]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD/mapillary-js/mapillary.min.js
Localisation updates from https://translatewiki.net.
[rails.git] / vendor / assets / iD / iD / mapillary-js / mapillary.min.js
1 (function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.Mapillary=e()}})(function(){var o,e,t;return function o(a,s,u){function c(r,e){if(!s[r]){if(!a[r]){var t=typeof require=="function"&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return c(t?t:e)},i,i.exports,o,a,s,u)}return s[r].exports}var l=typeof require=="function"&&require;for(var e=0;e<u.length;e++)c(u[e]);return c}({1:[function(e,t,r){"use strict";var b=e("tinyqueue");t.exports=n;t.exports.default=n;function n(e,t,r){t=t||1;var n,i,o,a;for(var s=0;s<e[0].length;s++){var u=e[0][s];if(!s||u[0]<n)n=u[0];if(!s||u[1]<i)i=u[1];if(!s||u[0]>o)o=u[0];if(!s||u[1]>a)a=u[1]}var c=o-n;var l=a-i;var h=Math.min(c,l);var p=h/2;var f=new b(null,x);if(h===0)return[n,i];for(var d=n;d<o;d+=h){for(var v=i;v<a;v+=h){f.push(new w(d+p,v+p,p,e))}}var m=S(e);var g=new w(n+c/2,i+l/2,0,e);if(g.d>m.d)m=g;var _=f.length;while(f.length){var y=f.pop();if(y.d>m.d){m=y;if(r)console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,_)}if(y.max-m.d<=t)continue;p=y.h/2;f.push(new w(y.x-p,y.y-p,p,e));f.push(new w(y.x+p,y.y-p,p,e));f.push(new w(y.x-p,y.y+p,p,e));f.push(new w(y.x+p,y.y+p,p,e));_+=4}if(r){console.log("num probes: "+_);console.log("best distance: "+m.d)}return[m.x,m.y]}function x(e,t){return t.max-e.max}function w(e,t,r,n){this.x=e;this.y=t;this.h=r;this.d=i(e,t,n);this.max=this.d+this.h*Math.SQRT2}function i(e,t,r){var n=false;var i=Infinity;for(var o=0;o<r.length;o++){var a=r[o];for(var s=0,u=a.length,c=u-1;s<u;c=s++){var l=a[s];var h=a[c];if(l[1]>t!==h[1]>t&&e<(h[0]-l[0])*(t-l[1])/(h[1]-l[1])+l[0])n=!n;i=Math.min(i,p(e,t,l,h))}}return(n?1:-1)*Math.sqrt(i)}function S(e){var t=0;var r=0;var n=0;var i=e[0];for(var o=0,a=i.length,s=a-1;o<a;s=o++){var u=i[o];var c=i[s];var l=u[0]*c[1]-c[0]*u[1];r+=(u[0]+c[0])*l;n+=(u[1]+c[1])*l;t+=l*3}if(t===0)return new w(i[0][0],i[0][1],0,e);return new w(r/t,n/t,0,e)}function p(e,t,r,n){var i=r[0];var o=r[1];var a=n[0]-i;var s=n[1]-o;if(a!==0||s!==0){var u=((e-i)*a+(t-o)*s)/(a*a+s*s);if(u>1){i=n[0];o=n[1]}else if(u>0){i+=a*u;o+=s*u}}a=e-i;s=t-o;return a*a+s*s}},{tinyqueue:243}],2:[function(e,t,r){t.exports=n;function n(e,t,r,n){this.cx=3*e;this.bx=3*(r-e)-this.cx;this.ax=1-this.cx-this.bx;this.cy=3*t;this.by=3*(n-t)-this.cy;this.ay=1-this.cy-this.by;this.p1x=e;this.p1y=n;this.p2x=r;this.p2y=n}n.prototype.sampleCurveX=function(e){return((this.ax*e+this.bx)*e+this.cx)*e};n.prototype.sampleCurveY=function(e){return((this.ay*e+this.by)*e+this.cy)*e};n.prototype.sampleCurveDerivativeX=function(e){return(3*this.ax*e+2*this.bx)*e+this.cx};n.prototype.solveCurveX=function(e,t){if(typeof t==="undefined")t=1e-6;var r,n,i,o,a;for(i=e,a=0;a<8;a++){o=this.sampleCurveX(i)-e;if(Math.abs(o)<t)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i=i-o/s}r=0;n=1;i=e;if(i<r)return r;if(i>n)return n;while(r<n){o=this.sampleCurveX(i);if(Math.abs(o-e)<t)return i;if(e>o){r=i}else{n=i}i=(n-r)*.5+r}return i};n.prototype.solve=function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},{}],3:[function(e,t,r){"use strict";r.byteLength=a;r.toByteArray=s;r.fromByteArray=d;var c=[];var u=[];var l=typeof Uint8Array!=="undefined"?Uint8Array:Array;var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,o=n.length;i<o;++i){c[i]=n[i];u[n.charCodeAt(i)]=i}u["-".charCodeAt(0)]=62;u["_".charCodeAt(0)]=63;function h(e){var t=e.length;if(t%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return e[t-2]==="="?2:e[t-1]==="="?1:0}function a(e){return e.length*3/4-h(e)}function s(e){var t,r,n,i,o;var a=e.length;i=h(e);o=new l(a*3/4-i);r=i>0?a-4:a;var s=0;for(t=0;t<r;t+=4){n=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)];o[s++]=n>>16&255;o[s++]=n>>8&255;o[s++]=n&255}if(i===2){n=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4;o[s++]=n&255}else if(i===1){n=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2;o[s++]=n>>8&255;o[s++]=n&255}return o}function p(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[e&63]}function f(e,t,r){var n;var i=[];for(var o=t;o<r;o+=3){n=(e[o]<<16)+(e[o+1]<<8)+e[o+2];i.push(p(n))}return i.join("")}function d(e){var t;var r=e.length;var n=r%3;var i="";var o=[];var a=16383;for(var s=0,u=r-n;s<u;s+=a){o.push(f(e,s,s+a>u?u:s+a))}if(n===1){t=e[r-1];i+=c[t>>2];i+=c[t<<4&63];i+="=="}else if(n===2){t=(e[r-2]<<8)+e[r-1];i+=c[t>>10];i+=c[t>>4&63];i+=c[t<<2&63];i+="="}o.push(i);return o.join("")}},{}],4:[function(e,t,r){},{}],5:[function(e,t,r){t.exports=function e(l){var h=String.prototype.split,p=/()??/.exec("")[1]===l,t;t=function(e,t,r){if(Object.prototype.toString.call(t)!=="[object RegExp]"){return h.call(e,t,r)}var n=[],i=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),o=0,t=new RegExp(t.source,i+"g"),a,s,u,c;e+="";if(!p){a=new RegExp("^"+t.source+"$(?!\\s)",i)}r=r===l?-1>>>0:r>>>0;while(s=t.exec(e)){u=s.index+s[0].length;if(u>o){n.push(e.slice(o,s.index));if(!p&&s.length>1){s[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++){if(arguments[e]===l){s[e]=l}}})}if(s.length>1&&s.index<e.length){Array.prototype.push.apply(n,s.slice(1))}c=s[0].length;o=u;if(n.length>=r){break}}if(t.lastIndex===s.index){t.lastIndex++}}if(o===e.length){if(c||!t.test("")){n.push("")}}else{n.push(e.slice(o))}return n.length>r?n.slice(0,r):n};return t}()},{}],6:[function(e,t,n){"use strict";var i=e("base64-js");var o=e("ieee754");n.Buffer=p;n.SlowBuffer=_;n.INSPECT_MAX_BYTES=50;var r=2147483647;n.kMaxLength=r;p.TYPED_ARRAY_SUPPORT=a();if(!p.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}function a(){try{var e=new Uint8Array(1);e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return e.foo()===42}catch(e){return false}}Object.defineProperty(p.prototype,"parent",{enumerable:true,get:function(){if(!p.isBuffer(this))return undefined;return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:true,get:function(){if(!p.isBuffer(this))return undefined;return this.byteOffset}});function s(e){if(e>r){throw new RangeError('The value "'+e+'" is invalid for option "size"')}var t=new Uint8Array(e);t.__proto__=p.prototype;return t}function p(e,t,r){if(typeof e==="number"){if(typeof t==="string"){throw new TypeError('The "string" argument must be of type string. Received type number')}return h(e)}return u(e,t,r)}if(typeof Symbol!=="undefined"&&Symbol.species!=null&&p[Symbol.species]===p){Object.defineProperty(p,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}p.poolSize=8192;function u(e,t,r){if(typeof e==="string"){return f(e,t)}if(ArrayBuffer.isView(e)){return d(e)}if(e==null){throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof e)}if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer)){return v(e,t,r)}if(typeof e==="number"){throw new TypeError('The "value" argument must not be of type number. Received type number')}var n=e.valueOf&&e.valueOf();if(n!=null&&n!==e){return p.from(n,t,r)}var i=m(e);if(i)return i;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==="function"){return p.from(e[Symbol.toPrimitive]("string"),t,r)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof e)}p.from=function(e,t,r){return u(e,t,r)};p.prototype.__proto__=Uint8Array.prototype;p.__proto__=Uint8Array;function c(e){if(typeof e!=="number"){throw new TypeError('"size" argument must be of type number')}else if(e<0){throw new RangeError('The value "'+e+'" is invalid for option "size"')}}function l(e,t,r){c(e);if(e<=0){return s(e)}if(t!==undefined){return typeof r==="string"?s(e).fill(t,r):s(e).fill(t)}return s(e)}p.alloc=function(e,t,r){return l(e,t,r)};function h(e){c(e);return s(e<0?0:g(e)|0)}p.allocUnsafe=function(e){return h(e)};p.allocUnsafeSlow=function(e){return h(e)};function f(e,t){if(typeof t!=="string"||t===""){t="utf8"}if(!p.isEncoding(t)){throw new TypeError("Unknown encoding: "+t)}var r=y(e,t)|0;var n=s(r);var i=n.write(e,t);if(i!==r){n=n.slice(0,i)}return n}function d(e){var t=e.length<0?0:g(e.length)|0;var r=s(t);for(var n=0;n<t;n+=1){r[n]=e[n]&255}return r}function v(e,t,r){if(t<0||e.byteLength<t){throw new RangeError('"offset" is outside of buffer bounds')}if(e.byteLength<t+(r||0)){throw new RangeError('"length" is outside of buffer bounds')}var n;if(t===undefined&&r===undefined){n=new Uint8Array(e)}else if(r===undefined){n=new Uint8Array(e,t)}else{n=new Uint8Array(e,t,r)}n.__proto__=p.prototype;return n}function m(e){if(p.isBuffer(e)){var t=g(e.length)|0;var r=s(t);if(r.length===0){return r}e.copy(r,0,0,t);return r}if(e.length!==undefined){if(typeof e.length!=="number"||J(e.length)){return s(0)}return d(e)}if(e.type==="Buffer"&&Array.isArray(e.data)){return d(e.data)}}function g(e){if(e>=r){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+r.toString(16)+" bytes")}return e|0}function _(e){if(+e!=e){e=0}return p.alloc(+e)}p.isBuffer=function e(t){return t!=null&&t._isBuffer===true&&t!==p.prototype};p.compare=function e(t,r){if(Z(t,Uint8Array))t=p.from(t,t.offset,t.byteLength);if(Z(r,Uint8Array))r=p.from(r,r.offset,r.byteLength);if(!p.isBuffer(t)||!p.isBuffer(r)){throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array')}if(t===r)return 0;var n=t.length;var i=r.length;for(var o=0,a=Math.min(n,i);o<a;++o){if(t[o]!==r[o]){n=t[o];i=r[o];break}}if(n<i)return-1;if(i<n)return 1;return 0};p.isEncoding=function e(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};p.concat=function e(t,r){if(!Array.isArray(t)){throw new TypeError('"list" argument must be an Array of Buffers')}if(t.length===0){return p.alloc(0)}var n;if(r===undefined){r=0;for(n=0;n<t.length;++n){r+=t[n].length}}var i=p.allocUnsafe(r);var o=0;for(n=0;n<t.length;++n){var a=t[n];if(Z(a,Uint8Array)){a=p.from(a)}if(!p.isBuffer(a)){throw new TypeError('"list" argument must be an Array of Buffers')}a.copy(i,o);o+=a.length}return i};function y(e,t){if(p.isBuffer(e)){return e.length}if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer)){return e.byteLength}if(typeof e!=="string"){throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. '+"Received type "+typeof e)}var r=e.length;var n=arguments.length>2&&arguments[2]===true;if(!n&&r===0)return 0;var i=false;for(;;){switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(i){return n?-1:q(e).length}t=(""+t).toLowerCase();i=true}}}p.byteLength=y;function b(e,t,r){var n=false;if(t===undefined||t<0){t=0}if(t>this.length){return""}if(r===undefined||r>this.length){r=this.length}if(r<=0){return""}r>>>=0;t>>>=0;if(r<=t){return""}if(!e)e="utf8";while(true){switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return j(this,t,r);case"ascii":return L(this,t,r);case"latin1":case"binary":return N(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}}p.prototype._isBuffer=true;function x(e,t,r){var n=e[t];e[t]=e[r];e[r]=n}p.prototype.swap16=function e(){var t=this.length;if(t%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var r=0;r<t;r+=2){x(this,r,r+1)}return this};p.prototype.swap32=function e(){var t=this.length;if(t%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var r=0;r<t;r+=4){x(this,r,r+3);x(this,r+1,r+2)}return this};p.prototype.swap64=function e(){var t=this.length;if(t%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var r=0;r<t;r+=8){x(this,r,r+7);x(this,r+1,r+6);x(this,r+2,r+5);x(this,r+3,r+4)}return this};p.prototype.toString=function e(){var t=this.length;if(t===0)return"";if(arguments.length===0)return j(this,0,t);return b.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function e(t){if(!p.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(this===t)return true;return p.compare(this,t)===0};p.prototype.inspect=function e(){var t="";var r=n.INSPECT_MAX_BYTES;t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim();if(this.length>r)t+=" ... ";return"<Buffer "+t+">"};p.prototype.compare=function e(t,r,n,i,o){if(Z(t,Uint8Array)){t=p.from(t,t.offset,t.byteLength)}if(!p.isBuffer(t)){throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. '+"Received type "+typeof t)}if(r===undefined){r=0}if(n===undefined){n=t?t.length:0}if(i===undefined){i=0}if(o===undefined){o=this.length}if(r<0||n>t.length||i<0||o>this.length){throw new RangeError("out of range index")}if(i>=o&&r>=n){return 0}if(i>=o){return-1}if(r>=n){return 1}r>>>=0;n>>>=0;i>>>=0;o>>>=0;if(this===t)return 0;var a=o-i;var s=n-r;var u=Math.min(a,s);var c=this.slice(i,o);var l=t.slice(r,n);for(var h=0;h<u;++h){if(c[h]!==l[h]){a=c[h];s=l[h];break}}if(a<s)return-1;if(s<a)return 1;return 0};function w(e,t,r,n,i){if(e.length===0)return-1;if(typeof r==="string"){n=r;r=0}else if(r>2147483647){r=2147483647}else if(r<-2147483648){r=-2147483648}r=+r;if(J(r)){r=i?0:e.length-1}if(r<0)r=e.length+r;if(r>=e.length){if(i)return-1;else r=e.length-1}else if(r<0){if(i)r=0;else return-1}if(typeof t==="string"){t=p.from(t,n)}if(p.isBuffer(t)){if(t.length===0){return-1}return S(e,t,r,n,i)}else if(typeof t==="number"){t=t&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(i){return Uint8Array.prototype.indexOf.call(e,t,r)}else{return Uint8Array.prototype.lastIndexOf.call(e,t,r)}}return S(e,[t],r,n,i)}throw new TypeError("val must be string, number or Buffer")}function S(e,t,r,n,i){var o=1;var a=e.length;var s=t.length;if(n!==undefined){n=String(n).toLowerCase();if(n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le"){if(e.length<2||t.length<2){return-1}o=2;a/=2;s/=2;r/=2}}function u(e,t){if(o===1){return e[t]}else{return e.readUInt16BE(t*o)}}var c;if(i){var l=-1;for(c=r;c<a;c++){if(u(e,c)===u(t,l===-1?0:c-l)){if(l===-1)l=c;if(c-l+1===s)return l*o}else{if(l!==-1)c-=c-l;l=-1}}}else{if(r+s>a)r=a-s;for(c=r;c>=0;c--){var h=true;for(var p=0;p<s;p++){if(u(e,c+p)!==u(t,p)){h=false;break}}if(h)return c}}return-1}p.prototype.includes=function e(t,r,n){return this.indexOf(t,r,n)!==-1};p.prototype.indexOf=function e(t,r,n){return w(this,t,r,n,true)};p.prototype.lastIndexOf=function e(t,r,n){return w(this,t,r,n,false)};function M(e,t,r,n){r=Number(r)||0;var i=e.length-r;if(!n){n=i}else{n=Number(n);if(n>i){n=i}}var o=t.length;if(n>o/2){n=o/2}for(var a=0;a<n;++a){var s=parseInt(t.substr(a*2,2),16);if(J(s))return a;e[r+a]=s}return a}function C(e,t,r,n){return K(q(t,e.length-r),e,r,n)}function T(e,t,r,n){return K(W(t),e,r,n)}function E(e,t,r,n){return T(e,t,r,n)}function O(e,t,r,n){return K(Y(t),e,r,n)}function P(e,t,r,n){return K(X(t,e.length-r),e,r,n)}p.prototype.write=function e(t,r,n,i){if(r===undefined){i="utf8";n=this.length;r=0}else if(n===undefined&&typeof r==="string"){i=r;n=this.length;r=0}else if(isFinite(r)){r=r>>>0;if(isFinite(n)){n=n>>>0;if(i===undefined)i="utf8"}else{i=n;n=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var o=this.length-r;if(n===undefined||n>o)n=o;if(t.length>0&&(n<0||r<0)||r>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!i)i="utf8";var a=false;for(;;){switch(i){case"hex":return M(this,t,r,n);case"utf8":case"utf-8":return C(this,t,r,n);case"ascii":return T(this,t,r,n);case"latin1":case"binary":return E(this,t,r,n);case"base64":return O(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase();a=true}}};p.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,r){if(t===0&&r===e.length){return i.fromByteArray(e)}else{return i.fromByteArray(e.slice(t,r))}}function j(e,t,r){r=Math.min(e.length,r);var n=[];var i=t;while(i<r){var o=e[i];var a=null;var s=o>239?4:o>223?3:o>191?2:1;if(i+s<=r){var u,c,l,h;switch(s){case 1:if(o<128){a=o}break;case 2:u=e[i+1];if((u&192)===128){h=(o&31)<<6|u&63;if(h>127){a=h}}break;case 3:u=e[i+1];c=e[i+2];if((u&192)===128&&(c&192)===128){h=(o&15)<<12|(u&63)<<6|c&63;if(h>2047&&(h<55296||h>57343)){a=h}}break;case 4:u=e[i+1];c=e[i+2];l=e[i+3];if((u&192)===128&&(c&192)===128&&(l&192)===128){h=(o&15)<<18|(u&63)<<12|(c&63)<<6|l&63;if(h>65535&&h<1114112){a=h}}}}if(a===null){a=65533;s=1}else if(a>65535){a-=65536;n.push(a>>>10&1023|55296);a=56320|a&1023}n.push(a);i+=s}return k(n)}var R=4096;function k(e){var t=e.length;if(t<=R){return String.fromCharCode.apply(String,e)}var r="";var n=0;while(n<t){r+=String.fromCharCode.apply(String,e.slice(n,n+=R))}return r}function L(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i){n+=String.fromCharCode(e[i]&127)}return n}function N(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i){n+=String.fromCharCode(e[i])}return n}function I(e,t,r){var n=e.length;if(!t||t<0)t=0;if(!r||r<0||r>n)r=n;var i="";for(var o=t;o<r;++o){i+=U(e[o])}return i}function D(e,t,r){var n=e.slice(t,r);var i="";for(var o=0;o<n.length;o+=2){i+=String.fromCharCode(n[o]+n[o+1]*256)}return i}p.prototype.slice=function e(t,r){var n=this.length;t=~~t;r=r===undefined?n:~~r;if(t<0){t+=n;if(t<0)t=0}else if(t>n){t=n}if(r<0){r+=n;if(r<0)r=0}else if(r>n){r=n}if(r<t)r=t;var i=this.subarray(t,r);i.__proto__=p.prototype;return i};function B(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUIntLE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n)B(t,r,this.length);var i=this[t];var o=1;var a=0;while(++a<r&&(o*=256)){i+=this[t+a]*o}return i};p.prototype.readUIntBE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n){B(t,r,this.length)}var i=this[t+--r];var o=1;while(r>0&&(o*=256)){i+=this[t+--r]*o}return i};p.prototype.readUInt8=function e(t,r){t=t>>>0;if(!r)B(t,1,this.length);return this[t]};p.prototype.readUInt16LE=function e(t,r){t=t>>>0;if(!r)B(t,2,this.length);return this[t]|this[t+1]<<8};p.prototype.readUInt16BE=function e(t,r){t=t>>>0;if(!r)B(t,2,this.length);return this[t]<<8|this[t+1]};p.prototype.readUInt32LE=function e(t,r){t=t>>>0;if(!r)B(t,4,this.length);return(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};p.prototype.readUInt32BE=function e(t,r){t=t>>>0;if(!r)B(t,4,this.length);return this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};p.prototype.readIntLE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n)B(t,r,this.length);var i=this[t];var o=1;var a=0;while(++a<r&&(o*=256)){i+=this[t+a]*o}o*=128;if(i>=o)i-=Math.pow(2,8*r);return i};p.prototype.readIntBE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n)B(t,r,this.length);var i=r;var o=1;var a=this[t+--i];while(i>0&&(o*=256)){a+=this[t+--i]*o}o*=128;if(a>=o)a-=Math.pow(2,8*r);return a};p.prototype.readInt8=function e(t,r){t=t>>>0;if(!r)B(t,1,this.length);if(!(this[t]&128))return this[t];return(255-this[t]+1)*-1};p.prototype.readInt16LE=function e(t,r){t=t>>>0;if(!r)B(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function e(t,r){t=t>>>0;if(!r)B(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function e(t,r){t=t>>>0;if(!r)B(t,4,this.length);return this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};p.prototype.readInt32BE=function e(t,r){t=t>>>0;if(!r)B(t,4,this.length);return this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};p.prototype.readFloatLE=function e(t,r){t=t>>>0;if(!r)B(t,4,this.length);return o.read(this,t,true,23,4)};p.prototype.readFloatBE=function e(t,r){t=t>>>0;if(!r)B(t,4,this.length);return o.read(this,t,false,23,4)};p.prototype.readDoubleLE=function e(t,r){t=t>>>0;if(!r)B(t,8,this.length);return o.read(this,t,true,52,8)};p.prototype.readDoubleBE=function e(t,r){t=t>>>0;if(!r)B(t,8,this.length);return o.read(this,t,false,52,8)};function F(e,t,r,n,i,o){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}p.prototype.writeUIntLE=function e(t,r,n,i){t=+t;r=r>>>0;n=n>>>0;if(!i){var o=Math.pow(2,8*n)-1;F(this,t,r,n,o,0)}var a=1;var s=0;this[r]=t&255;while(++s<n&&(a*=256)){this[r+s]=t/a&255}return r+n};p.prototype.writeUIntBE=function e(t,r,n,i){t=+t;r=r>>>0;n=n>>>0;if(!i){var o=Math.pow(2,8*n)-1;F(this,t,r,n,o,0)}var a=n-1;var s=1;this[r+a]=t&255;while(--a>=0&&(s*=256)){this[r+a]=t/s&255}return r+n};p.prototype.writeUInt8=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,1,255,0);this[r]=t&255;return r+1};p.prototype.writeUInt16LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,2,65535,0);this[r]=t&255;this[r+1]=t>>>8;return r+2};p.prototype.writeUInt16BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,2,65535,0);this[r]=t>>>8;this[r+1]=t&255;return r+2};p.prototype.writeUInt32LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,4,4294967295,0);this[r+3]=t>>>24;this[r+2]=t>>>16;this[r+1]=t>>>8;this[r]=t&255;return r+4};p.prototype.writeUInt32BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,4,4294967295,0);this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255;return r+4};p.prototype.writeIntLE=function e(t,r,n,i){t=+t;r=r>>>0;if(!i){var o=Math.pow(2,8*n-1);F(this,t,r,n,o-1,-o)}var a=0;var s=1;var u=0;this[r]=t&255;while(++a<n&&(s*=256)){if(t<0&&u===0&&this[r+a-1]!==0){u=1}this[r+a]=(t/s>>0)-u&255}return r+n};p.prototype.writeIntBE=function e(t,r,n,i){t=+t;r=r>>>0;if(!i){var o=Math.pow(2,8*n-1);F(this,t,r,n,o-1,-o)}var a=n-1;var s=1;var u=0;this[r+a]=t&255;while(--a>=0&&(s*=256)){if(t<0&&u===0&&this[r+a+1]!==0){u=1}this[r+a]=(t/s>>0)-u&255}return r+n};p.prototype.writeInt8=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,1,127,-128);if(t<0)t=255+t+1;this[r]=t&255;return r+1};p.prototype.writeInt16LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,2,32767,-32768);this[r]=t&255;this[r+1]=t>>>8;return r+2};p.prototype.writeInt16BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,2,32767,-32768);this[r]=t>>>8;this[r+1]=t&255;return r+2};p.prototype.writeInt32LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,4,2147483647,-2147483648);this[r]=t&255;this[r+1]=t>>>8;this[r+2]=t>>>16;this[r+3]=t>>>24;return r+4};p.prototype.writeInt32BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)F(this,t,r,4,2147483647,-2147483648);if(t<0)t=4294967295+t+1;this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255;return r+4};function z(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(e,t,r,n,i){t=+t;r=r>>>0;if(!i){z(e,t,r,4,34028234663852886e22,-34028234663852886e22)}o.write(e,t,r,n,23,4);return r+4}p.prototype.writeFloatLE=function e(t,r,n){return $(this,t,r,true,n)};p.prototype.writeFloatBE=function e(t,r,n){return $(this,t,r,false,n)};function G(e,t,r,n,i){t=+t;r=r>>>0;if(!i){z(e,t,r,8,17976931348623157e292,-17976931348623157e292)}o.write(e,t,r,n,52,8);return r+8}p.prototype.writeDoubleLE=function e(t,r,n){return G(this,t,r,true,n)};p.prototype.writeDoubleBE=function e(t,r,n){return G(this,t,r,false,n)};p.prototype.copy=function e(t,r,n,i){if(!p.isBuffer(t))throw new TypeError("argument should be a Buffer");if(!n)n=0;if(!i&&i!==0)i=this.length;if(r>=t.length)r=t.length;if(!r)r=0;if(i>0&&i<n)i=n;if(i===n)return 0;if(t.length===0||this.length===0)return 0;if(r<0){throw new RangeError("targetStart out of bounds")}if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(t.length-r<i-n){i=t.length-r+n}var o=i-n;if(this===t&&typeof Uint8Array.prototype.copyWithin==="function"){this.copyWithin(r,n,i)}else if(this===t&&n<r&&r<i){for(var a=o-1;a>=0;--a){t[a+r]=this[a+n]}}else{Uint8Array.prototype.set.call(t,this.subarray(n,i),r)}return o};p.prototype.fill=function e(t,r,n,i){if(typeof t==="string"){if(typeof r==="string"){i=r;r=0;n=this.length}else if(typeof n==="string"){i=n;n=this.length}if(i!==undefined&&typeof i!=="string"){throw new TypeError("encoding must be a string")}if(typeof i==="string"&&!p.isEncoding(i)){throw new TypeError("Unknown encoding: "+i)}if(t.length===1){var o=t.charCodeAt(0);if(i==="utf8"&&o<128||i==="latin1"){t=o}}}else if(typeof t==="number"){t=t&255}if(r<0||this.length<r||this.length<n){throw new RangeError("Out of range index")}if(n<=r){return this}r=r>>>0;n=n===undefined?this.length:n>>>0;if(!t)t=0;var a;if(typeof t==="number"){for(a=r;a<n;++a){this[a]=t}}else{var s=p.isBuffer(t)?t:p.from(t,i);var u=s.length;if(u===0){throw new TypeError('The value "'+t+'" is invalid for argument "value"')}for(a=0;a<n-r;++a){this[a+r]=s[a%u]}}return this};var V=/[^+/0-9A-Za-z-_]/g;function H(e){e=e.split("=")[0];e=e.trim().replace(V,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function U(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function q(e,t){t=t||Infinity;var r;var n=e.length;var i=null;var o=[];for(var a=0;a<n;++a){r=e.charCodeAt(a);if(r>55295&&r<57344){if(!i){if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(a+1===n){if((t-=3)>-1)o.push(239,191,189);continue}i=r;continue}if(r<56320){if((t-=3)>-1)o.push(239,191,189);i=r;continue}r=(i-55296<<10|r-56320)+65536}else if(i){if((t-=3)>-1)o.push(239,191,189)}i=null;if(r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return o}function W(e){var t=[];for(var r=0;r<e.length;++r){t.push(e.charCodeAt(r)&255)}return t}function X(e,t){var r,n,i;var o=[];for(var a=0;a<e.length;++a){if((t-=2)<0)break;r=e.charCodeAt(a);n=r>>8;i=r%256;o.push(i);o.push(n)}return o}function Y(e){return i.toByteArray(H(e))}function K(e,t,r,n){for(var i=0;i<n;++i){if(i+r>=t.length||i>=e.length)break;t[i+r]=e[i]}return i}function Z(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function J(e){return e!==e}},{"base64-js":3,ieee754:17}],7:[function(e,t,r){var n=t.exports={};var i;var o;function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){i=setTimeout}else{i=a}}catch(e){i=a}try{if(typeof clearTimeout==="function"){o=clearTimeout}else{o=s}}catch(e){o=s}})();function u(t){if(i===setTimeout){return setTimeout(t,0)}if((i===a||!i)&&setTimeout){i=setTimeout;return setTimeout(t,0)}try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}function c(t){if(o===clearTimeout){return clearTimeout(t)}if((o===s||!o)&&clearTimeout){o=clearTimeout;return clearTimeout(t)}try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}var l=[];var h=false;var p;var f=-1;function d(){if(!h||!p){return}h=false;if(p.length){l=p.concat(l)}else{f=-1}if(l.length){v()}}function v(){if(h){return}var e=u(d);h=true;var t=l.length;while(t){p=l;l=[];while(++f<t){if(p){p[f].run()}}f=-1;t=l.length}p=null;h=false;c(e)}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}}l.push(new m(e,t));if(l.length===1&&!h){u(v)}};function m(e,t){this.fun=e;this.array=t}m.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function g(){}n.on=g;n.addListener=g;n.once=g;n.off=g;n.removeListener=g;n.removeAllListeners=g;n.emit=g;n.prependListener=g;n.prependOnceListener=g;n.listeners=function(e){return[]};n.binding=function(e){throw new Error("process.binding is not supported")};n.cwd=function(){return"/"};n.chdir=function(e){throw new Error("process.chdir is not supported")};n.umask=function(){return 0}},{}],8:[function(e,t,r){"use strict";t.exports=n;t.exports.default=n;function n(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=v(e,0,i,r,true),a=[];if(!o||o.next===o.prev)return a;var s,u,c,l,h,p,f;if(n)o=g(e,t,o,r);if(e.length>80*r){s=c=e[0];u=l=e[1];for(var d=r;d<i;d+=r){h=e[d];p=e[d+1];if(h<s)s=h;if(p<u)u=p;if(h>c)c=h;if(p>l)l=p}f=Math.max(c-s,l-u);f=f!==0?1/f:0}m(o,a,r,s,u,f);return a}function v(e,t,r,n,i){var o,a;if(i===L(e,t,r,n)>0){for(o=t;o<r;o+=n)a=j(o,e[o],e[o+1],a)}else{for(o=r-n;o>=t;o-=n)a=j(o,e[o],e[o+1],a)}if(a&&s(a,a.next)){R(a);a=a.next}return a}function l(e,t){if(!e)return e;if(!t)t=e;var r=e,n;do{n=false;if(!r.steiner&&(s(r,r.next)||C(r.prev,r,r.next)===0)){R(r);r=t=r.prev;if(r===r.next)break;n=true}else{r=r.next}}while(n||r!==t);return t}function m(e,t,r,n,i,o,a){if(!e)return;if(!a&&o)x(e,n,i,o);var s=e,u,c;while(e.prev!==e.next){u=e.prev;c=e.next;if(o?p(e,n,i,o):h(e)){t.push(u.i/r);t.push(e.i/r);t.push(c.i/r);R(e);e=c.next;s=c.next;continue}e=c;if(e===s){if(!a){m(l(e),t,r,n,i,o,1)}else if(a===1){e=f(l(e),t,r);m(e,t,r,n,i,o,2)}else if(a===2){d(e,t,r,n,i,o)}break}}}function h(e){var t=e.prev,r=e,n=e.next;if(C(t,r,n)>=0)return false;var i=e.next.next;while(i!==e.prev){if(M(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&C(i.prev,i,i.next)>=0)return false;i=i.next}return true}function p(e,t,r,n){var i=e.prev,o=e,a=e.next;if(C(i,o,a)>=0)return false;var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,c=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,l=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y;var h=w(s,u,t,r,n),p=w(c,l,t,r,n);var f=e.prevZ,d=e.nextZ;while(f&&f.z>=h&&d&&d.z<=p){if(f!==e.prev&&f!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&C(f.prev,f,f.next)>=0)return false;f=f.prevZ;if(d!==e.prev&&d!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&C(d.prev,d,d.next)>=0)return false;d=d.nextZ}while(f&&f.z>=h){if(f!==e.prev&&f!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&C(f.prev,f,f.next)>=0)return false;f=f.prevZ}while(d&&d.z<=p){if(d!==e.prev&&d!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&C(d.prev,d,d.next)>=0)return false;d=d.nextZ}return true}function f(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;if(!s(i,o)&&a(i,n,n.next,o)&&O(i,o)&&O(o,i)){t.push(i.i/r);t.push(n.i/r);t.push(o.i/r);R(n);R(n.next);n=e=o}n=n.next}while(n!==e);return l(n)}function d(e,t,r,n,i,o){var a=e;do{var s=a.next.next;while(s!==a.prev){if(a.i!==s.i&&c(a,s)){var u=A(a,s);a=l(a,a.next);u=l(u,u.next);m(a,t,r,n,i,o);m(u,t,r,n,i,o);return}s=s.next}a=a.next}while(a!==e)}function g(e,t,r,n){var i=[],o,a,s,u,c;for(o=0,a=t.length;o<a;o++){s=t[o]*n;u=o<a-1?t[o+1]*n:e.length;c=v(e,s,u,n,false);if(c===c.next)c.steiner=true;i.push(S(c))}i.sort(_);for(o=0;o<i.length;o++){y(i[o],r);r=l(r,r.next)}return r}function _(e,t){return e.x-t.x}function y(e,t){t=i(e,t);if(t){var r=A(t,e);l(t,t.next);l(r,r.next)}}function i(e,t){var r=t,n=e.x,i=e.y,o=-Infinity,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o){o=s;if(s===n){if(i===r.y)return r;if(i===r.next.y)return r.next}a=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!a)return null;if(n===o)return a;var u=a,c=a.x,l=a.y,h=Infinity,p;r=a;do{if(n>=r.x&&r.x>=c&&n!==r.x&&M(i<l?n:o,i,c,l,i<l?o:n,i,r.x,r.y)){p=Math.abs(i-r.y)/(n-r.x);if(O(r,e)&&(p<h||p===h&&(r.x>a.x||r.x===a.x&&b(a,r)))){a=r;h=p}}r=r.next}while(r!==u);return a}function b(e,t){return C(e.prev,e,t.prev)<0&&C(t.next,e,e.next)<0}function x(e,t,r,n){var i=e;do{if(i.z===null)i.z=w(i.x,i.y,t,r,n);i.prevZ=i.prev;i.nextZ=i.next;i=i.next}while(i!==e);i.prevZ.nextZ=null;i.prevZ=null;o(i)}function o(e){var t,r,n,i,o,a,s,u,c=1;do{r=e;e=null;o=null;a=0;while(r){a++;n=r;s=0;for(t=0;t<c;t++){s++;n=n.nextZ;if(!n)break}u=c;while(s>0||u>0&&n){if(s!==0&&(u===0||!n||r.z<=n.z)){i=r;r=r.nextZ;s--}else{i=n;n=n.nextZ;u--}if(o)o.nextZ=i;else e=i;i.prevZ=o;o=i}r=n}o.nextZ=null;c*=2}while(a>1);return e}function w(e,t,r,n,i){e=32767*(e-r)*i;t=32767*(t-n)*i;e=(e|e<<8)&16711935;e=(e|e<<4)&252645135;e=(e|e<<2)&858993459;e=(e|e<<1)&1431655765;t=(t|t<<8)&16711935;t=(t|t<<4)&252645135;t=(t|t<<2)&858993459;t=(t|t<<1)&1431655765;return e|t<<1}function S(e){var t=e,r=e;do{if(t.x<r.x||t.x===r.x&&t.y<r.y)r=t;t=t.next}while(t!==e);return r}function M(e,t,r,n,i,o,a,s){return(i-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(n-s)-(r-a)*(t-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function c(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!E(e,t)&&(O(e,t)&&O(t,e)&&P(e,t)&&(C(e.prev,e,t.prev)||C(e,t.prev,t))||s(e,t)&&C(e.prev,e,e.next)>0&&C(t.prev,t,t.next)>0)}function C(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function s(e,t){return e.x===t.x&&e.y===t.y}function a(e,t,r,n){var i=T(C(e,t,r));var o=T(C(e,t,n));var a=T(C(r,n,e));var s=T(C(r,n,t));if(i!==o&&a!==s)return true;if(i===0&&u(e,r,t))return true;if(o===0&&u(e,n,t))return true;if(a===0&&u(r,e,n))return true;if(s===0&&u(r,t,n))return true;return false}function u(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function T(e){return e>0?1:e<0?-1:0}function E(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&a(r,r.next,e,t))return true;r=r.next}while(r!==e);return false}function O(e,t){return C(e.prev,e,e.next)<0?C(e,t,e.next)>=0&&C(e,e.prev,t)>=0:C(e,t,e.prev)<0||C(e,e.next,t)<0}function P(e,t){var r=e,n=false,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{if(r.y>o!==r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x)n=!n;r=r.next}while(r!==e);return n}function A(e,t){var r=new k(e.i,e.x,e.y),n=new k(t.i,t.x,t.y),i=e.next,o=t.prev;e.next=t;t.prev=e;r.next=i;i.prev=r;n.next=r;r.prev=n;o.next=n;n.prev=o;return n}function j(e,t,r,n){var i=new k(e,t,r);if(!n){i.prev=i;i.next=i}else{i.next=n.next;i.prev=n;n.next.prev=i;n.next=i}return i}function R(e){e.next.prev=e.prev;e.prev.next=e.next;if(e.prevZ)e.prevZ.nextZ=e.nextZ;if(e.nextZ)e.nextZ.prevZ=e.prevZ}function k(e,t,r){this.i=e;this.x=t;this.y=r;this.prev=null;this.next=null;this.z=null;this.prevZ=null;this.nextZ=null;this.steiner=false}n.deviation=function(e,t,r,n){var i=t&&t.length;var o=i?t[0]*r:e.length;var a=Math.abs(L(e,0,o,r));if(i){for(var s=0,u=t.length;s<u;s++){var c=t[s]*r;var l=s<u-1?t[s+1]*r:e.length;a-=Math.abs(L(e,c,l,r))}}var h=0;for(s=0;s<n.length;s+=3){var p=n[s]*r;var f=n[s+1]*r;var d=n[s+2]*r;h+=Math.abs((e[p]-e[d])*(e[f+1]-e[p+1])-(e[p]-e[f])*(e[d+1]-e[p+1]))}return a===0&&h===0?0:Math.abs((h-a)/a)};function L(e,t,r,n){var i=0;for(var o=t,a=r-n;o<r;o+=n){i+=(e[a]-e[o])*(e[o+1]+e[a+1]);a=o}return i}n.flatten=function(e){var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0;for(var i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++){for(var a=0;a<t;a++)r.vertices.push(e[i][o][a])}if(i>0){n+=e[i-1].length;r.holes.push(n)}}return r}},{}],9:[function(e,t,r){"use strict";var n=e("individual/one-version");var i="7";n("ev-store",i);var o="__EV_STORE_KEY@"+i;t.exports=a;function a(e){var t=e[o];if(!t){t=e[o]={}}return t}},{"individual/one-version":19}],10:[function(e,t,r){"use strict";var l=e("./request");var n=e("./buildQueryObject");var i=Array.isArray;function h(e,t){var r;for(r in t){e[r]=t[r]}return e}function o(e,t){this._jsongUrl=e;if(typeof t==="number"){var r={timeout:t};t=r}this._config=h({timeout:15e3,headers:{}},t||{})}o.prototype={constructor:o,buildQueryObject:n,get:function e(t){var r="GET";var n=this.buildQueryObject(this._jsongUrl,r,{paths:t,method:"get"});var i=h(n,this._config);var o=this;return l(r,i,o)},set:function e(t){var r="POST";var n=this.buildQueryObject(this._jsongUrl,r,{jsonGraph:t,method:"set"});var i=h(n,this._config);i.headers["Content-Type"]="application/x-www-form-urlencoded";var o=this;return l(r,i,o)},call:function e(t,r,n,i){r=r||[];n=n||[];i=i||[];var o="POST";var a=[];a.push("method=call");a.push("callPath="+encodeURIComponent(JSON.stringify(t)));a.push("arguments="+encodeURIComponent(JSON.stringify(r)));a.push("pathSuffixes="+encodeURIComponent(JSON.stringify(n)));a.push("paths="+encodeURIComponent(JSON.stringify(i)));var s=this.buildQueryObject(this._jsongUrl,o,a.join("&"));var u=h(s,this._config);u.headers["Content-Type"]="application/x-www-form-urlencoded";var c=this;return l(o,u,c)}};o.XMLHttpSource=o;o["default"]=o;t.exports=o},{"./buildQueryObject":11,"./request":14}],11:[function(e,t,r){"use strict";t.exports=function e(t,r,n){var i=[];var o;var a={url:t};var s=t.indexOf("?")!==-1;var u=s?"&":"?";if(typeof n==="string"){i.push(n)}else{o=Object.keys(n);o.forEach(function(e){var t=typeof n[e]==="object"?JSON.stringify(n[e]):n[e];i.push(e+"="+encodeURIComponent(t))})}if(r==="GET"){a.url+=u+i.join("&")}else{a.data=i.join("&")}return a}},{}],12:[function(e,t,r){(function(r){"use strict";t.exports=function e(){var t=new r.XMLHttpRequest;if("withCredentials"in t){return t}else if(!!r.XDomainRequest){return new XDomainRequest}else{throw new Error("CORS is not supported by your browser")}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],13:[function(e,t,r){(function(i){"use strict";t.exports=function e(){var t,r,n;if(i.XMLHttpRequest){return new i.XMLHttpRequest}else{try{r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];for(n=0;n<3;n++){try{t=r[n];if(new i.ActiveXObject(t)){break}}catch(e){}}return new i.ActiveXObject(t)}catch(e){throw new Error("XMLHttpRequest is not supported by your browser")}}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],14:[function(e,t,r){"use strict";var h=e("./getXMLHttpRequest");var p=e("./getCORSRequest");var f=Object.prototype.hasOwnProperty;var a=function(){};function n(){}n.create=function(o){var e=new n;e.subscribe=function(e,t,r){var n;var i;if(typeof e==="function"){n={onNext:e,onError:t||a,onCompleted:r||a}}else{n=e}i=o(n);if(typeof i==="function"){return{dispose:i}}else{return i}};return e};function i(u,c,l){return n.create(function e(r){var t={method:u||"GET",crossDomain:false,async:true,headers:{},responseType:"json"};var n,i,o,a,s;for(s in c){if(f.call(c,s)){t[s]=c[s]}}if(!t.crossDomain&&!t.headers["X-Requested-With"]){t.headers["X-Requested-With"]="XMLHttpRequest"}if(l.onBeforeRequest!=null){l.onBeforeRequest(t)}try{n=t.crossDomain?p():h()}catch(e){r.onError(e)}try{if(t.user){n.open(t.method,t.url,t.async,t.user,t.password)}else{n.open(t.method,t.url,t.async)}n.timeout=t.timeout;n.withCredentials=t.withCredentials!==false;o=t.headers;for(a in o){if(f.call(o,a)){n.setRequestHeader(a,o[a])}}if(t.responseType){try{n.responseType=t.responseType}catch(e){if(t.responseType!=="json"){throw e}}}n.onreadystatechange=function e(t){if(n.readyState===4){if(!i){i=true;d(r,n,t)}}};n.ontimeout=function e(t){if(!i){i=true;v(r,n,"timeout error",t)}};n.send(t.data)}catch(e){r.onError(e)}return function e(){if(!i&&n.readyState!==4){i=true;n.abort()}}})}function s(e,t,r){if(!r){r=new Error(t)}e.onError(r)}function d(e,t,r){var n,i,o;if(t&&e){o=t.responseType;n="response"in t?t.response:t.responseText;var a=t.status===1223?204:t.status;if(a>=200&&a<=399){try{if(o!=="json"){n=JSON.parse(n||"")}if(typeof n==="string"){n=JSON.parse(n||"")}}catch(r){s(e,"invalid json",r)}e.onNext(n);e.onCompleted();return}else if(a===401||a===403||a===407){return s(e,n)}else if(a===410){return s(e,n)}else if(a===408||a===504){return s(e,n)}else{return s(e,n||"Response code "+a)}}}function v(e,t,r,n){s(e,r||t.statusText||"request error",n)}t.exports=i},{"./getCORSRequest":12,"./getXMLHttpRequest":13}],15:[function(h,r,i){(function(n){!function(e){if("object"==typeof i&&"undefined"!=typeof r)r.exports=e();else if("function"==typeof o&&o.amd)o([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof n?n:"undefined"!=typeof self?self:this,t.falcor=e()}}(function(){var Ir;return function o(a,s,u){function c(r,e){if(!s[r]){if(!a[r]){var t="function"==typeof h&&h;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return c(t?t:e)},i,i.exports,o,a,s,u)}return s[r].exports}for(var l="function"==typeof h&&h,e=0;e<u.length;e++)c(u[e]);return c}({1:[function(e,t,r){var n=e(32),i=e(130);n.atom=i.atom,n.ref=i.ref,n.error=i.error,n.pathValue=i.pathValue,n.HttpDataSource=e(125),t.exports=n},{125:125,130:130,32:32}],2:[function(e,t,r){function i(e){var t=e||{};this._root=t._root||new n(t),this._path=t.path||t._path||[],this._scheduler=t.scheduler||t._scheduler||new f,this._source=t.source||t._source,this._request=t.request||t._request||new a(this,this._scheduler),this._ID=E++,"number"==typeof t.maxSize?this._maxSize=t.maxSize:this._maxSize=t._maxSize||i.prototype._maxSize,"number"==typeof t.collectRatio?this._collectRatio=t.collectRatio:this._collectRatio=t._collectRatio||i.prototype._collectRatio,(t.boxed||t.hasOwnProperty("_boxed"))&&(this._boxed=t.boxed||t._boxed),(t.materialized||t.hasOwnProperty("_materialized"))&&(this._materialized=t.materialized||t._materialized),"boolean"==typeof t.treatErrorsAsValues?this._treatErrorsAsValues=t.treatErrorsAsValues:t.hasOwnProperty("_treatErrorsAsValues")&&(this._treatErrorsAsValues=t._treatErrorsAsValues),t.cache&&this.setCache(t.cache)}var n=e(4),o=e(3),a=e(55),s=e(64),u=e(65),c=e(61),l=e(63),h=e(73),p=e(75),f=e(74),d=e(81),v=e(84),m=e(49),g=e(134),_=e(88),y=e(100),b=e(96),x=e(102),w=e(98),S=e(99),M=e(77),C=e(76),T=e(130),E=0,O=e(116),P=function(){},A=e(14),j=e(19),R={pathValue:!0,pathSyntax:!0,json:!0,jsonGraph:!0},k=e(72);t.exports=i,i.ref=T.ref,i.atom=T.atom,i.error=T.error,i.pathValue=T.pathValue,i.prototype.constructor=i,i.prototype._materialized=!1,i.prototype._boxed=!1,i.prototype._progressive=!1,i.prototype._treatErrorsAsValues=!1,i.prototype._maxSize=Math.pow(2,53)-1,i.prototype._collectRatio=.75,i.prototype.get=e(71),i.prototype._getWithPaths=e(70),i.prototype.set=function(){var t=O(arguments,R,"set");return t!==!0?new s(function(e){e.onError(t)}):this._set.apply(this,arguments)},i.prototype.preload=function(){var t=O(arguments,k,"preload");if(t!==!0)return new s(function(e){e.onError(t)});var e=Array.prototype.slice.call(arguments),r=this;return new s(function(t){return r.get.apply(r,e).subscribe(function(){},function(e){t.onError(e)},function(){t.onCompleted()})})},i.prototype._set=function(){var e,t=-1,r=arguments.length,n=arguments[r-1];for(b(n)?r-=1:n=void 0,e=new Array(r);++t<r;)e[t]=arguments[t];return u.create(this,e,n)},i.prototype.call=function(){var e,t=-1,r=arguments.length;for(e=new Array(r);++t<r;){var n=arguments[t];e[t]=n;var i=typeof n;if(t>1&&!Array.isArray(n)||0===t&&!Array.isArray(n)&&"string"!==i||1===t&&!Array.isArray(n)&&!x(n))return new s(function(e){e.onError(new Error("Invalid argument"))})}return c.create(this,e)},i.prototype.invalidate=function(){var e,t=-1,r=arguments.length,n=arguments[r-1];for(e=new Array(r);++t<r;)if(e[t]=g.fromPath(arguments[t]),"object"!=typeof e[t])throw new Error("Invalid argument");l.create(this,e,n).subscribe(P,function(e){throw e})},i.prototype.deref=e(5),i.prototype.getValue=e(16),i.prototype.setValue=e(79),i.prototype._getValueSync=e(24),i.prototype._setValueSync=e(80),i.prototype._derefSync=e(6),i.prototype.setCache=function(e){var t=this._root.cache;if(e!==t){var r=this._root,n=this._path;this._path=[],this._root.cache={},"undefined"!=typeof t&&m(r,r.expired,_(t),0),S(e)?C(this,[e]):w(e)?M(this,[e]):y(e)&&M(this,[{json:e}]),this._path=n}else"undefined"==typeof t&&(this._root.cache={});return this},i.prototype.getCache=function(){var e=v(arguments);if(0===e.length)return A(this._root.cache);var t=[{}],r=this._path;return j.getWithPathsAsJSONGraph(this,e,t),this._path=r,t[0].jsonGraph},i.prototype.getVersion=function(e){var t=e&&g.fromPath(e)||[];if(Array.isArray(t)===!1)throw new Error("Model#getVersion must be called with an Array path.");return this._path.length&&(t=this._path.concat(t)),this._getVersion(this,t)},i.prototype._syncCheck=function(e){if(Boolean(this._source)&&this._root.syncRefCount<=0&&this._root.unsafeMode===!1)throw new Error("Model#"+e+" may only be called within the context of a request selector.");return!0},i.prototype._clone=function(e){var t=new i(this);for(var r in e){var n=e[r];"delete"===n?delete t[r]:t[r]=n}return t.setCache=void 0,t},i.prototype.batch=function(e){var t=e;"number"==typeof t?t=new p(Math.round(Math.abs(t))):t&&t.schedule||(t=new h);var r=this._clone();return r._request=new a(r,t),r},i.prototype.unbatch=function(){var e=this._clone();return e._request=new a(e,new f),e},i.prototype.treatErrorsAsValues=function(){return this._clone({_treatErrorsAsValues:!0})},i.prototype.asDataSource=function(){return new o(this)},i.prototype._materialize=function(){return this._clone({_materialized:!0})},i.prototype._dematerialize=function(){return this._clone({_materialized:"delete"})},i.prototype.boxValues=function(){return this._clone({_boxed:!0})},i.prototype.unboxValues=function(){return this._clone({_boxed:"delete"})},i.prototype.withoutDataSource=function(){return this._clone({_source:"delete"})},i.prototype.toJSON=function(){return{$type:"ref",value:this._path}},i.prototype.getPath=function(){return d(this._path)},i.prototype._getBoundValue=e(13),i.prototype._getVersion=e(18),i.prototype._getValueSync=e(17),i.prototype._getPathValuesAsPathMap=j.getWithPathsAsPathMap,i.prototype._getPathValuesAsJSONG=j.getWithPathsAsJSONGraph,i.prototype._setPathValuesAsJSON=e(78),i.prototype._setPathValuesAsJSONG=e(78),i.prototype._setPathValuesAsPathMap=e(78),i.prototype._setPathValuesAsValues=e(78),i.prototype._setPathMapsAsJSON=e(77),i.prototype._setPathMapsAsJSONG=e(77),i.prototype._setPathMapsAsPathMap=e(77),i.prototype._setPathMapsAsValues=e(77),i.prototype._setJSONGsAsJSON=e(76),i.prototype._setJSONGsAsJSONG=e(76),i.prototype._setJSONGsAsPathMap=e(76),i.prototype._setJSONGsAsValues=e(76),i.prototype._setCache=e(77),i.prototype._invalidatePathValuesAsJSON=e(48),i.prototype._invalidatePathMapsAsJSON=e(47)},{100:100,102:102,116:116,13:13,130:130,134:134,14:14,16:16,17:17,18:18,19:19,24:24,3:3,4:4,47:47,48:48,49:49,5:5,55:55,6:6,61:61,63:63,64:64,65:65,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,84:84,88:88,96:96,98:98,99:99}],3:[function(e,t,r){function n(e){this._model=e._materialize().treatErrorsAsValues()}n.prototype.get=function(e){return this._model.get.apply(this._model,e)._toJSONG()},n.prototype.set=function(e){return this._model.set(e)._toJSONG()},n.prototype.call=function(e,t,r,n){var i=[e,t,r].concat(n);return this._model.call.apply(this._model,i)._toJSONG()},t.exports=n},{}],4:[function(e,t,r){function n(e){var t=e||{};this.syncRefCount=0,this.expired=t.expired||[],this.unsafeMode=t.unsafeMode||!1,this.collectionScheduler=t.collectionScheduler||new a,this.cache={},i(t.comparator)&&(this.comparator=t.comparator),i(t.errorSelector)&&(this.errorSelector=t.errorSelector),i(t.onChange)&&(this.onChange=t.onChange)}var i=e(96),o=e(91),a=e(74);n.prototype.errorSelector=function(e,t){return t},n.prototype.comparator=function(e,t){return o(e,"value")&&o(t,"value")?e.value===t.value&&e.$type===t.$type&&e.$expires===t.$expires:e===t},t.exports=n},{74:74,91:91,96:96}],5:[function(e,t,r){function s(e,t){var r,n=!1;try{++e._root.syncRefCount,r=e._derefSync(t)}catch(e){r=e,n=!0}finally{--e._root.syncRefCount}return n?u.Observable["throw"](r):u.Observable["return"](r)}var u=e(159),c=e(134);t.exports=function(e){for(var n=this,t=-1,i=arguments.length-1,o=new Array(i),a=c.fromPath(e);++t<i;)o[t]=c.fromPath(arguments[t+1]);if(0===i)throw new Error("Model#deref requires at least one value path.");return u.Observable.defer(function(){return s(n,a)}).flatMap(function(e){if(Boolean(e)){if(i>0){var t=u.Observable.of(e);return e.get.apply(e,o)["catch"](u.Observable.empty()).concat(t).last().flatMap(function(){return s(n,a)}).filter(function(e){return e})}return u.Observable["return"](e)}if(i>0){var r=o.map(function(e){return a.concat(e)});return n.get.apply(n,r).concat(u.Observable.defer(function(){return s(n,a)})).last().filter(function(e){return e})}return u.Observable.empty()})}},{134:134,159:159}],6:[function(e,t,r){var a=e(134),s=e(13),u=e(8),c=e(118);t.exports=function(e){var t=a.fromPath(e);if(!Array.isArray(t))throw new Error("Model#derefSync must be called with an Array path.");var r=s(this,this._path.concat(t),!1),n=r.path,i=r.value,o=r.found;if(o&&void 0!==i&&(i.$type!==c||void 0!==i.value)){if(i.$type)throw new u;return this._clone({_path:n})}}},{118:118,13:13,134:134,8:8}],7:[function(e,t,r){function n(){this.message=n.message,this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="BoundJSONGraphModelError",n.message="It is not legal to use the JSON Graph format from a bound Model. JSON Graph format can only be used from a root model.",t.exports=n},{}],8:[function(e,t,r){function n(e,t){this.message=o,this.stack=(new Error).stack,this.boundPath=e,this.shortedPath=t}var i="InvalidModelError",o="The boundPath of the model is not valid since a value or error was found before the path end.";n.prototype=new Error,n.prototype.name=i,n.message=o,t.exports=n},{}],9:[function(e,t,r){function n(e){this.message="An exception was thrown when making a request.",this.stack=(new Error).stack,this.innerError=e}var i="InvalidSourceError";n.prototype=new Error,n.prototype.name=i,n.is=function(e){return e&&e.name===i},t.exports=n},{}],10:[function(e,t,r){function n(){this.message="The allowed number of retries have been exceeded.",this.stack=(new Error).stack}var i="MaxRetryExceededError";n.prototype=new Error,n.prototype.name=i,n.is=function(e){return e&&e.name===i},t.exports=n},{}],11:[function(e,t,r){function n(e,t,r,n,i,o,a){for(var s,u,c=r,l=i,h=n,p=0;;){if(0===p&&h[x]?(p=l.length,u=h[x]):(s=l[p++],u=c[s]),u){var f=u.$type,d=f&&u.value||u;if(p<l.length){if(f){c=u;break}c=u;continue}if(c=u,f&&y(u))break;if(h[x]||g(h,u),f===b){a?_(e,u,o,null,null,null,l,l.length,a):w(e,u),p=0,l=d,h=u,c=t;continue}break}c=void 0;break}if(p<l.length&&void 0!==c){for(var v=[],m=0;p>m;m++)v[m]=l[m];l=v}return[c,l]}var i=e(26),g=i.create,_=e(22),y=e(27),b=e(120),x=e(33),w=e(29).promote;t.exports=n},{120:120,22:22,26:26,27:27,29:29,33:33}],12:[function(e,t,r){var v=e(15),m=e(8),g=e(7);t.exports=function(f,d){return function(e,t,r){var n,i,o,a=r[0],s={values:r,optimizedPaths:[]},u=e._root.cache,c=e._path,l=u,h=c.length,p=[];if(h){if(d)return{criticalError:new g};if(l=v(e,c),l.$type)return{criticalError:new m(c,c)};for(n=[],i=0;h>i;++i)n[i]=c[i]}else n=[],h=0;for(i=0,o=t.length;o>i;i++)f(e,u,l,t[i],0,a,s,p,n,h,d);return s}}},{15:15,7:7,8:8}],13:[function(e,t,r){var l=e(17),h=e(8);t.exports=function(e,t,r){var n,i,o,a,s,u=t,c=t;for(n=e._boxed,r=e._materialized,i=e._treatErrorsAsValues,e._boxed=!0,e._materialized=void 0===r||r,e._treatErrorsAsValues=!0,o=l(e,u.concat(null),!0),e._boxed=n,e._materialized=r,e._treatErrorsAsValues=i,u=o.optimizedPath,a=o.shorted,s=o.found,o=o.value;u.length&&null===u[u.length-1];)u.pop();if(s&&a)throw new h(c,u);return{path:u,value:o,shorted:a,found:s}}},{17:17,8:8}],14:[function(e,t,r){function u(e){var t,r,n,i={},o=Object.keys(e);for(r=0,n=o.length;n>r;r++)t=o[r],h(t)||(i[t]=e[t]);return i}function c(a,s,e){Object.keys(a).filter(function(e){return!h(e)&&a[e]}).forEach(function(e){var t=a[e],r=s[e];if(r||(r=s[e]={}),t.$type){var n,i=t.value&&"object"==typeof t.value,o=!a[l];return n=i||o?u(t):t.value,void(s[e]=n)}c(t,r,e)})}var l=e(37),h=e(97);t.exports=function(e){var t={};return c(e,t),t}},{37:37,97:97}],15:[function(e,t,r){t.exports=function(e,t){for(var r=e._root.cache,n=-1,i=t.length;++n<i&&r&&!r.$type;)r=r[t[n]];return r}},{}],16:[function(e,t,r){var i=e(64),a=e(134);t.exports=function(e){for(var o=a.fromPath(e),t=0,r=o.length;++t<r;)if("object"==typeof o[t])return new i(function(e){e.onError(new Error("Paths must be simple paths"))});var n=this;return new i(function(i){return n.get(o).subscribe(function(e){for(var t=e.json,r=-1,n=o.length;t&&++r<n;)t=t[o[r]];i.onNext(t)},function(e){i.onError(e)},function(){i.onCompleted()})})}},{134:134,64:64}],17:[function(e,t,r){var y=e(11),b=e(25),x=e(27),w=e(29).promote,S=e(120),M=e(118),C=e(119);t.exports=function(e,t,r){for(var n,i,o,a,s,u=e._root.cache,c=t.length,l=[],h=!1,p=!1,f=0,d=u,v=u,m=u,g=!0,_=!1;d&&c>f;){if(n=t[f++],null!==n&&(d=v[n],l[l.length]=n),!d){m=void 0,h=!0,g=!1;break}if(o=d.$type,o===M&&void 0===d.value){m=void 0,g=!1,h=c>f;break}if(c>f){if(o===S){if(x(d)){_=!0,m=void 0,g=!1;break}if(a=y(e,u,u,d,d.value),s=a[0],!s){m=void 0,d=void 0,g=!1;break}o=s.$type,d=s,l=a[1].slice(0)}if(o)break}else m=d;v=d}if(c>f&&!_){for(i=f;c>i;++i)if(null!==t[f]){p=!0;break}for(p?(h=!0,m=void 0):m=d,i=f;c>i;++i)null!==t[i]&&(l[l.length]=t[i])}if(m&&o&&(x(m)?m=void 0:w(e,m)),m&&o===C&&!e._treatErrorsAsValues)throw{path:f===c?t:t.slice(0,f),value:m.value};return m&&e._boxed?m=Boolean(o)&&!r?b(m):m:!m&&e._materialized?m={$type:M}:m&&(m=m.value),{value:m,shorted:h,optimizedPath:l,found:g}}},{11:11,118:118,119:119,120:120,25:25,27:27,29:29}],18:[function(e,t,r){var i=e(46);t.exports=function(e,t){var r=e._getValueSync({_boxed:!0,_root:e._root,_treatErrorsAsValues:e._treatErrorsAsValues},t,!0).value,n=r&&r[i];return null==n?-1:n}},{46:46}],19:[function(e,t,r){var n=e(12),i=e(31),o=n(i,!1),a=n(i,!0);t.exports={getValueSync:e(17),getBoundValue:e(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:a}},{12:12,13:13,17:17,31:31}],20:[function(e,t,r){var n=e(29),a=e(25),s=n.promote;t.exports=function(e,t,r,n,i){var o=t.value;i.errors||(i.errors=[]),e._boxed&&(o=a(t)),i.errors.push({path:n.slice(0,r+1),value:o}),s(e,t)}},{25:25,29:29}],21:[function(e,t,r){function u(e,t,r,n,i,o,a){a.requestedMissingPaths.push(n.slice(0,r).concat(t)),a.optimizedMissingPaths.push(i.slice(0,o).concat(t))}var n=e(30),c=n.fastCopy;t.exports=function(e,t,r,n,i,o,a){var s;n.requestedMissingPaths||(n.requestedMissingPaths=[],n.optimizedMissingPaths=[]),s=r<t.length?c(t,r):[],u(e,s,r,i,o,a,n)}},{30:30}],22:[function(e,t,r){var n=e(29),x=e(25),w=n.promote,S=e(120),M=e(118),C=e(119),T=e(37);t.exports=function(e,t,r,n,i,o,a,s,u,c){if(r){var l,h,p,f,d,v,m,g,_=!1;if(t&&w(e,t),t&&void 0!==t.value||(_=e._materialized),_)g={$type:M};else if(e._boxed)g=x(t);else if(t.$type===S||t.$type===C)g=u?x(t):t.value;else if(u){var y=t.value&&"object"==typeof t.value,b=!t[T];g=y||b?x(t):t.value}else g=t.value;if(i&&(i.hasValue=!0),u){for(d=r.jsonGraph,d||(d=r.jsonGraph={},r.paths=[]),l=0,h=s-1;h>l;l++)f=a[l],d[f]||(d[f]={}),d=d[f];f=a[l],d[f]=_?{$type:M}:g,o&&r.paths.push(o.slice(0,n))}else if(0===n)r.json=g;else{for(d=r.json,d||(d=r.json={}),l=0;n-1>l;l++)p=o[l],d[p]||(d[p]={}),v=d,m=p,d=d[p];p=o[l],null!==p?d[p]=g:v[m]=g}}}},{118:118,119:119,120:120,25:25,29:29,37:37}],23:[function(e,t,r){var f=e(27),n=e(26),i=e(29),d=n.remove,v=i.splice,m=e(119),g=e(20),_=e(22),y=e(21),b=e(28),x=e(35);t.exports=function(e,t,r,n,i,o,a,s,u,c,l){var h=t&&t.$type,p=t&&void 0===t.value;return t&&h?void(f(t)?(t[x]||(v(e,t),d(t)),y(e,r,n,o,a,s,u)):h===m?(l&&(a[n]=null),c||e._treatErrorsAsValues?_(e,t,i,n,o,a,s,u,c,l):g(e,t,n,a,o)):(l&&(a[n]=null),(!p||p&&e._materialized)&&_(e,t,i,n,o,a,s,u,c,l))):void(b(e)?_(e,t,i,n,o,a,s,u,c,l):y(e,r,n,o,a,s,u))}},{119:119,20:20,21:21,22:22,26:26,27:27,28:28,29:29,35:35}],24:[function(e,t,r){var n=e(134);t.exports=function(e){var t=n.fromPath(e);if(Array.isArray(t)===!1)throw new Error("Model#getValueSync must be called with an Array path.");return this._path.length&&(t=this._path.concat(t)),this._syncCheck("getValueSync")&&this._getValueSync(this,t).value}},{134:134}],25:[function(e,t,r){var a=e(40);t.exports=function(e){var t,r,n,i=Object.keys(e);for(t={},r=0,n=i.length;n>r;r++){var o=i[r];o[0]!==a&&(t[o]=e[o])}return t}},{40:40}],26:[function(e,t,r){function n(e,t){var r=t[u]||0;t[o+r]=e,t[u]=r+1,e[s]=r,e[a]=t}function i(e){var t=e[a];if(t){for(var r=e[s],n=t[u];n>r;)t[o+r]=t[o+r+1],++r;t[u]=n-1,e[a]=void 0,e[s]=void 0}}var o=e(43),a=e(33),s=e(42),u=e(44);t.exports={create:n,remove:i}},{33:33,42:42,43:43,44:44}],27:[function(e,t,r){var n=e(106);t.exports=function(e){var t=void 0===e.$expires&&-1||e.$expires;return-1!==t&&1!==t&&(0===t||t<n())}},{106:106}],28:[function(e,t,r){t.exports=function(e){return e._materialized&&!e._source}},{}],29:[function(e,t,r){function n(e,t){var r=e._root,n=r[a];if(n!==t){var i=t[u],o=t[s];o&&(o[u]=i),i&&(i[s]=o),t[u]=void 0,r[a]=t,t[s]=n,n[u]=t}}function i(e,t){var r=e._root,n=t[u],i=t[s];i&&(i[u]=n),n&&(n[s]=i),t[u]=void 0,t===r[a]&&(r[a]=void 0),t===r[o]&&(r[o]=void 0),t[c]=!0,r.expired.push(t)}var a=e(34),o=e(45),s=e(38),u=e(41),c=e(35);t.exports={promote:n,splice:i}},{34:34,35:35,38:38,41:41,45:45}],30:[function(e,t,r){function n(e,t){var r,n,i,o=[];for(n=0,i=t||0,r=e.length;r>i;n++,i++)o[n]=e[i];return o}function i(e,t){var r,n,i,o=[];for(r=0,n=e.length;n>r;r++)o[r]=e[r];for(i=0,n=t.length;n>i;i++)null!==t[i]&&(o[r++]=t[i]);return o}function o(e,t){var r,n,i,o=[];for(r=0,n=e.length;n>r;r++)o[r]=e[r];for(i=0,n=t.length;n>i;i++)o[r++]=t[i];return o}t.exports={fastCat:o,fastCatSkipNulls:i,fastCopy:n}},{}],31:[function(e,t,r){var P=e(11),A=e(23),j=e(27),R=e(143).iterateKeySet,k=e(120),L=e(29).promote;t.exports=function e(t,r,n,i,o,a,s,u,c,l,h,p){var f=p,d=c;if(!n||n&&n.$type||o===i.length)return void A(t,n,i,o,a,s,u,d,l,h,f);var v,m;v=i[o];var g="object"==typeof v,_=o+1,y=!1,b=v;if(g&&(y={},b=R(v,y)),void 0!==b||!y.done){var x=l+1;do{f=!1;var w;null===b?w=n:(w=n[b],d[l]=b,u[o]=b);var S=d,M=x;if(w){var C=w.$type,T=C&&w.value||w;if(_<i.length&&C&&C===k&&!j(w)){h&&A(t,w,i,_,a,s,null,d,M,h,f),L(t,w);var E=P(t,r,r,w,T,a,h);f=!0,w=E[0];var O=E[1];for(S=[],M=O.length,m=0;M>m;++m)S[m]=O[m]}}e(t,r,w,i,_,a,s,u,S,M,h,f),y&&!y.done&&(b=R(v,y))}while(y&&!y.done)}}},{11:11,120:120,143:143,23:23,27:27,29:29}],32:[function(e,t,r){"use strict";function n(e){return new n.Model(e)}"function"==typeof Promise?n.Promise=Promise:n.Promise=e(151),t.exports=n,n.Model=e(2)},{151:151,2:2}],33:[function(e,t,r){t.exports=e(40)+"context"},{40:40}],34:[function(e,t,r){t.exports=e(40)+"head"},{40:40}],35:[function(e,t,r){t.exports=e(40)+"invalidated"},{40:40}],36:[function(e,t,r){t.exports=e(40)+"key"},{40:40}],37:[function(e,t,r){t.exports="$modelCreated"},{}],38:[function(e,t,r){t.exports=e(40)+"next"},{40:40}],39:[function(e,t,r){t.exports=e(40)+"parent"},{40:40}],40:[function(e,t,r){t.exports=String.fromCharCode(30)},{}],41:[function(e,t,r){t.exports=e(40)+"prev"},{40:40}],42:[function(e,t,r){t.exports=e(40)+"ref-index"},{40:40}],43:[function(e,t,r){t.exports=e(40)+"ref"},{40:40}],44:[function(e,t,r){t.exports=e(40)+"refs-length"},{40:40}],45:[function(e,t,r){t.exports=e(40)+"tail"},{40:40}],46:[function(e,t,r){t.exports=e(40)+"version"},{40:40}],47:[function(e,t,r){function _(e,t,r,n,i,o,a,s,u,c){if(!k(e)&&!e.$type)for(var l in e)if(l[0]!==m&&"$"!==l[0]&&P(e,l)){var h=e[l],p=A(h)&&!h.$type,f=g(r,n,i,l,h,p,!1,o,a,s,u,c),d=f[0],v=f[1];d&&(p?_(h,t+1,r,v,d,o,a,s,u,c):D(d,v,l,s)&&I(v,O(d),s,o))}}function d(e,t,r,n,i,o,a,s){if(j(r))return L(r,i,o),[void 0,t];E(o,r);var u=r,c=r.value,l=t;if(r=r[x],null!=r)l=r[b]||t;else{var h=0,p=c.length-1;l=r=t;do{var f=c[h],d=p>h,v=g(t,l,r,f,e,d,!0,n,i,o,a,s);if(r=v[0],k(r))return v;l=v[1]}while(h++<p);if(u[x]!==r){var m=r[M]||0;r[M]=m+1,r[y+m]=u,u[x]=r,u[S]=m}}return[r,l]}function g(e,t,r,n,i,o,a,s,u,c,l,h){for(var p=r.$type;p===C;){var f=d(i,e,r,s,u,c,l,h);if(r=f[0],k(r))return f;t=f[1],p=r&&r.$type}if(void 0!==p)return[r,t];if(null==n){if(o)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[v])}else t=r,r=t[n];return[r,t]}var v=e(36),y=e(43),m=e(40),b=e(39),x=e(33),w=e(46),S=e(42),M=e(44),C=e(120),T=e(13),E=e(50),O=e(88),P=e(91),A=e(100),j=e(95),R=e(96),k=e(102),L=e(86),N=e(92),I=e(115),D=e(109);t.exports=function(e,t){for(var r=e._root,n=r,i=r.expired,o=N(),a=r._comparator,s=r._errorSelector,u=e._path,c=r.cache,l=u.length?T(e,u).value:c,h=l[b]||c,p=c[w],f=-1,d=t.length;++f<d;){var v=t[f];_(v.json,0,c,h,l,o,i,n,a,s)}var m=c[w],g=r.onChange;R(g)&&p!==m&&g()}},{100:100,102:102,109:109,115:115,120:120,13:13,33:33,36:36,39:39,40:40,42:42,43:43,44:44,46:46,50:50,86:86,88:88,91:91,92:92,95:95,96:96}],48:[function(e,t,r){function m(e,t,r,n,i,o,a,s){var u={},c=t<e.length-1,l=e[t],h=P(l,u);do{var p=v(r,n,i,h,c,!1,o,a,s),f=p[0],d=p[1];f&&(c?m(e,t+1,r,d,f,o,a,s):R(f,d,h,s)&&j(d,M(f),s,o)),h=P(l,u)}while(!u.done)}function h(e,t,r,n,i){if(C(t))return O(t,n,i),[void 0,e];S(i,t);var o=t,a=t.value,s=e;if(t=t[_],null!=t)s=t[g]||e;else{var u=0,c=a.length-1;s=t=e;do{var l=a[u],h=c>u,p=v(e,s,t,l,h,!0,r,n,i);if(t=p[0],E(t))return p;s=p[1]}while(u++<c);if(o[_]!==t){var f=t[x]||0;t[x]=f+1,t[d+f]=o,o[_]=t,o[b]=f}}return[t,s]}function v(e,t,r,n,i,o,a,s,u){for(var c=r.$type;c===f;){var l=h(e,r,a,s,u);if(r=l[0],E(r))return l;t=l[1],c=r.$type}if(void 0!==c)return[r,t];if(null==n){if(i)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[p])}else t=r,r=t[n];return[r,t]}var p=e(36),d=e(43),g=e(39),_=e(33),y=e(46),b=e(42),x=e(44),f=e(120),w=e(13),S=e(50),M=e(88),C=e(95),T=e(96),E=e(102),O=e(86),P=e(143).iterateKeySet,A=e(92),j=e(115),R=e(109);t.exports=function(e,t){for(var r=e._root,n=r,i=r.expired,o=A(),a=e._path,s=r.cache,u=a.length?w(e,a).value:s,c=u[g]||s,l=s[y],h=-1,p=t.length;++h<p;){var f=t[h];m(f,0,s,c,u,o,i,n)}var d=s[y],v=r.onChange;T(v)&&l!==d&&v()}},{102:102,109:109,115:115,120:120,13:13,143:143,33:33,36:36,39:39,42:42,43:43,44:44,46:46,50:50,86:86,88:88,92:92,95:95,96:96}],49:[function(e,t,r){var d=e(36),v=e(39),m=e(34),g=e(45),_=e(38),y=e(41),b=e(108),x=e(115);t.exports=function(e,t,r,n,i,o){var a=r,s=i;"number"!=typeof s&&(s=.75);var u,c,l,h="number"==typeof o,p=n*s;for(c=t.pop();c;)l=c.$size||0,a-=l,h===!0?x(c,l,e,o):(u=c[v])&&b(c,u,c[d],e),c=t.pop();if(a>=n){var f=e[g];for(c=f;a>=p&&c;)f=f[y],l=c.$size||0,a-=l,h===!0&&x(c,l,e,o),c=f;e[g]=e[y]=c,null==c?e[m]=e[_]=void 0:c[_]=void 0}}},{108:108,115:115,34:34,36:36,38:38,39:39,41:41,45:45}],50:[function(e,t,r){var a=e(121),s=e(34),u=e(45),c=e(38),l=e(41),h=e(100);t.exports=function(e,t){if(h(t)&&t.$expires!==a){var r=e[s],n=e[u],i=t[c],o=t[l];t!==r&&(null!=i&&"object"==typeof i&&(i[l]=o),null!=o&&"object"==typeof o&&(o[c]=i),i=r,null!=r&&"object"==typeof r&&(r[l]=t),e[s]=e[c]=r=t,r[c]=i,r[l]=void 0),null!=n&&t!==n||(e[u]=e[l]=n=o||t)}return t}},{100:100,121:121,34:34,38:38,41:41,45:45}],51:[function(e,t,r){var a=e(34),s=e(45),u=e(38),c=e(41);t.exports=function(e,t){var r=e[a],n=e[s],i=t[u],o=t[c];null!=i&&"object"==typeof i&&(i[c]=o),null!=o&&"object"==typeof o&&(o[u]=i),t===r&&(e[a]=e[u]=i),t===n&&(e[s]=e[c]=o),t[u]=t[c]=void 0,r=n=i=o=void 0}},{34:34,38:38,41:41,45:45}],52:[function(e,t,r){function l(t,r){var n=!1;return function(){if(!n&&!t._disposed){n=!0,t._callbacks[r]=null,t._optimizedPaths[r]=[],t._requestedPaths[r]=[];var e=--t._count;0!==e||t.sent||(t._disposable.dispose(),t.requestQueue.removeRequest(t))}}}function p(e){for(var t=[],r=-1,n=0,i=e.length;i>n;++n)for(var o=e[n],a=0,s=o.length;s>a;++a)t[++r]=o[a];return t}var h=e(59),u=e(60),n=0,i=e(57).GetRequest,f=e(76),d=e(78),v=e(119),m=[],o=function(e,t){this.sent=!1,this.scheduled=!1,this.requestQueue=t,this.id=++n,this.type=i,this._scheduler=e,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};o.prototype={batch:function(e,t,r){var o=this,n=o._optimizedPaths,a=o._requestedPaths,s=o._callbacks,i=n.length;return n[i]=t,a[i]=e,s[i]=r,++o._count,o.scheduled||(o.scheduled=!0,o._disposable=o._scheduler.schedule(function(){u(o,n,function(e,t){if(o.requestQueue.removeRequest(o),o._disposed=!0,o._count){o._merge(a,e,t);for(var r=0,n=s.length;n>r;++r){var i=s[r];i&&i(e,t)}}})})),l(o,i)},add:function(e,t,r){var n,i,o=this,a=h(e,t,o._pathMap);a?(i=a[2],n=a[1]):(i=e,n=t);var s=!1,u=!1;if(n.length<t.length){s=!0;var c=o._callbacks.length;o._callbacks[c]=r,o._requestedPaths[c]=a[0],o._optimizedPaths[c]=[],++o._count,u=l(o,c)}return[s,i,n,u]},_merge:function(e,t,r){var n=this,i=n.requestQueue.model,o=i._root,a=o.errorSelector,s=o.comparator,u=i._path;i._path=m;var c=p(e);if(t){var l=t;l instanceof Error&&(l={message:l.message}),l.$type||(l={$type:v,value:l});var h=c.map(function(e){return{path:e,value:l}});d(i,h,null,a,s)}else f(i,[{paths:c,jsonGraph:r.jsonGraph}],null,a,s);i._path=u}},t.exports=o},{119:119,57:57,59:59,60:60,76:76,78:78}],53:[function(e,t,r){function n(){this.length=0,this.pending=!1,this.pathmaps=[],a.call(this,this._subscribe)}var i=e(159),o=i.Observer,a=i.Observable,s=i.Disposable,u=i.SerialDisposable,c=i.CompositeDisposable,l=e(9),h=e(143),f=h.iterateKeySet;n.create=function(e,t,r){var n=new this;return n.queue=e,n.model=t,n.index=r,n},n.prototype=Object.create(a.prototype),n.prototype.constructor=n,n.prototype.insertPath=function(e,t,r,n,i){var o=n||0,a=i||e.length-1,s=r||this.pathmaps[a+1]||(this.pathmaps[a+1]=Object.create(null));if(void 0===s||null===s)return!1;var u,c,l=e[o],h={};u=f(l,h);do{if(c=s[u],a>o){if(null==c){if(t)return!1;c=s[u]=Object.create(null)}if(this.insertPath(e,t,c,o+1,a)===!1)return!1}else s[u]=(c||0)+1,this.length+=1;h.done||(u=f(l,h))}while(!h.done);return!0},n.prototype.removePath=function(e,t,r,n){var i=r||0,o=n||e.length-1,a=t||this.pathmaps[o+1];if(void 0===a||null===a)return!0;var s,u,c=0,l=e[i],h={};s=f(l,h);do{if(u=a[s],void 0!==u&&null!==u){if(o>i){c+=this.removePath(e,u,i+1,o);var p=void 0;for(p in u)break;void 0===p&&delete a[s]}else u=a[s]=(u||1)-1,0===u&&delete a[s],c+=1,this.length-=1;h.done||(s=f(l,h))}}while(!h.done);return c},n.prototype.getSourceObserver=function(t){var r=this;return o.create(function(e){e.jsonGraph=e.jsonGraph||e.jsong||e.values||e.value,e.index=r.index,t.onNext(e)},function(e){t.onError(e)},function(){t.onCompleted()})},n.prototype._subscribe=function(e){var t=this,r=this.queue;t.pending=!0;var n=!1,i=new u,o=s.create(function(){n||(n=!0,r&&r._remove(t))}),a=new c(i,o);try{i.setDisposable(this.model._source[this.method](this.getSourceArgs()).subscribe(this.getSourceObserver(e)))}catch(e){throw new l(e)}return a},t.exports=n},{143:143,159:159,9:9}],54:[function(e,t,r){function n(e,t){this.total=0,this.model=e,this.requests=[],this.scheduler=t}var i=e(58),m=e(40),g=e(90),_=e(100),o=e(143);n.prototype.set=function(e){return e.paths=o.collapse(e.paths),i.create(this.model,e)},n.prototype._remove=function(e){var t=this.requests,r=t.indexOf(e);-1!==r&&t.splice(r,1)},n.prototype.distributePaths=function(e,t,r){var n,i,o=this.model,a=-1,s=e.length,u=-1,c=t.length,l=[];e:for(;++a<s;){var h=e[a];for(u=-1;++u<c;)if(i=t[u],i.insertPath(h,i.pending)){l[u]=i;continue e}n||(n=r.create(this,o,this.total++),t[u]=n,l[c++]=n),n.insertPath(h,!1)}var p=[],f=-1;for(u=-1;++u<c;)i=l[u],null!=i&&(p[++f]=i);return p},n.prototype.mergeJSONGraphs=function(e,t){var r=0,n=[],i=[],o=[],a=e.index,s=t.index;e.index=Math.max(a,s),n[-1]=e.jsonGraph||{},i[-1]=t.jsonGraph||{};e:for(;r>-1;){for(var u=n[r-1],c=i[r-1],l=o[r-1]||(o[r-1]=Object.keys(c));l.length>0;){var h=l.pop();if(h[0]!==m)if(u.hasOwnProperty(h)){var p=u[h],f=g(p),d=c[h],v=g(d);if(_(p)&&_(d)&&!f&&!v){n[r]=p,i[r]=d,r+=1;continue e}s>a&&(u[h]=d)}else u[h]=c[h]}r-=1}return e},t.exports=n},{100:100,143:143,40:40,58:58,90:90}],55:[function(e,t,r){function n(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var i=e(54),o=e(56);n.prototype.get=o.prototype.get,n.prototype.removeRequest=o.prototype.removeRequest,n.prototype.set=i.prototype.set,n.prototype.call=i.prototype.call,t.exports=n},{54:54,56:56}],56:[function(e,t,r){function n(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var m=e(57),g=e(52);n.prototype={setScheduler:function(e){this.scheduler=e},get:function(e,t,r){function n(){f||(--c,0===c&&r())}var i,o,a,s=this,u=[],c=0,l=s._requests,h=t,p=e,f=!1;for(i=0,o=l.length;o>i;++i)if(a=l[i],a.type===m.GetRequest){if(a.sent){var d=a.add(p,h,n);d[0]&&(p=d[1],h=d[2],u[u.length]=d[3],++c)}else a.batch(p,h,n),h=[],p=[],++c;if(!h.length)break}if(h.length){a=new g(s.scheduler,s),l[l.length]=a,++c;var v=a.batch(p,h,n);u[u.length]=v}return function(){if(!f&&0!==c){f=!0;for(var e=u.length,t=0;e>t;++t)u[t]()}}},removeRequest:function(e){for(var t=this._requests,r=t.length;--r>=0;)if(t[r].id===e.id){t.splice(r,1);break}}},t.exports=n},{52:52,57:57}],57:[function(e,t,r){t.exports={GetRequest:"GET"}},{}],58:[function(e,t,r){function n(){c.call(this)}var i=e(159),u=i.Observer,c=e(53),l=e(83),h=e(76),p=e(78),f=new Array(0);n.create=function(e,t){var r=new n;return r.model=e,r.jsonGraphEnvelope=t,r},n.prototype=Object.create(c.prototype),n.prototype.constructor=n,n.prototype.method="set",n.prototype.insertPath=function(){return!1},n.prototype.removePath=function(){return 0},n.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},n.prototype.getSourceObserver=function(r){var n=this.model,i=n._path,o=this.jsonGraphEnvelope.paths,e=n._root,a=e.errorSelector,s=e.comparator;return c.prototype.getSourceObserver.call(this,u.create(function(e){n._path=f;var t=h(n,[{paths:o,jsonGraph:e.jsonGraph}],null,a,s);e.paths=t[1],n._path=i,r.onNext(e)},function(t){n._path=f,p(n,l(o,function(e){return{path:e,value:t}}),null,a,s),n._path=i,r.onError(t)},function(){r.onCompleted()}))},t.exports=n},{159:159,53:53,76:76,78:78,83:83}],59:[function(e,t,r){var f=e(143).hasIntersection,d=e(84);t.exports=function(e,t,r){for(var n=[],i=[],o=[],a=-1,s=-1,u=!1,c=0,l=t.length;l>c;++c){var h=t[c],p=r[h.length];p&&f(p,h,0)?(!u&&c>0&&(i=d(e,0,c),n=d(t,0,c)),o[++a]=e[c],u=!0):u&&(n[++s]=h,i[s]=e[c])}return u?[o,n,i]:null}},{143:143,84:84}],60:[function(e,t,r){var n=e(143),y=n.toTree,b=n.toPaths;t.exports=function(e,t,r){if(0===e._count)return void e.requestQueue.removeRequest(e);e.sent=!0,e.scheduled=!1;for(var n=e._pathMap,i=Object.keys(t),o=0,a=i.length;a>o;++o)for(var s=t[o],u=0,c=s.length;c>u;++u){var l=s[u],h=l.length;if(n[h]){var p=n[h];p[p.length]=l}else n[h]=[l]}for(var f=Object.keys(n),d=0,v=f.length;v>d;++d){var m=f[d];n[m]=y(n[m])}var g,_=e._collasped=b(n);e.requestQueue.model._source.get(_).subscribe(function(e){g=e},function(e){r(e,g)},function(){r(null,g)})}},{143:143}],61:[function(e,t,r){function n(e){b.call(this,e||i)}function _(e){return y.Observable.defer(function(){return e})}function i(i){function e(e){function t(e,t){if(Boolean(t.invalidated))e.invalidations.push(e.localThisPath.concat(t.path));else{var r=t.path,n=t.value;Boolean(n)&&"object"==typeof n&&n.$type===M?e.references.push({path:f(r),value:t.value}):e.values.push({path:f(r),value:t.value})}return e}function r(t){var e=t.values.concat(t.references);return e.length>0?_(l.set.apply(l,e)._toJSONG()).map(function(e){return{results:t,envelope:e}}):b["return"]({results:t,envelope:{jsonGraph:{},paths:[]}})}function n(e){var t,r=e.envelope,n=e.results,i=n.values,o=n.references,a=n.invalidations,s=i.map(p).map(f),u=o.reduce(h,[]),c=d.map(f),l=u.concat(c);return t=l.length>0?_(v.get.apply(v,s.concat(l))._toJSONG()):b["return"](r),t.doAction(function(e){e.invalidated=a})}function h(e,t){var r=t.path;return e.push.apply(e,c.map(function(e){return r.concat(e)})),e}function p(e){return e.path}var i=e&&e.localFn;if("function"==typeof i){var o=e.model,a=o._path,s=i.apply(o,u).reduce(t,{values:[],references:[],invalidations:[],localThisPath:a}).flatMap(r).flatMap(n);return b["return"](s)}return b.empty()}function t(e){function t(e){var t=e.invalidated;return t&&t.length&&v.invalidate.apply(v,t),e}return e&&"object"==typeof e?y.Observable.defer(function(){var t;try{t=e.call(h,u,c,d)}catch(e){t=b["throw"](new w(e))}return t}).map(t):b.empty()}function r(e){return _(l.set(e)).reduce(function(e){return e},null).map(function(){return{invalidated:e.invalidated,paths:e.paths.map(function(e){return e.slice(s.length)})}})}function f(e){return p.concat(e)}var n=this.args,o=this.model,a=S.fromPath(n[0]),u=n[1]||[],c=(n[2]||[]).map(S.fromPath),d=(n[3]||[]).map(S.fromPath),v=o._clone({_path:[]}),l=v.withoutDataSource(),s=o._path,h=s.concat(a),p=h.slice(0,-1),m=_(o.withoutDataSource().get(a)).map(function(e){for(var t=e.json,r=-1,n=a.length;t&&++r<n;)t=t[a[r]];var i=v._derefSync(p).boxValues();return{model:i,localFn:t}}).flatMap(e).defaultIfEmpty(t(o._source)).mergeAll().flatMap(r),g=new x;return g.add(m.subscribe(function(e){var t=e.paths,r=e.invalidated,n=o.get.apply(o,t);"AsJSONG"===i.outputFormat&&(n=_(n._toJSONG()).doAction(function(e){e.invalidated=r})),g.add(n.subscribe(i))},function(e){i.onError(e)})),g}var y=e(159)&&e(158),b=y.Observable,x=y.CompositeDisposable,o=e(64),w=e(9),S=e(134),M=e(120);n.create=o.create,n.prototype=Object.create(b.prototype),n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(e){return this},n.prototype.ensureCollect=function(e){return this},n.prototype.initialize=function(){return this},t.exports=n},{120:120,134:134,158:158,159:159,64:64,9:9}],62:[function(e,t,r){function n(e){o.call(this,e)}var i=e(159),o=i.Observable,a=e(64),p=e(134),s=e(88),u=e(49),f=e(81),c=e(46),d=Array.isArray,v=e(101),m=e(98),g=e(99);n.create=a.create,n.prototype=Object.create(o.prototype),n.prototype.constructor=n,n.prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var e,t,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],a=[],s=this.args,u=-1,c=s.length;++u<c;){var l,h=s[u];d(h)||"string"==typeof h?(h=p.fromPath(h),l="PathValues"):v(h)?(h.path=p.fromPath(h.path),l="PathValues"):g(h)?l="JSONGs":m(h)&&(l="PathMaps"),t!==l&&(t=l,e={inputType:l,arguments:[]},a.push(e),e.values=o),e.arguments.push(h)}return this.boundPath=f(r._path),this.groups=a,this.outputFormat=n,this.isProgressive=i,this.isCompleted=!1,this.isMaster=null==r._source,this.values=o,this},n.prototype.invokeSourceRequest=function(e){return this},n.prototype.ensureCollect=function(r){var t=this["finally"](function(){var e=r._root,t=e.cache;e.collectionScheduler.schedule(function(){u(e,e.expired,s(t),r._maxSize,r._collectRatio,t[c])})});return new this.constructor(function(e){return t.subscribe(e)})},t.exports=n},{101:101,134:134,159:159,46:46,49:49,64:64,81:81,88:88,98:98,99:99}],63:[function(e,t,r){function n(e){a.call(this,e||i)}function i(e){for(var t=this.model,r=this.method,n=this.groups,i=-1,o=n.length;++i<o;){var a=n[i],s=a.inputType,u=a.arguments;if(u.length>0){var c="_"+r+s+"AsJSON",l=t[c];l(t,u)}}return e.onCompleted(),h.empty}var o=e(159),h=o.Disposable,a=e(62);n.create=a.create,n.prototype=Object.create(a.prototype),n.prototype.method="invalidate",n.prototype.constructor=n,t.exports=n},{159:159,62:62}],64:[function(e,t,r){function n(e){this._subscribe=e}function i(e){var t=this.model,r=new this.type;return r.model=t,r.args=this.args,r.outputFormat=e.outputFormat||"AsPathMap",r.isProgressive=e.isProgressive||!1,r.subscribeCount=0,r.subscribeLimit=e.retryLimit||10,r.initialize().invokeSourceRequest(t).ensureCollect(t).subscribe(e)}var o=e(32),a=e(159)&&e(158),s=a.Observable,u=e(84),c=e(105),l={outputFormat:{value:"AsJSONG"}},h={isProgressive:{value:!0}};n.create=function(e,t){var r=new n(i);return r.args=t,r.type=this,r.model=e,r},n.prototype=Object.create(s.prototype),n.prototype.constructor=n,n.prototype._mixin=function(){var t=this,r=u(arguments);return new t.constructor(function(e){return t.subscribe(r.reduce(function(e,t){return Object.create(e,t)},e))})},n.prototype._toJSONG=function(){return this._mixin(l)},n.prototype.progressively=function(){return this._mixin(h)},n.prototype.subscribe=function(e,t,r){var n=e;n&&"object"==typeof n||(n={onNext:e||c,onError:t||c,onCompleted:r||c});var i=this._subscribe(n);switch(typeof i){case"function":return{dispose:i};case"object":return i||{dispose:c};default:return{dispose:c}}},n.prototype.then=function(e,t){var i=this;return new o.Promise(function(e,t){var r,n=!1;i.toArray().subscribe(function(e){r=e.length<=1?e[0]:e},function(e){n=!0,t(e)},function(){n===!1&&e(r)})}).then(e,t)},t.exports=n},{105:105,158:158,159:159,32:32,84:84}],65:[function(e,t,r){function n(e){c.call(this,e||i)}function i(e){return this.isCompleted?_.call(this,e):o.call(this,e)}function o(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),x.empty;for(var t=[],r=[],n=this.model,i=this.isMaster,o=n._root,a=this.outputFormat,s=o.errorSelector,u=this.method,c=this.groups,l=-1,h=c.length;++l<h;){var p=c[l],f=p.inputType,d=p.arguments;if(d.length>0){var v="_"+u+f+a,m=n[v],g=m(n,d,null,s);r.push.apply(r,g[1]),"PathValues"===f?t.push.apply(t,d.map(y)):"JSONGs"===f?t.push.apply(t,w(d,b)):t.push.apply(t,g[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,_.call(this,e)):void e.onError({method:u,optimizedPaths:r,invokeSourceRequest:!0})}function _(e){var t=new s(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(t=t._toJSONG()),this.isProgressive&&(t=t.progressively()),t.subscribe(e)}function y(e){return e.path}function b(e){return e.paths}var a=e(159),u=a.Observable,x=a.Disposable,s=e(67),c=e(62),l=e(9),w=e(82),h=new Array(0);n.create=c.create,n.prototype=Object.create(c.prototype),n.prototype.method="set",n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(o){var a=this,s=this["catch"](function(e){var t;if(e&&e.invokeSourceRequest===!0){var r={},n=o._path,i=e.optimizedPaths;o._path=h,o._getPathValuesAsJSONG(o._materialize().withoutDataSource(),i,[r]),o._path=n,t=o._request.set(r)["do"](function(e){a.isCompleted=i.length===e.paths.length},function(){a.isCompleted=!0}).materialize().flatMap(function(e){if("C"===e.kind)return u.empty();if("E"===e.kind){var t=e.exception;if(l.is(t))return u["throw"](e.exception)}return s})}else t=u["throw"](e);return t});return new this.constructor(function(e){return s.subscribe(e)})},t.exports=n},{159:159,62:62,67:67,82:82,9:9}],66:[function(e,t,r){var n=function(e){this.disposed=!1,this.currentDisposable=e};n.prototype={dispose:function(){if(!this.disposed&&this.currentDisposable){this.disposed=!0;var e=this.currentDisposable;e.dispose?e.dispose():e()}}},t.exports=n},{}],67:[function(e,t,r){var n=e(64),a=e(68),s=e(69),u={dispose:function(){}},i=e(159).Observable,o=t.exports=function(e,t,r,n){this.model=e,this.currentRemainingPaths=t,this.isJSONGraph=r||!1,this.isProgressive=n||!1};o.prototype=Object.create(i.prototype),o.prototype.subscribe=n.prototype.subscribe,o.prototype.then=n.prototype.then,o.prototype._toJSONG=function(){return new o(this.model,this.currentRemainingPaths,!0,this.isProgressive)},o.prototype.progressively=function(){return new o(this.model,this.currentRemainingPaths,this.isJSONGraph,!0)},o.prototype._subscribe=function(e){var t=[{}],r=[],n=e.isJSONG=this.isJSONGraph,i=this.isProgressive,o=a(this.model,this.currentRemainingPaths,e,i,n,t,r);return o?s(this,this.model,o,e,t,r,1):u}},{159:159,64:64,68:68,69:69}],68:[function(e,t,r){var n=e(19),v=n.getWithPathsAsJSONGraph,m=n.getWithPathsAsPathMap;t.exports=function(e,t,r,n,i,o,a){var s;if(s=i?v(e,t,o):m(e,t,o),s.criticalError)return r.onError(s.criticalError),null;var u=s.hasValue,c=!s.requestedMissingPaths||!e._source,l=o[0].json||o[0].jsonGraph;if(s.errors)for(var h=s.errors,p=a.length,f=0,d=h.length;d>f;++f,++p)a[p]=h[f];if(u&&n||l&&c)try{++e._root.syncRefCount,r.onNext(o[0])}catch(e){throw e}finally{--e._root.syncRefCount}return c?(a.length?r.onError(a):r.onCompleted(),null):s}},{19:19}],69:[function(e,t,r){var g=e(68),_=e(10),y=e(30).fastCat,b=e(49),x=e(88),w=e(66),S=e(46);t.exports=function i(o,a,e,s,u,c,l){if(10===l)throw new _;var t=a._request,h=e.requestedMissingPaths,r=e.optimizedMissingPaths,p=new w,n=[],f=a._path;if(f.length)for(var d=0,v=h.length;v>d;++d)n[d]=y(f,h[d]);else n=h;var m=t.get(n,r,function(){var e=g(a,h,s,o.isProgressive,o.isJSONGraph,u,c);if(e)p.currentDisposable=i(o,a,e,s,u,c,l+1);else{var t=a._root,r=t.cache,n=r[S];b(t,t.expired,x(r),a._maxSize,a._collectRatio,n)}});return p.currentDisposable=m,p}},{10:10,30:30,46:46,49:49,66:66,68:68,88:88}],70:[function(e,t,r){var n=e(67);t.exports=function(e){return new n(this,e)}},{67:67}],71:[function(e,t,r){var n=e(134),i=e(64),o=e(72),a=e(116),s=e(67);t.exports=function(){var t=a(arguments,o,"get");if(t!==!0)return new i(function(e){e.onError(t)});var e=n.fromPathsOrPathValues(arguments);return new s(this,e)}},{116:116,134:134,64:64,67:67,72:72}],72:[function(e,t,r){t.exports={path:!0,pathSyntax:!0}},{}],73:[function(e,t,r){function n(){}var i=e(123),o=e(159),a=o.Disposable;n.prototype.schedule=function(e){return i(e),a.empty},n.prototype.scheduleWithState=function(e,t){var r=this;return i(function(){t(r,e)}),a.empty},t.exports=n},{123:123,159:159}],74:[function(e,t,r){function n(){}var i=e(159),o=i.Disposable;n.prototype.schedule=function(e){return e(),o.empty},n.prototype.scheduleWithState=function(e,t){return t(this,e),o.empty},t.exports=n},{159:159}],75:[function(e,t,r){function n(e){this.delay=e}var i=e(159),o=i.Disposable;n.prototype.schedule=function(e){var t=setTimeout(e,this.delay);return o.create(function(){void 0!==t&&(clearTimeout(t),t=void 0)})},n.prototype.scheduleWithState=function(e,t){var r=this,n=setTimeout(function(){t(r,e)},this.delay);return o.create(function(){void 0!==n&&(clearTimeout(n),n=void 0)})},t.exports=n},{159:159}],76:[function(e,t,r){function C(e,t,r,n,i,o,a,s,u,c,l,h,p,f,d,v,m){for(var g={},_=t<e.length-1,y=e[t],b=k(y,g),x=h.index;;){l.depth=t;var w=T(r,n,i,o,a,s,b,_,!1,l,h,p,f,d,v,m);l[t]=b,l.index=t,h[h.index++]=b;var S=w[0],M=w[1];if(S&&(_?C(e,t+1,r,M,S,o,w[3],w[2],u,c,l,h,p,f,d,v,m):(O(d,S),u.push(l.slice(0,l.index+1)),c.push(h.slice(0,h.index)))),b=k(y,g),g.done)break;h.index=x}}function _(e,t,r,n,i,o,a,s,u,c,l){var h=t.value;if(o.splice(0,o.length),o.push.apply(o,h),P(t))return o.index=h.length,R(t,s,u),[void 0,e,n,r];O(u,t);var p=0,f=t,d=h.length-1,v=t=e,m=n=r;do{var g=h[p],_=d>p,y=T(e,v,t,r,m,n,g,_,!0,i,o,a,s,u,c,l);if(t=y[0],j(t))return o.index=p,y;v=y[1],n=y[2],m=y[3]}while(p++<d);if(o.index=p,f[w]!==t){var b=t[M]||0;t[M]=b+1,t[x+b]=f,f[w]=t,f[S]=b}return[t,v,n,m]}function T(e,t,r,n,i,o,a,s,u,c,l,h,p,f,d,v){for(var m=r.$type;m===b;){var g=_(e,r,n,o,c,l,h,p,f,d,v);if(r=g[0],j(r))return g;t=g[1],o=g[2],i=g[3],m=r.$type}if(void 0!==m)return[r,t,o,i];if(null==a){if(s)throw new Error("`null` is not allowed in branch key positions.");r&&(a=r[y])}else t=r,i=o,r=t[a],o=i&&i[a];return r=N(t,r,o,a,c,l,h,p,f,d,v),[r,t,o,i]}var y=e(36),x=e(43),w=e(33),E=e(46),S=e(42),M=e(44),b=e(120),O=e(50),P=e(94),A=e(96),j=e(102),R=e(86),k=e(143).iterateKeySet,L=e(92),N=e(103);t.exports=function(e,t,r,n,i){for(var o=e._root,a=o,s=o.expired,u=L(),c=o.cache,l=c[E],h=[],p=[],f=[],d=[],v=-1,m=t.length;++v<m;)for(var g=t[v],_=g.paths,y=g.jsonGraph,b=-1,x=_.length;++b<x;){var w=_[b];p.index=0,C(w,0,c,c,c,y,y,y,f,d,h,p,u,s,a,i,n)}var S=c[E],M=o.onChange;return A(M)&&l!==S&&M(),[f,d]}},{102:102,103:103,120:120,143:143,33:33,36:36,42:42,43:43,44:44,46:46,50:50,86:86,92:92,94:94,96:96}],77:[function(e,t,r){function M(e,t,r,n,i,o,a,s,u,c,l,h,p,f){var d=T(e);if(d&&d.length)for(var v=0,m=d.length,g=u.index;;){var _=d[v],y=e[_],b=j(y)&&!y.$type;s.depth=t;var x=C(r,n,i,_,y,b,!1,s,u,c,l,h,p,f);s[t]=_,s.index=t,u[u.index++]=_;var w=x[0],S=x[1];if(w&&(b?M(y,t+1,r,S,w,o,a,s,u,c,l,h,p,f):(A(h,w),o.push(s.slice(0,s.index+1)),a.push(u.slice(0,u.index)))),++v>=m)break;u.index=g}}function m(e,t,r,n,i,o,a,s,u,c){var l=r.value;if(i.splice(0,i.length),i.push.apply(i,l),S(r))return i.index=l.length,L(r,a,s),[void 0,t];A(s,r);var h=r,p=t;if(r=r[b],null!=r)p=r[E]||t,i.index=l.length;else{var f=0,d=l.length-1;p=r=t;do{var v=l[f],m=d>f,g=C(t,p,r,v,e,m,!0,n,i,o,a,s,u,c);if(r=g[0],k(r))return i.index=f,g;p=g[1]}while(f++<d);if(i.index=f,h[b]!==r){var _=r[w]||0;r[w]=_+1,r[y+_]=h,h[b]=r,h[x]=_}}return[r,p]}function C(e,t,r,n,i,o,a,s,u,c,l,h,p,f){for(var d=r.$type;d===_;){var v=m(i,e,r,s,u,c,l,h,p,f);if(r=v[0],k(r))return v;t=v[1],d=r&&r.$type}if(void 0!==d)return[r,t];if(null==n){if(o)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[g])}else t=r,r=t[n];return r=I(t,r,n,i,o,a,s,u,c,l,h,p,f),[r,t]}function T(e){if(j(e)&&!e.$type){var t=[],r=0;o(e)&&(t[r++]="length");for(var n in e)n[0]!==i&&"$"!==n[0]&&a(e,n)&&(t[r++]=n);return t}}var g=e(36),y=e(43),i=e(40),E=e(39),b=e(33),O=e(46),x=e(42),w=e(44),_=e(120),P=e(13),o=Array.isArray,A=e(50),a=e(91),j=e(100),S=e(95),R=e(96),k=e(102),L=e(86),N=e(92),I=e(104);t.exports=function(e,t,r,n,i){for(var o=e._root,a=o,s=o.expired,u=N(),c=e._path,l=o.cache,h=c.length?P(e,c).value:l,p=h[E]||l,f=l[O],d=[],v=[],m=[],g=c.length,_=-1,y=t.length;++_<y;){var b=t[_],x=c.slice(0);x.index=g,M(b.json,0,l,p,h,v,m,d,x,u,s,a,i,n)}var w=l[O],S=o.onChange;return R(S)&&f!==w&&S(),[v,m]}},{100:100,102:102,104:104,120:120,13:13,33:33,36:36,39:39,40:40,42:42,43:43,44:44,46:46,50:50,86:86,91:91,92:92,95:95,96:96}],78:[function(e,t,r){function T(e,t,r,n,i,o,a,s,u,c,l,h,p,f,d){for(var v={},m=r<t.length-1,g=t[r],_=k(g,v),y=c.index;;){u.depth=r;var b=S(n,i,o,_,e,m,!1,u,c,l,h,p,f,d);u[r]=_,u.index=r,c[c.index++]=_;var x=b[0],w=b[1];if(x&&(m?T(e,t,r+1,n,w,x,a,s,u,c,l,h,p,f,d):(M(p,x),a.push(u.slice(0,u.index+1)),s.push(c.slice(0,c.index)))),_=k(g,v),v.done)break;c.index=y}}function m(e,t,r,n,i,o,a,s,u,c){var l=r.value;if(i.splice(0,i.length),i.push.apply(i,l),C(r))return i.index=l.length,R(r,a,s),[void 0,t];M(s,r);var h=r,p=t;if(r=r[b],null!=r)p=r[E]||t,i.index=l.length;else{var f=0,d=l.length-1;p=r=t;do{var v=l[f],m=d>f,g=S(t,p,r,v,e,m,!0,n,i,o,a,s,u,c);if(r=g[0],j(r))return i.index=f,g;p=g[1]}while(f++<d);if(i.index=f,h[b]!==r){var _=r[w]||0;r[w]=_+1,r[y+_]=h,h[b]=r,h[x]=_}}return[r,p]}function S(e,t,r,n,i,o,a,s,u,c,l,h,p,f){for(var d=r.$type;d===_;){var v=m(i,e,r,s,u,c,l,h,p,f);if(r=v[0],j(r))return v;t=v[1],d=r.$type}if(void 0!==d)return[r,t];if(null==n){if(o)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[g])}else t=r,r=t[n];return r=N(t,r,n,i,o,a,s,u,c,l,h,p,f),[r,t]}var g=e(36),y=e(43),E=e(39),b=e(33),O=e(46),x=e(42),w=e(44),_=e(120),P=e(13),M=e(50),C=e(95),A=e(96),j=e(102),R=e(86),k=e(143).iterateKeySet,L=e(92),N=e(104);t.exports=function(e,t,r,n,i){for(var o=e._root,a=o,s=o.expired,u=L(),c=e._path,l=o.cache,h=c.length?P(e,c).value:l,p=h[E]||l,f=l[O],d=[],v=[],m=[],g=c.length,_=-1,y=t.length;++_<y;){var b=t[_],x=b.path,w=b.value,S=c.slice(0);S.index=g,T(w,x,0,l,p,h,v,m,d,S,u,s,a,i,n)}var M=l[O],C=o.onChange;return A(C)&&f!==M&&C(),[v,m]}},{102:102,104:104,120:120,13:13,143:143,33:33,36:36,39:39,42:42,43:43,44:44,46:46,50:50,86:86,92:92,95:95,96:96}],79:[function(e,t,r){var s=e(130),u=e(64),c=e(101);t.exports=function(e,t){for(var r=c(e)?e:s.pathValue(e,t),n=0,o=r.path,i=o.length;++n<i;)if("object"==typeof o[n])return new u(function(e){e.onError(new Error("Paths must be simple paths"))});var a=this;return new u(function(i){return a._set(r).subscribe(function(e){for(var t=e.json,r=-1,n=o.length;t&&++r<n;)t=t[o[r]];i.onNext(t)},function(e){i.onError(e)},function(){i.onCompleted()})})}},{101:101,130:130,64:64}],80:[function(e,t,r){var u=e(134),c=e(101),l=e(78);t.exports=function(e,t,r,n){var i=u.fromPath(e),o=t,a=r,s=n;if(c(i)?(s=a,a=o,o=i):o={path:i,value:o},c(o)===!1)throw new Error("Model#setValueSync must be called with an Array path.");return"function"!=typeof a&&(a=this._root._errorSelector),"function"!=typeof s&&(s=this._root._comparator),this._syncCheck("setValueSync")?(l(this,[o]),this._getValueSync(this,o.path).value):void 0}},{101:101,134:134,78:78}],81:[function(e,t,r){t.exports=function(e){if(!e)return e;for(var t=-1,r=e.length,n=[];++t<r;)n[t]=e[t];return n}},{}],82:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=-1,i=e.length,o=[];++n<i;)for(var a=t(e[n],n,e),s=-1,u=a.length;++s<u;)o[++r]=a[s];return o}},{}],83:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=e.length,i=new Array(n);++r<n;)i[r]=t(e[r],r,e);return i}},{}],84:[function(e,t,r){t.exports=function(e,t,r){var n=t||0,i=-1,o=e.length-n;0>o&&(o=0),r>0&&o>r&&(o=r);for(var a=new Array(o);++i<o;)a[i]=e[i+n];return a}},{}],85:[function(e,t,r){var i=e(40),o=e(91),a=Array.isArray,s=e(100);t.exports=function(e){var t=e;if(s(t)){t=a(e)?[]:{};var r=e;for(var n in r)n[0]!==i&&o(r,n)&&(t[n]=r[n])}return t}},{100:100,40:40,91:91}],86:[function(e,t,r){var n=e(51),i=e(35);t.exports=function(e,t,r){return e[i]||(e[i]=!0,t.push(e),n(r,e)),e}},{35:35,51:51}],87:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&e.$expires||void 0}},{100:100}],88:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&e.$size||0}},{100:100}],89:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&e.$timestamp||void 0}},{100:100}],90:[function(e,t,r){var n=e(100);t.exports=function(e,t){var r=n(e)&&e.$type||void 0;return t&&r?"branch":r}},{100:100}],91:[function(e,t,r){var n=e(100),i=Object.prototype.hasOwnProperty;t.exports=function(e,t){return n(e)&&i.call(e,t)}},{100:100}],92:[function(e,t,r){var n=1;t.exports=function(){return n++}},{}],93:[function(e,t,r){var i=e(36),o=e(39),a=e(46);t.exports=function(e,t,r,n){return e[i]=r,e[o]=t,e[a]=n,t[r]=e,e}},{36:36,39:39,46:46}],94:[function(e,t,r){var n=e(106),i=e(122),o=e(121);t.exports=function(e){var t=e.$expires;return null!=t&&t!==o&&t!==i&&t<n()}},{106:106,121:121,122:122}],95:[function(e,t,r){var n=e(106),i=e(122),o=e(121);t.exports=function(e){var t=e.$expires;return null!=t&&t!==o&&(t===i||t<n())}},{106:106,121:121,122:122}],96:[function(e,t,r){var n="function";t.exports=function(e){return Boolean(e)&&typeof e===n}},{}],97:[function(e,t,r){var n=e(40);t.exports=function(e){return"$size"===e||e&&e.charAt(0)===n}},{40:40}],98:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&"json"in e}},{100:100}],99:[function(e,t,r){var n=Array.isArray,i=e(100);t.exports=function(e){return i(e)&&n(e.paths)&&(i(e.jsonGraph)||i(e.jsong)||i(e.json)||i(e.values)||i(e.value))}},{100:100}],100:[function(e,t,r){var n="object";t.exports=function(e){return null!==e&&typeof e===n}},{}],101:[function(e,t,r){var n=Array.isArray,i=e(100);t.exports=function(e){return i(e)&&(n(e.path)||"string"==typeof e.path)}},{100:100}],102:[function(e,t,r){var n="object";t.exports=function(e){return null==e||typeof e!==n}},{}],103:[function(e,t,r){var y=e(36),b=e(39),x=e(120),w=e(119),S=e(88),M=e(89),C=e(100),T=e(95),E=e(96),O=e(50),P=e(117),A=e(93),j=e(86),R=e(110),k=e(115),L=e(107);t.exports=function(e,t,r,n,i,o,a,s,u,c,l){var h,p,f,d,v,m,g;if(t===r){if(null===r)return t=P(r,void 0,r),e=k(e,-t.$size,u,a),t=A(t,e,n),O(u,t),t;if(void 0===r)return r;if(d=C(t),d&&(p=t.$type,null==p))return null==t[b]&&(t[y]=n,t[b]=e),t}else d=C(t),d&&(p=t.$type);if(p!==x){if(v=C(r),v&&(f=r.$type),d&&!p&&(null==r||v&&!f))return t}else{if(null==r)return T(t)?void j(t,s,u):t;if(v=C(r),v&&(f=r.$type,f===x))if(t===r){if(null!=t[b])return t}else if(m=t.$timestamp,g=r.$timestamp,!T(t)&&!T(r)&&m>g)return}if(p&&v&&!f)return A(R(t,r,e,n,u),e,n);if(f||!v){if(f===w&&E(l)&&(r=l(L(i,n),r)),f&&t===r)null==t[b]&&(t=P(t,p,t.value),e=k(e,-t.$size,u,a),t=A(t,e,n,a));else{var _=!0;!p&&d||(_=M(r)<M(t)==!1,(p||f)&&E(c)&&(_=!c(t,r,o.slice(0,o.index)))),_&&(r=P(r,f,f?r.value:r),h=S(t)-S(r),t=R(t,r,e,n,u),e=k(e,h,u,a),t=A(t,e,n,a))}T(t)?j(t,s,u):O(u,t)}else null==t&&(t=A(r,e,n));return t}},{100:100,107:107,110:110,115:115,117:117,119:119,120:120,36:36,39:39,50:50,86:86,88:88,89:89,93:93,95:95,96:96}],104:[function(e,t,r){var _=e(120),y=e(119),b=e(90),x=e(88),w=e(89),S=e(95),M=e(102),C=e(96),T=e(117),E=e(86),O=e(93),P=e(110),A=e(115),j=e(114),R=e(107);t.exports=function(e,t,r,n,i,o,a,s,u,c,l,h,p){var f=b(t,o);if(i||o)f&&S(t)&&(f="expired",E(t,c,l)),(f&&f!==_||M(t))&&(t=P(t,{},e,r,l),t=O(t,e,r,u),t=j(t,u));else{var d=n,v=b(d),m=w(d)<w(t)==!1;if((f||v)&&C(h)&&(m=!h(t,d,s.slice(0,s.index))),m){v===y&&C(p)&&(d=p(R(a,r),d)),d=T(d,v,v?d.value:d);var g=x(t)-x(d);t=P(t,d,e,r,l),e=A(e,g,l,u),t=O(t,e,r,u)}}return t}},{102:102,107:107,110:110,114:114,115:115,117:117,119:119,120:120,86:86,88:88,89:89,90:90,93:93,95:95,96:96}],105:[function(e,t,r){t.exports=function(){}},{}],106:[function(e,t,r){t.exports=Date.now},{}],107:[function(e,t,r){t.exports=function(e,t){var r=e.slice(0,e.depth);return r[r.length]=t,r}},{}],108:[function(e,t,r){var o=e(120),a=e(39),s=e(51),u=e(100),c=e(112),l=e(113);t.exports=function(e,t,r,n){if(u(e)){var i=e.$type;return Boolean(i)&&(i===o&&l(e),s(n,e)),c(e),t[r]=e[a]=void 0,!0}return!1}},{100:100,112:112,113:113,120:120,39:39,51:51}],109:[function(e,t,r){var a=e(91),s=e(40),u=e(108);t.exports=function e(t,r,n,i){if(u(t,r,n,i)){if(null==t.$type)for(var o in t)o[0]!==s&&"$"!==o[0]&&a(t,o)&&e(t[o],t,o,i);return!0}return!1}},{108:108,40:40,91:91}],110:[function(e,t,r){var o=e(100),a=e(111),s=e(109);t.exports=function(e,t,r,n,i){return e===t?e:(o(e)&&(a(e,t),s(e,r,n,i)),r[n]=t,t)}},{100:100,109:109,111:111}],111:[function(e,t,r){var a=e(43),s=e(33),u=e(44);t.exports=function(e,t){for(var r=e[u]||0,n=t[u]||0,i=-1;++i<r;){var o=e[a+i];void 0!==o&&(o[s]=t,t[a+(n+i)]=o,e[a+i]=void 0)}return t[u]=r+n,e[u]=void 0,t}},{33:33,43:43,44:44}],112:[function(e,t,r){var i=e(43),o=e(33),a=e(42),s=e(44);t.exports=function(e){for(var t=-1,r=e[s]||0;++t<r;){var n=e[i+t];null!=n&&(n[o]=n[a]=e[i+t]=void 0)}return e[s]=void 0,e}},{33:33,42:42,43:43,44:44}],113:[function(e,t,r){var i=e(43),o=e(33),a=e(42),s=e(44);t.exports=function(e){var t=e[o];if(t){for(var r=(e[a]||0)-1,n=(t[s]||0)-1;++r<=n;)t[i+r]=t[i+(r+1)];t[s]=n,e[a]=e[o]=t=void 0}return e}},{33:33,42:42,43:43,44:44}],114:[function(e,t,r){var s=e(43),u=e(39),c=e(46),l=e(44);t.exports=function(e,t){var r=[e],n=0;do{var i=r[n--];if(i&&i[c]!==t){i[c]=t,r[n++]=i[u];for(var o=-1,a=i[l]||0;++o<a;)r[n++]=i[s+o]}}while(n>-1);return e}},{39:39,43:43,44:44,46:46}],115:[function(e,t,r){var s=e(36),u=e(46),c=e(39),l=e(108),h=e(114);t.exports=function(e,t,r,n){var i=e;do{var o=i[c],a=i.$size=(i.$size||0)-t;0>=a&&null!=o?l(i,o,i[s],r):i[u]!==n&&h(i,n),i=o}while(i);return e}},{108:108,114:114,36:36,39:39,46:46}],116:[function(e,t,r){var s=Array.isArray,u=e(101),c=e(99),l=e(98),h=e(134);t.exports=function(e,t,r){for(var n=0,i=e.length;i>n;++n){var o=e[n],a=!1;if(s(o)&&t.path?a=!0:"string"==typeof o&&t.pathSyntax?a=!0:u(o)&&t.pathValue?(o.path=h.fromPath(o.path),a=!0):c(o)&&t.jsonGraph?a=!0:l(o)&&t.json?a=!0:"function"==typeof o&&n+1===i&&t.selector&&(a=!0),!a)return new Error("Unrecognized argument "+typeof o+" ["+String(o)+"] to Model#"+r)}return!0}},{101:101,134:134,98:98,99:99}],117:[function(e,t,r){var n=e(130),s=n.atom,u=e(106),c=e(122),l=e(37),h=50,p=e(85),f=Array.isArray,d=e(88),v=e(87);t.exports=function(e,t,r){var n=0,i=e,o=t;if(o?(i=p(i),n=d(i),i.$type=o):(i=s(r),o=i.$type,i[l]=!0),null==r)n=h+1;else if(null==n||0>=n)switch(typeof r){case"object":n=f(r)?h+r.length:h+1;break;case"string":n=h+r.length;break;default:n=h+1}var a=v(i);return"number"==typeof a&&c>a&&(i.$expires=u()+-1*a),i.$size=n,i}},{106:106,122:122,130:130,37:37,85:85,87:87,88:88}],118:[function(e,t,r){t.exports="atom"},{}],119:[function(e,t,r){t.exports="error"},{}],120:[function(e,t,r){t.exports="ref"},{}],121:[function(e,t,r){t.exports=1},{}],122:[function(e,t,r){t.exports=0},{}],123:[function(e,t,r){"use strict";function n(){if(u.length)throw u.shift()}function i(e){var t;t=s.length?s.pop():new o,t.task=e,a(t)}function o(){this.task=null}var a=e(124),s=[],u=[],c=a.makeRequestCallFromTimer(n);t.exports=i,o.prototype.call=function(){try{this.task.call()}catch(e){i.onerror?i.onerror(e):(u.push(e),c())}finally{this.task=null,s[s.length]=this}}},{124:124}],124:[function(e,h,t){(function(e){"use strict";function t(e){a.length||(o(),s=!0),a[a.length]=e}function r(){for(;u<a.length;){var e=u;if(u+=1,a[e].call(),u>c){for(var t=0,r=a.length-u;r>t;t++)a[t]=a[t+u];a.length-=u,u=0}}a.length=0,u=0,s=!1}function n(e){var t=1,r=new l(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}function i(n){return function(){function e(){clearTimeout(t),clearInterval(r),n()}var t=setTimeout(e,0),r=setInterval(e,50)}}h.exports=t;var o,a=[],s=!1,u=0,c=1024,l=e.MutationObserver||e.WebKitMutationObserver;o="function"==typeof l?n(r):i(r),t.requestFlush=o,t.makeRequestCallFromTimer=i}).call(this,"undefined"!=typeof n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(e,t,r){"use strict";function c(e,t){var r;for(r in t)e[r]=t[r];return e}function n(e,t){if(this._jsongUrl=e,"number"==typeof t){var r={timeout:t};t=r}this._config=c({timeout:15e3,headers:{}},t||{})}var l=e(129),i=e(126);Array.isArray;n.prototype={constructor:n,buildQueryObject:i,get:function(e){var t="GET",r=this.buildQueryObject(this._jsongUrl,t,{paths:e,method:"get"}),n=c(r,this._config),i=this;return l(t,n,i)},set:function(e){var t="POST",r=this.buildQueryObject(this._jsongUrl,t,{jsonGraph:e,method:"set"}),n=c(r,this._config);n.headers["Content-Type"]="application/x-www-form-urlencoded";var i=this;return l(t,n,i)},call:function(e,t,r,n){t=t||[],r=r||[],n=n||[];var i="POST",o=[];o.push("method=call"),o.push("callPath="+encodeURIComponent(JSON.stringify(e))),o.push("arguments="+encodeURIComponent(JSON.stringify(t))),o.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),o.push("paths="+encodeURIComponent(JSON.stringify(n)));var a=this.buildQueryObject(this._jsongUrl,i,o.join("&")),s=c(a,this._config);s.headers["Content-Type"]="application/x-www-form-urlencoded";var u=this;return l(i,s,u)}},n.XMLHttpSource=n,n["default"]=n,t.exports=n},{126:126,129:129}],126:[function(e,t,r){"use strict";t.exports=function(e,t,r){var n,i=[],o={url:e},a=-1!==e.indexOf("?"),s=a?"&":"?";return"string"==typeof r?i.push(r):(n=Object.keys(r),n.forEach(function(e){var t="object"==typeof r[e]?JSON.stringify(r[e]):r[e];i.push(e+"="+encodeURIComponent(t))})),"GET"===t?o.url+=s+i.join("&"):o.data=i.join("&"),o}},{}],127:[function(e,r,t){(function(t){"use strict";r.exports=function(){var e=new t.XMLHttpRequest;if("withCredentials"in e)return e;if(t.XDomainRequest)return new XDomainRequest;throw new Error("CORS is not supported by your browser")}}).call(this,"undefined"!=typeof n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],128:[function(e,t,r){(function(n){"use strict";t.exports=function(){var e,t,r;if(n.XMLHttpRequest)return new n.XMLHttpRequest;try{for(t=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=0;3>r;r++)try{if(e=t[r],new n.ActiveXObject(e))break}catch(e){}return new n.ActiveXObject(e)}catch(e){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,"undefined"!=typeof n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(e,t,r){"use strict";function n(){}function i(s,u,c){return n.create(function(t){var r,n,e,i,o,a={method:s||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(o in u)d.call(u,o)&&(a[o]=u[o]);a.crossDomain||a.headers["X-Requested-With"]||(a.headers["X-Requested-With"]="XMLHttpRequest"),null!=c.onBeforeRequest&&c.onBeforeRequest(a);try{r=a.crossDomain?f():p()}catch(e){t.onError(e)}try{a.user?r.open(a.method,a.url,a.async,a.user,a.password):r.open(a.method,a.url,a.async),r.timeout=a.timeout,r.withCredentials=a.withCredentials!==!1,e=a.headers;for(i in e)d.call(e,i)&&r.setRequestHeader(i,e[i]);if(a.responseType)try{r.responseType=a.responseType}catch(e){if("json"!==a.responseType)throw e}r.onreadystatechange=function(e){4===r.readyState&&(n||(n=!0,l(t,r,e)))},r.ontimeout=function(e){n||(n=!0,h(t,r,"timeout error",e))},r.send(a.data)}catch(e){t.onError(e)}return function(){n||4===r.readyState||(n=!0,r.abort())}})}function a(e,t,r){r||(r=new Error(t)),e.onError(r)}function l(e,t,r){var n,i;if(t&&e){i=t.responseType,n="response"in t?t.response:t.responseText;var o=1223===t.status?204:t.status;if(o>=200&&399>=o){try{"json"!==i&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){a(e,"invalid json",r)}return e.onNext(n),void e.onCompleted()}return 401===o||403===o||407===o?a(e,n):410===o?a(e,n):408===o||504===o?a(e,n):a(e,n||"Response code "+o)}}function h(e,t,r,n){a(e,r||t.statusText||"request error",n)}var p=e(128),f=e(127),d=Object.prototype.hasOwnProperty,s=function(){};n.create=function(o){var e=new n;return e.subscribe=function(e,t,r){var n,i;return n="function"==typeof e?{onNext:e,onError:t||s,onCompleted:r||s}:e,i=o(n),"function"==typeof i?{dispose:i}:i},e},t.exports=i},{127:127,128:128}],130:[function(e,t,r){function n(e,t,r){var n=Object.create(null);if(null!=r){for(var i in r)n[i]=r[i];return n.$type=e,n.value=t,n}return{$type:e,value:t}}var i=e(134);t.exports={ref:function(e,t){return n("ref",i.fromPath(e),t)},atom:function(e,t){return n("atom",e,t)},undefined:function(){return n("atom")},error:function(e,t){return n("error",e,t)},pathValue:function(e,t){return{path:i.fromPath(e),value:t}},pathInvalidation:function(e){return{path:i.fromPath(e),invalidated:!0}}}},{134:134}],131:[function(e,t,r){t.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],132:[function(e,t,r){var n={token:"token",dotSeparator:".",commaSeparator:",",openingBracket:"[",closingBracket:"]",openingBrace:"{",closingBrace:"}",escape:"\\",space:" ",colon:":",quote:"quote",unknown:"unknown"};t.exports=n},{}],133:[function(e,t,r){t.exports={indexer:{nested:"Indexers cannot be nested.",needQuotes:"unquoted indexers must be numeric.",empty:"cannot have empty indexers.",leadingDot:"Indexers cannot have leading dots.",leadingComma:"Indexers cannot have leading comma.",requiresComma:"Indexers require commas between indexer args.",routedTokens:"Only one token can be used per indexer when specifying routed tokens."},range:{precedingNaN:"ranges must be preceded by numbers.",suceedingNaN:"ranges must be suceeded by numbers."},routed:{invalid:"Invalid routed token.  only integers|ranges|keys are supported."},quote:{empty:"cannot have empty quoted keys.",illegalEscape:"Invalid escape character.  Only quotes are escapable."},unexpectedToken:"Unexpected token.",invalidIdentifier:"Invalid Identifier.",invalidPath:"Please provide a valid path.",throwError:function(e,t,r){if(r)throw e+" -- "+t.parseString+" with next token: "+r;throw e+" -- "+t.parseString}}},{}],134:[function(e,t,r){var n=e(140),i=e(135),o=e(131),a=function(e,t){return i(new n(e,t))};t.exports=a,a.fromPathsOrPathValues=function(e,t){if(!e)return[];for(var r=[],n=0,i=e.length;i>n;n++)"string"==typeof e[n]?r[n]=a(e[n],t):"string"==typeof e[n].path?r[n]={path:a(e[n].path,t),value:e[n].value}:r[n]=e[n];return r},a.fromPath=function(e,t){return e?"string"==typeof e?a(e,t):e:[]},a.RoutedTokens=o},{131:131,135:135,140:140}],135:[function(e,t,r){var o=e(132),a=e(133),s=e(136);t.exports=function(e){for(var t=e.next(),r={},n=[];!t.done;){switch(t.type){case o.token:var i=+t.token[0];isNaN(i)||a.throwError(a.invalidIdentifier,e),n[n.length]=t.token;break;case o.dotSeparator:0===n.length&&a.throwError(a.unexpectedToken,e);break;case o.space:break;case o.openingBracket:s(e,t,r,n);break;default:a.throwError(a.unexpectedToken,e)}t=e.next()}return 0===n.length&&a.throwError(a.invalidPath,e),n}},{132:132,133:133,136:136}],136:[function(e,t,r){var c=e(132),l=e(133),h=l.indexer,p=e(138),f=e(137),d=e(139);t.exports=function(e,t,r,n){var i=e.next(),o=!1,a=1,s=!1;for(r.indexer=[];!i.done;){switch(i.type){case c.token:case c.quote:r.indexer.length===a&&l.throwError(h.requiresComma,e)}switch(i.type){case c.openingBrace:s=!0,d(e,i,r,n);break;case c.token:var u=+i.token;isNaN(u)&&l.throwError(h.needQuotes,e),r.indexer[r.indexer.length]=u;break;case c.dotSeparator:r.indexer.length||l.throwError(h.leadingDot,e),p(e,i,r,n);break;case c.space:break;case c.closingBracket:o=!0;break;case c.quote:f(e,i,r,n);break;case c.openingBracket:l.throwError(h.nested,e);break;case c.commaSeparator:++a;break;default:l.throwError(l.unexpectedToken,e)}if(o)break;i=e.next()}0===r.indexer.length&&l.throwError(h.empty,e),r.indexer.length>1&&s&&l.throwError(h.routedTokens,e),1===r.indexer.length&&(r.indexer=r.indexer[0]),n[n.length]=r.indexer,r.indexer=void 0}},{132:132,133:133,137:137,138:138,139:139}],137:[function(e,t,r){var c=e(132),l=e(133),h=l.quote;t.exports=function(e,t,r,n){for(var i=e.next(),o="",a=t.token,s=!1,u=!1;!i.done;){switch(i.type){case c.token:case c.space:case c.dotSeparator:case c.commaSeparator:case c.openingBracket:case c.closingBracket:case c.openingBrace:case c.closingBrace:s&&l.throwError(h.illegalEscape,e),o+=i.token;break;case c.quote:s?(o+=i.token,s=!1):i.token!==a?o+=i.token:u=!0;break;case c.escape:s=!0;break;default:l.throwError(l.unexpectedToken,e)}if(u)break;i=e.next()}0===o.length&&l.throwError(h.empty,e),r.indexer[r.indexer.length]=o}},{132:132,133:133}],138:[function(e,t,r){var h=e(140),p=e(132),f=e(133);t.exports=function(e,t,r,n){var i,o=e.peek(),a=1,s=!1,u=!0,c=r.indexer.length-1,l=h.toNumber(r.indexer[c]);for(isNaN(l)&&f.throwError(f.range.precedingNaN,e);!s&&!o.done;){switch(o.type){case p.dotSeparator:3===a&&f.throwError(f.unexpectedToken,e),++a,3===a&&(u=!1);break;case p.token:i=h.toNumber(e.next().token),isNaN(i)&&f.throwError(f.range.suceedingNaN,e),s=!0;break;default:s=!0}if(s)break;e.next(),o=e.peek()}r.indexer[c]={from:l,to:u?i:i-1}}},{132:132,133:133,140:140}],139:[function(e,t,r){var c=e(132),l=e(131),h=e(133),p=h.routed;t.exports=function(e,t,r,n){var i=e.next(),o=!1,a="";switch(i.token){case l.integers:case l.ranges:case l.keys:break;default:h.throwError(p.invalid,e)}var s=e.next();if(s.type===c.colon&&(o=!0,s=e.next(),s.type!==c.token&&h.throwError(p.invalid,e),a=s.token,s=e.next()),s.type===c.closingBrace){var u={type:i.token,named:o,name:a};r.indexer[r.indexer.length]=u}else h.throwError(p.invalid,e)}},{131:131,132:132,133:133}],140:[function(e,t,r){function c(e,t,r){return{token:e,done:r,type:t}}function n(e,t,r){var n,i=!1,o="",a=r?S:w;do{if(n=t+1>=e.length)break;var s=e[t+1];if(void 0===s||-1!==a.indexOf(s)){if(o.length)break;++t;var u;switch(s){case h:u=l.dotSeparator;break;case p:u=l.commaSeparator;break;case f:u=l.openingBracket;break;case d:u=l.closingBracket;break;case v:u=l.openingBrace;break;case m:u=l.closingBrace;break;case x:u=l.space;break;case y:case b:u=l.quote;break;case _:u=l.escape;break;case g:u=l.colon;break;default:u=l.unknown}i=c(s,u,!1);break}o+=s,++t}while(!n);return!i&&o.length&&(i=c(o,l.token,!1)),i||(i={done:!0}),{token:i,idx:t}}var l=e(132),h=".",p=",",f="[",d="]",v="{",m="}",g=":",_="\\",y='"',b="'",x=" ",w="\\'\"[]., ",S="\\{}'\"[]., :",i=t.exports=function(e,t){this._string=e,this._idx=-1,this._extended=t,this.parseString=""};i.prototype={next:function(){var e=this._nextToken?this._nextToken:n(this._string,this._idx,this._extended);return this._idx=e.idx,this._nextToken=!1,this.parseString+=e.token.token,e.token},peek:function(){var e=this._nextToken?this._nextToken:n(this._string,this._idx,this._extended);return this._nextToken=e,e.token}},i.toNumber=function(e){return isNaN(+e)?NaN:+e}},{132:132}],141:[function(e,t,r){var n=e(147),i=e(148);t.exports=function(e){var t=e.reduce(function(e,t){var r=t.length;return e[r]||(e[r]=[]),e[r].push(t),e},{});return Object.keys(t).forEach(function(e){t[e]=i(t[e])}),n(t)}},{147:147,148:148}],142:[function(e,t,r){var p=e(144);t.exports=function e(t,r,n){for(var i=t,o=!0;o&&n<r.length;++n){var a=r[n],s=typeof a;if(a&&"object"===s){var u={},c=p(a,u),l=n+1;do{var h=i[c];o=void 0!==h,o&&(o=e(h,r,l)),c=p(a,u)}while(o&&!u.done);break}i=i[a],o=void 0!==i}return o}},{144:144}],143:[function(e,t,r){t.exports={iterateKeySet:e(144),toTree:e(148),toTreeWithUnion:e(149),pathsComplementFromTree:e(146),pathsComplementFromLengthTree:e(145),hasIntersection:e(142),toPaths:e(147),collapse:e(141)}},{141:141,142:142,144:144,145:145,146:146,147:147,148:148,149:149}],144:[function(e,t,r){function s(e,t){var r=t.from=e.from||0,n=t.to=e.to||"number"==typeof e.length&&t.from+e.length-1||0;t.rangeOffset=t.from,t.loaded=!0,r>n&&(t.empty=!0)}function u(e,t){t.done=!1;var r=t.isObject=!(!e||"object"!=typeof e);t.isArray=r&&n(e),t.arrayOffset=0}var n=Array.isArray;t.exports=function(e,t){if(void 0===t.isArray&&u(e,t),t.isArray){var r;do{t.loaded&&t.rangeOffset>t.to&&(++t.arrayOffset,t.loaded=!1);var n=t.arrayOffset,i=e.length;if(n>=i){t.done=!0;break}var o=e[t.arrayOffset],a=typeof o;if("object"===a){if(t.loaded||s(o,t),t.empty)continue;r=t.rangeOffset++}else++t.arrayOffset,r=o}while(void 0===r);return r}return t.isObject?(t.loaded||s(e,t),t.rangeOffset>t.to?void(t.done=!0):t.rangeOffset++):(t.done=!0,e)}},{}],145:[function(e,t,r){var s=e(142);t.exports=function(e,t){for(var r=[],n=-1,i=0,o=e.length;o>i;++i){var a=e[i];s(t[a.length],a,0)||(r[++n]=a)}return r}},{142:142}],146:[function(e,t,r){var a=e(142);t.exports=function(e,t){for(var r=[],n=-1,i=0,o=e.length;o>i;++i)a(t,e[i],0)||(r[++n]=e[i]);return r}},{142:142}],147:[function(e,t,r){function u(e){return null!==e&&typeof e===n}function M(e,t,r){var n,i,o,a,s,u,c,l,h,p,f,d,v,m,g=T(String(t)),_=Object.create(null),y=[],b=-1,x=0,w=[],S=0;if(a=[],s=-1,r-1>t){for(u=C(e,a);++s<u;)n=a[s],i=M(e[n],t+1,r),o=i.code,_[o]?i=_[o]:(y[x++]=o,i=_[o]={keys:[],sets:i.sets}),g=T(g+n+o),E(n)&&i.keys.push(parseInt(n,10))||i.keys.push(n);for(;++b<x;)if(n=y[b],i=_[n],a=i.keys,u=a.length,u>0)for(c=i.sets,l=-1,h=c.length,v=a[0];++l<h;){for(p=c[l],f=-1,d=p.length,m=new Array(d+1),m[0]=u>1&&a||v;++f<d;)m[f+1]=p[f];w[S++]=m}}else for(u=C(e,a),u>1?w[S++]=[a]:w[S++]=a;++s<u;)g=T(g+a[s]);return{code:g,sets:w}}function c(e){for(var t=-1,r=e.length;++t<r;){var n=e[t];o(n)&&(e[t]=i(n))}return e}function i(e){for(var t=-1,r=e.length-1,n=r>0;++t<=r;){var i=e[t];if(!E(i)){n=!1;break}e[t]=parseInt(i,10)}if(n===!0){e.sort(s);var o=e[0],a=e[r];if(r>=a-o)return{from:o,to:a}}return e}function s(e,t){return e-t}function C(e,t,r){var n=0;for(var i in e)t[n++]=i;return n>1&&t.sort(r),n}function T(e){for(var t=5381,r=-1,n=e.length;++r<n;)t=(t<<5)+t+e.charCodeAt(r);return String(t)}function E(e){return!o(e)&&e-parseFloat(e)+1>=0}var o=Array.isArray,n="object";t.exports=function(e){var t,r=[],n=0;for(var i in e)if(E(i)&&u(t=e[i]))for(var o=M(t,0,parseInt(i,10)).sets,a=-1,s=o.length;++a<s;)r[n++]=c(o[a]);return r}},{}],148:[function(e,t,r){function u(e,t,r){var n,i=t[r],o={},a=r+1;n=c(i,o);do{var s=e[n];s||(a===t.length?e[n]=null:s=e[n]={}),a<t.length&&u(s,t,a),o.done||(n=c(i,o))}while(!o.done)}var c=e(144);Array.isArray;t.exports=function(e){return e.reduce(function(e,t){return u(e,t,0),e},{})}},{144:144}],149:[function(e,t,r){},{}],150:[function(e,t,r){function n(){l=!1,s.length?c=s.concat(c):h=-1,c.length&&i()}function i(){if(!l){var e=setTimeout(n);l=!0;for(var t=c.length;t;){for(s=c,c=[];++h<t;)s&&s[h].run();h=-1,t=c.length}s=null,l=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function a(){}var s,u=t.exports={},c=[],l=!1,h=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new o(e,t)),1!==c.length||l||setTimeout(i,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=a,u.addListener=a,u.once=a,u.off=a,u.removeListener=a,u.removeAllListeners=a,u.emit=a,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],151:[function(e,t,r){"use strict";t.exports=e(156)},{156:156}],152:[function(e,t,r){"use strict";function a(){}function n(e){try{return e.then}catch(e){return m=e,g}}function i(e,t){try{return e(t)}catch(e){return m=e,g}}function o(e,t,r){try{e(t,r)}catch(e){return m=e,g}}function s(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._37=0,this._12=null,this._59=[],e!==a&&d(e,this)}function u(n,i,o){return new n.constructor(function(e,t){var r=new s(a);r.then(e,t),c(n,new f(i,o,r))})}function c(r,n){for(;3===r._37;)r=r._12;return 0===r._37?void r._59.push(n):void v(function(){var e=1===r._37?n.onFulfilled:n.onRejected;if(null===e)return void(1===r._37?l(n.promise,r._12):h(n.promise,r._12));var t=i(e,r._12);t===g?h(n.promise,m):l(n.promise,t)})}function l(e,t){if(t===e)return h(e,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var r=n(t);if(r===g)return h(e,m);if(r===e.then&&t instanceof s)return e._37=3,e._12=t,void p(e);if("function"==typeof r)return void d(r.bind(t),e)}e._37=1,e._12=t,p(e)}function h(e,t){e._37=2,e._12=t,p(e)}function p(e){for(var t=0;t<e._59.length;t++)c(e,e._59[t]);e._59=null}function f(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function d(e,t){var r=!1,n=o(e,function(e){r||(r=!0,l(t,e))},function(e){r||(r=!0,h(t,e))});r||n!==g||(r=!0,h(t,m))}var v=e(124),m=null,g={};t.exports=s,s._99=a,s.prototype.then=function(e,t){if(this.constructor!==s)return u(this,e,t);var r=new s(a);return c(this,new f(e,t,r)),r}},{124:124}],153:[function(e,t,r){"use strict";var n=e(152);t.exports=n,n.prototype.done=function(e,t){var r=arguments.length?this.then.apply(this,arguments):this;r.then(null,function(e){setTimeout(function(){throw e},0)})}},{152:152}],154:[function(e,t,r){"use strict";function n(e){var t=new c(c._99);return t._37=1,t._12=e,t}var c=e(152);t.exports=c;var i=n(!0),o=n(!1),a=n(null),s=n(void 0),u=n(0),l=n("");c.resolve=function(e){if(e instanceof c)return e;if(null===e)return a;if(void 0===e)return s;if(e===!0)return i;if(e===!1)return o;if(0===e)return u;if(""===e)return l;if("object"==typeof e||"function"==typeof e)try{var t=e.then;if("function"==typeof t)return new c(t.bind(e))}catch(r){return new c(function(e,t){t(r)})}return n(e)},c.all=function(e){var u=Array.prototype.slice.call(e);return new c(function(i,o){function a(t,e){if(e&&("object"==typeof e||"function"==typeof e)){if(e instanceof c&&e.then===c.prototype.then){for(;3===e._37;)e=e._12;return 1===e._37?a(t,e._12):(2===e._37&&o(e._12),void e.then(function(e){a(t,e)},o))}var r=e.then;if("function"==typeof r){var n=new c(r.bind(e));return void n.then(function(e){a(t,e)},o)}}u[t]=e,0===--s&&i(u)}if(0===u.length)return i([]);for(var s=u.length,e=0;e<u.length;e++)a(e,u[e])})},c.reject=function(r){return new c(function(e,t){t(r)})},c.race=function(e){return new c(function(t,r){e.forEach(function(e){c.resolve(e).then(t,r)})})},c.prototype["catch"]=function(e){return this.then(null,e)}},{152:152}],155:[function(e,t,r){"use strict";var n=e(152);t.exports=n,n.prototype["finally"]=function(t){return this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})}},{152:152}],156:[function(e,t,r){"use strict";t.exports=e(152),e(153),e(155),e(154),e(157)},{152:152,153:153,154:154,155:155,157:157}],157:[function(e,t,r){"use strict";var a=e(152),i=e(123);t.exports=a,a.denodeify=function(o,e){return e=e||1/0,function(){var t=this,i=Array.prototype.slice.call(arguments,0,e>0?e:0);return new a(function(r,n){i.push(function(e,t){e?n(e):r(t)});var e=o.apply(t,i);!e||"object"!=typeof e&&"function"!=typeof e||"function"!=typeof e.then||r(e)})}},a.nodeify=function(r){return function(){var e=Array.prototype.slice.call(arguments),t="function"==typeof e[e.length-1]?e.pop():null,n=this;try{return r.apply(this,arguments).nodeify(t,n)}catch(r){if(null===t||"undefined"==typeof t)return new a(function(e,t){t(r)});i(function(){t.call(n,r)})}}},a.prototype.nodeify=function(t,r){return"function"!=typeof t?this:void this.then(function(e){i(function(){t.call(r,null,e)})},function(e){i(function(){t.call(r,e)})})}},{123:123,152:152}],158:[function(s,u,c){(function(a){(function(r){var e={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,t=e[typeof c]&&c&&!c.nodeType&&c,i=e[typeof u]&&u&&!u.nodeType&&u,o=(i&&i.exports===t&&t,e[typeof a]&&a);!o||o.global!==o&&o.window!==o||(n=o),"function"==typeof Ir&&Ir.amd?Ir(["rx"],function(e,t){return r(n,t,e)}):"object"==typeof u&&u&&u.exports===t?u.exports=r(n,u.exports,s(159)):n.Rx=r(n,{},n.Rx)}).call(this,function(s,e,t,u){function r(){try{return f.apply(this,arguments)}catch(e){return N.e=e,N}}function n(e){if(!M(e))throw new TypeError("fn must be a function");return f=e,r}function i(e,s,u){return new g(function(n){var i=!1,o=null,a=[];return e.subscribe(function(e){var t,r;try{r=s(e)}catch(e){return void n.onError(e)}if(t=0,i)try{t=u(r,o)}catch(e){return void n.onError(e)}else i=!0,o=r;t>0&&(o=r,a=[]),t>=0&&a.push(e)},function(e){n.onError(e)},function(){n.onNext(a),n.onCompleted()})},e)}function o(e){if(0===e.length)throw new R;return e[0]}function a(e,n,i,o){if(0>n)throw new L;return new g(function(t){var r=n;return e.subscribe(function(e){0===r--&&(t.onNext(e),t.onCompleted())},function(e){t.onError(e)},function(){i?(t.onNext(o),t.onCompleted()):t.onError(new L)})},e)}function c(e,i,o){return new g(function(t){var r=o,n=!1;return e.subscribe(function(e){n?t.onError(new Error("Sequence contains more than one element")):(r=e,n=!0)},function(e){t.onError(e)},function(){n||i?(t.onNext(r),t.onCompleted()):t.onError(new R)})},e)}function l(e,r,n){return new g(function(t){return e.subscribe(function(e){t.onNext(e),t.onCompleted()},function(e){t.onError(e)},function(){r?(t.onNext(n),t.onCompleted()):t.onError(new R)})},e)}function h(e,i,o){return new g(function(t){var r=o,n=!1;return e.subscribe(function(e){r=e,n=!0},function(e){t.onError(e)},function(){n||i?(t.onNext(r),t.onCompleted()):t.onError(new R)})},e)}function p(i,e,t,o){var a=j(e,t,3);return new g(function(r){var n=0;return i.subscribe(function(e){var t;try{t=a(e,n,i)}catch(e){return void r.onError(e)}t?(r.onNext(o?n:e),r.onCompleted()):n++},function(e){r.onError(e)},function(){r.onNext(o?-1:u),r.onCompleted()})},i)}var f,d=t.Observable,v=d.prototype,m=t.CompositeDisposable,g=t.AnonymousObservable,_=t.Disposable.empty,y=(t.internals.isEqual,t.helpers),b=y.not,x=y.defaultComparer,w=y.identity,S=y.defaultSubComparer,M=y.isFunction,C=y.isPromise,T=y.isArrayLike,E=y.isIterable,O=t.internals.inherits,P=d.fromPromise,A=d.from,j=t.internals.bindCallback,R=t.EmptyError,k=t.ObservableBase,L=t.ArgumentOutOfRangeError,N={e:{}};v.aggregate=function(){var o,a,s=!1,e=this;return 2===arguments.length?(s=!0,a=arguments[0],o=arguments[1]):o=arguments[0],new g(function(t){var r,n,i;return e.subscribe(function(e){!i&&(i=!0);try{r?n=o(n,e):(n=s?o(a,e):e,r=!0)}catch(e){return t.onError(e)}},function(e){t.onError(e)},function(){i&&t.onNext(n),!i&&s&&t.onNext(a),!i&&!s&&t.onError(new R),t.onCompleted()})},e)};var I=function(i){function e(e,t,r,n){this.source=e,this.acc=t,this.hasSeed=r,this.seed=n,i.call(this)}function t(e,t){this.o=e,this.acc=t.acc,this.hasSeed=t.hasSeed,this.seed=t.seed,this.hasAccumulation=!1,this.result=null,this.hasValue=!1,this.isStopped=!1}return O(e,i),e.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this))},t.prototype.onNext=function(e){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=n(this.acc)(this.result,e):(this.result=this.hasSeed?n(this.acc)(this.seed,e):e,this.hasAccumulation=!0),this.result===N&&this.o.onError(this.result.e))},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new R),this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},e}(k);return v.reduce=function(e){var t=!1;if(2===arguments.length){t=!0;var r=arguments[1]}return new I(this,e,t,r)},v.some=function(e,t){var r=this;return e?r.filter(e,t).some():new g(function(t){return r.subscribe(function(){t.onNext(!0),t.onCompleted()},function(e){t.onError(e)},function(){t.onNext(!1),t.onCompleted()})},r)},v.any=function(){return this.some.apply(this,arguments)},v.isEmpty=function(){return this.any().map(b)},v.every=function(t,e){return this.filter(function(e){return!t(e)},e).some().map(b)},v.all=function(){return this.every.apply(this,arguments)},v.includes=function(i,e){function o(e,t){return 0===e&&0===t||e===t||isNaN(e)&&isNaN(t)}var a=this;return new g(function(t){var r=0,n=+e||0;return Math.abs(n)===1/0&&(n=0),0>n?(t.onNext(!1),t.onCompleted(),_):a.subscribe(function(e){r++>=n&&o(e,i)&&(t.onNext(!0),t.onCompleted())},function(e){t.onError(e)},function(){t.onNext(!1),t.onCompleted()})},this)},v.contains=function(e,t){v.includes(e,t)},v.count=function(e,t){return e?this.filter(e,t).count():this.reduce(function(e){return e+1},0)},v.indexOf=function(i,e){var o=this;return new g(function(t){var r=0,n=+e||0;return Math.abs(n)===1/0&&(n=0),0>n?(t.onNext(-1),t.onCompleted(),_):o.subscribe(function(e){r>=n&&e===i&&(t.onNext(r),t.onCompleted()),r++},function(e){t.onError(e)},function(){t.onNext(-1),t.onCompleted()})},o)},v.sum=function(e,t){return e&&M(e)?this.map(e,t).sum():this.reduce(function(e,t){return e+t},0)},v.minBy=function(e,r){return r||(r=S),i(this,e,function(e,t){return-1*r(e,t)})},v.min=function(e){return this.minBy(w,e).map(function(e){return o(e)})},v.maxBy=function(e,t){return t||(t=S),i(this,e,t)},v.max=function(e){return this.maxBy(w,e).map(function(e){return o(e)})},v.average=function(e,t){return e&&M(e)?this.map(e,t).average():this.reduce(function(e,t){return{sum:e.sum+t,count:e.count+1}},{sum:0,count:0}).map(function(e){if(0===e.count)throw new R;return e.sum/e.count})},v.sequenceEqual=function(r,u){var c=this;return u||(u=x),new g(function(n){var i=!1,o=!1,a=[],s=[],e=c.subscribe(function(e){var t,r;if(s.length>0){r=s.shift();try{t=u(r,e)}catch(e){return void n.onError(e)}t||(n.onNext(!1),n.onCompleted())}else o?(n.onNext(!1),n.onCompleted()):a.push(e)},function(e){n.onError(e)},function(){i=!0,0===a.length&&(s.length>0?(n.onNext(!1),n.onCompleted()):o&&(n.onNext(!0),n.onCompleted()))});(T(r)||E(r))&&(r=A(r)),C(r)&&(r=P(r));var t=r.subscribe(function(e){var t;if(a.length>0){var r=a.shift();try{t=u(r,e)}catch(e){return void n.onError(e)}t||(n.onNext(!1),n.onCompleted())}else i?(n.onNext(!1),n.onCompleted()):s.push(e)},function(e){n.onError(e)},function(){o=!0,0===s.length&&(a.length>0?(n.onNext(!1),n.onCompleted()):i&&(n.onNext(!0),n.onCompleted()))});return new m(e,t)},c)},v.elementAt=function(e){return a(this,e,!1)},v.elementAtOrDefault=function(e,t){return a(this,e,!0,t)},v.single=function(e,t){return e&&M(e)?this.where(e,t).single():c(this,!1)},v.singleOrDefault=function(e,t,r){return e&&M(e)?this.filter(e,r).singleOrDefault(null,t):c(this,!0,t)},v.first=function(e,t){return e?this.where(e,t).first():l(this,!1)},v.firstOrDefault=function(e,t,r){return e?this.where(e).firstOrDefault(null,t):l(this,!0,t)},v.last=function(e,t){return e?this.where(e,t).last():h(this,!1)},v.lastOrDefault=function(e,t,r){return e?this.where(e,r).lastOrDefault(null,t):h(this,!0,t)},v.find=function(e,t){return p(this,e,t,!1)},v.findIndex=function(e,t){return p(this,e,t,!0)},v.toSet=function(){if("undefined"==typeof s.Set)throw new TypeError;var e=this;return new g(function(t){var r=new s.Set;return e.subscribe(function(e){r.add(e)},function(e){t.onError(e)},function(){t.onNext(r),t.onCompleted()})},e)},v.toMap=function(o,a){if("undefined"==typeof s.Map)throw new TypeError;var e=this;return new g(function(n){var i=new s.Map;return e.subscribe(function(e){var t;try{t=o(e)}catch(e){return void n.onError(e)}var r=e;if(a)try{r=a(e)}catch(e){return void n.onError(e)}i.set(t,r)},function(e){n.onError(e)},function(){n.onNext(i),n.onCompleted()})},e)},t})}).call(this,"undefined"!=typeof n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(e,Lr,Nr){(function(Rr,kr){(function(a){function i(e){for(var t=[],r=0,n=e.length;n>r;r++)t.push(e[r]);return t}function o(e,t){if(ie&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(se)){for(var r=[],n=t;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(e.stack);var i=r.join("\n"+se+"\n");e.stack=u(i)}}function u(e){for(var t=e.split("\n"),r=[],n=0,i=t.length;i>n;n++){var o=t[n];c(o)||l(o)||!o||r.push(o)}return r.join("\n")}function c(e){var t=h(e);if(!t)return!1;var r=t[0],n=t[1];return r===oe&&n>=ae&&jr>=n}function l(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function e(){if(ie)try{throw new Error}catch(e){var t=e.stack.split("\n"),r=t[0].indexOf("@")>0?t[1]:t[2],n=h(r);if(!n)return;return oe=n[0],n[1]}}function h(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var r=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(r)return[r[1],Number(r[2])];var n=/.*@(.+):(\d+)$/.exec(e);return n?[n[1],Number(n[2])]:void 0}function r(e){var t=[];if(!Ge(e))return t;$e.nonEnumArgs&&e.length&&Ve(e)&&(e=qe.call(e));var r=$e.enumPrototypes&&"function"==typeof e,n=$e.enumErrorProps&&(e===Ie||e instanceof Error);for(var i in e)r&&"prototype"==i||n&&("message"==i||"name"==i)||t.push(i);if($e.nonEnumShadows&&e!==De){var o=e.constructor,a=-1,s=we;if(e===(o&&o.prototype))var u=e===Be?Re:e===Ie?Ee:ke.call(e),c=ze[u];for(;++a<s;)i=xe[a],c&&c[i]||!Le.call(e,i)||t.push(i)}return t}function n(e,t,r){for(var n=-1,i=r(e),o=i.length;++n<o;){var a=i[n];if(t(e[a],a,e)===!1)break}return e}function v(e,t){return n(e,t,r)}function m(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}function g(n,e,i,o){if(n===e)return 0!==n||1/n==1/e;var t=typeof n,r=typeof e;if(n===n&&(null==n||null==e||"function"!=t&&"object"!=t&&"function"!=r&&"object"!=r))return!1;var a=ke.call(n),s=ke.call(e);if(a==Se&&(a=Ae),s==Se&&(s=Ae),a!=s)return!1;switch(a){case Ce:case Te:return+n==+e;case Pe:return n!=+n?e!=+e:0==n?1/n==1/e:n==+e;case je:case Re:return n==String(e)}var u=a==Me;if(!u){if(a!=Ae||!$e.nodeClass&&(m(n)||m(e)))return!1;var c=!$e.argsObject&&Ve(n)?Object:n.constructor,l=!$e.argsObject&&Ve(e)?Object:e.constructor;if(!(c==l||Le.call(n,"constructor")&&Le.call(e,"constructor")||ne(c)&&c instanceof c&&ne(l)&&l instanceof l||!("constructor"in n&&"constructor"in e)))return!1}i||(i=[]),o||(o=[]);for(var h=i.length;h--;)if(i[h]==n)return o[h]==e;var p=0,f=!0;if(i.push(n),o.push(e),u){if(h=n.length,p=e.length,f=p==h)for(;p--;){var d=e[p];if(!(f=g(n[p],d,i,o)))break}}else v(e,function(e,t,r){return Le.call(r,t)?(p++,f=Le.call(n,t)&&g(n[t],e,i,o)):void 0}),f&&v(n,function(e,t,r){return Le.call(r,t)?f=--p>-1:void 0});return i.pop(),o.pop(),f}function f(e,t){for(var r=new Array(e),n=0;e>n;n++)r[n]=t();return r}function t(){try{return He.apply(this,arguments)}catch(e){return Ke.e=e,Ke}}function p(e){if(!ne(e))throw new TypeError("fn must be a function");return He=e,t}function d(e){throw e}function _(e,t){this.id=e,this.value=t}function y(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function b(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function x(e){this._s=s}function w(e){this._s=s,this._l=s.length,this._i=0}function S(e){this._a=e}function M(e){this._a=e,this._l=O(e),this._i=0}function C(e){return"number"==typeof e&&H.isFinite(e)}function T(e){var t,r=e[ve];if(!r&&"string"==typeof e)return t=new x(e),t[ve]();if(!r&&e.length!==a)return t=new S(e),t[ve]();if(!r)throw new TypeError("Object is not iterable");return e[ve]()}function E(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}function O(e){var t=+e.length;return isNaN(t)?0:0!==t&&C(t)?(t=E(t)*Math.floor(Math.abs(t)),0>=t?0:t>Yt?Yt:t):t}function P(e,t){this.observer=e,this.parent=t}function A(e,t){return pt(e)||(e=mt),new Zt(t,e)}function j(e,t){this.observer=e,this.parent=t}function R(e,t){this.observer=e,this.parent=t}function k(t,o){return new Tr(function(n){var e=new at,i=new st;return i.setDisposable(e),e.setDisposable(t.subscribe(function(e){n.onNext(e)},function(e){try{var t=o(e)}catch(e){return n.onError(e)}re(t)&&(t=Vt(t));var r=new at;i.setDisposable(r),r.setDisposable(t.subscribe(n))},function(e){n.onCompleted(e)})),i},t)}function L(){return!1}function N(a,s){var e=this;return new Tr(function(n){var i=0,o=a.length;return e.subscribe(function(e){if(o>i){var t=a[i++],r=p(s)(e,t);if(r===Ke)return n.onError(r.e);n.onNext(r)}else n.onCompleted()},function(e){n.onError(e)},function(){n.onCompleted()})},e)}function L(){return!1}function I(){return[]}function L(){return!1}function D(){return[]}function B(e,t){this.observer=e,this.accumulator=t.accumulator,this.hasSeed=t.hasSeed,this.seed=t.seed,this.hasAccumulation=!1,this.accumulation=null,this.hasValue=!1,this.isStopped=!1}function F(n,e,t){var i=be(e,t,3);return n.map(function(e,t){var r=i(e,t,n);return re(r)&&(r=Vt(r)),(_e(r)||ge(r))&&(r=Kt(r)),r}).concatAll()}function z(e,t,r){for(var n=0,i=e.length;i>n;n++)if(r(e[n],t))return n;return-1}function $(e){this.comparer=e,this.set=[]}function G(n,e,t){var i=be(e,t,3);return n.map(function(e,t){var r=i(e,t,n);return re(r)&&(r=Vt(r)),(_e(r)||ge(r))&&(r=Kt(r)),r}).mergeAll()}var V={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},H=V[typeof window]&&window||this,U=V[typeof Nr]&&Nr&&!Nr.nodeType&&Nr,q=V[typeof Lr]&&Lr&&!Lr.nodeType&&Lr,W=q&&q.exports===U&&U,X=V[typeof kr]&&kr;!X||X.global!==X&&X.window!==X||(H=X);var Y={internals:{},config:{Promise:H.Promise},helpers:{}},K=Y.helpers.noop=function(){},Z=(Y.helpers.notDefined=function(e){return"undefined"==typeof e},Y.helpers.identity=function(e){return e}),J=(Y.helpers.pluck=function(t){return function(e){return e[t]}},Y.helpers.just=function(e){return function(){return e}},Y.helpers.defaultNow=Date.now),Q=Y.helpers.defaultComparer=function(e,t){return Ue(e,t)},ee=Y.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},te=(Y.helpers.defaultKeySerializer=function(e){return e.toString()},Y.helpers.defaultError=function(e){throw e}),re=Y.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},ne=(Y.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},Y.helpers.not=function(e){return!e},Y.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==ke.call(e)}),e}());Y.config.longStackSupport=!1;var ie=!1;try{throw new Error}catch(e){ie=!!e.stack}var oe,ae=e(),se="From previous event:",ue=Y.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};ue.prototype=Error.prototype;var ce=Y.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};ce.prototype=Error.prototype;var le=Y.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};le.prototype=Error.prototype;var he=Y.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};he.prototype=Error.prototype;var pe=Y.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};pe.prototype=Error.prototype;var fe=Y.helpers.notImplemented=function(){throw new pe},de=Y.helpers.notSupported=function(){throw new he},ve="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";H.Set&&"function"==typeof(new H.Set)["@@iterator"]&&(ve="@@iterator");var me=Y.doneEnumerator={done:!0,value:a},ge=Y.helpers.isIterable=function(e){return e[ve]!==a},_e=Y.helpers.isArrayLike=function(e){return e&&e.length!==a};Y.helpers.iterator=ve;var ye,be=Y.internals.bindCallback=function(n,i,e){if("undefined"==typeof i)return n;switch(e){case 0:return function(){return n.call(i)};case 1:return function(e){return n.call(i,e)};case 2:return function(e,t){return n.call(i,e,t)};case 3:return function(e,t,r){return n.call(i,e,t,r)}}return function(){return n.apply(i,arguments)}},xe=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],we=xe.length,Se="[object Arguments]",Me="[object Array]",Ce="[object Boolean]",Te="[object Date]",Ee="[object Error]",Oe="[object Function]",Pe="[object Number]",Ae="[object Object]",je="[object RegExp]",Re="[object String]",ke=Object.prototype.toString,Le=Object.prototype.hasOwnProperty,Ne=ke.call(arguments)==Se,Ie=Error.prototype,De=Object.prototype,Be=String.prototype,Fe=De.propertyIsEnumerable;try{ye=!(ke.call(document)==Ae&&!({toString:0}+""))}catch(e){ye=!0}var ze={};ze[Me]=ze[Te]=ze[Pe]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ze[Ce]=ze[Re]={constructor:!0,toString:!0,valueOf:!0},ze[Ee]=ze[Oe]=ze[je]={constructor:!0,toString:!0},ze[Ae]={constructor:!0};var $e={};!function(){var e=function(){this.x=1},t=[];e.prototype={valueOf:1,y:1};for(var r in new e)t.push(r);for(r in arguments);$e.enumErrorProps=Fe.call(Ie,"message")||Fe.call(Ie,"name"),$e.enumPrototypes=Fe.call(e,"prototype"),$e.nonEnumArgs=0!=r,$e.nonEnumShadows=!/valueOf/.test(t)}(1);var Ge=Y.internals.isObject=function(e){var t=typeof e;return e&&("function"==t||"object"==t)||!1},Ve=function(e){return e&&"object"==typeof e?ke.call(e)==Se:!1};Ne||(Ve=function(e){return e&&"object"==typeof e?Le.call(e,"callee"):!1});var He,Ue=Y.internals.isEqual=function(e,t){return g(e,t,[],[])},qe=({}.hasOwnProperty,Array.prototype.slice),We=this.inherits=Y.internals.inherits=function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r},Xe=Y.internals.addProperties=function(e){for(var t=[],r=1,n=arguments.length;n>r;r++)t.push(arguments[r]);for(var i=0,o=t.length;o>i;i++){var a=t[i];for(var s in a)e[s]=a[s]}},Ye=Y.internals.addRef=function(t,r){return new Tr(function(e){return new Qe(r.getDisposable(),t.subscribe(e))})},Ke={e:{}};_.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var Ze=Y.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},Je=Ze.prototype;Je.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},Je.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var r=this.items[e];this.items[e]=this.items[t],this.items[t]=r,this.percolate(t)}}},Je.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,r=2*e+2,n=e;if(t<this.length&&this.isHigherPriority(t,n)&&(n=t),r<this.length&&this.isHigherPriority(r,n)&&(n=r),n!==e){var i=this.items[e];this.items[e]=this.items[n],this.items[n]=i,this.heapify(n)}}},Je.peek=function(){return this.items[0].value},Je.removeAt=function(e){this.items[e]=this.items[--this.length],this.items[this.length]=a,this.heapify()},Je.dequeue=function(){var e=this.peek();return this.removeAt(0),e},Je.enqueue=function(e){var t=this.length++;this.items[t]=new _(Ze.count++,e),this.percolate(t)},Je.remove=function(e){for(var t=0;t<this.length;t++)if(this.items[t].value===e)return this.removeAt(t),!0;return!1},Ze.count=0;var Qe=Y.CompositeDisposable=function(){var e,t,r=[];if(Array.isArray(arguments[0]))r=arguments[0],t=r.length;else for(t=arguments.length,r=new Array(t),e=0;t>e;e++)r[e]=arguments[e];for(e=0;t>e;e++)if(!it(r[e]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},et=Qe.prototype;et.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},et.remove=function(e){var t=!1;if(!this.isDisposed){var r=this.disposables.indexOf(e);-1!==r&&(t=!0,this.disposables.splice(r,1),this.length--,e.dispose())}return t},et.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),r=0;e>r;r++)t[r]=this.disposables[r];for(this.disposables=[],this.length=0,r=0;e>r;r++)t[r].dispose()}};var tt=Y.Disposable=function(e){this.isDisposed=!1,this.action=e||K};tt.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var rt=tt.create=function(e){return new tt(e)},nt=tt.empty={dispose:K},it=tt.isDisposable=function(e){return e&&ne(e.dispose)},ot=tt.checkDisposed=function(e){if(e.isDisposed)throw new ce},at=Y.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};at.prototype.getDisposable=function(){return this.current},at.prototype.setDisposable=function(e){if(this.current)throw new Error("Disposable has already been assigned");var t=this.isDisposed;!t&&(this.current=e),t&&e&&e.dispose()},at.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var st=Y.SerialDisposable=function(){this.isDisposed=!1,this.current=null};st.prototype.getDisposable=function(){return this.current},st.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var r=this.current;this.current=e}r&&r.dispose(),t&&e&&e.dispose()},st.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var ut=Y.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?nt:new e(this)},t}();y.prototype.dispose=function(){this.scheduler.scheduleWithState(this,b)};var ct=Y.internals.ScheduledItem=function(e,t,r,n,i){this.scheduler=e,this.state=t,this.action=r,this.dueTime=n,this.comparer=i||ee,this.disposable=new at};ct.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ct.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},ct.prototype.isCancelled=function(){return this.disposable.isDisposed},ct.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var lt=Y.Scheduler=function(){function t(e,t,r,n){this.now=e,this._schedule=t,this._scheduleRelative=r,this._scheduleAbsolute=n}function r(e,t){return t(),nt}t.isScheduler=function(e){return e instanceof t};var e=t.prototype;return e.schedule=function(e){return this._schedule(e,r)},e.scheduleWithState=function(e,t){return this._schedule(e,t)},e.scheduleWithRelative=function(e,t){return this._scheduleRelative(t,e,r)},e.scheduleWithRelativeAndState=function(e,t,r){return this._scheduleRelative(e,t,r)},e.scheduleWithAbsolute=function(e,t){return this._scheduleAbsolute(t,e,r)},e.scheduleWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute(e,t,r)},t.now=J,t.normalize=function(e){return 0>e&&(e=0),e},t}(),ht=lt.normalize,pt=lt.isScheduler;!function(e){function r(t,e){function o(e){n(e,function(e){var r=!1,n=!1,i=t.scheduleWithState(e,function(e,t){return r?a.remove(i):n=!0,o(t),nt});n||(a.add(i),r=!0)})}var r=e[0],n=e[1],a=new Qe;return o(r),a}function n(o,e,a){function s(e){r(e,function(e,t){var r=!1,n=!1,i=o[a](e,t,function(e,t){return r?u.remove(i):n=!0,s(t),nt});n||(u.add(i),r=!0)})}var t=e[0],r=e[1],u=new Qe;return s(t),u}function i(t,r){t(function(e){r(t,e)})}e.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,i)},e.scheduleRecursiveWithState=function(e,t){return this.scheduleWithState([e,t],r)},e.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,i)},e.scheduleRecursiveWithRelativeAndState=function(e,t,r){return this._scheduleRelative([e,r],t,function(e,t){return n(e,t,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,i)},e.scheduleRecursiveWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute([e,r],t,function(e,t){return n(e,t,"scheduleWithAbsoluteAndState")})}}(lt.prototype),function(e){lt.prototype.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,t)},lt.prototype.schedulePeriodicWithState=function(e,t,r){if("undefined"==typeof H.setInterval)throw new he;t=ht(t);var n=e,i=H.setInterval(function(){n=r(n)},t);return rt(function(){H.clearInterval(i)})}}(lt.prototype),function(e){e.catchError=e["catch"]=function(e){return new bt(this,e)}}(lt.prototype);var ft,dt,vt=(Y.internals.SchedulePeriodicRecursive=function(){function t(e,t){t(0,this._period);try{this._state=this._action(this._state)}catch(e){throw this._cancel.dispose(),e}}function e(e,t,r,n){this._scheduler=e,this._state=t,this._period=r,this._action=n}return e.prototype.start=function(){var e=new at;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}(),lt.immediate=function(){function e(e,t){return t(this,e)}return new lt(J,e,de,de)}()),mt=lt.currentThread=function(){function i(){for(;o.length>0;){var e=o.dequeue();!e.isCancelled()&&e.invoke()}}function e(e,t){var r=new ct(this,e,t,this.now());if(o)o.enqueue(r);else{o=new Ze(4),o.enqueue(r);var n=p(i)();if(o=null,n===Ke)return d(n.e)}return r.disposable}var o,t=new lt(J,e,de,de);return t.scheduleRequired=function(){return!o},t}(),gt=function(){var e,t=K;if(H.setTimeout)e=H.setTimeout,t=H.clearTimeout;else{if(!H.WScript)throw new he;e=function(e,t){H.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),_t=gt.setTimeout,yt=gt.clearTimeout;!function(){function n(e){if(a)_t(function(){n(e)},0);else{var t=o[e];if(t){a=!0;var r=p(t)();if(dt(e),a=!1,r===Ke)return d(r.e)}}}function e(){if(!H.postMessage||H.importScripts)return!1;var e=!1,t=H.onmessage;return H.onmessage=function(){e=!0},H.postMessage("","*"),H.onmessage=t,e}function t(e){"string"==typeof e.data&&e.data.substring(0,u.length)===u&&n(e.data.substring(u.length))}var i=1,o={},a=!1;dt=function(e){delete o[e]};var r=RegExp("^"+String(ke).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),s="function"==typeof(s=X&&W&&X.setImmediate)&&!r.test(s)&&s;if(ne(s))ft=function(e){var t=i++;return o[t]=e,s(function(){n(t)}),t};else if("undefined"!=typeof Rr&&"[object process]"==={}.toString.call(Rr))ft=function(e){var t=i++;return o[t]=e,Rr.nextTick(function(){n(t)}),t};else if(e()){var u="ms.rx.schedule"+Math.random();H.addEventListener?H.addEventListener("message",t,!1):H.attachEvent?H.attachEvent("onmessage",t):H.onmessage=t,ft=function(e){var t=i++;return o[t]=e,H.postMessage(u+currentId,"*"),t}}else if(H.MessageChannel){var c=new H.MessageChannel;c.port1.onmessage=function(e){n(e.data)},ft=function(e){var t=i++;return o[t]=e,c.port2.postMessage(t),t}}else ft="document"in H&&"onreadystatechange"in H.document.createElement("script")?function(e){var t=H.document.createElement("script"),r=i++;return o[r]=e,t.onreadystatechange=function(){n(r),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},H.document.documentElement.appendChild(t),r}:function(e){var t=i++;return o[t]=e,_t(function(){n(t)},0),t}}();var bt=(lt.timeout=lt["default"]=function(){function e(e,t){var r=this,n=new at,i=ft(function(){!n.isDisposed&&n.setDisposable(t(r,e))});return new Qe(n,rt(function(){dt(i)}))}function t(e,t,r){var n=this,i=lt.normalize(t),o=new at;if(0===i)return n.scheduleWithState(e,r);var a=_t(function(){!o.isDisposed&&o.setDisposable(r(n,e))},i);return new Qe(o,rt(function(){yt(a)}))}function r(e,t,r){return this.scheduleWithRelativeAndState(e,t-this.now(),r)}return new lt(J,e,t,r)}(),function(r){function n(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function i(e,t,r){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(r))}function o(e,t,r){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(r))}function t(e,t){this._scheduler=e,this._handler=t,this._recursiveOriginal=null,this._recursiveWrapper=null,r.call(this,this._scheduler.now.bind(this._scheduler),n,i,o)}return We(t,r),t.prototype._clone=function(e){return new t(e,this._handler)},t.prototype._wrap=function(r){var n=this;return function(e,t){try{return r(n._getRecursiveWrapper(e),t)}catch(e){if(!n._handler(e))throw e;return nt}}},t.prototype._getRecursiveWrapper=function(e){if(this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},t.prototype.schedulePeriodicWithState=function(e,t,r){var n=this,i=!1,o=new at;return o.setDisposable(this._scheduler.schedulePeriodicWithState(e,t,function(e){if(i)return null;try{return r(e)}catch(e){if(i=!0,!n._handler(e))throw e;return o.dispose(),null}})),o},t}(lt)),xt=Y.Notification=function(){function e(e,t,r,n,i,o){this.kind=e,this.value=t,this.exception=r,this._accept=n,this._acceptObservable=i,this.toString=o}return e.prototype.accept=function(e,t,r){return e&&"object"==typeof e?this._acceptObservable(e):this._accept(e,t,r)},e.prototype.toObservable=function(e){var t=this;return pt(e)||(e=vt),new Tr(function(r){return e.scheduleWithState(t,function(e,t){t._acceptObservable(r),"N"===t.kind&&r.onCompleted()})})},e}(),wt=xt.createOnNext=function(){function t(e){return e(this.value)}function r(e){return e.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(e){return new xt("N",e,null,t,r,n)}}(),St=xt.createOnError=function(){function t(e,t){return t(this.exception)}function r(e){return e.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(e){return new xt("E",null,e,t,r,n)}}(),Mt=xt.createOnCompleted=function(){function e(e,t,r){return r()}function t(e){return e.onCompleted()}function r(){return"OnCompleted()"}return function(){return new xt("C",null,null,e,t,r)}}(),Ct=Y.Observer=function(){};Ct.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ct.prototype.asObserver=function(){return new Pt(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ct.prototype.checked=function(){return new At(this)};var Tt=Ct.create=function(e,t,r){return e||(e=K),t||(t=te),r||(r=K),new Pt(e,t,r)};Ct.fromNotifier=function(t,r){return new Pt(function(e){return t.call(r,wt(e))},function(e){return t.call(r,St(e))},function(){return t.call(r,Mt())})},Ct.prototype.notifyOn=function(e){return new Rt(e,this)},Ct.prototype.makeSafe=function(e){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,e)};var Et,Ot=Y.internals.AbstractObserver=function(e){function t(){this.isStopped=!1,e.call(this)}return We(t,e),t.prototype.next=fe,t.prototype.error=fe,t.prototype.completed=fe,t.prototype.onNext=function(e){this.isStopped||this.next(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.error(e),!0)},t}(Ct),Pt=Y.AnonymousObserver=function(n){function e(e,t,r){n.call(this),this._onNext=e,this._onError=t,this._onCompleted=r}return We(e,n),e.prototype.next=function(e){this._onNext(e)},e.prototype.error=function(e){this._onError(e)},e.prototype.completed=function(){this._onCompleted()},e}(Ot),At=function(t){function e(e){t.call(this),this._observer=e,this._state=0}We(e,t);var r=e.prototype;return r.onNext=function(e){this.checkAccess();var t=p(this._observer.onNext).call(this._observer,e);this._state=0,t===Ke&&d(t.e)},r.onError=function(e){this.checkAccess();var t=p(this._observer.onError).call(this._observer,e);this._state=2,t===Ke&&d(t.e)},r.onCompleted=function(){this.checkAccess();var e=p(this._observer.onCompleted).call(this._observer);this._state=2,e===Ke&&d(e.e)},r.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},e}(Ct),jt=Y.internals.ScheduledObserver=function(r){function e(e,t){r.call(this),this.scheduler=e,this.observer=t,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new st}return We(e,r),e.prototype.next=function(e){var t=this;this.queue.push(function(){t.observer.onNext(e)})},e.prototype.error=function(e){var t=this;this.queue.push(function(){t.observer.onError(e)})},e.prototype.completed=function(){var e=this;this.queue.push(function(){e.observer.onCompleted()})},e.prototype.ensureActive=function(){var e=!1,r=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var t;if(!(r.queue.length>0))return void(r.isAcquired=!1);t=r.queue.shift();try{t()}catch(e){throw r.queue=[],r.hasFaulted=!0,e}e()}))},e.prototype.dispose=function(){r.prototype.dispose.call(this),this.disposable.dispose()},e}(Ot),Rt=function(n){function e(e,t,r){n.call(this,e,t),this._cancel=r}return We(e,n),e.prototype.next=function(e){n.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){n.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){n.prototype.completed.call(this),this.ensureActive()},e.prototype.dispose=function(){n.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},e}(jt),kt=Y.Observable=function(){function e(r){if(Y.config.longStackSupport&&ie){try{throw new Error}catch(e){this.stack=e.stack.substring(e.stack.indexOf("\n")+1)}var n=this;this._subscribe=function(e){var t=e.onError.bind(e);return e.onError=function(e){o(e,n),t(e)},r.call(n,e)}}else this._subscribe=r}return Et=e.prototype,Et.subscribe=Et.forEach=function(e,t,r){return this._subscribe("object"==typeof e?e:Tt(e,t,r))},Et.subscribeOnNext=function(t,r){return this._subscribe(Tt("undefined"!=typeof r?function(e){t.call(r,e)}:t))},Et.subscribeOnError=function(t,r){return this._subscribe(Tt(null,"undefined"!=typeof r?function(e){t.call(r,e)}:t))},Et.subscribeOnCompleted=function(e,t){return this._subscribe(Tt(null,null,"undefined"!=typeof t?function(){e.call(t)}:e))},e}(),Lt=Y.ObservableBase=function(e){function o(e){return e&&ne(e.dispose)?e:ne(e)?rt(e):nt}function n(e,t){var r=t[0],n=t[1],i=p(n.subscribeCore).call(n,r);return i!==Ke||r.fail(Ke.e)?void r.setDisposable(o(i)):d(Ke.e)}function t(e){var t=new Er(e),r=[t,this];return mt.scheduleRequired()?mt.scheduleWithState(r,n):n(null,r),t}function r(){e.call(this,t)}return We(r,e),r.prototype.subscribeCore=fe,r}(kt),Nt=Y.internals.Enumerable=function(){},It=function(t){function e(e){this.sources=e,t.call(this)}function u(e,t,r){this.o=e,this.s=t,this.e=r,this.isStopped=!1}return We(e,t),e.prototype.subscribeCore=function(o){var a,s=new st,e=vt.scheduleRecursiveWithState(this.sources[ve](),function(e,t){if(!a){var r=p(e.next).call(e);if(r===Ke)return o.onError(r.e);if(r.done)return o.onCompleted();var n=r.value;re(n)&&(n=Vt(n));var i=new at;s.setDisposable(i),i.setDisposable(n.subscribe(new u(o,t,e)))}});return new Qe(s,e,rt(function(){a=!0}))},u.prototype.onNext=function(e){this.isStopped||this.o.onNext(e)},u.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},u.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},u.prototype.dispose=function(){this.isStopped=!0},u.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},e}(Lt);Nt.prototype.concat=function(){return new It(this)};var Dt=function(t){function e(e){this.sources=e,t.call(this)}return We(e,t),e.prototype.subscribeCore=function(o){var a,s=this.sources[ve](),u=new st,e=vt.scheduleRecursiveWithState(null,function(e,t){if(!a){var r=p(s.next).call(s);if(r===Ke)return o.onError(r.e);if(r.done)return null!==e?o.onError(e):o.onCompleted();var n=r.value;re(n)&&(n=Vt(n));var i=new at;u.setDisposable(i),i.setDisposable(n.subscribe(function(e){o.onNext(e)},t,function(){o.onCompleted()}))}});return new Qe(u,e,rt(function(){a=!0}))},e}(Lt);Nt.prototype.catchError=function(){return new Dt(this)},Nt.prototype.catchErrorWhen=function(n){var i=this;return new Tr(function(o){var a,s,u=new Pr,c=new Pr,e=n(u),t=e.subscribe(c),l=i[ve](),h=new st,r=vt.scheduleRecursive(function(t){if(!a){var e=p(l.next).call(l);if(e===Ke)return o.onError(e.e);if(e.done)return void(s?o.onError(s):o.onCompleted());var r=e.value;re(r)&&(r=Vt(r));var n=new at,i=new at;h.setDisposable(new Qe(i,n)),n.setDisposable(r.subscribe(function(e){o.onNext(e)},function(e){i.setDisposable(c.subscribe(t,function(e){o.onError(e)},function(){o.onCompleted()})),u.onNext(e)},function(){o.onCompleted()}))}});return new Qe(t,h,r,rt(function(){a=!0}))})};var Bt=function(e){function t(e,t){this.v=e,this.c=null==t?-1:t}function r(e){this.v=e.v,this.l=e.c}return We(t,e),t.prototype[ve]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?me:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(Nt),Ft=Nt.repeat=function(e,t){return new Bt(e,t)},zt=function(e){function t(e,t,r){this.s=e,this.fn=t?be(t,r,3):null}function r(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return We(t,e),t.prototype[ve]=function(){return new r(this)},r.prototype.next=function(){return++this.i<this.l?{done:!1,value:this.fn?this.fn(this.s[this.i],this.i,this.s):this.s[this.i]}:me},t}(Nt),$t=Nt.of=function(e,t,r){return new zt(e,t,r)};Et.observeOn=function(t){var r=this;return new Tr(function(e){return r.subscribe(new Rt(t,e))},r)},Et.subscribeOn=function(n){var i=this;return new Tr(function(e){var t=new at,r=new st;return r.setDisposable(t),t.setDisposable(n.schedule(function(){r.setDisposable(new y(n,i.subscribe(e)))})),r},i)};var Gt=function(t){function e(e){this.p=e,t.call(this)}return We(e,t),e.prototype.subscribeCore=function(t){return this.p.then(function(e){t.onNext(e),t.onCompleted()},function(e){t.onError(e)}),nt},e}(Lt),Vt=kt.fromPromise=function(e){return new Gt(e)};Et.toPromise=function(e){if(e||(e=Y.config.Promise),!e)throw new he("Promise type not provided nor in Rx.config.Promise");var i=this;return new e(function(e,t){var r,n=!1;i.subscribe(function(e){r=e,n=!0},t,function(){n&&e(r)})})};var Ht=function(t){function e(e){this.source=e,t.call(this)}function r(e){this.o=e,this.a=[],this.isStopped=!1}return We(e,t),e.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e))},r.prototype.onNext=function(e){this.isStopped||this.a.push(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onNext(this.a),this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},e}(Lt);Et.toArray=function(){return new Ht(this)},kt.create=kt.createWithDisposable=function(e,t){return new Tr(e,t)};var Ut=(kt.defer=function(r){return new Tr(function(t){var e;try{e=r()}catch(e){return sr(e).subscribe(t)}return re(e)&&(e=Vt(e)),e.subscribe(t)})},function(t){function e(e){this.scheduler=e,t.call(this)}function r(e,t){this.observer=e,this.parent=t}function n(e,t){t.onCompleted()}return We(e,t),e.prototype.subscribeCore=function(e){var t=new r(e,this);return t.run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState(this.observer,n)},e}(Lt)),qt=kt.empty=function(e){return pt(e)||(e=vt),new Ut(e)},Wt=function(n){function e(e,t,r){this.iterable=e,this.mapper=t,this.scheduler=r,n.call(this)}return We(e,n),e.prototype.subscribeCore=function(e){var t=new Xt(e,this);return t.run()},e}(Lt),Xt=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){function e(e,t){try{var r=i.next()}catch(e){return o.onError(e)}if(r.done)return o.onCompleted();var n=r.value;if(a)try{n=a(n,e)}catch(e){return o.onError(e)}o.onNext(n),t(e+1)}var t=Object(this.parent.iterable),i=T(t),o=this.observer,a=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},e}(),Yt=Math.pow(2,53)-1;x.prototype[ve]=function(){return new w(this._s)},w.prototype[ve]=function(){return this},w.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:me},S.prototype[ve]=function(){return new M(this._a)},M.prototype[ve]=function(){return this},M.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:me};var Kt=kt.from=function(e,t,r,n){if(null==e)throw new Error("iterable cannot be null.");if(t&&!ne(t))throw new Error("mapFn when provided must be a function");if(t)var i=be(t,r,2);return pt(n)||(n=mt),new Wt(e,i,n)},Zt=function(r){function e(e,t){this.args=e,this.scheduler=t,r.call(this)}return We(e,r),e.prototype.subscribeCore=function(e){var t=new P(e,this);return t.run()},e}(Lt);P.prototype.run=function(){function e(e,t){i>e?(r.onNext(n[e]),t(e+1)):r.onCompleted()}var r=this.observer,n=this.parent.args,i=n.length;return this.parent.scheduler.scheduleRecursiveWithState(0,e)};var Jt=kt.fromArray=function(e,t){return pt(t)||(t=mt),new Zt(e,t)};kt.generate=function(e,a,s,u,t){return pt(t)||(t=mt),new Tr(function(i){var o=!0;return t.scheduleRecursiveWithState(e,function(e,t){var r,n;try{o?o=!1:e=s(e),r=a(e),r&&(n=u(e))}catch(e){return i.onError(e)}r?(i.onNext(n),t(e)):i.onCompleted()})})};var Qt=function(e){function t(){e.call(this)}return We(t,e),t.prototype.subscribeCore=function(e){return nt},t}(Lt),er=kt.never=function(){return new Qt};kt.of=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return new Zt(t,mt)},kt.ofWithScheduler=function(e){for(var t=arguments.length,r=new Array(t-1),n=1;t>n;n++)r[n-1]=arguments[n];return new Zt(r,e)};var tr=function(r){function e(e,t){this.obj=e,this.keys=Object.keys(e),this.scheduler=t,r.call(this)}return We(e,r),e.prototype.subscribeCore=function(e){var t=new j(e,this);return t.run()},e}(Lt);j.prototype.run=function(){function e(e,t){if(a>e){var r=o[e];n.onNext([r,i[r]]),t(e+1)}else n.onCompleted()}var n=this.observer,i=this.parent.obj,o=this.parent.keys,a=o.length;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},kt.pairs=function(e,t){return t||(t=mt),new tr(e,t)};var rr=function(n){function e(e,t,r){this.start=e,this.rangeCount=t,this.scheduler=r,n.call(this)}return We(e,n),e.prototype.subscribeCore=function(e){var t=new nr(e,this);return t.run()},e}(Lt),nr=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){function e(e,t){n>e?(i.onNext(r+e),t(e+1)):i.onCompleted()}var r=this.parent.start,n=this.parent.rangeCount,i=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},e}();kt.range=function(e,t,r){return pt(r)||(r=mt),new rr(e,t,r)};var ir=function(n){function e(e,t,r){this.value=e,this.repeatCount=null==t?-1:t,this.scheduler=r,n.call(this)}return We(e,n),e.prototype.subscribeCore=function(e){var t=new R(e,this);return t.run()},e}(Lt);R.prototype.run=function(){function e(e,t){return(-1===e||e>0)&&(r.onNext(n),e>0&&e--),0===e?r.onCompleted():void t(e)}var r=this.observer,n=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,e)},kt.repeat=function(e,t,r){return pt(r)||(r=mt),new ir(e,t,r)};var or=function(r){function e(e,t){this.value=e,this.scheduler=t,r.call(this)}function n(e,t){this.observer=e,this.parent=t}function t(e,t){var r=t[0],n=t[1];n.onNext(r),n.onCompleted()}return We(e,r),e.prototype.subscribeCore=function(e){var t=new n(e,this);return t.run()},n.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],t)},e}(Lt),ar=(kt["return"]=kt.just=kt.returnValue=function(e,t){return pt(t)||(t=vt),new or(e,t)},function(r){function e(e,t){this.error=e,this.scheduler=t,r.call(this)}function n(e,t){this.o=e,this.p=t}function t(e,t){var r=t[0],n=t[1];n.onError(r)}return We(e,r),e.prototype.subscribeCore=function(e){var t=new n(e,this);return t.run()},n.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],t)},e}(Lt)),sr=kt["throw"]=kt.throwError=kt.throwException=function(e,t){return pt(t)||(t=vt),new ar(e,t)};kt.using=function(i,o){return new Tr(function(t){var e,r,n=nt;try{e=i(),e&&(n=e),r=o(e)}catch(e){return new Qe(sr(e).subscribe(t),n)}return new Qe(r.subscribe(t),n)})},Et.amb=function(u){var c=this;return new Tr(function(t){function r(){i||(i=o,s.dispose())}function n(){i||(i=a,e.dispose())}var i,o="L",a="R",e=new at,s=new at;return re(u)&&(u=Vt(u)),e.setDisposable(c.subscribe(function(e){r(),i===o&&t.onNext(e)},function(e){r(),i===o&&t.onError(e)},function(){r(),i===o&&t.onCompleted()})),s.setDisposable(u.subscribe(function(e){n(),i===a&&t.onNext(e)},function(e){n(),i===a&&t.onError(e)},function(){n(),i===a&&t.onCompleted()})),new Qe(e,s)})},kt.amb=function(){function e(e,t){return e.amb(t)}var t=er(),r=[];if(Array.isArray(arguments[0]))r=arguments[0];else for(var n=0,i=arguments.length;i>n;n++)r.push(arguments[n]);for(var n=0,i=r.length;i>n;n++)t=e(t,r[n]);return t},Et["catch"]=Et.catchError=Et.catchException=function(e){return"function"==typeof e?k(this,e):ur([this,e])};var ur=kt.catchError=kt["catch"]=kt.catchException=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return $t(e).catchError()};Et.combineLatest=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),cr.apply(this,t)};var cr=kt.combineLatest=function(){for(var e=arguments.length,h=new Array(e),t=0;e>t;t++)h[t]=arguments[t];var p=h.pop();return Array.isArray(h[0])&&(h=h[0]),new Tr(function(n){function i(r){if(a[r]=!0,s||(s=a.every(Z))){try{var e=p.apply(null,c)}catch(e){return n.onError(e)}n.onNext(e)}else u.filter(function(e,t){return t!==r}).every(Z)&&n.onCompleted()}function o(e){u[e]=!0,u.every(Z)&&n.onCompleted()}for(var e=h.length,t=function(){return!1},a=f(e,t),s=!1,u=f(e,t),c=new Array(e),l=new Array(e),r=0;e>r;r++)!function(t){var e=h[t],r=new at;re(e)&&(e=Vt(e)),r.setDisposable(e.subscribe(function(e){c[t]=e,i(t)},function(e){n.onError(e)},function(){o(t)})),l[t]=r}(r);return new Qe(l)},this)};Et.concat=function(){for(var e=[],t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return e.unshift(this),hr.apply(null,e)};var lr=function(t){function e(e){this.sources=e,t.call(this)}function r(e,t){this.sources=e,this.o=t}return We(e,t),e.prototype.subscribeCore=function(e){var t=new r(this.sources,e);return t.run()},r.prototype.run=function(){var i,o=new st,a=this.sources,s=a.length,u=this.o,e=vt.scheduleRecursiveWithState(0,function(e,t){if(!i){if(e===s)return u.onCompleted();var r=a[e];re(r)&&(r=Vt(r));var n=new at;o.setDisposable(n),n.setDisposable(r.subscribe(function(e){u.onNext(e)},function(e){u.onError(e)},function(){t(e+1)}))}});return new Qe(o,e,rt(function(){i=!0}))},e}(Lt),hr=kt.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,r=arguments.length;r>t;t++)e[t]=arguments[t]}return new lr(e)};Et.concatAll=Et.concatObservable=function(){return this.merge(1)};var pr=function(r){function e(e,t){this.source=e,this.maxConcurrent=t,r.call(this)}return We(e,r),e.prototype.subscribeCore=function(e){var t=new Qe;return t.add(this.source.subscribe(new fr(e,this.maxConcurrent,t))),t},e}(Lt),fr=function(){function e(e,t,r){this.o=e,this.max=t,this.g=r,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function r(e,t){this.parent=e,this.sad=t,this.isStopped=!1}return e.prototype.handleSubscribe=function(e){var t=new at;this.g.add(t),re(e)&&(e=Vt(e)),t.setDisposable(e.subscribe(new r(this,t)))},e.prototype.onNext=function(e){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(e)):this.q.push(e))},e.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},r.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=this.parent;e.g.remove(this.sad),e.q.length>0?e.handleSubscribe(e.q.shift()):(e.activeCount--,e.done&&0===e.activeCount&&e.o.onCompleted())}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();Et.merge=function(e){return"number"!=typeof e?dr(this,e):new pr(this,e)};var dr=kt.merge=function(){var e,t,r=[],n=arguments.length;if(arguments[0])if(pt(arguments[0]))for(e=arguments[0],t=1;n>t;t++)r.push(arguments[t]);else for(e=vt,t=0;n>t;t++)r.push(arguments[t]);else for(e=vt,t=1;n>t;t++)r.push(arguments[t]);return Array.isArray(r[0])&&(r=r[0]),A(e,r).mergeAll()},vr=Y.CompositeError=function(e){this.name="NotImplementedError",this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};vr.prototype=Error.prototype,kt.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var r=0;t>r;r++)e[r]=arguments[r]}var s=A(null,e);return new Tr(function(r){function n(){0===a.length?r.onCompleted():1===a.length?r.onError(a[0]):r.onError(new vr(a))}var i=new Qe,e=new at,o=!1,a=[];return i.add(e),e.setDisposable(s.subscribe(function(e){var t=new at;i.add(t),re(e)&&(e=Vt(e)),t.setDisposable(e.subscribe(function(e){r.onNext(e)},function(e){a.push(e),i.remove(t),o&&1===i.length&&n()},function(){i.remove(t),o&&1===i.length&&n()}))},function(e){a.push(e),o=!0,1===i.length&&n()},function(){o=!0,1===i.length&&n()})),i})};var mr=function(t){function e(e){this.source=e,t.call(this)}function n(e,t){this.o=e,this.g=t,this.isStopped=!1,this.done=!1}function r(e,t,r){this.parent=e,this.g=t,this.sad=r,this.isStopped=!1}return We(e,t),e.prototype.subscribeCore=function(e){var t=new Qe,r=new at;return t.add(r),r.setDisposable(this.source.subscribe(new n(e,t))),t},n.prototype.onNext=function(e){if(!this.isStopped){var t=new at;this.g.add(t),re(e)&&(e=Vt(e)),t.setDisposable(e.subscribe(new r(this,this.g,t)))}},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},r.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},r.prototype.onCompleted=function(){if(!this.isStopped){var e=this.parent;this.isStopped=!0,e.g.remove(this.sad),e.done&&1===e.g.length&&e.o.onCompleted()}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},e}(Lt);Et.mergeAll=Et.mergeObservable=function(){return new mr(this)},Et.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return gr([this,e])};var gr=kt.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var e=0,t=arguments.length;t>e;e++)a.push(arguments[e]);return new Tr(function(n){var i=0,o=new st,e=vt.scheduleRecursive(function(e){var t,r;i<a.length?(t=a[i++],re(t)&&(t=Vt(t)),r=new at,o.setDisposable(r),r.setDisposable(t.subscribe(n.onNext.bind(n),e,e))):n.onCompleted()});return new Qe(o,e)})};Et.skipUntil=function(i){var o=this;return new Tr(function(t){var r=!1,e=new Qe(o.subscribe(function(e){r&&t.onNext(e)},function(e){t.onError(e)},function(){r&&t.onCompleted()}));re(i)&&(i=Vt(i));var n=new at;return e.add(n),n.setDisposable(i.subscribe(function(){r=!0,n.dispose()},function(e){t.onError(e)},function(){n.dispose()})),e},o)};var _r=function(t){function e(e){this.source=e,t.call(this)}function n(e,t){this.o=e,this.inner=t,this.stopped=!1,this.latest=0,this.hasLatest=!1,this.isStopped=!1}function i(e,t){this.parent=e,this.id=t,this.isStopped=!1}return We(e,t),e.prototype.subscribeCore=function(e){var t=new st,r=this.source.subscribe(new n(e,t));return new Qe(r,t)},n.prototype.onNext=function(e){if(!this.isStopped){var t=new at,r=++this.latest;this.hasLatest=!0,this.inner.setDisposable(t),re(e)&&(e=Vt(e)),t.setDisposable(e.subscribe(new i(this,r)))}},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.stopped=!0,!this.hasLatest&&this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},i.prototype.onNext=function(e){this.isStopped||this.parent.latest===this.id&&this.parent.o.onNext(e)},i.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&this.parent.o.onError(e))},i.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.isStopped&&this.parent.o.onCompleted()))},i.prototype.dispose=function(){this.isStopped=!0},i.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},e}(Lt);Et["switch"]=Et.switchLatest=function(){return new _r(this)};var yr=function(r){function e(e,t){this.source=e,this.other=re(t)?Vt(t):t,r.call(this)}function t(e){this.o=e,this.isStopped=!1}return We(e,r),e.prototype.subscribeCore=function(e){return new Qe(this.source.subscribe(e),this.other.subscribe(new t(e)))},t.prototype.onNext=function(e){this.isStopped||this.o.onCompleted()},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){!this.isStopped&&(this.isStopped=!0)},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},e}(Lt);Et.takeUntil=function(e){return new yr(this,e)},Et.withLatestFrom=function(){for(var e=arguments.length,u=new Array(e),t=0;e>t;t++)u[t]=arguments[t];var c=u.pop(),l=this;return Array.isArray(u[0])&&(u=u[0]),new Tr(function(n){for(var e=u.length,i=f(e,L),o=!1,a=new Array(e),s=new Array(e+1),t=0;e>t;t++)!function(t){var e=u[t],r=new at;re(e)&&(e=Vt(e)),r.setDisposable(e.subscribe(function(e){a[t]=e,i[t]=!0,o=i.every(Z)},function(e){n.onError(e)},K)),s[t]=r}(t);var r=new at;return r.setDisposable(l.subscribe(function(e){var t=[e].concat(a);if(o){var r=p(c).apply(null,t);return r===Ke?n.onError(r.e):void n.onNext(r)}},function(e){n.onError(e)},function(){n.onCompleted()})),s[e]=r,new Qe(s)},this)},Et.zip=function(){if(Array.isArray(arguments[0]))return N.apply(this,arguments);for(var e=arguments.length,s=new Array(e),t=0;e>t;t++)s[t]=arguments[t];var u=this,c=s.pop();return s.unshift(u),new Tr(function(i){for(var e=s.length,o=f(e,I),a=f(e,L),r=new Array(e),t=0;e>t;t++)!function(n){var e=s[n],t=new at;re(e)&&(e=Vt(e)),t.setDisposable(e.subscribe(function(e){if(o[n].push(e),o.every(function(e){return e.length>0})){var t=o.map(function(e){return e.shift()}),r=p(c).apply(u,t);if(r===Ke)return i.onError(r.e);i.onNext(r)}else a.filter(function(e,t){return t!==n}).every(Z)&&i.onCompleted()},function(e){i.onError(e)},function(){a[n]=!0,a.every(Z)&&i.onCompleted()})),r[n]=t}(t);return new Qe(r)},u)},kt.zip=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=t.shift();return n.zip.apply(n,t)},kt.zipArray=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var e=arguments.length;a=new Array(e);for(var t=0;e>t;t++)a[t]=arguments[t]}return new Tr(function(n){for(var e=a.length,i=f(e,D),o=f(e,L),t=new Array(e),r=0;e>r;r++)!function(r){t[r]=new at,t[r].setDisposable(a[r].subscribe(function(e){if(i[r].push(e),i.every(function(e){return e.length>0})){var t=i.map(function(e){return e.shift()});n.onNext(t)}else if(o.filter(function(e,t){return t!==r}).every(Z))return n.onCompleted()},function(e){n.onError(e)},function(){o[r]=!0,o.every(Z)&&n.onCompleted()}))}(r);return new Qe(t)})},Et.asObservable=function(){var t=this;return new Tr(function(e){return t.subscribe(e)},t)},Et.bufferWithCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).selectMany(function(e){return e.toArray()}).where(function(e){return e.length>0})},Et.dematerialize=function(){var e=this;return new Tr(function(t){return e.subscribe(function(e){return e.accept(t)},function(e){t.onError(e)},function(){t.onCompleted()})},this)},Et.distinctUntilChanged=function(a,s){var e=this;return s||(s=Q),new Tr(function(n){var i,o=!1;return e.subscribe(function(e){var t=e;if(a&&(t=p(a)(e),t===Ke))return n.onError(t.e);if(o){var r=p(s)(i,t);if(r===Ke)return n.onError(r.e)}o&&r||(o=!0,i=t,n.onNext(e))},function(e){n.onError(e)},function(){n.onCompleted()})},this)};var br=function(i){function e(e,t,r,n){this.source=e,this.t=!t||ne(t)?Tt(t||K,r||K,n||K):t,i.call(this)}function t(e,t){this.o=e,this.t=t,this.isStopped=!1}return We(e,i),e.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.t))},t.prototype.onNext=function(e){if(!this.isStopped){var t=p(this.t.onNext).call(this.t,e);t===Ke&&this.o.onError(t.e),this.o.onNext(e)}},t.prototype.onError=function(e){if(!this.isStopped){this.isStopped=!0;var t=p(this.t.onError).call(this.t,e);if(t===Ke)return this.o.onError(t.e);this.o.onError(e)}},t.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=p(this.t.onCompleted).call(this.t);if(e===Ke)return this.o.onError(e.e);this.o.onCompleted()}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},e}(Lt);Et["do"]=Et.tap=Et.doAction=function(e,t,r){return new br(this,e,t,r)},Et.doOnNext=Et.tapOnNext=function(t,r){return this.tap("undefined"!=typeof r?function(e){t.call(r,e)}:t)},Et.doOnError=Et.tapOnError=function(t,r){return this.tap(K,"undefined"!=typeof r?function(e){t.call(r,e)}:t)},Et.doOnCompleted=Et.tapOnCompleted=function(e,t){return this.tap(K,null,"undefined"!=typeof t?function(){e.call(t)}:e)},Et["finally"]=Et.ensure=function(r){var n=this;return new Tr(function(e){var t;try{t=n.subscribe(e)}catch(e){throw r(),e}return rt(function(){try{t.dispose()}catch(e){throw e}finally{r()}})},this)},Et.finallyAction=function(e){return this.ensure(e)};var xr=function(t){function e(e){this.source=e,t.call(this)}function r(e){this.o=e,this.isStopped=!1}return We(e,t),e.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e))},r.prototype.onNext=K,r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},e}(Lt);Et.ignoreElements=function(){return new xr(this)},Et.materialize=function(){var e=this;return new Tr(function(t){return e.subscribe(function(e){t.onNext(wt(e))},function(e){t.onNext(St(e)),t.onCompleted()},function(){t.onNext(Mt()),t.onCompleted()})},e)},Et.repeat=function(e){return Ft(this,e).concat()},Et.retry=function(e){return Ft(this,e).catchError()},Et.retryWhen=function(e){return Ft(this).catchErrorWhen(e)};var wr=function(i){function e(e,t,r,n){this.source=e,this.accumulator=t,this.hasSeed=r,this.seed=n,i.call(this)}return We(e,i),e.prototype.subscribeCore=function(e){return this.source.subscribe(new B(e,this))},e}(Lt);B.prototype.onNext=function(e){if(!this.isStopped){!this.hasValue&&(this.hasValue=!0);try{this.hasAccumulation?this.accumulation=this.accumulator(this.accumulation,e):(this.accumulation=this.hasSeed?this.accumulator(this.seed,e):e,this.hasAccumulation=!0)}catch(e){return this.observer.onError(e)}this.observer.onNext(this.accumulation)}},B.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},B.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},B.prototype.dispose=function(){this.isStopped=!0},B.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},Et.scan=function(){var e,t,r=!1;return 2===arguments.length?(r=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new wr(this,t,r,e)},Et.skipLast=function(n){if(0>n)throw new le;var e=this;return new Tr(function(t){var r=[];return e.subscribe(function(e){r.push(e),r.length>n&&t.onNext(r.shift())},function(e){t.onError(e)},function(){t.onCompleted()})},e)},Et.startWith=function(){var e,t=0;arguments.length&&pt(arguments[0])?(e=arguments[0],t=1):e=vt;for(var r=[],n=t,i=arguments.length;i>n;n++)r.push(arguments[n]);return $t([Jt(r,e),this]).concat()},Et.takeLast=function(n){if(0>n)throw new le;var e=this;return new Tr(function(t){var r=[];return e.subscribe(function(e){r.push(e),r.length>n&&r.shift()},function(e){t.onError(e)},function(){for(;r.length>0;)t.onNext(r.shift());t.onCompleted()})},e)},Et.takeLastBuffer=function(n){var e=this;return new Tr(function(t){var r=[];return e.subscribe(function(e){r.push(e),r.length>n&&r.shift()},function(e){t.onError(e)},function(){t.onNext(r),t.onCompleted()})},e)},Et.windowWithCount=function(s,u){var n=this;if(+s||(s=0),Math.abs(s)===1/0&&(s=0),0>=s)throw new le;if(null==u&&(u=s),+u||(u=0),Math.abs(u)===1/0&&(u=0),0>=u)throw new le;return new Tr(function(t){function i(){var e=new Pr;a.push(e),t.onNext(Ye(e,r))}var e=new at,r=new ut(e),o=0,a=[];return i(),e.setDisposable(n.subscribe(function(e){for(var t=0,r=a.length;r>t;t++)a[t].onNext(e);var n=o-s+1;n>=0&&n%u===0&&a.shift().onCompleted(),++o%u===0&&i()},function(e){for(;a.length>0;)a.shift().onError(e);t.onError(e)},function(){for(;a.length>0;)a.shift().onCompleted();t.onCompleted()})),r},n)},Et.selectConcat=Et.concatMap=function(t,i,e){return ne(t)&&ne(i)?this.concatMap(function(r,n){var e=t(r,n);return re(e)&&(e=Vt(e)),(_e(e)||ge(e))&&(e=Kt(e)),e.map(function(e,t){return i(r,e,n,t)})}):ne(t)?F(this,t,e):F(this,function(){return t})},Et.concatMapObserver=Et.selectConcatObserver=function(e,t,r,n){var i=this,o=be(e,n,2),a=be(t,n,1),s=be(r,n,0);return new Tr(function(r){var n=0;return i.subscribe(function(e){var t;try{t=o(e,n++)}catch(e){return void r.onError(e)}re(t)&&(t=Vt(t)),r.onNext(t)},function(e){var t;try{t=a(e)}catch(e){return void r.onError(e)}re(t)&&(t=Vt(t)),r.onNext(t),r.onCompleted()},function(){var e;try{e=s()}catch(e){return void r.onError(e)}re(e)&&(e=Vt(e)),r.onNext(e),r.onCompleted()})},this).concatAll()},Et.defaultIfEmpty=function(e){var n=this;return e===a&&(e=null),new Tr(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},function(e){t.onError(e)},function(){!r&&t.onNext(e),t.onCompleted()})},n)},$.prototype.push=function(e){var t=-1===z(this.set,e,this.comparer);return t&&this.set.push(e),t},Et.distinct=function(i,e){var t=this;return e||(e=Q),new Tr(function(r){var n=new $(e);return t.subscribe(function(e){var t=e;if(i)try{t=i(e)}catch(e){return void r.onError(e)}n.push(t)&&r.onNext(e)},function(e){r.onError(e)},function(){r.onCompleted()})},this)};var Sr=function(n){function r(e,t,r){this.source=e,this.selector=be(t,r,3),n.call(this)}function i(n,i){return function(e,t,r){return n.call(this,i.selector(e,t,r),t,r)}}function t(e,t,r){this.o=e,this.selector=t,this.source=r,this.i=0,this.isStopped=!1}return We(r,n),r.prototype.internalMap=function(e,t){return new r(this.source,i(e,this),t)},r.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.selector,this))},t.prototype.onNext=function(e){if(!this.isStopped){var t=p(this.selector)(e,this.i++,this.source);return t===Ke?this.o.onError(t.e):void this.o.onNext(t)}},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},r}(Lt);Et.map=Et.select=function(e,t){var r="function"==typeof e?e:function(){return e};return this instanceof Sr?this.internalMap(r,t):new Sr(this,r,t)},Et.pluck=function(){var i=arguments,o=arguments.length;if(0===o)throw new Error("List of properties cannot be empty.");return this.map(function(e){for(var t=e,r=0;o>r;r++){var n=t[i[r]];if("undefined"==typeof n)return a;t=n}return t})},Et.flatMapObserver=Et.selectManyObserver=function(i,o,t,a){var e=this;return new Tr(function(r){var n=0;return e.subscribe(function(e){var t;try{t=i.call(a,e,n++)}catch(e){return void r.onError(e)}re(t)&&(t=Vt(t)),r.onNext(t)},function(e){var t;try{t=o.call(a,e)}catch(e){return void r.onError(e)}re(t)&&(t=Vt(t)),r.onNext(t),r.onCompleted()},function(){var e;try{e=t.call(a)}catch(e){return void r.onError(e)}re(e)&&(e=Vt(e)),r.onNext(e),r.onCompleted()})},e).mergeAll()},Et.selectMany=Et.flatMap=function(t,i,e){return ne(t)&&ne(i)?this.flatMap(function(r,n){var e=t(r,n);return re(e)&&(e=Vt(e)),(_e(e)||ge(e))&&(e=Kt(e)),e.map(function(e,t){return i(r,e,n,t)})},e):ne(t)?G(this,t,e):G(this,function(){return t})},Et.selectSwitch=Et.flatMapLatest=Et.switchMap=function(e,t){return this.select(e,t).switchLatest()};var Mr=function(r){function e(e,t){this.source=e,this.skipCount=t,r.call(this)}function t(e,t){this.c=t,this.r=t,this.o=e,this.isStopped=!1}return We(e,r),e.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.skipCount))},t.prototype.onNext=function(e){this.isStopped||(this.r<=0?this.o.onNext(e):this.r--)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},e}(Lt);Et.skip=function(e){if(0>e)throw new le;return new Mr(this,e)},Et.skipWhile=function(e,t){var i=this,o=be(e,t,3);return new Tr(function(t){var r=0,n=!1;return i.subscribe(function(e){if(!n)try{n=!o(e,r++,i)}catch(e){return void t.onError(e)}n&&t.onNext(e)},function(e){t.onError(e)},function(){t.onCompleted()})},i)},Et.take=function(e,t){if(0>e)throw new le;if(0===e)return qt(t);var n=this;return new Tr(function(t){var r=e;return n.subscribe(function(e){r-- >0&&(t.onNext(e),0>=r&&t.onCompleted())},function(e){t.onError(e)},function(){t.onCompleted()})},n)},Et.takeWhile=function(e,t){var i=this,o=be(e,t,3);return new Tr(function(t){var r=0,n=!0;return i.subscribe(function(e){if(n){try{n=o(e,r++,i)}catch(e){return void t.onError(e)}n?t.onNext(e):t.onCompleted()}},function(e){t.onError(e)},function(){t.onCompleted()})},i)};var Cr=function(n){function r(e,t,r){this.source=e,this.predicate=be(t,r,3),n.call(this)}function i(n,i){return function(e,t,r){return i.predicate(e,t,r)&&n.call(this,e,t,r)}}function t(e,t,r){this.o=e,this.predicate=t,this.source=r,this.i=0,this.isStopped=!1}return We(r,n),r.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.predicate,this))},r.prototype.internalFilter=function(e,t){return new r(this.source,i(e,this),t)},t.prototype.onNext=function(e){if(!this.isStopped){var t=p(this.predicate)(e,this.i++,this.source);return t===Ke?this.o.onError(t.e):void(t&&this.o.onNext(e))}},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},r}(Lt);Et.filter=Et.where=function(e,t){return this instanceof Cr?this.internalFilter(e,t):new Cr(this,e,t)},Et.transduce=function(e){function n(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}var i=this;return new Tr(function(t){var r=e(n(t));return i.subscribe(function(e){try{r["@@transducer/step"](t,e)}catch(e){t.onError(e)}},function(e){t.onError(e)},function(){r["@@transducer/result"](t)})},i)};var Tr=Y.AnonymousObservable=function(r){function o(e){return e&&ne(e.dispose)?e:ne(e)?rt(e):nt}function i(e,t){var r=t[0],n=t[1],i=p(n)(r);return i!==Ke||r.fail(Ke.e)?void r.setDisposable(o(i)):d(Ke.e)}function e(n,e){function t(e){var t=new Er(e),r=[t,n];return mt.scheduleRequired()?mt.scheduleWithState(r,i):i(null,r),t}this.source=e,r.call(this,t)}return We(e,r),e}(kt),Er=function(t){function e(e){t.call(this),this.observer=e,this.m=new at}We(e,t);var r=e.prototype;return r.next=function(e){var t=p(this.observer.onNext).call(this.observer,e);t===Ke&&(this.dispose(),d(t.e))},r.error=function(e){var t=p(this.observer.onError).call(this.observer,e);this.dispose(),t===Ke&&d(t.e)},r.completed=function(){var e=p(this.observer.onCompleted).call(this.observer);this.dispose(),e===Ke&&d(e.e)},r.setDisposable=function(e){this.m.setDisposable(e)},r.getDisposable=function(){return this.m.getDisposable()},r.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ot),Or=function(e,t){this.subject=e,this.observer=t};Or.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var e=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(e,1),this.observer=null}};var Pr=Y.Subject=function(e){function t(e){return ot(this),this.isStopped?this.hasError?(e.onError(this.error),nt):(e.onCompleted(),nt):(this.observers.push(e),new Or(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return We(r,e),Xe(r.prototype,Ct.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(ot(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=i(this.observers),r=t.length;r>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(ot(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,r=i(this.observers),n=r.length;n>t;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){if(ot(this),!this.isStopped)for(var t=0,r=i(this.observers),n=r.length;n>t;t++)r[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(e,t){return new Ar(e,t)},r}(kt),Ar=(Y.AsyncSubject=function(e){function t(e){return ot(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),nt):(this.observers.push(e),new Or(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return We(r,e),Xe(r.prototype,Ct,{hasObservers:function(){return ot(this),this.observers.length>0},onCompleted:function(){var e,t;if(ot(this),!this.isStopped){this.isStopped=!0;var r=i(this.observers),t=r.length;if(this.hasValue)for(e=0;t>e;e++){var n=r[e];n.onNext(this.value),n.onCompleted()}else for(e=0;t>e;e++)r[e].onCompleted();this.observers.length=0}},onError:function(e){if(ot(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,r=i(this.observers),n=r.length;n>t;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){ot(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(kt),Y.AnonymousSubject=function(r){function n(e){return this.observable.subscribe(e)}function e(e,t){this.observer=e,this.observable=t,r.call(this,n)}return We(e,r),Xe(e.prototype,Ct.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),e}(kt));"function"==typeof Ir&&"object"==typeof Ir.amd&&Ir.amd?(H.Rx=Y,Ir(function(){return Y})):U&&q?W?(q.exports=Y).Rx=Y:U.Rx=Y:H.Rx=Y;var jr=e()}).call(this)}).call(this,e(150),"undefined"!=typeof n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{150:150}]},{},[1])(1)})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],16:[function(i,o,e){(function(e){var t=typeof e!=="undefined"?e:typeof window!=="undefined"?window:{};var r=i("min-document");var n;if(typeof document!=="undefined"){n=document}else{n=t["__GLOBAL_DOCUMENT_CACHE@4"];if(!n){n=t["__GLOBAL_DOCUMENT_CACHE@4"]=r}}o.exports=n}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":4}],17:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a;var s=i*8-n-1;var u=(1<<s)-1;var c=u>>1;var l=-7;var h=r?i-1:0;var p=r?-1:1;var f=e[t+h];h+=p;o=f&(1<<-l)-1;f>>=-l;l+=s;for(;l>0;o=o*256+e[t+h],h+=p,l-=8){}a=o&(1<<-l)-1;o>>=-l;l+=n;for(;l>0;a=a*256+e[t+h],h+=p,l-=8){}if(o===0){o=1-c}else if(o===u){return a?NaN:(f?-1:1)*Infinity}else{a=a+Math.pow(2,n);o=o-c}return(f?-1:1)*a*Math.pow(2,o-n)};r.write=function(e,t,r,n,i,o){var a,s,u;var c=o*8-i-1;var l=(1<<c)-1;var h=l>>1;var p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var f=n?0:o-1;var d=n?1:-1;var v=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){s=isNaN(t)?1:0;a=l}else{a=Math.floor(Math.log(t)/Math.LN2);if(t*(u=Math.pow(2,-a))<1){a--;u*=2}if(a+h>=1){t+=p/u}else{t+=p*Math.pow(2,1-h)}if(t*u>=2){a++;u/=2}if(a+h>=l){s=0;a=l}else if(a+h>=1){s=(t*u-1)*Math.pow(2,i);a=a+h}else{s=t*Math.pow(2,h-1)*Math.pow(2,i);a=0}}for(;i>=8;e[r+f]=s&255,f+=d,s/=256,i-=8){}a=a<<i|s;c+=i;for(;c>0;e[r+f]=a&255,f+=d,a/=256,c-=8){}e[r+f-d]|=v*128}},{}],18:[function(e,n,t){(function(e){"use strict";var r=typeof window!=="undefined"?window:typeof e!=="undefined"?e:{};n.exports=t;function t(e,t){if(e in r){return r[e]}r[e]=t;return t}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],19:[function(e,t,r){"use strict";var a=e("./index.js");t.exports=n;function n(e,t,r){var n="__INDIVIDUAL_ONE_VERSION_"+e;var i=n+"_ENFORCE_SINGLETON";var o=a(i,t);if(o!==t){throw new Error("Can only have one copy of "+e+".\n"+"You already have version "+o+" installed.\n"+"This means you cannot install version "+t)}return a(n,r)}},{"./index.js":18}],20:[function(e,t,r){"use strict";t.exports=function e(t){return typeof t==="object"&&t!==null}},{}],21:[function(e,t,r){"use strict";var m={};m.base32="0123456789bcdefghjkmnpqrstuvwxyz";m.encode=function(e,t,r){if(typeof r=="undefined"){for(var n=1;n<=12;n++){var i=m.encode(e,t,n);var o=m.decode(i);if(o.lat==e&&o.lon==t)return i}r=12}e=Number(e);t=Number(t);r=Number(r);if(isNaN(e)||isNaN(t)||isNaN(r))throw new Error("Invalid geohash");var a=0;var s=0;var u=true;var c="";var l=-90,h=90;var p=-180,f=180;while(c.length<r){if(u){var d=(p+f)/2;if(t>=d){a=a*2+1;p=d}else{a=a*2;f=d}}else{var v=(l+h)/2;if(e>=v){a=a*2+1;l=v}else{a=a*2;h=v}}u=!u;if(++s==5){c+=m.base32.charAt(a);s=0;a=0}}return c};m.decode=function(e){var t=m.bounds(e);var r=t.sw.lat,n=t.sw.lon;var i=t.ne.lat,o=t.ne.lon;var a=(r+i)/2;var s=(n+o)/2;a=a.toFixed(Math.floor(2-Math.log(i-r)/Math.LN10));s=s.toFixed(Math.floor(2-Math.log(o-n)/Math.LN10));return{lat:Number(a),lon:Number(s)}};m.bounds=function(e){if(e.length===0)throw new Error("Invalid geohash");e=e.toLowerCase();var t=true;var r=-90,n=90;var i=-180,o=180;for(var a=0;a<e.length;a++){var s=e.charAt(a);var u=m.base32.indexOf(s);if(u==-1)throw new Error("Invalid geohash");for(var c=4;c>=0;c--){var l=u>>c&1;if(t){var h=(i+o)/2;if(l==1){i=h}else{o=h}}else{var p=(r+n)/2;if(l==1){r=p}else{n=p}}t=!t}}var f={sw:{lat:r,lon:i},ne:{lat:n,lon:o}};return f};m.adjacent=function(e,t){e=e.toLowerCase();t=t.toLowerCase();if(e.length===0)throw new Error("Invalid geohash");if("nsew".indexOf(t)==-1)throw new Error("Invalid direction");var r={n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]};var n={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]};var i=e.slice(-1);var o=e.slice(0,-1);var a=e.length%2;if(n[t][a].indexOf(i)!=-1&&o!==""){o=m.adjacent(o,t)}return o+m.base32.charAt(r[t][a].indexOf(i))};m.neighbours=function(e){return{n:m.adjacent(e,"n"),ne:m.adjacent(m.adjacent(e,"n"),"e"),e:m.adjacent(e,"e"),se:m.adjacent(m.adjacent(e,"s"),"e"),s:m.adjacent(e,"s"),sw:m.adjacent(m.adjacent(e,"s"),"w"),w:m.adjacent(e,"w"),nw:m.adjacent(m.adjacent(e,"n"),"w")}};if(typeof t!="undefined"&&t.exports)t.exports=m},{}],22:[function(e,r,n){(function(e,t){typeof n==="object"&&typeof r!=="undefined"?t(n):typeof o==="function"&&o.amd?o(["exports"],t):(e=e||self,t(e.martinez={}))})(this,function(e){"use strict";function n(e,t){return e>t?1:e<t?-1:0}var m=function e(t,r){if(t===void 0)t=n;if(r===void 0)r=false;this._compare=t;this._root=null;this._size=0;this._noDuplicates=!!r};var t={size:{configurable:true}};m.prototype.rotateLeft=function e(t){var r=t.right;if(r){t.right=r.left;if(r.left){r.left.parent=t}r.parent=t.parent}if(!t.parent){this._root=r}else if(t===t.parent.left){t.parent.left=r}else{t.parent.right=r}if(r){r.left=t}t.parent=r};m.prototype.rotateRight=function e(t){var r=t.left;if(r){t.left=r.right;if(r.right){r.right.parent=t}r.parent=t.parent}if(!t.parent){this._root=r}else if(t===t.parent.left){t.parent.left=r}else{t.parent.right=r}if(r){r.right=t}t.parent=r};m.prototype._splay=function e(t){while(t.parent){var r=t.parent;if(!r.parent){if(r.left===t){this.rotateRight(r)}else{this.rotateLeft(r)}}else if(r.left===t&&r.parent.left===r){this.rotateRight(r.parent);this.rotateRight(r)}else if(r.right===t&&r.parent.right===r){this.rotateLeft(r.parent);this.rotateLeft(r)}else if(r.left===t&&r.parent.right===r){this.rotateRight(r);this.rotateLeft(r)}else{this.rotateLeft(r);this.rotateRight(r)}}};m.prototype.splay=function e(t){var r,n,i,o,a;while(t.parent){r=t.parent;n=r.parent;if(n&&n.parent){i=n.parent;if(i.left===n){i.left=t}else{i.right=t}t.parent=i}else{t.parent=null;this._root=t}o=t.left;a=t.right;if(t===r.left){if(n){if(n.left===r){if(r.right){n.left=r.right;n.left.parent=n}else{n.left=null}r.right=n;n.parent=r}else{if(o){n.right=o;o.parent=n}else{n.right=null}t.left=n;n.parent=t}}if(a){r.left=a;a.parent=r}else{r.left=null}t.right=r;r.parent=t}else{if(n){if(n.right===r){if(r.left){n.right=r.left;n.right.parent=n}else{n.right=null}r.left=n;n.parent=r}else{if(a){n.left=a;a.parent=n}else{n.left=null}t.right=n;n.parent=t}}if(o){r.right=o;o.parent=r}else{r.right=null}t.left=r;r.parent=t}}};m.prototype.replace=function e(t,r){if(!t.parent){this._root=r}else if(t===t.parent.left){t.parent.left=r}else{t.parent.right=r}if(r){r.parent=t.parent}};m.prototype.minNode=function e(t){if(t===void 0)t=this._root;if(t){while(t.left){t=t.left}}return t};m.prototype.maxNode=function e(t){if(t===void 0)t=this._root;if(t){while(t.right){t=t.right}}return t};m.prototype.insert=function e(t,r){var n=this._root;var i=null;var o=this._compare;var a;if(this._noDuplicates){while(n){i=n;a=o(n.key,t);if(a===0){return}else if(o(n.key,t)<0){n=n.right}else{n=n.left}}}else{while(n){i=n;if(o(n.key,t)<0){n=n.right}else{n=n.left}}}n={key:t,data:r,left:null,right:null,parent:i};if(!i){this._root=n}else if(o(i.key,n.key)<0){i.right=n}else{i.left=n}this.splay(n);this._size++;return n};m.prototype.find=function e(t){var r=this._root;var n=this._compare;while(r){var i=n(r.key,t);if(i<0){r=r.right}else if(i>0){r=r.left}else{return r}}return null};m.prototype.contains=function e(t){var r=this._root;var n=this._compare;while(r){var i=n(t,r.key);if(i===0){return true}else if(i<0){r=r.left}else{r=r.right}}return false};m.prototype.remove=function e(t){var r=this.find(t);if(!r){return false}this.splay(r);if(!r.left){this.replace(r,r.right)}else if(!r.right){this.replace(r,r.left)}else{var n=this.minNode(r.right);if(n.parent!==r){this.replace(n,n.right);n.right=r.right;n.right.parent=n}this.replace(r,n);n.left=r.left;n.left.parent=n}this._size--;return true};m.prototype.removeNode=function e(t){if(!t){return false}this.splay(t);if(!t.left){this.replace(t,t.right)}else if(!t.right){this.replace(t,t.left)}else{var r=this.minNode(t.right);if(r.parent!==t){this.replace(r,r.right);r.right=t.right;r.right.parent=r}this.replace(t,r);r.left=t.left;r.left.parent=r}this._size--;return true};m.prototype.erase=function e(t){var r=this.find(t);if(!r){return}this.splay(r);var n=r.left;var i=r.right;var o=null;if(n){n.parent=null;o=this.maxNode(n);this.splay(o);this._root=o}if(i){if(n){o.right=i}else{this._root=i}i.parent=o}this._size--};m.prototype.pop=function e(){var t=this._root,r=null;if(t){while(t.left){t=t.left}r={key:t.key,data:t.data};this.remove(t.key)}return r};m.prototype.next=function e(t){var r=t;if(r){if(r.right){r=r.right;while(r&&r.left){r=r.left}}else{r=t.parent;while(r&&r.right===t){t=r;r=r.parent}}}return r};m.prototype.prev=function e(t){var r=t;if(r){if(r.left){r=r.left;while(r&&r.right){r=r.right}}else{r=t.parent;while(r&&r.left===t){t=r;r=r.parent}}}return r};m.prototype.forEach=function e(t){var r=this._root;var n=[],i=false,o=0;while(!i){if(r){n.push(r);r=r.left}else{if(n.length>0){r=n.pop();t(r,o++);r=r.right}else{i=true}}}return this};m.prototype.range=function e(t,r,n,i){var o=[];var a=this._compare;var s=this._root,u;while(o.length!==0||s){if(s){o.push(s);s=s.left}else{s=o.pop();u=a(s.key,r);if(u>0){break}else if(a(s.key,t)>=0){if(n.call(i,s)){return this}}s=s.right}}return this};m.prototype.keys=function e(){var t=this._root;var r=[],n=[],i=false;while(!i){if(t){r.push(t);t=t.left}else{if(r.length>0){t=r.pop();n.push(t.key);t=t.right}else{i=true}}}return n};m.prototype.values=function e(){var t=this._root;var r=[],n=[],i=false;while(!i){if(t){r.push(t);t=t.left}else{if(r.length>0){t=r.pop();n.push(t.data);t=t.right}else{i=true}}}return n};m.prototype.at=function e(t){var r=this._root;var n=[],i=false,o=0;while(!i){if(r){n.push(r);r=r.left}else{if(n.length>0){r=n.pop();if(o===t){return r}o++;r=r.right}else{i=true}}}return null};m.prototype.load=function e(t,r,n){if(t===void 0)t=[];if(r===void 0)r=[];if(n===void 0)n=false;if(this._size!==0){throw new Error("bulk-load: tree is not empty")}var i=t.length;if(n){c(t,r,0,i-1,this._compare)}this._root=l(null,t,r,0,i);this._size=i;return this};m.prototype.min=function e(){var t=this.minNode(this._root);if(t){return t.key}else{return null}};m.prototype.max=function e(){var t=this.maxNode(this._root);if(t){return t.key}else{return null}};m.prototype.isEmpty=function e(){return this._root===null};t.size.get=function(){return this._size};m.createTree=function e(t,r,n,i,o){return new m(n,o).load(t,r,i)};Object.defineProperties(m.prototype,t);function l(e,t,r,n,i){var o=i-n;if(o>0){var a=n+Math.floor(o/2);var s=t[a];var u=r[a];var c={key:s,data:u,parent:e};c.left=l(c,t,r,n,a);c.right=l(c,t,r,a+1,i);return c}return null}function c(e,t,r,n,i){if(r>=n){return}var o=e[r+n>>1];var a=r-1;var s=n+1;while(true){do{a++}while(i(e[a],o)<0);do{s--}while(i(e[s],o)>0);if(a>=s){break}var u=e[a];e[a]=e[s];e[s]=u;u=t[a];t[a]=t[s];t[s]=u}c(e,t,r,s,i);c(e,t,s+1,n,i)}var a=0;var u=1;var h=2;var p=3;var g=0;var s=1;var _=2;var f=3;function y(e,t,r){if(t===null){e.inOut=false;e.otherInOut=true}else{if(e.isSubject===t.isSubject){e.inOut=!t.inOut;e.otherInOut=t.otherInOut}else{e.inOut=!t.otherInOut;e.otherInOut=t.isVertical()?!t.inOut:t.inOut}if(t){e.prevInResult=!i(t,r)||t.isVertical()?t.prevInResult:t}}var n=i(e,r);if(n){e.resultTransition=o(e,r)}else{e.resultTransition=0}}function i(e,t){switch(e.type){case a:switch(t){case g:return!e.otherInOut;case s:return e.otherInOut;case _:return e.isSubject&&e.otherInOut||!e.isSubject&&!e.otherInOut;case f:return true}break;case h:return t===g||t===s;case p:return t===_;case u:return false}return false}function o(e,t){var r=!e.inOut;var n=!e.otherInOut;var i;switch(t){case g:i=r&&n;break;case s:i=r||n;break;case f:i=r^n;break;case _:if(e.isSubject){i=r&&!n}else{i=n&&!r}break}return i?+1:-1}var d=function e(t,r,n,i,o){this.left=r;this.point=t;this.otherEvent=n;this.isSubject=i;this.type=o||a;this.inOut=false;this.otherInOut=false;this.prevInResult=null;this.resultTransition=0;this.otherPos=-1;this.outputContourId=-1;this.isExteriorRing=true};var r={inResult:{configurable:true}};d.prototype.isBelow=function e(t){var r=this.point,n=this.otherEvent.point;return this.left?(r[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(r[1]-t[1])>0:(n[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(n[1]-t[1])>0};d.prototype.isAbove=function e(t){return!this.isBelow(t)};d.prototype.isVertical=function e(){return this.point[0]===this.otherEvent.point[0]};r.inResult.get=function(){return this.resultTransition!==0};d.prototype.clone=function e(){var t=new d(this.point,this.left,this.otherEvent,this.isSubject,this.type);t.contourId=this.contourId;t.resultTransition=this.resultTransition;t.prevInResult=this.prevInResult;t.isExteriorRing=this.isExteriorRing;t.inOut=this.inOut;t.otherInOut=this.otherInOut;return t};Object.defineProperties(d.prototype,r);function v(e,t){if(e[0]===t[0]){if(e[1]===t[1]){return true}else{return false}}return false}var b=11102230246251565e-32;var L=134217729;var N=(3+8*b)*b;function I(e,t,r,n,i){var o,a,s,u;var c=t[0];var l=n[0];var h=0;var p=0;if(l>c===l>-c){o=c;c=t[++h]}else{o=l;l=n[++p]}var f=0;if(h<e&&p<r){if(l>c===l>-c){a=c+o;s=o-(a-c);c=t[++h]}else{a=l+o;s=o-(a-l);l=n[++p]}o=a;if(s!==0){i[f++]=s}while(h<e&&p<r){if(l>c===l>-c){a=o+c;u=a-o;s=o-(a-u)+(c-u);c=t[++h]}else{a=o+l;u=a-o;s=o-(a-u)+(l-u);l=n[++p]}o=a;if(s!==0){i[f++]=s}}}while(h<e){a=o+c;u=a-o;s=o-(a-u)+(c-u);c=t[++h];o=a;if(s!==0){i[f++]=s}}while(p<r){a=o+l;u=a-o;s=o-(a-u)+(l-u);l=n[++p];o=a;if(s!==0){i[f++]=s}}if(o!==0||f===0){i[f++]=o}return f}function D(e,t){var r=t[0];for(var n=1;n<e;n++){r+=t[n]}return r}function x(e){return new Float64Array(e)}var w=(3+16*b)*b;var B=(2+12*b)*b;var F=(9+64*b)*b*b;var z=x(4);var $=x(8);var G=x(12);var V=x(16);var H=x(4);function S(e,t,r,n,i,o,a){var s,u,c,l;var h,p,f,d,v,m,g,_,y,b,x,w,S,M;var C=e-i;var T=r-i;var E=t-o;var O=n-o;b=C*O;p=L*C;f=p-(p-C);d=C-f;p=L*O;v=p-(p-O);m=O-v;x=d*m-(b-f*v-d*v-f*m);w=E*T;p=L*E;f=p-(p-E);d=E-f;p=L*T;v=p-(p-T);m=T-v;S=d*m-(w-f*v-d*v-f*m);g=x-S;h=x-g;z[0]=x-(g+h)+(h-S);_=b+g;h=_-b;y=b-(_-h)+(g-h);g=y-w;h=y-g;z[1]=y-(g+h)+(h-w);M=_+g;h=M-_;z[2]=_-(M-h)+(g-h);z[3]=M;var P=D(4,z);var A=B*a;if(P>=A||-P>=A){return P}h=e-C;s=e-(C+h)+(h-i);h=r-T;c=r-(T+h)+(h-i);h=t-E;u=t-(E+h)+(h-o);h=n-O;l=n-(O+h)+(h-o);if(s===0&&u===0&&c===0&&l===0){return P}A=F*a+N*Math.abs(P);P+=C*l+O*s-(E*c+T*u);if(P>=A||-P>=A){return P}b=s*O;p=L*s;f=p-(p-s);d=s-f;p=L*O;v=p-(p-O);m=O-v;x=d*m-(b-f*v-d*v-f*m);w=u*T;p=L*u;f=p-(p-u);d=u-f;p=L*T;v=p-(p-T);m=T-v;S=d*m-(w-f*v-d*v-f*m);g=x-S;h=x-g;H[0]=x-(g+h)+(h-S);_=b+g;h=_-b;y=b-(_-h)+(g-h);g=y-w;h=y-g;H[1]=y-(g+h)+(h-w);M=_+g;h=M-_;H[2]=_-(M-h)+(g-h);H[3]=M;var j=I(4,z,4,H,$);b=C*l;p=L*C;f=p-(p-C);d=C-f;p=L*l;v=p-(p-l);m=l-v;x=d*m-(b-f*v-d*v-f*m);w=E*c;p=L*E;f=p-(p-E);d=E-f;p=L*c;v=p-(p-c);m=c-v;S=d*m-(w-f*v-d*v-f*m);g=x-S;h=x-g;H[0]=x-(g+h)+(h-S);_=b+g;h=_-b;y=b-(_-h)+(g-h);g=y-w;h=y-g;H[1]=y-(g+h)+(h-w);M=_+g;h=M-_;H[2]=_-(M-h)+(g-h);H[3]=M;var R=I(j,$,4,H,G);b=s*l;p=L*s;f=p-(p-s);d=s-f;p=L*l;v=p-(p-l);m=l-v;x=d*m-(b-f*v-d*v-f*m);w=u*c;p=L*u;f=p-(p-u);d=u-f;p=L*c;v=p-(p-c);m=c-v;S=d*m-(w-f*v-d*v-f*m);g=x-S;h=x-g;H[0]=x-(g+h)+(h-S);_=b+g;h=_-b;y=b-(_-h)+(g-h);g=y-w;h=y-g;H[1]=y-(g+h)+(h-w);M=_+g;h=M-_;H[2]=_-(M-h)+(g-h);H[3]=M;var k=I(R,G,4,H,V);return V[k-1]}function M(e,t,r,n,i,o){var a=(t-o)*(r-i);var s=(e-i)*(n-o);var u=a-s;if(a===0||s===0||a>0!==s>0){return u}var c=Math.abs(a+s);if(Math.abs(u)>=w*c){return u}return-S(e,t,r,n,i,o,c)}function C(e,t,r){var n=M(e[0],e[1],t[0],t[1],r[0],r[1]);if(n>0){return-1}if(n<0){return 1}return 0}function T(e,t){var r=e.point;var n=t.point;if(r[0]>n[0]){return 1}if(r[0]<n[0]){return-1}if(r[1]!==n[1]){return r[1]>n[1]?1:-1}return E(e,t,r)}function E(e,t,r,n){if(e.left!==t.left){return e.left?1:-1}if(C(r,e.otherEvent.point,t.otherEvent.point)!==0){return!e.isBelow(t.otherEvent.point)?1:-1}return!e.isSubject&&t.isSubject?1:-1}function O(e,t,r){var n=new d(t,false,e,e.isSubject);var i=new d(t,true,e.otherEvent,e.isSubject);if(v(e.point,e.otherEvent.point)){console.warn("what is that, a collapsed segment?",e)}n.contourId=i.contourId=e.contourId;if(T(i,e.otherEvent)>0){e.otherEvent.left=true;i.left=false}e.otherEvent.otherEvent=i;e.otherEvent=n;r.push(i);r.push(n);return r}function P(e,t){return e[0]*t[1]-e[1]*t[0]}function A(e,t){return e[0]*t[0]+e[1]*t[1]}function j(e,t,r,n,i){var o=[t[0]-e[0],t[1]-e[1]];var a=[n[0]-r[0],n[1]-r[1]];function s(e,t,r){return[e[0]+t*r[0],e[1]+t*r[1]]}var u=[r[0]-e[0],r[1]-e[1]];var c=P(o,a);var l=c*c;var h=A(o,o);if(l>0){var p=P(u,a)/c;if(p<0||p>1){return null}var f=P(u,o)/c;if(f<0||f>1){return null}if(p===0||p===1){return i?null:[s(e,p,o)]}if(f===0||f===1){return i?null:[s(r,f,a)]}return[s(e,p,o)]}c=P(u,o);l=c*c;if(l>0){return null}var d=A(o,u)/h;var v=d+A(o,a)/h;var m=Math.min(d,v);var g=Math.max(d,v);if(m<=1&&g>=0){if(m===1){return i?null:[s(e,m>0?m:0,o)]}if(g===0){return i?null:[s(e,g<1?g:1,o)]}if(i&&m===0&&g===1){return null}return[s(e,m>0?m:0,o),s(e,g<1?g:1,o)]}return null}function R(e,t,r){var n=j(e.point,e.otherEvent.point,t.point,t.otherEvent.point);var i=n?n.length:0;if(i===0){return 0}if(i===1&&(v(e.point,t.point)||v(e.otherEvent.point,t.otherEvent.point))){return 0}if(i===2&&e.isSubject===t.isSubject){return 0}if(i===1){if(!v(e.point,n[0])&&!v(e.otherEvent.point,n[0])){O(e,n[0],r)}if(!v(t.point,n[0])&&!v(t.otherEvent.point,n[0])){O(t,n[0],r)}return 1}var o=[];var a=false;var s=false;if(v(e.point,t.point)){a=true}else if(T(e,t)===1){o.push(t,e)}else{o.push(e,t)}if(v(e.otherEvent.point,t.otherEvent.point)){s=true}else if(T(e.otherEvent,t.otherEvent)===1){o.push(t.otherEvent,e.otherEvent)}else{o.push(e.otherEvent,t.otherEvent)}if(a&&s||a){t.type=u;e.type=t.inOut===e.inOut?h:p;if(a&&!s){O(o[1].otherEvent,o[0].point,r)}return 2}if(s){O(o[0],o[1].point,r);return 3}if(o[0]!==o[3].otherEvent){O(o[0],o[1].point,r);O(o[1],o[2].point,r);return 3}O(o[0],o[1].point,r);O(o[3].otherEvent,o[2].point,r);return 3}function k(e,t){if(e===t){return 0}if(C(e.point,e.otherEvent.point,t.point)!==0||C(e.point,e.otherEvent.point,t.otherEvent.point)!==0){if(v(e.point,t.point)){return e.isBelow(t.otherEvent.point)?-1:1}if(e.point[0]===t.point[0]){return e.point[1]<t.point[1]?-1:1}if(T(e,t)===1){return t.isAbove(e.point)?-1:1}return e.isBelow(t.point)?-1:1}if(e.isSubject===t.isSubject){var r=e.point,n=t.point;if(r[0]===n[0]&&r[1]===n[1]){r=e.otherEvent.point;n=t.otherEvent.point;if(r[0]===n[0]&&r[1]===n[1]){return 0}else{return e.contourId>t.contourId?1:-1}}}else{return e.isSubject?-1:1}return T(e,t)===1?1:-1}function U(e,t,r,n,i,o){var a=new m(k);var s=[];var u=Math.min(n[2],i[2]);var c,l,h;while(e.length!==0){var p=e.pop();s.push(p);if(o===g&&p.point[0]>u||o===_&&p.point[0]>n[2]){break}if(p.left){l=c=a.insert(p);h=a.minNode();if(c!==h){c=a.prev(c)}else{c=null}l=a.next(l);var f=c?c.key:null;var d=void 0;y(p,f,o);if(l){if(R(p,l.key,e)===2){y(p,f,o);y(p,l.key,o)}}if(c){if(R(c.key,p,e)===2){var v=c;if(v!==h){v=a.prev(v)}else{v=null}d=v?v.key:null;y(f,d,o);y(p,f,o)}}}else{p=p.otherEvent;l=c=a.find(p);if(c&&l){if(c!==h){c=a.prev(c)}else{c=null}l=a.next(l);a.remove(p);if(l&&c){R(c.key,l.key,e)}}}}return s}var q=function e(){this.points=[];this.holeIds=[];this.holeOf=null;this.depth=null};q.prototype.isExterior=function e(){return this.holeOf==null};function W(e){var t,r,n,i;var o=[];for(r=0,n=e.length;r<n;r++){t=e[r];if(t.left&&t.inResult||!t.left&&t.otherEvent.inResult){o.push(t)}}var a=false;while(!a){a=true;for(r=0,n=o.length;r<n;r++){if(r+1<n&&T(o[r],o[r+1])===1){i=o[r];o[r]=o[r+1];o[r+1]=i;a=false}}}for(r=0,n=o.length;r<n;r++){t=o[r];t.otherPos=r}for(r=0,n=o.length;r<n;r++){t=o[r];if(!t.left){i=t.otherPos;t.otherPos=t.otherEvent.otherPos;t.otherEvent.otherPos=i}}return o}function X(e,t,r,n){var i=e+1,o=t[e].point,a;var s=t.length;if(i<s){a=t[i].point}while(i<s&&a[0]===o[0]&&a[1]===o[1]){if(!r[i]){return i}else{i++}a=t[i].point}i=e-1;while(r[i]&&i>n){i--}return i}function Y(e,t,r){var n=new q;if(e.prevInResult!=null){var i=e.prevInResult;var o=i.outputContourId;var a=i.resultTransition;if(a>0){var s=t[o];if(s.holeOf!=null){var u=s.holeOf;t[u].holeIds.push(r);n.holeOf=u;n.depth=t[o].depth}else{t[o].holeIds.push(r);n.holeOf=o;n.depth=t[o].depth+1}}else{n.holeOf=null;n.depth=t[o].depth}}else{n.holeOf=null;n.depth=0}return n}function K(e){var a,t;var s=W(e);var u={};var c=[];var r=function(){if(u[a]){return}var t=c.length;var e=Y(s[a],c,t);var r=function(e){u[e]=true;s[e].outputContourId=t};var n=a;var i=a;var o=s[a].point;e.points.push(o);while(true){r(n);n=s[n].otherPos;r(n);e.points.push(s[n].point);n=X(n,s,u,i);if(n==i){break}}c.push(e)};for(a=0,t=s.length;a<t;a++)r();return c}var Z=Q;var J=Q;function Q(e,t){if(!(this instanceof Q)){return new Q(e,t)}this.data=e||[];this.length=this.data.length;this.compare=t||ee;if(this.length>0){for(var r=(this.length>>1)-1;r>=0;r--){this._down(r)}}}function ee(e,t){return e<t?-1:e>t?1:0}Q.prototype={push:function(e){this.data.push(e);this.length++;this._up(this.length-1)},pop:function(){if(this.length===0){return undefined}var e=this.data[0];this.length--;if(this.length>0){this.data[0]=this.data[this.length];this._down(0)}this.data.pop();return e},peek:function(){return this.data[0]},_up:function(e){var t=this.data;var r=this.compare;var n=t[e];while(e>0){var i=e-1>>1;var o=t[i];if(r(n,o)>=0){break}t[e]=o;e=i}t[e]=n},_down:function(e){var t=this.data;var r=this.compare;var n=this.length>>1;var i=t[e];while(e<n){var o=(e<<1)+1;var a=o+1;var s=t[o];if(a<this.length&&r(t[a],s)<0){o=a;s=t[a]}if(r(s,i)>=0){break}t[e]=s;e=o}t[e]=i}};Z.default=J;var te=Math.max;var re=Math.min;var ne=0;function ie(e,t,r,n,i,o){var a,s,u,c,l,h;for(a=0,s=e.length-1;a<s;a++){u=e[a];c=e[a+1];l=new d(u,false,undefined,t);h=new d(c,false,l,t);l.otherEvent=h;if(u[0]===c[0]&&u[1]===c[1]){continue}l.contourId=h.contourId=r;if(!o){l.isExteriorRing=false;h.isExteriorRing=false}if(T(l,h)>0){h.left=true}else{l.left=true}var p=u[0],f=u[1];i[0]=re(i[0],p);i[1]=re(i[1],f);i[2]=te(i[2],p);i[3]=te(i[3],f);n.push(l);n.push(h)}}function oe(e,t,r,n,i){var o=new Z(null,T);var a,s,u,c,l,h;for(u=0,c=e.length;u<c;u++){a=e[u];for(l=0,h=a.length;l<h;l++){s=l===0;if(s){ne++}ie(a[l],true,ne,o,r,s)}}for(u=0,c=t.length;u<c;u++){a=t[u];for(l=0,h=a.length;l<h;l++){s=l===0;if(i===_){s=false}if(s){ne++}ie(a[l],false,ne,o,n,s)}}return o}var ae=[];function se(e,t,r){var n=null;if(e.length*t.length===0){if(r===g){n=ae}else if(r===_){n=e}else if(r===s||r===f){n=e.length===0?t:e}}return n}function ue(e,t,r,n,i){var o=null;if(r[0]>n[2]||n[0]>r[2]||r[1]>n[3]||n[1]>r[3]){if(i===g){o=ae}else if(i===_){o=e}else if(i===s||i===f){o=e.concat(t)}}return o}function ce(e,t,r){if(typeof e[0][0][0]==="number"){e=[e]}if(typeof t[0][0][0]==="number"){t=[t]}var n=se(e,t,r);if(n){return n===ae?null:n}var i=[Infinity,Infinity,-Infinity,-Infinity];var o=[Infinity,Infinity,-Infinity,-Infinity];var a=oe(e,t,i,o,r);n=ue(e,t,i,o,r);if(n){return n===ae?null:n}var s=U(a,e,t,i,o,r);var u=K(s);var c=[];for(var l=0;l<u.length;l++){var h=u[l];if(h.isExterior()){var p=[h.points];for(var f=0;f<h.holeIds.length;f++){var d=h.holeIds[f];p.push(u[d].points)}c.push(p)}}return c}function le(e,t){return ce(e,t,s)}function he(e,t){return ce(e,t,_)}function pe(e,t){return ce(e,t,f)}function fe(e,t){return ce(e,t,g)}var de={UNION:s,DIFFERENCE:_,INTERSECTION:g,XOR:f};e.diff=he;e.intersection=fe;e.operations=de;e.union=le;e.xor=pe;Object.defineProperty(e,"__esModule",{value:true})})},{}],23:[function(e,t,r){"use strict";var n=e("./lib/utils/common").assign;var i=e("./lib/deflate");var o=e("./lib/inflate");var a=e("./lib/zlib/constants");var s={};n(s,i,o,a);t.exports=s},{"./lib/deflate":24,"./lib/inflate":25,"./lib/utils/common":26,"./lib/zlib/constants":29}],24:[function(e,t,r){"use strict";var a=e("./zlib/deflate");var s=e("./utils/common");var u=e("./utils/strings");var i=e("./zlib/messages");var o=e("./zlib/zstream");var c=Object.prototype.toString;var l=0;var h=4;var p=0;var f=1;var d=2;var v=-1;var m=0;var g=8;function _(e){if(!(this instanceof _))return new _(e);this.options=s.assign({level:v,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},e||{});var t=this.options;if(t.raw&&t.windowBits>0){t.windowBits=-t.windowBits}else if(t.gzip&&t.windowBits>0&&t.windowBits<16){t.windowBits+=16}this.err=0;this.msg="";this.ended=false;this.chunks=[];this.strm=new o;this.strm.avail_out=0;var r=a.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==p){throw new Error(i[r])}if(t.header){a.deflateSetHeader(this.strm,t.header)}if(t.dictionary){var n;if(typeof t.dictionary==="string"){n=u.string2buf(t.dictionary)}else if(c.call(t.dictionary)==="[object ArrayBuffer]"){n=new Uint8Array(t.dictionary)}else{n=t.dictionary}r=a.deflateSetDictionary(this.strm,n);if(r!==p){throw new Error(i[r])}this._dict_set=true}}_.prototype.push=function(e,t){var r=this.strm;var n=this.options.chunkSize;var i,o;if(this.ended){return false}o=t===~~t?t:t===true?h:l;if(typeof e==="string"){r.input=u.string2buf(e)}else if(c.call(e)==="[object ArrayBuffer]"){r.input=new Uint8Array(e)}else{r.input=e}r.next_in=0;r.avail_in=r.input.length;do{if(r.avail_out===0){r.output=new s.Buf8(n);r.next_out=0;r.avail_out=n}i=a.deflate(r,o);if(i!==f&&i!==p){this.onEnd(i);this.ended=true;return false}if(r.avail_out===0||r.avail_in===0&&(o===h||o===d)){if(this.options.to==="string"){this.onData(u.buf2binstring(s.shrinkBuf(r.output,r.next_out)))}else{this.onData(s.shrinkBuf(r.output,r.next_out))}}}while((r.avail_in>0||r.avail_out===0)&&i!==f);if(o===h){i=a.deflateEnd(this.strm);this.onEnd(i);this.ended=true;return i===p}if(o===d){this.onEnd(p);r.avail_out=0;return true}return true};_.prototype.onData=function(e){this.chunks.push(e)};_.prototype.onEnd=function(e){if(e===p){if(this.options.to==="string"){this.result=this.chunks.join("")}else{this.result=s.flattenChunks(this.chunks)}}this.chunks=[];this.err=e;this.msg=this.strm.msg};function n(e,t){var r=new _(t);r.push(e,true);if(r.err){throw r.msg||i[r.err]}return r.result}function y(e,t){t=t||{};t.raw=true;return n(e,t)}function b(e,t){t=t||{};t.gzip=true;return n(e,t)}r.Deflate=_;r.deflate=n;r.deflateRaw=y;r.gzip=b},{"./utils/common":26,"./utils/strings":27,"./zlib/deflate":31,"./zlib/messages":36,"./zlib/zstream":38}],25:[function(e,t,r){"use strict";var h=e("./zlib/inflate");var p=e("./utils/common");var f=e("./utils/strings");var d=e("./zlib/constants");var n=e("./zlib/messages");var i=e("./zlib/zstream");var o=e("./zlib/gzheader");var v=Object.prototype.toString;function a(e){if(!(this instanceof a))return new a(e);this.options=p.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;if(t.raw&&t.windowBits>=0&&t.windowBits<16){t.windowBits=-t.windowBits;if(t.windowBits===0){t.windowBits=-15}}if(t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)){t.windowBits+=32}if(t.windowBits>15&&t.windowBits<48){if((t.windowBits&15)===0){t.windowBits|=15}}this.err=0;this.msg="";this.ended=false;this.chunks=[];this.strm=new i;this.strm.avail_out=0;var r=h.inflateInit2(this.strm,t.windowBits);if(r!==d.Z_OK){throw new Error(n[r])}this.header=new o;h.inflateGetHeader(this.strm,this.header);if(t.dictionary){if(typeof t.dictionary==="string"){t.dictionary=f.string2buf(t.dictionary)}else if(v.call(t.dictionary)==="[object ArrayBuffer]"){t.dictionary=new Uint8Array(t.dictionary)}if(t.raw){r=h.inflateSetDictionary(this.strm,t.dictionary);if(r!==d.Z_OK){throw new Error(n[r])}}}}a.prototype.push=function(e,t){var r=this.strm;var n=this.options.chunkSize;var i=this.options.dictionary;var o,a;var s,u,c;var l=false;if(this.ended){return false}a=t===~~t?t:t===true?d.Z_FINISH:d.Z_NO_FLUSH;if(typeof e==="string"){r.input=f.binstring2buf(e)}else if(v.call(e)==="[object ArrayBuffer]"){r.input=new Uint8Array(e)}else{r.input=e}r.next_in=0;r.avail_in=r.input.length;do{if(r.avail_out===0){r.output=new p.Buf8(n);r.next_out=0;r.avail_out=n}o=h.inflate(r,d.Z_NO_FLUSH);if(o===d.Z_NEED_DICT&&i){o=h.inflateSetDictionary(this.strm,i)}if(o===d.Z_BUF_ERROR&&l===true){o=d.Z_OK;l=false}if(o!==d.Z_STREAM_END&&o!==d.Z_OK){this.onEnd(o);this.ended=true;return false}if(r.next_out){if(r.avail_out===0||o===d.Z_STREAM_END||r.avail_in===0&&(a===d.Z_FINISH||a===d.Z_SYNC_FLUSH)){if(this.options.to==="string"){s=f.utf8border(r.output,r.next_out);u=r.next_out-s;c=f.buf2string(r.output,s);r.next_out=u;r.avail_out=n-u;if(u){p.arraySet(r.output,r.output,s,u,0)}this.onData(c)}else{this.onData(p.shrinkBuf(r.output,r.next_out))}}}if(r.avail_in===0&&r.avail_out===0){l=true}}while((r.avail_in>0||r.avail_out===0)&&o!==d.Z_STREAM_END);if(o===d.Z_STREAM_END){a=d.Z_FINISH}if(a===d.Z_FINISH){o=h.inflateEnd(this.strm);this.onEnd(o);this.ended=true;return o===d.Z_OK}if(a===d.Z_SYNC_FLUSH){this.onEnd(d.Z_OK);r.avail_out=0;return true}return true};a.prototype.onData=function(e){this.chunks.push(e)};a.prototype.onEnd=function(e){if(e===d.Z_OK){if(this.options.to==="string"){this.result=this.chunks.join("")}else{this.result=p.flattenChunks(this.chunks)}}this.chunks=[];this.err=e;this.msg=this.strm.msg};function s(e,t){var r=new a(t);r.push(e,true);if(r.err){throw r.msg||n[r.err]}return r.result}function u(e,t){t=t||{};t.raw=true;return s(e,t)}r.Inflate=a;r.inflate=s;r.inflateRaw=u;r.ungzip=s},{"./utils/common":26,"./utils/strings":27,"./zlib/constants":29,"./zlib/gzheader":32,"./zlib/inflate":34,"./zlib/messages":36,"./zlib/zstream":38}],26:[function(e,t,r){"use strict";var n=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.assign=function(e){var t=Array.prototype.slice.call(arguments,1);while(t.length){var r=t.shift();if(!r){continue}if(typeof r!=="object"){throw new TypeError(r+"must be non-object")}for(var n in r){if(i(r,n)){e[n]=r[n]}}}return e};r.shrinkBuf=function(e,t){if(e.length===t){return e}if(e.subarray){return e.subarray(0,t)}e.length=t;return e};var o={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var o=0;o<n;o++){e[i+o]=t[r+o]}},flattenChunks:function(e){var t,r,n,i,o,a;n=0;for(t=0,r=e.length;t<r;t++){n+=e[t].length}a=new Uint8Array(n);i=0;for(t=0,r=e.length;t<r;t++){o=e[t];a.set(o,i);i+=o.length}return a}};var a={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++){e[i+o]=t[r+o]}},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){if(e){r.Buf8=Uint8Array;r.Buf16=Uint16Array;r.Buf32=Int32Array;r.assign(r,o)}else{r.Buf8=Array;r.Buf16=Array;r.Buf32=Array;r.assign(r,a)}};r.setTyped(n)},{}],27:[function(e,t,r){"use strict";var u=e("./common");var i=true;var o=true;try{String.fromCharCode.apply(null,[0])}catch(e){i=false}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=false}var c=new u.Buf8(256);for(var n=0;n<256;n++){c[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1}c[254]=c[254]=1;r.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++){r=e.charCodeAt(i);if((r&64512)===55296&&i+1<a){n=e.charCodeAt(i+1);if((n&64512)===56320){r=65536+(r-55296<<10)+(n-56320);i++}}s+=r<128?1:r<2048?2:r<65536?3:4}t=new u.Buf8(s);for(o=0,i=0;o<s;i++){r=e.charCodeAt(i);if((r&64512)===55296&&i+1<a){n=e.charCodeAt(i+1);if((n&64512)===56320){r=65536+(r-55296<<10)+(n-56320);i++}}if(r<128){t[o++]=r}else if(r<2048){t[o++]=192|r>>>6;t[o++]=128|r&63}else if(r<65536){t[o++]=224|r>>>12;t[o++]=128|r>>>6&63;t[o++]=128|r&63}else{t[o++]=240|r>>>18;t[o++]=128|r>>>12&63;t[o++]=128|r>>>6&63;t[o++]=128|r&63}}return t};function l(e,t){if(t<65534){if(e.subarray&&o||!e.subarray&&i){return String.fromCharCode.apply(null,u.shrinkBuf(e,t))}}var r="";for(var n=0;n<t;n++){r+=String.fromCharCode(e[n])}return r}r.buf2binstring=function(e){return l(e,e.length)};r.binstring2buf=function(e){var t=new u.Buf8(e.length);for(var r=0,n=t.length;r<n;r++){t[r]=e.charCodeAt(r)}return t};r.buf2string=function(e,t){var r,n,i,o;var a=t||e.length;var s=new Array(a*2);for(n=0,r=0;r<a;){i=e[r++];if(i<128){s[n++]=i;continue}o=c[i];if(o>4){s[n++]=65533;r+=o-1;continue}i&=o===2?31:o===3?15:7;while(o>1&&r<a){i=i<<6|e[r++]&63;o--}if(o>1){s[n++]=65533;continue}if(i<65536){s[n++]=i}else{i-=65536;s[n++]=55296|i>>10&1023;s[n++]=56320|i&1023}}return l(s,n)};r.utf8border=function(e,t){var r;t=t||e.length;if(t>e.length){t=e.length}r=t-1;while(r>=0&&(e[r]&192)===128){r--}if(r<0){return t}if(r===0){return t}return r+c[e[r]]>t?r:t}},{"./common":26}],28:[function(e,t,r){"use strict";function n(e,t,r,n){var i=e&65535|0,o=e>>>16&65535|0,a=0;while(r!==0){a=r>2e3?2e3:r;r-=a;do{i=i+t[n++]|0;o=o+i|0}while(--a);i%=65521;o%=65521}return i|o<<16|0}t.exports=n},{}],29:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],30:[function(e,t,r){"use strict";function n(){var e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++){e=e&1?3988292384^e>>>1:e>>>1}t[r]=e}return t}var s=n();function i(e,t,r,n){var i=s,o=n+r;e^=-1;for(var a=n;a<o;a++){e=e>>>8^i[(e^t[a])&255]}return e^-1}t.exports=i},{}],31:[function(e,t,r){"use strict";var h=e("../utils/common");var c=e("./trees");var p=e("./adler32");var l=e("./crc32");var n=e("./messages");var f=0;var d=1;var v=3;var m=4;var g=5;var _=0;var y=1;var b=-2;var i=-3;var x=-5;var u=-1;var o=1;var w=2;var S=3;var M=4;var a=0;var s=2;var C=8;var T=9;var E=15;var O=8;var P=29;var A=256;var j=A+1+P;var R=30;var k=19;var L=2*j+1;var N=15;var I=3;var D=258;var B=D+I+1;var F=32;var z=42;var $=69;var G=73;var V=91;var H=103;var U=113;var q=666;var W=1;var X=2;var Y=3;var K=4;var Z=3;function J(e,t){e.msg=n[t];return t}function Q(e){return(e<<1)-(e>4?9:0)}function ee(e){var t=e.length;while(--t>=0){e[t]=0}}function te(e){var t=e.state;var r=t.pending;if(r>e.avail_out){r=e.avail_out}if(r===0){return}h.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out);e.next_out+=r;t.pending_out+=r;e.total_out+=r;e.avail_out-=r;t.pending-=r;if(t.pending===0){t.pending_out=0}}function re(e,t){c._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t);e.block_start=e.strstart;te(e.strm)}function ne(e,t){e.pending_buf[e.pending++]=t}function ie(e,t){e.pending_buf[e.pending++]=t>>>8&255;e.pending_buf[e.pending++]=t&255}function oe(e,t,r,n){var i=e.avail_in;if(i>n){i=n}if(i===0){return 0}e.avail_in-=i;h.arraySet(t,e.input,e.next_in,i,r);if(e.state.wrap===1){e.adler=p(e.adler,t,i,r)}else if(e.state.wrap===2){e.adler=l(e.adler,t,i,r)}e.next_in+=i;e.total_in+=i;return i}function ae(e,t){var r=e.max_chain_length;var n=e.strstart;var i;var o;var a=e.prev_length;var s=e.nice_match;var u=e.strstart>e.w_size-B?e.strstart-(e.w_size-B):0;var c=e.window;var l=e.w_mask;var h=e.prev;var p=e.strstart+D;var f=c[n+a-1];var d=c[n+a];if(e.prev_length>=e.good_match){r>>=2}if(s>e.lookahead){s=e.lookahead}do{i=t;if(c[i+a]!==d||c[i+a-1]!==f||c[i]!==c[n]||c[++i]!==c[n+1]){continue}n+=2;i++;do{}while(c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&n<p);o=D-(p-n);n=p-D;if(o>a){e.match_start=t;a=o;if(o>=s){break}f=c[n+a-1];d=c[n+a]}}while((t=h[t&l])>u&&--r!==0);if(a<=e.lookahead){return a}return e.lookahead}function se(e){var t=e.w_size;var r,n,i,o,a;do{o=e.window_size-e.lookahead-e.strstart;if(e.strstart>=t+(t-B)){h.arraySet(e.window,e.window,t,t,0);e.match_start-=t;e.strstart-=t;e.block_start-=t;n=e.hash_size;r=n;do{i=e.head[--r];e.head[r]=i>=t?i-t:0}while(--n);n=t;r=n;do{i=e.prev[--r];e.prev[r]=i>=t?i-t:0}while(--n);o+=t}if(e.strm.avail_in===0){break}n=oe(e.strm,e.window,e.strstart+e.lookahead,o);e.lookahead+=n;if(e.lookahead+e.insert>=I){a=e.strstart-e.insert;e.ins_h=e.window[a];e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;while(e.insert){e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+I-1])&e.hash_mask;e.prev[a&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=a;a++;e.insert--;if(e.lookahead+e.insert<I){break}}}}while(e.lookahead<B&&e.strm.avail_in!==0)}function ue(e,t){var r=65535;if(r>e.pending_buf_size-5){r=e.pending_buf_size-5}for(;;){if(e.lookahead<=1){se(e);if(e.lookahead===0&&t===f){return W}if(e.lookahead===0){break}}e.strstart+=e.lookahead;e.lookahead=0;var n=e.block_start+r;if(e.strstart===0||e.strstart>=n){e.lookahead=e.strstart-n;e.strstart=n;re(e,false);if(e.strm.avail_out===0){return W}}if(e.strstart-e.block_start>=e.w_size-B){re(e,false);if(e.strm.avail_out===0){return W}}}e.insert=0;if(t===m){re(e,true);if(e.strm.avail_out===0){return Y}return K}if(e.strstart>e.block_start){re(e,false);if(e.strm.avail_out===0){return W}}return W}function ce(e,t){var r;var n;for(;;){if(e.lookahead<B){se(e);if(e.lookahead<B&&t===f){return W}if(e.lookahead===0){break}}r=0;if(e.lookahead>=I){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+I-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}if(r!==0&&e.strstart-r<=e.w_size-B){e.match_length=ae(e,r)}if(e.match_length>=I){n=c._tr_tally(e,e.strstart-e.match_start,e.match_length-I);e.lookahead-=e.match_length;if(e.match_length<=e.max_lazy_match&&e.lookahead>=I){e.match_length--;do{e.strstart++;e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+I-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}while(--e.match_length!==0);e.strstart++}else{e.strstart+=e.match_length;e.match_length=0;e.ins_h=e.window[e.strstart];e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask}}else{n=c._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++}if(n){re(e,false);if(e.strm.avail_out===0){return W}}}e.insert=e.strstart<I-1?e.strstart:I-1;if(t===m){re(e,true);if(e.strm.avail_out===0){return Y}return K}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return W}}return X}function le(e,t){var r;var n;var i;for(;;){if(e.lookahead<B){se(e);if(e.lookahead<B&&t===f){return W}if(e.lookahead===0){break}}r=0;if(e.lookahead>=I){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+I-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}e.prev_length=e.match_length;e.prev_match=e.match_start;e.match_length=I-1;if(r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-B){e.match_length=ae(e,r);if(e.match_length<=5&&(e.strategy===o||e.match_length===I&&e.strstart-e.match_start>4096)){e.match_length=I-1}}if(e.prev_length>=I&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-I;n=c._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-I);e.lookahead-=e.prev_length-1;e.prev_length-=2;do{if(++e.strstart<=i){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+I-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}}while(--e.prev_length!==0);e.match_available=0;e.match_length=I-1;e.strstart++;if(n){re(e,false);if(e.strm.avail_out===0){return W}}}else if(e.match_available){n=c._tr_tally(e,0,e.window[e.strstart-1]);if(n){re(e,false)}e.strstart++;e.lookahead--;if(e.strm.avail_out===0){return W}}else{e.match_available=1;e.strstart++;e.lookahead--}}if(e.match_available){n=c._tr_tally(e,0,e.window[e.strstart-1]);e.match_available=0}e.insert=e.strstart<I-1?e.strstart:I-1;if(t===m){re(e,true);if(e.strm.avail_out===0){return Y}return K}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return W}}return X}function he(e,t){var r;var n;var i,o;var a=e.window;for(;;){if(e.lookahead<=D){se(e);if(e.lookahead<=D&&t===f){return W}if(e.lookahead===0){break}}e.match_length=0;if(e.lookahead>=I&&e.strstart>0){i=e.strstart-1;n=a[i];if(n===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+D;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=D-(o-i);if(e.match_length>e.lookahead){e.match_length=e.lookahead}}}if(e.match_length>=I){r=c._tr_tally(e,1,e.match_length-I);e.lookahead-=e.match_length;e.strstart+=e.match_length;e.match_length=0}else{r=c._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++}if(r){re(e,false);if(e.strm.avail_out===0){return W}}}e.insert=0;if(t===m){re(e,true);if(e.strm.avail_out===0){return Y}return K}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return W}}return X}function pe(e,t){var r;for(;;){if(e.lookahead===0){se(e);if(e.lookahead===0){if(t===f){return W}break}}e.match_length=0;r=c._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++;if(r){re(e,false);if(e.strm.avail_out===0){return W}}}e.insert=0;if(t===m){re(e,true);if(e.strm.avail_out===0){return Y}return K}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return W}}return X}function fe(e,t,r,n,i){this.good_length=e;this.max_lazy=t;this.nice_length=r;this.max_chain=n;this.func=i}var de;de=[new fe(0,0,0,0,ue),new fe(4,4,8,4,ce),new fe(4,5,16,8,ce),new fe(4,6,32,32,ce),new fe(4,4,16,16,le),new fe(8,16,32,32,le),new fe(8,16,128,128,le),new fe(8,32,128,256,le),new fe(32,128,258,1024,le),new fe(32,258,258,4096,le)];function ve(e){e.window_size=2*e.w_size;ee(e.head);e.max_lazy_match=de[e.level].max_lazy;e.good_match=de[e.level].good_length;e.nice_match=de[e.level].nice_length;e.max_chain_length=de[e.level].max_chain;e.strstart=0;e.block_start=0;e.lookahead=0;e.insert=0;e.match_length=e.prev_length=I-1;e.match_available=0;e.ins_h=0}function me(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=C;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new h.Buf16(L*2);this.dyn_dtree=new h.Buf16((2*R+1)*2);this.bl_tree=new h.Buf16((2*k+1)*2);ee(this.dyn_ltree);ee(this.dyn_dtree);ee(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new h.Buf16(N+1);this.heap=new h.Buf16(2*j+1);ee(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new h.Buf16(2*j+1);ee(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function ge(e){var t;if(!e||!e.state){return J(e,b)}e.total_in=e.total_out=0;e.data_type=s;t=e.state;t.pending=0;t.pending_out=0;if(t.wrap<0){t.wrap=-t.wrap}t.status=t.wrap?z:U;e.adler=t.wrap===2?0:1;t.last_flush=f;c._tr_init(t);return _}function _e(e){var t=ge(e);if(t===_){ve(e.state)}return t}function ye(e,t){if(!e||!e.state){return b}if(e.state.wrap!==2){return b}e.state.gzhead=t;return _}function be(e,t,r,n,i,o){if(!e){return b}var a=1;if(t===u){t=6}if(n<0){a=0;n=-n}else if(n>15){a=2;n-=16}if(i<1||i>T||r!==C||n<8||n>15||t<0||t>9||o<0||o>M){return J(e,b)}if(n===8){n=9}var s=new me;e.state=s;s.strm=e;s.wrap=a;s.gzhead=null;s.w_bits=n;s.w_size=1<<s.w_bits;s.w_mask=s.w_size-1;s.hash_bits=i+7;s.hash_size=1<<s.hash_bits;s.hash_mask=s.hash_size-1;s.hash_shift=~~((s.hash_bits+I-1)/I);s.window=new h.Buf8(s.w_size*2);s.head=new h.Buf16(s.hash_size);s.prev=new h.Buf16(s.w_size);s.lit_bufsize=1<<i+6;s.pending_buf_size=s.lit_bufsize*4;s.pending_buf=new h.Buf8(s.pending_buf_size);s.d_buf=1*s.lit_bufsize;s.l_buf=(1+2)*s.lit_bufsize;s.level=t;s.strategy=o;s.method=r;return _e(e)}function xe(e,t){return be(e,t,C,E,O,a)}function we(e,t){var r,n;var i,o;if(!e||!e.state||t>g||t<0){return e?J(e,b):b}n=e.state;if(!e.output||!e.input&&e.avail_in!==0||n.status===q&&t!==m){return J(e,e.avail_out===0?x:b)}n.strm=e;r=n.last_flush;n.last_flush=t;if(n.status===z){if(n.wrap===2){e.adler=0;ne(n,31);ne(n,139);ne(n,8);if(!n.gzhead){ne(n,0);ne(n,0);ne(n,0);ne(n,0);ne(n,0);ne(n,n.level===9?2:n.strategy>=w||n.level<2?4:0);ne(n,Z);n.status=U}else{ne(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(!n.gzhead.extra?0:4)+(!n.gzhead.name?0:8)+(!n.gzhead.comment?0:16));ne(n,n.gzhead.time&255);ne(n,n.gzhead.time>>8&255);ne(n,n.gzhead.time>>16&255);ne(n,n.gzhead.time>>24&255);ne(n,n.level===9?2:n.strategy>=w||n.level<2?4:0);ne(n,n.gzhead.os&255);if(n.gzhead.extra&&n.gzhead.extra.length){ne(n,n.gzhead.extra.length&255);ne(n,n.gzhead.extra.length>>8&255)}if(n.gzhead.hcrc){e.adler=l(e.adler,n.pending_buf,n.pending,0)}n.gzindex=0;n.status=$}}else{var a=C+(n.w_bits-8<<4)<<8;var s=-1;if(n.strategy>=w||n.level<2){s=0}else if(n.level<6){s=1}else if(n.level===6){s=2}else{s=3}a|=s<<6;if(n.strstart!==0){a|=F}a+=31-a%31;n.status=U;ie(n,a);if(n.strstart!==0){ie(n,e.adler>>>16);ie(n,e.adler&65535)}e.adler=1}}if(n.status===$){if(n.gzhead.extra){i=n.pending;while(n.gzindex<(n.gzhead.extra.length&65535)){if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i){e.adler=l(e.adler,n.pending_buf,n.pending-i,i)}te(e);i=n.pending;if(n.pending===n.pending_buf_size){break}}ne(n,n.gzhead.extra[n.gzindex]&255);n.gzindex++}if(n.gzhead.hcrc&&n.pending>i){e.adler=l(e.adler,n.pending_buf,n.pending-i,i)}if(n.gzindex===n.gzhead.extra.length){n.gzindex=0;n.status=G}}else{n.status=G}}if(n.status===G){if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i){e.adler=l(e.adler,n.pending_buf,n.pending-i,i)}te(e);i=n.pending;if(n.pending===n.pending_buf_size){o=1;break}}if(n.gzindex<n.gzhead.name.length){o=n.gzhead.name.charCodeAt(n.gzindex++)&255}else{o=0}ne(n,o)}while(o!==0);if(n.gzhead.hcrc&&n.pending>i){e.adler=l(e.adler,n.pending_buf,n.pending-i,i)}if(o===0){n.gzindex=0;n.status=V}}else{n.status=V}}if(n.status===V){if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i){e.adler=l(e.adler,n.pending_buf,n.pending-i,i)}te(e);i=n.pending;if(n.pending===n.pending_buf_size){o=1;break}}if(n.gzindex<n.gzhead.comment.length){o=n.gzhead.comment.charCodeAt(n.gzindex++)&255}else{o=0}ne(n,o)}while(o!==0);if(n.gzhead.hcrc&&n.pending>i){e.adler=l(e.adler,n.pending_buf,n.pending-i,i)}if(o===0){n.status=H}}else{n.status=H}}if(n.status===H){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size){te(e)}if(n.pending+2<=n.pending_buf_size){ne(n,e.adler&255);ne(n,e.adler>>8&255);e.adler=0;n.status=U}}else{n.status=U}}if(n.pending!==0){te(e);if(e.avail_out===0){n.last_flush=-1;return _}}else if(e.avail_in===0&&Q(t)<=Q(r)&&t!==m){return J(e,x)}if(n.status===q&&e.avail_in!==0){return J(e,x)}if(e.avail_in!==0||n.lookahead!==0||t!==f&&n.status!==q){var u=n.strategy===w?pe(n,t):n.strategy===S?he(n,t):de[n.level].func(n,t);if(u===Y||u===K){n.status=q}if(u===W||u===Y){if(e.avail_out===0){n.last_flush=-1}return _}if(u===X){if(t===d){c._tr_align(n)}else if(t!==g){c._tr_stored_block(n,0,0,false);if(t===v){ee(n.head);if(n.lookahead===0){n.strstart=0;n.block_start=0;n.insert=0}}}te(e);if(e.avail_out===0){n.last_flush=-1;return _}}}if(t!==m){return _}if(n.wrap<=0){return y}if(n.wrap===2){ne(n,e.adler&255);ne(n,e.adler>>8&255);ne(n,e.adler>>16&255);ne(n,e.adler>>24&255);ne(n,e.total_in&255);ne(n,e.total_in>>8&255);ne(n,e.total_in>>16&255);ne(n,e.total_in>>24&255)}else{ie(n,e.adler>>>16);ie(n,e.adler&65535)}te(e);if(n.wrap>0){n.wrap=-n.wrap}return n.pending!==0?_:y}function Se(e){var t;if(!e||!e.state){return b}t=e.state.status;if(t!==z&&t!==$&&t!==G&&t!==V&&t!==H&&t!==U&&t!==q){return J(e,b)}e.state=null;return t===U?J(e,i):_}function Me(e,t){var r=t.length;var n;var i,o;var a;var s;var u;var c;var l;if(!e||!e.state){return b}n=e.state;a=n.wrap;if(a===2||a===1&&n.status!==z||n.lookahead){return b}if(a===1){e.adler=p(e.adler,t,r,0)}n.wrap=0;if(r>=n.w_size){if(a===0){ee(n.head);n.strstart=0;n.block_start=0;n.insert=0}l=new h.Buf8(n.w_size);h.arraySet(l,t,r-n.w_size,n.w_size,0);t=l;r=n.w_size}s=e.avail_in;u=e.next_in;c=e.input;e.avail_in=r;e.next_in=0;e.input=t;se(n);while(n.lookahead>=I){i=n.strstart;o=n.lookahead-(I-1);do{n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+I-1])&n.hash_mask;n.prev[i&n.w_mask]=n.head[n.ins_h];n.head[n.ins_h]=i;i++}while(--o);n.strstart=i;n.lookahead=I-1;se(n)}n.strstart+=n.lookahead;n.block_start=n.strstart;n.insert=n.lookahead;n.lookahead=0;n.match_length=n.prev_length=I-1;n.match_available=0;e.next_in=u;e.input=c;e.avail_in=s;n.wrap=a;return _}r.deflateInit=xe;r.deflateInit2=be;r.deflateReset=_e;r.deflateResetKeep=ge;r.deflateSetHeader=ye;r.deflate=we;r.deflateEnd=Se;r.deflateSetDictionary=Me;r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":26,"./adler32":28,"./crc32":30,"./messages":36,"./trees":37}],32:[function(e,t,r){"use strict";function n(){this.text=0;this.time=0;this.xflags=0;this.os=0;this.extra=null;this.extra_len=0;this.name="";this.comment="";this.hcrc=0;this.done=false}t.exports=n},{}],33:[function(e,t,r){"use strict";var O=30;var P=12;t.exports=function e(t,r){var n;var i;var o;var a;var s;var u;var c;var l;var h;var p;var f;var d;var v;var m;var g;var _;var y;var b;var x;var w;var S;var M;var C;var T,E;n=t.state;i=t.next_in;T=t.input;o=i+(t.avail_in-5);a=t.next_out;E=t.output;s=a-(r-t.avail_out);u=a+(t.avail_out-257);c=n.dmax;l=n.wsize;h=n.whave;p=n.wnext;f=n.window;d=n.hold;v=n.bits;m=n.lencode;g=n.distcode;_=(1<<n.lenbits)-1;y=(1<<n.distbits)-1;e:do{if(v<15){d+=T[i++]<<v;v+=8;d+=T[i++]<<v;v+=8}b=m[d&_];t:for(;;){x=b>>>24;d>>>=x;v-=x;x=b>>>16&255;if(x===0){E[a++]=b&65535}else if(x&16){w=b&65535;x&=15;if(x){if(v<x){d+=T[i++]<<v;v+=8}w+=d&(1<<x)-1;d>>>=x;v-=x}if(v<15){d+=T[i++]<<v;v+=8;d+=T[i++]<<v;v+=8}b=g[d&y];r:for(;;){x=b>>>24;d>>>=x;v-=x;x=b>>>16&255;if(x&16){S=b&65535;x&=15;if(v<x){d+=T[i++]<<v;v+=8;if(v<x){d+=T[i++]<<v;v+=8}}S+=d&(1<<x)-1;if(S>c){t.msg="invalid distance too far back";n.mode=O;break e}d>>>=x;v-=x;x=a-s;if(S>x){x=S-x;if(x>h){if(n.sane){t.msg="invalid distance too far back";n.mode=O;break e}}M=0;C=f;if(p===0){M+=l-x;if(x<w){w-=x;do{E[a++]=f[M++]}while(--x);M=a-S;C=E}}else if(p<x){M+=l+p-x;x-=p;if(x<w){w-=x;do{E[a++]=f[M++]}while(--x);M=0;if(p<w){x=p;w-=x;do{E[a++]=f[M++]}while(--x);M=a-S;C=E}}}else{M+=p-x;if(x<w){w-=x;do{E[a++]=f[M++]}while(--x);M=a-S;C=E}}while(w>2){E[a++]=C[M++];E[a++]=C[M++];E[a++]=C[M++];w-=3}if(w){E[a++]=C[M++];if(w>1){E[a++]=C[M++]}}}else{M=a-S;do{E[a++]=E[M++];E[a++]=E[M++];E[a++]=E[M++];w-=3}while(w>2);if(w){E[a++]=E[M++];if(w>1){E[a++]=E[M++]}}}}else if((x&64)===0){b=g[(b&65535)+(d&(1<<x)-1)];continue r}else{t.msg="invalid distance code";n.mode=O;break e}break}}else if((x&64)===0){b=m[(b&65535)+(d&(1<<x)-1)];continue t}else if(x&32){n.mode=P;break e}else{t.msg="invalid literal/length code";n.mode=O;break e}break}}while(i<o&&a<u);w=v>>3;i-=w;v-=w<<3;d&=(1<<v)-1;t.next_in=i;t.next_out=a;t.avail_in=i<o?5+(o-i):5-(i-o);t.avail_out=a<u?257+(u-a):257-(a-u);n.hold=d;n.bits=v;return}},{}],34:[function(e,t,r){"use strict";var P=e("../utils/common");var A=e("./adler32");var j=e("./crc32");var R=e("./inffast");var k=e("./inftrees");var L=0;var N=1;var I=2;var D=4;var B=5;var F=6;var z=0;var $=1;var G=2;var V=-2;var H=-3;var U=-4;var q=-5;var W=8;var X=1;var Y=2;var K=3;var Z=4;var J=5;var Q=6;var ee=7;var te=8;var re=9;var ne=10;var ie=11;var oe=12;var ae=13;var se=14;var ue=15;var ce=16;var le=17;var he=18;var pe=19;var fe=20;var de=21;var ve=22;var me=23;var ge=24;var _e=25;var ye=26;var be=27;var xe=28;var we=29;var Se=30;var Me=31;var Ce=32;var n=852;var i=592;var o=15;var a=o;function Te(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function s(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=null;this.distcode=null;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=null;this.lens=new P.Buf16(320);this.work=new P.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function u(e){var t;if(!e||!e.state){return V}t=e.state;e.total_in=e.total_out=t.total=0;e.msg="";if(t.wrap){e.adler=t.wrap&1}t.mode=X;t.last=0;t.havedict=0;t.dmax=32768;t.head=null;t.hold=0;t.bits=0;t.lencode=t.lendyn=new P.Buf32(n);t.distcode=t.distdyn=new P.Buf32(i);t.sane=1;t.back=-1;return z}function c(e){var t;if(!e||!e.state){return V}t=e.state;t.wsize=0;t.whave=0;t.wnext=0;return u(e)}function l(e,t){var r;var n;if(!e||!e.state){return V}n=e.state;if(t<0){r=0;t=-t}else{r=(t>>4)+1;if(t<48){t&=15}}if(t&&(t<8||t>15)){return V}if(n.window!==null&&n.wbits!==t){n.window=null}n.wrap=r;n.wbits=t;return c(e)}function h(e,t){var r;var n;if(!e){return V}n=new s;e.state=n;n.window=null;r=l(e,t);if(r!==z){e.state=null}return r}function p(e){return h(e,a)}var f=true;var d,v;function Ee(e){if(f){var t;d=new P.Buf32(512);v=new P.Buf32(32);t=0;while(t<144){e.lens[t++]=8}while(t<256){e.lens[t++]=9}while(t<280){e.lens[t++]=7}while(t<288){e.lens[t++]=8}k(N,e.lens,0,288,d,0,e.work,{bits:9});t=0;while(t<32){e.lens[t++]=5}k(I,e.lens,0,32,v,0,e.work,{bits:5});f=false}e.lencode=d;e.lenbits=9;e.distcode=v;e.distbits=5}function Oe(e,t,r,n){var i;var o=e.state;if(o.window===null){o.wsize=1<<o.wbits;o.wnext=0;o.whave=0;o.window=new P.Buf8(o.wsize)}if(n>=o.wsize){P.arraySet(o.window,t,r-o.wsize,o.wsize,0);o.wnext=0;o.whave=o.wsize}else{i=o.wsize-o.wnext;if(i>n){i=n}P.arraySet(o.window,t,r-n,i,o.wnext);n-=i;if(n){P.arraySet(o.window,t,r-n,n,0);o.wnext=n;o.whave=o.wsize}else{o.wnext+=i;if(o.wnext===o.wsize){o.wnext=0}if(o.whave<o.wsize){o.whave+=i}}}return 0}function m(e,t){var r;var n,i;var o;var a;var s,u;var c;var l;var h,p;var f;var d;var v;var m=0;var g,_,y;var b,x,w;var S;var M;var C=new P.Buf8(4);var T;var E;var O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0){return V}r=e.state;if(r.mode===oe){r.mode=ae}a=e.next_out;i=e.output;u=e.avail_out;o=e.next_in;n=e.input;s=e.avail_in;c=r.hold;l=r.bits;h=s;p=u;M=z;e:for(;;){switch(r.mode){case X:if(r.wrap===0){r.mode=ae;break}while(l<16){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if(r.wrap&2&&c===35615){r.check=0;C[0]=c&255;C[1]=c>>>8&255;r.check=j(r.check,C,2,0);c=0;l=0;r.mode=Y;break}r.flags=0;if(r.head){r.head.done=false}if(!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check";r.mode=Se;break}if((c&15)!==W){e.msg="unknown compression method";r.mode=Se;break}c>>>=4;l-=4;S=(c&15)+8;if(r.wbits===0){r.wbits=S}else if(S>r.wbits){e.msg="invalid window size";r.mode=Se;break}r.dmax=1<<S;e.adler=r.check=1;r.mode=c&512?ne:oe;c=0;l=0;break;case Y:while(l<16){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}r.flags=c;if((r.flags&255)!==W){e.msg="unknown compression method";r.mode=Se;break}if(r.flags&57344){e.msg="unknown header flags set";r.mode=Se;break}if(r.head){r.head.text=c>>8&1}if(r.flags&512){C[0]=c&255;C[1]=c>>>8&255;r.check=j(r.check,C,2,0)}c=0;l=0;r.mode=K;case K:while(l<32){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if(r.head){r.head.time=c}if(r.flags&512){C[0]=c&255;C[1]=c>>>8&255;C[2]=c>>>16&255;C[3]=c>>>24&255;r.check=j(r.check,C,4,0)}c=0;l=0;r.mode=Z;case Z:while(l<16){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if(r.head){r.head.xflags=c&255;r.head.os=c>>8}if(r.flags&512){C[0]=c&255;C[1]=c>>>8&255;r.check=j(r.check,C,2,0)}c=0;l=0;r.mode=J;case J:if(r.flags&1024){while(l<16){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}r.length=c;if(r.head){r.head.extra_len=c}if(r.flags&512){C[0]=c&255;C[1]=c>>>8&255;r.check=j(r.check,C,2,0)}c=0;l=0}else if(r.head){r.head.extra=null}r.mode=Q;case Q:if(r.flags&1024){f=r.length;if(f>s){f=s}if(f){if(r.head){S=r.head.extra_len-r.length;if(!r.head.extra){r.head.extra=new Array(r.head.extra_len)}P.arraySet(r.head.extra,n,o,f,S)}if(r.flags&512){r.check=j(r.check,n,f,o)}s-=f;o+=f;r.length-=f}if(r.length){break e}}r.length=0;r.mode=ee;case ee:if(r.flags&2048){if(s===0){break e}f=0;do{S=n[o+f++];if(r.head&&S&&r.length<65536){r.head.name+=String.fromCharCode(S)}}while(S&&f<s);if(r.flags&512){r.check=j(r.check,n,f,o)}s-=f;o+=f;if(S){break e}}else if(r.head){r.head.name=null}r.length=0;r.mode=te;case te:if(r.flags&4096){if(s===0){break e}f=0;do{S=n[o+f++];if(r.head&&S&&r.length<65536){r.head.comment+=String.fromCharCode(S)}}while(S&&f<s);if(r.flags&512){r.check=j(r.check,n,f,o)}s-=f;o+=f;if(S){break e}}else if(r.head){r.head.comment=null}r.mode=re;case re:if(r.flags&512){while(l<16){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if(c!==(r.check&65535)){e.msg="header crc mismatch";r.mode=Se;break}c=0;l=0}if(r.head){r.head.hcrc=r.flags>>9&1;r.head.done=true}e.adler=r.check=0;r.mode=oe;break;case ne:while(l<32){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}e.adler=r.check=Te(c);c=0;l=0;r.mode=ie;case ie:if(r.havedict===0){e.next_out=a;e.avail_out=u;e.next_in=o;e.avail_in=s;r.hold=c;r.bits=l;return G}e.adler=r.check=1;r.mode=oe;case oe:if(t===B||t===F){break e}case ae:if(r.last){c>>>=l&7;l-=l&7;r.mode=be;break}while(l<3){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}r.last=c&1;c>>>=1;l-=1;switch(c&3){case 0:r.mode=se;break;case 1:Ee(r);r.mode=fe;if(t===F){c>>>=2;l-=2;break e}break;case 2:r.mode=le;break;case 3:e.msg="invalid block type";r.mode=Se}c>>>=2;l-=2;break;case se:c>>>=l&7;l-=l&7;while(l<32){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths";r.mode=Se;break}r.length=c&65535;c=0;l=0;r.mode=ue;if(t===F){break e}case ue:r.mode=ce;case ce:f=r.length;if(f){if(f>s){f=s}if(f>u){f=u}if(f===0){break e}P.arraySet(i,n,o,f,a);s-=f;o+=f;u-=f;a+=f;r.length-=f;break}r.mode=oe;break;case le:while(l<14){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}r.nlen=(c&31)+257;c>>>=5;l-=5;r.ndist=(c&31)+1;c>>>=5;l-=5;r.ncode=(c&15)+4;c>>>=4;l-=4;if(r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols";r.mode=Se;break}r.have=0;r.mode=he;case he:while(r.have<r.ncode){while(l<3){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}r.lens[O[r.have++]]=c&7;c>>>=3;l-=3}while(r.have<19){r.lens[O[r.have++]]=0}r.lencode=r.lendyn;r.lenbits=7;T={bits:r.lenbits};M=k(L,r.lens,0,19,r.lencode,0,r.work,T);r.lenbits=T.bits;if(M){e.msg="invalid code lengths set";r.mode=Se;break}r.have=0;r.mode=pe;case pe:while(r.have<r.nlen+r.ndist){for(;;){m=r.lencode[c&(1<<r.lenbits)-1];g=m>>>24;_=m>>>16&255;y=m&65535;if(g<=l){break}if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if(y<16){c>>>=g;l-=g;r.lens[r.have++]=y}else{if(y===16){E=g+2;while(l<E){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}c>>>=g;l-=g;if(r.have===0){e.msg="invalid bit length repeat";r.mode=Se;break}S=r.lens[r.have-1];f=3+(c&3);c>>>=2;l-=2}else if(y===17){E=g+3;while(l<E){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}c>>>=g;l-=g;S=0;f=3+(c&7);c>>>=3;l-=3}else{E=g+7;while(l<E){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}c>>>=g;l-=g;S=0;f=11+(c&127);c>>>=7;l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat";r.mode=Se;break}while(f--){r.lens[r.have++]=S}}}if(r.mode===Se){break}if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block";r.mode=Se;break}r.lenbits=9;T={bits:r.lenbits};M=k(N,r.lens,0,r.nlen,r.lencode,0,r.work,T);r.lenbits=T.bits;if(M){e.msg="invalid literal/lengths set";r.mode=Se;break}r.distbits=6;r.distcode=r.distdyn;T={bits:r.distbits};M=k(I,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T);r.distbits=T.bits;if(M){e.msg="invalid distances set";r.mode=Se;break}r.mode=fe;if(t===F){break e}case fe:r.mode=de;case de:if(s>=6&&u>=258){e.next_out=a;e.avail_out=u;e.next_in=o;e.avail_in=s;r.hold=c;r.bits=l;R(e,p);a=e.next_out;i=e.output;u=e.avail_out;o=e.next_in;n=e.input;s=e.avail_in;c=r.hold;l=r.bits;if(r.mode===oe){r.back=-1}break}r.back=0;for(;;){m=r.lencode[c&(1<<r.lenbits)-1];g=m>>>24;_=m>>>16&255;y=m&65535;if(g<=l){break}if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if(_&&(_&240)===0){b=g;x=_;w=y;for(;;){m=r.lencode[w+((c&(1<<b+x)-1)>>b)];g=m>>>24;_=m>>>16&255;y=m&65535;if(b+g<=l){break}if(s===0){break e}s--;c+=n[o++]<<l;l+=8}c>>>=b;l-=b;r.back+=b}c>>>=g;l-=g;r.back+=g;r.length=y;if(_===0){r.mode=ye;break}if(_&32){r.back=-1;r.mode=oe;break}if(_&64){e.msg="invalid literal/length code";r.mode=Se;break}r.extra=_&15;r.mode=ve;case ve:if(r.extra){E=r.extra;while(l<E){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}r.length+=c&(1<<r.extra)-1;c>>>=r.extra;l-=r.extra;r.back+=r.extra}r.was=r.length;r.mode=me;case me:for(;;){m=r.distcode[c&(1<<r.distbits)-1];g=m>>>24;_=m>>>16&255;y=m&65535;if(g<=l){break}if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if((_&240)===0){b=g;x=_;w=y;for(;;){m=r.distcode[w+((c&(1<<b+x)-1)>>b)];g=m>>>24;_=m>>>16&255;y=m&65535;if(b+g<=l){break}if(s===0){break e}s--;c+=n[o++]<<l;l+=8}c>>>=b;l-=b;r.back+=b}c>>>=g;l-=g;r.back+=g;if(_&64){e.msg="invalid distance code";r.mode=Se;break}r.offset=y;r.extra=_&15;r.mode=ge;case ge:if(r.extra){E=r.extra;while(l<E){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}r.offset+=c&(1<<r.extra)-1;c>>>=r.extra;l-=r.extra;r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back";r.mode=Se;break}r.mode=_e;case _e:if(u===0){break e}f=p-u;if(r.offset>f){f=r.offset-f;if(f>r.whave){if(r.sane){e.msg="invalid distance too far back";r.mode=Se;break}}if(f>r.wnext){f-=r.wnext;d=r.wsize-f}else{d=r.wnext-f}if(f>r.length){f=r.length}v=r.window}else{v=i;d=a-r.offset;f=r.length}if(f>u){f=u}u-=f;r.length-=f;do{i[a++]=v[d++]}while(--f);if(r.length===0){r.mode=de}break;case ye:if(u===0){break e}i[a++]=r.length;u--;r.mode=de;break;case be:if(r.wrap){while(l<32){if(s===0){break e}s--;c|=n[o++]<<l;l+=8}p-=u;e.total_out+=p;r.total+=p;if(p){e.adler=r.check=r.flags?j(r.check,i,p,a-p):A(r.check,i,p,a-p)}p=u;if((r.flags?c:Te(c))!==r.check){e.msg="incorrect data check";r.mode=Se;break}c=0;l=0}r.mode=xe;case xe:if(r.wrap&&r.flags){while(l<32){if(s===0){break e}s--;c+=n[o++]<<l;l+=8}if(c!==(r.total&4294967295)){e.msg="incorrect length check";r.mode=Se;break}c=0;l=0}r.mode=we;case we:M=$;break e;case Se:M=H;break e;case Me:return U;case Ce:default:return V}}e.next_out=a;e.avail_out=u;e.next_in=o;e.avail_in=s;r.hold=c;r.bits=l;if(r.wsize||p!==e.avail_out&&r.mode<Se&&(r.mode<be||t!==D)){if(Oe(e,e.output,e.next_out,p-e.avail_out)){r.mode=Me;return U}}h-=e.avail_in;p-=e.avail_out;e.total_in+=h;e.total_out+=p;r.total+=p;if(r.wrap&&p){e.adler=r.check=r.flags?j(r.check,i,p,e.next_out-p):A(r.check,i,p,e.next_out-p)}e.data_type=r.bits+(r.last?64:0)+(r.mode===oe?128:0)+(r.mode===fe||r.mode===ue?256:0);if((h===0&&p===0||t===D)&&M===z){M=q}return M}function g(e){if(!e||!e.state){return V}var t=e.state;if(t.window){t.window=null}e.state=null;return z}function _(e,t){var r;if(!e||!e.state){return V}r=e.state;if((r.wrap&2)===0){return V}r.head=t;t.done=false;return z}function y(e,t){var r=t.length;var n;var i;var o;if(!e||!e.state){return V}n=e.state;if(n.wrap!==0&&n.mode!==ie){return V}if(n.mode===ie){i=1;i=A(i,t,r,0);if(i!==n.check){return H}}o=Oe(e,t,r,r);if(o){n.mode=Me;return U}n.havedict=1;return z}r.inflateReset=c;r.inflateReset2=l;r.inflateResetKeep=u;r.inflateInit=p;r.inflateInit2=h;r.inflate=m;r.inflateEnd=g;r.inflateGetHeader=_;r.inflateSetDictionary=y;r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":26,"./adler32":28,"./crc32":30,"./inffast":33,"./inftrees":35}],35:[function(e,t,r){"use strict";var N=e("../utils/common");var I=15;var D=852;var B=592;var F=0;var z=1;var $=2;var G=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var V=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78];var H=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var U=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function e(t,r,n,i,o,a,s,u){var c=u.bits;var l=0;var h=0;var p=0,f=0;var d=0;var v=0;var m=0;var g=0;var _=0;var y=0;var b;var x;var w;var S;var M;var C=null;var T=0;var E;var O=new N.Buf16(I+1);var P=new N.Buf16(I+1);var A=null;var j=0;var R,k,L;for(l=0;l<=I;l++){O[l]=0}for(h=0;h<i;h++){O[r[n+h]]++}d=c;for(f=I;f>=1;f--){if(O[f]!==0){break}}if(d>f){d=f}if(f===0){o[a++]=1<<24|64<<16|0;o[a++]=1<<24|64<<16|0;u.bits=1;return 0}for(p=1;p<f;p++){if(O[p]!==0){break}}if(d<p){d=p}g=1;for(l=1;l<=I;l++){g<<=1;g-=O[l];if(g<0){return-1}}if(g>0&&(t===F||f!==1)){return-1}P[1]=0;for(l=1;l<I;l++){P[l+1]=P[l]+O[l]}for(h=0;h<i;h++){if(r[n+h]!==0){s[P[r[n+h]]++]=h}}if(t===F){C=A=s;E=19}else if(t===z){C=G;T-=257;A=V;j-=257;E=256}else{C=H;A=U;E=-1}y=0;h=0;l=p;M=a;v=d;m=0;w=-1;_=1<<d;S=_-1;if(t===z&&_>D||t===$&&_>B){return 1}for(;;){R=l-m;if(s[h]<E){k=0;L=s[h]}else if(s[h]>E){k=A[j+s[h]];L=C[T+s[h]]}else{k=32+64;L=0}b=1<<l-m;x=1<<v;p=x;do{x-=b;o[M+(y>>m)+x]=R<<24|k<<16|L|0}while(x!==0);b=1<<l-1;while(y&b){b>>=1}if(b!==0){y&=b-1;y+=b}else{y=0}h++;if(--O[l]===0){if(l===f){break}l=r[n+s[h]]}if(l>d&&(y&S)!==w){if(m===0){m=d}M+=p;v=l-m;g=1<<v;while(v+m<f){g-=O[v+m];if(g<=0){break}v++;g<<=1}_+=1<<v;if(t===z&&_>D||t===$&&_>B){return 1}w=y&S;o[w]=d<<24|v<<16|M-a|0}}if(y!==0){o[M+y]=l-m<<24|64<<16|0}u.bits=d;return 0}},{"../utils/common":26}],36:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],37:[function(e,t,r){"use strict";var i=e("../utils/common");var s=4;var n=0;var o=1;var u=2;function a(e){var t=e.length;while(--t>=0){e[t]=0}}var c=0;var l=1;var h=2;var p=3;var f=258;var d=29;var v=256;var m=v+1+d;var g=30;var _=19;var y=2*m+1;var b=15;var x=16;var w=7;var S=256;var M=16;var C=17;var T=18;var E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var O=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var j=512;var R=new Array((m+2)*2);a(R);var k=new Array(g*2);a(k);var L=new Array(j);a(L);var N=new Array(f-p+1);a(N);var I=new Array(d);a(I);var D=new Array(g);a(D);function B(e,t,r,n,i){this.static_tree=e;this.extra_bits=t;this.extra_base=r;this.elems=n;this.max_length=i;this.has_stree=e&&e.length}var F;var z;var $;function G(e,t){this.dyn_tree=e;this.max_code=0;this.stat_desc=t}function V(e){return e<256?L[e]:L[256+(e>>>7)]}function H(e,t){e.pending_buf[e.pending++]=t&255;e.pending_buf[e.pending++]=t>>>8&255}function U(e,t,r){if(e.bi_valid>x-r){e.bi_buf|=t<<e.bi_valid&65535;H(e,e.bi_buf);e.bi_buf=t>>x-e.bi_valid;e.bi_valid+=r-x}else{e.bi_buf|=t<<e.bi_valid&65535;e.bi_valid+=r}}function q(e,t,r){U(e,r[t*2],r[t*2+1])}function W(e,t){var r=0;do{r|=e&1;e>>>=1;r<<=1}while(--t>0);return r>>>1}function X(e){if(e.bi_valid===16){H(e,e.bi_buf);e.bi_buf=0;e.bi_valid=0}else if(e.bi_valid>=8){e.pending_buf[e.pending++]=e.bi_buf&255;e.bi_buf>>=8;e.bi_valid-=8}}function Y(e,t){var r=t.dyn_tree;var n=t.max_code;var i=t.stat_desc.static_tree;var o=t.stat_desc.has_stree;var a=t.stat_desc.extra_bits;var s=t.stat_desc.extra_base;var u=t.stat_desc.max_length;var c;var l,h;var p;var f;var d;var v=0;for(p=0;p<=b;p++){e.bl_count[p]=0}r[e.heap[e.heap_max]*2+1]=0;for(c=e.heap_max+1;c<y;c++){l=e.heap[c];p=r[r[l*2+1]*2+1]+1;if(p>u){p=u;v++}r[l*2+1]=p;if(l>n){continue}e.bl_count[p]++;f=0;if(l>=s){f=a[l-s]}d=r[l*2];e.opt_len+=d*(p+f);if(o){e.static_len+=d*(i[l*2+1]+f)}}if(v===0){return}do{p=u-1;while(e.bl_count[p]===0){p--}e.bl_count[p]--;e.bl_count[p+1]+=2;e.bl_count[u]--;v-=2}while(v>0);for(p=u;p!==0;p--){l=e.bl_count[p];while(l!==0){h=e.heap[--c];if(h>n){continue}if(r[h*2+1]!==p){e.opt_len+=(p-r[h*2+1])*r[h*2];r[h*2+1]=p}l--}}}function K(e,t,r){var n=new Array(b+1);var i=0;var o;var a;for(o=1;o<=b;o++){n[o]=i=i+r[o-1]<<1}for(a=0;a<=t;a++){var s=e[a*2+1];if(s===0){continue}e[a*2]=W(n[s]++,s)}}function Z(){var e;var t;var r;var n;var i;var o=new Array(b+1);r=0;for(n=0;n<d-1;n++){I[n]=r;for(e=0;e<1<<E[n];e++){N[r++]=n}}N[r-1]=n;i=0;for(n=0;n<16;n++){D[n]=i;for(e=0;e<1<<O[n];e++){L[i++]=n}}i>>=7;for(;n<g;n++){D[n]=i<<7;for(e=0;e<1<<O[n]-7;e++){L[256+i++]=n}}for(t=0;t<=b;t++){o[t]=0}e=0;while(e<=143){R[e*2+1]=8;e++;o[8]++}while(e<=255){R[e*2+1]=9;e++;o[9]++}while(e<=279){R[e*2+1]=7;e++;o[7]++}while(e<=287){R[e*2+1]=8;e++;o[8]++}K(R,m+1,o);for(e=0;e<g;e++){k[e*2+1]=5;k[e*2]=W(e,5)}F=new B(R,E,v+1,m,b);z=new B(k,O,0,g,b);$=new B(new Array(0),P,0,_,w)}function J(e){var t;for(t=0;t<m;t++){e.dyn_ltree[t*2]=0}for(t=0;t<g;t++){e.dyn_dtree[t*2]=0}for(t=0;t<_;t++){e.bl_tree[t*2]=0}e.dyn_ltree[S*2]=1;e.opt_len=e.static_len=0;e.last_lit=e.matches=0}function Q(e){if(e.bi_valid>8){H(e,e.bi_buf)}else if(e.bi_valid>0){e.pending_buf[e.pending++]=e.bi_buf}e.bi_buf=0;e.bi_valid=0}function ee(e,t,r,n){Q(e);if(n){H(e,r);H(e,~r)}i.arraySet(e.pending_buf,e.window,t,r,e.pending);e.pending+=r}function te(e,t,r,n){var i=t*2;var o=r*2;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function re(e,t,r){var n=e.heap[r];var i=r<<1;while(i<=e.heap_len){if(i<e.heap_len&&te(t,e.heap[i+1],e.heap[i],e.depth)){i++}if(te(t,n,e.heap[i],e.depth)){break}e.heap[r]=e.heap[i];r=i;i<<=1}e.heap[r]=n}function ne(e,t,r){var n;var i;var o=0;var a;var s;if(e.last_lit!==0){do{n=e.pending_buf[e.d_buf+o*2]<<8|e.pending_buf[e.d_buf+o*2+1];i=e.pending_buf[e.l_buf+o];o++;if(n===0){q(e,i,t)}else{a=N[i];q(e,a+v+1,t);s=E[a];if(s!==0){i-=I[a];U(e,i,s)}n--;a=V(n);q(e,a,r);s=O[a];if(s!==0){n-=D[a];U(e,n,s)}}}while(o<e.last_lit)}q(e,S,t)}function ie(e,t){var r=t.dyn_tree;var n=t.stat_desc.static_tree;var i=t.stat_desc.has_stree;var o=t.stat_desc.elems;var a,s;var u=-1;var c;e.heap_len=0;e.heap_max=y;for(a=0;a<o;a++){if(r[a*2]!==0){e.heap[++e.heap_len]=u=a;e.depth[a]=0}else{r[a*2+1]=0}}while(e.heap_len<2){c=e.heap[++e.heap_len]=u<2?++u:0;r[c*2]=1;e.depth[c]=0;e.opt_len--;if(i){e.static_len-=n[c*2+1]}}t.max_code=u;for(a=e.heap_len>>1;a>=1;a--){re(e,r,a)}c=o;do{a=e.heap[1];e.heap[1]=e.heap[e.heap_len--];re(e,r,1);s=e.heap[1];e.heap[--e.heap_max]=a;e.heap[--e.heap_max]=s;r[c*2]=r[a*2]+r[s*2];e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1;r[a*2+1]=r[s*2+1]=c;e.heap[1]=c++;re(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1];Y(e,t);K(r,u,e.bl_count)}function oe(e,t,r){var n;var i=-1;var o;var a=t[0*2+1];var s=0;var u=7;var c=4;if(a===0){u=138;c=3}t[(r+1)*2+1]=65535;for(n=0;n<=r;n++){o=a;a=t[(n+1)*2+1];if(++s<u&&o===a){continue}else if(s<c){e.bl_tree[o*2]+=s}else if(o!==0){if(o!==i){e.bl_tree[o*2]++}e.bl_tree[M*2]++}else if(s<=10){e.bl_tree[C*2]++}else{e.bl_tree[T*2]++}s=0;i=o;if(a===0){u=138;c=3}else if(o===a){u=6;c=3}else{u=7;c=4}}}function ae(e,t,r){var n;var i=-1;var o;var a=t[0*2+1];var s=0;var u=7;var c=4;if(a===0){u=138;c=3}for(n=0;n<=r;n++){o=a;a=t[(n+1)*2+1];if(++s<u&&o===a){continue}else if(s<c){do{q(e,o,e.bl_tree)}while(--s!==0)}else if(o!==0){if(o!==i){q(e,o,e.bl_tree);s--}q(e,M,e.bl_tree);U(e,s-3,2)}else if(s<=10){q(e,C,e.bl_tree);U(e,s-3,3)}else{q(e,T,e.bl_tree);U(e,s-11,7)}s=0;i=o;if(a===0){u=138;c=3}else if(o===a){u=6;c=3}else{u=7;c=4}}}function se(e){var t;oe(e,e.dyn_ltree,e.l_desc.max_code);oe(e,e.dyn_dtree,e.d_desc.max_code);ie(e,e.bl_desc);for(t=_-1;t>=3;t--){if(e.bl_tree[A[t]*2+1]!==0){break}}e.opt_len+=3*(t+1)+5+5+4;return t}function ue(e,t,r,n){var i;U(e,t-257,5);U(e,r-1,5);U(e,n-4,4);for(i=0;i<n;i++){U(e,e.bl_tree[A[i]*2+1],3)}ae(e,e.dyn_ltree,t-1);ae(e,e.dyn_dtree,r-1)}function ce(e){var t=4093624447;var r;for(r=0;r<=31;r++,t>>>=1){if(t&1&&e.dyn_ltree[r*2]!==0){return n}}if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0){return o}for(r=32;r<v;r++){if(e.dyn_ltree[r*2]!==0){return o}}return n}var le=false;function he(e){if(!le){Z();le=true}e.l_desc=new G(e.dyn_ltree,F);e.d_desc=new G(e.dyn_dtree,z);e.bl_desc=new G(e.bl_tree,$);e.bi_buf=0;e.bi_valid=0;J(e)}function pe(e,t,r,n){U(e,(c<<1)+(n?1:0),3);ee(e,t,r,true)}function fe(e){U(e,l<<1,3);q(e,S,R);X(e)}function de(e,t,r,n){var i,o;var a=0;if(e.level>0){if(e.strm.data_type===u){e.strm.data_type=ce(e)}ie(e,e.l_desc);ie(e,e.d_desc);a=se(e);i=e.opt_len+3+7>>>3;o=e.static_len+3+7>>>3;if(o<=i){i=o}}else{i=o=r+5}if(r+4<=i&&t!==-1){pe(e,t,r,n)}else if(e.strategy===s||o===i){U(e,(l<<1)+(n?1:0),3);ne(e,R,k)}else{U(e,(h<<1)+(n?1:0),3);ue(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1);ne(e,e.dyn_ltree,e.dyn_dtree)}J(e);if(n){Q(e)}}function ve(e,t,r){e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255;e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255;e.pending_buf[e.l_buf+e.last_lit]=r&255;e.last_lit++;if(t===0){e.dyn_ltree[r*2]++}else{e.matches++;t--;e.dyn_ltree[(N[r]+v+1)*2]++;e.dyn_dtree[V(t)*2]++}return e.last_lit===e.lit_bufsize-1}r._tr_init=he;r._tr_stored_block=pe;r._tr_flush_block=de;r._tr_tally=ve;r._tr_align=fe},{"../utils/common":26}],38:[function(e,t,r){"use strict";function n(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}t.exports=n},{}],39:[function(e,t,c){(function(i){function o(e,t){var r=0;for(var n=e.length-1;n>=0;n--){var i=e[n];if(i==="."){e.splice(n,1)}else if(i===".."){e.splice(n,1);r++}else if(r){e.splice(n,1);r--}}if(t){for(;r--;r){e.unshift("..")}}return e}var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var a=function(e){return t.exec(e).slice(1)};c.resolve=function(){var e="",t=false;for(var r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:i.cwd();if(typeof n!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!n){continue}e=n+"/"+e;t=n.charAt(0)==="/"}e=o(s(e.split("/"),function(e){return!!e}),!t).join("/");return(t?"/":"")+e||"."};c.normalize=function(e){var t=c.isAbsolute(e),r=n(e,-1)==="/";e=o(s(e.split("/"),function(e){return!!e}),!t).join("/");if(!e&&!t){e="."}if(e&&r){e+="/"}return(t?"/":"")+e};c.isAbsolute=function(e){return e.charAt(0)==="/"};c.join=function(){var e=Array.prototype.slice.call(arguments,0);return c.normalize(s(e,function(e,t){if(typeof e!=="string"){throw new TypeError("Arguments to path.join must be strings")}return e}).join("/"))};c.relative=function(e,t){e=c.resolve(e).substr(1);t=c.resolve(t).substr(1);function r(e){var t=0;for(;t<e.length;t++){if(e[t]!=="")break}var r=e.length-1;for(;r>=0;r--){if(e[r]!=="")break}if(t>r)return[];return e.slice(t,r-t+1)}var n=r(e.split("/"));var i=r(t.split("/"));var o=Math.min(n.length,i.length);var a=o;for(var s=0;s<o;s++){if(n[s]!==i[s]){a=s;break}}var u=[];for(var s=a;s<n.length;s++){u.push("..")}u=u.concat(i.slice(a));return u.join("/")};c.sep="/";c.delimiter=":";c.dirname=function(e){var t=a(e),r=t[0],n=t[1];if(!r&&!n){return"."}if(n){n=n.substr(0,n.length-1)}return r+n};c.basename=function(e,t){var r=a(e)[2];if(t&&r.substr(-1*t.length)===t){r=r.substr(0,r.length-t.length)}return r};c.extname=function(e){return a(e)[3]};function s(e,t){if(e.filter)return e.filter(t);var r=[];for(var n=0;n<e.length;n++){if(t(e[n],n,e))r.push(e[n])}return r}var n="ab".substr(-1)==="b"?function(e,t,r){return e.substr(t,r)}:function(e,t,r){if(t<0)t=e.length+t;return e.substr(t,r)}}).call(this,e("_process"))},{_process:7}],40:[function(e,t,r){"use strict";t.exports=i;var n=e("ieee754");function i(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0);this.pos=0;this.type=0;this.length=this.buf.length}i.Varint=0;i.Fixed64=1;i.Bytes=2;i.Fixed32=5;var o=(1<<16)*(1<<16),a=1/o;var s=12;var u=typeof TextDecoder==="undefined"?null:new TextDecoder("utf8");i.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){r=r||this.length;while(this.pos<r){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7;e(i,t,this);if(this.pos===o)this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=C(this.buf,this.pos);this.pos+=4;return e},readSFixed32:function(){var e=E(this.buf,this.pos);this.pos+=4;return e},readFixed64:function(){var e=C(this.buf,this.pos)+C(this.buf,this.pos+4)*o;this.pos+=8;return e},readSFixed64:function(){var e=C(this.buf,this.pos)+E(this.buf,this.pos+4)*o;this.pos+=8;return e},readFloat:function(){var e=n.read(this.buf,this.pos,true,23,4);this.pos+=4;return e},readDouble:function(){var e=n.read(this.buf,this.pos,true,52,8);this.pos+=8;return e},readVarint:function(e){var t=this.buf,r,n;n=t[this.pos++];r=n&127;if(n<128)return r;n=t[this.pos++];r|=(n&127)<<7;if(n<128)return r;n=t[this.pos++];r|=(n&127)<<14;if(n<128)return r;n=t[this.pos++];r|=(n&127)<<21;if(n<128)return r;n=t[this.pos];r|=(n&15)<<28;return c(r,e,this)},readVarint64:function(){return this.readVarint(true)},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;var t=this.pos;this.pos=e;if(e-t>=s&&u){return P(this.buf,t,e)}return O(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);this.pos=e;return t},readPackedVarint:function(e,t){if(this.type!==i.Bytes)return e.push(this.readVarint(t));var r=l(this);e=e||[];while(this.pos<r)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==i.Bytes)return e.push(this.readSVarint());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==i.Bytes)return e.push(this.readBoolean());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==i.Bytes)return e.push(this.readFloat());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==i.Bytes)return e.push(this.readDouble());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed32());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed32());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed64());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed64());var t=l(this);e=e||[];while(this.pos<t)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===i.Varint)while(this.buf[this.pos++]>127){}else if(t===i.Bytes)this.pos=this.readVarint()+this.pos;else if(t===i.Fixed32)this.pos+=4;else if(t===i.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){var t=this.length||16;while(t<this.pos+e)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf);this.buf=r;this.length=t}},finish:function(){this.length=this.pos;this.pos=0;return this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4);T(this.buf,e,this.pos);this.pos+=4},writeSFixed32:function(e){this.realloc(4);T(this.buf,e,this.pos);this.pos+=4},writeFixed64:function(e){this.realloc(8);T(this.buf,e&-1,this.pos);T(this.buf,Math.floor(e*a),this.pos+4);this.pos+=8},writeSFixed64:function(e){this.realloc(8);T(this.buf,e&-1,this.pos);T(this.buf,Math.floor(e*a),this.pos+4);this.pos+=8},writeVarint:function(e){e=+e||0;if(e>268435455||e<0){p(e,this);return}this.realloc(4);this.buf[this.pos++]=e&127|(e>127?128:0);if(e<=127)return;this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0);if(e<=127)return;this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0);if(e<=127)return;this.buf[this.pos++]=e>>>7&127},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e);this.realloc(e.length*4);this.pos++;var t=this.pos;this.pos=A(this.buf,e,this.pos);var r=this.pos-t;if(r>=128)v(t,r,this);this.pos=t-1;this.writeVarint(r);this.pos+=r},writeFloat:function(e){this.realloc(4);n.write(this.buf,e,this.pos,true,23,4);this.pos+=4},writeDouble:function(e){this.realloc(8);n.write(this.buf,e,this.pos,true,52,8);this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t);this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;if(n>=128)v(r,n,this);this.pos=r-1;this.writeVarint(n);this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,i.Bytes);this.writeRawMessage(t,r)},writePackedVarint:function(e,t){if(t.length)this.writeMessage(e,m,t)},writePackedSVarint:function(e,t){if(t.length)this.writeMessage(e,g,t)},writePackedBoolean:function(e,t){if(t.length)this.writeMessage(e,b,t)},writePackedFloat:function(e,t){if(t.length)this.writeMessage(e,_,t)},writePackedDouble:function(e,t){if(t.length)this.writeMessage(e,y,t)},writePackedFixed32:function(e,t){if(t.length)this.writeMessage(e,x,t)},writePackedSFixed32:function(e,t){if(t.length)this.writeMessage(e,w,t)},writePackedFixed64:function(e,t){if(t.length)this.writeMessage(e,S,t)},writePackedSFixed64:function(e,t){if(t.length)this.writeMessage(e,M,t)},writeBytesField:function(e,t){this.writeTag(e,i.Bytes);this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,i.Fixed32);this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,i.Fixed32);this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,i.Fixed64);this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,i.Fixed64);this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,i.Varint);this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,i.Varint);this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,i.Bytes);this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,i.Fixed32);this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,i.Fixed64);this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function c(e,t,r){var n=r.buf,i,o;o=n[r.pos++];i=(o&112)>>4;if(o<128)return h(e,i,t);o=n[r.pos++];i|=(o&127)<<3;if(o<128)return h(e,i,t);o=n[r.pos++];i|=(o&127)<<10;if(o<128)return h(e,i,t);o=n[r.pos++];i|=(o&127)<<17;if(o<128)return h(e,i,t);o=n[r.pos++];i|=(o&127)<<24;if(o<128)return h(e,i,t);o=n[r.pos++];i|=(o&1)<<31;if(o<128)return h(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function l(e){return e.type===i.Bytes?e.readVarint()+e.pos:e.pos+1}function h(e,t,r){if(r){return t*4294967296+(e>>>0)}return(t>>>0)*4294967296+(e>>>0)}function p(e,t){var r,n;if(e>=0){r=e%4294967296|0;n=e/4294967296|0}else{r=~(-e%4294967296);n=~(-e/4294967296);if(r^4294967295){r=r+1|0}else{r=0;n=n+1|0}}if(e>=0x10000000000000000||e<-0x10000000000000000){throw new Error("Given varint doesn't fit into 10 bytes")}t.realloc(10);f(r,n,t);d(n,t)}function f(e,t,r){r.buf[r.pos++]=e&127|128;e>>>=7;r.buf[r.pos++]=e&127|128;e>>>=7;r.buf[r.pos++]=e&127|128;e>>>=7;r.buf[r.pos++]=e&127|128;e>>>=7;r.buf[r.pos]=e&127}function d(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0);if(!e)return;t.buf[t.pos++]=e&127|((e>>>=7)?128:0);if(!e)return;t.buf[t.pos++]=e&127|((e>>>=7)?128:0);if(!e)return;t.buf[t.pos++]=e&127|((e>>>=7)?128:0);if(!e)return;t.buf[t.pos++]=e&127|((e>>>=7)?128:0);if(!e)return;t.buf[t.pos++]=e&127}function v(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function m(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function g(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function _(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function y(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function b(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function x(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function w(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function S(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function M(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function C(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function T(e,t,r){e[r]=t;e[r+1]=t>>>8;e[r+2]=t>>>16;e[r+3]=t>>>24}function E(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function O(e,t,r){var n="";var i=t;while(i<r){var o=e[i];var a=null;var s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var u,c,l;if(s===1){if(o<128){a=o}}else if(s===2){u=e[i+1];if((u&192)===128){a=(o&31)<<6|u&63;if(a<=127){a=null}}}else if(s===3){u=e[i+1];c=e[i+2];if((u&192)===128&&(c&192)===128){a=(o&15)<<12|(u&63)<<6|c&63;if(a<=2047||a>=55296&&a<=57343){a=null}}}else if(s===4){u=e[i+1];c=e[i+2];l=e[i+3];if((u&192)===128&&(c&192)===128&&(l&192)===128){a=(o&15)<<18|(u&63)<<12|(c&63)<<6|l&63;if(a<=65535||a>=1114112){a=null}}}if(a===null){a=65533;s=1}else if(a>65535){a-=65536;n+=String.fromCharCode(a>>>10&1023|55296);a=56320|a&1023}n+=String.fromCharCode(a);i+=s}return n}function P(e,t,r){return u.decode(e.subarray(t,r))}function A(e,t,r){for(var n=0,i,o;n<t.length;n++){i=t.charCodeAt(n);if(i>55295&&i<57344){if(o){if(i<56320){e[r++]=239;e[r++]=191;e[r++]=189;o=i;continue}else{i=o-55296<<10|i-56320|65536;o=null}}else{if(i>56319||n+1===t.length){e[r++]=239;e[r++]=191;e[r++]=189}else{o=i}continue}}else if(o){e[r++]=239;e[r++]=191;e[r++]=189;o=null}if(i<128){e[r++]=i}else{if(i<2048){e[r++]=i>>6|192}else{if(i<65536){e[r++]=i>>12|224}else{e[r++]=i>>18|240;e[r++]=i>>12&63|128}e[r++]=i>>6&63|128}e[r++]=i&63|128}}return r}},{ieee754:41}],41:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a;var s=i*8-n-1;var u=(1<<s)-1;var c=u>>1;var l=-7;var h=r?i-1:0;var p=r?-1:1;var f=e[t+h];h+=p;o=f&(1<<-l)-1;f>>=-l;l+=s;for(;l>0;o=o*256+e[t+h],h+=p,l-=8){}a=o&(1<<-l)-1;o>>=-l;l+=n;for(;l>0;a=a*256+e[t+h],h+=p,l-=8){}if(o===0){o=1-c}else if(o===u){return a?NaN:(f?-1:1)*Infinity}else{a=a+Math.pow(2,n);o=o-c}return(f?-1:1)*a*Math.pow(2,o-n)};r.write=function(e,t,r,n,i,o){var a,s,u;var c=o*8-i-1;var l=(1<<c)-1;var h=l>>1;var p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var f=n?0:o-1;var d=n?1:-1;var v=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){s=isNaN(t)?1:0;a=l}else{a=Math.floor(Math.log(t)/Math.LN2);if(t*(u=Math.pow(2,-a))<1){a--;u*=2}if(a+h>=1){t+=p/u}else{t+=p*Math.pow(2,1-h)}if(t*u>=2){a++;u/=2}if(a+h>=l){s=0;a=l}else if(a+h>=1){s=(t*u-1)*Math.pow(2,i);a=a+h}else{s=t*Math.pow(2,h-1)*Math.pow(2,i);a=0}}for(;i>=8;e[r+f]=s&255,f+=d,s/=256,i-=8){}a=a<<i|s;c+=i;for(;c>0;e[r+f]=a&255,f+=d,a/=256,c-=8){}e[r+f-d]|=v*128}},{}],42:[function(e,r,n){!function(e,t){"object"==typeof n&&"undefined"!=typeof r?r.exports=t():"function"==typeof o&&o.amd?o(t):(e=e||self).RBush=t()}(this,function(){"use strict";function s(e,t,r,n,i){!function e(t,r,n,i,o){for(;i>n;){if(i-n>600){var a=i-n+1,s=r-n+1,u=Math.log(a),c=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*c*(a-c)/a)*(s-a/2<0?-1:1),h=Math.max(n,Math.floor(r-s*c/a+l)),p=Math.min(i,Math.floor(r+(a-s)*c/a+l));e(t,r,h,p,o)}var f=t[r],d=n,v=i;for(m(t,n,r),o(t[i],f)>0&&m(t,n,i);d<v;){for(m(t,d,v),d++,v--;o(t[d],f)<0;)d++;for(;o(t[v],f)>0;)v--}0===o(t[n],f)?m(t,n,v):m(t,++v,i),v<=r&&(n=v+1),r<=v&&(i=v-1)}}(e,t,r||0,n||e.length-1,i||o)}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function o(e,t){return e<t?-1:e>t?1:0}var e=function(e){void 0===e&&(e=9),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function l(e,t,r){if(!r)return t.indexOf(e);for(var n=0;n<t.length;n++)if(r(e,t[n]))return n;return-1}function f(e,t){g(e,0,e.children.length,t,e)}function g(e,t,r,n,i){i||(i=v(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=t;o<r;o++){var a=e.children[o];p(i,e.leaf?n(a):a)}return i}function p(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function a(e,t){return e.minX-t.minX}function u(e,t){return e.minY-t.minY}function _(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function h(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function c(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function v(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function y(e,t,r,n,i){for(var o=[t,r];o.length;)if(!((r=o.pop())-(t=o.pop())<=n)){var a=t+Math.ceil((r-t)/n/2)*n;s(e,a,t,r,i),o.push(t,a,a,r)}}return e.prototype.all=function(){return this._all(this.data,[])},e.prototype.search=function(e){var t=this.data,r=[];if(!c(e,t))return r;for(var n=this.toBBox,i=[];t;){for(var o=0;o<t.children.length;o++){var a=t.children[o],s=t.leaf?n(a):a;c(e,s)&&(t.leaf?r.push(a):h(e,s)?this._all(a,r):i.push(a))}t=i.pop()}return r},e.prototype.collides=function(e){var t=this.data;if(!c(e,t))return!1;for(var r=[];t;){for(var n=0;n<t.children.length;n++){var i=t.children[n],o=t.leaf?this.toBBox(i):i;if(c(e,o)){if(t.leaf||h(e,o))return!0;r.push(i)}}t=r.pop()}return!1},e.prototype.load=function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0;t<e.length;t++)this.insert(e[t]);return this}var r=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var n=this.data;this.data=r,r=n}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},e.prototype.insert=function(e){return e&&this._insert(e,this.data.height-1),this},e.prototype.clear=function(){return this.data=v([]),this},e.prototype.remove=function(e,t){if(!e)return this;for(var r,n,i,o=this.data,a=this.toBBox(e),s=[],u=[];o||s.length;){if(o||(o=s.pop(),n=s[s.length-1],r=u.pop(),i=!0),o.leaf){var c=l(e,o.children,t);if(-1!==c)return o.children.splice(c,1),s.push(o),this._condense(s),this}i||o.leaf||!h(o,a)?n?(r++,o=n.children[r],i=!1):o=null:(s.push(o),u.push(r),r=0,n=o,o=o.children[0])}return this},e.prototype.toBBox=function(e){return e},e.prototype.compareMinX=function(e,t){return e.minX-t.minX},e.prototype.compareMinY=function(e,t){return e.minY-t.minY},e.prototype.toJSON=function(){return this.data},e.prototype.fromJSON=function(e){return this.data=e,this},e.prototype._all=function(e,t){for(var r=[];e;)e.leaf?t.push.apply(t,e.children):r.push.apply(r,e.children),e=r.pop();return t},e.prototype._build=function(e,t,r,n){var i,o=r-t+1,a=this._maxEntries;if(o<=a)return f(i=v(e.slice(t,r+1)),this.toBBox),i;n||(n=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,n-1))),(i=v([])).leaf=!1,i.height=n;var s=Math.ceil(o/a),u=s*Math.ceil(Math.sqrt(a));y(e,t,r,u,this.compareMinX);for(var c=t;c<=r;c+=u){var l=Math.min(c+u-1,r);y(e,c,l,s,this.compareMinY);for(var h=c;h<=l;h+=s){var p=Math.min(h+s-1,l);i.children.push(this._build(e,h,p,n-1))}}return f(i,this.toBBox),i},e.prototype._chooseSubtree=function(e,t,r,n){for(;n.push(t),!t.leaf&&n.length-1!==r;){for(var i=1/0,o=1/0,a=void 0,s=0;s<t.children.length;s++){var u=t.children[s],c=_(u),l=(h=e,p=u,(Math.max(p.maxX,h.maxX)-Math.min(p.minX,h.minX))*(Math.max(p.maxY,h.maxY)-Math.min(p.minY,h.minY))-c);l<o?(o=l,i=c<i?c:i,a=u):l===o&&c<i&&(i=c,a=u)}t=a||t.children[0]}var h,p;return t},e.prototype._insert=function(e,t,r){var n=r?e:this.toBBox(e),i=[],o=this._chooseSubtree(n,this.data,t,i);for(o.children.push(e),p(o,n);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(n,i,t)},e.prototype._split=function(e,t){var r=e[t],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var o=this._chooseSplitIndex(r,i,n),a=v(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,f(r,this.toBBox),f(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(r,a)},e.prototype._splitRoot=function(e,t){this.data=v([e,t]),this.data.height=e.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},e.prototype._chooseSplitIndex=function(e,t,r){for(var n,i,o,a,s,u,c,l=1/0,h=1/0,p=t;p<=r-t;p++){var f=g(e,0,p,this.toBBox),d=g(e,p,r,this.toBBox),v=(i=f,o=d,a=void 0,s=void 0,u=void 0,c=void 0,a=Math.max(i.minX,o.minX),s=Math.max(i.minY,o.minY),u=Math.min(i.maxX,o.maxX),c=Math.min(i.maxY,o.maxY),Math.max(0,u-a)*Math.max(0,c-s)),m=_(f)+_(d);v<l?(l=v,n=p,h=m<h?m:h):v===l&&m<h&&(h=m,n=p)}return n||r-t},e.prototype._chooseSplitAxis=function(e,t,r){var n=e.leaf?this.compareMinX:a,i=e.leaf?this.compareMinY:u;this._allDistMargin(e,t,r,n)<this._allDistMargin(e,t,r,i)&&e.children.sort(n)},e.prototype._allDistMargin=function(e,t,r,n){e.children.sort(n);for(var i=this.toBBox,o=g(e,0,t,i),a=g(e,r-t,r,i),s=d(o)+d(a),u=t;u<r-t;u++){var c=e.children[u];p(o,e.leaf?i(c):c),s+=d(o)}for(var l=r-t-1;l>=t;l--){var h=e.children[l];p(a,e.leaf?i(h):h),s+=d(a)}return s},e.prototype._adjustParentBBoxes=function(e,t,r){for(var n=r;n>=0;n--)p(t[n],e)},e.prototype._condense=function(e){for(var t=e.length-1,r=void 0;t>=0;t--)0===e[t].children.length?t>0?(r=e[t-1].children).splice(r.indexOf(e[t]),1):this.clear():f(e[t],this.toBBox)},e})},{}],43:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./internal/Observable");r.Observable=n.Observable;var i=e("./internal/observable/ConnectableObservable");r.ConnectableObservable=i.ConnectableObservable;var o=e("./internal/operators/groupBy");r.GroupedObservable=o.GroupedObservable;var a=e("./internal/symbol/observable");r.observable=a.observable;var s=e("./internal/Subject");r.Subject=s.Subject;var u=e("./internal/BehaviorSubject");r.BehaviorSubject=u.BehaviorSubject;var c=e("./internal/ReplaySubject");r.ReplaySubject=c.ReplaySubject;var l=e("./internal/AsyncSubject");r.AsyncSubject=l.AsyncSubject;var h=e("./internal/scheduler/asap");r.asapScheduler=h.asap;var p=e("./internal/scheduler/async");r.asyncScheduler=p.async;var f=e("./internal/scheduler/queue");r.queueScheduler=f.queue;var d=e("./internal/scheduler/animationFrame");r.animationFrameScheduler=d.animationFrame;var v=e("./internal/scheduler/VirtualTimeScheduler");r.VirtualTimeScheduler=v.VirtualTimeScheduler;r.VirtualAction=v.VirtualAction;var m=e("./internal/Scheduler");r.Scheduler=m.Scheduler;var g=e("./internal/Subscription");r.Subscription=g.Subscription;var _=e("./internal/Subscriber");r.Subscriber=_.Subscriber;var y=e("./internal/Notification");r.Notification=y.Notification;r.NotificationKind=y.NotificationKind;var b=e("./internal/util/pipe");r.pipe=b.pipe;var x=e("./internal/util/noop");r.noop=x.noop;var w=e("./internal/util/identity");r.identity=w.identity;var S=e("./internal/util/isObservable");r.isObservable=S.isObservable;var M=e("./internal/util/ArgumentOutOfRangeError");r.ArgumentOutOfRangeError=M.ArgumentOutOfRangeError;var C=e("./internal/util/EmptyError");r.EmptyError=C.EmptyError;var T=e("./internal/util/ObjectUnsubscribedError");r.ObjectUnsubscribedError=T.ObjectUnsubscribedError;var E=e("./internal/util/UnsubscriptionError");r.UnsubscriptionError=E.UnsubscriptionError;var O=e("./internal/util/TimeoutError");r.TimeoutError=O.TimeoutError;var P=e("./internal/observable/bindCallback");r.bindCallback=P.bindCallback;var A=e("./internal/observable/bindNodeCallback");r.bindNodeCallback=A.bindNodeCallback;var j=e("./internal/observable/combineLatest");r.combineLatest=j.combineLatest;var R=e("./internal/observable/concat");r.concat=R.concat;var k=e("./internal/observable/defer");r.defer=k.defer;var L=e("./internal/observable/empty");r.empty=L.empty;var N=e("./internal/observable/forkJoin");r.forkJoin=N.forkJoin;var I=e("./internal/observable/from");r.from=I.from;var D=e("./internal/observable/fromEvent");r.fromEvent=D.fromEvent;var B=e("./internal/observable/fromEventPattern");r.fromEventPattern=B.fromEventPattern;var F=e("./internal/observable/generate");r.generate=F.generate;var z=e("./internal/observable/iif");r.iif=z.iif;var $=e("./internal/observable/interval");r.interval=$.interval;var G=e("./internal/observable/merge");r.merge=G.merge;var V=e("./internal/observable/never");r.never=V.never;var H=e("./internal/observable/of");r.of=H.of;var U=e("./internal/observable/onErrorResumeNext");r.onErrorResumeNext=U.onErrorResumeNext;var q=e("./internal/observable/pairs");r.pairs=q.pairs;var W=e("./internal/observable/partition");r.partition=W.partition;var X=e("./internal/observable/race");r.race=X.race;var Y=e("./internal/observable/range");r.range=Y.range;var K=e("./internal/observable/throwError");r.throwError=K.throwError;var Z=e("./internal/observable/timer");r.timer=Z.timer;var J=e("./internal/observable/using");r.using=J.using;var Q=e("./internal/observable/zip");r.zip=Q.zip;var ee=e("./internal/scheduled/scheduled");r.scheduled=ee.scheduled;var te=e("./internal/observable/empty");r.EMPTY=te.EMPTY;var re=e("./internal/observable/never");r.NEVER=re.NEVER;var ne=e("./internal/config");r.config=ne.config},{"./internal/AsyncSubject":44,"./internal/BehaviorSubject":45,"./internal/Notification":47,"./internal/Observable":48,"./internal/ReplaySubject":51,"./internal/Scheduler":52,"./internal/Subject":53,"./internal/Subscriber":55,"./internal/Subscription":56,"./internal/config":57,"./internal/observable/ConnectableObservable":58,"./internal/observable/bindCallback":60,"./internal/observable/bindNodeCallback":61,"./internal/observable/combineLatest":62,"./internal/observable/concat":63,"./internal/observable/defer":64,"./internal/observable/empty":65,"./internal/observable/forkJoin":66,"./internal/observable/from":67,"./internal/observable/fromEvent":69,"./internal/observable/fromEventPattern":70,"./internal/observable/generate":71,"./internal/observable/iif":72,"./internal/observable/interval":73,"./internal/observable/merge":74,"./internal/observable/never":75,"./internal/observable/of":76,"./internal/observable/onErrorResumeNext":77,"./internal/observable/pairs":78,"./internal/observable/partition":79,"./internal/observable/race":80,"./internal/observable/range":81,"./internal/observable/throwError":82,"./internal/observable/timer":83,"./internal/observable/using":84,"./internal/observable/zip":85,"./internal/operators/groupBy":121,"./internal/scheduled/scheduled":193,"./internal/scheduler/VirtualTimeScheduler":203,"./internal/scheduler/animationFrame":204,"./internal/scheduler/asap":205,"./internal/scheduler/async":206,"./internal/scheduler/queue":207,"./internal/symbol/observable":209,"./internal/util/ArgumentOutOfRangeError":211,"./internal/util/EmptyError":212,"./internal/util/ObjectUnsubscribedError":214,"./internal/util/TimeoutError":215,"./internal/util/UnsubscriptionError":216,"./internal/util/identity":219,"./internal/util/isObservable":228,"./internal/util/noop":231,"./internal/util/pipe":233}],44:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./Subject");var o=e("./Subscription");var a=function(t){n(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.value=null;e.hasNext=false;e.hasCompleted=false;return e}e.prototype._subscribe=function(e){if(this.hasError){e.error(this.thrownError);return o.Subscription.EMPTY}else if(this.hasCompleted&&this.hasNext){e.next(this.value);e.complete();return o.Subscription.EMPTY}return t.prototype._subscribe.call(this,e)};e.prototype.next=function(e){if(!this.hasCompleted){this.value=e;this.hasNext=true}};e.prototype.error=function(e){if(!this.hasCompleted){t.prototype.error.call(this,e)}};e.prototype.complete=function(){this.hasCompleted=true;if(this.hasNext){t.prototype.next.call(this,this.value)}t.prototype.complete.call(this)};return e}(i.Subject);r.AsyncSubject=a},{"./Subject":53,"./Subscription":56}],45:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./Subject");var o=e("./util/ObjectUnsubscribedError");var a=function(r){n(e,r);function e(e){var t=r.call(this)||this;t._value=e;return t}Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:true,configurable:true});e.prototype._subscribe=function(e){var t=r.prototype._subscribe.call(this,e);if(t&&!t.closed){e.next(this._value)}return t};e.prototype.getValue=function(){if(this.hasError){throw this.thrownError}else if(this.closed){throw new o.ObjectUnsubscribedError}else{return this._value}};e.prototype.next=function(e){r.prototype.next.call(this,this._value=e)};return e}(i.Subject);r.BehaviorSubject=a},{"./Subject":53,"./util/ObjectUnsubscribedError":214}],46:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./Subscriber");var o=function(i){n(e,i);function e(e,t,r){var n=i.call(this)||this;n.parent=e;n.outerValue=t;n.outerIndex=r;n.index=0;return n}e.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)};e.prototype._error=function(e){this.parent.notifyError(e,this);this.unsubscribe()};e.prototype._complete=function(){this.parent.notifyComplete(this);this.unsubscribe()};return e}(i.Subscriber);r.InnerSubscriber=o},{"./Subscriber":55}],47:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./observable/empty");var i=e("./observable/of");var o=e("./observable/throwError");var a;(function(e){e["NEXT"]="N";e["ERROR"]="E";e["COMPLETE"]="C"})(a=r.NotificationKind||(r.NotificationKind={}));var s=function(){function t(e,t,r){this.kind=e;this.value=t;this.error=r;this.hasValue=e==="N"}t.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()}};t.prototype.do=function(e,t,r){var n=this.kind;switch(n){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return r&&r()}};t.prototype.accept=function(e,t,r){if(e&&typeof e.next==="function"){return this.observe(e)}else{return this.do(e,t,r)}};t.prototype.toObservable=function(){var e=this.kind;switch(e){case"N":return i.of(this.value);case"E":return o.throwError(this.error);case"C":return n.empty()}throw new Error("unexpected notification kind value")};t.createNext=function(e){if(typeof e!=="undefined"){return new t("N",e)}return t.undefinedValueNotification};t.createError=function(e){return new t("E",undefined,e)};t.createComplete=function(){return t.completeNotification};t.completeNotification=new t("C");t.undefinedValueNotification=new t("N",undefined);return t}();r.Notification=s},{"./observable/empty":65,"./observable/of":76,"./observable/throwError":82}],48:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./util/canReportError");var o=e("./util/toSubscriber");var i=e("./symbol/observable");var a=e("./util/pipe");var s=e("./config");var u=function(){function r(e){this._isScalar=false;if(e){this._subscribe=e}}r.prototype.lift=function(e){var t=new r;t.source=this;t.operator=e;return t};r.prototype.subscribe=function(e,t,r){var n=this.operator;var i=o.toSubscriber(e,t,r);if(n){i.add(n.call(i,this.source))}else{i.add(this.source||s.config.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i))}if(s.config.useDeprecatedSynchronousErrorHandling){if(i.syncErrorThrowable){i.syncErrorThrowable=false;if(i.syncErrorThrown){throw i.syncErrorValue}}}return i};r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){if(s.config.useDeprecatedSynchronousErrorHandling){t.syncErrorThrown=true;t.syncErrorValue=e}if(n.canReportError(t)){t.error(e)}else{console.warn(e)}}};r.prototype.forEach=function(n,e){var i=this;e=c(e);return new e(function(e,t){var r;r=i.subscribe(function(e){try{n(e)}catch(e){t(e);if(r){r.unsubscribe()}}},t,e)})};r.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)};r.prototype[i.observable]=function(){return this};r.prototype.pipe=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e.length===0){return this}return a.pipeFromArray(e)(this)};r.prototype.toPromise=function(e){var n=this;e=c(e);return new e(function(e,t){var r;n.subscribe(function(e){return r=e},function(e){return t(e)},function(){return e(r)})})};r.create=function(e){return new r(e)};return r}();r.Observable=u;function c(e){if(!e){e=s.config.Promise||Promise}if(!e){throw new Error("no Promise impl found")}return e}},{"./config":57,"./symbol/observable":209,"./util/canReportError":217,"./util/pipe":233,"./util/toSubscriber":240}],49:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./config");var i=e("./util/hostReportError");r.empty={closed:true,next:function(e){},error:function(e){if(n.config.useDeprecatedSynchronousErrorHandling){throw e}else{i.hostReportError(e)}},complete:function(){}}},{"./config":57,"./util/hostReportError":218}],50:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./Subscriber");var o=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)};t.prototype.notifyError=function(e,t){this.destination.error(e)};t.prototype.notifyComplete=function(e){this.destination.complete()};return t}(i.Subscriber);r.OuterSubscriber=o},{"./Subscriber":55}],51:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./Subject");var o=e("./scheduler/queue");var s=e("./Subscription");var u=e("./operators/observeOn");var c=e("./util/ObjectUnsubscribedError");var l=e("./SubjectSubscription");var a=function(i){n(e,i);function e(e,t,r){if(e===void 0){e=Number.POSITIVE_INFINITY}if(t===void 0){t=Number.POSITIVE_INFINITY}var n=i.call(this)||this;n.scheduler=r;n._events=[];n._infiniteTimeWindow=false;n._bufferSize=e<1?1:e;n._windowTime=t<1?1:t;if(t===Number.POSITIVE_INFINITY){n._infiniteTimeWindow=true;n.next=n.nextInfiniteTimeWindow}else{n.next=n.nextTimeWindow}return n}e.prototype.nextInfiniteTimeWindow=function(e){var t=this._events;t.push(e);if(t.length>this._bufferSize){t.shift()}i.prototype.next.call(this,e)};e.prototype.nextTimeWindow=function(e){this._events.push(new h(this._getNow(),e));this._trimBufferThenGetEvents();i.prototype.next.call(this,e)};e.prototype._subscribe=function(e){var t=this._infiniteTimeWindow;var r=t?this._events:this._trimBufferThenGetEvents();var n=this.scheduler;var i=r.length;var o;if(this.closed){throw new c.ObjectUnsubscribedError}else if(this.isStopped||this.hasError){o=s.Subscription.EMPTY}else{this.observers.push(e);o=new l.SubjectSubscription(this,e)}if(n){e.add(e=new u.ObserveOnSubscriber(e,n))}if(t){for(var a=0;a<i&&!e.closed;a++){e.next(r[a])}}else{for(var a=0;a<i&&!e.closed;a++){e.next(r[a].value)}}if(this.hasError){e.error(this.thrownError)}else if(this.isStopped){e.complete()}return o};e.prototype._getNow=function(){return(this.scheduler||o.queue).now()};e.prototype._trimBufferThenGetEvents=function(){var e=this._getNow();var t=this._bufferSize;var r=this._windowTime;var n=this._events;var i=n.length;var o=0;while(o<i){if(e-n[o].time<r){break}o++}if(i>t){o=Math.max(o,i-t)}if(o>0){n.splice(0,o)}return n};return e}(i.Subject);r.ReplaySubject=a;var h=function(){function e(e,t){this.time=e;this.value=t}return e}()},{"./Subject":53,"./SubjectSubscription":54,"./Subscription":56,"./operators/observeOn":136,"./scheduler/queue":207,"./util/ObjectUnsubscribedError":214}],52:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=function(){function r(e,t){if(t===void 0){t=r.now}this.SchedulerAction=e;this.now=t}r.prototype.schedule=function(e,t,r){if(t===void 0){t=0}return new this.SchedulerAction(this,e).schedule(r,t)};r.now=function(){return Date.now()};return r}();r.Scheduler=n},{}],53:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("./Observable");var o=e("./Subscriber");var a=e("./Subscription");var s=e("./util/ObjectUnsubscribedError");var u=e("./SubjectSubscription");var c=e("../internal/symbol/rxSubscriber");var l=function(r){i(e,r);function e(e){var t=r.call(this,e)||this;t.destination=e;return t}return e}(o.Subscriber);r.SubjectSubscriber=l;var h=function(t){i(e,t);function e(){var e=t.call(this)||this;e.observers=[];e.closed=false;e.isStopped=false;e.hasError=false;e.thrownError=null;return e}e.prototype[c.rxSubscriber]=function(){return new l(this)};e.prototype.lift=function(e){var t=new p(this,this);t.operator=e;return t};e.prototype.next=function(e){if(this.closed){throw new s.ObjectUnsubscribedError}if(!this.isStopped){var t=this.observers;var r=t.length;var n=t.slice();for(var i=0;i<r;i++){n[i].next(e)}}};e.prototype.error=function(e){if(this.closed){throw new s.ObjectUnsubscribedError}this.hasError=true;this.thrownError=e;this.isStopped=true;var t=this.observers;var r=t.length;var n=t.slice();for(var i=0;i<r;i++){n[i].error(e)}this.observers.length=0};e.prototype.complete=function(){if(this.closed){throw new s.ObjectUnsubscribedError}this.isStopped=true;var e=this.observers;var t=e.length;var r=e.slice();for(var n=0;n<t;n++){r[n].complete()}this.observers.length=0};e.prototype.unsubscribe=function(){this.isStopped=true;this.closed=true;this.observers=null};e.prototype._trySubscribe=function(e){if(this.closed){throw new s.ObjectUnsubscribedError}else{return t.prototype._trySubscribe.call(this,e)}};e.prototype._subscribe=function(e){if(this.closed){throw new s.ObjectUnsubscribedError}else if(this.hasError){e.error(this.thrownError);return a.Subscription.EMPTY}else if(this.isStopped){e.complete();return a.Subscription.EMPTY}else{this.observers.push(e);return new u.SubjectSubscription(this,e)}};e.prototype.asObservable=function(){var e=new n.Observable;e.source=this;return e};e.create=function(e,t){return new p(e,t)};return e}(n.Observable);r.Subject=h;var p=function(n){i(e,n);function e(e,t){var r=n.call(this)||this;r.destination=e;r.source=t;return r}e.prototype.next=function(e){var t=this.destination;if(t&&t.next){t.next(e)}};e.prototype.error=function(e){var t=this.destination;if(t&&t.error){this.destination.error(e)}};e.prototype.complete=function(){var e=this.destination;if(e&&e.complete){this.destination.complete()}};e.prototype._subscribe=function(e){var t=this.source;if(t){return this.source.subscribe(e)}else{return a.Subscription.EMPTY}};return e}(h);r.AnonymousSubject=p},{"../internal/symbol/rxSubscriber":210,"./Observable":48,"./SubjectSubscription":54,"./Subscriber":55,"./Subscription":56,"./util/ObjectUnsubscribedError":214}],54:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("./Subscription");var o=function(n){i(e,n);function e(e,t){var r=n.call(this)||this;r.subject=e;r.subscriber=t;r.closed=false;return r}e.prototype.unsubscribe=function(){if(this.closed){return}this.closed=true;var e=this.subject;var t=e.observers;this.subject=null;if(!t||t.length===0||e.isStopped||e.closed){return}var r=t.indexOf(this.subscriber);if(r!==-1){t.splice(r,1)}};return e}(n.Subscription);r.SubjectSubscription=o},{"./Subscription":56}],55:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var u=e("./util/isFunction");var c=e("./Observer");var i=e("./Subscription");var a=e("../internal/symbol/rxSubscriber");var o=e("./config");var l=e("./util/hostReportError");var s=function(i){n(o,i);function o(e,t,r){var n=i.call(this)||this;n.syncErrorValue=null;n.syncErrorThrown=false;n.syncErrorThrowable=false;n.isStopped=false;switch(arguments.length){case 0:n.destination=c.empty;break;case 1:if(!e){n.destination=c.empty;break}if(typeof e==="object"){if(e instanceof o){n.syncErrorThrowable=e.syncErrorThrowable;n.destination=e;e.add(n)}else{n.syncErrorThrowable=true;n.destination=new h(n,e)}break}default:n.syncErrorThrowable=true;n.destination=new h(n,e,t,r);break}return n}o.prototype[a.rxSubscriber]=function(){return this};o.create=function(e,t,r){var n=new o(e,t,r);n.syncErrorThrowable=false;return n};o.prototype.next=function(e){if(!this.isStopped){this._next(e)}};o.prototype.error=function(e){if(!this.isStopped){this.isStopped=true;this._error(e)}};o.prototype.complete=function(){if(!this.isStopped){this.isStopped=true;this._complete()}};o.prototype.unsubscribe=function(){if(this.closed){return}this.isStopped=true;i.prototype.unsubscribe.call(this)};o.prototype._next=function(e){this.destination.next(e)};o.prototype._error=function(e){this.destination.error(e);this.unsubscribe()};o.prototype._complete=function(){this.destination.complete();this.unsubscribe()};o.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;this._parentOrParents=null;this.unsubscribe();this.closed=false;this.isStopped=false;this._parentOrParents=e;return this};return o}(i.Subscription);r.Subscriber=s;var h=function(s){n(e,s);function e(e,t,r,n){var i=s.call(this)||this;i._parentSubscriber=e;var o;var a=i;if(u.isFunction(t)){o=t}else if(t){o=t.next;r=t.error;n=t.complete;if(t!==c.empty){a=Object.create(t);if(u.isFunction(a.unsubscribe)){i.add(a.unsubscribe.bind(a))}a.unsubscribe=i.unsubscribe.bind(i)}}i._context=a;i._next=o;i._error=r;i._complete=n;return i}e.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;if(!o.config.useDeprecatedSynchronousErrorHandling||!t.syncErrorThrowable){this.__tryOrUnsub(this._next,e)}else if(this.__tryOrSetError(t,this._next,e)){this.unsubscribe()}}};e.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber;var r=o.config.useDeprecatedSynchronousErrorHandling;if(this._error){if(!r||!t.syncErrorThrowable){this.__tryOrUnsub(this._error,e);this.unsubscribe()}else{this.__tryOrSetError(t,this._error,e);this.unsubscribe()}}else if(!t.syncErrorThrowable){this.unsubscribe();if(r){throw e}l.hostReportError(e)}else{if(r){t.syncErrorValue=e;t.syncErrorThrown=true}else{l.hostReportError(e)}this.unsubscribe()}}};e.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};if(!o.config.useDeprecatedSynchronousErrorHandling||!t.syncErrorThrowable){this.__tryOrUnsub(r);this.unsubscribe()}else{this.__tryOrSetError(t,r);this.unsubscribe()}}else{this.unsubscribe()}}};e.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){this.unsubscribe();if(o.config.useDeprecatedSynchronousErrorHandling){throw e}else{l.hostReportError(e)}}};e.prototype.__tryOrSetError=function(t,e,r){if(!o.config.useDeprecatedSynchronousErrorHandling){throw new Error("bad call")}try{e.call(this._context,r)}catch(e){if(o.config.useDeprecatedSynchronousErrorHandling){t.syncErrorValue=e;t.syncErrorThrown=true;return true}else{l.hostReportError(e);return true}}return false};e.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null;this._parentSubscriber=null;e.unsubscribe()};return e}(s);r.SafeSubscriber=h},{"../internal/symbol/rxSubscriber":210,"./Observer":49,"./Subscription":56,"./config":57,"./util/hostReportError":218,"./util/isFunction":223}],56:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var l=e("./util/isArray");var h=e("./util/isObject");var p=e("./util/isFunction");var f=e("./util/UnsubscriptionError");var n=function(){function c(e){this.closed=false;this._parentOrParents=null;this._subscriptions=null;if(e){this._unsubscribe=e}}c.prototype.unsubscribe=function(){var t;if(this.closed){return}var e=this,r=e._parentOrParents,n=e._unsubscribe,i=e._subscriptions;this.closed=true;this._parentOrParents=null;this._subscriptions=null;if(r instanceof c){r.remove(this)}else if(r!==null){for(var o=0;o<r.length;++o){var a=r[o];a.remove(this)}}if(p.isFunction(n)){try{n.call(this)}catch(e){t=e instanceof f.UnsubscriptionError?d(e.errors):[e]}}if(l.isArray(i)){var o=-1;var s=i.length;while(++o<s){var u=i[o];if(h.isObject(u)){try{u.unsubscribe()}catch(e){t=t||[];if(e instanceof f.UnsubscriptionError){t=t.concat(d(e.errors))}else{t.push(e)}}}}}if(t){throw new f.UnsubscriptionError(t)}};c.prototype.add=function(e){var t=e;if(!e){return c.EMPTY}switch(typeof e){case"function":t=new c(e);case"object":if(t===this||t.closed||typeof t.unsubscribe!=="function"){return t}else if(this.closed){t.unsubscribe();return t}else if(!(t instanceof c)){var r=t;t=new c;t._subscriptions=[r]}break;default:{throw new Error("unrecognized teardown "+e+" added to Subscription.")}}var n=t._parentOrParents;if(n===null){t._parentOrParents=this}else if(n instanceof c){if(n===this){return t}t._parentOrParents=[n,this]}else if(n.indexOf(this)===-1){n.push(this)}else{return t}var i=this._subscriptions;if(i===null){this._subscriptions=[t]}else{i.push(t)}return t};c.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);if(r!==-1){t.splice(r,1)}}};c.EMPTY=function(e){e.closed=true;return e}(new c);return c}();r.Subscription=n;function d(e){return e.reduce(function(e,t){return e.concat(t instanceof f.UnsubscriptionError?t.errors:t)},[])}},{"./util/UnsubscriptionError":216,"./util/isArray":220,"./util/isFunction":223,"./util/isObject":227}],57:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=false;r.config={Promise:undefined,set useDeprecatedSynchronousErrorHandling(e){if(e){var t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else if(n){console.log("RxJS: Back to a better error behavior. Thank you. <3")}n=e},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],58:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subject");var o=e("../Observable");var a=e("../Subscriber");var s=e("../Subscription");var u=e("../operators/refCount");var c=function(n){i(e,n);function e(e,t){var r=n.call(this)||this;r.source=e;r.subjectFactory=t;r._refCount=0;r._isComplete=false;return r}e.prototype._subscribe=function(e){return this.getSubject().subscribe(e)};e.prototype.getSubject=function(){var e=this._subject;if(!e||e.isStopped){this._subject=this.subjectFactory()}return this._subject};e.prototype.connect=function(){var e=this._connection;if(!e){this._isComplete=false;e=this._connection=new s.Subscription;e.add(this.source.subscribe(new l(this.getSubject(),this)));if(e.closed){this._connection=null;e=s.Subscription.EMPTY}}return e};e.prototype.refCount=function(){return u.refCount()(this)};return e}(o.Observable);r.ConnectableObservable=c;r.connectableObservableDescriptor=function(){var e=c.prototype;return{operator:{value:null},_refCount:{value:0,writable:true},_subject:{value:null,writable:true},_connection:{value:null,writable:true},_subscribe:{value:e._subscribe},_isComplete:{value:e._isComplete,writable:true},getSubject:{value:e.getSubject},connect:{value:e.connect},refCount:{value:e.refCount}}}();var l=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.connectable=t;return r}e.prototype._error=function(e){this._unsubscribe();n.prototype._error.call(this,e)};e.prototype._complete=function(){this.connectable._isComplete=true;this._unsubscribe();n.prototype._complete.call(this)};e.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;if(t){t.unsubscribe()}}};return e}(n.SubjectSubscriber);var h=function(){function e(e){this.connectable=e}e.prototype.call=function(e,t){var r=this.connectable;r._refCount++;var n=new p(e,r);var i=t.subscribe(n);if(!n.closed){n.connection=r.connect()}return i};return e}();var p=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.connectable=t;return r}e.prototype._unsubscribe=function(){var e=this.connectable;if(!e){this.connection=null;return}this.connectable=null;var t=e._refCount;if(t<=0){this.connection=null;return}e._refCount=t-1;if(t>1){this.connection=null;return}var r=this.connection;var n=e._connection;this.connection=null;if(n&&(!r||n===r)){n.unsubscribe()}};return e}(a.Subscriber)},{"../Observable":48,"../Subject":53,"../Subscriber":55,"../Subscription":56,"../operators/refCount":147}],59:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Observable");var a=e("../scheduler/asap");var s=e("../util/isNumeric");var o=function(i){n(o,i);function o(e,t,r){if(t===void 0){t=0}if(r===void 0){r=a.asap}var n=i.call(this)||this;n.source=e;n.delayTime=t;n.scheduler=r;if(!s.isNumeric(t)||t<0){n.delayTime=0}if(!r||typeof r.schedule!=="function"){n.scheduler=a.asap}return n}o.create=function(e,t,r){if(t===void 0){t=0}if(r===void 0){r=a.asap}return new o(e,t,r)};o.dispatch=function(e){var t=e.source,r=e.subscriber;return this.add(t.subscribe(r))};o.prototype._subscribe=function(e){var t=this.delayTime;var r=this.source;var n=this.scheduler;return n.schedule(o.dispatch,t,{source:r,subscriber:e})};return o}(i.Observable);r.SubscribeOnObservable=o},{"../Observable":48,"../scheduler/asap":205,"../util/isNumeric":226}],60:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var c=e("../Observable");var h=e("../AsyncSubject");var n=e("../operators/map");var l=e("../util/canReportError");var i=e("../util/isArray");var o=e("../util/isScheduler");function a(s,r,u){if(r){if(o.isScheduler(r)){u=r}else{return function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return a(s,u).apply(void 0,e).pipe(n.map(function(e){return i.isArray(e)?r.apply(void 0,e):r(e)}))}}}return function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}var i=this;var o;var a={context:i,subject:o,callbackFunc:s,scheduler:u};return new c.Observable(function(e){if(!u){if(!o){o=new h.AsyncSubject;var t=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}o.next(e.length<=1?e[0]:e);o.complete()};try{s.apply(i,n.concat([t]))}catch(e){if(l.canReportError(o)){o.error(e)}else{console.warn(e)}}}return o.subscribe(e)}else{var r={args:n,subscriber:e,params:a};return u.schedule(p,0,r)}})}}r.bindCallback=a;function p(e){var n=this;var t=this;var r=e.args,i=e.subscriber,o=e.params;var a=o.callbackFunc,s=o.context,u=o.scheduler;var c=o.subject;if(!c){c=o.subject=new h.AsyncSubject;var l=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=e.length<=1?e[0]:e;n.add(u.schedule(f,0,{value:r,subject:c}))};try{a.apply(s,r.concat([l]))}catch(e){c.error(e)}}this.add(c.subscribe(i))}function f(e){var t=e.value,r=e.subject;r.next(t);r.complete()}function s(e){var t=e.err,r=e.subject;r.error(t)}},{"../AsyncSubject":44,"../Observable":48,"../operators/map":125,"../util/canReportError":217,"../util/isArray":220,"../util/isScheduler":230}],61:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var l=e("../AsyncSubject");var i=e("../operators/map");var u=e("../util/canReportError");var o=e("../util/isScheduler");var c=e("../util/isArray");function h(a,r,s){if(r){if(o.isScheduler(r)){s=r}else{return function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return h(a,s).apply(void 0,e).pipe(i.map(function(e){return c.isArray(e)?r.apply(void 0,e):r(e)}))}}}return function(){var i=[];for(var e=0;e<arguments.length;e++){i[e]=arguments[e]}var o={subject:undefined,args:i,callbackFunc:a,scheduler:s,context:this};return new n.Observable(function(e){var t=o.context;var n=o.subject;if(!s){if(!n){n=o.subject=new l.AsyncSubject;var r=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=e.shift();if(r){n.error(r);return}n.next(e.length<=1?e[0]:e);n.complete()};try{a.apply(t,i.concat([r]))}catch(e){if(u.canReportError(n)){n.error(e)}else{console.warn(e)}}}return n.subscribe(e)}else{return s.schedule(p,0,{params:o,subscriber:e,context:t})}})}}r.bindNodeCallback=h;function p(e){var i=this;var t=e.params,r=e.subscriber,n=e.context;var o=t.callbackFunc,a=t.args,s=t.scheduler;var u=t.subject;if(!u){u=t.subject=new l.AsyncSubject;var c=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=e.shift();if(r){i.add(s.schedule(d,0,{err:r,subject:u}))}else{var n=e.length<=1?e[0]:e;i.add(s.schedule(f,0,{value:n,subject:u}))}};try{o.apply(n,a.concat([c]))}catch(e){this.add(s.schedule(d,0,{err:e,subject:u}))}}this.add(u.subscribe(r))}function f(e){var t=e.value,r=e.subject;r.next(t);r.complete()}function d(e){var t=e.err,r=e.subject;r.error(t)}},{"../AsyncSubject":44,"../Observable":48,"../operators/map":125,"../util/canReportError":217,"../util/isArray":220,"../util/isScheduler":230}],62:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var o=e("../util/isScheduler");var a=e("../util/isArray");var n=e("../OuterSubscriber");var s=e("../util/subscribeToResult");var u=e("./fromArray");var c={};function l(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=null;var n=null;if(o.isScheduler(e[e.length-1])){n=e.pop()}if(typeof e[e.length-1]==="function"){r=e.pop()}if(e.length===1&&a.isArray(e[0])){e=e[0]}return u.fromArray(e,n).lift(new h(r))}r.combineLatest=l;var h=function(){function e(e){this.resultSelector=e}e.prototype.call=function(e,t){return t.subscribe(new p(e,this.resultSelector))};return e}();r.CombineLatestOperator=h;var p=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.resultSelector=t;r.active=0;r.values=[];r.observables=[];return r}e.prototype._next=function(e){this.values.push(c);this.observables.push(e)};e.prototype._complete=function(){var e=this.observables;var t=e.length;if(t===0){this.destination.complete()}else{this.active=t;this.toRespond=t;for(var r=0;r<t;r++){var n=e[r];this.add(s.subscribeToResult(this,n,n,r))}}};e.prototype.notifyComplete=function(e){if((this.active-=1)===0){this.destination.complete()}};e.prototype.notifyNext=function(e,t,r,n,i){var o=this.values;var a=o[r];var s=!this.toRespond?0:a===c?--this.toRespond:this.toRespond;o[r]=t;if(s===0){if(this.resultSelector){this._tryResultSelector(o)}else{this.destination.next(o.slice())}}};e.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){this.destination.error(e);return}this.destination.next(t)};return e}(n.OuterSubscriber);r.CombineLatestSubscriber=p},{"../OuterSubscriber":50,"../util/isArray":220,"../util/isScheduler":230,"../util/subscribeToResult":239,"./fromArray":68}],63:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./of");var i=e("../operators/concatAll");function o(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return i.concatAll()(n.of.apply(void 0,e))}r.concat=o},{"../operators/concatAll":97,"./of":76}],64:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../Observable");var o=e("./from");var a=e("./empty");function n(n){return new i.Observable(function(t){var e;try{e=n()}catch(e){t.error(e);return undefined}var r=e?o.from(e):a.empty();return r.subscribe(t)})}r.defer=n},{"../Observable":48,"./empty":65,"./from":67}],65:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");r.EMPTY=new n.Observable(function(e){return e.complete()});function i(e){return e?o(e):r.EMPTY}r.empty=i;function o(t){return new n.Observable(function(e){return t.schedule(function(){return e.complete()})})}},{"../Observable":48}],66:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var o=e("../util/isArray");var a=e("../operators/map");var s=e("../util/isObject");var l=e("./from");function i(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e.length===1){var r=e[0];if(o.isArray(r)){return u(r,null)}if(s.isObject(r)&&Object.getPrototypeOf(r)===Object.prototype){var n=Object.keys(r);return u(n.map(function(e){return r[e]}),n)}}if(typeof e[e.length-1]==="function"){var i=e.pop();e=e.length===1&&o.isArray(e[0])?e[0]:e;return u(e,null).pipe(a.map(function(e){return i.apply(void 0,e)}))}return u(e,null)}r.forkJoin=i;function u(u,c){return new n.Observable(function(n){var i=u.length;if(i===0){n.complete();return}var o=new Array(i);var a=0;var s=0;var e=function(t){var e=l.from(u[t]);var r=false;n.add(e.subscribe({next:function(e){if(!r){r=true;s++}o[t]=e},error:function(e){return n.error(e)},complete:function(){a++;if(a===i||!r){if(s===i){n.next(c?c.reduce(function(e,t,r){return e[t]=o[r],e},{}):o)}n.complete()}}}))};for(var t=0;t<i;t++){e(t)}})}},{"../Observable":48,"../operators/map":125,"../util/isArray":220,"../util/isObject":227,"./from":67}],67:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var i=e("../util/subscribeTo");var o=e("../scheduled/scheduled");function a(e,t){if(!t){if(e instanceof n.Observable){return e}return new n.Observable(i.subscribeTo(e))}else{return o.scheduled(e,t)}}r.from=a},{"../Observable":48,"../scheduled/scheduled":193,"../util/subscribeTo":234}],68:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var i=e("../util/subscribeToArray");var o=e("../scheduled/scheduleArray");function a(e,t){if(!t){return new n.Observable(i.subscribeToArray(e))}else{return o.scheduleArray(e,t)}}r.fromArray=a},{"../Observable":48,"../scheduled/scheduleArray":189,"../util/subscribeToArray":235}],69:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Observable");var a=e("../util/isArray");var s=e("../util/isFunction");var u=e("../operators/map");var n=function(){return Object.prototype.toString}();function c(r,n,i,t){if(s.isFunction(i)){t=i;i=undefined}if(t){return c(r,n,i).pipe(u.map(function(e){return a.isArray(e)?t.apply(void 0,e):t(e)}))}return new o.Observable(function(t){function e(e){if(arguments.length>1){t.next(Array.prototype.slice.call(arguments))}else{t.next(e)}}h(r,n,e,t,i)})}r.fromEvent=c;function h(e,t,r,n,i){var o;if(d(e)){var a=e;e.addEventListener(t,r,i);o=function(){return a.removeEventListener(t,r,i)}}else if(f(e)){var s=e;e.on(t,r);o=function(){return s.off(t,r)}}else if(p(e)){var u=e;e.addListener(t,r);o=function(){return u.removeListener(t,r)}}else if(e&&e.length){for(var c=0,l=e.length;c<l;c++){h(e[c],t,r,n,i)}}else{throw new TypeError("Invalid event target")}n.add(o)}function p(e){return e&&typeof e.addListener==="function"&&typeof e.removeListener==="function"}function f(e){return e&&typeof e.on==="function"&&typeof e.off==="function"}function d(e){return e&&typeof e.addEventListener==="function"&&typeof e.removeEventListener==="function"}},{"../Observable":48,"../operators/map":125,"../util/isArray":220,"../util/isFunction":223}],70:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Observable");var a=e("../util/isArray");var s=e("../util/isFunction");var u=e("../operators/map");function c(n,i,t){if(t){return c(n,i).pipe(u.map(function(e){return a.isArray(e)?t.apply(void 0,e):t(e)}))}return new o.Observable(function(r){var e=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.next(e.length===1?e[0]:e)};var t;try{t=n(e)}catch(e){r.error(e);return undefined}if(!s.isFunction(i)){return undefined}return function(){return i(e,t)}})}r.fromEventPattern=c},{"../Observable":48,"../operators/map":125,"../util/isArray":220,"../util/isFunction":223}],71:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var c=e("../util/identity");var l=e("../util/isScheduler");function i(e,i,o,t,a){var s;var u;if(arguments.length==1){var r=e;u=r.initialState;i=r.condition;o=r.iterate;s=r.resultSelector||c.identity;a=r.scheduler}else if(t===undefined||l.isScheduler(t)){u=e;s=c.identity;a=t}else{u=e;s=t}return new n.Observable(function(t){var e=u;if(a){return a.schedule(h,0,{subscriber:t,iterate:o,condition:i,resultSelector:s,state:e})}do{if(i){var r=void 0;try{r=i(e)}catch(e){t.error(e);return undefined}if(!r){t.complete();break}}var n=void 0;try{n=s(e)}catch(e){t.error(e);return undefined}t.next(n);if(t.closed){break}try{e=o(e)}catch(e){t.error(e);return undefined}}while(true);return undefined})}r.generate=i;function h(e){var t=e.subscriber,r=e.condition;if(t.closed){return undefined}if(e.needIterate){try{e.state=e.iterate(e.state)}catch(e){t.error(e);return undefined}}else{e.needIterate=true}if(r){var n=void 0;try{n=r(e.state)}catch(e){t.error(e);return undefined}if(!n){t.complete();return undefined}if(t.closed){return undefined}}var i;try{i=e.resultSelector(e.state)}catch(e){t.error(e);return undefined}if(t.closed){return undefined}t.next(i);if(t.closed){return undefined}return this.schedule(e)}},{"../Observable":48,"../util/identity":219,"../util/isScheduler":230}],72:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./defer");var i=e("./empty");function o(e,t,r){if(t===void 0){t=i.EMPTY}if(r===void 0){r=i.EMPTY}return n.defer(function(){return e()?t:r})}r.iif=o},{"./defer":64,"./empty":65}],73:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var i=e("../scheduler/async");var o=e("../util/isNumeric");function a(t,r){if(t===void 0){t=0}if(r===void 0){r=i.async}if(!o.isNumeric(t)||t<0){t=0}if(!r||typeof r.schedule!=="function"){r=i.async}return new n.Observable(function(e){e.add(r.schedule(s,t,{subscriber:e,counter:0,period:t}));return e})}r.interval=a;function s(e){var t=e.subscriber,r=e.counter,n=e.period;t.next(r);this.schedule({subscriber:t,counter:r+1,period:n},n)}},{"../Observable":48,"../scheduler/async":206,"../util/isNumeric":226}],74:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Observable");var a=e("../util/isScheduler");var s=e("../operators/mergeAll");var u=e("./fromArray");function n(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=Number.POSITIVE_INFINITY;var n=null;var i=e[e.length-1];if(a.isScheduler(i)){n=e.pop();if(e.length>1&&typeof e[e.length-1]==="number"){r=e.pop()}}else if(typeof i==="number"){r=e.pop()}if(n===null&&e.length===1&&e[0]instanceof o.Observable){return e[0]}return s.mergeAll(r)(u.fromArray(e,n))}r.merge=n},{"../Observable":48,"../operators/mergeAll":130,"../util/isScheduler":230,"./fromArray":68}],75:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var i=e("../util/noop");r.NEVER=new n.Observable(i.noop);function o(){return r.NEVER}r.never=o},{"../Observable":48,"../util/noop":231}],76:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../util/isScheduler");var i=e("./fromArray");var o=e("../scheduled/scheduleArray");function a(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=e[e.length-1];if(n.isScheduler(r)){e.pop();return o.scheduleArray(e,r)}else{return i.fromArray(e)}}r.of=a},{"../scheduled/scheduleArray":189,"../util/isScheduler":230,"./fromArray":68}],77:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../Observable");var o=e("./from");var a=e("../util/isArray");var s=e("./empty");function u(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e.length===0){return s.EMPTY}var r=e[0],n=e.slice(1);if(e.length===1&&a.isArray(r)){return u.apply(void 0,r)}return new i.Observable(function(t){var e=function(){return t.add(u.apply(void 0,n).subscribe(t))};return o.from(r).subscribe({next:function(e){t.next(e)},error:e,complete:e})})}r.onErrorResumeNext=u},{"../Observable":48,"../util/isArray":220,"./empty":65,"./from":67}],78:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Observable");var a=e("../Subscription");function n(i,n){if(!n){return new o.Observable(function(e){var t=Object.keys(i);for(var r=0;r<t.length&&!e.closed;r++){var n=t[r];if(i.hasOwnProperty(n)){e.next([n,i[n]])}}e.complete()})}else{return new o.Observable(function(e){var t=Object.keys(i);var r=new a.Subscription;r.add(n.schedule(s,0,{keys:t,index:0,subscriber:e,subscription:r,obj:i}));return r})}}r.pairs=n;function s(e){var t=e.keys,r=e.index,n=e.subscriber,i=e.subscription,o=e.obj;if(!n.closed){if(r<t.length){var a=t[r];n.next([a,o[a]]);i.add(this.schedule({keys:t,index:r+1,subscriber:n,subscription:i,obj:o}))}else{n.complete()}}}r.dispatch=s},{"../Observable":48,"../Subscription":56}],79:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../util/not");var i=e("../util/subscribeTo");var o=e("../operators/filter");var a=e("../Observable");function s(e,t,r){return[o.filter(t,r)(new a.Observable(i.subscribeTo(e))),o.filter(n.not(t,r))(new a.Observable(i.subscribeTo(e)))]}r.partition=s},{"../Observable":48,"../operators/filter":116,"../util/not":232,"../util/subscribeTo":234}],80:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../util/isArray");var o=e("./fromArray");var a=e("../OuterSubscriber");var s=e("../util/subscribeToResult");function u(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e.length===1){if(i.isArray(e[0])){e=e[0]}else{return e[0]}}return o.fromArray(e,undefined).lift(new c)}r.race=u;var c=function(){function e(){}e.prototype.call=function(e,t){return t.subscribe(new l(e))};return e}();r.RaceOperator=c;var l=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t.hasFirst=false;t.observables=[];t.subscriptions=[];return t}e.prototype._next=function(e){this.observables.push(e)};e.prototype._complete=function(){var e=this.observables;var t=e.length;if(t===0){this.destination.complete()}else{for(var r=0;r<t&&!this.hasFirst;r++){var n=e[r];var i=s.subscribeToResult(this,n,n,r);if(this.subscriptions){this.subscriptions.push(i)}this.add(i)}this.observables=null}};e.prototype.notifyNext=function(e,t,r,n,i){if(!this.hasFirst){this.hasFirst=true;for(var o=0;o<this.subscriptions.length;o++){if(o!==r){var a=this.subscriptions[o];a.unsubscribe();this.remove(a)}}this.subscriptions=null}this.destination.next(t)};return e}(a.OuterSubscriber);r.RaceSubscriber=l},{"../OuterSubscriber":50,"../util/isArray":220,"../util/subscribeToResult":239,"./fromArray":68}],81:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var a=e("../Observable");function n(n,i,o){if(n===void 0){n=0}return new a.Observable(function(e){if(i===undefined){i=n;n=0}var t=0;var r=n;if(o){return o.schedule(s,0,{index:t,count:i,start:n,subscriber:e})}else{do{if(t++>=i){e.complete();break}e.next(r++);if(e.closed){break}}while(true)}return undefined})}r.range=n;function s(e){var t=e.start,r=e.index,n=e.count,i=e.subscriber;if(r>=n){i.complete();return}i.next(t);if(i.closed){return}e.index=r+1;e.start=t+1;this.schedule(e)}r.dispatch=s},{"../Observable":48}],82:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");function i(t,r){if(!r){return new n.Observable(function(e){return e.error(t)})}else{return new n.Observable(function(e){return r.schedule(o,0,{error:t,subscriber:e})})}}r.throwError=i;function o(e){var t=e.error,r=e.subscriber;r.error(t)}},{"../Observable":48}],83:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Observable");var a=e("../scheduler/async");var s=e("../util/isNumeric");var u=e("../util/isScheduler");function n(r,e,n){if(r===void 0){r=0}var i=-1;if(s.isNumeric(e)){i=Number(e)<1&&1||Number(e)}else if(u.isScheduler(e)){n=e}if(!u.isScheduler(n)){n=a.async}return new o.Observable(function(e){var t=s.isNumeric(r)?r:+r-n.now();return n.schedule(c,t,{index:0,period:i,subscriber:e})})}r.timer=n;function c(e){var t=e.index,r=e.period,n=e.subscriber;n.next(t);if(n.closed){return}else if(r===-1){return n.complete()}e.index=t+1;this.schedule(e,r)}},{"../Observable":48,"../scheduler/async":206,"../util/isNumeric":226,"../util/isScheduler":230}],84:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var s=e("./from");var u=e("./empty");function i(o,a){return new n.Observable(function(t){var e;try{e=o()}catch(e){t.error(e);return undefined}var r;try{r=a(e)}catch(e){t.error(e);return undefined}var n=r?s.from(r):u.EMPTY;var i=n.subscribe(t);return function(){i.unsubscribe();if(e){e.unsubscribe()}}})}r.using=i},{"../Observable":48,"./empty":65,"./from":67}],85:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./fromArray");var o=e("../util/isArray");var a=e("../Subscriber");var s=e("../OuterSubscriber");var u=e("../util/subscribeToResult");var c=e("../../internal/symbol/iterator");function l(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=e[e.length-1];if(typeof r==="function"){e.pop()}return i.fromArray(e,undefined).lift(new h(r))}r.zip=l;var h=function(){function e(e){this.resultSelector=e}e.prototype.call=function(e,t){return t.subscribe(new p(e,this.resultSelector))};return e}();r.ZipOperator=h;var p=function(i){n(e,i);function e(e,t,r){if(r===void 0){r=Object.create(null)}var n=i.call(this,e)||this;n.iterators=[];n.active=0;n.resultSelector=typeof t==="function"?t:null;n.values=r;return n}e.prototype._next=function(e){var t=this.iterators;if(o.isArray(e)){t.push(new d(e))}else if(typeof e[c.iterator]==="function"){t.push(new f(e[c.iterator]()))}else{t.push(new v(this.destination,this,e))}};e.prototype._complete=function(){var e=this.iterators;var t=e.length;this.unsubscribe();if(t===0){this.destination.complete();return}this.active=t;for(var r=0;r<t;r++){var n=e[r];if(n.stillUnsubscribed){var i=this.destination;i.add(n.subscribe(n,r))}else{this.active--}}};e.prototype.notifyInactive=function(){this.active--;if(this.active===0){this.destination.complete()}};e.prototype.checkIterators=function(){var e=this.iterators;var t=e.length;var r=this.destination;for(var n=0;n<t;n++){var i=e[n];if(typeof i.hasValue==="function"&&!i.hasValue()){return}}var o=false;var a=[];for(var n=0;n<t;n++){var i=e[n];var s=i.next();if(i.hasCompleted()){o=true}if(s.done){r.complete();return}a.push(s.value)}if(this.resultSelector){this._tryresultSelector(a)}else{r.next(a)}if(o){r.complete()}};e.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){this.destination.error(e);return}this.destination.next(t)};return e}(a.Subscriber);r.ZipSubscriber=p;var f=function(){function e(e){this.iterator=e;this.nextResult=e.next()}e.prototype.hasValue=function(){return true};e.prototype.next=function(){var e=this.nextResult;this.nextResult=this.iterator.next();return e};e.prototype.hasCompleted=function(){var e=this.nextResult;return e&&e.done};return e}();var d=function(){function e(e){this.array=e;this.index=0;this.length=0;this.length=e.length}e.prototype[c.iterator]=function(){return this};e.prototype.next=function(e){var t=this.index++;var r=this.array;return t<this.length?{value:r[t],done:false}:{value:null,done:true}};e.prototype.hasValue=function(){return this.array.length>this.index};e.prototype.hasCompleted=function(){return this.array.length===this.index};return e}();var v=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.parent=t;n.observable=r;n.stillUnsubscribed=true;n.buffer=[];n.isComplete=false;return n}e.prototype[c.iterator]=function(){return this};e.prototype.next=function(){var e=this.buffer;if(e.length===0&&this.isComplete){return{value:null,done:true}}else{return{value:e.shift(),done:false}}};e.prototype.hasValue=function(){return this.buffer.length>0};e.prototype.hasCompleted=function(){return this.buffer.length===0&&this.isComplete};e.prototype.notifyComplete=function(){if(this.buffer.length>0){this.isComplete=true;this.parent.notifyInactive()}else{this.destination.complete()}};e.prototype.notifyNext=function(e,t,r,n,i){this.buffer.push(t);this.parent.checkIterators()};e.prototype.subscribe=function(e,t){return u.subscribeToResult(this,this.observable,this,t)};return e}(s.OuterSubscriber)},{"../../internal/symbol/iterator":208,"../OuterSubscriber":50,"../Subscriber":55,"../util/isArray":220,"../util/subscribeToResult":239,"./fromArray":68}],86:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function a(r){return function e(t){return t.lift(new s(r))}}r.audit=a;var s=function(){function e(e){this.durationSelector=e}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.durationSelector))};return e}();var u=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.durationSelector=t;r.hasValue=false;return r}e.prototype._next=function(e){this.value=e;this.hasValue=true;if(!this.throttled){var t=void 0;try{var r=this.durationSelector;t=r(e)}catch(e){return this.destination.error(e)}var n=o.subscribeToResult(this,t);if(!n||n.closed){this.clearThrottle()}else{this.add(this.throttled=n)}}};e.prototype.clearThrottle=function(){var e=this,t=e.value,r=e.hasValue,n=e.throttled;if(n){this.remove(n);this.throttled=null;n.unsubscribe()}if(r){this.value=null;this.hasValue=false;this.destination.next(t)}};e.prototype.notifyNext=function(e,t,r,n){this.clearThrottle()};e.prototype.notifyComplete=function(){this.clearThrottle()};return e}(n.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],87:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../scheduler/async");var i=e("./audit");var o=e("../observable/timer");function a(e,t){if(t===void 0){t=n.async}return i.audit(function(){return o.timer(e,t)})}r.auditTime=a},{"../observable/timer":83,"../scheduler/async":206,"./audit":86}],88:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function a(r){return function e(t){return t.lift(new s(r))}}r.buffer=a;var s=function(){function e(e){this.closingNotifier=e}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.closingNotifier))};return e}();var u=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.buffer=[];r.add(o.subscribeToResult(r,t));return r}e.prototype._next=function(e){this.buffer.push(e)};e.prototype.notifyNext=function(e,t,r,n,i){var o=this.buffer;this.buffer=[];this.destination.next(o)};return e}(n.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],89:[function(e,t,r){"use strict";var o=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");function i(r,n){if(n===void 0){n=null}return function e(t){return t.lift(new a(r,n))}}r.bufferCount=i;var a=function(){function e(e,t){this.bufferSize=e;this.startBufferEvery=t;if(!t||e===t){this.subscriberClass=s}else{this.subscriberClass=u}}e.prototype.call=function(e,t){return t.subscribe(new this.subscriberClass(e,this.bufferSize,this.startBufferEvery))};return e}();var s=function(n){o(e,n);function e(e,t){var r=n.call(this,e)||this;r.bufferSize=t;r.buffer=[];return r}e.prototype._next=function(e){var t=this.buffer;t.push(e);if(t.length==this.bufferSize){this.destination.next(t);this.buffer=[]}};e.prototype._complete=function(){var e=this.buffer;if(e.length>0){this.destination.next(e)}n.prototype._complete.call(this)};return e}(n.Subscriber);var u=function(i){o(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.bufferSize=t;n.startBufferEvery=r;n.buffers=[];n.count=0;return n}e.prototype._next=function(e){var t=this,r=t.bufferSize,n=t.startBufferEvery,i=t.buffers,o=t.count;this.count++;if(o%n===0){i.push([])}for(var a=i.length;a--;){var s=i[a];s.push(e);if(s.length===r){i.splice(a,1);this.destination.next(s)}}};e.prototype._complete=function(){var e=this,t=e.buffers,r=e.destination;while(t.length>0){var n=t.shift();if(n.length>0){r.next(n)}}i.prototype._complete.call(this)};return e}(n.Subscriber)},{"../Subscriber":55}],90:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var a=e("../scheduler/async");var i=e("../Subscriber");var s=e("../util/isScheduler");function o(r){var e=arguments.length;var n=a.async;if(s.isScheduler(arguments[arguments.length-1])){n=arguments[arguments.length-1];e--}var i=null;if(e>=2){i=arguments[1]}var o=Number.POSITIVE_INFINITY;if(e>=3){o=arguments[2]}return function e(t){return t.lift(new u(r,i,o,n))}}r.bufferTime=o;var u=function(){function e(e,t,r,n){this.bufferTimeSpan=e;this.bufferCreationInterval=t;this.maxBufferSize=r;this.scheduler=n}e.prototype.call=function(e,t){return t.subscribe(new l(e,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))};return e}();var c=function(){function e(){this.buffer=[]}return e}();var l=function(l){n(e,l);function e(e,t,r,n,i){var o=l.call(this,e)||this;o.bufferTimeSpan=t;o.bufferCreationInterval=r;o.maxBufferSize=n;o.scheduler=i;o.contexts=[];var a=o.openContext();o.timespanOnly=r==null||r<0;if(o.timespanOnly){var s={subscriber:o,context:a,bufferTimeSpan:t};o.add(a.closeAction=i.schedule(h,t,s))}else{var u={subscriber:o,context:a};var c={bufferTimeSpan:t,bufferCreationInterval:r,subscriber:o,scheduler:i};o.add(a.closeAction=i.schedule(f,t,u));o.add(i.schedule(p,r,c))}return o}e.prototype._next=function(e){var t=this.contexts;var r=t.length;var n;for(var i=0;i<r;i++){var o=t[i];var a=o.buffer;a.push(e);if(a.length==this.maxBufferSize){n=o}}if(n){this.onBufferFull(n)}};e.prototype._error=function(e){this.contexts.length=0;l.prototype._error.call(this,e)};e.prototype._complete=function(){var e=this,t=e.contexts,r=e.destination;while(t.length>0){var n=t.shift();r.next(n.buffer)}l.prototype._complete.call(this)};e.prototype._unsubscribe=function(){this.contexts=null};e.prototype.onBufferFull=function(e){this.closeContext(e);var t=e.closeAction;t.unsubscribe();this.remove(t);if(!this.closed&&this.timespanOnly){e=this.openContext();var r=this.bufferTimeSpan;var n={subscriber:this,context:e,bufferTimeSpan:r};this.add(e.closeAction=this.scheduler.schedule(h,r,n))}};e.prototype.openContext=function(){var e=new c;this.contexts.push(e);return e};e.prototype.closeContext=function(e){this.destination.next(e.buffer);var t=this.contexts;var r=t?t.indexOf(e):-1;if(r>=0){t.splice(t.indexOf(e),1)}};return e}(i.Subscriber);function h(e){var t=e.subscriber;var r=e.context;if(r){t.closeContext(r)}if(!t.closed){e.context=t.openContext();e.context.closeAction=this.schedule(e,e.bufferTimeSpan)}}function p(e){var t=e.bufferCreationInterval,r=e.bufferTimeSpan,n=e.subscriber,i=e.scheduler;var o=n.openContext();var a=this;if(!n.closed){n.add(o.closeAction=i.schedule(f,r,{subscriber:n,context:o}));a.schedule(e,t)}}function f(e){var t=e.subscriber,r=e.context;t.closeContext(r)}},{"../Subscriber":55,"../scheduler/async":206,"../util/isScheduler":230}],91:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var a=e("../Subscription");var s=e("../util/subscribeToResult");var i=e("../OuterSubscriber");function o(r,n){return function e(t){return t.lift(new u(r,n))}}r.bufferToggle=o;var u=function(){function e(e,t){this.openings=e;this.closingSelector=t}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.openings,this.closingSelector))};return e}();var c=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.openings=t;n.closingSelector=r;n.contexts=[];n.add(s.subscribeToResult(n,t));return n}e.prototype._next=function(e){var t=this.contexts;var r=t.length;for(var n=0;n<r;n++){t[n].buffer.push(e)}};e.prototype._error=function(e){var t=this.contexts;while(t.length>0){var r=t.shift();r.subscription.unsubscribe();r.buffer=null;r.subscription=null}this.contexts=null;i.prototype._error.call(this,e)};e.prototype._complete=function(){var e=this.contexts;while(e.length>0){var t=e.shift();this.destination.next(t.buffer);t.subscription.unsubscribe();t.buffer=null;t.subscription=null}this.contexts=null;i.prototype._complete.call(this)};e.prototype.notifyNext=function(e,t,r,n,i){e?this.closeBuffer(e):this.openBuffer(t)};e.prototype.notifyComplete=function(e){this.closeBuffer(e.context)};e.prototype.openBuffer=function(e){try{var t=this.closingSelector;var r=t.call(this,e);if(r){this.trySubscribe(r)}}catch(e){this._error(e)}};e.prototype.closeBuffer=function(e){var t=this.contexts;if(t&&e){var r=e.buffer,n=e.subscription;this.destination.next(r);t.splice(t.indexOf(e),1);this.remove(n);n.unsubscribe()}};e.prototype.trySubscribe=function(e){var t=this.contexts;var r=[];var n=new a.Subscription;var i={buffer:r,subscription:n};t.push(i);var o=s.subscribeToResult(this,e,i);if(!o||o.closed){this.closeBuffer(i)}else{o.context=i;this.add(o);n.add(o)}};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../Subscription":56,"../util/subscribeToResult":239}],92:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var o=e("../Subscription");var n=e("../OuterSubscriber");var a=e("../util/subscribeToResult");function s(t){return function(e){return e.lift(new u(t))}}r.bufferWhen=s;var u=function(){function e(e){this.closingSelector=e}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.closingSelector))};return e}();var c=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.closingSelector=t;r.subscribing=false;r.openBuffer();return r}e.prototype._next=function(e){this.buffer.push(e)};e.prototype._complete=function(){var e=this.buffer;if(e){this.destination.next(e)}n.prototype._complete.call(this)};e.prototype._unsubscribe=function(){this.buffer=null;this.subscribing=false};e.prototype.notifyNext=function(e,t,r,n,i){this.openBuffer()};e.prototype.notifyComplete=function(){if(this.subscribing){this.complete()}else{this.openBuffer()}};e.prototype.openBuffer=function(){var e=this.closingSubscription;if(e){this.remove(e);e.unsubscribe()}var t=this.buffer;if(this.buffer){this.destination.next(t)}this.buffer=[];var r;try{var n=this.closingSelector;r=n()}catch(e){return this.error(e)}e=new o.Subscription;this.closingSubscription=e;this.add(e);this.subscribing=true;e.add(a.subscribeToResult(this,r));this.subscribing=false};return e}(n.OuterSubscriber)},{"../OuterSubscriber":50,"../Subscription":56,"../util/subscribeToResult":239}],93:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var o=e("../InnerSubscriber");var a=e("../util/subscribeToResult");function s(i){return function e(t){var r=new u(i);var n=t.lift(r);return r.caught=n}}r.catchError=s;var u=function(){function e(e){this.selector=e}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.selector,this.caught))};return e}();var c=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.selector=t;n.caught=r;return n}e.prototype.error=function(e){if(!this.isStopped){var t=void 0;try{t=this.selector(e,this.caught)}catch(e){i.prototype.error.call(this,e);return}this._unsubscribeAndRecycle();var r=new o.InnerSubscriber(this,undefined,undefined);this.add(r);var n=a.subscribeToResult(this,t,undefined,undefined,r);if(n!==r){this.add(n)}}};return e}(i.OuterSubscriber)},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../util/subscribeToResult":239}],94:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/combineLatest");function i(t){return function(e){return e.lift(new n.CombineLatestOperator(t))}}r.combineAll=i},{"../observable/combineLatest":62}],95:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../util/isArray");var i=e("../observable/combineLatest");var o=e("../observable/from");var a={};function s(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}var r=null;if(typeof t[t.length-1]==="function"){r=t.pop()}if(t.length===1&&n.isArray(t[0])){t=t[0].slice()}return function(e){return e.lift.call(o.from([e].concat(t)),new i.CombineLatestOperator(r))}}r.combineLatest=s},{"../observable/combineLatest":62,"../observable/from":67,"../util/isArray":220}],96:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/concat");function i(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}return function(e){return e.lift.call(n.concat.apply(void 0,[e].concat(t)))}}r.concat=i},{"../observable/concat":63}],97:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./mergeAll");function i(){return n.mergeAll(1)}r.concatAll=i},{"./mergeAll":130}],98:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./mergeMap");function i(e,t){return n.mergeMap(e,t,1)}r.concatMap=i},{"./mergeMap":131}],99:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./concatMap");function i(e,t){return n.concatMap(function(){return e},t)}r.concatMapTo=i},{"./concatMap":98}],100:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(t){return function(e){return e.lift(new a(t,e))}}r.count=o;var a=function(){function e(e,t){this.predicate=e;this.source=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.source))};return e}();var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.predicate=t;n.source=r;n.count=0;n.index=0;return n}e.prototype._next=function(e){if(this.predicate){this._tryPredicate(e)}else{this.count++}};e.prototype._tryPredicate=function(e){var t;try{t=this.predicate(e,this.index++,this.source)}catch(e){this.destination.error(e);return}if(t){this.count++}};e.prototype._complete=function(){this.destination.next(this.count);this.destination.complete()};return e}(i.Subscriber)},{"../Subscriber":55}],101:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function a(t){return function(e){return e.lift(new s(t))}}r.debounce=a;var s=function(){function e(e){this.durationSelector=e}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.durationSelector))};return e}();var u=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.durationSelector=t;r.hasValue=false;r.durationSubscription=null;return r}e.prototype._next=function(e){try{var t=this.durationSelector.call(this,e);if(t){this._tryNext(e,t)}}catch(e){this.destination.error(e)}};e.prototype._complete=function(){this.emitValue();this.destination.complete()};e.prototype._tryNext=function(e,t){var r=this.durationSubscription;this.value=e;this.hasValue=true;if(r){r.unsubscribe();this.remove(r)}r=o.subscribeToResult(this,t);if(r&&!r.closed){this.add(this.durationSubscription=r)}};e.prototype.notifyNext=function(e,t,r,n,i){this.emitValue()};e.prototype.notifyComplete=function(){this.emitValue()};e.prototype.emitValue=function(){if(this.hasValue){var e=this.value;var t=this.durationSubscription;if(t){this.durationSubscription=null;t.unsubscribe();this.remove(t)}this.value=null;this.hasValue=false;n.prototype._next.call(this,e)}};return e}(n.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],102:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../scheduler/async");function a(t,r){if(r===void 0){r=o.async}return function(e){return e.lift(new s(t,r))}}r.debounceTime=a;var s=function(){function e(e,t){this.dueTime=e;this.scheduler=t}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.dueTime,this.scheduler))};return e}();var u=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.dueTime=t;n.scheduler=r;n.debouncedSubscription=null;n.lastValue=null;n.hasValue=false;return n}e.prototype._next=function(e){this.clearDebounce();this.lastValue=e;this.hasValue=true;this.add(this.debouncedSubscription=this.scheduler.schedule(c,this.dueTime,this))};e.prototype._complete=function(){this.debouncedNext();this.destination.complete()};e.prototype.debouncedNext=function(){this.clearDebounce();if(this.hasValue){var e=this.lastValue;this.lastValue=null;this.hasValue=false;this.destination.next(e)}};e.prototype.clearDebounce=function(){var e=this.debouncedSubscription;if(e!==null){this.remove(e);e.unsubscribe();this.debouncedSubscription=null}};return e}(i.Subscriber);function c(e){e.debouncedNext()}},{"../Subscriber":55,"../scheduler/async":206}],103:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");function o(t){if(t===void 0){t=null}return function(e){return e.lift(new a(t))}}r.defaultIfEmpty=o;var a=function(){function e(e){this.defaultValue=e}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.defaultValue))};return e}();var s=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.defaultValue=t;r.isEmpty=true;return r}e.prototype._next=function(e){this.isEmpty=false;this.destination.next(e)};e.prototype._complete=function(){if(this.isEmpty){this.destination.next(this.defaultValue)}this.destination.complete()};return e}(n.Subscriber)},{"../Subscriber":55}],104:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../scheduler/async");var o=e("../util/isDate");var a=e("../Subscriber");var s=e("../Notification");function u(e,t){if(t===void 0){t=i.async}var r=o.isDate(e);var n=r?+e-t.now():Math.abs(e);return function(e){return e.lift(new c(n,t))}}r.delay=u;var c=function(){function e(e,t){this.delay=e;this.scheduler=t}e.prototype.call=function(e,t){return t.subscribe(new l(e,this.delay,this.scheduler))};return e}();var l=function(i){n(r,i);function r(e,t,r){var n=i.call(this,e)||this;n.delay=t;n.scheduler=r;n.queue=[];n.active=false;n.errored=false;return n}r.dispatch=function(e){var t=e.source;var r=t.queue;var n=e.scheduler;var i=e.destination;while(r.length>0&&r[0].time-n.now()<=0){r.shift().notification.observe(i)}if(r.length>0){var o=Math.max(0,r[0].time-n.now());this.schedule(e,o)}else{this.unsubscribe();t.active=false}};r.prototype._schedule=function(e){this.active=true;var t=this.destination;t.add(e.schedule(r.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))};r.prototype.scheduleNotification=function(e){if(this.errored===true){return}var t=this.scheduler;var r=new h(t.now()+this.delay,e);this.queue.push(r);if(this.active===false){this._schedule(t)}};r.prototype._next=function(e){this.scheduleNotification(s.Notification.createNext(e))};r.prototype._error=function(e){this.errored=true;this.queue=[];this.destination.error(e);this.unsubscribe()};r.prototype._complete=function(){this.scheduleNotification(s.Notification.createComplete());this.unsubscribe()};return r}(a.Subscriber);var h=function(){function e(e,t){this.time=e;this.notification=t}return e}()},{"../Notification":47,"../Subscriber":55,"../scheduler/async":206,"../util/isDate":222}],105:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");var o=e("../Observable");var a=e("../OuterSubscriber");var s=e("../util/subscribeToResult");function u(t,r){if(r){return function(e){return new h(e,r).lift(new c(t))}}return function(e){return e.lift(new c(t))}}r.delayWhen=u;var c=function(){function e(e){this.delayDurationSelector=e}e.prototype.call=function(e,t){return t.subscribe(new l(e,this.delayDurationSelector))};return e}();var l=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.delayDurationSelector=t;r.completed=false;r.delayNotifierSubscriptions=[];r.index=0;return r}e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(e);this.removeSubscription(i);this.tryComplete()};e.prototype.notifyError=function(e,t){this._error(e)};e.prototype.notifyComplete=function(e){var t=this.removeSubscription(e);if(t){this.destination.next(t)}this.tryComplete()};e.prototype._next=function(e){var t=this.index++;try{var r=this.delayDurationSelector(e,t);if(r){this.tryDelay(r,e)}}catch(e){this.destination.error(e)}};e.prototype._complete=function(){this.completed=true;this.tryComplete();this.unsubscribe()};e.prototype.removeSubscription=function(e){e.unsubscribe();var t=this.delayNotifierSubscriptions.indexOf(e);if(t!==-1){this.delayNotifierSubscriptions.splice(t,1)}return e.outerValue};e.prototype.tryDelay=function(e,t){var r=s.subscribeToResult(this,e,t);if(r&&!r.closed){var n=this.destination;n.add(r);this.delayNotifierSubscriptions.push(r)}};e.prototype.tryComplete=function(){if(this.completed&&this.delayNotifierSubscriptions.length===0){this.destination.complete()}};return e}(a.OuterSubscriber);var h=function(n){i(e,n);function e(e,t){var r=n.call(this)||this;r.source=e;r.subscriptionDelay=t;return r}e.prototype._subscribe=function(e){this.subscriptionDelay.subscribe(new p(e,this.source))};return e}(o.Observable);var p=function(n){i(e,n);function e(e,t){var r=n.call(this)||this;r.parent=e;r.source=t;r.sourceSubscribed=false;return r}e.prototype._next=function(e){this.subscribeToSource()};e.prototype._error=function(e){this.unsubscribe();this.parent.error(e)};e.prototype._complete=function(){this.unsubscribe();this.subscribeToSource()};e.prototype.subscribeToSource=function(){if(!this.sourceSubscribed){this.sourceSubscribed=true;this.unsubscribe();this.source.subscribe(this.parent)}};return e}(n.Subscriber)},{"../Observable":48,"../OuterSubscriber":50,"../Subscriber":55,"../util/subscribeToResult":239}],106:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(){return function e(t){return t.lift(new a)}}r.dematerialize=o;var a=function(){function e(){}e.prototype.call=function(e,t){return t.subscribe(new s(e))};return e}();var s=function(t){n(e,t);function e(e){return t.call(this,e)||this}e.prototype._next=function(e){e.observe(this.destination)};return e}(i.Subscriber)},{"../Subscriber":55}],107:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function a(t,r){return function(e){return e.lift(new s(t,r))}}r.distinct=a;var s=function(){function e(e,t){this.keySelector=e;this.flushes=t}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.keySelector,this.flushes))};return e}();var u=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.keySelector=t;n.values=new Set;if(r){n.add(o.subscribeToResult(n,r))}return n}e.prototype.notifyNext=function(e,t,r,n,i){this.values.clear()};e.prototype.notifyError=function(e,t){this._error(e)};e.prototype._next=function(e){if(this.keySelector){this._useKeySelector(e)}else{this._finalizeNext(e,e)}};e.prototype._useKeySelector=function(e){var t;var r=this.destination;try{t=this.keySelector(e)}catch(e){r.error(e);return}this._finalizeNext(t,e)};e.prototype._finalizeNext=function(e,t){var r=this.values;if(!r.has(e)){r.add(e);this.destination.next(t)}};return e}(i.OuterSubscriber);r.DistinctSubscriber=u},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],108:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(t,r){return function(e){return e.lift(new a(t,r))}}r.distinctUntilChanged=o;var a=function(){function e(e,t){this.compare=e;this.keySelector=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.compare,this.keySelector))};return e}();var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.keySelector=r;n.hasKey=false;if(typeof t==="function"){n.compare=t}return n}e.prototype.compare=function(e,t){return e===t};e.prototype._next=function(e){var t;try{var r=this.keySelector;t=r?r(e):e}catch(e){return this.destination.error(e)}var n=false;if(this.hasKey){try{var i=this.compare;n=i(this.key,t)}catch(e){return this.destination.error(e)}}else{this.hasKey=true}if(!n){this.key=t;this.destination.next(e)}};return e}(i.Subscriber)},{"../Subscriber":55}],109:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("./distinctUntilChanged");function n(r,n){return i.distinctUntilChanged(function(e,t){return n?n(e[r],t[r]):e[r]===t[r]})}r.distinctUntilKeyChanged=n},{"./distinctUntilChanged":108}],110:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../util/ArgumentOutOfRangeError");var o=e("./filter");var a=e("./throwIfEmpty");var s=e("./defaultIfEmpty");var u=e("./take");function n(r,t){if(r<0){throw new i.ArgumentOutOfRangeError}var n=arguments.length>=2;return function(e){return e.pipe(o.filter(function(e,t){return t===r}),u.take(1),n?s.defaultIfEmpty(t):a.throwIfEmpty(function(){return new i.ArgumentOutOfRangeError}))}}r.elementAt=n},{"../util/ArgumentOutOfRangeError":211,"./defaultIfEmpty":103,"./filter":116,"./take":168,"./throwIfEmpty":175}],111:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/concat");var i=e("../observable/of");function o(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}return function(e){return n.concat(e,i.of.apply(void 0,t))}}r.endWith=o},{"../observable/concat":63,"../observable/of":76}],112:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(t,r){return function(e){return e.lift(new a(t,r,e))}}r.every=o;var a=function(){function e(e,t,r){this.predicate=e;this.thisArg=t;this.source=r}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.thisArg,this.source))};return e}();var s=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e)||this;i.predicate=t;i.thisArg=r;i.source=n;i.index=0;i.thisArg=r||i;return i}e.prototype.notifyComplete=function(e){this.destination.next(e);this.destination.complete()};e.prototype._next=function(e){var t=false;try{t=this.predicate.call(this.thisArg,e,this.index++,this.source)}catch(e){this.destination.error(e);return}if(!t){this.notifyComplete(false)}};e.prototype._complete=function(){this.notifyComplete(true)};return e}(i.Subscriber)},{"../Subscriber":55}],113:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function a(){return function(e){return e.lift(new s)}}r.exhaust=a;var s=function(){function e(){}e.prototype.call=function(e,t){return t.subscribe(new u(e))};return e}();var u=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t.hasCompleted=false;t.hasSubscription=false;return t}e.prototype._next=function(e){if(!this.hasSubscription){this.hasSubscription=true;this.add(o.subscribeToResult(this,e))}};e.prototype._complete=function(){this.hasCompleted=true;if(!this.hasSubscription){this.destination.complete()}};e.prototype.notifyComplete=function(e){this.remove(e);this.hasSubscription=false;if(this.hasCompleted){this.destination.complete()}};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],114:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../OuterSubscriber");var a=e("../InnerSubscriber");var s=e("../util/subscribeToResult");var o=e("./map");var u=e("../observable/from");function c(t,i){if(i){return function(e){return e.pipe(c(function(r,n){return u.from(t(r,n)).pipe(o.map(function(e,t){return i(r,e,n,t)}))}))}}return function(e){return e.lift(new l(t))}}r.exhaustMap=c;var l=function(){function e(e){this.project=e}e.prototype.call=function(e,t){return t.subscribe(new h(e,this.project))};return e}();var h=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.project=t;r.hasSubscription=false;r.hasCompleted=false;r.index=0;return r}e.prototype._next=function(e){if(!this.hasSubscription){this.tryNext(e)}};e.prototype.tryNext=function(e){var t;var r=this.index++;try{t=this.project(e,r)}catch(e){this.destination.error(e);return}this.hasSubscription=true;this._innerSub(t,e,r)};e.prototype._innerSub=function(e,t,r){var n=new a.InnerSubscriber(this,t,r);var i=this.destination;i.add(n);var o=s.subscribeToResult(this,e,undefined,undefined,n);if(o!==n){i.add(o)}};e.prototype._complete=function(){this.hasCompleted=true;if(!this.hasSubscription){this.destination.complete()}this.unsubscribe()};e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)};e.prototype.notifyError=function(e){this.destination.error(e)};e.prototype.notifyComplete=function(e){var t=this.destination;t.remove(e);this.hasSubscription=false;if(this.hasCompleted){this.destination.complete()}};return e}(n.OuterSubscriber)},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../observable/from":67,"../util/subscribeToResult":239,"./map":125}],115:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var a=e("../util/subscribeToResult");function o(t,r,n){if(r===void 0){r=Number.POSITIVE_INFINITY}if(n===void 0){n=undefined}r=(r||0)<1?Number.POSITIVE_INFINITY:r;return function(e){return e.lift(new s(t,r,n))}}r.expand=o;var s=function(){function e(e,t,r){this.project=e;this.concurrent=t;this.scheduler=r}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.project,this.concurrent,this.scheduler))};return e}();r.ExpandOperator=s;var u=function(o){n(s,o);function s(e,t,r,n){var i=o.call(this,e)||this;i.project=t;i.concurrent=r;i.scheduler=n;i.index=0;i.active=0;i.hasCompleted=false;if(r<Number.POSITIVE_INFINITY){i.buffer=[]}return i}s.dispatch=function(e){var t=e.subscriber,r=e.result,n=e.value,i=e.index;t.subscribeToProjection(r,n,i)};s.prototype._next=function(e){var t=this.destination;if(t.closed){this._complete();return}var r=this.index++;if(this.active<this.concurrent){t.next(e);try{var n=this.project;var i=n(e,r);if(!this.scheduler){this.subscribeToProjection(i,e,r)}else{var o={subscriber:this,result:i,value:e,index:r};var a=this.destination;a.add(this.scheduler.schedule(s.dispatch,0,o))}}catch(e){t.error(e)}}else{this.buffer.push(e)}};s.prototype.subscribeToProjection=function(e,t,r){this.active++;var n=this.destination;n.add(a.subscribeToResult(this,e,t,r))};s.prototype._complete=function(){this.hasCompleted=true;if(this.hasCompleted&&this.active===0){this.destination.complete()}this.unsubscribe()};s.prototype.notifyNext=function(e,t,r,n,i){this._next(t)};s.prototype.notifyComplete=function(e){var t=this.buffer;var r=this.destination;r.remove(e);this.active--;if(t&&t.length>0){this._next(t.shift())}if(this.hasCompleted&&this.active===0){this.destination.complete()}};return s}(i.OuterSubscriber);r.ExpandSubscriber=u},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],116:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(r,n){return function e(t){return t.lift(new a(r,n))}}r.filter=o;var a=function(){function e(e,t){this.predicate=e;this.thisArg=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.thisArg))};return e}();var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.predicate=t;n.thisArg=r;n.count=0;return n}e.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){this.destination.error(e);return}if(t){this.destination.next(e)}};return e}(i.Subscriber)},{"../Subscriber":55}],117:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");var o=e("../Subscription");function a(t){return function(e){return e.lift(new s(t))}}r.finalize=a;var s=function(){function e(e){this.callback=e}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.callback))};return e}();var u=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.add(new o.Subscription(t));return r}return e}(n.Subscriber)},{"../Subscriber":55,"../Subscription":56}],118:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(t,r){if(typeof t!=="function"){throw new TypeError("predicate is not a function")}return function(e){return e.lift(new a(t,e,false,r))}}r.find=o;var a=function(){function e(e,t,r,n){this.predicate=e;this.source=t;this.yieldIndex=r;this.thisArg=n}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.source,this.yieldIndex,this.thisArg))};return e}();r.FindValueOperator=a;var s=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e)||this;o.predicate=t;o.source=r;o.yieldIndex=n;o.thisArg=i;o.index=0;return o}e.prototype.notifyComplete=function(e){var t=this.destination;t.next(e);t.complete();this.unsubscribe()};e.prototype._next=function(e){var t=this,r=t.predicate,n=t.thisArg;var i=this.index++;try{var o=r.call(n||this,e,i,this.source);if(o){this.notifyComplete(this.yieldIndex?i:e)}}catch(e){this.destination.error(e)}};e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:undefined)};return e}(i.Subscriber);r.FindValueSubscriber=s},{"../Subscriber":55}],119:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../operators/find");function i(t,r){return function(e){return e.lift(new n.FindValueOperator(t,e,true,r))}}r.findIndex=i},{"../operators/find":118}],120:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../util/EmptyError");var o=e("./filter");var a=e("./take");var s=e("./defaultIfEmpty");var u=e("./throwIfEmpty");var c=e("../util/identity");function n(n,e){var t=arguments.length>=2;return function(r){return r.pipe(n?o.filter(function(e,t){return n(e,t,r)}):c.identity,a.take(1),t?s.defaultIfEmpty(e):u.throwIfEmpty(function(){return new i.EmptyError}))}}r.first=n},{"../util/EmptyError":212,"../util/identity":219,"./defaultIfEmpty":103,"./filter":116,"./take":168,"./throwIfEmpty":175}],121:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../Subscription");var a=e("../Observable");var s=e("../Subject");function u(t,r,n,i){return function(e){return e.lift(new c(t,r,n,i))}}r.groupBy=u;var c=function(){function e(e,t,r,n){this.keySelector=e;this.elementSelector=t;this.durationSelector=r;this.subjectSelector=n}e.prototype.call=function(e,t){return t.subscribe(new l(e,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))};return e}();var l=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e)||this;o.keySelector=t;o.elementSelector=r;o.durationSelector=n;o.subjectSelector=i;o.groups=null;o.attemptedToUnsubscribe=false;o.count=0;return o}e.prototype._next=function(e){var t;try{t=this.keySelector(e)}catch(e){this.error(e);return}this._group(e,t)};e.prototype._group=function(e,t){var r=this.groups;if(!r){r=this.groups=new Map}var n=r.get(t);var i;if(this.elementSelector){try{i=this.elementSelector(e)}catch(e){this.error(e)}}else{i=e}if(!n){n=this.subjectSelector?this.subjectSelector():new s.Subject;r.set(t,n);var o=new p(t,n,this);this.destination.next(o);if(this.durationSelector){var a=void 0;try{a=this.durationSelector(new p(t,n))}catch(e){this.error(e);return}this.add(a.subscribe(new h(t,n,this)))}}if(!n.closed){n.next(i)}};e.prototype._error=function(r){var e=this.groups;if(e){e.forEach(function(e,t){e.error(r)});e.clear()}this.destination.error(r)};e.prototype._complete=function(){var e=this.groups;if(e){e.forEach(function(e,t){e.complete()});e.clear()}this.destination.complete()};e.prototype.removeGroup=function(e){this.groups.delete(e)};e.prototype.unsubscribe=function(){if(!this.closed){this.attemptedToUnsubscribe=true;if(this.count===0){a.prototype.unsubscribe.call(this)}}};return e}(i.Subscriber);var h=function(i){n(e,i);function e(e,t,r){var n=i.call(this,t)||this;n.key=e;n.group=t;n.parent=r;return n}e.prototype._next=function(e){this.complete()};e.prototype._unsubscribe=function(){var e=this,t=e.parent,r=e.key;this.key=this.parent=null;if(t){t.removeGroup(r)}};return e}(i.Subscriber);var p=function(i){n(e,i);function e(e,t,r){var n=i.call(this)||this;n.key=e;n.groupSubject=t;n.refCountSubscription=r;return n}e.prototype._subscribe=function(e){var t=new o.Subscription;var r=this,n=r.refCountSubscription,i=r.groupSubject;if(n&&!n.closed){t.add(new f(n))}t.add(i.subscribe(e));return t};return e}(a.Observable);r.GroupedObservable=p;var f=function(r){n(e,r);function e(e){var t=r.call(this)||this;t.parent=e;e.count++;return t}e.prototype.unsubscribe=function(){var e=this.parent;if(!e.closed&&!this.closed){r.prototype.unsubscribe.call(this);e.count-=1;if(e.count===0&&e.attemptedToUnsubscribe){e.unsubscribe()}}};return e}(o.Subscription)},{"../Observable":48,"../Subject":53,"../Subscriber":55,"../Subscription":56}],122:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(){return function e(t){return t.lift(new a)}}r.ignoreElements=o;var a=function(){function e(){}e.prototype.call=function(e,t){return t.subscribe(new s(e))};return e}();var s=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._next=function(e){};return t}(i.Subscriber)},{"../Subscriber":55}],123:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(){return function(e){return e.lift(new a)}}r.isEmpty=o;var a=function(){function e(){}e.prototype.call=function(e,t){return t.subscribe(new s(e))};return e}();var s=function(t){n(e,t);function e(e){return t.call(this,e)||this}e.prototype.notifyComplete=function(e){var t=this.destination;t.next(e);t.complete()};e.prototype._next=function(e){this.notifyComplete(false)};e.prototype._complete=function(){this.notifyComplete(true)};return e}(i.Subscriber)},{"../Subscriber":55}],124:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../util/EmptyError");var o=e("./filter");var a=e("./takeLast");var s=e("./throwIfEmpty");var u=e("./defaultIfEmpty");var c=e("../util/identity");function n(n,e){var t=arguments.length>=2;return function(r){return r.pipe(n?o.filter(function(e,t){return n(e,t,r)}):c.identity,a.takeLast(1),t?u.defaultIfEmpty(e):s.throwIfEmpty(function(){return new i.EmptyError}))}}r.last=n},{"../util/EmptyError":212,"../util/identity":219,"./defaultIfEmpty":103,"./filter":116,"./takeLast":169,"./throwIfEmpty":175}],125:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(r,n){return function e(t){if(typeof r!=="function"){throw new TypeError("argument is not a function. Are you looking for `mapTo()`?")}return t.lift(new a(r,n))}}r.map=o;var a=function(){function e(e,t){this.project=e;this.thisArg=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.project,this.thisArg))};return e}();r.MapOperator=a;var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.project=t;n.count=0;n.thisArg=r||n;return n}e.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){this.destination.error(e);return}this.destination.next(t)};return e}(i.Subscriber)},{"../Subscriber":55}],126:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");function o(t){return function(e){return e.lift(new a(t))}}r.mapTo=o;var a=function(){function e(e){this.value=e}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.value))};return e}();var s=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.value=t;return r}e.prototype._next=function(e){this.destination.next(this.value)};return e}(n.Subscriber)},{"../Subscriber":55}],127:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../Notification");function a(){return function e(t){return t.lift(new s)}}r.materialize=a;var s=function(){function e(){}e.prototype.call=function(e,t){return t.subscribe(new u(e))};return e}();var u=function(t){n(e,t);function e(e){return t.call(this,e)||this}e.prototype._next=function(e){this.destination.next(o.Notification.createNext(e))};e.prototype._error=function(e){var t=this.destination;t.next(o.Notification.createError(e));t.complete()};e.prototype._complete=function(){var e=this.destination;e.next(o.Notification.createComplete());e.complete()};return e}(i.Subscriber)},{"../Notification":47,"../Subscriber":55}],128:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./reduce");function i(r){var e=typeof r==="function"?function(e,t){return r(e,t)>0?e:t}:function(e,t){return e>t?e:t};return n.reduce(e)}r.max=i},{"./reduce":146}],129:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/merge");function i(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}return function(e){return e.lift.call(n.merge.apply(void 0,[e].concat(t)))}}r.merge=i},{"../observable/merge":74}],130:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./mergeMap");var i=e("../util/identity");function o(e){if(e===void 0){e=Number.POSITIVE_INFINITY}return n.mergeMap(i.identity,e)}r.mergeAll=o},{"../util/identity":219,"./mergeMap":131}],131:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var a=e("../util/subscribeToResult");var i=e("../OuterSubscriber");var s=e("../InnerSubscriber");var o=e("./map");var u=e("../observable/from");function c(t,i,r){if(r===void 0){r=Number.POSITIVE_INFINITY}if(typeof i==="function"){return function(e){return e.pipe(c(function(r,n){return u.from(t(r,n)).pipe(o.map(function(e,t){return i(r,e,n,t)}))},r))}}else if(typeof i==="number"){r=i}return function(e){return e.lift(new l(t,r))}}r.mergeMap=c;var l=function(){function e(e,t){if(t===void 0){t=Number.POSITIVE_INFINITY}this.project=e;this.concurrent=t}e.prototype.call=function(e,t){return t.subscribe(new h(e,this.project,this.concurrent))};return e}();r.MergeMapOperator=l;var h=function(i){n(e,i);function e(e,t,r){if(r===void 0){r=Number.POSITIVE_INFINITY}var n=i.call(this,e)||this;n.project=t;n.concurrent=r;n.hasCompleted=false;n.buffer=[];n.active=0;n.index=0;return n}e.prototype._next=function(e){if(this.active<this.concurrent){this._tryNext(e)}else{this.buffer.push(e)}};e.prototype._tryNext=function(e){var t;var r=this.index++;try{t=this.project(e,r)}catch(e){this.destination.error(e);return}this.active++;this._innerSub(t,e,r)};e.prototype._innerSub=function(e,t,r){var n=new s.InnerSubscriber(this,t,r);var i=this.destination;i.add(n);var o=a.subscribeToResult(this,e,undefined,undefined,n);if(o!==n){i.add(o)}};e.prototype._complete=function(){this.hasCompleted=true;if(this.active===0&&this.buffer.length===0){this.destination.complete()}this.unsubscribe()};e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)};e.prototype.notifyComplete=function(e){var t=this.buffer;this.remove(e);this.active--;if(t.length>0){this._next(t.shift())}else if(this.active===0&&this.hasCompleted){this.destination.complete()}};return e}(i.OuterSubscriber);r.MergeMapSubscriber=h},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../observable/from":67,"../util/subscribeToResult":239,"./map":125}],132:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./mergeMap");function i(e,t,r){if(r===void 0){r=Number.POSITIVE_INFINITY}if(typeof t==="function"){return n.mergeMap(function(){return e},t,r)}if(typeof t==="number"){r=t}return n.mergeMap(function(){return e},r)}r.mergeMapTo=i},{"./mergeMap":131}],133:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var a=e("../util/subscribeToResult");var i=e("../OuterSubscriber");var s=e("../InnerSubscriber");function o(t,r,n){if(n===void 0){n=Number.POSITIVE_INFINITY}return function(e){return e.lift(new u(t,r,n))}}r.mergeScan=o;var u=function(){function e(e,t,r){this.accumulator=e;this.seed=t;this.concurrent=r}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.accumulator,this.seed,this.concurrent))};return e}();r.MergeScanOperator=u;var c=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e)||this;i.accumulator=t;i.acc=r;i.concurrent=n;i.hasValue=false;i.hasCompleted=false;i.buffer=[];i.active=0;i.index=0;return i}e.prototype._next=function(e){if(this.active<this.concurrent){var t=this.index++;var r=this.destination;var n=void 0;try{var i=this.accumulator;n=i(this.acc,e,t)}catch(e){return r.error(e)}this.active++;this._innerSub(n,e,t)}else{this.buffer.push(e)}};e.prototype._innerSub=function(e,t,r){var n=new s.InnerSubscriber(this,t,r);var i=this.destination;i.add(n);var o=a.subscribeToResult(this,e,undefined,undefined,n);if(o!==n){i.add(o)}};e.prototype._complete=function(){this.hasCompleted=true;if(this.active===0&&this.buffer.length===0){if(this.hasValue===false){this.destination.next(this.acc)}this.destination.complete()}this.unsubscribe()};e.prototype.notifyNext=function(e,t,r,n,i){var o=this.destination;this.acc=t;this.hasValue=true;o.next(t)};e.prototype.notifyComplete=function(e){var t=this.buffer;var r=this.destination;r.remove(e);this.active--;if(t.length>0){this._next(t.shift())}else if(this.active===0&&this.hasCompleted){if(this.hasValue===false){this.destination.next(this.acc)}this.destination.complete()}};return e}(i.OuterSubscriber);r.MergeScanSubscriber=c},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../util/subscribeToResult":239}],134:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./reduce");function i(r){var e=typeof r==="function"?function(e,t){return r(e,t)<0?e:t}:function(e,t){return e<t?e:t};return n.reduce(e)}r.min=i},{"./reduce":146}],135:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var a=e("../observable/ConnectableObservable");function n(i,o){return function e(t){var r;if(typeof i==="function"){r=i}else{r=function e(){return i}}if(typeof o==="function"){return t.lift(new s(r,o))}var n=Object.create(t,a.connectableObservableDescriptor);n.source=t;n.subjectFactory=r;return n}}r.multicast=n;var s=function(){function e(e,t){this.subjectFactory=e;this.selector=t}e.prototype.call=function(e,t){var r=this.selector;var n=this.subjectFactory();var i=r(n).subscribe(e);i.add(t.subscribe(n));return i};return e}();r.MulticastOperator=s},{"../observable/ConnectableObservable":58}],136:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../Notification");function a(r,n){if(n===void 0){n=0}return function e(t){return t.lift(new s(r,n))}}r.observeOn=a;var s=function(){function e(e,t){if(t===void 0){t=0}this.scheduler=e;this.delay=t}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.scheduler,this.delay))};return e}();r.ObserveOnOperator=s;var u=function(i){n(r,i);function r(e,t,r){if(r===void 0){r=0}var n=i.call(this,e)||this;n.scheduler=t;n.delay=r;return n}r.dispatch=function(e){var t=e.notification,r=e.destination;t.observe(r);this.unsubscribe()};r.prototype.scheduleMessage=function(e){var t=this.destination;t.add(this.scheduler.schedule(r.dispatch,this.delay,new c(e,this.destination)))};r.prototype._next=function(e){this.scheduleMessage(o.Notification.createNext(e))};r.prototype._error=function(e){this.scheduleMessage(o.Notification.createError(e));this.unsubscribe()};r.prototype._complete=function(){this.scheduleMessage(o.Notification.createComplete());this.unsubscribe()};return r}(i.Subscriber);r.ObserveOnSubscriber=u;var c=function(){function e(e,t){this.notification=e;this.destination=t}return e}();r.ObserveOnMessage=c},{"../Notification":47,"../Subscriber":55}],137:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/from");var o=e("../util/isArray");var a=e("../OuterSubscriber");var s=e("../InnerSubscriber");var u=e("../util/subscribeToResult");function c(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}if(t.length===1&&o.isArray(t[0])){t=t[0]}return function(e){return e.lift(new h(t))}}r.onErrorResumeNext=c;function l(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var r=null;if(e.length===1&&o.isArray(e[0])){e=e[0]}r=e.shift();return n.from(r,null).lift(new h(e))}r.onErrorResumeNextStatic=l;var h=function(){function e(e){this.nextSources=e}e.prototype.call=function(e,t){return t.subscribe(new p(e,this.nextSources))};return e}();var p=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.destination=e;r.nextSources=t;return r}e.prototype.notifyError=function(e,t){this.subscribeToNextSource()};e.prototype.notifyComplete=function(e){this.subscribeToNextSource()};e.prototype._error=function(e){this.subscribeToNextSource();this.unsubscribe()};e.prototype._complete=function(){this.subscribeToNextSource();this.unsubscribe()};e.prototype.subscribeToNextSource=function(){var e=this.nextSources.shift();if(!!e){var t=new s.InnerSubscriber(this,undefined,undefined);var r=this.destination;r.add(t);var n=u.subscribeToResult(this,e,undefined,undefined,t);if(n!==t){r.add(n)}}else{this.destination.complete()}};return e}(a.OuterSubscriber)},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../observable/from":67,"../util/isArray":220,"../util/subscribeToResult":239}],138:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(){return function(e){return e.lift(new a)}}r.pairwise=o;var a=function(){function e(){}e.prototype.call=function(e,t){return t.subscribe(new s(e))};return e}();var s=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t.hasPrev=false;return t}e.prototype._next=function(e){var t;if(this.hasPrev){t=[this.prev,e]}else{this.hasPrev=true}this.prev=e;if(t){this.destination.next(t)}};return e}(i.Subscriber)},{"../Subscriber":55}],139:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../util/not");var i=e("./filter");function o(t,r){return function(e){return[i.filter(t,r)(e),i.filter(n.not(t,r))(e)]}}r.partition=o},{"../util/not":232,"./filter":116}],140:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./map");function i(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}var r=t.length;if(r===0){throw new Error("list of properties cannot be empty.")}return function(e){return n.map(o(t,r))(e)}}r.pluck=i;function o(i,o){var e=function(e){var t=e;for(var r=0;r<o;r++){var n=t[i[r]];if(typeof n!=="undefined"){t=n}else{return undefined}}return t};return e}},{"./map":125}],141:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subject");var i=e("./multicast");function o(e){return e?i.multicast(function(){return new n.Subject},e):i.multicast(new n.Subject)}r.publish=o},{"../Subject":53,"./multicast":135}],142:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../BehaviorSubject");var i=e("./multicast");function o(t){return function(e){return i.multicast(new n.BehaviorSubject(t))(e)}}r.publishBehavior=o},{"../BehaviorSubject":45,"./multicast":135}],143:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../AsyncSubject");var i=e("./multicast");function o(){return function(e){return i.multicast(new n.AsyncSubject)(e)}}r.publishLast=o},{"../AsyncSubject":44,"./multicast":135}],144:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var a=e("../ReplaySubject");var s=e("./multicast");function n(e,t,r,n){if(r&&typeof r!=="function"){n=r}var i=typeof r==="function"?r:undefined;var o=new a.ReplaySubject(e,t,n);return function(e){return s.multicast(function(){return o},i)(e)}}r.publishReplay=n},{"../ReplaySubject":51,"./multicast":135}],145:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../util/isArray");var i=e("../observable/race");function o(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}return function e(t){if(r.length===1&&n.isArray(r[0])){r=r[0]}return t.lift.call(i.race.apply(void 0,[t].concat(r)))}}r.race=o},{"../observable/race":80,"../util/isArray":220}],146:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("./scan");var o=e("./takeLast");var a=e("./defaultIfEmpty");var s=e("../util/pipe");function n(n,r){if(arguments.length>=2){return function e(t){return s.pipe(i.scan(n,r),o.takeLast(1),a.defaultIfEmpty(r))(t)}}return function e(t){return s.pipe(i.scan(function(e,t,r){return n(e,t,r+1)}),o.takeLast(1))(t)}}r.reduce=n},{"../util/pipe":233,"./defaultIfEmpty":103,"./scan":154,"./takeLast":169}],147:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");function o(){return function e(t){return t.lift(new a(t))}}r.refCount=o;var a=function(){function e(e){this.connectable=e}e.prototype.call=function(e,t){var r=this.connectable;r._refCount++;var n=new s(e,r);var i=t.subscribe(n);if(!n.closed){n.connection=r.connect()}return i};return e}();var s=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.connectable=t;return r}e.prototype._unsubscribe=function(){var e=this.connectable;if(!e){this.connection=null;return}this.connectable=null;var t=e._refCount;if(t<=0){this.connection=null;return}e._refCount=t-1;if(t>1){this.connection=null;return}var r=this.connection;var n=e._connection;this.connection=null;if(n&&(!r||n===r)){n.unsubscribe()}};return e}(n.Subscriber)},{"../Subscriber":55}],148:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../observable/empty");function a(t){if(t===void 0){t=-1}return function(e){if(t===0){return o.empty()}else if(t<0){return e.lift(new s(-1,e))}else{return e.lift(new s(t-1,e))}}}r.repeat=a;var s=function(){function e(e,t){this.count=e;this.source=t}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.count,this.source))};return e}();var u=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.count=t;n.source=r;return n}e.prototype.complete=function(){if(!this.isStopped){var e=this,t=e.source,r=e.count;if(r===0){return i.prototype.complete.call(this)}else if(r>-1){this.count=r-1}t.subscribe(this._unsubscribeAndRecycle())}};return e}(i.Subscriber)},{"../Subscriber":55,"../observable/empty":65}],149:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var o=e("../Subject");var i=e("../OuterSubscriber");var a=e("../util/subscribeToResult");function s(t){return function(e){return e.lift(new u(t))}}r.repeatWhen=s;var u=function(){function e(e){this.notifier=e}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.notifier,t))};return e}();var c=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.notifier=t;n.source=r;n.sourceIsBeingSubscribedTo=true;return n}e.prototype.notifyNext=function(e,t,r,n,i){this.sourceIsBeingSubscribedTo=true;this.source.subscribe(this)};e.prototype.notifyComplete=function(e){if(this.sourceIsBeingSubscribedTo===false){return i.prototype.complete.call(this)}};e.prototype.complete=function(){this.sourceIsBeingSubscribedTo=false;if(!this.isStopped){if(!this.retries){this.subscribeToRetries()}if(!this.retriesSubscription||this.retriesSubscription.closed){return i.prototype.complete.call(this)}this._unsubscribeAndRecycle();this.notifications.next()}};e.prototype._unsubscribe=function(){var e=this,t=e.notifications,r=e.retriesSubscription;if(t){t.unsubscribe();this.notifications=null}if(r){r.unsubscribe();this.retriesSubscription=null}this.retries=null};e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;this._unsubscribe=null;i.prototype._unsubscribeAndRecycle.call(this);this._unsubscribe=e;return this};e.prototype.subscribeToRetries=function(){this.notifications=new o.Subject;var e;try{var t=this.notifier;e=t(this.notifications)}catch(e){return i.prototype.complete.call(this)}this.retries=e;this.retriesSubscription=a.subscribeToResult(this,e)};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../Subject":53,"../util/subscribeToResult":239}],150:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(t){if(t===void 0){t=-1}return function(e){return e.lift(new a(t,e))}}r.retry=o;var a=function(){function e(e,t){this.count=e;this.source=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.count,this.source))};return e}();var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.count=t;n.source=r;return n}e.prototype.error=function(e){if(!this.isStopped){var t=this,r=t.source,n=t.count;if(n===0){return i.prototype.error.call(this,e)}else if(n>-1){this.count=n-1}r.subscribe(this._unsubscribeAndRecycle())}};return e}(i.Subscriber)},{"../Subscriber":55}],151:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var a=e("../Subject");var i=e("../OuterSubscriber");var s=e("../util/subscribeToResult");function o(t){return function(e){return e.lift(new u(t,e))}}r.retryWhen=o;var u=function(){function e(e,t){this.notifier=e;this.source=t}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.notifier,this.source))};return e}();var c=function(o){n(e,o);function e(e,t,r){var n=o.call(this,e)||this;n.notifier=t;n.source=r;return n}e.prototype.error=function(e){if(!this.isStopped){var t=this.errors;var r=this.retries;var n=this.retriesSubscription;if(!r){t=new a.Subject;try{var i=this.notifier;r=i(t)}catch(e){return o.prototype.error.call(this,e)}n=s.subscribeToResult(this,r)}else{this.errors=null;this.retriesSubscription=null}this._unsubscribeAndRecycle();this.errors=t;this.retries=r;this.retriesSubscription=n;t.next(e)}};e.prototype._unsubscribe=function(){var e=this,t=e.errors,r=e.retriesSubscription;if(t){t.unsubscribe();this.errors=null}if(r){r.unsubscribe();this.retriesSubscription=null}this.retries=null};e.prototype.notifyNext=function(e,t,r,n,i){var o=this._unsubscribe;this._unsubscribe=null;this._unsubscribeAndRecycle();this._unsubscribe=o;this.source.subscribe(this)};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../Subject":53,"../util/subscribeToResult":239}],152:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function a(t){return function(e){return e.lift(new s(t))}}r.sample=a;var s=function(){function e(e){this.notifier=e}e.prototype.call=function(e,t){var r=new u(e);var n=t.subscribe(r);n.add(o.subscribeToResult(r,this.notifier));return n};return e}();var u=function(t){n(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e.hasValue=false;return e}e.prototype._next=function(e){this.value=e;this.hasValue=true};e.prototype.notifyNext=function(e,t,r,n,i){this.emitValue()};e.prototype.notifyComplete=function(){this.emitValue()};e.prototype.emitValue=function(){if(this.hasValue){this.hasValue=false;this.destination.next(this.value)}};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],153:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../scheduler/async");function a(t,r){if(r===void 0){r=o.async}return function(e){return e.lift(new s(t,r))}}r.sampleTime=a;var s=function(){function e(e,t){this.period=e;this.scheduler=t}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.period,this.scheduler))};return e}();var u=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.period=t;n.scheduler=r;n.hasValue=false;n.add(r.schedule(c,t,{subscriber:n,period:t}));return n}e.prototype._next=function(e){this.lastValue=e;this.hasValue=true};e.prototype.notifyNext=function(){if(this.hasValue){this.hasValue=false;this.destination.next(this.lastValue)}};return e}(i.Subscriber);function c(e){var t=e.subscriber,r=e.period;t.notifyNext();this.schedule(e,r)}},{"../Subscriber":55,"../scheduler/async":206}],154:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(r,n){var i=false;if(arguments.length>=2){i=true}return function e(t){return t.lift(new a(r,n,i))}}r.scan=o;var a=function(){function e(e,t,r){if(r===void 0){r=false}this.accumulator=e;this.seed=t;this.hasSeed=r}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.accumulator,this.seed,this.hasSeed))};return e}();var s=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e)||this;i.accumulator=t;i._seed=r;i.hasSeed=n;i.index=0;return i}Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=true;this._seed=e},enumerable:true,configurable:true});e.prototype._next=function(e){if(!this.hasSeed){this.seed=e;this.destination.next(e)}else{return this._tryNext(e)}};e.prototype._tryNext=function(e){var t=this.index++;var r;try{r=this.accumulator(this.seed,e,t)}catch(e){this.destination.error(e)}this.seed=r;this.destination.next(r)};return e}(i.Subscriber)},{"../Subscriber":55}],155:[function(e,t,r){"use strict";var o=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");function i(t,r){return function(e){return e.lift(new a(t,r))}}r.sequenceEqual=i;var a=function(){function e(e,t){this.compareTo=e;this.comparator=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.compareTo,this.comparator))};return e}();r.SequenceEqualOperator=a;var s=function(i){o(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.compareTo=t;n.comparator=r;n._a=[];n._b=[];n._oneComplete=false;n.destination.add(t.subscribe(new u(e,n)));return n}e.prototype._next=function(e){if(this._oneComplete&&this._b.length===0){this.emit(false)}else{this._a.push(e);this.checkValues()}};e.prototype._complete=function(){if(this._oneComplete){this.emit(this._a.length===0&&this._b.length===0)}else{this._oneComplete=true}this.unsubscribe()};e.prototype.checkValues=function(){var e=this,t=e._a,r=e._b,n=e.comparator;while(t.length>0&&r.length>0){var i=t.shift();var o=r.shift();var a=false;try{a=n?n(i,o):i===o}catch(e){this.destination.error(e)}if(!a){this.emit(false)}}};e.prototype.emit=function(e){var t=this.destination;t.next(e);t.complete()};e.prototype.nextB=function(e){if(this._oneComplete&&this._a.length===0){this.emit(false)}else{this._b.push(e);this.checkValues()}};e.prototype.completeB=function(){if(this._oneComplete){this.emit(this._a.length===0&&this._b.length===0)}else{this._oneComplete=true}};return e}(n.Subscriber);r.SequenceEqualSubscriber=s;var u=function(n){o(e,n);function e(e,t){var r=n.call(this,e)||this;r.parent=t;return r}e.prototype._next=function(e){this.parent.nextB(e)};e.prototype._error=function(e){this.parent.error(e);this.unsubscribe()};e.prototype._complete=function(){this.parent.completeB();this.unsubscribe()};return e}(n.Subscriber)},{"../Subscriber":55}],156:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./multicast");var i=e("./refCount");var o=e("../Subject");function a(){return new o.Subject}function s(){return function(e){return i.refCount()(n.multicast(a)(e))}}r.share=s},{"../Subject":53,"./multicast":135,"./refCount":147}],157:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var p=e("../ReplaySubject");function n(e,t,r){var n;if(e&&typeof e==="object"){n=e}else{n={bufferSize:e,windowTime:t,refCount:false,scheduler:r}}return function(e){return e.lift(i(n))}}r.shareReplay=n;function i(e){var t=e.bufferSize,n=t===void 0?Number.POSITIVE_INFINITY:t,r=e.windowTime,i=r===void 0?Number.POSITIVE_INFINITY:r,o=e.refCount,a=e.scheduler;var s;var u=0;var c;var l=false;var h=false;return function e(t){u++;if(!s||l){l=false;s=new p.ReplaySubject(n,i,a);c=t.subscribe({next:function(e){s.next(e)},error:function(e){l=true;s.error(e)},complete:function(){h=true;c=undefined;s.complete()}})}var r=s.subscribe(this);this.add(function(){u--;r.unsubscribe();if(c&&!h&&o&&u===0){c.unsubscribe();c=undefined;s=undefined}})}}},{"../ReplaySubject":51}],158:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../util/EmptyError");function a(t){return function(e){return e.lift(new s(t,e))}}r.single=a;var s=function(){function e(e,t){this.predicate=e;this.source=t}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.predicate,this.source))};return e}();var u=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.predicate=t;n.source=r;n.seenValue=false;n.index=0;return n}e.prototype.applySingleValue=function(e){if(this.seenValue){this.destination.error("Sequence contains more than one element")}else{this.seenValue=true;this.singleValue=e}};e.prototype._next=function(e){var t=this.index++;if(this.predicate){this.tryNext(e,t)}else{this.applySingleValue(e)}};e.prototype.tryNext=function(e,t){try{if(this.predicate(e,t,this.source)){this.applySingleValue(e)}}catch(e){this.destination.error(e)}};e.prototype._complete=function(){var e=this.destination;if(this.index>0){e.next(this.seenValue?this.singleValue:undefined);e.complete()}else{e.error(new o.EmptyError)}};return e}(i.Subscriber)},{"../Subscriber":55,"../util/EmptyError":212}],159:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");function o(t){return function(e){return e.lift(new a(t))}}r.skip=o;var a=function(){function e(e){this.total=e}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.total))};return e}();var s=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.total=t;r.count=0;return r}e.prototype._next=function(e){if(++this.count>this.total){this.destination.next(e)}};return e}(n.Subscriber)},{"../Subscriber":55}],160:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");var o=e("../util/ArgumentOutOfRangeError");function a(t){return function(e){return e.lift(new s(t))}}r.skipLast=a;var s=function(){function e(e){this._skipCount=e;if(this._skipCount<0){throw new o.ArgumentOutOfRangeError}}e.prototype.call=function(e,t){if(this._skipCount===0){return t.subscribe(new n.Subscriber(e))}else{return t.subscribe(new u(e,this._skipCount))}};return e}();var u=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r._skipCount=t;r._count=0;r._ring=new Array(t);return r}e.prototype._next=function(e){var t=this._skipCount;var r=this._count++;if(r<t){this._ring[r]=e}else{var n=r%t;var i=this._ring;var o=i[n];i[n]=e;this.destination.next(o)}};return e}(n.Subscriber)},{"../Subscriber":55,"../util/ArgumentOutOfRangeError":211}],161:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var a=e("../InnerSubscriber");var s=e("../util/subscribeToResult");function o(t){return function(e){return e.lift(new u(t))}}r.skipUntil=o;var u=function(){function e(e){this.notifier=e}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.notifier))};return e}();var c=function(o){n(e,o);function e(e,t){var r=o.call(this,e)||this;r.hasValue=false;var n=new a.InnerSubscriber(r,undefined,undefined);r.add(n);r.innerSubscription=n;var i=s.subscribeToResult(r,t,undefined,undefined,n);if(i!==n){r.add(i);r.innerSubscription=i}return r}e.prototype._next=function(e){if(this.hasValue){o.prototype._next.call(this,e)}};e.prototype.notifyNext=function(e,t,r,n,i){this.hasValue=true;if(this.innerSubscription){this.innerSubscription.unsubscribe()}};e.prototype.notifyComplete=function(){};return e}(i.OuterSubscriber)},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../util/subscribeToResult":239}],162:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");function o(t){return function(e){return e.lift(new a(t))}}r.skipWhile=o;var a=function(){function e(e){this.predicate=e}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate))};return e}();var s=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.predicate=t;r.skipping=true;r.index=0;return r}e.prototype._next=function(e){var t=this.destination;if(this.skipping){this.tryCallPredicate(e)}if(!this.skipping){t.next(e)}};e.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}};return e}(n.Subscriber)},{"../Subscriber":55}],163:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/concat");var i=e("../util/isScheduler");function o(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}var r=t[t.length-1];if(i.isScheduler(r)){t.pop();return function(e){return n.concat(t,e,r)}}else{return function(e){return n.concat(t,e)}}}r.startWith=o},{"../observable/concat":63,"../util/isScheduler":230}],164:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/SubscribeOnObservable");function i(r,n){if(n===void 0){n=0}return function e(t){return t.lift(new o(r,n))}}r.subscribeOn=i;var o=function(){function e(e,t){this.scheduler=e;this.delay=t}e.prototype.call=function(e,t){return new n.SubscribeOnObservable(t,this.delay,this.scheduler).subscribe(e)};return e}()},{"../observable/SubscribeOnObservable":59}],165:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./switchMap");var i=e("../util/identity");function o(){return n.switchMap(i.identity)}r.switchAll=o},{"../util/identity":219,"./switchMap":166}],166:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../OuterSubscriber");var a=e("../InnerSubscriber");var s=e("../util/subscribeToResult");var o=e("./map");var u=e("../observable/from");function c(t,i){if(typeof i==="function"){return function(e){return e.pipe(c(function(r,n){return u.from(t(r,n)).pipe(o.map(function(e,t){return i(r,e,n,t)}))}))}}return function(e){return e.lift(new l(t))}}r.switchMap=c;var l=function(){function e(e){this.project=e}e.prototype.call=function(e,t){return t.subscribe(new h(e,this.project))};return e}();var h=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.project=t;r.index=0;return r}e.prototype._next=function(e){var t;var r=this.index++;try{t=this.project(e,r)}catch(e){this.destination.error(e);return}this._innerSub(t,e,r)};e.prototype._innerSub=function(e,t,r){var n=this.innerSubscription;if(n){n.unsubscribe()}var i=new a.InnerSubscriber(this,t,r);var o=this.destination;o.add(i);this.innerSubscription=s.subscribeToResult(this,e,undefined,undefined,i);if(this.innerSubscription!==i){o.add(this.innerSubscription)}};e.prototype._complete=function(){var e=this.innerSubscription;if(!e||e.closed){n.prototype._complete.call(this)}this.unsubscribe()};e.prototype._unsubscribe=function(){this.innerSubscription=null};e.prototype.notifyComplete=function(e){var t=this.destination;t.remove(e);this.innerSubscription=null;if(this.isStopped){n.prototype._complete.call(this)}};e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)};return e}(n.OuterSubscriber)},{"../InnerSubscriber":46,"../OuterSubscriber":50,"../observable/from":67,"../util/subscribeToResult":239,"./map":125}],167:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./switchMap");function i(e,t){return t?n.switchMap(function(){return e},t):n.switchMap(function(){return e})}r.switchMapTo=i},{"./switchMap":166}],168:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");var o=e("../util/ArgumentOutOfRangeError");var a=e("../observable/empty");function s(t){return function(e){if(t===0){return a.empty()}else{return e.lift(new u(t))}}}r.take=s;var u=function(){function e(e){this.total=e;if(this.total<0){throw new o.ArgumentOutOfRangeError}}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.total))};return e}();var c=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.total=t;r.count=0;return r}e.prototype._next=function(e){var t=this.total;var r=++this.count;if(r<=t){this.destination.next(e);if(r===t){this.destination.complete();this.unsubscribe()}}};return e}(n.Subscriber)},{"../Subscriber":55,"../observable/empty":65,"../util/ArgumentOutOfRangeError":211}],169:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");var o=e("../util/ArgumentOutOfRangeError");var a=e("../observable/empty");function s(r){return function e(t){if(r===0){return a.empty()}else{return t.lift(new u(r))}}}r.takeLast=s;var u=function(){function e(e){this.total=e;if(this.total<0){throw new o.ArgumentOutOfRangeError}}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.total))};return e}();var c=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.total=t;r.ring=new Array;r.count=0;return r}e.prototype._next=function(e){var t=this.ring;var r=this.total;var n=this.count++;if(t.length<r){t.push(e)}else{var i=n%r;t[i]=e}};e.prototype._complete=function(){var e=this.destination;var t=this.count;if(t>0){var r=this.count>=this.total?this.total:this.count;var n=this.ring;for(var i=0;i<r;i++){var o=t++%r;e.next(n[o])}}e.complete()};return e}(n.Subscriber)},{"../Subscriber":55,"../observable/empty":65,"../util/ArgumentOutOfRangeError":211}],170:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function a(t){return function(e){return e.lift(new s(t))}}r.takeUntil=a;var s=function(){function e(e){this.notifier=e}e.prototype.call=function(e,t){var r=new u(e);var n=o.subscribeToResult(r,this.notifier);if(n&&!r.seenValue){r.add(n);return t.subscribe(r)}return r};return e}();var u=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t.seenValue=false;return t}e.prototype.notifyNext=function(e,t,r,n,i){this.seenValue=true;this.complete()};e.prototype.notifyComplete=function(){};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],171:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");function o(t,r){if(r===void 0){r=false}return function(e){return e.lift(new a(t,r))}}r.takeWhile=o;var a=function(){function e(e,t){this.predicate=e;this.inclusive=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.inclusive))};return e}();var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.predicate=t;n.inclusive=r;n.index=0;return n}e.prototype._next=function(e){var t=this.destination;var r;try{r=this.predicate(e,this.index++)}catch(e){t.error(e);return}this.nextOrComplete(e,r)};e.prototype.nextOrComplete=function(e,t){var r=this.destination;if(Boolean(t)){r.next(e)}else{if(this.inclusive){r.next(e)}r.complete()}};return e}(i.Subscriber)},{"../Subscriber":55}],172:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var a=e("../util/noop");var s=e("../util/isFunction");function o(r,n,i){return function e(t){return t.lift(new u(r,n,i))}}r.tap=o;var u=function(){function e(e,t,r){this.nextOrObserver=e;this.error=t;this.complete=r}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.nextOrObserver,this.error,this.complete))};return e}();var c=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e)||this;i._tapNext=a.noop;i._tapError=a.noop;i._tapComplete=a.noop;i._tapError=r||a.noop;i._tapComplete=n||a.noop;if(s.isFunction(t)){i._context=i;i._tapNext=t}else if(t){i._context=t;i._tapNext=t.next||a.noop;i._tapError=t.error||a.noop;i._tapComplete=t.complete||a.noop}return i}e.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){this.destination.error(e);return}this.destination.next(e)};e.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){this.destination.error(e);return}this.destination.error(e)};e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){this.destination.error(e);return}return this.destination.complete()};return e}(i.Subscriber)},{"../Subscriber":55,"../util/isFunction":223,"../util/noop":231}],173:[function(e,t,n){"use strict";var r=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(n,"__esModule",{value:true});var i=e("../OuterSubscriber");var a=e("../util/subscribeToResult");n.defaultThrottleConfig={leading:true,trailing:false};function o(t,r){if(r===void 0){r=n.defaultThrottleConfig}return function(e){return e.lift(new s(t,r.leading,r.trailing))}}n.throttle=o;var s=function(){function e(e,t,r){this.durationSelector=e;this.leading=t;this.trailing=r}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.durationSelector,this.leading,this.trailing))};return e}();var u=function(o){r(e,o);function e(e,t,r,n){var i=o.call(this,e)||this;i.destination=e;i.durationSelector=t;i._leading=r;i._trailing=n;i._hasValue=false;return i}e.prototype._next=function(e){this._hasValue=true;this._sendValue=e;if(!this._throttled){if(this._leading){this.send()}else{this.throttle(e)}}};e.prototype.send=function(){var e=this,t=e._hasValue,r=e._sendValue;if(t){this.destination.next(r);this.throttle(r)}this._hasValue=false;this._sendValue=null};e.prototype.throttle=function(e){var t=this.tryDurationSelector(e);if(!!t){this.add(this._throttled=a.subscribeToResult(this,t))}};e.prototype.tryDurationSelector=function(e){try{return this.durationSelector(e)}catch(e){this.destination.error(e);return null}};e.prototype.throttlingDone=function(){var e=this,t=e._throttled,r=e._trailing;if(t){t.unsubscribe()}this._throttled=null;if(r){this.send()}};e.prototype.notifyNext=function(e,t,r,n,i){this.throttlingDone()};e.prototype.notifyComplete=function(){this.throttlingDone()};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],174:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var o=e("../scheduler/async");var a=e("./throttle");function s(t,r,n){if(r===void 0){r=o.async}if(n===void 0){n=a.defaultThrottleConfig}return function(e){return e.lift(new u(t,r,n.leading,n.trailing))}}r.throttleTime=s;var u=function(){function e(e,t,r,n){this.duration=e;this.scheduler=t;this.leading=r;this.trailing=n}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.duration,this.scheduler,this.leading,this.trailing))};return e}();var c=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e)||this;o.duration=t;o.scheduler=r;o.leading=n;o.trailing=i;o._hasTrailingValue=false;o._trailingValue=null;return o}e.prototype._next=function(e){if(this.throttled){if(this.trailing){this._trailingValue=e;this._hasTrailingValue=true}}else{this.add(this.throttled=this.scheduler.schedule(l,this.duration,{subscriber:this}));if(this.leading){this.destination.next(e)}else if(this.trailing){this._trailingValue=e;this._hasTrailingValue=true}}};e.prototype._complete=function(){if(this._hasTrailingValue){this.destination.next(this._trailingValue);this.destination.complete()}else{this.destination.complete()}};e.prototype.clearThrottle=function(){var e=this.throttled;if(e){if(this.trailing&&this._hasTrailingValue){this.destination.next(this._trailingValue);this._trailingValue=null;this._hasTrailingValue=false}e.unsubscribe();this.remove(e);this.throttled=null}};return e}(i.Subscriber);function l(e){var t=e.subscriber;t.clearThrottle()}},{"../Subscriber":55,"../scheduler/async":206,"./throttle":173}],175:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("../util/EmptyError");var o=e("../Subscriber");function a(t){if(t===void 0){t=c}return function(e){return e.lift(new s(t))}}r.throwIfEmpty=a;var s=function(){function e(e){this.errorFactory=e}e.prototype.call=function(e,t){return t.subscribe(new u(e,this.errorFactory))};return e}();var u=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.errorFactory=t;r.hasValue=false;return r}e.prototype._next=function(e){this.hasValue=true;this.destination.next(e)};e.prototype._complete=function(){if(!this.hasValue){var t=void 0;try{t=this.errorFactory()}catch(e){t=e}this.destination.error(t)}else{return this.destination.complete()}};return e}(o.Subscriber);function c(){return new n.EmptyError}},{"../Subscriber":55,"../util/EmptyError":212}],176:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../scheduler/async");var o=e("./scan");var a=e("../observable/defer");var s=e("./map");function n(n){if(n===void 0){n=i.async}return function(e){return a.defer(function(){return e.pipe(o.scan(function(e,t){var r=e.current;return{value:t,current:n.now(),last:r}},{current:n.now(),value:undefined,last:undefined}),s.map(function(e){var t=e.current,r=e.last,n=e.value;return new u(n,t-r)}))})}}r.timeInterval=n;var u=function(){function e(e,t){this.value=e;this.interval=t}return e}();r.TimeInterval=u},{"../observable/defer":64,"../scheduler/async":206,"./map":125,"./scan":154}],177:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../scheduler/async");var i=e("../util/TimeoutError");var o=e("./timeoutWith");var a=e("../observable/throwError");function s(e,t){if(t===void 0){t=n.async}return o.timeoutWith(e,a.throwError(new i.TimeoutError),t)}r.timeout=s},{"../observable/throwError":82,"../scheduler/async":206,"../util/TimeoutError":215,"./timeoutWith":178}],178:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var a=e("../scheduler/async");var s=e("../util/isDate");var i=e("../OuterSubscriber");var o=e("../util/subscribeToResult");function u(n,i,o){if(o===void 0){o=a.async}return function(e){var t=s.isDate(n);var r=t?+n-o.now():Math.abs(n);return e.lift(new c(r,t,i,o))}}r.timeoutWith=u;var c=function(){function e(e,t,r,n){this.waitFor=e;this.absoluteTimeout=t;this.withObservable=r;this.scheduler=n}e.prototype.call=function(e,t){return t.subscribe(new l(e,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))};return e}();var l=function(a){n(t,a);function t(e,t,r,n,i){var o=a.call(this,e)||this;o.absoluteTimeout=t;o.waitFor=r;o.withObservable=n;o.scheduler=i;o.action=null;o.scheduleTimeout();return o}t.dispatchTimeout=function(e){var t=e.withObservable;e._unsubscribeAndRecycle();e.add(o.subscribeToResult(e,t))};t.prototype.scheduleTimeout=function(){var e=this.action;if(e){this.action=e.schedule(this,this.waitFor)}else{this.add(this.action=this.scheduler.schedule(t.dispatchTimeout,this.waitFor,this))}};t.prototype._next=function(e){if(!this.absoluteTimeout){this.scheduleTimeout()}a.prototype._next.call(this,e)};t.prototype._unsubscribe=function(){this.action=null;this.scheduler=null;this.withObservable=null};return t}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../scheduler/async":206,"../util/isDate":222,"../util/subscribeToResult":239}],179:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../scheduler/async");var i=e("./map");function o(t){if(t===void 0){t=n.async}return i.map(function(e){return new a(e,t.now())})}r.timestamp=o;var a=function(){function e(e,t){this.value=e;this.timestamp=t}return e}();r.Timestamp=a},{"../scheduler/async":206,"./map":125}],180:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./reduce");function i(e,t,r){if(r===0){return[t]}e.push(t);return e}function o(){return n.reduce(i,[])}r.toArray=o},{"./reduce":146}],181:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subject");var o=e("../OuterSubscriber");var a=e("../util/subscribeToResult");function s(r){return function e(t){return t.lift(new u(r))}}r.window=s;var u=function(){function e(e){this.windowBoundaries=e}e.prototype.call=function(e,t){var r=new c(e);var n=t.subscribe(r);if(!n.closed){r.add(a.subscribeToResult(r,this.windowBoundaries))}return n};return e}();var c=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t.window=new i.Subject;e.next(t.window);return t}e.prototype.notifyNext=function(e,t,r,n,i){this.openWindow()};e.prototype.notifyError=function(e,t){this._error(e)};e.prototype.notifyComplete=function(e){this._complete()};e.prototype._next=function(e){this.window.next(e)};e.prototype._error=function(e){this.window.error(e);this.destination.error(e)};e.prototype._complete=function(){this.window.complete();this.destination.complete()};e.prototype._unsubscribe=function(){this.window=null};e.prototype.openWindow=function(){var e=this.window;if(e){e.complete()}var t=this.destination;var r=this.window=new i.Subject;t.next(r)};return e}(o.OuterSubscriber)},{"../OuterSubscriber":50,"../Subject":53,"../util/subscribeToResult":239}],182:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscriber");var c=e("../Subject");function o(r,n){if(n===void 0){n=0}return function e(t){return t.lift(new a(r,n))}}r.windowCount=o;var a=function(){function e(e,t){this.windowSize=e;this.startWindowEvery=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.windowSize,this.startWindowEvery))};return e}();var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e)||this;n.destination=e;n.windowSize=t;n.startWindowEvery=r;n.windows=[new c.Subject];n.count=0;e.next(n.windows[0]);return n}e.prototype._next=function(e){var t=this.startWindowEvery>0?this.startWindowEvery:this.windowSize;var r=this.destination;var n=this.windowSize;var i=this.windows;var o=i.length;for(var a=0;a<o&&!this.closed;a++){i[a].next(e)}var s=this.count-n+1;if(s>=0&&s%t===0&&!this.closed){i.shift().complete()}if(++this.count%t===0&&!this.closed){var u=new c.Subject;i.push(u);r.next(u)}};e.prototype._error=function(e){var t=this.windows;if(t){while(t.length>0&&!this.closed){t.shift().error(e)}}this.destination.error(e)};e.prototype._complete=function(){var e=this.windows;if(e){while(e.length>0&&!this.closed){e.shift().complete()}}this.destination.complete()};e.prototype._unsubscribe=function(){this.count=0;this.windows=null};return e}(i.Subscriber)},{"../Subject":53,"../Subscriber":55}],183:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subject");var a=e("../scheduler/async");var o=e("../Subscriber");var s=e("../util/isNumeric");var u=e("../util/isScheduler");function c(r){var n=a.async;var i=null;var o=Number.POSITIVE_INFINITY;if(u.isScheduler(arguments[3])){n=arguments[3]}if(u.isScheduler(arguments[2])){n=arguments[2]}else if(s.isNumeric(arguments[2])){o=arguments[2]}if(u.isScheduler(arguments[1])){n=arguments[1]}else if(s.isNumeric(arguments[1])){i=arguments[1]}return function e(t){return t.lift(new l(r,i,o,n))}}r.windowTime=c;var l=function(){function e(e,t,r,n){this.windowTimeSpan=e;this.windowCreationInterval=t;this.maxWindowSize=r;this.scheduler=n}e.prototype.call=function(e,t){return t.subscribe(new p(e,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))};return e}();var h=function(t){n(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e._numberOfNextedValues=0;return e}e.prototype.next=function(e){this._numberOfNextedValues++;t.prototype.next.call(this,e)};Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:true,configurable:true});return e}(i.Subject);var p=function(l){n(e,l);function e(e,t,r,n,i){var o=l.call(this,e)||this;o.destination=e;o.windowTimeSpan=t;o.windowCreationInterval=r;o.maxWindowSize=n;o.scheduler=i;o.windows=[];var a=o.openWindow();if(r!==null&&r>=0){var s={subscriber:o,window:a,context:null};var u={windowTimeSpan:t,windowCreationInterval:r,subscriber:o,scheduler:i};o.add(i.schedule(v,t,s));o.add(i.schedule(d,r,u))}else{var c={subscriber:o,window:a,windowTimeSpan:t};o.add(i.schedule(f,t,c))}return o}e.prototype._next=function(e){var t=this.windows;var r=t.length;for(var n=0;n<r;n++){var i=t[n];if(!i.closed){i.next(e);if(i.numberOfNextedValues>=this.maxWindowSize){this.closeWindow(i)}}}};e.prototype._error=function(e){var t=this.windows;while(t.length>0){t.shift().error(e)}this.destination.error(e)};e.prototype._complete=function(){var e=this.windows;while(e.length>0){var t=e.shift();if(!t.closed){t.complete()}}this.destination.complete()};e.prototype.openWindow=function(){var e=new h;this.windows.push(e);var t=this.destination;t.next(e);return e};e.prototype.closeWindow=function(e){e.complete();var t=this.windows;t.splice(t.indexOf(e),1)};return e}(o.Subscriber);function f(e){var t=e.subscriber,r=e.windowTimeSpan,n=e.window;if(n){t.closeWindow(n)}e.window=t.openWindow();this.schedule(e,r)}function d(e){var t=e.windowTimeSpan,r=e.subscriber,n=e.scheduler,i=e.windowCreationInterval;var o=r.openWindow();var a=this;var s={action:a,subscription:null};var u={subscriber:r,window:o,context:s};s.subscription=n.schedule(v,t,u);a.add(s.subscription);a.schedule(e,i)}function v(e){var t=e.subscriber,r=e.window,n=e.context;if(n&&n.action&&n.subscription){n.action.remove(n.subscription)}t.closeWindow(r)}},{"../Subject":53,"../Subscriber":55,"../scheduler/async":206,"../util/isNumeric":226,"../util/isScheduler":230}],184:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var h=e("../Subject");var p=e("../Subscription");var i=e("../OuterSubscriber");var f=e("../util/subscribeToResult");function o(t,r){return function(e){return e.lift(new a(t,r))}}r.windowToggle=o;var a=function(){function e(e,t){this.openings=e;this.closingSelector=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.openings,this.closingSelector))};return e}();var s=function(o){n(e,o);function e(e,t,r){var n=o.call(this,e)||this;n.openings=t;n.closingSelector=r;n.contexts=[];n.add(n.openSubscription=f.subscribeToResult(n,t,t));return n}e.prototype._next=function(e){var t=this.contexts;if(t){var r=t.length;for(var n=0;n<r;n++){t[n].window.next(e)}}};e.prototype._error=function(e){var t=this.contexts;this.contexts=null;if(t){var r=t.length;var n=-1;while(++n<r){var i=t[n];i.window.error(e);i.subscription.unsubscribe()}}o.prototype._error.call(this,e)};e.prototype._complete=function(){var e=this.contexts;this.contexts=null;if(e){var t=e.length;var r=-1;while(++r<t){var n=e[r];n.window.complete();n.subscription.unsubscribe()}}o.prototype._complete.call(this)};e.prototype._unsubscribe=function(){var e=this.contexts;this.contexts=null;if(e){var t=e.length;var r=-1;while(++r<t){var n=e[r];n.window.unsubscribe();n.subscription.unsubscribe()}}};e.prototype.notifyNext=function(e,t,r,n,i){if(e===this.openings){var o=void 0;try{var a=this.closingSelector;o=a(t)}catch(e){return this.error(e)}var s=new h.Subject;var u=new p.Subscription;var c={window:s,subscription:u};this.contexts.push(c);var l=f.subscribeToResult(this,o,c);if(l.closed){this.closeWindow(this.contexts.length-1)}else{l.context=c;u.add(l)}this.destination.next(s)}else{this.closeWindow(this.contexts.indexOf(e))}};e.prototype.notifyError=function(e){this.error(e)};e.prototype.notifyComplete=function(e){if(e!==this.openSubscription){this.closeWindow(this.contexts.indexOf(e.context))}};e.prototype.closeWindow=function(e){if(e===-1){return}var t=this.contexts;var r=t[e];var n=r.window,i=r.subscription;t.splice(e,1);n.complete();i.unsubscribe()};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../Subject":53,"../Subscription":56,"../util/subscribeToResult":239}],185:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var o=e("../Subject");var n=e("../OuterSubscriber");var a=e("../util/subscribeToResult");function s(r){return function e(t){return t.lift(new u(r))}}r.windowWhen=s;var u=function(){function e(e){this.closingSelector=e}e.prototype.call=function(e,t){return t.subscribe(new c(e,this.closingSelector))};return e}();var c=function(n){i(e,n);function e(e,t){var r=n.call(this,e)||this;r.destination=e;r.closingSelector=t;r.openWindow();return r}e.prototype.notifyNext=function(e,t,r,n,i){this.openWindow(i)};e.prototype.notifyError=function(e,t){this._error(e)};e.prototype.notifyComplete=function(e){this.openWindow(e)};e.prototype._next=function(e){this.window.next(e)};e.prototype._error=function(e){this.window.error(e);this.destination.error(e);this.unsubscribeClosingNotification()};e.prototype._complete=function(){this.window.complete();this.destination.complete();this.unsubscribeClosingNotification()};e.prototype.unsubscribeClosingNotification=function(){if(this.closingNotification){this.closingNotification.unsubscribe()}};e.prototype.openWindow=function(e){if(e===void 0){e=null}if(e){this.remove(e);e.unsubscribe()}var t=this.window;if(t){t.complete()}var r=this.window=new o.Subject;this.destination.next(r);var n;try{var i=this.closingSelector;n=i()}catch(e){this.destination.error(e);this.window.error(e);return}this.add(this.closingNotification=a.subscribeToResult(this,n))};return e}(n.OuterSubscriber)},{"../OuterSubscriber":50,"../Subject":53,"../util/subscribeToResult":239}],186:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../OuterSubscriber");var u=e("../util/subscribeToResult");function o(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return function(e){var t;if(typeof n[n.length-1]==="function"){t=n.pop()}var r=n;return e.lift(new a(r,t))}}r.withLatestFrom=o;var a=function(){function e(e,t){this.observables=e;this.project=t}e.prototype.call=function(e,t){return t.subscribe(new s(e,this.observables,this.project))};return e}();var s=function(s){n(e,s);function e(e,t,r){var n=s.call(this,e)||this;n.observables=t;n.project=r;n.toRespond=[];var i=t.length;n.values=new Array(i);for(var o=0;o<i;o++){n.toRespond.push(o)}for(var o=0;o<i;o++){var a=t[o];n.add(u.subscribeToResult(n,a,a,o))}return n}e.prototype.notifyNext=function(e,t,r,n,i){this.values[r]=t;var o=this.toRespond;if(o.length>0){var a=o.indexOf(r);if(a!==-1){o.splice(a,1)}}};e.prototype.notifyComplete=function(){};e.prototype._next=function(e){if(this.toRespond.length===0){var t=[e].concat(this.values);if(this.project){this._tryProject(t)}else{this.destination.next(t)}}};e.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){this.destination.error(e);return}this.destination.next(t)};return e}(i.OuterSubscriber)},{"../OuterSubscriber":50,"../util/subscribeToResult":239}],187:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/zip");function i(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}return function e(t){return t.lift.call(n.zip.apply(void 0,[t].concat(r)))}}r.zip=i},{"../observable/zip":85}],188:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../observable/zip");function i(t){return function(e){return e.lift(new n.ZipOperator(t))}}r.zipAll=i},{"../observable/zip":85}],189:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Observable");var a=e("../Subscription");function n(n,i){return new o.Observable(function(e){var t=new a.Subscription;var r=0;t.add(i.schedule(function(){if(r===n.length){e.complete();return}e.next(n[r++]);if(!e.closed){t.add(this.schedule())}}));return t})}r.scheduleArray=n},{"../Observable":48,"../Subscription":56}],190:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");var o=e("../Subscription");var a=e("../symbol/iterator");function i(t,r){if(!t){throw new Error("Iterable cannot be null")}return new n.Observable(function(n){var e=new o.Subscription;var i;e.add(function(){if(i&&typeof i.return==="function"){i.return()}});e.add(r.schedule(function(){i=t[a.iterator]();e.add(r.schedule(function(){if(n.closed){return}var e;var t;try{var r=i.next();e=r.value;t=r.done}catch(e){n.error(e);return}if(t){n.complete()}else{n.next(e);this.schedule()}}))}));return e})}r.scheduleIterable=i},{"../Observable":48,"../Subscription":56,"../symbol/iterator":208}],191:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Observable");var a=e("../Subscription");var s=e("../symbol/observable");function n(n,i){return new o.Observable(function(t){var r=new a.Subscription;r.add(i.schedule(function(){var e=n[s.observable]();r.add(e.subscribe({next:function(e){r.add(i.schedule(function(){return t.next(e)}))},error:function(e){r.add(i.schedule(function(){return t.error(e)}))},complete:function(){r.add(i.schedule(function(){return t.complete()}))}}))}));return r})}r.scheduleObservable=n},{"../Observable":48,"../Subscription":56,"../symbol/observable":209}],192:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../Observable");var o=e("../Subscription");function n(e,n){return new i.Observable(function(t){var r=new o.Subscription;r.add(n.schedule(function(){return e.then(function(e){r.add(n.schedule(function(){t.next(e);r.add(n.schedule(function(){return t.complete()}))}))},function(e){r.add(n.schedule(function(){return t.error(e)}))})}));return r})}r.schedulePromise=n},{"../Observable":48,"../Subscription":56}],193:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./scheduleObservable");var i=e("./schedulePromise");var o=e("./scheduleArray");var a=e("./scheduleIterable");var s=e("../util/isInteropObservable");var u=e("../util/isPromise");var c=e("../util/isArrayLike");var l=e("../util/isIterable");function h(e,t){if(e!=null){if(s.isInteropObservable(e)){return n.scheduleObservable(e,t)}else if(u.isPromise(e)){return i.schedulePromise(e,t)}else if(c.isArrayLike(e)){return o.scheduleArray(e,t)}else if(l.isIterable(e)||typeof e==="string"){return a.scheduleIterable(e,t)}}throw new TypeError((e!==null&&typeof e||e)+" is not observable")}r.scheduled=h},{"../util/isArrayLike":221,"../util/isInteropObservable":224,"../util/isIterable":225,"../util/isPromise":229,"./scheduleArray":189,"./scheduleIterable":190,"./scheduleObservable":191,"./schedulePromise":192}],194:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("../Subscription");var o=function(r){n(e,r);function e(e,t){return r.call(this)||this}e.prototype.schedule=function(e,t){if(t===void 0){t=0}return this};return e}(i.Subscription);r.Action=o},{"../Subscription":56}],195:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("./AsyncAction");var o=function(n){i(e,n);function e(e,t){var r=n.call(this,e,t)||this;r.scheduler=e;r.work=t;return r}e.prototype.requestAsyncId=function(e,t,r){if(r===void 0){r=0}if(r!==null&&r>0){return n.prototype.requestAsyncId.call(this,e,t,r)}e.actions.push(this);return e.scheduled||(e.scheduled=requestAnimationFrame(function(){return e.flush(null)}))};e.prototype.recycleAsyncId=function(e,t,r){if(r===void 0){r=0}if(r!==null&&r>0||r===null&&this.delay>0){return n.prototype.recycleAsyncId.call(this,e,t,r)}if(e.actions.length===0){cancelAnimationFrame(t);e.scheduled=undefined}return undefined};return e}(n.AsyncAction);r.AnimationFrameAction=o},{"./AsyncAction":199}],196:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./AsyncScheduler");var o=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.flush=function(e){this.active=true;this.scheduled=undefined;var t=this.actions;var r;var n=-1;var i=t.length;e=e||t.shift();do{if(r=e.execute(e.state,e.delay)){break}}while(++n<i&&(e=t.shift()));this.active=false;if(r){while(++n<i&&(e=t.shift())){e.unsubscribe()}throw r}};return t}(i.AsyncScheduler);r.AnimationFrameScheduler=o},{"./AsyncScheduler":200}],197:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var o=e("../util/Immediate");var n=e("./AsyncAction");var a=function(n){i(e,n);function e(e,t){var r=n.call(this,e,t)||this;r.scheduler=e;r.work=t;return r}e.prototype.requestAsyncId=function(e,t,r){if(r===void 0){r=0}if(r!==null&&r>0){return n.prototype.requestAsyncId.call(this,e,t,r)}e.actions.push(this);return e.scheduled||(e.scheduled=o.Immediate.setImmediate(e.flush.bind(e,null)))};e.prototype.recycleAsyncId=function(e,t,r){if(r===void 0){r=0}if(r!==null&&r>0||r===null&&this.delay>0){return n.prototype.recycleAsyncId.call(this,e,t,r)}if(e.actions.length===0){o.Immediate.clearImmediate(t);e.scheduled=undefined}return undefined};return e}(n.AsyncAction);r.AsapAction=a},{"../util/Immediate":213,"./AsyncAction":199}],198:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./AsyncScheduler");var o=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.flush=function(e){this.active=true;this.scheduled=undefined;var t=this.actions;var r;var n=-1;var i=t.length;e=e||t.shift();do{if(r=e.execute(e.state,e.delay)){break}}while(++n<i&&(e=t.shift()));this.active=false;if(r){while(++n<i&&(e=t.shift())){e.unsubscribe()}throw r}};return t}(i.AsyncScheduler);r.AsapScheduler=o},{"./AsyncScheduler":200}],199:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("./Action");var o=function(n){i(e,n);function e(e,t){var r=n.call(this,e,t)||this;r.scheduler=e;r.work=t;r.pending=false;return r}e.prototype.schedule=function(e,t){if(t===void 0){t=0}if(this.closed){return this}this.state=e;var r=this.id;var n=this.scheduler;if(r!=null){this.id=this.recycleAsyncId(n,r,t)}this.pending=true;this.delay=t;this.id=this.id||this.requestAsyncId(n,this.id,t);return this};e.prototype.requestAsyncId=function(e,t,r){if(r===void 0){r=0}return setInterval(e.flush.bind(e,this),r)};e.prototype.recycleAsyncId=function(e,t,r){if(r===void 0){r=0}if(r!==null&&this.delay===r&&this.pending===false){return t}clearInterval(t);return undefined};e.prototype.execute=function(e,t){if(this.closed){return new Error("executing a cancelled action")}this.pending=false;var r=this._execute(e,t);if(r){return r}else if(this.pending===false&&this.id!=null){this.id=this.recycleAsyncId(this.scheduler,this.id,null)}};e.prototype._execute=function(e,t){var r=false;var n=undefined;try{this.work(e)}catch(e){r=true;n=!!e&&e||new Error(e)}if(r){this.unsubscribe();return n}};e.prototype._unsubscribe=function(){var e=this.id;var t=this.scheduler;var r=t.actions;var n=r.indexOf(this);this.work=null;this.state=null;this.pending=false;this.scheduler=null;if(n!==-1){r.splice(n,1)}if(e!=null){this.id=this.recycleAsyncId(t,e,null)}this.delay=null};return e}(n.Action);r.AsyncAction=o},{"./Action":194}],200:[function(e,t,r){"use strict";var o=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var a=e("../Scheduler");var n=function(n){o(i,n);function i(e,t){if(t===void 0){t=a.Scheduler.now}var r=n.call(this,e,function(){if(i.delegate&&i.delegate!==r){return i.delegate.now()}else{return t()}})||this;r.actions=[];r.active=false;r.scheduled=undefined;return r}i.prototype.schedule=function(e,t,r){if(t===void 0){t=0}if(i.delegate&&i.delegate!==this){return i.delegate.schedule(e,t,r)}else{return n.prototype.schedule.call(this,e,t,r)}};i.prototype.flush=function(e){var t=this.actions;if(this.active){t.push(e);return}var r;this.active=true;do{if(r=e.execute(e.state,e.delay)){break}}while(e=t.shift());this.active=false;if(r){while(e=t.shift()){e.unsubscribe()}throw r}};return i}(a.Scheduler);r.AsyncScheduler=n},{"../Scheduler":52}],201:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("./AsyncAction");var o=function(n){i(e,n);function e(e,t){var r=n.call(this,e,t)||this;r.scheduler=e;r.work=t;return r}e.prototype.schedule=function(e,t){if(t===void 0){t=0}if(t>0){return n.prototype.schedule.call(this,e,t)}this.delay=t;this.state=e;this.scheduler.flush(this);return this};e.prototype.execute=function(e,t){return t>0||this.closed?n.prototype.execute.call(this,e,t):this._execute(e,t)};e.prototype.requestAsyncId=function(e,t,r){if(r===void 0){r=0}if(r!==null&&r>0||r===null&&this.delay>0){return n.prototype.requestAsyncId.call(this,e,t,r)}return e.flush(this)};return e}(n.AsyncAction);r.QueueAction=o},{"./AsyncAction":199}],202:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var i=e("./AsyncScheduler");var o=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(i.AsyncScheduler);r.QueueScheduler=o},{"./AsyncScheduler":200}],203:[function(e,t,r){"use strict";var a=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});var n=e("./AsyncAction");var i=e("./AsyncScheduler");var o=function(n){a(e,n);function e(e,t){if(e===void 0){e=s}if(t===void 0){t=Number.POSITIVE_INFINITY}var r=n.call(this,e,function(){return r.frame})||this;r.maxFrames=t;r.frame=0;r.index=-1;return r}e.prototype.flush=function(){var e=this,t=e.actions,r=e.maxFrames;var n,i;while((i=t[0])&&i.delay<=r){t.shift();this.frame=i.delay;if(n=i.execute(i.state,i.delay)){break}}if(n){while(i=t.shift()){i.unsubscribe()}throw n}};e.frameTimeFactor=10;return e}(i.AsyncScheduler);r.VirtualTimeScheduler=o;var s=function(i){a(o,i);function o(e,t,r){if(r===void 0){r=e.index+=1}var n=i.call(this,e,t)||this;n.scheduler=e;n.work=t;n.index=r;n.active=true;n.index=e.index=r;return n}o.prototype.schedule=function(e,t){if(t===void 0){t=0}if(!this.id){return i.prototype.schedule.call(this,e,t)}this.active=false;var r=new o(this.scheduler,this.work);this.add(r);return r.schedule(e,t)};o.prototype.requestAsyncId=function(e,t,r){if(r===void 0){r=0}this.delay=e.frame+r;var n=e.actions;n.push(this);n.sort(o.sortActions);return true};o.prototype.recycleAsyncId=function(e,t,r){if(r===void 0){r=0}return undefined};o.prototype._execute=function(e,t){if(this.active===true){return i.prototype._execute.call(this,e,t)}};o.sortActions=function(e,t){if(e.delay===t.delay){if(e.index===t.index){return 0}else if(e.index>t.index){return 1}else{return-1}}else if(e.delay>t.delay){return 1}else{return-1}};return o}(n.AsyncAction);r.VirtualAction=s},{"./AsyncAction":199,"./AsyncScheduler":200}],204:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./AnimationFrameAction");var i=e("./AnimationFrameScheduler");r.animationFrame=new i.AnimationFrameScheduler(n.AnimationFrameAction)},{"./AnimationFrameAction":195,"./AnimationFrameScheduler":196}],205:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./AsapAction");var i=e("./AsapScheduler");r.asap=new i.AsapScheduler(n.AsapAction)},{"./AsapAction":197,"./AsapScheduler":198}],206:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./AsyncAction");var i=e("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":199,"./AsyncScheduler":200}],207:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./QueueAction");var i=e("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":201,"./QueueScheduler":202}],208:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(){if(typeof Symbol!=="function"||!Symbol.iterator){return"@@iterator"}return Symbol.iterator}r.getSymbolIterator=n;r.iterator=n();r.$$iterator=r.iterator},{}],209:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.observable=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}()},{}],210:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.rxSubscriber=function(){return typeof Symbol==="function"?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}();r.$$rxSubscriber=r.rxSubscriber},{}],211:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=function(){function e(){Error.call(this);this.message="argument out of range";this.name="ArgumentOutOfRangeError";return this}e.prototype=Object.create(Error.prototype);return e}();r.ArgumentOutOfRangeError=n},{}],212:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=function(){function e(){Error.call(this);this.message="no elements in sequence";this.name="EmptyError";return this}e.prototype=Object.create(Error.prototype);return e}();r.EmptyError=n},{}],213:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=1;var i=function(){return Promise.resolve()}();var o={};function a(e){if(e in o){delete o[e];return true}return false}r.Immediate={setImmediate:function(e){var t=n++;o[t]=true;i.then(function(){return a(t)&&e()});return t},clearImmediate:function(e){a(e)}};r.TestTools={pending:function(){return Object.keys(o).length}}},{}],214:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=function(){function e(){Error.call(this);this.message="object unsubscribed";this.name="ObjectUnsubscribedError";return this}e.prototype=Object.create(Error.prototype);return e}();r.ObjectUnsubscribedError=n},{}],215:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=function(){function e(){Error.call(this);this.message="Timeout has occurred";this.name="TimeoutError";return this}e.prototype=Object.create(Error.prototype);return e}();r.TimeoutError=n},{}],216:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=function(){function e(e){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;return this}e.prototype=Object.create(Error.prototype);return e}();r.UnsubscriptionError=n},{}],217:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../Subscriber");function n(e){while(e){var t=e,r=t.closed,n=t.destination,i=t.isStopped;if(r||i){return false}else if(n&&n instanceof o.Subscriber){e=n}else{e=null}}return true}r.canReportError=n},{"../Subscriber":55}],218:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){setTimeout(function(){throw e},0)}r.hostReportError=n},{}],219:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){return e}r.identity=n},{}],220:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.isArray=function(){return Array.isArray||function(e){return e&&typeof e.length==="number"}}()},{}],221:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.isArrayLike=function(e){return e&&typeof e.length==="number"&&typeof e!=="function"}},{}],222:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){return e instanceof Date&&!isNaN(+e)}r.isDate=n},{}],223:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){return typeof e==="function"}r.isFunction=n},{}],224:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../symbol/observable");function i(e){return e&&typeof e[n.observable]==="function"}r.isInteropObservable=i},{"../symbol/observable":209}],225:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../symbol/iterator");function i(e){return e&&typeof e[n.iterator]==="function"}r.isIterable=i},{"../symbol/iterator":208}],226:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./isArray");function i(e){return!n.isArray(e)&&e-parseFloat(e)+1>=0}r.isNumeric=i},{"./isArray":220}],227:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){return e!==null&&typeof e==="object"}r.isObject=n},{}],228:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Observable");function i(e){return!!e&&(e instanceof n.Observable||typeof e.lift==="function"&&typeof e.subscribe==="function")}r.isObservable=i},{"../Observable":48}],229:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){return!!e&&typeof e.subscribe!=="function"&&typeof e.then==="function"}r.isPromise=n},{}],230:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){return e&&typeof e.schedule==="function"}r.isScheduler=n},{}],231:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(){}r.noop=n},{}],232:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e,t){function r(){return!r.pred.apply(r.thisArg,arguments)}r.pred=e;r.thisArg=t;return r}r.not=n},{}],233:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./identity");function i(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return o(e)}r.pipe=i;function o(r){if(r.length===0){return n.identity}if(r.length===1){return r[0]}return function e(t){return r.reduce(function(e,t){return t(e)},t)}}r.pipeFromArray=o},{"./identity":219}],234:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./subscribeToArray");var i=e("./subscribeToPromise");var o=e("./subscribeToIterable");var a=e("./subscribeToObservable");var s=e("./isArrayLike");var u=e("./isPromise");var c=e("./isObject");var l=e("../symbol/iterator");var h=e("../symbol/observable");r.subscribeTo=function(e){if(!!e&&typeof e[h.observable]==="function"){return a.subscribeToObservable(e)}else if(s.isArrayLike(e)){return n.subscribeToArray(e)}else if(u.isPromise(e)){return i.subscribeToPromise(e)}else if(!!e&&typeof e[l.iterator]==="function"){return o.subscribeToIterable(e)}else{var t=c.isObject(e)?"an invalid object":"'"+e+"'";var r="You provided "+t+" where a stream was expected."+" You can provide an Observable, Promise, Array, or Iterable.";throw new TypeError(r)}}},{"../symbol/iterator":208,"../symbol/observable":209,"./isArrayLike":221,"./isObject":227,"./isPromise":229,"./subscribeToArray":235,"./subscribeToIterable":236,"./subscribeToObservable":237,"./subscribeToPromise":238}],235:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.subscribeToArray=function(n){return function(e){for(var t=0,r=n.length;t<r&&!e.closed;t++){e.next(n[t])}e.complete()}}},{}],236:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=e("../symbol/iterator");r.subscribeToIterable=function(n){return function(e){var t=n[i.iterator]();do{var r=t.next();if(r.done){e.complete();break}e.next(r.value);if(e.closed){break}}while(true);if(typeof t.return==="function"){e.add(function(){if(t.return){t.return()}})}return e}}},{"../symbol/iterator":208}],237:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../symbol/observable");r.subscribeToObservable=function(r){return function(e){var t=r[n.observable]();if(typeof t.subscribe!=="function"){throw new TypeError("Provided object does not correctly implement Symbol.observable")}else{return t.subscribe(e)}}}},{"../symbol/observable":209}],238:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./hostReportError");r.subscribeToPromise=function(e){return function(t){e.then(function(e){if(!t.closed){t.next(e);t.complete()}},function(e){return t.error(e)}).then(null,n.hostReportError);return t}}},{"./hostReportError":218}],239:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var o=e("../InnerSubscriber");var a=e("./subscribeTo");var s=e("../Observable");function n(e,t,r,n,i){if(i===void 0){i=new o.InnerSubscriber(e,r,n)}if(i.closed){return undefined}if(t instanceof s.Observable){return t.subscribe(i)}return a.subscribeTo(t)(i)}r.subscribeToResult=n},{"../InnerSubscriber":46,"../Observable":48,"./subscribeTo":234}],240:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../Subscriber");var i=e("../symbol/rxSubscriber");var o=e("../Observer");function a(e,t,r){if(e){if(e instanceof n.Subscriber){return e}if(e[i.rxSubscriber]){return e[i.rxSubscriber]()}}if(!e&&!t&&!r){return new n.Subscriber(o.empty)}return new n.Subscriber(e,t,r)}r.toSubscriber=a},{"../Observer":49,"../Subscriber":55,"../symbol/rxSubscriber":210}],241:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("../internal/operators/audit");r.audit=n.audit;var i=e("../internal/operators/auditTime");r.auditTime=i.auditTime;var o=e("../internal/operators/buffer");r.buffer=o.buffer;var a=e("../internal/operators/bufferCount");r.bufferCount=a.bufferCount;var s=e("../internal/operators/bufferTime");r.bufferTime=s.bufferTime;var u=e("../internal/operators/bufferToggle");r.bufferToggle=u.bufferToggle;var c=e("../internal/operators/bufferWhen");r.bufferWhen=c.bufferWhen;var l=e("../internal/operators/catchError");r.catchError=l.catchError;var h=e("../internal/operators/combineAll");r.combineAll=h.combineAll;var p=e("../internal/operators/combineLatest");r.combineLatest=p.combineLatest;var f=e("../internal/operators/concat");r.concat=f.concat;var d=e("../internal/operators/concatAll");r.concatAll=d.concatAll;var v=e("../internal/operators/concatMap");r.concatMap=v.concatMap;var m=e("../internal/operators/concatMapTo");r.concatMapTo=m.concatMapTo;var g=e("../internal/operators/count");r.count=g.count;var _=e("../internal/operators/debounce");r.debounce=_.debounce;var y=e("../internal/operators/debounceTime");r.debounceTime=y.debounceTime;var b=e("../internal/operators/defaultIfEmpty");r.defaultIfEmpty=b.defaultIfEmpty;var x=e("../internal/operators/delay");r.delay=x.delay;var w=e("../internal/operators/delayWhen");r.delayWhen=w.delayWhen;var S=e("../internal/operators/dematerialize");r.dematerialize=S.dematerialize;var M=e("../internal/operators/distinct");r.distinct=M.distinct;var C=e("../internal/operators/distinctUntilChanged");r.distinctUntilChanged=C.distinctUntilChanged;var T=e("../internal/operators/distinctUntilKeyChanged");r.distinctUntilKeyChanged=T.distinctUntilKeyChanged;var E=e("../internal/operators/elementAt");r.elementAt=E.elementAt;var O=e("../internal/operators/endWith");r.endWith=O.endWith;var P=e("../internal/operators/every");r.every=P.every;var A=e("../internal/operators/exhaust");r.exhaust=A.exhaust;var j=e("../internal/operators/exhaustMap");r.exhaustMap=j.exhaustMap;var R=e("../internal/operators/expand");r.expand=R.expand;var k=e("../internal/operators/filter");r.filter=k.filter;var L=e("../internal/operators/finalize");r.finalize=L.finalize;var N=e("../internal/operators/find");r.find=N.find;var I=e("../internal/operators/findIndex");r.findIndex=I.findIndex;var D=e("../internal/operators/first");r.first=D.first;var B=e("../internal/operators/groupBy");r.groupBy=B.groupBy;var F=e("../internal/operators/ignoreElements");r.ignoreElements=F.ignoreElements;var z=e("../internal/operators/isEmpty");r.isEmpty=z.isEmpty;var $=e("../internal/operators/last");r.last=$.last;var G=e("../internal/operators/map");r.map=G.map;var V=e("../internal/operators/mapTo");r.mapTo=V.mapTo;var H=e("../internal/operators/materialize");r.materialize=H.materialize;var U=e("../internal/operators/max");r.max=U.max;var q=e("../internal/operators/merge");r.merge=q.merge;var W=e("../internal/operators/mergeAll");r.mergeAll=W.mergeAll;var X=e("../internal/operators/mergeMap");r.mergeMap=X.mergeMap;var Y=e("../internal/operators/mergeMap");r.flatMap=Y.mergeMap;var K=e("../internal/operators/mergeMapTo");r.mergeMapTo=K.mergeMapTo;var Z=e("../internal/operators/mergeScan");r.mergeScan=Z.mergeScan;var J=e("../internal/operators/min");r.min=J.min;var Q=e("../internal/operators/multicast");r.multicast=Q.multicast;var ee=e("../internal/operators/observeOn");r.observeOn=ee.observeOn;var te=e("../internal/operators/onErrorResumeNext");r.onErrorResumeNext=te.onErrorResumeNext;var re=e("../internal/operators/pairwise");r.pairwise=re.pairwise;var ne=e("../internal/operators/partition");r.partition=ne.partition;var ie=e("../internal/operators/pluck");r.pluck=ie.pluck;var oe=e("../internal/operators/publish");r.publish=oe.publish;var ae=e("../internal/operators/publishBehavior");r.publishBehavior=ae.publishBehavior;var se=e("../internal/operators/publishLast");r.publishLast=se.publishLast;var ue=e("../internal/operators/publishReplay");r.publishReplay=ue.publishReplay;var ce=e("../internal/operators/race");r.race=ce.race;var le=e("../internal/operators/reduce");r.reduce=le.reduce;var he=e("../internal/operators/repeat");r.repeat=he.repeat;var pe=e("../internal/operators/repeatWhen");r.repeatWhen=pe.repeatWhen;var fe=e("../internal/operators/retry");r.retry=fe.retry;var de=e("../internal/operators/retryWhen");r.retryWhen=de.retryWhen;var ve=e("../internal/operators/refCount");r.refCount=ve.refCount;var me=e("../internal/operators/sample");r.sample=me.sample;var ge=e("../internal/operators/sampleTime");r.sampleTime=ge.sampleTime;var _e=e("../internal/operators/scan");r.scan=_e.scan;var ye=e("../internal/operators/sequenceEqual");r.sequenceEqual=ye.sequenceEqual;var be=e("../internal/operators/share");r.share=be.share;var xe=e("../internal/operators/shareReplay");r.shareReplay=xe.shareReplay;var we=e("../internal/operators/single");r.single=we.single;var Se=e("../internal/operators/skip");r.skip=Se.skip;var Me=e("../internal/operators/skipLast");r.skipLast=Me.skipLast;var Ce=e("../internal/operators/skipUntil");r.skipUntil=Ce.skipUntil;var Te=e("../internal/operators/skipWhile");r.skipWhile=Te.skipWhile;var Ee=e("../internal/operators/startWith");r.startWith=Ee.startWith;var Oe=e("../internal/operators/subscribeOn");r.subscribeOn=Oe.subscribeOn;var Pe=e("../internal/operators/switchAll");r.switchAll=Pe.switchAll;var Ae=e("../internal/operators/switchMap");r.switchMap=Ae.switchMap;var je=e("../internal/operators/switchMapTo");r.switchMapTo=je.switchMapTo;var Re=e("../internal/operators/take");r.take=Re.take;var ke=e("../internal/operators/takeLast");r.takeLast=ke.takeLast;var Le=e("../internal/operators/takeUntil");r.takeUntil=Le.takeUntil;var Ne=e("../internal/operators/takeWhile");r.takeWhile=Ne.takeWhile;var Ie=e("../internal/operators/tap");r.tap=Ie.tap;var De=e("../internal/operators/throttle");r.throttle=De.throttle;var Be=e("../internal/operators/throttleTime");r.throttleTime=Be.throttleTime;var Fe=e("../internal/operators/throwIfEmpty");r.throwIfEmpty=Fe.throwIfEmpty;var ze=e("../internal/operators/timeInterval");r.timeInterval=ze.timeInterval;var $e=e("../internal/operators/timeout");r.timeout=$e.timeout;var Ge=e("../internal/operators/timeoutWith");r.timeoutWith=Ge.timeoutWith;var Ve=e("../internal/operators/timestamp");r.timestamp=Ve.timestamp;var He=e("../internal/operators/toArray");r.toArray=He.toArray;var Ue=e("../internal/operators/window");r.window=Ue.window;var qe=e("../internal/operators/windowCount");r.windowCount=qe.windowCount;var We=e("../internal/operators/windowTime");r.windowTime=We.windowTime;var Xe=e("../internal/operators/windowToggle");r.windowToggle=Xe.windowToggle;var Ye=e("../internal/operators/windowWhen");r.windowWhen=Ye.windowWhen;var Ke=e("../internal/operators/withLatestFrom");r.withLatestFrom=Ke.withLatestFrom;var Ze=e("../internal/operators/zip");r.zip=Ze.zip;var Je=e("../internal/operators/zipAll");r.zipAll=Je.zipAll},{"../internal/operators/audit":86,"../internal/operators/auditTime":87,"../internal/operators/buffer":88,"../internal/operators/bufferCount":89,"../internal/operators/bufferTime":90,"../internal/operators/bufferToggle":91,"../internal/operators/bufferWhen":92,"../internal/operators/catchError":93,"../internal/operators/combineAll":94,"../internal/operators/combineLatest":95,"../internal/operators/concat":96,"../internal/operators/concatAll":97,"../internal/operators/concatMap":98,"../internal/operators/concatMapTo":99,"../internal/operators/count":100,"../internal/operators/debounce":101,"../internal/operators/debounceTime":102,"../internal/operators/defaultIfEmpty":103,"../internal/operators/delay":104,"../internal/operators/delayWhen":105,"../internal/operators/dematerialize":106,"../internal/operators/distinct":107,"../internal/operators/distinctUntilChanged":108,"../internal/operators/distinctUntilKeyChanged":109,"../internal/operators/elementAt":110,"../internal/operators/endWith":111,"../internal/operators/every":112,"../internal/operators/exhaust":113,"../internal/operators/exhaustMap":114,"../internal/operators/expand":115,"../internal/operators/filter":116,"../internal/operators/finalize":117,"../internal/operators/find":118,"../internal/operators/findIndex":119,"../internal/operators/first":120,"../internal/operators/groupBy":121,"../internal/operators/ignoreElements":122,"../internal/operators/isEmpty":123,"../internal/operators/last":124,"../internal/operators/map":125,"../internal/operators/mapTo":126,"../internal/operators/materialize":127,"../internal/operators/max":128,"../internal/operators/merge":129,"../internal/operators/mergeAll":130,"../internal/operators/mergeMap":131,"../internal/operators/mergeMapTo":132,"../internal/operators/mergeScan":133,"../internal/operators/min":134,"../internal/operators/multicast":135,"../internal/operators/observeOn":136,"../internal/operators/onErrorResumeNext":137,"../internal/operators/pairwise":138,"../internal/operators/partition":139,"../internal/operators/pluck":140,"../internal/operators/publish":141,"../internal/operators/publishBehavior":142,"../internal/operators/publishLast":143,"../internal/operators/publishReplay":144,"../internal/operators/race":145,"../internal/operators/reduce":146,"../internal/operators/refCount":147,"../internal/operators/repeat":148,"../internal/operators/repeatWhen":149,"../internal/operators/retry":150,"../internal/operators/retryWhen":151,"../internal/operators/sample":152,"../internal/operators/sampleTime":153,"../internal/operators/scan":154,"../internal/operators/sequenceEqual":155,"../internal/operators/share":156,"../internal/operators/shareReplay":157,"../internal/operators/single":158,"../internal/operators/skip":159,"../internal/operators/skipLast":160,"../internal/operators/skipUntil":161,"../internal/operators/skipWhile":162,"../internal/operators/startWith":163,"../internal/operators/subscribeOn":164,"../internal/operators/switchAll":165,"../internal/operators/switchMap":166,"../internal/operators/switchMapTo":167,"../internal/operators/take":168,"../internal/operators/takeLast":169,"../internal/operators/takeUntil":170,"../internal/operators/takeWhile":171,"../internal/operators/tap":172,"../internal/operators/throttle":173,"../internal/operators/throttleTime":174,"../internal/operators/throwIfEmpty":175,"../internal/operators/timeInterval":176,"../internal/operators/timeout":177,"../internal/operators/timeoutWith":178,"../internal/operators/timestamp":179,"../internal/operators/toArray":180,"../internal/operators/window":181,"../internal/operators/windowCount":182,"../internal/operators/windowTime":183,"../internal/operators/windowToggle":184,"../internal/operators/windowWhen":185,"../internal/operators/withLatestFrom":186,"../internal/operators/zip":187,"../internal/operators/zipAll":188}],242:[function(e,r,n){(function(e,t){"object"===typeof n&&"undefined"!==typeof r?t(n):"function"===typeof o&&o.amd?o(["exports"],t):(e=e||self,t(e.THREE={}))})(this,function(e){function t(){}function Me(e,t){this.x=e||0;this.y=t||0}function m(){this.elements=[1,0,0,0,1,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function p(e,t,r,n,i,o,a,s,u,c){Object.defineProperty(this,"id",{value:qo++});this.uuid=Vo.generateUUID();this.name="";this.image=void 0!==e?e:p.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==t?t:p.DEFAULT_MAPPING;this.wrapS=void 0!==r?r:1001;this.wrapT=void 0!==n?n:1001;this.magFilter=void 0!==i?i:1006;this.minFilter=void 0!==o?o:1008;this.anisotropy=void 0!==u?u:1;this.format=void 0!==a?a:1023;this.internalFormat=null;this.type=void 0!==s?s:1009;this.offset=new Me(0,0);this.repeat=new Me(1,1);this.center=new Me(0,0);this.rotation=0;this.matrixAutoUpdate=!0;this.matrix=new m;this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==c?c:3e3;this.version=0;this.onUpdate=null}function Ce(e,t,r,n){this.x=e||0;this.y=t||0;this.z=r||0;this.w=void 0!==n?n:1}function T(e,t,r){this.width=e;this.height=t;this.scissor=new Ce(0,0,e,t);this.scissorTest=!1;this.viewport=new Ce(0,0,e,t);r=r||{};this.texture=new p(void 0,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding);this.texture.image={};this.texture.image.width=e;this.texture.image.height=t;this.texture.generateMipmaps=void 0!==r.generateMipmaps?r.generateMipmaps:!1;this.texture.minFilter=void 0!==r.minFilter?r.minFilter:1006;this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0;this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0;this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function r(e,t,r){T.call(this,e,t,r);this.samples=4}function d(e,t,r,n){this._x=e||0;this._y=t||0;this._z=r||0;this._w=void 0!==n?n:1}function Te(e,t,r){this.x=e||0;this.y=t||0;this.z=r||0}function Ee(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function i(e,t,r,n){this._x=e||0;this._y=t||0;this._z=r||0;this._order=n||i.DefaultOrder}function o(){this.mask=1}function f(){Object.defineProperty(this,"id",{value:ia++});this.uuid=Vo.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=f.DefaultUp.clone();var e=new Te,t=new i,r=new d,n=new Te(1,1,1);t._onChange(function(){r.setFromEuler(t,!1)});r._onChange(function(){t.setFromQuaternion(r,void 0,!1)});Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ee},normalMatrix:{value:new m}});this.matrix=new Ee;this.matrixWorld=new Ee;this.matrixAutoUpdate=f.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new o;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={}}function Oe(){f.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.environment=this.background=null;this.autoUpdate=!0;"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function n(e,t){this.min=void 0!==e?e:new Te(Infinity,Infinity,Infinity);this.max=void 0!==t?t:new Te(-Infinity,-Infinity,-Infinity)}function a(e,t,r,n,i){var o;var a=0;for(o=e.length-3;a<=o;a+=3){Pa.fromArray(e,a);var s=i.x*Math.abs(Pa.x)+i.y*Math.abs(Pa.y)+i.z*Math.abs(Pa.z),u=t.dot(Pa),c=r.dot(Pa),l=n.dot(Pa);if(Math.max(-Math.max(u,c,l),Math.min(u,c,l))>s)return!1}return!0}function l(e,t){this.center=void 0!==e?e:new Te;this.radius=void 0!==t?t:-1}function s(e,t){this.origin=void 0!==e?e:new Te;this.direction=void 0!==t?t:new Te(0,0,-1)}function g(e,t){this.normal=void 0!==e?e:new Te(1,0,0);this.constant=void 0!==t?t:0}function b(e,t,r){this.a=void 0!==e?e:new Te;this.b=void 0!==t?t:new Te;this.c=void 0!==r?r:new Te}function v(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)}function u(e,t,r){0>r&&(r+=1);1<r&&--r;return r<1/6?e+6*(t-e)*r:.5>r?t:r<2/3?e+6*(t-e)*(2/3-r):e}function c(e){return.04045>e?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function h(e){return.0031308>e?12.92*e:1.055*Math.pow(e,.41666)-.055}function _(e,t,r,n,i,o){this.a=e;this.b=t;this.c=r;this.normal=n&&n.isVector3?n:new Te;this.vertexNormals=Array.isArray(n)?n:[];this.color=i&&i.isColor?i:new v;this.vertexColors=Array.isArray(i)?i:[];this.materialIndex=void 0!==o?o:0}function y(){Object.defineProperty(this,"id",{value:es++});this.uuid=Vo.generateUUID();this.name="";this.type="Material";this.fog=!0;this.blending=1;this.side=0;this.vertexColors=this.flatShading=!1;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilWriteMask=255;this.stencilFunc=519;this.stencilRef=0;this.stencilFuncMask=255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.toneMapped=this.visible=!0;this.userData={};this.version=0}function x(e){y.call(this);this.type="MeshBasicMaterial";this.color=new v(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphTargets=this.skinning=!1;this.setValues(e)}function E(e,t,r){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="";this.array=e;this.itemSize=t;this.count=void 0!==e?e.length/t:0;this.normalized=!0===r;this.usage=35044;this.updateRange={offset:0,count:-1};this.version=0}function w(e,t,r){E.call(this,new Int8Array(e),t,r)}function S(e,t,r){E.call(this,new Uint8Array(e),t,r)}function M(e,t,r){E.call(this,new Uint8ClampedArray(e),t,r)}function C(e,t,r){E.call(this,new Int16Array(e),t,r)}function O(e,t,r){E.call(this,new Uint16Array(e),t,r)}function P(e,t,r){E.call(this,new Int32Array(e),t,r)}function A(e,t,r){E.call(this,new Uint32Array(e),t,r)}function j(e,t,r){E.call(this,new Float32Array(e),t,r)}function R(e,t,r){E.call(this,new Float64Array(e),t,r)}function k(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function L(e){if(0===e.length)return-Infinity;for(var t=e[0],r=1,n=e.length;r<n;++r)e[r]>t&&(t=e[r]);return t}function N(){Object.defineProperty(this,"id",{value:rs+=2});this.uuid=Vo.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.morphTargetsRelative=!1;this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function I(e,t){f.call(this);this.type="Mesh";this.geometry=void 0!==e?e:new N;this.material=void 0!==t?t:new x;this.updateMorphTargets()}function D(e,t,r,n,i,o,a,s){if(null===(1===t.side?n.intersectTriangle(a,o,i,!0,s):n.intersectTriangle(i,o,a,2!==t.side,s)))return null;Cs.copy(s);Cs.applyMatrix4(e.matrixWorld);t=r.ray.origin.distanceTo(Cs);return t<r.near||t>r.far?null:{distance:t,point:Cs.clone(),object:e}}function B(e,t,r,n,i,o,a,s,u,c,l,h){ps.fromBufferAttribute(i,c);fs.fromBufferAttribute(i,l);ds.fromBufferAttribute(i,h);i=e.morphTargetInfluences;if(t.morphTargets&&o&&i){_s.set(0,0,0);ys.set(0,0,0);bs.set(0,0,0);for(var p=0,f=o.length;p<f;p++){var d=i[p],v=o[p];0!==d&&(vs.fromBufferAttribute(v,c),ms.fromBufferAttribute(v,l),gs.fromBufferAttribute(v,h),a?(_s.addScaledVector(vs,d),ys.addScaledVector(ms,d),bs.addScaledVector(gs,d)):(_s.addScaledVector(vs.sub(ps),d),ys.addScaledVector(ms.sub(fs),d),bs.addScaledVector(gs.sub(ds),d)))}ps.add(_s);fs.add(ys);ds.add(bs)}e.isSkinnedMesh&&(e.boneTransform(c,ps),e.boneTransform(l,fs),e.boneTransform(h,ds));if(e=D(e,t,r,n,ps,fs,ds,Ms))s&&(xs.fromBufferAttribute(s,c),ws.fromBufferAttribute(s,l),Ss.fromBufferAttribute(s,h),e.uv=b.getUV(Ms,ps,fs,ds,xs,ws,Ss,new Me)),u&&(xs.fromBufferAttribute(u,c),ws.fromBufferAttribute(u,l),Ss.fromBufferAttribute(u,h),e.uv2=b.getUV(Ms,ps,fs,ds,xs,ws,Ss,new Me)),s=new _(c,l,h),b.getNormal(ps,fs,ds,s.normal),e.face=s;return e}function F(){Object.defineProperty(this,"id",{value:Ts+=2});this.uuid=Vo.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function z(e){var t={},r;for(r in e){t[r]={};for(var n in e[r]){var i=e[r][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[r][n]=i.clone():Array.isArray(i)?t[r][n]=i.slice():t[r][n]=i}}return t}function $(e){for(var t={},r=0;r<e.length;r++){var n=z(e[r]),i;for(i in n)t[i]=n[i]}return t}function G(e){y.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!1;this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;this.uniformsNeedUpdate=!1;void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function V(){f.call(this);this.type="Camera";this.matrixWorldInverse=new Ee;this.projectionMatrix=new Ee;this.projectionMatrixInverse=new Ee}function H(e,t,r,n){V.call(this);this.type="PerspectiveCamera";this.fov=void 0!==e?e:50;this.zoom=1;this.near=void 0!==r?r:.1;this.far=void 0!==n?n:2e3;this.focus=10;this.aspect=void 0!==t?t:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function U(e,t,a){f.call(this);this.type="CubeCamera";if(!0!==a.isWebGLCubeRenderTarget)console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");else{this.renderTarget=a;var o=new H(90,1,e,t);o.layers=this.layers;o.up.set(0,-1,0);o.lookAt(new Te(1,0,0));this.add(o);var s=new H(90,1,e,t);s.layers=this.layers;s.up.set(0,-1,0);s.lookAt(new Te(-1,0,0));this.add(s);var u=new H(90,1,e,t);u.layers=this.layers;u.up.set(0,0,1);u.lookAt(new Te(0,1,0));this.add(u);var c=new H(90,1,e,t);c.layers=this.layers;c.up.set(0,0,-1);c.lookAt(new Te(0,-1,0));this.add(c);var l=new H(90,1,e,t);l.layers=this.layers;l.up.set(0,-1,0);l.lookAt(new Te(0,0,1));this.add(l);var h=new H(90,1,e,t);h.layers=this.layers;h.up.set(0,-1,0);h.lookAt(new Te(0,0,-1));this.add(h);this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=e.xr.enabled,n=e.getRenderTarget();e.xr.enabled=!1;var i=a.texture.generateMipmaps;a.texture.generateMipmaps=!1;e.setRenderTarget(a,0);e.render(t,o);e.setRenderTarget(a,1);e.render(t,s);e.setRenderTarget(a,2);e.render(t,u);e.setRenderTarget(a,3);e.render(t,c);e.setRenderTarget(a,4);e.render(t,l);a.texture.generateMipmaps=i;e.setRenderTarget(a,5);e.render(t,h);e.setRenderTarget(n);e.xr.enabled=r};this.clear=function(e,t,r,n){for(var i=e.getRenderTarget(),o=0;6>o;o++)e.setRenderTarget(a,o),e.clear(t,r,n);e.setRenderTarget(i)}}}function q(e,t,r){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=r);T.call(this,e,e,t)}function Pe(e,t,r,n,i,o,a,s,u,c,l,h){p.call(this,null,o,a,s,u,c,n,i,l,h);this.image={data:e||null,width:t||1,height:r||1};this.magFilter=void 0!==u?u:1003;this.minFilter=void 0!==c?c:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1;this.needsUpdate=!0}function Ae(e,t,r,n,i,o){this.planes=[void 0!==e?e:new g,void 0!==t?t:new g,void 0!==r?r:new g,void 0!==n?n:new g,void 0!==i?i:new g,void 0!==o?o:new g]}function je(){function r(e,t){!1!==i&&(o(e,t),n.requestAnimationFrame(r))}var n=null,i=!1,o=null;return{start:function(){!0!==i&&null!==o&&(n.requestAnimationFrame(r),i=!0)},stop:function(){i=!1},setAnimationLoop:function(e){o=e},setContext:function(e){n=e}}}function Re(o,e){function a(e,t){var r=e.array,n=e.usage,i=o.createBuffer();o.bindBuffer(t,i);o.bufferData(t,r,n);e.onUploadCallback();t=5126;r instanceof Float32Array?t=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?t=5123:r instanceof Int16Array?t=5122:r instanceof Uint32Array?t=5125:r instanceof Int32Array?t=5124:r instanceof Int8Array?t=5120:r instanceof Uint8Array&&(t=5121);return{buffer:i,type:t,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}var s=e.isWebGL2,u=new WeakMap;return{get:function(e){e.isInterleavedBufferAttribute&&(e=e.data);return u.get(e)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var t=u.get(e);t&&(o.deleteBuffer(t.buffer),u.delete(e))},update:function(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var r=u.get(e);if(void 0===r)u.set(e,a(e,t));else if(r.version<e.version){var n=e.array,i=e.updateRange;o.bindBuffer(t,r.buffer);-1===i.count?o.bufferSubData(t,0,n):(s?o.bufferSubData(t,i.offset*n.BYTES_PER_ELEMENT,n,i.offset,i.count):o.bufferSubData(t,i.offset*n.BYTES_PER_ELEMENT,n.subarray(i.offset,i.offset+i.count)),i.count=-1);r.version=e.version}}}}function W(e,t,r,n){F.call(this);this.type="PlaneGeometry";this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};this.fromBufferGeometry(new X(e,t,r,n));this.mergeVertices()}function X(e,t,r,n){N.call(this);this.type="PlaneBufferGeometry";this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};e=e||1;t=t||1;var i=e/2,o=t/2;r=Math.floor(r)||1;n=Math.floor(n)||1;var a=r+1,s=n+1,u=e/r,c=t/n,l=[],h=[],p=[],f=[];for(e=0;e<s;e++){var d=e*c-o;for(t=0;t<a;t++)h.push(t*u-i,-d,0),p.push(0,0,1),f.push(t/r),f.push(1-e/n)}for(e=0;e<n;e++)for(t=0;t<r;t++)i=t+a*(e+1),o=t+1+a*(e+1),s=t+1+a*e,l.push(t+a*e,i,s),l.push(i,o,s);this.setIndex(l);this.setAttribute("position",new j(h,3));this.setAttribute("normal",new j(p,3));this.setAttribute("uv",new j(f,2))}function ke(i,r,o,n){function a(e,t){r.buffers.color.setClear(e.r,e.g,e.b,t,n)}var s=new v(0),u=0,c,l,h=null,p=0,f=null;return{getClearColor:function(){return s},setClearColor:function(e,t){s.set(e);u=void 0!==t?t:1;a(s,u)},getClearAlpha:function(){return u},setClearAlpha:function(e){u=e;a(s,u)},render:function(e,t,r,n){t=t.background;r=i.xr;(r=r.getSession&&r.getSession())&&"additive"===r.environmentBlendMode&&(t=null);null===t?a(s,u):t&&t.isColor&&(a(t,1),n=!0);(i.autoClear||n)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil);if(t&&(t.isCubeTexture||t.isWebGLCubeRenderTarget||306===t.mapping)){void 0===l&&(l=new I(new js(1,1,1),new G({type:"BackgroundCubeMaterial",uniforms:z(Ds.cube.uniforms),vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),o.update(l));n=t.isWebGLCubeRenderTarget?t.texture:t;l.material.uniforms.envMap.value=n;l.material.uniforms.flipEnvMap.value=n.isCubeTexture?-1:1;if(h!==t||p!==n.version||f!==i.toneMapping)l.material.needsUpdate=!0,h=t,p=n.version,f=i.toneMapping;e.unshift(l,l.geometry,l.material,0,0,null)}else if(t&&t.isTexture){void 0===c&&(c=new I(new X(2,2),new G({type:"BackgroundMaterial",uniforms:z(Ds.background.uniforms),vertexShader:Ds.background.vertexShader,fragmentShader:Ds.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),o.update(c));c.material.uniforms.t2D.value=t;!0===t.matrixAutoUpdate&&t.updateMatrix();c.material.uniforms.uvTransform.value.copy(t.matrix);if(h!==t||p!==t.version||f!==i.toneMapping)c.material.needsUpdate=!0,h=t,p=t.version,f=i.toneMapping;e.unshift(c,c.geometry,c.material,0,0,null)}}}}function Le(o,a,s,e){var u=e.isWebGL2,c;this.setMode=function(e){c=e};this.render=function(e,t){o.drawArrays(c,e,t);s.update(t,c)};this.renderInstances=function(e,t,r,n){if(0!==n){if(u){e=o;var i="drawArraysInstanced"}else if(e=a.get("ANGLE_instanced_arrays"),i="drawArraysInstancedANGLE",null===e){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}e[i](c,t,r,n);s.update(r,c,n)}}}function Ne(t,r,e){function n(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(35633,36338).precision&&0<t.getShaderPrecisionFormat(35632,36338).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(35633,36337).precision&&0<t.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var i,o="undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!==typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,a=void 0!==e.precision?e.precision:"highp",s=n(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);e=!0===e.logarithmicDepthBuffer;s=t.getParameter(34930);var u=t.getParameter(35660),c=t.getParameter(3379),l=t.getParameter(34076),h=t.getParameter(34921),p=t.getParameter(36347),f=t.getParameter(36348),d=t.getParameter(36349),v=0<u,m=o||!!r.get("OES_texture_float"),g=v&&m,_=o?t.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==i)return i;var e=r.get("EXT_texture_filter_anisotropic");return i=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:a,logarithmicDepthBuffer:e,maxTextures:s,maxVertexTextures:u,maxTextureSize:c,maxCubemapSize:l,maxAttributes:h,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:d,vertexTextures:v,floatFragmentTextures:m,floatVertexTextures:g,maxSamples:_}}function Ie(){function u(){v.value!==l&&(v.value=l,v.needsUpdate=0<h);a.numPlanes=h;a.numIntersection=0}function c(e,t,r,n){var i=null!==e?e.length:0,o=null;if(0!==i){o=v.value;if(!0!==n||null===o){n=r+4*i;t=t.matrixWorldInverse;d.getNormalMatrix(t);if(null===o||o.length<n)o=new Float32Array(n);for(n=0;n!==i;++n,r+=4)s.copy(e[n]).applyMatrix4(t,d),s.normal.toArray(o,r),o[r+3]=s.constant}v.value=o;v.needsUpdate=!0}a.numPlanes=i;a.numIntersection=0;return o}var a=this,l=null,h=0,p=!1,f=!1,s=new g,d=new m,v={value:null,needsUpdate:!1};this.uniform=v;this.numIntersection=this.numPlanes=0;this.init=function(e,t,r){var n=0!==e.length||t||0!==h||p;p=t;l=c(e,r,0);h=e.length;return n};this.beginShadows=function(){f=!0;c(null)};this.endShadows=function(){f=!1;u()};this.setState=function(e,t,r,n,i,o){if(!p||null===e||0===e.length||f&&!r)f?c(null):u();else{r=f?0:h;var a=4*r,s=i.clippingState||null;v.value=s;s=c(e,n,a,o);for(e=0;e!==a;++e)s[e]=l[e];i.clippingState=s;this.numIntersection=t?this.numPlanes:0;this.numPlanes+=r}}}function De(r){var n={};return{get:function(e){if(void 0!==n[e])return n[e];switch(e){case"WEBGL_depth_texture":var t=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:t=r.getExtension(e)}null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported.");return n[e]=t}}}function Be(e,c,n){function i(e){var t=e.target;e=a.get(t);null!==e.index&&c.remove(e.index);for(var r in e.attributes)c.remove(e.attributes[r]);t.removeEventListener("dispose",i);a.delete(t);if(r=l.get(e))c.remove(r),l.delete(e);n.memory.geometries--}function o(e){var t=[],r=e.index,n=e.attributes.position;if(null!==r){var i=r.array;r=r.version;n=0;for(var o=i.length;n<o;n+=3){var a=i[n+0],s=i[n+1],u=i[n+2];t.push(a,s,s,u,u,a)}}else for(i=n.array,r=n.version,n=0,o=i.length/3-1;n<o;n+=3)a=n+0,s=n+1,u=n+2,t.push(a,s,s,u,u,a);t=new(65535<L(t)?A:O)(t,1);t.version=r;c.update(t,34963);(i=l.get(e))&&c.remove(i);l.set(e,t)}var a=new WeakMap,l=new WeakMap;return{get:function(e,t){var r=a.get(t);if(r)return r;t.addEventListener("dispose",i);t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new N).setFromObject(e)),r=t._bufferGeometry);a.set(t,r);n.memory.geometries++;return r},update:function(e){var t=e.index,r=e.attributes;null!==t&&c.update(t,34963);for(var n in r)c.update(r[n],34962);e=e.morphAttributes;for(n in e){t=e[n];r=0;for(var i=t.length;r<i;r++)c.update(t[r],34962)}},getWireframeAttribute:function(e){var t=l.get(e);if(t){var r=e.index;null!==r&&t.version<r.version&&o(e)}else o(e);return l.get(e)}}}function Fe(o,a,s,e){var u=e.isWebGL2,c,l,h;this.setMode=function(e){c=e};this.setIndex=function(e){l=e.type;h=e.bytesPerElement};this.render=function(e,t){o.drawElements(c,t,l,e*h);s.update(t,c)};this.renderInstances=function(e,t,r,n){if(0!==n){if(u){e=o;var i="drawElementsInstanced"}else if(e=a.get("ANGLE_instanced_arrays"),i="drawElementsInstancedANGLE",null===e){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}e[i](c,r,l,t*h,n);s.update(r,c,n)}}}function ze(e){var n={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:n,programs:null,autoReset:!0,reset:function(){n.frame++;n.calls=0;n.triangles=0;n.points=0;n.lines=0},update:function(e,t,r){r=r||1;n.calls++;switch(t){case 4:n.triangles+=e/3*r;break;case 1:n.lines+=e/2*r;break;case 3:n.lines+=r*(e-1);break;case 2:n.lines+=r*e;break;case 0:n.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",t)}}}}function Y(e,t){return Math.abs(t[1])-Math.abs(e[1])}function $e(c){var l={},h=new Float32Array(8);return{update:function(e,t,r,n){var i=e.morphTargetInfluences,o=void 0===i?0:i.length;e=l[t.id];if(void 0===e){e=[];for(var a=0;a<o;a++)e[a]=[a,0];l[t.id]=e}var s=r.morphTargets&&t.morphAttributes.position;r=r.morphNormals&&t.morphAttributes.normal;for(a=0;a<o;a++){var u=e[a];0!==u[1]&&(s&&t.deleteAttribute("morphTarget"+a),r&&t.deleteAttribute("morphNormal"+a))}for(a=0;a<o;a++)u=e[a],u[0]=a,u[1]=i[a];e.sort(Y);for(a=i=0;8>a;a++){if(u=e[a])if(o=u[0],u=u[1]){s&&t.setAttribute("morphTarget"+a,s[o]);r&&t.setAttribute("morphNormal"+a,r[o]);h[a]=u;i+=u;continue}h[a]=0}t=t.morphTargetsRelative?1:1-i;n.getUniforms().setValue(c,"morphTargetBaseInfluence",t);n.getUniforms().setValue(c,"morphTargetInfluences",h)}}}function Ge(e,i,o,a){var s=new WeakMap;return{update:function(e){var t=a.render.frame,r=e.geometry,n=i.get(e,r);s.get(n)!==t&&(r.isGeometry&&n.updateFromObject(e),i.update(n),s.set(n,t));e.isInstancedMesh&&o.update(e.instanceMatrix,34962);return n},dispose:function(){s=new WeakMap}}}function K(e,t,r,n,i,o,a,s,u,c){e=void 0!==e?e:[];p.call(this,e,void 0!==t?t:301,r,n,i,o,void 0!==a?a:1022,s,u,c);this.flipY=!1}function Z(e,t,r,n){p.call(this,null);this.image={data:e||null,width:t||1,height:r||1,depth:n||1};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1;this.needsUpdate=!0}function J(e,t,r,n){p.call(this,null);this.image={data:e||null,width:t||1,height:r||1,depth:n||1};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1;this.needsUpdate=!0}function Q(e,t,r){var n=e[0];if(0>=n||0<n)return e;var i=t*r,o=Gs[i];void 0===o&&(o=new Float32Array(i),Gs[i]=o);if(0!==t)for(n.toArray(o,0),n=1,i=0;n!==t;++n)i+=r,e[n].toArray(o,i);return o}function ee(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function te(e,t){for(var r=0,n=t.length;r<n;r++)e[r]=t[r]}function re(e,t){var r=Vs[t];void 0===r&&(r=new Int32Array(t),Vs[t]=r);for(var n=0;n!==t;++n)r[n]=e.allocateTextureUnit();return r}function ne(e,t){var r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function ie(e,t){var r=this.cache;if(void 0!==t.x){if(r[0]!==t.x||r[1]!==t.y)e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y}else ee(r,t)||(e.uniform2fv(this.addr,t),te(r,t))}function oe(e,t){var r=this.cache;if(void 0!==t.x){if(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z}else if(void 0!==t.r){if(r[0]!==t.r||r[1]!==t.g||r[2]!==t.b)e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b}else ee(r,t)||(e.uniform3fv(this.addr,t),te(r,t))}function ae(e,t){var r=this.cache;if(void 0!==t.x){if(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w}else ee(r,t)||(e.uniform4fv(this.addr,t),te(r,t))}function se(e,t){var r=this.cache,n=t.elements;void 0===n?ee(r,t)||(e.uniformMatrix2fv(this.addr,!1,t),te(r,t)):ee(r,n)||(qs.set(n),e.uniformMatrix2fv(this.addr,!1,qs),te(r,n))}function ue(e,t){var r=this.cache,n=t.elements;void 0===n?ee(r,t)||(e.uniformMatrix3fv(this.addr,!1,t),te(r,t)):ee(r,n)||(Us.set(n),e.uniformMatrix3fv(this.addr,!1,Us),te(r,n))}function ce(e,t){var r=this.cache,n=t.elements;void 0===n?ee(r,t)||(e.uniformMatrix4fv(this.addr,!1,t),te(r,t)):ee(r,n)||(Hs.set(n),e.uniformMatrix4fv(this.addr,!1,Hs),te(r,n))}function le(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i);r.safeSetTexture2D(t||Bs,i)}function he(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i);r.setTexture2DArray(t||Fs,i)}function pe(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i);r.setTexture3D(t||zs,i)}function fe(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i);r.safeSetTextureCube(t||$s,i)}function de(e,t){var r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function ve(e,t){var r=this.cache;ee(r,t)||(e.uniform2iv(this.addr,t),te(r,t))}function me(e,t){var r=this.cache;ee(r,t)||(e.uniform3iv(this.addr,t),te(r,t))}function ge(e,t){var r=this.cache;ee(r,t)||(e.uniform4iv(this.addr,t),te(r,t))}function _e(e,t){var r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function ye(e){switch(e){case 5126:return ne;case 35664:return ie;case 35665:return oe;case 35666:return ae;case 35674:return se;case 35675:return ue;case 35676:return ce;case 5124:case 35670:return de;case 35667:case 35671:return ve;case 35668:case 35672:return me;case 35669:case 35673:return ge;case 5125:return _e;case 35678:case 36198:case 36298:case 36306:case 35682:return le;case 35679:case 36299:case 36307:return pe;case 35680:case 36300:case 36308:case 36293:return fe;case 36289:case 36303:case 36311:case 36292:return he}}function be(e,t){e.uniform1fv(this.addr,t)}function xe(e,t){e.uniform1iv(this.addr,t)}function we(e,t){e.uniform2iv(this.addr,t)}function Se(e,t){e.uniform3iv(this.addr,t)}function Ve(e,t){e.uniform4iv(this.addr,t)}function He(e,t){t=Q(t,this.size,2);e.uniform2fv(this.addr,t)}function Ue(e,t){t=Q(t,this.size,3);e.uniform3fv(this.addr,t)}function qe(e,t){t=Q(t,this.size,4);e.uniform4fv(this.addr,t)}function We(e,t){t=Q(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,t)}function Xe(e,t){t=Q(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,t)}function Ye(e,t){t=Q(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,t)}function Ke(e,t,r){var n=t.length,i=re(r,n);e.uniform1iv(this.addr,i);for(e=0;e!==n;++e)r.safeSetTexture2D(t[e]||Bs,i[e])}function Ze(e,t,r){var n=t.length,i=re(r,n);e.uniform1iv(this.addr,i);for(e=0;e!==n;++e)r.safeSetTextureCube(t[e]||$s,i[e])}function Je(e){switch(e){case 5126:return be;case 35664:return He;case 35665:return Ue;case 35666:return qe;case 35674:return We;case 35675:return Xe;case 35676:return Ye;case 5124:case 35670:return xe;case 35667:case 35671:return we;case 35668:case 35672:return Se;case 35669:case 35673:return Ve;case 35678:case 36198:case 36298:case 36306:case 35682:return Ke;case 35680:case 36300:case 36308:case 36293:return Ze}}function Qe(e,t,r){this.id=e;this.addr=r;this.cache=[];this.setValue=ye(t.type)}function et(e,t,r){this.id=e;this.addr=r;this.cache=[];this.size=t.size;this.setValue=Je(t.type)}function tt(e){this.id=e;this.seq=[];this.map={}}function rt(e,t){this.seq=[];this.map={};for(var r=e.getProgramParameter(t,35718),n=0;n<r;++n){var i=e.getActiveUniform(t,n),o=e.getUniformLocation(t,i.name),a=this,s=i.name,u=s.length;for(Ws.lastIndex=0;;){var c=Ws.exec(s),l=Ws.lastIndex,h=c[1],p=c[3];"]"===c[2]&&(h|=0);if(void 0===p||"["===p&&l+2===u){s=a;i=void 0===p?new Qe(h,i,o):new et(h,i,o);s.seq.push(i);s.map[i.id]=i;break}else p=a.map[h],void 0===p&&(p=new tt(h),h=a,a=p,h.seq.push(a),h.map[a.id]=a),a=p}}}function nt(e,t,r){t=e.createShader(t);e.shaderSource(t,r);e.compileShader(t);return t}function it(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:throw Error("unsupported encoding: "+e)}}function ot(e,t,r){var n=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(n&&""===i)return"";e=e.getShaderSource(t).split("\n");for(t=0;t<e.length;t++)e[t]=t+1+": "+e[t];e=e.join("\n");return"THREE.WebGLShader: gl.getShaderInfoLog() "+r+"\n"+i+e}function at(e,t){t=it(t);return"vec4 "+e+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function st(e,t){t=it(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function ut(e,t){switch(t){case 1:t="Linear";break;case 2:t="Reinhard";break;case 3:t="Uncharted2";break;case 4:t="OptimizedCineon";break;case 5:t="ACESFilmic";break;default:throw Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function ct(e){var t=[],r;for(r in e){var n=e[r];!1!==n&&t.push("#define "+r+" "+n)}return t.join("\n")}function lt(e){return""!==e}function ht(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function pt(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function ft(e,t){e=Is[t];if(void 0===e)throw Error("Can not resolve #include <"+t+">");return e.replace(Ys,ft)}function dt(e,t,r,n){console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.");return vt(e,t,r,n)}function vt(e,t,r,n){e="";for(t=parseInt(t);t<parseInt(r);t++)e+=n.replace(/\[ i \]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return e}function mt(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION");return t}function gt(e){var t="SHADOWMAP_TYPE_BASIC";1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM");return t}function _t(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:case 307:t="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:t="ENVMAP_TYPE_EQUIREC";break;case 305:t="ENVMAP_TYPE_SPHERE"}return t}function yt(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 304:t="ENVMAP_MODE_REFRACTION"}return t}function bt(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}function xt(e,t,r){var i=e.getContext(),n=r.defines,o=r.vertexShader,a=r.fragmentShader,s=gt(r),u=_t(r),c=yt(r),l=bt(r),h=0<e.gammaFactor?e.gammaFactor:1,p=r.isWebGL2?"":[r.extensionDerivatives||r.envMapCubeUV||r.bumpMap||r.tangentSpaceNormalMap||r.clearcoatNormalMap||r.flatShading||"physical"===r.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(lt).join("\n"),f=ct(n),d=i.createProgram();r.isRawShaderMaterial?(n=[f].filter(lt).join("\n"),0<n.length&&(n+="\n"),s=[p,f].filter(lt).join("\n"),0<s.length&&(s+="\n")):(n=[mt(r),"#define SHADER_NAME "+r.shaderName,f,r.instancing?"#define USE_INSTANCING":"",r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+h,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+c:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+s:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(lt).join("\n"),s=[p,mt(r),"#define SHADER_NAME "+r.shaderName,f,r.alphaTest?"#define ALPHATEST "+r.alphaTest+(r.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+h,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+u:"",r.envMap?"#define "+c:"",r.envMap?"#define "+l:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.sheen?"#define USE_SHEEN":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+s:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(r.extensionShaderTextureLOD||r.envMap)&&r.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==r.toneMapping?"#define TONE_MAPPING":"",0!==r.toneMapping?Is.tonemapping_pars_fragment:"",0!==r.toneMapping?ut("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.outputEncoding||r.mapEncoding||r.matcapEncoding||r.envMapEncoding||r.emissiveMapEncoding||r.lightMapEncoding?Is.encodings_pars_fragment:"",r.mapEncoding?at("mapTexelToLinear",r.mapEncoding):"",r.matcapEncoding?at("matcapTexelToLinear",r.matcapEncoding):"",r.envMapEncoding?at("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?at("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.lightMapEncoding?at("lightMapTexelToLinear",r.lightMapEncoding):"",r.outputEncoding?st("linearToOutputTexel",r.outputEncoding):"",r.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(lt).join("\n"));o=o.replace(Ys,ft);o=ht(o,r);o=pt(o,r);a=a.replace(Ys,ft);a=ht(a,r);a=pt(a,r);o=o.replace(Zs,vt).replace(Ks,dt);a=a.replace(Zs,vt).replace(Ks,dt);r.isWebGL2&&!r.isRawShaderMaterial&&(u=!1,c=/^\s*#version\s+300\s+es\s*\n/,r.isShaderMaterial&&null!==o.match(c)&&null!==a.match(c)&&(u=!0,o=o.replace(c,""),a=a.replace(c,"")),n="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+n,s=["#version 300 es\n\n#define varying in",u?"":"out highp vec4 pc_fragColor;",u?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+s);a=s+a;o=nt(i,35633,n+o);a=nt(i,35632,a);i.attachShader(d,o);i.attachShader(d,a);void 0!==r.index0AttributeName?i.bindAttribLocation(d,0,r.index0AttributeName):!0===r.morphTargets&&i.bindAttribLocation(d,0,"position");i.linkProgram(d);if(e.debug.checkShaderErrors){e=i.getProgramInfoLog(d).trim();u=i.getShaderInfoLog(o).trim();c=i.getShaderInfoLog(a).trim();h=l=!0;if(!1===i.getProgramParameter(d,35714))l=!1,p=ot(i,o,"vertex"),f=ot(i,a,"fragment"),console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(d,35715),"gl.getProgramInfoLog",e,p,f);else if(""!==e)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",e);else if(""===u||""===c)h=!1;h&&(this.diagnostics={runnable:l,programLog:e,vertexShader:{log:u,prefix:n},fragmentShader:{log:c,prefix:s}})}i.deleteShader(o);i.deleteShader(a);var v;this.getUniforms=function(){void 0===v&&(v=new rt(i,d));return v};var m;this.getAttributes=function(){if(void 0===m){for(var e={},t=i.getProgramParameter(d,35721),r=0;r<t;r++){var n=i.getActiveAttrib(d,r).name;e[n]=i.getAttribLocation(d,n)}m=e}return m};this.destroy=function(){i.deleteProgram(d);this.program=void 0};this.name=r.shaderName;this.id=Xs++;this.cacheKey=t;this.usedTimes=1;this.program=d;this.vertexShader=o;this.fragmentShader=a;return this}function wt(p,f,d){function v(e){if(e)e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding);else var t=3e3;return t}var a=[],m=d.isWebGL2,g=d.logarithmicDepthBuffer,_=d.floatVertexTextures,y=d.precision,b=d.maxVertexUniforms,x=d.vertexTextures,w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},n="precision isWebGL2 supportsVertexTextures outputEncoding instancing map mapEncoding matcap matcapEncoding envMap envMapMode envMapEncoding envMapCubeUV lightMap lightMapEncoding aoMap emissiveMap emissiveMapEncoding bumpMap normalMap objectSpaceNormalMap tangentSpaceNormalMap clearcoatMap clearcoatRoughnessMap clearcoatNormalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors vertexTangents vertexUvs uvsVertexOnly fog useFog fogExp2 flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights numDirLightShadows numPointLightShadows numSpotLightShadows shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering sheen".split(" ");this.getParameters=function(e,t,r,n,i,o,a){var s=n.fog;n=e.isMeshStandardMaterial?n.environment:null;n=e.envMap||n;var u=w[e.type];if(a.isSkinnedMesh){var c=a.skeleton.bones;if(_)c=1024;else{var l=Math.min(Math.floor((b-20)/4),c.length);l<c.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+c.length+" bones. This GPU supports "+l+"."),c=0):c=l}}else c=0;null!==e.precision&&(y=d.getMaxPrecision(e.precision),y!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",y,"instead."));u?(l=Ds[u],l={name:e.type,uniforms:Rs.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):l={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.onBeforeCompile(l,p);var h=p.getRenderTarget();return{isWebGL2:m,shaderID:u,shaderName:l.name,uniforms:l.uniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,defines:e.defines,isRawShaderMaterial:e.isRawShaderMaterial,isShaderMaterial:e.isShaderMaterial,precision:y,instancing:!0===a.isInstancedMesh,supportsVertexTextures:x,outputEncoding:null!==h?v(h.texture):p.outputEncoding,map:!!e.map,mapEncoding:v(e.map),matcap:!!e.matcap,matcapEncoding:v(e.matcap),envMap:!!n,envMapMode:n&&n.mapping,envMapEncoding:v(n),envMapCubeUV:!!n&&(306===n.mapping||307===n.mapping),lightMap:!!e.lightMap,lightMapEncoding:v(e.lightMap),aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:v(e.emissiveMap),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:1===e.normalMapType,tangentSpaceNormalMap:0===e.normalMapType,clearcoatMap:!!e.clearcoatMap,clearcoatRoughnessMap:!!e.clearcoatRoughnessMap,clearcoatNormalMap:!!e.clearcoatNormalMap,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,sheen:!!e.sheen,combine:e.combine,vertexTangents:e.normalMap&&e.vertexTangents,vertexColors:e.vertexColors,vertexUvs:!!e.map||!!e.bumpMap||!!e.normalMap||!!e.specularMap||!!e.alphaMap||!!e.emissiveMap||!!e.roughnessMap||!!e.metalnessMap||!!e.clearcoatMap||!!e.clearcoatRoughnessMap||!!e.clearcoatNormalMap||!!e.displacementMap,uvsVertexOnly:!(e.map||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e.emissiveMap||e.roughnessMap||e.metalnessMap||e.clearcoatNormalMap)&&!!e.displacementMap,fog:!!s,useFog:e.fog,fogExp2:s&&s.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:g,skinning:e.skinning&&0<c,maxBones:c,useVertexTexture:_,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:p.maxMorphTargets,maxMorphNormals:p.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numDirLightShadows:t.directionalShadowMap.length,numPointLightShadows:t.pointShadowMap.length,numSpotLightShadows:t.spotShadowMap.length,numClippingPlanes:i,numClipIntersection:o,dithering:e.dithering,shadowMapEnabled:p.shadowMap.enabled&&0<r.length,shadowMapType:p.shadowMap.type,toneMapping:e.toneMapped?p.toneMapping:0,physicallyCorrectLights:p.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:2===e.side,flipSided:1===e.side,depthPacking:void 0!==e.depthPacking?e.depthPacking:!1,index0AttributeName:e.index0AttributeName,extensionDerivatives:e.extensions&&e.extensions.derivatives,extensionFragDepth:e.extensions&&e.extensions.fragDepth,extensionDrawBuffers:e.extensions&&e.extensions.drawBuffers,extensionShaderTextureLOD:e.extensions&&e.extensions.shaderTextureLOD,rendererExtensionFragDepth:m||null!==f.get("EXT_frag_depth"),rendererExtensionDrawBuffers:m||null!==f.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:m||null!==f.get("EXT_shader_texture_lod"),onBeforeCompile:e.onBeforeCompile}};this.getProgramCacheKey=function(e){var t=[];e.shaderID?t.push(e.shaderID):(t.push(e.fragmentShader),t.push(e.vertexShader));if(void 0!==e.defines)for(var r in e.defines)t.push(r),t.push(e.defines[r]);if(void 0===e.isRawShaderMaterial){for(r=0;r<n.length;r++)t.push(e[n[r]]);t.push(p.outputEncoding);t.push(p.gammaFactor)}t.push(e.onBeforeCompile.toString());return t.join()};this.acquireProgram=function(e,t){for(var r,n=0,i=a.length;n<i;n++){var o=a[n];if(o.cacheKey===t){r=o;++r.usedTimes;break}}void 0===r&&(r=new xt(p,t,e),a.push(r));return r};this.releaseProgram=function(e){if(0===--e.usedTimes){var t=a.indexOf(e);a[t]=a[a.length-1];a.pop();e.destroy()}};this.programs=a}function St(){var n=new WeakMap;return{get:function(e){var t=n.get(e);void 0===t&&(t={},n.set(e,t));return t},remove:function(e){n.delete(e)},update:function(e,t,r){n.get(e)[t]=r},dispose:function(){n=new WeakMap}}}function Mt(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Ct(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Tt(){function a(e,t,r,n,i,o){var a=s[u];void 0===a?(a={id:e.id,object:e,geometry:t,material:r,program:r.program||h,groupOrder:n,renderOrder:e.renderOrder,z:i,group:o},s[u]=a):(a.id=e.id,a.object=e,a.geometry=t,a.material=r,a.program=r.program||h,a.groupOrder=n,a.renderOrder=e.renderOrder,a.z=i,a.group=o);u++;return a}var s=[],u=0,c=[],l=[],h={id:-1};return{opaque:c,transparent:l,init:function(){u=0;c.length=0;l.length=0},push:function(e,t,r,n,i,o){e=a(e,t,r,n,i,o);(!0===r.transparent?l:c).push(e)},unshift:function(e,t,r,n,i,o){e=a(e,t,r,n,i,o);(!0===r.transparent?l:c).unshift(e)},finish:function(){for(var e=u,t=s.length;e<t;e++){var r=s[e];if(null===r.id)break;r.id=null;r.object=null;r.geometry=null;r.material=null;r.program=null;r.group=null}},sort:function(e,t){1<c.length&&c.sort(e||Mt);1<l.length&&l.sort(t||Ct)}}}function Et(){function i(e){e=e.target;e.removeEventListener("dispose",i);o.delete(e)}var o=new WeakMap;return{get:function(e,t){var r=o.get(e);if(void 0===r){var n=new Tt;o.set(e,new WeakMap);o.get(e).set(t,n);e.addEventListener("dispose",i)}else n=r.get(t),void 0===n&&(n=new Tt,r.set(t,n));return n},dispose:function(){o=new WeakMap}}}function Ot(){var r={};return{get:function(e){if(void 0!==r[e.id])return r[e.id];switch(e.type){case"DirectionalLight":var t={direction:new Te,color:new v};break;case"SpotLight":t={position:new Te,direction:new Te,color:new v,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Te,color:new v,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Te,skyColor:new v,groundColor:new v};break;case"RectAreaLight":t={color:new v,position:new Te,halfWidth:new Te,halfHeight:new Te}}return r[e.id]=t}}}function Pt(){var r={};return{get:function(e){if(void 0!==r[e.id])return r[e.id];switch(e.type){case"DirectionalLight":var t={shadowBias:0,shadowRadius:1,shadowMapSize:new Me};break;case"SpotLight":t={shadowBias:0,shadowRadius:1,shadowMapSize:new Me};break;case"PointLight":t={shadowBias:0,shadowRadius:1,shadowMapSize:new Me,shadowCameraNear:1,shadowCameraFar:1e3}}return r[e.id]=t}}}function At(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function jt(){for(var x=new Ot,w=Pt(),S={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},e=0;9>e;e++)S.probe.push(new Te);var M=new Te,C=new Ee,T=new Ee;return{setup:function(e,t,r){for(var n=0,i=0,o=0,a=0;9>a;a++)S.probe[a].set(0,0,0);var s=t=0,u=0,c=0,l=0,h=0,p=0,f=0;r=r.matrixWorldInverse;e.sort(At);a=0;for(var d=e.length;a<d;a++){var v=e[a],m=v.color,g=v.intensity,_=v.distance,y=v.shadow&&v.shadow.map?v.shadow.map.texture:null;if(v.isAmbientLight)n+=m.r*g,i+=m.g*g,o+=m.b*g;else if(v.isLightProbe)for(y=0;9>y;y++)S.probe[y].addScaledVector(v.sh.coefficients[y],g);else if(v.isDirectionalLight){var b=x.get(v);b.color.copy(v.color).multiplyScalar(v.intensity);b.direction.setFromMatrixPosition(v.matrixWorld);M.setFromMatrixPosition(v.target.matrixWorld);b.direction.sub(M);b.direction.transformDirection(r);v.castShadow&&(g=v.shadow,m=w.get(v),m.shadowBias=g.bias,m.shadowRadius=g.radius,m.shadowMapSize=g.mapSize,S.directionalShadow[t]=m,S.directionalShadowMap[t]=y,S.directionalShadowMatrix[t]=v.shadow.matrix,h++);S.directional[t]=b;t++}else v.isSpotLight?(b=x.get(v),b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(r),b.color.copy(m).multiplyScalar(g),b.distance=_,b.direction.setFromMatrixPosition(v.matrixWorld),M.setFromMatrixPosition(v.target.matrixWorld),b.direction.sub(M),b.direction.transformDirection(r),b.coneCos=Math.cos(v.angle),b.penumbraCos=Math.cos(v.angle*(1-v.penumbra)),b.decay=v.decay,v.castShadow&&(g=v.shadow,m=w.get(v),m.shadowBias=g.bias,m.shadowRadius=g.radius,m.shadowMapSize=g.mapSize,S.spotShadow[u]=m,S.spotShadowMap[u]=y,S.spotShadowMatrix[u]=v.shadow.matrix,f++),S.spot[u]=b,u++):v.isRectAreaLight?(b=x.get(v),b.color.copy(m).multiplyScalar(g),b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(r),T.identity(),C.copy(v.matrixWorld),C.premultiply(r),T.extractRotation(C),b.halfWidth.set(.5*v.width,0,0),b.halfHeight.set(0,.5*v.height,0),b.halfWidth.applyMatrix4(T),b.halfHeight.applyMatrix4(T),S.rectArea[c]=b,c++):v.isPointLight?(b=x.get(v),b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(r),b.color.copy(v.color).multiplyScalar(v.intensity),b.distance=v.distance,b.decay=v.decay,v.castShadow&&(g=v.shadow,m=w.get(v),m.shadowBias=g.bias,m.shadowRadius=g.radius,m.shadowMapSize=g.mapSize,m.shadowCameraNear=g.camera.near,m.shadowCameraFar=g.camera.far,S.pointShadow[s]=m,S.pointShadowMap[s]=y,S.pointShadowMatrix[s]=v.shadow.matrix,p++),S.point[s]=b,s++):v.isHemisphereLight&&(b=x.get(v),b.direction.setFromMatrixPosition(v.matrixWorld),b.direction.transformDirection(r),b.direction.normalize(),b.skyColor.copy(v.color).multiplyScalar(g),b.groundColor.copy(v.groundColor).multiplyScalar(g),S.hemi[l]=b,l++)}S.ambient[0]=n;S.ambient[1]=i;S.ambient[2]=o;e=S.hash;if(e.directionalLength!==t||e.pointLength!==s||e.spotLength!==u||e.rectAreaLength!==c||e.hemiLength!==l||e.numDirectionalShadows!==h||e.numPointShadows!==p||e.numSpotShadows!==f)S.directional.length=t,S.spot.length=u,S.rectArea.length=c,S.point.length=s,S.hemi.length=l,S.directionalShadow.length=h,S.directionalShadowMap.length=h,S.pointShadow.length=p,S.pointShadowMap.length=p,S.spotShadow.length=f,S.spotShadowMap.length=f,S.directionalShadowMatrix.length=h,S.pointShadowMatrix.length=p,S.spotShadowMatrix.length=f,e.directionalLength=t,e.pointLength=s,e.spotLength=u,e.rectAreaLength=c,e.hemiLength=l,e.numDirectionalShadows=h,e.numPointShadows=p,e.numSpotShadows=f,S.version=Js++},state:S}}function Rt(){var t=new jt,r=[],n=[];return{init:function(){r.length=0;n.length=0},state:{lightsArray:r,shadowsArray:n,lights:t},setupLights:function(e){t.setup(r,n,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){n.push(e)}}}function kt(){function n(e){e=e.target;e.removeEventListener("dispose",n);i.delete(e)}var i=new WeakMap;return{get:function(e,t){if(!1===i.has(e)){var r=new Rt;i.set(e,new WeakMap);i.get(e).set(t,r);e.addEventListener("dispose",n)}else!1===i.get(e).has(t)?(r=new Rt,i.get(e).set(t,r)):r=i.get(e).get(t);return r},dispose:function(){i=new WeakMap}}}function Lt(e){y.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.fog=!1;this.setValues(e)}function Nt(e){y.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new Te;this.nearDistance=1;this.farDistance=1e3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.fog=!1;this.setValues(e)}function It(d,v,m){function c(e,t,r){r=e<<0|t<<1|r<<2;var n=i[r];void 0===n&&(n=new Lt({depthPacking:3201,morphTargets:e,skinning:t}),i[r]=n);return n}function l(e,t,r){r=e<<0|t<<1|r<<2;var n=o[r];void 0===n&&(n=new Nt({morphTargets:e,skinning:t}),o[r]=n);return n}function p(e,t,r,n,i,o,a){var s=c,u=e.customDepthMaterial;!0===n.isPointLight&&(s=l,u=e.customDistanceMaterial);void 0===u?(u=!1,!0===r.morphTargets&&(u=t.morphAttributes&&t.morphAttributes.position&&0<t.morphAttributes.position.length),t=!1,!0===e.isSkinnedMesh&&(!0===r.skinning?t=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),e=s(u,t,!0===e.isInstancedMesh)):e=u;d.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length&&(u=e.uuid,s=r.uuid,t=h[u],void 0===t&&(t={},h[u]=t),u=t[s],void 0===u&&(u=e.clone(),t[s]=u),e=u);e.visible=r.visible;e.wireframe=r.wireframe;e.side=3===a?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side];e.clipShadows=r.clipShadows;e.clippingPlanes=r.clippingPlanes;e.clipIntersection=r.clipIntersection;e.wireframeLinewidth=r.wireframeLinewidth;e.linewidth=r.linewidth;!0===n.isPointLight&&!0===e.isMeshDistanceMaterial&&(e.referencePosition.setFromMatrixPosition(n.matrixWorld),e.nearDistance=i,e.farDistance=o);return e}function g(e,t,r,n,i){if(!1!==e.visible){if(e.layers.test(t.layers)&&(e.isMesh||e.isLine||e.isPoints)&&(e.castShadow||e.receiveShadow&&3===i)&&(!e.frustumCulled||_.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld);var o=v.update(e),a=e.material;if(Array.isArray(a))for(var s=o.groups,u=0,c=s.length;u<c;u++){var l=s[u],h=a[l.materialIndex];h&&h.visible&&(h=p(e,o,h,n,r.near,r.far,i),d.renderBufferDirect(r,null,o,h,e,l))}else a.visible&&(h=p(e,o,a,n,r.near,r.far,i),d.renderBufferDirect(r,null,o,h,e,null))}e=e.children;o=0;for(a=e.length;o<a;o++)g(e[o],t,r,n,i)}}var _=new Ae,y=new Me,b=new Me,x=new Ce,i=[],o=[],h={},f={0:1,1:0,2:2},w=new G({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:.125},uniforms:{shadow_pass:{value:null},resolution:{value:new Me},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n  float mean = 0.0;\n  float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy  ) / resolution ) );\n  for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n    #ifdef HORIZONAL_PASS\n      vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n      mean += distribution.x;\n      squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n    #else\n      float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0,  i )  * radius ) / resolution ) );\n      mean += depth;\n      squared_mean += depth * depth;\n    #endif\n  }\n  mean = mean * HALF_SAMPLE_RATE;\n  squared_mean = squared_mean * HALF_SAMPLE_RATE;\n  float std_dev = sqrt( squared_mean - mean * mean );\n  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),S=w.clone();S.defines.HORIZONAL_PASS=1;var e=new N;e.setAttribute("position",new E(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var M=new I(e,w),C=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(e,t,r){if(!1!==C.enabled&&(!1!==C.autoUpdate||!1!==C.needsUpdate)&&0!==e.length){var n=d.getRenderTarget(),i=d.getActiveCubeFace(),o=d.getActiveMipmapLevel(),a=d.state;a.setBlending(0);a.buffers.color.setClear(1,1,1,1);a.buffers.depth.setTest(!0);a.setScissorTest(!1);for(var s=0,u=e.length;s<u;s++){var c=e[s],l=c.shadow;if(void 0===l)console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");else{y.copy(l.mapSize);var h=l.getFrameExtents();y.multiply(h);b.copy(l.mapSize);if(y.x>m||y.y>m)y.x>m&&(b.x=Math.floor(m/h.x),y.x=b.x*h.x,l.mapSize.x=b.x),y.y>m&&(b.y=Math.floor(m/h.y),y.y=b.y*h.y,l.mapSize.y=b.y);null!==l.map||l.isPointLightShadow||3!==this.type||(h={minFilter:1006,magFilter:1006,format:1023},l.map=new T(y.x,y.y,h),l.map.texture.name=c.name+".shadowMap",l.mapPass=new T(y.x,y.y,h),l.camera.updateProjectionMatrix());null===l.map&&(h={minFilter:1003,magFilter:1003,format:1023},l.map=new T(y.x,y.y,h),l.map.texture.name=c.name+".shadowMap",l.camera.updateProjectionMatrix());d.setRenderTarget(l.map);d.clear();h=l.getViewportCount();for(var p=0;p<h;p++){var f=l.getViewport(p);x.set(b.x*f.x,b.y*f.y,b.x*f.z,b.y*f.w);a.viewport(x);l.updateMatrices(c,p);_=l.getFrustum();g(t,r,l.camera,c,this.type)}l.isPointLightShadow||3!==this.type||(c=l,l=r,h=v.update(M),w.uniforms.shadow_pass.value=c.map.texture,w.uniforms.resolution.value=c.mapSize,w.uniforms.radius.value=c.radius,d.setRenderTarget(c.mapPass),d.clear(),d.renderBufferDirect(l,null,h,w,M,null),S.uniforms.shadow_pass.value=c.mapPass.texture,S.uniforms.resolution.value=c.mapSize,S.uniforms.radius.value=c.radius,d.setRenderTarget(c.map),d.clear(),d.renderBufferDirect(l,null,h,S,M,null))}}C.needsUpdate=!1;d.setRenderTarget(n,i,o)}}}function Dt(l,r,e){function t(e,t,r){var n=new Uint8Array(4),i=l.createTexture();l.bindTexture(e,i);l.texParameteri(e,10241,9728);l.texParameteri(e,10240,9728);for(e=0;e<r;e++)l.texImage2D(t+e,0,6408,1,1,0,6408,5121,n);return i}function n(e,t){m[e]=1;0===g[e]&&(l.enableVertexAttribArray(e),g[e]=1);_[e]!==t&&((c?l:r.get("ANGLE_instanced_arrays"))[c?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](e,t),_[e]=t)}function h(e){!0!==y[e]&&(l.enable(e),y[e]=!0)}function p(e){!1!==y[e]&&(l.disable(e),y[e]=!1)}function i(e,t,r,n,i,o,a,s){if(0===e)x&&(p(3042),x=!1);else if(x||(h(3042),x=!0),5!==e){if(e!==w||s!==P){if(100!==S||100!==T)l.blendEquation(32774),T=S=100;if(s)switch(e){case 1:l.blendFuncSeparate(1,771,1,771);break;case 2:l.blendFunc(1,1);break;case 3:l.blendFuncSeparate(0,0,769,771);break;case 4:l.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:l.blendFuncSeparate(770,771,1,771);break;case 2:l.blendFunc(770,1);break;case 3:l.blendFunc(0,769);break;case 4:l.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}O=E=C=M=null;w=e;P=s}}else{i=i||t;o=o||r;a=a||n;if(t!==S||i!==T)l.blendEquationSeparate(G[t],G[i]),S=t,T=i;if(r!==M||n!==C||o!==E||a!==O)l.blendFuncSeparate(V[r],V[n],V[o],V[a]),M=r,C=n,E=o,O=a;w=e;P=null}}function o(e){A!==e&&(e?l.frontFace(2304):l.frontFace(2305),A=e)}function a(e){0!==e?(h(2884),e!==j&&(1===e?l.cullFace(1029):2===e?l.cullFace(1028):l.cullFace(1032))):p(2884);j=e}function s(e,t,r){if(e){if(h(32823),k!==t||L!==r)l.polygonOffset(t,r),k=t,L=r}else p(32823)}function u(e){void 0===e&&(e=33984+N-1);D!==e&&(l.activeTexture(e),D=e)}var c=e.isWebGL2,f=new function(){var t=!1,o=new Ce,r=null,a=new Ce(0,0,0,0);return{setMask:function(e){r===e||t||(l.colorMask(e,e,e,e),r=e)},setLocked:function(e){t=e},setClear:function(e,t,r,n,i){!0===i&&(e*=n,t*=n,r*=n);o.set(e,t,r,n);!1===a.equals(o)&&(l.clearColor(e,t,r,n),a.copy(o))},reset:function(){t=!1;r=null;a.set(-1,0,0,0)}}},d=new function(){var t=!1,r=null,n=null,i=null;return{setTest:function(e){e?h(2929):p(2929)},setMask:function(e){r===e||t||(l.depthMask(e),r=e)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:l.depthFunc(512);break;case 1:l.depthFunc(519);break;case 2:l.depthFunc(513);break;case 3:l.depthFunc(515);break;case 4:l.depthFunc(514);break;case 5:l.depthFunc(518);break;case 6:l.depthFunc(516);break;case 7:l.depthFunc(517);break;default:l.depthFunc(515)}else l.depthFunc(515);n=e}},setLocked:function(e){t=e},setClear:function(e){i!==e&&(l.clearDepth(e),i=e)},reset:function(){t=!1;i=n=r=null}}},v=new function(){var t=!1,r=null,n=null,i=null,o=null,a=null,s=null,u=null,c=null;return{setTest:function(e){t||(e?h(2960):p(2960))},setMask:function(e){r===e||t||(l.stencilMask(e),r=e)},setFunc:function(e,t,r){if(n!==e||i!==t||o!==r)l.stencilFunc(e,t,r),n=e,i=t,o=r},setOp:function(e,t,r){if(a!==e||s!==t||u!==r)l.stencilOp(e,t,r),a=e,s=t,u=r},setLocked:function(e){t=e},setClear:function(e){c!==e&&(l.clearStencil(e),c=e)},reset:function(){t=!1;c=u=s=a=o=i=n=r=null}}};e=l.getParameter(34921);var m=new Uint8Array(e),g=new Uint8Array(e),_=new Uint8Array(e),y={},b=null,x=null,w=null,S=null,M=null,C=null,T=null,E=null,O=null,P=!1,A=null,j=null,R=null,k=null,L=null,N=l.getParameter(35661),I=!1;e=0;e=l.getParameter(7938);-1!==e.indexOf("WebGL")?(e=parseFloat(/^WebGL ([0-9])/.exec(e)[1]),I=1<=e):-1!==e.indexOf("OpenGL ES")&&(e=parseFloat(/^OpenGL ES ([0-9])/.exec(e)[1]),I=2<=e);var D=null,B={},F=new Ce,z=new Ce,$={};$[3553]=t(3553,3553,1);$[34067]=t(34067,34069,6);f.setClear(0,0,0,1);d.setClear(1);v.setClear(0);h(2929);d.setFunc(3);o(!1);a(1);h(2884);i(0);var G={100:32774,101:32778,102:32779};c?(G[103]=32775,G[104]=32776):(e=r.get("EXT_blend_minmax"),null!==e&&(G[103]=e.MIN_EXT,G[104]=e.MAX_EXT));var V={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};return{buffers:{color:f,depth:d,stencil:v},initAttributes:function(){for(var e=0,t=m.length;e<t;e++)m[e]=0},enableAttribute:function(e){n(e,0)},enableAttributeAndDivisor:n,disableUnusedAttributes:function(){for(var e=0,t=g.length;e!==t;++e)g[e]!==m[e]&&(l.disableVertexAttribArray(e),g[e]=0)},vertexAttribPointer:function(e,t,r,n,i,o){!0!==c||5124!==r&&5125!==r?l.vertexAttribPointer(e,t,r,n,i,o):l.vertexAttribIPointer(e,t,r,n,i,o)},enable:h,disable:p,useProgram:function(e){return b!==e?(l.useProgram(e),b=e,!0):!1},setBlending:i,setMaterial:function(e,t){2===e.side?p(2884):h(2884);var r=1===e.side;t&&(r=!r);o(r);1===e.blending&&!1===e.transparent?i(0):i(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha);d.setFunc(e.depthFunc);d.setTest(e.depthTest);d.setMask(e.depthWrite);f.setMask(e.colorWrite);t=e.stencilWrite;v.setTest(t);t&&(v.setMask(e.stencilWriteMask),v.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),v.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass));s(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:o,setCullFace:a,setLineWidth:function(e){e!==R&&(I&&l.lineWidth(e),R=e)},setPolygonOffset:s,setScissorTest:function(e){e?h(3089):p(3089)},activeTexture:u,bindTexture:function(e,t){null===D&&u();var r=B[D];void 0===r&&(r={type:void 0,texture:void 0},B[D]=r);if(r.type!==e||r.texture!==t)l.bindTexture(e,t||$[e]),r.type=e,r.texture=t},unbindTexture:function(){var e=B[D];void 0!==e&&void 0!==e.type&&(l.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{l.compressedTexImage2D.apply(l,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{l.texImage2D.apply(l,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{l.texImage3D.apply(l,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===F.equals(e)&&(l.scissor(e.x,e.y,e.z,e.w),F.copy(e))},viewport:function(e){!1===z.equals(e)&&(l.viewport(e.x,e.y,e.z,e.w),z.copy(e))},reset:function(){for(var e=0;e<g.length;e++)1===g[e]&&(l.disableVertexAttribArray(e),g[e]=0);y={};D=null;B={};j=A=w=b=null;f.reset();d.reset();v.reset()}}}function Bt(f,n,d,v,i,m,s){function o(e,t){return k?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(e,t,r,n){var i=1;if(e.width>n||e.height>n)i=n/Math.max(e.width,e.height);if(1>i||!0===t){if("undefined"!==typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&e instanceof ImageBitmap)return n=t?Vo.floorPowerOfTwo:Math.floor,t=n(i*e.width),i=n(i*e.height),void 0===R&&(R=o(t,i)),r=r?o(t,i):R,r.width=t,r.height=i,r.getContext("2d").drawImage(e,0,0,t,i),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+t+"x"+i+")."),r;"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+").")}return e}function _(e){return Vo.isPowerOfTwo(e.width)&&Vo.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function b(e,t,r,n){f.generateMipmap(e);v.get(t).__maxMipLevel=Math.log(Math.max(r,n))*Math.LOG2E}function x(e,t,r){if(!1===E)return t;if(null!==e){if(void 0!==f[e])return f[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}e=t;6403===t&&(5126===r&&(e=33326),5131===r&&(e=33325),5121===r&&(e=33321));6407===t&&(5126===r&&(e=34837),5131===r&&(e=34843),5121===r&&(e=32849));6408===t&&(5126===r&&(e=34836),5131===r&&(e=34842),5121===r&&(e=32856));33325!==e&&33326!==e&&34842!==e&&34836!==e||n.get("EXT_color_buffer_float");return e}function a(e){return 1003===e||1004===e||1005===e?9728:9729}function r(e){e=e.target;e.removeEventListener("dispose",r);var t=v.get(e);void 0!==t.__webglInit&&(f.deleteTexture(t.__webglTexture),v.remove(e));e.isVideoTexture&&j.delete(e);s.memory.textures--}function u(e){e=e.target;e.removeEventListener("dispose",u);var t=v.get(e),r=v.get(e.texture);if(e){void 0!==r.__webglTexture&&f.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(r=0;6>r;r++)f.deleteFramebuffer(t.__webglFramebuffer[r]),t.__webglDepthbuffer&&f.deleteRenderbuffer(t.__webglDepthbuffer[r]);else f.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&f.deleteRenderbuffer(t.__webglDepthbuffer),t.__webglMultisampledFramebuffer&&f.deleteFramebuffer(t.__webglMultisampledFramebuffer),t.__webglColorRenderbuffer&&f.deleteRenderbuffer(t.__webglColorRenderbuffer),t.__webglDepthRenderbuffer&&f.deleteRenderbuffer(t.__webglDepthRenderbuffer);v.remove(e.texture);v.remove(e)}s.memory.textures--}function c(e,t){var r=v.get(e);if(e.isVideoTexture){var n=s.render.frame;j.get(e)!==n&&(j.set(e,n),e.update())}if(0<e.version&&r.__version!==e.version)if(n=e.image,void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{p(r,e,t);return}d.activeTexture(33984+t);d.bindTexture(3553,r.__webglTexture)}function l(e,t){if(6===e.image.length){var r=v.get(e);if(0<e.version&&r.__version!==e.version){S(r,e);d.activeTexture(33984+t);d.bindTexture(34067,r.__webglTexture);f.pixelStorei(37440,e.flipY);var n=e&&(e.isCompressedTexture||e.image[0].isCompressedTexture);t=e.image[0]&&e.image[0].isDataTexture;for(var i=[],o=0;6>o;o++)i[o]=n||t?t?e.image[o].image:e.image[o]:g(e.image[o],!1,!0,O);var a=i[0],s=_(a)||E,u=m.convert(e.format),c=m.convert(e.type),l=x(e.internalFormat,u,c);w(34067,e,s);if(n){for(o=0;6>o;o++){var h=i[o].mipmaps;for(n=0;n<h.length;n++){var p=h[n];1023!==e.format&&1022!==e.format?null!==u?d.compressedTexImage2D(34069+o,n,l,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):d.texImage2D(34069+o,n,l,p.width,p.height,0,u,c,p.data)}}r.__maxMipLevel=h.length-1}else{h=e.mipmaps;for(o=0;6>o;o++)if(t)for(d.texImage2D(34069+o,0,l,i[o].width,i[o].height,0,u,c,i[o].data),n=0;n<h.length;n++)p=h[n],p=p.image[o].image,d.texImage2D(34069+o,n+1,l,p.width,p.height,0,u,c,p.data);else for(d.texImage2D(34069+o,0,l,u,c,i[o]),n=0;n<h.length;n++)p=h[n],d.texImage2D(34069+o,n+1,l,u,c,p.image[o]);r.__maxMipLevel=h.length}y(e,s)&&b(34067,e,a.width,a.height);r.__version=e.version;if(e.onUpdate)e.onUpdate(e)}else d.activeTexture(33984+t),d.bindTexture(34067,r.__webglTexture)}}function h(e,t){d.activeTexture(33984+t);d.bindTexture(34067,v.get(e).__webglTexture)}function w(e,t,r){r?(f.texParameteri(e,10242,N[t.wrapS]),f.texParameteri(e,10243,N[t.wrapT]),32879!==e&&35866!==e||f.texParameteri(e,32882,N[t.wrapR]),f.texParameteri(e,10240,I[t.magFilter]),f.texParameteri(e,10241,I[t.minFilter])):(f.texParameteri(e,10242,33071),f.texParameteri(e,10243,33071),32879!==e&&35866!==e||f.texParameteri(e,32882,33071),1001===t.wrapS&&1001===t.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),f.texParameteri(e,10240,a(t.magFilter)),f.texParameteri(e,10241,a(t.minFilter)),1003!==t.minFilter&&1006!==t.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));!(r=n.get("EXT_texture_filter_anisotropic"))||1015===t.type&&null===n.get("OES_texture_float_linear")||1016===t.type&&null===(E||n.get("OES_texture_half_float_linear"))||!(1<t.anisotropy||v.get(t).__currentAnisotropy)||(f.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,i.getMaxAnisotropy())),v.get(t).__currentAnisotropy=t.anisotropy)}function S(e,t){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",r),e.__webglTexture=f.createTexture(),s.memory.textures++)}function p(e,t,r){var n=3553;t.isDataTexture2DArray&&(n=35866);t.isDataTexture3D&&(n=32879);S(e,t);d.activeTexture(33984+r);d.bindTexture(n,e.__webglTexture);f.pixelStorei(37440,t.flipY);f.pixelStorei(37441,t.premultiplyAlpha);f.pixelStorei(3317,t.unpackAlignment);r=E?!1:1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter;r=r&&!1===_(t.image);r=g(t.image,r,!1,P);var i=_(r)||E,o=m.convert(t.format),a=m.convert(t.type),s=x(t.internalFormat,o,a);w(n,t,i);var u=t.mipmaps;if(t.isDepthTexture)s=6402,E?s=1015===t.type?36012:1014===t.type?33190:1020===t.type?35056:33189:1015===t.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===t.format&&6402===s&&1012!==t.type&&1014!==t.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),t.type=1012,a=m.convert(t.type)),1027===t.format&&6402===s&&(s=34041,1020!==t.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),t.type=1020,a=m.convert(t.type))),d.texImage2D(3553,0,s,r.width,r.height,0,o,a,null);else if(t.isDataTexture)if(0<u.length&&i){for(var c=0,l=u.length;c<l;c++){var h=u[c];d.texImage2D(3553,c,s,h.width,h.height,0,o,a,h.data)}t.generateMipmaps=!1;e.__maxMipLevel=u.length-1}else d.texImage2D(3553,0,s,r.width,r.height,0,o,a,r.data),e.__maxMipLevel=0;else if(t.isCompressedTexture){c=0;for(l=u.length;c<l;c++)h=u[c],1023!==t.format&&1022!==t.format?null!==o?d.compressedTexImage2D(3553,c,s,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):d.texImage2D(3553,c,s,h.width,h.height,0,o,a,h.data);e.__maxMipLevel=u.length-1}else if(t.isDataTexture2DArray)d.texImage3D(35866,0,s,r.width,r.height,r.depth,0,o,a,r.data),e.__maxMipLevel=0;else if(t.isDataTexture3D)d.texImage3D(32879,0,s,r.width,r.height,r.depth,0,o,a,r.data),e.__maxMipLevel=0;else if(0<u.length&&i){c=0;for(l=u.length;c<l;c++)h=u[c],d.texImage2D(3553,c,s,o,a,h);t.generateMipmaps=!1;e.__maxMipLevel=u.length-1}else d.texImage2D(3553,0,s,o,a,r),e.__maxMipLevel=0;y(t,i)&&b(n,t,r.width,r.height);e.__version=t.version;if(t.onUpdate)t.onUpdate(t)}function M(e,t,r,n){var i=m.convert(t.texture.format),o=m.convert(t.texture.type),a=x(t.texture.internalFormat,i,o);d.texImage2D(n,0,a,t.width,t.height,0,i,o,null);f.bindFramebuffer(36160,e);f.framebufferTexture2D(36160,r,n,v.get(t.texture).__webglTexture,0);f.bindFramebuffer(36160,null)}function C(e,t,r){f.bindRenderbuffer(36161,e);if(t.depthBuffer&&!t.stencilBuffer){var n=33189;r?((r=t.depthTexture)&&r.isDepthTexture&&(1015===r.type?n=36012:1014===r.type&&(n=33190)),r=T(t),f.renderbufferStorageMultisample(36161,r,n,t.width,t.height)):f.renderbufferStorage(36161,n,t.width,t.height);f.framebufferRenderbuffer(36160,36096,36161,e)}else t.depthBuffer&&t.stencilBuffer?(r?(r=T(t),f.renderbufferStorageMultisample(36161,r,35056,t.width,t.height)):f.renderbufferStorage(36161,34041,t.width,t.height),f.framebufferRenderbuffer(36160,33306,36161,e)):(e=m.convert(t.texture.format),n=m.convert(t.texture.type),n=x(t.texture.internalFormat,e,n),r?(r=T(t),f.renderbufferStorageMultisample(36161,r,n,t.width,t.height)):f.renderbufferStorage(36161,n,t.width,t.height));f.bindRenderbuffer(36161,null)}function T(e){return E&&e.isWebGLMultisampleRenderTarget?Math.min(A,e.samples):0}var E=i.isWebGL2,t=i.maxTextures,O=i.maxCubemapSize,P=i.maxTextureSize,A=i.maxSamples,j=new WeakMap,R,k=!1;try{k="undefined"!==typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}var L=0,N={1e3:10497,1001:33071,1002:33648},I={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987},D=!1,B=!1;this.allocateTextureUnit=function(){var e=L;e>=t&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+t);L+=1;return e};this.resetTextureUnits=function(){L=0};this.setTexture2D=c;this.setTexture2DArray=function(e,t){var r=v.get(e);0<e.version&&r.__version!==e.version?p(r,e,t):(d.activeTexture(33984+t),d.bindTexture(35866,r.__webglTexture))};this.setTexture3D=function(e,t){var r=v.get(e);0<e.version&&r.__version!==e.version?p(r,e,t):(d.activeTexture(33984+t),d.bindTexture(32879,r.__webglTexture))};this.setTextureCube=l;this.setTextureCubeDynamic=h;this.setupRenderTarget=function(e){var t=v.get(e),r=v.get(e.texture);e.addEventListener("dispose",u);r.__webglTexture=f.createTexture();s.memory.textures++;var n=!0===e.isWebGLCubeRenderTarget,i=!0===e.isWebGLMultisampleRenderTarget,o=_(e)||E;!E||1022!==e.texture.format||1015!==e.texture.type&&1016!==e.texture.type||(e.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead."));if(n)for(t.__webglFramebuffer=[],i=0;6>i;i++)t.__webglFramebuffer[i]=f.createFramebuffer();else if(t.__webglFramebuffer=f.createFramebuffer(),i)if(E){t.__webglMultisampledFramebuffer=f.createFramebuffer();t.__webglColorRenderbuffer=f.createRenderbuffer();f.bindRenderbuffer(36161,t.__webglColorRenderbuffer);i=m.convert(e.texture.format);var a=m.convert(e.texture.type);i=x(e.texture.internalFormat,i,a);a=T(e);f.renderbufferStorageMultisample(36161,a,i,e.width,e.height);f.bindFramebuffer(36160,t.__webglMultisampledFramebuffer);f.framebufferRenderbuffer(36160,36064,36161,t.__webglColorRenderbuffer);f.bindRenderbuffer(36161,null);e.depthBuffer&&(t.__webglDepthRenderbuffer=f.createRenderbuffer(),C(t.__webglDepthRenderbuffer,e,!0));f.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(n){d.bindTexture(34067,r.__webglTexture);w(34067,e.texture,o);for(i=0;6>i;i++)M(t.__webglFramebuffer[i],e,36064,34069+i);y(e.texture,o)&&b(34067,e.texture,e.width,e.height);d.bindTexture(34067,null)}else d.bindTexture(3553,r.__webglTexture),w(3553,e.texture,o),M(t.__webglFramebuffer,e,36064,3553),y(e.texture,o)&&b(3553,e.texture,e.width,e.height),d.bindTexture(3553,null);if(e.depthBuffer){t=v.get(e);r=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(r)throw Error("target.depthTexture not supported in Cube render targets");if(e&&e.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");f.bindFramebuffer(36160,t.__webglFramebuffer);if(!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");v.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0);c(e.depthTexture,0);t=v.get(e.depthTexture).__webglTexture;if(1026===e.depthTexture.format)f.framebufferTexture2D(36160,36096,3553,t,0);else if(1027===e.depthTexture.format)f.framebufferTexture2D(36160,33306,3553,t,0);else throw Error("Unknown depthTexture format")}else if(r)for(t.__webglDepthbuffer=[],r=0;6>r;r++)f.bindFramebuffer(36160,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=f.createRenderbuffer(),C(t.__webglDepthbuffer[r],e,!1);else f.bindFramebuffer(36160,t.__webglFramebuffer),t.__webglDepthbuffer=f.createRenderbuffer(),C(t.__webglDepthbuffer,e,!1);f.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(e){var t=e.texture,r=_(e)||E;if(y(t,r)){r=e.isWebGLCubeRenderTarget?34067:3553;var n=v.get(t).__webglTexture;d.bindTexture(r,n);b(r,t,e.width,e.height);d.bindTexture(r,null)}};this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(E){var t=v.get(e);f.bindFramebuffer(36008,t.__webglMultisampledFramebuffer);f.bindFramebuffer(36009,t.__webglFramebuffer);var r=e.width,n=e.height,i=16384;e.depthBuffer&&(i|=256);e.stencilBuffer&&(i|=1024);f.blitFramebuffer(0,0,r,n,0,0,r,n,i,9728);f.bindFramebuffer(36160,t.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===D&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),D=!0),e=e.texture);c(e,t)};this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),e=e.texture);e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?l(e,t):h(e,t)}}function Ft(e,r,t){var n=t.isWebGL2;return{convert:function(e){if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e){if(n)return 5131;var t=r.get("OES_texture_half_float");return null!==t?t.HALF_FLOAT_OES:null}if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e)if(t=r.get("WEBGL_compressed_texture_s3tc"),null!==t){if(33776===e)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(35840===e||35841===e||35842===e||35843===e)if(t=r.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(35840===e)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(36196===e)return t=r.get("WEBGL_compressed_texture_etc1"),null!==t?t.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===e||37496===e)if(t=r.get("WEBGL_compressed_texture_etc"),null!==t){if(37492===e)return t.COMPRESSED_RGB8_ETC2;if(37496===e)return t.COMPRESSED_RGBA8_ETC2_EAC}if(37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e)return t=r.get("WEBGL_compressed_texture_astc"),null!==t?e:null;if(36492===e)return t=r.get("EXT_texture_compression_bptc"),null!==t?e:null;if(1020===e){if(n)return 34042;t=r.get("WEBGL_depth_texture");return null!==t?t.UNSIGNED_INT_24_8_WEBGL:null}}}}function zt(e){H.call(this);this.cameras=e||[]}function $t(){f.call(this);this.type="Group"}function Gt(){this._grip=this._targetRay=null}function Vt(c,t){function r(e){var t=v.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function n(){v.forEach(function(e,t){e.disconnect(t)});v.clear();c.setFramebuffer(null);c.setRenderTarget(c.getRenderTarget());C.stop();a.isPresenting=!1;a.dispatchEvent({type:"sessionend"})}function i(e){p=e;C.setContext(h);C.start();a.isPresenting=!0;a.dispatchEvent({type:"sessionstart"})}function o(e){for(var t=h.inputSources,r=0;r<d.length;r++)v.set(t[r],d[r]);for(r=0;r<e.removed.length;r++){t=e.removed[r];var n=v.get(t);n&&(n.dispatchEvent({type:"disconnected",data:t}),v.delete(t))}for(r=0;r<e.added.length;r++)t=e.added[r],(n=v.get(t))&&n.dispatchEvent({type:"connected",data:t})}function l(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix);e.matrixWorldInverse.getInverse(e.matrixWorld)}var a=this,h=null,s=1,p=null,u="local-floor",f=null,d=[],v=new Map,m=new H;m.layers.enable(1);m.viewport=new Ce;var g=new H;g.layers.enable(2);g.viewport=new Ce;var _=[m,g],y=new zt;y.layers.enable(1);y.layers.enable(2);var b=null,x=null;this.isPresenting=this.enabled=!1;this.getController=function(e){var t=d[e];void 0===t&&(t=new Gt,d[e]=t);return t.getTargetRaySpace()};this.getControllerGrip=function(e){var t=d[e];void 0===t&&(t=new Gt,d[e]=t);return t.getGripSpace()};this.setFramebufferScaleFactor=function(e){s=e;!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")};this.setReferenceSpaceType=function(e){u=e;!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")};this.getReferenceSpace=function(){return p};this.getSession=function(){return h};this.setSession=function(e){h=e;null!==h&&(h.addEventListener("select",r),h.addEventListener("selectstart",r),h.addEventListener("selectend",r),h.addEventListener("squeeze",r),h.addEventListener("squeezestart",r),h.addEventListener("squeezeend",r),h.addEventListener("end",n),e=t.getContextAttributes(),!0!==e.xrCompatible&&t.makeXRCompatible(),e=new XRWebGLLayer(h,t,{antialias:e.antialias,alpha:e.alpha,depth:e.depth,stencil:e.stencil,framebufferScaleFactor:s}),h.updateRenderState({baseLayer:e}),h.requestReferenceSpace(u).then(i),h.addEventListener("inputsourceschange",o))};var w=new Te,S=new Te;this.getCamera=function(e){y.near=g.near=m.near=e.near;y.far=g.far=m.far=e.far;if(b!==y.near||x!==y.far)h.updateRenderState({depthNear:y.near,depthFar:y.far}),b=y.near,x=y.far;var t=e.parent,r=y.cameras;l(y,t);for(var n=0;n<r.length;n++)l(r[n],t);e.matrixWorld.copy(y.matrixWorld);e=e.children;n=0;for(t=e.length;n<t;n++)e[n].updateMatrixWorld(!0);if(2===r.length){w.setFromMatrixPosition(m.matrixWorld);S.setFromMatrixPosition(g.matrixWorld);r=w.distanceTo(S);var i=m.projectionMatrix.elements,o=g.projectionMatrix.elements,a=i[14]/(i[10]-1);n=i[14]/(i[10]+1);e=(i[9]+1)/i[5];t=(i[9]-1)/i[5];var s=(i[8]-1)/i[0],u=(o[8]+1)/o[0];o=a*s;i=a*u;u=r/(-s+u);s=u*-s;m.matrixWorld.decompose(y.position,y.quaternion,y.scale);y.translateX(s);y.translateZ(u);y.matrixWorld.compose(y.position,y.quaternion,y.scale);y.matrixWorldInverse.getInverse(y.matrixWorld);a+=u;u=n+u;y.projectionMatrix.makePerspective(o-s,i+(r-s),e*n/u*a,t*n/u*a,a,u)}else y.projectionMatrix.copy(m.projectionMatrix);return y};var M=null,C=new je;C.setAnimationLoop(function(e,t){f=t.getViewerPose(p);if(null!==f){var r=f.views,n=h.renderState.baseLayer;c.setFramebuffer(n.framebuffer);var i=!1;r.length!==y.cameras.length&&(y.cameras.length=0,i=!0);for(var o=0;o<r.length;o++){var a=r[o],s=n.getViewport(a),u=_[o];u.matrix.fromArray(a.transform.matrix);u.projectionMatrix.fromArray(a.projectionMatrix);u.viewport.set(s.x,s.y,s.width,s.height);0===o&&y.matrix.copy(u.matrix);!0===i&&y.cameras.push(u)}}r=h.inputSources;for(o=0;o<d.length;o++)d[o].update(r[o],t,p);M&&M(e,t)});this.setAnimationLoop=function(e){M=e};this.dispose=function(){}}function Ht(o){function s(e,t,r){e.opacity.value=t.opacity;t.color&&e.diffuse.value.copy(t.color);t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity);t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.specularMap&&(e.specularMap.value=t.specularMap);if(r=t.envMap||r)e.envMap.value=r,e.flipEnvMap.value=r.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=o.get(r).__maxMipLevel;t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity);t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);if(t.map)var n=t.map;else t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap);void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix));if(t.aoMap)var i=t.aoMap;else t.lightMap&&(i=t.lightMap);void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uv2Transform.value.copy(i.matrix))}function u(e,t,r){e.roughness.value=t.roughness;e.metalness.value=t.metalness;t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap);t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);if(t.envMap||r)e.envMapIntensity.value=t.envMapIntensity}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color);t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,t,r,n,i){if(t.isMeshBasicMaterial)s(e,t);else if(t.isMeshLambertMaterial)s(e,t),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);else if(t.isMeshToonMaterial)s(e,t),e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);else if(t.isMeshPhongMaterial)s(e,t),e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);else if(t.isMeshStandardMaterial)s(e,t,r),t.isMeshPhysicalMaterial?(u(e,t,r),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate()),e.transparency.value=t.transparency):u(e,t,r);else if(t.isMeshMatcapMaterial)s(e,t),t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);else if(t.isMeshDepthMaterial)s(e,t),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);else if(t.isMeshDistanceMaterial)s(e,t),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance;else if(t.isMeshNormalMaterial)s(e,t),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);else if(t.isLineBasicMaterial)e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.isLineDashedMaterial&&(e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale);else if(t.isPointsMaterial){e.diffuse.value.copy(t.color);e.opacity.value=t.opacity;e.size.value=t.size*n;e.scale.value=.5*i;t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);if(t.map)var o=t.map;else t.alphaMap&&(o=t.alphaMap);void 0!==o&&(!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uvTransform.value.copy(o.matrix))}else if(t.isSpriteMaterial){e.diffuse.value.copy(t.color);e.opacity.value=t.opacity;e.rotation.value=t.rotation;t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);if(t.map)var a=t.map;else t.alphaMap&&(a=t.alphaMap);void 0!==a&&(!0===a.matrixAutoUpdate&&a.updateMatrix(),e.uvTransform.value.copy(a.matrix))}else t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}}}function Ut(e){var w;function t(){te=new De(ee);re=new Ne(ee,te,e);!1===re.isWebGL2&&(te.get("WEBGL_depth_texture"),te.get("OES_texture_float"),te.get("OES_texture_half_float"),te.get("OES_texture_half_float_linear"),te.get("OES_standard_derivatives"),te.get("OES_element_index_uint"),te.get("ANGLE_instanced_arrays"));te.get("OES_texture_float_linear");_e=new Ft(ee,te,re);ne=new Dt(ee,te,re);ne.scissor(B.copy(q).multiplyScalar(G).floor());ne.viewport(D.copy(U).multiplyScalar(G).floor());ie=new ze(ee);oe=new St;ae=new Bt(ee,te,ne,oe,re,_e,ie);se=new Re(ee,re);ue=new Be(ee,se,ie);ce=new Ge(ee,ue,se,ie);ve=new $e(ee);le=new wt(C,te,re);he=new Ht(oe);pe=new Et;fe=new kt;de=new ke(C,ne,ce,g);me=new Le(ee,te,ie,re);ge=new Fe(ee,te,ie,re);ie.programs=le.programs;C.capabilities=re;C.extensions=te;C.properties=oe;C.renderLists=pe;C.state=ne;C.info=ie}function r(e){e.preventDefault();console.log("THREE.WebGLRenderer: Context Lost.");T=!0}function n(){console.log("THREE.WebGLRenderer: Context Restored.");T=!1;t()}function c(e){e=e.target;e.removeEventListener("dispose",c);l(e);oe.remove(e)}function l(e){var t=oe.get(e).program;e.program=void 0;void 0!==t&&le.releaseProgram(t)}function s(e,t){e.render(function(e){C.renderBufferImmediate(e,t)})}function h(e,t,r,n){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)M.pushLight(e),e.castShadow&&M.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||X.intersectsSprite(e)){n&&Q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(J);var i=ce.update(e),o=e.material;o.visible&&x.push(e,i,o,r,Q.z,null)}}else if(e.isImmediateRenderObject)n&&Q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(J),x.push(e,null,e.material,r,Q.z,null);else if(e.isMesh||e.isLine||e.isPoints)if(e.isSkinnedMesh&&e.skeleton.frame!==ie.render.frame&&(e.skeleton.update(),e.skeleton.frame=ie.render.frame),!e.frustumCulled||X.intersectsObject(e))if(n&&Q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(J),i=ce.update(e),o=e.material,Array.isArray(o))for(var a=i.groups,s=0,u=a.length;s<u;s++){var c=a[s],l=o[c.materialIndex];l&&l.visible&&x.push(e,i,l,r,Q.z,c)}else o.visible&&x.push(e,i,o,r,Q.z,null);e=e.children;s=0;for(u=e.length;s<u;s++)h(e[s],t,r,n)}}function a(e,t,r,n){for(var i=0,o=e.length;i<o;i++){var a=e[i],s=a.object,u=a.geometry,c=void 0===n?a.material:n;a=a.group;if(r.isArrayCamera){I=r;for(var l=r.cameras,h=0,p=l.length;h<p;h++){var f=l[h];s.layers.test(f.layers)&&(ne.viewport(D.copy(f.viewport)),M.setupLights(f),d(s,t,f,u,c,a))}}else I=null,d(s,t,r,u,c,a)}}function d(e,t,r,n,i,o){e.onBeforeRender(C,t,r,n,i,o);M=fe.get(t,I||r);e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld);e.normalMatrix.getNormalMatrix(e.modelViewMatrix);if(e.isImmediateRenderObject){var a=S(r,t,i,e);ne.setMaterial(i);k=w=null;L=!1;s(e,a)}else C.renderBufferDirect(r,t,n,i,e,o);e.onAfterRender(C,t,r,n,i,o);M=fe.get(t,I||r)}function v(e,t,r){var n=oe.get(e),i=M.state.lights,o=i.state.version;r=le.getParameters(e,i.state,M.state.shadowsArray,t,Y.numPlanes,Y.numIntersection,r);var a=le.getProgramCacheKey(r),s=n.program,u=!0;if(void 0===s)e.addEventListener("dispose",c);else if(s.cacheKey!==a)l(e);else{if(n.lightsStateVersion!==o)n.lightsStateVersion=o;else if(void 0!==r.shaderID)return;u=!1}u&&(s=le.acquireProgram(r,a),n.program=s,n.uniforms=r.uniforms,n.outputEncoding=r.outputEncoding,e.program=s);r=s.getAttributes();if(e.morphTargets)for(a=e.numSupportedMorphTargets=0;a<C.maxMorphTargets;a++)0<=r["morphTarget"+a]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(a=e.numSupportedMorphNormals=0;a<C.maxMorphNormals;a++)0<=r["morphNormal"+a]&&e.numSupportedMorphNormals++;r=n.uniforms;if(!e.isShaderMaterial&&!e.isRawShaderMaterial||!0===e.clipping)n.numClippingPlanes=Y.numPlanes,n.numIntersection=Y.numIntersection,r.clippingPlanes=Y.uniform;n.environment=e.isMeshStandardMaterial?t.environment:null;n.fog=t.fog;n.needsLights=e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights;n.lightsStateVersion=o;n.needsLights&&(r.ambientLightColor.value=i.state.ambient,r.lightProbe.value=i.state.probe,r.directionalLights.value=i.state.directional,r.directionalLightShadows.value=i.state.directionalShadow,r.spotLights.value=i.state.spot,r.spotLightShadows.value=i.state.spotShadow,r.rectAreaLights.value=i.state.rectArea,r.pointLights.value=i.state.point,r.pointLightShadows.value=i.state.pointShadow,r.hemisphereLights.value=i.state.hemi,r.directionalShadowMap.value=i.state.directionalShadowMap,r.directionalShadowMatrix.value=i.state.directionalShadowMatrix,r.spotShadowMap.value=i.state.spotShadowMap,r.spotShadowMatrix.value=i.state.spotShadowMatrix,r.pointShadowMap.value=i.state.pointShadowMap,r.pointShadowMatrix.value=i.state.pointShadowMatrix);e=n.program.getUniforms();e=rt.seqWithValue(e.seq,r);n.uniformsList=e}function S(e,t,r,n){ae.resetTextureUnits();var i=t.fog,o=r.isMeshStandardMaterial?t.environment:null,a=null===A?C.outputEncoding:A.texture.encoding,s=oe.get(r),u=M.state.lights;K&&(Z||e!==N)&&Y.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,e,s,e===N&&r.id===R);r.version===s.__version?void 0===s.program?v(r,t,n):r.fog&&s.fog!==i?v(r,t,n):s.environment!==o?v(r,t,n):s.needsLights&&s.lightsStateVersion!==u.state.version?v(r,t,n):void 0===s.numClippingPlanes||s.numClippingPlanes===Y.numPlanes&&s.numIntersection===Y.numIntersection?s.outputEncoding!==a&&v(r,t,n):v(r,t,n):(v(r,t,n),s.__version=r.version);var c=!1,l=!1,h=!1;t=s.program;a=t.getUniforms();u=s.uniforms;ne.useProgram(t.program)&&(h=l=c=!0);r.id!==R&&(R=r.id,l=!0);if(c||N!==e){a.setValue(ee,"projectionMatrix",e.projectionMatrix);re.logarithmicDepthBuffer&&a.setValue(ee,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2));N!==e&&(N=e,h=l=!0);if(r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap)c=a.map.cameraPosition,void 0!==c&&c.setValue(ee,Q.setFromMatrixPosition(e.matrixWorld));(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&a.setValue(ee,"isOrthographic",!0===e.isOrthographicCamera);(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&a.setValue(ee,"viewMatrix",e.matrixWorldInverse)}if(r.skinning&&(a.setOptional(ee,n,"bindMatrix"),a.setOptional(ee,n,"bindMatrixInverse"),e=n.skeleton))if(c=e.bones,re.floatVertexTextures){if(void 0===e.boneTexture){c=Math.sqrt(4*c.length);c=Vo.ceilPowerOfTwo(c);c=Math.max(c,4);var p=new Float32Array(c*c*4);p.set(e.boneMatrices);var f=new Pe(p,c,c,1023,1015);e.boneMatrices=p;e.boneTexture=f;e.boneTextureSize=c}a.setValue(ee,"boneTexture",e.boneTexture,ae);a.setValue(ee,"boneTextureSize",e.boneTextureSize)}else a.setOptional(ee,e,"boneMatrices");if(l||s.receiveShadow!==n.receiveShadow)s.receiveShadow=n.receiveShadow,a.setValue(ee,"receiveShadow",n.receiveShadow);l&&(a.setValue(ee,"toneMappingExposure",C.toneMappingExposure),a.setValue(ee,"toneMappingWhitePoint",C.toneMappingWhitePoint),s.needsLights&&(l=h,u.ambientLightColor.needsUpdate=l,u.lightProbe.needsUpdate=l,u.directionalLights.needsUpdate=l,u.directionalLightShadows.needsUpdate=l,u.pointLights.needsUpdate=l,u.pointLightShadows.needsUpdate=l,u.spotLights.needsUpdate=l,u.spotLightShadows.needsUpdate=l,u.rectAreaLights.needsUpdate=l,u.hemisphereLights.needsUpdate=l),i&&r.fog&&he.refreshFogUniforms(u,i),he.refreshMaterialUniforms(u,r,o,G,$),void 0!==u.ltc_1&&(u.ltc_1.value=Ns.LTC_1),void 0!==u.ltc_2&&(u.ltc_2.value=Ns.LTC_2),rt.upload(ee,s.uniformsList,u,ae));r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(rt.upload(ee,s.uniformsList,u,ae),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&a.setValue(ee,"center",n.center);a.setValue(ee,"modelViewMatrix",n.modelViewMatrix);a.setValue(ee,"normalMatrix",n.normalMatrix);a.setValue(ee,"modelMatrix",n.matrixWorld);return t}e=e||{};var i=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),o=void 0!==e.context?e.context:null,u=void 0!==e.alpha?e.alpha:!1,p=void 0!==e.depth?e.depth:!0,f=void 0!==e.stencil?e.stencil:!0,m=void 0!==e.antialias?e.antialias:!1,g=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,_=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,y=void 0!==e.powerPreference?e.powerPreference:"default",b=void 0!==e.failIfMajorPerformanceCaveat?e.failIfMajorPerformanceCaveat:!1,x=null,M=null;this.domElement=i;this.debug={checkShaderErrors:!0};this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.outputEncoding=3e3;this.physicallyCorrectLights=!1;this.toneMapping=0;this.toneMappingWhitePoint=this.toneMappingExposure=1;this.maxMorphTargets=8;this.maxMorphNormals=4;var C=this,T=!1,E=null,O=0,P=0,A=null,j=null,R=-1;var k=w=null;var L=!1;var N=null,I=null,D=new Ce,B=new Ce,F=null,z=i.width,$=i.height,G=1,V=null,H=null,U=new Ce(0,0,z,$),q=new Ce(0,0,z,$),W=!1,X=new Ae,Y=new Ie,K=!1,Z=!1,J=new Ee,Q=new Te;try{u={alpha:u,depth:p,stencil:f,antialias:m,premultipliedAlpha:g,preserveDrawingBuffer:_,powerPreference:y,failIfMajorPerformanceCaveat:b};i.addEventListener("webglcontextlost",r,!1);i.addEventListener("webglcontextrestored",n,!1);var ee=o||i.getContext("webgl",u)||i.getContext("experimental-webgl",u);if(null===ee){if(null!==i.getContext("webgl"))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}void 0===ee.getShaderPrecisionFormat&&(ee.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}var te,re,ne,ie,oe,ae,se,ue,ce,le,he,pe,fe,de,ve,me,ge,_e;t();var ye=new Vt(C,ee);this.xr=ye;var be=new It(C,ce,re.maxTextureSize);this.shadowMap=be;this.getContext=function(){return ee};this.getContextAttributes=function(){return ee.getContextAttributes()};this.forceContextLoss=function(){var e=te.get("WEBGL_lose_context");e&&e.loseContext()};this.forceContextRestore=function(){var e=te.get("WEBGL_lose_context");e&&e.restoreContext()};this.getPixelRatio=function(){return G};this.setPixelRatio=function(e){void 0!==e&&(G=e,this.setSize(z,$,!1))};this.getSize=function(e){void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new Me);return e.set(z,$)};this.setSize=function(e,t,r){ye.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(z=e,$=t,i.width=Math.floor(e*G),i.height=Math.floor(t*G),!1!==r&&(i.style.width=e+"px",i.style.height=t+"px"),this.setViewport(0,0,e,t))};this.getDrawingBufferSize=function(e){void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new Me);return e.set(z*G,$*G).floor()};this.setDrawingBufferSize=function(e,t,r){z=e;$=t;G=r;i.width=Math.floor(e*r);i.height=Math.floor(t*r);this.setViewport(0,0,e,t)};this.getCurrentViewport=function(e){void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Ce);return e.copy(D)};this.getViewport=function(e){return e.copy(U)};this.setViewport=function(e,t,r,n){e.isVector4?U.set(e.x,e.y,e.z,e.w):U.set(e,t,r,n);ne.viewport(D.copy(U).multiplyScalar(G).floor())};this.getScissor=function(e){return e.copy(q)};this.setScissor=function(e,t,r,n){e.isVector4?q.set(e.x,e.y,e.z,e.w):q.set(e,t,r,n);ne.scissor(B.copy(q).multiplyScalar(G).floor())};this.getScissorTest=function(){return W};this.setScissorTest=function(e){ne.setScissorTest(W=e)};this.setOpaqueSort=function(e){V=e};this.setTransparentSort=function(e){H=e};this.getClearColor=function(){return de.getClearColor()};this.setClearColor=function(){de.setClearColor.apply(de,arguments)};this.getClearAlpha=function(){return de.getClearAlpha()};this.setClearAlpha=function(){de.setClearAlpha.apply(de,arguments)};this.clear=function(e,t,r){var n=0;if(void 0===e||e)n|=16384;if(void 0===t||t)n|=256;if(void 0===r||r)n|=1024;ee.clear(n)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.dispose=function(){i.removeEventListener("webglcontextlost",r,!1);i.removeEventListener("webglcontextrestored",n,!1);pe.dispose();fe.dispose();oe.dispose();ce.dispose();ye.dispose();Se.stop()};this.renderBufferImmediate=function(e,t){ne.initAttributes();var r=oe.get(e);e.hasPositions&&!r.position&&(r.position=ee.createBuffer());e.hasNormals&&!r.normal&&(r.normal=ee.createBuffer());e.hasUvs&&!r.uv&&(r.uv=ee.createBuffer());e.hasColors&&!r.color&&(r.color=ee.createBuffer());t=t.getAttributes();e.hasPositions&&(ee.bindBuffer(34962,r.position),ee.bufferData(34962,e.positionArray,35048),ne.enableAttribute(t.position),ee.vertexAttribPointer(t.position,3,5126,!1,0,0));e.hasNormals&&(ee.bindBuffer(34962,r.normal),ee.bufferData(34962,e.normalArray,35048),ne.enableAttribute(t.normal),ee.vertexAttribPointer(t.normal,3,5126,!1,0,0));e.hasUvs&&(ee.bindBuffer(34962,r.uv),ee.bufferData(34962,e.uvArray,35048),ne.enableAttribute(t.uv),ee.vertexAttribPointer(t.uv,2,5126,!1,0,0));e.hasColors&&(ee.bindBuffer(34962,r.color),ee.bufferData(34962,e.colorArray,35048),ne.enableAttribute(t.color),ee.vertexAttribPointer(t.color,3,5126,!1,0,0));ne.disableUnusedAttributes();ee.drawArrays(4,0,e.count);e.count=0};var xe=new Oe;this.renderBufferDirect=function(e,t,r,n,i,o){null===t&&(t=xe);var a=i.isMesh&&0>i.matrixWorld.determinant(),s=S(e,t,n,i);ne.setMaterial(n,a);var u=!1;if(w!==r.id||k!==s.id||L!==(!0===n.wireframe))w=r.id,k=s.id,L=!0===n.wireframe,u=!0;if(n.morphTargets||n.morphNormals)ve.update(i,r,n,s),u=!0;!0===i.isInstancedMesh&&(u=!0);e=r.index;t=r.attributes.position;if(null===e){if(void 0===t||0===t.count)return}else if(0===e.count)return;var c=1;!0===n.wireframe&&(e=ue.getWireframeAttribute(r),c=2);a=me;if(null!==e){var l=se.get(e);a=ge;a.setIndex(l)}if(u){if(!1!==re.isWebGL2||!i.isInstancedMesh&&!r.isInstancedBufferGeometry||null!==te.get("ANGLE_instanced_arrays")){ne.initAttributes();u=r.attributes;s=s.getAttributes();var h=n.defaultAttributeValues;for(x in s){var p=s[x];if(0<=p){var f=u[x];if(void 0!==f){var d=f.normalized,v=f.itemSize,m=se.get(f);if(void 0!==m){var g=m.buffer,_=m.type;m=m.bytesPerElement;if(f.isInterleavedBufferAttribute){var y=f.data,b=y.stride;f=f.offset;y&&y.isInstancedInterleavedBuffer?(ne.enableAttributeAndDivisor(p,y.meshPerAttribute),void 0===r._maxInstanceCount&&(r._maxInstanceCount=y.meshPerAttribute*y.count)):ne.enableAttribute(p);ee.bindBuffer(34962,g);ne.vertexAttribPointer(p,v,_,d,b*m,f*m)}else f.isInstancedBufferAttribute?(ne.enableAttributeAndDivisor(p,f.meshPerAttribute),void 0===r._maxInstanceCount&&(r._maxInstanceCount=f.meshPerAttribute*f.count)):ne.enableAttribute(p),ee.bindBuffer(34962,g),ne.vertexAttribPointer(p,v,_,d,0,0)}}else if("instanceMatrix"===x)m=se.get(i.instanceMatrix),void 0!==m&&(g=m.buffer,_=m.type,ne.enableAttributeAndDivisor(p+0,1),ne.enableAttributeAndDivisor(p+1,1),ne.enableAttributeAndDivisor(p+2,1),ne.enableAttributeAndDivisor(p+3,1),ee.bindBuffer(34962,g),ee.vertexAttribPointer(p+0,4,_,!1,64,0),ee.vertexAttribPointer(p+1,4,_,!1,64,16),ee.vertexAttribPointer(p+2,4,_,!1,64,32),ee.vertexAttribPointer(p+3,4,_,!1,64,48));else if(void 0!==h&&(d=h[x],void 0!==d))switch(d.length){case 2:ee.vertexAttrib2fv(p,d);break;case 3:ee.vertexAttrib3fv(p,d);break;case 4:ee.vertexAttrib4fv(p,d);break;default:ee.vertexAttrib1fv(p,d)}}}ne.disableUnusedAttributes()}null!==e&&ee.bindBuffer(34963,l.buffer)}var x=r.drawRange.start*c;u=null!==o?o.start*c:0;l=Math.max(x,u);o=Math.max(0,Math.min(null!==e?e.count:t.count,x+r.drawRange.count*c,u+(null!==o?o.count*c:Infinity))-1-l+1);0!==o&&(i.isMesh?!0===n.wireframe?(ne.setLineWidth(n.wireframeLinewidth*(null===A?G:1)),a.setMode(1)):a.setMode(4):i.isLine?(n=n.linewidth,void 0===n&&(n=1),ne.setLineWidth(n*(null===A?G:1)),i.isLineSegments?a.setMode(1):i.isLineLoop?a.setMode(2):a.setMode(3)):i.isPoints?a.setMode(0):i.isSprite&&a.setMode(4),i.isInstancedMesh?a.renderInstances(r,l,o,i.count):r.isInstancedBufferGeometry?a.renderInstances(r,l,o,Math.min(r.instanceCount,r._maxInstanceCount)):a.render(l,o))};this.compile=function(i,e){M=fe.get(i,e);M.init();i.traverse(function(e){e.isLight&&(M.pushLight(e),e.castShadow&&M.pushShadow(e))});M.setupLights(e);var o={};i.traverse(function(e){var t=e.material;if(t)if(Array.isArray(t))for(var r=0;r<t.length;r++){var n=t[r];!1===n.uuid in o&&(v(n,i,e),o[n.uuid]=!0)}else!1===t.uuid in o&&(v(t,i,e),o[t.uuid]=!0)})};var we=null,Se=new je;Se.setAnimationLoop(function(e){ye.isPresenting||we&&we(e)});"undefined"!==typeof window&&Se.setContext(window);this.setAnimationLoop=function(e){we=e;ye.setAnimationLoop(e);Se.start()};this.render=function(e,t,r,n){if(void 0!==r){console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.");var i=r}if(void 0!==n){console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.");var o=n}t&&t.isCamera?T||(k=w=null,L=!1,R=-1,N=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ye.enabled&&ye.isPresenting&&(t=ye.getCamera(t)),e.onBeforeRender(C,e,t,i||A),M=fe.get(e,t),M.init(),J.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),X.setFromProjectionMatrix(J),Z=this.localClippingEnabled,K=Y.init(this.clippingPlanes,Z,t),x=pe.get(e,t),x.init(),h(e,t,0,C.sortObjects),x.finish(),!0===C.sortObjects&&x.sort(V,H),K&&Y.beginShadows(),be.render(M.state.shadowsArray,e,t),M.setupLights(t),K&&Y.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),de.render(x,e,t,o),r=x.opaque,n=x.transparent,e.overrideMaterial?(i=e.overrideMaterial,r.length&&a(r,e,t,i),n.length&&a(n,e,t,i)):(r.length&&a(r,e,t),n.length&&a(n,e,t)),e.onAfterRender(C,e,t),null!==A&&(ae.updateRenderTargetMipmap(A),ae.updateMultisampleRenderTarget(A)),ne.buffers.depth.setTest(!0),ne.buffers.depth.setMask(!0),ne.buffers.color.setMask(!0),ne.setPolygonOffset(!1),M=x=null):console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")};this.setFramebuffer=function(e){E!==e&&null===A&&ee.bindFramebuffer(36160,e);E=e};this.getActiveCubeFace=function(){return O};this.getActiveMipmapLevel=function(){return P};this.getRenderTarget=function(){return A};this.setRenderTarget=function(e,t,r){A=e;O=t;P=r;e&&void 0===oe.get(e).__webglFramebuffer&&ae.setupRenderTarget(e);var n=E,i=!1;e?(n=oe.get(e).__webglFramebuffer,e.isWebGLCubeRenderTarget?(n=n[t||0],i=!0):n=e.isWebGLMultisampleRenderTarget?oe.get(e).__webglMultisampledFramebuffer:n,D.copy(e.viewport),B.copy(e.scissor),F=e.scissorTest):(D.copy(U).multiplyScalar(G).floor(),B.copy(q).multiplyScalar(G).floor(),F=W);j!==n&&(ee.bindFramebuffer(36160,n),j=n);ne.viewport(D);ne.scissor(B);ne.setScissorTest(F);i&&(e=oe.get(e.texture),ee.framebufferTexture2D(36160,36064,34069+(t||0),e.__webglTexture,r||0))};this.readRenderTargetPixels=function(e,t,r,n,i,o,a){if(e&&e.isWebGLRenderTarget){var s=oe.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]);if(s){a=!1;s!==j&&(ee.bindFramebuffer(36160,s),a=!0);try{var u=e.texture,c=u.format,l=u.type;1023!==c&&_e.convert(c)!==ee.getParameter(35739)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===l||_e.convert(l)===ee.getParameter(35738)||1015===l&&(re.isWebGL2||te.get("OES_texture_float")||te.get("WEBGL_color_buffer_float"))||1016===l&&(re.isWebGL2?te.get("EXT_color_buffer_float"):te.get("EXT_color_buffer_half_float"))?36053===ee.checkFramebufferStatus(36160)?0<=t&&t<=e.width-n&&0<=r&&r<=e.height-i&&ee.readPixels(t,r,n,i,_e.convert(c),_e.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{a&&ee.bindFramebuffer(36160,j)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")};this.copyFramebufferToTexture=function(e,t,r){void 0===r&&(r=0);var n=Math.pow(2,-r),i=Math.floor(t.image.width*n);n=Math.floor(t.image.height*n);var o=_e.convert(t.format);ae.setTexture2D(t,0);ee.copyTexImage2D(3553,r,o,e.x,e.y,i,n,0);ne.unbindTexture()};this.copyTextureToTexture=function(e,t,r,n){void 0===n&&(n=0);var i=t.image.width,o=t.image.height,a=_e.convert(r.format),s=_e.convert(r.type);ae.setTexture2D(r,0);t.isDataTexture?ee.texSubImage2D(3553,n,e.x,e.y,i,o,a,s,t.image.data):t.isCompressedTexture?ee.compressedTexSubImage2D(3553,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):ee.texSubImage2D(3553,n,e.x,e.y,a,s,t.image);0===n&&r.generateMipmaps&&ee.generateMipmap(3553);ne.unbindTexture()};this.initTexture=function(e){ae.setTexture2D(e,0);ne.unbindTexture()};"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function qt(e,t){this.name="";this.color=new v(e);this.density=void 0!==t?t:25e-5}function Wt(e,t,r){this.name="";this.color=new v(e);this.near=void 0!==t?t:1;this.far=void 0!==r?r:1e3}function Xt(e,t){this.array=e;this.stride=t;this.count=void 0!==e?e.length/t:0;this.usage=35044;this.updateRange={offset:0,count:-1};this.version=0}function Yt(e,t,r,n){this.name="";this.data=e;this.itemSize=t;this.offset=r;this.normalized=!0===n}function Kt(e){y.call(this);this.type="SpriteMaterial";this.color=new v(16777215);this.alphaMap=this.map=null;this.rotation=0;this.transparent=this.sizeAttenuation=!0;this.setValues(e)}function Zt(e){f.call(this);this.type="Sprite";if(void 0===eu){eu=new N;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);t=new Xt(t,5);eu.setIndex([0,1,2,0,2,3]);eu.setAttribute("position",new Yt(t,3,0,!1));eu.setAttribute("uv",new Yt(t,2,3,!1))}this.geometry=eu;this.material=void 0!==e?e:new Kt;this.center=new Me(.5,.5)}function Jt(e,t,r,n,i,o){iu.subVectors(e,r).addScalar(.5).multiply(n);void 0!==i?(ou.x=o*iu.x-i*iu.y,ou.y=i*iu.x+o*iu.y):ou.copy(iu);e.copy(t);e.x+=ou.x;e.y+=ou.y;e.applyMatrix4(au)}function Qt(){f.call(this);this._currentLevel=0;this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}});this.autoUpdate=!0}function er(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");I.call(this,e,t);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new Ee;this.bindMatrixInverse=new Ee}function tr(e,t){e=e||[];this.bones=e.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);this.frame=-1;if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new Ee)}function rr(){f.call(this);this.type="Bone"}function nr(e,t,r){I.call(this,e,t);this.instanceMatrix=new E(new Float32Array(16*r),16);this.count=r;this.frustumCulled=!1}function ir(e){y.call(this);this.type="LineBasicMaterial";this.color=new v(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.morphTargets=!1;this.setValues(e)}function or(e,t,r){1===r&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.");f.call(this);this.type="Line";this.geometry=void 0!==e?e:new N;this.material=void 0!==t?t:new ir;this.updateMorphTargets()}function ar(e,t){or.call(this,e,t);this.type="LineSegments"}function sr(e,t){or.call(this,e,t);this.type="LineLoop"}function ur(e){y.call(this);this.type="PointsMaterial";this.color=new v(16777215);this.alphaMap=this.map=null;this.size=1;this.sizeAttenuation=!0;this.morphTargets=!1;this.setValues(e)}function cr(e,t){f.call(this);this.type="Points";this.geometry=void 0!==e?e:new N;this.material=void 0!==t?t:new ur;this.updateMorphTargets()}function lr(e,t,r,n,i,o,a){var s=Pu.distanceSqToPoint(e);s<r&&(r=new Te,Pu.closestPointToPoint(e,r),r.applyMatrix4(n),e=i.ray.origin.distanceTo(r),e<i.near||e>i.far||o.push({distance:e,distanceToRay:Math.sqrt(s),point:r,index:t,face:null,object:a}))}function hr(e,t,r,n,i,o,a,s,u){p.call(this,e,t,r,n,i,o,a,s,u);this.format=void 0!==a?a:1022;this.minFilter=void 0!==o?o:1006;this.magFilter=void 0!==i?i:1006;this.generateMipmaps=!1}function pr(e,t,r,n,i,o,a,s,u,c,l,h){p.call(this,null,o,a,s,u,c,n,i,l,h);this.image={width:t,height:r};this.mipmaps=e;this.generateMipmaps=this.flipY=!1}function fr(e,t,r,n,i,o,a,s,u){p.call(this,e,t,r,n,i,o,a,s,u);this.needsUpdate=!0}function dr(e,t,r,n,i,o,a,s,u,c){c=void 0!==c?c:1026;if(1026!==c&&1027!==c)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===c&&(r=1012);void 0===r&&1027===c&&(r=1020);p.call(this,null,n,i,o,a,s,c,r,u);this.image={width:e,height:t};this.magFilter=void 0!==a?a:1003;this.minFilter=void 0!==s?s:1003;this.generateMipmaps=this.flipY=!1}function vr(e){N.call(this);this.type="WireframeGeometry";var t=[],r,n,i,o=[0,0],a={},s=["a","b","c"];if(e&&e.isGeometry){var u=e.faces;var c=0;for(n=u.length;c<n;c++){var l=u[c];for(r=0;3>r;r++){var h=l[s[r]];var p=l[s[(r+1)%3]];o[0]=Math.min(h,p);o[1]=Math.max(h,p);h=o[0]+","+o[1];void 0===a[h]&&(a[h]={index1:o[0],index2:o[1]})}}for(h in a)c=a[h],s=e.vertices[c.index1],t.push(s.x,s.y,s.z),s=e.vertices[c.index2],t.push(s.x,s.y,s.z)}else if(e&&e.isBufferGeometry)if(s=new Te,null!==e.index){u=e.attributes.position;l=e.index;var f=e.groups;0===f.length&&(f=[{start:0,count:l.count,materialIndex:0}]);e=0;for(i=f.length;e<i;++e)for(c=f[e],r=c.start,n=c.count,c=r,n=r+n;c<n;c+=3)for(r=0;3>r;r++)h=l.getX(c+r),p=l.getX(c+(r+1)%3),o[0]=Math.min(h,p),o[1]=Math.max(h,p),h=o[0]+","+o[1],void 0===a[h]&&(a[h]={index1:o[0],index2:o[1]});for(h in a)c=a[h],s.fromBufferAttribute(u,c.index1),t.push(s.x,s.y,s.z),s.fromBufferAttribute(u,c.index2),t.push(s.x,s.y,s.z)}else for(u=e.attributes.position,c=0,n=u.count/3;c<n;c++)for(r=0;3>r;r++)a=3*c+r,s.fromBufferAttribute(u,a),t.push(s.x,s.y,s.z),a=3*c+(r+1)%3,s.fromBufferAttribute(u,a),t.push(s.x,s.y,s.z);this.setAttribute("position",new j(t,3))}function mr(e,t,r){F.call(this);this.type="ParametricGeometry";this.parameters={func:e,slices:t,stacks:r};this.fromBufferGeometry(new gr(e,t,r));this.mergeVertices()}function gr(e,t,r){N.call(this);this.type="ParametricBufferGeometry";this.parameters={func:e,slices:t,stacks:r};var n=[],i=[],o=[],a=[],s=new Te,u=new Te,c=new Te,l=new Te,h=new Te,p,f;3>e.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var d=t+1;for(p=0;p<=r;p++){var v=p/r;for(f=0;f<=t;f++){var m=f/t;e(m,v,u);i.push(u.x,u.y,u.z);0<=m-1e-5?(e(m-1e-5,v,c),l.subVectors(u,c)):(e(m+1e-5,v,c),l.subVectors(c,u));0<=v-1e-5?(e(m,v-1e-5,c),h.subVectors(u,c)):(e(m,v+1e-5,c),h.subVectors(c,u));s.crossVectors(l,h).normalize();o.push(s.x,s.y,s.z);a.push(m,v)}}for(p=0;p<r;p++)for(f=0;f<t;f++)e=p*d+f+1,s=(p+1)*d+f+1,u=(p+1)*d+f,n.push(p*d+f,e,u),n.push(e,s,u);this.setIndex(n);this.setAttribute("position",new j(i,3));this.setAttribute("normal",new j(o,3));this.setAttribute("uv",new j(a,2))}function _r(e,t,r,n){F.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:e,indices:t,radius:r,detail:n};this.fromBufferGeometry(new yr(e,t,r,n));this.mergeVertices()}function yr(r,v,e,t){function m(e){h.push(e.x,e.y,e.z)}function g(e,t){e*=3;t.x=r[e+0];t.y=r[e+1];t.z=r[e+2]}function l(e,t,r,n){0>n&&1===e.x&&(p[t]=e.x-1);0===r.x&&0===r.z&&(p[t]=n/2/Math.PI+.5)}N.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:r,indices:v,radius:e,detail:t};e=e||1;t=t||0;var h=[],p=[];(function(e){for(var t=new Te,r=new Te,n=new Te,i=0;i<v.length;i+=3){g(v[i+0],t);g(v[i+1],r);g(v[i+2],n);var o,a,s=t,u=r,c=n,l=Math.pow(2,e),h=[];for(a=0;a<=l;a++){h[a]=[];var p=s.clone().lerp(c,a/l),f=u.clone().lerp(c,a/l),d=l-a;for(o=0;o<=d;o++)h[a][o]=0===o&&a===l?p:p.clone().lerp(f,o/d)}for(a=0;a<l;a++)for(o=0;o<2*(l-a)-1;o++)s=Math.floor(o/2),0===o%2?(m(h[a][s+1]),m(h[a+1][s]),m(h[a][s])):(m(h[a][s+1]),m(h[a+1][s+1]),m(h[a+1][s]))}})(t);(function(e){for(var t=new Te,r=0;r<h.length;r+=3)t.x=h[r+0],t.y=h[r+1],t.z=h[r+2],t.normalize().multiplyScalar(e),h[r+0]=t.x,h[r+1]=t.y,h[r+2]=t.z})(e);(function(){for(var e=new Te,t=0;t<h.length;t+=3)e.x=h[t+0],e.y=h[t+1],e.z=h[t+2],p.push(Math.atan2(e.z,-e.x)/2/Math.PI+.5,1-(Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5));e=new Te;t=new Te;for(var r=new Te,n=new Te,i=new Me,o=new Me,a=new Me,s=0,u=0;s<h.length;s+=9,u+=6){e.set(h[s+0],h[s+1],h[s+2]);t.set(h[s+3],h[s+4],h[s+5]);r.set(h[s+6],h[s+7],h[s+8]);i.set(p[u+0],p[u+1]);o.set(p[u+2],p[u+3]);a.set(p[u+4],p[u+5]);n.copy(e).add(t).add(r).divideScalar(3);var c=Math.atan2(n.z,-n.x);l(i,u+0,e,c);l(o,u+2,t,c);l(a,u+4,r,c)}for(e=0;e<p.length;e+=6)t=p[e+0],r=p[e+2],n=p[e+4],i=Math.min(t,r,n),.9<Math.max(t,r,n)&&.1>i&&(.2>t&&(p[e+0]+=1),.2>r&&(p[e+2]+=1),.2>n&&(p[e+4]+=1))})();this.setAttribute("position",new j(h,3));this.setAttribute("normal",new j(h.slice(),3));this.setAttribute("uv",new j(p,2));0===t?this.computeVertexNormals():this.normalizeNormals()}function br(e,t){F.call(this);this.type="TetrahedronGeometry";this.parameters={radius:e,detail:t};this.fromBufferGeometry(new xr(e,t));this.mergeVertices()}function xr(e,t){yr.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t);this.type="TetrahedronBufferGeometry";this.parameters={radius:e,detail:t}}function wr(e,t){F.call(this);this.type="OctahedronGeometry";this.parameters={radius:e,detail:t};this.fromBufferGeometry(new Sr(e,t));this.mergeVertices()}function Sr(e,t){yr.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t);this.type="OctahedronBufferGeometry";this.parameters={radius:e,detail:t}}function Mr(e,t){F.call(this);this.type="IcosahedronGeometry";this.parameters={radius:e,detail:t};this.fromBufferGeometry(new Cr(e,t));this.mergeVertices()}function Cr(e,t){var r=(1+Math.sqrt(5))/2;yr.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t);this.type="IcosahedronBufferGeometry";this.parameters={radius:e,detail:t}}function Tr(e,t){F.call(this);this.type="DodecahedronGeometry";this.parameters={radius:e,detail:t};this.fromBufferGeometry(new Er(e,t));this.mergeVertices()}function Er(e,t){var r=(1+Math.sqrt(5))/2,n=1/r;yr.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t);this.type="DodecahedronBufferGeometry";this.parameters={radius:e,detail:t}}function Or(e,t,r,n,i,o){F.call(this);this.type="TubeGeometry";this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:n,closed:i};void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");e=new Pr(e,t,r,n,i);this.tangents=e.tangents;this.normals=e.normals;this.binormals=e.binormals;this.fromBufferGeometry(e);this.mergeVertices()}function Pr(i,o,a,s,e){function t(e){h=i.getPointAt(e/o,h);var t=u.normals[e];e=u.binormals[e];for(p=0;p<=s;p++){var r=p/s*Math.PI*2,n=Math.sin(r);r=-Math.cos(r);l.x=r*t.x+n*e.x;l.y=r*t.y+n*e.y;l.z=r*t.z+n*e.z;l.normalize();d.push(l.x,l.y,l.z);c.x=h.x+a*l.x;c.y=h.y+a*l.y;c.z=h.z+a*l.z;f.push(c.x,c.y,c.z)}}N.call(this);this.type="TubeBufferGeometry";this.parameters={path:i,tubularSegments:o,radius:a,radialSegments:s,closed:e};o=o||64;a=a||1;s=s||8;e=e||!1;var u=i.computeFrenetFrames(o,e);this.tangents=u.tangents;this.normals=u.normals;this.binormals=u.binormals;var c=new Te,l=new Te,r=new Me,h=new Te,n,p,f=[],d=[],v=[],m=[];for(n=0;n<o;n++)t(n);t(!1===e?o:0);for(n=0;n<=o;n++)for(p=0;p<=s;p++)r.x=n/o,r.y=p/s,v.push(r.x,r.y);(function(){for(p=1;p<=o;p++)for(n=1;n<=s;n++){var e=(s+1)*p+(n-1),t=(s+1)*p+n,r=(s+1)*(p-1)+n;m.push((s+1)*(p-1)+(n-1),e,r);m.push(e,t,r)}})();this.setIndex(m);this.setAttribute("position",new j(f,3));this.setAttribute("normal",new j(d,3));this.setAttribute("uv",new j(v,2))}function Ar(e,t,r,n,i,o,a){F.call(this);this.type="TorusKnotGeometry";this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:o};void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.");this.fromBufferGeometry(new jr(e,t,r,n,i,o));this.mergeVertices()}function jr(e,t,r,n,i,o){function a(e,t,r,n,i){var o=Math.sin(e);t=r/t*e;r=Math.cos(t);i.x=n*(2+r)*.5*Math.cos(e);i.y=n*(2+r)*o*.5;i.z=n*Math.sin(t)*.5}N.call(this);this.type="TorusKnotBufferGeometry";this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:o};e=e||1;t=t||.4;r=Math.floor(r)||64;n=Math.floor(n)||8;i=i||2;o=o||3;var s=[],u=[],c=[],l=[],h,p=new Te,f=new Te,d=new Te,v=new Te,m=new Te,g=new Te,_=new Te;for(h=0;h<=r;++h){var y=h/r*i*Math.PI*2;a(y,i,o,e,d);a(y+.01,i,o,e,v);g.subVectors(v,d);_.addVectors(v,d);m.crossVectors(g,_);_.crossVectors(m,g);m.normalize();_.normalize();for(y=0;y<=n;++y){var b=y/n*Math.PI*2,x=-t*Math.cos(b);b=t*Math.sin(b);p.x=d.x+(x*_.x+b*m.x);p.y=d.y+(x*_.y+b*m.y);p.z=d.z+(x*_.z+b*m.z);u.push(p.x,p.y,p.z);f.subVectors(p,d).normalize();c.push(f.x,f.y,f.z);l.push(h/r);l.push(y/n)}}for(y=1;y<=r;y++)for(h=1;h<=n;h++)e=(n+1)*y+(h-1),t=(n+1)*y+h,i=(n+1)*(y-1)+h,s.push((n+1)*(y-1)+(h-1),e,i),s.push(e,t,i);this.setIndex(s);this.setAttribute("position",new j(u,3));this.setAttribute("normal",new j(c,3));this.setAttribute("uv",new j(l,2))}function Rr(e,t,r,n,i){F.call(this);this.type="TorusGeometry";this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i};this.fromBufferGeometry(new kr(e,t,r,n,i));this.mergeVertices()}function kr(e,t,r,n,i){N.call(this);this.type="TorusBufferGeometry";this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i};e=e||1;t=t||.4;r=Math.floor(r)||8;n=Math.floor(n)||6;i=i||2*Math.PI;var o=[],a=[],s=[],u=[],c=new Te,l=new Te,h=new Te,p,f;for(p=0;p<=r;p++)for(f=0;f<=n;f++){var d=f/n*i,v=p/r*Math.PI*2;l.x=(e+t*Math.cos(v))*Math.cos(d);l.y=(e+t*Math.cos(v))*Math.sin(d);l.z=t*Math.sin(v);a.push(l.x,l.y,l.z);c.x=e*Math.cos(d);c.y=e*Math.sin(d);h.subVectors(l,c).normalize();s.push(h.x,h.y,h.z);u.push(f/n);u.push(p/r)}for(p=1;p<=r;p++)for(f=1;f<=n;f++)e=(n+1)*(p-1)+f-1,t=(n+1)*(p-1)+f,i=(n+1)*p+f,o.push((n+1)*p+f-1,e,i),o.push(e,t,i);this.setIndex(o);this.setAttribute("position",new j(a,3));this.setAttribute("normal",new j(s,3));this.setAttribute("uv",new j(u,2))}function Lr(e,t,r,n,i){for(var o,a=0,s=t,u=r-n;s<r;s+=n)a+=(e[u]-e[s])*(e[s+1]+e[u+1]),u=s;if(i===0<a)for(i=t;i<r;i+=n)o=Kr(i,e[i],e[i+1],o);else for(i=r-n;i>=t;i-=n)o=Kr(i,e[i],e[i+1],o);o&&Hr(o,o.next)&&(Zr(o),o=o.next);return o}function Nr(e,t){if(!e)return e;t||(t=e);do{var r=!1;if(e.steiner||!Hr(e,e.next)&&0!==Vr(e.prev,e,e.next))e=e.next;else{Zr(e);e=t=e.prev;if(e===e.next)break;r=!0}}while(r||e!==t);return t}function Ir(e,t,r,n,i,o,a){if(e){if(!a&&o){var s=e,u=s;do{null===u.z&&(u.z=zr(u.x,u.y,n,i,o)),u.prevZ=u.prev,u=u.nextZ=u.next}while(u!==s);u.prevZ.nextZ=null;u.prevZ=null;s=u;var c,l,h,p,f=1;do{u=s;var d=s=null;for(l=0;u;){l++;var v=u;for(c=h=0;c<f&&(h++,v=v.nextZ,v);c++);for(p=f;0<h||0<p&&v;)0!==h&&(0===p||!v||u.z<=v.z)?(c=u,u=u.nextZ,h--):(c=v,v=v.nextZ,p--),d?d.nextZ=c:s=c,c.prevZ=d,d=c;u=v}d.nextZ=null;f*=2}while(1<l)}for(s=e;e.prev!==e.next;){u=e.prev;v=e.next;if(o)d=Dr(e,n,i,o);else e:if(d=e,l=d.prev,h=d,f=d.next,0<=Vr(l,h,f))d=!1;else{for(c=d.next.next;c!==d.prev;){if(Gr(l.x,l.y,h.x,h.y,f.x,f.y,c.x,c.y)&&0<=Vr(c.prev,c,c.next)){d=!1;break e}c=c.next}d=!0}if(d)t.push(u.i/r),t.push(e.i/r),t.push(v.i/r),Zr(e),s=e=v.next;else if(e=v,e===s){if(!a)Ir(Nr(e),t,r,n,i,o,1);else if(1===a){e=Nr(e);a=t;s=r;u=e;do{v=u.prev,d=u.next.next,!Hr(v,d)&&Ur(v,u,u.next,d)&&Xr(v,d)&&Xr(d,v)&&(a.push(v.i/s),a.push(u.i/s),a.push(d.i/s),Zr(u),Zr(u.next),u=e=d),u=u.next}while(u!==e);e=Nr(u);Ir(e,t,r,n,i,o,2)}else if(2===a)e:{a=e;do{for(s=a.next.next;s!==a.prev;){if(u=a.i!==s.i){u=a;v=s;if(d=u.next.i!==v.i&&u.prev.i!==v.i){t:{d=u;do{if(d.i!==u.i&&d.next.i!==u.i&&d.i!==v.i&&d.next.i!==v.i&&Ur(d,d.next,u,v)){d=!0;break t}d=d.next}while(d!==u);d=!1}d=!d}if(d){if(d=Xr(u,v)&&Xr(v,u)){d=u;l=!1;h=(u.x+v.x)/2;f=(u.y+v.y)/2;do{d.y>f!==d.next.y>f&&d.next.y!==d.y&&h<(d.next.x-d.x)*(f-d.y)/(d.next.y-d.y)+d.x&&(l=!l),d=d.next}while(d!==u);d=l}d=d&&(Vr(u.prev,u,v.prev)||Vr(u,v.prev,v))||Hr(u,v)&&0<Vr(u.prev,u,u.next)&&0<Vr(v.prev,v,v.next)}u=d}if(u){e=Yr(a,s);a=Nr(a,a.next);e=Nr(e,e.next);Ir(a,t,r,n,i,o);Ir(e,t,r,n,i,o);break e}s=s.next}a=a.next}while(a!==e)}break}}}}function Dr(e,t,r,n){var i=e.prev,o=e.next;if(0<=Vr(i,e,o))return!1;var a=i.x>e.x?i.x>o.x?i.x:o.x:e.x>o.x?e.x:o.x,s=i.y>e.y?i.y>o.y?i.y:o.y:e.y>o.y?e.y:o.y,u=zr(i.x<e.x?i.x<o.x?i.x:o.x:e.x<o.x?e.x:o.x,i.y<e.y?i.y<o.y?i.y:o.y:e.y<o.y?e.y:o.y,t,r,n);t=zr(a,s,t,r,n);r=e.prevZ;for(n=e.nextZ;r&&r.z>=u&&n&&n.z<=t;){if(r!==e.prev&&r!==e.next&&Gr(i.x,i.y,e.x,e.y,o.x,o.y,r.x,r.y)&&0<=Vr(r.prev,r,r.next))return!1;r=r.prevZ;if(n!==e.prev&&n!==e.next&&Gr(i.x,i.y,e.x,e.y,o.x,o.y,n.x,n.y)&&0<=Vr(n.prev,n,n.next))return!1;n=n.nextZ}for(;r&&r.z>=u;){if(r!==e.prev&&r!==e.next&&Gr(i.x,i.y,e.x,e.y,o.x,o.y,r.x,r.y)&&0<=Vr(r.prev,r,r.next))return!1;r=r.prevZ}for(;n&&n.z<=t;){if(n!==e.prev&&n!==e.next&&Gr(i.x,i.y,e.x,e.y,o.x,o.y,n.x,n.y)&&0<=Vr(n.prev,n,n.next))return!1;n=n.nextZ}return!0}function Br(e,t){return e.x-t.x}function Fr(e,t){var r=t,n=e.x,i=e.y,o=-Infinity;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var a=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o){o=a;if(a===n){if(i===r.y)return r;if(i===r.next.y)return r.next}var s=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!s)return null;if(n===o)return s;t=s;a=s.x;var u=s.y,c=Infinity;r=s;do{if(n>=r.x&&r.x>=a&&n!==r.x&&Gr(i<u?n:o,i,a,u,i<u?o:n,i,r.x,r.y)){var l=Math.abs(i-r.y)/(n-r.x);var h;if((h=Xr(r,e))&&!(h=l<c)&&(h=l===c)&&!(h=r.x>s.x)&&(h=r.x===s.x)){h=s;var p=r;h=0>Vr(h.prev,h,p.prev)&&0>Vr(p.next,h,h.next)}h&&(s=r,c=l)}r=r.next}while(r!==t);return s}function zr(e,t,r,n,i){e=32767*(e-r)*i;t=32767*(t-n)*i;e=(e|e<<8)&16711935;e=(e|e<<4)&252645135;e=(e|e<<2)&858993459;t=(t|t<<8)&16711935;t=(t|t<<4)&252645135;t=(t|t<<2)&858993459;return(e|e<<1)&1431655765|((t|t<<1)&1431655765)<<1}function $r(e){var t=e,r=e;do{if(t.x<r.x||t.x===r.x&&t.y<r.y)r=t;t=t.next}while(t!==e);return r}function Gr(e,t,r,n,i,o,a,s){return 0<=(i-a)*(t-s)-(e-a)*(o-s)&&0<=(e-a)*(n-s)-(r-a)*(t-s)&&0<=(r-a)*(o-s)-(i-a)*(n-s)}function Vr(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Hr(e,t){return e.x===t.x&&e.y===t.y}function Ur(e,t,r,n){var i=Wr(Vr(e,t,r)),o=Wr(Vr(e,t,n)),a=Wr(Vr(r,n,e)),s=Wr(Vr(r,n,t));return i!==o&&a!==s||0===i&&qr(e,r,t)||0===o&&qr(e,n,t)||0===a&&qr(r,e,n)||0===s&&qr(r,t,n)?!0:!1}function qr(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Wr(e){return 0<e?1:0>e?-1:0}function Xr(e,t){return 0>Vr(e.prev,e,e.next)?0<=Vr(e,t,e.next)&&0<=Vr(e,e.prev,t):0>Vr(e,t,e.prev)||0>Vr(e,e.next,t)}function Yr(e,t){var r=new Jr(e.i,e.x,e.y),n=new Jr(t.i,t.x,t.y),i=e.next,o=t.prev;e.next=t;t.prev=e;r.next=i;i.prev=r;n.next=r;r.prev=n;o.next=n;n.prev=o;return n}function Kr(e,t,r,n){e=new Jr(e,t,r);n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e);return e}function Zr(e){e.next.prev=e.prev;e.prev.next=e.next;e.prevZ&&(e.prevZ.nextZ=e.nextZ);e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Jr(e,t,r){this.i=e;this.x=t;this.y=r;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Qr(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function en(e,t){for(var r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}function tn(e,t){F.call(this);this.type="ExtrudeGeometry";this.parameters={shapes:e,options:t};this.fromBufferGeometry(new rn(e,t));this.mergeVertices()}function rn(e,G){function t(e){function t(e,t,r){t||console.error("THREE.ExtrudeGeometry: vec does not exist");return t.clone().multiplyScalar(r).add(e)}function r(e,t,r){var n=e.x-t.x;var i=e.y-t.y;var o=r.x-e.x;var a=r.y-e.y,s=n*n+i*i;if(Math.abs(n*a-i*o)>Number.EPSILON){var u=Math.sqrt(s),c=Math.sqrt(o*o+a*a);s=t.x-i/u;t=t.y+n/u;a=((r.x-a/c-s)*a-(r.y+o/c-t)*o)/(n*a-i*o);o=s+n*a-e.x;n=t+i*a-e.y;i=o*o+n*n;if(2>=i)return new Me(o,n);i=Math.sqrt(i/2)}else e=!1,n>Number.EPSILON?o>Number.EPSILON&&(e=!0):n<-Number.EPSILON?o<-Number.EPSILON&&(e=!0):Math.sign(i)===Math.sign(a)&&(e=!0),e?(o=-i,i=Math.sqrt(s)):(o=n,n=i,i=Math.sqrt(s/2));return new Me(o/i,n/i)}function n(e,t){for(N=e.length;0<=--N;){var r=N;var n=N-1;0>n&&(n=e.length-1);var i,o=p+2*m;for(i=0;i<o;i++){var a=R*i,s=R*(i+1),u=t+n+a,c=t+n+s;s=t+r+s;l(t+r+a);l(u);l(s);l(u);l(c);l(s);a=H.length/3;a=_.generateSideWallUV(V,H,a-6,a-3,a-2,a-1);h(a[0]);h(a[1]);h(a[3]);h(a[1]);h(a[2]);h(a[3])}}}function i(e,t,r){a.push(e);a.push(t);a.push(r)}function o(e,t,r){l(e);l(t);l(r);e=H.length/3;e=_.generateTopUV(V,H,e-3,e-2,e-1);h(e[0]);h(e[1]);h(e[2])}function l(e){H.push(a[3*e]);H.push(a[3*e+1]);H.push(a[3*e+2])}function h(e){U.push(e.x);U.push(e.y)}var a=[],s=void 0!==G.curveSegments?G.curveSegments:12,p=void 0!==G.steps?G.steps:1,u=void 0!==G.depth?G.depth:100,c=void 0!==G.bevelEnabled?G.bevelEnabled:!0,f=void 0!==G.bevelThickness?G.bevelThickness:6,d=void 0!==G.bevelSize?G.bevelSize:f-2,v=void 0!==G.bevelOffset?G.bevelOffset:0,m=void 0!==G.bevelSegments?G.bevelSegments:3,g=G.extrudePath,_=void 0!==G.UVGenerator?G.UVGenerator:Lu;void 0!==G.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),u=G.amount);var y=!1;if(g){var b=g.getSpacedPoints(p);y=!0;c=!1;var x=g.computeFrenetFrames(p,!1);var w=new Te;var S=new Te;var M=new Te}c||(v=d=f=m=0);var C;s=e.extractPoints(s);e=s.shape;var T=s.holes;if(!ku.isClockWise(e)){e=e.reverse();var E=0;for(C=T.length;E<C;E++){var O=T[E];ku.isClockWise(O)&&(T[E]=O.reverse())}}var P=ku.triangulateShape(e,T),A=e;E=0;for(C=T.length;E<C;E++)O=T[E],e=e.concat(O);var j,R=e.length,k,L=P.length;s=[];var N=0;var I=A.length;var D=I-1;for(j=N+1;N<I;N++,D++,j++)D===I&&(D=0),j===I&&(j=0),s[N]=r(A[N],A[D],A[j]);g=[];var B=s.concat();E=0;for(C=T.length;E<C;E++){O=T[E];var F=[];N=0;I=O.length;D=I-1;for(j=N+1;N<I;N++,D++,j++)D===I&&(D=0),j===I&&(j=0),F[N]=r(O[N],O[D],O[j]);g.push(F);B=B.concat(F)}for(D=0;D<m;D++){I=D/m;var z=f*Math.cos(I*Math.PI/2);j=d*Math.sin(I*Math.PI/2)+v;N=0;for(I=A.length;N<I;N++){var $=t(A[N],s[N],j);i($.x,$.y,-z)}E=0;for(C=T.length;E<C;E++)for(O=T[E],F=g[E],N=0,I=O.length;N<I;N++)$=t(O[N],F[N],j),i($.x,$.y,-z)}j=d+v;for(N=0;N<R;N++)$=c?t(e[N],B[N],j):e[N],y?(S.copy(x.normals[0]).multiplyScalar($.x),w.copy(x.binormals[0]).multiplyScalar($.y),M.copy(b[0]).add(S).add(w),i(M.x,M.y,M.z)):i($.x,$.y,0);for(I=1;I<=p;I++)for(N=0;N<R;N++)$=c?t(e[N],B[N],j):e[N],y?(S.copy(x.normals[I]).multiplyScalar($.x),w.copy(x.binormals[I]).multiplyScalar($.y),M.copy(b[I]).add(S).add(w),i(M.x,M.y,M.z)):i($.x,$.y,u/p*I);for(D=m-1;0<=D;D--){I=D/m;z=f*Math.cos(I*Math.PI/2);j=d*Math.sin(I*Math.PI/2)+v;N=0;for(I=A.length;N<I;N++)$=t(A[N],s[N],j),i($.x,$.y,u+z);E=0;for(C=T.length;E<C;E++)for(O=T[E],F=g[E],N=0,I=O.length;N<I;N++)$=t(O[N],F[N],j),y?i($.x,$.y+b[p-1].y,b[p-1].x+z):i($.x,$.y,u+z)}(function(){var e=H.length/3;if(c){var t=0*R;for(N=0;N<L;N++)k=P[N],o(k[2]+t,k[1]+t,k[0]+t);t=R*(p+2*m);for(N=0;N<L;N++)k=P[N],o(k[0]+t,k[1]+t,k[2]+t)}else{for(N=0;N<L;N++)k=P[N],o(k[2],k[1],k[0]);for(N=0;N<L;N++)k=P[N],o(k[0]+R*p,k[1]+R*p,k[2]+R*p)}V.addGroup(e,H.length/3-e,0)})();(function(){var e=H.length/3,t=0;n(A,t);t+=A.length;E=0;for(C=T.length;E<C;E++)O=T[E],n(O,t),t+=O.length;V.addGroup(e,H.length/3-e,1)})()}N.call(this);this.type="ExtrudeBufferGeometry";this.parameters={shapes:e,options:G};e=Array.isArray(e)?e:[e];for(var V=this,H=[],U=[],r=0,n=e.length;r<n;r++)t(e[r]);this.setAttribute("position",new j(H,3));this.setAttribute("uv",new j(U,2));this.computeVertexNormals()}function nn(e,t,r){r.shapes=[];if(Array.isArray(e))for(var n=0,i=e.length;n<i;n++)r.shapes.push(e[n].uuid);else r.shapes.push(e.uuid);void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON());return r}function on(e,t){F.call(this);this.type="TextGeometry";this.parameters={text:e,parameters:t};this.fromBufferGeometry(new an(e,t));this.mergeVertices()}function an(e,t){t=t||{};var r=t.font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new F;e=r.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50;void 0===t.bevelThickness&&(t.bevelThickness=10);void 0===t.bevelSize&&(t.bevelSize=8);void 0===t.bevelEnabled&&(t.bevelEnabled=!1);rn.call(this,e,t);this.type="TextBufferGeometry"}function sn(e,t,r,n,i,o,a){F.call(this);this.type="SphereGeometry";this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:a};this.fromBufferGeometry(new un(e,t,r,n,i,o,a));this.mergeVertices()}function un(e,t,r,n,i,o,a){N.call(this);this.type="SphereBufferGeometry";this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:a};e=e||1;t=Math.max(3,Math.floor(t)||8);r=Math.max(2,Math.floor(r)||6);n=void 0!==n?n:0;i=void 0!==i?i:2*Math.PI;o=void 0!==o?o:0;a=void 0!==a?a:Math.PI;var s=Math.min(o+a,Math.PI),u,c,l=0,h=[],p=new Te,f=new Te,d=[],v=[],m=[],g=[];for(c=0;c<=r;c++){var _=[],y=c/r,b=0;0==c&&0==o?b=.5/t:c==r&&s==Math.PI&&(b=-.5/t);for(u=0;u<=t;u++){var x=u/t;p.x=-e*Math.cos(n+x*i)*Math.sin(o+y*a);p.y=e*Math.cos(o+y*a);p.z=e*Math.sin(n+x*i)*Math.sin(o+y*a);v.push(p.x,p.y,p.z);f.copy(p).normalize();m.push(f.x,f.y,f.z);g.push(x+b,1-y);_.push(l++)}h.push(_)}for(c=0;c<r;c++)for(u=0;u<t;u++)e=h[c][u+1],n=h[c][u],i=h[c+1][u],a=h[c+1][u+1],(0!==c||0<o)&&d.push(e,n,a),(c!==r-1||s<Math.PI)&&d.push(n,i,a);this.setIndex(d);this.setAttribute("position",new j(v,3));this.setAttribute("normal",new j(m,3));this.setAttribute("uv",new j(g,2))}function cn(e,t,r,n,i,o){F.call(this);this.type="RingGeometry";this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:o};this.fromBufferGeometry(new ln(e,t,r,n,i,o));this.mergeVertices()}function ln(e,t,r,n,i,o){N.call(this);this.type="RingBufferGeometry";this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:o};e=e||.5;t=t||1;i=void 0!==i?i:0;o=void 0!==o?o:2*Math.PI;r=void 0!==r?Math.max(3,r):8;n=void 0!==n?Math.max(1,n):1;var a=[],s=[],u=[],c=[],l=e,h=(t-e)/n,p=new Te,f=new Me,d,v;for(d=0;d<=n;d++){for(v=0;v<=r;v++)e=i+v/r*o,p.x=l*Math.cos(e),p.y=l*Math.sin(e),s.push(p.x,p.y,p.z),u.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,c.push(f.x,f.y);l+=h}for(d=0;d<n;d++)for(t=d*(r+1),v=0;v<r;v++)e=v+t,i=e+r+1,o=e+r+2,l=e+1,a.push(e,i,l),a.push(i,o,l);this.setIndex(a);this.setAttribute("position",new j(s,3));this.setAttribute("normal",new j(u,3));this.setAttribute("uv",new j(c,2))}function hn(e,t,r,n){F.call(this);this.type="LatheGeometry";this.parameters={points:e,segments:t,phiStart:r,phiLength:n};this.fromBufferGeometry(new pn(e,t,r,n));this.mergeVertices()}function pn(e,t,r,n){N.call(this);this.type="LatheBufferGeometry";this.parameters={points:e,segments:t,phiStart:r,phiLength:n};t=Math.floor(t)||12;r=r||0;n=n||2*Math.PI;n=Vo.clamp(n,0,2*Math.PI);var i=[],o=[],a=[],s=1/t,u=new Te,c=new Me,l;for(l=0;l<=t;l++){var h=r+l*s*n;var p=Math.sin(h),f=Math.cos(h);for(h=0;h<=e.length-1;h++)u.x=e[h].x*p,u.y=e[h].y,u.z=e[h].x*f,o.push(u.x,u.y,u.z),c.x=l/t,c.y=h/(e.length-1),a.push(c.x,c.y)}for(l=0;l<t;l++)for(h=0;h<e.length-1;h++)r=h+l*e.length,s=r+e.length,u=r+e.length+1,c=r+1,i.push(r,s,c),i.push(s,u,c);this.setIndex(i);this.setAttribute("position",new j(o,3));this.setAttribute("uv",new j(a,2));this.computeVertexNormals();if(n===2*Math.PI)for(n=this.attributes.normal.array,i=new Te,o=new Te,a=new Te,r=t*e.length*3,h=l=0;l<e.length;l++,h+=3)i.x=n[h+0],i.y=n[h+1],i.z=n[h+2],o.x=n[r+h+0],o.y=n[r+h+1],o.z=n[r+h+2],a.addVectors(i,o).normalize(),n[h+0]=n[r+h+0]=a.x,n[h+1]=n[r+h+1]=a.y,n[h+2]=n[r+h+2]=a.z}function fn(e,t){F.call(this);this.type="ShapeGeometry";"object"===typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments);this.parameters={shapes:e,curveSegments:t};this.fromBufferGeometry(new dn(e,t));this.mergeVertices()}function dn(e,s){function t(e){var t,r=c.length/3;e=e.extractPoints(s);var n=e.shape,i=e.holes;!1===ku.isClockWise(n)&&(n=n.reverse());e=0;for(t=i.length;e<t;e++){var o=i[e];!0===ku.isClockWise(o)&&(i[e]=o.reverse())}var a=ku.triangulateShape(n,i);e=0;for(t=i.length;e<t;e++)o=i[e],n=n.concat(o);e=0;for(t=n.length;e<t;e++)o=n[e],c.push(o.x,o.y,0),l.push(0,0,1),h.push(o.x,o.y);e=0;for(t=a.length;e<t;e++)n=a[e],u.push(n[0]+r,n[1]+r,n[2]+r),p+=3}N.call(this);this.type="ShapeBufferGeometry";this.parameters={shapes:e,curveSegments:s};s=s||12;var u=[],c=[],l=[],h=[],r=0,p=0;if(!1===Array.isArray(e))t(e);else for(var n=0;n<e.length;n++)t(e[n]),this.addGroup(r,p,n),r+=p,p=0;this.setIndex(u);this.setAttribute("position",new j(c,3));this.setAttribute("normal",new j(l,3));this.setAttribute("uv",new j(h,2))}function vn(e,t){t.shapes=[];if(Array.isArray(e))for(var r=0,n=e.length;r<n;r++)t.shapes.push(e[r].uuid);else t.shapes.push(e.uuid);return t}function mn(e,t){N.call(this);this.type="EdgesGeometry";this.parameters={thresholdAngle:t};var r=[];t=Math.cos(Vo.DEG2RAD*(void 0!==t?t:1));var n=[0,0],i={},o=["a","b","c"];if(e.isBufferGeometry){var a=new F;a.fromBufferGeometry(e)}else a=e.clone();a.mergeVertices();a.computeFaceNormals();e=a.vertices;a=a.faces;for(var s=0,u=a.length;s<u;s++)for(var c=a[s],l=0;3>l;l++){var h=c[o[l]];var p=c[o[(l+1)%3]];n[0]=Math.min(h,p);n[1]=Math.max(h,p);h=n[0]+","+n[1];void 0===i[h]?i[h]={index1:n[0],index2:n[1],face1:s,face2:void 0}:i[h].face2=s}for(h in i)if(n=i[h],void 0===n.face2||a[n.face1].normal.dot(a[n.face2].normal)<=t)o=e[n.index1],r.push(o.x,o.y,o.z),o=e[n.index2],r.push(o.x,o.y,o.z);this.setAttribute("position",new j(r,3))}function gn(e,t,r,n,i,o,a,s){F.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s};this.fromBufferGeometry(new _n(e,t,r,n,i,o,a,s));this.mergeVertices()}function _n(p,f,d,v,m,e,g,_){function t(e){var t,r=new Me,n=new Te,i=0,o=!0===e?p:f,a=!0===e?1:-1;var s=M;for(t=1;t<=v;t++)x.push(0,T*a,0),w.push(0,a,0),S.push(.5,.5),M++;var u=M;for(t=0;t<=v;t++){var c=t/v*_+g,l=Math.cos(c);c=Math.sin(c);n.x=o*c;n.y=T*a;n.z=o*l;x.push(n.x,n.y,n.z);w.push(0,a,0);r.x=.5*l+.5;r.y=.5*c*a+.5;S.push(r.x,r.y);M++}for(t=0;t<v;t++)r=s+t,n=u+t,!0===e?b.push(n,n+1,r):b.push(n+1,n,r),i+=3;y.addGroup(E,i,!0===e?1:2);E+=i}N.call(this);this.type="CylinderBufferGeometry";this.parameters={radiusTop:p,radiusBottom:f,height:d,radialSegments:v,heightSegments:m,openEnded:e,thetaStart:g,thetaLength:_};var y=this;p=void 0!==p?p:1;f=void 0!==f?f:1;d=d||1;v=Math.floor(v)||8;m=Math.floor(m)||1;e=void 0!==e?e:!1;g=void 0!==g?g:0;_=void 0!==_?_:2*Math.PI;var b=[],x=[],w=[],S=[],M=0,C=[],T=d/2,E=0;(function(){var e,t,r=new Te,n=new Te,i=0,o=(f-p)/d;for(t=0;t<=m;t++){var a=[],s=t/m,u=s*(f-p)+p;for(e=0;e<=v;e++){var c=e/v,l=c*_+g,h=Math.sin(l);l=Math.cos(l);n.x=u*h;n.y=-s*d+T;n.z=u*l;x.push(n.x,n.y,n.z);r.set(h,o,l).normalize();w.push(r.x,r.y,r.z);S.push(c,1-s);a.push(M++)}C.push(a)}for(e=0;e<v;e++)for(t=0;t<m;t++)r=C[t+1][e],n=C[t+1][e+1],o=C[t][e+1],b.push(C[t][e],r,o),b.push(r,n,o),i+=6;y.addGroup(E,i,0);E+=i})();!1===e&&(0<p&&t(!0),0<f&&t(!1));this.setIndex(b);this.setAttribute("position",new j(x,3));this.setAttribute("normal",new j(w,3));this.setAttribute("uv",new j(S,2))}function yn(e,t,r,n,i,o,a){gn.call(this,0,e,t,r,n,i,o,a);this.type="ConeGeometry";this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:a}}function bn(e,t,r,n,i,o,a){_n.call(this,0,e,t,r,n,i,o,a);this.type="ConeBufferGeometry";this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:a}}function xn(e,t,r,n){F.call(this);this.type="CircleGeometry";this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n};this.fromBufferGeometry(new wn(e,t,r,n));this.mergeVertices()}function wn(e,t,r,n){N.call(this);this.type="CircleBufferGeometry";this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n};e=e||1;t=void 0!==t?Math.max(3,t):8;r=void 0!==r?r:0;n=void 0!==n?n:2*Math.PI;var i=[],o=[],a=[],s=[],u,c=new Te,l=new Me;o.push(0,0,0);a.push(0,0,1);s.push(.5,.5);var h=0;for(u=3;h<=t;h++,u+=3){var p=r+h/t*n;c.x=e*Math.cos(p);c.y=e*Math.sin(p);o.push(c.x,c.y,c.z);a.push(0,0,1);l.x=(o[u]/e+1)/2;l.y=(o[u+1]/e+1)/2;s.push(l.x,l.y)}for(u=1;u<=t;u++)i.push(u,u+1,0);this.setIndex(i);this.setAttribute("position",new j(o,3));this.setAttribute("normal",new j(a,3));this.setAttribute("uv",new j(s,2))}function Sn(e){y.call(this);this.type="ShadowMaterial";this.color=new v(0);this.transparent=!0;this.setValues(e)}function Mn(e){G.call(this,e);this.type="RawShaderMaterial"}function Cn(e){y.call(this);this.defines={STANDARD:""};this.type="MeshStandardMaterial";this.color=new v(16777215);this.roughness=1;this.metalness=0;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new v(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Me(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null;this.envMapIntensity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexTangents=this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(e)}function Tn(e){Cn.call(this);this.defines={STANDARD:"",PHYSICAL:""};this.type="MeshPhysicalMaterial";this.clearcoat=0;this.clearcoatMap=null;this.clearcoatRoughness=0;this.clearcoatRoughnessMap=null;this.clearcoatNormalScale=new Me(1,1);this.clearcoatNormalMap=null;this.reflectivity=.5;this.sheen=null;this.transparency=0;this.setValues(e)}function En(e){y.call(this);this.type="MeshPhongMaterial";this.color=new v(16777215);this.specular=new v(1118481);this.shininess=30;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new v(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Me(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(e)}function On(e){y.call(this);this.defines={TOON:""};this.type="MeshToonMaterial";this.color=new v(16777215);this.specular=new v(1118481);this.shininess=30;this.lightMap=this.gradientMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new v(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Me(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.alphaMap=this.specularMap=null;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(e)}function Pn(e){y.call(this);this.type="MeshNormalMaterial";this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Me(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.fog=!1;this.setValues(e)}function An(e){y.call(this);this.type="MeshLambertMaterial";this.color=new v(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new v(0);this.emissiveIntensity=1;this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(e)}function jn(e){y.call(this);this.defines={MATCAP:""};this.type="MeshMatcapMaterial";this.color=new v(16777215);this.bumpMap=this.map=this.matcap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Me(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.alphaMap=null;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(e)}function Rn(e){ir.call(this);this.type="LineDashedMaterial";this.scale=1;this.dashSize=3;this.gapSize=1;this.setValues(e)}function kn(e,t,r,n){this.parameterPositions=e;this._cachedIndex=0;this.resultBuffer=void 0!==n?n:new t.constructor(r);this.sampleValues=t;this.valueSize=r}function Ln(e,t,r,n){kn.call(this,e,t,r,n);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function Nn(e,t,r,n){kn.call(this,e,t,r,n)}function In(e,t,r,n){kn.call(this,e,t,r,n)}function Dn(e,t,r,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e;this.times=Du.convertArray(t,this.TimeBufferType);this.values=Du.convertArray(r,this.ValueBufferType);this.setInterpolation(n||this.DefaultInterpolation)}function Bn(e,t,r){Dn.call(this,e,t,r)}function Fn(e,t,r,n){Dn.call(this,e,t,r,n)}function zn(e,t,r,n){Dn.call(this,e,t,r,n)}function $n(e,t,r,n){kn.call(this,e,t,r,n)}function Gn(e,t,r,n){Dn.call(this,e,t,r,n)}function Vn(e,t,r,n){Dn.call(this,e,t,r,n)}function Hn(e,t,r,n){Dn.call(this,e,t,r,n)}function Un(e,t,r,n){this.name=e;this.tracks=r;this.duration=void 0!==t?t:-1;this.blendMode=void 0!==n?n:2500;this.uuid=Vo.generateUUID();0>this.duration&&this.resetDuration()}function qn(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return zn;case"vector":case"vector2":case"vector3":case"vector4":return Hn;case"color":return Fn;case"quaternion":return Gn;case"bool":case"boolean":return Bn;case"string":return Vn}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Wn(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=qn(e.type);if(void 0===e.times){var r=[],n=[];Du.flattenJSON(e.keys,r,n,"value");e.times=r;e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function Xn(e,t,r){var n=this,i=!1,o=0,a=0,s=void 0,u=[];this.onStart=void 0;this.onLoad=e;this.onProgress=t;this.onError=r;this.itemStart=function(e){a++;if(!1===i&&void 0!==n.onStart)n.onStart(e,o,a);i=!0};this.itemEnd=function(e){o++;if(void 0!==n.onProgress)n.onProgress(e,o,a);if(o===a&&(i=!1,void 0!==n.onLoad))n.onLoad()};this.itemError=function(e){if(void 0!==n.onError)n.onError(e)};this.resolveURL=function(e){return s?s(e):e};this.setURLModifier=function(e){s=e;return this};this.addHandler=function(e,t){u.push(e,t);return this};this.removeHandler=function(e){e=u.indexOf(e);-1!==e&&u.splice(e,2);return this};this.getHandler=function(e){for(var t=0,r=u.length;t<r;t+=2){var n=u[t],i=u[t+1];n.global&&(n.lastIndex=0);if(n.test(e))return i}return null}}function Yn(e){this.manager=void 0!==e?e:Fu;this.crossOrigin="anonymous";this.resourcePath=this.path="";this.requestHeader={}}function Kn(e){Yn.call(this,e)}function Zn(e){Yn.call(this,e)}function Jn(e){Yn.call(this,e)}function Qn(e){Yn.call(this,e)}function ei(e){Yn.call(this,e)}function ti(e){Yn.call(this,e)}function ri(e){Yn.call(this,e)}function ni(){this.type="Curve";this.arcLengthDivisions=200}function ii(e,t,r,n,i,o,a,s){ni.call(this);this.type="EllipseCurve";this.aX=e||0;this.aY=t||0;this.xRadius=r||1;this.yRadius=n||1;this.aStartAngle=i||0;this.aEndAngle=o||2*Math.PI;this.aClockwise=a||!1;this.aRotation=s||0}function oi(e,t,r,n,i,o){ii.call(this,e,t,r,r,n,i,o);this.type="ArcCurve"}function ai(){var s=0,u=0,c=0,l=0;return{initCatmullRom:function(e,t,r,n,i){e=i*(r-e);n=i*(n-t);s=t;u=e;c=-3*t+3*r-2*e-n;l=2*t-2*r+e+n},initNonuniformCatmullRom:function(e,t,r,n,i,o,a){e=((t-e)/i-(r-e)/(i+o)+(r-t)/o)*o;n=((r-t)/o-(n-t)/(o+a)+(n-r)/a)*o;s=t;u=e;c=-3*t+3*r-2*e-n;l=2*t-2*r+e+n},calc:function(e){var t=e*e;return s+u*e+c*t+l*t*e}}}function si(e,t,r,n){ni.call(this);this.type="CatmullRomCurve3";this.points=e||[];this.closed=t||!1;this.curveType=r||"centripetal";this.tension=n||.5}function ui(e,t,r,n,i){t=.5*(n-t);i=.5*(i-r);var o=e*e;return(2*r-2*n+t+i)*e*o+(-3*r+3*n-2*t-i)*o+t*e+r}function ci(e,t,r,n){var i=1-e;return i*i*t+2*(1-e)*e*r+e*e*n}function li(e,t,r,n,i){var o=1-e,a=1-e;return o*o*o*t+3*a*a*e*r+3*(1-e)*e*e*n+e*e*e*i}function hi(e,t,r,n){ni.call(this);this.type="CubicBezierCurve";this.v0=e||new Me;this.v1=t||new Me;this.v2=r||new Me;this.v3=n||new Me}function pi(e,t,r,n){ni.call(this);this.type="CubicBezierCurve3";this.v0=e||new Te;this.v1=t||new Te;this.v2=r||new Te;this.v3=n||new Te}function fi(e,t){ni.call(this);this.type="LineCurve";this.v1=e||new Me;this.v2=t||new Me}function di(e,t){ni.call(this);this.type="LineCurve3";this.v1=e||new Te;this.v2=t||new Te}function vi(e,t,r){ni.call(this);this.type="QuadraticBezierCurve";this.v0=e||new Me;this.v1=t||new Me;this.v2=r||new Me}function mi(e,t,r){ni.call(this);this.type="QuadraticBezierCurve3";this.v0=e||new Te;this.v1=t||new Te;this.v2=r||new Te}function gi(e){ni.call(this);this.type="SplineCurve";this.points=e||[]}function _i(){ni.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function yi(e){_i.call(this);this.type="Path";this.currentPoint=new Me;e&&this.setFromPoints(e)}function bi(e){yi.call(this,e);this.uuid=Vo.generateUUID();this.type="Shape";this.holes=[]}function xi(e,t){f.call(this);this.type="Light";this.color=new v(e);this.intensity=void 0!==t?t:1;this.receiveShadow=void 0}function wi(e,t,r){xi.call(this,e,r);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(f.DefaultUp);this.updateMatrix();this.groundColor=new v(t)}function Si(e){this.camera=e;this.bias=0;this.radius=1;this.mapSize=new Me(512,512);this.mapPass=this.map=null;this.matrix=new Ee;this._frustum=new Ae;this._frameExtents=new Me(1,1);this._viewportCount=1;this._viewports=[new Ce(0,0,1,1)]}function Mi(){Si.call(this,new H(50,1,.5,500))}function Ci(e,t,r,n,i,o){xi.call(this,e,t);this.type="SpotLight";this.position.copy(f.DefaultUp);this.updateMatrix();this.target=new f;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}});this.distance=void 0!==r?r:0;this.angle=void 0!==n?n:Math.PI/3;this.penumbra=void 0!==i?i:0;this.decay=void 0!==o?o:1;this.shadow=new Mi}function Ti(){Si.call(this,new H(90,1,.5,500));this._frameExtents=new Me(4,2);this._viewportCount=6;this._viewports=[new Ce(2,1,1,1),new Ce(0,1,1,1),new Ce(3,1,1,1),new Ce(1,1,1,1),new Ce(3,0,1,1),new Ce(1,0,1,1)];this._cubeDirections=[new Te(1,0,0),new Te(-1,0,0),new Te(0,0,1),new Te(0,0,-1),new Te(0,1,0),new Te(0,-1,0)];this._cubeUps=[new Te(0,1,0),new Te(0,1,0),new Te(0,1,0),new Te(0,1,0),new Te(0,0,1),new Te(0,0,-1)]}function Ei(e,t,r,n){xi.call(this,e,t);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}});this.distance=void 0!==r?r:0;this.decay=void 0!==n?n:1;this.shadow=new Ti}function Oi(e,t,r,n,i,o){V.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==e?e:-1;this.right=void 0!==t?t:1;this.top=void 0!==r?r:1;this.bottom=void 0!==n?n:-1;this.near=void 0!==i?i:.1;this.far=void 0!==o?o:2e3;this.updateProjectionMatrix()}function Pi(){Si.call(this,new Oi(-5,5,5,-5,.5,500))}function Ai(e,t){xi.call(this,e,t);this.type="DirectionalLight";this.position.copy(f.DefaultUp);this.updateMatrix();this.target=new f;this.shadow=new Pi}function ji(e,t){xi.call(this,e,t);this.type="AmbientLight";this.castShadow=void 0}function Ri(e,t,r,n){xi.call(this,e,t);this.type="RectAreaLight";this.width=void 0!==r?r:10;this.height=void 0!==n?n:10}function ki(){this.coefficients=[];for(var e=0;9>e;e++)this.coefficients.push(new Te)}function Li(e,t){xi.call(this,void 0,t);this.type="LightProbe";this.sh=void 0!==e?e:new ki}function Ni(e){Yn.call(this,e);this.textures={}}function Ii(){N.call(this);this.type="InstancedBufferGeometry";this.instanceCount=Infinity}function Di(e,t,r,n){"number"===typeof r&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));E.call(this,e,t,r);this.meshPerAttribute=n||1}function Bi(e){Yn.call(this,e)}function Fi(e){Yn.call(this,e)}function zi(e){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");Yn.call(this,e);this.options=void 0}function $i(){this.type="ShapePath";this.color=new v;this.subPaths=[];this.currentPath=null}function Gi(e){this.type="Font";this.data=e}function Vi(e){Yn.call(this,e)}function Hi(e){Yn.call(this,e)}function Ui(e,t,r){Li.call(this,void 0,r);e=(new v).set(e);r=(new v).set(t);t=new Te(e.r,e.g,e.b);e=new Te(r.r,r.g,r.b);r=Math.sqrt(Math.PI);var n=r*Math.sqrt(.75);this.sh.coefficients[0].copy(t).add(e).multiplyScalar(r);this.sh.coefficients[1].copy(t).sub(e).multiplyScalar(n)}function qi(e,t){Li.call(this,void 0,t);e=(new v).set(e);this.sh.coefficients[0].set(e.r,e.g,e.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Wi(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new H;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new H;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Xi(e){this.autoStart=void 0!==e?e:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Yi(){f.call(this);this.type="AudioListener";this.context=Ju.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new Xi}function Ki(e){f.call(this);this.type="Audio";this.listener=e;this.context=e.context;this.gain=this.context.createGain();this.gain.connect(e.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.loopEnd=this.loopStart=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this._progress=this._startedAt=0;this.filters=[]}function Zi(e){Ki.call(this,e);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function Ji(e,t){this.analyser=e.context.createAnalyser();this.analyser.fftSize=void 0!==t?t:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);e.getOutput().connect(this.analyser)}function Qi(e,t,r){this.binding=e;this.valueSize=r;switch(t){case"quaternion":e=this._slerp;t=this._slerpAdditive;var n=this._setAdditiveIdentityQuaternion;this.buffer=new Float64Array(6*r);this._workIndex=5;break;case"string":case"bool":t=e=this._select;n=this._setAdditiveIdentityOther;this.buffer=Array(5*r);break;default:e=this._lerp,t=this._lerpAdditive,n=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=e;this._mixBufferRegionAdditive=t;this._setIdentity=n;this._origIndex=3;this._addIndex=4;this.referenceCount=this.useCount=this.cumulativeWeightAdditive=this.cumulativeWeight=0}function eo(e,t,r){r=r||to.parseTrackName(t);this._targetGroup=e;this._bindings=e.subscribe_(t,r)}function to(e,t,r){this.path=t;this.parsedPath=r||to.parseTrackName(t);this.node=to.findNode(e,this.parsedPath.nodeName)||e;this.rootNode=e}function ro(){this.uuid=Vo.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function no(e,t,r,n){this._mixer=e;this._clip=t;this._localRoot=r||null;this.blendMode=n||t.blendMode;e=t.tracks;t=e.length;r=Array(t);n={endingStart:2400,endingEnd:2400};for(var i=0;i!==t;++i){var o=e[i].createInterpolant(null);r[i]=o;o.settings=n}this._interpolantSettings=n;this._interpolants=r;this._propertyBindings=Array(t);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function io(e){this._root=e;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function oo(e,t){"string"===typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=t);this.value=e}function ao(e,t,r){Xt.call(this,e,t);this.meshPerAttribute=r||1}function so(e,t,r,n){this.ray=new s(e,t);this.near=r||0;this.far=n||Infinity;this.camera=null;this.layers=new o;this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function uo(e,t){return e.distance-t.distance}function co(e,t,r,n){e.layers.test(t.layers)&&e.raycast(t,r);if(!0===n){e=e.children;n=0;for(var i=e.length;n<i;n++)co(e[n],t,r,!0)}}function lo(e,t,r){this.radius=void 0!==e?e:1;this.phi=void 0!==t?t:0;this.theta=void 0!==r?r:0;return this}function ho(e,t,r){this.radius=void 0!==e?e:1;this.theta=void 0!==t?t:0;this.y=void 0!==r?r:0;return this}function po(e,t){this.min=void 0!==e?e:new Me(Infinity,Infinity);this.max=void 0!==t?t:new Me(-Infinity,-Infinity)}function fo(e,t){this.start=void 0!==e?e:new Te;this.end=void 0!==t?t:new Te}function vo(e){f.call(this);this.material=e;this.render=function(){};this.hasUvs=this.hasColors=this.hasNormals=this.hasPositions=!1;this.uvArray=this.colorArray=this.normalArray=this.positionArray=null;this.count=0}function mo(e,t){f.call(this);this.light=e;this.light.updateMatrixWorld();this.matrix=e.matrixWorld;this.matrixAutoUpdate=!1;this.color=t;e=new N;t=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(var r=0,n=1;32>r;r++,n++){var i=r/32*Math.PI*2,o=n/32*Math.PI*2;t.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}e.setAttribute("position",new j(t,3));t=new ir({fog:!1,toneMapped:!1});this.cone=new ar(e,t);this.add(this.cone);this.update()}function go(e){var t=[];e&&e.isBone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,go(e.children[r]));return t}function _o(e){for(var t=go(e),r=new N,n=[],i=[],o=new v(0,0,1),a=new v(0,1,0),s=0;s<t.length;s++){var u=t[s];u.parent&&u.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(o.r,o.g,o.b),i.push(a.r,a.g,a.b))}r.setAttribute("position",new j(n,3));r.setAttribute("color",new j(i,3));n=new ir({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});ar.call(this,r,n);this.type="SkeletonHelper";this.root=e;this.bones=t;this.matrix=e.matrixWorld;this.matrixAutoUpdate=!1}function yo(e,t,r){this.light=e;this.light.updateMatrixWorld();this.color=r;e=new un(t,4,2);t=new x({wireframe:!0,fog:!1,toneMapped:!1});I.call(this,e,t);this.type="PointLightHelper";this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1;this.update()}function bo(e,t,r){f.call(this);this.light=e;this.light.updateMatrixWorld();this.matrix=e.matrixWorld;this.matrixAutoUpdate=!1;this.color=r;e=new Sr(t);e.rotateY(.5*Math.PI);this.material=new x({wireframe:!0,fog:!1,toneMapped:!1});void 0===this.color&&(this.material.vertexColors=!0);t=e.getAttribute("position");t=new Float32Array(3*t.count);e.setAttribute("color",new E(t,3));this.add(new I(e,this.material));this.update()}function xo(e,t,r,n){e=e||10;t=t||10;r=new v(void 0!==r?r:4473924);n=new v(void 0!==n?n:8947848);var i=t/2,o=e/t,a=e/2;e=[];for(var s=[],u=0,c=0,l=-a;u<=t;u++,l+=o){e.push(-a,0,l,a,0,l);e.push(l,0,-a,l,0,a);var h=u===i?r:n;h.toArray(s,c);c+=3;h.toArray(s,c);c+=3;h.toArray(s,c);c+=3;h.toArray(s,c);c+=3}t=new N;t.setAttribute("position",new j(e,3));t.setAttribute("color",new j(s,3));r=new ir({vertexColors:!0,toneMapped:!1});ar.call(this,t,r);this.type="GridHelper"}function wo(e,t,r,n,i,o){e=e||10;t=t||16;r=r||8;n=n||64;i=new v(void 0!==i?i:4473924);o=new v(void 0!==o?o:8947848);var a=[],s=[],u;for(u=0;u<=t;u++){var c=u/t*2*Math.PI;var l=Math.sin(c)*e;c=Math.cos(c)*e;a.push(0,0,0);a.push(l,0,c);var h=u&1?i:o;s.push(h.r,h.g,h.b);s.push(h.r,h.g,h.b)}for(u=0;u<=r;u++){h=u&1?i:o;var p=e-e/r*u;for(t=0;t<n;t++)c=t/n*2*Math.PI,l=Math.sin(c)*p,c=Math.cos(c)*p,a.push(l,0,c),s.push(h.r,h.g,h.b),c=(t+1)/n*2*Math.PI,l=Math.sin(c)*p,c=Math.cos(c)*p,a.push(l,0,c),s.push(h.r,h.g,h.b)}e=new N;e.setAttribute("position",new j(a,3));e.setAttribute("color",new j(s,3));a=new ir({vertexColors:!0,toneMapped:!1});ar.call(this,e,a);this.type="PolarGridHelper"}function So(e,t,r){f.call(this);this.light=e;this.light.updateMatrixWorld();this.matrix=e.matrixWorld;this.matrixAutoUpdate=!1;this.color=r;void 0===t&&(t=1);e=new N;e.setAttribute("position",new j([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));t=new ir({fog:!1,toneMapped:!1});this.lightPlane=new or(e,t);this.add(this.lightPlane);e=new N;e.setAttribute("position",new j([0,0,0,0,0,1],3));this.targetLine=new or(e,t);this.add(this.targetLine);this.update()}function Mo(e){function t(e,t,r){n(e,r);n(t,r)}function n(e,t){o.push(0,0,0);a.push(t.r,t.g,t.b);void 0===s[e]&&(s[e]=[]);s[e].push(o.length/3-1)}var r=new N,i=new ir({color:16777215,vertexColors:!0,toneMapped:!1}),o=[],a=[],s={},u=new v(16755200),c=new v(16711680),l=new v(43775),h=new v(16777215),p=new v(3355443);t("n1","n2",u);t("n2","n4",u);t("n4","n3",u);t("n3","n1",u);t("f1","f2",u);t("f2","f4",u);t("f4","f3",u);t("f3","f1",u);t("n1","f1",u);t("n2","f2",u);t("n3","f3",u);t("n4","f4",u);t("p","n1",c);t("p","n2",c);t("p","n3",c);t("p","n4",c);t("u1","u2",l);t("u2","u3",l);t("u3","u1",l);t("c","t",h);t("p","c",p);t("cn1","cn2",p);t("cn3","cn4",p);t("cf1","cf2",p);t("cf3","cf4",p);r.setAttribute("position",new j(o,3));r.setAttribute("color",new j(a,3));ar.call(this,r,i);this.type="CameraHelper";this.camera=e;this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix();this.matrix=e.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=s;this.update()}function Co(e,t,r,n,i,o,a){Ac.set(i,o,a).unproject(n);e=t[e];if(void 0!==e)for(r=r.getAttribute("position"),t=0,n=e.length;t<n;t++)r.setXYZ(e[t],Ac.x,Ac.y,Ac.z)}function To(e,t){this.object=e;void 0===t&&(t=16776960);e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);var r=new Float32Array(24),n=new N;n.setIndex(new E(e,1));n.setAttribute("position",new E(r,3));ar.call(this,n,new ir({color:t,toneMapped:!1}));this.type="BoxHelper";this.matrixAutoUpdate=!1;this.update()}function Eo(e,t){this.type="Box3Helper";this.box=e;t=t||16776960;e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);var r=new N;r.setIndex(new E(e,1));r.setAttribute("position",new j([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3));ar.call(this,r,new ir({color:t,toneMapped:!1}));this.type="Box3Helper";this.geometry.computeBoundingSphere()}function Oo(e,t,r){this.plane=e;this.size=void 0===t?1:t;e=void 0!==r?r:16776960;t=new N;t.setAttribute("position",new j([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3));t.computeBoundingSphere();or.call(this,t,new ir({color:e,toneMapped:!1}));this.type="PlaneHelper";t=new N;t.setAttribute("position",new j([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3));t.computeBoundingSphere();this.add(new I(t,new x({color:e,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}function Po(e,t,r,n,i,o){f.call(this);this.type="ArrowHelper";void 0===e&&(e=new Te(0,0,1));void 0===t&&(t=new Te(0,0,0));void 0===r&&(r=1);void 0===n&&(n=16776960);void 0===i&&(i=.2*r);void 0===o&&(o=.2*i);void 0===Lc&&(Lc=new N,Lc.setAttribute("position",new j([0,0,0,0,1,0],3)),Nc=new _n(0,.5,1,5,1),Nc.translate(0,-.5,0));this.position.copy(t);this.line=new or(Lc,new ir({color:n,toneMapped:!1}));this.line.matrixAutoUpdate=!1;this.add(this.line);this.cone=new I(Nc,new x({color:n,toneMapped:!1}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(e);this.setLength(r,i,o)}function Ao(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e];e=new N;e.setAttribute("position",new j(t,3));e.setAttribute("color",new j([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));t=new ir({vertexColors:!0,toneMapped:!1});ar.call(this,e,t);this.type="AxesHelper"}function jo(e){this._renderer=e;this._pingPongRenderTarget=null;e=new Float32Array(20);var t=new Te(0,1,0);e=new Mn({defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t},inputEncoding:{value:Fc[3e3]},outputEncoding:{value:Fc[3e3]}},vertexShader:Io(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n"+Do()+"\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});e.type="SphericalGaussianBlur";this._blurMaterial=e;this._cubemapShader=this._equirectShader=null;this._compileMaterial(this._blurMaterial)}function Ro(e){e=new T(3*Ic,3*Ic,e);e.texture.mapping=306;e.texture.name="PMREM.cubeUv";e.scissorTest=!0;return e}function ko(e,t,r,n,i){e.viewport.set(t,r,n,i);e.scissor.set(t,r,n,i)}function Lo(){var e=new Me(1,1);e=new Mn({uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:Fc[3e3]},outputEncoding:{value:Fc[3e3]}},vertexShader:Io(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n"+Do()+"\n\n#include <common>\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv = equirectUv( outputDirection );\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});e.type="EquirectangularToCubeUV";return e}function No(){var e=new Mn({uniforms:{envMap:{value:null},inputEncoding:{value:Fc[3e3]},outputEncoding:{value:Fc[3e3]}},vertexShader:Io(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n"+Do()+"\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});e.type="CubemapToCubeUV";return e}function Io(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\t} else if (face == 2.0) {\n\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\t} else if (face == 5.0) {\n\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\t}\n\treturn direction;\n}\n\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function Do(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}function Bo(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");si.call(this,e);this.type="catmullrom";this.closed=!0}function Fo(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");si.call(this,e);this.type="catmullrom"}function zo(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.");si.call(this,e);this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e});void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:0<e?1:+e});!1==="name"in Function.prototype&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});void 0===Object.assign&&(Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(void 0!==n&&null!==n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t});Object.assign(t.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]);-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)},removeEventListener:function(e,t){void 0!==this._listeners&&(e=this._listeners[e],void 0!==e&&(t=e.indexOf(t),-1!==t&&e.splice(t,1)))},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;t=t.slice(0);for(var r=0,n=t.length;r<n;r++)t[r].call(this,e)}}}});for(var $o=[],Go=0;256>Go;Go++)$o[Go]=(16>Go?"0":"")+Go.toString(16);var Vo={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return($o[e&255]+$o[e>>8&255]+$o[e>>16&255]+$o[e>>24&255]+"-"+$o[t&255]+$o[t>>8&255]+"-"+$o[t>>16&15|64]+$o[t>>24&255]+"-"+$o[r&63|128]+$o[r>>8&255]+"-"+$o[r>>16&255]+$o[r>>24&255]+$o[n&255]+$o[n>>8&255]+$o[n>>16&255]+$o[n>>24&255]).toUpperCase()},clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},lerp:function(e,t,r){return(1-r)*e+r*t},smoothstep:function(e,t,r){if(e<=t)return 0;if(e>=r)return 1;e=(e-t)/(r-t);return e*e*(3-2*e)},smootherstep:function(e,t,r){if(e<=t)return 0;if(e>=r)return 1;e=(e-t)/(r-t);return e*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Vo.DEG2RAD},radToDeg:function(e){return e*Vo.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,r,n,i){var o=Math.cos,a=Math.sin,s=o(r/2);r=a(r/2);var u=o((t+n)/2),c=a((t+n)/2),l=o((t-n)/2),h=a((t-n)/2);o=o((n-t)/2);t=a((n-t)/2);switch(i){case"XYX":e.set(s*c,r*l,r*h,s*u);break;case"YZY":e.set(r*h,s*c,r*l,s*u);break;case"ZXZ":e.set(r*l,r*h,s*c,s*u);break;case"XZX":e.set(s*c,r*t,r*o,s*u);break;case"YXY":e.set(r*o,s*c,r*t,s*u);break;case"ZYZ":e.set(r*t,r*o,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};Object.defineProperties(Me.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}});Object.assign(Me.prototype,{isVector2:!0,set:function(e,t){this.x=e;this.y=t;return this},setScalar:function(e){this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){this.x=e.x;this.y=e.y;return this},add:function(e,t){if(void 0!==t)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t);this.x+=e.x;this.y+=e.y;return this},addScalar:function(e){this.x+=e;this.y+=e;return this},addVectors:function(e,t){this.x=e.x+t.x;this.y=e.y+t.y;return this},addScaledVector:function(e,t){this.x+=e.x*t;this.y+=e.y*t;return this},sub:function(e,t){if(void 0!==t)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t);this.x-=e.x;this.y-=e.y;return this},subScalar:function(e){this.x-=e;this.y-=e;return this},subVectors:function(e,t){this.x=e.x-t.x;this.y=e.y-t.y;return this},multiply:function(e){this.x*=e.x;this.y*=e.y;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;return this},divide:function(e){this.x/=e.x;this.y/=e.y;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,r=this.y;e=e.elements;this.x=e[0]*t+e[3]*r+e[6];this.y=e[1]*t+e[4]*r+e[7];return this},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);return this},max:function(e){this.x=Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);return this},clamp:function(e,t){this.x=Math.max(e.x,Math.min(t.x,this.x));this.y=Math.max(e.y,Math.min(t.y,this.y));return this},clampScalar:function(e,t){this.x=Math.max(e,Math.min(t,this.x));this.y=Math.max(e,Math.min(t,this.y));return this},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;e=this.y-e.y;return t*t+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){this.x+=(e.x-this.x)*t;this.y+=(e.y-this.y)*t;return this},lerpVectors:function(e,t,r){this.x=e.x+(t.x-e.x)*r;this.y=e.y+(t.y-e.y)*r;return this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){void 0===t&&(t=0);this.x=e[t];this.y=e[t+1];return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);e[t]=this.x;e[t+1]=this.y;return e},fromBufferAttribute:function(e,t,r){void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=e.getX(t);this.y=e.getY(t);return this},rotateAround:function(e,t){var r=Math.cos(t);t=Math.sin(t);var n=this.x-e.x,i=this.y-e.y;this.x=n*r-i*t+e.x;this.y=n*t+i*r+e.y;return this},random:function(){this.x=Math.random();this.y=Math.random();return this}});Object.assign(m.prototype,{isMatrix3:!0,set:function(e,t,r,n,i,o,a,s,u){var c=this.elements;c[0]=e;c[1]=n;c[2]=a;c[3]=t;c[4]=i;c[5]=s;c[6]=r;c[7]=o;c[8]=u;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements;e=e.elements;t[0]=e[0];t[1]=e[1];t[2]=e[2];t[3]=e[3];t[4]=e[4];t[5]=e[5];t[6]=e[6];t[7]=e[7];t[8]=e[8];return this},extractBasis:function(e,t,r){e.setFromMatrix3Column(this,0);t.setFromMatrix3Column(this,1);r.setFromMatrix3Column(this,2);return this},setFromMatrix4:function(e){e=e.elements;this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]);return this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements;t=this.elements;e=r[0];var i=r[3],o=r[6],a=r[1],s=r[4],u=r[7],c=r[2],l=r[5];r=r[8];var h=n[0],p=n[3],f=n[6],d=n[1],v=n[4],m=n[7],g=n[2],_=n[5];n=n[8];t[0]=e*h+i*d+o*g;t[3]=e*p+i*v+o*_;t[6]=e*f+i*m+o*n;t[1]=a*h+s*d+u*g;t[4]=a*p+s*v+u*_;t[7]=a*f+s*m+u*n;t[2]=c*h+l*d+r*g;t[5]=c*p+l*v+r*_;t[8]=c*f+l*m+r*n;return this},multiplyScalar:function(e){var t=this.elements;t[0]*=e;t[3]*=e;t[6]*=e;t[1]*=e;t[4]*=e;t[7]*=e;t[2]*=e;t[5]*=e;t[8]*=e;return this},determinant:function(){var e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],u=e[7];e=e[8];return t*o*e-t*a*u-r*i*e+r*a*s+n*i*u-n*o*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var r=e.elements;e=this.elements;t=r[0];var n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7];r=r[8];var l=r*a-s*c,h=s*u-r*o,p=c*o-a*u,f=t*l+n*h+i*p;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);f=1/f;e[0]=l*f;e[1]=(i*c-r*n)*f;e[2]=(s*n-i*a)*f;e[3]=h*f;e[4]=(r*t-i*u)*f;e[5]=(i*o-s*t)*f;e[6]=p*f;e[7]=(n*u-c*t)*f;e[8]=(a*t-n*o)*f;return this},transpose:function(){var e=this.elements;var t=e[1];e[1]=e[3];e[3]=t;t=e[2];e[2]=e[6];e[6]=t;t=e[5];e[5]=e[7];e[7]=t;return this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;e[0]=t[0];e[1]=t[3];e[2]=t[6];e[3]=t[1];e[4]=t[4];e[5]=t[7];e[6]=t[2];e[7]=t[5];e[8]=t[8];return this},setUvTransform:function(e,t,r,n,i,o,a){var s=Math.cos(i);i=Math.sin(i);this.set(r*s,r*i,-r*(s*o+i*a)+o+e,-n*i,n*s,-n*(-i*o+s*a)+a+t,0,0,1)},scale:function(e,t){var r=this.elements;r[0]*=e;r[3]*=e;r[6]*=e;r[1]*=t;r[4]*=t;r[7]*=t;return this},rotate:function(e){var t=Math.cos(e);e=Math.sin(e);var r=this.elements,n=r[0],i=r[3],o=r[6],a=r[1],s=r[4],u=r[7];r[0]=t*n+e*a;r[3]=t*i+e*s;r[6]=t*o+e*u;r[1]=-e*n+t*a;r[4]=-e*i+t*s;r[7]=-e*o+t*u;return this},translate:function(e,t){var r=this.elements;r[0]+=e*r[2];r[3]+=e*r[5];r[6]+=e*r[8];r[1]+=t*r[2];r[4]+=t*r[5];r[7]+=t*r[8];return this},equals:function(e){var t=this.elements;e=e.elements;for(var r=0;9>r;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;9>r;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);var r=this.elements;e[t]=r[0];e[t+1]=r[1];e[t+2]=r[2];e[t+3]=r[3];e[t+4]=r[4];e[t+5]=r[5];e[t+6]=r[6];e[t+7]=r[7];e[t+8]=r[8];return e}});var Ho,Uo={getDataURL:function(e){if("undefined"==typeof HTMLCanvasElement)return e.src;if(!(e instanceof HTMLCanvasElement)){void 0===Ho&&(Ho=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"));Ho.width=e.width;Ho.height=e.height;var t=Ho.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height);e=Ho}return 2048<e.width||2048<e.height?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},qo=0;p.DEFAULT_IMAGE=void 0;p.DEFAULT_MAPPING=300;p.prototype=Object.assign(Object.create(t.prototype),{constructor:p,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name;this.image=e.image;this.mipmaps=e.mipmaps.slice(0);this.mapping=e.mapping;this.wrapS=e.wrapS;this.wrapT=e.wrapT;this.magFilter=e.magFilter;this.minFilter=e.minFilter;this.anisotropy=e.anisotropy;this.format=e.format;this.internalFormat=e.internalFormat;this.type=e.type;this.offset.copy(e.offset);this.repeat.copy(e.repeat);this.center.copy(e.center);this.rotation=e.rotation;this.matrixAutoUpdate=e.matrixAutoUpdate;this.matrix.copy(e.matrix);this.generateMipmaps=e.generateMipmaps;this.premultiplyAlpha=e.premultiplyAlpha;this.flipY=e.flipY;this.unpackAlignment=e.unpackAlignment;this.encoding=e.encoding;return this},toJSON:function(e){var t=void 0===e||"string"===typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Vo.generateUUID());if(!t&&void 0===e.images[n.uuid]){if(Array.isArray(n)){var i=[];for(var o=0,a=n.length;o<a;o++)i.push(Uo.getDataURL(n[o]))}else i=Uo.getDataURL(n);e.images[n.uuid]={uuid:n.uuid,url:i}}r.image=n.uuid}t||(e.textures[this.uuid]=r);return r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;e.applyMatrix3(this.matrix);if(0>e.x||1<e.x)switch(this.wrapS){case 1e3:e.x-=Math.floor(e.x);break;case 1001:e.x=0>e.x?0:1;break;case 1002:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(0>e.y||1<e.y)switch(this.wrapT){case 1e3:e.y-=Math.floor(e.y);break;case 1001:e.y=0>e.y?0:1;break;case 1002:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y);return e}});Object.defineProperty(p.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});Object.defineProperties(Ce.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}});Object.assign(Ce.prototype,{isVector4:!0,set:function(e,t,r,n){this.x=e;this.y=t;this.z=r;this.w=n;return this},setScalar:function(e){this.w=this.z=this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setW:function(e){this.w=e;return this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;this.w=void 0!==e.w?e.w:1;return this},add:function(e,t){if(void 0!==t)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t);this.x+=e.x;this.y+=e.y;this.z+=e.z;this.w+=e.w;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;this.w+=e;return this},addVectors:function(e,t){this.x=e.x+t.x;this.y=e.y+t.y;this.z=e.z+t.z;this.w=e.w+t.w;return this},addScaledVector:function(e,t){this.x+=e.x*t;this.y+=e.y*t;this.z+=e.z*t;this.w+=e.w*t;return this},sub:function(e,t){if(void 0!==t)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t);this.x-=e.x;this.y-=e.y;this.z-=e.z;this.w-=e.w;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;this.w-=e;return this},subVectors:function(e,t){this.x=e.x-t.x;this.y=e.y-t.y;this.z=e.z-t.z;this.w=e.w-t.w;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;this.w*=e;return this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=this.w;e=e.elements;this.x=e[0]*t+e[4]*r+e[8]*n+e[12]*i;this.y=e[1]*t+e[5]*r+e[9]*n+e[13]*i;this.z=e[2]*t+e[6]*r+e[10]*n+e[14]*i;this.w=e[3]*t+e[7]*r+e[11]*n+e[15]*i;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);1e-4>t?(this.x=1,this.z=this.y=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t);return this},setAxisAngleFromRotationMatrix:function(e){e=e.elements;var t=e[0];var r=e[4];var n=e[8],i=e[1],o=e[5],a=e[9];var s=e[2];var u=e[6];var c=e[10];if(.01>Math.abs(r-i)&&.01>Math.abs(n-s)&&.01>Math.abs(a-u)){if(.1>Math.abs(r+i)&&.1>Math.abs(n+s)&&.1>Math.abs(a+u)&&.1>Math.abs(t+o+c-3))return this.set(1,0,0,0),this;e=Math.PI;t=(t+1)/2;o=(o+1)/2;c=(c+1)/2;r=(r+i)/4;n=(n+s)/4;a=(a+u)/4;t>o&&t>c?.01>t?(u=0,r=s=.707106781):(u=Math.sqrt(t),s=r/u,r=n/u):o>c?.01>o?(u=.707106781,s=0,r=.707106781):(s=Math.sqrt(o),u=r/s,r=a/s):.01>c?(s=u=.707106781,r=0):(r=Math.sqrt(c),u=n/r,s=a/r);this.set(u,s,r,e);return this}e=Math.sqrt((u-a)*(u-a)+(n-s)*(n-s)+(i-r)*(i-r));.001>Math.abs(e)&&(e=1);this.x=(u-a)/e;this.y=(n-s)/e;this.z=(i-r)/e;this.w=Math.acos((t+o+c-1)/2);return this},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);this.z=Math.min(this.z,e.z);this.w=Math.min(this.w,e.w);return this},max:function(e){this.x=Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);this.z=Math.max(this.z,e.z);this.w=Math.max(this.w,e.w);return this},clamp:function(e,t){this.x=Math.max(e.x,Math.min(t.x,this.x));this.y=Math.max(e.y,Math.min(t.y,this.y));this.z=Math.max(e.z,Math.min(t.z,this.z));this.w=Math.max(e.w,Math.min(t.w,this.w));return this},clampScalar:function(e,t){this.x=Math.max(e,Math.min(t,this.x));this.y=Math.max(e,Math.min(t,this.y));this.z=Math.max(e,Math.min(t,this.z));this.w=Math.max(e,Math.min(t,this.w));return this},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){this.x+=(e.x-this.x)*t;this.y+=(e.y-this.y)*t;this.z+=(e.z-this.z)*t;this.w+=(e.w-this.w)*t;return this},lerpVectors:function(e,t,r){this.x=e.x+(t.x-e.x)*r;this.y=e.y+(t.y-e.y)*r;this.z=e.z+(t.z-e.z)*r;this.w=e.w+(t.w-e.w)*r;return this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){void 0===t&&(t=0);this.x=e[t];this.y=e[t+1];this.z=e[t+2];this.w=e[t+3];return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);e[t]=this.x;e[t+1]=this.y;e[t+2]=this.z;e[t+3]=this.w;return e},fromBufferAttribute:function(e,t,r){void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");this.x=e.getX(t);this.y=e.getY(t);this.z=e.getZ(t);this.w=e.getW(t);return this},random:function(){this.x=Math.random();this.y=Math.random();this.z=Math.random();this.w=Math.random();return this}});T.prototype=Object.assign(Object.create(t.prototype),{constructor:T,isWebGLRenderTarget:!0,setSize:function(e,t){if(this.width!==e||this.height!==t)this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose();this.viewport.set(0,0,e,t);this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.width=e.width;this.height=e.height;this.viewport.copy(e.viewport);this.texture=e.texture.clone();this.depthBuffer=e.depthBuffer;this.stencilBuffer=e.stencilBuffer;this.depthTexture=e.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});r.prototype=Object.assign(Object.create(T.prototype),{constructor:r,isWebGLMultisampleRenderTarget:!0,copy:function(e){T.prototype.copy.call(this,e);this.samples=e.samples;return this}});Object.assign(d,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,r,n,i,o,a){var s=r[n+0],u=r[n+1],c=r[n+2];r=r[n+3];n=i[o+0];var l=i[o+1],h=i[o+2];i=i[o+3];if(r!==i||s!==n||u!==l||c!==h){o=1-a;var p=s*n+u*l+c*h+r*i,f=0<=p?1:-1,d=1-p*p;d>Number.EPSILON&&(d=Math.sqrt(d),p=Math.atan2(d,p*f),o=Math.sin(o*p)/d,a=Math.sin(a*p)/d);f*=a;s=s*o+n*f;u=u*o+l*f;c=c*o+h*f;r=r*o+i*f;o===1-a&&(a=1/Math.sqrt(s*s+u*u+c*c+r*r),s*=a,u*=a,c*=a,r*=a)}e[t]=s;e[t+1]=u;e[t+2]=c;e[t+3]=r},multiplyQuaternionsFlat:function(e,t,r,n,i,o){var a=r[n],s=r[n+1],u=r[n+2];r=r[n+3];n=i[o];var c=i[o+1],l=i[o+2];i=i[o+3];e[t]=a*i+r*n+s*l-u*c;e[t+1]=s*i+r*c+u*n-a*l;e[t+2]=u*i+r*l+a*c-s*n;e[t+3]=r*i-a*n-s*c-u*l;return e}});Object.defineProperties(d.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e;this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e;this._onChangeCallback()}}});Object.assign(d.prototype,{isQuaternion:!0,set:function(e,t,r,n){this._x=e;this._y=t;this._z=r;this._w=n;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){this._x=e.x;this._y=e.y;this._z=e.z;this._w=e.w;this._onChangeCallback();return this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=e._x,n=e._y,i=e._z;e=e.order;var o=Math.cos,a=Math.sin,s=o(r/2),u=o(n/2);o=o(i/2);r=a(r/2);n=a(n/2);i=a(i/2);switch(e){case"XYZ":this._x=r*u*o+s*n*i;this._y=s*n*o-r*u*i;this._z=s*u*i+r*n*o;this._w=s*u*o-r*n*i;break;case"YXZ":this._x=r*u*o+s*n*i;this._y=s*n*o-r*u*i;this._z=s*u*i-r*n*o;this._w=s*u*o+r*n*i;break;case"ZXY":this._x=r*u*o-s*n*i;this._y=s*n*o+r*u*i;this._z=s*u*i+r*n*o;this._w=s*u*o-r*n*i;break;case"ZYX":this._x=r*u*o-s*n*i;this._y=s*n*o+r*u*i;this._z=s*u*i-r*n*o;this._w=s*u*o+r*n*i;break;case"YZX":this._x=r*u*o+s*n*i;this._y=s*n*o+r*u*i;this._z=s*u*i-r*n*o;this._w=s*u*o-r*n*i;break;case"XZY":this._x=r*u*o-s*n*i;this._y=s*n*o-r*u*i;this._z=s*u*i+r*n*o;this._w=s*u*o+r*n*i;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+e)}!1!==t&&this._onChangeCallback();return this},setFromAxisAngle:function(e,t){t/=2;var r=Math.sin(t);this._x=e.x*r;this._y=e.y*r;this._z=e.z*r;this._w=Math.cos(t);this._onChangeCallback();return this},setFromRotationMatrix:function(e){var t=e.elements,r=t[0];e=t[4];var n=t[8],i=t[1],o=t[5],a=t[9],s=t[2],u=t[6];t=t[10];var c=r+o+t;0<c?(r=.5/Math.sqrt(c+1),this._w=.25/r,this._x=(u-a)*r,this._y=(n-s)*r,this._z=(i-e)*r):r>o&&r>t?(r=2*Math.sqrt(1+r-o-t),this._w=(u-a)/r,this._x=.25*r,this._y=(e+i)/r,this._z=(n+s)/r):o>t?(r=2*Math.sqrt(1+o-r-t),this._w=(n-s)/r,this._x=(e+i)/r,this._y=.25*r,this._z=(a+u)/r):(r=2*Math.sqrt(1+t-r-o),this._w=(i-e)/r,this._x=(n+s)/r,this._y=(a+u)/r,this._z=.25*r);this._onChangeCallback();return this},setFromUnitVectors:function(e,t){var r=e.dot(t)+1;1e-6>r?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x);this._w=r;return this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Vo.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var r=this.angleTo(e);if(0===r)return this;this.slerp(e,Math.min(1,t/r));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e);this._onChangeCallback();return this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z;e=e._w;var o=t._x,a=t._y,s=t._z;t=t._w;this._x=r*t+e*o+n*s-i*a;this._y=n*t+e*a+i*o-r*s;this._z=i*t+e*s+r*a-n*o;this._w=e*t-r*o-n*a-i*s;this._onChangeCallback();return this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,i=this._z,o=this._w,a=o*e._w+r*e._x+n*e._y+i*e._z;0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e);if(1<=a)return this._w=o,this._x=r,this._y=n,this._z=i,this;e=1-a*a;if(e<=Number.EPSILON)return a=1-t,this._w=a*o+t*this._w,this._x=a*r+t*this._x,this._y=a*n+t*this._y,this._z=a*i+t*this._z,this.normalize(),this._onChangeCallback(),this;e=Math.sqrt(e);var s=Math.atan2(e,a);a=Math.sin((1-t)*s)/e;t=Math.sin(t*s)/e;this._w=o*a+this._w*t;this._x=r*a+this._x*t;this._y=n*a+this._y*t;this._z=i*a+this._z*t;this._onChangeCallback();return this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){void 0===t&&(t=0);this._x=e[t];this._y=e[t+1];this._z=e[t+2];this._w=e[t+3];this._onChangeCallback();return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);e[t]=this._x;e[t+1]=this._y;e[t+2]=this._z;e[t+3]=this._w;return e},fromBufferAttribute:function(e,t){this._x=e.getX(t);this._y=e.getY(t);this._z=e.getZ(t);this._w=e.getW(t);return this},_onChange:function(e){this._onChangeCallback=e;return this},_onChangeCallback:function(){}});var Wo=new Te,Xo=new d;Object.assign(Te.prototype,{isVector3:!0,set:function(e,t,r){this.x=e;this.y=t;this.z=r;return this},setScalar:function(e){this.z=this.y=this.x=e;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;return this},add:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t);this.x+=e.x;this.y+=e.y;this.z+=e.z;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;return this},addVectors:function(e,t){this.x=e.x+t.x;this.y=e.y+t.y;this.z=e.z+t.z;return this},addScaledVector:function(e,t){this.x+=e.x*t;this.y+=e.y*t;this.z+=e.z*t;return this},sub:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t);this.x-=e.x;this.y-=e.y;this.z-=e.z;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;return this},subVectors:function(e,t){this.x=e.x-t.x;this.y=e.y-t.y;this.z=e.z-t.z;return this},multiply:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t);this.x*=e.x;this.y*=e.y;this.z*=e.z;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;return this},multiplyVectors:function(e,t){this.x=e.x*t.x;this.y=e.y*t.y;this.z=e.z*t.z;return this},applyEuler:function(e){e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(Xo.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Xo.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z;e=e.elements;this.x=e[0]*t+e[3]*r+e[6]*n;this.y=e[1]*t+e[4]*r+e[7]*n;this.z=e[2]*t+e[5]*r+e[8]*n;return this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z;e=e.elements;var i=1/(e[3]*t+e[7]*r+e[11]*n+e[15]);this.x=(e[0]*t+e[4]*r+e[8]*n+e[12])*i;this.y=(e[1]*t+e[5]*r+e[9]*n+e[13])*i;this.z=(e[2]*t+e[6]*r+e[10]*n+e[14])*i;return this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,o=e.y,a=e.z;e=e.w;var s=e*t+o*n-a*r,u=e*r+a*t-i*n,c=e*n+i*r-o*t;t=-i*t-o*r-a*n;this.x=s*e+t*-i+u*-a-c*-o;this.y=u*e+t*-o+c*-i-s*-a;this.z=c*e+t*-a+s*-o-u*-i;return this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,r=this.y,n=this.z;e=e.elements;this.x=e[0]*t+e[4]*r+e[8]*n;this.y=e[1]*t+e[5]*r+e[9]*n;this.z=e[2]*t+e[6]*r+e[10]*n;return this.normalize()},divide:function(e){this.x/=e.x;this.y/=e.y;this.z/=e.z;return this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){this.x=Math.min(this.x,e.x);this.y=Math.min(this.y,e.y);this.z=Math.min(this.z,e.z);return this},max:function(e){this.x=Math.max(this.x,e.x);this.y=Math.max(this.y,e.y);this.z=Math.max(this.z,e.z);return this},clamp:function(e,t){this.x=Math.max(e.x,Math.min(t.x,this.x));this.y=Math.max(e.y,Math.min(t.y,this.y));this.z=Math.max(e.z,Math.min(t.z,this.z));return this},clampScalar:function(e,t){this.x=Math.max(e,Math.min(t,this.x));this.y=Math.max(e,Math.min(t,this.y));this.z=Math.max(e,Math.min(t,this.z));return this},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){this.x+=(e.x-this.x)*t;this.y+=(e.y-this.y)*t;this.z+=(e.z-this.z)*t;return this},lerpVectors:function(e,t,r){this.x=e.x+(t.x-e.x)*r;this.y=e.y+(t.y-e.y)*r;this.z=e.z+(t.z-e.z)*r;return this},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var r=e.x,n=e.y;e=e.z;var i=t.x,o=t.y;t=t.z;this.x=n*t-e*o;this.y=e*i-r*t;this.z=r*o-n*i;return this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);t=e.dot(this)/t;return this.copy(e).multiplyScalar(t)},projectOnPlane:function(e){Wo.copy(this).projectOnVector(e);return this.sub(Wo)},reflect:function(e){return this.sub(Wo.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;e=this.dot(e)/t;return Math.acos(Vo.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;e=this.z-e.z;return t*t+r*r+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,r){var n=Math.sin(t)*e;this.x=n*Math.sin(r);this.y=Math.cos(t)*e;this.z=n*Math.cos(r);return this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,r){this.x=e*Math.sin(t);this.y=r;this.z=e*Math.cos(t);return this},setFromMatrixPosition:function(e){e=e.elements;this.x=e[12];this.y=e[13];this.z=e[14];return this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length();e=this.setFromMatrixColumn(e,2).length();this.x=t;this.y=r;this.z=e;return this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){void 0===t&&(t=0);this.x=e[t];this.y=e[t+1];this.z=e[t+2];return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);e[t]=this.x;e[t+1]=this.y;e[t+2]=this.z;return e},fromBufferAttribute:function(e,t,r){void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=e.getX(t);this.y=e.getY(t);this.z=e.getZ(t);return this},random:function(){this.x=Math.random();this.y=Math.random();this.z=Math.random();return this}});var Yo=new Te,Ko=new Ee,Zo=new Te(0,0,0),Jo=new Te(1,1,1),Qo=new Te,ea=new Te,ta=new Te;Object.assign(Ee.prototype,{isMatrix4:!0,set:function(e,t,r,n,i,o,a,s,u,c,l,h,p,f,d,v){var m=this.elements;m[0]=e;m[4]=t;m[8]=r;m[12]=n;m[1]=i;m[5]=o;m[9]=a;m[13]=s;m[2]=u;m[6]=c;m[10]=l;m[14]=h;m[3]=p;m[7]=f;m[11]=d;m[15]=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new Ee).fromArray(this.elements)},copy:function(e){var t=this.elements;e=e.elements;t[0]=e[0];t[1]=e[1];t[2]=e[2];t[3]=e[3];t[4]=e[4];t[5]=e[5];t[6]=e[6];t[7]=e[7];t[8]=e[8];t[9]=e[9];t[10]=e[10];t[11]=e[11];t[12]=e[12];t[13]=e[13];t[14]=e[14];t[15]=e[15];return this},copyPosition:function(e){var t=this.elements;e=e.elements;t[12]=e[12];t[13]=e[13];t[14]=e[14];return this},extractBasis:function(e,t,r){e.setFromMatrixColumn(this,0);t.setFromMatrixColumn(this,1);r.setFromMatrixColumn(this,2);return this},makeBasis:function(e,t,r){this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1);return this},extractRotation:function(e){var t=this.elements,r=e.elements,n=1/Yo.setFromMatrixColumn(e,0).length(),i=1/Yo.setFromMatrixColumn(e,1).length();e=1/Yo.setFromMatrixColumn(e,2).length();t[0]=r[0]*n;t[1]=r[1]*n;t[2]=r[2]*n;t[3]=0;t[4]=r[4]*i;t[5]=r[5]*i;t[6]=r[6]*i;t[7]=0;t[8]=r[8]*e;t[9]=r[9]*e;t[10]=r[10]*e;t[11]=0;t[12]=0;t[13]=0;t[14]=0;t[15]=1;return this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,n=e.y,i=e.z,o=Math.cos(r);r=Math.sin(r);var a=Math.cos(n);n=Math.sin(n);var s=Math.cos(i);i=Math.sin(i);if("XYZ"===e.order){e=o*s;var u=o*i,c=r*s,l=r*i;t[0]=a*s;t[4]=-a*i;t[8]=n;t[1]=u+c*n;t[5]=e-l*n;t[9]=-r*a;t[2]=l-e*n;t[6]=c+u*n;t[10]=o*a}else"YXZ"===e.order?(e=a*s,u=a*i,c=n*s,l=n*i,t[0]=e+l*r,t[4]=c*r-u,t[8]=o*n,t[1]=o*i,t[5]=o*s,t[9]=-r,t[2]=u*r-c,t[6]=l+e*r,t[10]=o*a):"ZXY"===e.order?(e=a*s,u=a*i,c=n*s,l=n*i,t[0]=e-l*r,t[4]=-o*i,t[8]=c+u*r,t[1]=u+c*r,t[5]=o*s,t[9]=l-e*r,t[2]=-o*n,t[6]=r,t[10]=o*a):"ZYX"===e.order?(e=o*s,u=o*i,c=r*s,l=r*i,t[0]=a*s,t[4]=c*n-u,t[8]=e*n+l,t[1]=a*i,t[5]=l*n+e,t[9]=u*n-c,t[2]=-n,t[6]=r*a,t[10]=o*a):"YZX"===e.order?(e=o*a,u=o*n,c=r*a,l=r*n,t[0]=a*s,t[4]=l-e*i,t[8]=c*i+u,t[1]=i,t[5]=o*s,t[9]=-r*s,t[2]=-n*s,t[6]=u*i+c,t[10]=e-l*i):"XZY"===e.order&&(e=o*a,u=o*n,c=r*a,l=r*n,t[0]=a*s,t[4]=-i,t[8]=n*s,t[1]=e*i+l,t[5]=o*s,t[9]=u*i-c,t[2]=c*i-u,t[6]=r*s,t[10]=l*i+e);t[3]=0;t[7]=0;t[11]=0;t[12]=0;t[13]=0;t[14]=0;t[15]=1;return this},makeRotationFromQuaternion:function(e){return this.compose(Zo,e,Jo)},lookAt:function(e,t,r){var n=this.elements;ta.subVectors(e,t);0===ta.lengthSq()&&(ta.z=1);ta.normalize();Qo.crossVectors(r,ta);0===Qo.lengthSq()&&(1===Math.abs(r.z)?ta.x+=1e-4:ta.z+=1e-4,ta.normalize(),Qo.crossVectors(r,ta));Qo.normalize();ea.crossVectors(ta,Qo);n[0]=Qo.x;n[4]=ea.x;n[8]=ta.x;n[1]=Qo.y;n[5]=ea.y;n[9]=ta.y;n[2]=Qo.z;n[6]=ea.z;n[10]=ta.z;return this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements;t=this.elements;e=r[0];var i=r[4],o=r[8],a=r[12],s=r[1],u=r[5],c=r[9],l=r[13],h=r[2],p=r[6],f=r[10],d=r[14],v=r[3],m=r[7],g=r[11];r=r[15];var _=n[0],y=n[4],b=n[8],x=n[12],w=n[1],S=n[5],M=n[9],C=n[13],T=n[2],E=n[6],O=n[10],P=n[14],A=n[3],j=n[7],R=n[11];n=n[15];t[0]=e*_+i*w+o*T+a*A;t[4]=e*y+i*S+o*E+a*j;t[8]=e*b+i*M+o*O+a*R;t[12]=e*x+i*C+o*P+a*n;t[1]=s*_+u*w+c*T+l*A;t[5]=s*y+u*S+c*E+l*j;t[9]=s*b+u*M+c*O+l*R;t[13]=s*x+u*C+c*P+l*n;t[2]=h*_+p*w+f*T+d*A;t[6]=h*y+p*S+f*E+d*j;t[10]=h*b+p*M+f*O+d*R;t[14]=h*x+p*C+f*P+d*n;t[3]=v*_+m*w+g*T+r*A;t[7]=v*y+m*S+g*E+r*j;t[11]=v*b+m*M+g*O+r*R;t[15]=v*x+m*C+g*P+r*n;return this},multiplyScalar:function(e){var t=this.elements;t[0]*=e;t[4]*=e;t[8]*=e;t[12]*=e;t[1]*=e;t[5]*=e;t[9]*=e;t[13]*=e;t[2]*=e;t[6]*=e;t[10]*=e;t[14]*=e;t[3]*=e;t[7]*=e;t[11]*=e;t[15]*=e;return this},determinant:function(){var e=this.elements,t=e[0],r=e[4],n=e[8],i=e[12],o=e[1],a=e[5],s=e[9],u=e[13],c=e[2],l=e[6],h=e[10],p=e[14];return e[3]*(+i*s*l-n*u*l-i*a*h+r*u*h+n*a*p-r*s*p)+e[7]*(+t*s*p-t*u*h+i*o*h-n*o*p+n*u*c-i*s*c)+e[11]*(+t*u*l-t*a*p-i*o*l+r*o*p+i*a*c-r*u*c)+e[15]*(-n*a*c-t*s*l+t*a*h+n*o*l-r*o*h+r*s*c)},transpose:function(){var e=this.elements;var t=e[1];e[1]=e[4];e[4]=t;t=e[2];e[2]=e[8];e[8]=t;t=e[6];e[6]=e[9];e[9]=t;t=e[3];e[3]=e[12];e[12]=t;t=e[7];e[7]=e[13];e[13]=t;t=e[11];e[11]=e[14];e[14]=t;return this},setPosition:function(e,t,r){var n=this.elements;e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r);return this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");t=this.elements;var r=e.elements;e=r[0];var n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],h=r[9],p=r[10],f=r[11],d=r[12],v=r[13],m=r[14];r=r[15];var g=h*m*c-v*p*c+v*u*f-s*m*f-h*u*r+s*p*r,_=d*p*c-l*m*c-d*u*f+a*m*f+l*u*r-a*p*r,y=l*v*c-d*h*c+d*s*f-a*v*f-l*s*r+a*h*r,b=d*h*u-l*v*u-d*s*p+a*v*p+l*s*m-a*h*m,x=e*g+n*_+i*y+o*b;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);x=1/x;t[0]=g*x;t[1]=(v*p*o-h*m*o-v*i*f+n*m*f+h*i*r-n*p*r)*x;t[2]=(s*m*o-v*u*o+v*i*c-n*m*c-s*i*r+n*u*r)*x;t[3]=(h*u*o-s*p*o-h*i*c+n*p*c+s*i*f-n*u*f)*x;t[4]=_*x;t[5]=(l*m*o-d*p*o+d*i*f-e*m*f-l*i*r+e*p*r)*x;t[6]=(d*u*o-a*m*o-d*i*c+e*m*c+a*i*r-e*u*r)*x;t[7]=(a*p*o-l*u*o+l*i*c-e*p*c-a*i*f+e*u*f)*x;t[8]=y*x;t[9]=(d*h*o-l*v*o-d*n*f+e*v*f+l*n*r-e*h*r)*x;t[10]=(a*v*o-d*s*o+d*n*c-e*v*c-a*n*r+e*s*r)*x;t[11]=(l*s*o-a*h*o-l*n*c+e*h*c+a*n*f-e*s*f)*x;t[12]=b*x;t[13]=(l*v*i-d*h*i+d*n*p-e*v*p-l*n*m+e*h*m)*x;t[14]=(d*s*i-a*v*i-d*n*u+e*v*u+a*n*m-e*s*m)*x;t[15]=(a*h*i-l*s*i+l*n*u-e*h*u-a*n*p+e*s*p)*x;return this},scale:function(e){var t=this.elements,r=e.x,n=e.y;e=e.z;t[0]*=r;t[4]*=n;t[8]*=e;t[1]*=r;t[5]*=n;t[9]*=e;t[2]*=r;t[6]*=n;t[10]*=e;t[3]*=r;t[7]*=n;t[11]*=e;return this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,r){this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1);return this},makeRotationX:function(e){var t=Math.cos(e);e=Math.sin(e);this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1);return this},makeRotationY:function(e){var t=Math.cos(e);e=Math.sin(e);this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1);return this},makeRotationZ:function(e){var t=Math.cos(e);e=Math.sin(e);this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(e,t){var r=Math.cos(t);t=Math.sin(t);var n=1-r,i=e.x,o=e.y;e=e.z;var a=n*i,s=n*o;this.set(a*i+r,a*o-t*e,a*e+t*o,0,a*o+t*e,s*o+r,s*e-t*i,0,a*e-t*o,s*e+t*i,n*e*e+r,0,0,0,0,1);return this},makeScale:function(e,t,r){this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1);return this},makeShear:function(e,t,r){this.set(1,t,r,0,e,1,r,0,e,t,1,0,0,0,0,1);return this},compose:function(e,t,r){var n=this.elements,i=t._x,o=t._y,a=t._z,s=t._w,u=i+i,c=o+o,l=a+a;t=i*u;var h=i*c;i*=l;var p=o*c;o*=l;a*=l;u*=s;c*=s;s*=l;l=r.x;var f=r.y;r=r.z;n[0]=(1-(p+a))*l;n[1]=(h+s)*l;n[2]=(i-c)*l;n[3]=0;n[4]=(h-s)*f;n[5]=(1-(t+a))*f;n[6]=(o+u)*f;n[7]=0;n[8]=(i+c)*r;n[9]=(o-u)*r;n[10]=(1-(t+p))*r;n[11]=0;n[12]=e.x;n[13]=e.y;n[14]=e.z;n[15]=1;return this},decompose:function(e,t,r){var n=this.elements,i=Yo.set(n[0],n[1],n[2]).length(),o=Yo.set(n[4],n[5],n[6]).length(),a=Yo.set(n[8],n[9],n[10]).length();0>this.determinant()&&(i=-i);e.x=n[12];e.y=n[13];e.z=n[14];Ko.copy(this);e=1/i;n=1/o;var s=1/a;Ko.elements[0]*=e;Ko.elements[1]*=e;Ko.elements[2]*=e;Ko.elements[4]*=n;Ko.elements[5]*=n;Ko.elements[6]*=n;Ko.elements[8]*=s;Ko.elements[9]*=s;Ko.elements[10]*=s;t.setFromRotationMatrix(Ko);r.x=i;r.y=o;r.z=a;return this},makePerspective:function(e,t,r,n,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements;a[0]=2*i/(t-e);a[4]=0;a[8]=(t+e)/(t-e);a[12]=0;a[1]=0;a[5]=2*i/(r-n);a[9]=(r+n)/(r-n);a[13]=0;a[2]=0;a[6]=0;a[10]=-(o+i)/(o-i);a[14]=-2*o*i/(o-i);a[3]=0;a[7]=0;a[11]=-1;a[15]=0;return this},makeOrthographic:function(e,t,r,n,i,o){var a=this.elements,s=1/(t-e),u=1/(r-n),c=1/(o-i);a[0]=2*s;a[4]=0;a[8]=0;a[12]=-((t+e)*s);a[1]=0;a[5]=2*u;a[9]=0;a[13]=-((r+n)*u);a[2]=0;a[6]=0;a[10]=-2*c;a[14]=-((o+i)*c);a[3]=0;a[7]=0;a[11]=0;a[15]=1;return this},equals:function(e){var t=this.elements;e=e.elements;for(var r=0;16>r;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;16>r;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);var r=this.elements;e[t]=r[0];e[t+1]=r[1];e[t+2]=r[2];e[t+3]=r[3];e[t+4]=r[4];e[t+5]=r[5];e[t+6]=r[6];e[t+7]=r[7];e[t+8]=r[8];e[t+9]=r[9];e[t+10]=r[10];e[t+11]=r[11];e[t+12]=r[12];e[t+13]=r[13];e[t+14]=r[14];e[t+15]=r[15];return e}});var ra=new Ee,na=new d;i.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");i.DefaultOrder="XYZ";Object.defineProperties(i.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e;this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e;this._onChangeCallback()}}});Object.assign(i.prototype,{isEuler:!0,set:function(e,t,r,n){this._x=e;this._y=t;this._z=r;this._order=n||this._order;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){this._x=e._x;this._y=e._y;this._z=e._z;this._order=e._order;this._onChangeCallback();return this},setFromRotationMatrix:function(e,t,r){var n=Vo.clamp,i=e.elements;e=i[0];var o=i[4],a=i[8],s=i[1],u=i[5],c=i[9],l=i[2],h=i[6];i=i[10];t=t||this._order;switch(t){case"XYZ":this._y=Math.asin(n(a,-1,1));.9999999>Math.abs(a)?(this._x=Math.atan2(-c,i),this._z=Math.atan2(-o,e)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-n(c,-1,1));.9999999>Math.abs(c)?(this._y=Math.atan2(a,i),this._z=Math.atan2(s,u)):(this._y=Math.atan2(-l,e),this._z=0);break;case"ZXY":this._x=Math.asin(n(h,-1,1));.9999999>Math.abs(h)?(this._y=Math.atan2(-l,i),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(s,e));break;case"ZYX":this._y=Math.asin(-n(l,-1,1));.9999999>Math.abs(l)?(this._x=Math.atan2(h,i),this._z=Math.atan2(s,e)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(n(s,-1,1));.9999999>Math.abs(s)?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-l,e)):(this._x=0,this._y=Math.atan2(a,i));break;case"XZY":this._z=Math.asin(-n(o,-1,1));.9999999>Math.abs(o)?(this._x=Math.atan2(h,u),this._y=Math.atan2(a,e)):(this._x=Math.atan2(-c,i),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}this._order=t;!1!==r&&this._onChangeCallback();return this},setFromQuaternion:function(e,t,r){ra.makeRotationFromQuaternion(e);return this.setFromRotationMatrix(ra,t,r)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){na.setFromEuler(this);return this.setFromQuaternion(na,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){this._x=e[0];this._y=e[1];this._z=e[2];void 0!==e[3]&&(this._order=e[3]);this._onChangeCallback();return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);e[t]=this._x;e[t+1]=this._y;e[t+2]=this._z;e[t+3]=this._order;return e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Te(this._x,this._y,this._z)},_onChange:function(e){this._onChangeCallback=e;return this},_onChangeCallback:function(){}});Object.assign(o.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask=this.mask|1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!==(this.mask&e.mask)}});var ia=0,oa=new Te,aa=new d,sa=new Ee,ua=new Te,ca=new Te,la=new Te,ha=new d,pa=new Te(1,0,0),fa=new Te(0,1,0),da=new Te(0,0,1),va={type:"added"},ma={type:"removed"};f.DefaultUp=new Te(0,1,0);f.DefaultMatrixAutoUpdate=!0;f.prototype=Object.assign(Object.create(t.prototype),{constructor:f,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix();this.matrix.premultiply(e);this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){this.quaternion.premultiply(e);return this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){aa.setFromAxisAngle(e,t);this.quaternion.multiply(aa);return this},rotateOnWorldAxis:function(e,t){aa.setFromAxisAngle(e,t);this.quaternion.premultiply(aa);return this},rotateX:function(e){return this.rotateOnAxis(pa,e)},rotateY:function(e){return this.rotateOnAxis(fa,e)},rotateZ:function(e){return this.rotateOnAxis(da,e)},translateOnAxis:function(e,t){oa.copy(e).applyQuaternion(this.quaternion);this.position.add(oa.multiplyScalar(t));return this},translateX:function(e){return this.translateOnAxis(pa,e)},translateY:function(e){return this.translateOnAxis(fa,e)},translateZ:function(e){return this.translateOnAxis(da,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(sa.getInverse(this.matrixWorld))},lookAt:function(e,t,r){e.isVector3?ua.copy(e):ua.set(e,t,r);e=this.parent;this.updateWorldMatrix(!0,!1);ca.setFromMatrixPosition(this.matrixWorld);this.isCamera||this.isLight?sa.lookAt(ca,ua,this.up):sa.lookAt(ua,ca,this.up);this.quaternion.setFromRotationMatrix(sa);e&&(sa.extractRotation(e.matrixWorld),aa.setFromRotationMatrix(sa),this.quaternion.premultiply(aa.inverse()))},add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}if(e===this)return console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this;e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(va)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e);return this},remove:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}t=this.children.indexOf(e);-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ma));return this},attach:function(e){this.updateWorldMatrix(!0,!1);sa.getInverse(this.matrixWorld);null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),sa.multiply(e.parent.matrixWorld));e.applyMatrix4(sa);e.updateWorldMatrix(!1,!1);this.add(e);return this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new Te);this.updateMatrixWorld(!0);return e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new d);this.updateMatrixWorld(!0);this.matrixWorld.decompose(ca,e,la);return e},getWorldScale:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new Te);this.updateMatrixWorld(!0);this.matrixWorld.decompose(ca,ha,e);return e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new Te);this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||e)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0;for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var r=this.parent;!0===e&&null!==r&&r.updateWorldMatrix(!0,!1);this.matrixAutoUpdate&&this.updateMatrix();null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);if(!0===t)for(e=this.children,t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0)},toJSON:function(r){function e(e,t){void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(r));return t.uuid}function t(e){var t=[],r;for(r in e){var n=e[r];delete n.metadata;t.push(n)}return t}var n=void 0===r||"string"===typeof r,i={};n&&(r={geometries:{},materials:{},textures:{},images:{},shapes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var o={};o.uuid=this.uuid;o.type=this.type;""!==this.name&&(o.name=this.name);!0===this.castShadow&&(o.castShadow=!0);!0===this.receiveShadow&&(o.receiveShadow=!0);!1===this.visible&&(o.visible=!1);!1===this.frustumCulled&&(o.frustumCulled=!1);0!==this.renderOrder&&(o.renderOrder=this.renderOrder);"{}"!==JSON.stringify(this.userData)&&(o.userData=this.userData);o.layers=this.layers.mask;o.matrix=this.matrix.toArray();!1===this.matrixAutoUpdate&&(o.matrixAutoUpdate=!1);this.isInstancedMesh&&(o.type="InstancedMesh",o.count=this.count,o.instanceMatrix=this.instanceMatrix.toJSON());if(this.isMesh||this.isLine||this.isPoints){o.geometry=e(r.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes)if(a=a.shapes,Array.isArray(a))for(var s=0,u=a.length;s<u;s++)e(r.shapes,a[s]);else e(r.shapes,a)}if(void 0!==this.material)if(Array.isArray(this.material)){a=[];s=0;for(u=this.material.length;s<u;s++)a.push(e(r.materials,this.material[s]));o.material=a}else o.material=e(r.materials,this.material);if(0<this.children.length)for(o.children=[],s=0;s<this.children.length;s++)o.children.push(this.children[s].toJSON(r).object);if(n){n=t(r.geometries);s=t(r.materials);u=t(r.textures);var c=t(r.images);a=t(r.shapes);0<n.length&&(i.geometries=n);0<s.length&&(i.materials=s);0<u.length&&(i.textures=u);0<c.length&&(i.images=c);0<a.length&&(i.shapes=a)}i.object=o;return i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){void 0===t&&(t=!0);this.name=e.name;this.up.copy(e.up);this.position.copy(e.position);this.quaternion.copy(e.quaternion);this.scale.copy(e.scale);this.matrix.copy(e.matrix);this.matrixWorld.copy(e.matrixWorld);this.matrixAutoUpdate=e.matrixAutoUpdate;this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate;this.layers.mask=e.layers.mask;this.visible=e.visible;this.castShadow=e.castShadow;this.receiveShadow=e.receiveShadow;this.frustumCulled=e.frustumCulled;this.renderOrder=e.renderOrder;this.userData=JSON.parse(JSON.stringify(e.userData));if(!0===t)for(t=0;t<e.children.length;t++)this.add(e.children[t].clone());return this}});Oe.prototype=Object.assign(Object.create(f.prototype),{constructor:Oe,isScene:!0,copy:function(e,t){f.prototype.copy.call(this,e,t);null!==e.background&&(this.background=e.background.clone());null!==e.environment&&(this.environment=e.environment.clone());null!==e.fog&&(this.fog=e.fog.clone());null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone());this.autoUpdate=e.autoUpdate;this.matrixAutoUpdate=e.matrixAutoUpdate;return this},toJSON:function(e){var t=f.prototype.toJSON.call(this,e);null!==this.background&&(t.object.background=this.background.toJSON(e));null!==this.environment&&(t.object.environment=this.environment.toJSON(e));null!==this.fog&&(t.object.fog=this.fog.toJSON());return t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var ga=[new Te,new Te,new Te,new Te,new Te,new Te,new Te,new Te],_a=new Te,ya=new n,ba=new Te,xa=new Te,wa=new Te,Sa=new Te,Ma=new Te,Ca=new Te,Ta=new Te,Ea=new Te,Oa=new Te,Pa=new Te;Object.assign(n.prototype,{isBox3:!0,set:function(e,t){this.min.copy(e);this.max.copy(t);return this},setFromArray:function(e){for(var t=Infinity,r=Infinity,n=Infinity,i=-Infinity,o=-Infinity,a=-Infinity,s=0,u=e.length;s<u;s+=3){var c=e[s],l=e[s+1],h=e[s+2];c<t&&(t=c);l<r&&(r=l);h<n&&(n=h);c>i&&(i=c);l>o&&(o=l);h>a&&(a=h)}this.min.set(t,r,n);this.max.set(i,o,a);return this},setFromBufferAttribute:function(e){for(var t=Infinity,r=Infinity,n=Infinity,i=-Infinity,o=-Infinity,a=-Infinity,s=0,u=e.count;s<u;s++){var c=e.getX(s),l=e.getY(s),h=e.getZ(s);c<t&&(t=c);l<r&&(r=l);h<n&&(n=h);c>i&&(i=c);l>o&&(o=l);h>a&&(a=h)}this.min.set(t,r,n);this.max.set(i,o,a);return this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){t=_a.copy(t).multiplyScalar(.5);this.min.copy(e).sub(t);this.max.copy(e).add(t);return this},setFromObject:function(e){this.makeEmpty();return this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.min.copy(e.min);this.max.copy(e.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new Te);return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new Te);return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){this.min.min(e);this.max.max(e);return this},expandByVector:function(e){this.min.sub(e);this.max.add(e);return this},expandByScalar:function(e){this.min.addScalar(-e);this.max.addScalar(e);return this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),ya.copy(t.boundingBox),ya.applyMatrix4(e.matrixWorld),this.union(ya));e=e.children;t=0;for(var r=e.length;t<r;t++)this.expandByObject(e[t]);return this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Te);return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},intersectsSphere:function(e){this.clampPoint(e.center,_a);return _a.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){if(0<e.normal.x){var t=e.normal.x*this.min.x;var r=e.normal.x*this.max.x}else t=e.normal.x*this.max.x,r=e.normal.x*this.min.x;0<e.normal.y?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y);0<e.normal.z?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z);return t<=-e.constant&&r>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Ta);Ea.subVectors(this.max,Ta);ba.subVectors(e.a,Ta);xa.subVectors(e.b,Ta);wa.subVectors(e.c,Ta);Sa.subVectors(xa,ba);Ma.subVectors(wa,xa);Ca.subVectors(ba,wa);e=[0,-Sa.z,Sa.y,0,-Ma.z,Ma.y,0,-Ca.z,Ca.y,Sa.z,0,-Sa.x,Ma.z,0,-Ma.x,Ca.z,0,-Ca.x,-Sa.y,Sa.x,0,-Ma.y,Ma.x,0,-Ca.y,Ca.x,0];if(!a(e,ba,xa,wa,Ea))return!1;e=[1,0,0,0,1,0,0,0,1];if(!a(e,ba,xa,wa,Ea))return!1;Oa.crossVectors(Sa,Ma);e=[Oa.x,Oa.y,Oa.z];return a(e,ba,xa,wa,Ea)},clampPoint:function(e,t){void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Te);return t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return _a.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required");this.getCenter(e.center);e.radius=.5*this.getSize(_a).length();return e},intersect:function(e){this.min.max(e.min);this.max.min(e.max);this.isEmpty()&&this.makeEmpty();return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this},applyMatrix4:function(e){if(this.isEmpty())return this;ga[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e);ga[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e);ga[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e);ga[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e);ga[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e);ga[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e);ga[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e);ga[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e);this.setFromPoints(ga);return this},translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Aa=new n;Object.assign(l.prototype,{set:function(e,t){this.center.copy(e);this.radius=t;return this},setFromPoints:function(e,t){var r=this.center;void 0!==t?r.copy(t):Aa.setFromPoints(e).getCenter(r);for(var n=t=0,i=e.length;n<i;n++)t=Math.max(t,r.distanceToSquared(e[n]));this.radius=Math.sqrt(t);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.center.copy(e.center);this.radius=e.radius;return this},isEmpty:function(){return 0>this.radius},makeEmpty:function(){this.center.set(0,0,0);this.radius=-1;return this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e);void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new Te);t.copy(e);r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center));return t},getBoundingBox:function(e){void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new n);if(this.isEmpty())return e.makeEmpty(),e;e.set(this.center,this.center);e.expandByScalar(this.radius);return e},applyMatrix4:function(e){this.center.applyMatrix4(e);this.radius*=e.getMaxScaleOnAxis();return this},translate:function(e){this.center.add(e);return this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var ja=new Te,Ra=new Te,ka=new Te,La=new Te,Na=new Te,Ia=new Te,Da=new Te;Object.assign(s.prototype,{set:function(e,t){this.origin.copy(e);this.direction.copy(t);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.origin.copy(e.origin);this.direction.copy(e.direction);return this},at:function(e,t){void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Te);return t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){this.direction.copy(e).sub(this.origin).normalize();return this},recast:function(e){this.origin.copy(this.at(e,ja));return this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Te);t.subVectors(e,this.origin);e=t.dot(this.direction);return 0>e?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=ja.subVectors(e,this.origin).dot(this.direction);if(0>t)return this.origin.distanceToSquared(e);ja.copy(this.direction).multiplyScalar(t).add(this.origin);return ja.distanceToSquared(e)},distanceSqToSegment:function(e,t,r,n){Ra.copy(e).add(t).multiplyScalar(.5);ka.copy(t).sub(e).normalize();La.copy(this.origin).sub(Ra);var i=.5*e.distanceTo(t),o=-this.direction.dot(ka),a=La.dot(this.direction),s=-La.dot(ka),u=La.lengthSq(),c=Math.abs(1-o*o);if(0<c){e=o*s-a;t=o*a-s;var l=i*c;0<=e?t>=-l?t<=l?(i=1/c,e*=i,t*=i,o=e*(e+o*t+2*a)+t*(o*e+t+2*s)+u):(t=i,e=Math.max(0,-(o*t+a)),o=-e*e+t*(t+2*s)+u):(t=-i,e=Math.max(0,-(o*t+a)),o=-e*e+t*(t+2*s)+u):t<=-l?(e=Math.max(0,-(-o*i+a)),t=0<e?-i:Math.min(Math.max(-i,-s),i),o=-e*e+t*(t+2*s)+u):t<=l?(e=0,t=Math.min(Math.max(-i,-s),i),o=t*(t+2*s)+u):(e=Math.max(0,-(o*i+a)),t=0<e?i:Math.min(Math.max(-i,-s),i),o=-e*e+t*(t+2*s)+u)}else t=0<o?-i:i,e=Math.max(0,-(o*t+a)),o=-e*e+t*(t+2*s)+u;r&&r.copy(this.direction).multiplyScalar(e).add(this.origin);n&&n.copy(ka).multiplyScalar(t).add(Ra);return o},intersectSphere:function(e,t){ja.subVectors(e.center,this.origin);var r=ja.dot(this.direction),n=ja.dot(ja)-r*r;e=e.radius*e.radius;if(n>e)return null;e=Math.sqrt(e-n);n=r-e;r+=e;return 0>n&&0>r?null:0>n?this.at(r,t):this.at(n,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;e=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=e?e:null},intersectPlane:function(e,t){e=this.distanceToPlane(e);return null===e?null:this.at(e,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||0>e.normal.dot(this.direction)*t?!0:!1},intersectBox:function(e,t){var r=1/this.direction.x;var n=1/this.direction.y;var i=1/this.direction.z,o=this.origin;if(0<=r){var a=(e.min.x-o.x)*r;r*=e.max.x-o.x}else a=(e.max.x-o.x)*r,r*=e.min.x-o.x;if(0<=n){var s=(e.min.y-o.y)*n;n*=e.max.y-o.y}else s=(e.max.y-o.y)*n,n*=e.min.y-o.y;if(a>n||s>r)return null;if(s>a||a!==a)a=s;if(n<r||r!==r)r=n;0<=i?(s=(e.min.z-o.z)*i,e=(e.max.z-o.z)*i):(s=(e.max.z-o.z)*i,e=(e.min.z-o.z)*i);if(a>e||s>r)return null;if(s>a||a!==a)a=s;if(e<r||r!==r)r=e;return 0>r?null:this.at(0<=a?a:r,t)},intersectsBox:function(e){return null!==this.intersectBox(e,ja)},intersectTriangle:function(e,t,r,n,i){Na.subVectors(t,e);Ia.subVectors(r,e);Da.crossVectors(Na,Ia);t=this.direction.dot(Da);if(0<t){if(n)return null;n=1}else if(0>t)n=-1,t=-t;else return null;La.subVectors(this.origin,e);e=n*this.direction.dot(Ia.crossVectors(La,Ia));if(0>e)return null;r=n*this.direction.dot(Na.cross(La));if(0>r||e+r>t)return null;e=-n*La.dot(Da);return 0>e?null:this.at(e/t,i)},applyMatrix4:function(e){this.origin.applyMatrix4(e);this.direction.transformDirection(e);return this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Ba=new Te,Fa=new Te,za=new m;Object.assign(g.prototype,{isPlane:!0,set:function(e,t){this.normal.copy(e);this.constant=t;return this},setComponents:function(e,t,r,n){this.normal.set(e,t,r);this.constant=n;return this},setFromNormalAndCoplanarPoint:function(e,t){this.normal.copy(e);this.constant=-t.dot(this.normal);return this},setFromCoplanarPoints:function(e,t,r){t=Ba.subVectors(r,t).cross(Fa.subVectors(e,t)).normalize();this.setFromNormalAndCoplanarPoint(t,e);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.normal.copy(e.normal);this.constant=e.constant;return this},normalize:function(){var e=1/this.normal.length();this.normal.multiplyScalar(e);this.constant*=e;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new Te);return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new Te);var r=e.delta(Ba),n=this.normal.dot(r);if(0===n){if(0===this.distanceToPoint(e.start))return t.copy(e.start)}else if(n=-(e.start.dot(this.normal)+this.constant)/n,!(0>n||1<n))return t.copy(r).multiplyScalar(n).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start);e=this.distanceToPoint(e.end);return 0>t&&0<e||0>e&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Te);return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){t=t||za.getNormalMatrix(e);e=this.coplanarPoint(Ba).applyMatrix4(e);t=this.normal.applyMatrix3(t).normalize();this.constant=-e.dot(t);return this},translate:function(e){this.constant-=e.dot(this.normal);return this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var $a=new Te,Ga=new Te,Va=new Te,Ha=new Te,Ua=new Te,qa=new Te,Wa=new Te,Xa=new Te,Ya=new Te,Ka=new Te;Object.assign(b,{getNormal:function(e,t,r,n){void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new Te);n.subVectors(r,t);$a.subVectors(e,t);n.cross($a);e=n.lengthSq();return 0<e?n.multiplyScalar(1/Math.sqrt(e)):n.set(0,0,0)},getBarycoord:function(e,t,r,n,i){$a.subVectors(n,t);Ga.subVectors(r,t);Va.subVectors(e,t);e=$a.dot($a);t=$a.dot(Ga);r=$a.dot(Va);var o=Ga.dot(Ga);n=Ga.dot(Va);var a=e*o-t*t;void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Te);if(0===a)return i.set(-2,-1,-1);a=1/a;o=(o*r-t*n)*a;e=(e*n-t*r)*a;return i.set(1-o-e,e,o)},containsPoint:function(e,t,r,n){b.getBarycoord(e,t,r,n,Ha);return 0<=Ha.x&&0<=Ha.y&&1>=Ha.x+Ha.y},getUV:function(e,t,r,n,i,o,a,s){this.getBarycoord(e,t,r,n,Ha);s.set(0,0);s.addScaledVector(i,Ha.x);s.addScaledVector(o,Ha.y);s.addScaledVector(a,Ha.z);return s},isFrontFacing:function(e,t,r,n){$a.subVectors(r,t);Ga.subVectors(e,t);return 0>$a.cross(Ga).dot(n)?!0:!1}});Object.assign(b.prototype,{set:function(e,t,r){this.a.copy(e);this.b.copy(t);this.c.copy(r);return this},setFromPointsAndIndices:function(e,t,r,n){this.a.copy(e[t]);this.b.copy(e[r]);this.c.copy(e[n]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a.copy(e.a);this.b.copy(e.b);this.c.copy(e.c);return this},getArea:function(){$a.subVectors(this.c,this.b);Ga.subVectors(this.a,this.b);return.5*$a.cross(Ga).length()},getMidpoint:function(e){void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Te);return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return b.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new g);return e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return b.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,r,n,i){return b.getUV(e,this.a,this.b,this.c,t,r,n,i)},containsPoint:function(e){return b.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return b.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Te);var r=this.a,n=this.b,i=this.c;Ua.subVectors(n,r);qa.subVectors(i,r);Xa.subVectors(e,r);var o=Ua.dot(Xa),a=qa.dot(Xa);if(0>=o&&0>=a)return t.copy(r);Ya.subVectors(e,n);var s=Ua.dot(Ya),u=qa.dot(Ya);if(0<=s&&u<=s)return t.copy(n);var c=o*u-s*a;if(0>=c&&0<=o&&0>=s)return n=o/(o-s),t.copy(r).addScaledVector(Ua,n);Ka.subVectors(e,i);e=Ua.dot(Ka);var l=qa.dot(Ka);if(0<=l&&e<=l)return t.copy(i);o=e*a-o*l;if(0>=o&&0<=a&&0>=l)return c=a/(a-l),t.copy(r).addScaledVector(qa,c);a=s*l-e*u;if(0>=a&&0<=u-s&&0<=e-l)return Wa.subVectors(i,n),c=(u-s)/(u-s+(e-l)),t.copy(n).addScaledVector(Wa,c);i=1/(a+o+c);n=o*i;c*=i;return t.copy(r).addScaledVector(Ua,n).addScaledVector(qa,c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Za={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ja={h:0,s:0,l:0},Qa={h:0,s:0,l:0};Object.assign(v.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){e&&e.isColor?this.copy(e):"number"===typeof e?this.setHex(e):"string"===typeof e&&this.setStyle(e);return this},setScalar:function(e){this.b=this.g=this.r=e;return this},setHex:function(e){e=Math.floor(e);this.r=(e>>16&255)/255;this.g=(e>>8&255)/255;this.b=(e&255)/255;return this},setRGB:function(e,t,r){this.r=e;this.g=t;this.b=r;return this},setHSL:function(e,t,r){e=Vo.euclideanModulo(e,1);t=Vo.clamp(t,0,1);r=Vo.clamp(r,0,1);0===t?this.r=this.g=this.b=r:(t=.5>=r?r*(1+t):r+t-r*t,r=2*r-t,this.r=u(r,t,e+1/3),this.g=u(r,t,e),this.b=u(r,t,e-1/3));return this},setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n=r[2];switch(r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n)){n=parseFloat(r[1])/360;var i=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;e(r[5]);return this.setHSL(n,i,o)}}}else if(r=/^#([A-Fa-f0-9]+)$/.exec(t)){r=r[1];n=r.length;if(3===n)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===n)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0<t.length?this.setColorName(t):this},setColorName:function(e){var t=Za[e];void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e);return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){this.r=e.r;this.g=e.g;this.b=e.b;return this},copyGammaToLinear:function(e,t){void 0===t&&(t=2);this.r=Math.pow(e.r,t);this.g=Math.pow(e.g,t);this.b=Math.pow(e.b,t);return this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);t=0<t?1/t:1;this.r=Math.pow(e.r,t);this.g=Math.pow(e.g,t);this.b=Math.pow(e.b,t);return this},convertGammaToLinear:function(e){this.copyGammaToLinear(this,e);return this},convertLinearToGamma:function(e){this.copyLinearToGamma(this,e);return this},copySRGBToLinear:function(e){this.r=c(e.r);this.g=c(e.g);this.b=c(e.b);return this},copyLinearToSRGB:function(e){this.r=h(e.r);this.g=h(e.g);this.b=h(e.b);return this},convertSRGBToLinear:function(){this.copySRGBToLinear(this);return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t=this.r,r=this.g,n=this.b,i=Math.max(t,r,n),o=Math.min(t,r,n),a,s=(o+i)/2;if(o===i)o=a=0;else{var u=i-o;o=.5>=s?u/(i+o):u/(2-i-o);switch(i){case t:a=(r-n)/u+(r<n?6:0);break;case r:a=(n-t)/u+2;break;case n:a=(t-r)/u+4}a/=6}e.h=a;e.s=o;e.l=s;return e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){this.getHSL(Ja);Ja.h+=e;Ja.s+=t;Ja.l+=r;this.setHSL(Ja.h,Ja.s,Ja.l);return this},add:function(e){this.r+=e.r;this.g+=e.g;this.b+=e.b;return this},addColors:function(e,t){this.r=e.r+t.r;this.g=e.g+t.g;this.b=e.b+t.b;return this},addScalar:function(e){this.r+=e;this.g+=e;this.b+=e;return this},sub:function(e){this.r=Math.max(0,this.r-e.r);this.g=Math.max(0,this.g-e.g);this.b=Math.max(0,this.b-e.b);return this},multiply:function(e){this.r*=e.r;this.g*=e.g;this.b*=e.b;return this},multiplyScalar:function(e){this.r*=e;this.g*=e;this.b*=e;return this},lerp:function(e,t){this.r+=(e.r-this.r)*t;this.g+=(e.g-this.g)*t;this.b+=(e.b-this.b)*t;return this},lerpHSL:function(e,t){this.getHSL(Ja);e.getHSL(Qa);e=Vo.lerp(Ja.h,Qa.h,t);var r=Vo.lerp(Ja.s,Qa.s,t);t=Vo.lerp(Ja.l,Qa.l,t);this.setHSL(e,r,t);return this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){void 0===t&&(t=0);this.r=e[t];this.g=e[t+1];this.b=e[t+2];return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);e[t]=this.r;e[t+1]=this.g;e[t+2]=this.b;return e},toJSON:function(){return this.getHex()}});v.NAMES=Za;Object.assign(_.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a;this.b=e.b;this.c=e.c;this.normal.copy(e.normal);this.color.copy(e.color);this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();t=0;for(r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var es=0;y.prototype=Object.assign(Object.create(t.prototype),{constructor:y,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0===r)console.warn("THREE.Material: '"+t+"' parameter is undefined.");else if("shading"===t)console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===r?!0:!1;else{var n=this[t];void 0===n?console.warn("THREE."+this.type+": '"+t+"' is not a property of this material."):n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r}}},toJSON:function(e){function t(e){var t=[],r;for(r in e){var n=e[r];delete n.metadata;t.push(n)}return t}var r=void 0===e||"string"===typeof e;r&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid;n.type=this.type;""!==this.name&&(n.name=this.name);this.color&&this.color.isColor&&(n.color=this.color.getHex());void 0!==this.roughness&&(n.roughness=this.roughness);void 0!==this.metalness&&(n.metalness=this.metalness);this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex());this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex());this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity);this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex());void 0!==this.shininess&&(n.shininess=this.shininess);void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat);void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness);this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid);this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid);this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray());this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid);this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid);this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid);this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid);this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity);this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid);this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid);this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid);this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity));this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid);void 0!==this.size&&(n.size=this.size);void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(n.blending=this.blending);!0===this.flatShading&&(n.flatShading=this.flatShading);0!==this.side&&(n.side=this.side);this.vertexColors&&(n.vertexColors=!0);1>this.opacity&&(n.opacity=this.opacity);!0===this.transparent&&(n.transparent=this.transparent);n.depthFunc=this.depthFunc;n.depthTest=this.depthTest;n.depthWrite=this.depthWrite;n.stencilWrite=this.stencilWrite;n.stencilWriteMask=this.stencilWriteMask;n.stencilFunc=this.stencilFunc;n.stencilRef=this.stencilRef;n.stencilFuncMask=this.stencilFuncMask;n.stencilFail=this.stencilFail;n.stencilZFail=this.stencilZFail;n.stencilZPass=this.stencilZPass;this.rotation&&0!==this.rotation&&(n.rotation=this.rotation);!0===this.polygonOffset&&(n.polygonOffset=!0);0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits);this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth);void 0!==this.dashSize&&(n.dashSize=this.dashSize);void 0!==this.gapSize&&(n.gapSize=this.gapSize);void 0!==this.scale&&(n.scale=this.scale);!0===this.dithering&&(n.dithering=!0);0<this.alphaTest&&(n.alphaTest=this.alphaTest);!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha);!0===this.wireframe&&(n.wireframe=this.wireframe);1<this.wireframeLinewidth&&(n.wireframeLinewidth=this.wireframeLinewidth);"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap);"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin);!0===this.morphTargets&&(n.morphTargets=!0);!0===this.morphNormals&&(n.morphNormals=!0);!0===this.skinning&&(n.skinning=!0);!1===this.visible&&(n.visible=!1);!1===this.toneMapped&&(n.toneMapped=!1);"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData);r&&(r=t(e.textures),e=t(e.images),0<r.length&&(n.textures=r),0<e.length&&(n.images=e));return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name;this.fog=e.fog;this.blending=e.blending;this.side=e.side;this.flatShading=e.flatShading;this.vertexColors=e.vertexColors;this.opacity=e.opacity;this.transparent=e.transparent;this.blendSrc=e.blendSrc;this.blendDst=e.blendDst;this.blendEquation=e.blendEquation;this.blendSrcAlpha=e.blendSrcAlpha;this.blendDstAlpha=e.blendDstAlpha;this.blendEquationAlpha=e.blendEquationAlpha;this.depthFunc=e.depthFunc;this.depthTest=e.depthTest;this.depthWrite=e.depthWrite;this.stencilWriteMask=e.stencilWriteMask;this.stencilFunc=e.stencilFunc;this.stencilRef=e.stencilRef;this.stencilFuncMask=e.stencilFuncMask;this.stencilFail=e.stencilFail;this.stencilZFail=e.stencilZFail;this.stencilZPass=e.stencilZPass;this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,r=null;if(null!==t){var n=t.length;r=Array(n);for(var i=0;i!==n;++i)r[i]=t[i].clone()}this.clippingPlanes=r;this.clipIntersection=e.clipIntersection;this.clipShadows=e.clipShadows;this.shadowSide=e.shadowSide;this.colorWrite=e.colorWrite;this.precision=e.precision;this.polygonOffset=e.polygonOffset;this.polygonOffsetFactor=e.polygonOffsetFactor;this.polygonOffsetUnits=e.polygonOffsetUnits;this.dithering=e.dithering;this.alphaTest=e.alphaTest;this.premultipliedAlpha=e.premultipliedAlpha;this.visible=e.visible;this.toneMapped=e.toneMapped;this.userData=JSON.parse(JSON.stringify(e.userData));return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.defineProperty(y.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});x.prototype=Object.create(y.prototype);x.prototype.constructor=x;x.prototype.isMeshBasicMaterial=!0;x.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);this.map=e.map;this.lightMap=e.lightMap;this.lightMapIntensity=e.lightMapIntensity;this.aoMap=e.aoMap;this.aoMapIntensity=e.aoMapIntensity;this.specularMap=e.specularMap;this.alphaMap=e.alphaMap;this.envMap=e.envMap;this.combine=e.combine;this.reflectivity=e.reflectivity;this.refractionRatio=e.refractionRatio;this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;this.wireframeLinecap=e.wireframeLinecap;this.wireframeLinejoin=e.wireframeLinejoin;this.skinning=e.skinning;this.morphTargets=e.morphTargets;return this};var ts=new Te;Object.defineProperty(E.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});Object.assign(E.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){this.usage=e;return this},copy:function(e){this.name=e.name;this.array=new e.array.constructor(e.array);this.itemSize=e.itemSize;this.count=e.count;this.normalized=e.normalized;this.usage=e.usage;return this},copyAt:function(e,t,r){e*=this.itemSize;r*=t.itemSize;for(var n=0,i=this.itemSize;n<i;n++)this.array[e+n]=t.array[r+n];return this},copyArray:function(e){this.array.set(e);return this},copyColorsArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),o=new v);t[r++]=o.r;t[r++]=o.g;t[r++]=o.b}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),o=new Me);t[r++]=o.x;t[r++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),o=new Te);t[r++]=o.x;t[r++]=o.y;t[r++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new Ce);t[r++]=o.x;t[r++]=o.y;t[r++]=o.z;t[r++]=o.w}return this},applyMatrix3:function(e){for(var t=0,r=this.count;t<r;t++)ts.x=this.getX(t),ts.y=this.getY(t),ts.z=this.getZ(t),ts.applyMatrix3(e),this.setXYZ(t,ts.x,ts.y,ts.z);return this},applyMatrix4:function(e){for(var t=0,r=this.count;t<r;t++)ts.x=this.getX(t),ts.y=this.getY(t),ts.z=this.getZ(t),ts.applyMatrix4(e),this.setXYZ(t,ts.x,ts.y,ts.z);return this},applyNormalMatrix:function(e){for(var t=0,r=this.count;t<r;t++)ts.x=this.getX(t),ts.y=this.getY(t),ts.z=this.getZ(t),ts.applyNormalMatrix(e),this.setXYZ(t,ts.x,ts.y,ts.z);return this},transformDirection:function(e){for(var t=0,r=this.count;t<r;t++)ts.x=this.getX(t),ts.y=this.getY(t),ts.z=this.getZ(t),ts.transformDirection(e),this.setXYZ(t,ts.x,ts.y,ts.z);return this},set:function(e,t){void 0===t&&(t=0);this.array.set(e,t);return this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){this.array[e*this.itemSize]=t;return this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){this.array[e*this.itemSize+1]=t;return this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){this.array[e*this.itemSize+2]=t;return this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){this.array[e*this.itemSize+3]=t;return this},setXY:function(e,t,r){e*=this.itemSize;this.array[e+0]=t;this.array[e+1]=r;return this},setXYZ:function(e,t,r,n){e*=this.itemSize;this.array[e+0]=t;this.array[e+1]=r;this.array[e+2]=n;return this},setXYZW:function(e,t,r,n,i){e*=this.itemSize;this.array[e+0]=t;this.array[e+1]=r;this.array[e+2]=n;this.array[e+3]=i;return this},onUpload:function(e){this.onUploadCallback=e;return this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});w.prototype=Object.create(E.prototype);w.prototype.constructor=w;S.prototype=Object.create(E.prototype);S.prototype.constructor=S;M.prototype=Object.create(E.prototype);M.prototype.constructor=M;C.prototype=Object.create(E.prototype);C.prototype.constructor=C;O.prototype=Object.create(E.prototype);O.prototype.constructor=O;P.prototype=Object.create(E.prototype);P.prototype.constructor=P;A.prototype=Object.create(E.prototype);A.prototype.constructor=A;j.prototype=Object.create(E.prototype);j.prototype.constructor=j;R.prototype=Object.create(E.prototype);R.prototype.constructor=R;Object.assign(k.prototype,{computeGroups:function(e){var t=[],r=void 0;e=e.faces;for(var n=0;n<e.length;n++){var i=e[n];if(i.materialIndex!==r){r=i.materialIndex;void 0!==o&&(o.count=3*n-o.start,t.push(o));var o={start:3*n,materialIndex:r}}}void 0!==o&&(o.count=3*n-o.start,t.push(o));this.groups=t},fromGeometry:function(e){var t=e.faces,r=e.vertices,n=e.faceVertexUvs,i=n[0]&&0<n[0].length,o=n[1]&&0<n[1].length,a=e.morphTargets,s=a.length;if(0<s){var u=[];for(var c=0;c<s;c++)u[c]={name:a[c].name,data:[]};this.morphTargets.position=u}var l=e.morphNormals,h=l.length;if(0<h){var p=[];for(c=0;c<h;c++)p[c]={name:l[c].name,data:[]};this.morphTargets.normal=p}var f=e.skinIndices,d=e.skinWeights,v=f.length===r.length,m=d.length===r.length;0<r.length&&0===t.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<t.length;c++){var g=t[c];this.vertices.push(r[g.a],r[g.b],r[g.c]);var _=g.vertexNormals;3===_.length?this.normals.push(_[0],_[1],_[2]):(_=g.normal,this.normals.push(_,_,_));_=g.vertexColors;3===_.length?this.colors.push(_[0],_[1],_[2]):(_=g.color,this.colors.push(_,_,_));!0===i&&(_=n[0][c],void 0!==_?this.uvs.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new Me,new Me,new Me)));!0===o&&(_=n[1][c],void 0!==_?this.uvs2.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new Me,new Me,new Me)));for(_=0;_<s;_++){var y=a[_].vertices;u[_].data.push(y[g.a],y[g.b],y[g.c])}for(_=0;_<h;_++)y=l[_].vertexNormals[c],p[_].data.push(y.a,y.b,y.c);v&&this.skinIndices.push(f[g.a],f[g.b],f[g.c]);m&&this.skinWeights.push(d[g.a],d[g.b],d[g.c])}this.computeGroups(e);this.verticesNeedUpdate=e.verticesNeedUpdate;this.normalsNeedUpdate=e.normalsNeedUpdate;this.colorsNeedUpdate=e.colorsNeedUpdate;this.uvsNeedUpdate=e.uvsNeedUpdate;this.groupsNeedUpdate=e.groupsNeedUpdate;null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone());null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone());return this}});var rs=1,ns=new Ee,is=new f,os=new Te,as=new n,ss=new n,us=new Te;N.prototype=Object.assign(Object.create(t.prototype),{constructor:N,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(65535<L(e)?A:O)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){this.attributes[e]=t;return this},deleteAttribute:function(e){delete this.attributes[e];return this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e;this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);t=this.attributes.normal;if(void 0!==t){var r=(new m).getNormalMatrix(e);t.applyNormalMatrix(r);t.needsUpdate=!0}t=this.attributes.tangent;void 0!==t&&(t.transformDirection(e),t.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();return this},rotateX:function(e){ns.makeRotationX(e);this.applyMatrix4(ns);return this},rotateY:function(e){ns.makeRotationY(e);this.applyMatrix4(ns);return this},rotateZ:function(e){ns.makeRotationZ(e);this.applyMatrix4(ns);return this},translate:function(e,t,r){ns.makeTranslation(e,t,r);this.applyMatrix4(ns);return this},scale:function(e,t,r){ns.makeScale(e,t,r);this.applyMatrix4(ns);return this},lookAt:function(e){is.lookAt(e);is.updateMatrix();this.applyMatrix4(is.matrix);return this},center:function(){this.computeBoundingBox();this.boundingBox.getCenter(os).negate();this.translate(os.x,os.y,os.z);return this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){e=new j(3*t.vertices.length,3);var r=new j(3*t.colors.length,3);this.setAttribute("position",e.copyVector3sArray(t.vertices));this.setAttribute("color",r.copyColorsArray(t.colors));t.lineDistances&&t.lineDistances.length===t.vertices.length&&(e=new j(t.lineDistances.length,1),this.setAttribute("lineDistance",e.copyArray(t.lineDistances)));null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone());null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new j(t,3));return this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var r=t.__directGeometry;!0===t.elementsNeedUpdate&&(r=void 0,t.elementsNeedUpdate=!1);if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate;r.normalsNeedUpdate=t.normalsNeedUpdate;r.colorsNeedUpdate=t.colorsNeedUpdate;r.uvsNeedUpdate=t.uvsNeedUpdate;r.groupsNeedUpdate=t.groupsNeedUpdate;t.verticesNeedUpdate=!1;t.normalsNeedUpdate=!1;t.colorsNeedUpdate=!1;t.uvsNeedUpdate=!1;t.groupsNeedUpdate=!1;t=r}!0===t.verticesNeedUpdate&&(r=this.attributes.position,void 0!==r&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1);!0===t.normalsNeedUpdate&&(r=this.attributes.normal,void 0!==r&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1);!0===t.colorsNeedUpdate&&(r=this.attributes.color,void 0!==r&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1);t.uvsNeedUpdate&&(r=this.attributes.uv,void 0!==r&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1);t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,void 0!==r&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1);t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1);return this},fromGeometry:function(e){e.__directGeometry=(new k).fromGeometry(e);return this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);this.setAttribute("position",new E(t,3).copyVector3sArray(e.vertices));0<e.normals.length&&(t=new Float32Array(3*e.normals.length),this.setAttribute("normal",new E(t,3).copyVector3sArray(e.normals)));0<e.colors.length&&(t=new Float32Array(3*e.colors.length),this.setAttribute("color",new E(t,3).copyColorsArray(e.colors)));0<e.uvs.length&&(t=new Float32Array(2*e.uvs.length),this.setAttribute("uv",new E(t,2).copyVector2sArray(e.uvs)));0<e.uvs2.length&&(t=new Float32Array(2*e.uvs2.length),this.setAttribute("uv2",new E(t,2).copyVector2sArray(e.uvs2)));this.groups=e.groups;for(var r in e.morphTargets){t=[];for(var n=e.morphTargets[r],i=0,o=n.length;i<o;i++){var a=n[i],s=new j(3*a.data.length,3);s.name=a.name;t.push(s.copyVector3sArray(a.data))}this.morphAttributes[r]=t}0<e.skinIndices.length&&(r=new j(4*e.skinIndices.length,4),this.setAttribute("skinIndex",r.copyVector4sArray(e.skinIndices)));0<e.skinWeights.length&&(r=new j(4*e.skinWeights.length,4),this.setAttribute("skinWeight",r.copyVector4sArray(e.skinWeights)));null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone());null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone());return this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new n);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t){e=0;for(var r=t.length;e<r;e++)as.setFromBufferAttribute(t[e]),this.morphTargetsRelative?(us.addVectors(this.boundingBox.min,as.min),this.boundingBox.expandByPoint(us),us.addVectors(this.boundingBox.max,as.max),this.boundingBox.expandByPoint(us)):(this.boundingBox.expandByPoint(as.min),this.boundingBox.expandByPoint(as.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new l);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var r=this.boundingSphere.center;as.setFromBufferAttribute(e);if(t)for(var n=0,i=t.length;n<i;n++){var o=t[n];ss.setFromBufferAttribute(o);this.morphTargetsRelative?(us.addVectors(as.min,ss.min),as.expandByPoint(us),us.addVectors(as.max,ss.max),as.expandByPoint(us)):(as.expandByPoint(ss.min),as.expandByPoint(ss.max))}as.getCenter(r);var a=0;n=0;for(i=e.count;n<i;n++)us.fromBufferAttribute(e,n),a=Math.max(a,r.distanceToSquared(us));if(t)for(n=0,i=t.length;n<i;n++){o=t[n];for(var s=this.morphTargetsRelative,u=0,c=o.count;u<c;u++)us.fromBufferAttribute(o,u),s&&(os.fromBufferAttribute(e,u),us.add(os)),a=Math.max(a,r.distanceToSquared(us))}this.boundingSphere.radius=Math.sqrt(a);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var r=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new E(new Float32Array(r.length),3));else for(var n=t.normal.array,i=0,o=n.length;i<o;i++)n[i]=0;n=t.normal.array;var a=new Te,s=new Te,u=new Te,c=new Te,l=new Te;if(e){var h=e.array;i=0;for(o=e.count;i<o;i+=3){e=3*h[i+0];var p=3*h[i+1];var f=3*h[i+2];a.fromArray(r,e);s.fromArray(r,p);u.fromArray(r,f);c.subVectors(u,s);l.subVectors(a,s);c.cross(l);n[e]+=c.x;n[e+1]+=c.y;n[e+2]+=c.z;n[p]+=c.x;n[p+1]+=c.y;n[p+2]+=c.z;n[f]+=c.x;n[f+1]+=c.y;n[f+2]+=c.z}}else for(i=0,o=r.length;i<o;i+=9)a.fromArray(r,i),s.fromArray(r,i+3),u.fromArray(r,i+6),c.subVectors(u,s),l.subVectors(a,s),c.cross(l),n[i]=c.x,n[i+1]=c.y,n[i+2]=c.z,n[i+3]=c.x,n[i+4]=c.y,n[i+5]=c.z,n[i+6]=c.x,n[i+7]=c.y,n[i+8]=c.z;this.normalizeNormals();t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var r=this.attributes,n;for(n in r)if(void 0!==e.attributes[n]){var i=r[n].array,o=e.attributes[n],a=o.array,s=o.itemSize*t;o=Math.min(a.length,i.length-s);for(var u=0;u<o;u++,s++)i[s]=a[u]}return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,r=e.count;t<r;t++)us.x=e.getX(t),us.y=e.getY(t),us.z=e.getZ(t),us.normalize(),e.setXYZ(t,us.x,us.y,us.z)},toNonIndexed:function(){function e(e,t){var r=e.array,n=e.itemSize;e=e.normalized;for(var i=new r.constructor(t.length*n),o,a=0,s=0,u=t.length;s<u;s++){o=t[s]*n;for(var c=0;c<n;c++)i[a++]=r[o++]}return new E(i,n,e)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new N,r=this.index.array,n=this.attributes,i;for(i in n){var o=n[i];o=e(o,r);t.setAttribute(i,o)}var a=this.morphAttributes;for(i in a){var s=[],u=a[i];n=0;for(var c=u.length;n<c;n++)o=u[n],o=e(o,r),s.push(o);t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;r=this.groups;n=0;for(i=r.length;n<i;n++)o=r[n],t.addGroup(o.start,o.count,o.materialIndex);return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};e.uuid=this.uuid;e.type=this.type;""!==this.name&&(e.name=this.name);0<Object.keys(this.userData).length&&(e.userData=this.userData);if(void 0!==this.parameters){var t=this.parameters;for(c in t)void 0!==t[c]&&(e[c]=t[c]);return e}e.data={attributes:{}};t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});var r=this.attributes;for(c in r){t=r[c];var n=t.toJSON();""!==t.name&&(n.name=t.name);e.data.attributes[c]=n}r={};var i=!1;for(c in this.morphAttributes){for(var o=this.morphAttributes[c],a=[],s=0,u=o.length;s<u;s++)t=o[s],n=t.toJSON(),""!==t.name&&(n.name=t.name),a.push(n);0<a.length&&(r[c]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);var c=this.groups;0<c.length&&(e.data.groups=JSON.parse(JSON.stringify(c)));c=this.boundingSphere;null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius});return e},clone:function(){return(new N).copy(this)},copy:function(e){var t;this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());r=e.attributes;for(a in r)this.setAttribute(a,r[a].clone());var n=e.morphAttributes;for(a in n){var i=[],o=n[a];r=0;for(t=o.length;r<t;r++)i.push(o[r].clone());this.morphAttributes[a]=i}this.morphTargetsRelative=e.morphTargetsRelative;var a=e.groups;r=0;for(t=a.length;r<t;r++)n=a[r],this.addGroup(n.start,n.count,n.materialIndex);a=e.boundingBox;null!==a&&(this.boundingBox=a.clone());a=e.boundingSphere;null!==a&&(this.boundingSphere=a.clone());this.drawRange.start=e.drawRange.start;this.drawRange.count=e.drawRange.count;this.userData=e.userData;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var cs=new Ee,ls=new s,hs=new l,ps=new Te,fs=new Te,ds=new Te,vs=new Te,ms=new Te,gs=new Te,_s=new Te,ys=new Te,bs=new Te,xs=new Me,ws=new Me,Ss=new Me,Ms=new Te,Cs=new Te;I.prototype=Object.assign(Object.create(f.prototype),{constructor:I,isMesh:!0,copy:function(e){f.prototype.copy.call(this,e);void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice());void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary));return this},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){e=e.morphAttributes;var t=Object.keys(e);if(0<t.length){var r=e[t[0]];if(void 0!==r)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=r.length;e<t;e++){var n=r[e].name||String(e);this.morphTargetInfluences.push(0);this.morphTargetDictionary[n]=e}}}else e=e.morphTargets,void 0!==e&&0<e.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},raycast:function(e,t){var r=this.geometry,n=this.material,i=this.matrixWorld;if(void 0!==n&&(null===r.boundingSphere&&r.computeBoundingSphere(),hs.copy(r.boundingSphere),hs.applyMatrix4(i),!1!==e.ray.intersectsSphere(hs)&&(cs.getInverse(i),ls.copy(e.ray).applyMatrix4(cs),null===r.boundingBox||!1!==ls.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o=r.index;i=r.attributes.position;var a=r.morphAttributes.position,s=r.morphTargetsRelative,u=r.attributes.uv,c=r.attributes.uv2,l=r.groups,h=r.drawRange,p,f;if(null!==o)if(Array.isArray(n)){var d=0;for(p=l.length;d<p;d++){var v=l[d];var m=n[v.materialIndex];var g=Math.max(v.start,h.start);for(f=r=Math.min(v.start+v.count,h.start+h.count);g<f;g+=3){r=o.getX(g);var _=o.getX(g+1);var y=o.getX(g+2);if(r=B(this,m,e,ls,i,a,s,u,c,r,_,y))r.faceIndex=Math.floor(g/3),r.face.materialIndex=v.materialIndex,t.push(r)}}}else for(g=Math.max(0,h.start),r=Math.min(o.count,h.start+h.count),d=g,p=r;d<p;d+=3){if(r=o.getX(d),_=o.getX(d+1),y=o.getX(d+2),r=B(this,n,e,ls,i,a,s,u,c,r,_,y))r.faceIndex=Math.floor(d/3),t.push(r)}else if(void 0!==i)if(Array.isArray(n))for(d=0,p=l.length;d<p;d++)for(v=l[d],m=n[v.materialIndex],g=Math.max(v.start,h.start),f=r=Math.min(v.start+v.count,h.start+h.count);g<f;g+=3){if(r=g,_=g+1,y=g+2,r=B(this,m,e,ls,i,a,s,u,c,r,_,y))r.faceIndex=Math.floor(g/3),r.face.materialIndex=v.materialIndex,t.push(r)}else for(g=Math.max(0,h.start),r=Math.min(i.count,h.start+h.count),d=g,p=r;d<p;d+=3)if(r=d,_=d+1,y=d+2,r=B(this,n,e,ls,i,a,s,u,c,r,_,y))r.faceIndex=Math.floor(d/3),t.push(r)}else if(r.isGeometry)for(i=Array.isArray(n),a=r.vertices,s=r.faces,r=r.faceVertexUvs[0],0<r.length&&(o=r),h=0,d=s.length;h<d;h++)if(p=s[h],r=i?n[p.materialIndex]:n,void 0!==r&&(u=a[p.a],c=a[p.b],l=a[p.c],r=D(this,r,e,ls,u,c,l,Ms)))o&&o[h]&&(v=o[h],xs.copy(v[0]),ws.copy(v[1]),Ss.copy(v[2]),r.uv=b.getUV(Ms,u,c,l,xs,ws,Ss,new Me)),r.face=p,r.faceIndex=h,t.push(r)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Ts=0,Es=new Ee,Os=new f,Ps=new Te;F.prototype=Object.assign(Object.create(t.prototype),{constructor:F,isGeometry:!0,applyMatrix4:function(e){for(var t=(new m).getNormalMatrix(e),r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);r=0;for(n=this.faces.length;r<n;r++){e=this.faces[r];e.normal.applyMatrix3(t).normalize();for(var i=0,o=e.vertexNormals.length;i<o;i++)e.vertexNormals[i].applyMatrix3(t).normalize()}null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();this.normalsNeedUpdate=this.verticesNeedUpdate=!0;return this},rotateX:function(e){Es.makeRotationX(e);this.applyMatrix4(Es);return this},rotateY:function(e){Es.makeRotationY(e);this.applyMatrix4(Es);return this},rotateZ:function(e){Es.makeRotationZ(e);this.applyMatrix4(Es);return this},translate:function(e,t,r){Es.makeTranslation(e,t,r);this.applyMatrix4(Es);return this},scale:function(e,t,r){Es.makeScale(e,t,r);this.applyMatrix4(Es);return this},lookAt:function(e){Os.lookAt(e);Os.updateMatrix();this.applyMatrix4(Os.matrix);return this},fromBufferGeometry:function(e){function t(e,t,r,n){var i=void 0===u?[]:[a.colors[e].clone(),a.colors[t].clone(),a.colors[r].clone()],o=void 0===s?[]:[(new Te).fromArray(s,3*e),(new Te).fromArray(s,3*t),(new Te).fromArray(s,3*r)];n=new _(e,t,r,o,i,n);a.faces.push(n);void 0!==c&&a.faceVertexUvs[0].push([(new Me).fromArray(c,2*e),(new Me).fromArray(c,2*t),(new Me).fromArray(c,2*r)]);void 0!==l&&a.faceVertexUvs[1].push([(new Me).fromArray(l,2*e),(new Me).fromArray(l,2*t),(new Me).fromArray(l,2*r)])}var a=this,r=null!==e.index?e.index.array:void 0,n=e.attributes;if(void 0===n.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=n.position.array,s=void 0!==n.normal?n.normal.array:void 0,u=void 0!==n.color?n.color.array:void 0,c=void 0!==n.uv?n.uv.array:void 0,l=void 0!==n.uv2?n.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(n=0;n<i.length;n+=3)a.vertices.push((new Te).fromArray(i,n)),void 0!==u&&a.colors.push((new v).fromArray(u,n));var o=e.groups;if(0<o.length)for(n=0;n<o.length;n++){i=o[n];var h=i.start,p=h;for(h+=i.count;p<h;p+=3)void 0!==r?t(r[p],r[p+1],r[p+2],i.materialIndex):t(p,p+1,p+2,i.materialIndex)}else if(void 0!==r)for(n=0;n<r.length;n+=3)t(r[n],r[n+1],r[n+2]);else for(n=0;n<i.length/3;n+=3)t(n,n+1,n+2);this.computeFaceNormals();null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone());null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();this.boundingBox.getCenter(Ps).negate();this.translate(Ps.x,Ps.y,Ps.z);return this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius;t=0===t?1:1/t;var r=new Ee;r.set(t,0,0,-t*e.x,0,t,0,-t*e.y,0,0,t,-t*e.z,0,0,0,1);this.applyMatrix4(r);return this},computeFaceNormals:function(){for(var e=new Te,t=new Te,r=0,n=this.faces.length;r<n;r++){var i=this.faces[r],o=this.vertices[i.a],a=this.vertices[i.b];e.subVectors(this.vertices[i.c],a);t.subVectors(o,a);e.cross(t);e.normalize();i.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t;var r=Array(this.vertices.length);var n=0;for(t=this.vertices.length;n<t;n++)r[n]=new Te;if(e){var i=new Te,o=new Te;e=0;for(n=this.faces.length;e<n;e++){t=this.faces[e];var a=this.vertices[t.a];var s=this.vertices[t.b];var u=this.vertices[t.c];i.subVectors(u,s);o.subVectors(a,s);i.cross(o);r[t.a].add(i);r[t.b].add(i);r[t.c].add(i)}}else for(this.computeFaceNormals(),e=0,n=this.faces.length;e<n;e++)t=this.faces[e],r[t.a].add(t.normal),r[t.b].add(t.normal),r[t.c].add(t.normal);n=0;for(t=this.vertices.length;n<t;n++)r[n].normalize();e=0;for(n=this.faces.length;e<n;e++)t=this.faces[e],a=t.vertexNormals,3===a.length?(a[0].copy(r[t.a]),a[1].copy(r[t.b]),a[2].copy(r[t.c])):(a[0]=r[t.a].clone(),a[1]=r[t.b].clone(),a[2]=r[t.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e;this.computeFaceNormals();var t=0;for(e=this.faces.length;t<e;t++){var r=this.faces[t];var n=r.vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t;var r=0;for(t=this.faces.length;r<t;r++){var n=this.faces[r];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone();n.__originalVertexNormals||(n.__originalVertexNormals=[]);var i=0;for(e=n.vertexNormals.length;i<e;i++)n.__originalVertexNormals[i]?n.__originalVertexNormals[i].copy(n.vertexNormals[i]):n.__originalVertexNormals[i]=n.vertexNormals[i].clone()}var o=new F;o.faces=this.faces;i=0;for(e=this.morphTargets.length;i<e;i++){if(!this.morphNormals[i]){this.morphNormals[i]={};this.morphNormals[i].faceNormals=[];this.morphNormals[i].vertexNormals=[];n=this.morphNormals[i].faceNormals;var a=this.morphNormals[i].vertexNormals;r=0;for(t=this.faces.length;r<t;r++){var s=new Te;var u={a:new Te,b:new Te,c:new Te};n.push(s);a.push(u)}}a=this.morphNormals[i];o.vertices=this.morphTargets[i].vertices;o.computeFaceNormals();o.computeVertexNormals();r=0;for(t=this.faces.length;r<t;r++)n=this.faces[r],s=a.faceNormals[r],u=a.vertexNormals[r],s.copy(n.normal),u.a.copy(n.vertexNormals[0]),u.b.copy(n.vertexNormals[1]),u.c.copy(n.vertexNormals[2])}r=0;for(t=this.faces.length;r<t;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new n);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new l);this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e&&e.isGeometry){var n,i=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,u=e.faces,c=this.colors,l=e.colors;void 0===r&&(r=0);void 0!==t&&(n=(new m).getNormalMatrix(t));for(var h=0,p=a.length;h<p;h++){var f=a[h].clone();void 0!==t&&f.applyMatrix4(t);o.push(f)}h=0;for(p=l.length;h<p;h++)c.push(l[h].clone());h=0;for(p=u.length;h<p;h++){a=u[h];var d=a.vertexNormals;l=a.vertexColors;c=new _(a.a+i,a.b+i,a.c+i);c.normal.copy(a.normal);void 0!==n&&c.normal.applyMatrix3(n).normalize();t=0;for(o=d.length;t<o;t++)f=d[t].clone(),void 0!==n&&f.applyMatrix3(n).normalize(),c.vertexNormals.push(f);c.color.copy(a.color);t=0;for(o=l.length;t<o;t++)f=l[t],c.vertexColors.push(f.clone());c.materialIndex=a.materialIndex+r;s.push(c)}h=0;for(p=e.faceVertexUvs.length;h<p;h++)for(r=e.faceVertexUvs[h],void 0===this.faceVertexUvs[h]&&(this.faceVertexUvs[h]=[]),t=0,o=r.length;t<o;t++){n=r[t];i=[];s=0;for(u=n.length;s<u;s++)i.push(n[s].clone());this.faceVertexUvs[h].push(i)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e={},t=[],r=[],n=Math.pow(10,4),i;var o=0;for(i=this.vertices.length;o<i;o++){var a=this.vertices[o];a=Math.round(a.x*n)+"_"+Math.round(a.y*n)+"_"+Math.round(a.z*n);void 0===e[a]?(e[a]=o,t.push(this.vertices[o]),r[o]=t.length-1):r[o]=r[e[a]]}e=[];o=0;for(i=this.faces.length;o<i;o++)for(n=this.faces[o],n.a=r[n.a],n.b=r[n.b],n.c=r[n.c],n=[n.a,n.b,n.c],a=0;3>a;a++)if(n[a]===n[(a+1)%3]){e.push(o);break}for(o=e.length-1;0<=o;o--)for(n=e[o],this.faces.splice(n,1),r=0,i=this.faceVertexUvs.length;r<i;r++)this.faceVertexUvs[r].splice(n,1);o=this.vertices.length-t.length;this.vertices=t;return o},setFromPoints:function(e){this.vertices=[];for(var t=0,r=e.length;t<r;t++){var n=e[t];this.vertices.push(new Te(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;r<t;r++)e[r]._id=r;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var n=this.faceVertexUvs[0],i=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]);i&&i.length===t&&(a=[]);for(r=0;r<t;r++){var s=e[r]._id;o&&o.push(n[s]);a&&a.push(i[s])}o&&(this.faceVertexUvs[0]=o);a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();if(void 0!==c[t])return c[t];c[t]=u.length/3;u.push(e.x,e.y,e.z);return c[t]}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();if(void 0!==h[t])return h[t];h[t]=l.length;l.push(e.getHex());return h[t]}function n(e){var t=e.x.toString()+e.y.toString();if(void 0!==f[t])return f[t];f[t]=p.length/2;p.push(e.x,e.y);return f[t]}var i={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};i.uuid=this.uuid;i.type=this.type;""!==this.name&&(i.name=this.name);if(void 0!==this.parameters){var o=this.parameters,a;for(a in o)void 0!==o[a]&&(i[a]=o[a]);return i}o=[];for(a=0;a<this.vertices.length;a++){var s=this.vertices[a];o.push(s.x,s.y,s.z)}s=[];var u=[],c={},l=[],h={},p=[],f={};for(a=0;a<this.faces.length;a++){var d=this.faces[a],v=void 0!==this.faceVertexUvs[0][a],m=0<d.normal.length(),g=0<d.vertexNormals.length,_=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=0<d.vertexColors.length,b=0;b=e(b,0,0);b=e(b,1,!0);b=e(b,2,!1);b=e(b,3,v);b=e(b,4,m);b=e(b,5,g);b=e(b,6,_);b=e(b,7,y);s.push(b);s.push(d.a,d.b,d.c);s.push(d.materialIndex);v&&(v=this.faceVertexUvs[0][a],s.push(n(v[0]),n(v[1]),n(v[2])));m&&s.push(t(d.normal));g&&(m=d.vertexNormals,s.push(t(m[0]),t(m[1]),t(m[2])));_&&s.push(r(d.color));y&&(d=d.vertexColors,s.push(r(d[0]),r(d[1]),r(d[2])))}i.data={};i.data.vertices=o;i.data.normals=u;0<l.length&&(i.data.colors=l);0<p.length&&(i.data.uvs=[p]);i.data.faces=s;return i},clone:function(){return(new F).copy(this)},copy:function(e){var t,r,n;this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.name=e.name;var i=e.vertices;var o=0;for(t=i.length;o<t;o++)this.vertices.push(i[o].clone());i=e.colors;o=0;for(t=i.length;o<t;o++)this.colors.push(i[o].clone());i=e.faces;o=0;for(t=i.length;o<t;o++)this.faces.push(i[o].clone());o=0;for(t=e.faceVertexUvs.length;o<t;o++){var a=e.faceVertexUvs[o];void 0===this.faceVertexUvs[o]&&(this.faceVertexUvs[o]=[]);i=0;for(r=a.length;i<r;i++){var s=a[i],u=[];var c=0;for(n=s.length;c<n;c++)u.push(s[c].clone());this.faceVertexUvs[o].push(u)}}c=e.morphTargets;o=0;for(t=c.length;o<t;o++){n={};n.name=c[o].name;if(void 0!==c[o].vertices)for(n.vertices=[],i=0,r=c[o].vertices.length;i<r;i++)n.vertices.push(c[o].vertices[i].clone());if(void 0!==c[o].normals)for(n.normals=[],i=0,r=c[o].normals.length;i<r;i++)n.normals.push(c[o].normals[i].clone());this.morphTargets.push(n)}c=e.morphNormals;o=0;for(t=c.length;o<t;o++){n={};if(void 0!==c[o].vertexNormals)for(n.vertexNormals=[],i=0,r=c[o].vertexNormals.length;i<r;i++)a=c[o].vertexNormals[i],s={},s.a=a.a.clone(),s.b=a.b.clone(),s.c=a.c.clone(),n.vertexNormals.push(s);if(void 0!==c[o].faceNormals)for(n.faceNormals=[],i=0,r=c[o].faceNormals.length;i<r;i++)n.faceNormals.push(c[o].faceNormals[i].clone());this.morphNormals.push(n)}i=e.skinWeights;o=0;for(t=i.length;o<t;o++)this.skinWeights.push(i[o].clone());i=e.skinIndices;o=0;for(t=i.length;o<t;o++)this.skinIndices.push(i[o].clone());i=e.lineDistances;o=0;for(t=i.length;o<t;o++)this.lineDistances.push(i[o]);o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());o=e.boundingSphere;null!==o&&(this.boundingSphere=o.clone());this.elementsNeedUpdate=e.elementsNeedUpdate;this.verticesNeedUpdate=e.verticesNeedUpdate;this.uvsNeedUpdate=e.uvsNeedUpdate;this.normalsNeedUpdate=e.normalsNeedUpdate;this.colorsNeedUpdate=e.colorsNeedUpdate;this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate;this.groupsNeedUpdate=e.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var As=function(a){function e(e,t,r,n,i,o){a.call(this);this.type="BoxGeometry";this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:o};this.fromBufferGeometry(new js(e,t,r,n,i,o));this.mergeVertices()}a&&(e.__proto__=a);e.prototype=Object.create(a&&a.prototype);return e.prototype.constructor=e}(F),js=function(s){function e(e,t,r,n,i,o){function a(e,t,r,n,i,o,a,s,u,c,l){var h=o/u,p=a/c,f=o/2,d=a/2,v=s/2;a=u+1;for(var m=c+1,g=o=0,_=new Te,y=0;y<m;y++)for(var b=y*p-d,x=0;x<a;x++)_[e]=(x*h-f)*n,_[t]=b*i,_[r]=v,M.push(_.x,_.y,_.z),_[e]=0,_[t]=0,_[r]=0<s?1:-1,C.push(_.x,_.y,_.z),T.push(x/u),T.push(1-y/c),o+=1;for(e=0;e<c;e++)for(t=0;t<u;t++)r=E+t+a*(e+1),n=E+(t+1)+a*(e+1),i=E+(t+1)+a*e,S.push(E+t+a*e,r,i),S.push(r,n,i),g+=6;w.addGroup(O,g,l);O+=g;E+=o}s.call(this);this.type="BoxBufferGeometry";this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:o};var w=this;e=e||1;t=t||1;r=r||1;n=Math.floor(n)||1;i=Math.floor(i)||1;o=Math.floor(o)||1;var S=[],M=[],C=[],T=[],E=0,O=0;a("z","y","x",-1,-1,r,t,e,o,i,0);a("z","y","x",1,-1,r,t,-e,o,i,1);a("x","z","y",1,1,e,r,t,n,o,2);a("x","z","y",1,-1,e,r,-t,n,o,3);a("x","y","z",1,-1,e,t,r,n,i,4);a("x","y","z",-1,-1,e,t,-r,n,i,5);this.setIndex(S);this.setAttribute("position",new j(M,3));this.setAttribute("normal",new j(C,3));this.setAttribute("uv",new j(T,2))}s&&(e.__proto__=s);e.prototype=Object.create(s&&s.prototype);return e.prototype.constructor=e}(N),Rs={clone:z,merge:$};G.prototype=Object.create(y.prototype);G.prototype.constructor=G;G.prototype.isShaderMaterial=!0;G.prototype.copy=function(e){y.prototype.copy.call(this,e);this.fragmentShader=e.fragmentShader;this.vertexShader=e.vertexShader;this.uniforms=z(e.uniforms);this.defines=Object.assign({},e.defines);this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;this.lights=e.lights;this.clipping=e.clipping;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.morphNormals=e.morphNormals;this.extensions=Object.assign({},e.extensions);return this};G.prototype.toJSON=function(e){var t=y.prototype.toJSON.call(this,e);t.uniforms={};for(var r in this.uniforms){var n=this.uniforms[r].value;t.uniforms[r]=n&&n.isTexture?{type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?{type:"c",value:n.getHex()}:n&&n.isVector2?{type:"v2",value:n.toArray()}:n&&n.isVector3?{type:"v3",value:n.toArray()}:n&&n.isVector4?{type:"v4",value:n.toArray()}:n&&n.isMatrix3?{type:"m3",value:n.toArray()}:n&&n.isMatrix4?{type:"m4",value:n.toArray()}:{value:n}}0<Object.keys(this.defines).length&&(t.defines=this.defines);t.vertexShader=this.vertexShader;t.fragmentShader=this.fragmentShader;e={};for(var i in this.extensions)!0===this.extensions[i]&&(e[i]=!0);0<Object.keys(e).length&&(t.extensions=e);return t};V.prototype=Object.assign(Object.create(f.prototype),{constructor:V,isCamera:!0,copy:function(e,t){f.prototype.copy.call(this,e,t);this.matrixWorldInverse.copy(e.matrixWorldInverse);this.projectionMatrix.copy(e.projectionMatrix);this.projectionMatrixInverse.copy(e.projectionMatrixInverse);return this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Te);this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){f.prototype.updateMatrixWorld.call(this,e);this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){f.prototype.updateWorldMatrix.call(this,e,t);this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}});H.prototype=Object.assign(Object.create(V.prototype),{constructor:H,isPerspectiveCamera:!0,copy:function(e,t){V.prototype.copy.call(this,e,t);this.fov=e.fov;this.zoom=e.zoom;this.near=e.near;this.far=e.far;this.focus=e.focus;this.aspect=e.aspect;this.view=null===e.view?null:Object.assign({},e.view);this.filmGauge=e.filmGauge;this.filmOffset=e.filmOffset;return this},setFocalLength:function(e){e=.5*this.getFilmHeight()/e;this.fov=2*Vo.RAD2DEG*Math.atan(e);this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Vo.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Vo.RAD2DEG*Math.atan(Math.tan(.5*Vo.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,r,n,i,o){this.aspect=e/t;null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1});this.view.enabled=!0;this.view.fullWidth=e;this.view.fullHeight=t;this.view.offsetX=r;this.view.offsetY=n;this.view.width=i;this.view.height=o;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Vo.DEG2RAD*this.fov)/this.zoom,r=2*t,n=this.aspect*r,i=-.5*n,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;i+=o.offsetX*n/a;t-=o.offsetY*r/s;n*=o.width/a;r*=o.height/s}o=this.filmOffset;0!==o&&(i+=e*o/this.getFilmWidth());this.projectionMatrix.makePerspective(i,i+n,t,t-r,e,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){e=f.prototype.toJSON.call(this,e);e.object.fov=this.fov;e.object.zoom=this.zoom;e.object.near=this.near;e.object.far=this.far;e.object.focus=this.focus;e.object.aspect=this.aspect;null!==this.view&&(e.object.view=Object.assign({},this.view));e.object.filmGauge=this.filmGauge;e.object.filmOffset=this.filmOffset;return e}});U.prototype=Object.create(f.prototype);U.prototype.constructor=U;q.prototype=Object.create(T.prototype);q.prototype.constructor=q;q.prototype.isWebGLCubeRenderTarget=!0;q.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type;this.texture.format=t.format;this.texture.encoding=t.encoding;var r=new Oe,n=new G({type:"CubemapFromEquirect",uniforms:z({tEquirect:{value:null}}),vertexShader:"varying vec3 vWorldDirection;\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}",side:1,blending:0});n.uniforms.tEquirect.value=t;t=new I(new js(5,5,5),n);r.add(t);new U(1,10,this).update(e,r);t.geometry.dispose();t.material.dispose();return this};Pe.prototype=Object.create(p.prototype);Pe.prototype.constructor=Pe;Pe.prototype.isDataTexture=!0;var ks=new l,Ls=new Te;Object.assign(Ae.prototype,{set:function(e,t,r,n,i,o){var a=this.planes;a[0].copy(e);a[1].copy(t);a[2].copy(r);a[3].copy(n);a[4].copy(i);a[5].copy(o);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromProjectionMatrix:function(e){var t=this.planes,r=e.elements;e=r[0];var n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],l=r[8],h=r[9],p=r[10],f=r[11],d=r[12],v=r[13],m=r[14];r=r[15];t[0].setComponents(o-e,c-a,f-l,r-d).normalize();t[1].setComponents(o+e,c+a,f+l,r+d).normalize();t[2].setComponents(o+n,c+s,f+h,r+v).normalize();t[3].setComponents(o-n,c-s,f-h,r-v).normalize();t[4].setComponents(o-i,c-u,f-p,r-m).normalize();t[5].setComponents(o+i,c+u,f+p,r+m).normalize();return this},intersectsObject:function(e){var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere();ks.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);return this.intersectsSphere(ks)},intersectsSprite:function(e){ks.center.set(0,0,0);ks.radius=.7071067811865476;ks.applyMatrix4(e.matrixWorld);return this.intersectsSphere(ks)},intersectsSphere:function(e){var t=this.planes,r=e.center;e=-e.radius;for(var n=0;6>n;n++)if(t[n].distanceToPoint(r)<e)return!1;return!0},intersectsBox:function(e){for(var t=this.planes,r=0;6>r;r++){var n=t[r];Ls.x=0<n.normal.x?e.max.x:e.min.x;Ls.y=0<n.normal.y?e.max.y:e.min.y;Ls.z=0<n.normal.z?e.max.z:e.min.z;if(0>n.distanceToPoint(Ls))return!1}return!0},containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}});var Ns={common:{diffuse:{value:new v(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new m},uv2Transform:{value:new m},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Me(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new v(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new v(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new m}},sprite:{diffuse:{value:new v(15658734)},opacity:{value:1},center:{value:new Me(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new m}}};W.prototype=Object.create(F.prototype);W.prototype.constructor=W;X.prototype=Object.create(N.prototype);X.prototype.constructor=X;var Is={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE  = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS  = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha  = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n  return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n    vec3 absDirection = abs(direction);\n    float face = -1.0;\n    if (absDirection.x > absDirection.z) {\n      if (absDirection.x > absDirection.y)\n        face = direction.x > 0.0 ? 0.0 : 3.0;\n      else\n        face = direction.y > 0.0 ? 1.0 : 4.0;\n    } else {\n      if (absDirection.z > absDirection.y)\n        face = direction.z > 0.0 ? 2.0 : 5.0;\n      else\n        face = direction.y > 0.0 ? 1.0 : 4.0;\n    }\n    return face;\n}\nvec2 getUV(vec3 direction, float face) {\n    vec2 uv;\n    if (face == 0.0) {\n      uv = vec2(direction.z, direction.y) / abs(direction.x);    } else if (face == 1.0) {\n      uv = vec2(-direction.x, -direction.z) / abs(direction.y);    } else if (face == 2.0) {\n      uv = vec2(-direction.x, direction.y) / abs(direction.z);    } else if (face == 3.0) {\n      uv = vec2(-direction.z, direction.y) / abs(direction.x);    } else if (face == 4.0) {\n      uv = vec2(-direction.x, direction.z) / abs(direction.y);    } else {\n      uv = vec2(direction.x, direction.y) / abs(direction.z);    }\n    return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n  float face = getFace(direction);\n  float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n  mipInt = max(mipInt, cubeUV_minMipLevel);\n  float faceSize = exp2(mipInt);\n  float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n  vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n  vec2 f = fract(uv);\n  uv += 0.5 - f;\n  if (face > 2.0) {\n    uv.y += faceSize;\n    face -= 3.0;\n  }\n  uv.x += face * faceSize;\n  if(mipInt < cubeUV_maxMipLevel){\n    uv.y += 2.0 * cubeUV_maxTileSize;\n  }\n  uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n  uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n  uv *= texelSize;\n  vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  uv.x += texelSize;\n  vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  uv.y += texelSize;\n  vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  uv.x -= texelSize;\n  vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  vec3 tm = mix(tl, tr, f.x);\n  vec3 bm = mix(bl, br, f.x);\n  return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n  float mip = 0.0;\n  if (roughness >= r1) {\n    mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n  } else if (roughness >= r4) {\n    mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n  } else if (roughness >= r5) {\n    mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n  } else if (roughness >= r6) {\n    mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n  } else {\n    mip = -2.0 * log2(1.16 * roughness);  }\n  return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n  float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n  float mipF = fract(mip);\n  float mipInt = floor(mip);\n  vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n  if (mipF == 0.0) {\n    return vec4(color0, 1.0);\n  } else {\n    vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n    return vec4(mix(color0, color1, mipF), 1.0);\n  }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t}  else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t  vec3 reflectVec = reflect( -viewDir, normal );\n\t\t  reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Ds={basic:{uniforms:$([Ns.common,Ns.specularmap,Ns.envmap,Ns.aomap,Ns.lightmap,Ns.fog]),vertexShader:Is.meshbasic_vert,fragmentShader:Is.meshbasic_frag},lambert:{uniforms:$([Ns.common,Ns.specularmap,Ns.envmap,Ns.aomap,Ns.lightmap,Ns.emissivemap,Ns.fog,Ns.lights,{emissive:{value:new v(0)}}]),vertexShader:Is.meshlambert_vert,fragmentShader:Is.meshlambert_frag},phong:{uniforms:$([Ns.common,Ns.specularmap,Ns.envmap,Ns.aomap,Ns.lightmap,Ns.emissivemap,Ns.bumpmap,Ns.normalmap,Ns.displacementmap,Ns.fog,Ns.lights,{emissive:{value:new v(0)},specular:{value:new v(1118481)},shininess:{value:30}}]),vertexShader:Is.meshphong_vert,fragmentShader:Is.meshphong_frag},standard:{uniforms:$([Ns.common,Ns.envmap,Ns.aomap,Ns.lightmap,Ns.emissivemap,Ns.bumpmap,Ns.normalmap,Ns.displacementmap,Ns.roughnessmap,Ns.metalnessmap,Ns.fog,Ns.lights,{emissive:{value:new v(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Is.meshphysical_vert,fragmentShader:Is.meshphysical_frag},toon:{uniforms:$([Ns.common,Ns.specularmap,Ns.aomap,Ns.lightmap,Ns.emissivemap,Ns.bumpmap,Ns.normalmap,Ns.displacementmap,Ns.gradientmap,Ns.fog,Ns.lights,{emissive:{value:new v(0)},specular:{value:new v(1118481)},shininess:{value:30}}]),vertexShader:Is.meshtoon_vert,fragmentShader:Is.meshtoon_frag},matcap:{uniforms:$([Ns.common,Ns.bumpmap,Ns.normalmap,Ns.displacementmap,Ns.fog,{matcap:{value:null}}]),vertexShader:Is.meshmatcap_vert,fragmentShader:Is.meshmatcap_frag},points:{uniforms:$([Ns.points,Ns.fog]),vertexShader:Is.points_vert,fragmentShader:Is.points_frag},dashed:{uniforms:$([Ns.common,Ns.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Is.linedashed_vert,fragmentShader:Is.linedashed_frag},depth:{uniforms:$([Ns.common,Ns.displacementmap]),vertexShader:Is.depth_vert,fragmentShader:Is.depth_frag},normal:{uniforms:$([Ns.common,Ns.bumpmap,Ns.normalmap,Ns.displacementmap,{opacity:{value:1}}]),vertexShader:Is.normal_vert,fragmentShader:Is.normal_frag},sprite:{uniforms:$([Ns.sprite,Ns.fog]),vertexShader:Is.sprite_vert,fragmentShader:Is.sprite_frag},background:{uniforms:{uvTransform:{value:new m},t2D:{value:null}},vertexShader:Is.background_vert,fragmentShader:Is.background_frag},cube:{uniforms:$([Ns.envmap,{opacity:{value:1}}]),vertexShader:Is.cube_vert,fragmentShader:Is.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Is.equirect_vert,fragmentShader:Is.equirect_frag},distanceRGBA:{uniforms:$([Ns.common,Ns.displacementmap,{referencePosition:{value:new Te},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Is.distanceRGBA_vert,fragmentShader:Is.distanceRGBA_frag},shadow:{uniforms:$([Ns.lights,Ns.fog,{color:{value:new v(0)},opacity:{value:1}}]),vertexShader:Is.shadow_vert,fragmentShader:Is.shadow_frag}};Ds.physical={uniforms:$([Ds.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Me(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new v(0)},transparency:{value:0}}]),vertexShader:Is.meshphysical_vert,fragmentShader:Is.meshphysical_frag};K.prototype=Object.create(p.prototype);K.prototype.constructor=K;K.prototype.isCubeTexture=!0;Object.defineProperty(K.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});Z.prototype=Object.create(p.prototype);Z.prototype.constructor=Z;Z.prototype.isDataTexture2DArray=!0;J.prototype=Object.create(p.prototype);J.prototype.constructor=J;J.prototype.isDataTexture3D=!0;var Bs=new p,Fs=new Z,zs=new J,$s=new K,Gs=[],Vs=[],Hs=new Float32Array(16),Us=new Float32Array(9),qs=new Float32Array(4);et.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length));te(t,e)};tt.prototype.setValue=function(e,t,r){for(var n=this.seq,i=0,o=n.length;i!==o;++i){var a=n[i];a.setValue(e,t[a.id],r)}};var Ws=/([\w\d_]+)(\])?(\[|\.)?/g;rt.prototype.setValue=function(e,t,r,n){t=this.map[t];void 0!==t&&t.setValue(e,r,n)};rt.prototype.setOptional=function(e,t,r){t=t[r];void 0!==t&&this.setValue(e,r,t)};rt.upload=function(e,t,r,n){for(var i=0,o=t.length;i!==o;++i){var a=t[i],s=r[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}};rt.seqWithValue=function(e,t){for(var r=[],n=0,i=e.length;n!==i;++n){var o=e[n];o.id in t&&r.push(o)}return r};var Xs=0,Ys=/^[ \t]*#include +<([\w\d./]+)>/gm,Ks=/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Zs=/#pragma unroll_loop_start[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g,Js=0;Lt.prototype=Object.create(y.prototype);Lt.prototype.constructor=Lt;Lt.prototype.isMeshDepthMaterial=!0;Lt.prototype.copy=function(e){y.prototype.copy.call(this,e);this.depthPacking=e.depthPacking;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.map=e.map;this.alphaMap=e.alphaMap;this.displacementMap=e.displacementMap;this.displacementScale=e.displacementScale;this.displacementBias=e.displacementBias;this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;return this};Nt.prototype=Object.create(y.prototype);Nt.prototype.constructor=Nt;Nt.prototype.isMeshDistanceMaterial=!0;Nt.prototype.copy=function(e){y.prototype.copy.call(this,e);this.referencePosition.copy(e.referencePosition);this.nearDistance=e.nearDistance;this.farDistance=e.farDistance;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.map=e.map;this.alphaMap=e.alphaMap;this.displacementMap=e.displacementMap;this.displacementScale=e.displacementScale;this.displacementBias=e.displacementBias;return this};zt.prototype=Object.assign(Object.create(H.prototype),{constructor:zt,isArrayCamera:!0});$t.prototype=Object.assign(Object.create(f.prototype),{constructor:$t,isGroup:!0});Object.assign(Gt.prototype,{constructor:Gt,getTargetRaySpace:function(){null===this._targetRay&&(this._targetRay=new $t,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1);return this._targetRay},getGripSpace:function(){null===this._grip&&(this._grip=new $t,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1);return this._grip},dispatchEvent:function(e){null!==this._targetRay&&this._targetRay.dispatchEvent(e);null!==this._grip&&this._grip.dispatchEvent(e);return this},disconnect:function(e){this.dispatchEvent({type:"disconnected",data:e});null!==this._targetRay&&(this._targetRay.visible=!1);null!==this._grip&&(this._grip.visible=!1);return this},update:function(e,t,r){var n=null,i=null,o=this._targetRay,a=this._grip;e&&(null!==o&&(n=t.getPose(e.targetRaySpace,r),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&e.gripSpace&&(i=t.getPose(e.gripSpace,r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))));null!==o&&(o.visible=null!==n);null!==a&&(a.visible=null!==i);return this}});Object.assign(Vt.prototype,t.prototype);Object.assign(qt.prototype,{isFogExp2:!0,clone:function(){return new qt(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});Object.assign(Wt.prototype,{isFog:!0,clone:function(){return new Wt(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});Object.defineProperty(Xt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});Object.assign(Xt.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){this.usage=e;return this},copy:function(e){this.array=new e.array.constructor(e.array);this.count=e.count;this.stride=e.stride;this.usage=e.usage;return this},copyAt:function(e,t,r){e*=this.stride;r*=t.stride;for(var n=0,i=this.stride;n<i;n++)this.array[e+n]=t.array[r+n];return this},set:function(e,t){void 0===t&&(t=0);this.array.set(e,t);return this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){this.onUploadCallback=e;return this}});var Qs=new Te;Object.defineProperties(Yt.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}});Object.assign(Yt.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,r=this.data.count;t<r;t++)Qs.x=this.getX(t),Qs.y=this.getY(t),Qs.z=this.getZ(t),Qs.applyMatrix4(e),this.setXYZ(t,Qs.x,Qs.y,Qs.z);return this},setX:function(e,t){this.data.array[e*this.data.stride+this.offset]=t;return this},setY:function(e,t){this.data.array[e*this.data.stride+this.offset+1]=t;return this},setZ:function(e,t){this.data.array[e*this.data.stride+this.offset+2]=t;return this},setW:function(e,t){this.data.array[e*this.data.stride+this.offset+3]=t;return this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){e=e*this.data.stride+this.offset;this.data.array[e+0]=t;this.data.array[e+1]=r;return this},setXYZ:function(e,t,r,n){e=e*this.data.stride+this.offset;this.data.array[e+0]=t;this.data.array[e+1]=r;this.data.array[e+2]=n;return this},setXYZW:function(e,t,r,n,i){e=e*this.data.stride+this.offset;this.data.array[e+0]=t;this.data.array[e+1]=r;this.data.array[e+2]=n;this.data.array[e+3]=i;return this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var r=t*this.data.stride+this.offset,n=0;n<this.itemSize;n++)e.push(this.data.array[r+n]);return new E(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var r=t*this.data.stride+this.offset,n=0;n<this.itemSize;n++)e.push(this.data.array[r+n]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}});Kt.prototype=Object.create(y.prototype);Kt.prototype.constructor=Kt;Kt.prototype.isSpriteMaterial=!0;Kt.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);this.map=e.map;this.alphaMap=e.alphaMap;this.rotation=e.rotation;this.sizeAttenuation=e.sizeAttenuation;return this};var eu,tu=new Te,ru=new Te,nu=new Te,iu=new Me,ou=new Me,au=new Ee,su=new Te,uu=new Te,cu=new Te,lu=new Me,hu=new Me,pu=new Me;Zt.prototype=Object.assign(Object.create(f.prototype),{constructor:Zt,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');ru.setFromMatrixScale(this.matrixWorld);au.copy(e.camera.matrixWorld);this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld);nu.setFromMatrixPosition(this.modelViewMatrix);e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ru.multiplyScalar(-nu.z);var r=this.material.rotation;if(0!==r){var n=Math.cos(r);var i=Math.sin(r)}r=this.center;Jt(su.set(-.5,-.5,0),nu,r,ru,i,n);Jt(uu.set(.5,-.5,0),nu,r,ru,i,n);Jt(cu.set(.5,.5,0),nu,r,ru,i,n);lu.set(0,0);hu.set(1,0);pu.set(1,1);var o=e.ray.intersectTriangle(su,uu,cu,!1,tu);if(null===o&&(Jt(uu.set(-.5,.5,0),nu,r,ru,i,n),hu.set(0,1),o=e.ray.intersectTriangle(su,cu,uu,!1,tu),null===o))return;i=e.ray.origin.distanceTo(tu);i<e.near||i>e.far||t.push({distance:i,point:tu.clone(),uv:b.getUV(tu,su,uu,cu,lu,hu,pu,new Me),face:null,object:this})},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){f.prototype.copy.call(this,e);void 0!==e.center&&this.center.copy(e.center);return this}});var fu=new Te,du=new Te;Qt.prototype=Object.assign(Object.create(f.prototype),{constructor:Qt,isLOD:!0,copy:function(e){f.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,n=t.length;r<n;r++){var i=t[r];this.addLevel(i.object.clone(),i.distance)}this.autoUpdate=e.autoUpdate;return this},addLevel:function(e,t){void 0===t&&(t=0);t=Math.abs(t);for(var r=this.levels,n=0;n<r.length&&!(t<r[n].distance);n++);r.splice(n,0,{distance:t,object:e});this.add(e);return this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(0<t.length){for(var r=1,n=t.length;r<n&&!(e<t[r].distance);r++);return t[r-1].object}return null},raycast:function(e,t){if(0<this.levels.length){fu.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(fu);this.getObjectForDistance(r).raycast(e,t)}},update:function(e){var t=this.levels;if(1<t.length){fu.setFromMatrixPosition(e.matrixWorld);du.setFromMatrixPosition(this.matrixWorld);e=fu.distanceTo(du)/e.zoom;t[0].object.visible=!0;for(var r=1,n=t.length;r<n;r++)if(e>=t[r].distance)t[r-1].object.visible=!1,t[r].object.visible=!0;else break;for(this._currentLevel=r-1;r<n;r++)t[r].object.visible=!1}},toJSON:function(e){e=f.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(e.object.autoUpdate=!1);e.object.levels=[];for(var t=this.levels,r=0,n=t.length;r<n;r++){var i=t[r];e.object.levels.push({object:i.object.uuid,distance:i.distance})}return e}});er.prototype=Object.assign(Object.create(I.prototype),{constructor:er,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e;void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld);this.bindMatrix.copy(t);this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Ce,t=this.geometry.attributes.skinWeight,r=0,n=t.count;r<n;r++){e.x=t.getX(r);e.y=t.getY(r);e.z=t.getZ(r);e.w=t.getW(r);var i=1/e.manhattanLength();Infinity!==i?e.multiplyScalar(i):e.set(1,0,0,0);t.setXYZW(r,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){I.prototype.updateMatrixWorld.call(this,e);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var o=new Te,a=new Ce,s=new Ce,u=new Te,c=new Ee;return function(e,t){var r=this.skeleton,n=this.geometry;a.fromBufferAttribute(n.attributes.skinIndex,e);s.fromBufferAttribute(n.attributes.skinWeight,e);o.fromBufferAttribute(n.attributes.position,e).applyMatrix4(this.bindMatrix);t.set(0,0,0);for(e=0;4>e;e++)if(n=s.getComponent(e),0!==n){var i=a.getComponent(e);c.multiplyMatrices(r.bones[i].matrixWorld,r.boneInverses[i]);t.addScaledVector(u.copy(o).applyMatrix4(c),n)}return t.applyMatrix4(this.bindMatrixInverse)}}()});var vu=new Ee,mu=new Ee;Object.assign(tr.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var r=new Ee;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld);this.boneInverses.push(r)}},pose:function(){var e,t;var r=0;for(t=this.bones.length;r<t;r++)(e=this.bones[r])&&e.matrixWorld.getInverse(this.boneInverses[r]);r=0;for(t=this.bones.length;r<t;r++)if(e=this.bones[r])e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale)},update:function(){for(var e=this.bones,t=this.boneInverses,r=this.boneMatrices,n=this.boneTexture,i=0,o=e.length;i<o;i++)vu.multiplyMatrices(e[i]?e[i].matrixWorld:mu,t[i]),vu.toArray(r,16*i);void 0!==n&&(n.needsUpdate=!0)},clone:function(){return new tr(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,r=this.bones.length;t<r;t++){var n=this.bones[t];if(n.name===e)return n}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}});rr.prototype=Object.assign(Object.create(f.prototype),{constructor:rr,isBone:!0});var gu=new Ee,_u=new Ee,yu=[],bu=new I;nr.prototype=Object.assign(Object.create(I.prototype),{constructor:nr,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var r=this.matrixWorld,n=this.count;bu.geometry=this.geometry;bu.material=this.material;if(void 0!==bu.material)for(var i=0;i<n;i++){this.getMatrixAt(i,gu);_u.multiplyMatrices(r,gu);bu.matrixWorld=_u;bu.raycast(e,yu);for(var o=0,a=yu.length;o<a;o++){var s=yu[o];s.instanceId=i;s.object=this;t.push(s)}yu.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}});ir.prototype=Object.create(y.prototype);ir.prototype.constructor=ir;ir.prototype.isLineBasicMaterial=!0;ir.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);this.linewidth=e.linewidth;this.linecap=e.linecap;this.linejoin=e.linejoin;this.morphTargets=e.morphTargets;return this};var xu=new Te,wu=new Te,Su=new Ee,Mu=new s,Cu=new l;or.prototype=Object.assign(Object.create(f.prototype),{constructor:or,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],n=1,i=t.count;n<i;n++)xu.fromBufferAttribute(t,n-1),wu.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=xu.distanceTo(wu);e.setAttribute("lineDistance",new j(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(t=e.vertices,r=e.lineDistances,r[0]=0,n=1,i=t.length;n<i;n++)r[n]=r[n-1],r[n]+=t[n-1].distanceTo(t[n]);return this},raycast:function(e,t){var r=this.geometry,n=this.matrixWorld,i=e.params.Line.threshold;null===r.boundingSphere&&r.computeBoundingSphere();Cu.copy(r.boundingSphere);Cu.applyMatrix4(n);Cu.radius+=i;if(!1!==e.ray.intersectsSphere(Cu)){Su.getInverse(n);Mu.copy(e.ray).applyMatrix4(Su);n=i/((this.scale.x+this.scale.y+this.scale.z)/3);n*=n;var o=new Te,a=new Te;i=new Te;var s=new Te,u=this&&this.isLineSegments?2:1;if(r.isBufferGeometry){var c=r.index,l=r.attributes.position.array;if(null!==c){c=c.array;r=0;for(var h=c.length-1;r<h;r+=u){var p=c[r+1];o.fromArray(l,3*c[r]);a.fromArray(l,3*p);p=Mu.distanceSqToSegment(o,a,s,i);p>n||(s.applyMatrix4(this.matrixWorld),p=e.ray.origin.distanceTo(s),p<e.near||p>e.far||t.push({distance:p,point:i.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this}))}}else for(r=0,h=l.length/3-1;r<h;r+=u)o.fromArray(l,3*r),a.fromArray(l,3*r+3),p=Mu.distanceSqToSegment(o,a,s,i),p>n||(s.applyMatrix4(this.matrixWorld),p=e.ray.origin.distanceTo(s),p<e.near||p>e.far||t.push({distance:p,point:i.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this}))}else if(r.isGeometry)for(o=r.vertices,a=o.length,r=0;r<a-1;r+=u)p=Mu.distanceSqToSegment(o[r],o[r+1],s,i),p>n||(s.applyMatrix4(this.matrixWorld),p=e.ray.origin.distanceTo(s),p<e.near||p>e.far||t.push({distance:p,point:i.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this}))}},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){e=e.morphAttributes;var t=Object.keys(e);if(0<t.length){var r=e[t[0]];if(void 0!==r)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=r.length;e<t;e++){var n=r[e].name||String(e);this.morphTargetInfluences.push(0);this.morphTargetDictionary[n]=e}}}else e=e.morphTargets,void 0!==e&&0<e.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Tu=new Te,Eu=new Te;ar.prototype=Object.assign(Object.create(or.prototype),{constructor:ar,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],n=0,i=t.count;n<i;n+=2)Tu.fromBufferAttribute(t,n),Eu.fromBufferAttribute(t,n+1),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+Tu.distanceTo(Eu);e.setAttribute("lineDistance",new j(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(t=e.vertices,r=e.lineDistances,n=0,i=t.length;n<i;n+=2)Tu.copy(t[n]),Eu.copy(t[n+1]),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+Tu.distanceTo(Eu);return this}});sr.prototype=Object.assign(Object.create(or.prototype),{constructor:sr,isLineLoop:!0});ur.prototype=Object.create(y.prototype);ur.prototype.constructor=ur;ur.prototype.isPointsMaterial=!0;ur.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);this.map=e.map;this.alphaMap=e.alphaMap;this.size=e.size;this.sizeAttenuation=e.sizeAttenuation;this.morphTargets=e.morphTargets;return this};var Ou=new Ee,Pu=new s,Au=new l,ju=new Te;cr.prototype=Object.assign(Object.create(f.prototype),{constructor:cr,isPoints:!0,raycast:function(e,t){var r=this.geometry,n=this.matrixWorld,i=e.params.Points.threshold;null===r.boundingSphere&&r.computeBoundingSphere();Au.copy(r.boundingSphere);Au.applyMatrix4(n);Au.radius+=i;if(!1!==e.ray.intersectsSphere(Au))if(Ou.getInverse(n),Pu.copy(e.ray).applyMatrix4(Ou),i/=(this.scale.x+this.scale.y+this.scale.z)/3,i*=i,r.isBufferGeometry){var o=r.index;r=r.attributes.position.array;if(null!==o){var a=o.array;o=0;for(var s=a.length;o<s;o++){var u=a[o];ju.fromArray(r,3*u);lr(ju,u,i,n,e,t,this)}}else for(o=0,a=r.length/3;o<a;o++)ju.fromArray(r,3*o),lr(ju,o,i,n,e,t,this)}else for(r=r.vertices,o=0,a=r.length;o<a;o++)lr(r[o],o,i,n,e,t,this)},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){e=e.morphAttributes;var t=Object.keys(e);if(0<t.length){var r=e[t[0]];if(void 0!==r)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=r.length;e<t;e++){var n=r[e].name||String(e);this.morphTargetInfluences.push(0);this.morphTargetDictionary[n]=e}}}else e=e.morphTargets,void 0!==e&&0<e.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});hr.prototype=Object.assign(Object.create(p.prototype),{constructor:hr,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});pr.prototype=Object.create(p.prototype);pr.prototype.constructor=pr;pr.prototype.isCompressedTexture=!0;fr.prototype=Object.create(p.prototype);fr.prototype.constructor=fr;fr.prototype.isCanvasTexture=!0;dr.prototype=Object.create(p.prototype);dr.prototype.constructor=dr;dr.prototype.isDepthTexture=!0;vr.prototype=Object.create(N.prototype);vr.prototype.constructor=vr;mr.prototype=Object.create(F.prototype);mr.prototype.constructor=mr;gr.prototype=Object.create(N.prototype);gr.prototype.constructor=gr;_r.prototype=Object.create(F.prototype);_r.prototype.constructor=_r;yr.prototype=Object.create(N.prototype);yr.prototype.constructor=yr;br.prototype=Object.create(F.prototype);br.prototype.constructor=br;xr.prototype=Object.create(yr.prototype);xr.prototype.constructor=xr;wr.prototype=Object.create(F.prototype);wr.prototype.constructor=wr;Sr.prototype=Object.create(yr.prototype);Sr.prototype.constructor=Sr;Mr.prototype=Object.create(F.prototype);Mr.prototype.constructor=Mr;Cr.prototype=Object.create(yr.prototype);Cr.prototype.constructor=Cr;Tr.prototype=Object.create(F.prototype);Tr.prototype.constructor=Tr;Er.prototype=Object.create(yr.prototype);Er.prototype.constructor=Er;Or.prototype=Object.create(F.prototype);Or.prototype.constructor=Or;Pr.prototype=Object.create(N.prototype);Pr.prototype.constructor=Pr;Pr.prototype.toJSON=function(){var e=N.prototype.toJSON.call(this);e.path=this.parameters.path.toJSON();return e};Ar.prototype=Object.create(F.prototype);Ar.prototype.constructor=Ar;jr.prototype=Object.create(N.prototype);jr.prototype.constructor=jr;Rr.prototype=Object.create(F.prototype);Rr.prototype.constructor=Rr;kr.prototype=Object.create(N.prototype);kr.prototype.constructor=kr;var Ru={triangulate:function(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=Lr(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s;if(n){var u=r;n=[];var c;var l=0;for(c=t.length;l<c;l++){var h=t[l]*u;var p=l<c-1?t[l+1]*u:e.length;h=Lr(e,h,p,u,!1);h===h.next&&(h.steiner=!0);n.push($r(h))}n.sort(Br);for(l=0;l<n.length;l++){u=n[l];t=o;if(t=Fr(u,t))u=Yr(t,u),Nr(t,t.next),Nr(u,u.next);o=Nr(o,o.next)}}if(e.length>80*r){var f=s=e[0];var d=n=e[1];for(u=r;u<i;u+=r)l=e[u],t=e[u+1],l<f&&(f=l),t<d&&(d=t),l>s&&(s=l),t>n&&(n=t);s=Math.max(s-f,n-d);s=0!==s?1/s:0}Ir(o,a,r,f,d,s);return a}},ku={area:function(e){for(var t=e.length,r=0,n=t-1,i=0;i<t;n=i++)r+=e[n].x*e[i].y-e[i].x*e[n].y;return.5*r},isClockWise:function(e){return 0>ku.area(e)},triangulateShape:function(e,t){var r=[],n=[],i=[];Qr(e);en(r,e);var o=e.length;t.forEach(Qr);for(e=0;e<t.length;e++)n.push(o),o+=t[e].length,en(r,t[e]);t=Ru.triangulate(r,n);for(e=0;e<t.length;e+=3)i.push(t.slice(e,e+3));return i}};tn.prototype=Object.create(F.prototype);tn.prototype.constructor=tn;tn.prototype.toJSON=function(){var e=F.prototype.toJSON.call(this);return nn(this.parameters.shapes,this.parameters.options,e)};rn.prototype=Object.create(N.prototype);rn.prototype.constructor=rn;rn.prototype.toJSON=function(){var e=N.prototype.toJSON.call(this);return nn(this.parameters.shapes,this.parameters.options,e)};var Lu={generateTopUV:function(e,t,r,n,i){e=t[3*n];n=t[3*n+1];var o=t[3*i];i=t[3*i+1];return[new Me(t[3*r],t[3*r+1]),new Me(e,n),new Me(o,i)]},generateSideWallUV:function(e,t,r,n,i,o){e=t[3*r];var a=t[3*r+1];r=t[3*r+2];var s=t[3*n],u=t[3*n+1];n=t[3*n+2];var c=t[3*i],l=t[3*i+1];i=t[3*i+2];var h=t[3*o],p=t[3*o+1];t=t[3*o+2];return.01>Math.abs(a-u)?[new Me(e,1-r),new Me(s,1-n),new Me(c,1-i),new Me(h,1-t)]:[new Me(a,1-r),new Me(u,1-n),new Me(l,1-i),new Me(p,1-t)]}};on.prototype=Object.create(F.prototype);on.prototype.constructor=on;an.prototype=Object.create(rn.prototype);an.prototype.constructor=an;sn.prototype=Object.create(F.prototype);sn.prototype.constructor=sn;un.prototype=Object.create(N.prototype);un.prototype.constructor=un;cn.prototype=Object.create(F.prototype);cn.prototype.constructor=cn;ln.prototype=Object.create(N.prototype);ln.prototype.constructor=ln;hn.prototype=Object.create(F.prototype);hn.prototype.constructor=hn;pn.prototype=Object.create(N.prototype);pn.prototype.constructor=pn;fn.prototype=Object.create(F.prototype);fn.prototype.constructor=fn;fn.prototype.toJSON=function(){var e=F.prototype.toJSON.call(this);return vn(this.parameters.shapes,e)};dn.prototype=Object.create(N.prototype);dn.prototype.constructor=dn;dn.prototype.toJSON=function(){var e=N.prototype.toJSON.call(this);return vn(this.parameters.shapes,e)};mn.prototype=Object.create(N.prototype);mn.prototype.constructor=mn;gn.prototype=Object.create(F.prototype);gn.prototype.constructor=gn;_n.prototype=Object.create(N.prototype);_n.prototype.constructor=_n;yn.prototype=Object.create(gn.prototype);yn.prototype.constructor=yn;bn.prototype=Object.create(_n.prototype);bn.prototype.constructor=bn;xn.prototype=Object.create(F.prototype);xn.prototype.constructor=xn;wn.prototype=Object.create(N.prototype);wn.prototype.constructor=wn;var Nu=Object.freeze({__proto__:null,WireframeGeometry:vr,ParametricGeometry:mr,ParametricBufferGeometry:gr,TetrahedronGeometry:br,TetrahedronBufferGeometry:xr,OctahedronGeometry:wr,OctahedronBufferGeometry:Sr,IcosahedronGeometry:Mr,IcosahedronBufferGeometry:Cr,DodecahedronGeometry:Tr,DodecahedronBufferGeometry:Er,PolyhedronGeometry:_r,PolyhedronBufferGeometry:yr,TubeGeometry:Or,TubeBufferGeometry:Pr,TorusKnotGeometry:Ar,TorusKnotBufferGeometry:jr,TorusGeometry:Rr,TorusBufferGeometry:kr,TextGeometry:on,TextBufferGeometry:an,SphereGeometry:sn,SphereBufferGeometry:un,RingGeometry:cn,RingBufferGeometry:ln,PlaneGeometry:W,PlaneBufferGeometry:X,LatheGeometry:hn,LatheBufferGeometry:pn,ShapeGeometry:fn,ShapeBufferGeometry:dn,ExtrudeGeometry:tn,ExtrudeBufferGeometry:rn,EdgesGeometry:mn,ConeGeometry:yn,ConeBufferGeometry:bn,CylinderGeometry:gn,CylinderBufferGeometry:_n,CircleGeometry:xn,CircleBufferGeometry:wn,BoxGeometry:As,BoxBufferGeometry:js});Sn.prototype=Object.create(y.prototype);Sn.prototype.constructor=Sn;Sn.prototype.isShadowMaterial=!0;Sn.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);return this};Mn.prototype=Object.create(G.prototype);Mn.prototype.constructor=Mn;Mn.prototype.isRawShaderMaterial=!0;Cn.prototype=Object.create(y.prototype);Cn.prototype.constructor=Cn;Cn.prototype.isMeshStandardMaterial=!0;Cn.prototype.copy=function(e){y.prototype.copy.call(this,e);this.defines={STANDARD:""};this.color.copy(e.color);this.roughness=e.roughness;this.metalness=e.metalness;this.map=e.map;this.lightMap=e.lightMap;this.lightMapIntensity=e.lightMapIntensity;this.aoMap=e.aoMap;this.aoMapIntensity=e.aoMapIntensity;this.emissive.copy(e.emissive);this.emissiveMap=e.emissiveMap;this.emissiveIntensity=e.emissiveIntensity;this.bumpMap=e.bumpMap;this.bumpScale=e.bumpScale;this.normalMap=e.normalMap;this.normalMapType=e.normalMapType;this.normalScale.copy(e.normalScale);this.displacementMap=e.displacementMap;this.displacementScale=e.displacementScale;this.displacementBias=e.displacementBias;this.roughnessMap=e.roughnessMap;this.metalnessMap=e.metalnessMap;this.alphaMap=e.alphaMap;this.envMap=e.envMap;this.envMapIntensity=e.envMapIntensity;this.refractionRatio=e.refractionRatio;this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;this.wireframeLinecap=e.wireframeLinecap;this.wireframeLinejoin=e.wireframeLinejoin;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.morphNormals=e.morphNormals;this.vertexTangents=e.vertexTangents;return this};Tn.prototype=Object.create(Cn.prototype);Tn.prototype.constructor=Tn;Tn.prototype.isMeshPhysicalMaterial=!0;Tn.prototype.copy=function(e){Cn.prototype.copy.call(this,e);this.defines={STANDARD:"",PHYSICAL:""};this.clearcoat=e.clearcoat;this.clearcoatMap=e.clearcoatMap;this.clearcoatRoughness=e.clearcoatRoughness;this.clearcoatRoughnessMap=e.clearcoatRoughnessMap;this.clearcoatNormalMap=e.clearcoatNormalMap;this.clearcoatNormalScale.copy(e.clearcoatNormalScale);this.reflectivity=e.reflectivity;this.sheen=e.sheen?(this.sheen||new v).copy(e.sheen):null;this.transparency=e.transparency;return this};En.prototype=Object.create(y.prototype);En.prototype.constructor=En;En.prototype.isMeshPhongMaterial=!0;En.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);this.specular.copy(e.specular);this.shininess=e.shininess;this.map=e.map;this.lightMap=e.lightMap;this.lightMapIntensity=e.lightMapIntensity;this.aoMap=e.aoMap;this.aoMapIntensity=e.aoMapIntensity;this.emissive.copy(e.emissive);this.emissiveMap=e.emissiveMap;this.emissiveIntensity=e.emissiveIntensity;this.bumpMap=e.bumpMap;this.bumpScale=e.bumpScale;this.normalMap=e.normalMap;this.normalMapType=e.normalMapType;this.normalScale.copy(e.normalScale);this.displacementMap=e.displacementMap;this.displacementScale=e.displacementScale;this.displacementBias=e.displacementBias;this.specularMap=e.specularMap;this.alphaMap=e.alphaMap;this.envMap=e.envMap;this.combine=e.combine;this.reflectivity=e.reflectivity;this.refractionRatio=e.refractionRatio;this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;this.wireframeLinecap=e.wireframeLinecap;this.wireframeLinejoin=e.wireframeLinejoin;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.morphNormals=e.morphNormals;return this};On.prototype=Object.create(y.prototype);On.prototype.constructor=On;On.prototype.isMeshToonMaterial=!0;On.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);this.specular.copy(e.specular);this.shininess=e.shininess;this.map=e.map;this.gradientMap=e.gradientMap;this.lightMap=e.lightMap;this.lightMapIntensity=e.lightMapIntensity;this.aoMap=e.aoMap;this.aoMapIntensity=e.aoMapIntensity;this.emissive.copy(e.emissive);this.emissiveMap=e.emissiveMap;this.emissiveIntensity=e.emissiveIntensity;this.bumpMap=e.bumpMap;this.bumpScale=e.bumpScale;this.normalMap=e.normalMap;this.normalMapType=e.normalMapType;this.normalScale.copy(e.normalScale);this.displacementMap=e.displacementMap;this.displacementScale=e.displacementScale;this.displacementBias=e.displacementBias;this.specularMap=e.specularMap;this.alphaMap=e.alphaMap;this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;this.wireframeLinecap=e.wireframeLinecap;this.wireframeLinejoin=e.wireframeLinejoin;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.morphNormals=e.morphNormals;return this};Pn.prototype=Object.create(y.prototype);Pn.prototype.constructor=Pn;Pn.prototype.isMeshNormalMaterial=!0;Pn.prototype.copy=function(e){y.prototype.copy.call(this,e);this.bumpMap=e.bumpMap;this.bumpScale=e.bumpScale;this.normalMap=e.normalMap;this.normalMapType=e.normalMapType;this.normalScale.copy(e.normalScale);this.displacementMap=e.displacementMap;this.displacementScale=e.displacementScale;this.displacementBias=e.displacementBias;this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.morphNormals=e.morphNormals;return this};An.prototype=Object.create(y.prototype);An.prototype.constructor=An;An.prototype.isMeshLambertMaterial=!0;An.prototype.copy=function(e){y.prototype.copy.call(this,e);this.color.copy(e.color);this.map=e.map;this.lightMap=e.lightMap;this.lightMapIntensity=e.lightMapIntensity;this.aoMap=e.aoMap;this.aoMapIntensity=e.aoMapIntensity;this.emissive.copy(e.emissive);this.emissiveMap=e.emissiveMap;this.emissiveIntensity=e.emissiveIntensity;this.specularMap=e.specularMap;this.alphaMap=e.alphaMap;this.envMap=e.envMap;this.combine=e.combine;this.reflectivity=e.reflectivity;this.refractionRatio=e.refractionRatio;this.wireframe=e.wireframe;this.wireframeLinewidth=e.wireframeLinewidth;this.wireframeLinecap=e.wireframeLinecap;this.wireframeLinejoin=e.wireframeLinejoin;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.morphNormals=e.morphNormals;return this};jn.prototype=Object.create(y.prototype);jn.prototype.constructor=jn;jn.prototype.isMeshMatcapMaterial=!0;jn.prototype.copy=function(e){y.prototype.copy.call(this,e);this.defines={MATCAP:""};this.color.copy(e.color);this.matcap=e.matcap;this.map=e.map;this.bumpMap=e.bumpMap;this.bumpScale=e.bumpScale;this.normalMap=e.normalMap;this.normalMapType=e.normalMapType;this.normalScale.copy(e.normalScale);this.displacementMap=e.displacementMap;this.displacementScale=e.displacementScale;this.displacementBias=e.displacementBias;this.alphaMap=e.alphaMap;this.skinning=e.skinning;this.morphTargets=e.morphTargets;this.morphNormals=e.morphNormals;return this};Rn.prototype=Object.create(ir.prototype);Rn.prototype.constructor=Rn;Rn.prototype.isLineDashedMaterial=!0;Rn.prototype.copy=function(e){ir.prototype.copy.call(this,e);this.scale=e.scale;this.dashSize=e.dashSize;this.gapSize=e.gapSize;return this};var Iu=Object.freeze({__proto__:null,ShadowMaterial:Sn,SpriteMaterial:Kt,RawShaderMaterial:Mn,ShaderMaterial:G,PointsMaterial:ur,MeshPhysicalMaterial:Tn,MeshStandardMaterial:Cn,MeshPhongMaterial:En,MeshToonMaterial:On,MeshNormalMaterial:Pn,MeshLambertMaterial:An,MeshDepthMaterial:Lt,MeshDistanceMaterial:Nt,MeshBasicMaterial:x,MeshMatcapMaterial:jn,LineDashedMaterial:Rn,LineBasicMaterial:ir,Material:y}),Du={arraySlice:function(e,t,r){return Du.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==r?r:e.length)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"===typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(r){for(var e=r.length,t=Array(e),n=0;n!==e;++n)t[n]=n;t.sort(function(e,t){return r[e]-r[t]});return t},sortedArray:function(e,t,r){for(var n=e.length,i=new e.constructor(n),o=0,a=0;a!==n;++o)for(var s=r[o]*t,u=0;u!==t;++u)i[a++]=e[s+u];return i},flattenJSON:function(e,t,r,n){for(var i=1,o=e[0];void 0!==o&&void 0===o[n];)o=e[i++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a)){do{a=o[n],void 0!==a&&(t.push(o.time),r.push.apply(r,a)),o=e[i++]}while(void 0!==o)}else if(void 0!==a.toArray){do{a=o[n],void 0!==a&&(t.push(o.time),a.toArray(r,r.length)),o=e[i++]}while(void 0!==o)}else{do{a=o[n],void 0!==a&&(t.push(o.time),r.push(a)),o=e[i++]}while(void 0!==o)}}},subclip:function(e,t,r,n,i){i=i||30;e=e.clone();e.name=t;var o=[];for(t=0;t<e.tracks.length;++t){for(var a=e.tracks[t],s=a.getValueSize(),u=[],c=[],l=0;l<a.times.length;++l){var h=a.times[l]*i;if(!(h<r||h>=n))for(u.push(a.times[l]),h=0;h<s;++h)c.push(a.values[l*s+h])}0!==u.length&&(a.times=Du.convertArray(u,a.times.constructor),a.values=Du.convertArray(c,a.values.constructor),o.push(a))}e.tracks=o;r=Infinity;for(t=0;t<e.tracks.length;++t)r>e.tracks[t].times[0]&&(r=e.tracks[t].times[0]);for(t=0;t<e.tracks.length;++t)e.tracks[t].shift(-1*r);e.resetDuration();return e},makeClipAdditive:function(e,t,r,n){void 0===t&&(t=0);void 0===r&&(r=e);if(void 0===n||0>=n)n=30;var i=e.tracks.length;t/=n;for(n=0;n<i;++n){var o=r.tracks[n],a=o.ValueTypeName;if("bool"!==a&&"string"!==a){var s=e.tracks.find(function(e){return e.name===o.name&&e.ValueTypeName===a});if(void 0!==s){var u=o.getValueSize(),c=o.times.length-1;t<=o.times[0]?c=Du.arraySlice(o.values,0,o.valueSize):t>=o.times[c]?c=Du.arraySlice(o.values,c*u):(c=o.createInterpolant(),c.evaluate(t),c=c.resultBuffer);"quaternion"===a&&new d(c[0],c[1],c[2],c[3]).normalize().conjugate().toArray(c);for(var l=s.times.length,h=0;h<l;++h){var p=h*u;if("quaternion"===a)d.multiplyQuaternionsFlat(s.values,p,c,0,s.values,p);else for(var f=0;f<u;++f)s.values[p+f]-=c[f]}}}}e.blendMode=2501;return e}};Object.assign(kn.prototype,{evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,n=t[r],i=t[r-1];e:{t:{r:{n:if(!(e<n)){for(var o=r+2;;){if(void 0===n){if(e<i)break n;this._cachedIndex=r=t.length;return this.afterEnd_(r-1,e,i)}if(r===o)break;i=n;n=t[++r];if(e<n)break t}n=t.length;break r}if(e>=i)break e;else{o=t[1];e<o&&(r=2,i=o);for(o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===o)break;n=i;i=t[--r-1];if(e>=i)break t}n=r;r=0}}for(;r<n;)i=r+n>>>1,e<t[i]?n=i:r=i+1;n=t[r];i=t[r-1];if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return this._cachedIndex=r=t.length,this.afterEnd_(r-1,i,e)}this._cachedIndex=r;this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize;e*=n;for(var i=0;i!==n;++i)t[i]=r[e+i];return t},interpolate_:function(){throw Error("call to abstract method")},intervalChanged_:function(){}});Object.assign(kn.prototype,{beforeStart_:kn.prototype.copySampleValue_,afterEnd_:kn.prototype.copySampleValue_});Ln.prototype=Object.assign(Object.create(kn.prototype),{constructor:Ln,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,r){var n=this.parameterPositions,i=e-2,o=e+1,a=n[i],s=n[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:i=e;a=2*t-r;break;case 2402:i=n.length-2;a=t+n[i]-n[i+1];break;default:i=e,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=e;s=2*r-t;break;case 2402:o=1;s=r+n[1]-n[0];break;default:o=e-1,s=t}e=.5*(r-t);n=this.valueSize;this._weightPrev=e/(t-a);this._weightNext=e/(s-r);this._offsetPrev=i*n;this._offsetNext=o*n},interpolate_:function(e,t,r,n){var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize;e*=a;var s=e-a,u=this._offsetPrev,c=this._offsetNext,l=this._weightPrev,h=this._weightNext,p=(r-t)/(n-t);r=p*p;n=r*p;t=-l*n+2*l*r-l*p;l=(1+l)*n+(-1.5-2*l)*r+(-.5+l)*p+1;p=(-1-h)*n+(1.5+h)*r+.5*p;h=h*n-h*r;for(r=0;r!==a;++r)i[r]=t*o[u+r]+l*o[s+r]+p*o[e+r]+h*o[c+r];return i}});Nn.prototype=Object.assign(Object.create(kn.prototype),{constructor:Nn,interpolate_:function(e,t,r,n){var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize;e*=a;var s=e-a;t=(r-t)/(n-t);r=1-t;for(n=0;n!==a;++n)i[n]=o[s+n]*r+o[e+n]*t;return i}});In.prototype=Object.assign(Object.create(kn.prototype),{constructor:In,interpolate_:function(e){return this.copySampleValue_(e-1)}});Object.assign(Dn,{toJSON:function(e){var t=e.constructor;if(void 0!==t.toJSON)t=t.toJSON(e);else{t={name:e.name,times:Du.convertArray(e.times,Array),values:Du.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}t.type=e.ValueTypeName;return t}});Object.assign(Dn.prototype,{constructor:Dn,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new In(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Nn(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Ln(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){switch(e){case 2300:var t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);console.warn("THREE.KeyframeTrack:",t);return this}this.createInterpolant=t;return this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,n=r.length,i=0,o=n-1;i!==n&&r[i]<e;)++i;for(;-1!==o&&r[o]>t;)--o;++o;if(0!==i||o!==n)i>=o&&(o=Math.max(o,1),i=o-1),e=this.getValueSize(),this.times=Du.arraySlice(r,i,o),this.values=Du.arraySlice(this.values,i*e,o*e);return this},validate:function(){var e=!0,t=this.getValueSize();0!==t-Math.floor(t)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var r=this.times;t=this.values;var n=r.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var i=null,o=0;o!==n;o++){var a=r[o];if("number"===typeof a&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,a);e=!1;break}if(null!==i&&i>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,a,i);e=!1;break}i=a}if(void 0!==t&&Du.isTypedArray(t))for(o=0,r=t.length;o!==r;++o)if(n=t[o],isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,n);e=!1;break}return e},optimize:function(){for(var e=Du.arraySlice(this.times),t=Du.arraySlice(this.values),r=this.getValueSize(),n=2302===this.getInterpolation(),i=1,o=e.length-1,a=1;a<o;++a){var s=!1,u=e[a];if(u!==e[a+1]&&(1!==a||u!==u[0]))if(n)s=!0;else{var c=a*r,l=c-r,h=c+r;for(u=0;u!==r;++u){var p=t[c+u];if(p!==t[l+u]||p!==t[h+u]){s=!0;break}}}if(s){if(a!==i)for(e[i]=e[a],s=a*r,c=i*r,u=0;u!==r;++u)t[c+u]=t[s+u];++i}}if(0<o){e[i]=e[o];s=o*r;c=i*r;for(u=0;u!==r;++u)t[c+u]=t[s+u];++i}i!==e.length?(this.times=Du.arraySlice(e,0,i),this.values=Du.arraySlice(t,0,i*r)):(this.times=e,this.values=t);return this},clone:function(){var e=Du.arraySlice(this.times,0),t=Du.arraySlice(this.values,0);e=new this.constructor(this.name,e,t);e.createInterpolant=this.createInterpolant;return e}});Bn.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Bn,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});Fn.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Fn,ValueTypeName:"color"});zn.prototype=Object.assign(Object.create(Dn.prototype),{constructor:zn,ValueTypeName:"number"});$n.prototype=Object.assign(Object.create(kn.prototype),{constructor:$n,interpolate_:function(e,t,r,n){var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize;e*=a;t=(r-t)/(n-t);for(r=e+a;e!==r;e+=4)d.slerpFlat(i,0,o,e-a,o,e,t);return i}});Gn.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Gn,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new $n(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0});Vn.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Vn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});Hn.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Hn,ValueTypeName:"vector"});Object.assign(Un,{parse:function(e){for(var t=[],r=e.tracks,n=1/(e.fps||1),i=0,o=r.length;i!==o;++i)t.push(Wn(r[i]).scale(n));return new Un(e.name,e.duration,t,e.blendMode)},toJSON:function(e){var t=[],r=e.tracks;e={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(var n=0,i=r.length;n!==i;++n)t.push(Dn.toJSON(r[n]));return e},CreateFromMorphTargetSequence:function(e,t,r,n){for(var i=t.length,o=[],a=0;a<i;a++){var s=[],u=[];s.push((a+i-1)%i,a,(a+1)%i);u.push(0,1,0);var c=Du.getKeyframeOrder(s);s=Du.sortedArray(s,1,c);u=Du.sortedArray(u,1,c);n||0!==s[0]||(s.push(i),u.push(u[0]));o.push(new zn(".morphTargetInfluences["+t[a].name+"]",s,u).scale(1/r))}return new Un(e,-1,o)},findByName:function(e,t){var r=e;Array.isArray(e)||(r=e.geometry&&e.geometry.animations||e.animations);for(e=0;e<r.length;e++)if(r[e].name===t)return r[e];return null},CreateClipsFromMorphTargetSequences:function(e,t,r){for(var n={},i=/^([\w-]*?)([\d]+)$/,o=0,a=e.length;o<a;o++){var s=e[o],u=s.name.match(i);if(u&&1<u.length){var c=u[1];(u=n[c])||(n[c]=u=[]);u.push(s)}}e=[];for(c in n)e.push(Un.CreateFromMorphTargetSequence(c,n[c],t,r));return e},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;var r=function(e,t,r,n,i){if(0!==r.length){var o=[],a=[];Du.flattenJSON(r,o,a,n);0!==o.length&&i.push(new e(t,o,a))}},n=[],i=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.blendMode;e=e.hierarchy||[];for(var u=0;u<e.length;u++){var c=e[u].keys;if(c&&0!==c.length)if(c[0].morphTargets){o={};for(var l=0;l<c.length;l++)if(c[l].morphTargets)for(var h=0;h<c[l].morphTargets.length;h++)o[c[l].morphTargets[h]]=-1;for(var p in o){var f=[],d=[];for(h=0;h!==c[l].morphTargets.length;++h){var v=c[l];f.push(v.time);d.push(v.morphTarget===p?1:0)}n.push(new zn(".morphTargetInfluence["+p+"]",f,d))}o=o.length*(a||1)}else l=".bones["+t[u].name+"]",r(Hn,l+".position",c,"pos",n),r(Gn,l+".quaternion",c,"rot",n),r(Hn,l+".scale",c,"scl",n)}return 0===n.length?null:new Un(i,o,n,s)}});Object.assign(Un.prototype,{resetDuration:function(){for(var e=0,t=0,r=this.tracks.length;t!==r;++t){var n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}this.duration=e;return this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Un(this.name,this.duration,e,this.blendMode)}});var Bu={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Fu=new Xn;Object.assign(Yn.prototype,{load:function(){},loadAsync:function(r,n){var i=this;return new Promise(function(e,t){i.load(r,e,n,t)})},parse:function(){},setCrossOrigin:function(e){this.crossOrigin=e;return this},setPath:function(e){this.path=e;return this},setResourcePath:function(e){this.resourcePath=e;return this},setRequestHeader:function(e){this.requestHeader=e;return this}});var zu={};Kn.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Kn,load:function(a,e,t,r){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var s=this,n=Bu.get(a);if(void 0!==n)return s.manager.itemStart(a),setTimeout(function(){e&&e(n);s.manager.itemEnd(a)},0),n;if(void 0!==zu[a])zu[a].push({onLoad:e,onProgress:t,onError:r});else{var i=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(i){t=i[1];var o=!!i[2];i=i[3];i=decodeURIComponent(i);o&&(i=atob(i));try{var u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":var c=new Uint8Array(i.length);for(o=0;o<i.length;o++)c[o]=i.charCodeAt(o);var l="blob"===u?new Blob([c.buffer],{type:t}):c.buffer;break;case"document":l=(new DOMParser).parseFromString(i,t);break;case"json":l=JSON.parse(i);break;default:l=i}setTimeout(function(){e&&e(l);s.manager.itemEnd(a)},0)}catch(e){setTimeout(function(){r&&r(e);s.manager.itemError(a);s.manager.itemEnd(a)},0)}}else{zu[a]=[];zu[a].push({onLoad:e,onProgress:t,onError:r});var h=new XMLHttpRequest;h.open("GET",a,!0);h.addEventListener("load",function(e){var t=this.response,r=zu[a];delete zu[a];if(200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");Bu.add(a,t);for(var n=0,i=r.length;n<i;n++){var o=r[n];if(o.onLoad)o.onLoad(t)}}else{n=0;for(i=r.length;n<i;n++)if(o=r[n],o.onError)o.onError(e);s.manager.itemError(a)}s.manager.itemEnd(a)},!1);h.addEventListener("progress",function(e){for(var t=zu[a],r=0,n=t.length;r<n;r++){var i=t[r];if(i.onProgress)i.onProgress(e)}},!1);h.addEventListener("error",function(e){var t=zu[a];delete zu[a];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i.onError)i.onError(e)}s.manager.itemError(a);s.manager.itemEnd(a)},!1);h.addEventListener("abort",function(e){var t=zu[a];delete zu[a];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i.onError)i.onError(e)}s.manager.itemError(a);s.manager.itemEnd(a)},!1);void 0!==this.responseType&&(h.responseType=this.responseType);void 0!==this.withCredentials&&(h.withCredentials=this.withCredentials);h.overrideMimeType&&h.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(o in this.requestHeader)h.setRequestHeader(o,this.requestHeader[o]);h.send(null)}s.manager.itemStart(a);return h}},setResponseType:function(e){this.responseType=e;return this},setWithCredentials:function(e){this.withCredentials=e;return this},setMimeType:function(e){this.mimeType=e;return this}});Zn.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Zn,load:function(t,r,e,n){var i=this,o=new Kn(i.manager);o.setPath(i.path);o.load(t,function(e){try{r(i.parse(JSON.parse(e)))}catch(e){n?n(e):console.error(e),i.manager.itemError(t)}},e,n)},parse:function(e){for(var t=[],r=0;r<e.length;r++){var n=Un.parse(e[r]);t.push(n)}return t}});Jn.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Jn,load:function(e,i,r,n){function t(t){u.load(e[t],function(e){e=o.parse(e,!0);a[t]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps};c+=1;6===c&&(1===e.mipmapCount&&(s.minFilter=1006),s.format=e.format,s.needsUpdate=!0,i&&i(s))},r,n)}var o=this,a=[],s=new pr;s.image=a;var u=new Kn(this.manager);u.setPath(this.path);u.setResponseType("arraybuffer");if(Array.isArray(e))for(var c=0,l=0,h=e.length;l<h;++l)t(l);else u.load(e,function(e){e=o.parse(e,!0);if(e.isCubemap)for(var t=e.mipmaps.length/e.mipmapCount,r=0;r<t;r++){a[r]={mipmaps:[]};for(var n=0;n<e.mipmapCount;n++)a[r].mipmaps.push(e.mipmaps[r*e.mipmapCount+n]),a[r].format=e.format,a[r].width=e.width,a[r].height=e.height}else s.image.width=e.width,s.image.height=e.height,s.mipmaps=e.mipmaps;1===e.mipmapCount&&(s.minFilter=1006);s.format=e.format;s.needsUpdate=!0;i&&i(s)},r,n);return s}});Qn.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Qn,load:function(e,t,r,n){var i=this,o=new Pe,a=new Kn(this.manager);a.setResponseType("arraybuffer");a.setPath(this.path);a.load(e,function(e){if(e=i.parse(e))void 0!==e.image?o.image=e.image:void 0!==e.data&&(o.image.width=e.width,o.image.height=e.height,o.image.data=e.data),o.wrapS=void 0!==e.wrapS?e.wrapS:1001,o.wrapT=void 0!==e.wrapT?e.wrapT:1001,o.magFilter=void 0!==e.magFilter?e.magFilter:1006,o.minFilter=void 0!==e.minFilter?e.minFilter:1006,o.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(o.format=e.format),void 0!==e.type&&(o.type=e.type),void 0!==e.mipmaps&&(o.mipmaps=e.mipmaps,o.minFilter=1008),1===e.mipmapCount&&(o.minFilter=1006),o.needsUpdate=!0,t&&t(o,e)},r,n);return o}});ei.prototype=Object.assign(Object.create(Yn.prototype),{constructor:ei,load:function(t,e,r,n){function i(){u.removeEventListener("load",i,!1);u.removeEventListener("error",o,!1);Bu.add(t,this);e&&e(this);a.manager.itemEnd(t)}function o(e){u.removeEventListener("load",i,!1);u.removeEventListener("error",o,!1);n&&n(e);a.manager.itemError(t);a.manager.itemEnd(t)}void 0!==this.path&&(t=this.path+t);t=this.manager.resolveURL(t);var a=this,s=Bu.get(t);if(void 0!==s)return a.manager.itemStart(t),setTimeout(function(){e&&e(s);a.manager.itemEnd(t)},0),s;var u=document.createElementNS("http://www.w3.org/1999/xhtml","img");u.addEventListener("load",i,!1);u.addEventListener("error",o,!1);"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(u.crossOrigin=this.crossOrigin);a.manager.itemStart(t);u.src=t;return u}});ti.prototype=Object.assign(Object.create(Yn.prototype),{constructor:ti,load:function(e,r,t,n){function i(t){a.load(e[t],function(e){o.images[t]=e;s++;6===s&&(o.needsUpdate=!0,r&&r(o))},void 0,n)}var o=new K,a=new ei(this.manager);a.setCrossOrigin(this.crossOrigin);a.setPath(this.path);var s=0;for(t=0;t<e.length;++t)i(t);return o}});ri.prototype=Object.assign(Object.create(Yn.prototype),{constructor:ri,load:function(t,r,e,n){var i=new p,o=new ei(this.manager);o.setCrossOrigin(this.crossOrigin);o.setPath(this.path);o.load(t,function(e){i.image=e;e=0<t.search(/\.jpe?g($|\?)/i)||0===t.search(/^data:image\/jpeg/);i.format=e?1022:1023;i.needsUpdate=!0;void 0!==r&&r(i)},e,n);return i}});Object.assign(ni.prototype,{getPoint:function(){console.warn("THREE.Curve: .getPoint() not implemented.");return null},getPointAt:function(e,t){e=this.getUtoTmapping(e);return this.getPoint(e,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){void 0===e&&(e=this.arcLengthDivisions);if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],r=this.getPoint(0),n,i=0;t.push(0);for(n=1;n<=e;n++){var o=this.getPoint(n/e);i+=o.distanceTo(r);t.push(i);r=o}return this.cacheArcLengths=t},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(e,t){var r=this.getLengths(),n=r.length;t=t?t:e*r[n-1];for(var i=0,o=n-1,a;i<=o;)if(e=Math.floor(i+(o-i)/2),a=r[e]-t,0>a)i=e+1;else if(0<a)o=e-1;else{o=e;break}e=o;if(r[e]===t)return e/(n-1);i=r[e];return(e+(t-i)/(r[e+1]-i))/(n-1)},getTangent:function(e,t){var r=e-1e-4;e+=1e-4;0>r&&(r=0);1<e&&(e=1);r=this.getPoint(r);e=this.getPoint(e);t=t||(r.isVector2?new Me:new Te);t.copy(e).sub(r).normalize();return t},getTangentAt:function(e,t){e=this.getUtoTmapping(e);return this.getTangent(e,t)},computeFrenetFrames:function(e,t){var r=new Te,n=[],i=[],o=[],a=new Te,s=new Ee,u;for(u=0;u<=e;u++){var c=u/e;n[u]=this.getTangentAt(c,new Te);n[u].normalize()}i[0]=new Te;o[0]=new Te;u=Number.MAX_VALUE;c=Math.abs(n[0].x);var l=Math.abs(n[0].y),h=Math.abs(n[0].z);c<=u&&(u=c,r.set(1,0,0));l<=u&&(u=l,r.set(0,1,0));h<=u&&r.set(0,0,1);a.crossVectors(n[0],r).normalize();i[0].crossVectors(n[0],a);o[0].crossVectors(n[0],i[0]);for(u=1;u<=e;u++)i[u]=i[u-1].clone(),o[u]=o[u-1].clone(),a.crossVectors(n[u-1],n[u]),a.length()>Number.EPSILON&&(a.normalize(),r=Math.acos(Vo.clamp(n[u-1].dot(n[u]),-1,1)),i[u].applyMatrix4(s.makeRotationAxis(a,r))),o[u].crossVectors(n[u],i[u]);if(!0===t)for(r=Math.acos(Vo.clamp(i[0].dot(i[e]),-1,1)),r/=e,0<n[0].dot(a.crossVectors(i[0],i[e]))&&(r=-r),u=1;u<=e;u++)i[u].applyMatrix4(s.makeRotationAxis(n[u],r*u)),o[u].crossVectors(n[u],i[u]);return{tangents:n,normals:i,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.arcLengthDivisions=e.arcLengthDivisions;return this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};e.arcLengthDivisions=this.arcLengthDivisions;e.type=this.type;return e},fromJSON:function(e){this.arcLengthDivisions=e.arcLengthDivisions;return this}});ii.prototype=Object.create(ni.prototype);ii.prototype.constructor=ii;ii.prototype.isEllipseCurve=!0;ii.prototype.getPoint=function(e,t){t=t||new Me;for(var r=2*Math.PI,n=this.aEndAngle-this.aStartAngle,i=Math.abs(n)<Number.EPSILON;0>n;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(n=i?0:r);!0!==this.aClockwise||i||(n=n===r?-r:n-r);r=this.aStartAngle+e*n;e=this.aX+this.xRadius*Math.cos(r);var o=this.aY+this.yRadius*Math.sin(r);0!==this.aRotation&&(r=Math.cos(this.aRotation),n=Math.sin(this.aRotation),i=e-this.aX,o-=this.aY,e=i*r-o*n+this.aX,o=i*n+o*r+this.aY);return t.set(e,o)};ii.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.aX=e.aX;this.aY=e.aY;this.xRadius=e.xRadius;this.yRadius=e.yRadius;this.aStartAngle=e.aStartAngle;this.aEndAngle=e.aEndAngle;this.aClockwise=e.aClockwise;this.aRotation=e.aRotation;return this};ii.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.aX=this.aX;e.aY=this.aY;e.xRadius=this.xRadius;e.yRadius=this.yRadius;e.aStartAngle=this.aStartAngle;e.aEndAngle=this.aEndAngle;e.aClockwise=this.aClockwise;e.aRotation=this.aRotation;return e};ii.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.aX=e.aX;this.aY=e.aY;this.xRadius=e.xRadius;this.yRadius=e.yRadius;this.aStartAngle=e.aStartAngle;this.aEndAngle=e.aEndAngle;this.aClockwise=e.aClockwise;this.aRotation=e.aRotation;return this};oi.prototype=Object.create(ii.prototype);oi.prototype.constructor=oi;oi.prototype.isArcCurve=!0;var $u=new Te,Gu=new ai,Vu=new ai,Hu=new ai;si.prototype=Object.create(ni.prototype);si.prototype.constructor=si;si.prototype.isCatmullRomCurve3=!0;si.prototype.getPoint=function(e,t){t=t||new Te;var r=this.points,n=r.length;e*=n-(this.closed?0:1);var i=Math.floor(e);e-=i;this.closed?i+=0<i?0:(Math.floor(Math.abs(i)/n)+1)*n:0===e&&i===n-1&&(i=n-2,e=1);if(this.closed||0<i)var o=r[(i-1)%n];else $u.subVectors(r[0],r[1]).add(r[0]),o=$u;var a=r[i%n];var s=r[(i+1)%n];this.closed||i+2<n?r=r[(i+2)%n]:($u.subVectors(r[n-1],r[n-2]).add(r[n-1]),r=$u);if("centripetal"===this.curveType||"chordal"===this.curveType){var u="chordal"===this.curveType?.5:.25;n=Math.pow(o.distanceToSquared(a),u);i=Math.pow(a.distanceToSquared(s),u);u=Math.pow(s.distanceToSquared(r),u);1e-4>i&&(i=1);1e-4>n&&(n=i);1e-4>u&&(u=i);Gu.initNonuniformCatmullRom(o.x,a.x,s.x,r.x,n,i,u);Vu.initNonuniformCatmullRom(o.y,a.y,s.y,r.y,n,i,u);Hu.initNonuniformCatmullRom(o.z,a.z,s.z,r.z,n,i,u)}else"catmullrom"===this.curveType&&(Gu.initCatmullRom(o.x,a.x,s.x,r.x,this.tension),Vu.initCatmullRom(o.y,a.y,s.y,r.y,this.tension),Hu.initCatmullRom(o.z,a.z,s.z,r.z,this.tension));t.set(Gu.calc(e),Vu.calc(e),Hu.calc(e));return t};si.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.points=[];for(var t=0,r=e.points.length;t<r;t++)this.points.push(e.points[t].clone());this.closed=e.closed;this.curveType=e.curveType;this.tension=e.tension;return this};si.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++)e.points.push(this.points[t].toArray());e.closed=this.closed;e.curveType=this.curveType;e.tension=this.tension;return e};si.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new Te).fromArray(n))}this.closed=e.closed;this.curveType=e.curveType;this.tension=e.tension;return this};hi.prototype=Object.create(ni.prototype);hi.prototype.constructor=hi;hi.prototype.isCubicBezierCurve=!0;hi.prototype.getPoint=function(e,t){t=t||new Me;var r=this.v0,n=this.v1,i=this.v2,o=this.v3;t.set(li(e,r.x,n.x,i.x,o.x),li(e,r.y,n.y,i.y,o.y));return t};hi.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.v0.copy(e.v0);this.v1.copy(e.v1);this.v2.copy(e.v2);this.v3.copy(e.v3);return this};hi.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.v0=this.v0.toArray();e.v1=this.v1.toArray();e.v2=this.v2.toArray();e.v3=this.v3.toArray();return e};hi.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.v0.fromArray(e.v0);this.v1.fromArray(e.v1);this.v2.fromArray(e.v2);this.v3.fromArray(e.v3);return this};pi.prototype=Object.create(ni.prototype);pi.prototype.constructor=pi;pi.prototype.isCubicBezierCurve3=!0;pi.prototype.getPoint=function(e,t){t=t||new Te;var r=this.v0,n=this.v1,i=this.v2,o=this.v3;t.set(li(e,r.x,n.x,i.x,o.x),li(e,r.y,n.y,i.y,o.y),li(e,r.z,n.z,i.z,o.z));return t};pi.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.v0.copy(e.v0);this.v1.copy(e.v1);this.v2.copy(e.v2);this.v3.copy(e.v3);return this};pi.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.v0=this.v0.toArray();e.v1=this.v1.toArray();e.v2=this.v2.toArray();e.v3=this.v3.toArray();return e};pi.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.v0.fromArray(e.v0);this.v1.fromArray(e.v1);this.v2.fromArray(e.v2);this.v3.fromArray(e.v3);return this};fi.prototype=Object.create(ni.prototype);fi.prototype.constructor=fi;fi.prototype.isLineCurve=!0;fi.prototype.getPoint=function(e,t){t=t||new Me;1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1));return t};fi.prototype.getPointAt=function(e,t){return this.getPoint(e,t)};fi.prototype.getTangent=function(e,t){e=t||new Me;return e=e.copy(this.v2).sub(this.v1).normalize()};fi.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.v1.copy(e.v1);this.v2.copy(e.v2);return this};fi.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.v1=this.v1.toArray();e.v2=this.v2.toArray();return e};fi.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.v1.fromArray(e.v1);this.v2.fromArray(e.v2);return this};di.prototype=Object.create(ni.prototype);di.prototype.constructor=di;di.prototype.isLineCurve3=!0;di.prototype.getPoint=function(e,t){t=t||new Te;1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1));return t};di.prototype.getPointAt=function(e,t){return this.getPoint(e,t)};di.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.v1.copy(e.v1);this.v2.copy(e.v2);return this};di.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.v1=this.v1.toArray();e.v2=this.v2.toArray();return e};di.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.v1.fromArray(e.v1);this.v2.fromArray(e.v2);return this};vi.prototype=Object.create(ni.prototype);vi.prototype.constructor=vi;vi.prototype.isQuadraticBezierCurve=!0;vi.prototype.getPoint=function(e,t){t=t||new Me;var r=this.v0,n=this.v1,i=this.v2;t.set(ci(e,r.x,n.x,i.x),ci(e,r.y,n.y,i.y));return t};vi.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.v0.copy(e.v0);this.v1.copy(e.v1);this.v2.copy(e.v2);return this};vi.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.v0=this.v0.toArray();e.v1=this.v1.toArray();e.v2=this.v2.toArray();return e};vi.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.v0.fromArray(e.v0);this.v1.fromArray(e.v1);this.v2.fromArray(e.v2);return this};mi.prototype=Object.create(ni.prototype);mi.prototype.constructor=mi;mi.prototype.isQuadraticBezierCurve3=!0;mi.prototype.getPoint=function(e,t){t=t||new Te;var r=this.v0,n=this.v1,i=this.v2;t.set(ci(e,r.x,n.x,i.x),ci(e,r.y,n.y,i.y),ci(e,r.z,n.z,i.z));return t};mi.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.v0.copy(e.v0);this.v1.copy(e.v1);this.v2.copy(e.v2);return this};mi.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.v0=this.v0.toArray();e.v1=this.v1.toArray();e.v2=this.v2.toArray();return e};mi.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.v0.fromArray(e.v0);this.v1.fromArray(e.v1);this.v2.fromArray(e.v2);return this};gi.prototype=Object.create(ni.prototype);gi.prototype.constructor=gi;gi.prototype.isSplineCurve=!0;gi.prototype.getPoint=function(e,t){t=t||new Me;var r=this.points,n=(r.length-1)*e;e=Math.floor(n);n-=e;var i=r[0===e?e:e-1],o=r[e],a=r[e>r.length-2?r.length-1:e+1];r=r[e>r.length-3?r.length-1:e+2];t.set(ui(n,i.x,o.x,a.x,r.x),ui(n,i.y,o.y,a.y,r.y));return t};gi.prototype.copy=function(e){ni.prototype.copy.call(this,e);this.points=[];for(var t=0,r=e.points.length;t<r;t++)this.points.push(e.points[t].clone());return this};gi.prototype.toJSON=function(){var e=ni.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++)e.points.push(this.points[t].toArray());return e};gi.prototype.fromJSON=function(e){ni.prototype.fromJSON.call(this,e);this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new Me).fromArray(n))}return this};var Uu=Object.freeze({__proto__:null,ArcCurve:oi,CatmullRomCurve3:si,CubicBezierCurve:hi,CubicBezierCurve3:pi,EllipseCurve:ii,LineCurve:fi,LineCurve3:di,QuadraticBezierCurve:vi,QuadraticBezierCurve3:mi,SplineCurve:gi});_i.prototype=Object.assign(Object.create(ni.prototype),{constructor:_i,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new fi(t,e))},getPoint:function(e){var t=e*this.getLength(),r=this.getCurveLengths();for(e=0;e<r.length;){if(r[e]>=t)return t=r[e]-t,e=this.curves[e],r=e.getLength(),e.getPointAt(0===r?0:1-t/r);e++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));this.autoClose&&t.push(t[0]);return t},getPoints:function(e){e=e||12;for(var t=[],r,n=0,i=this.curves;n<i.length;n++){var o=i[n];o=o.getPoints(o&&o.isEllipseCurve?2*e:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e);for(var a=0;a<o.length;a++){var s=o[a];r&&r.equals(s)||(t.push(s),r=s)}}this.autoClose&&1<t.length&&!t[t.length-1].equals(t[0])&&t.push(t[0]);return t},copy:function(e){ni.prototype.copy.call(this,e);this.curves=[];for(var t=0,r=e.curves.length;t<r;t++)this.curves.push(e.curves[t].clone());this.autoClose=e.autoClose;return this},toJSON:function(){var e=ni.prototype.toJSON.call(this);e.autoClose=this.autoClose;e.curves=[];for(var t=0,r=this.curves.length;t<r;t++)e.curves.push(this.curves[t].toJSON());return e},fromJSON:function(e){ni.prototype.fromJSON.call(this,e);this.autoClose=e.autoClose;this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var n=e.curves[t];this.curves.push((new Uu[n.type]).fromJSON(n))}return this}});yi.prototype=Object.assign(Object.create(_i.prototype),{constructor:yi,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){this.currentPoint.set(e,t);return this},lineTo:function(e,t){var r=new fi(this.currentPoint.clone(),new Me(e,t));this.curves.push(r);this.currentPoint.set(e,t);return this},quadraticCurveTo:function(e,t,r,n){e=new vi(this.currentPoint.clone(),new Me(e,t),new Me(r,n));this.curves.push(e);this.currentPoint.set(r,n);return this},bezierCurveTo:function(e,t,r,n,i,o){e=new hi(this.currentPoint.clone(),new Me(e,t),new Me(r,n),new Me(i,o));this.curves.push(e);this.currentPoint.set(i,o);return this},splineThru:function(e){var t=[this.currentPoint.clone()].concat(e);t=new gi(t);this.curves.push(t);this.currentPoint.copy(e[e.length-1]);return this},arc:function(e,t,r,n,i,o){this.absarc(e+this.currentPoint.x,t+this.currentPoint.y,r,n,i,o);return this},absarc:function(e,t,r,n,i,o){this.absellipse(e,t,r,r,n,i,o);return this},ellipse:function(e,t,r,n,i,o,a,s){this.absellipse(e+this.currentPoint.x,t+this.currentPoint.y,r,n,i,o,a,s);return this},absellipse:function(e,t,r,n,i,o,a,s){e=new ii(e,t,r,n,i,o,a,s);0<this.curves.length&&(t=e.getPoint(0),t.equals(this.currentPoint)||this.lineTo(t.x,t.y));this.curves.push(e);e=e.getPoint(1);this.currentPoint.copy(e);return this},copy:function(e){_i.prototype.copy.call(this,e);this.currentPoint.copy(e.currentPoint);return this},toJSON:function(){var e=_i.prototype.toJSON.call(this);e.currentPoint=this.currentPoint.toArray();return e},fromJSON:function(e){_i.prototype.fromJSON.call(this,e);this.currentPoint.fromArray(e.currentPoint);return this}});bi.prototype=Object.assign(Object.create(yi.prototype),{constructor:bi,getPointsHoles:function(e){for(var t=[],r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){yi.prototype.copy.call(this,e);this.holes=[];for(var t=0,r=e.holes.length;t<r;t++)this.holes.push(e.holes[t].clone());return this},toJSON:function(){var e=yi.prototype.toJSON.call(this);e.uuid=this.uuid;e.holes=[];for(var t=0,r=this.holes.length;t<r;t++)e.holes.push(this.holes[t].toJSON());return e},fromJSON:function(e){yi.prototype.fromJSON.call(this,e);this.uuid=e.uuid;this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var n=e.holes[t];this.holes.push((new yi).fromJSON(n))}return this}});xi.prototype=Object.assign(Object.create(f.prototype),{constructor:xi,isLight:!0,copy:function(e){f.prototype.copy.call(this,e);this.color.copy(e.color);this.intensity=e.intensity;return this},toJSON:function(e){e=f.prototype.toJSON.call(this,e);e.object.color=this.color.getHex();e.object.intensity=this.intensity;void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex());void 0!==this.distance&&(e.object.distance=this.distance);void 0!==this.angle&&(e.object.angle=this.angle);void 0!==this.decay&&(e.object.decay=this.decay);void 0!==this.penumbra&&(e.object.penumbra=this.penumbra);void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON());return e}});wi.prototype=Object.assign(Object.create(xi.prototype),{constructor:wi,isHemisphereLight:!0,copy:function(e){xi.prototype.copy.call(this,e);this.groundColor.copy(e.groundColor);return this}});Object.assign(Si.prototype,{_projScreenMatrix:new Ee,_lightPositionWorld:new Te,_lookTarget:new Te,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,r=this.matrix,n=this._projScreenMatrix,i=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(e.matrixWorld);t.position.copy(o);i.setFromMatrixPosition(e.target.matrixWorld);t.lookAt(i);t.updateMatrixWorld();n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);this._frustum.setFromProjectionMatrix(n);r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);r.multiply(t.projectionMatrix);r.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){this.camera=e.camera.clone();this.bias=e.bias;this.radius=e.radius;this.mapSize.copy(e.mapSize);return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};0!==this.bias&&(e.bias=this.bias);1!==this.radius&&(e.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)e.mapSize=this.mapSize.toArray();e.camera=this.camera.toJSON(!1).object;delete e.camera.matrix;return e}});Mi.prototype=Object.assign(Object.create(Si.prototype),{constructor:Mi,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,r=2*Vo.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;if(r!==t.fov||n!==t.aspect||i!==t.far)t.fov=r,t.aspect=n,t.far=i,t.updateProjectionMatrix();Si.prototype.updateMatrices.call(this,e)}});Ci.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ci,isSpotLight:!0,copy:function(e){xi.prototype.copy.call(this,e);this.distance=e.distance;this.angle=e.angle;this.penumbra=e.penumbra;this.decay=e.decay;this.target=e.target.clone();this.shadow=e.shadow.clone();return this}});Ti.prototype=Object.assign(Object.create(Si.prototype),{constructor:Ti,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var r=this.camera,n=this.matrix,i=this._lightPositionWorld,o=this._lookTarget,a=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld);r.position.copy(i);o.copy(r.position);o.add(this._cubeDirections[t]);r.up.copy(this._cubeUps[t]);r.lookAt(o);r.updateMatrixWorld();n.makeTranslation(-i.x,-i.y,-i.z);a.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse);this._frustum.setFromProjectionMatrix(a)}});Ei.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ei,isPointLight:!0,copy:function(e){xi.prototype.copy.call(this,e);this.distance=e.distance;this.decay=e.decay;this.shadow=e.shadow.clone();return this}});Oi.prototype=Object.assign(Object.create(V.prototype),{constructor:Oi,isOrthographicCamera:!0,copy:function(e,t){V.prototype.copy.call(this,e,t);this.left=e.left;this.right=e.right;this.top=e.top;this.bottom=e.bottom;this.near=e.near;this.far=e.far;this.zoom=e.zoom;this.view=null===e.view?null:Object.assign({},e.view);return this},setViewOffset:function(e,t,r,n,i,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1});this.view.enabled=!0;this.view.fullWidth=e;this.view.fullHeight=t;this.view.offsetX=r;this.view.offsetY=n;this.view.width=i;this.view.height=o;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,i=r-e;r+=e;e=n+t;t=n-t;null!==this.view&&this.view.enabled&&(n=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom,i+=n*this.view.offsetX,r=i+n*this.view.width,e-=t*this.view.offsetY,t=e-t*this.view.height);this.projectionMatrix.makeOrthographic(i,r,e,t,this.near,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){e=f.prototype.toJSON.call(this,e);e.object.zoom=this.zoom;e.object.left=this.left;e.object.right=this.right;e.object.top=this.top;e.object.bottom=this.bottom;e.object.near=this.near;e.object.far=this.far;null!==this.view&&(e.object.view=Object.assign({},this.view));return e}});Pi.prototype=Object.assign(Object.create(Si.prototype),{constructor:Pi,isDirectionalLightShadow:!0,updateMatrices:function(e){Si.prototype.updateMatrices.call(this,e)}});Ai.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ai,isDirectionalLight:!0,copy:function(e){xi.prototype.copy.call(this,e);this.target=e.target.clone();this.shadow=e.shadow.clone();return this}});ji.prototype=Object.assign(Object.create(xi.prototype),{constructor:ji,isAmbientLight:!0});Ri.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ri,isRectAreaLight:!0,copy:function(e){xi.prototype.copy.call(this,e);this.width=e.width;this.height=e.height;return this},toJSON:function(e){e=xi.prototype.toJSON.call(this,e);e.object.width=this.width;e.object.height=this.height;return e}});Object.assign(ki.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;9>t;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;9>e;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var r=e.x,n=e.y;e=e.z;var i=this.coefficients;t.copy(i[0]).multiplyScalar(.282095);t.addScaledVector(i[1],.488603*n);t.addScaledVector(i[2],.488603*e);t.addScaledVector(i[3],.488603*r);t.addScaledVector(i[4],1.092548*r*n);t.addScaledVector(i[5],1.092548*n*e);t.addScaledVector(i[6],.315392*(3*e*e-1));t.addScaledVector(i[7],1.092548*r*e);t.addScaledVector(i[8],.546274*(r*r-n*n));return t},getIrradianceAt:function(e,t){var r=e.x,n=e.y;e=e.z;var i=this.coefficients;t.copy(i[0]).multiplyScalar(.886227);t.addScaledVector(i[1],1.023328*n);t.addScaledVector(i[2],1.023328*e);t.addScaledVector(i[3],1.023328*r);t.addScaledVector(i[4],.858086*r*n);t.addScaledVector(i[5],.858086*n*e);t.addScaledVector(i[6],.743125*e*e-.247708);t.addScaledVector(i[7],.858086*r*e);t.addScaledVector(i[8],.429043*(r*r-n*n));return t},add:function(e){for(var t=0;9>t;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var r=0;9>r;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this},scale:function(e){for(var t=0;9>t;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var r=0;9>r;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this},equals:function(e){for(var t=0;9>t;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var r=this.coefficients,n=0;9>n;n++)r[n].fromArray(e,t+3*n);return this},toArray:function(e,t){void 0===e&&(e=[]);void 0===t&&(t=0);for(var r=this.coefficients,n=0;9>n;n++)r[n].toArray(e,t+3*n);return e}});Object.assign(ki,{getBasisAt:function(e,t){var r=e.x,n=e.y;e=e.z;t[0]=.282095;t[1]=.488603*n;t[2]=.488603*e;t[3]=.488603*r;t[4]=1.092548*r*n;t[5]=1.092548*n*e;t[6]=.315392*(3*e*e-1);t[7]=1.092548*r*e;t[8]=.546274*(r*r-n*n)}});Li.prototype=Object.assign(Object.create(xi.prototype),{constructor:Li,isLightProbe:!0,copy:function(e){xi.prototype.copy.call(this,e);this.sh.copy(e.sh);return this},fromJSON:function(e){this.intensity=e.intensity;this.sh.fromArray(e.sh);return this},toJSON:function(e){e=xi.prototype.toJSON.call(this,e);e.object.sh=this.sh.toArray();return e}});Ni.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Ni,load:function(t,r,e,n){var i=this,o=new Kn(i.manager);o.setPath(i.path);o.load(t,function(e){try{r(i.parse(JSON.parse(e)))}catch(e){n?n(e):console.error(e),i.manager.itemError(t)}},e,n)},parse:function(e){function t(e){void 0===r[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e);return r[e]}var r=this.textures,n=new Iu[e.type];void 0!==e.uuid&&(n.uuid=e.uuid);void 0!==e.name&&(n.name=e.name);void 0!==e.color&&n.color.setHex(e.color);void 0!==e.roughness&&(n.roughness=e.roughness);void 0!==e.metalness&&(n.metalness=e.metalness);void 0!==e.sheen&&(n.sheen=(new v).setHex(e.sheen));void 0!==e.emissive&&n.emissive.setHex(e.emissive);void 0!==e.specular&&n.specular.setHex(e.specular);void 0!==e.shininess&&(n.shininess=e.shininess);void 0!==e.clearcoat&&(n.clearcoat=e.clearcoat);void 0!==e.clearcoatRoughness&&(n.clearcoatRoughness=e.clearcoatRoughness);void 0!==e.fog&&(n.fog=e.fog);void 0!==e.flatShading&&(n.flatShading=e.flatShading);void 0!==e.blending&&(n.blending=e.blending);void 0!==e.combine&&(n.combine=e.combine);void 0!==e.side&&(n.side=e.side);void 0!==e.opacity&&(n.opacity=e.opacity);void 0!==e.transparent&&(n.transparent=e.transparent);void 0!==e.alphaTest&&(n.alphaTest=e.alphaTest);void 0!==e.depthTest&&(n.depthTest=e.depthTest);void 0!==e.depthWrite&&(n.depthWrite=e.depthWrite);void 0!==e.colorWrite&&(n.colorWrite=e.colorWrite);void 0!==e.stencilWrite&&(n.stencilWrite=e.stencilWrite);void 0!==e.stencilWriteMask&&(n.stencilWriteMask=e.stencilWriteMask);void 0!==e.stencilFunc&&(n.stencilFunc=e.stencilFunc);void 0!==e.stencilRef&&(n.stencilRef=e.stencilRef);void 0!==e.stencilFuncMask&&(n.stencilFuncMask=e.stencilFuncMask);void 0!==e.stencilFail&&(n.stencilFail=e.stencilFail);void 0!==e.stencilZFail&&(n.stencilZFail=e.stencilZFail);void 0!==e.stencilZPass&&(n.stencilZPass=e.stencilZPass);void 0!==e.wireframe&&(n.wireframe=e.wireframe);void 0!==e.wireframeLinewidth&&(n.wireframeLinewidth=e.wireframeLinewidth);void 0!==e.wireframeLinecap&&(n.wireframeLinecap=e.wireframeLinecap);void 0!==e.wireframeLinejoin&&(n.wireframeLinejoin=e.wireframeLinejoin);void 0!==e.rotation&&(n.rotation=e.rotation);1!==e.linewidth&&(n.linewidth=e.linewidth);void 0!==e.dashSize&&(n.dashSize=e.dashSize);void 0!==e.gapSize&&(n.gapSize=e.gapSize);void 0!==e.scale&&(n.scale=e.scale);void 0!==e.polygonOffset&&(n.polygonOffset=e.polygonOffset);void 0!==e.polygonOffsetFactor&&(n.polygonOffsetFactor=e.polygonOffsetFactor);void 0!==e.polygonOffsetUnits&&(n.polygonOffsetUnits=e.polygonOffsetUnits);void 0!==e.skinning&&(n.skinning=e.skinning);void 0!==e.morphTargets&&(n.morphTargets=e.morphTargets);void 0!==e.morphNormals&&(n.morphNormals=e.morphNormals);void 0!==e.dithering&&(n.dithering=e.dithering);void 0!==e.vertexTangents&&(n.vertexTangents=e.vertexTangents);void 0!==e.visible&&(n.visible=e.visible);void 0!==e.toneMapped&&(n.toneMapped=e.toneMapped);void 0!==e.userData&&(n.userData=e.userData);void 0!==e.vertexColors&&(n.vertexColors="number"===typeof e.vertexColors?0<e.vertexColors?!0:!1:e.vertexColors);if(void 0!==e.uniforms)for(var i in e.uniforms){var o=e.uniforms[i];n.uniforms[i]={};switch(o.type){case"t":n.uniforms[i].value=t(o.value);break;case"c":n.uniforms[i].value=(new v).setHex(o.value);break;case"v2":n.uniforms[i].value=(new Me).fromArray(o.value);break;case"v3":n.uniforms[i].value=(new Te).fromArray(o.value);break;case"v4":n.uniforms[i].value=(new Ce).fromArray(o.value);break;case"m3":n.uniforms[i].value=(new m).fromArray(o.value);case"m4":n.uniforms[i].value=(new Ee).fromArray(o.value);break;default:n.uniforms[i].value=o.value}}void 0!==e.defines&&(n.defines=e.defines);void 0!==e.vertexShader&&(n.vertexShader=e.vertexShader);void 0!==e.fragmentShader&&(n.fragmentShader=e.fragmentShader);if(void 0!==e.extensions)for(var a in e.extensions)n.extensions[a]=e.extensions[a];void 0!==e.shading&&(n.flatShading=1===e.shading);void 0!==e.size&&(n.size=e.size);void 0!==e.sizeAttenuation&&(n.sizeAttenuation=e.sizeAttenuation);void 0!==e.map&&(n.map=t(e.map));void 0!==e.matcap&&(n.matcap=t(e.matcap));void 0!==e.alphaMap&&(n.alphaMap=t(e.alphaMap));void 0!==e.bumpMap&&(n.bumpMap=t(e.bumpMap));void 0!==e.bumpScale&&(n.bumpScale=e.bumpScale);void 0!==e.normalMap&&(n.normalMap=t(e.normalMap));void 0!==e.normalMapType&&(n.normalMapType=e.normalMapType);void 0!==e.normalScale&&(i=e.normalScale,!1===Array.isArray(i)&&(i=[i,i]),n.normalScale=(new Me).fromArray(i));void 0!==e.displacementMap&&(n.displacementMap=t(e.displacementMap));void 0!==e.displacementScale&&(n.displacementScale=e.displacementScale);void 0!==e.displacementBias&&(n.displacementBias=e.displacementBias);void 0!==e.roughnessMap&&(n.roughnessMap=t(e.roughnessMap));void 0!==e.metalnessMap&&(n.metalnessMap=t(e.metalnessMap));void 0!==e.emissiveMap&&(n.emissiveMap=t(e.emissiveMap));void 0!==e.emissiveIntensity&&(n.emissiveIntensity=e.emissiveIntensity);void 0!==e.specularMap&&(n.specularMap=t(e.specularMap));void 0!==e.envMap&&(n.envMap=t(e.envMap));void 0!==e.envMapIntensity&&(n.envMapIntensity=e.envMapIntensity);void 0!==e.reflectivity&&(n.reflectivity=e.reflectivity);void 0!==e.refractionRatio&&(n.refractionRatio=e.refractionRatio);void 0!==e.lightMap&&(n.lightMap=t(e.lightMap));void 0!==e.lightMapIntensity&&(n.lightMapIntensity=e.lightMapIntensity);void 0!==e.aoMap&&(n.aoMap=t(e.aoMap));void 0!==e.aoMapIntensity&&(n.aoMapIntensity=e.aoMapIntensity);void 0!==e.gradientMap&&(n.gradientMap=t(e.gradientMap));void 0!==e.clearcoatMap&&(n.clearcoatMap=t(e.clearcoatMap));void 0!==e.clearcoatRoughnessMap&&(n.clearcoatRoughnessMap=t(e.clearcoatRoughnessMap));void 0!==e.clearcoatNormalMap&&(n.clearcoatNormalMap=t(e.clearcoatNormalMap));void 0!==e.clearcoatNormalScale&&(n.clearcoatNormalScale=(new Me).fromArray(e.clearcoatNormalScale));return n},setTextures:function(e){this.textures=e;return this}});var qu={decodeText:function(e){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};Ii.prototype=Object.assign(Object.create(N.prototype),{constructor:Ii,isInstancedBufferGeometry:!0,copy:function(e){N.prototype.copy.call(this,e);this.instanceCount=e.instanceCount;return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=N.prototype.toJSON.call(this);e.instanceCount=this.instanceCount;e.isInstancedBufferGeometry=!0;return e}});Di.prototype=Object.assign(Object.create(E.prototype),{constructor:Di,isInstancedBufferAttribute:!0,copy:function(e){E.prototype.copy.call(this,e);this.meshPerAttribute=e.meshPerAttribute;return this},toJSON:function(){var e=E.prototype.toJSON.call(this);e.meshPerAttribute=this.meshPerAttribute;e.isInstancedBufferAttribute=!0;return e}});Bi.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Bi,load:function(t,r,e,n){var i=this,o=new Kn(i.manager);o.setPath(i.path);o.load(t,function(e){try{r(i.parse(JSON.parse(e)))}catch(e){n?n(e):console.error(e),i.manager.itemError(t)}},e,n)},parse:function(e){var t=e.isInstancedBufferGeometry?new Ii:new N,r=e.data.index;if(void 0!==r){var n=new Wu[r.type](r.array);t.setIndex(new E(n,1))}r=e.data.attributes;for(var i in r){var o=r[i];n=new Wu[o.type](o.array);n=new(o.isInstancedBufferAttribute?Di:E)(n,o.itemSize,o.normalized);void 0!==o.name&&(n.name=o.name);t.setAttribute(i,n)}var a=e.data.morphAttributes;if(a)for(i in a){var s=a[i],u=[];r=0;for(var c=s.length;r<c;r++)o=s[r],n=new Wu[o.type](o.array),n=new E(n,o.itemSize,o.normalized),void 0!==o.name&&(n.name=o.name),u.push(n);t.morphAttributes[i]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);i=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==i)for(r=0,o=i.length;r!==o;++r)n=i[r],t.addGroup(n.start,n.count,n.materialIndex);r=e.data.boundingSphere;void 0!==r&&(i=new Te,void 0!==r.center&&i.fromArray(r.center),t.boundingSphere=new l(i,r.radius));e.name&&(t.name=e.name);e.userData&&(t.userData=e.userData);return t}});var Wu={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!==typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};Fi.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Fi,load:function(r,n,e,i){var o=this,t=""===this.path?qu.extractUrlBase(r):this.path;this.resourcePath=this.resourcePath||t;t=new Kn(o.manager);t.setPath(this.path);t.load(r,function(e){var t=null;try{t=JSON.parse(e)}catch(e){void 0!==i&&i(e);console.error("THREE:ObjectLoader: Can't parse "+r+".",e.message);return}e=t.metadata;void 0===e||void 0===e.type||"geometry"===e.type.toLowerCase()?console.error("THREE.ObjectLoader: Can't load "+r):o.parse(t,n)},e,i)},parse:function(e,t){var r=this.parseShape(e.shapes);r=this.parseGeometries(e.geometries,r);var n=this.parseImages(e.images,function(){void 0!==t&&t(i)});n=this.parseTextures(e.textures,n);n=this.parseMaterials(e.materials,n);var i=this.parseObject(e.object,r,n);e.animations&&(i.animations=this.parseAnimations(e.animations));void 0!==e.images&&0!==e.images.length||void 0===t||t(i);return i},parseShape:function(e){var t={};if(void 0!==e)for(var r=0,n=e.length;r<n;r++){var i=(new bi).fromJSON(e[r]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var r={};if(void 0!==e)for(var n=new Bi,i=0,o=e.length;i<o;i++){var a=e[i];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":var s=new Nu[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Nu[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Nu[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Nu[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Nu[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Nu[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Nu[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Nu[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Nu[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Nu[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"TubeGeometry":case"TubeBufferGeometry":s=new Nu[a.type]((new Uu[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Nu[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Nu[a.type](a.vertices,a.indices,a.radius,a.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":s=[];for(var u=0,c=a.shapes.length;u<c;u++){var l=t[a.shapes[u]];s.push(l)}s=new Nu[a.type](s,a.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":s=[];u=0;for(c=a.shapes.length;u<c;u++)l=t[a.shapes[u]],s.push(l);u=a.options.extrudePath;void 0!==u&&(a.options.extrudePath=(new Uu[u.type]).fromJSON(u));s=new Nu[a.type](s,a.options);break;case"BufferGeometry":case"InstancedBufferGeometry":s=n.parse(a);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+a.type+'"');continue}s.uuid=a.uuid;void 0!==a.name&&(s.name=a.name);!0===s.isBufferGeometry&&void 0!==a.userData&&(s.userData=a.userData);r[a.uuid]=s}return r},parseMaterials:function(e,t){var r={},n={};if(void 0!==e){var i=new Ni;i.setTextures(t);t=0;for(var o=e.length;t<o;t++){var a=e[t];if("MultiMaterial"===a.type){for(var s=[],u=0;u<a.materials.length;u++){var c=a.materials[u];void 0===r[c.uuid]&&(r[c.uuid]=i.parse(c));s.push(r[c.uuid])}n[a.uuid]=s}else void 0===r[a.uuid]&&(r[a.uuid]=i.parse(a)),n[a.uuid]=r[a.uuid]}}return n},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],i=Un.parse(n);void 0!==n.uuid&&(i.uuid=n.uuid);t.push(i)}return t},parseImages:function(e,t){function r(e){n.manager.itemStart(e);return o.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e);n.manager.itemEnd(e)})}var n=this,i={};if(void 0!==e&&0<e.length){t=new Xn(t);var o=new ei(t);o.setCrossOrigin(this.crossOrigin);t=0;for(var a=e.length;t<a;t++){var s=e[t],u=s.url;if(Array.isArray(u)){i[s.uuid]=[];for(var c=0,l=u.length;c<l;c++){var h=u[c];h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;i[s.uuid].push(r(h))}}else h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:n.resourcePath+s.url,i[s.uuid]=r(h)}}return i},parseTextures:function(e,t){function r(e,t){if("number"===typeof e)return e;console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e);return t[e]}var n={};if(void 0!==e)for(var i=0,o=e.length;i<o;i++){var a=e[i];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid);void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=Array.isArray(t[a.image])?new K(t[a.image]):new p(t[a.image]);s.needsUpdate=!0;s.uuid=a.uuid;void 0!==a.name&&(s.name=a.name);void 0!==a.mapping&&(s.mapping=r(a.mapping,Xu));void 0!==a.offset&&s.offset.fromArray(a.offset);void 0!==a.repeat&&s.repeat.fromArray(a.repeat);void 0!==a.center&&s.center.fromArray(a.center);void 0!==a.rotation&&(s.rotation=a.rotation);void 0!==a.wrap&&(s.wrapS=r(a.wrap[0],Yu),s.wrapT=r(a.wrap[1],Yu));void 0!==a.format&&(s.format=a.format);void 0!==a.type&&(s.type=a.type);void 0!==a.encoding&&(s.encoding=a.encoding);void 0!==a.minFilter&&(s.minFilter=r(a.minFilter,Ku));void 0!==a.magFilter&&(s.magFilter=r(a.magFilter,Ku));void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy);void 0!==a.flipY&&(s.flipY=a.flipY);void 0!==a.premultiplyAlpha&&(s.premultiplyAlpha=a.premultiplyAlpha);void 0!==a.unpackAlignment&&(s.unpackAlignment=a.unpackAlignment);n[a.uuid]=s}return n},parseObject:function(e,t,o){function r(e){void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e);return t[e]}function n(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];void 0===o[i]&&console.warn("THREE.ObjectLoader: Undefined material",i);t.push(o[i])}return t}void 0===o[e]&&console.warn("THREE.ObjectLoader: Undefined material",e);return o[e]}}switch(e.type){case"Scene":var i=new Oe;void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new v(e.background));void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new Wt(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new qt(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new H(e.fov,e.aspect,e.near,e.far);void 0!==e.focus&&(i.focus=e.focus);void 0!==e.zoom&&(i.zoom=e.zoom);void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge);void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset);void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new Oi(e.left,e.right,e.top,e.bottom,e.near,e.far);void 0!==e.zoom&&(i.zoom=e.zoom);void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new ji(e.color,e.intensity);break;case"DirectionalLight":i=new Ai(e.color,e.intensity);break;case"PointLight":i=new Ei(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new Ri(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new Ci(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new wi(e.color,e.groundColor,e.intensity);break;case"LightProbe":i=(new Li).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":i=r(e.geometry);var a=n(e.material);i=new I(i,a);break;case"InstancedMesh":i=r(e.geometry);a=n(e.material);var s=e.instanceMatrix;i=new nr(i,a,e.count);i.instanceMatrix=new E(new Float32Array(s.array),16);break;case"LOD":i=new Qt;break;case"Line":i=new or(r(e.geometry),n(e.material),e.mode);break;case"LineLoop":i=new sr(r(e.geometry),n(e.material));break;case"LineSegments":i=new ar(r(e.geometry),n(e.material));break;case"PointCloud":case"Points":i=new cr(r(e.geometry),n(e.material));break;case"Sprite":i=new Zt(n(e.material));break;case"Group":i=new $t;break;default:i=new f}i.uuid=e.uuid;void 0!==e.name&&(i.name=e.name);void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale));void 0!==e.castShadow&&(i.castShadow=e.castShadow);void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow);e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera)));void 0!==e.visible&&(i.visible=e.visible);void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled);void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder);void 0!==e.userData&&(i.userData=e.userData);void 0!==e.layers&&(i.layers.mask=e.layers);if(void 0!==e.children)for(s=e.children,a=0;a<s.length;a++)i.add(this.parseObject(s[a],t,o));if("LOD"===e.type)for(void 0!==e.autoUpdate&&(i.autoUpdate=e.autoUpdate),e=e.levels,s=0;s<e.length;s++){a=e[s];var u=i.getObjectByProperty("uuid",a.object);void 0!==u&&i.addLevel(u,a.distance)}return i}});var Xu={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Yu={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Ku={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};zi.prototype=Object.assign(Object.create(Yn.prototype),{constructor:zi,setOptions:function(e){this.options=e;return this},load:function(t,r,e,n){void 0===t&&(t="");void 0!==this.path&&(t=this.path+t);t=this.manager.resolveURL(t);var i=this,o=Bu.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){r&&r(o);i.manager.itemEnd(t)},0),o;fetch(t).then(function(e){return e.blob()}).then(function(e){return void 0===i.options?createImageBitmap(e):createImageBitmap(e,i.options)}).then(function(e){Bu.add(t,e);r&&r(e);i.manager.itemEnd(t)}).catch(function(e){n&&n(e);i.manager.itemError(t);i.manager.itemEnd(t)});i.manager.itemStart(t)}});Object.assign($i.prototype,{moveTo:function(e,t){this.currentPath=new yi;this.subPaths.push(this.currentPath);this.currentPath.moveTo(e,t);return this},lineTo:function(e,t){this.currentPath.lineTo(e,t);return this},quadraticCurveTo:function(e,t,r,n){this.currentPath.quadraticCurveTo(e,t,r,n);return this},bezierCurveTo:function(e,t,r,n,i,o){this.currentPath.bezierCurveTo(e,t,r,n,i,o);return this},splineThru:function(e){this.currentPath.splineThru(e);return this},toShapes:function(e,t){function r(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r],o=new bi;o.curves=i.curves;t.push(o)}return t}function n(e,t){for(var r=t.length,n=!1,i=r-1,o=0;o<r;i=o++){var a=t[i],s=t[o],u=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=t[o],u=-u,s=t[i],c=-c),!(e.y<a.y||e.y>s.y))if(e.y===a.y){if(e.x===a.x)return!0}else{i=c*(e.x-a.x)-u*(e.y-a.y);if(0===i)return!0;0>i||(n=!n)}}else if(e.y===a.y&&(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x))return!0}return n}var i=ku.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return r(o);t=[];if(1===o.length){var a=o[0];var s=new bi;s.curves=a.curves;t.push(s);return t}var u=!i(o[0].getPoints());u=e?!u:u;s=[];var c=[],l=[],h=0;c[h]=void 0;l[h]=[];for(var p=0,f=o.length;p<f;p++){a=o[p];var d=a.getPoints();var v=i(d);(v=e?!v:v)?(!u&&c[h]&&h++,c[h]={s:new bi,p:d},c[h].s.curves=a.curves,u&&h++,l[h]=[]):l[h].push({h:a,p:d[0]})}if(!c[0])return r(o);if(1<c.length){p=!1;e=[];i=0;for(o=c.length;i<o;i++)s[i]=[];i=0;for(o=c.length;i<o;i++)for(a=l[i],v=0;v<a.length;v++){u=a[v];h=!0;for(d=0;d<c.length;d++)n(u.p,c[d].p)&&(i!==d&&e.push({froms:i,tos:d,hole:v}),h?(h=!1,s[d].push(u)):p=!0);h&&s[i].push(u)}0<e.length&&(p||(l=s))}p=0;for(i=c.length;p<i;p++)for(s=c[p].s,t.push(s),e=l[p],o=0,a=e.length;o<a;o++)s.holes.push(e[o].h);return t}});Object.assign(Gi.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);var r=[],n=t;t=this.data;var i=Array.from?Array.from(e):String(e).split("");n/=t.resolution;var o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n;e=[];for(var a=0,s=0,u=0;u<i.length;u++){var c=i[u];if("\n"===c)a=0,s-=o;else{var l=c;c=n;var h=a,p=s,f=t,d=f.glyphs[l]||f.glyphs["?"];if(d){l=new $i;if(d.o){f=d._cachedOutline||(d._cachedOutline=d.o.split(" "));for(var v=0,m=f.length;v<m;)switch(f[v++]){case"m":var g=f[v++]*c+h;var _=f[v++]*c+p;l.moveTo(g,_);break;case"l":g=f[v++]*c+h;_=f[v++]*c+p;l.lineTo(g,_);break;case"q":var y=f[v++]*c+h;var b=f[v++]*c+p;var x=f[v++]*c+h;var w=f[v++]*c+p;l.quadraticCurveTo(x,w,y,b);break;case"b":y=f[v++]*c+h,b=f[v++]*c+p,x=f[v++]*c+h,w=f[v++]*c+p,g=f[v++]*c+h,_=f[v++]*c+p,l.bezierCurveTo(x,w,g,_,y,b)}}c={offsetX:d.ha*c,path:l}}else console.error('THREE.Font: character "'+l+'" does not exists in font family '+f.familyName+"."),c=void 0;a+=c.offsetX;e.push(c.path)}}t=0;for(i=e.length;t<i;t++)Array.prototype.push.apply(r,e[t].toShapes());return r}});Vi.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Vi,load:function(e,n,t,r){var i=this,o=new Kn(this.manager);o.setPath(this.path);o.load(e,function(t){try{var r=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(t.substring(65,t.length-2))}t=i.parse(r);n&&n(t)},t,r)},parse:function(e){return new Gi(e)}});var Zu,Ju={getContext:function(){void 0===Zu&&(Zu=new(window.AudioContext||window.webkitAudioContext));return Zu},setContext:function(e){Zu=e}};Hi.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Hi,load:function(r,n,e,i){var o=this,t=new Kn(o.manager);t.setResponseType("arraybuffer");t.setPath(o.path);t.load(r,function(e){try{var t=e.slice(0);Ju.getContext().decodeAudioData(t,function(e){n(e)})}catch(e){i?i(e):console.error(e),o.manager.itemError(r)}},e,i)}});Ui.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ui,isHemisphereLightProbe:!0,copy:function(e){Li.prototype.copy.call(this,e);return this},toJSON:function(e){return Li.prototype.toJSON.call(this,e)}});qi.prototype=Object.assign(Object.create(Li.prototype),{constructor:qi,isAmbientLightProbe:!0,copy:function(e){Li.prototype.copy.call(this,e);return this},toJSON:function(e){return Li.prototype.toJSON.call(this,e)}});var Qu=new Ee,ec=new Ee;Object.assign(Wi.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus;t.fov=e.fov;t.aspect=e.aspect*this.aspect;t.near=e.near;t.far=e.far;t.zoom=e.zoom;t.eyeSep=this.eyeSep;var r=e.projectionMatrix.clone(),n=t.eyeSep/2,i=n*t.near/t.focus,o=t.near*Math.tan(Vo.DEG2RAD*t.fov*.5)/t.zoom;ec.elements[12]=-n;Qu.elements[12]=n;n=-o*t.aspect+i;var a=o*t.aspect+i;r.elements[0]=2*t.near/(a-n);r.elements[8]=(a+n)/(a-n);this.cameraL.projectionMatrix.copy(r);n=-o*t.aspect-i;a=o*t.aspect-i;r.elements[0]=2*t.near/(a-n);r.elements[8]=(a+n)/(a-n);this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(ec);this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Qu)}});Object.assign(Xi.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"===typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3;this.oldTime=t;this.elapsedTime+=e}return e}});var tc=new Te,rc=new d,nc=new Te,ic=new Te;Yi.prototype=Object.assign(Object.create(f.prototype),{constructor:Yi,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=e;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01);return this},updateMatrixWorld:function(e){f.prototype.updateMatrixWorld.call(this,e);e=this.context.listener;var t=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(tc,rc,nc);ic.set(0,0,-1).applyQuaternion(rc);if(e.positionX){var r=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(tc.x,r);e.positionY.linearRampToValueAtTime(tc.y,r);e.positionZ.linearRampToValueAtTime(tc.z,r);e.forwardX.linearRampToValueAtTime(ic.x,r);e.forwardY.linearRampToValueAtTime(ic.y,r);e.forwardZ.linearRampToValueAtTime(ic.z,r);e.upX.linearRampToValueAtTime(t.x,r);e.upY.linearRampToValueAtTime(t.y,r);e.upZ.linearRampToValueAtTime(t.z,r)}else e.setPosition(tc.x,tc.y,tc.z),e.setOrientation(ic.x,ic.y,ic.z,t.x,t.y,t.z)}});Ki.prototype=Object.assign(Object.create(f.prototype),{constructor:Ki,getOutput:function(){return this.gain},setNodeSource:function(e){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=e;this.connect();return this},setMediaElementSource:function(e){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(e);this.connect();return this},setMediaStreamSource:function(e){this.hasPlaybackControl=!1;this.sourceType="mediaStreamNode";this.source=this.context.createMediaStreamSource(e);this.connect();return this},setBuffer:function(e){this.buffer=e;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(e){void 0===e&&(e=0);if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this._startedAt=this.context.currentTime+e,e=this.context.createBufferSource(),e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){e||(e=[]);!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e;return this},setDetune:function(e){this.detune=e;if(void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this},setLoopStart:function(e){this.loopStart=e;return this},setLoopEnd:function(e){this.loopEnd=e;return this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01);return this}});var oc=new Te,ac=new d,sc=new Te,uc=new Te;Zi.prototype=Object.assign(Object.create(Ki.prototype),{constructor:Zi,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){this.panner.refDistance=e;return this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){this.panner.rolloffFactor=e;return this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){this.panner.distanceModel=e;return this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){this.panner.maxDistance=e;return this},setDirectionalCone:function(e,t,r){this.panner.coneInnerAngle=e;this.panner.coneOuterAngle=t;this.panner.coneOuterGain=r;return this},updateMatrixWorld:function(e){f.prototype.updateMatrixWorld.call(this,e);if(!0!==this.hasPlaybackControl||!1!==this.isPlaying)if(this.matrixWorld.decompose(oc,ac,sc),uc.set(0,0,1).applyQuaternion(ac),e=this.panner,e.positionX){var t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(oc.x,t);e.positionY.linearRampToValueAtTime(oc.y,t);e.positionZ.linearRampToValueAtTime(oc.z,t);e.orientationX.linearRampToValueAtTime(uc.x,t);e.orientationY.linearRampToValueAtTime(uc.y,t);e.orientationZ.linearRampToValueAtTime(uc.z,t)}else e.setPosition(oc.x,oc.y,oc.z),e.setOrientation(uc.x,uc.y,uc.z)}});Object.assign(Ji.prototype,{getFrequencyData:function(){this.analyser.getByteFrequencyData(this.data);return this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),r=0;r<t.length;r++)e+=t[r];return e/t.length}});Object.assign(Qi.prototype,{accumulate:function(e,t){var r=this.buffer,n=this.valueSize;e=e*n+n;var i=this.cumulativeWeight;if(0===i){for(i=0;i!==n;++i)r[e+i]=r[i];i=t}else i+=t,this._mixBufferRegion(r,e,0,t/i,n);this.cumulativeWeight=i},accumulateAdditive:function(e){var t=this.buffer,r=this.valueSize,n=r*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity();this._mixBufferRegionAdditive(t,n,0,e,r);this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,r=this.buffer;e=e*t+t;var n=this.cumulativeWeight,i=this.cumulativeWeightAdditive,o=this.binding;this.cumulativeWeightAdditive=this.cumulativeWeight=0;1>n&&this._mixBufferRegion(r,e,t*this._origIndex,1-n,t);0<i&&this._mixBufferRegionAdditive(r,e,this._addIndex*t,1,t);n=t;for(i=t+t;n!==i;++n)if(r[n]!==r[n+t]){o.setValue(r,e);break}},saveOriginalState:function(){var e=this.buffer,t=this.valueSize,r=t*this._origIndex;this.binding.getValue(e,r);for(var n=t;n!==r;++n)e[n]=e[r+n%t];this._setIdentity();this.cumulativeWeightAdditive=this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize;e<t;e++)this.buffer[e]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric();this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]},_select:function(e,t,r,n,i){if(.5<=n)for(n=0;n!==i;++n)e[t+n]=e[r+n]},_slerp:function(e,t,r,n){d.slerpFlat(e,t,e,t,e,r,n)},_slerpAdditive:function(e,t,r,n,i){i*=this._workIndex;d.multiplyQuaternionsFlat(e,i,e,t,e,r);d.slerpFlat(e,t,e,t,e,i,n)},_lerp:function(e,t,r,n,i){for(var o=1-n,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[r+a]*n}},_lerpAdditive:function(e,t,r,n,i){for(var o=0;o!==i;++o){var a=t+o;e[a]+=e[r+o]*n}}});var cc=/[\[\]\.:\/]/g,lc="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",hc=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),pc=/(WCOD+)?/.source.replace("WCOD",lc),fc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),dc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),vc=new RegExp("^"+hc+pc+fc+dc+"$"),mc=["material","materials","bones"];Object.assign(eo.prototype,{getValue:function(e,t){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}});Object.assign(to,{Composite:eo,create:function(e,t,r){return e&&e.isAnimationObjectGroup?new to.Composite(e,t,r):new to(e,t,r)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(cc,"")},parseTrackName:function(e){var t=vc.exec(e);if(!t)throw Error("PropertyBinding: Cannot parse trackName: "+e);t={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]};var r=t.nodeName&&t.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var n=t.nodeName.substring(r+1);-1!==mc.indexOf(n)&&(t.nodeName=t.nodeName.substring(0,r),t.objectName=n)}if(null===t.propertyName||0===t.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return t},findNode:function(e,n){if(!n||""===n||"."===n||-1===n||n===e.name||n===e.uuid)return e;if(e.skeleton){var t=e.skeleton.getBoneByName(n);if(void 0!==t)return t}if(e.children){var i=function(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.name===n||r.uuid===n||(r=i(r.children)))return r}return null};if(e=i(e.children))return e}return null}});Object.assign(to.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)e[t++]=r[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t];this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t];this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t);this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t);this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind();this.getValue(e,t)},setValue:function(e,t){this.bind();this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,i=t.propertyIndex;e||(this.node=e=to.findNode(this.rootNode,t.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(e){if(r){var o=t.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(r=0;r<e.length;r++)if(e[r].name===o){o=r;break}break;default:if(void 0===e[r]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(void 0!==o){if(void 0===e[o]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[o]}}o=e[n];if(void 0===o)console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+n+" but it wasn't found.",e);else{t=this.Versioning.None;this.targetObject=e;void 0!==e.needsUpdate?t=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(t=this.Versioning.MatrixWorldNeedsUpdate);r=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===n){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}r=this.BindingType.ArrayElement;this.resolvedProperty=o;this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(r=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(r=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=n;this.getValue=this.GetterByBindingType[r];this.setValue=this.SetterByBindingTypeAndVersioning[r][t]}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}});Object.assign(to.prototype,{_getValue_unbound:to.prototype.getValue,_setValue_unbound:to.prototype.setValue});Object.assign(ro.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,u=void 0,c=0,l=arguments.length;c!==l;++c){var h=arguments[c],p=h.uuid,f=n[p];if(void 0===f){f=t++;n[p]=f;e.push(h);p=0;for(var d=s;p!==d;++p)a[p].push(new to(h,i[p],o[p]))}else if(f<r){u=e[f];var v=--r;d=e[v];n[d.uuid]=f;e[f]=d;n[p]=v;e[v]=h;p=0;for(d=s;p!==d;++p){var m=a[p],g=m[f];m[f]=m[v];void 0===g&&(g=new to(h,i[p],o[p]));m[v]=g}}else e[f]!==u&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=r},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,i=n.length,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],u=s.uuid,c=r[u];if(void 0!==c&&c>=t){var l=t++,h=e[l];r[h.uuid]=c;e[c]=h;r[u]=l;e[l]=s;s=0;for(u=i;s!==u;++s){h=n[s];var p=h[c];h[c]=h[l];h[l]=p}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,o=i.length,a=0,s=arguments.length;a!==s;++a){var u=arguments[a].uuid,c=n[u];if(void 0!==c)if(delete n[u],c<r){u=--r;var l=e[u],h=--t,p=e[h];n[l.uuid]=c;e[c]=l;n[p.uuid]=u;e[u]=p;e.pop();l=0;for(p=o;l!==p;++l){var f=i[l],d=f[h];f[c]=f[u];f[u]=d;f.pop()}}else for(h=--t,p=e[h],n[p.uuid]=c,e[c]=p,e.pop(),l=0,p=o;l!==p;++l)f=i[l],f[c]=f[h],f.pop()}this.nCachedObjects_=r},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,n=r[e],i=this._bindings;if(void 0!==n)return i[n];var o=this._paths,a=this._parsedPaths,s=this._objects,u=this.nCachedObjects_,c=Array(s.length);n=i.length;r[e]=n;o.push(e);a.push(t);i.push(c);r=u;for(n=s.length;r!==n;++r)c[r]=new to(s[r],e,t);return c},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var n=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=r;o[r]=s;o.pop();i[r]=i[a];i.pop();n[r]=n[a];n.pop()}}});Object.assign(no.prototype,{play:function(){this._mixer._activateAction(this);return this},stop:function(){this._mixer._deactivateAction(this);return this.reset()},reset:function(){this.paused=!1;this.enabled=!0;this.time=0;this._loopCount=-1;this._startTime=null;return this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){this._startTime=e;return this},setLoop:function(e,t){this.loop=e;this.repetitions=t;return this},setEffectiveWeight:function(e){this.weight=e;this._effectiveWeight=this.enabled?e:0;return this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){e.fadeOut(t);this.fadeIn(t);if(r){r=this._clip.duration;var n=e._clip.duration,i=r/n;e.warp(1,n/r,t);this.warp(i,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e));return this},setEffectiveTimeScale:function(e){this.timeScale=e;this._effectiveTimeScale=this.paused?0:e;return this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){this.timeScale=this._clip.duration/e;return this.stopWarping()},syncWith:function(e){this.time=e.time;this.timeScale=e.timeScale;return this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,r){var n=this._mixer,i=n.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(this._timeScaleInterpolant=o=n._lendControlInterpolant());n=o.parameterPositions;o=o.sampleValues;n[0]=i;n[1]=i+r;o[0]=e/a;o[1]=t/a;return this},stopWarping:function(){var e=this._timeScaleInterpolant;null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e));return this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,n){if(this.enabled){var i=this._startTime;if(null!==i){t=(e-i)*r;if(0>t||0===r)return;this._startTime=null;t*=r}t*=this._updateTimeScale(e);r=this._updateTime(t);e=this._updateWeight(e);if(0<e)switch(t=this._interpolants,i=this._propertyBindings,this.blendMode){case 2501:for(var o=0,a=t.length;o!==a;++o)t[o].evaluate(r),i[o].accumulateAdditive(e);break;default:for(o=0,a=t.length;o!==a;++o)t[o].evaluate(r),i[o].accumulate(n,e)}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var n=r.evaluate(e)[0];t*=n;e>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r){var n=r.evaluate(e)[0];t*=n;e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e,r=this._clip.duration,n=this.loop,i=this._loopCount,o=2202===n;if(0===e)return-1===i?t:o&&1===(i&1)?r-t:t;if(2200===n)e:{if(-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1)),t>=r)t=r;else if(0>t)t=0;else{this.time=t;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=t;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1})}else{-1===i&&(0<=e?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o));if(t>=r||0>t){n=Math.floor(t/r);t-=r*n;i+=Math.abs(n);var a=this.repetitions-i;0>=a?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t=0<e?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1})):(1===a?(e=0>e,this._setEndings(e,!e,o)):this._setEndings(!1,!1,o),this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n}))}else this.time=t;if(o&&1===(i&1))return r-t}return t},_setEndings:function(e,t,r){var n=this._interpolantSettings;r?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,r){var n=this._mixer,i=n.time,o=this._weightInterpolant;null===o&&(this._weightInterpolant=o=n._lendControlInterpolant());n=o.parameterPositions;o=o.sampleValues;n[0]=i;o[0]=t;n[1]=i+e;o[1]=r;return this}});io.prototype=Object.assign(Object.create(t.prototype),{constructor:io,_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,i=n.length,o=e._propertyBindings;e=e._interpolants;var a=r.uuid,s=this._bindingsByRootAndName,u=s[a];void 0===u&&(u={},s[a]=u);for(s=0;s!==i;++s){var c=n[s],l=c.name,h=u[l];if(void 0===h){h=o[s];if(void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}h=new Qi(to.create(r,l,t&&t._propertyBindings[s].binding.parsedPath),c.ValueTypeName,c.getValueSize());++h.referenceCount;this._addInactiveBinding(h,a,l)}o[s]=h;e[s].resultBuffer=h.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,n=this._actionsByClip[r];this._bindAction(e,n&&n.knownActions[0]);this._addInactiveAction(e,r,t)}t=e._propertyBindings;r=0;for(n=t.length;r!==n;++r){var i=t[r];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){e=e._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(e,t,r){var n=this._actions,i=this._actionsByClip,o=i[t];void 0===o?(o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o):(t=o.knownActions,e._byClipCacheIndex=t.length,t.push(e));e._cacheIndex=n.length;n.push(e);o.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n;t[n]=r;t.pop();e._cacheIndex=null;t=e._clip.uuid;r=this._actionsByClip;n=r[t];var i=n.knownActions,o=i[i.length-1],a=e._byClipCacheIndex;o._byClipCacheIndex=a;i[a]=o;i.pop();e._byClipCacheIndex=null;delete n.actionByRoot[(e._localRoot||this._root).uuid];0===i.length&&delete r[t];this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){e=e._propertyBindings;for(var t=0,r=e.length;t!==r;++t){var n=e[t];0===--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,i=t[n];e._cacheIndex=n;t[n]=e;i._cacheIndex=r;t[r]=i},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,i=t[n];e._cacheIndex=n;t[n]=e;i._cacheIndex=r;t[r]=i},_addInactiveBinding:function(e,t,r){var n=this._bindingsByRootAndName,i=n[t],o=this._bindings;void 0===i&&(i={},n[t]=i);i[r]=e;e._cacheIndex=o.length;o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,n=r.rootNode.uuid;r=r.path;var i=this._bindingsByRootAndName,o=i[n],a=t[t.length-1];e=e._cacheIndex;a._cacheIndex=e;t[e]=a;t.pop();delete o[r];0===Object.keys(o).length&&delete i[n]},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,i=t[n];e._cacheIndex=n;t[n]=e;i._cacheIndex=r;t[r]=i},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,i=t[n];e._cacheIndex=n;t[n]=e;i._cacheIndex=r;t[r]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];void 0===r&&(r=new Nn(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r);return r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,i=t[n];e.__cacheIndex=n;t[n]=e;i.__cacheIndex=r;t[r]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,r){var n=t||this._root,i=n.uuid;n="string"===typeof e?Un.findByName(n,e):e;e=null!==n?n.uuid:e;var o=this._actionsByClip[e],a=null;void 0===r&&(r=null!==n?n.blendMode:2500);if(void 0!==o){a=o.actionByRoot[i];if(void 0!==a&&a.blendMode===r)return a;a=o.knownActions[0];null===n&&(n=a._clip)}if(null===n)return null;t=new no(this,n,t,r);this._bindAction(t,a);this._addInactiveAction(t,e,i);return t},existingAction:function(e,t){var r=t||this._root;t=r.uuid;r="string"===typeof e?Un.findByName(r,e):e;e=this._actionsByClip[r?r.uuid:e];return void 0!==e?e.actionByRoot[t]||null:null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;0<=t;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,n=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1,a=0;a!==r;++a)t[a]._update(n,e,i,o);e=this._bindings;t=this._nActiveBindings;for(a=0;a!==t;++a)e[a].apply(o);return this},setTime:function(e){for(var t=this.time=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions;e=e.uuid;var r=this._actionsByClip,n=r[e];if(void 0!==n){n=n.knownActions;for(var i=0,o=n.length;i!==o;++i){var a=n[i];this._deactivateAction(a);var s=a._cacheIndex,u=t[t.length-1];a._cacheIndex=null;a._byClipCacheIndex=null;u._cacheIndex=s;t[s]=u;t.pop();this._removeInactiveBindingsForAction(a)}delete r[e]}},uncacheRoot:function(e){e=e.uuid;var t=this._actionsByClip;for(n in t){var r=t[n].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var n=this._bindingsByRootAndName[e];if(void 0!==n)for(var i in n)e=n[i],e.restoreOriginalState(),this._removeInactiveBinding(e)},uncacheAction:function(e,t){e=this.existingAction(e,t);null!==e&&(this._deactivateAction(e),this._removeInactiveAction(e))}});oo.prototype.clone=function(){return new oo(void 0===this.value.clone?this.value:this.value.clone())};ao.prototype=Object.assign(Object.create(Xt.prototype),{constructor:ao,isInstancedInterleavedBuffer:!0,copy:function(e){Xt.prototype.copy.call(this,e);this.meshPerAttribute=e.meshPerAttribute;return this}});Object.assign(so.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,r){r=r||[];co(e,this,r,t);r.sort(uo);return r},intersectObjects:function(e,t,r){r=r||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var n=0,i=e.length;n<i;n++)co(e[n],this,r,t);r.sort(uo);return r}});Object.assign(lo.prototype,{set:function(e,t,r){this.radius=e;this.phi=t;this.theta=r;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.radius=e.radius;this.phi=e.phi;this.theta=e.theta;return this},makeSafe:function(){this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi));return this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,r){this.radius=Math.sqrt(e*e+t*t+r*r);0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(e,r),this.phi=Math.acos(Vo.clamp(t/this.radius,-1,1)));return this}});Object.assign(ho.prototype,{set:function(e,t,r){this.radius=e;this.theta=t;this.y=r;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.radius=e.radius;this.theta=e.theta;this.y=e.y;return this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,r){this.radius=Math.sqrt(e*e+r*r);this.theta=Math.atan2(e,r);this.y=t;return this}});var gc=new Me;Object.assign(po.prototype,{set:function(e,t){this.min.copy(e);this.max.copy(t);return this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){t=gc.copy(t).multiplyScalar(.5);this.min.copy(e).sub(t);this.max.copy(e).add(t);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.min.copy(e.min);this.max.copy(e.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new Me);return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new Me);return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){this.min.min(e);this.max.max(e);return this},expandByVector:function(e){this.min.sub(e);this.max.add(e);return this},expandByScalar:function(e){this.min.addScalar(-e);this.max.addScalar(e);return this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Me);return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Me);return t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return gc.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){this.min.max(e.min);this.max.min(e.max);return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this},translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var _c=new Te,yc=new Te;Object.assign(fo.prototype,{set:function(e,t){this.start.copy(e);this.end.copy(t);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.start.copy(e.start);this.end.copy(e.end);return this},getCenter:function(e){void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Te);return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Te);return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Te);return this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){_c.subVectors(e,this.start);yc.subVectors(this.end,this.start);e=yc.dot(yc);e=yc.dot(_c)/e;t&&(e=Vo.clamp(e,0,1));return e},closestPointToPoint:function(e,t,r){e=this.closestPointToPointParameter(e,t);void 0===r&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),r=new Te);return this.delta(r).multiplyScalar(e).add(this.start)},applyMatrix4:function(e){this.start.applyMatrix4(e);this.end.applyMatrix4(e);return this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}});vo.prototype=Object.create(f.prototype);vo.prototype.constructor=vo;vo.prototype.isImmediateRenderObject=!0;var bc=new Te;mo.prototype=Object.create(f.prototype);mo.prototype.constructor=mo;mo.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};mo.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e);bc.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(bc);void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var xc=new Te,wc=new Ee,Sc=new Ee;_o.prototype=Object.create(ar.prototype);_o.prototype.constructor=_o;_o.prototype.isSkeletonHelper=!0;_o.prototype.updateMatrixWorld=function(e){var t=this.bones,r=this.geometry,n=r.getAttribute("position");Sc.getInverse(this.root.matrixWorld);for(var i=0,o=0;i<t.length;i++){var a=t[i];a.parent&&a.parent.isBone&&(wc.multiplyMatrices(Sc,a.matrixWorld),xc.setFromMatrixPosition(wc),n.setXYZ(o,xc.x,xc.y,xc.z),wc.multiplyMatrices(Sc,a.parent.matrixWorld),xc.setFromMatrixPosition(wc),n.setXYZ(o+1,xc.x,xc.y,xc.z),o+=2)}r.getAttribute("position").needsUpdate=!0;f.prototype.updateMatrixWorld.call(this,e)};yo.prototype=Object.create(I.prototype);yo.prototype.constructor=yo;yo.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};yo.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var Mc=new Te,Cc=new v,Tc=new v;bo.prototype=Object.create(f.prototype);bo.prototype.constructor=bo;bo.prototype.dispose=function(){this.children[0].geometry.dispose();this.children[0].material.dispose()};bo.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Cc.copy(this.light.color);Tc.copy(this.light.groundColor);for(var r=0,n=t.count;r<n;r++){var i=r<n/2?Cc:Tc;t.setXYZ(r,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(Mc.setFromMatrixPosition(this.light.matrixWorld).negate())};xo.prototype=Object.assign(Object.create(ar.prototype),{constructor:xo,copy:function(e){ar.prototype.copy.call(this,e);this.geometry.copy(e.geometry);this.material.copy(e.material);return this},clone:function(){return(new this.constructor).copy(this)}});wo.prototype=Object.create(ar.prototype);wo.prototype.constructor=wo;var Ec=new Te,Oc=new Te,Pc=new Te;So.prototype=Object.create(f.prototype);So.prototype.constructor=So;So.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()};So.prototype.update=function(){Ec.setFromMatrixPosition(this.light.matrixWorld);Oc.setFromMatrixPosition(this.light.target.matrixWorld);Pc.subVectors(Oc,Ec);this.lightPlane.lookAt(Oc);void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color));this.targetLine.lookAt(Oc);this.targetLine.scale.z=Pc.length()};var Ac=new Te,jc=new V;Mo.prototype=Object.create(ar.prototype);Mo.prototype.constructor=Mo;Mo.prototype.update=function(){var e=this.geometry,t=this.pointMap;jc.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);Co("c",t,e,jc,0,0,-1);Co("t",t,e,jc,0,0,1);Co("n1",t,e,jc,-1,-1,-1);Co("n2",t,e,jc,1,-1,-1);Co("n3",t,e,jc,-1,1,-1);Co("n4",t,e,jc,1,1,-1);Co("f1",t,e,jc,-1,-1,1);Co("f2",t,e,jc,1,-1,1);Co("f3",t,e,jc,-1,1,1);Co("f4",t,e,jc,1,1,1);Co("u1",t,e,jc,.7,1.1,-1);Co("u2",t,e,jc,-.7,1.1,-1);Co("u3",t,e,jc,0,2,-1);Co("cf1",t,e,jc,-1,0,1);Co("cf2",t,e,jc,1,0,1);Co("cf3",t,e,jc,0,-1,1);Co("cf4",t,e,jc,0,1,1);Co("cn1",t,e,jc,-1,0,-1);Co("cn2",t,e,jc,1,0,-1);Co("cn3",t,e,jc,0,-1,-1);Co("cn4",t,e,jc,0,1,-1);e.getAttribute("position").needsUpdate=!0};var Rc=new n;To.prototype=Object.create(ar.prototype);To.prototype.constructor=To;To.prototype.update=function(e){void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments.");void 0!==this.object&&Rc.setFromObject(this.object);if(!Rc.isEmpty()){e=Rc.min;var t=Rc.max,r=this.geometry.attributes.position,n=r.array;n[0]=t.x;n[1]=t.y;n[2]=t.z;n[3]=e.x;n[4]=t.y;n[5]=t.z;n[6]=e.x;n[7]=e.y;n[8]=t.z;n[9]=t.x;n[10]=e.y;n[11]=t.z;n[12]=t.x;n[13]=t.y;n[14]=e.z;n[15]=e.x;n[16]=t.y;n[17]=e.z;n[18]=e.x;n[19]=e.y;n[20]=e.z;n[21]=t.x;n[22]=e.y;n[23]=e.z;r.needsUpdate=!0;this.geometry.computeBoundingSphere()}};To.prototype.setFromObject=function(e){this.object=e;this.update();return this};To.prototype.copy=function(e){ar.prototype.copy.call(this,e);this.object=e.object;return this};To.prototype.clone=function(){return(new this.constructor).copy(this)};Eo.prototype=Object.create(ar.prototype);Eo.prototype.constructor=Eo;Eo.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),f.prototype.updateMatrixWorld.call(this,e))};Oo.prototype=Object.create(or.prototype);Oo.prototype.constructor=Oo;Oo.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;1e-8>Math.abs(t)&&(t=1e-8);this.scale.set(.5*this.size,.5*this.size,t);this.children[0].material.side=0>t?1:0;this.lookAt(this.plane.normal);f.prototype.updateMatrixWorld.call(this,e)};var kc=new Te,Lc,Nc;Po.prototype=Object.create(f.prototype);Po.prototype.constructor=Po;Po.prototype.setDirection=function(e){.99999<e.y?this.quaternion.set(0,0,0,1):-.99999>e.y?this.quaternion.set(1,0,0,0):(kc.set(e.z,0,-e.x).normalize(),this.quaternion.setFromAxisAngle(kc,Math.acos(e.y)))};Po.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e);void 0===r&&(r=.2*t);this.line.scale.set(1,Math.max(1e-4,e-t),1);this.line.updateMatrix();this.cone.scale.set(r,t,r);this.cone.position.y=e;this.cone.updateMatrix()};Po.prototype.setColor=function(e){this.line.material.color.set(e);this.cone.material.color.set(e)};Po.prototype.copy=function(e){f.prototype.copy.call(this,e,!1);this.line.copy(e.line);this.cone.copy(e.cone);return this};Po.prototype.clone=function(){return(new this.constructor).copy(this)};Ao.prototype=Object.create(ar.prototype);Ao.prototype.constructor=Ao;var Ic=Math.pow(2,8),Dc=[.125,.215,.35,.446,.526,.582],Bc=5+Dc.length,Fc={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},zc=new Oi,$c=function(){for(var e=[],t=[],r=[],n=8,i=0;i<Bc;i++){var o=Math.pow(2,n);t.push(o);var a=1/o;4<i?a=Dc[i-8+4-1]:0==i&&(a=0);r.push(a);a=1/(o-1);o=-a/2;a=1+a/2;var s=[o,o,a,o,a,a,o,o,a,a,o,a];o=new Float32Array(108);a=new Float32Array(72);for(var u=new Float32Array(36),c=0;6>c;c++){var l=c%3*2/3-1,h=2<c?0:-1;o.set([l,h,0,l+2/3,h,0,l+2/3,h+1,0,l,h,0,l+2/3,h+1,0,l,h+1,0],18*c);a.set(s,12*c);u.set([c,c,c,c,c,c],6*c)}s=new N;s.setAttribute("position",new E(o,3));s.setAttribute("uv",new E(a,2));s.setAttribute("faceIndex",new E(u,1));e.push(s);4<n&&n--}return{_lodPlanes:e,_sizeLods:t,_sigmas:r}}(),Gc=$c._lodPlanes,Vc=$c._sizeLods,Hc=$c._sigmas,Uc=null,qc=(1+Math.sqrt(5))/2,Wc=1/qc,Xc=[new Te(1,1,1),new Te(-1,1,1),new Te(1,1,-1),new Te(-1,1,-1),new Te(0,qc,Wc),new Te(0,qc,-Wc),new Te(Wc,0,qc),new Te(-Wc,0,qc),new Te(qc,Wc,0),new Te(-qc,Wc,0)];jo.prototype={constructor:jo,fromScene:function(e,t,r,n){void 0===t&&(t=0);void 0===r&&(r=.1);void 0===n&&(n=100);Uc=this._renderer.getRenderTarget();var i=this._allocateTargets();this._sceneToCubeUV(e,r,n,i);0<t&&this._blur(i,0,0,t);this._applyPMREM(i);this._cleanup(i);return i},fromEquirectangular:function(e){e.magFilter=1003;e.minFilter=1003;e.generateMipmaps=!1;return this.fromCubemap(e)},fromCubemap:function(e){Uc=this._renderer.getRenderTarget();var t=this._allocateTargets(e);this._textureToCubeUV(e,t);this._applyPMREM(t);this._cleanup(t);return t},compileCubemapShader:function(){null===this._cubemapShader&&(this._cubemapShader=No(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){null===this._equirectShader&&(this._equirectShader=Lo(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose();null!==this._cubemapShader&&this._cubemapShader.dispose();null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<Gc.length;e++)Gc[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose();this._renderer.setRenderTarget(Uc);e.scissorTest=!1;e.setSize(e.width,e.height)},_allocateTargets:function(e){var t=void 0===e||1009!==e.type?!1:3e3===e.encoding||3001===e.encoding||3007===e.encoding;t={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:t?e.encoding:3002,depthBuffer:!1,stencilBuffer:!1};var r=Ro(t);r.depthBuffer=e?!1:!0;this._pingPongRenderTarget=Ro(t);return r},_compileMaterial:function(e){e=new I(Gc[0],e);this._renderer.compile(e,zc)},_sceneToCubeUV:function(e,t,r,n){t=new H(90,1,t,r);r=[1,-1,1,1,1,1];var i=[1,1,1,-1,-1,-1],o=this._renderer,a=o.outputEncoding,s=o.toneMapping,u=o.toneMappingExposure,c=o.getClearColor(),l=o.getClearAlpha();o.toneMapping=1;o.toneMappingExposure=1;o.outputEncoding=3e3;var h=e.background;if(h&&h.isColor){h.convertSRGBToLinear();var p=Math.min(Math.max(Math.ceil(Math.log2(Math.max(h.r,h.g,h.b))),-128),127);h=h.multiplyScalar(Math.pow(2,-p));o.setClearColor(h,(p+128)/255);e.background=null}for(h=0;6>h;h++)p=h%3,0==p?(t.up.set(0,r[h],0),t.lookAt(i[h],0,0)):1==p?(t.up.set(0,0,r[h]),t.lookAt(0,i[h],0)):(t.up.set(0,r[h],0),t.lookAt(0,0,i[h])),ko(n,p*Ic,2<h?Ic:0,Ic,Ic),o.setRenderTarget(n),o.render(e,t);o.toneMapping=s;o.toneMappingExposure=u;o.outputEncoding=a;o.setClearColor(c,l)},_textureToCubeUV:function(e,t){var r=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=No()):null==this._equirectShader&&(this._equirectShader=Lo());var n=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new I(Gc[0],n);n=n.uniforms;n.envMap.value=e;e.isCubeTexture||n.texelSize.value.set(1/e.image.width,1/e.image.height);n.inputEncoding.value=Fc[e.encoding];n.outputEncoding.value=Fc[t.texture.encoding];ko(t,0,0,3*Ic,2*Ic);r.setRenderTarget(t);r.render(i,zc)},_applyPMREM:function(e){var t=this._renderer,r=t.autoClear;t.autoClear=!1;for(var n=1;n<Bc;n++)this._blur(e,n-1,n,Math.sqrt(Hc[n]*Hc[n]-Hc[n-1]*Hc[n-1]),Xc[(n-1)%Xc.length]);t.autoClear=r},_blur:function(e,t,r,n,i){var o=this._pingPongRenderTarget;this._halfBlur(e,o,t,r,n,"latitudinal",i);this._halfBlur(o,e,r,r,n,"longitudinal",i)},_halfBlur:function(e,t,r,n,i,o,a){var s=this._renderer,u=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");var c=new I(Gc[n],u);u=u.uniforms;var l=Vc[r]-1;l=isFinite(i)?Math.PI/(2*l):2*Math.PI/39;var h=i/l,p=isFinite(i)?1+Math.floor(3*h):20;20<p&&console.warn("sigmaRadians, "+i+", is too large and will clip, as it requested "+p+" samples when the maximum is set to 20");i=[];for(var f=0,d=0;20>d;++d){var v=d/h;v=Math.exp(-v*v/2);i.push(v);0==d?f+=v:d<p&&(f+=2*v)}for(d=0;d<i.length;d++)i[d]/=f;u.envMap.value=e.texture;u.samples.value=p;u.weights.value=i;u.latitudinal.value="latitudinal"===o;a&&(u.poleAxis.value=a);u.dTheta.value=l;u.mipInt.value=8-r;u.inputEncoding.value=Fc[e.texture.encoding];u.outputEncoding.value=Fc[e.texture.encoding];e=Vc[n];v=3*Math.max(0,Ic-2*e);ko(t,v,(0===n?0:2*Ic)+2*e*(4<n?n-8+4:0),3*e,2*e);s.setRenderTarget(t);s.render(c,zc)}};ni.create=function(e,t){console.log("THREE.Curve.create() has been deprecated");e.prototype=Object.create(ni.prototype);e.prototype.constructor=e;e.prototype.getPoint=t;return e};Object.assign(_i.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");e=this.getPoints(e);return this.createGeometry(e)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");e=this.getSpacedPoints(e);return this.createGeometry(e)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new F,r=0,n=e.length;r<n;r++){var i=e[r];t.vertices.push(new Te(i.x,i.y,i.z||0))}return t}});Object.assign(yi.prototype,{fromPoints:function(e){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints().");return this.setFromPoints(e)}});Bo.prototype=Object.create(si.prototype);Fo.prototype=Object.create(si.prototype);zo.prototype=Object.create(si.prototype);Object.assign(zo.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});xo.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};_o.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(Yn.prototype,{extractUrlBase:function(e){console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.");return qu.extractUrlBase(e)}});Yn.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Object.assign(Fi.prototype,{setTexturePath:function(e){console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().");return this.setResourcePath(e)}});Object.assign(po.prototype,{center:function(e){console.warn("THREE.Box2: .center() has been renamed to .getCenter().");return this.getCenter(e)},empty:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(e){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(e)},size:function(e){console.warn("THREE.Box2: .size() has been renamed to .getSize().");return this.getSize(e)}});Object.assign(n.prototype,{center:function(e){console.warn("THREE.Box3: .center() has been renamed to .getCenter().");return this.getCenter(e)},empty:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(e){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(e)},isIntersectionSphere:function(e){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(e)},size:function(e){console.warn("THREE.Box3: .size() has been renamed to .getSize().");return this.getSize(e)}});Object.assign(l.prototype,{empty:function(){console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty().");return this.isEmpty()}});Ae.prototype.setFromMatrix=function(e){console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().");return this.setFromProjectionMatrix(e)};fo.prototype.center=function(e){console.warn("THREE.Line3: .center() has been renamed to .getCenter().");return this.getCenter(e)};Object.assign(Vo,{random16:function(){console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead.");return Math.random()},nearestPowerOfTwo:function(e){console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().");return Vo.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().");return Vo.ceilPowerOfTwo(e)}});Object.assign(m.prototype,{flattenToArrayOffset:function(e,t){console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(e,t)},multiplyVector3:function(e){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.");return e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(Ee.prototype,{extractPosition:function(e){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");return this.copyPosition(e)},flattenToArrayOffset:function(e,t){console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(e,t)},getPosition:function(){console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");return(new Te).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.");return e.applyMatrix4(this)},multiplyVector4:function(e){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");e.transformDirection(this)},crossVector:function(e){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.");return e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,r,n,i,o){console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.");return this.makePerspective(e,t,n,r,i,o)}});g.prototype.isIntersectionLine=function(e){console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().");return this.intersectsLine(e)};d.prototype.multiplyVector3=function(e){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return e.applyQuaternion(this)};Object.assign(s.prototype,{isIntersectionBox:function(e){console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(e)},isIntersectionPlane:function(e){console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().");return this.intersectsPlane(e)},isIntersectionSphere:function(e){console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(e)}});Object.assign(b.prototype,{area:function(){console.warn("THREE.Triangle: .area() has been renamed to .getArea().");return this.getArea()},barycoordFromPoint:function(e,t){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return this.getBarycoord(e,t)},midpoint:function(e){console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint().");return this.getMidpoint(e)},normal:function(e){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return this.getNormal(e)},plane:function(e){console.warn("THREE.Triangle: .plane() has been renamed to .getPlane().");return this.getPlane(e)}});Object.assign(b,{barycoordFromPoint:function(e,t,r,n,i){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return b.getBarycoord(e,t,r,n,i)},normal:function(e,t,r,n){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return b.getNormal(e,t,r,n)}});Object.assign(bi.prototype,{extractAllPoints:function(e){console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.");return this.extractPoints(e)},extrude:function(e){console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.");return new tn(this,e)},makeGeometry:function(e){console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.");return new fn(this,e)}});Object.assign(Me.prototype,{fromAttribute:function(e,t,r){console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(e)},lengthManhattan:function(){console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(Te.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(t,e)},applyProjection:function(e){console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.");return this.applyMatrix4(e)},fromAttribute:function(e,t,r){console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(e)},lengthManhattan:function(){console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(Ce.prototype,{fromAttribute:function(e,t,r){console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(e,t,r)},lengthManhattan:function(){console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(F.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().");return this.applyMatrix4(e)}});Object.assign(f.prototype,{getChildByName:function(e){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().");return this.applyMatrix4(e)}});Object.defineProperties(f.prototype,{eulerOrder:{get:function(){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");return this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.assign(I.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}});Object.defineProperties(I.prototype,{drawMode:{get:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.");return 0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});Object.defineProperties(Qt.prototype,{objects:{get:function(){console.warn("THREE.LOD: .objects has been renamed to .levels.");return this.levels}}});Object.defineProperty(tr.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});er.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(ni.prototype,"__arcLengthDivisions",{get:function(){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");return this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");this.arcLengthDivisions=e}});H.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.");void 0!==t&&(this.filmGauge=t);this.setFocalLength(e)};Object.defineProperties(xi.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov.");this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left.");this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right.");this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top.");this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.");this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near.");this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far.");this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias.");this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.");this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.");this.shadow.mapSize.height=e}}});Object.defineProperties(E.prototype,{length:{get:function(){console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead.");return this.array.length}},dynamic:{get:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.");return 35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.");this.setUsage(35048)}}});Object.assign(E.prototype,{setDynamic:function(e){console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.");this.setUsage(!0===e?35048:35044);return this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(N.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(e)},addAttribute:function(e,t,r){console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().");return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new E(t,r)))},addDrawCall:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.");console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup().");this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().");this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().");return this.deleteAttribute(e)},applyMatrix:function(e){console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().");return this.applyMatrix4(e)}});Object.defineProperties(N.prototype,{drawcalls:{get:function(){console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups.");return this.groups}},offsets:{get:function(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups.");return this.groups}}});Object.defineProperties(Ii.prototype,{maxInstancedCount:{get:function(){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.");return this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.");this.instanceCount=e}}});Object.defineProperties(so.prototype,{linePrecision:{get:function(){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.");return this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.");this.params.Line.threshold=e}}});Object.defineProperties(Xt.prototype,{dynamic:{get:function(){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.");return 35048===this.usage},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.");this.setUsage(e)}}});Object.assign(Xt.prototype,{setDynamic:function(e){console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.");this.setUsage(!0===e?35048:35044);return this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(rn.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.defineProperties(oo.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.");return this}}});Object.defineProperties(y.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){console.warn("THREE.Material: .wrapRGB has been removed.");return new v}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.");this.flatShading=1===e}},stencilMask:{get:function(){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead.");return this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead.");this.stencilFuncMask=e}}});Object.defineProperties(En.prototype,{metal:{get:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.");return!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(G.prototype,{derivatives:{get:function(){console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");return this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=e}}});Object.assign(Ut.prototype,{clearTarget:function(e,t,r,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.");this.setRenderTarget(e);this.clear(t,r,n)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop().");this.setAnimationLoop(e)},getCurrentRenderTarget:function(){console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().");return this.getRenderTarget()},getMaxAnisotropy:function(){console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().");return this.capabilities.getMaxAnisotropy()},getPrecision:function(){console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.");return this.capabilities.precision},resetGLState:function(){console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset().");return this.state.reset()},supportsFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.");return this.capabilities.vertexTextures},supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().");this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().");return this.getActiveMipmapLevel()}});Object.defineProperties(Ut.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.");return this.getContext()}},vr:{get:function(){console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr");return this.xr}},gammaInput:{get:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.");return!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.");return!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.");this.outputEncoding=!0===e?3001:3e3}}});Object.defineProperties(It.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(T.prototype,{wrapS:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");return this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");this.texture.wrapS=e}},wrapT:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");return this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");this.texture.wrapT=e}},magFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");return this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");this.texture.magFilter=e}},minFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");return this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");this.texture.minFilter=e}},anisotropy:{get:function(){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");return this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=e}},offset:{get:function(){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");return this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");this.texture.offset=e}},repeat:{get:function(){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");return this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");this.texture.repeat=e}},format:{get:function(){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");return this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");this.texture.format=e}},type:{get:function(){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");return this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");this.texture.type=e}},generateMipmaps:{get:function(){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");return this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");this.texture.generateMipmaps=e}}});Object.defineProperties(Ki.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;(new Hi).load(e,function(e){t.setBuffer(e)});return this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}});Ji.prototype.getData=function(){console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData().");return this.getFrequencyData()};U.prototype.updateCubeMap=function(e,t){console.warn("THREE.CubeCamera: .updateCubeMap() is now .update().");return this.update(e,t)};Uo.crossOrigin=void 0;Uo.loadTexture=function(e,t,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new ri;i.setCrossOrigin(this.crossOrigin);e=i.load(e,r,void 0,n);t&&(e.mapping=t);return e};Uo.loadTextureCube=function(e,t,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new ti;i.setCrossOrigin(this.crossOrigin);e=i.load(e,r,void 0,n);t&&(e.mapping=t);return e};Uo.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Uo.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"117"}}));e.ACESFilmicToneMapping=5;e.AddEquation=100;e.AddOperation=2;e.AdditiveAnimationBlendMode=2501;e.AdditiveBlending=2;e.AlphaFormat=1021;e.AlwaysDepth=1;e.AlwaysStencilFunc=519;e.AmbientLight=ji;e.AmbientLightProbe=qi;e.AnimationClip=Un;e.AnimationLoader=Zn;e.AnimationMixer=io;e.AnimationObjectGroup=ro;e.AnimationUtils=Du;e.ArcCurve=oi;e.ArrayCamera=zt;e.ArrowHelper=Po;e.Audio=Ki;e.AudioAnalyser=Ji;e.AudioContext=Ju;e.AudioListener=Yi;e.AudioLoader=Hi;e.AxesHelper=Ao;e.AxisHelper=function(e){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper.");return new Ao(e)};e.BackSide=1;e.BasicDepthPacking=3200;e.BasicShadowMap=0;e.BinaryTextureLoader=function(e){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.");return new Qn(e)};e.Bone=rr;e.BooleanKeyframeTrack=Bn;e.BoundingBoxHelper=function(e,t){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.");return new To(e,t)};e.Box2=po;e.Box3=n;e.Box3Helper=Eo;e.BoxBufferGeometry=js;e.BoxGeometry=As;e.BoxHelper=To;e.BufferAttribute=E;e.BufferGeometry=N;e.BufferGeometryLoader=Bi;e.ByteType=1010;e.Cache=Bu;e.Camera=V;e.CameraHelper=Mo;e.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")};e.CanvasTexture=fr;e.CatmullRomCurve3=si;e.CineonToneMapping=4;e.CircleBufferGeometry=wn;e.CircleGeometry=xn;e.ClampToEdgeWrapping=1001;e.Clock=Xi;e.ClosedSplineCurve3=Bo;e.Color=v;e.ColorKeyframeTrack=Fn;e.CompressedTexture=pr;e.CompressedTextureLoader=Jn;e.ConeBufferGeometry=bn;e.ConeGeometry=yn;e.CubeCamera=U;e.CubeGeometry=As;e.CubeReflectionMapping=301;e.CubeRefractionMapping=302;e.CubeTexture=K;e.CubeTextureLoader=ti;e.CubeUVReflectionMapping=306;e.CubeUVRefractionMapping=307;e.CubicBezierCurve=hi;e.CubicBezierCurve3=pi;e.CubicInterpolant=Ln;e.CullFaceBack=1;e.CullFaceFront=2;e.CullFaceFrontBack=3;e.CullFaceNone=0;e.Curve=ni;e.CurvePath=_i;e.CustomBlending=5;e.CylinderBufferGeometry=_n;e.CylinderGeometry=gn;e.Cylindrical=ho;e.DataTexture=Pe;e.DataTexture2DArray=Z;e.DataTexture3D=J;e.DataTextureLoader=Qn;e.DecrementStencilOp=7683;e.DecrementWrapStencilOp=34056;e.DefaultLoadingManager=Fu;e.DepthFormat=1026;e.DepthStencilFormat=1027;e.DepthTexture=dr;e.DirectionalLight=Ai;e.DirectionalLightHelper=So;e.DirectionalLightShadow=Pi;e.DiscreteInterpolant=In;e.DodecahedronBufferGeometry=Er;e.DodecahedronGeometry=Tr;e.DoubleSide=2;e.DstAlphaFactor=206;e.DstColorFactor=208;e.DynamicBufferAttribute=function(e,t){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.");return new E(e,t).setUsage(35048)};e.DynamicCopyUsage=35050;e.DynamicDrawUsage=35048;e.DynamicReadUsage=35049;e.EdgesGeometry=mn;e.EdgesHelper=function(e,t){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.");return new ar(new mn(e.geometry),new ir({color:void 0!==t?t:16777215}))};e.EllipseCurve=ii;e.EqualDepth=4;e.EqualStencilFunc=514;e.EquirectangularReflectionMapping=303;e.EquirectangularRefractionMapping=304;e.Euler=i;e.EventDispatcher=t;e.ExtrudeBufferGeometry=rn;e.ExtrudeGeometry=tn;e.Face3=_;e.Face4=function(e,t,r,n,i,o,a){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new _(e,t,r,i,o,a)};e.FaceColors=1;e.FileLoader=Kn;e.FlatShading=1;e.Float32Attribute=function(e,t){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.");return new j(e,t)};e.Float32BufferAttribute=j;e.Float64Attribute=function(e,t){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.");return new R(e,t)};e.Float64BufferAttribute=R;e.FloatType=1015;e.Fog=Wt;e.FogExp2=qt;e.Font=Gi;e.FontLoader=Vi;e.FrontFaceDirectionCCW=1;e.FrontFaceDirectionCW=0;e.FrontSide=0;e.Frustum=Ae;e.GammaEncoding=3007;e.Geometry=F;e.GeometryUtils={merge:function(e,t,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");if(t.isMesh){t.matrixAutoUpdate&&t.updateMatrix();var n=t.matrix;t=t.geometry}e.merge(t,n,r)},center:function(e){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return e.center()}};e.GreaterDepth=6;e.GreaterEqualDepth=5;e.GreaterEqualStencilFunc=518;e.GreaterStencilFunc=516;e.GridHelper=xo;e.Group=$t;e.HalfFloatType=1016;e.HemisphereLight=wi;e.HemisphereLightHelper=bo;e.HemisphereLightProbe=Ui;e.IcosahedronBufferGeometry=Cr;e.IcosahedronGeometry=Mr;e.ImageBitmapLoader=zi;e.ImageLoader=ei;e.ImageUtils=Uo;e.ImmediateRenderObject=vo;e.IncrementStencilOp=7682;e.IncrementWrapStencilOp=34055;e.InstancedBufferAttribute=Di;e.InstancedBufferGeometry=Ii;e.InstancedInterleavedBuffer=ao;e.InstancedMesh=nr;e.Int16Attribute=function(e,t){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.");return new C(e,t)};e.Int16BufferAttribute=C;e.Int32Attribute=function(e,t){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.");return new P(e,t)};e.Int32BufferAttribute=P;e.Int8Attribute=function(e,t){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.");return new w(e,t)};e.Int8BufferAttribute=w;e.IntType=1013;e.InterleavedBuffer=Xt;e.InterleavedBufferAttribute=Yt;e.Interpolant=kn;e.InterpolateDiscrete=2300;e.InterpolateLinear=2301;e.InterpolateSmooth=2302;e.InvertStencilOp=5386;e.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")};e.KeepStencilOp=7680;e.KeyframeTrack=Dn;e.LOD=Qt;e.LatheBufferGeometry=pn;e.LatheGeometry=hn;e.Layers=o;e.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")};e.LessDepth=2;e.LessEqualDepth=3;e.LessEqualStencilFunc=515;e.LessStencilFunc=513;e.Light=xi;e.LightProbe=Li;e.LightShadow=Si;e.Line=or;e.Line3=fo;e.LineBasicMaterial=ir;e.LineCurve=fi;e.LineCurve3=di;e.LineDashedMaterial=Rn;e.LineLoop=sr;e.LinePieces=1;e.LineSegments=ar;e.LineStrip=0;e.LinearEncoding=3e3;e.LinearFilter=1006;e.LinearInterpolant=Nn;e.LinearMipMapLinearFilter=1008;e.LinearMipMapNearestFilter=1007;e.LinearMipmapLinearFilter=1008;e.LinearMipmapNearestFilter=1007;e.LinearToneMapping=1;e.Loader=Yn;e.LoaderUtils=qu;e.LoadingManager=Xn;e.LogLuvEncoding=3003;e.LoopOnce=2200;e.LoopPingPong=2202;e.LoopRepeat=2201;e.LuminanceAlphaFormat=1025;e.LuminanceFormat=1024;e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};e.Material=y;e.MaterialLoader=Ni;e.Math=Vo;e.MathUtils=Vo;e.Matrix3=m;e.Matrix4=Ee;e.MaxEquation=104;e.Mesh=I;e.MeshBasicMaterial=x;e.MeshDepthMaterial=Lt;e.MeshDistanceMaterial=Nt;e.MeshFaceMaterial=function(e){console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead.");return e};e.MeshLambertMaterial=An;e.MeshMatcapMaterial=jn;e.MeshNormalMaterial=Pn;e.MeshPhongMaterial=En;e.MeshPhysicalMaterial=Tn;e.MeshStandardMaterial=Cn;e.MeshToonMaterial=On;e.MinEquation=103;e.MirroredRepeatWrapping=1002;e.MixOperation=1;e.MultiMaterial=function(e){void 0===e&&(e=[]);console.warn("THREE.MultiMaterial has been removed. Use an Array instead.");e.isMultiMaterial=!0;e.materials=e;e.clone=function(){return e.slice()};return e};e.MultiplyBlending=4;e.MultiplyOperation=0;e.NearestFilter=1003;e.NearestMipMapLinearFilter=1005;e.NearestMipMapNearestFilter=1004;e.NearestMipmapLinearFilter=1005;e.NearestMipmapNearestFilter=1004;e.NeverDepth=0;e.NeverStencilFunc=512;e.NoBlending=0;e.NoColors=0;e.NoToneMapping=0;e.NormalAnimationBlendMode=2500;e.NormalBlending=1;e.NotEqualDepth=7;e.NotEqualStencilFunc=517;e.NumberKeyframeTrack=zn;e.Object3D=f;e.ObjectLoader=Fi;e.ObjectSpaceNormalMap=1;e.OctahedronBufferGeometry=Sr;e.OctahedronGeometry=wr;e.OneFactor=201;e.OneMinusDstAlphaFactor=207;e.OneMinusDstColorFactor=209;e.OneMinusSrcAlphaFactor=205;e.OneMinusSrcColorFactor=203;e.OrthographicCamera=Oi;e.PCFShadowMap=1;e.PCFSoftShadowMap=2;e.PMREMGenerator=jo;e.ParametricBufferGeometry=gr;e.ParametricGeometry=mr;e.Particle=function(e){console.warn("THREE.Particle has been renamed to THREE.Sprite.");return new Zt(e)};e.ParticleBasicMaterial=function(e){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.");return new ur(e)};e.ParticleSystem=function(e,t){console.warn("THREE.ParticleSystem has been renamed to THREE.Points.");return new cr(e,t)};e.ParticleSystemMaterial=function(e){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.");return new ur(e)};e.Path=yi;e.PerspectiveCamera=H;e.Plane=g;e.PlaneBufferGeometry=X;e.PlaneGeometry=W;e.PlaneHelper=Oo;e.PointCloud=function(e,t){console.warn("THREE.PointCloud has been renamed to THREE.Points.");return new cr(e,t)};e.PointCloudMaterial=function(e){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.");return new ur(e)};e.PointLight=Ei;e.PointLightHelper=yo;e.Points=cr;e.PointsMaterial=ur;e.PolarGridHelper=wo;e.PolyhedronBufferGeometry=yr;e.PolyhedronGeometry=_r;e.PositionalAudio=Zi;e.PropertyBinding=to;e.PropertyMixer=Qi;e.QuadraticBezierCurve=vi;e.QuadraticBezierCurve3=mi;e.Quaternion=d;e.QuaternionKeyframeTrack=Gn;e.QuaternionLinearInterpolant=$n;e.REVISION="117";e.RGBADepthPacking=3201;e.RGBAFormat=1023;e.RGBAIntegerFormat=1033;e.RGBA_ASTC_10x10_Format=37819;e.RGBA_ASTC_10x5_Format=37816;e.RGBA_ASTC_10x6_Format=37817;e.RGBA_ASTC_10x8_Format=37818;e.RGBA_ASTC_12x10_Format=37820;e.RGBA_ASTC_12x12_Format=37821;e.RGBA_ASTC_4x4_Format=37808;e.RGBA_ASTC_5x4_Format=37809;e.RGBA_ASTC_5x5_Format=37810;e.RGBA_ASTC_6x5_Format=37811;e.RGBA_ASTC_6x6_Format=37812;e.RGBA_ASTC_8x5_Format=37813;e.RGBA_ASTC_8x6_Format=37814;e.RGBA_ASTC_8x8_Format=37815;e.RGBA_BPTC_Format=36492;e.RGBA_ETC2_EAC_Format=37496;e.RGBA_PVRTC_2BPPV1_Format=35843;e.RGBA_PVRTC_4BPPV1_Format=35842;e.RGBA_S3TC_DXT1_Format=33777;e.RGBA_S3TC_DXT3_Format=33778;e.RGBA_S3TC_DXT5_Format=33779;e.RGBDEncoding=3006;e.RGBEEncoding=3002;e.RGBEFormat=1023;e.RGBFormat=1022;e.RGBIntegerFormat=1032;e.RGBM16Encoding=3005;e.RGBM7Encoding=3004;e.RGB_ETC1_Format=36196;e.RGB_ETC2_Format=37492;e.RGB_PVRTC_2BPPV1_Format=35841;e.RGB_PVRTC_4BPPV1_Format=35840;e.RGB_S3TC_DXT1_Format=33776;e.RGFormat=1030;e.RGIntegerFormat=1031;e.RawShaderMaterial=Mn;e.Ray=s;e.Raycaster=so;e.RectAreaLight=Ri;e.RedFormat=1028;e.RedIntegerFormat=1029;e.ReinhardToneMapping=2;e.RepeatWrapping=1e3;e.ReplaceStencilOp=7681;e.ReverseSubtractEquation=102;e.RingBufferGeometry=ln;e.RingGeometry=cn;e.SRGB8_ALPHA8_ASTC_10x10_Format=37851;e.SRGB8_ALPHA8_ASTC_10x5_Format=37848;e.SRGB8_ALPHA8_ASTC_10x6_Format=37849;e.SRGB8_ALPHA8_ASTC_10x8_Format=37850;e.SRGB8_ALPHA8_ASTC_12x10_Format=37852;e.SRGB8_ALPHA8_ASTC_12x12_Format=37853;e.SRGB8_ALPHA8_ASTC_4x4_Format=37840;e.SRGB8_ALPHA8_ASTC_5x4_Format=37841;e.SRGB8_ALPHA8_ASTC_5x5_Format=37842;e.SRGB8_ALPHA8_ASTC_6x5_Format=37843;e.SRGB8_ALPHA8_ASTC_6x6_Format=37844;e.SRGB8_ALPHA8_ASTC_8x5_Format=37845;e.SRGB8_ALPHA8_ASTC_8x6_Format=37846;e.SRGB8_ALPHA8_ASTC_8x8_Format=37847;e.Scene=Oe;e.SceneUtils={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};e.ShaderChunk=Is;e.ShaderLib=Ds;e.ShaderMaterial=G;e.ShadowMaterial=Sn;e.Shape=bi;e.ShapeBufferGeometry=dn;e.ShapeGeometry=fn;e.ShapePath=$i;e.ShapeUtils=ku;e.ShortType=1011;e.Skeleton=tr;e.SkeletonHelper=_o;e.SkinnedMesh=er;e.SmoothShading=2;e.Sphere=l;e.SphereBufferGeometry=un;e.SphereGeometry=sn;e.Spherical=lo;e.SphericalHarmonics3=ki;e.SphericalReflectionMapping=305;e.Spline=zo;e.SplineCurve=gi;e.SplineCurve3=Fo;e.SpotLight=Ci;e.SpotLightHelper=mo;e.SpotLightShadow=Mi;e.Sprite=Zt;e.SpriteMaterial=Kt;e.SrcAlphaFactor=204;e.SrcAlphaSaturateFactor=210;e.SrcColorFactor=202;e.StaticCopyUsage=35046;e.StaticDrawUsage=35044;e.StaticReadUsage=35045;e.StereoCamera=Wi;e.StreamCopyUsage=35042;e.StreamDrawUsage=35040;e.StreamReadUsage=35041;e.StringKeyframeTrack=Vn;e.SubtractEquation=101;e.SubtractiveBlending=3;e.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};e.TangentSpaceNormalMap=0;e.TetrahedronBufferGeometry=xr;e.TetrahedronGeometry=br;e.TextBufferGeometry=an;e.TextGeometry=on;e.Texture=p;e.TextureLoader=ri;e.TorusBufferGeometry=kr;e.TorusGeometry=Rr;e.TorusKnotBufferGeometry=jr;e.TorusKnotGeometry=Ar;e.Triangle=b;e.TriangleFanDrawMode=2;e.TriangleStripDrawMode=1;e.TrianglesDrawMode=0;e.TubeBufferGeometry=Pr;e.TubeGeometry=Or;e.UVMapping=300;e.Uint16Attribute=function(e,t){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.");return new O(e,t)};e.Uint16BufferAttribute=O;e.Uint32Attribute=function(e,t){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.");return new A(e,t)};e.Uint32BufferAttribute=A;e.Uint8Attribute=function(e,t){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.");return new S(e,t)};e.Uint8BufferAttribute=S;e.Uint8ClampedAttribute=function(e,t){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.");return new M(e,t)};e.Uint8ClampedBufferAttribute=M;e.Uncharted2ToneMapping=3;e.Uniform=oo;e.UniformsLib=Ns;e.UniformsUtils=Rs;e.UnsignedByteType=1009;e.UnsignedInt248Type=1020;e.UnsignedIntType=1014;e.UnsignedShort4444Type=1017;e.UnsignedShort5551Type=1018;e.UnsignedShort565Type=1019;e.UnsignedShortType=1012;e.VSMShadowMap=3;e.Vector2=Me;e.Vector3=Te;e.Vector4=Ce;e.VectorKeyframeTrack=Hn;e.Vertex=function(e,t,r){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead.");return new Te(e,t,r)};e.VertexColors=2;e.VideoTexture=hr;e.WebGLCubeRenderTarget=q;e.WebGLMultisampleRenderTarget=r;e.WebGLRenderTarget=T;e.WebGLRenderTargetCube=function(e,t,r){console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).");return new q(e,r)};e.WebGLRenderer=Ut;e.WebGLUtils=Ft;e.WireframeGeometry=vr;e.WireframeHelper=function(e,t){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.");return new ar(new vr(e.geometry),new ir({color:void 0!==t?t:16777215}))};e.WrapAroundEnding=2402;e.XHRLoader=function(e){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader.");return new Kn(e)};e.ZeroCurvatureEnding=2400;e.ZeroFactor=200;e.ZeroSlopeEnding=2401;e.ZeroStencilOp=0;e.sRGBEncoding=3001;Object.defineProperty(e,"__esModule",{value:!0})})},{}],243:[function(e,t,r){"use strict";t.exports=n;function n(e,t){if(!(this instanceof n))return new n(e,t);this.data=e||[];this.length=this.data.length;this.compare=t||i;if(this.length>0){for(var r=this.length>>1;r>=0;r--)this._down(r)}}function i(e,t){return e<t?-1:e>t?1:0}n.prototype={push:function(e){this.data.push(e);this.length++;this._up(this.length-1)},pop:function(){if(this.length===0)return undefined;var e=this.data[0];this.length--;if(this.length>0){this.data[0]=this.data[this.length];this._down(0)}this.data.pop();return e},peek:function(){return this.data[0]},_up:function(e){var t=this.data;var r=this.compare;var n=t[e];while(e>0){var i=e-1>>1;var o=t[i];if(r(n,o)>=0)break;t[e]=o;e=i}t[e]=n},_down:function(e){var t=this.data;var r=this.compare;var n=this.length;var i=n>>1;var o=t[e];while(e<i){var a=(e<<1)+1;var s=a+1;var u=t[a];if(s<n&&r(t[s],u)<0){a=s;u=t[s]}if(r(u,o)>=0)break;t[e]=u;e=a}t[e]=o}}},{}],244:[function(e,t,r){var n=e("./vdom/create-element.js");t.exports=n},{"./vdom/create-element.js":250}],245:[function(e,t,r){var n=e("./vtree/diff.js");t.exports=n},{"./vtree/diff.js":270}],246:[function(e,t,r){var n=e("./virtual-hyperscript/index.js");t.exports=n},{"./virtual-hyperscript/index.js":257}],247:[function(e,t,r){var n=e("./diff.js");var i=e("./patch.js");var o=e("./h.js");var a=e("./create-element.js");var s=e("./vnode/vnode.js");var u=e("./vnode/vtext.js");t.exports={diff:n,patch:i,h:o,create:a,VNode:s,VText:u}},{"./create-element.js":244,"./diff.js":245,"./h.js":246,"./patch.js":248,"./vnode/vnode.js":266,"./vnode/vtext.js":268}],248:[function(e,t,r){var n=e("./vdom/patch.js");t.exports=n},{"./vdom/patch.js":253}],249:[function(e,t,r){var h=e("is-object");var s=e("../vnode/is-vhook.js");t.exports=n;function n(e,t,r){for(var n in t){var i=t[n];if(i===undefined){o(e,n,i,r)}else if(s(i)){o(e,n,i,r);if(i.hook){i.hook(e,n,r?r[n]:undefined)}}else{if(h(i)){a(e,t,r,n,i)}else{e[n]=i}}}}function o(e,t,r,n){if(n){var i=n[t];if(!s(i)){if(t==="attributes"){for(var o in i){e.removeAttribute(o)}}else if(t==="style"){for(var a in i){e.style[a]=""}}else if(typeof i==="string"){e[t]=""}else{e[t]=null}}else if(i.unhook){i.unhook(e,t,r)}}}function a(e,t,r,n,i){var o=r?r[n]:undefined;if(n==="attributes"){for(var a in i){var s=i[a];if(s===undefined){e.removeAttribute(a)}else{e.setAttribute(a,s)}}return}if(o&&h(o)&&p(o)!==p(i)){e[n]=i;return}if(!h(e[n])){e[n]={}}var u=n==="style"?"":undefined;for(var c in i){var l=i[c];e[n][c]=l===undefined?u:l}}function p(e){if(Object.getPrototypeOf){return Object.getPrototypeOf(e)}else if(e.__proto__){return e.__proto__}else if(e.constructor){return e.constructor.prototype}}},{"../vnode/is-vhook.js":261,"is-object":20}],250:[function(e,t,r){var c=e("global/document");var l=e("./apply-properties");var h=e("../vnode/is-vnode.js");var p=e("../vnode/is-vtext.js");var f=e("../vnode/is-widget.js");var d=e("../vnode/handle-thunk.js");t.exports=v;function v(e,t){var r=t?t.document||c:c;var n=t?t.warn:null;e=d(e).a;if(f(e)){return e.init()}else if(p(e)){return r.createTextNode(e.text)}else if(!h(e)){if(n){n("Item is not a valid virtual dom node",e)}return null}var i=e.namespace===null?r.createElement(e.tagName):r.createElementNS(e.namespace,e.tagName);var o=e.properties;l(i,o);var a=e.children;for(var s=0;s<a.length;s++){var u=v(a[s],t);if(u){i.appendChild(u)}}return i}},{"../vnode/handle-thunk.js":259,"../vnode/is-vnode.js":262,"../vnode/is-vtext.js":263,"../vnode/is-widget.js":264,"./apply-properties":249,"global/document":16}],251:[function(e,t,r){var l={};t.exports=n;function n(e,t,r,n){if(!r||r.length===0){return{}}else{r.sort(i);return h(e,t,r,n,0)}}function h(e,t,r,n,i){n=n||{};if(e){if(p(r,i,i)){n[i]=e}var o=t.children;if(o){var a=e.childNodes;for(var s=0;s<t.children.length;s++){i+=1;var u=o[s]||l;var c=i+(u.count||0);if(p(r,i,c)){h(a[s],u,r,n,i)}i=c}}}return n}function p(e,t,r){if(e.length===0){return false}var n=0;var i=e.length-1;var o;var a;while(n<=i){o=(i+n)/2>>0;a=e[o];if(n===i){return a>=t&&a<=r}else if(a<t){n=o+1}else if(a>r){i=o-1}else{return true}}return false}function i(e,t){return e>t?1:-1}},{}],252:[function(e,t,r){var a=e("./apply-properties");var n=e("../vnode/is-widget.js");var s=e("../vnode/vpatch.js");var u=e("./update-widget");t.exports=i;function i(e,t,r){var n=e.type;var i=e.vNode;var o=e.patch;switch(n){case s.REMOVE:return c(t,i);case s.INSERT:return l(t,o,r);case s.VTEXT:return h(t,i,o,r);case s.WIDGET:return p(t,i,o,r);case s.VNODE:return f(t,i,o,r);case s.ORDER:v(t,o);return t;case s.PROPS:a(t,o,i.properties);return t;case s.THUNK:return m(t,r.patch(t,o,r));default:return t}}function c(e,t){var r=e.parentNode;if(r){r.removeChild(e)}d(e,t);return null}function l(e,t,r){var n=r.render(t,r);if(e){e.appendChild(n)}return e}function h(e,t,r,n){var i;if(e.nodeType===3){e.replaceData(0,e.length,r.text);i=e}else{var o=e.parentNode;i=n.render(r,n);if(o&&i!==e){o.replaceChild(i,e)}}return i}function p(e,t,r,n){var i=u(t,r);var o;if(i){o=r.update(t,e)||e}else{o=n.render(r,n)}var a=e.parentNode;if(a&&o!==e){a.replaceChild(o,e)}if(!i){d(e,t)}return o}function f(e,t,r,n){var i=e.parentNode;var o=n.render(r,n);if(i&&o!==e){i.replaceChild(o,e)}return o}function d(e,t){if(typeof t.destroy==="function"&&n(t)){t.destroy(e)}}function v(e,t){var r=e.childNodes;var n={};var i;var o;var a;for(var s=0;s<t.removes.length;s++){o=t.removes[s];i=r[o.from];if(o.key){n[o.key]=i}e.removeChild(i)}var u=r.length;for(var c=0;c<t.inserts.length;c++){a=t.inserts[c];i=n[a.key];e.insertBefore(i,a.to>=u++?null:r[a.to])}}function m(e,t){if(e&&t&&e!==t&&e.parentNode){e.parentNode.replaceChild(t,e)}return t}},{"../vnode/is-widget.js":264,"../vnode/vpatch.js":267,"./apply-properties":249,"./update-widget":254}],253:[function(e,t,r){var u=e("global/document");var a=e("x-is-array");var n=e("./create-element");var c=e("./dom-index");var s=e("./patch-op");t.exports=i;function i(e,t,r){r=r||{};r.patch=r.patch&&r.patch!==i?r.patch:o;r.render=r.render||n;return r.patch(e,t,r)}function o(e,t,r){var n=h(t);if(n.length===0){return e}var i=c(e,t.a,n);var o=e.ownerDocument;if(!r.document&&o!==u){r.document=o}for(var a=0;a<n.length;a++){var s=n[a];e=l(e,i[s],t[s],r)}return e}function l(e,t,r,n){if(!t){return e}var i;if(a(r)){for(var o=0;o<r.length;o++){i=s(r[o],t,n);if(t===e){e=i}}}else{i=s(r,t,n);if(t===e){e=i}}return e}function h(e){var t=[];for(var r in e){if(r!=="a"){t.push(Number(r))}}return t}},{"./create-element":250,"./dom-index":251,"./patch-op":252,"global/document":16,"x-is-array":289}],254:[function(e,t,r){var n=e("../vnode/is-widget.js");t.exports=i;function i(e,t){if(n(e)&&n(t)){if("name"in e&&"name"in t){return e.id===t.id}else{return e.init===t.init}}return false}},{"../vnode/is-widget.js":264}],255:[function(e,t,r){"use strict";var i=e("ev-store");t.exports=n;function n(e){if(!(this instanceof n)){return new n(e)}this.value=e}n.prototype.hook=function(e,t){var r=i(e);var n=t.substr(3);r[n]=this.value};n.prototype.unhook=function(e,t){var r=i(e);var n=t.substr(3);r[n]=undefined}},{"ev-store":9}],256:[function(e,t,r){"use strict";t.exports=n;function n(e){if(!(this instanceof n)){return new n(e)}this.value=e}n.prototype.hook=function(e,t){if(e[t]!==this.value){e[t]=this.value}}},{}],257:[function(e,t,r){"use strict";var o=e("x-is-array");var u=e("../vnode/vnode.js");var a=e("../vnode/vtext.js");var n=e("../vnode/is-vnode");var i=e("../vnode/is-vtext");var s=e("../vnode/is-widget");var c=e("../vnode/is-vhook");var l=e("../vnode/is-thunk");var h=e("./parse-tag.js");var p=e("./hooks/soft-set-hook.js");var f=e("./hooks/ev-hook.js");t.exports=d;function d(e,t,r){var n=[];var i,o,a,s;if(!r&&_(t)){r=t;o={}}o=o||t||{};i=h(e,o);if(o.hasOwnProperty("key")){a=o.key;o.key=undefined}if(o.hasOwnProperty("namespace")){s=o.namespace;o.namespace=undefined}if(i==="INPUT"&&!s&&o.hasOwnProperty("value")&&o.value!==undefined&&!c(o.value)){o.value=p(o.value)}m(o);if(r!==undefined&&r!==null){v(r,n,i,o)}return new u(i,o,n,a,s)}function v(e,t,r,n){if(typeof e==="string"){t.push(new a(e))}else if(typeof e==="number"){t.push(new a(String(e)))}else if(g(e)){t.push(e)}else if(o(e)){for(var i=0;i<e.length;i++){v(e[i],t,r,n)}}else if(e===null||e===undefined){return}else{throw y({foreignObject:e,parentVnode:{tagName:r,properties:n}})}}function m(e){for(var t in e){if(e.hasOwnProperty(t)){var r=e[t];if(c(r)){continue}if(t.substr(0,3)==="ev-"){e[t]=f(r)}}}}function g(e){return n(e)||i(e)||s(e)||l(e)}function _(e){return typeof e==="string"||o(e)||g(e)}function y(e){var t=new Error;t.type="virtual-hyperscript.unexpected.virtual-element";t.message="Unexpected virtual child passed to h().\n"+"Expected a VNode / Vthunk / VWidget / string but:\n"+"got:\n"+b(e.foreignObject)+".\n"+"The parent vnode is:\n"+b(e.parentVnode);"\n"+"Suggested fix: change your `h(..., [ ... ])` callsite.";t.foreignObject=e.foreignObject;t.parentVnode=e.parentVnode;return t}function b(t){try{return JSON.stringify(t,null,"    ")}catch(e){return String(t)}}},{"../vnode/is-thunk":260,"../vnode/is-vhook":261,"../vnode/is-vnode":262,"../vnode/is-vtext":263,"../vnode/is-widget":264,"../vnode/vnode.js":266,"../vnode/vtext.js":268,"./hooks/ev-hook.js":255,"./hooks/soft-set-hook.js":256,"./parse-tag.js":258,"x-is-array":289}],258:[function(e,t,r){"use strict";var c=e("browser-split");var l=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/;var h=/^\.|#/;t.exports=n;function n(e,t){if(!e){return"DIV"}var r=!t.hasOwnProperty("id");var n=c(e,l);var i=null;if(h.test(n[1])){i="DIV"}var o,a,s,u;for(u=0;u<n.length;u++){a=n[u];if(!a){continue}s=a.charAt(0);if(!i){i=a}else if(s==="."){o=o||[];o.push(a.substring(1,a.length))}else if(s==="#"&&r){t.id=a.substring(1,a.length)}}if(o){if(t.className){o.push(t.className)}t.className=o.join(" ")}return t.namespace?i:i.toUpperCase()}},{"browser-split":5}],259:[function(e,t,r){var n=e("./is-vnode");var i=e("./is-vtext");var o=e("./is-widget");var a=e("./is-thunk");t.exports=s;function s(e,t){var r=e;var n=t;if(a(t)){n=u(t,e)}if(a(e)){r=u(e,null)}return{a:r,b:n}}function u(e,t){var r=e.vnode;if(!r){r=e.vnode=e.render(t)}if(!(n(r)||i(r)||o(r))){throw new Error("thunk did not return a valid node")}return r}},{"./is-thunk":260,"./is-vnode":262,"./is-vtext":263,"./is-widget":264}],260:[function(e,t,r){t.exports=n;function n(e){return e&&e.type==="Thunk"}},{}],261:[function(e,t,r){t.exports=n;function n(e){return e&&(typeof e.hook==="function"&&!e.hasOwnProperty("hook")||typeof e.unhook==="function"&&!e.hasOwnProperty("unhook"))}},{}],262:[function(e,t,r){var n=e("./version");t.exports=i;function i(e){return e&&e.type==="VirtualNode"&&e.version===n}},{"./version":265}],263:[function(e,t,r){var n=e("./version");t.exports=i;function i(e){return e&&e.type==="VirtualText"&&e.version===n}},{"./version":265}],264:[function(e,t,r){t.exports=n;function n(e){return e&&e.type==="Widget"}},{}],265:[function(e,t,r){t.exports="2"},{}],266:[function(e,t,r){var n=e("./version");var v=e("./is-vnode");var m=e("./is-widget");var g=e("./is-thunk");var _=e("./is-vhook");t.exports=i;var y={};var b=[];function i(e,t,r,n,i){this.tagName=e;this.properties=t||y;this.children=r||b;this.key=n!=null?String(n):undefined;this.namespace=typeof i==="string"?i:null;var o=r&&r.length||0;var a=0;var s=false;var u=false;var c=false;var l;for(var h in t){if(t.hasOwnProperty(h)){var p=t[h];if(_(p)&&p.unhook){if(!l){l={}}l[h]=p}}}for(var f=0;f<o;f++){var d=r[f];if(v(d)){a+=d.count||0;if(!s&&d.hasWidgets){s=true}if(!u&&d.hasThunks){u=true}if(!c&&(d.hooks||d.descendantHooks)){c=true}}else if(!s&&m(d)){if(typeof d.destroy==="function"){s=true}}else if(!u&&g(d)){u=true}}this.count=o+a;this.hasWidgets=s;this.hasThunks=u;this.hooks=l;this.descendantHooks=c}i.prototype.version=n;i.prototype.type="VirtualNode"},{"./is-thunk":260,"./is-vhook":261,"./is-vnode":262,"./is-widget":264,"./version":265}],267:[function(e,t,r){var n=e("./version");i.NONE=0;i.VTEXT=1;i.VNODE=2;i.WIDGET=3;i.PROPS=4;i.ORDER=5;i.INSERT=6;i.REMOVE=7;i.THUNK=8;t.exports=i;function i(e,t,r){this.type=Number(e);this.vNode=t;this.patch=r}i.prototype.version=n;i.prototype.type="VirtualPatch"},{"./version":265}],268:[function(e,t,r){var n=e("./version");t.exports=i;function i(e){this.text=String(e)}i.prototype.version=n;i.prototype.type="VirtualText"},{"./version":265}],269:[function(e,t,r){var u=e("is-object");var c=e("../vnode/is-vhook");t.exports=l;function l(e,t){var r;for(var n in e){if(!(n in t)){r=r||{};r[n]=undefined}var i=e[n];var o=t[n];if(i===o){continue}else if(u(i)&&u(o)){if(h(o)!==h(i)){r=r||{};r[n]=o}else if(c(o)){r=r||{};r[n]=o}else{var a=l(i,o);if(a){r=r||{};r[n]=a}}}else{r=r||{};r[n]=o}}for(var s in t){if(!(s in e)){r=r||{};r[s]=t[s]}}return r}function h(e){if(Object.getPrototypeOf){return Object.getPrototypeOf(e)}else if(e.__proto__){return e.__proto__}else if(e.constructor){return e.constructor.prototype}}},{"../vnode/is-vhook":261,"is-object":20}],270:[function(e,t,r){var n=e("x-is-array");var d=e("../vnode/vpatch");var v=e("../vnode/is-vnode");var s=e("../vnode/is-vtext");var u=e("../vnode/is-widget");var c=e("../vnode/is-thunk");var a=e("../vnode/handle-thunk");var l=e("./diff-props");t.exports=h;function h(e,t){var r={a:e};m(e,t,r,0);return r}function m(e,t,r,n){if(e===t){return}var i=r[n];var o=false;if(c(e)||c(t)){_(e,t,r,n)}else if(t==null){if(!u(e)){f(e,r,n);i=r[n]}i=S(i,new d(d.REMOVE,e,t))}else if(v(t)){if(v(e)){if(e.tagName===t.tagName&&e.namespace===t.namespace&&e.key===t.key){var a=l(e.properties,t.properties);if(a){i=S(i,new d(d.PROPS,e,a))}i=p(e,t,r,i,n)}else{i=S(i,new d(d.VNODE,e,t));o=true}}else{i=S(i,new d(d.VNODE,e,t));o=true}}else if(s(t)){if(!s(e)){i=S(i,new d(d.VTEXT,e,t));o=true}else if(e.text!==t.text){i=S(i,new d(d.VTEXT,e,t))}}else if(u(t)){if(!u(e)){o=true}i=S(i,new d(d.WIDGET,e,t))}if(i){r[n]=i}if(o){f(e,r,n)}}function p(e,t,r,n,i){var o=e.children;var a=w(o,t.children);var s=a.children;var u=o.length;var c=s.length;var l=u>c?u:c;for(var h=0;h<l;h++){var p=o[h];var f=s[h];i+=1;if(!p){if(f){n=S(n,new d(d.INSERT,null,f))}}else{m(p,f,r,i)}if(v(p)&&p.count){i+=p.count}}if(a.moves){n=S(n,new d(d.ORDER,e,a.moves))}return n}function f(e,t,r){b(e,t,r);g(e,t,r)}function g(e,t,r){if(u(e)){if(typeof e.destroy==="function"){t[r]=S(t[r],new d(d.REMOVE,e,null))}}else if(v(e)&&(e.hasWidgets||e.hasThunks)){var n=e.children;var i=n.length;for(var o=0;o<i;o++){var a=n[o];r+=1;g(a,t,r);if(v(a)&&a.count){r+=a.count}}}else if(c(e)){_(e,null,t,r)}}function _(e,t,r,n){var i=a(e,t);var o=h(i.a,i.b);if(y(o)){r[n]=new d(d.THUNK,null,o)}}function y(e){for(var t in e){if(t!=="a"){return true}}return false}function b(e,t,r){if(v(e)){if(e.hooks){t[r]=S(t[r],new d(d.PROPS,e,x(e.hooks)))}if(e.descendantHooks||e.hasThunks){var n=e.children;var i=n.length;for(var o=0;o<i;o++){var a=n[o];r+=1;b(a,t,r);if(v(a)&&a.count){r+=a.count}}}}else if(c(e)){_(e,null,t,r)}}function x(e){var t={};for(var r in e){t[r]=undefined}return t}function w(e,t){var r=T(t);var n=r.keys;var i=r.free;if(i.length===t.length){return{children:t,moves:null}}var o=T(e);var a=o.keys;var s=o.free;if(s.length===e.length){return{children:t,moves:null}}var u=[];var c=0;var l=i.length;var h=0;for(var p=0;p<e.length;p++){var f=e[p];var d;if(f.key){if(n.hasOwnProperty(f.key)){d=n[f.key];u.push(t[d])}else{d=p-h++;u.push(null)}}else{if(c<l){d=i[c++];u.push(t[d])}else{d=p-h++;u.push(null)}}}var v=c>=i.length?t.length:i[c];for(var m=0;m<t.length;m++){var g=t[m];if(g.key){if(!a.hasOwnProperty(g.key)){u.push(g)}}else if(m>=v){u.push(g)}}var _=u.slice();var y=0;var b=[];var x=[];var w;for(var S=0;S<t.length;){var M=t[S];w=_[y];while(w===null&&_.length){b.push(C(_,y,null));w=_[y]}if(!w||w.key!==M.key){if(M.key){if(w&&w.key){if(n[w.key]!==S+1){b.push(C(_,y,w.key));w=_[y];if(!w||w.key!==M.key){x.push({key:M.key,to:S})}else{y++}}else{x.push({key:M.key,to:S})}}else{x.push({key:M.key,to:S})}S++}else if(w&&w.key){b.push(C(_,y,w.key))}}else{y++;S++}}while(y<_.length){w=_[y];b.push(C(_,y,w&&w.key))}if(b.length===h&&!x.length){return{children:u,moves:null}}return{children:u,moves:{removes:b,inserts:x}}}function C(e,t,r){e.splice(t,1);return{from:t,key:r}}function T(e){var t={};var r=[];var n=e.length;for(var i=0;i<n;i++){var o=e[i];if(o.key){t[o.key]=i}else{r.push(i)}}return{keys:t,free:r}}function S(e,t){if(e){if(n(e)){e.push(t)}else{e=[e,t]}return e}else{return t}}},{"../vnode/handle-thunk":259,"../vnode/is-thunk":260,"../vnode/is-vnode":262,"../vnode/is-vtext":263,"../vnode/is-widget":264,"../vnode/vpatch":267,"./diff-props":269,"x-is-array":289}],271:[function(t,r,e){(function(e){"use strict";e(function(e){var t=e("./makePromise");var r=e("./Scheduler");var n=e("./env").asap;return t({scheduler:new r(n)})})})(typeof o==="function"&&o.amd?o:function(e){r.exports=e(t)})},{"./Scheduler":272,"./env":284,"./makePromise":286}],272:[function(e,t,r){(function(e){"use strict";e(function(){function e(e){this._async=e;this._running=false;this._queue=this;this._queueLen=0;this._afterQueue={};this._afterQueueLen=0;var t=this;this.drain=function(){t._drain()}}e.prototype.enqueue=function(e){this._queue[this._queueLen++]=e;this.run()};e.prototype.afterQueue=function(e){this._afterQueue[this._afterQueueLen++]=e;this.run()};e.prototype.run=function(){if(!this._running){this._running=true;this._async(this.drain)}};e.prototype._drain=function(){var e=0;for(;e<this._queueLen;++e){this._queue[e].run();this._queue[e]=void 0}this._queueLen=0;this._running=false;for(e=0;e<this._afterQueueLen;++e){this._afterQueue[e].run();this._afterQueue[e]=void 0}this._afterQueueLen=0};return e})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],273:[function(e,t,r){(function(e){"use strict";e(function(){function t(e){Error.call(this);this.message=e;this.name=t.name;if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,t)}}t.prototype=Object.create(Error.prototype);t.prototype.constructor=t;return t})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],274:[function(e,t,r){(function(e){"use strict";e(function(){e.tryCatchResolve=t;return e;function e(a,s){if(arguments.length<2){s=t}return e;function e(e,t,r){var n=a._defer();var i=r.length;var o=new Array(i);u({f:e,thisArg:t,args:r,params:o,i:i-1,call:s},n._handler);return n}function u(e,t){if(e.i<0){return s(e.f,e.thisArg,e.params,t)}var r=a._handler(e.args[e.i]);r.fold(n,e,void 0,t)}function n(e,t,r){e.params[e.i]=t;e.i-=1;u(e,r)}}function t(e,t,r,n){try{n.resolve(e.apply(t,r))}catch(e){n.reject(e)}}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],275:[function(t,r,e){(function(e){"use strict";e(function(e){var _=e("../state");var y=e("../apply");return function e(f){var i=y(f);var r=f.resolve;var n=f.all;var o=Array.prototype.reduce;var a=Array.prototype.reduceRight;var s=Array.prototype.slice;f.any=t;f.some=u;f.settle=p;f.map=c;f.filter=l;f.reduce=v;f.reduceRight=m;f.prototype.spread=function(t){return this.then(n).then(function(e){return t.apply(this,e)})};return f;function t(e){var t=f._defer();var r=t._handler;var n=e.length>>>0;var i=n;var o=[];for(var a,s,u=0;u<n;++u){s=e[u];if(s===void 0&&!(u in e)){--i;continue}a=f._handler(s);if(a.state()>0){r.become(a);f._visitRemaining(e,u,a);break}else{a.visit(r,c,l)}}if(i===0){r.reject(new RangeError("any(): array must not be empty"))}return t;function c(e){o=null;this.resolve(e)}function l(e){if(this.resolved){return}o.push(e);if(--i===0){this.reject(o)}}}function u(e,t){var r=f._defer();var n=r._handler;var i=[];var o=[];var a=e.length>>>0;var s=0;var u;var c,l;for(l=0;l<a;++l){c=e[l];if(c===void 0&&!(l in e)){continue}++s}t=Math.max(t,0);u=s-t+1;s=Math.min(t,s);if(t>s){n.reject(new RangeError("some(): array must contain at least "+t+" item(s), but had "+s))}else if(s===0){n.resolve(i)}for(l=0;l<a;++l){c=e[l];if(c===void 0&&!(l in e)){continue}f._handler(c).visit(n,h,p,n.notify)}return r;function h(e){if(this.resolved){return}i.push(e);if(--s===0){o=null;this.resolve(i)}}function p(e){if(this.resolved){return}o.push(e);if(--u===0){i=null;this.reject(o)}}}function c(e,t){return f._traverse(t,e)}function l(e,t){var r=s.call(e);return f._traverse(t,r).then(function(e){return h(r,e)})}function h(e,t){var r=t.length;var n=new Array(r);for(var i=0,o=0;i<r;++i){if(t[i]){n[o++]=f._handler(e[i]).value}}n.length=o;return n}function p(e){return n(e.map(d))}function d(e){var t;if(e instanceof f){t=e._handler.join()}if(t&&t.state()===0||!t){return r(e).then(_.fulfilled,_.rejected)}t._unreport();return _.inspect(t)}function v(e,t){return arguments.length>2?o.call(e,g(t),arguments[2]):o.call(e,g(t))}function m(e,t){return arguments.length>2?a.call(e,g(t),arguments[2]):a.call(e,g(t))}function g(n){return function(e,t,r){return i(n,void 0,[e,t,r])}}}})})(typeof o==="function"&&o.amd?o:function(e){r.exports=e(t)})},{"../apply":274,"../state":287}],276:[function(e,t,r){(function(e){"use strict";e(function(){return function e(t){var n=t.resolve;var i=t.reject;var r=t.prototype["catch"];t.prototype.done=function(e,t){this._handler.visit(this._handler.receiver,e,t)};t.prototype["catch"]=t.prototype.otherwise=function(e){if(arguments.length<2){return r.call(this,e)}if(typeof e!=="function"){return this.ensure(u)}return r.call(this,o(arguments[1],e))};function o(t,r){return function(e){return c(e,r)?t.call(this,e):i(e)}}t.prototype["finally"]=t.prototype.ensure=function(t){if(typeof t!=="function"){return this}return this.then(function(e){return a(t,this,h,e)},function(e){return a(t,this,i,e)})};function a(e,t,r,n){var i=e.call(t);return l(i)?s(i,r,n):r(n)}function s(e,t,r){return n(e).then(function(){return t(r)})}t.prototype["else"]=t.prototype.orElse=function(e){return this.then(void 0,function(){return e})};t.prototype["yield"]=function(e){return this.then(function(){return e})};t.prototype.tap=function(e){return this.then(e)["yield"](this)};return t};function u(){throw new TypeError("catch predicate must be a function")}function c(e,t){return r(t)?e instanceof t:t(e)}function r(e){return e===Error||e!=null&&e.prototype instanceof Error}function l(e){return(typeof e==="object"||typeof e==="function")&&e!==null}function h(e){return e}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],277:[function(e,t,r){(function(e){"use strict";e(function(){return function e(i){i.prototype.fold=function(n,e){var t=this._beget();this._handler.fold(function(e,t,r){i._handler(e).fold(function(e,t,r){r.resolve(n.call(this,t,e))},t,this,r)},e,t._handler.receiver,t._handler);return t};return i}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],278:[function(t,r,e){(function(e){"use strict";e(function(e){var r=e("../state").inspect;return function e(t){t.prototype.inspect=function(){return r(t._handler(this))};return t}})})(typeof o==="function"&&o.amd?o:function(e){r.exports=e(t)})},{"../state":287}],279:[function(e,t,r){(function(e){"use strict";e(function(){return function e(t){var a=t.resolve;t.iterate=r;t.unfold=s;return t;function r(t,e,r,n){return s(function(e){return[e,t(e)]},e,r,n)}function s(r,n,i,e){return a(e).then(function(t){return a(n(t)).then(function(e){return e?t:a(r(t)).spread(o)})});function o(e,t){return a(i(e)).then(function(){return s(r,n,i,t)})}}}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],280:[function(e,t,r){(function(e){"use strict";e(function(){return function e(t){t.prototype.progress=function(e){return this.then(void 0,void 0,e)};return t}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],281:[function(t,r,e){(function(e){"use strict";e(function(e){var a=e("../env");var i=e("../TimeoutError");function s(e,t,r,n){return a.setTimer(function(){e(r,n,t)},t)}return function e(t){t.prototype.delay=function(e){var t=this._beget();this._handler.fold(r,e,void 0,t._handler);return t};function r(e,t,r){s(n,e,t,r)}function n(e,t){t.resolve(e)}t.prototype.timeout=function(e,t){var r=this._beget();var n=r._handler;var i=s(o,e,t,r._handler);this._handler.visit(n,function e(t){a.clearTimer(i);this.resolve(t)},function e(t){a.clearTimer(i);this.reject(t)},n.notify);return r};function o(e,t,r){var n=typeof e==="undefined"?new i("timed out after "+r+"ms"):e;t.reject(n)}return t}})})(typeof o==="function"&&o.amd?o:function(e){r.exports=e(t)})},{"../TimeoutError":273,"../env":284}],282:[function(t,r,e){(function(e){"use strict";e(function(e){var p=e("../env").setTimer;var f=e("../format");return function e(t){var r=v;var n=v;var i;if(typeof console!=="undefined"){i=console;r=typeof i.error!=="undefined"?function(e){i.error(e)}:function(e){i.log(e)};n=typeof i.info!=="undefined"?function(e){i.info(e)}:function(e){i.log(e)}}t.onPotentiallyUnhandledRejection=function(e){l(u,e)};t.onPotentiallyUnhandledRejectionHandled=function(e){l(c,e)};t.onFatalRejection=function(e){l(d,e.value)};var o=[];var a=[];var s=null;function u(e){if(!e.handled){a.push(e);r("Potentially unhandled rejection ["+e.id+"] "+f.formatError(e.value))}}function c(e){var t=a.indexOf(e);if(t>=0){a.splice(t,1);n("Handled previous rejection ["+e.id+"] "+f.formatObject(e.value))}}function l(e,t){o.push(e,t);if(s===null){s=p(h,0)}}function h(){s=null;while(o.length>0){o.shift()(o.shift())}}return t};function d(e){throw e}function v(){}})})(typeof o==="function"&&o.amd?o:function(e){r.exports=e(t)})},{"../env":284,"../format":285}],283:[function(e,t,r){(function(e){"use strict";e(function(){return function e(t){t.prototype["with"]=t.prototype.withThis=function(e){var t=this._beget();var r=t._handler;r.receiver=e;this._handler.chain(r,e);return t};return t}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],284:[function(t,r,e){(function(h){(function(e){"use strict";e(function(e){var t;var r=typeof setTimeout!=="undefined"&&setTimeout;var n=function(e,t){return setTimeout(e,t)};var i=function(e){return clearTimeout(e)};var o=function(e){return r(e,0)};if(u()){o=function(e){return h.nextTick(e)}}else if(t=c()){o=l(t)}else if(!r){var a=e;var s=a("vertx");n=function(e,t){return s.setTimer(t,e)};i=s.cancelTimer;o=s.runOnLoop||s.runOnContext}return{setTimer:n,clearTimer:i,asap:o};function u(){return typeof h!=="undefined"&&Object.prototype.toString.call(h)==="[object process]"}function c(){return typeof MutationObserver!=="undefined"&&MutationObserver||typeof WebKitMutationObserver!=="undefined"&&WebKitMutationObserver}function l(e){var t;var r=document.createTextNode("");var n=new e(i);n.observe(r,{characterData:true});function i(){var e=t;t=void 0;e()}var o=0;return function(e){t=e;r.data=o^=1}}})})(typeof o==="function"&&o.amd?o:function(e){r.exports=e(t)})}).call(this,t("_process"))},{_process:7}],285:[function(e,t,r){(function(e){"use strict";e(function(){return{formatError:e,formatObject:r,tryStringify:n};function e(e){var t=typeof e==="object"&&e!==null&&(e.stack||e.message)?e.stack||e.message:r(e);return e instanceof Error?t:t+" (WARNING: non-Error used)"}function r(e){var t=String(e);if(t==="[object Object]"&&typeof JSON!=="undefined"){t=n(e,t)}return t}function n(e,t){try{return JSON.stringify(e)}catch(e){return t}}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],286:[function(e,t,r){(function(ne){(function(e){"use strict";e(function(){return function e(t){var r=t.scheduler;var n=re();var i=Object.create||function(e){function t(){}t.prototype=e;return new t};function h(e,t){this._handler=e===S?t:o(e)}function o(e){var t=new T;try{e(r,n,i)}catch(e){n(e)}return t;function r(e){t.resolve(e)}function n(e){t.reject(e)}function i(e){t.notify(e)}}h.resolve=a;h.reject=s;h.never=u;h._defer=c;h._handler=b;function a(e){return G(e)?e:new h(S,new E(b(e)))}function s(e){return new h(S,new E(new j(e)))}function u(){return N}function c(){return new h(S,new T)}h.prototype.then=function(e,t,r){var n=this._handler;var i=n.join().state();if(typeof e!=="function"&&i>0||typeof t!=="function"&&i<0){return new this.constructor(S,n)}var o=this._beget();var a=o._handler;n.chain(a,n.receiver,e,t,r);return o};h.prototype["catch"]=function(e){return this.then(void 0,e)};h.prototype._beget=function(){return l(this._handler,this.constructor)};function l(e,t){var r=new T(e.receiver,e.join().context);return new t(S,r)}h.all=p;h.race=_;h._traverse=f;function p(e){return d(J,null,e)}function f(e,t){return d(W,e,t)}function d(n,i,o){var e=typeof i==="function"?c:l;var t=new T;var a=o.length>>>0;var s=new Array(a);for(var r=0,u;r<o.length&&!t.resolved;++r){u=o[r];if(u===void 0&&!(r in o)){--a;continue}v(o,e,r,u,t)}if(a===0){t.become(new P(s))}return new h(S,t);function c(e,t,r){if(!r.resolved){v(o,l,e,n(i,t,e),r)}}function l(e,t,r){s[e]=t;if(--a===0){r.become(new P(s))}}}function v(e,t,r,n,i){if(V(n)){var o=x(n);var a=o.state();if(a===0){o.fold(t,r,void 0,i)}else if(a>0){t(r,o.value,i)}else{i.become(o);m(e,r+1,o)}}else{t(r,n,i)}}h._visitRemaining=m;function m(e,t,r){for(var n=t;n<e.length;++n){g(b(e[n]),r)}}function g(e,t){if(e===t){return}var r=e.state();if(r===0){e.visit(e,void 0,e._unreport)}else if(r<0){e._unreport()}}function _(e){if(typeof e!=="object"||e===null){return s(new TypeError("non-iterable passed to race()"))}return e.length===0?u():e.length===1?a(e[0]):y(e)}function y(e){var t=new T;var r,n,i;for(r=0;r<e.length;++r){n=e[r];if(n===void 0&&!(r in e)){continue}i=b(n);if(i.state()!==0){t.become(i);m(e,r+1,i);break}else{i.visit(t,t.resolve,t.reject)}}return new h(S,t)}function b(e){if(G(e)){return e._handler.join()}return V(e)?w(e):new P(e)}function x(e){return G(e)?e._handler.join():w(e)}function w(e){try{var t=e.then;return typeof t==="function"?new O(t,e):new P(e)}catch(e){return new j(e)}}function S(){}S.prototype.when=S.prototype.become=S.prototype.notify=S.prototype.fail=S.prototype._unreport=S.prototype._report=Q;S.prototype._state=0;S.prototype.state=function(){return this._state};S.prototype.join=function(){var e=this;while(e.handler!==void 0){e=e.handler}return e};S.prototype.chain=function(e,t,r,n,i){this.when({resolver:e,receiver:t,fulfilled:r,rejected:n,progress:i})};S.prototype.visit=function(e,t,r,n){this.chain(C,e,t,r,n)};S.prototype.fold=function(e,t,r,n){this.when(new $(e,t,r,n))};function M(){}Z(S,M);M.prototype.become=function(e){e.fail()};var C=new M;function T(e,t){h.createContext(this,t);this.consumers=void 0;this.receiver=e;this.handler=void 0;this.resolved=false}Z(S,T);T.prototype._state=0;T.prototype.resolve=function(e){this.become(b(e))};T.prototype.reject=function(e){if(this.resolved){return}this.become(new j(e))};T.prototype.join=function(){if(!this.resolved){return this}var e=this;while(e.handler!==void 0){e=e.handler;if(e===this){return this.handler=I()}}return e};T.prototype.run=function(){var e=this.consumers;var t=this.handler;this.handler=this.handler.join();this.consumers=void 0;for(var r=0;r<e.length;++r){t.when(e[r])}};T.prototype.become=function(e){if(this.resolved){return}this.resolved=true;this.handler=e;if(this.consumers!==void 0){r.enqueue(this)}if(this.context!==void 0){e._report(this.context)}};T.prototype.when=function(e){if(this.resolved){r.enqueue(new D(e,this.handler))}else{if(this.consumers===void 0){this.consumers=[e]}else{this.consumers.push(e)}}};T.prototype.notify=function(e){if(!this.resolved){r.enqueue(new B(e,this))}};T.prototype.fail=function(e){var t=typeof e==="undefined"?this.context:e;this.resolved&&this.handler.join().fail(t)};T.prototype._report=function(e){this.resolved&&this.handler.join()._report(e)};T.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()};function E(e){this.handler=e}Z(S,E);E.prototype.when=function(e){r.enqueue(new D(e,this))};E.prototype._report=function(e){this.join()._report(e)};E.prototype._unreport=function(){this.join()._unreport()};function O(e,t){T.call(this);r.enqueue(new F(e,t,this))}Z(T,O);function P(e){h.createContext(this);this.value=e}Z(S,P);P.prototype._state=1;P.prototype.fold=function(e,t,r,n){U(e,t,this,r,n)};P.prototype.when=function(e){H(e.fulfilled,this,e.receiver,e.resolver)};var A=0;function j(e){h.createContext(this);this.id=++A;this.value=e;this.handled=false;this.reported=false;this._report()}Z(S,j);j.prototype._state=-1;j.prototype.fold=function(e,t,r,n){n.become(this)};j.prototype.when=function(e){if(typeof e.rejected==="function"){this._unreport()}H(e.rejected,this,e.receiver,e.resolver)};j.prototype._report=function(e){r.afterQueue(new R(this,e))};j.prototype._unreport=function(){if(this.handled){return}this.handled=true;r.afterQueue(new k(this))};j.prototype.fail=function(e){this.reported=true;n("unhandledRejection",this);h.onFatalRejection(this,e===void 0?this.context:e)};function R(e,t){this.rejection=e;this.context=t}R.prototype.run=function(){if(!this.rejection.handled&&!this.rejection.reported){this.rejection.reported=true;n("unhandledRejection",this.rejection)||h.onPotentiallyUnhandledRejection(this.rejection,this.context)}};function k(e){this.rejection=e}k.prototype.run=function(){if(this.rejection.reported){n("rejectionHandled",this.rejection)||h.onPotentiallyUnhandledRejectionHandled(this.rejection)}};h.createContext=h.enterContext=h.exitContext=h.onPotentiallyUnhandledRejection=h.onPotentiallyUnhandledRejectionHandled=h.onFatalRejection=Q;var L=new S;var N=new h(S,L);function I(){return new j(new TypeError("Promise cycle"))}function D(e,t){this.continuation=e;this.handler=t}D.prototype.run=function(){this.handler.join().when(this.continuation)};function B(e,t){this.handler=t;this.value=e}B.prototype.run=function(){var e=this.handler.consumers;if(e===void 0){return}for(var t,r=0;r<e.length;++r){t=e[r];q(t.progress,this.value,this.handler,t.receiver,t.resolver)}};function F(e,t,r){this._then=e;this.thenable=t;this.resolver=r}F.prototype.run=function(){var t=this.resolver;z(this._then,this.thenable,e,r,n);function e(e){t.resolve(e)}function r(e){t.reject(e)}function n(e){t.notify(e)}};function z(e,t,r,n,i){try{e.call(t,r,n,i)}catch(e){n(e)}}function $(e,t,r,n){this.f=e;this.z=t;this.c=r;this.to=n;this.resolver=C;this.receiver=this}$.prototype.fulfilled=function(e){this.f.call(this.c,this.z,e,this.to)};$.prototype.rejected=function(e){this.to.reject(e)};$.prototype.progress=function(e){this.to.notify(e)};function G(e){return e instanceof h}function V(e){return(typeof e==="object"||typeof e==="function")&&e!==null}function H(e,t,r,n){if(typeof e!=="function"){return n.become(t)}h.enterContext(t);X(e,t.value,r,n);h.exitContext()}function U(e,t,r,n,i){if(typeof e!=="function"){return i.become(r)}h.enterContext(r);Y(e,t,r.value,n,i);h.exitContext()}function q(e,t,r,n,i){if(typeof e!=="function"){return i.notify(t)}h.enterContext(r);K(e,t,n,i);h.exitContext()}function W(e,t,r){try{return e(t,r)}catch(e){return s(e)}}function X(e,t,r,n){try{n.become(b(e.call(r,t)))}catch(e){n.become(new j(e))}}function Y(e,t,r,n,i){try{e.call(n,t,r,i)}catch(e){i.become(new j(e))}}function K(e,t,r,n){try{n.notify(e.call(r,t))}catch(e){n.notify(e)}}function Z(e,t){t.prototype=i(e.prototype);t.prototype.constructor=t}function J(e,t){return t}function Q(){}function ee(){if(typeof CustomEvent==="function"){try{var e=new CustomEvent("unhandledRejection");return e instanceof CustomEvent}catch(e){}}return false}function te(){if(typeof document!=="undefined"&&typeof document.createEvent==="function"){try{var e=document.createEvent("CustomEvent");e.initCustomEvent("eventType",false,true,{});return true}catch(e){}}return false}function re(){if(typeof ne!=="undefined"&&ne!==null&&typeof ne.emit==="function"){return function(e,t){return e==="unhandledRejection"?ne.emit(e,t.value,t):ne.emit(e,t)}}else if(typeof self!=="undefined"&&ee()){return function(n,i){return function(e,t){var r=new i(e,{detail:{reason:t.value,key:t},bubbles:false,cancelable:true});return!n.dispatchEvent(r)}}(self,CustomEvent)}else if(typeof self!=="undefined"&&te()){return function(n,i){return function(e,t){var r=i.createEvent("CustomEvent");r.initCustomEvent(e,false,true,{reason:t.value,key:t});return!n.dispatchEvent(r)}}(self,document)}return Q}return h}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})}).call(this,e("_process"))},{_process:7}],287:[function(e,t,r){(function(e){"use strict";e(function(){return{pending:r,fulfilled:i,rejected:n,inspect:e};function r(){return{state:"pending"}}function n(e){return{state:"rejected",reason:e}}function i(e){return{state:"fulfilled",value:e}}function e(e){var t=e.state();return t===0?r():t>0?i(e.value):n(e.value)}})})(typeof o==="function"&&o.amd?o:function(e){t.exports=e()})},{}],288:[function(t,r,e){(function(e){"use strict";e(function(e){var t=e("./lib/decorators/timed");var r=e("./lib/decorators/array");var n=e("./lib/decorators/flow");var i=e("./lib/decorators/fold");var o=e("./lib/decorators/inspect");var a=e("./lib/decorators/iterate");var s=e("./lib/decorators/progress");var u=e("./lib/decorators/with");var c=e("./lib/decorators/unhandledRejection");var l=e("./lib/TimeoutError");var h=[r,n,i,a,s,o,u,t,c].reduce(function(e,t){return t(e)},e("./lib/Promise"));var p=e("./lib/apply")(h);f.promise=d;f.resolve=h.resolve;f.reject=h.reject;f.lift=v;f["try"]=m;f.attempt=m;f.iterate=h.iterate;f.unfold=h.unfold;f.join=b;f.all=x;f.settle=w;f.any=v(h.any);f.some=v(h.some);f.race=v(h.race);f.map=S;f.filter=M;f.reduce=v(h.reduce);f.reduceRight=v(h.reduceRight);f.isPromiseLike=y;f.Promise=h;f.defer=g;f.TimeoutError=l;function f(e,t,r,n){var i=h.resolve(e);if(arguments.length<2){return i}return i.then(t,r,n)}function d(e){return new h(e)}function v(n){return function(){for(var e=0,t=arguments.length,r=new Array(t);e<t;++e){r[e]=arguments[e]}return p(n,this,r)}}function m(e){for(var t=0,r=arguments.length-1,n=new Array(r);t<r;++t){n[t]=arguments[t+1]}return p(e,this,n)}function g(){return new _}function _(){var t=h._defer();function e(e){t._handler.resolve(e)}function r(e){t._handler.reject(e)}function n(e){t._handler.notify(e)}this.promise=t;this.resolve=e;this.reject=r;this.notify=n;this.resolver={resolve:e,reject:r,notify:n}}function y(e){return e&&typeof e.then==="function"}function b(){return h.all(arguments)}function x(e){return f(e,h.all)}function w(e){return f(e,h.settle)}function S(e,t){return f(e,function(e){return h.map(e,t)})}function M(e,t){return f(e,function(e){return h.filter(e,t)})}return f})})(typeof o==="function"&&o.amd?o:function(e){r.exports=e(t)})},{"./lib/Promise":271,"./lib/TimeoutError":273,"./lib/apply":274,"./lib/decorators/array":275,"./lib/decorators/flow":276,"./lib/decorators/fold":277,"./lib/decorators/inspect":278,"./lib/decorators/iterate":279,"./lib/decorators/progress":280,"./lib/decorators/timed":281,"./lib/decorators/unhandledRejection":282,"./lib/decorators/with":283}],289:[function(e,t,r){var n=Array.isArray;var i=Object.prototype.toString;t.exports=n||o;function o(e){return i.call(e)==="[object Array]"}},{}],290:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./api/APIv3");Object.defineProperty(r,"APIv3",{enumerable:true,get:function(){return o.APIv3}});var a=e("./api/ModelCreator");Object.defineProperty(r,"ModelCreator",{enumerable:true,get:function(){return a.ModelCreator}});i(e("./api/interfaces/interfaces"),r)},{"./api/APIv3":303,"./api/ModelCreator":304,"./api/interfaces/interfaces":305}],291:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});r.ImageBoundary=void 0;var o=e("./component/Component");Object.defineProperty(r,"Component",{enumerable:true,get:function(){return o.Component}});var a=e("./component/ComponentService");Object.defineProperty(r,"ComponentService",{enumerable:true,get:function(){return a.ComponentService}});var s=e("./component/utils/HandlerBase");Object.defineProperty(r,"HandlerBase",{enumerable:true,get:function(){return s.HandlerBase}});var u=e("./component/utils/MeshFactory");Object.defineProperty(r,"MeshFactory",{enumerable:true,get:function(){return u.MeshFactory}});var c=e("./component/utils/MeshScene");Object.defineProperty(r,"MeshScene",{enumerable:true,get:function(){return c.MeshScene}});var l=e("./component/utils/MouseOperator");Object.defineProperty(r,"MouseOperator",{enumerable:true,get:function(){return l.MouseOperator}});var h=e("./component/utils/ComponentSize");Object.defineProperty(r,"ComponentSize",{enumerable:true,get:function(){return h.ComponentSize}});var p=e("./component/AttributionComponent");Object.defineProperty(r,"AttributionComponent",{enumerable:true,get:function(){return p.AttributionComponent}});var f=e("./component/BackgroundComponent");Object.defineProperty(r,"BackgroundComponent",{enumerable:true,get:function(){return f.BackgroundComponent}});var d=e("./component/BearingComponent");Object.defineProperty(r,"BearingComponent",{enumerable:true,get:function(){return d.BearingComponent}});var v=e("./component/CacheComponent");Object.defineProperty(r,"CacheComponent",{enumerable:true,get:function(){return v.CacheComponent}});var m=e("./component/CoverComponent");Object.defineProperty(r,"CoverComponent",{enumerable:true,get:function(){return m.CoverComponent}});var g=e("./component/DebugComponent");Object.defineProperty(r,"DebugComponent",{enumerable:true,get:function(){return g.DebugComponent}});var _=e("./component/direction/DirectionComponent");Object.defineProperty(r,"DirectionComponent",{enumerable:true,get:function(){return _.DirectionComponent}});var y=e("./component/direction/DirectionDOMCalculator");Object.defineProperty(r,"DirectionDOMCalculator",{enumerable:true,get:function(){return y.DirectionDOMCalculator}});var b=e("./component/direction/DirectionDOMRenderer");Object.defineProperty(r,"DirectionDOMRenderer",{enumerable:true,get:function(){return b.DirectionDOMRenderer}});var x=e("./component/ImageComponent");Object.defineProperty(r,"ImageComponent",{enumerable:true,get:function(){return x.ImageComponent}});var w=e("./component/keyboard/KeyboardComponent");Object.defineProperty(r,"KeyboardComponent",{enumerable:true,get:function(){return w.KeyboardComponent}});var S=e("./component/keyboard/KeyPlayHandler");Object.defineProperty(r,"KeyPlayHandler",{enumerable:true,get:function(){return S.KeyPlayHandler}});var M=e("./component/keyboard/KeyZoomHandler");Object.defineProperty(r,"KeyZoomHandler",{enumerable:true,get:function(){return M.KeyZoomHandler}});var C=e("./component/keyboard/KeySequenceNavigationHandler");Object.defineProperty(r,"KeySequenceNavigationHandler",{enumerable:true,get:function(){return C.KeySequenceNavigationHandler}});var T=e("./component/keyboard/KeySpatialNavigationHandler");Object.defineProperty(r,"KeySpatialNavigationHandler",{enumerable:true,get:function(){return T.KeySpatialNavigationHandler}});var E=e("./component/LoadingComponent");Object.defineProperty(r,"LoadingComponent",{enumerable:true,get:function(){return E.LoadingComponent}});var O=e("./component/marker/marker/Marker");Object.defineProperty(r,"Marker",{enumerable:true,get:function(){return O.Marker}});var P=e("./component/marker/MarkerComponent");Object.defineProperty(r,"MarkerComponent",{enumerable:true,get:function(){return P.MarkerComponent}});var A=e("./component/marker/MarkerScene");Object.defineProperty(r,"MarkerScene",{enumerable:true,get:function(){return A.MarkerScene}});var j=e("./component/marker/MarkerSet");Object.defineProperty(r,"MarkerSet",{enumerable:true,get:function(){return j.MarkerSet}});var R=e("./component/mouse/MouseComponent");Object.defineProperty(r,"MouseComponent",{enumerable:true,get:function(){return R.MouseComponent}});i(e("./component/mouse/HandlerTypes"),r);var k=e("./component/mouse/BounceHandler");Object.defineProperty(r,"BounceHandler",{enumerable:true,get:function(){return k.BounceHandler}});var L=e("./component/mouse/DragPanHandler");Object.defineProperty(r,"DragPanHandler",{enumerable:true,get:function(){return L.DragPanHandler}});var N=e("./component/mouse/DoubleClickZoomHandler");Object.defineProperty(r,"DoubleClickZoomHandler",{enumerable:true,get:function(){return N.DoubleClickZoomHandler}});var I=e("./component/mouse/EarthControlHandler");Object.defineProperty(r,"EarthControlHandler",{enumerable:true,get:function(){return I.EarthControlHandler}});var D=e("./component/mouse/ScrollZoomHandler");Object.defineProperty(r,"ScrollZoomHandler",{enumerable:true,get:function(){return D.ScrollZoomHandler}});var B=e("./component/mouse/TouchZoomHandler");Object.defineProperty(r,"TouchZoomHandler",{enumerable:true,get:function(){return B.TouchZoomHandler}});var F=e("./component/mouse/ImageBoundary");r.ImageBoundary=F;var z=e("./component/popup/popup/Popup");Object.defineProperty(r,"Popup",{enumerable:true,get:function(){return z.Popup}});var $=e("./component/popup/PopupComponent");Object.defineProperty(r,"PopupComponent",{enumerable:true,get:function(){return $.PopupComponent}});var G=e("./component/NavigationComponent");Object.defineProperty(r,"NavigationComponent",{enumerable:true,get:function(){return G.NavigationComponent}});var V=e("./component/RouteComponent");Object.defineProperty(r,"RouteComponent",{enumerable:true,get:function(){return V.RouteComponent}});var H=e("./component/sequence/SequenceComponent");Object.defineProperty(r,"SequenceComponent",{enumerable:true,get:function(){return H.SequenceComponent}});var U=e("./component/sequence/SequenceDOMRenderer");Object.defineProperty(r,"SequenceDOMRenderer",{enumerable:true,get:function(){return U.SequenceDOMRenderer}});var q=e("./component/sequence/SequenceMode");Object.defineProperty(r,"SequenceMode",{enumerable:true,get:function(){return q.SequenceMode}});var W=e("./component/spatialdata/SpatialDataCache");Object.defineProperty(r,"SpatialDataCache",{enumerable:true,get:function(){return W.SpatialDataCache}});var X=e("./component/spatialdata/SpatialDataComponent");Object.defineProperty(r,"SpatialDataComponent",{enumerable:true,get:function(){return X.SpatialDataComponent}});var Y=e("./component/spatialdata/SpatialDataScene");Object.defineProperty(r,"SpatialDataScene",{enumerable:true,get:function(){return Y.SpatialDataScene}});var K=e("./component/imageplane/ImagePlaneComponent");Object.defineProperty(r,"ImagePlaneComponent",{enumerable:true,get:function(){return K.ImagePlaneComponent}});var Z=e("./component/imageplane/ImagePlaneGLRenderer");Object.defineProperty(r,"ImagePlaneGLRenderer",{enumerable:true,get:function(){return Z.ImagePlaneGLRenderer}});var J=e("./component/shaders/Shaders");Object.defineProperty(r,"Shaders",{enumerable:true,get:function(){return J.Shaders}});var Q=e("./component/marker/marker/SimpleMarker");Object.defineProperty(r,"SimpleMarker",{enumerable:true,get:function(){return Q.SimpleMarker}});var ee=e("./component/marker/marker/CircleMarker");Object.defineProperty(r,"CircleMarker",{enumerable:true,get:function(){return ee.CircleMarker}});var te=e("./component/slider/SliderComponent");Object.defineProperty(r,"SliderComponent",{enumerable:true,get:function(){return te.SliderComponent}});var re=e("./component/slider/SliderDOMRenderer");Object.defineProperty(r,"SliderDOMRenderer",{enumerable:true,get:function(){return re.SliderDOMRenderer}});var ne=e("./component/slider/SliderGLRenderer");Object.defineProperty(r,"SliderGLRenderer",{enumerable:true,get:function(){return ne.SliderGLRenderer}});var ie=e("./component/StatsComponent");Object.defineProperty(r,"StatsComponent",{enumerable:true,get:function(){return ie.StatsComponent}});var oe=e("./component/tag/handlers/TagHandlerBase");Object.defineProperty(r,"TagHandlerBase",{enumerable:true,get:function(){return oe.TagHandlerBase}});var ae=e("./component/tag/handlers/CreateHandlerBase");Object.defineProperty(r,"CreateHandlerBase",{enumerable:true,get:function(){return ae.CreateHandlerBase}});var se=e("./component/tag/handlers/CreatePointHandler");Object.defineProperty(r,"CreatePointHandler",{enumerable:true,get:function(){return se.CreatePointHandler}});var ue=e("./component/tag/handlers/CreateVertexHandler");Object.defineProperty(r,"CreateVertexHandler",{enumerable:true,get:function(){return ue.CreateVertexHandler}});var ce=e("./component/tag/handlers/CreatePointsHandler");Object.defineProperty(r,"CreatePointsHandler",{enumerable:true,get:function(){return ce.CreatePointsHandler}});var le=e("./component/tag/handlers/CreatePolygonHandler");Object.defineProperty(r,"CreatePolygonHandler",{enumerable:true,get:function(){return le.CreatePolygonHandler}});var he=e("./component/tag/handlers/CreateRectHandler");Object.defineProperty(r,"CreateRectHandler",{enumerable:true,get:function(){return he.CreateRectHandler}});var pe=e("./component/tag/handlers/CreateRectDragHandler");Object.defineProperty(r,"CreateRectDragHandler",{enumerable:true,get:function(){return pe.CreateRectDragHandler}});var fe=e("./component/tag/handlers/EditVertexHandler");Object.defineProperty(r,"EditVertexHandler",{enumerable:true,get:function(){return fe.EditVertexHandler}});var de=e("./component/tag/tag/Tag");Object.defineProperty(r,"Tag",{enumerable:true,get:function(){return de.Tag}});var ve=e("./component/tag/tag/OutlineTag");Object.defineProperty(r,"OutlineTag",{enumerable:true,get:function(){return ve.OutlineTag}});var me=e("./component/tag/tag/ExtremePointTag");Object.defineProperty(r,"ExtremePointTag",{enumerable:true,get:function(){return me.ExtremePointTag}});var ge=e("./component/tag/tag/RenderTag");Object.defineProperty(r,"RenderTag",{enumerable:true,get:function(){return ge.RenderTag}});var _e=e("./component/tag/tag/OutlineRenderTagBase");Object.defineProperty(r,"OutlineRenderTagBase",{enumerable:true,get:function(){return _e.OutlineRenderTagBase}});var ye=e("./component/tag/tag/OutlineRenderTag");Object.defineProperty(r,"OutlineRenderTag",{enumerable:true,get:function(){return ye.OutlineRenderTag}});var be=e("./component/tag/tag/ExtremePointRenderTag");Object.defineProperty(r,"ExtremePointRenderTag",{enumerable:true,get:function(){return be.ExtremePointRenderTag}});var xe=e("./component/tag/tag/SpotTag");Object.defineProperty(r,"SpotTag",{enumerable:true,get:function(){return xe.SpotTag}});var we=e("./component/tag/tag/SpotRenderTag");Object.defineProperty(r,"SpotRenderTag",{enumerable:true,get:function(){return we.SpotRenderTag}});var Se=e("./component/tag/tag/TagDomain");Object.defineProperty(r,"TagDomain",{enumerable:true,get:function(){return Se.TagDomain}});var Me=e("./component/tag/TagComponent");Object.defineProperty(r,"TagComponent",{enumerable:true,get:function(){return Me.TagComponent}});var Ce=e("./component/tag/TagCreator");Object.defineProperty(r,"TagCreator",{enumerable:true,get:function(){return Ce.TagCreator}});var Te=e("./component/tag/TagDOMRenderer");Object.defineProperty(r,"TagDOMRenderer",{enumerable:true,get:function(){return Te.TagDOMRenderer}});var Ee=e("./component/tag/TagMode");Object.defineProperty(r,"TagMode",{enumerable:true,get:function(){return Ee.TagMode}});var Oe=e("./component/tag/TagOperation");Object.defineProperty(r,"TagOperation",{enumerable:true,get:function(){return Oe.TagOperation}});var Pe=e("./component/tag/TagScene");Object.defineProperty(r,"TagScene",{enumerable:true,get:function(){return Pe.TagScene}});var Ae=e("./component/tag/TagSet");Object.defineProperty(r,"TagSet",{enumerable:true,get:function(){return Ae.TagSet}});var je=e("./component/tag/geometry/Geometry");Object.defineProperty(r,"Geometry",{enumerable:true,get:function(){return je.Geometry}});var Re=e("./component/tag/geometry/VertexGeometry");Object.defineProperty(r,"VertexGeometry",{enumerable:true,get:function(){return Re.VertexGeometry}});var ke=e("./component/tag/geometry/RectGeometry");Object.defineProperty(r,"RectGeometry",{enumerable:true,get:function(){return ke.RectGeometry}});var Le=e("./component/tag/geometry/PointGeometry");Object.defineProperty(r,"PointGeometry",{enumerable:true,get:function(){return Le.PointGeometry}});var Ne=e("./component/tag/geometry/PointsGeometry");Object.defineProperty(r,"PointsGeometry",{enumerable:true,get:function(){return Ne.PointsGeometry}});var Ie=e("./component/tag/geometry/PolygonGeometry");Object.defineProperty(r,"PolygonGeometry",{enumerable:true,get:function(){return Ie.PolygonGeometry}});var De=e("./component/tag/error/GeometryTagError");Object.defineProperty(r,"GeometryTagError",{enumerable:true,get:function(){return De.GeometryTagError}});var Be=e("./component/zoom/ZoomComponent");Object.defineProperty(r,"ZoomComponent",{enumerable:true,get:function(){return Be.ZoomComponent}});var Fe=e("./component/tag/tag/CreateTag");Object.defineProperty(r,"CreateTag",{enumerable:true,get:function(){return Fe.CreateTag}});var ze=e("./component/tag/tag/OutlineCreateTag");Object.defineProperty(r,"OutlineCreateTag",{enumerable:true,get:function(){return ze.OutlineCreateTag}});var $e=e("./component/tag/tag/ExtremePointCreateTag");Object.defineProperty(r,"ExtremePointCreateTag",{enumerable:true,get:function(){return $e.ExtremePointCreateTag}});i(e("./component/interfaces/interfaces"),r)},{"./component/AttributionComponent":306,"./component/BackgroundComponent":307,"./component/BearingComponent":308,"./component/CacheComponent":309,"./component/Component":310,"./component/ComponentService":311,"./component/CoverComponent":312,"./component/DebugComponent":313,"./component/ImageComponent":314,"./component/LoadingComponent":315,"./component/NavigationComponent":316,"./component/RouteComponent":317,"./component/StatsComponent":318,"./component/direction/DirectionComponent":319,"./component/direction/DirectionDOMCalculator":320,"./component/direction/DirectionDOMRenderer":321,"./component/imageplane/ImagePlaneComponent":322,"./component/imageplane/ImagePlaneGLRenderer":323,"./component/interfaces/interfaces":327,"./component/keyboard/KeyPlayHandler":328,"./component/keyboard/KeySequenceNavigationHandler":329,"./component/keyboard/KeySpatialNavigationHandler":330,"./component/keyboard/KeyZoomHandler":331,"./component/keyboard/KeyboardComponent":332,"./component/marker/MarkerComponent":334,"./component/marker/MarkerScene":335,"./component/marker/MarkerSet":336,"./component/marker/marker/CircleMarker":338,"./component/marker/marker/Marker":339,"./component/marker/marker/SimpleMarker":340,"./component/mouse/BounceHandler":341,"./component/mouse/DoubleClickZoomHandler":342,"./component/mouse/DragPanHandler":343,"./component/mouse/EarthControlHandler":344,"./component/mouse/HandlerTypes":345,"./component/mouse/ImageBoundary":346,"./component/mouse/MouseComponent":347,"./component/mouse/ScrollZoomHandler":348,"./component/mouse/TouchZoomHandler":349,"./component/popup/PopupComponent":351,"./component/popup/popup/Popup":352,"./component/sequence/SequenceComponent":353,"./component/sequence/SequenceDOMRenderer":354,"./component/sequence/SequenceMode":355,"./component/shaders/Shaders":356,"./component/slider/SliderComponent":357,"./component/slider/SliderDOMRenderer":358,"./component/slider/SliderGLRenderer":359,"./component/spatialdata/SpatialDataCache":362,"./component/spatialdata/SpatialDataComponent":363,"./component/spatialdata/SpatialDataScene":364,"./component/tag/TagComponent":367,"./component/tag/TagCreator":368,"./component/tag/TagDOMRenderer":369,"./component/tag/TagMode":370,"./component/tag/TagOperation":371,"./component/tag/TagScene":372,"./component/tag/TagSet":373,"./component/tag/error/GeometryTagError":374,"./component/tag/geometry/Geometry":375,"./component/tag/geometry/PointGeometry":376,"./component/tag/geometry/PointsGeometry":377,"./component/tag/geometry/PolygonGeometry":378,"./component/tag/geometry/RectGeometry":379,"./component/tag/geometry/VertexGeometry":380,"./component/tag/handlers/CreateHandlerBase":381,"./component/tag/handlers/CreatePointHandler":382,"./component/tag/handlers/CreatePointsHandler":383,"./component/tag/handlers/CreatePolygonHandler":384,"./component/tag/handlers/CreateRectDragHandler":385,"./component/tag/handlers/CreateRectHandler":386,"./component/tag/handlers/CreateVertexHandler":387,"./component/tag/handlers/EditVertexHandler":388,"./component/tag/handlers/TagHandlerBase":389,"./component/tag/tag/CreateTag":391,"./component/tag/tag/ExtremePointCreateTag":392,"./component/tag/tag/ExtremePointRenderTag":393,"./component/tag/tag/ExtremePointTag":394,"./component/tag/tag/OutlineCreateTag":395,"./component/tag/tag/OutlineRenderTag":396,"./component/tag/tag/OutlineRenderTagBase":397,"./component/tag/tag/OutlineTag":398,"./component/tag/tag/RenderTag":399,"./component/tag/tag/SpotRenderTag":400,"./component/tag/tag/SpotTag":401,"./component/tag/tag/Tag":402,"./component/tag/tag/TagDomain":403,"./component/utils/ComponentSize":404,"./component/utils/HandlerBase":405,"./component/utils/MeshFactory":406,"./component/utils/MeshScene":407,"./component/utils/MouseOperator":408,"./component/zoom/ZoomComponent":409}],292:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./graph/edge/EdgeDirection");Object.defineProperty(r,"EdgeDirection",{enumerable:true,get:function(){return o.EdgeDirection}});var a=e("./graph/edge/EdgeCalculatorSettings");Object.defineProperty(r,"EdgeCalculatorSettings",{enumerable:true,get:function(){return a.EdgeCalculatorSettings}});var s=e("./graph/edge/EdgeCalculatorDirections");Object.defineProperty(r,"EdgeCalculatorDirections",{enumerable:true,get:function(){return s.EdgeCalculatorDirections}});var u=e("./graph/edge/EdgeCalculatorCoefficients");Object.defineProperty(r,"EdgeCalculatorCoefficients",{enumerable:true,get:function(){return u.EdgeCalculatorCoefficients}});var c=e("./graph/edge/EdgeCalculator");Object.defineProperty(r,"EdgeCalculator",{enumerable:true,get:function(){return c.EdgeCalculator}});i(e("./graph/edge/interfaces/interfaces"),r)},{"./graph/edge/EdgeCalculator":433,"./graph/edge/EdgeCalculatorCoefficients":434,"./graph/edge/EdgeCalculatorDirections":435,"./graph/edge/EdgeCalculatorSettings":436,"./graph/edge/EdgeDirection":437,"./graph/edge/interfaces/interfaces":438}],293:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./error/AbortMapillaryError");Object.defineProperty(r,"AbortMapillaryError",{enumerable:true,get:function(){return n.AbortMapillaryError}});var i=e("./error/ArgumentMapillaryError");Object.defineProperty(r,"ArgumentMapillaryError",{enumerable:true,get:function(){return i.ArgumentMapillaryError}});var o=e("./error/GraphMapillaryError");Object.defineProperty(r,"GraphMapillaryError",{enumerable:true,get:function(){return o.GraphMapillaryError}});var a=e("./error/MapillaryError");Object.defineProperty(r,"MapillaryError",{enumerable:true,get:function(){return a.MapillaryError}})},{"./error/AbortMapillaryError":410,"./error/ArgumentMapillaryError":411,"./error/GraphMapillaryError":412,"./error/MapillaryError":413}],294:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});r.Lines=r.Geo=void 0;var o=e("./geo/Camera");Object.defineProperty(r,"Camera",{enumerable:true,get:function(){return o.Camera}});var a=e("./geo/GeoCoords");Object.defineProperty(r,"GeoCoords",{enumerable:true,get:function(){return a.GeoCoords}});var s=e("./geo/GeoRBush");Object.defineProperty(r,"GeoRBush",{enumerable:true,get:function(){return s.GeoRBush}});var u=e("./geo/ViewportCoords");Object.defineProperty(r,"ViewportCoords",{enumerable:true,get:function(){return u.ViewportCoords}});var c=e("./geo/Spatial");Object.defineProperty(r,"Spatial",{enumerable:true,get:function(){return c.Spatial}});var l=e("./geo/Transform");Object.defineProperty(r,"Transform",{enumerable:true,get:function(){return l.Transform}});i(e("./geo/interfaces/interfaces"),r);var h=e("./geo/Geo");r.Geo=h;var p=e("./geo/Lines");r.Lines=p},{"./geo/Camera":414,"./geo/Geo":415,"./geo/GeoCoords":416,"./geo/GeoRBush":417,"./geo/Lines":418,"./geo/Spatial":419,"./geo/Transform":420,"./geo/ViewportCoords":421,"./geo/interfaces/interfaces":422}],295:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./graph/FilterCreator");Object.defineProperty(r,"FilterCreator",{enumerable:true,get:function(){return o.FilterCreator}});var a=e("./graph/Graph");Object.defineProperty(r,"Graph",{enumerable:true,get:function(){return a.Graph}});var s=e("./graph/GraphCalculator");Object.defineProperty(r,"GraphCalculator",{enumerable:true,get:function(){return s.GraphCalculator}});var u=e("./graph/GraphMode");Object.defineProperty(r,"GraphMode",{enumerable:true,get:function(){return u.GraphMode}});var c=e("./graph/GraphService");Object.defineProperty(r,"GraphService",{enumerable:true,get:function(){return c.GraphService}});var l=e("./graph/ImageLoadingService");Object.defineProperty(r,"ImageLoadingService",{enumerable:true,get:function(){return l.ImageLoadingService}});var h=e("./graph/MeshReader");Object.defineProperty(r,"MeshReader",{enumerable:true,get:function(){return h.MeshReader}});var p=e("./graph/Node");Object.defineProperty(r,"Node",{enumerable:true,get:function(){return p.Node}});var f=e("./graph/NodeCache");Object.defineProperty(r,"NodeCache",{enumerable:true,get:function(){return f.NodeCache}});var d=e("./graph/Sequence");Object.defineProperty(r,"Sequence",{enumerable:true,get:function(){return d.Sequence}});i(e("./graph/interfaces/interfaces"),r)},{"./graph/FilterCreator":423,"./graph/Graph":424,"./graph/GraphCalculator":425,"./graph/GraphMode":426,"./graph/GraphService":427,"./graph/ImageLoadingService":428,"./graph/MeshReader":429,"./graph/Node":430,"./graph/NodeCache":431,"./graph/Sequence":432,"./graph/interfaces/interfaces":439}],296:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});r.SpatialDataComponent=r.PopupComponent=r.MarkerComponent=r.TagComponent=void 0;i(e("./Support"),r);var o=e("./Edge");Object.defineProperty(r,"EdgeDirection",{enumerable:true,get:function(){return o.EdgeDirection}});var a=e("./Error");Object.defineProperty(r,"AbortMapillaryError",{enumerable:true,get:function(){return a.AbortMapillaryError}});var s=e("./Render");Object.defineProperty(r,"RenderMode",{enumerable:true,get:function(){return s.RenderMode}});var u=e("./State");Object.defineProperty(r,"TransitionMode",{enumerable:true,get:function(){return u.TransitionMode}});var c=e("./Viewer");Object.defineProperty(r,"Alignment",{enumerable:true,get:function(){return c.Alignment}});Object.defineProperty(r,"ImageSize",{enumerable:true,get:function(){return c.ImageSize}});Object.defineProperty(r,"Viewer",{enumerable:true,get:function(){return c.Viewer}});var l=e("./Component");Object.defineProperty(r,"SliderMode",{enumerable:true,get:function(){return l.SliderMode}});Object.defineProperty(r,"ComponentSize",{enumerable:true,get:function(){return l.ComponentSize}});var h=e("./component/tag/Tag");r.TagComponent=h;var p=e("./component/marker/Marker");r.MarkerComponent=p;var f=e("./component/popup/Popup");r.PopupComponent=f;var d=e("./component/spatialdata/SpatialData");r.SpatialDataComponent=d},{"./Component":291,"./Edge":292,"./Error":293,"./Render":297,"./State":298,"./Support":299,"./Viewer":302,"./component/marker/Marker":333,"./component/popup/Popup":350,"./component/spatialdata/SpatialData":361,"./component/tag/Tag":366}],297:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./render/DOMRenderer");Object.defineProperty(r,"DOMRenderer",{enumerable:true,get:function(){return o.DOMRenderer}});var a=e("./render/GLRenderer");Object.defineProperty(r,"GLRenderer",{enumerable:true,get:function(){return a.GLRenderer}});var s=e("./render/GLRenderStage");Object.defineProperty(r,"GLRenderStage",{enumerable:true,get:function(){return s.GLRenderStage}});var u=e("./render/RenderCamera");Object.defineProperty(r,"RenderCamera",{enumerable:true,get:function(){return u.RenderCamera}});var c=e("./render/RenderMode");Object.defineProperty(r,"RenderMode",{enumerable:true,get:function(){return c.RenderMode}});var l=e("./render/RenderService");Object.defineProperty(r,"RenderService",{enumerable:true,get:function(){return l.RenderService}});i(e("./render/interfaces/interfaces"),r)},{"./render/DOMRenderer":440,"./render/GLRenderStage":441,"./render/GLRenderer":442,"./render/RenderCamera":443,"./render/RenderMode":444,"./render/RenderService":445,"./render/interfaces/interfaces":446}],298:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./state/FrameGenerator");Object.defineProperty(r,"FrameGenerator",{enumerable:true,get:function(){return o.FrameGenerator}});var a=e("./state/RotationDelta");Object.defineProperty(r,"RotationDelta",{enumerable:true,get:function(){return a.RotationDelta}});var s=e("./state/State");Object.defineProperty(r,"State",{enumerable:true,get:function(){return s.State}});var u=e("./state/states/StateBase");Object.defineProperty(r,"StateBase",{enumerable:true,get:function(){return u.StateBase}});var c=e("./state/StateContext");Object.defineProperty(r,"StateContext",{enumerable:true,get:function(){return c.StateContext}});var l=e("./state/StateService");Object.defineProperty(r,"StateService",{enumerable:true,get:function(){return l.StateService}});var h=e("./state/TransitionMode");Object.defineProperty(r,"TransitionMode",{enumerable:true,get:function(){return h.TransitionMode}});var p=e("./state/states/EarthState");Object.defineProperty(r,"EarthState",{enumerable:true,get:function(){return p.EarthState}});var f=e("./state/states/InteractiveStateBase");Object.defineProperty(r,"InteractiveStateBase",{enumerable:true,get:function(){return f.InteractiveStateBase}});var d=e("./state/states/InteractiveWaitingState");Object.defineProperty(r,"InteractiveWaitingState",{enumerable:true,get:function(){return d.InteractiveWaitingState}});var v=e("./state/states/TraversingState");Object.defineProperty(r,"TraversingState",{enumerable:true,get:function(){return v.TraversingState}});var m=e("./state/states/WaitingState");Object.defineProperty(r,"WaitingState",{enumerable:true,get:function(){return m.WaitingState}});i(e("./state/interfaces/interfaces"),r)},{"./state/FrameGenerator":447,"./state/RotationDelta":448,"./state/State":449,"./state/StateContext":450,"./state/StateService":451,"./state/TransitionMode":452,"./state/interfaces/interfaces":453,"./state/states/EarthState":454,"./state/states/InteractiveStateBase":455,"./state/states/InteractiveWaitingState":456,"./state/states/StateBase":457,"./state/states/TraversingState":458,"./state/states/WaitingState":459}],299:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.isFallbackSupported=r.isSupported=void 0;var n=e("./utils/Support");function i(){return o()&&n.isWebGLSupportedCached()}r.isSupported=i;function o(){return n.isBrowser()&&n.isBlobSupported()&&n.isArraySupported()&&n.isFunctionSupported()&&n.isJSONSupported()&&n.isObjectSupported()}r.isFallbackSupported=o},{"./utils/Support":468}],300:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./tiles/ImageTileLoader");Object.defineProperty(r,"ImageTileLoader",{enumerable:true,get:function(){return o.ImageTileLoader}});var a=e("./tiles/ImageTileStore");Object.defineProperty(r,"ImageTileStore",{enumerable:true,get:function(){return a.ImageTileStore}});var s=e("./tiles/TextureProvider");Object.defineProperty(r,"TextureProvider",{enumerable:true,get:function(){return s.TextureProvider}});var u=e("./tiles/RegionOfInterestCalculator");Object.defineProperty(r,"RegionOfInterestCalculator",{enumerable:true,get:function(){return u.RegionOfInterestCalculator}});i(e("./tiles/interfaces/interfaces"),r)},{"./tiles/ImageTileLoader":460,"./tiles/ImageTileStore":461,"./tiles/RegionOfInterestCalculator":462,"./tiles/TextureProvider":463,"./tiles/interfaces/interfaces":464}],301:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./utils/DOM");Object.defineProperty(r,"DOM",{enumerable:true,get:function(){return o.DOM}});var a=e("./utils/EventEmitter");Object.defineProperty(r,"EventEmitter",{enumerable:true,get:function(){return a.EventEmitter}});var s=e("./utils/Settings");Object.defineProperty(r,"Settings",{enumerable:true,get:function(){return s.Settings}});i(e("./utils/Support"),r);var u=e("./utils/Urls");Object.defineProperty(r,"Urls",{enumerable:true,get:function(){return u.Urls}})},{"./utils/DOM":465,"./utils/EventEmitter":466,"./utils/Settings":467,"./utils/Support":468,"./utils/Urls":469}],302:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./viewer/Alignment");Object.defineProperty(r,"Alignment",{enumerable:true,get:function(){return o.Alignment}});var a=e("./viewer/CacheService");Object.defineProperty(r,"CacheService",{enumerable:true,get:function(){return a.CacheService}});var s=e("./viewer/ComponentController");Object.defineProperty(r,"ComponentController",{enumerable:true,get:function(){return s.ComponentController}});var u=e("./viewer/Container");Object.defineProperty(r,"Container",{enumerable:true,get:function(){return u.Container}});var c=e("./viewer/Observer");Object.defineProperty(r,"Observer",{enumerable:true,get:function(){return c.Observer}});var l=e("./viewer/ImageSize");Object.defineProperty(r,"ImageSize",{enumerable:true,get:function(){return l.ImageSize}});var h=e("./viewer/KeyboardService");Object.defineProperty(r,"KeyboardService",{enumerable:true,get:function(){return h.KeyboardService}});var p=e("./viewer/LoadingService");Object.defineProperty(r,"LoadingService",{enumerable:true,get:function(){return p.LoadingService}});var f=e("./viewer/MouseService");Object.defineProperty(r,"MouseService",{enumerable:true,get:function(){return f.MouseService}});var d=e("./viewer/Navigator");Object.defineProperty(r,"Navigator",{enumerable:true,get:function(){return d.Navigator}});var v=e("./viewer/PlayService");Object.defineProperty(r,"PlayService",{enumerable:true,get:function(){return v.PlayService}});var m=e("./viewer/Projection");Object.defineProperty(r,"Projection",{enumerable:true,get:function(){return m.Projection}});var g=e("./viewer/SpriteService");Object.defineProperty(r,"SpriteService",{enumerable:true,get:function(){return g.SpriteService}});var _=e("./viewer/TouchService");Object.defineProperty(r,"TouchService",{enumerable:true,get:function(){return _.TouchService}});var y=e("./viewer/Viewer");Object.defineProperty(r,"Viewer",{enumerable:true,get:function(){return y.Viewer}});i(e("./viewer/interfaces/interfaces"),r)},{"./viewer/Alignment":470,"./viewer/CacheService":471,"./viewer/ComponentController":472,"./viewer/Container":473,"./viewer/ImageSize":474,"./viewer/KeyboardService":475,"./viewer/LoadingService":476,"./viewer/MouseService":477,"./viewer/Navigator":478,"./viewer/Observer":479,"./viewer/PlayService":481,"./viewer/Projection":482,"./viewer/SpriteService":483,"./viewer/TouchService":484,"./viewer/Viewer":485,"./viewer/interfaces/interfaces":486}],303:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.APIv3=void 0;var s=e("rxjs/operators");var n=e("rxjs");var i=e("../API");var o=function(){function e(e,t,r){this._clientId=e;this._modelCreator=r!=null?r:new i.ModelCreator;this._model=this._modelCreator.createModel(e,t);this._pageCount=999;this._pathImageByKey="imageByKey";this._pathImageCloseTo="imageCloseTo";this._pathImagesByH="imagesByH";this._pathImageViewAdd="imageViewAdd";this._pathSequenceByKey="sequenceByKey";this._pathSequenceViewAdd="sequenceViewAdd";this._propertiesCore=["cl","l","sequence_key"];this._propertiesFill=["captured_at","captured_with_camera_uuid","user","organization_key","private","project"];this._propertiesKey=["key"];this._propertiesSequence=["keys"];this._propertiesSpatial=["atomic_scale","cluster_key","c_rotation","ca","calt","camera_projection_type","cca","cfocal","ck1","ck2","gpano","height","merge_cc","merge_version","orientation","width"];this._propertiesUser=["username"]}Object.defineProperty(e.prototype,"clientId",{get:function(){return this._clientId},enumerable:false,configurable:true});e.prototype.imageByKeyFill$=function(t){return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImageByKey,t,this._propertiesKey.concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).pipe(s.map(function(e){if(!e){throw new Error("Images ("+t.join(", ")+") could not be found.")}return e.json.imageByKey})),this._pathImageByKey,t)};e.prototype.imageByKeyFull$=function(t){return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImageByKey,t,this._propertiesKey.concat(this._propertiesCore).concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).pipe(s.map(function(e){if(!e){throw new Error("Images ("+t.join(", ")+") could not be found.")}return e.json.imageByKey})),this._pathImageByKey,t)};e.prototype.imageCloseTo$=function(e,t){var r=t+":"+e;return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImageCloseTo,[r],this._propertiesKey.concat(this._propertiesCore).concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).pipe(s.map(function(e){return e!=null?e.json.imageCloseTo[r]:null})),this._pathImageCloseTo,[r])};e.prototype.imagesByH$=function(o){var a=this;return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImagesByH,o,{from:0,to:this._pageCount},this._propertiesKey.concat(this._propertiesCore)])).pipe(s.map(function(e){if(!e){e={json:{imagesByH:{}}};for(var t=0,r=o;t<r.length;t++){var n=r[t];e.json.imagesByH[n]={};for(var i=0;i<=a._pageCount;i++){e.json.imagesByH[n][i]=null}}}return e.json.imagesByH})),this._pathImagesByH,o)};e.prototype.imageViewAdd$=function(e){return this._catchInvalidateCall$(this._wrapCallModelResponse$(this._model.call([this._pathImageViewAdd],[e])),this._pathImageViewAdd,e)};e.prototype.invalidateImageByKey=function(e){this._invalidateGet(this._pathImageByKey,e)};e.prototype.invalidateImagesByH=function(e){this._invalidateGet(this._pathImagesByH,e)};e.prototype.invalidateSequenceByKey=function(e){this._invalidateGet(this._pathSequenceByKey,e)};e.prototype.setToken=function(e){this._model.invalidate([]);this._model=null;this._model=this._modelCreator.createModel(this._clientId,e)};e.prototype.sequenceByKey$=function(i){return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathSequenceByKey,i,this._propertiesKey.concat(this._propertiesSequence)])).pipe(s.map(function(e){if(!e){e={json:{sequenceByKey:{}}}}for(var t=0,r=i;t<r.length;t++){var n=r[t];if(!(n in e.json.sequenceByKey)){console.warn("Sequence data missing ("+n+")");e.json.sequenceByKey[n]={key:n,keys:[]}}}return e.json.sequenceByKey})),this._pathSequenceByKey,i)};e.prototype.sequenceViewAdd$=function(e){return this._catchInvalidateCall$(this._wrapCallModelResponse$(this._model.call([this._pathSequenceViewAdd],[e])),this._pathSequenceViewAdd,e)};e.prototype._catchInvalidateGet$=function(e,t,r){var n=this;return e.pipe(s.catchError(function(e){n._invalidateGet(t,r);throw e}))};e.prototype._catchInvalidateCall$=function(e,t,r){var n=this;return e.pipe(s.catchError(function(e){n._invalidateCall(t,r);throw e}))};e.prototype._invalidateGet=function(e,t){this._model.invalidate([e,t])};e.prototype._invalidateCall=function(e,t){this._model.invalidate([e],[t])};e.prototype._wrapModelResponse$=function(e){return n.Observable.create(function(t){e.then(function(e){t.next(e);t.complete()},function(e){t.error(e)})})};e.prototype._wrapCallModelResponse$=function(e){return this._wrapModelResponse$(e).pipe(s.map(function(e){return}))};return e}();r.APIv3=o;r.default=o},{"../API":290,rxjs:43,"rxjs/operators":241}],304:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ModelCreator=void 0;var n=e("falcor");var i=e("falcor-http-datasource");var o=e("../Utils");var a=function(){function e(){}e.prototype.createModel=function(e,t){var r={crossDomain:true,withCredentials:false};if(t!=null){r.headers={Authorization:"Bearer "+t}}return new n.Model({maxSize:16*1024*1024,source:new i.default(o.Urls.falcorModel(e),r)})};return e}();r.ModelCreator=a;r.default=a},{"../Utils":301,falcor:15,"falcor-http-datasource":10}],305:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true})},{}],306:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.AttributionComponent=void 0;var o=e("rxjs");var a=e("rxjs/operators");var d=e("virtual-dom");var n=e("../Component");var v=e("../Utils");var s=function(n){i(e,n);function e(e,t,r){return n.call(this,e,t,r)||this}e.prototype._activate=function(){var n=this;this._disposable=o.combineLatest(this._navigator.stateService.currentNode$,this._container.renderService.size$).pipe(a.map(function(e){var t=e[0],r=e[1];return{name:n._name,vnode:n._getAttributionNode(t.username,t.key,t.capturedAt,r.width)}})).subscribe(this._container.domRenderer.render$)};e.prototype._deactivate=function(){this._disposable.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{}};e.prototype._getAttributionNode=function(e,t,r,n){var i=n<=640;var o=d.h("div.AttributionMapillaryLogo",[]);var a=d.h("a.AttributionIconContainer",{href:v.Urls.explore,target:"_blank"},[o]);var s=i?""+e:"image by "+e;var u=d.h("div.AttributionUsername",{textContent:s},[]);var c=new Date(r).toDateString().split(" ");var l=(c.length>3?i?[c[3]]:[c[1],c[2]+",",c[3]]:c).join(" ");var h=d.h("div.AttributionDate",{textContent:l},[]);var p=d.h("a.AttributionImageContainer",{href:v.Urls.exporeImage(t),target:"_blank"},[u,h]);var f=i?".AttributionCompact":"";return d.h("div.AttributionContainer"+f,{},[a,p])};e.componentName="attribution";return e}(n.Component);r.AttributionComponent=s;n.ComponentService.register(s);r.default=s},{"../Component":291,"../Utils":301,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],307:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.BackgroundComponent=void 0;var o=e("virtual-dom");var n=e("../Component");var a=function(n){i(e,n);function e(e,t,r){return n.call(this,e,t,r)||this}e.prototype._activate=function(){this._container.domRenderer.render$.next({name:this._name,vnode:this._getBackgroundNode("The viewer can't display the given image.")})};e.prototype._deactivate=function(){return};e.prototype._getDefaultConfiguration=function(){return{}};e.prototype._getBackgroundNode=function(e){return o.h("div.BackgroundWrapper",{},[o.h("p",{textContent:e},[])])};e.componentName="background";return e}(n.Component);r.BackgroundComponent=a;n.ComponentService.register(a);r.default=a},{"../Component":291,"virtual-dom":247}],308:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.BearingComponent=void 0;var a=e("rxjs/operators");var v=e("virtual-dom");var o=e("@mapbox/unitbezier");var s=e("rxjs");var i=e("../Component");var u=e("../Geo");var c=e("../geo/ViewportCoords");var g=e("./utils/ComponentSize");var l=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t,r)||this;n._spatial=new u.Spatial;n._viewportCoords=new c.default;n._svgNamespace="http://www.w3.org/2000/svg";n._distinctThreshold=Math.PI/360;n._animationSpeed=.075;n._unitBezier=new o(.74,.67,.38,.96);return n}e.prototype._activate=function(){var m=this;var e=this._container.renderService.renderCamera$.pipe(a.map(function(e){var t=m._spatial.degToRad(e.perspective.fov);var r=e.perspective.aspect===Number.POSITIVE_INFINITY?Math.PI:Math.atan(e.perspective.aspect*Math.tan(.5*t))*2;return[m._spatial.azimuthalToBearing(e.rotation.phi),r]}),a.distinctUntilChanged(function(e,t){return Math.abs(t[0]-e[0])<m._distinctThreshold&&Math.abs(t[1]-e[1])<m._distinctThreshold}));var t=s.combineLatest(this._navigator.stateService.currentState$.pipe(a.distinctUntilChanged(undefined,function(e){return e.state.currentNode.key})),this._navigator.panService.panNodes$).pipe(a.map(function(e){var t=e[0],r=e[1];var n=t.state.currentNode;var i=t.state.currentTransform;if(n.pano){var o=2*Math.PI*n.gpano.CroppedAreaImageWidthPixels/n.gpano.FullPanoWidthPixels;return[o/2,o/2]}var a=m._computeProjectedPoints(i);var s=m._spatial.degToRad(m._computeHorizontalFov(a));var u=s/2;var c=s/2;for(var l=0,h=r;l<h.length;l++){var p=h[l],f=p[0],d=p[2];var v=m._spatial.wrap(f.ca-n.ca,-180,180);if(v<0){u=m._spatial.degToRad(Math.abs(v))+d/2}else{c=m._spatial.degToRad(Math.abs(v))+d/2}}return[u,c]}),a.distinctUntilChanged(function(e,t){var r=e[0],n=e[1];var i=t[0],o=t[1];return Math.abs(i-r)<m._distinctThreshold&&Math.abs(o-n)<m._distinctThreshold}));var r=s.combineLatest(this._navigator.stateService.currentState$.pipe(a.distinctUntilChanged(undefined,function(e){return e.state.currentNode.key})),this._container.renderService.bearing$).pipe(a.map(function(e){var t=e[0],r=e[1];var n=m._spatial.degToRad(t.state.currentNode.ca-r);return n}));var n=new s.Subject;var i=n.pipe(a.scan(function(e,t){return t(e)},{alpha:0,curr:[0,0,0],prev:[0,0,0]}),a.map(function(e){var t=m._unitBezier.solve(e.alpha);var r=e.curr;var n=e.prev;return[m._interpolate(n[0],r[0],t),m._interpolate(n[1],r[1],t)]}));this._fovSubscription=t.pipe(a.map(function(a){return function(e){var t=m._unitBezier.solve(e.alpha);var r=e.curr;var n=e.prev;var i=[m._interpolate(n[0],r[0],t),m._interpolate(n[1],r[1],t)];var o=a.slice();return{alpha:0,curr:o,prev:i}}})).subscribe(n);this._fovAnimationSubscription=t.pipe(a.switchMap(function(){return m._container.renderService.renderCameraFrame$.pipe(a.skip(1),a.scan(function(e){return e+m._animationSpeed},0),a.takeWhile(function(e){return e<=1+m._animationSpeed}),a.map(function(e){return Math.min(e,1)}))}),a.map(function(t){return function(e){return{alpha:t,curr:e.curr.slice(),prev:e.prev.slice()}}})).subscribe(n);var o=s.combineLatest(r,i).pipe(a.map(function(e){var t=e[0],r=e[1];return[t,r[0],r[1]]}));this._renderSubscription=s.combineLatest(e,o,this._configuration$,this._container.renderService.size$).pipe(a.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=i[0],a=i[1],s=i[2],u=e[2],c=e[3];var l=m._createBackground(r);var h=m._createFovIndicator(a,s,o);var p=m._createNorth(r);var f=m._createCircleSectorCompass(m._createCircleSector(Math.max(Math.PI/20,n),"#FFF"));var d=u.size===g.default.Small||u.size===g.default.Automatic&&c.width<640?".BearingCompact":"";return{name:m._name,vnode:v.h("div.BearingIndicatorContainer"+d,{oncontextmenu:function(e){e.preventDefault()}},[l,h,p,f])}})).subscribe(this._container.domRenderer.render$)};e.prototype._deactivate=function(){this._renderSubscription.unsubscribe();this._fovSubscription.unsubscribe();this._fovAnimationSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{size:g.default.Automatic}};e.prototype._createFovIndicator=function(e,t,r){var n=this._createFovArc(e,t);var i=v.h("g",{attributes:{transform:"translate(18,18)"},namespace:this._svgNamespace},[n]);var o=v.h("svg",{attributes:{viewBox:"0 0 36 36"},namespace:this._svgNamespace,style:{height:"36px",left:"2px",position:"absolute",top:"2px",transform:"rotateZ("+this._spatial.radToDeg(r)+"deg)",width:"36px"}},[i]);return o};e.prototype._createFovArc=function(e,t){var r=16.75;var n=2.5;var i=e+t;if(i>2*Math.PI-Math.PI/90){return v.h("circle",{attributes:{cx:"0",cy:"0","fill-opacity":"0",r:""+r,stroke:"#FFF","stroke-width":""+n},namespace:this._svgNamespace},[])}var o=-Math.PI/2-e;var a=o+i;var s=r*Math.cos(o);var u=r*Math.sin(o);var c=r*Math.cos(a);var l=r*Math.sin(a);var h=i>=Math.PI?1:0;var p="M "+s+" "+u+" A "+r+" "+r+" 0 "+h+" 1 "+c+" "+l;return v.h("path",{attributes:{d:p,"fill-opacity":"0",stroke:"#FFF","stroke-width":""+n},namespace:this._svgNamespace},[])};e.prototype._createCircleSectorCompass=function(e){var t=v.h("g",{attributes:{transform:"translate(1,1)"},namespace:this._svgNamespace},[e]);var r=v.h("svg",{attributes:{viewBox:"0 0 2 2"},namespace:this._svgNamespace,style:{height:"26px",left:"7px",position:"absolute",top:"7px",width:"26px"}},[t]);return r};e.prototype._createCircleSector=function(e,t){if(e>2*Math.PI-Math.PI/90){return v.h("circle",{attributes:{cx:"0",cy:"0",fill:t,r:"1"},namespace:this._svgNamespace},[])}var r=-Math.PI/2-e/2;var n=r+e;var i=Math.cos(r);var o=Math.sin(r);var a=Math.cos(n);var s=Math.sin(n);var u=e>=Math.PI?1:0;var c="M 0 0 "+i+" "+o+" A 1 1 0 "+u+" 1 "+a+" "+s;return v.h("path",{attributes:{d:c,fill:t},namespace:this._svgNamespace},[])};e.prototype._createNorth=function(e){var t=v.h("div.BearingNorth",[]);var r=v.h("div.BearingNorthContainer",{style:{transform:"rotateZ("+this._spatial.radToDeg(-e)+"deg)"}},[t]);return r};e.prototype._createBackground=function(e){return v.h("div.BearingIndicatorBackground",{style:{transform:"rotateZ("+this._spatial.radToDeg(-e)+"deg)"}},[v.h("div.BearingIndicatorBackgroundCircle",[]),v.h("div.BearingIndicatorBackgroundArrowContainer",[v.h("div.BearingIndicatorBackgroundArrow",[])])])};e.prototype._computeProjectedPoints=function(e){var t=[[1,0]];var r=[[0,.5]];var n=12;return u.Geo.computeProjectedPoints(e,t,r,n,this._viewportCoords)};e.prototype._computeHorizontalFov=function(e){var t=this;var r=e.map(function(e){return t._coordToFov(e[0])});var n=Math.min.apply(Math,r);return n};e.prototype._coordToFov=function(e){return this._spatial.radToDeg(2*Math.atan(e))};e.prototype._interpolate=function(e,t,r){return(1-r)*e+r*t};e.componentName="bearing";return e}(i.Component);r.BearingComponent=l;i.ComponentService.register(l);r.default=l},{"../Component":291,"../Geo":294,"../geo/ViewportCoords":421,"./utils/ComponentSize":404,"@mapbox/unitbezier":2,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],309:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CacheComponent=void 0;var y=e("rxjs");var b=e("rxjs/operators");var x=e("../Edge");var n=e("../Component");var o=function(n){i(e,n);function e(e,t,r){return n.call(this,e,t,r)||this}e.prototype.setDepth=function(e){this.configure({depth:e})};e.prototype._activate=function(){var _=this;this._sequenceSubscription=y.combineLatest(this._navigator.stateService.currentNode$.pipe(b.switchMap(function(e){return e.sequenceEdges$}),b.filter(function(e){return e.cached})),this._configuration$).pipe(b.switchMap(function(e){var t=e[0];var r=e[1];var n=Math.max(0,Math.min(4,r.depth.sequence));var i=_._cache$(t.edges,x.EdgeDirection.Next,n);var o=_._cache$(t.edges,x.EdgeDirection.Prev,n);return y.merge(i,o).pipe(b.catchError(function(e,t){console.error("Failed to cache sequence edges.",e);return y.empty()}))})).subscribe(function(){});this._spatialSubscription=y.combineLatest(this._navigator.stateService.currentNode$.pipe(b.switchMap(function(e){return y.combineLatest(y.of(e),e.spatialEdges$.pipe(b.filter(function(e){return e.cached})))})),this._configuration$).pipe(b.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];var o=n.edges;var a=i.depth;var s=Math.max(0,Math.min(2,a.pano));var u=r.pano?0:Math.max(0,Math.min(3,a.step));var c=r.pano?0:Math.max(0,Math.min(1,a.turn));var l=_._cache$(o,x.EdgeDirection.Pano,s);var h=_._cache$(o,x.EdgeDirection.StepForward,u);var p=_._cache$(o,x.EdgeDirection.StepBackward,u);var f=_._cache$(o,x.EdgeDirection.StepLeft,u);var d=_._cache$(o,x.EdgeDirection.StepRight,u);var v=_._cache$(o,x.EdgeDirection.TurnLeft,c);var m=_._cache$(o,x.EdgeDirection.TurnRight,c);var g=_._cache$(o,x.EdgeDirection.TurnU,c);return y.merge(h,p,f,d,l,v,m,g).pipe(b.catchError(function(e,t){console.error("Failed to cache spatial edges.",e);return y.empty()}))})).subscribe(function(){})};e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe();this._spatialSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}};e.prototype._cache$=function(e,s,t){var u=this;return y.zip(y.of(e),y.of(t)).pipe(b.expand(function(e){var t=e[0];var r=e[1];var n=[];if(r>0){for(var i=0,o=t;i<o.length;i++){var a=o[i];if(a.data.direction===s){n.push(y.zip(u._navigator.graphService.cacheNode$(a.to).pipe(b.mergeMap(function(e){return u._nodeToEdges$(e,s)})),y.of(r-1)))}}}return y.from(n).pipe(b.mergeAll())}),b.skip(1))};e.prototype._nodeToEdges$=function(e,t){return([x.EdgeDirection.Next,x.EdgeDirection.Prev].indexOf(t)>-1?e.sequenceEdges$:e.spatialEdges$).pipe(b.first(function(e){return e.cached}),b.map(function(e){return e.edges}))};e.componentName="cache";return e}(n.Component);r.CacheComponent=o;n.ComponentService.register(o);r.default=o},{"../Component":291,"../Edge":292,rxjs:43,"rxjs/operators":241}],310:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.Component=void 0;var o=e("rxjs/operators");var a=e("rxjs");var i=e("../Utils");var s=function(i){n(e,i);function e(e,t,r){var n=i.call(this)||this;n._activated$=new a.BehaviorSubject(false);n._configurationSubject$=new a.Subject;n._activated=false;n._container=t;n._name=e;n._navigator=r;n._configuration$=n._configurationSubject$.pipe(o.startWith(n.defaultConfiguration),o.scan(function(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}),o.publishReplay(1),o.refCount());n._configuration$.subscribe(function(){});return n}Object.defineProperty(e.prototype,"activated",{get:function(){return this._activated},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"activated$",{get:function(){return this._activated$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"defaultConfiguration",{get:function(){return this._getDefaultConfiguration()},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:false,configurable:true});e.prototype.activate=function(e){if(this._activated){return}if(e!==undefined){this._configurationSubject$.next(e)}this._activated=true;this._activate();this._activated$.next(true)};e.prototype.configure=function(e){this._configurationSubject$.next(e)};e.prototype.deactivate=function(){if(!this._activated){return}this._activated=false;this._deactivate();this._container.domRenderer.clear(this._name);this._container.glRenderer.clear(this._name);this._activated$.next(false)};e.prototype.resize=function(){return};e.componentName="not_worthy";return e}(i.EventEmitter);r.Component=s;r.default=s},{"../Utils":301,rxjs:43,"rxjs/operators":241}],311:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ComponentService=void 0;var n=e("../Error");var i=function(){function i(e,t){this._components={};for(var r in i.registeredComponents){if(!i.registeredComponents.hasOwnProperty(r)){continue}var n=i.registeredComponents[r];this._components[r]={active:false,component:new n(r,e,t)}}this._coverComponent=new i.registeredCoverComponent("cover",e,t);this._coverComponent.activate();this._coverActivated=true}i.register=function(e){if(i.registeredComponents[e.componentName]===undefined){i.registeredComponents[e.componentName]=e}};i.registerCover=function(e){i.registeredCoverComponent=e};Object.defineProperty(i.prototype,"coverActivated",{get:function(){return this._coverActivated},enumerable:false,configurable:true});i.prototype.activateCover=function(){if(this._coverActivated){return}this._coverActivated=true;for(var e in this._components){if(!this._components.hasOwnProperty(e)){continue}var t=this._components[e];if(t.active){t.component.deactivate()}}};i.prototype.deactivateCover=function(){if(!this._coverActivated){return}this._coverActivated=false;for(var e in this._components){if(!this._components.hasOwnProperty(e)){continue}var t=this._components[e];if(t.active){t.component.activate()}}};i.prototype.activate=function(e){this._checkName(e);this._components[e].active=true;if(!this._coverActivated){this.get(e).activate()}};i.prototype.configure=function(e,t){this._checkName(e);this.get(e).configure(t)};i.prototype.deactivate=function(e){this._checkName(e);this._components[e].active=false;if(!this._coverActivated){this.get(e).deactivate()}};i.prototype.get=function(e){return this._components[e].component};i.prototype.getCover=function(){return this._coverComponent};i.prototype._checkName=function(e){if(!(e in this._components)){throw new n.ArgumentMapillaryError("Component does not exist: "+e)}};i.registeredComponents={};return i}();r.ComponentService=i;r.default=i},{"../Error":293}],312:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CoverComponent=void 0;var o=e("rxjs");var s=e("rxjs/operators");var u=e("virtual-dom");var c=e("../Component");var a=e("../Utils");var l=e("../Viewer");var n=function(n){i(e,n);function e(e,t,r){return n.call(this,e,t,r)||this}e.prototype._activate=function(){var a=this;this._configuration$.pipe(s.distinctUntilChanged(undefined,function(e){return e.state}),s.switchMap(function(e){return o.combineLatest(o.of(e.state),a._navigator.stateService.currentNode$)}),s.switchMap(function(e){var t=e[0],r=e[1];var n=o.combineLatest(o.of(r.key),r.image$.pipe(s.filter(function(e){return!!e}),s.map(function(e){return e.src})));return t===c.CoverState.Visible?n.pipe(s.first()):n}),s.distinctUntilChanged(function(e,t){var r=e[0],n=e[1];var i=t[0],o=t[1];return r===i&&n===o}),s.map(function(e){var t=e[0],r=e[1];return{key:t,src:r}})).subscribe(this._configurationSubject$);this._renderSubscription=o.combineLatest(this._configuration$,this._container.renderService.size$).pipe(s.map(function(e){var t=e[0],r=e[1];if(!t.key){return{name:a._name,vnode:u.h("div",[])}}var n=r.width<=640||r.height<=480?".CoverCompact":"";if(t.state===c.CoverState.Hidden){var i=u.h("div.CoverContainer.CoverDone"+n,[a._getCoverBackgroundVNode(t)]);return{name:a._name,vnode:i}}var o=u.h("div.CoverContainer"+n,[a._getCoverButtonVNode(t)]);return{name:a._name,vnode:o}})).subscribe(this._container.domRenderer.render$)};e.prototype._deactivate=function(){this._renderSubscription.unsubscribe();this._keySubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{state:c.CoverState.Visible}};e.prototype._getCoverButtonVNode=function(e){var t=this;var r=e.state===c.CoverState.Loading?"div.Cover.CoverLoading":"div.Cover";var n=u.h("div.CoverButton",[u.h("div.CoverButtonIcon",[])]);var i=u.h("a.CoverLogo",{href:a.Urls.explore,target:"_blank"},[]);var o=u.h("div.CoverIndicator",{onclick:function(){t.configure({state:c.CoverState.Loading})}},[]);return u.h(r,[this._getCoverBackgroundVNode(e),o,n,i])};e.prototype._getCoverBackgroundVNode=function(e){var t=e.src!=null?e.src:a.Urls.thumbnail(e.key,l.ImageSize.Size640);var r={style:{backgroundImage:"url("+t+")"}};var n=[];if(e.state===c.CoverState.Loading){n.push(u.h("div.Spinner",{},[]))}return u.h("div.CoverBackground",r,n)};e.componentName="cover";return e}(c.Component);r.CoverComponent=n;c.ComponentService.registerCover(n);r.default=n},{"../Component":291,"../Utils":301,"../Viewer":302,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],313:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.DebugComponent=void 0;var o=e("rxjs");var a=e("rxjs/operators");var u=e("virtual-dom");var i=e("../Component");var s=function(t){n(e,t);function e(){var e=t!==null&&t.apply(this,arguments)||this;e._open$=new o.BehaviorSubject(false);return e}e.prototype._activate=function(){var i=this;this._disposable=o.combineLatest(this._navigator.stateService.currentState$,this._open$,this._navigator.imageLoadingService.loadstatus$).pipe(a.map(function(e){var t=e[0],r=e[1],n=e[2];return{name:i._name,vnode:i._getDebugVNode(r,i._getDebugInfo(t,n))}})).subscribe(this._container.domRenderer.render$)};e.prototype._deactivate=function(){this._disposable.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{}};e.prototype._getDebugInfo=function(e,t){var r=[];r.push(u.h("h2","Node"));if(e.state.currentNode){r.push(u.h("p","currentNode: "+e.state.currentNode.key))}if(e.state.previousNode){r.push(u.h("p","previousNode: "+e.state.previousNode.key))}r.push(u.h("h2","Loading"));var n=0;var i=0;var o=0;for(var a in t){if(!t.hasOwnProperty(a)){continue}var s=t[a];n+=s.loaded;if(s.loaded!==s.total){o++}else{i++}}r.push(u.h("p","Loaded Images: "+i));r.push(u.h("p","Loading Images: "+o));r.push(u.h("p","Total bytes loaded: "+n));r.push(u.h("h2","Camera"));r.push(u.h("p","camera.position.x: "+e.state.camera.position.x));r.push(u.h("p","camera.position.y: "+e.state.camera.position.y));r.push(u.h("p","camera.position.z: "+e.state.camera.position.z));r.push(u.h("p","camera.lookat.x: "+e.state.camera.lookat.x));r.push(u.h("p","camera.lookat.y: "+e.state.camera.lookat.y));r.push(u.h("p","camera.lookat.z: "+e.state.camera.lookat.z));r.push(u.h("p","camera.up.x: "+e.state.camera.up.x));r.push(u.h("p","camera.up.y: "+e.state.camera.up.y));r.push(u.h("p","camera.up.z: "+e.state.camera.up.z));return r};e.prototype._getDebugVNode=function(e,t){if(e){return u.h("div.Debug",{},[u.h("h2",{},["Debug"]),this._getDebugVNodeButton(e),u.h("pre",{},t)])}else{return this._getDebugVNodeButton(e)}};e.prototype._getDebugVNodeButton=function(e){var t=e?"Disable Debug":"D";var r=e?"":".DebugButtonFixed";if(e){return u.h("button.DebugButton"+r,{onclick:this._closeDebugElement.bind(this)},[t])}else{return u.h("button.DebugButton"+r,{onclick:this._openDebugElement.bind(this)},[t])}};e.prototype._closeDebugElement=function(e){this._open$.next(false)};e.prototype._openDebugElement=function(){this._open$.next(true)};e.componentName="debug";return e}(i.Component);r.DebugComponent=s;i.ComponentService.register(s);r.default=s},{"../Component":291,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],314:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ImageComponent=void 0;var i=e("rxjs");var a=e("rxjs/operators");var s=e("virtual-dom");var o=e("../Component");var u=e("../Utils");var c=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._canvasId=t.id+"-"+i._name;i._dom=!!n?n:new u.DOM;return i}e.prototype._activate=function(){var t=this;var e=this._container.domRenderer.element$.pipe(a.map(function(e){return t._dom.document.getElementById(t._canvasId)}),a.filter(function(e){return!!e}),a.map(function(e){var t=e.parentElement;var r=t.offsetWidth;var n=t.offsetHeight;return[e,{height:n,width:r}]}),a.distinctUntilChanged(function(e,t){return e.height===t.height&&e.width===t.width},function(e){var t=e[0],r=e[1];return r}));this.drawSubscription=i.combineLatest(e,this._navigator.stateService.currentNode$).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];r.width=n.width;r.height=n.height;r.getContext("2d").drawImage(i.image,0,0,n.width,n.height)});this._container.domRenderer.renderAdaptive$.next({name:this._name,vnode:s.h("canvas#"+this._canvasId,[])})};e.prototype._deactivate=function(){this.drawSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{}};e.componentName="image";return e}(o.Component);r.ImageComponent=c;o.ComponentService.register(c);r.default=c},{"../Component":291,"../Utils":301,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],315:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.LoadingComponent=void 0;var o=e("rxjs");var s=e("rxjs/operators");var a=e("virtual-dom");var n=e("../Component");var u=function(n){i(e,n);function e(e,t,r){return n.call(this,e,t,r)||this}e.prototype._activate=function(){var a=this;this._loadingSubscription=this._navigator.loadingService.loading$.pipe(s.switchMap(function(e){return e?a._navigator.imageLoadingService.loadstatus$:o.of({})}),s.map(function(e){var t=0;var r=0;for(var n in e){if(!e.hasOwnProperty(n)){continue}var i=e[n];if(i.loaded!==i.total){r+=i.loaded;t+=i.total}}var o=100;if(t!==0){o=r/t*100}return{name:a._name,vnode:a._getBarVNode(o)}})).subscribe(this._container.domRenderer.render$)};e.prototype._deactivate=function(){this._loadingSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{}};e.prototype._getBarVNode=function(e){var t={};var r={};if(e!==100){t.width=e.toFixed(0)+"%";t.opacity="1"}else{t.width="100%";t.opacity="0"}return a.h("div.Loading",{style:r},[a.h("div.LoadingBar",{style:t},[])])};e.componentName="loading";return e}(n.Component);r.LoadingComponent=u;n.ComponentService.register(u);r.default=u},{"../Component":291,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],316:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.NavigationComponent=void 0;var o=e("rxjs");var a=e("rxjs/operators");var c=e("virtual-dom");var s=e("../Edge");var u=e("../Error");var i=e("../Component");var l=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t,r)||this;n._seqNames={};n._seqNames[s.EdgeDirection[s.EdgeDirection.Prev]]="Prev";n._seqNames[s.EdgeDirection[s.EdgeDirection.Next]]="Next";n._spaTopNames={};n._spaTopNames[s.EdgeDirection[s.EdgeDirection.TurnLeft]]="Turnleft";n._spaTopNames[s.EdgeDirection[s.EdgeDirection.StepLeft]]="Left";n._spaTopNames[s.EdgeDirection[s.EdgeDirection.StepForward]]="Forward";n._spaTopNames[s.EdgeDirection[s.EdgeDirection.StepRight]]="Right";n._spaTopNames[s.EdgeDirection[s.EdgeDirection.TurnRight]]="Turnright";n._spaBottomNames={};n._spaBottomNames[s.EdgeDirection[s.EdgeDirection.TurnU]]="Turnaround";n._spaBottomNames[s.EdgeDirection[s.EdgeDirection.StepBackward]]="Backward";return n}e.prototype._activate=function(){var u=this;this._renderSubscription=o.combineLatest(this._navigator.stateService.currentNode$,this._configuration$).pipe(a.switchMap(function(e){var t=e[0],r=e[1];var n=r.sequence?t.sequenceEdges$.pipe(a.map(function(e){return e.edges.map(function(e){return e.data.direction})})):o.of([]);var i=!t.pano&&r.spatial?t.spatialEdges$.pipe(a.map(function(e){return e.edges.map(function(e){return e.data.direction})})):o.of([]);return o.combineLatest(n,i).pipe(a.map(function(e){var t=e[0],r=e[1];return t.concat(r)}))}),a.map(function(e){var t=u._createArrowRow(u._seqNames,e);var r=u._createArrowRow(u._spaTopNames,e);var n=u._createArrowRow(u._spaBottomNames,e);var i=c.h("div.NavigationSequence",t);var o=c.h("div.NavigationSpatialTop",r);var a=c.h("div.NavigationSpatialBottom",n);var s=c.h("div.NavigationSpatial",[o,a]);return{name:u._name,vnode:c.h("div.NavigationContainer",[i,s])}})).subscribe(this._container.domRenderer.render$)};e.prototype._deactivate=function(){this._renderSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{sequence:true,spatial:true}};e.prototype._createArrowRow=function(e,t){var r=[];for(var n in e){if(!e.hasOwnProperty(n)){continue}var i=s.EdgeDirection[n];if(t.indexOf(i)!==-1){r.push(this._createVNode(i,e[n],"visible"))}else{r.push(this._createVNode(i,e[n],"hidden"))}}return r};e.prototype._createVNode=function(t,e,r){var n=this;return c.h("span.Direction.Direction"+e,{onclick:function(e){n._navigator.moveDir$(t).subscribe(undefined,function(e){if(!(e instanceof u.AbortMapillaryError)){console.error(e)}})},style:{visibility:r}},[])};e.componentName="navigation";return e}(i.Component);r.NavigationComponent=l;i.ComponentService.register(l);r.default=l},{"../Component":291,"../Edge":292,"../Error":293,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],317:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.RouteComponent=void 0;var s=e("rxjs");var o=e("rxjs/operators");var u=e("virtual-dom");var n=e("../Component");var c=function(){function e(){}return e}();var l=function(){function e(){}return e}();var h=function(){function e(){this.nodeInstructions=[];this.nodeInstructionsOrdered=[]}return e}();var a=function(n){i(e,n);function e(e,t,r){return n.call(this,e,t,r)||this}e.prototype.play=function(){this.configure({playing:true})};e.prototype.stop=function(){this.configure({playing:false})};e.prototype._activate=function(){var a=this;var e=this._navigator.stateService.currentState$.pipe(o.filter(function(e){return e.id%2===0}),o.filter(function(e){return e.state.nodesAhead<15}),o.distinctUntilChanged(undefined,function(e){return e.state.lastNode.key}));var t=s.combineLatest(this.configuration$.pipe(o.mergeMap(function(e){return s.from(e.paths)}),o.distinct(function(e){return e.sequenceKey}),o.mergeMap(function(t){return a._navigator.apiV3.sequenceByKey$([t.sequenceKey]).pipe(o.map(function(e){return e[t.sequenceKey]}))})),this.configuration$).pipe(o.map(function(e){var t=e[0],r=e[1];var n=0;var i=[];for(var o=0,a=r.paths;o<a.length;o++){var s=a[o];if(s.sequenceKey===t.key){var u=[];var c=false;for(var l=0,h=t.keys;l<h.length;l++){var p=h[l];if(s.startKey===p){c=true}if(c){var f=null;for(var d=0,v=s.infoKeys;d<v.length;d++){var m=v[d];if(m.key===p){f=m.description}}u.push({description:f,key:p})}if(s.stopKey===p){c=false}}i.push({nodeInstructions:u,place:n})}n++}return i}),o.scan(function(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];e.nodeInstructionsOrdered[i.place]=i.nodeInstructions}for(var o in e.nodeInstructionsOrdered){if(!e.nodeInstructionsOrdered.hasOwnProperty(o)){continue}var a=e.nodeInstructionsOrdered[o];for(var s=0,u=a;s<u.length;s++){var c=u[s];e.nodeInstructions.push(c)}}return e},new h));var r=s.combineLatest(e,t,this.configuration$).pipe(o.map(function(e){var t=e[0],r=e[1],n=e[2];return{conf:n,frame:t,routeTrack:r}}),o.scan(function(e,t){if(t.conf.playing===undefined||t.conf.playing){e.routeTrack=t.routeTrack;e.currentNode=t.frame.state.currentNode;e.lastNode=t.frame.state.lastNode;e.playing=true}else{a._navigator.stateService.cutNodes();e.playing=false}return e},new l),o.filter(function(e){return e.playing}),o.filter(function(e){for(var t=0,r=e.routeTrack.nodeInstructions;t<r.length;t++){var n=r[t];if(!n){continue}if(n.key===e.lastNode.key){return true}}return false}),o.distinctUntilChanged(undefined,function(e){return e.lastNode.key}),o.mergeMap(function(e){var t=0;for(var r=0,n=e.routeTrack.nodeInstructions;r<n.length;r++){var i=n[r];if(i.key===e.lastNode.key){break}t++}var o=e.routeTrack.nodeInstructions[t+1];if(!o){return s.of(null)}return a._navigator.graphService.cacheNode$(o.key)}));this._disposable=s.combineLatest(r,this.configuration$).pipe(o.map(function(e){var t=e[0],r=e[1];return{conf:r,node:t}}),o.filter(function(e){return e.node!==null&&e.conf.playing}),o.pluck("node")).subscribe(this._navigator.stateService.appendNode$);this._disposableDescription=s.combineLatest(this._navigator.stateService.currentNode$,t,this.configuration$).pipe(o.map(function(e){var t=e[0],r=e[1],n=e[2];if(n.playing!==undefined&&!n.playing){return"quit"}var i=null;for(var o=0,a=r.nodeInstructions;o<a.length;o++){var s=a[o];if(s.key===t.key){i=s.description;break}}return i}),o.scan(function(e,t){if(t!==e.description&&t!==null){e.description=t;e.showsLeft=6}else{e.showsLeft--}if(t==="quit"){e.description=null}return e},new c),o.map(function(e){if(e.showsLeft>0&&e.description){return{name:a._name,vnode:a._getRouteAnnotationNode(e.description)}}else{return{name:a._name,vnode:u.h("div",[])}}})).subscribe(this._container.domRenderer.render$)};e.prototype._deactivate=function(){this._disposable.unsubscribe();this._disposableDescription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{}};e.prototype._getRouteAnnotationNode=function(e){return u.h("div.RouteFrame",{},[u.h("p",{textContent:e},[])])};e.componentName="route";return e}(n.Component);r.RouteComponent=a;n.ComponentService.register(a);r.default=a},{"../Component":291,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],318:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.StatsComponent=void 0;var i=e("rxjs");var a=e("rxjs/operators");var o=e("../Component");var s=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._scheduler=n;return i}e.prototype._activate=function(){var e=this;this._sequenceSubscription=this._navigator.stateService.currentNode$.pipe(a.scan(function(e,t){var r=t.sequenceKey;e.report=[];if(!(r in e.reported)){e.report=[r];e.reported[r]=true}return e},{report:[],reported:{}}),a.filter(function(e){return e.report.length>0}),a.mergeMap(function(r){return e._navigator.apiV3.sequenceViewAdd$(r.report).pipe(a.catchError(function(e,t){console.error("Failed to report sequence stats ("+r.report+")",e);return i.empty()}))})).subscribe(function(){});this._imageSubscription=this._navigator.stateService.currentNode$.pipe(a.map(function(e){return e.key})).pipe(a.buffer(this._navigator.stateService.currentNode$.pipe(a.debounceTime(5e3,this._scheduler))),a.scan(function(e,t){e.report=[];for(var r=0,n=t;r<n.length;r++){var i=n[r];if(!(i in e.reported)){e.report.push(i);e.reported[i]=true}}return e},{report:[],reported:{}}),a.filter(function(e){return e.report.length>0}),a.mergeMap(function(r){return e._navigator.apiV3.imageViewAdd$(r.report).pipe(a.catchError(function(e,t){console.error("Failed to report image stats ("+r.report+")",e);return i.empty()}))})).subscribe(function(){})};e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe();this._imageSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{}};e.componentName="stats";return e}(o.Component);r.StatsComponent=s;o.ComponentService.register(s);r.default=s},{"../Component":291,rxjs:43,"rxjs/operators":241}],319:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.DirectionComponent=void 0;var i=e("virtual-dom");var a=e("rxjs");var s=e("rxjs/operators");var u=e("../../Component");var o=function(o){n(t,o);function t(e,t,r,n){var i=o.call(this,e,t,r)||this;i._renderer=!!n?n:new u.DirectionDOMRenderer(i.defaultConfiguration,{height:t.element.offsetHeight,width:t.element.offsetWidth});i._hoveredKeySubject$=new a.Subject;i._hoveredKey$=i._hoveredKeySubject$.pipe(s.share());return i}Object.defineProperty(t.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:false,configurable:true});t.prototype.setHighlightKey=function(e){this.configure({highlightKey:e})};t.prototype.setMinWidth=function(e){this.configure({minWidth:e})};t.prototype.setMaxWidth=function(e){this.configure({maxWidth:e})};t.prototype._activate=function(){var n=this;this._configurationSubscription=this._configuration$.subscribe(function(e){n._renderer.setConfiguration(e)});this._resizeSubscription=this._container.renderService.size$.subscribe(function(e){n._renderer.resize(e)});this._nodeSubscription=this._navigator.stateService.currentNode$.pipe(s.tap(function(e){n._container.domRenderer.render$.next({name:n._name,vnode:i.h("div",{},[])});n._renderer.setNode(e)}),s.withLatestFrom(this._configuration$),s.switchMap(function(e){var r=e[0],t=e[1];return a.combineLatest(r.spatialEdges$,t.distinguishSequence?n._navigator.graphService.cacheSequence$(r.sequenceKey).pipe(s.catchError(function(e,t){console.error("Failed to cache sequence ("+r.sequenceKey+")",e);return a.of(null)})):a.of(null))})).subscribe(function(e){var t=e[0],r=e[1];n._renderer.setEdges(t,r)});this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.pipe(s.tap(function(e){n._renderer.setRenderCamera(e)}),s.map(function(){return n._renderer}),s.filter(function(e){return e.needsRender}),s.map(function(e){return{name:n._name,vnode:e.render(n._navigator)}})).subscribe(this._container.domRenderer.render$);this._hoveredKeySubscription=a.combineLatest(this._container.domRenderer.element$,this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$.pipe(s.startWith(null)),this._container.mouseService.mouseUp$.pipe(s.startWith(null))).pipe(s.map(function(e){var t=e[0];var r=t.getElementsByClassName("DirectionsPerspective");for(var n=0;n<r.length;n++){var i=r.item(n).querySelector(":hover");if(i!=null&&i.hasAttribute("data-key")){return i.getAttribute("data-key")}}return null}),s.distinctUntilChanged()).subscribe(this._hoveredKeySubject$);this._emitHoveredKeySubscription=this._hoveredKey$.subscribe(function(e){n.fire(t.hoveredkeychanged,e)})};t.prototype._deactivate=function(){this._configurationSubscription.unsubscribe();this._emitHoveredKeySubscription.unsubscribe();this._hoveredKeySubscription.unsubscribe();this._nodeSubscription.unsubscribe();this._renderCameraSubscription.unsubscribe()};t.prototype._getDefaultConfiguration=function(){return{distinguishSequence:false,maxWidth:460,minWidth:260}};t.componentName="direction";t.hoveredkeychanged="hoveredkeychanged";return t}(u.Component);r.DirectionComponent=o;u.ComponentService.register(o);r.default=o},{"../../Component":291,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],320:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DirectionDOMCalculator=void 0;var n=e("../../Geo");var i=function(){function e(e,t){this._spatial=new n.Spatial;this._minThresholdWidth=320;this._maxThresholdWidth=1480;this._minThresholdHeight=240;this._maxThresholdHeight=820;this._configure(e);this._resize(t);this._reset()}Object.defineProperty(e.prototype,"minWidth",{get:function(){return this._minWidth},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"containerWidth",{get:function(){return this._containerWidth},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"containerWidthCss",{get:function(){return this._containerWidthCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"containerMarginCss",{get:function(){return this._containerMarginCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"containerLeftCss",{get:function(){return this._containerLeftCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"containerHeight",{get:function(){return this._containerHeight},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"containerHeightCss",{get:function(){return this._containerHeightCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"containerBottomCss",{get:function(){return this._containerBottomCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"stepCircleSize",{get:function(){return this._stepCircleSize},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"stepCircleSizeCss",{get:function(){return this._stepCircleSizeCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"stepCircleMarginCss",{get:function(){return this._stepCircleMarginCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"turnCircleSize",{get:function(){return this._turnCircleSize},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"turnCircleSizeCss",{get:function(){return this._turnCircleSizeCss},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"outerRadius",{get:function(){return this._outerRadius},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"innerRadius",{get:function(){return this._innerRadius},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"shadowOffset",{get:function(){return this._shadowOffset},enumerable:false,configurable:true});e.prototype.configure=function(e){this._configure(e);this._reset()};e.prototype.resize=function(e){this._resize(e);this._reset()};e.prototype.angleToCoordinates=function(e){return[Math.cos(e),Math.sin(e)]};e.prototype.relativeAngleToCoordiantes=function(e,t){var r=this._spatial.wrapAngle(e-t);return this.angleToCoordinates(r)};e.prototype._configure=function(e){this._minWidth=e.minWidth;this._maxWidth=this._getMaxWidth(e.minWidth,e.maxWidth)};e.prototype._resize=function(e){this._elementWidth=e.width;this._elementHeight=e.height};e.prototype._reset=function(){this._containerWidth=this._getContainerWidth(this._elementWidth,this._elementHeight);this._containerHeight=this._getContainerHeight(this.containerWidth);this._stepCircleSize=this._getStepCircleDiameter(this._containerHeight);this._turnCircleSize=this._getTurnCircleDiameter(this.containerHeight);this._outerRadius=this._getOuterRadius(this._containerHeight);this._innerRadius=this._getInnerRadius(this._containerHeight);this._shadowOffset=3;this._containerWidthCss=this._numberToCssPixels(this._containerWidth);this._containerMarginCss=this._numberToCssPixels(-.5*this._containerWidth);this._containerLeftCss=this._numberToCssPixels(Math.floor(.5*this._elementWidth));this._containerHeightCss=this._numberToCssPixels(this._containerHeight);this._containerBottomCss=this._numberToCssPixels(Math.floor(-.08*this._containerHeight));this._stepCircleSizeCss=this._numberToCssPixels(this._stepCircleSize);this._stepCircleMarginCss=this._numberToCssPixels(-.5*this._stepCircleSize);this._turnCircleSizeCss=this._numberToCssPixels(this._turnCircleSize)};e.prototype._getContainerWidth=function(e,t){var r=(e-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth);var n=(t-this._minThresholdHeight)/(this._maxThresholdHeight-this._minThresholdHeight);var i=Math.max(0,Math.min(1,Math.min(r,n)));i=.04*Math.round(25*i);return this._minWidth+i*(this._maxWidth-this._minWidth)};e.prototype._getContainerHeight=function(e){return.77*e};e.prototype._getStepCircleDiameter=function(e){return.34*e};e.prototype._getTurnCircleDiameter=function(e){return.3*e};e.prototype._getOuterRadius=function(e){return.31*e};e.prototype._getInnerRadius=function(e){return.125*e};e.prototype._numberToCssPixels=function(e){return e+"px"};e.prototype._getMaxWidth=function(e,t){return e>t?e:t};return e}();r.DirectionDOMCalculator=i;r.default=i},{"../../Geo":294}],321:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DirectionDOMRenderer=void 0;var x=e("virtual-dom");var n=e("../../Component");var f=e("../../Edge");var c=e("../../Error");var i=e("../../Geo");var o=function(){function e(e,t){this._isEdge=false;this._spatial=new i.Spatial;this._calculator=new n.DirectionDOMCalculator(e,t);this._node=null;this._rotation={phi:0,theta:0};this._epsilon=.5*Math.PI/180;this._highlightKey=null;this._distinguishSequence=false;this._needsRender=false;this._stepEdges=[];this._turnEdges=[];this._panoEdges=[];this._sequenceEdgeKeys=[];this._stepDirections=[f.EdgeDirection.StepForward,f.EdgeDirection.StepBackward,f.EdgeDirection.StepLeft,f.EdgeDirection.StepRight];this._turnDirections=[f.EdgeDirection.TurnLeft,f.EdgeDirection.TurnRight,f.EdgeDirection.TurnU];this._turnNames={};this._turnNames[f.EdgeDirection.TurnLeft]="TurnLeft";this._turnNames[f.EdgeDirection.TurnRight]="TurnRight";this._turnNames[f.EdgeDirection.TurnU]="TurnAround";var r=!!document.documentMode;this._isEdge=!r&&!!window.StyleMedia}Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:false,configurable:true});e.prototype.render=function(e){this._needsRender=false;var t=this._rotation;var r=[];var n=[];if(this._node.pano){r=r.concat(this._createPanoArrows(e,t))}else{r=r.concat(this._createPerspectiveToPanoArrows(e,t));r=r.concat(this._createStepArrows(e,t));n=n.concat(this._createTurnArrows(e))}return this._getContainer(r,n,t)};e.prototype.setEdges=function(e,t){this._setEdges(e,t);this._setNeedsRender()};e.prototype.setNode=function(e){this._node=e;this._clearEdges();this._setNeedsRender()};e.prototype.setRenderCamera=function(e){var t=e.rotation;if(Math.abs(t.phi-this._rotation.phi)<this._epsilon){return}this._rotation=t;this._setNeedsRender()};e.prototype.setConfiguration=function(e){var t=false;if(this._highlightKey!==e.highlightKey||this._distinguishSequence!==e.distinguishSequence){this._highlightKey=e.highlightKey;this._distinguishSequence=e.distinguishSequence;t=true}if(this._calculator.minWidth!==e.minWidth||this._calculator.maxWidth!==e.maxWidth){this._calculator.configure(e);t=true}if(t){this._setNeedsRender()}};e.prototype.resize=function(e){this._calculator.resize(e);this._setNeedsRender()};e.prototype._setNeedsRender=function(){if(this._node!=null){this._needsRender=true}};e.prototype._clearEdges=function(){this._stepEdges=[];this._turnEdges=[];this._panoEdges=[];this._sequenceEdgeKeys=[]};e.prototype._setEdges=function(e,t){this._stepEdges=[];this._turnEdges=[];this._panoEdges=[];this._sequenceEdgeKeys=[];for(var r=0,n=e.edges;r<n.length;r++){var i=n[r];var o=i.data.direction;if(this._stepDirections.indexOf(o)>-1){this._stepEdges.push(i);continue}if(this._turnDirections.indexOf(o)>-1){this._turnEdges.push(i);continue}if(i.data.direction===f.EdgeDirection.Pano){this._panoEdges.push(i)}}if(this._distinguishSequence&&t!=null){var a=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);for(var s=0,u=a;s<u.length;s++){var i=u[s];var c=i.to;for(var l=0,h=t.keys;l<h.length;l++){var p=h[l];if(p===c){this._sequenceEdgeKeys.push(c);break}}}}};e.prototype._createPanoArrows=function(e,t){var r=[];for(var n=0,i=this._panoEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByKey(e,o.to,o.data.worldMotionAzimuth,t,this._calculator.outerRadius,"DirectionsArrowPano"))}for(var a=0,s=this._stepEdges;a<s.length;a++){var u=s[a];r.push(this._createPanoToPerspectiveArrow(e,u.to,u.data.worldMotionAzimuth,t,u.data.direction))}return r};e.prototype._createPanoToPerspectiveArrow=function(e,t,r,n,i){var o=Math.PI/8;var a=n.phi;switch(i){case f.EdgeDirection.StepBackward:a=n.phi-Math.PI;break;case f.EdgeDirection.StepLeft:a=n.phi+Math.PI/2;break;case f.EdgeDirection.StepRight:a=n.phi-Math.PI/2;break;default:break}if(Math.abs(this._spatial.wrapAngle(r-a))<o){return this._createVNodeByKey(e,t,r,n,this._calculator.outerRadius,"DirectionsArrowStep")}return this._createVNodeDisabled(t,r,n)};e.prototype._createPerspectiveToPanoArrows=function(e,t){var r=[];for(var n=0,i=this._panoEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByKey(e,o.to,o.data.worldMotionAzimuth,t,this._calculator.innerRadius,"DirectionsArrowPano",true))}return r};e.prototype._createStepArrows=function(e,t){var r=[];for(var n=0,i=this._stepEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByDirection(e,o.to,o.data.worldMotionAzimuth,t,o.data.direction))}return r};e.prototype._createTurnArrows=function(e){var t=[];for(var r=0,n=this._turnEdges;r<n.length;r++){var i=n[r];var o=i.data.direction;var a=this._turnNames[o];t.push(this._createVNodeByTurn(e,i.to,a,o))}return t};e.prototype._createVNodeByKey=function(t,r,e,n,i,o,a){var s=function(e){t.moveToKey$(r).subscribe(undefined,function(e){if(!(e instanceof c.AbortMapillaryError)){console.error(e)}})};return this._createVNode(r,e,n,i,o,"DirectionsCircle",s,a)};e.prototype._createVNodeByDirection=function(t,e,r,n,i){var o=function(e){t.moveDir$(i).subscribe(undefined,function(e){if(!(e instanceof c.AbortMapillaryError)){console.error(e)}})};return this._createVNode(e,r,n,this._calculator.outerRadius,"DirectionsArrowStep","DirectionsCircle",o)};e.prototype._createVNodeByTurn=function(t,e,r,n){var i=function(e){t.moveDir$(n).subscribe(undefined,function(e){if(!(e instanceof c.AbortMapillaryError)){console.error(e)}})};var o={height:this._calculator.turnCircleSizeCss,transform:"rotate(0)",width:this._calculator.turnCircleSizeCss};switch(n){case f.EdgeDirection.TurnLeft:o.left="5px";o.top="5px";break;case f.EdgeDirection.TurnRight:o.right="5px";o.top="5px";break;case f.EdgeDirection.TurnU:o.left="5px";o.bottom="5px";break;default:break}var a={attributes:{"data-key":e},onclick:i,style:o};var s="TurnCircle";if(this._sequenceEdgeKeys.indexOf(e)>-1){s+="Sequence"}if(this._highlightKey===e){s+="Highlight"}var u=x.h("div."+r,{},[]);return x.h("div."+s,a,[u])};e.prototype._createVNodeDisabled=function(e,t,r){return this._createVNode(e,t,r,this._calculator.outerRadius,"DirectionsArrowDisabled","DirectionsCircleDisabled")};e.prototype._createVNode=function(e,t,r,n,i,o,a,s){var u=this._calculator.angleToCoordinates(t-r.phi);var c=Math.round(-n*u[1]+.5*this._calculator.containerWidth);var l=Math.round(-n*u[0]+.5*this._calculator.containerHeight);var h=this._calculator.relativeAngleToCoordiantes(t,r.phi);var p=this._calculator.shadowOffset;var f=-p*h[1];var d=p*h[0];var v="drop-shadow("+f+"px "+d+"px 1px rgba(0,0,0,0.8))";var m={style:{"-webkit-filter":v,filter:v}};var g=x.h("div."+i,m,[]);var _=-this._spatial.radToDeg(t-r.phi);var y=s?"translate("+c+"px, "+l+"px) rotate("+_+"deg) translateZ(-0.01px)":"translate("+c+"px, "+l+"px) rotate("+_+"deg)";var b={attributes:{"data-key":e},onclick:a,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:y,width:this._calculator.stepCircleSizeCss}};if(this._sequenceEdgeKeys.indexOf(e)>-1){o+="Sequence"}if(this._highlightKey===e){o+="Highlight"}return x.h("div."+o,b,[g])};e.prototype._getContainer=function(e,t,r){var n=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)";var i={oncontextmenu:function(e){e.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:n,width:this._calculator.containerWidthCss}};return x.h("div.DirectionsPerspective",i,t.concat(e))};return e}();r.DirectionDOMRenderer=o;r.default=o},{"../../Component":291,"../../Edge":292,"../../Error":293,"../../Geo":294,"virtual-dom":247}],322:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ImagePlaneComponent=void 0;var m=e("rxjs");var g=e("rxjs/operators");var o=e("../../Component");var s=e("../../Viewer");var u=e("../../Render");var c=e("../../Tiles");var l=e("../../Utils");var _=e("../../geo/ViewportCoords");var y=e("../../geo/Spatial");var i=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t,r)||this;n._imageTileLoader=new c.ImageTileLoader(l.Urls.tileScheme,l.Urls.tileDomain,l.Urls.origin);n._roiCalculator=new c.RegionOfInterestCalculator;n._rendererOperation$=new m.Subject;n._rendererCreator$=new m.Subject;n._rendererDisposer$=new m.Subject;n._renderer$=n._rendererOperation$.pipe(g.scan(function(e,t){return t(e)},null),g.filter(function(e){return e!=null}),g.distinctUntilChanged(undefined,function(e){return e.frameId}));n._rendererCreator$.pipe(g.map(function(){return function(e){if(e!=null){throw new Error("Multiple image plane states can not be created at the same time")}return new o.ImagePlaneGLRenderer}})).subscribe(n._rendererOperation$);n._rendererDisposer$.pipe(g.map(function(){return function(e){e.dispose();return null}})).subscribe(n._rendererOperation$);return n}e.prototype._activate=function(){var v=this;this._rendererSubscription=this._renderer$.pipe(g.map(function(e){var t={name:v._name,render:{frameId:e.frameId,needsRender:e.needsRender,render:e.render.bind(e),stage:u.GLRenderStage.Background}};e.clearNeedsRender();return t})).subscribe(this._container.glRenderer.render$);this._rendererCreator$.next(null);this._stateSubscription=this._navigator.stateService.currentState$.pipe(g.map(function(t){return function(e){e.updateFrame(t);return e}})).subscribe(this._rendererOperation$);var t=this._navigator.stateService.currentState$.pipe(g.distinctUntilChanged(undefined,function(e){return e.state.currentNode.key}),g.withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$),g.map(function(e){var t=e[0],r=e[1],n=e[2];var i=t.state;var o=Math.max(n.width,n.height);var a=i.currentNode;var s=i.currentTransform;var u=o>2048?2048:o>1024?1024:512;return new c.TextureProvider(a.key,s.basicWidth,s.basicHeight,u,a.image,v._imageTileLoader,new c.ImageTileStore,r)}),g.publishReplay(1),g.refCount());this._textureProviderSubscription=t.subscribe(function(){});this._setTextureProviderSubscription=t.pipe(g.map(function(t){return function(e){e.setTextureProvider(t.key,t);return e}})).subscribe(this._rendererOperation$);this._setTileSizeSubscription=this._container.renderService.size$.pipe(g.switchMap(function(e){return m.combineLatest(t,m.of(e)).pipe(g.first())})).subscribe(function(e){var t=e[0],r=e[1];var n=Math.max(r.width,r.height);var i=n>2048?2048:n>1024?1024:512;t.setTileSize(i)});this._abortTextureProviderSubscription=t.pipe(g.pairwise()).subscribe(function(e){var t=e[0];t.abort()});var e=m.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.pipe(g.debounceTime(250))).pipe(g.map(function(e){var t=e[0],r=e[1];return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf(),r.height.valueOf(),r.width.valueOf()]}),g.pairwise(),g.skipWhile(function(e){return e[1][2]-e[0][2]<0||e[1][2]===0}),g.map(function(e){var t=e[0][0].equals(e[1][0]);var r=e[0][1].equals(e[1][1]);var n=e[0][2]===e[1][2];var i=e[0][3]===e[1][3];var o=e[0][4]===e[1][4];return t&&r&&n&&i&&o}),g.distinctUntilChanged(),g.filter(function(e){return e}),g.switchMap(function(e){return v._container.renderService.renderCameraFrame$.pipe(g.first())}),g.withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$));this._setRegionOfInterestSubscription=t.pipe(g.switchMap(function(o){return e.pipe(g.map(function(e){var t=e[0],r=e[1],n=e[2];var i=(new _.default).viewportToBasic(0,0,n,t.perspective);if(i[0]<0||i[1]<0||i[0]>1||i[1]>1){return undefined}return[v._roiCalculator.computeRegionOfInterest(t,r,n),o]}),g.filter(function(e){return!!e}))}),g.filter(function(e){return!e[1].disposed})).subscribe(function(e){var t=e[0];var r=e[1];r.setRegionOfInterest(t)});var n=t.pipe(g.switchMap(function(e){return e.hasTexture$}),g.startWith(false),g.publishReplay(1),g.refCount());this._hasTextureSubscription=n.subscribe(function(){});var r=this._navigator.stateService.currentState$.pipe(g.filter(function(e){return e.state.nodesAhead===0}),g.map(function(e){return e.state.currentNode}),g.distinctUntilChanged(undefined,function(e){return e.key}),g.debounceTime(1e3),g.withLatestFrom(n),g.filter(function(e){return!e[1]}),g.map(function(e){return e[0]}),g.filter(function(e){return e.pano?l.Settings.maxImageSize>l.Settings.basePanoramaSize:l.Settings.maxImageSize>l.Settings.baseImageSize}),g.switchMap(function(r){var e=r.pano?l.Settings.basePanoramaSize:l.Settings.baseImageSize;if(Math.max(r.image.width,r.image.height)>e){return m.empty()}var t=r.cacheImage$(l.Settings.maxImageSize).pipe(g.map(function(e){return[e.image,e]}));return t.pipe(g.takeUntil(n.pipe(g.filter(function(e){return e}))),g.catchError(function(e,t){console.error("Failed to fetch high res image ("+r.key+")",e);return m.empty()}))})).pipe(g.publish(),g.refCount());this._updateBackgroundSubscription=r.pipe(g.withLatestFrom(t)).subscribe(function(e){if(e[0][1].key!==e[1].key||e[1].disposed){return}e[1].updateBackground(e[0][0])});this._updateTextureImageSubscription=r.pipe(g.map(function(t){return function(e){e.updateTextureImage(t[0],t[1]);return e}})).subscribe(this._rendererOperation$);this._clearPeripheryPlaneSubscription=this._navigator.panService.panNodes$.pipe(g.filter(function(e){return e.length===0}),g.map(function(){return function(e){e.clearPeripheryPlanes();return e}})).subscribe(this._rendererOperation$);var i=this._navigator.panService.panNodes$.pipe(g.switchMap(function(e){return m.from(e).pipe(g.mergeMap(function(e){var t=e[0],r=e[1];return m.combineLatest(v._navigator.graphService.cacheNode$(t.key).pipe(g.catchError(function(e){console.error("Failed to cache periphery node ("+t.key+")",e);return m.empty()})),m.of(r))}))}),g.share());this._addPeripheryPlaneSubscription=i.pipe(g.map(function(e){var t=e[0],r=e[1];return function(e){e.addPeripheryPlane(t,r);return e}})).subscribe(this._rendererOperation$);this._updatePeripheryPlaneTextureSubscription=i.pipe(g.mergeMap(function(e){var t=e[0];return s.ImageSize.Size2048>Math.max(t.image.width,t.image.height)?t.cacheImage$(s.ImageSize.Size2048).pipe(g.catchError(function(){return m.empty()})):m.empty()}),g.map(function(t){return function(e){e.updateTextureImage(t.image,t);return e}})).subscribe(this._rendererOperation$);var o=this._navigator.stateService.currentState$.pipe(g.map(function(e){return e.state.alpha<1}),g.distinctUntilChanged());var a=m.combineLatest(this._container.mouseService.active$,this._container.touchService.active$,this._navigator.stateService.inMotion$,o).pipe(g.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return!(t||r||n||i)}),g.filter(function(e){return e}));this._moveToPeripheryNodeSubscription=this._navigator.panService.panNodes$.pipe(g.switchMap(function(i){return a.pipe(g.withLatestFrom(v._container.renderService.renderCamera$,v._navigator.stateService.currentNode$,v._navigator.stateService.currentTransform$),g.mergeMap(function(e){var t=e[1],r=e[2],n=e[3];return m.of([t,r,n,i])}))}),g.switchMap(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];var o=t.camera.lookat.clone().sub(t.camera.position);var a=(new y.default).viewingDirection(r.rotation);var s=a.angleTo(o);var u=[s,undefined];var c=(new _.default).viewportToBasic(0,0,n,t.perspective);if(c[0]>=0&&c[0]<=1&&c[1]>=0&&c[1]<=1){u[0]=Number.NEGATIVE_INFINITY}for(var l=0,h=i;l<h.length;l++){var p=h[l][0];var f=(new y.default).viewingDirection(p.rotation);var d=f.angleTo(o);if(d<u[0]){u[0]=d;u[1]=p.key}}if(!u[1]){return m.empty()}return v._navigator.moveToKey$(u[1]).pipe(g.catchError(function(){return m.empty()}))})).subscribe()};e.prototype._deactivate=function(){this._rendererDisposer$.next(null);this._abortTextureProviderSubscription.unsubscribe();this._hasTextureSubscription.unsubscribe();this._rendererSubscription.unsubscribe();this._setRegionOfInterestSubscription.unsubscribe();this._setTextureProviderSubscription.unsubscribe();this._setTileSizeSubscription.unsubscribe();this._stateSubscription.unsubscribe();this._textureProviderSubscription.unsubscribe();this._updateBackgroundSubscription.unsubscribe();this._updateTextureImageSubscription.unsubscribe();this._clearPeripheryPlaneSubscription.unsubscribe();this._addPeripheryPlaneSubscription.unsubscribe();this._updatePeripheryPlaneTextureSubscription.unsubscribe();this._moveToPeripheryNodeSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{}};e.componentName="imagePlane";return e}(o.Component);r.ImagePlaneComponent=i;o.ComponentService.register(i);r.default=i},{"../../Component":291,"../../Render":297,"../../Tiles":300,"../../Utils":301,"../../Viewer":302,"../../geo/Spatial":419,"../../geo/ViewportCoords":421,rxjs:43,"rxjs/operators":241}],323:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ImagePlaneGLRenderer=void 0;var n=e("../../Component");var i=function(){function e(){this._factory=new n.MeshFactory;this._scene=new n.MeshScene;this._alpha=0;this._alphaOld=0;this._fadeOutSpeed=.05;this._currentKey=null;this._previousKey=null;this._providerDisposers={};this._frameId=0;this._needsRender=false}Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:false,configurable:true});e.prototype.indicateNeedsRender=function(){this._needsRender=true};e.prototype.addPeripheryPlane=function(e,t){var r=this._factory.createMesh(e,t);var n={};n[e.key]=r;this._scene.addPeripheryPlanes(n);this._needsRender=true};e.prototype.clearPeripheryPlanes=function(){this._scene.setPeripheryPlanes({});this._needsRender=true};e.prototype.updateFrame=function(e){this._updateFrameId(e.id);this._needsRender=this._updateAlpha(e.state.alpha)||this._needsRender;this._needsRender=this._updateAlphaOld(e.state.alpha)||this._needsRender;this._needsRender=this._updateImagePlanes(e.state)||this._needsRender};e.prototype.setTextureProvider=function(e,t){var r=this;if(e!==this._currentKey){return}var n=t.textureCreated$.subscribe(function(e){r._updateTexture(e)});var i=t.textureUpdated$.subscribe(function(e){r._needsRender=true});var o=function(){n.unsubscribe();i.unsubscribe();t.dispose()};if(e in this._providerDisposers){var a=this._providerDisposers[e];a();delete this._providerDisposers[e]}this._providerDisposers[e]=o};e.prototype.updateTextureImage=function(e,t){this._needsRender=true;var r=this._extend({},this._scene.planes,this._scene.planesOld,this._scene.planesPeriphery);for(var n in r){if(!r.hasOwnProperty(n)){continue}if(n!==t.key){continue}var i=r[n];var o=i.material;var a=o.uniforms.projectorTex.value;a.image=e;a.needsUpdate=true}};e.prototype.render=function(e,t){var r=this._scene.planes;var n=this._scene.planesOld;var i=this._scene.planesPeriphery;var o=Object.keys(n).length?1:this._alpha;var a=Object.keys(n).length?1:Math.floor(this._alpha);for(var s in r){if(!r.hasOwnProperty(s)){continue}var u=r[s];u.material.uniforms.opacity.value=o}for(var s in n){if(!n.hasOwnProperty(s)){continue}var u=n[s];u.material.uniforms.opacity.value=this._alphaOld}for(var s in i){if(!i.hasOwnProperty(s)){continue}var u=i[s];u.material.uniforms.opacity.value=a}t.render(this._scene.scenePeriphery,e);t.render(this._scene.scene,e);t.render(this._scene.sceneOld,e);for(var s in r){if(!r.hasOwnProperty(s)){continue}var u=r[s];u.material.uniforms.opacity.value=this._alpha}t.render(this._scene.scene,e)};e.prototype.clearNeedsRender=function(){this._needsRender=false};e.prototype.dispose=function(){this._scene.clear()};e.prototype._updateFrameId=function(e){this._frameId=e};e.prototype._updateAlpha=function(e){if(e===this._alpha){return false}this._alpha=e;return true};e.prototype._updateAlphaOld=function(e){if(e<1||this._alphaOld===0){return false}this._alphaOld=Math.max(0,this._alphaOld-this._fadeOutSpeed);return true};e.prototype._updateImagePlanes=function(e){if(e.currentNode==null||e.currentNode.key===this._currentKey){return false}var t=e.previousNode!=null?e.previousNode.key:null;var r=e.currentNode.key;if(this._previousKey!==t&&this._previousKey!==r&&this._previousKey in this._providerDisposers){var n=this._providerDisposers[this._previousKey];n();delete this._providerDisposers[this._previousKey]}if(t!=null){if(t!==this._currentKey&&t!==this._previousKey){var i=this._factory.createMesh(e.previousNode,e.previousTransform);var o={};o[t]=i;this._scene.updateImagePlanes(o)}this._previousKey=t}this._currentKey=r;var a=this._factory.createMesh(e.currentNode,e.currentTransform);var s={};s[r]=a;this._scene.updateImagePlanes(s);this._alphaOld=1;return true};e.prototype._updateTexture=function(e){this._needsRender=true;var t=this._scene.planes;for(var r in t){if(!t.hasOwnProperty(r)){continue}var n=t[r];var i=n.material;var o=i.uniforms.projectorTex.value;i.uniforms.projectorTex.value=null;o.dispose();i.uniforms.projectorTex.value=e}};e.prototype._extend=function(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}for(var n=0,i=t;n<i.length;n++){var o=i[n];for(var a in o){if(!o.hasOwnProperty(a)){continue}e[a]=o[a]}}return e};return e}();r.ImagePlaneGLRenderer=i;r.default=i},{"../../Component":291}],324:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],325:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.CoverState=void 0;var n;(function(e){e[e["Hidden"]=0]="Hidden";e[e["Loading"]=1]="Loading";e[e["Visible"]=2]="Visible"})(n=r.CoverState||(r.CoverState={}))},{}],326:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SliderMode=void 0;var n;(function(e){e[e["Motion"]=0]="Motion";e[e["Stationary"]=1]="Stationary"})(n=r.SliderMode||(r.SliderMode={}))},{}],327:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))n(t,e,r)};Object.defineProperty(r,"__esModule",{value:true});var o=e("./ICoverConfiguration");Object.defineProperty(r,"CoverState",{enumerable:true,get:function(){return o.CoverState}});var a=e("./ISliderConfiguration");Object.defineProperty(r,"SliderMode",{enumerable:true,get:function(){return a.SliderMode}});i(e("../imageplane/interfaces/interfaces"),r);i(e("../marker/interfaces/interfaces"),r);i(e("../spatialdata/interfaces/interfaces"),r);i(e("../tag/interfaces/interfaces"),r)},{"../imageplane/interfaces/interfaces":324,"../marker/interfaces/interfaces":337,"../spatialdata/interfaces/interfaces":365,"../tag/interfaces/interfaces":390,"./ICoverConfiguration":325,"./ISliderConfiguration":326}],328:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.KeyPlayHandler=void 0;var i=e("rxjs/operators");var o=e("../../Component");var h=e("../../Edge");var a=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._enable=function(){var l=this;this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(i.withLatestFrom(this._navigator.playService.playing$,this._navigator.playService.direction$,this._navigator.playService.speed$,this._navigator.stateService.currentNode$.pipe(i.switchMap(function(e){return e.sequenceEdges$})))).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4];if(t.altKey||t.ctrlKey||t.metaKey){return}switch(t.key){case"D":if(!t.shiftKey){return}var a=r?null:n===h.EdgeDirection.Next?h.EdgeDirection.Prev:n===h.EdgeDirection.Prev?h.EdgeDirection.Next:null;if(a!=null){l._navigator.playService.setDirection(a)}break;case" ":if(t.shiftKey){return}if(r){l._navigator.playService.stop()}else{for(var s=0,u=o.edges;s<u.length;s++){var c=u[s];if(c.data.direction===n){l._navigator.playService.play()}}}break;case"<":l._navigator.playService.setSpeed(i-.05);break;case">":l._navigator.playService.setSpeed(i+.05);break;default:return}t.preventDefault()})};t.prototype._disable=function(){this._keyDownSubscription.unsubscribe()};t.prototype._getConfiguration=function(e){return{keyZoom:e}};return t}(o.HandlerBase);r.KeyPlayHandler=a;r.default=a},{"../../Component":291,"../../Edge":292,"rxjs/operators":241}],329:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.KeySequenceNavigationHandler=void 0;var i=e("rxjs/operators");var o=e("../../Component");var u=e("../../Edge");var c=e("../../Error");var a=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._enable=function(){var s=this;var e=this._navigator.stateService.currentNode$.pipe(i.switchMap(function(e){return e.sequenceEdges$}));this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(i.withLatestFrom(e)).subscribe(function(e){var t=e[0],r=e[1];var n=null;switch(t.keyCode){case 38:n=u.EdgeDirection.Next;break;case 40:n=u.EdgeDirection.Prev;break;default:return}t.preventDefault();if(!t.altKey||t.shiftKey||!r.cached){return}for(var i=0,o=r.edges;i<o.length;i++){var a=o[i];if(a.data.direction===n){s._navigator.moveToKey$(a.to).subscribe(undefined,function(e){if(!(e instanceof c.AbortMapillaryError)){console.error(e)}});return}}})};t.prototype._disable=function(){this._keyDownSubscription.unsubscribe()};t.prototype._getConfiguration=function(e){return{keySequenceNavigation:e}};return t}(o.HandlerBase);r.KeySequenceNavigationHandler=a;r.default=a},{"../../Component":291,"../../Edge":292,"../../Error":293,"rxjs/operators":241}],330:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.KeySpatialNavigationHandler=void 0;var i=e("rxjs/operators");var o=e("../../Component");var _=e("../../Edge");var a=e("../../Error");var s=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._spatial=n;return i}e.prototype._enable=function(){var g=this;var e=this._navigator.stateService.currentNode$.pipe(i.switchMap(function(e){return e.spatialEdges$}));this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(i.withLatestFrom(e,this._navigator.stateService.currentState$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2];var i=n.state.currentNode.pano;var o=null;switch(t.keyCode){case 37:o=t.shiftKey&&!i?_.EdgeDirection.TurnLeft:_.EdgeDirection.StepLeft;break;case 38:o=t.shiftKey&&!i?_.EdgeDirection.Pano:_.EdgeDirection.StepForward;break;case 39:o=t.shiftKey&&!i?_.EdgeDirection.TurnRight:_.EdgeDirection.StepRight;break;case 40:o=t.shiftKey&&!i?_.EdgeDirection.TurnU:_.EdgeDirection.StepBackward;break;default:return}t.preventDefault();if(t.altKey||!r.cached||t.shiftKey&&i){return}if(!i){g._moveDir(o,r)}else{var a={};a[_.EdgeDirection.StepBackward]=Math.PI;a[_.EdgeDirection.StepForward]=0;a[_.EdgeDirection.StepLeft]=Math.PI/2;a[_.EdgeDirection.StepRight]=-Math.PI/2;var s=g._rotationFromCamera(n.state.camera).phi;var u=g._spatial.wrapAngle(s+a[o]);var c=Math.PI/4;var l=r.edges.filter(function(e){return e.data.direction===_.EdgeDirection.Pano||e.data.direction===o});var h=Number.MAX_VALUE;var p=null;for(var f=0,d=l;f<d.length;f++){var v=d[f];var m=Math.abs(g._spatial.wrapAngle(v.data.worldMotionAzimuth-u));if(m<Math.min(h,c)){h=m;p=v.to}}if(p==null){return}g._moveToKey(p)}})};e.prototype._disable=function(){this._keyDownSubscription.unsubscribe()};e.prototype._getConfiguration=function(e){return{keySpatialNavigation:e}};e.prototype._moveDir=function(e,t){for(var r=0,n=t.edges;r<n.length;r++){var i=n[r];if(i.data.direction===e){this._moveToKey(i.to);return}}};e.prototype._moveToKey=function(e){this._navigator.moveToKey$(e).subscribe(undefined,function(e){if(!(e instanceof a.AbortMapillaryError)){console.error(e)}})};e.prototype._rotationFromCamera=function(e){var t=e.lookat.clone().sub(e.position);var r=t.clone().dot(e.up);var n=t.clone().sub(e.up.clone().multiplyScalar(r));var i=Math.atan2(n.y,n.x);var o=Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1]);return{phi:i,theta:o}};return e}(o.HandlerBase);r.KeySpatialNavigationHandler=s;r.default=s},{"../../Component":291,"../../Edge":292,"../../Error":293,"rxjs/operators":241}],331:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.KeyZoomHandler=void 0;var i=e("rxjs/operators");var o=e("../../Component");var a=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._viewportCoords=n;return i}e.prototype._enable=function(){var s=this;this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(i.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2];if(t.altKey||t.shiftKey||t.ctrlKey||t.metaKey){return}var i=0;switch(t.key){case"+":i=1;break;case"-":i=-1;break;default:return}t.preventDefault();var o=s._viewportCoords.unprojectFromViewport(0,0,r.perspective);var a=n.projectBasic(o.toArray());s._navigator.stateService.zoomIn(i,a)})};e.prototype._disable=function(){this._keyDownSubscription.unsubscribe()};e.prototype._getConfiguration=function(e){return{keyZoom:e}};return e}(o.HandlerBase);r.KeyZoomHandler=a;r.default=a},{"../../Component":291,"rxjs/operators":241}],332:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.KeyboardComponent=void 0;var o=e("../../Component");var a=e("../../Geo");var i=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t,r)||this;n._keyPlayHandler=new o.KeyPlayHandler(n,t,r);n._keySequenceNavigationHandler=new o.KeySequenceNavigationHandler(n,t,r);n._keySpatialNavigationHandler=new o.KeySpatialNavigationHandler(n,t,r,new a.Spatial);n._keyZoomHandler=new o.KeyZoomHandler(n,t,r,new a.ViewportCoords);return n}Object.defineProperty(e.prototype,"keyPlay",{get:function(){return this._keyPlayHandler},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"keySequenceNavigation",{get:function(){return this._keySequenceNavigationHandler},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"keySpatialNavigation",{get:function(){return this._keySpatialNavigationHandler},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"keyZoom",{get:function(){return this._keyZoomHandler},enumerable:false,configurable:true});e.prototype._activate=function(){var t=this;this._configurationSubscription=this._configuration$.subscribe(function(e){if(e.keyPlay){t._keyPlayHandler.enable()}else{t._keyPlayHandler.disable()}if(e.keySequenceNavigation){t._keySequenceNavigationHandler.enable()}else{t._keySequenceNavigationHandler.disable()}if(e.keySpatialNavigation){t._keySpatialNavigationHandler.enable()}else{t._keySpatialNavigationHandler.disable()}if(e.keyZoom){t._keyZoomHandler.enable()}else{t._keyZoomHandler.disable()}})};e.prototype._deactivate=function(){this._configurationSubscription.unsubscribe();this._keyPlayHandler.disable();this._keySequenceNavigationHandler.disable();this._keySpatialNavigationHandler.disable();this._keyZoomHandler.disable()};e.prototype._getDefaultConfiguration=function(){return{keyPlay:true,keySequenceNavigation:true,keySpatialNavigation:true,keyZoom:true}};e.componentName="keyboard";return e}(o.Component);r.KeyboardComponent=i;o.ComponentService.register(i);r.default=i},{"../../Component":291,"../../Geo":294}],333:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./MarkerComponent");Object.defineProperty(r,"MarkerComponent",{enumerable:true,get:function(){return n.MarkerComponent}});var i=e("./marker/SimpleMarker");Object.defineProperty(r,"SimpleMarker",{enumerable:true,get:function(){return i.SimpleMarker}});var o=e("./marker/CircleMarker");Object.defineProperty(r,"CircleMarker",{enumerable:true,get:function(){return o.CircleMarker}})},{"./MarkerComponent":334,"./marker/CircleMarker":338,"./marker/SimpleMarker":340}],334:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.MarkerComponent=void 0;var p=e("rxjs");var f=e("rxjs/operators");var T=e("three");var o=e("when");var a=e("../../Component");var d=e("../../Render");var s=e("../../Graph");var u=e("../../Geo");var i=function(i){n(C,i);function C(e,t,r){var n=i.call(this,e,t,r)||this;n._relativeGroundAltitude=-2;n._geoCoords=new u.GeoCoords;n._graphCalculator=new s.GraphCalculator;n._markerScene=new a.MarkerScene;n._markerSet=new a.MarkerSet;n._viewportCoords=new u.ViewportCoords;return n}C.prototype.add=function(e){this._markerSet.add(e)};C.prototype.get=function(e){return this._markerSet.get(e)};C.prototype.getAll=function(){return this._markerSet.getAll()};C.prototype.getMarkerIdAt=function(n){var i=this;return o.promise(function(t,r){i._container.renderService.renderCamera$.pipe(f.first(),f.map(function(e){var t=i._viewportCoords.canvasToViewport(n[0],n[1],i._container.element);var r=i._markerScene.intersectObjects(t,e.perspective);return r})).subscribe(function(e){t(e)},function(e){r(e)})})};C.prototype.has=function(e){return this._markerSet.has(e)};C.prototype.remove=function(e){this._markerSet.remove(e)};C.prototype.removeAll=function(){this._markerSet.removeAll()};C.prototype._activate=function(){var M=this;var e=this._navigator.stateService.currentState$.pipe(f.map(function(e){return e.state.camera.position.z+M._relativeGroundAltitude}),f.distinctUntilChanged(function(e,t){return Math.abs(e-t)<.01}),f.publishReplay(1),f.refCount());var t=p.combineLatest(e,this._navigator.stateService.reference$).pipe(f.first(),f.map(function(){}),f.publishReplay(1),f.refCount());var r=this._configuration$.pipe(f.map(function(e){return{visibleBBoxSize:Math.max(1,Math.min(200,e.visibleBBoxSize))}}));var n=this._navigator.stateService.currentNode$.pipe(f.map(function(e){return e.latLon}),f.publishReplay(1),f.refCount());var i=p.combineLatest(r,n).pipe(f.map(function(e){var t=e[0],r=e[1];return M._graphCalculator.boundingBoxCorners(r,t.visibleBBoxSize/2)}),f.publishReplay(1),f.refCount());var o=p.combineLatest(p.concat(p.of(this._markerSet),this._markerSet.changed$),i).pipe(f.map(function(e){var t=e[0],r=e[1];return t.search(r)}));this._setChangedSubscription=t.pipe(f.switchMap(function(){return o.pipe(f.withLatestFrom(M._navigator.stateService.reference$,e))})).subscribe(function(e){var t=e[0],r=e[1],n=e[2];var i=M._geoCoords;var o=M._markerScene;var a=o.markers;var s=Object.assign({},a);for(var u=0,c=t;u<c.length;u++){var l=c[u];if(l.id in a){delete s[l.id]}else{var h=i.geodeticToEnu(l.latLon.lat,l.latLon.lon,r.alt+n,r.lat,r.lon,r.alt);o.add(l,h)}}for(var p in s){if(!s.hasOwnProperty(p)){continue}o.remove(p)}});this._markersUpdatedSubscription=t.pipe(f.switchMap(function(){return M._markerSet.updated$.pipe(f.withLatestFrom(i,M._navigator.stateService.reference$,e))})).subscribe(function(e){var t=e[0],r=e[1],n=r[0],i=r[1],o=e[2],a=e[3];var s=M._geoCoords;var u=M._markerScene;for(var c=0,l=t;c<l.length;c++){var h=l[c];var p=u.has(h.id);var f=h.latLon.lat>n.lat&&h.latLon.lat<i.lat&&h.latLon.lon>n.lon&&h.latLon.lon<i.lon;if(f){var d=s.geodeticToEnu(h.latLon.lat,h.latLon.lon,o.alt+a,o.lat,o.lon,o.alt);u.add(h,d)}else if(!f&&p){u.remove(h.id)}}});this._referenceSubscription=this._navigator.stateService.reference$.pipe(f.skip(1),f.withLatestFrom(e)).subscribe(function(e){var t=e[0],r=e[1];var n=M._geoCoords;var i=M._markerScene;for(var o=0,a=i.getAll();o<a.length;o++){var s=a[o];var u=n.geodeticToEnu(s.latLon.lat,s.latLon.lon,t.alt+r,t.lat,t.lon,t.alt);i.update(s.id,u)}});this._adjustHeightSubscription=e.pipe(f.skip(1),f.withLatestFrom(this._navigator.stateService.reference$,n)).subscribe(function(e){var t=e[0],r=e[1],n=e[2];var i=M._geoCoords;var o=M._markerScene;var a=i.geodeticToEnu(n.lat,n.lon,r.alt+t,r.lat,r.lon,r.alt);for(var s=0,u=o.getAll();s<u.length;s++){var c=u[s];var l=i.geodeticToEnu(c.latLon.lat,c.latLon.lon,r.alt+t,r.lat,r.lon,r.alt);var h=l[0]-a[0];var p=l[1]-a[1];var f=Math.sqrt(h*h+p*p);if(f>50){continue}o.lerpAltitude(c.id,t,Math.min(1,Math.max(0,1.2-1.2*f/50)))}});this._renderSubscription=this._navigator.stateService.currentState$.pipe(f.map(function(e){var t=M._markerScene;return{name:M._name,render:{frameId:e.id,needsRender:t.needsRender,render:t.render.bind(t),stage:d.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$);var a=p.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).pipe(f.map(function(e){var t=e[0],r=e[1];var n=M._container.element;var i=M._viewportCoords.canvasPosition(r,n),o=i[0],a=i[1];var s=M._viewportCoords.canvasToViewport(o,a,n);var u=M._markerScene.intersectObjects(s,t.perspective);return u}),f.publishReplay(1),f.refCount());var s=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).pipe(f.map(function(e){return true}));var u=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).pipe(f.map(function(e){return false}));var c=p.merge(s,u).pipe(f.startWith(false));this._dragEventSubscription=p.merge(s.pipe(f.withLatestFrom(a)),p.combineLatest(u,p.of(null))).pipe(f.startWith([false,null]),f.pairwise()).subscribe(function(e){var t=e[0],r=e[1];var n=r[0];var i=n?C.dragstart:C.dragend;var o=n?r[1]:t[1];var a=M._markerScene.get(o);var s={marker:a,target:M,type:i};M.fire(i,s)});var l=p.merge(this._container.mouseService.mouseDown$.pipe(f.map(function(e){return true})),this._container.mouseService.documentMouseUp$.pipe(f.map(function(e){return false}))).pipe(f.startWith(false));this._mouseClaimSubscription=p.combineLatest(this._container.mouseService.active$,a.pipe(f.distinctUntilChanged()),l,c).pipe(f.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return!t&&r!=null&&n||i}),f.distinctUntilChanged()).subscribe(function(e){if(e){M._container.mouseService.claimMouse(M._name,1);M._container.mouseService.claimWheel(M._name,1)}else{M._container.mouseService.unclaimMouse(M._name);M._container.mouseService.unclaimWheel(M._name)}});var h=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).pipe(f.withLatestFrom(a,this._container.renderService.renderCamera$),f.map(function(e){var t=e[0],r=e[1],n=e[2];var i=M._markerScene.get(r);var o=M._container.element;var a=M._viewportCoords.projectToCanvas(i.geometry.position.toArray(),o,n.perspective),s=a[0],u=a[1];var c=M._viewportCoords.canvasPosition(t,o),l=c[0],h=c[1];var p=[l-s,h-u];return[i,p,n]}),f.publishReplay(1),f.refCount());this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).pipe(f.withLatestFrom(h,this._navigator.stateService.reference$,r)).subscribe(function(e){var t=e[0],r=e[1],n=r[0],i=r[1],o=r[2],a=e[2],s=e[3];if(!M._markerScene.has(n.id)){return}var u=M._container.element;var c=M._viewportCoords.canvasPosition(t,u),l=c[0],h=c[1];var p=l-i[0];var f=h-i[1];var d=M._viewportCoords.canvasToViewport(p,f,u),v=d[0],m=d[1];var g=new T.Vector3(v,m,1).unproject(o.perspective).sub(o.perspective.position).normalize();var _=Math.min(M._relativeGroundAltitude/g.z,s.visibleBBoxSize/2-.1);if(_<0){return}var y=g.clone().multiplyScalar(_).add(o.perspective.position);y.z=o.perspective.position.z+M._relativeGroundAltitude;var b=M._geoCoords.enuToGeodetic(y.x,y.y,y.z,a.lat,a.lon,a.alt),x=b[0],w=b[1];M._markerScene.update(n.id,y.toArray(),{lat:x,lon:w});M._markerSet.update(n);var S={marker:n,target:M,type:C.changed};M.fire(C.changed,S)})};C.prototype._deactivate=function(){this._adjustHeightSubscription.unsubscribe();this._dragEventSubscription.unsubscribe();this._markersUpdatedSubscription.unsubscribe();this._mouseClaimSubscription.unsubscribe();this._referenceSubscription.unsubscribe();this._renderSubscription.unsubscribe();this._setChangedSubscription.unsubscribe();this._updateMarkerSubscription.unsubscribe();this._markerScene.clear()};C.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}};C.componentName="marker";C.changed="changed";C.dragstart="dragstart";C.dragend="dragend";return C}(a.Component);r.MarkerComponent=i;a.ComponentService.register(i);r.default=i},{"../../Component":291,"../../Geo":294,"../../Graph":295,"../../Render":297,rxjs:43,"rxjs/operators":241,three:242,when:288}],335:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MarkerScene=void 0;var u=e("three");var n=function(){function e(e,t){this._needsRender=false;this._interactiveObjects=[];this._markers={};this._objectMarkers={};this._raycaster=!!t?t:new u.Raycaster;this._scene=!!e?e:new u.Scene}Object.defineProperty(e.prototype,"markers",{get:function(){return this._markers},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:false,configurable:true});e.prototype.add=function(e,t){if(e.id in this._markers){this._dispose(e.id)}e.createGeometry(t);this._scene.add(e.geometry);this._markers[e.id]=e;for(var r=0,n=e.getInteractiveObjects();r<n.length;r++){var i=n[r];this._interactiveObjects.push(i);this._objectMarkers[i.uuid]=e.id}this._needsRender=true};e.prototype.clear=function(){for(var e in this._markers){if(!this._markers.hasOwnProperty){continue}this._dispose(e)}this._needsRender=true};e.prototype.get=function(e){return this._markers[e]};e.prototype.getAll=function(){var t=this;return Object.keys(this._markers).map(function(e){return t._markers[e]})};e.prototype.has=function(e){return e in this._markers};e.prototype.intersectObjects=function(e,t){var r=e[0],n=e[1];this._raycaster.setFromCamera(new u.Vector2(r,n),t);var i=this._raycaster.intersectObjects(this._interactiveObjects);for(var o=0,a=i;o<a.length;o++){var s=a[o];if(s.object.uuid in this._objectMarkers){return this._objectMarkers[s.object.uuid]}}return null};e.prototype.lerpAltitude=function(e,t,r){if(!(e in this._markers)){return}this._markers[e].lerpAltitude(t,r);this._needsRender=true};e.prototype.remove=function(e){if(!(e in this._markers)){return}this._dispose(e);this._needsRender=true};e.prototype.render=function(e,t){t.render(this._scene,e);this._needsRender=false};e.prototype.update=function(e,t,r){if(!(e in this._markers)){return}var n=this._markers[e];n.updatePosition(t,r);this._needsRender=true};e.prototype._dispose=function(e){var t=this._markers[e];this._scene.remove(t.geometry);for(var r=0,n=t.getInteractiveObjects();r<n.length;r++){var i=n[r];var o=this._interactiveObjects.indexOf(i);if(o!==-1){this._interactiveObjects.splice(o,1)}else{console.warn("Object does not exist ("+i.id+") for "+e)}delete this._objectMarkers[i.uuid]}t.disposeGeometry();delete this._markers[e]};return e}();r.MarkerScene=n;r.default=n},{three:242}],336:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MarkerSet=void 0;var n=e("rxjs");var i=e("../../Geo");var o=function(){function e(){this._hash={};this._index=new i.GeoRBush(16);this._indexChanged$=new n.Subject;this._updated$=new n.Subject}Object.defineProperty(e.prototype,"changed$",{get:function(){return this._indexChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"updated$",{get:function(){return this._updated$},enumerable:false,configurable:true});e.prototype.add=function(e){var t=[];var r=this._hash;var n=this._index;for(var i=0,o=e;i<o.length;i++){var a=o[i];var s=a.id;if(s in r){n.remove(r[s]);t.push(a)}var u={lat:a.latLon.lat,lon:a.latLon.lon,marker:a};r[s]=u;n.insert(u)}if(t.length>0){this._updated$.next(t)}if(e.length>t.length){this._indexChanged$.next(this)}};e.prototype.has=function(e){return e in this._hash};e.prototype.get=function(e){return this.has(e)?this._hash[e].marker:undefined};e.prototype.getAll=function(){return this._index.all().map(function(e){return e.marker})};e.prototype.remove=function(e){var t=this._hash;var r=this._index;var n=false;for(var i=0,o=e;i<o.length;i++){var a=o[i];if(!(a in t)){continue}var s=t[a];r.remove(s);delete t[a];n=true}if(n){this._indexChanged$.next(this)}};e.prototype.removeAll=function(){this._hash={};this._index.clear();this._indexChanged$.next(this)};e.prototype.search=function(e){var t=e[0],r=e[1];return this._index.search({maxX:r.lat,maxY:r.lon,minX:t.lat,minY:t.lon}).map(function(e){return e.marker})};e.prototype.update=function(e){var t=this._hash;var r=this._index;var n=e.id;if(!(n in t)){return}r.remove(t[n]);var i={lat:e.latLon.lat,lon:e.latLon.lon,marker:e};t[n]=i;r.insert(i)};return e}();r.MarkerSet=o;r.default=o},{"../../Geo":294,rxjs:43}],337:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],338:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CircleMarker=void 0;var o=e("three");var i=e("../../../Component");var a=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t)||this;r=!!r?r:{};n._color=r.color!=null?r.color:16777215;n._opacity=r.opacity!=null?r.opacity:.4;n._radius=r.radius!=null?r.radius:1;return n}e.prototype._createGeometry=function(e){var t=new o.Mesh(new o.CircleGeometry(this._radius,16),new o.MeshBasicMaterial({color:this._color,opacity:this._opacity,transparent:true}));t.up.fromArray([0,0,1]);t.renderOrder=-1;var r=new o.Object3D;r.add(t);r.position.fromArray(e);this._geometry=r};e.prototype._disposeGeometry=function(){for(var e=0,t=this._geometry.children;e<t.length;e++){var r=t[e];r.geometry.dispose();r.material.dispose()}};e.prototype._getInteractiveObjects=function(){return[]};return e}(i.Marker);r.CircleMarker=a;r.default=a},{"../../../Component":291,three:242}],339:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Marker=void 0;var n=function(){function e(e,t){this._id=e;this._latLon=t}Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"latLon",{get:function(){return this._latLon},enumerable:false,configurable:true});e.prototype.createGeometry=function(e){if(!!this._geometry){return}this._createGeometry(e);this._geometry.updateMatrixWorld(true)};e.prototype.disposeGeometry=function(){if(!this._geometry){return}this._disposeGeometry();this._geometry=undefined};e.prototype.getInteractiveObjects=function(){if(!this._geometry){return[]}return this._getInteractiveObjects()};e.prototype.lerpAltitude=function(e,t){if(!this._geometry){return}this._geometry.position.z=(1-t)*this._geometry.position.z+t*e};e.prototype.updatePosition=function(e,t){if(!!t){this._latLon.lat=t.lat;this._latLon.lon=t.lon}if(!this._geometry){return}this._geometry.position.fromArray(e);this._geometry.updateMatrixWorld(true)};return e}();r.Marker=n;r.default=n},{}],340:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.SimpleMarker=void 0;var w=e("three");var i=e("../../../Component");var o=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t)||this;r=!!r?r:{};n._ballColor=r.ballColor!=null?r.ballColor:16711680;n._ballOpacity=r.ballOpacity!=null?r.ballOpacity:.8;n._circleToRayAngle=2;n._color=r.color!=null?r.color:16711680;n._interactive=!!r.interactive;n._opacity=r.opacity!=null?r.opacity:.4;n._radius=r.radius!=null?r.radius:1;return n}e.prototype._createGeometry=function(e){var t=this._radius;var r=new w.Mesh(this._markerGeometry(t,8,8),new w.MeshBasicMaterial({color:this._color,opacity:this._opacity,transparent:true}));r.renderOrder=1;var n=new w.Mesh(new w.SphereGeometry(t/2,8,8),new w.MeshBasicMaterial({color:this._ballColor,opacity:this._ballOpacity,transparent:true}));n.position.z=this._markerHeight(t);var i=new w.Object3D;i.add(n);i.add(r);i.position.fromArray(e);this._geometry=i};e.prototype._disposeGeometry=function(){for(var e=0,t=this._geometry.children;e<t.length;e++){var r=t[e];r.geometry.dispose();r.material.dispose()}};e.prototype._getInteractiveObjects=function(){return this._interactive?[this._geometry.children[0]]:[]};e.prototype._markerHeight=function(e){var t=Math.tan(Math.PI-this._circleToRayAngle);return e*Math.sqrt(1+t*t)};e.prototype._markerGeometry=function(e,t,r){var n=new w.Geometry;t=Math.max(3,Math.floor(t)||8);r=Math.max(2,Math.floor(r)||6);var i=this._markerHeight(e);var o=[];for(var a=0;a<=r;++a){var s=[];for(var u=0;u<=t;++u){var c=u/t*Math.PI*2;var l=a/r*Math.PI;var h=void 0;if(l<this._circleToRayAngle){h=e}else{var p=Math.tan(l-this._circleToRayAngle);h=e*Math.sqrt(1+p*p)}var f=new w.Vector3;f.x=h*Math.cos(c)*Math.sin(l);f.y=h*Math.sin(c)*Math.sin(l);f.z=h*Math.cos(l)+i;n.vertices.push(f);s.push(n.vertices.length-1)}o.push(s)}for(var a=0;a<r;++a){for(var u=0;u<t;++u){var d=o[a][u+1];var v=o[a][u];var m=o[a+1][u];var g=o[a+1][u+1];var _=n.vertices[d].clone().normalize();var y=n.vertices[v].clone().normalize();var b=n.vertices[m].clone().normalize();var x=n.vertices[g].clone().normalize();n.faces.push(new w.Face3(d,v,g,[_,y,x]));n.faces.push(new w.Face3(v,m,g,[y.clone(),b,x.clone()]))}}n.computeFaceNormals();n.boundingSphere=new w.Sphere(new w.Vector3,e+i);return n};return e}(i.Marker);r.SimpleMarker=o;r.default=o},{"../../../Component":291,three:242}],341:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.BounceHandler=void 0;var i=e("rxjs");var o=e("rxjs/operators");var S=e("../../Component");var a=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e,t,r)||this;o._spatial=i;o._viewportCoords=n;return o}e.prototype._enable=function(){var w=this;var e=this._navigator.stateService.currentState$.pipe(o.map(function(e){return e.state.alpha<1}),o.distinctUntilChanged());this._bounceSubscription=i.combineLatest(e,this._navigator.stateService.inTranslation$,this._container.mouseService.active$,this._container.touchService.active$).pipe(o.map(function(e){return e[0]||e[1]||e[2]||e[3]}),o.distinctUntilChanged(),o.switchMap(function(e){return e?i.empty():i.combineLatest(w._container.renderService.renderCamera$,w._navigator.stateService.currentTransform$.pipe(o.first()))}),o.withLatestFrom(this._navigator.panService.panNodes$)).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];if(!n.hasValidScale&&r.camera.focal<.1){return}if(r.perspective.aspect===0||r.perspective.aspect===Number.POSITIVE_INFINITY){return}var o=S.ImageBoundary.viewportDistances(n,r.perspective,w._viewportCoords);var a=w._viewportCoords.viewportToBasic(0,0,n,r.perspective);if((a[0]<0||a[0]>1)&&i.length>0){o[0]=o[2]=0}for(var s=0,u=i;s<u.length;s++){var c=u[s],l=c[1];var h=S.ImageBoundary.viewportDistances(l,r.perspective,w._viewportCoords);for(var p=1;p<o.length;p+=2){if(h[p]<o[p]){o[p]=h[p]}}}if(Math.max.apply(Math,o)<.01){return}var f=o[1]-o[3];var d=o[0]-o[2];var v=w._viewportCoords.unprojectFromViewport(0,0,r.perspective).sub(r.perspective.position);var m=w._viewportCoords.unprojectFromViewport(f,0,r.perspective).sub(r.perspective.position);var g=w._viewportCoords.unprojectFromViewport(0,d,r.perspective).sub(r.perspective.position);var _=(f>0?1:-1)*m.angleTo(v);var y=(d>0?1:-1)*g.angleTo(v);var b=Math.PI/60;var x=.1;_=w._spatial.clamp(x*_,-b,b);y=w._spatial.clamp(x*y,-b,b);w._navigator.stateService.rotateUnbounded({phi:_,theta:y})})};e.prototype._disable=function(){this._bounceSubscription.unsubscribe()};e.prototype._getConfiguration=function(){return{}};return e}(S.HandlerBase);r.BounceHandler=a;r.default=a},{"../../Component":291,rxjs:43,"rxjs/operators":241}],342:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.DoubleClickZoomHandler=void 0;var i=e("rxjs");var a=e("rxjs/operators");var o=e("../../Component");var s=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._viewportCoords=n;return i}e.prototype._enable=function(){var h=this;this._zoomSubscription=i.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.pipe(a.map(function(e){var t=e.touches[0];return{clientX:t.clientX,clientY:t.clientY,shiftKey:e.shiftKey}}))).pipe(a.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2];var i=h._container.element;var o=h._viewportCoords.canvasPosition(t,i),a=o[0],s=o[1];var u=h._viewportCoords.unprojectFromCanvas(a,s,i,r.perspective);var c=n.projectBasic(u.toArray());var l=!!t.shiftKey?-1:1;h._navigator.stateService.zoomIn(l,c)})};e.prototype._disable=function(){this._zoomSubscription.unsubscribe()};e.prototype._getConfiguration=function(e){return{doubleClickZoom:e}};return e}(o.HandlerBase);r.DoubleClickZoomHandler=s;r.default=s},{"../../Component":291,rxjs:43,"rxjs/operators":241}],343:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.DragPanHandler=void 0;var s=e("rxjs");var u=e("rxjs/operators");var T=e("../../Component");var i=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e,t,r)||this;o._spatial=i;o._viewportCoords=n;return o}e.prototype._enable=function(){var C=this;var e=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).pipe(u.map(function(){return true}),u.share());var t=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).pipe(u.map(function(){return false}),u.share());this._activeMouseSubscription=s.merge(e,t).subscribe(this._container.mouseService.activate$);var r=s.merge(e,t).pipe(u.switchMap(function(e){return e?C._container.mouseService.documentMouseMove$:s.empty()}));this._preventDefaultSubscription=s.merge(r,this._container.touchService.touchMove$).subscribe(function(e){e.preventDefault()});var n=this._container.touchService.singleTouchDragStart$.pipe(u.map(function(){return true}));var i=this._container.touchService.singleTouchDragEnd$.pipe(u.map(function(){return false}));this._activeTouchSubscription=s.merge(n,i).subscribe(this._container.touchService.activate$);var o=this._navigator.stateService.currentState$.pipe(u.map(function(e){return e.state.currentNode.fullPano||e.state.nodesAhead<1}),u.distinctUntilChanged(),u.switchMap(function(e){if(!e){return s.empty()}var t=T.MouseOperator.filteredPairwiseMouseDrag$(C._component.name,C._container.mouseService);var r=s.merge(C._container.touchService.singleTouchDragStart$,C._container.touchService.singleTouchDrag$,C._container.touchService.singleTouchDragEnd$.pipe(u.map(function(){return null}))).pipe(u.map(function(e){return e!=null&&e.touches.length>0?e.touches[0]:null}),u.pairwise(),u.filter(function(e){return e[0]!=null&&e[1]!=null}));return s.merge(t,r)}),u.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,this._navigator.panService.panNodes$),u.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];var o=t[0];var a=t[1];var s=a.clientX-o.clientX;var u=a.clientY-o.clientY;var c=C._container.element;var l=C._viewportCoords.canvasPosition(a,c),h=l[0],p=l[1];var f=C._viewportCoords.unprojectFromCanvas(h,p,c,r.perspective).sub(r.perspective.position);var d=C._viewportCoords.unprojectFromCanvas(h-s,p,c,r.perspective).sub(r.perspective.position);var v=C._viewportCoords.unprojectFromCanvas(h,p-u,c,r.perspective).sub(r.perspective.position);var m=(s>0?1:-1)*d.angleTo(f);var g=(u>0?-1:1)*v.angleTo(f);var _=T.ImageBoundary.viewportDistances(n,r.perspective,C._viewportCoords);for(var y=0,b=i;y<b.length;y++){var x=b[y],w=x[1];var S=T.ImageBoundary.viewportDistances(w,r.perspective,C._viewportCoords);for(var M=0;M<_.length;M++){if(S[M]<_[M]){_[M]=S[M]}}}if(_[0]>0&&g<0){g/=Math.max(1,200*_[0])}if(_[2]>0&&g>0){g/=Math.max(1,200*_[2])}if(_[1]>0&&m<0){m/=Math.max(1,200*_[1])}if(_[3]>0&&m>0){m/=Math.max(1,200*_[3])}return{phi:m,theta:g}}),u.share());this._rotateWithoutInertiaSubscription=o.subscribe(function(e){C._navigator.stateService.rotateWithoutInertia(e)});this._rotateSubscription=o.pipe(u.scan(function(e,t){C._drainBuffer(e);e.push([Date.now(),t]);return e},[]),u.sample(s.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$),this._container.touchService.singleTouchDragEnd$)),u.map(function(e){var t=C._drainBuffer(e.slice());var r={phi:0,theta:0};for(var n=0,i=t;n<i.length;n++){var o=i[n];r.phi+=o[1].phi;r.theta+=o[1].theta}var a=t.length;if(a>0){r.phi/=a;r.theta/=a}var s=Math.PI/18;r.phi=C._spatial.clamp(r.phi,-s,s);r.theta=C._spatial.clamp(r.theta,-s,s);return r})).subscribe(function(e){C._navigator.stateService.rotate(e)})};e.prototype._disable=function(){this._activeMouseSubscription.unsubscribe();this._activeTouchSubscription.unsubscribe();this._preventDefaultSubscription.unsubscribe();this._rotateSubscription.unsubscribe();this._rotateWithoutInertiaSubscription.unsubscribe();this._activeMouseSubscription=null;this._activeTouchSubscription=null;this._preventDefaultSubscription=null;this._rotateSubscription=null};e.prototype._getConfiguration=function(e){return{dragPan:e}};e.prototype._drainBuffer=function(e){var t=50;var r=Date.now();while(e.length>0&&r-e[0][0]>t){e.shift()}return e};return e}(T.HandlerBase);r.DragPanHandler=i;r.default=i},{"../../Component":291,rxjs:43,"rxjs/operators":241}],344:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.EarthControlHandler=void 0;var d=e("three");var i=e("rxjs");var o=e("rxjs/operators");var s=e("../../Component");var u=e("../../State");var a=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e,t,r)||this;o._spatial=i;o._viewportCoords=n;return o}e.prototype._enable=function(){var h=this;var e=this._navigator.stateService.state$.pipe(o.map(function(e){return e===u.State.Earth}),o.share());this._preventDefaultSubscription=e.pipe(o.switchMap(function(e){return e?h._container.mouseService.mouseWheel$:i.empty()})).subscribe(function(e){e.preventDefault()});this._truckSubscription=e.pipe(o.switchMap(function(e){if(!e){return i.empty()}return s.MouseOperator.filteredPairwiseMouseDrag$(h._component.name,h._container.mouseService).pipe(o.filter(function(e){var t=e[0],r=e[1];return!(t.ctrlKey&&r.ctrlKey)}))}),o.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$),o.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=e[2];var a=[0,0,1];var s=o.unprojectBasic([.5,.5],0);s[2]-=2;var u=h._planeIntersection(n,a,s,i.perspective,h._container.element);var c=h._planeIntersection(r,a,s,i.perspective,h._container.element);if(!u||!c){return null}var l=(new d.Vector3).subVectors(u,c).multiplyScalar(-1).toArray();return l}),o.filter(function(e){return!!e})).subscribe(function(e){h._navigator.stateService.truck(e)});this._orbitSubscription=e.pipe(o.switchMap(function(e){if(!e){return i.empty()}return s.MouseOperator.filteredPairwiseMouseDrag$(h._component.name,h._container.mouseService).pipe(o.filter(function(e){var t=e[0],r=e[1];return t.ctrlKey&&r.ctrlKey}))}),o.map(function(e){var t=e[0],r=e[1];var n=h._eventToViewport(r,h._container.element),i=n[0],o=n[1];var a=h._eventToViewport(t,h._container.element),s=a[0],u=a[1];var c=(s-i)*Math.PI;var l=(o-u)*Math.PI/2;return{phi:c,theta:l}})).subscribe(function(e){h._navigator.stateService.orbit(e)});this._dollySubscription=e.pipe(o.switchMap(function(e){if(!e){return i.empty()}return h._container.mouseService.filteredWheel$(h._component.name,h._container.mouseService.mouseWheel$)}),o.map(function(e){var t=e.deltaY;if(e.deltaMode===1){t=40*t}else if(e.deltaMode===2){t=800*t}var r=h._viewportCoords.containerToCanvas(h._container.element);return-t/r[1]})).subscribe(function(e){h._navigator.stateService.dolly(e)})};e.prototype._disable=function(){this._dollySubscription.unsubscribe();this._orbitSubscription.unsubscribe();this._preventDefaultSubscription.unsubscribe();this._truckSubscription.unsubscribe()};e.prototype._getConfiguration=function(){return{}};e.prototype._eventToViewport=function(e,t){var r=this._viewportCoords.canvasPosition(e,t);return this._viewportCoords.canvasToViewport(r[0],r[1],t)};e.prototype._planeIntersection=function(e,t,r,n,i){var o=this._viewportCoords.canvasPosition(e,i),a=o[0],s=o[1];var u=this._viewportCoords.unprojectFromCanvas(a,s,i,n).sub(n.position).normalize();if(Math.abs(this._spatial.angleToPlane(u.toArray(),t))<Math.PI/90){return null}var c=n.position.clone();var l=(new d.Vector3).fromArray(t);var h=(new d.Vector3).fromArray(r);var p=(new d.Vector3).subVectors(h,c).dot(l)/u.clone().dot(l);var f=(new d.Vector3).addVectors(c,u.multiplyScalar(p));if(this._viewportCoords.worldToCamera(f.toArray(),n)[2]>0){return null}return f};return e}(s.HandlerBase);r.EarthControlHandler=a;r.default=a},{"../../Component":291,"../../State":298,rxjs:43,"rxjs/operators":241,three:242}],345:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],346:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.viewportDistances=void 0;var z=e("../../../src/Geo");function $(e){var t=[];var r=[[0,0],[1,0],[1,1],[0,1]];var n=[[1,0],[0,1],[-1,0],[0,-1]];for(var i=0;i<4;++i){var o=r[i];var a=n[i];for(var s=0;s<e;++s){t.push([o[0]+a[0]*s/e,o[1]+a[1]*s/e])}}return t}function G(e,t){return e>=-1&&e<=1&&t>=-1&&t<=1}function V(e,t){return e>=0&&e<=1&&t>=0&&t<=1}function n(t,r,n){var e=$(100);var i=e.map(function(e){return n.basicToViewportSafe(e[0],e[1],t,r)});var o=[];var a=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}];var s=[false,false,false,false];for(var u=0;u<i.length;u++){var c=i[u];var l=i[(u+1)%i.length];if(c===null){continue}if(l===null){if(G(c[0],c[1])){o.push(c)}continue}var h=c[0],p=c[1];var f=l[0],d=l[1];if(G(h,p)){if(G(f,d)){o.push(c)}else{for(var v=0;v<4;v++){var m={p1:{x:h,y:p},p2:{x:f,y:d}};var g={p1:a[v],p2:a[(v+1)%4]};var _=z.Lines.segmentsIntersect(m,g);if(_){var y=z.Lines.segmentIntersection(m,g);o.push(c,[y.x,y.y]);s[v]=true}}}}}var b=n.viewportToBasic(-1,1,t,r),x=b[0],w=b[1];var S=n.viewportToBasic(1,1,t,r),M=S[0],C=S[1];var T=n.viewportToBasic(1,-1,t,r),E=T[0],O=T[1];var P=n.viewportToBasic(-1,-1,t,r),A=P[0],j=P[1];if(V(x,w)){s[3]=s[0]=true}if(V(M,C)){s[0]=s[1]=true}if(V(E,O)){s[1]=s[2]=true}if(V(A,j)){s[2]=s[3]=true}var R=[-1,-1,1,1];for(var k=0,L=o;k<L.length;k++){var N=L[k];var I=N[0];var D=N[1];if(I>R[1]){R[1]=I}if(I<R[3]){R[3]=I}if(D>R[0]){R[0]=D}if(D<R[2]){R[2]=D}}var B=[1,1,-1,-1];var F=[];for(var v=0;v<4;v++){if(s[v]){F.push(0);continue}F.push(Math.abs(B[v]-R[v]))}return F}r.viewportDistances=n},{"../../../src/Geo":294}],347:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.MouseComponent=void 0;var s=e("../../Component");var u=e("../../Geo");var i=function(a){n(e,a);function e(e,t,r){var n=a.call(this,e,t,r)||this;var i=new u.Spatial;var o=new u.ViewportCoords;n._bounceHandler=new s.BounceHandler(n,t,r,o,i);n._doubleClickZoomHandler=new s.DoubleClickZoomHandler(n,t,r,o);n._dragPanHandler=new s.DragPanHandler(n,t,r,o,i);n._earthControlHandler=new s.EarthControlHandler(n,t,r,o,i);n._scrollZoomHandler=new s.ScrollZoomHandler(n,t,r,o);n._touchZoomHandler=new s.TouchZoomHandler(n,t,r,o);return n}Object.defineProperty(e.prototype,"doubleClickZoom",{get:function(){return this._doubleClickZoomHandler},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"dragPan",{get:function(){return this._dragPanHandler},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"scrollZoom",{get:function(){return this._scrollZoomHandler},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"touchZoom",{get:function(){return this._touchZoomHandler},enumerable:false,configurable:true});e.prototype._activate=function(){var t=this;this._bounceHandler.enable();this._earthControlHandler.enable();this._configurationSubscription=this._configuration$.subscribe(function(e){if(e.doubleClickZoom){t._doubleClickZoomHandler.enable()}else{t._doubleClickZoomHandler.disable()}if(e.dragPan){t._dragPanHandler.enable()}else{t._dragPanHandler.disable()}if(e.scrollZoom){t._scrollZoomHandler.enable()}else{t._scrollZoomHandler.disable()}if(e.touchZoom){t._touchZoomHandler.enable()}else{t._touchZoomHandler.disable()}});this._container.mouseService.claimMouse(this._name,0)};e.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name);this._configurationSubscription.unsubscribe();this._bounceHandler.disable();this._doubleClickZoomHandler.disable();this._dragPanHandler.disable();this._earthControlHandler.disable();this._scrollZoomHandler.disable();this._touchZoomHandler.disable()};e.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:false,dragPan:true,scrollZoom:true,touchZoom:true}};e.componentName="mouse";return e}(s.Component);r.MouseComponent=i;s.ComponentService.register(i);r.default=i},{"../../Component":291,"../../Geo":294}],348:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ScrollZoomHandler=void 0;var i=e("rxjs/operators");var o=e("../../Component");var a=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._viewportCoords=n;return i}e.prototype._enable=function(){var f=this;this._container.mouseService.claimWheel(this._component.name,0);this._preventDefaultSubscription=this._container.mouseService.mouseWheel$.subscribe(function(e){e.preventDefault()});this._zoomSubscription=this._container.mouseService.filteredWheel$(this._component.name,this._container.mouseService.mouseWheel$).pipe(i.withLatestFrom(this._navigator.stateService.currentState$,function(e,t){return[e,t]}),i.filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}),i.map(function(e){return e[0]}),i.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,r){return[e,t,r]})).subscribe(function(e){var t=e[0];var r=e[1];var n=e[2];var i=f._container.element;var o=f._viewportCoords.canvasPosition(t,i),a=o[0],s=o[1];var u=f._viewportCoords.unprojectFromCanvas(a,s,i,r.perspective);var c=n.projectBasic(u.toArray());var l=t.deltaY;if(t.deltaMode===1){l=40*l}else if(t.deltaMode===2){l=800*l}var h=f._viewportCoords.containerToCanvas(i);var p=-3*l/h[1];f._navigator.stateService.zoomIn(p,c)})};e.prototype._disable=function(){this._container.mouseService.unclaimWheel(this._component.name);this._preventDefaultSubscription.unsubscribe();this._zoomSubscription.unsubscribe();this._preventDefaultSubscription=null;this._zoomSubscription=null};e.prototype._getConfiguration=function(e){return{scrollZoom:e}};return e}(o.HandlerBase);r.ScrollZoomHandler=a;r.default=a},{"../../Component":291,"rxjs/operators":241}],349:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.TouchZoomHandler=void 0;var i=e("rxjs");var a=e("rxjs/operators");var o=e("../../Component");var s=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._viewportCoords=n;return i}e.prototype._enable=function(){var d=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(e){e.originalEvent.preventDefault()});var e=this._container.touchService.pinchStart$.pipe(a.map(function(e){return true}));var t=this._container.touchService.pinchEnd$.pipe(a.map(function(e){return false}));this._activeSubscription=i.merge(e,t).subscribe(this._container.touchService.activate$);this._zoomSubscription=this._container.touchService.pinch$.pipe(a.withLatestFrom(this._navigator.stateService.currentState$),a.filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}),a.map(function(e){return e[0]}),a.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2];var i=d._container.element;var o=d._viewportCoords.canvasPosition(t,i),a=o[0],s=o[1];var u=d._viewportCoords.unprojectFromCanvas(a,s,i,r.perspective);var c=n.projectBasic(u.toArray());var l=d._viewportCoords.containerToCanvas(i),h=l[0],p=l[1];var f=3*t.distanceChange/Math.min(h,p);d._navigator.stateService.zoomIn(f,c)})};e.prototype._disable=function(){this._activeSubscription.unsubscribe();this._preventDefaultSubscription.unsubscribe();this._zoomSubscription.unsubscribe();this._preventDefaultSubscription=null;this._zoomSubscription=null};e.prototype._getConfiguration=function(e){return{touchZoom:e}};return e}(o.HandlerBase);r.TouchZoomHandler=s;r.default=s},{"../../Component":291,rxjs:43,"rxjs/operators":241}],350:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./popup/Popup");Object.defineProperty(r,"Popup",{enumerable:true,get:function(){return n.Popup}});var i=e("./PopupComponent");Object.defineProperty(r,"PopupComponent",{enumerable:true,get:function(){return i.PopupComponent}})},{"./PopupComponent":351,"./popup/Popup":352}],351:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.PopupComponent=void 0;var a=e("rxjs");var i=e("rxjs/operators");var o=e("../../Component");var s=e("../../Utils");var u=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._dom=!!n?n:new s.DOM;i._popups=[];i._added$=new a.Subject;i._popups$=new a.Subject;return i}e.prototype.add=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];if(this._popups.indexOf(n)!==-1){continue}this._popups.push(n);if(this._activated){n.setParentContainer(this._popupContainer)}}this._added$.next(e);this._popups$.next(this._popups)};e.prototype.getAll=function(){return this._popups.slice()};e.prototype.remove=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];this._remove(n)}this._popups$.next(this._popups)};e.prototype.removeAll=function(){for(var e=0,t=this._popups.slice();e<t.length;e++){var r=t[e];this._remove(r)}this._popups$.next(this._popups)};e.prototype._activate=function(){var s=this;this._popupContainer=this._dom.createElement("div","mapillary-js-popup-container",this._container.element);for(var e=0,t=this._popups;e<t.length;e++){var r=t[e];r.setParentContainer(this._popupContainer)}this._updateAllSubscription=a.combineLatest(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$).subscribe(function(e){var t=e[0],r=e[1],n=e[2];for(var i=0,o=s._popups;i<o.length;i++){var a=o[i];a.update(t,r,n)}});var n=this._popups$.pipe(i.startWith(this._popups),i.switchMap(function(e){return a.from(e).pipe(i.mergeMap(function(e){return e.changed$}))}),i.map(function(e){return[e]}));this._updateAddedChangedSubscription=a.merge(this._added$,n).pipe(i.withLatestFrom(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];for(var o=0,a=t;o<a.length;o++){var s=a[o];s.update(r,n,i)}})};e.prototype._deactivate=function(){this._updateAllSubscription.unsubscribe();this._updateAddedChangedSubscription.unsubscribe();for(var e=0,t=this._popups;e<t.length;e++){var r=t[e];r.remove()}this._container.element.removeChild(this._popupContainer);delete this._popupContainer};e.prototype._getDefaultConfiguration=function(){return{}};e.prototype._remove=function(e){var t=this._popups.indexOf(e);if(t===-1){return}var r=this._popups.splice(t,1)[0];if(this._activated){r.remove()}};e.componentName="popup";return e}(o.Component);r.PopupComponent=u;o.ComponentService.register(u);r.default=u},{"../../Component":291,"../../Utils":301,rxjs:43,"rxjs/operators":241}],352:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Popup=void 0;var n=e("rxjs");var i=e("../../../Geo");var o=e("../../../Utils");var x=e("../../../Viewer");var a=function(){function e(e,t,r){this._options={};e=!!e?e:{};this._options.capturePointer=e.capturePointer===false?e.capturePointer:true;this._options.clean=e.clean;this._options.float=e.float;this._options.offset=e.offset;this._options.opacity=e.opacity;this._options.position=e.position;this._dom=!!r?r:new o.DOM;this._viewportCoords=!!t?t:new i.ViewportCoords;this._notifyChanged$=new n.Subject}Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:false,configurable:true});e.prototype.remove=function(){if(this._content&&this._content.parentNode){this._content.parentNode.removeChild(this._content)}if(this._container){this._container.parentNode.removeChild(this._container);delete this._container}if(this._parentContainer){delete this._parentContainer}};e.prototype.setBasicPoint=function(e){this._point=e.slice();this._rect=null;this._notifyChanged$.next(this)};e.prototype.setBasicRect=function(e){this._rect=e.slice();this._point=null;this._notifyChanged$.next(this)};e.prototype.setDOMContent=function(e){if(this._content&&this._content.parentNode){this._content.parentNode.removeChild(this._content)}var t="mapillaryjs-popup-content"+(this._options.clean===true?"-clean":"")+(this._options.capturePointer===true?" mapillaryjs-popup-capture-pointer":"");this._content=this._dom.createElement("div",t,this._container);this._content.appendChild(e);this._notifyChanged$.next(this)};e.prototype.setHTML=function(e){var t=this._dom.document.createDocumentFragment();var r=this._dom.createElement("body");var n;r.innerHTML=e;while(true){n=r.firstChild;if(!n){break}t.appendChild(n)}this.setDOMContent(t)};e.prototype.setText=function(e){this.setDOMContent(this._dom.document.createTextNode(e))};e.prototype.setParentContainer=function(e){this._parentContainer=e};e.prototype.update=function(e,t,r){var n;if(!this._parentContainer||!this._content){return}if(!this._point&&!this._rect){return}if(!this._container){this._container=this._dom.createElement("div","mapillaryjs-popup",this._parentContainer);var i=this._options.clean!==true&&this._options.float!==x.Alignment.Center;if(i){var o="mapillaryjs-popup-tip"+(this._options.capturePointer===true?" mapillaryjs-popup-capture-pointer":"");this._tip=this._dom.createElement("div",o,this._container);this._dom.createElement("div","mapillaryjs-popup-tip-inner",this._tip)}this._container.appendChild(this._content);this._parentContainer.appendChild(this._container);if(this._options.opacity!=null){this._container.style.opacity=this._options.opacity.toString()}}var a=null;var s=this._alignmentToPopupAligment(this._options.position);var u=this._alignmentToPopupAligment(this._options.float);var c=this._container.classList;if(this._point!=null){a=this._viewportCoords.basicToCanvasSafe(this._point[0],this._point[1],{offsetHeight:t.height,offsetWidth:t.width},r,e.perspective)}else{var l=["center","top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];var h=null;for(var p=0,f=l;p<f.length;p++){var d=f[p];if(c.contains("mapillaryjs-popup-float-"+d)){h=d;break}}n=this._rectToPixel(this._rect,s,h,e,t,r),a=n[0],s=n[1];if(!u){u=s}}if(a==null){this._container.style.display="none";return}this._container.style.display="";if(!u){var v=this._container.offsetWidth;var m=this._container.offsetHeight;var g=this._pixelToFloats(a,t,v,m);u=g.length===0?"top":g.join("-")}var _=this._normalizeOffset(this._options.offset);a=[a[0]+_[u][0],a[1]+_[u][1]];a=[Math.round(a[0]),Math.round(a[1])];var y={bottom:"translate(-50%,0)","bottom-left":"translate(-100%,0)","bottom-right":"translate(0,0)",center:"translate(-50%,-50%)",left:"translate(-100%,-50%)",right:"translate(0,-50%)",top:"translate(-50%,-100%)","top-left":"translate(-100%,-100%)","top-right":"translate(0,-100%)"};for(var b in y){if(!y.hasOwnProperty(b)){continue}c.remove("mapillaryjs-popup-float-"+b)}c.add("mapillaryjs-popup-float-"+u);this._container.style.transform=y[u]+" translate("+a[0]+"px,"+a[1]+"px)"};e.prototype._rectToPixel=function(e,t,r,n,i,o){if(!t){var a=this._container.offsetWidth;var s=this._container.offsetHeight;var u={bottom:[0,s/2],"bottom-left":[-a/2,s/2],"bottom-right":[a/2,s/2],left:[-a/2,0],right:[a/2,0],top:[0,-s/2],"top-left":[-a/2,-s/2],"top-right":[a/2,-s/2]};var c=["top","bottom","left","right"];var l=[0,null,null];for(var h=0,p=c;h<p.length;h++){var f=p[h];var d=this._pointFromRectPosition(e,f);var v=this._viewportCoords.basicToCanvasSafe(d[0],d[1],{offsetHeight:i.height,offsetWidth:i.width},o,n.perspective);if(v==null){continue}var m=u[f];var g=[v[0]+m[0],v[1]+m[1]];var _=r!=null&&r===f?1:.7;var y=this._pixelToFloats(g,i,a/_,s/(2*_));if(y.length===0&&v[0]>0&&v[0]<i.width&&v[1]>0&&v[1]<i.height){return[v,f]}var b=Math.max(g[0]-a/2,0);var x=Math.min(g[0]+a/2,i.width);var w=Math.max(g[1]-s/2,0);var S=Math.min(g[1]+s/2,i.height);var M=Math.max(0,x-b);var C=Math.max(0,S-w);var T=_*M*C;if(T>l[0]){l[0]=T;l[1]=v;l[2]=f}}if(l[0]>0){return[l[1],l[2]]}}var E=this._pointFromRectPosition(e,t);var O=this._viewportCoords.basicToCanvasSafe(E[0],E[1],{offsetHeight:i.height,offsetWidth:i.width},o,n.perspective);return[O,t!=null?t:"top"]};e.prototype._alignmentToPopupAligment=function(e){switch(e){case x.Alignment.Bottom:return"bottom";case x.Alignment.BottomLeft:return"bottom-left";case x.Alignment.BottomRight:return"bottom-right";case x.Alignment.Center:return"center";case x.Alignment.Left:return"left";case x.Alignment.Right:return"right";case x.Alignment.Top:return"top";case x.Alignment.TopLeft:return"top-left";case x.Alignment.TopRight:return"top-right";default:return null}};e.prototype._normalizeOffset=function(e){if(e==null){return this._normalizeOffset(0)}if(typeof e==="number"){var t=e;var r=t>=0?1:-1;var n=r*Math.round(Math.sqrt(.5*Math.pow(t,2)));return{bottom:[0,t],"bottom-left":[-n,n],"bottom-right":[n,n],center:[0,0],left:[-t,0],right:[t,0],top:[0,-t],"top-left":[-n,-n],"top-right":[n,-n]}}else{return{bottom:e.bottom||[0,0],"bottom-left":e.bottomLeft||[0,0],"bottom-right":e.bottomRight||[0,0],center:e.center||[0,0],left:e.left||[0,0],right:e.right||[0,0],top:e.top||[0,0],"top-left":e.topLeft||[0,0],"top-right":e.topRight||[0,0]}}};e.prototype._pixelToFloats=function(e,t,r,n){var i=[];if(e[1]<n){i.push("bottom")}else if(e[1]>t.height-n){i.push("top")}if(e[0]<r/2){i.push("right")}else if(e[0]>t.width-r/2){i.push("left")}return i};e.prototype._pointFromRectPosition=function(e,t){var r=e[0];var n=e[0]<e[2]?e[2]:e[2]+1;var i=e[1];var o=e[3];switch(t){case"bottom":return[(r+n)/2,o];case"bottom-left":return[r,o];case"bottom-right":return[n,o];case"center":return[(r+n)/2,(i+o)/2];case"left":return[r,(i+o)/2];case"right":return[n,(i+o)/2];case"top":return[(r+n)/2,i];case"top-left":return[r,i];case"top-right":return[n,i];default:return[(r+n)/2,o]}};return e}();r.Popup=a;r.default=a},{"../../../Geo":294,"../../../Utils":301,"../../../Viewer":302,rxjs:43}],353:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.SequenceComponent=void 0;var c=e("rxjs");var l=e("rxjs/operators");var u=e("../../Component");var i=e("../../Edge");var o=e("../../Graph");var a=function(a){n(s,a);function s(e,t,r,n,i){var o=a.call(this,e,t,r)||this;o._sequenceDOMRenderer=!!n?n:new u.SequenceDOMRenderer(t);o._scheduler=i;o._containerWidth$=new c.Subject;o._hoveredKeySubject$=new c.Subject;o._hoveredKey$=o._hoveredKeySubject$.pipe(l.share());o._navigator.playService.playing$.pipe(l.skip(1),l.withLatestFrom(o._configuration$)).subscribe(function(e){var t=e[0],r=e[1];o.fire(s.playingchanged,t);if(t===r.playing){return}if(t){o.play()}else{o.stop()}});o._navigator.playService.direction$.pipe(l.skip(1),l.withLatestFrom(o._configuration$)).subscribe(function(e){var t=e[0],r=e[1];if(t!==r.direction){o.setDirection(t)}});return o}Object.defineProperty(s.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:false,configurable:true});s.prototype.play=function(){this.configure({playing:true})};s.prototype.stop=function(){this.configure({playing:false})};s.prototype.setDirection=function(e){this.configure({direction:e})};s.prototype.setHighlightKey=function(e){this.configure({highlightKey:e})};s.prototype.setMaxWidth=function(e){this.configure({maxWidth:e})};s.prototype.setMinWidth=function(e){this.configure({minWidth:e})};s.prototype.setVisible=function(e){this.configure({visible:e})};s.prototype._activate=function(){var u=this;this._sequenceDOMRenderer.activate();var t=this._navigator.stateService.currentNode$.pipe(l.switchMap(function(e){return e.sequenceEdges$}),l.publishReplay(1),l.refCount());var e=this._navigator.stateService.currentNode$.pipe(l.distinctUntilChanged(undefined,function(e){return e.sequenceKey}),l.switchMap(function(e){return c.concat(c.of(null),u._navigator.graphService.cacheSequence$(e.sequenceKey).pipe(l.retry(3),l.catchError(function(e){console.error("Failed to cache sequence",e);return c.of(null)})))}),l.startWith(null),l.publishReplay(1),l.refCount());this._sequenceSubscription=e.subscribe();var i=this._sequenceDOMRenderer.index$.pipe(l.withLatestFrom(e),l.map(function(e){var t=e[0],r=e[1];return r!=null?r.keys[t]:null}),l.filter(function(e){return!!e}),l.distinctUntilChanged(),l.publish(),l.refCount());this._moveSubscription=c.merge(i.pipe(l.debounceTime(100,this._scheduler)),i.pipe(l.auditTime(400,this._scheduler))).pipe(l.distinctUntilChanged(),l.switchMap(function(e){return u._navigator.moveToKey$(e).pipe(l.catchError(function(e){return c.empty()}))})).subscribe();this._setSequenceGraphModeSubscription=this._sequenceDOMRenderer.changingPositionChanged$.pipe(l.filter(function(e){return e})).subscribe(function(){u._navigator.graphService.setGraphMode(o.GraphMode.Sequence)});this._setSpatialGraphModeSubscription=this._sequenceDOMRenderer.changingPositionChanged$.pipe(l.filter(function(e){return!e})).subscribe(function(){u._navigator.graphService.setGraphMode(o.GraphMode.Spatial)});this._navigator.graphService.graphMode$.pipe(l.switchMap(function(e){return e===o.GraphMode.Spatial?u._navigator.stateService.currentNode$.pipe(l.take(2)):c.empty()}),l.filter(function(e){return!e.spatialEdges.cached}),l.switchMap(function(e){return u._navigator.graphService.cacheNode$(e.key).pipe(l.catchError(function(e){return c.empty()}))})).subscribe();this._stopSubscription=this._sequenceDOMRenderer.changingPositionChanged$.pipe(l.filter(function(e){return e})).subscribe(function(){u._navigator.playService.stop()});this._cacheSequenceNodesSubscription=c.combineLatest(this._navigator.graphService.graphMode$,this._sequenceDOMRenderer.changingPositionChanged$.pipe(l.startWith(false),l.distinctUntilChanged())).pipe(l.withLatestFrom(this._navigator.stateService.currentNode$),l.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return n&&r===o.GraphMode.Sequence?u._navigator.graphService.cacheSequenceNodes$(i.sequenceKey,i.key).pipe(l.retry(3),l.catchError(function(e){console.error("Failed to cache sequence nodes.",e);return c.empty()})):c.empty()})).subscribe();var r=e.pipe(l.switchMap(function(r){if(!r){return c.of({index:null,max:null})}var n=true;return u._sequenceDOMRenderer.changingPositionChanged$.pipe(l.startWith(false),l.distinctUntilChanged(),l.switchMap(function(e){var t=!e&&n?0:1;n=false;return e?i:u._navigator.stateService.currentNode$.pipe(l.map(function(e){return e.key}),l.distinctUntilChanged(),l.skip(t))}),l.map(function(e){var t=r.keys.indexOf(e);if(t===-1){return{index:null,max:null}}return{index:t,max:r.keys.length-1}}))}));this._renderSubscription=c.combineLatest(t,this._configuration$,this._containerWidth$,this._sequenceDOMRenderer.changed$.pipe(l.startWith(this._sequenceDOMRenderer)),this._navigator.playService.speed$,r).pipe(l.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5];var s=u._sequenceDOMRenderer.render(t,r,n,o,a.index,a.max,u,u._navigator);return{name:u._name,vnode:s}})).subscribe(this._container.domRenderer.render$);this._setSpeedSubscription=this._sequenceDOMRenderer.speed$.subscribe(function(e){u._navigator.playService.setSpeed(e)});this._setDirectionSubscription=this._configuration$.pipe(l.map(function(e){return e.direction}),l.distinctUntilChanged()).subscribe(function(e){u._navigator.playService.setDirection(e)});this._containerWidthSubscription=c.combineLatest(this._container.renderService.size$,this._configuration$.pipe(l.distinctUntilChanged(function(e,t){return e[0]===t[0]&&e[1]===t[1]},function(e){return[e.minWidth,e.maxWidth]}))).pipe(l.map(function(e){var t=e[0],r=e[1];return u._sequenceDOMRenderer.getContainerWidth(t,r)})).subscribe(this._containerWidth$);this._playingSubscription=this._configuration$.pipe(l.map(function(e){return e.playing}),l.distinctUntilChanged()).subscribe(function(e){if(e){u._navigator.playService.play()}else{u._navigator.playService.stop()}});this._hoveredKeySubscription=this._sequenceDOMRenderer.mouseEnterDirection$.pipe(l.switchMap(function(i){var e=t.pipe(l.map(function(e){for(var t=0,r=e.edges;t<r.length;t++){var n=r[t];if(n.data.direction===i){return n.to}}return null}),l.takeUntil(u._sequenceDOMRenderer.mouseLeaveDirection$));return c.concat(e,c.of(null))}),l.distinctUntilChanged()).subscribe(this._hoveredKeySubject$);this._emitHoveredKeySubscription=this._hoveredKey$.subscribe(function(e){u.fire(s.hoveredkeychanged,e)})};s.prototype._deactivate=function(){this._emitHoveredKeySubscription.unsubscribe();this._renderSubscription.unsubscribe();this._playingSubscription.unsubscribe();this._containerWidthSubscription.unsubscribe();this._hoveredKeySubscription.unsubscribe();this._setSpeedSubscription.unsubscribe();this._setDirectionSubscription.unsubscribe();this._setSequenceGraphModeSubscription.unsubscribe();this._setSpatialGraphModeSubscription.unsubscribe();this._sequenceSubscription.unsubscribe();this._moveSubscription.unsubscribe();this._cacheSequenceNodesSubscription.unsubscribe();this._stopSubscription.unsubscribe();this._sequenceDOMRenderer.deactivate()};s.prototype._getDefaultConfiguration=function(){return{direction:i.EdgeDirection.Next,maxWidth:108,minWidth:70,playing:false,visible:true}};s.componentName="sequence";s.playingchanged="playingchanged";s.hoveredkeychanged="hoveredkeychanged";return s}(u.Component);r.SequenceComponent=a;u.ComponentService.register(a);r.default=a},{"../../Component":291,"../../Edge":292,"../../Graph":295,rxjs:43,"rxjs/operators":241}],354:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SequenceDOMRenderer=void 0;var n=e("rxjs");var i=e("rxjs/operators");var w=e("virtual-dom");var S=e("../../Component");var M=e("../../Edge");var f=e("../../Error");var o=function(){function e(e){this._container=e;this._minThresholdWidth=320;this._maxThresholdWidth=1480;this._minThresholdHeight=240;this._maxThresholdHeight=820;this._stepperDefaultWidth=108;this._controlsDefaultWidth=88;this._defaultHeight=30;this._expandControls=false;this._mode=S.SequenceMode.Default;this._speed=.5;this._changingSpeed=false;this._index=null;this._changingPosition=false;this._mouseEnterDirection$=new n.Subject;this._mouseLeaveDirection$=new n.Subject;this._notifyChanged$=new n.Subject;this._notifyChangingPositionChanged$=new n.Subject;this._notifySpeedChanged$=new n.Subject;this._notifyIndexChanged$=new n.Subject}Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"changingPositionChanged$",{get:function(){return this._notifyChangingPositionChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"speed$",{get:function(){return this._notifySpeedChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"index$",{get:function(){return this._notifyIndexChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseEnterDirection$",{get:function(){return this._mouseEnterDirection$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseLeaveDirection$",{get:function(){return this._mouseLeaveDirection$},enumerable:false,configurable:true});e.prototype.activate=function(){var t=this;if(!!this._changingSubscription){return}this._changingSubscription=n.merge(this._container.mouseService.documentMouseUp$,this._container.touchService.touchEnd$.pipe(i.filter(function(e){return e.touches.length===0}))).subscribe(function(e){if(t._changingSpeed){t._changingSpeed=false}if(t._changingPosition){t._setChangingPosition(false)}})};e.prototype.deactivate=function(){if(!this._changingSubscription){return}this._changingSpeed=false;this._changingPosition=false;this._expandControls=false;this._mode=S.SequenceMode.Default;this._changingSubscription.unsubscribe();this._changingSubscription=null};e.prototype.render=function(e,t,r,n,i,o,a,s){if(t.visible===false){return w.h("div.SequenceContainer",{},[])}var u=this._createStepper(e,t,r,a,s);var c=this._createSequenceControls(r);var l=this._createPlaybackControls(r,n,a,t);var h=this._createTimelineControls(r,i,o);return w.h("div.SequenceContainer",[u,c,l,h])};e.prototype.getContainerWidth=function(e,t){var r=t.minWidth;var n=t.maxWidth;if(n<r){n=r}var i=(e.width-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth);var o=(e.height-this._minThresholdHeight)/(this._maxThresholdHeight-this._minThresholdHeight);var a=Math.max(0,Math.min(1,Math.min(i,o)));return r+a*(n-r)};e.prototype._createPositionInput=function(e,t){var r=this;this._index=e;var n=function(e){r._index=Number(e.target.value);r._notifyIndexChanged$.next(r._index)};var i=this._container.domContainer.getBoundingClientRect();var o=Math.max(276,Math.min(410,5+.8*i.width))-65;var a=function(e){e.stopPropagation();r._setChangingPosition(true)};var s=function(e){if(r._changingPosition===true){e.stopPropagation()}};var u=function(e){if(e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="ArrowUp"){e.preventDefault()}};var c={max:t!=null?t:1,min:0,onchange:n,oninput:n,onkeydown:u,onmousedown:a,onmousemove:s,ontouchmove:s,ontouchstart:a,style:{width:o+"px"},type:"range",value:e!=null?e:0};var l=e==null||t==null||t<=1;if(l){c.disabled="true"}var h=w.h("input.SequencePosition",c,[]);var p=l?".SequencePositionContainerDisabled":".SequencePositionContainer";return w.h("div"+p,[h])};e.prototype._createSpeedInput=function(e){var t=this;this._speed=e;var r=function(e){t._speed=Number(e.target.value)/1e3;t._notifySpeedChanged$.next(t._speed)};var n=this._container.domContainer.getBoundingClientRect();var i=Math.max(276,Math.min(410,5+.8*n.width))-160;var o=function(e){t._changingSpeed=true;e.stopPropagation()};var a=function(e){if(t._changingSpeed===true){e.stopPropagation()}};var s=function(e){if(e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="ArrowUp"){e.preventDefault()}};var u=w.h("input.SequenceSpeed",{max:1e3,min:0,onchange:r,oninput:r,onkeydown:s,onmousedown:o,onmousemove:a,ontouchmove:a,ontouchstart:o,style:{width:i+"px"},type:"range",value:1e3*e},[]);return w.h("div.SequenceSpeedContainer",[u])};e.prototype._createPlaybackControls=function(e,t,r,n){var i=this;if(this._mode!==S.SequenceMode.Playback){return w.h("div.SequencePlayback",[])}var o=w.h("div.SequenceSwitchIcon.SequenceIconVisible",[]);var a=n.direction===M.EdgeDirection.Next?M.EdgeDirection.Prev:M.EdgeDirection.Next;var s=n.playing;var u={onclick:function(){if(!s){r.setDirection(a)}}};var c=n.playing?".SequenceSwitchButtonDisabled":".SequenceSwitchButton";var l=w.h("div"+c,u,[o]);var h=w.h("div.SequenceSlowIcon.SequenceIconVisible",[]);var p=w.h("div.SequenceSlowContainer",[h]);var f=w.h("div.SequenceFastIcon.SequenceIconVisible",[]);var d=w.h("div.SequenceFastContainer",[f]);var v=w.h("div.SequenceCloseIcon.SequenceIconVisible",[]);var m={onclick:function(){i._mode=S.SequenceMode.Default;i._notifyChanged$.next(i)}};var g=w.h("div.SequenceCloseButton",m,[v]);var _=this._createSpeedInput(t);var y=[l,p,_,d,g];var b=Math.round(e/this._stepperDefaultWidth*this._defaultHeight+10);var x={style:{top:b+"px"}};return w.h("div.SequencePlayback",x,y)};e.prototype._createPlayingButton=function(e,t,r,n){var i=r.direction===M.EdgeDirection.Next&&e!=null||r.direction===M.EdgeDirection.Prev&&t!=null;var o=r.playing?function(e){n.stop()}:i?function(e){n.play()}:null;var a={onclick:o};var s=r.playing?"Stop":i?"Play":"PlayDisabled";var u={className:s};if(r.direction===M.EdgeDirection.Prev){u.style={transform:"rotate(180deg) translate(50%, 50%)"}}var c=w.h("div.SequenceComponentIcon",u,[]);var l=i?"SequencePlay":"SequencePlayDisabled";return w.h("div."+l,a,[c])};e.prototype._createSequenceControls=function(e){var t=this;var r=Math.round(8/this._stepperDefaultWidth*e);var n={onclick:function(){t._expandControls=!t._expandControls;t._mode=S.SequenceMode.Default;t._notifyChanged$.next(t)},style:{"border-bottom-right-radius":r+"px","border-top-right-radius":r+"px"}};var i=w.h("div.SequenceExpanderBar",[]);var o=w.h("div.SequenceExpanderButton",n,[i]);var a=this._mode===S.SequenceMode.Playback?".SequenceFastIconGrey.SequenceIconVisible":".SequenceFastIcon";var s=w.h("div"+a,[]);var u={onclick:function(){t._mode=t._mode===S.SequenceMode.Playback?S.SequenceMode.Default:S.SequenceMode.Playback;t._notifyChanged$.next(t)}};var c=w.h("div.SequencePlaybackButton",u,[s]);var l=this._mode===S.SequenceMode.Timeline?".SequenceTimelineIconGrey.SequenceIconVisible":".SequenceTimelineIcon";var h=w.h("div"+l,[]);var p={onclick:function(){t._mode=t._mode===S.SequenceMode.Timeline?S.SequenceMode.Default:S.SequenceMode.Timeline;t._notifyChanged$.next(t)}};var f=w.h("div.SequenceTimelineButton",p,[h]);var d={style:{height:this._defaultHeight/this._stepperDefaultWidth*e+"px",transform:"translate("+(e/2+2)+"px, 0)",width:this._controlsDefaultWidth/this._stepperDefaultWidth*e+"px"}};var v=".SequenceControls"+(this._expandControls?".SequenceControlsExpanded":"");return w.h("div"+v,d,[c,f,o])};e.prototype._createSequenceArrows=function(e,t,r,n,i){var o=this;var a={onclick:e!=null?function(e){i.moveDir$(M.EdgeDirection.Next).subscribe(undefined,function(e){if(!(e instanceof f.AbortMapillaryError)){console.error(e)}})}:null,onmouseenter:function(e){o._mouseEnterDirection$.next(M.EdgeDirection.Next)},onmouseleave:function(e){o._mouseLeaveDirection$.next(M.EdgeDirection.Next)}};var s=Math.round(8/this._stepperDefaultWidth*r);var u={onclick:t!=null?function(e){i.moveDir$(M.EdgeDirection.Prev).subscribe(undefined,function(e){if(!(e instanceof f.AbortMapillaryError)){console.error(e)}})}:null,onmouseenter:function(e){o._mouseEnterDirection$.next(M.EdgeDirection.Prev)},onmouseleave:function(e){o._mouseLeaveDirection$.next(M.EdgeDirection.Prev)},style:{"border-bottom-left-radius":s+"px","border-top-left-radius":s+"px"}};var c=this._getStepClassName(M.EdgeDirection.Next,e,n.highlightKey);var l=this._getStepClassName(M.EdgeDirection.Prev,t,n.highlightKey);var h=w.h("div.SequenceComponentIcon",[]);var p=w.h("div.SequenceComponentIcon",[]);return[w.h("div."+l,u,[p]),w.h("div."+c,a,[h])]};e.prototype._createStepper=function(e,t,r,n,i){var o=null;var a=null;for(var s=0,u=e.edges;s<u.length;s++){var c=u[s];if(c.data.direction===M.EdgeDirection.Next){o=c.to}if(c.data.direction===M.EdgeDirection.Prev){a=c.to}}var l=this._createPlayingButton(o,a,t,n);var h=this._createSequenceArrows(o,a,r,t,i);h.splice(1,0,l);var p={oncontextmenu:function(e){e.preventDefault()},style:{height:this._defaultHeight/this._stepperDefaultWidth*r+"px",width:r+"px"}};return w.h("div.SequenceStepper",p,h)};e.prototype._createTimelineControls=function(e,t,r){var n=this;if(this._mode!==S.SequenceMode.Timeline){return w.h("div.SequenceTimeline",[])}var i=this._createPositionInput(t,r);var o=w.h("div.SequenceCloseIcon.SequenceIconVisible",[]);var a={onclick:function(){n._mode=S.SequenceMode.Default;n._notifyChanged$.next(n)}};var s=w.h("div.SequenceCloseButton",a,[o]);var u=Math.round(e/this._stepperDefaultWidth*this._defaultHeight+10);var c={style:{top:u+"px"}};return w.h("div.SequenceTimeline",c,[i,s])};e.prototype._getStepClassName=function(e,t,r){var n=e===M.EdgeDirection.Next?"SequenceStepNext":"SequenceStepPrev";if(t==null){n+="Disabled"}else{if(r===t){n+="Highlight"}}return n};e.prototype._setChangingPosition=function(e){this._changingPosition=e;this._notifyChangingPositionChanged$.next(e)};return e}();r.SequenceDOMRenderer=o;r.default=o},{"../../Component":291,"../../Edge":292,"../../Error":293,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],355:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SequenceMode=void 0;var n;(function(e){e[e["Default"]=0]="Default";e[e["Playback"]=1]="Playback";e[e["Timeline"]=2]="Timeline"})(n=r.SequenceMode||(r.SequenceMode={}));r.default=n},{}],356:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Shaders=void 0;var n=e("path");var i=function(){function e(){}e.equirectangular={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float phiLength;\nuniform float phiShift;\nuniform float thetaLength;\nuniform float thetaShift;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vec3 b = normalize(vRstq.xyz);\n    float lat = -asin(b.y);\n    float lon = atan(b.x, b.z);\n    float x = (lon - phiShift) / phiLength + 0.5;\n    float y = (lat - thetaShift) / thetaLength + 0.5;\n    vec4 baseColor = texture2D(projectorTex, vec2(x, y));\n    baseColor.a = opacity;\n    gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"};e.equirectangularCurtain={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float curtain;\nuniform float opacity;\nuniform float phiLength;\nuniform float phiShift;\nuniform float thetaLength;\nuniform float thetaShift;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vec3 b = normalize(vRstq.xyz);\n    float lat = -asin(b.y);\n    float lon = atan(b.x, b.z);\n    float x = (lon - phiShift) / phiLength + 0.5;\n    float y = (lat - thetaShift) / thetaLength + 0.5;\n\n    bool inverted = curtain < 0.5;\n\n    float curtainMin = inverted ? curtain + 0.5 : curtain - 0.5;\n    float curtainMax = curtain;\n\n    bool insideCurtain = inverted ?\n        x > curtainMin || x < curtainMax :\n        x > curtainMin && x < curtainMax;\n\n    vec4 baseColor;\n    if (insideCurtain) {\n        baseColor = texture2D(projectorTex, vec2(x, y));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"};e.perspective={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float x = vRstq.x / vRstq.z;\n    float y = vRstq.y / vRstq.z;\n    float r2 = x * x + y * y;\n\n    if (radial_peak > 0. && r2 > radial_peak * sqrt(r2)) {\n        r2 = radial_peak * radial_peak;\n    }\n\n    float d = 1.0 + k1 * r2 + k2 * r2 * r2;\n    float u = scale_x * focal * d * x + 0.5;\n    float v = - scale_y * focal * d * y + 0.5;\n\n    vec4 baseColor;\n    if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"};e.perspectiveCurtain={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float x = vRstq.x / vRstq.z;\n    float y = vRstq.y / vRstq.z;\n    float r2 = x * x + y * y;\n\n    if (radial_peak > 0. && r2 > radial_peak * sqrt(r2)) {\n        r2 = radial_peak * radial_peak;\n    }\n\n    float d = 1.0 + k1 * r2 + k2 * r2 * r2;\n    float u = scale_x * focal * d * x + 0.5;\n    float v = - scale_y * focal * d * y + 0.5;\n\n    vec4 baseColor;\n    if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"};e.fisheye={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float x = vRstq.x;\n    float y = vRstq.y;\n    float z = vRstq.z;\n\n    float r = sqrt(x * x + y * y);\n    float theta = atan(r, z);\n\n    if (radial_peak > 0. && theta > radial_peak) {\n        theta = radial_peak;\n    }\n\n    float theta2 = theta * theta;\n    float theta_d = theta * (1.0 + theta2 * (k1 + theta2 * k2));\n    float s = focal * theta_d / r;\n\n    float u = scale_x * s * x + 0.5;\n    float v = -scale_y * s * y + 0.5;\n\n    vec4 baseColor;\n    if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"};e.fisheyeCurtain={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float x = vRstq.x;\n    float y = vRstq.y;\n    float z = vRstq.z;\n\n    float r2 = sqrt(x * x + y * y);\n    float theta = atan(r2, z);\n\n    if (radial_peak > 0. && theta > radial_peak) {\n        theta = radial_peak;\n    }\n\n    float theta2 = theta * theta;\n    float theta_d = theta * (1.0 + theta2 * (k1 + theta2 * k2));\n    float s = focal * theta_d / r2;\n\n    float u = scale_x * s * x + 0.5;\n    float v = -scale_y * s * y + 0.5;\n\n    vec4 baseColor;\n    if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"};e.perspectiveDistorted={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float u = vRstq.x / vRstq.w;\n    float v = vRstq.y / vRstq.w;\n\n    vec4 baseColor;\n    if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n"};e.perspectiveDistortedCurtain={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float u = vRstq.x / vRstq.w;\n    float v = vRstq.y / vRstq.w;\n\n    vec4 baseColor;\n    if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n"};return e}();r.Shaders=i},{path:39}],357:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.SliderComponent=void 0;var d=e("rxjs");var v=e("rxjs/operators");var m=e("../../Component");var a=e("../../Geo");var g=e("../../State");var _=e("../../Render");var y=e("../../Tiles");var b=e("../../Utils");var i=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._viewportCoords=!!n?n:new a.ViewportCoords;i._domRenderer=new m.SliderDOMRenderer(t);i._imageTileLoader=new y.ImageTileLoader(b.Urls.tileScheme,b.Urls.tileDomain,b.Urls.origin);i._roiCalculator=new y.RegionOfInterestCalculator;i._spatial=new a.Spatial;i._glRendererOperation$=new d.Subject;i._glRendererCreator$=new d.Subject;i._glRendererDisposer$=new d.Subject;i._glRenderer$=i._glRendererOperation$.pipe(v.scan(function(e,t){return t(e)},null),v.filter(function(e){return e!=null}),v.distinctUntilChanged(undefined,function(e){return e.frameId}));i._glRendererCreator$.pipe(v.map(function(){return function(e){if(e!=null){throw new Error("Multiple slider states can not be created at the same time")}return new m.SliderGLRenderer}})).subscribe(i._glRendererOperation$);i._glRendererDisposer$.pipe(v.map(function(){return function(e){e.dispose();return null}})).subscribe(i._glRendererOperation$);return i}e.prototype.setInitialPosition=function(e){this.configure({initialPosition:e})};e.prototype.setKeys=function(e){this.configure({keys:e})};e.prototype.setSliderMode=function(e){this.configure({mode:e})};e.prototype.setSliderVisible=function(e){this.configure({sliderVisible:e})};e.prototype._activate=function(){var z=this;this._modeSubcription=this._domRenderer.mode$.subscribe(function(e){z.setSliderMode(e)});this._glRenderSubscription=this._glRenderer$.pipe(v.map(function(e){var t={name:z._name,render:{frameId:e.frameId,needsRender:e.needsRender,render:e.render.bind(e),stage:_.GLRenderStage.Background}};return t})).subscribe(this._container.glRenderer.render$);var e=d.concat(this.configuration$.pipe(v.map(function(e){return e.initialPosition!=null?e.initialPosition:1}),v.first()),this._domRenderer.position$);var t=this.configuration$.pipe(v.map(function(e){return e.mode}),v.distinctUntilChanged());var r=this._navigator.stateService.currentState$.pipe(v.map(function(e){return e.state.motionless}),v.distinctUntilChanged());var n=this._navigator.stateService.currentState$.pipe(v.map(function(e){return e.state.currentNode.fullPano}),v.distinctUntilChanged());var i=d.combineLatest(this._configuration$.pipe(v.map(function(e){return e.sliderVisible})),this._navigator.stateService.currentState$.pipe(v.map(function(e){return!(e.state.currentNode==null||e.state.previousNode==null||e.state.currentNode.pano&&!e.state.currentNode.fullPano||e.state.previousNode.pano&&!e.state.previousNode.fullPano||e.state.currentNode.fullPano&&!e.state.previousNode.fullPano)}),v.distinctUntilChanged())).pipe(v.map(function(e){var t=e[0],r=e[1];return t&&r}),v.distinctUntilChanged());this._waitSubscription=d.combineLatest(t,r,n,i).pipe(v.withLatestFrom(this._navigator.stateService.state$)).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=t[2],o=t[3],a=e[1];var s=o&&(n||r===m.SliderMode.Stationary||i);if(s&&a!==g.State.WaitingInteractively){z._navigator.stateService.waitInteractively()}else if(!s&&a!==g.State.Waiting){z._navigator.stateService.wait()}});this._moveSubscription=d.combineLatest(e,t,r,n,i).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4];if(n||r===m.SliderMode.Stationary||i){z._navigator.stateService.moveTo(1)}else{z._navigator.stateService.moveTo(t)}});this._domRenderSubscription=d.combineLatest(e,t,r,n,i,this._container.renderService.size$).pipe(v.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5];return{name:z._name,vnode:z._domRenderer.render(t,r,n,i,o)}})).subscribe(this._container.domRenderer.render$);this._glRendererCreator$.next(null);this._updateCurtainSubscription=d.combineLatest(e,n,i,this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(v.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4];if(!r){return n?t:1}var a=z._viewportCoords.viewportToBasic(-1.15,0,o,i.perspective);var s=z._viewportCoords.viewportToBasic(1.15,0,o,i.perspective);var u=s[0]<a[0]?s[0]+1:s[0];var c=a[0]+t*(u-a[0]);return c>1?c-1:c}),v.map(function(t){return function(e){e.updateCurtain(t);return e}})).subscribe(this._glRendererOperation$);this._stateSubscription=d.combineLatest(this._navigator.stateService.currentState$,t).pipe(v.map(function(e){var t=e[0],r=e[1];return function(e){e.update(t,r);return e}})).subscribe(this._glRendererOperation$);this._setKeysSubscription=this._configuration$.pipe(v.filter(function(e){return e.keys!=null}),v.switchMap(function(e){return d.zip(d.zip(z._catchCacheNode$(e.keys.background),z._catchCacheNode$(e.keys.foreground)).pipe(v.map(function(e){return{background:e[0],foreground:e[1]}})),z._navigator.stateService.currentState$.pipe(v.first())).pipe(v.map(function(e){return{nodes:e[0],state:e[1].state}}))})).subscribe(function(e){if(e.state.currentNode!=null&&e.state.previousNode!=null&&e.state.currentNode.key===e.nodes.foreground.key&&e.state.previousNode.key===e.nodes.background.key){return}if(e.state.currentNode.key===e.nodes.background.key){z._navigator.stateService.setNodes([e.nodes.foreground]);return}if(e.state.currentNode.key===e.nodes.foreground.key&&e.state.trajectory.length===1){z._navigator.stateService.prependNodes([e.nodes.background]);return}z._navigator.stateService.setNodes([e.nodes.background]);z._navigator.stateService.setNodes([e.nodes.foreground])},function(e){console.error(e)});var o=this._navigator.stateService.currentState$.pipe(v.map(function(e){return e.state.previousNode}),v.filter(function(e){return e!=null}),v.distinctUntilChanged(undefined,function(e){return e.key}));var a=this._navigator.stateService.currentState$.pipe(v.distinctUntilChanged(undefined,function(e){return e.state.currentNode.key}),v.withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$),v.map(function(e){var t=e[0],r=e[1],n=e[2];var i=t.state;var o=Math.max(n.width,n.height);var a=i.currentNode;var s=i.currentTransform;var u=o>2048?2048:o>1024?1024:512;return new y.TextureProvider(a.key,s.basicWidth,s.basicHeight,u,a.image,z._imageTileLoader,new y.ImageTileStore,r)}),v.publishReplay(1),v.refCount());this._textureProviderSubscription=a.subscribe(function(){});this._setTextureProviderSubscription=a.pipe(v.map(function(t){return function(e){e.setTextureProvider(t.key,t);return e}})).subscribe(this._glRendererOperation$);this._setTileSizeSubscription=this._container.renderService.size$.pipe(v.switchMap(function(e){return d.combineLatest(a,d.of(e)).pipe(v.first())})).subscribe(function(e){var t=e[0],r=e[1];var n=Math.max(r.width,r.height);var i=n>2048?2048:n>1024?1024:512;t.setTileSize(i)});this._abortTextureProviderSubscription=a.pipe(v.pairwise()).subscribe(function(e){var t=e[0];t.abort()});var s=d.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.pipe(v.debounceTime(250))).pipe(v.map(function(e){var t=e[0],r=e[1];return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf(),r.height.valueOf(),r.width.valueOf()]}),v.pairwise(),v.skipWhile(function(e){return e[1][2]-e[0][2]<0||e[1][2]===0}),v.map(function(e){var t=e[0][0].equals(e[1][0]);var r=e[0][1].equals(e[1][1]);var n=e[0][2]===e[1][2];var i=e[0][3]===e[1][3];var o=e[0][4]===e[1][4];return t&&r&&n&&i&&o}),v.distinctUntilChanged(),v.filter(function(e){return e}),v.switchMap(function(e){return z._container.renderService.renderCameraFrame$.pipe(v.first())}),v.withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$));this._setRegionOfInterestSubscription=a.pipe(v.switchMap(function(i){return s.pipe(v.map(function(e){var t=e[0],r=e[1],n=e[2];return[z._roiCalculator.computeRegionOfInterest(t,r,n),i]}))}),v.filter(function(e){return!e[1].disposed})).subscribe(function(e){var t=e[0];var r=e[1];r.setRegionOfInterest(t)});var u=a.pipe(v.switchMap(function(e){return e.hasTexture$}),v.startWith(false),v.publishReplay(1),v.refCount());this._hasTextureSubscription=u.subscribe(function(){});var c=this._navigator.stateService.currentState$.pipe(v.filter(function(e){return e.state.nodesAhead===0}),v.map(function(e){return e.state.currentNode}),v.distinctUntilChanged(undefined,function(e){return e.key}),v.debounceTime(1e3),v.withLatestFrom(u),v.filter(function(e){return!e[1]}),v.map(function(e){return e[0]}),v.filter(function(e){return e.pano?b.Settings.maxImageSize>b.Settings.basePanoramaSize:b.Settings.maxImageSize>b.Settings.baseImageSize}),v.switchMap(function(r){var e=r.pano?b.Settings.basePanoramaSize:b.Settings.baseImageSize;if(Math.max(r.image.width,r.image.height)>e){return d.empty()}var t=r.cacheImage$(b.Settings.maxImageSize).pipe(v.map(function(e){return[e.image,e]}));return t.pipe(v.takeUntil(u.pipe(v.filter(function(e){return e}))),v.catchError(function(e,t){console.error("Failed to fetch high res image ("+r.key+")",e);return d.empty()}))})).pipe(v.publish(),v.refCount());this._updateBackgroundSubscription=c.pipe(v.withLatestFrom(a)).subscribe(function(e){if(e[0][1].key!==e[1].key||e[1].disposed){return}e[1].updateBackground(e[0][0])});this._updateTextureImageSubscription=c.pipe(v.map(function(t){return function(e){e.updateTextureImage(t[0],t[1]);return e}})).subscribe(this._glRendererOperation$);var l=this._navigator.stateService.currentState$.pipe(v.filter(function(e){return!!e.state.previousNode}),v.distinctUntilChanged(undefined,function(e){return e.state.previousNode.key}),v.withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$),v.map(function(e){var t=e[0],r=e[1],n=e[2];var i=t.state;var o=Math.max(n.width,n.height);var a=i.previousNode;var s=i.previousTransform;var u=o>2048?2048:o>1024?1024:512;return new y.TextureProvider(a.key,s.basicWidth,s.basicHeight,u,a.image,z._imageTileLoader,new y.ImageTileStore,r)}),v.publishReplay(1),v.refCount());this._textureProviderSubscriptionPrev=l.subscribe(function(){});this._setTextureProviderSubscriptionPrev=l.pipe(v.map(function(t){return function(e){e.setTextureProviderPrev(t.key,t);return e}})).subscribe(this._glRendererOperation$);this._setTileSizeSubscriptionPrev=this._container.renderService.size$.pipe(v.switchMap(function(e){return d.combineLatest(l,d.of(e)).pipe(v.first())})).subscribe(function(e){var t=e[0],r=e[1];var n=Math.max(r.width,r.height);var i=n>2048?2048:n>1024?1024:512;t.setTileSize(i)});this._abortTextureProviderSubscriptionPrev=l.pipe(v.pairwise()).subscribe(function(e){var t=e[0];t.abort()});var h=d.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.pipe(v.debounceTime(250))).pipe(v.map(function(e){var t=e[0],r=e[1];return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf(),r.height.valueOf(),r.width.valueOf()]}),v.pairwise(),v.skipWhile(function(e){return e[1][2]-e[0][2]<0||e[1][2]===0}),v.map(function(e){var t=e[0][0].equals(e[1][0]);var r=e[0][1].equals(e[1][1]);var n=e[0][2]===e[1][2];var i=e[0][3]===e[1][3];var o=e[0][4]===e[1][4];return t&&r&&n&&i&&o}),v.distinctUntilChanged(),v.filter(function(e){return e}),v.switchMap(function(e){return z._container.renderService.renderCameraFrame$.pipe(v.first())}),v.withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$));this._setRegionOfInterestSubscriptionPrev=l.pipe(v.switchMap(function(i){return h.pipe(v.map(function(e){var t=e[0],r=e[1],n=e[2];return[z._roiCalculator.computeRegionOfInterest(t,r,n),i]}))}),v.filter(function(e){return!e[1].disposed}),v.withLatestFrom(this._navigator.stateService.currentState$)).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];var o=null;if(i.state.previousNode.fullPano){if(i.state.currentNode.fullPano){var a=z._spatial.viewingDirection(i.state.currentNode.rotation);var s=z._spatial.viewingDirection(i.state.previousNode.rotation);var u=z._spatial.angleBetweenVector2(a.x,a.y,s.x,s.y);var c=u/(2*Math.PI);var l={maxX:z._spatial.wrap(r.bbox.maxX+c,0,1),maxY:r.bbox.maxY,minX:z._spatial.wrap(r.bbox.minX+c,0,1),minY:r.bbox.minY};o={bbox:l,pixelHeight:r.pixelHeight,pixelWidth:r.pixelWidth}}else{var a=z._spatial.viewingDirection(i.state.currentNode.rotation);var s=z._spatial.viewingDirection(i.state.previousNode.rotation);var u=z._spatial.angleBetweenVector2(a.x,a.y,s.x,s.y);var h=u/(2*Math.PI);var p=z._spatial.angleToPlane(a.toArray(),[0,0,1]);var f=z._spatial.angleToPlane(s.toArray(),[0,0,1]);var d=(f-p)/(2*Math.PI);var v=i.state.currentTransform;var m=Math.max(v.basicWidth,v.basicHeight);var g=m>0?2*Math.atan(.5*v.basicWidth/(m*v.focal)):Math.PI/3;var _=m>0?2*Math.atan(.5*v.basicHeight/(m*v.focal)):Math.PI/3;var y=g/(2*Math.PI);var b=_/Math.PI;var x=(r.bbox.maxX-r.bbox.minX)*y;var w=(r.bbox.maxY-r.bbox.minY)*b;var S=r.pixelWidth*y;var M=r.pixelHeight*b;var C=(r.bbox.minX+r.bbox.maxX)/2-.5;var T=(r.bbox.minY+r.bbox.maxY)/2-.5;var E=.5+h+y*C-x/2;var O=.5+h+y*C+x/2;var P=.5+d+b*T-w/2;var A=.5+d+b*T+w/2;var l={maxX:z._spatial.wrap(O,0,1),maxY:A,minX:z._spatial.wrap(E,0,1),minY:P};o={bbox:l,pixelHeight:M,pixelWidth:S}}}else{var j=i.state.currentTransform.basicAspect;var R=i.state.previousTransform.basicAspect;var k=z._getBasicCorners(j,R),L=k[0],N=L[0],I=L[1],D=k[1],B=D[0],F=D[1];var x=B-N;var w=F-I;var S=r.pixelWidth/x;var M=r.pixelHeight/w;var E=(x-1)/(2*x)+r.bbox.minX/x;var O=(x-1)/(2*x)+r.bbox.maxX/x;var P=(w-1)/(2*w)+r.bbox.minY/w;var A=(w-1)/(2*w)+r.bbox.maxY/w;var l={maxX:O,maxY:A,minX:E,minY:P};z._clipBoundingBox(l);o={bbox:l,pixelHeight:M,pixelWidth:S}}n.setRegionOfInterest(o)});var p=l.pipe(v.switchMap(function(e){return e.hasTexture$}),v.startWith(false),v.publishReplay(1),v.refCount());this._hasTextureSubscriptionPrev=p.subscribe(function(){});var f=this._navigator.stateService.currentState$.pipe(v.filter(function(e){return e.state.nodesAhead===0&&!!e.state.previousNode}),v.map(function(e){return e.state.previousNode}),v.distinctUntilChanged(undefined,function(e){return e.key}),v.debounceTime(1e3),v.withLatestFrom(p),v.filter(function(e){return!e[1]}),v.map(function(e){return e[0]}),v.filter(function(e){return e.pano?b.Settings.maxImageSize>b.Settings.basePanoramaSize:b.Settings.maxImageSize>b.Settings.baseImageSize}),v.switchMap(function(r){var e=r.pano?b.Settings.basePanoramaSize:b.Settings.baseImageSize;if(Math.max(r.image.width,r.image.height)>e){return d.empty()}var t=r.cacheImage$(b.Settings.maxImageSize).pipe(v.map(function(e){return[e.image,e]}));return t.pipe(v.takeUntil(p.pipe(v.filter(function(e){return e}))),v.catchError(function(e,t){console.error("Failed to fetch high res image ("+r.key+")",e);return d.empty()}))})).pipe(v.publish(),v.refCount());this._updateBackgroundSubscriptionPrev=f.pipe(v.withLatestFrom(l)).subscribe(function(e){if(e[0][1].key!==e[1].key||e[1].disposed){return}e[1].updateBackground(e[0][0])});this._updateTextureImageSubscriptionPrev=f.pipe(v.map(function(t){return function(e){e.updateTextureImage(t[0],t[1]);return e}})).subscribe(this._glRendererOperation$)};e.prototype._deactivate=function(){var t=this;this._waitSubscription.unsubscribe();this._navigator.stateService.state$.pipe(v.first()).subscribe(function(e){if(e!==g.State.Traversing){t._navigator.stateService.traverse()}});this._glRendererDisposer$.next(null);this._domRenderer.deactivate();this._modeSubcription.unsubscribe();this._setKeysSubscription.unsubscribe();this._stateSubscription.unsubscribe();this._glRenderSubscription.unsubscribe();this._domRenderSubscription.unsubscribe();this._moveSubscription.unsubscribe();this._updateCurtainSubscription.unsubscribe();this._textureProviderSubscription.unsubscribe();this._setTextureProviderSubscription.unsubscribe();this._setTileSizeSubscription.unsubscribe();this._abortTextureProviderSubscription.unsubscribe();this._setRegionOfInterestSubscription.unsubscribe();this._hasTextureSubscription.unsubscribe();this._updateBackgroundSubscription.unsubscribe();this._updateTextureImageSubscription.unsubscribe();this._textureProviderSubscriptionPrev.unsubscribe();this._setTextureProviderSubscriptionPrev.unsubscribe();this._setTileSizeSubscriptionPrev.unsubscribe();this._abortTextureProviderSubscriptionPrev.unsubscribe();this._setRegionOfInterestSubscriptionPrev.unsubscribe();this._hasTextureSubscriptionPrev.unsubscribe();this._updateBackgroundSubscriptionPrev.unsubscribe();this._updateTextureImageSubscriptionPrev.unsubscribe();this.configure({keys:null})};e.prototype._getDefaultConfiguration=function(){return{initialPosition:1,mode:m.SliderMode.Motion,sliderVisible:true}};e.prototype._catchCacheNode$=function(r){return this._navigator.graphService.cacheNode$(r).pipe(v.catchError(function(e,t){console.error("Failed to cache slider node ("+r+")",e);return d.empty()}))};e.prototype._getBasicCorners=function(e,t){var r;var n;if(e>t){r=.5;n=.5*e/t}else{r=.5*t/e;n=.5}return[[.5-r,.5-n],[.5+r,.5+n]]};e.prototype._clipBoundingBox=function(e){e.minX=Math.max(0,Math.min(1,e.minX));e.maxX=Math.max(0,Math.min(1,e.maxX));e.minY=Math.max(0,Math.min(1,e.minY));e.maxY=Math.max(0,Math.min(1,e.maxY))};e.componentName="slider";return e}(m.Component);r.SliderComponent=i;m.ComponentService.register(i);r.default=i},{"../../Component":291,"../../Geo":294,"../../Render":297,"../../State":298,"../../Tiles":300,"../../Utils":301,rxjs:43,"rxjs/operators":241}],358:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SliderDOMRenderer=void 0;var n=e("rxjs");var i=e("rxjs/operators");var l=e("virtual-dom");var o=e("../../Component");var a=function(){function e(e){this._container=e;this._interacting=false;this._notifyModeChanged$=new n.Subject;this._notifyPositionChanged$=new n.Subject;this._stopInteractionSubscription=null}Object.defineProperty(e.prototype,"mode$",{get:function(){return this._notifyModeChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"position$",{get:function(){return this._notifyPositionChanged$},enumerable:false,configurable:true});e.prototype.activate=function(){var t=this;if(!!this._stopInteractionSubscription){return}this._stopInteractionSubscription=n.merge(this._container.mouseService.documentMouseUp$,this._container.touchService.touchEnd$.pipe(i.filter(function(e){return e.touches.length===0}))).subscribe(function(e){if(t._interacting){t._interacting=false}})};e.prototype.deactivate=function(){if(!this._stopInteractionSubscription){return}this._interacting=false;this._stopInteractionSubscription.unsubscribe();this._stopInteractionSubscription=null};e.prototype.render=function(e,t,r,n,i){var o=[];if(i){o.push(l.h("div.SliderBorder",[]));var a=!(r||n);if(a){o.push(this._createModeButton(t));o.push(this._createModeButton2d(t))}o.push(this._createPositionInput(e,a))}var s=this._container.domContainer.getBoundingClientRect();var u=Math.max(215,Math.min(400,s.width-100));return l.h("div.SliderContainer",{style:{width:u+"px"}},o)};e.prototype._createModeButton=function(e){var t=this;var r={onclick:function(){if(e===o.SliderMode.Motion){return}t._notifyModeChanged$.next(o.SliderMode.Motion)}};var n=e===o.SliderMode.Stationary?"SliderModeButtonDisabled":"SliderModeButton";return l.h("div."+n,r,[l.h("div.SliderModeIcon",[])])};e.prototype._createModeButton2d=function(e){var t=this;var r={onclick:function(){if(e===o.SliderMode.Stationary){return}t._notifyModeChanged$.next(o.SliderMode.Stationary)}};var n=e===o.SliderMode.Motion?"SliderModeButton2dDisabled":"SliderModeButton2d";return l.h("div."+n,r,[l.h("div.SliderModeIcon2d",[])])};e.prototype._createPositionInput=function(e,t){var r=this;var n=function(e){r._notifyPositionChanged$.next(Number(e.target.value)/1e3)};var i=function(e){r._interacting=true;e.stopPropagation()};var o=function(e){if(r._interacting){e.stopPropagation()}};var a=function(e){if(e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="ArrowUp"){e.preventDefault()}};var s=this._container.domContainer.getBoundingClientRect();var u=Math.max(215,Math.min(400,s.width-105))-84+(t?0:52);var c=l.h("input.SliderPosition",{max:1e3,min:0,onchange:n,oninput:n,onkeydown:a,onmousedown:i,onmousemove:o,ontouchmove:o,ontouchstart:i,style:{width:u+"px"},type:"range",value:1e3*e},[]);return l.h("div.SliderPositionContainer",[c])};return e}();r.SliderDOMRenderer=a;r.default=a},{"../../Component":291,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],359:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SliderGLRenderer=void 0;var T=e("../../Component");var E=e("../../Geo");var n=function(){function e(){this._factory=new T.MeshFactory;this._scene=new T.MeshScene;this._spatial=new E.Spatial;this._currentKey=null;this._previousKey=null;this._disabled=false;this._curtain=1;this._frameId=0;this._needsRender=false;this._mode=null;this._currentProviderDisposers={};this._previousProviderDisposers={}}Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:false,configurable:true});e.prototype.setTextureProvider=function(e,t){this._setTextureProvider(e,this._currentKey,t,this._currentProviderDisposers,this._updateTexture.bind(this))};e.prototype.setTextureProviderPrev=function(e,t){this._setTextureProvider(e,this._previousKey,t,this._previousProviderDisposers,this._updateTexturePrev.bind(this))};e.prototype.update=function(e,t){this._updateFrameId(e.id);this._updateImagePlanes(e.state,t)};e.prototype.updateCurtain=function(e){if(this._curtain===e){return}this._curtain=e;this._updateCurtain();this._needsRender=true};e.prototype.updateTexture=function(e,t){var r=t.key===this._currentKey?this._scene.planes:t.key===this._previousKey?this._scene.planesOld:{};if(Object.keys(r).length===0){return}this._needsRender=true;for(var n in r){if(!r.hasOwnProperty(n)){continue}var i=r[n];var o=i.material;var a=o.uniforms.projectorTex.value;a.image=e;a.needsUpdate=true}};e.prototype.updateTextureImage=function(e,t){if(this._currentKey!==t.key){return}this._needsRender=true;var r=this._scene.planes;for(var n in r){if(!r.hasOwnProperty(n)){continue}var i=r[n];var o=i.material;var a=o.uniforms.projectorTex.value;a.image=e;a.needsUpdate=true}};e.prototype.render=function(e,t){if(!this.disabled){t.render(this._scene.sceneOld,e)}t.render(this._scene.scene,e);this._needsRender=false};e.prototype.dispose=function(){this._scene.clear();for(var e in this._currentProviderDisposers){if(!this._currentProviderDisposers.hasOwnProperty(e)){continue}this._currentProviderDisposers[e]()}for(var e in this._previousProviderDisposers){if(!this._previousProviderDisposers.hasOwnProperty(e)){continue}this._previousProviderDisposers[e]()}this._currentProviderDisposers={};this._previousProviderDisposers={}};e.prototype._getBasicCorners=function(e,t){var r;var n;if(e>t){r=.5;n=.5*e/t}else{r=.5*t/e;n=.5}return[[.5-r,.5-n],[.5+r,.5+n]]};e.prototype._setDisabled=function(e){this._disabled=e.currentNode==null||e.previousNode==null||e.currentNode.pano&&!e.currentNode.fullPano||e.previousNode.pano&&!e.previousNode.fullPano||e.currentNode.fullPano&&!e.previousNode.fullPano};e.prototype._setTextureProvider=function(e,t,r,n,i){var o=this;if(e!==t){return}var a=r.textureCreated$.subscribe(i);var s=r.textureUpdated$.subscribe(function(e){o._needsRender=true});var u=function(){a.unsubscribe();s.unsubscribe();r.dispose()};if(e in n){var c=n[e];c();delete n[e]}n[e]=u};e.prototype._updateCurtain=function(){var e=this._scene.planes;for(var t in e){if(!e.hasOwnProperty(t)){continue}var r=e[t];var n=r.material;if(!!n.uniforms.curtain){n.uniforms.curtain.value=this._curtain}}};e.prototype._updateFrameId=function(e){this._frameId=e};e.prototype._updateImagePlanes=function(e,t){var r=e.currentNode!=null&&this._currentKey!==e.currentNode.key;var n=e.previousNode!=null&&this._previousKey!==e.previousNode.key;var i=this._mode!==t;if(!(r||n||i)){return}this._setDisabled(e);this._needsRender=true;this._mode=t;var o=e.motionless||t===T.SliderMode.Stationary||e.currentNode.pano;if(this.disabled||n){if(this._previousKey in this._previousProviderDisposers){this._previousProviderDisposers[this._previousKey]();delete this._previousProviderDisposers[this._previousKey]}}if(this.disabled){this._scene.setImagePlanesOld({})}else{if(n||i){var a=e.previousNode;this._previousKey=a.key;var s=e.currentTransform.rt.elements;var u=[s[12],s[13],s[14]];var c=e.currentTransform.basicAspect;var l=e.previousTransform.basicAspect;var h=c>l?[1,l/c]:[c/l,1];var p=e.currentNode.rotation;var f=e.currentNode.width;var d=e.currentNode.height;if(a.fullPano){p=e.previousNode.rotation;u=this._spatial.rotate(this._spatial.opticalCenter(e.currentNode.rotation,u).toArray(),p).multiplyScalar(-1).toArray();f=e.previousNode.width;d=e.previousNode.height}var v=new E.Transform(e.currentNode.orientation,f,d,e.currentNode.focal,e.currentNode.scale,a.gpano,p,u,a.image,h);var m=undefined;if(a.fullPano){m=this._factory.createMesh(a,o||e.currentNode.fullPano?v:e.previousTransform)}else{if(o){var g=this._getBasicCorners(c,l),_=g[0],y=_[0],b=_[1],x=g[1],w=x[0],S=x[1];m=this._factory.createFlatMesh(e.previousNode,v,y,w,b,S)}else{m=this._factory.createMesh(e.previousNode,e.previousTransform)}}var M={};M[a.key]=m;this._scene.setImagePlanesOld(M)}}if(r||i){if(this._currentKey in this._currentProviderDisposers){this._currentProviderDisposers[this._currentKey]();delete this._currentProviderDisposers[this._currentKey]}this._currentKey=e.currentNode.key;var C={};if(e.currentNode.fullPano){C[e.currentNode.key]=this._factory.createCurtainMesh(e.currentNode,e.currentTransform)}else if(e.currentNode.pano&&!e.currentNode.fullPano){C[e.currentNode.key]=this._factory.createMesh(e.currentNode,e.currentTransform)}else{if(o){C[e.currentNode.key]=this._factory.createDistortedCurtainMesh(e.currentNode,e.currentTransform)}else{C[e.currentNode.key]=this._factory.createCurtainMesh(e.currentNode,e.currentTransform)}}this._scene.setImagePlanes(C);this._updateCurtain()}};e.prototype._updateTexture=function(e){this._needsRender=true;var t=this._scene.planes;for(var r in t){if(!t.hasOwnProperty(r)){continue}var n=t[r];var i=n.material;var o=i.uniforms.projectorTex.value;i.uniforms.projectorTex.value=null;o.dispose();i.uniforms.projectorTex.value=e}};e.prototype._updateTexturePrev=function(e){this._needsRender=true;var t=this._scene.planesOld;for(var r in t){if(!t.hasOwnProperty(r)){continue}var n=t[r];var i=n.material;var o=i.uniforms.projectorTex.value;i.uniforms.projectorTex.value=null;o.dispose();i.uniforms.projectorTex.value=e}};return e}();r.SliderGLRenderer=n;r.default=n},{"../../Component":291,"../../Geo":294}],360:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.CameraVisualizationMode=void 0;var n;(function(e){e[e["Default"]=0]="Default";e[e["Cluster"]=1]="Cluster";e[e["ConnectedComponent"]=2]="ConnectedComponent";e[e["Sequence"]=3]="Sequence"})(n=r.CameraVisualizationMode||(r.CameraVisualizationMode={}));r.default=n},{}],361:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./CameraVisualizationMode");Object.defineProperty(r,"CameraVisualizationMode",{enumerable:true,get:function(){return n.CameraVisualizationMode}})},{"./CameraVisualizationMode":360}],362:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SpatialDataCache=void 0;var o=e("latlon-geohash");var a=e("pako");var s=e("rxjs");var u=e("rxjs/operators");var c=e("../../Error");var l=e("../../Utils");var n=function(){function e(e){this._graphService=e;this._tiles={};this._cacheRequests={};this._clusterReconstructions={};this._clusterReconstructionTiles={};this._tileClusters={};this._cachingTiles$={};this._cachingClusterReconstructions$={}}e.prototype.cacheClusterReconstructions$=function(t){var r=this;if(!this.hasTile(t)){throw new Error("Cannot cache reconstructions of a non-existing tile.")}if(this.hasClusterReconstructions(t)){throw new Error("Cannot cache reconstructions that already exists.")}if(this.isCachingClusterReconstructions(t)){return this._cachingClusterReconstructions$[t]}var e=this.getTile(t).filter(function(e){return!!e.clusterKey}).map(function(e){return e.clusterKey}).filter(function(e,t,r){return r.indexOf(e)===t});this._tileClusters[t]=e;this._cacheRequests[t]=[];this._cachingClusterReconstructions$[t]=s.from(e).pipe(u.mergeMap(function(e){if(r._hasClusterReconstruction(e)){return s.of(r._getClusterReconstruction(e))}return r._getClusterReconstruction$(e,r._cacheRequests[t]).pipe(u.catchError(function(e){if(e instanceof c.AbortMapillaryError){return s.empty()}console.error(e);return s.empty()}))},6),u.filter(function(){return t in r._tileClusters}),u.tap(function(e){if(!r._hasClusterReconstruction(e.key)){r._clusterReconstructions[e.key]=e}if(!(e.key in r._clusterReconstructionTiles)){r._clusterReconstructionTiles[e.key]=[]}if(r._clusterReconstructionTiles[e.key].indexOf(t)===-1){r._clusterReconstructionTiles[e.key].push(t)}}),u.finalize(function(){if(t in r._cachingClusterReconstructions$){delete r._cachingClusterReconstructions$[t]}if(t in r._cacheRequests){delete r._cacheRequests[t]}}),u.publish(),u.refCount());return this._cachingClusterReconstructions$[t]};e.prototype.cacheTile$=function(r){var n=this;if(r.length!==8){throw new Error("Hash needs to be level 8.")}if(this.hasTile(r)){throw new Error("Cannot cache tile that already exists.")}if(this.isCachingTile(r)){return this._cachingTiles$[r]}var e=o.bounds(r);var t={lat:e.sw.lat,lon:e.sw.lon};var i={lat:e.ne.lat,lon:e.ne.lon};this._cachingTiles$[r]=this._graphService.cacheBoundingBox$(t,i).pipe(u.catchError(function(e){console.error(e);return s.empty()}),u.map(function(e){return e.map(function(e){return n._createNodeData(e)})}),u.filter(function(){return!(r in n._tiles)}),u.tap(function(e){var t;n._tiles[r]=[];(t=n._tiles[r]).push.apply(t,e);delete n._cachingTiles$[r]}),u.finalize(function(){if(r in n._cachingTiles$){delete n._cachingTiles$[r]}}),u.publish(),u.refCount());return this._cachingTiles$[r]};e.prototype.isCachingClusterReconstructions=function(e){return e in this._cachingClusterReconstructions$};e.prototype.isCachingTile=function(e){return e in this._cachingTiles$};e.prototype.hasClusterReconstructions=function(e){if(e in this._cachingClusterReconstructions$||!(e in this._tileClusters)){return false}for(var t=0,r=this._tileClusters[e];t<r.length;t++){var n=r[t];if(!(n in this._clusterReconstructions)){return false}}return true};e.prototype.hasTile=function(e){return!(e in this._cachingTiles$)&&e in this._tiles};e.prototype.getClusterReconstructions=function(e){var t=this;return e in this._tileClusters?this._tileClusters[e].map(function(e){return t._clusterReconstructions[e]}).filter(function(e){return!!e}):[]};e.prototype.getTile=function(e){return e in this._tiles?this._tiles[e]:[]};e.prototype.uncache=function(e){for(var t=0,r=Object.keys(this._cacheRequests);t<r.length;t++){var n=r[t];if(!!e&&e.indexOf(n)!==-1){continue}for(var i=0,o=this._cacheRequests[n];i<o.length;i++){var a=o[i];a.abort()}delete this._cacheRequests[n]}for(var s=0,u=Object.keys(this._tileClusters);s<u.length;s++){var n=u[s];if(!!e&&e.indexOf(n)!==-1){continue}for(var c=0,l=this._tileClusters[n];c<l.length;c++){var h=l[c];if(!(h in this._clusterReconstructionTiles)){continue}var p=this._clusterReconstructionTiles[h].indexOf(n);if(p===-1){continue}this._clusterReconstructionTiles[h].splice(p,1);if(this._clusterReconstructionTiles[h].length>0){continue}delete this._clusterReconstructionTiles[h];delete this._clusterReconstructions[h]}delete this._tileClusters[n]}for(var f=0,d=Object.keys(this._tiles);f<d.length;f++){var n=d[f];if(!!e&&e.indexOf(n)!==-1){continue}delete this._tiles[n]}};e.prototype._createNodeData=function(e){return{alt:e.alt,cameraProjection:e.cameraProjection,clusterKey:e.clusterKey,focal:e.focal,gpano:e.gpano,height:e.height,k1:e.ck1,k2:e.ck2,key:e.key,lat:e.latLon.lat,lon:e.latLon.lon,mergeCC:e.mergeCC,orientation:e.orientation,originalLat:e.originalLatLon.lat,originalLon:e.originalLatLon.lon,rotation:[e.rotation[0],e.rotation[1],e.rotation[2]],scale:e.scale,sequenceKey:e.sequenceKey,width:e.width}};e.prototype._getClusterReconstruction=function(e){return this._clusterReconstructions[e]};e.prototype._getClusterReconstruction$=function(o,e){return s.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",l.Urls.clusterReconstruction(o),true);i.responseType="arraybuffer";i.timeout=15e3;i.onload=function(){if(!i.response){n.error(new Error("Cluster reconstruction retreival failed ("+o+")"))}else{var e=a.inflate(i.response,{to:"string"});var t=JSON.parse(e);if(t.length<1){n.error(new Error("No cluster reconstruction exists ("+o+")"))}var r=t[0];r.key=o;n.next(r);n.complete()}};i.onerror=function(){n.error(new Error("Failed to get cluster reconstruction ("+o+")"))};i.ontimeout=function(){n.error(new Error("Cluster reconstruction request timed out ("+o+")"))};i.onabort=function(){n.error(new c.AbortMapillaryError("Cluster reconstruction request was aborted ("+o+")"))};e.push(i);i.send(null)})};e.prototype._hasClusterReconstruction=function(e){return e in this._clusterReconstructions};return e}();r.SpatialDataCache=n;r.default=n},{"../../Error":293,"../../Utils":301,"latlon-geohash":21,pako:23,rxjs:43,"rxjs/operators":241}],363:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.SpatialDataComponent=void 0;var d=e("latlon-geohash");var l=e("rxjs");var h=e("rxjs/operators");var o=e("../../Component");var a=e("../../Geo");var s=e("../../Render");var u=e("../../viewer/PlayService");var p=e("../../state/State");var f=e("./CameraVisualizationMode");var i=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t,r)||this;n._cache=new o.SpatialDataCache(r.graphService);n._scene=new o.SpatialDataScene(n._getDefaultConfiguration());n._viewportCoords=new a.ViewportCoords;n._geoCoords=new a.GeoCoords;return n}e.prototype._activate=function(){var c=this;this._earthControlsSubscription=this._configuration$.pipe(h.map(function(e){return e.earthControls}),h.distinctUntilChanged(),h.withLatestFrom(this._navigator.stateService.state$)).subscribe(function(e){var t=e[0],r=e[1];if(t&&r!==p.default.Earth){c._navigator.stateService.earth()}else if(!t&&r===p.default.Earth){c._navigator.stateService.traverse()}});var e=this._container.renderService.bearing$.pipe(h.map(function(e){var t="";if(e>292.5||e<=67.5){t+="n"}if(e>112.5&&e<=247.5){t+="s"}if(e>22.5&&e<=157.5){t+="e"}if(e>202.5&&e<=337.5){t+="w"}return t}),h.distinctUntilChanged(),h.publishReplay(1),h.refCount());var t=this._navigator.stateService.reference$.pipe(h.tap(function(){c._scene.uncache()}),h.switchMap(function(){return c._navigator.stateService.currentNode$.pipe(h.map(function(e){return d.encode(e.latLon.lat,e.latLon.lon,8)}),h.distinctUntilChanged())}),h.publishReplay(1),h.refCount());var r=l.combineLatest(this._navigator.playService.playing$,this._navigator.playService.speed$).pipe(h.map(function(e){var t=e[0],r=e[1];return t&&r>u.default.sequenceSpeed}),h.distinctUntilChanged(),h.publishReplay(1),h.refCount());var n=l.combineLatest(this._navigator.stateService.state$.pipe(h.map(function(e){return e===p.default.Earth}),h.distinctUntilChanged()),t,r,e).pipe(h.distinctUntilChanged(function(e,t){var r=e[0],n=e[1],i=e[2],o=e[3];var a=t[0],s=t[1],u=t[2],c=t[3];if(r!==a){return false}if(r){return n===s&&i===u}return n===s&&i===u&&o===c}),h.concatMap(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];if(t){return n?l.of([r]):l.of(c._adjacentComponent(r,4))}return n?l.of([r,d.neighbours(r)[i]]):l.of(c._computeTiles(r,i))}),h.publish(),h.refCount());var i=n.pipe(h.switchMap(function(e){return l.from(e).pipe(h.mergeMap(function(e){var t=c._cache.hasTile(e)?l.of(c._cache.getTile(e)):c._cache.cacheTile$(e);return l.combineLatest(l.of(e),t)},6))}),h.publish(),h.refCount());this._addTileSubscription=i.pipe(h.withLatestFrom(this._navigator.stateService.reference$)).subscribe(function(e){var t=e[0][0],r=e[1];if(c._scene.hasTile(t)){return}c._scene.addTile(c._computeTileBBox(t,r),t)});this._addNodeSubscription=i.pipe(h.withLatestFrom(this._navigator.stateService.reference$)).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];for(var o=0,a=n;o<a.length;o++){var s=a[o];if(c._scene.hasNode(s.key,r)){continue}c._scene.addNode(s,c._createTransform(s,i),c._computeOriginalPosition(s,i),r)}});this._addReconstructionSubscription=i.pipe(h.concatMap(function(e){var t=e[0];var r;if(c._cache.hasClusterReconstructions(t)){r=l.from(c._cache.getClusterReconstructions(t))}else if(c._cache.isCachingClusterReconstructions(t)){r=c._cache.cacheClusterReconstructions$(t).pipe(h.last(null,{}),h.switchMap(function(){return l.from(c._cache.getClusterReconstructions(t))}))}else if(c._cache.hasTile(t)){r=c._cache.cacheClusterReconstructions$(t)}else{r=l.empty()}return l.combineLatest(l.of(t),r)}),h.withLatestFrom(this._navigator.stateService.reference$)).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];if(c._scene.hasClusterReconstruction(n.key,r)){return}c._scene.addClusterReconstruction(n,c._computeTranslation(n,i),r)});this._cameraVisibilitySubscription=this._configuration$.pipe(h.map(function(e){return e.camerasVisible}),h.distinctUntilChanged()).subscribe(function(e){c._scene.setCameraVisibility(e)});this._pointVisibilitySubscription=this._configuration$.pipe(h.map(function(e){return e.pointsVisible}),h.distinctUntilChanged()).subscribe(function(e){c._scene.setPointVisibility(e)});this._positionVisibilitySubscription=this._configuration$.pipe(h.map(function(e){return e.positionsVisible}),h.distinctUntilChanged()).subscribe(function(e){c._scene.setPositionVisibility(e)});this._tileVisibilitySubscription=this._configuration$.pipe(h.map(function(e){return e.tilesVisible}),h.distinctUntilChanged()).subscribe(function(e){c._scene.setTileVisibility(e)});this._ccToModeSubscription=this._configuration$.pipe(h.map(function(e){return e.connectedComponents===true?f.default.ConnectedComponent:f.default.Default}),h.distinctUntilChanged()).subscribe(function(e){c.configure({cameraVisualizationMode:e})});this._cameraVisualizationModeSubscription=this._configuration$.pipe(h.map(function(e){return e.cameraVisualizationMode}),h.distinctUntilChanged()).subscribe(function(e){c._scene.setCameraVisualizationMode(e)});this._uncacheSubscription=t.subscribe(function(e){var t=c._adjacentComponent(e,4);c._scene.uncache(t);c._cache.uncache(t)});this._moveSubscription=this._navigator.playService.playing$.pipe(h.switchMap(function(e){return e?l.empty():c._container.mouseService.dblClick$}),h.withLatestFrom(this._container.renderService.renderCamera$),h.switchMap(function(e){var t=e[0],r=e[1];var n=c._container.element;var i=c._viewportCoords.canvasPosition(t,n),o=i[0],a=i[1];var s=c._viewportCoords.canvasToViewport(o,a,n);var u=c._scene.intersectObjects(s,r.perspective);return!!u?c._navigator.moveToKey$(u).pipe(h.catchError(function(){return l.empty()})):l.empty()})).subscribe();this._renderSubscription=this._navigator.stateService.currentState$.pipe(h.map(function(e){var t=c._scene;return{name:c._name,render:{frameId:e.id,needsRender:t.needsRender,render:t.render.bind(t),stage:s.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$)};e.prototype._deactivate=function(){var t=this;this._cache.uncache();this._scene.uncache();this._addNodeSubscription.unsubscribe();this._addReconstructionSubscription.unsubscribe();this._addTileSubscription.unsubscribe();this._cameraVisibilitySubscription.unsubscribe();this._earthControlsSubscription.unsubscribe();this._moveSubscription.unsubscribe();this._pointVisibilitySubscription.unsubscribe();this._positionVisibilitySubscription.unsubscribe();this._renderSubscription.unsubscribe();this._tileVisibilitySubscription.unsubscribe();this._uncacheSubscription.unsubscribe();this._cameraVisualizationModeSubscription.unsubscribe();this._ccToModeSubscription.unsubscribe();this._navigator.stateService.state$.pipe(h.first()).subscribe(function(e){if(e===p.default.Earth){t._navigator.stateService.traverse()}})};e.prototype._getDefaultConfiguration=function(){return{cameraVisualizationMode:f.default.Default,camerasVisible:false,connectedComponents:false,pointsVisible:true,positionsVisible:false,tilesVisible:false}};e.prototype._adjacentComponent=function(e,t){var r=new Set;r.add(e);this._adjacentComponentRecursive(r,[e],0,t);return this._setToArray(r)};e.prototype._adjacentComponentRecursive=function(e,t,r,n){if(r===n){return}var i=[];for(var o=0,a=t;o<a.length;o++){var s=a[o];var u=d.neighbours(s);for(var c in u){if(!u.hasOwnProperty(c)){continue}i.push(u[c])}}var l=[];for(var h=0,p=i;h<p.length;h++){var f=p[h];if(!e.has(f)){e.add(f);l.push(f)}}this._adjacentComponentRecursive(e,l,r+1,n)};e.prototype._computeOriginalPosition=function(e,t){return this._geoCoords.geodeticToEnu(e.originalLat,e.originalLon,e.alt,t.lat,t.lon,t.alt)};e.prototype._computeTileBBox=function(e,t){var r=d.bounds(e);var n=this._geoCoords.geodeticToEnu(r.sw.lat,r.sw.lon,0,t.lat,t.lon,t.alt);var i=this._geoCoords.geodeticToEnu(r.ne.lat,r.ne.lon,0,t.lat,t.lon,t.alt);return[n,i]};e.prototype._createTransform=function(e,t){var r=a.Geo.computeTranslation({alt:e.alt,lat:e.lat,lon:e.lon},e.rotation,t);var n=new a.Transform(e.orientation,e.width,e.height,e.focal,e.scale,e.gpano,e.rotation,r,undefined,undefined,e.k1,e.k2,e.cameraProjection);return n};e.prototype._computeTiles=function(e,t){var r=new Set;var n=["n","ne","e","se","s","sw","w","nw"];this._computeTilesRecursive(r,e,t,n,0,2);return this._setToArray(r)};e.prototype._computeTilesRecursive=function(e,t,r,n,i,o){e.add(t);if(i===o){return}var a=d.neighbours(t);var s=n.indexOf(r);var u=n.length;var c=[a[n[this._modulo(s-1,u)]],a[r],a[n[this._modulo(s+1,u)]]];for(var l=0,h=c;l<h.length;l++){var p=h[l];this._computeTilesRecursive(e,p,r,n,i+1,o)}};e.prototype._computeTranslation=function(e,t){return this._geoCoords.geodeticToEnu(e.reference_lla.latitude,e.reference_lla.longitude,e.reference_lla.altitude,t.lat,t.lon,t.alt)};e.prototype._modulo=function(e,t){return(e%t+t)%t};e.prototype._setToArray=function(e){var t=[];e.forEach(function(e){t.push(e)});return t};e.componentName="spatialData";return e}(o.Component);r.SpatialDataComponent=i;o.ComponentService.register(i);r.default=i},{"../../Component":291,"../../Geo":294,"../../Render":297,"../../state/State":449,"../../viewer/PlayService":481,"./CameraVisualizationMode":360,"latlon-geohash":21,rxjs:43,"rxjs/operators":241}],364:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SpatialDataScene=void 0;var d=e("three");var h=e("./CameraVisualizationMode");var n=function(){function e(e,t,r){this._scene=!!t?t:new d.Scene;this._raycaster=!!r?r:new d.Raycaster(undefined,undefined,.8);this._cameraColors={};this._needsRender=false;this._interactiveObjects=[];this._nodes={};this._tiles={};this._tileClusterReconstructions={};this._clusterReconstructions={};this._cameraVisualizationMode=!!e.cameraVisualizationMode?e.cameraVisualizationMode:h.default.Default;if(this._cameraVisualizationMode===h.default.Default&&e.connectedComponents===true){this._cameraVisualizationMode=h.default.ConnectedComponent}this._camerasVisible=e.camerasVisible;this._pointsVisible=e.pointsVisible;this._positionsVisible=e.positionsVisible;this._tilesVisible=e.tilesVisible}Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:false,configurable:true});e.prototype.addClusterReconstruction=function(e,t,r){if(this.hasClusterReconstruction(e.key,r)){return}var n=e.key;if(!(n in this._clusterReconstructions)){this._clusterReconstructions[n]={points:new d.Object3D,tiles:[]};this._clusterReconstructions[n].points.visible=this._pointsVisible;this._clusterReconstructions[n].points.add(this._createClusterPoints(e,t));this._scene.add(this._clusterReconstructions[n].points)}if(this._clusterReconstructions[n].tiles.indexOf(r)===-1){this._clusterReconstructions[n].tiles.push(r)}if(!(r in this._tileClusterReconstructions)){this._tileClusterReconstructions[r]={keys:[]}}if(this._tileClusterReconstructions[r].keys.indexOf(n)===-1){this._tileClusterReconstructions[r].keys.push(n)}this._needsRender=true};e.prototype.addNode=function(e,t,r,n){var i=e.key;var o=e.clusterKey;var a=e.sequenceKey;var s=!!e.mergeCC?e.mergeCC.toString():"";if(this.hasNode(i,n)){return}if(!(n in this._nodes)){this._nodes[n]={cameraKeys:{},cameras:new d.Object3D,clusters:{},connectedComponents:{},keys:[],positions:new d.Object3D,sequences:{}};this._nodes[n].cameras.visible=this._camerasVisible;this._nodes[n].positions.visible=this._positionsVisible;this._scene.add(this._nodes[n].cameras,this._nodes[n].positions)}if(!(s in this._nodes[n].connectedComponents)){this._nodes[n].connectedComponents[s]=[]}if(!(o in this._nodes[n].clusters)){this._nodes[n].clusters[o]=[]}if(!(a in this._nodes[n].sequences)){this._nodes[n].sequences[a]=[]}var u=this._createCamera(t);this._nodes[n].cameras.add(u);for(var c=0,l=u.children;c<l.length;c++){var h=l[c];this._nodes[n].cameraKeys[h.uuid]=i;this._interactiveObjects.push(h)}this._nodes[n].connectedComponents[s].push(u);this._nodes[n].clusters[o].push(u);this._nodes[n].sequences[a].push(u);var p=this._getId(o,s,a,this._cameraVisualizationMode);var f=this._getColor(p,this._cameraVisualizationMode);this._setCameraColor(f,u);this._nodes[n].positions.add(this._createPosition(t,r));this._nodes[n].keys.push(i);this._needsRender=true};e.prototype.addTile=function(e,t){if(this.hasTile(t)){return}var r=e[0];var n=e[1];var i=new d.Geometry;i.vertices.push((new d.Vector3).fromArray(r),new d.Vector3(r[0],n[1],(r[2]+n[2])/2),(new d.Vector3).fromArray(n),new d.Vector3(n[0],r[1],(r[2]+n[2])/2),(new d.Vector3).fromArray(r));var o=new d.Line(i,new d.LineBasicMaterial);this._tiles[t]=new d.Object3D;this._tiles[t].visible=this._tilesVisible;this._tiles[t].add(o);this._scene.add(this._tiles[t]);this._needsRender=true};e.prototype.uncache=function(e){for(var t=0,r=Object.keys(this._tileClusterReconstructions);t<r.length;t++){var n=r[t];if(!!e&&e.indexOf(n)!==-1){continue}this._disposeReconstruction(n)}for(var i=0,o=Object.keys(this._nodes);i<o.length;i++){var n=o[i];if(!!e&&e.indexOf(n)!==-1){continue}this._disposeNodes(n)}for(var a=0,s=Object.keys(this._tiles);a<s.length;a++){var n=s[a];if(!!e&&e.indexOf(n)!==-1){continue}this._disposeTile(n)}this._needsRender=true};e.prototype.hasClusterReconstruction=function(e,t){return e in this._clusterReconstructions&&this._clusterReconstructions[e].tiles.indexOf(t)!==-1};e.prototype.hasTile=function(e){return e in this._tiles};e.prototype.hasNode=function(e,t){return t in this._nodes&&this._nodes[t].keys.indexOf(e)!==-1};e.prototype.intersectObjects=function(e,t){var r=e[0],n=e[1];if(!this._camerasVisible){return null}this._raycaster.setFromCamera(new d.Vector2(r,n),t);var i=this._raycaster.intersectObjects(this._interactiveObjects);for(var o=0,a=i;o<a.length;o++){var s=a[o];for(var u in this._nodes){if(!this._nodes.hasOwnProperty(u)){continue}if(s.object.uuid in this._nodes[u].cameraKeys){return this._nodes[u].cameraKeys[s.object.uuid]}}}return null};e.prototype.setCameraVisibility=function(e){if(e===this._camerasVisible){return}for(var t in this._nodes){if(!this._nodes.hasOwnProperty(t)){continue}this._nodes[t].cameras.visible=e}this._camerasVisible=e;this._needsRender=true};e.prototype.setPointVisibility=function(e){if(e===this._pointsVisible){return}for(var t in this._clusterReconstructions){if(!this._clusterReconstructions.hasOwnProperty(t)){continue}this._clusterReconstructions[t].points.visible=e}this._pointsVisible=e;this._needsRender=true};e.prototype.setPositionVisibility=function(e){if(e===this._positionsVisible){return}for(var t in this._nodes){if(!this._nodes.hasOwnProperty(t)){continue}this._nodes[t].positions.visible=e}this._positionsVisible=e;this._needsRender=true};e.prototype.setTileVisibility=function(e){if(e===this._tilesVisible){return}for(var t in this._tiles){if(!this._tiles.hasOwnProperty(t)){continue}this._tiles[t].visible=e}this._tilesVisible=e;this._needsRender=true};e.prototype.setCameraVisualizationMode=function(e){if(e===this._cameraVisualizationMode){return}for(var t in this._nodes){if(!this._nodes.hasOwnProperty(t)){continue}var r=undefined;if(e===h.default.Cluster){r=this._nodes[t].clusters}else if(e===h.default.ConnectedComponent){r=this._nodes[t].connectedComponents}else if(e===h.default.Sequence){r=this._nodes[t].sequences}else{for(var n=0,i=this._nodes[t].cameras.children;n<i.length;n++){var o=i[n];var a=this._getColor("",e);this._setCameraColor(a,o)}continue}for(var s in r){if(!r.hasOwnProperty(s)){continue}var a=this._getColor(s,e);for(var u=0,c=r[s];u<c.length;u++){var l=c[u];this._setCameraColor(a,l)}}}this._cameraVisualizationMode=e;this._needsRender=true};e.prototype.render=function(e,t){t.render(this._scene,e);this._needsRender=false};e.prototype._arrayToFloatArray=function(e,t){var r=e.length;var n=new Float32Array(r*t);for(var i=0;i<r;i++){var o=e[i];var a=3*i;n[a+0]=o[0];n[a+1]=o[1];n[a+2]=o[2]}return n};e.prototype._createAxis=function(e){var t=e.unprojectBasic([.5,0],.22);var r=e.unprojectBasic([.5,1],.16);var n=new d.BufferGeometry;n.setAttribute("position",new d.BufferAttribute(this._arrayToFloatArray([t,r],3),3));return new d.Line(n,new d.LineBasicMaterial)};e.prototype._createCamera=function(e){return!!e.gpano?this._createPanoCamera(e):this._createPrespectiveCamera(e)};e.prototype._createDiagonals=function(e,t){var r=e.unprojectBasic([0,0],0,true);var n=e.unprojectBasic([0,0],t,true);var i=e.unprojectBasic([1,0],t,true);var o=e.unprojectBasic([1,1],t,true);var a=e.unprojectBasic([0,1],t,true);var s=[r,n,r,i,r,o,r,a];var u=new d.BufferGeometry;u.setAttribute("position",new d.BufferAttribute(this._arrayToFloatArray(s,3),3));return new d.LineSegments(u,new d.LineBasicMaterial)};e.prototype._createFrame=function(t,r){var e=[];e.push.apply(e,this._subsample([0,1],[0,0],20));e.push.apply(e,this._subsample([0,0],[1,0],20));e.push.apply(e,this._subsample([1,0],[1,1],20));var n=e.map(function(e){return t.unprojectBasic(e,r,true)});var i=new d.BufferGeometry;i.setAttribute("position",new d.BufferAttribute(this._arrayToFloatArray(n,3),3));return new d.Line(i,new d.LineBasicMaterial)};e.prototype._createLatitude=function(e,t,r){var n=new Float32Array((t+1)*3);for(var i=0;i<=t;i++){var o=r.unprojectBasic([i/t,e],.16);var a=3*i;n[a+0]=o[0];n[a+1]=o[1];n[a+2]=o[2]}var s=new d.BufferGeometry;s.setAttribute("position",new d.BufferAttribute(n,3));return new d.Line(s,new d.LineBasicMaterial)};e.prototype._createLongitude=function(e,t,r){var n=new Float32Array((t+1)*3);for(var i=0;i<=t;i++){var o=r.unprojectBasic([e,i/t],.16);var a=3*i;n[a+0]=o[0];n[a+1]=o[1];n[a+2]=o[2]}var s=new d.BufferGeometry;s.setAttribute("position",new d.BufferAttribute(n,3));return new d.Line(s,new d.LineBasicMaterial)};e.prototype._createPanoCamera=function(e){var t=new d.Object3D;t.children.push(this._createAxis(e));t.children.push(this._createLatitude(.5,10,e));t.children.push(this._createLongitude(0,6,e));t.children.push(this._createLongitude(.25,6,e));t.children.push(this._createLongitude(.5,6,e));t.children.push(this._createLongitude(.75,6,e));return t};e.prototype._createClusterPoints=function(t,e){var r=Object.keys(t.points).map(function(e){return t.points[e]});var n=r.length;var i=new Float32Array(n*3);var o=new Float32Array(n*3);for(var a=0;a<n;a++){var s=3*a;var u=r[a].coordinates;var c=new d.Vector3(u[0],u[1],u[2]).add((new d.Vector3).fromArray(e));i[s+0]=c.x;i[s+1]=c.y;i[s+2]=c.z;var l=r[a].color;o[s+0]=l[0]/255;o[s+1]=l[1]/255;o[s+2]=l[2]/255}var h=new d.BufferGeometry;h.setAttribute("position",new d.BufferAttribute(i,3));h.setAttribute("color",new d.BufferAttribute(o,3));var p=new d.PointsMaterial({size:.1,vertexColors:true});return new d.Points(h,p)};e.prototype._createPosition=function(e,t){var r=e.unprojectBasic([0,0],0);var n=[t,r];var i=new d.BufferGeometry;i.setAttribute("position",new d.BufferAttribute(this._arrayToFloatArray(n,3),3));return new d.Line(i,new d.LineBasicMaterial({color:new d.Color(1,0,0)}))};e.prototype._createPrespectiveCamera=function(e){var t=.2;var r=new d.Object3D;r.children.push(this._createDiagonals(e,t));r.children.push(this._createFrame(e,t));return r};e.prototype._disposeCameras=function(e){var t=this._nodes[e].cameras;for(var r=0,n=t.children.slice();r<n.length;r++){var i=n[r];for(var o=0,a=i.children;o<a.length;o++){var s=a[o];s.geometry.dispose();s.material.dispose();var u=this._interactiveObjects.indexOf(s);if(u!==-1){this._interactiveObjects.splice(u,1)}else{console.warn("Object does not exist ("+s.id+") for "+e)}}t.remove(i)}this._scene.remove(t)};e.prototype._disposePoints=function(e){for(var t=0,r=this._tileClusterReconstructions[e].keys;t<r.length;t++){var n=r[t];if(!(n in this._clusterReconstructions)){continue}var i=this._clusterReconstructions[n].tiles.indexOf(e);if(i===-1){continue}this._clusterReconstructions[n].tiles.splice(i,1);if(this._clusterReconstructions[n].tiles.length>0){continue}for(var o=0,a=this._clusterReconstructions[n].points.children.slice();o<a.length;o++){var s=a[o];s.geometry.dispose();s.material.dispose()}this._scene.remove(this._clusterReconstructions[n].points);delete this._clusterReconstructions[n]}};e.prototype._disposePositions=function(e){var t=this._nodes[e].positions;for(var r=0,n=t.children.slice();r<n.length;r++){var i=n[r];i.geometry.dispose();i.material.dispose();t.remove(i)}this._scene.remove(t)};e.prototype._disposeNodes=function(e){this._disposeCameras(e);this._disposePositions(e);delete this._nodes[e]};e.prototype._disposeReconstruction=function(e){this._disposePoints(e);delete this._tileClusterReconstructions[e]};e.prototype._disposeTile=function(e){var t=this._tiles[e];for(var r=0,n=t.children.slice();r<n.length;r++){var i=n[r];i.geometry.dispose();i.material.dispose();t.remove(i)}this._scene.remove(t);delete this._tiles[e]};e.prototype._getColor=function(e,t){return t!==h.default.Default&&e.length>0?this._getCameraColor(e):"#FFFFFF"};e.prototype._getCameraColor=function(e){if(!(e in this._cameraColors)){this._cameraColors[e]=this._randomColor()}return this._cameraColors[e]};e.prototype._getId=function(e,t,r,n){switch(n){case h.default.Cluster:return e;case h.default.ConnectedComponent:return t;case h.default.Sequence:return r;default:return""}};e.prototype._interpolate=function(e,t,r){return e+r*(t-e)};e.prototype._randomColor=function(){return"hsl("+Math.floor(360*Math.random())+", 100%, 65%)"};e.prototype._setCameraColor=function(e,t){for(var r=0,n=t.children;r<n.length;r++){var i=n[r];i.material.color=new d.Color(e)}};e.prototype._subsample=function(e,t,r){if(r<1){return[e,t]}var n=[];for(var i=0;i<=r+1;i++){var o=[];for(var a=0;a<3;a++){o.push(this._interpolate(e[a],t[a],i/(r+1)))}n.push(o)}return n};return e}();r.SpatialDataScene=n;r.default=n},{"./CameraVisualizationMode":360,three:242}],365:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],366:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var n=e("./error/GeometryTagError");Object.defineProperty(r,"GeometryTagError",{enumerable:true,get:function(){return n.GeometryTagError}});var i=e("./geometry/PointGeometry");Object.defineProperty(r,"PointGeometry",{enumerable:true,get:function(){return i.PointGeometry}});var o=e("./geometry/PointsGeometry");Object.defineProperty(r,"PointsGeometry",{enumerable:true,get:function(){return o.PointsGeometry}});var a=e("./geometry/RectGeometry");Object.defineProperty(r,"RectGeometry",{enumerable:true,get:function(){return a.RectGeometry}});var s=e("./geometry/PolygonGeometry");Object.defineProperty(r,"PolygonGeometry",{enumerable:true,get:function(){return s.PolygonGeometry}});var u=e("./tag/OutlineTag");Object.defineProperty(r,"OutlineTag",{enumerable:true,get:function(){return u.OutlineTag}});var c=e("./tag/ExtremePointTag");Object.defineProperty(r,"ExtremePointTag",{enumerable:true,get:function(){return c.ExtremePointTag}});var l=e("./tag/SpotTag");Object.defineProperty(r,"SpotTag",{enumerable:true,get:function(){return l.SpotTag}});var h=e("./tag/TagDomain");Object.defineProperty(r,"TagDomain",{enumerable:true,get:function(){return h.TagDomain}});var p=e("./TagComponent");Object.defineProperty(r,"TagComponent",{enumerable:true,get:function(){return p.TagComponent}});var f=e("./TagMode");Object.defineProperty(r,"TagMode",{enumerable:true,get:function(){return f.TagMode}})},{"./TagComponent":367,"./TagMode":370,"./error/GeometryTagError":374,"./geometry/PointGeometry":376,"./geometry/PointsGeometry":377,"./geometry/PolygonGeometry":378,"./geometry/RectGeometry":379,"./tag/ExtremePointTag":394,"./tag/OutlineTag":398,"./tag/SpotTag":401,"./tag/TagDomain":403}],367:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.TagComponent=void 0;var s=e("rxjs");var u=e("rxjs/operators");var a=e("when");var c=e("../../Component");var l=e("../../Geo");var h=e("../../Render");var i=function(i){n(o,i);function o(e,t,r){var n=i.call(this,e,t,r)||this;n._tagDomRenderer=new c.TagDOMRenderer;n._tagScene=new c.TagScene;n._tagSet=new c.TagSet;n._tagCreator=new c.TagCreator(n,r);n._viewportCoords=new l.ViewportCoords;n._createHandlers={CreatePoint:new c.CreatePointHandler(n,t,r,n._viewportCoords,n._tagCreator),CreatePoints:new c.CreatePointsHandler(n,t,r,n._viewportCoords,n._tagCreator),CreatePolygon:new c.CreatePolygonHandler(n,t,r,n._viewportCoords,n._tagCreator),CreateRect:new c.CreateRectHandler(n,t,r,n._viewportCoords,n._tagCreator),CreateRectDrag:new c.CreateRectDragHandler(n,t,r,n._viewportCoords,n._tagCreator),Default:undefined};n._editVertexHandler=new c.EditVertexHandler(n,t,r,n._viewportCoords,n._tagSet);n._renderTags$=n._tagSet.changed$.pipe(u.map(function(e){var t=e.getAll();t.sort(function(e,t){var r=e.tag.id;var n=t.tag.id;if(r<n){return-1}if(r>n){return 1}return 0});return t}),u.share());n._tagChanged$=n._renderTags$.pipe(u.switchMap(function(e){return s.from(e).pipe(u.mergeMap(function(e){return s.merge(e.tag.changed$,e.tag.geometryChanged$)}))}),u.share());n._renderTagGLChanged$=n._renderTags$.pipe(u.switchMap(function(e){return s.from(e).pipe(u.mergeMap(function(e){return e.glObjectsChanged$}))}),u.share());n._createGeometryChanged$=n._tagCreator.tag$.pipe(u.switchMap(function(e){return e!=null?e.geometryChanged$:s.empty()}),u.share());n._createGLObjectsChanged$=n._tagCreator.tag$.pipe(u.switchMap(function(e){return e!=null?e.glObjectsChanged$:s.empty()}),u.share());n._creatingConfiguration$=n._configuration$.pipe(u.distinctUntilChanged(function(e,t){return e.mode===t.mode},function(e){return{createColor:e.createColor,mode:e.mode}}),u.publishReplay(1),u.refCount());n._creatingConfiguration$.subscribe(function(e){n.fire(o.modechanged,e.mode)});return n}o.prototype.add=function(r){var n=this;if(this._activated){this._navigator.stateService.currentTransform$.pipe(u.first()).subscribe(function(e){n._tagSet.add(r,e);var t=r.map(function(e){return n._tagSet.get(e.id)});n._tagScene.add(t)})}else{this._tagSet.addDeactivated(r)}};o.prototype.calculateRect=function(n){var e=this;return a.promise(function(t,r){e._navigator.stateService.currentTransform$.pipe(u.first(),u.map(function(e){return n.getRect2d(e)})).subscribe(function(e){t(e)},function(e){r(e)})})};o.prototype.create=function(){this._tagCreator.replayedTag$.pipe(u.first(),u.filter(function(e){return!!e})).subscribe(function(e){e.create()})};o.prototype.changeMode=function(e){this.configure({mode:e})};o.prototype.get=function(e){if(this._activated){var t=this._tagSet.get(e);return t!==undefined?t.tag:undefined}else{return this._tagSet.getDeactivated(e)}};o.prototype.getAll=function(){if(this.activated){return this._tagSet.getAll().map(function(e){return e.tag})}else{return this._tagSet.getAllDeactivated()}};o.prototype.getTagIdsAt=function(n){var i=this;return a.promise(function(t,r){i._container.renderService.renderCamera$.pipe(u.first(),u.map(function(e){var t=i._viewportCoords.canvasToViewport(n[0],n[1],i._container.element);var r=i._tagScene.intersectObjects(t,e.perspective);return r})).subscribe(function(e){t(e)},function(e){r(e)})})};o.prototype.has=function(e){return this._activated?this._tagSet.has(e):this._tagSet.hasDeactivated(e)};o.prototype.remove=function(e){if(this._activated){this._tagSet.remove(e);this._tagScene.remove(e)}else{this._tagSet.removeDeactivated(e)}};o.prototype.removeAll=function(){if(this._activated){this._tagSet.removeAll();this._tagScene.removeAll()}else{this._tagSet.removeAllDeactivated()}};o.prototype._activate=function(){var a=this;this._editVertexHandler.enable();var e=s.from(Object.keys(this._createHandlers)).pipe(u.map(function(e){return a._createHandlers[e]}),u.filter(function(e){return!!e}),u.mergeMap(function(e){return e.geometryCreated$}),u.share());this._fireGeometryCreatedSubscription=e.subscribe(function(e){a.fire(o.geometrycreated,e)});this._fireCreateGeometryEventSubscription=this._tagCreator.tag$.pipe(u.skipWhile(function(e){return e==null}),u.distinctUntilChanged()).subscribe(function(e){var t=e!=null?o.creategeometrystart:o.creategeometryend;a.fire(t,a)});this._handlerStopCreateSubscription=e.subscribe(function(){a.changeMode(c.TagMode.Default)});this._handlerEnablerSubscription=this._creatingConfiguration$.subscribe(function(e){a._disableCreateHandlers();var t=c.TagMode[e.mode];var r=a._createHandlers[t];if(!!r){r.enable()}});this._fireTagsChangedSubscription=this._renderTags$.subscribe(function(){a.fire(o.tagschanged,a)});this._stopCreateSubscription=this._tagCreator.tag$.pipe(u.switchMap(function(e){return e!=null?e.aborted$.pipe(u.map(function(){return null})):s.empty()})).subscribe(function(){a.changeMode(c.TagMode.Default)});this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(e){if(a._tagScene.hasCreateTag()){a._tagScene.removeCreateTag()}if(e!=null){a._tagScene.addCreateTag(e)}});this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(e){a._tagScene.updateCreateTagObjects(e)});this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(e){a._tagScene.updateObjects(e)});this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(){a._tagScene.update()});this._domSubscription=s.combineLatest(this._renderTags$.pipe(u.startWith([]),u.tap(function(){a._container.domRenderer.render$.next({name:a._name,vnode:a._tagDomRenderer.clear()})})),this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.pipe(u.startWith(null)),s.merge(this._tagCreator.tag$,this._createGeometryChanged$).pipe(u.startWith(null))).pipe(u.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[5];return{name:a._name,vnode:a._tagDomRenderer.render(t,o,n,r.perspective,i)}})).subscribe(this._container.domRenderer.render$);this._glSubscription=this._navigator.stateService.currentState$.pipe(u.map(function(e){var t=a._tagScene;return{name:a._name,render:{frameId:e.id,needsRender:t.needsRender,render:t.render.bind(t),stage:h.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$);this._navigator.stateService.currentTransform$.pipe(u.first()).subscribe(function(e){a._tagSet.activate(e);a._tagScene.add(a._tagSet.getAll())})};o.prototype._deactivate=function(){this._editVertexHandler.disable();this._disableCreateHandlers();this._tagScene.clear();this._tagSet.deactivate();this._tagCreator.delete$.next(null);this._updateGLObjectsSubscription.unsubscribe();this._updateTagSceneSubscription.unsubscribe();this._stopCreateSubscription.unsubscribe();this._setGLCreateTagSubscription.unsubscribe();this._createGLObjectsChangedSubscription.unsubscribe();this._domSubscription.unsubscribe();this._glSubscription.unsubscribe();this._fireCreateGeometryEventSubscription.unsubscribe();this._fireGeometryCreatedSubscription.unsubscribe();this._fireTagsChangedSubscription.unsubscribe();this._handlerStopCreateSubscription.unsubscribe();this._handlerEnablerSubscription.unsubscribe();this._container.element.classList.remove("component-tag-create")};o.prototype._getDefaultConfiguration=function(){return{createColor:16777215,indicatePointsCompleter:true,mode:c.TagMode.Default}};o.prototype._disableCreateHandlers=function(){var e=this._createHandlers;for(var t in e){if(!e.hasOwnProperty(t)){continue}var r=e[t];if(!!r){r.disable()}}};o.componentName="tag";o.creategeometryend="creategeometryend";o.creategeometrystart="creategeometrystart";o.modechanged="modechanged";o.geometrycreated="geometrycreated";o.tagschanged="tagschanged";return o}(c.Component);r.TagComponent=i;c.ComponentService.register(i);r.default=i},{"../../Component":291,"../../Geo":294,"../../Render":297,rxjs:43,"rxjs/operators":241,when:288}],368:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TagCreator=void 0;var n=e("rxjs/operators");var i=e("rxjs");var o=e("../../Component");var a=function(){function e(e,t){this._component=e;this._navigator=t;this._tagOperation$=new i.Subject;this._createPoints$=new i.Subject;this._createPolygon$=new i.Subject;this._createRect$=new i.Subject;this._delete$=new i.Subject;this._tag$=this._tagOperation$.pipe(n.scan(function(e,t){return t(e)},null),n.share());this._replayedTag$=this._tag$.pipe(n.publishReplay(1),n.refCount());this._replayedTag$.subscribe();this._createPoints$.pipe(n.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$),n.map(function(e){var t=e[0],r=e[1],n=e[2];return function(){var e=new o.PointsGeometry([[t[0],t[1]],[t[0],t[1]]]);return new o.ExtremePointCreateTag(e,{color:r.createColor,indicateCompleter:r.indicatePointsCompleter},n)}})).subscribe(this._tagOperation$);this._createRect$.pipe(n.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$),n.map(function(e){var t=e[0],r=e[1],n=e[2];return function(){var e=new o.RectGeometry([t[0],t[1],t[0],t[1]]);return new o.OutlineCreateTag(e,{color:r.createColor},n)}})).subscribe(this._tagOperation$);this._createPolygon$.pipe(n.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$),n.map(function(e){var t=e[0],r=e[1],n=e[2];return function(){var e=new o.PolygonGeometry([[t[0],t[1]],[t[0],t[1]],[t[0],t[1]]]);return new o.OutlineCreateTag(e,{color:r.createColor},n)}})).subscribe(this._tagOperation$);this._delete$.pipe(n.map(function(){return function(){return null}})).subscribe(this._tagOperation$)}Object.defineProperty(e.prototype,"createRect$",{get:function(){return this._createRect$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"createPolygon$",{get:function(){return this._createPolygon$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"createPoints$",{get:function(){return this._createPoints$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"delete$",{get:function(){return this._delete$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"tag$",{get:function(){return this._tag$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"replayedTag$",{get:function(){return this._replayedTag$},enumerable:false,configurable:true});return e}();r.TagCreator=a;r.default=a},{"../../Component":291,rxjs:43,"rxjs/operators":241}],369:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TagDOMRenderer=void 0;var c=e("virtual-dom");var n=function(){function e(){}e.prototype.render=function(e,t,r,n,i){var o=[];for(var a=0,s=e;a<s.length;a++){var u=s[a];o=o.concat(u.getDOMObjects(r,n,i))}if(t!=null){o=o.concat(t.getDOMObjects(n,i))}return c.h("div.TagContainer",{},o)};e.prototype.clear=function(){return c.h("div",{},[])};return e}();r.TagDOMRenderer=n},{"virtual-dom":247}],370:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TagMode=void 0;var n;(function(e){e[e["Default"]=0]="Default";e[e["CreatePoint"]=1]="CreatePoint";e[e["CreatePoints"]=2]="CreatePoints";e[e["CreatePolygon"]=3]="CreatePolygon";e[e["CreateRect"]=4]="CreateRect";e[e["CreateRectDrag"]=5]="CreateRectDrag"})(n=r.TagMode||(r.TagMode={}));r.default=n},{}],371:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TagOperation=void 0;var n;(function(e){e[e["None"]=0]="None";e[e["Centroid"]=1]="Centroid";e[e["Vertex"]=2]="Vertex"})(n=r.TagOperation||(r.TagOperation={}));r.default=n},{}],372:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TagScene=void 0;var c=e("three");var n=function(){function e(e,t){this._createTag=null;this._needsRender=false;this._raycaster=!!t?t:new c.Raycaster;this._scene=!!e?e:new c.Scene;this._objectTags={};this._retrievableObjects=[];this._tags={}}Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:false,configurable:true});e.prototype.add=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];if(n.tag.id in this._tags){this._remove(n.tag.id)}this._add(n)}this._needsRender=true};e.prototype.addCreateTag=function(e){for(var t=0,r=e.glObjects;t<r.length;t++){var n=r[t];this._scene.add(n)}this._createTag={tag:e,objects:e.glObjects};this._needsRender=true};e.prototype.clear=function(){for(var e=0,t=Object.keys(this._tags);e<t.length;e++){var r=t[e];this._remove(r)}this._needsRender=false};e.prototype.get=function(e){return this.has(e)?this._tags[e].tag:undefined};e.prototype.has=function(e){return e in this._tags};e.prototype.hasCreateTag=function(){return this._createTag!=null};e.prototype.intersectObjects=function(e,t){var r=e[0],n=e[1];this._raycaster.setFromCamera(new c.Vector2(r,n),t);var i=this._raycaster.intersectObjects(this._retrievableObjects);var o=[];for(var a=0,s=i;a<s.length;a++){var u=s[a];if(u.object.uuid in this._objectTags){o.push(this._objectTags[u.object.uuid])}}return o};e.prototype.remove=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];this._remove(n)}this._needsRender=true};e.prototype.removeAll=function(){for(var e=0,t=Object.keys(this._tags);e<t.length;e++){var r=t[e];this._remove(r)}this._needsRender=true};e.prototype.removeCreateTag=function(){if(this._createTag==null){return}for(var e=0,t=this._createTag.objects;e<t.length;e++){var r=t[e];this._scene.remove(r)}this._createTag.tag.dispose();this._createTag=null;this._needsRender=true};e.prototype.render=function(e,t){t.render(this._scene,e);this._needsRender=false};e.prototype.update=function(){this._needsRender=true};e.prototype.updateCreateTagObjects=function(e){if(this._createTag.tag!==e){throw new Error("Create tags do not have the same reference.")}for(var t=0,r=this._createTag.objects;t<r.length;t++){var n=r[t];this._scene.remove(n)}for(var i=0,o=e.glObjects;i<o.length;i++){var n=o[i];this._scene.add(n)}this._createTag.objects=e.glObjects;this._needsRender=true};e.prototype.updateObjects=function(e){var t=e.tag.id;if(this._tags[t].tag!==e){throw new Error("Tags do not have the same reference.")}var r=this._tags[t];this._removeObjects(r);delete this._tags[t];this._add(e);this._needsRender=true};e.prototype._add=function(e){var t=e.tag.id;var r={tag:e,objects:[],retrievableObjects:[]};this._tags[t]=r;for(var n=0,i=e.getGLObjects();n<i.length;n++){var o=i[n];r.objects.push(o);this._scene.add(o)}for(var a=0,s=e.getRetrievableObjects();a<s.length;a++){var u=s[a];r.retrievableObjects.push(u);this._retrievableObjects.push(u);this._objectTags[u.uuid]=e.tag.id}};e.prototype._remove=function(e){var t=this._tags[e];this._removeObjects(t);t.tag.dispose();delete this._tags[e]};e.prototype._removeObjects=function(e){for(var t=0,r=e.objects;t<r.length;t++){var n=r[t];this._scene.remove(n)}for(var i=0,o=e.retrievableObjects;i<o.length;i++){var a=o[i];var s=this._retrievableObjects.indexOf(a);if(s!==-1){this._retrievableObjects.splice(s,1)}}};return e}();r.TagScene=n;r.default=n},{three:242}],373:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TagSet=void 0;var n=e("rxjs");var i=e("../../Component");var o=e("./tag/ExtremePointTag");var a=e("./tag/ExtremePointRenderTag");var s=function(){function e(){this._active=false;this._hash={};this._hashDeactivated={};this._notifyChanged$=new n.Subject}Object.defineProperty(e.prototype,"active",{get:function(){return this._active},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:false,configurable:true});e.prototype.activate=function(e){if(this._active){return}for(var t in this._hashDeactivated){if(!this._hashDeactivated.hasOwnProperty(t)){continue}var r=this._hashDeactivated[t];this._add(r,e)}this._hashDeactivated={};this._active=true;this._notifyChanged$.next(this)};e.prototype.deactivate=function(){if(!this._active){return}for(var e in this._hash){if(!this._hash.hasOwnProperty(e)){continue}this._hashDeactivated[e]=this._hash[e].tag}this._hash={};this._active=false};e.prototype.add=function(e,t){this._assertActivationState(true);for(var r=0,n=e;r<n.length;r++){var i=n[r];this._add(i,t)}this._notifyChanged$.next(this)};e.prototype.addDeactivated=function(e){this._assertActivationState(false);for(var t=0,r=e;t<r.length;t++){var n=r[t];if(!(n instanceof i.OutlineTag||n instanceof i.SpotTag||n instanceof o.default)){throw new Error("Tag type not supported")}this._hashDeactivated[n.id]=n}};e.prototype.get=function(e){return this.has(e)?this._hash[e]:undefined};e.prototype.getAll=function(){var t=this._hash;return Object.keys(t).map(function(e){return t[e]})};e.prototype.getAllDeactivated=function(){var t=this._hashDeactivated;return Object.keys(t).map(function(e){return t[e]})};e.prototype.getDeactivated=function(e){return this.hasDeactivated(e)?this._hashDeactivated[e]:undefined};e.prototype.has=function(e){return e in this._hash};e.prototype.hasDeactivated=function(e){return e in this._hashDeactivated};e.prototype.remove=function(e){this._assertActivationState(true);var t=this._hash;for(var r=0,n=e;r<n.length;r++){var i=n[r];if(!(i in t)){continue}delete t[i]}this._notifyChanged$.next(this)};e.prototype.removeAll=function(){this._assertActivationState(true);this._hash={};this._notifyChanged$.next(this)};e.prototype.removeAllDeactivated=function(){this._assertActivationState(false);this._hashDeactivated={}};e.prototype.removeDeactivated=function(e){this._assertActivationState(false);var t=this._hashDeactivated;for(var r=0,n=e;r<n.length;r++){var i=n[r];if(!(i in t)){continue}delete t[i]}};e.prototype._add=function(e,t){if(e instanceof i.OutlineTag){this._hash[e.id]=new i.OutlineRenderTag(e,t)}else if(e instanceof i.SpotTag){this._hash[e.id]=new i.SpotRenderTag(e,t)}else if(e instanceof o.default){this._hash[e.id]=new a.default(e,t)}else{throw new Error("Tag type not supported")}};e.prototype._assertActivationState=function(e){if(e!==this._active){throw new Error("Tag set not in correct state for operation.")}};return e}();r.TagSet=s;r.default=s},{"../../Component":291,"./tag/ExtremePointRenderTag":393,"./tag/ExtremePointTag":394,rxjs:43}],374:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.GeometryTagError=void 0;var n=e("../../../Error");var o=function(r){i(n,r);function n(e){var t=r.call(this,e!=null?e:"The provided geometry value is incorrect")||this;Object.setPrototypeOf(t,n.prototype);t.name="GeometryTagError";return t}return n}(n.MapillaryError);r.GeometryTagError=o;r.default=n.MapillaryError},{"../../../Error":293}],375:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Geometry=void 0;var n=e("rxjs");var i=function(){function e(){this._notifyChanged$=new n.Subject}Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:false,configurable:true});return e}();r.Geometry=i;r.default=i},{rxjs:43}],376:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.PointGeometry=void 0;var o=e("../../../Component");var i=function(i){n(e,i);function e(e){var t=i.call(this)||this;var r=e[0];var n=e[1];if(r<0||r>1||n<0||n>1){throw new o.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}t._point=e.slice();return t}Object.defineProperty(e.prototype,"point",{get:function(){return this._point},enumerable:false,configurable:true});e.prototype.getCentroid2d=function(){return this._point.slice()};e.prototype.getCentroid3d=function(e){return e.unprojectBasic(this._point,200)};e.prototype.setCentroid2d=function(e,t){var r=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];this._point[0]=r[0];this._point[1]=r[1];this._notifyChanged$.next(this)};return e}(o.Geometry);r.PointGeometry=i;r.default=i},{"../../../Component":291}],377:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.PointsGeometry=void 0;var u=e("../../../Component");var i=function(a){n(e,a);function e(e){var t=a.call(this)||this;var r=e.length;if(r<2){throw new u.GeometryTagError("A points geometry must have two or more positions.")}t._points=[];for(var n=0,i=e;n<i.length;n++){var o=i[n];if(o[0]<0||o[0]>1||o[1]<0||o[1]>1){throw new u.GeometryTagError("Basic coordinates of points must be on the interval [0, 1].")}t._points.push(o.slice())}return t}Object.defineProperty(e.prototype,"points",{get:function(){return this._points},enumerable:false,configurable:true});e.prototype.addPoint2d=function(e){var t=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];this._points.push(t);this._notifyChanged$.next(this)};e.prototype.getPoint2d=function(e){return this._points[e].slice()};e.prototype.removePoint2d=function(e){if(e<0||e>=this._points.length||this._points.length<3){throw new u.GeometryTagError("Index for removed point must be valid.")}this._points.splice(e,1);this._notifyChanged$.next(this)};e.prototype.setVertex2d=function(e,t,r){this.setPoint2d(e,t,r)};e.prototype.setPoint2d=function(e,t,r){var n=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];this._points[e]=n;this._notifyChanged$.next(this)};e.prototype.getPoints3d=function(e){return this._getPoints3d(this._points,e)};e.prototype.getPoint3d=function(e,t){return t.unprojectBasic(this._points[e],200)};e.prototype.getPoints2d=function(){return this._points.slice()};e.prototype.getCentroid2d=function(e){if(!e){throw new u.GeometryTagError("Get centroid must be called with a transform for points geometries.")}var t=this.getRect2d(e),r=t[0],n=t[1],i=t[2],o=t[3];var a=r<i?(r+i)/2:(r+i+1)/2%1;var s=(n+o)/2;return[a,s]};e.prototype.getCentroid3d=function(e){var t=this.getCentroid2d();return e.unprojectBasic(t,200)};e.prototype.getRect2d=function(e){var t=1;var r=0;var n=1;var i=0;var o=this._points;for(var a=0,s=o;a<s.length;a++){var u=s[a];if(u[0]<t){t=u[0]}if(u[0]>r){r=u[0]}if(u[1]<n){n=u[1]}if(u[1]>i){i=u[1]}}if(e.fullPano){var c=[];for(var l=0;l<o.length;l++){c[l]=l}c.sort(function(e,t){return o[e][0]<o[t][0]?-1:o[e][0]>o[t][0]?1:e<t?-1:1});var h=o[c[0]][0]+1-o[c[c.length-1]][0];var p=0;for(var l=0;l<c.length-1;l++){var f=c[l];var d=c[l+1];var v=o[d][0]-o[f][0];if(v>h){h=v;p=l+1}}if(p>0){t=o[c[p]][0];r=o[c[p-1]][0]}}return[t,n,r,i]};e.prototype.setCentroid2d=function(e,t){throw new Error("Not implemented")};e.prototype._getPoints3d=function(e,t){return e.map(function(e){return t.unprojectBasic(e,200)})};return e}(u.Geometry);r.PointsGeometry=i;r.default=i},{"../../../Component":291}],378:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.PolygonGeometry=void 0;var f=e("../../../Component");var i=function(p){n(e,p);function e(e,t){var r=p.call(this)||this;var n=e.length;if(n<3){throw new f.GeometryTagError("A polygon must have three or more positions.")}if(e[0][0]!==e[n-1][0]||e[0][1]!==e[n-1][1]){throw new f.GeometryTagError("First and last positions must be equivalent.")}r._polygon=[];for(var i=0,o=e;i<o.length;i++){var a=o[i];if(a[0]<0||a[0]>1||a[1]<0||a[1]>1){throw new f.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].")}r._polygon.push(a.slice())}r._holes=[];if(t==null){return r}for(var s=0;s<t.length;s++){var u=t[s];var c=u.length;if(c<3){throw new f.GeometryTagError("A polygon hole must have three or more positions.")}if(u[0][0]!==u[c-1][0]||u[0][1]!==u[c-1][1]){throw new f.GeometryTagError("First and last positions of hole must be equivalent.")}r._holes.push([]);for(var l=0,h=u;l<h.length;l++){var a=h[l];if(a[0]<0||a[0]>1||a[1]<0||a[1]>1){throw new f.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].")}r._holes[s].push(a.slice())}}return r}Object.defineProperty(e.prototype,"polygon",{get:function(){return this._polygon},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"holes",{get:function(){return this._holes},enumerable:false,configurable:true});e.prototype.addVertex2d=function(e){var t=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];this._polygon.splice(this._polygon.length-1,0,t);this._notifyChanged$.next(this)};e.prototype.getVertex2d=function(e){return this._polygon[e].slice()};e.prototype.removeVertex2d=function(e){if(e<0||e>=this._polygon.length||this._polygon.length<4){throw new f.GeometryTagError("Index for removed vertex must be valid.")}if(e>0&&e<this._polygon.length-1){this._polygon.splice(e,1)}else{this._polygon.splice(0,1);this._polygon.pop();var t=this._polygon[0].slice();this._polygon.push(t)}this._notifyChanged$.next(this)};e.prototype.setVertex2d=function(e,t,r){var n=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];if(e===0||e===this._polygon.length-1){this._polygon[0]=n.slice();this._polygon[this._polygon.length-1]=n.slice()}else{this._polygon[e]=n.slice()}this._notifyChanged$.next(this)};e.prototype.setCentroid2d=function(e,t){var r=this._polygon.map(function(e){return e[0]});var n=this._polygon.map(function(e){return e[1]});var i=Math.min.apply(Math,r);var o=Math.max.apply(Math,r);var a=Math.min.apply(Math,n);var s=Math.max.apply(Math,n);var u=this.getCentroid2d();var c=-i;var l=1-o;var h=-a;var p=1-s;var f=Math.max(c,Math.min(l,e[0]-u[0]));var d=Math.max(h,Math.min(p,e[1]-u[1]));for(var v=0,m=this._polygon;v<m.length;v++){var g=m[v];g[0]+=f;g[1]+=d}this._notifyChanged$.next(this)};e.prototype.getPoints3d=function(e){return this._getPoints3d(this._subsample(this._polygon),e)};e.prototype.getVertex3d=function(e,t){return t.unprojectBasic(this._polygon[e],200)};e.prototype.getVertices2d=function(){return this._polygon.slice()};e.prototype.getVertices3d=function(e){return this._getPoints3d(this._polygon,e)};e.prototype.getHolePoints3d=function(t){var r=this;return this._holes.map(function(e){return r._getPoints3d(r._subsample(e),t)})};e.prototype.getHoleVertices3d=function(t){var r=this;return this._holes.map(function(e){return r._getPoints3d(e,t)})};e.prototype.getCentroid2d=function(){var e=this._polygon;var t=0;var r=0;var n=0;for(var i=0;i<e.length-1;i++){var o=e[i][0];var a=e[i][1];var s=e[i+1][0];var u=e[i+1][1];var c=o*u-s*a;t+=c;r+=(o+s)*c;n+=(a+u)*c}t/=2;r/=6*t;n/=6*t;return[r,n]};e.prototype.getCentroid3d=function(e){var t=this.getCentroid2d();return e.unprojectBasic(t,200)};e.prototype.get3dDomainTriangles3d=function(t){var r=this;return this._triangulate(this._project(this._polygon,t),this.getVertices3d(t),this._holes.map(function(e){return r._project(e,t)}),this.getHoleVertices3d(t))};e.prototype.getTriangles3d=function(t){var r=this;if(t.fullPano){return this._triangulatePano(this._polygon.slice(),this.holes.slice(),t)}var e=this._project(this._subsample(this._polygon),t);var n=this.getPoints3d(t);var i=this._holes.map(function(e){return r._project(r._subsample(e),t)});var o=this.getHolePoints3d(t);return this._triangulate(e,n,i,o)};e.prototype.getPoleOfInaccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._polygon.slice())};e.prototype.getPoleOfInaccessibility3d=function(e){var t=this._getPoleOfInaccessibility2d(this._polygon.slice());return e.unprojectBasic(t,200)};e.prototype._getPoints3d=function(e,t){return e.map(function(e){return t.unprojectBasic(e,200)})};return e}(f.VertexGeometry);r.PolygonGeometry=i;r.default=i},{"../../../Component":291}],379:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.RectGeometry=void 0;var a=e("../../../Component");var i=function(o){n(e,o);function e(e){var t=o.call(this)||this;if(e[1]>e[3]){throw new a.GeometryTagError("Basic Y coordinates values can not be inverted.")}for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i<0||i>1){throw new a.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}}t._anchorIndex=undefined;t._rect=e.slice(0,4);t._inverted=t._rect[0]>t._rect[2];return t}Object.defineProperty(e.prototype,"anchorIndex",{get:function(){return this._anchorIndex},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"inverted",{get:function(){return this._inverted},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"rect",{get:function(){return this._rect},enumerable:false,configurable:true});e.prototype.initializeAnchorIndexing=function(e){if(this._anchorIndex!==undefined){throw new Error("Anchor indexing is already initialized.")}if(e<0||e>3){throw new Error("Invalid anchor index: "+e+".")}this._anchorIndex=e===undefined?0:e};e.prototype.terminateAnchorIndexing=function(){this._anchorIndex=undefined};e.prototype.setOppositeVertex2d=function(e,t){if(this._anchorIndex===undefined){throw new Error("Anchor indexing needs to be initialized.")}var r=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];var n=this._rect.slice();var i=this._anchorIndex===0?[n[0],n[3]]:this._anchorIndex===1?[n[0],n[1]]:this._anchorIndex===2?[n[2],n[1]]:[n[2],n[3]];if(t.fullPano){var o=this._anchorIndex<2?r[0]-n[2]:r[0]-n[0];if(!this._inverted&&this._anchorIndex<2&&r[0]<.25&&n[2]>.75&&o<-.5){this._inverted=true;this._anchorIndex=i[1]>r[1]?0:1}else if(!this._inverted&&this._anchorIndex>=2&&r[0]<.25&&n[2]>.75&&o<-.5){this._inverted=true;this._anchorIndex=i[1]>r[1]?0:1}else if(this._inverted&&this._anchorIndex>=2&&r[0]<.25&&n[0]>.75&&o<-.5){this._inverted=false;if(i[0]>r[0]){this._anchorIndex=i[1]>r[1]?3:2}else{this._anchorIndex=i[1]>r[1]?0:1}}else if(!this._inverted&&this._anchorIndex>=2&&r[0]>.75&&n[0]<.25&&o>.5){this._inverted=true;this._anchorIndex=i[1]>r[1]?3:2}else if(!this._inverted&&this._anchorIndex<2&&r[0]>.75&&n[0]<.25&&o>.5){this._inverted=true;this._anchorIndex=i[1]>r[1]?3:2}else if(this._inverted&&this._anchorIndex<2&&r[0]>.75&&n[2]<.25&&o>.5){this._inverted=false;if(i[0]>r[0]){this._anchorIndex=i[1]>r[1]?3:2}else{this._anchorIndex=i[1]>r[1]?0:1}}else if(this._inverted&&this._anchorIndex<2&&r[0]>n[0]){this._inverted=false;this._anchorIndex=i[1]>r[1]?0:1}else if(this._inverted&&this._anchorIndex>=2&&r[0]<n[2]){this._inverted=false;this._anchorIndex=i[1]>r[1]?3:2}else if(this._inverted){if(this._anchorIndex<2){this._anchorIndex=i[1]>r[1]?0:1}else{this._anchorIndex=i[1]>r[1]?3:2}}else{if(i[0]<=r[0]&&i[1]>r[1]){this._anchorIndex=0}else if(i[0]<=r[0]&&i[1]<=r[1]){this._anchorIndex=1}else if(i[0]>r[0]&&i[1]<=r[1]){this._anchorIndex=2}else{this._anchorIndex=3}}var a=[];if(this._anchorIndex===0){a[0]=i[0];a[1]=r[1];a[2]=r[0];a[3]=i[1]}else if(this._anchorIndex===1){a[0]=i[0];a[1]=i[1];a[2]=r[0];a[3]=r[1]}else if(this._anchorIndex===2){a[0]=r[0];a[1]=i[1];a[2]=i[0];a[3]=r[1]}else{a[0]=r[0];a[1]=r[1];a[2]=i[0];a[3]=i[1]}if(!this._inverted&&a[0]>a[2]||this._inverted&&a[0]<a[2]){a[0]=n[0];a[2]=n[2]}if(a[1]>a[3]){a[1]=n[1];a[3]=n[3]}this._rect[0]=a[0];this._rect[1]=a[1];this._rect[2]=a[2];this._rect[3]=a[3]}else{if(i[0]<=r[0]&&i[1]>r[1]){this._anchorIndex=0}else if(i[0]<=r[0]&&i[1]<=r[1]){this._anchorIndex=1}else if(i[0]>r[0]&&i[1]<=r[1]){this._anchorIndex=2}else{this._anchorIndex=3}var a=[];if(this._anchorIndex===0){a[0]=i[0];a[1]=r[1];a[2]=r[0];a[3]=i[1]}else if(this._anchorIndex===1){a[0]=i[0];a[1]=i[1];a[2]=r[0];a[3]=r[1]}else if(this._anchorIndex===2){a[0]=r[0];a[1]=i[1];a[2]=i[0];a[3]=r[1]}else{a[0]=r[0];a[1]=r[1];a[2]=i[0];a[3]=i[1]}if(a[0]>a[2]){a[0]=n[0];a[2]=n[2]}if(a[1]>a[3]){a[1]=n[1];a[3]=n[3]}this._rect[0]=a[0];this._rect[1]=a[1];this._rect[2]=a[2];this._rect[3]=a[3]}this._notifyChanged$.next(this)};e.prototype.setVertex2d=function(e,t,r){var n=this._rect.slice();var i=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];var o=[];if(e===0){o[0]=i[0];o[1]=n[1];o[2]=n[2];o[3]=i[1]}else if(e===1){o[0]=i[0];o[1]=i[1];o[2]=n[2];o[3]=n[3]}else if(e===2){o[0]=n[0];o[1]=i[1];o[2]=i[0];o[3]=n[3]}else if(e===3){o[0]=n[0];o[1]=n[1];o[2]=i[0];o[3]=i[1]}if(r.fullPano){var a=e<2&&i[0]>.75&&n[0]<.25||e>=2&&this._inverted&&i[0]>.75&&n[2]<.25;var s=e<2&&this._inverted&&i[0]<.25&&n[0]>.75||e>=2&&i[0]<.25&&n[2]>.75;if(a||s){this._inverted=!this._inverted}else{if(o[0]-n[0]<-.25){o[0]=n[0]}if(o[2]-n[2]>.25){o[2]=n[2]}}if(!this._inverted&&o[0]>o[2]||this._inverted&&o[0]<o[2]){o[0]=n[0];o[2]=n[2]}}else{if(o[0]>o[2]){o[0]=n[0];o[2]=n[2]}}if(o[1]>o[3]){o[1]=n[1];o[3]=n[3]}this._rect[0]=o[0];this._rect[1]=o[1];this._rect[2]=o[2];this._rect[3]=o[3];this._notifyChanged$.next(this)};e.prototype.setCentroid2d=function(e,t){var r=this._rect.slice();var n=r[0];var i=this._inverted?r[2]+1:r[2];var o=r[1];var a=r[3];var s=n+(i-n)/2;var u=o+(a-o)/2;var c=0;if(t.gpano!=null&&t.gpano.CroppedAreaImageWidthPixels===t.gpano.FullPanoWidthPixels){c=this._inverted?e[0]+1-s:e[0]-s}else{var l=-n;var h=1-i;c=Math.max(l,Math.min(h,e[0]-s))}var p=-o;var f=1-a;var d=Math.max(p,Math.min(f,e[1]-u));this._rect[0]=r[0]+c;this._rect[1]=r[1]+d;this._rect[2]=r[2]+c;this._rect[3]=r[3]+d;if(this._rect[0]<0){this._rect[0]+=1;this._inverted=!this._inverted}else if(this._rect[0]>1){this._rect[0]-=1;this._inverted=!this._inverted}if(this._rect[2]<0){this._rect[2]+=1;this._inverted=!this._inverted}else if(this._rect[2]>1){this._rect[2]-=1;this._inverted=!this._inverted}this._notifyChanged$.next(this)};e.prototype.getPoints3d=function(t){return this._getPoints2d().map(function(e){return t.unprojectBasic(e,200)})};e.prototype.getVertex2d=function(e){return this._rectToVertices2d(this._rect)[e]};e.prototype.getNonAdjustedVertex2d=function(e){return this._rectToNonAdjustedVertices2d(this._rect)[e]};e.prototype.getVertex3d=function(e,t){return t.unprojectBasic(this._rectToVertices2d(this._rect)[e],200)};e.prototype.getVertices2d=function(){return this._rectToVertices2d(this._rect)};e.prototype.getVertices3d=function(t){return this._rectToVertices2d(this._rect).map(function(e){return t.unprojectBasic(e,200)})};e.prototype.getCentroid2d=function(){var e=this._rect;var t=e[0];var r=this._inverted?e[2]+1:e[2];var n=e[1];var i=e[3];var o=(t+r)/2;var a=(n+i)/2;return[o,a]};e.prototype.getCentroid3d=function(e){var t=this.getCentroid2d();return e.unprojectBasic(t,200)};e.prototype.getPoleOfInaccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))};e.prototype.getPoleOfInaccessibility3d=function(e){var t=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return e.unprojectBasic(t,200)};e.prototype.getTriangles3d=function(e){return e.fullPano?[]:this._triangulate(this._project(this._getPoints2d(),e),this.getPoints3d(e))};e.prototype.validate=function(e){var t=this._rect;if(!this._inverted&&e[0]<t[0]||e[0]-t[2]>.25||e[1]<t[1]){return false}return true};e.prototype._getPoints2d=function(){var e=this._rectToVertices2d(this._rect);var t=e.length-1;var r=10;var n=[];for(var i=0;i<t;++i){var o=e[i][0];var a=e[i][1];var s=e[i+1][0];var u=e[i+1][1];var c=(s-o)/(r-1);var l=(u-a)/(r-1);for(var h=0;h<r;++h){var p=[o+h*c,a+h*l];n.push(p)}}return n};e.prototype._rectToVertices2d=function(e){return[[e[0],e[3]],[e[0],e[1]],[this._inverted?e[2]+1:e[2],e[1]],[this._inverted?e[2]+1:e[2],e[3]],[e[0],e[3]]]};e.prototype._rectToNonAdjustedVertices2d=function(e){return[[e[0],e[3]],[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]]};return e}(a.VertexGeometry);r.RectGeometry=i;r.default=i},{"../../../Component":291}],380:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();var x=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n};Object.defineProperty(r,"__esModule",{value:true});r.VertexGeometry=void 0;var g=e("earcut");var w=e("martinez-polygon-clipping");var i=e("@mapbox/polylabel");var o=e("three");var a=e("../../../Component");var s=function(t){n(e,t);function e(){var e=t.call(this)||this;e._subsampleThreshold=.005;return e}e.prototype._getPoleOfInaccessibility2d=function(e){var t=i([e],.03);return t};e.prototype._project=function(e,t){var r=this._createCamera(t.upVector().toArray(),t.unprojectSfM([0,0],0),t.unprojectSfM([0,0],10));return this._deunproject(e,t,r)};e.prototype._subsample=function(e,t){if(t===void 0){t=this._subsampleThreshold}var r=[];var n=e.length;for(var i=0;i<n;i++){var o=e[i];var a=e[(i+1)%n];r.push(o);var s=Math.sqrt(Math.pow(a[0]-o[0],2)+Math.pow(a[1]-o[1],2));var u=Math.floor(s/t);var c=1/(u+1);for(var l=1;l<=u;l++){var h=l*c;var p=[(1-h)*o[0]+h*a[0],(1-h)*o[1]+h*a[1]];r.push(p)}}return r};e.prototype._triangulate=function(e,t,r,n){var i=[e.slice(0,-1)];for(var o=0,a=r!=null?r:[];o<a.length;o++){var s=a[o];i.push(s.slice(0,-1))}var u=t.slice(0,-1);for(var c=0,l=n!=null?n:[];c<l.length;c++){var h=l[c];u=u.concat(h.slice(0,-1))}var p=g.default.flatten(i);var f=g.default(p.vertices,p.holes,p.dimensions);var d=[];for(var v=0;v<f.length;++v){var m=u[f[v]];d.push(m[0]);d.push(m[1]);d.push(m[2])}return d};e.prototype._triangulatePano=function(e,t,r){var n=[];var i=1e-9;var o=3;var a=3;for(var s=0;s<o;s++){for(var u=0;u<a;u++){var c=s===0?-i:i;var l=u===0?-i:i;var h=s/o+c;var p=u/a+l;var f=(s+1)/o+i;var d=(u+1)/a+i;var v=[[h,p],[h,d],[f,d],[f,p],[h,p]];var m=[(2*s+1)/(2*o),(2*u+1)/(2*a)];n.push.apply(n,this._triangulateSubarea(e,t,v,m,r))}}return n};e.prototype._unproject=function(e,t,r){if(r===void 0){r=200}return e.map(function(e){return t.unprojectBasic(e,r)})};e.prototype._createCamera=function(e,t,r){var n=new o.Camera;n.up.copy((new o.Vector3).fromArray(e));n.position.copy((new o.Vector3).fromArray(t));n.lookAt((new o.Vector3).fromArray(r));n.updateMatrix();n.updateMatrixWorld(true);return n};e.prototype._deunproject=function(e,n,i){return e.map(function(e){var t=n.unprojectBasic(e,1e4);var r=new o.Vector3(t[0],t[1],t[2]).applyMatrix4(i.matrixWorldInverse);return[r.x/r.z,r.y/r.z]})};e.prototype._triangulateSubarea=function(e,t,r,n,i){var o=w.intersection(x([e],t),[r]);if(!o){return[]}var a=[];var s=this._subsampleThreshold;var u=this._createCamera(i.upVector().toArray(),i.unprojectSfM([0,0],0),i.unprojectBasic(n,10));for(var c=0,l=o;c<l.length;c++){var h=l[c];var p=this._subsample(h[0],s);var f=this._deunproject(p,i,u);var d=this._unproject(p,i);var v=[];var m=[];for(var g=1;g<h.length;g++){var _=this._subsample(h[g],s);var y=this._deunproject(_,i,u);var b=this._unproject(_,i);v.push(y);m.push(b)}a.push.apply(a,this._triangulate(f,d,v,m))}return a};return e}(a.Geometry);r.VertexGeometry=s;r.default=s},{"../../../Component":291,"@mapbox/polylabel":1,earcut:8,"martinez-polygon-clipping":22,three:242}],381:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CreateHandlerBase=void 0;var o=e("rxjs/operators");var s=e("rxjs");var i=e("../../../Component");var a=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e,t,r,n)||this;o._tagCreator=i;o._geometryCreated$=new s.Subject;return o}Object.defineProperty(e.prototype,"geometryCreated$",{get:function(){return this._geometryCreated$},enumerable:false,configurable:true});e.prototype._enable=function(){this._enableCreate();this._container.element.classList.add("component-tag-create")};e.prototype._disable=function(){this._container.element.classList.remove("component-tag-create");this._disableCreate()};e.prototype._validateBasic=function(e){var t=e[0];var r=e[1];return 0<=t&&t<=1&&0<=r&&r<=1};e.prototype._mouseEventToBasic$=function(e){var i=this;return e.pipe(o.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$),o.map(function(e){var t=e[0],r=e[1],n=e[2];return i._mouseEventToBasic(t,i._container.element,r,n)}))};return e}(i.TagHandlerBase);r.CreateHandlerBase=a;r.default=a},{"../../../Component":291,rxjs:43,"rxjs/operators":241}],382:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CreatePointHandler=void 0;var i=e("rxjs/operators");var o=e("../../../Component");var a=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._enableCreate=function(){this._container.mouseService.deferPixels(this._name,4);this._geometryCreatedSubscription=this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(i.filter(this._validateBasic),i.map(function(e){return new o.PointGeometry(e)})).subscribe(this._geometryCreated$)};t.prototype._disableCreate=function(){this._container.mouseService.undeferPixels(this._name);this._geometryCreatedSubscription.unsubscribe()};t.prototype._getNameExtension=function(){return"create-point"};return t}(o.CreateHandlerBase);r.CreatePointHandler=a;r.default=a},{"../../../Component":291,"rxjs/operators":241}],383:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CreatePointsHandler=void 0;var i=e("../../../Component");var o=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(t.prototype,"_create$",{get:function(){return this._tagCreator.createPoints$},enumerable:false,configurable:true});t.prototype._addPoint=function(e,t){e.geometry.addPoint2d(t)};t.prototype._getNameExtension=function(){return"create-points"};t.prototype._setVertex2d=function(e,t,r){e.geometry.setPoint2d(e.geometry.points.length-1,t,r)};return t}(i.CreateVertexHandler);r.CreatePointsHandler=o;r.default=o},{"../../../Component":291}],384:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CreatePolygonHandler=void 0;var i=e("../../../Component");var o=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(t.prototype,"_create$",{get:function(){return this._tagCreator.createPolygon$},enumerable:false,configurable:true});t.prototype._addPoint=function(e,t){e.addPoint(t)};t.prototype._getNameExtension=function(){return"create-polygon"};t.prototype._setVertex2d=function(e,t,r){e.geometry.setVertex2d(e.geometry.polygon.length-2,t,r)};return t}(i.CreateVertexHandler);r.CreatePolygonHandler=o;r.default=o},{"../../../Component":291}],385:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CreateRectDragHandler=void 0;var i=e("rxjs");var a=e("rxjs/operators");var o=e("../../../Component");var s=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._enableCreate=function(){var o=this;this._container.mouseService.claimMouse(this._name,2);this._deleteSubscription=this._navigator.stateService.currentTransform$.pipe(a.map(function(e){return null}),a.skip(1)).subscribe(this._tagCreator.delete$);this._createSubscription=this._mouseEventToBasic$(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$)).pipe(a.filter(this._validateBasic)).subscribe(this._tagCreator.createRect$);this._initializeAnchorIndexingSubscription=this._tagCreator.tag$.pipe(a.filter(function(e){return!!e})).subscribe(function(e){e.geometry.initializeAnchorIndexing()});var t=i.combineLatest(i.merge(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseMove$),this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseMove$)),this._container.renderService.renderCamera$).pipe(a.withLatestFrom(this._navigator.stateService.currentTransform$),a.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return o._mouseEventToBasic(r,o._container.element,n,i)}));this._setVertexSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return!!e?i.combineLatest(i.of(e),t,o._navigator.stateService.currentTransform$):i.empty()})).subscribe(function(e){var t=e[0],r=e[1],n=e[2];t.geometry.setOppositeVertex2d(r,n)});var r=this._container.mouseService.mouseDragEnd$.pipe(a.withLatestFrom(this._mouseEventToBasic$(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$)).pipe(a.filter(this._validateBasic)),function(e,t){return t}),a.share());this._addPointSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return!!e?i.combineLatest(i.of(e),r):i.empty()})).subscribe(function(e){var t=e[0],r=e[1];var n=t.geometry;if(!n.validate(r)){r=n.getNonAdjustedVertex2d(3)}t.addPoint(r)});this._geometryCreatedSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return!!e?e.created$.pipe(a.map(function(e){return e.geometry})):i.empty()})).subscribe(this._geometryCreated$)};t.prototype._disableCreate=function(){this._container.mouseService.unclaimMouse(this._name);this._tagCreator.delete$.next(null);this._addPointSubscription.unsubscribe();this._createSubscription.unsubscribe();this._deleteSubscription.unsubscribe();this._geometryCreatedSubscription.unsubscribe();this._initializeAnchorIndexingSubscription.unsubscribe();this._setVertexSubscription.unsubscribe()};t.prototype._getNameExtension=function(){return"create-rect-drag"};return t}(o.CreateHandlerBase);r.CreateRectDragHandler=s;r.default=s},{"../../../Component":291,rxjs:43,"rxjs/operators":241}],386:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CreateRectHandler=void 0;var i=e("rxjs/operators");var o=e("../../../Component");var a=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(t.prototype,"_create$",{get:function(){return this._tagCreator.createRect$},enumerable:false,configurable:true});t.prototype._addPoint=function(e,t){var r=e.geometry;if(!r.validate(t)){t=r.getNonAdjustedVertex2d(3)}e.addPoint(t)};t.prototype._enable=function(){e.prototype._enable.call(this);this._initializeAnchorIndexingSubscription=this._tagCreator.tag$.pipe(i.filter(function(e){return!!e})).subscribe(function(e){e.geometry.initializeAnchorIndexing()})};t.prototype._disable=function(){e.prototype._disable.call(this);this._initializeAnchorIndexingSubscription.unsubscribe()};t.prototype._getNameExtension=function(){return"create-rect"};t.prototype._setVertex2d=function(e,t,r){e.geometry.setOppositeVertex2d(t,r)};return t}(o.CreateVertexHandler);r.CreateRectHandler=a;r.default=a},{"../../../Component":291,"rxjs/operators":241}],387:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.CreateVertexHandler=void 0;var i=e("rxjs");var o=e("rxjs/operators");var a=e("../../../Component");var s=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._enableCreate=function(){var a=this;this._container.mouseService.deferPixels(this._name,4);var e=this._navigator.stateService.currentTransform$.pipe(o.map(function(){}),o.publishReplay(1),o.refCount());this._deleteSubscription=e.pipe(o.skip(1)).subscribe(this._tagCreator.delete$);var t=this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(o.share());this._createSubscription=e.pipe(o.switchMap(function(){return t.pipe(o.filter(a._validateBasic),o.take(1))})).subscribe(this._create$);this._setVertexSubscription=this._tagCreator.tag$.pipe(o.switchMap(function(e){return!!e?i.combineLatest(i.of(e),i.merge(a._container.mouseService.mouseMove$,a._container.mouseService.domMouseMove$),a._container.renderService.renderCamera$,a._navigator.stateService.currentTransform$):i.empty()})).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];var o=a._mouseEventToBasic(r,a._container.element,n,i);a._setVertex2d(t,o,i)});this._addPointSubscription=this._tagCreator.tag$.pipe(o.switchMap(function(e){return!!e?i.combineLatest(i.of(e),t):i.empty()})).subscribe(function(e){var t=e[0],r=e[1];a._addPoint(t,r)});this._geometryCreateSubscription=this._tagCreator.tag$.pipe(o.switchMap(function(e){return!!e?e.created$.pipe(o.map(function(e){return e.geometry})):i.empty()})).subscribe(this._geometryCreated$)};t.prototype._disableCreate=function(){this._container.mouseService.undeferPixels(this._name);this._tagCreator.delete$.next(null);this._addPointSubscription.unsubscribe();this._createSubscription.unsubscribe();this._deleteSubscription.unsubscribe();this._geometryCreateSubscription.unsubscribe();this._setVertexSubscription.unsubscribe()};return t}(a.CreateHandlerBase);r.CreateVertexHandler=s;r.default=s},{"../../../Component":291,rxjs:43,"rxjs/operators":241}],388:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.EditVertexHandler=void 0;var i=e("rxjs");var o=e("rxjs/operators");var u=e("../../../Component");var a=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this,e,t,r,n)||this;o._tagSet=i;return o}e.prototype._enable=function(){var s=this;var e=this._tagSet.changed$.pipe(o.map(function(e){return e.getAll()}),o.switchMap(function(e){return i.from(e).pipe(o.mergeMap(function(e){return e.interact$}))}),o.switchMap(function(e){return i.concat(i.of(e),s._container.mouseService.documentMouseUp$.pipe(o.map(function(){return{offsetX:0,offsetY:0,operation:u.TagOperation.None,tag:null}}),o.first()))}),o.share());var t=i.merge(this._container.mouseService.mouseMove$,this._container.mouseService.domMouseMove$).pipe(o.share());this._claimMouseSubscription=e.pipe(o.switchMap(function(e){return!!e.tag?s._container.mouseService.domMouseDragStart$:i.empty()})).subscribe(function(){s._container.mouseService.claimMouse(s._name,3)});this._cursorSubscription=e.pipe(o.map(function(e){return e.cursor}),o.distinctUntilChanged()).subscribe(function(e){var t=["crosshair","move","nesw-resize","nwse-resize"];for(var r=0,n=t;r<n.length;r++){var i=n[r];s._container.element.classList.remove("component-tag-edit-"+i)}if(!!e){s._container.element.classList.add("component-tag-edit-"+e)}});this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseDragEnd$).subscribe(function(e){s._container.mouseService.unclaimMouse(s._name)});this._preventDefaultSubscription=e.pipe(o.switchMap(function(e){return!!e.tag?s._container.mouseService.documentMouseMove$:i.empty()})).subscribe(function(e){e.preventDefault()});this._updateGeometrySubscription=e.pipe(o.switchMap(function(e){if(e.operation===u.TagOperation.None||!e.tag){return i.empty()}var t=s._container.mouseService.filtered$(s._name,s._container.mouseService.domMouseDrag$).pipe(o.filter(function(e){return s._viewportCoords.insideElement(e,s._container.element)}));return i.combineLatest(t,s._container.renderService.renderCamera$).pipe(o.withLatestFrom(i.of(e),s._navigator.stateService.currentTransform$,function(e,t,r){var n=e[0],i=e[1];return[n,i,t,r]}))})).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];var o=s._mouseEventToBasic(t,s._container.element,r,i,n.offsetX,n.offsetY);var a=n.tag.geometry;if(n.operation===u.TagOperation.Centroid){a.setCentroid2d(o,i)}else if(n.operation===u.TagOperation.Vertex){a.setVertex2d(n.vertexIndex,o,i)}})};e.prototype._disable=function(){this._claimMouseSubscription.unsubscribe();this._cursorSubscription.unsubscribe();this._preventDefaultSubscription.unsubscribe();this._unclaimMouseSubscription.unsubscribe();this._updateGeometrySubscription.unsubscribe()};e.prototype._getNameExtension=function(){return"edit-vertex"};return e}(u.TagHandlerBase);r.EditVertexHandler=a;r.default=a},{"../../../Component":291,rxjs:43,"rxjs/operators":241}],389:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.TagHandlerBase=void 0;var i=e("../../../Component");var o=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,t,r)||this;i._name=i._component.name+"-"+i._getNameExtension();i._viewportCoords=n;return i}e.prototype._getConfiguration=function(e){return{}};e.prototype._mouseEventToBasic=function(e,t,r,n,i,o){i=i!=null?i:0;o=o!=null?o:0;var a=this._viewportCoords.canvasPosition(e,t),s=a[0],u=a[1];var c=this._viewportCoords.canvasToBasic(s-i,u-o,t,n,r.perspective);return c};return e}(i.HandlerBase);r.TagHandlerBase=o;r.default=o},{"../../../Component":291}],390:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],391:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.CreateTag=void 0;var n=e("rxjs/operators");var o=e("three");var i=e("rxjs");var a=e("../../../Geo");var s=function(){function e(e,t,r){var n=this;this._geometry=e;this._transform=t;this._viewportCoords=!!r?r:new a.ViewportCoords;this._aborted$=new i.Subject;this._created$=new i.Subject;this._glObjectsChanged$=new i.Subject;this._geometryChangedSubscription=this._geometry.changed$.subscribe(function(){n._onGeometryChanged();n._glObjectsChanged$.next(n)})}Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"glObjects",{get:function(){return this._glObjects},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"aborted$",{get:function(){return this._aborted$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"created$",{get:function(){return this._created$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"geometryChanged$",{get:function(){var e=this;return this._geometry.changed$.pipe(n.map(function(){return e}))},enumerable:false,configurable:true});e.prototype.dispose=function(){this._geometryChangedSubscription.unsubscribe()};e.prototype._canvasToTransform=function(e){var t=Math.round(e[0]);var r=Math.round(e[1]);var n="translate(-50%,-50%) translate("+t+"px,"+r+"px)";return n};e.prototype._colorToBackground=function(e){return"#"+("000000"+e.toString(16)).substr(-6)};e.prototype._createOutine=function(e,t){var r=this._getLinePositions(e);var n=new o.BufferGeometry;n.setAttribute("position",new o.BufferAttribute(r,3));var i=new o.LineBasicMaterial({color:t,linewidth:1});return new o.Line(n,i)};e.prototype._disposeLine=function(e){if(e==null){return}e.geometry.dispose();e.material.dispose()};e.prototype._getLinePositions=function(e){var t=e.length;var r=new Float32Array(t*3);for(var n=0;n<t;++n){var i=3*n;var o=e[n];r[i]=o[0];r[i+1]=o[1];r[i+2]=o[2]}return r};return e}();r.CreateTag=s;r.default=s},{"../../../Geo":294,rxjs:43,"rxjs/operators":241,three:242}],392:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ExtremePointCreateTag=void 0;var y=e("virtual-dom");var a=e("../Tag");var i=e("../../../Component");var o=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,r,n)||this;i._options={color:t.color==null?16777215:t.color,indicateCompleter:t.indicateCompleter==null?true:t.indicateCompleter};i._rectGeometry=new a.RectGeometry(i._geometry.getRect2d(r));i._createGlObjects();return i}e.prototype.create=function(){if(this._geometry.points.length<3){return}this._geometry.removePoint2d(this._geometry.points.length-1);this._created$.next(this)};e.prototype.dispose=function(){o.prototype.dispose.call(this);this._disposeObjects()};e.prototype.getDOMObjects=function(p,e){var f=this;var d={offsetHeight:e.height,offsetWidth:e.width};var v=[];var m=this._geometry.getPoints2d();var g=m.length;var t=function(e){var t=e;var r=m[e],n=r[0],i=r[1];var o=_._viewportCoords.basicToCanvasSafe(n,i,d,_._transform,p);if(!o){return"continue"}var a=function(e){e.stopPropagation();f._aborted$.next(f)};var s=function(e){e.stopPropagation();f._geometry.removePoint2d(t)};var u=_._canvasToTransform(o);var c={onclick:e===0&&g<3?a:s,style:{transform:u}};v.push(y.h("div.TagInteractor",c,[]));var l=_._colorToBackground(_._options.color);var h={style:{background:l,transform:u}};v.push(y.h("div.TagVertex",h,[]))};var _=this;for(var r=0;r<g-1;r++){t(r)}if(g>2&&this._options.indicateCompleter===true){var n=this._geometry.getCentroid2d(this._transform),i=n[0],o=n[1];var a=this._viewportCoords.basicToCanvasSafe(i,o,d,this._transform,p);if(!!a){var s=function(e){e.stopPropagation();f._geometry.removePoint2d(f._geometry.points.length-1);f._created$.next(f)};var u=this._canvasToTransform(a);var c={onclick:s,style:{transform:u}};v.push(y.h("div.TagCompleter.TagLarger",c,[]));var l={style:{background:this._colorToBackground(this._options.color),transform:u}};v.push(y.h("div.TagVertex.TagLarger",l,[]));var h={style:{transform:u}};v.push(y.h("div.TagDot",h,[]))}}return v};e.prototype._onGeometryChanged=function(){this._disposeObjects();this._rectGeometry=new a.RectGeometry(this._geometry.getRect2d(this._transform));this._createGlObjects()};e.prototype._createGlObjects=function(){this._glObjects=[];var e=this._rectGeometry.getPoints3d(this._transform);this._outline=this._createOutine(e,this._options.color);this._glObjects.push(this._outline)};e.prototype._disposeObjects=function(){this._disposeLine(this._outline);this._outline=null;this._glObjects=null};return e}(i.CreateTag);r.ExtremePointCreateTag=o},{"../../../Component":291,"../Tag":366,"virtual-dom":247}],393:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ExtremePointRenderTag=void 0;var o=e("three");var y=e("virtual-dom");var b=e("../../../Component");var n=function(n){i(e,n);function e(e,t){var r=n.call(this,e,t)||this;r._rectGeometry=new b.RectGeometry(r._tag.geometry.getRect2d(t));r._fill=!t.gpano?r._createFill():null;r._outline=r._tag.lineWidth>=1?r._createOutline():null;return r}e.prototype.dispose=function(){n.prototype.dispose.call(this);this._disposeFill();this._disposeOutline()};e.prototype.getDOMObjects=function(e,t,r){var n=[];var i={offsetHeight:r.height,offsetWidth:r.width};if(!this._tag.editable){return n}var o=this._colorToCss(this._tag.lineColor);var a=this._tag.geometry.getPoints2d();for(var s=0;s<a.length;s++){var u=a[s],c=u[0],l=u[1];var h=this._viewportCoords.basicToCanvasSafe(c,l,i,this._transform,t);if(h==null){continue}var p="crosshair";var f=this._interact(b.TagOperation.Vertex,p,s);var d=Math.round(h[0]);var v=Math.round(h[1]);var m="translate(-50%, -50%) translate("+d+"px,"+v+"px)";var g={onmousedown:f,style:{background:o,transform:m,cursor:p}};n.push(y.h("div.TagResizer",g,[]));if(!this._tag.indicateVertices){continue}var _={style:{background:o,transform:m}};n.push(y.h("div.TagVertex",_,[]))}return n};e.prototype.getGLObjects=function(){var e=[];if(this._fill!=null){e.push(this._fill)}if(this._outline!=null){e.push(this._outline)}return e};e.prototype.getRetrievableObjects=function(){return this._fill!=null?[this._fill]:[]};e.prototype._onGeometryChanged=function(){this._rectGeometry=new b.RectGeometry(this._tag.geometry.getRect2d(this._transform));if(this._fill!=null){this._updateFillGeometry()}if(this._outline!=null){this._updateOulineGeometry()}};e.prototype._onTagChanged=function(){var e=false;if(this._fill!=null){this._updateFillMaterial(this._fill.material)}if(this._outline==null){if(this._tag.lineWidth>=1){this._outline=this._createOutline();e=true}}else{this._updateOutlineMaterial()}return e};e.prototype._getPoints3d=function(){return this._rectGeometry.getPoints3d(this._transform)};e.prototype._getTriangles=function(){return this._rectGeometry.getTriangles3d(this._transform)};e.prototype._updateFillMaterial=function(e){e.color=new o.Color(this._tag.fillColor);e.opacity=this._tag.fillOpacity;e.needsUpdate=true};e.prototype._updateLineBasicMaterial=function(e){e.color=new o.Color(this._tag.lineColor);e.linewidth=Math.max(this._tag.lineWidth,1);e.visible=this._tag.lineWidth>=1&&this._tag.lineOpacity>0;e.opacity=this._tag.lineOpacity;e.transparent=this._tag.lineOpacity<1;e.needsUpdate=true};e.prototype._updateOutlineMaterial=function(){var e=this._outline.material;this._updateLineBasicMaterial(e)};return e}(b.OutlineRenderTagBase);r.ExtremePointRenderTag=n;r.default=n},{"../../../Component":291,three:242,"virtual-dom":247}],394:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ExtremePointTag=void 0;var i=e("../../../Component");var o=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t)||this;r=!!r?r:{};n._editable=r.editable==null?false:r.editable;n._fillColor=r.fillColor==null?16777215:r.fillColor;n._fillOpacity=r.fillOpacity==null?0:r.fillOpacity;n._indicateVertices=r.indicateVertices==null?true:r.indicateVertices;n._lineColor=r.lineColor==null?16777215:r.lineColor;n._lineOpacity=r.lineOpacity==null?1:r.lineOpacity;n._lineWidth=r.lineWidth==null?1:r.lineWidth;return n}Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"fillColor",{get:function(){return this._fillColor},set:function(e){this._fillColor=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(e){this._fillOpacity=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(e){this._indicateVertices=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lineColor",{get:function(){return this._lineColor},set:function(e){this._lineColor=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(e){this._lineOpacity=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});e.prototype.setOptions=function(e){this._editable=e.editable==null?this._editable:e.editable;this._indicateVertices=e.indicateVertices==null?this._indicateVertices:e.indicateVertices;this._lineColor=e.lineColor==null?this._lineColor:e.lineColor;this._lineWidth=e.lineWidth==null?this._lineWidth:e.lineWidth;this._fillColor=e.fillColor==null?this._fillColor:e.fillColor;this._fillOpacity=e.fillOpacity==null?this._fillOpacity:e.fillOpacity;this._notifyChanged$.next(this)};return e}(i.Tag);r.ExtremePointTag=o;r.default=o},{"../../../Component":291}],395:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.OutlineCreateTag=void 0;var k=e("virtual-dom");var L=e("../../../Component");var i=function(o){n(e,o);function e(e,t,r,n){var i=o.call(this,e,r,n)||this;i._options={color:t.color==null?16777215:t.color};i._createGlObjects();return i}e.prototype.create=function(){if(this._geometry instanceof L.RectGeometry){this._created$.next(this)}else if(this._geometry instanceof L.PolygonGeometry){var e=this._geometry;e.removeVertex2d(e.polygon.length-2);this._created$.next(this)}};e.prototype.dispose=function(){o.prototype.dispose.call(this);this._disposeLine(this._outline);this._disposeObjects()};e.prototype.getDOMObjects=function(e,t){var r=this;var n=[];var i={offsetHeight:t.height,offsetWidth:t.width};var o=function(e){e.stopPropagation();r._aborted$.next(r)};if(this._geometry instanceof L.RectGeometry){var a=this._geometry.anchorIndex;var s=a===undefined?1:a;var u=this._geometry.getVertex2d(s),c=u[0],l=u[1];var h=this._viewportCoords.basicToCanvasSafe(c,l,i,this._transform,e);if(h!=null){var p=this._colorToBackground(this._options.color);var f=this._canvasToTransform(h);var d={style:{background:p,transform:f}};var v={onclick:o,style:{transform:f}};n.push(k.h("div.TagInteractor",v,[]));n.push(k.h("div.TagVertex",d,[]))}}else if(this._geometry instanceof L.PolygonGeometry){var m=this._geometry;var g=m.getVertex2d(0),_=g[0],y=g[1];var b=this._viewportCoords.basicToCanvasSafe(_,y,i,this._transform,e);if(b!=null){var x=m.polygon.length>4?function(e){e.stopPropagation();m.removeVertex2d(m.polygon.length-2);r._created$.next(r)}:o;var f=this._canvasToTransform(b);var v={onclick:x,style:{transform:f}};var w=m.polygon.length>4?"TagCompleter":"TagInteractor";n.push(k.h("div."+w,v,[]))}if(m.polygon.length>3){var S=m.getVertex2d(m.polygon.length-3),M=S[0],C=S[1];var T=this._viewportCoords.basicToCanvasSafe(M,C,i,this._transform,e);if(T!=null){var E=function(e){e.stopPropagation();m.removeVertex2d(m.polygon.length-3)};var f=this._canvasToTransform(T);var v={onclick:E,style:{transform:f}};n.push(k.h("div.TagInteractor",v,[]))}}var O=m.polygon.slice();O.splice(-2,2);for(var P=0,A=O;P<A.length;P++){var j=A[P];var R=this._viewportCoords.basicToCanvasSafe(j[0],j[1],i,this._transform,e);if(R!=null){var p=this._colorToBackground(this._options.color);var f=this._canvasToTransform(R);var d={style:{background:p,transform:f}};n.push(k.h("div.TagVertex",d,[]))}}}return n};e.prototype.addPoint=function(e){if(this._geometry instanceof L.RectGeometry){var t=this._geometry;if(!t.validate(e)){return}this._created$.next(this)}else if(this._geometry instanceof L.PolygonGeometry){var r=this._geometry;r.addVertex2d(e)}};e.prototype._onGeometryChanged=function(){this._disposeLine(this._outline);this._disposeObjects();this._createGlObjects()};e.prototype._disposeObjects=function(){this._outline=null;this._glObjects=[]};e.prototype._createGlObjects=function(){var e=this._geometry instanceof L.RectGeometry?this._geometry.getPoints3d(this._transform):this._geometry.getVertices3d(this._transform);this._outline=this._createOutine(e,this._options.color);this._glObjects=[this._outline]};return e}(L.CreateTag);r.OutlineCreateTag=i;r.default=i},{"../../../Component":291,"virtual-dom":247}],396:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.OutlineRenderTag=void 0;var o=e("three");var G=e("virtual-dom");var V=e("../../../Component");var n=function(n){i(e,n);function e(e,t){var r=n.call(this,e,t)||this;r._fill=!t.gpano?r._createFill():t.fullPano&&e.domain===V.TagDomain.TwoDimensional&&e.geometry instanceof V.PolygonGeometry?r._createFill():null;r._holes=r._tag.lineWidth>=1?r._createHoles():[];r._outline=r._tag.lineWidth>=1?r._createOutline():null;return r}e.prototype.dispose=function(){n.prototype.dispose.call(this);this._disposeFill();this._disposeHoles();this._disposeOutline()};e.prototype.getDOMObjects=function(e,t,r){var n=this;var i=[];var o=this._tag.geometry instanceof V.RectGeometry;var a=!this._transform.gpano;var s={offsetHeight:r.height,offsetWidth:r.width};if(this._tag.icon!=null&&(o||a)){var u=this._tag.geometry instanceof V.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfInaccessibility2d(),c=u[0],l=u[1];var h=this._viewportCoords.basicToCanvasSafe(c,l,s,this._transform,t);if(h!=null){var p=function(){n._interact$.next({offsetX:0,offsetY:0,operation:V.TagOperation.None,tag:n._tag})};if(e.loaded){var f=e.getDOMSprite(this._tag.icon,this._tag.iconFloat);var d=Math.round(h[0]);var v=Math.round(h[1]);var m="translate("+d+"px,"+v+"px)";var g=function(e){e.stopPropagation();n._tag.click$.next(n._tag)};var _={onclick:g,onmousedown:p,style:{transform:m}};i.push(G.h("div.TagSymbol",_,[f]))}}}else if(this._tag.text!=null&&(o||a)){var y=this._tag.geometry instanceof V.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfInaccessibility2d(),b=y[0],x=y[1];var w=this._viewportCoords.basicToCanvasSafe(b,x,s,this._transform,t);if(w!=null){var S=Math.round(w[0]);var M=Math.round(w[1]);var m=this._tag.geometry instanceof V.RectGeometry?"translate("+S+"px,"+M+"px)":"translate(-50%, -50%) translate("+S+"px,"+M+"px)";var p=function(){n._interact$.next({offsetX:0,offsetY:0,operation:V.TagOperation.None,tag:n._tag})};var _={onmousedown:p,style:{color:this._colorToCss(this._tag.textColor),transform:m},textContent:this._tag.text};i.push(G.h("span.TagSymbol",_,[]))}}if(!this._tag.editable){return i}var C=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof V.RectGeometry){var T=this._tag.geometry.getCentroid2d(),E=T[0],O=T[1];var P=this._viewportCoords.basicToCanvasSafe(E,O,s,this._transform,t);if(P!=null){var p=this._interact(V.TagOperation.Centroid,"move");var A=Math.round(P[0]);var j=Math.round(P[1]);var m="translate(-50%, -50%) translate("+A+"px,"+j+"px)";var _={onmousedown:p,style:{background:C,transform:m}};i.push(G.h("div.TagMover",_,[]))}}var R=this._tag.geometry.getVertices2d();for(var k=0;k<R.length-1;k++){if(o&&(this._tag.icon!=null&&k===this._tag.iconIndex||this._tag.icon==null&&this._tag.text!=null&&k===3)){continue}var L=R[k],N=L[0],I=L[1];var D=this._viewportCoords.basicToCanvasSafe(N,I,s,this._transform,t);if(D==null){continue}var B=o?k%2===0?"nesw-resize":"nwse-resize":"crosshair";var p=this._interact(V.TagOperation.Vertex,B,k);var F=Math.round(D[0]);var z=Math.round(D[1]);var m="translate(-50%, -50%) translate("+F+"px,"+z+"px)";var _={onmousedown:p,style:{background:C,transform:m,cursor:B}};i.push(G.h("div.TagResizer",_,[]));if(!this._tag.indicateVertices){continue}var $={style:{background:C,transform:m}};i.push(G.h("div.TagVertex",$,[]))}return i};e.prototype.getGLObjects=function(){var e=[];if(this._fill!=null){e.push(this._fill)}for(var t=0,r=this._holes;t<r.length;t++){var n=r[t];e.push(n)}if(this._outline!=null){e.push(this._outline)}return e};e.prototype.getRetrievableObjects=function(){return this._fill!=null?[this._fill]:[]};e.prototype._onGeometryChanged=function(){if(this._fill!=null){this._updateFillGeometry()}if(this._holes.length>0){this._updateHoleGeometries()}if(this._outline!=null){this._updateOulineGeometry()}};e.prototype._onTagChanged=function(){var e=false;if(this._fill!=null){this._updateFillMaterial(this._fill.material)}if(this._outline==null){if(this._tag.lineWidth>=1){this._holes=this._createHoles();this._outline=this._createOutline();e=true}}else{this._updateHoleMaterials();this._updateOutlineMaterial()}return e};e.prototype._getPoints3d=function(){return this._in3dDomain()?this._tag.geometry.getVertices3d(this._transform):this._tag.geometry.getPoints3d(this._transform)};e.prototype._getTriangles=function(){return this._in3dDomain()?this._tag.geometry.get3dDomainTriangles3d(this._transform):this._tag.geometry.getTriangles3d(this._transform)};e.prototype._updateFillMaterial=function(e){e.color=new o.Color(this._tag.fillColor);e.opacity=this._tag.fillOpacity;e.needsUpdate=true};e.prototype._updateLineBasicMaterial=function(e){e.color=new o.Color(this._tag.lineColor);e.linewidth=Math.max(this._tag.lineWidth,1);e.visible=this._tag.lineWidth>=1&&this._tag.lineOpacity>0;e.opacity=this._tag.lineOpacity;e.transparent=this._tag.lineOpacity<1;e.needsUpdate=true};e.prototype._createHoles=function(){var e=[];if(this._tag.geometry instanceof V.PolygonGeometry){var t=this._getHoles3d();for(var r=0,n=t;r<n.length;r++){var i=n[r];var o=this._createLine(i);e.push(o)}}return e};e.prototype._disposeHoles=function(){for(var e=0,t=this._holes;e<t.length;e++){var r=t[e];r.geometry.dispose();r.material.dispose()}this._holes=[]};e.prototype._getHoles3d=function(){var e=this._tag.geometry;return this._in3dDomain()?e.getHoleVertices3d(this._transform):e.getHolePoints3d(this._transform)};e.prototype._in3dDomain=function(){return this._tag.geometry instanceof V.PolygonGeometry&&this._tag.domain===V.TagDomain.ThreeDimensional};e.prototype._updateHoleGeometries=function(){var e=this._getHoles3d();if(e.length!==this._holes.length){throw new Error("Changing the number of holes is not supported.")}for(var t=0;t<this._holes.length;t++){var r=e[t];var n=this._holes[t];this._updateLine(n,r)}};e.prototype._updateHoleMaterials=function(){for(var e=0,t=this._holes;e<t.length;e++){var r=t[e];this._updateLineBasicMaterial(r.material)}};e.prototype._updateOutlineMaterial=function(){this._updateLineBasicMaterial(this._outline.material)};return e}(V.OutlineRenderTagBase);r.OutlineRenderTag=n},{"../../../Component":291,three:242,"virtual-dom":247}],397:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.OutlineRenderTagBase=void 0;var o=e("three");var n=e("../../../Component");var a=function(n){i(e,n);function e(e,t){var r=n.call(this,e,t)||this;r._geometryChangedSubscription=r._tag.geometry.changed$.subscribe(function(){r._onGeometryChanged()});r._changedSubscription=r._tag.changed$.subscribe(function(){var e=r._onTagChanged();if(e){r._glObjectsChanged$.next(r)}});return r}e.prototype.dispose=function(){this._changedSubscription.unsubscribe();this._geometryChangedSubscription.unsubscribe()};e.prototype._colorToCss=function(e){return"#"+("000000"+e.toString(16)).substr(-6)};e.prototype._createFill=function(){var e=this._getTriangles();var t=new Float32Array(e);var r=new o.BufferGeometry;r.setAttribute("position",new o.BufferAttribute(t,3));r.computeBoundingSphere();var n=new o.MeshBasicMaterial({side:o.DoubleSide,transparent:true});this._updateFillMaterial(n);return new o.Mesh(r,n)};e.prototype._createLine=function(e){var t=this._getLinePositions(e);var r=new o.BufferGeometry;r.setAttribute("position",new o.BufferAttribute(t,3));r.computeBoundingSphere();var n=new o.LineBasicMaterial;this._updateLineBasicMaterial(n);var i=new o.Line(r,n);i.renderOrder=1;return i};e.prototype._createOutline=function(){return this._createLine(this._getPoints3d())};e.prototype._disposeFill=function(){if(this._fill==null){return}this._fill.geometry.dispose();this._fill.material.dispose();this._fill=null};e.prototype._disposeOutline=function(){if(this._outline==null){return}this._outline.geometry.dispose();this._outline.material.dispose();this._outline=null};e.prototype._getLinePositions=function(e){var t=e.length;var r=new Float32Array(t*3);for(var n=0;n<t;++n){var i=3*n;var o=e[n];r[i+0]=o[0];r[i+1]=o[1];r[i+2]=o[2]}return r};e.prototype._interact=function(n,i,o){var a=this;return function(e){var t=e.offsetX-e.target.offsetWidth/2;var r=e.offsetY-e.target.offsetHeight/2;a._interact$.next({cursor:i,offsetX:t,offsetY:r,operation:n,tag:a._tag,vertexIndex:o})}};e.prototype._updateFillGeometry=function(){var e=this._getTriangles();var t=new Float32Array(e);var r=this._fill.geometry;var n=r.getAttribute("position");if(n.array.length===t.length){n.set(t);n.needsUpdate=true}else{r.removeAttribute("position");r.setAttribute("position",new o.BufferAttribute(t,3))}r.computeBoundingSphere()};e.prototype._updateLine=function(e,t){var r=this._getLinePositions(t);var n=e.geometry;var i=n.getAttribute("position");i.set(r);i.needsUpdate=true;n.computeBoundingSphere()};e.prototype._updateOulineGeometry=function(){this._updateLine(this._outline,this._getPoints3d())};return e}(n.RenderTag);r.OutlineRenderTagBase=a;r.default=a},{"../../../Component":291,three:242}],398:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.OutlineTag=void 0;var u=e("rxjs");var c=e("../../../Component");var l=e("../../../Viewer");var i=function(a){n(s,a);function s(e,t,r){var n=a.call(this,e,t)||this;r=!!r?r:{};var i=r.domain!=null&&t instanceof c.PolygonGeometry?r.domain:c.TagDomain.TwoDimensional;var o=n._twoDimensionalPolygon(i,t);n._domain=i;n._editable=r.editable==null||o?false:r.editable;n._fillColor=r.fillColor==null?16777215:r.fillColor;n._fillOpacity=r.fillOpacity==null?0:r.fillOpacity;n._icon=r.icon===undefined?null:r.icon;n._iconFloat=r.iconFloat==null?l.Alignment.Center:r.iconFloat;n._iconIndex=r.iconIndex==null?3:r.iconIndex;n._indicateVertices=r.indicateVertices==null?true:r.indicateVertices;n._lineColor=r.lineColor==null?16777215:r.lineColor;n._lineOpacity=r.lineOpacity==null?1:r.lineOpacity;n._lineWidth=r.lineWidth==null?1:r.lineWidth;n._text=r.text===undefined?null:r.text;n._textColor=r.textColor==null?16777215:r.textColor;n._click$=new u.Subject;n._click$.subscribe(function(e){n.fire(s.click,n)});return n}Object.defineProperty(s.prototype,"click$",{get:function(){return this._click$},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"domain",{get:function(){return this._domain},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"editable",{get:function(){return this._editable},set:function(e){if(this._twoDimensionalPolygon(this._domain,this._geometry)){return}this._editable=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"fillColor",{get:function(){return this._fillColor},set:function(e){this._fillColor=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(e){this._fillOpacity=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"geometry",{get:function(){return this._geometry},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(e){this._iconFloat=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(e){this._iconIndex=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(e){this._indicateVertices=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"lineColor",{get:function(){return this._lineColor},set:function(e){this._lineColor=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(e){this._lineOpacity=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(s.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});s.prototype.setOptions=function(e){var t=this._twoDimensionalPolygon(this._domain,this._geometry);this._editable=t||e.editable==null?this._editable:e.editable;this._icon=e.icon===undefined?this._icon:e.icon;this._iconFloat=e.iconFloat==null?this._iconFloat:e.iconFloat;this._iconIndex=e.iconIndex==null?this._iconIndex:e.iconIndex;this._indicateVertices=e.indicateVertices==null?this._indicateVertices:e.indicateVertices;this._lineColor=e.lineColor==null?this._lineColor:e.lineColor;this._lineWidth=e.lineWidth==null?this._lineWidth:e.lineWidth;this._fillColor=e.fillColor==null?this._fillColor:e.fillColor;this._fillOpacity=e.fillOpacity==null?this._fillOpacity:e.fillOpacity;this._text=e.text===undefined?this._text:e.text;this._textColor=e.textColor==null?this._textColor:e.textColor;this._notifyChanged$.next(this)};s.prototype._twoDimensionalPolygon=function(e,t){return e!==c.TagDomain.ThreeDimensional&&t instanceof c.PolygonGeometry};s.click="click";return s}(c.Tag);r.OutlineTag=i;r.default=i},{"../../../Component":291,"../../../Viewer":302,rxjs:43}],399:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RenderTag=void 0;var n=e("rxjs");var i=e("../../../Geo");var o=function(){function e(e,t,r){this._tag=e;this._transform=t;this._viewportCoords=!!r?r:new i.ViewportCoords;this._glObjectsChanged$=new n.Subject;this._interact$=new n.Subject}Object.defineProperty(e.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"interact$",{get:function(){return this._interact$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"tag",{get:function(){return this._tag},enumerable:false,configurable:true});return e}();r.RenderTag=o;r.default=o},{"../../../Geo":294,rxjs:43}],400:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.SpotRenderTag=void 0;var S=e("virtual-dom");var M=e("../../../Component");var C=e("../../../Viewer");var i=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.dispose=function(){};t.prototype.getDOMObjects=function(e,t,r){var n=this;var i=this._tag;var o={offsetHeight:r.height,offsetWidth:r.width};var a=[];var s=i.geometry.getCentroid2d(),u=s[0],c=s[1];var l=this._viewportCoords.basicToCanvasSafe(u,c,o,this._transform,t);if(l!=null){var h=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:M.TagOperation.None,tag:i})};var p=Math.round(l[0]);var f=Math.round(l[1]);if(i.icon!=null){if(e.loaded){var d=e.getDOMSprite(i.icon,C.Alignment.Bottom);var v="translate("+p+"px,"+(f+8)+"px)";var m={onmousedown:h,style:{pointerEvents:"all",transform:v}};a.push(S.h("div",m,[d]))}}else if(i.text!=null){var g="translate(-50%,0%) translate("+p+"px,"+(f+8)+"px)";var m={onmousedown:h,style:{color:this._colorToCss(i.textColor),transform:g},textContent:i.text};a.push(S.h("span.TagSymbol",m,[]))}var _=this._interact(M.TagOperation.Centroid,i,"move");var y=this._colorToCss(i.color);var b="translate(-50%,-50%) translate("+p+"px,"+f+"px)";if(i.editable){var x={onmousedown:_,style:{background:y,transform:b}};a.push(S.h("div.TagSpotInteractor",x,[]))}var w={style:{background:y,transform:b}};a.push(S.h("div.TagVertex",w,[]))}return a};t.prototype.getGLObjects=function(){return[]};t.prototype.getRetrievableObjects=function(){return[]};t.prototype._colorToCss=function(e){return"#"+("000000"+e.toString(16)).substr(-6)};t.prototype._interact=function(n,i,o,a){var s=this;return function(e){var t=e.offsetX-e.target.offsetWidth/2;var r=e.offsetY-e.target.offsetHeight/2;s._interact$.next({cursor:o,offsetX:t,offsetY:r,operation:n,tag:i,vertexIndex:a})}};return t}(M.RenderTag);r.SpotRenderTag=i},{"../../../Component":291,"../../../Viewer":302,"virtual-dom":247}],401:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.SpotTag=void 0;var i=e("../../../Component");var o=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t)||this;r=!!r?r:{};n._color=r.color==null?16777215:r.color;n._editable=r.editable==null?false:r.editable;n._icon=r.icon===undefined?null:r.icon;n._text=r.text===undefined?null:r.text;n._textColor=r.textColor==null?16777215:r.textColor;return n}Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(e){this._color=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e;this._notifyChanged$.next(this)},enumerable:false,configurable:true});e.prototype.setOptions=function(e){this._color=e.color==null?this._color:e.color;this._editable=e.editable==null?this._editable:e.editable;this._icon=e.icon===undefined?this._icon:e.icon;this._text=e.text===undefined?this._text:e.text;this._textColor=e.textColor==null?this._textColor:e.textColor;this._notifyChanged$.next(this)};return e}(i.Tag);r.SpotTag=o;r.default=o},{"../../../Component":291}],402:[function(e,t,r){"use strict";var o=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.Tag=void 0;var a=e("rxjs/operators");var s=e("rxjs");var n=e("../../../Utils");var i=function(n){o(i,n);function i(e,t){var r=n.call(this)||this;r._id=e;r._geometry=t;r._notifyChanged$=new s.Subject;r._notifyChanged$.subscribe(function(e){r.fire(i.changed,r)});r._geometry.changed$.subscribe(function(e){r.fire(i.geometrychanged,r)});return r}Object.defineProperty(i.prototype,"id",{get:function(){return this._id},enumerable:false,configurable:true});Object.defineProperty(i.prototype,"geometry",{get:function(){return this._geometry},enumerable:false,configurable:true});Object.defineProperty(i.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:false,configurable:true});Object.defineProperty(i.prototype,"geometryChanged$",{get:function(){var t=this;return this._geometry.changed$.pipe(a.map(function(e){return t}),a.share())},enumerable:false,configurable:true});i.changed="changed";i.geometrychanged="geometrychanged";return i}(n.EventEmitter);r.Tag=i;r.default=i},{"../../../Utils":301,rxjs:43,"rxjs/operators":241}],403:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TagDomain=void 0;var n;(function(e){e[e["TwoDimensional"]=0]="TwoDimensional";e[e["ThreeDimensional"]=1]="ThreeDimensional"})(n=r.TagDomain||(r.TagDomain={}));r.default=n},{}],404:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ComponentSize=void 0;var n;(function(e){e[e["Automatic"]=0]="Automatic";e[e["Large"]=1]="Large";e[e["Small"]=2]="Small"})(n=r.ComponentSize||(r.ComponentSize={}));r.default=n},{}],405:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.HandlerBase=void 0;var n=function(){function e(e,t,r){this._component=e;this._container=t;this._navigator=r;this._enabled=false}Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:false,configurable:true});e.prototype.enable=function(){if(this._enabled||!this._component.activated){return}this._enable();this._enabled=true;this._component.configure(this._getConfiguration(true))};e.prototype.disable=function(){if(!this._enabled){return}this._disable();this._enabled=false;if(this._component.activated){this._component.configure(this._getConfiguration(false))}};return e}();r.HandlerBase=n;r.default=n},{}],406:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MeshFactory=void 0;var b=e("three");var l=e("../../Component");var n=function(){function e(e,t){this._imagePlaneDepth=e!=null?e:200;this._imageSphereRadius=t!=null?t:200}e.prototype.createMesh=function(e,t){if(e.pano){return this._createImageSphere(e,t)}else if(t.cameraProjection==="fisheye"){return this._createImagePlaneFisheye(e,t)}else{return this._createImagePlane(e,t)}};e.prototype.createFlatMesh=function(e,t,r,n,i,o){var a=this._createTexture(e.image);var s=this._createDistortedPlaneMaterialParameters(t,a);var u=new b.ShaderMaterial(s);var c=this._getFlatImagePlaneGeoFromBasic(t,r,n,i,o);return new b.Mesh(c,u)};e.prototype.createCurtainMesh=function(e,t){if(e.pano&&!e.fullPano){throw new Error("Cropped panoramas cannot have curtain.")}if(e.pano){return this._createSphereCurtainMesh(e,t)}else if(t.cameraProjection==="fisheye"){return this._createCurtainMeshFisheye(e,t)}else{return this._createCurtainMesh(e,t)}};e.prototype.createDistortedCurtainMesh=function(e,t){if(e.pano){throw new Error("Cropped panoramas cannot have curtain.")}return this._createDistortedCurtainMesh(e,t)};e.prototype._createCurtainMesh=function(e,t){var r=this._createTexture(e.image);var n=this._createCurtainPlaneMaterialParameters(t,r);var i=new b.ShaderMaterial(n);var o=this._useMesh(t,e)?this._getImagePlaneGeo(t,e):this._getRegularFlatImagePlaneGeo(t);return new b.Mesh(o,i)};e.prototype._createCurtainMeshFisheye=function(e,t){var r=this._createTexture(e.image);var n=this._createCurtainPlaneMaterialParametersFisheye(t,r);var i=new b.ShaderMaterial(n);var o=this._useMesh(t,e)?this._getImagePlaneGeoFisheye(t,e):this._getRegularFlatImagePlaneGeo(t);return new b.Mesh(o,i)};e.prototype._createDistortedCurtainMesh=function(e,t){var r=this._createTexture(e.image);var n=this._createDistortedCurtainPlaneMaterialParameters(t,r);var i=new b.ShaderMaterial(n);var o=this._getRegularFlatImagePlaneGeo(t);return new b.Mesh(o,i)};e.prototype._createSphereCurtainMesh=function(e,t){var r=this._createTexture(e.image);var n=this._createCurtainSphereMaterialParameters(t,r);var i=new b.ShaderMaterial(n);return this._useMesh(t,e)?new b.Mesh(this._getImageSphereGeo(t,e),i):new b.Mesh(this._getFlatImageSphereGeo(t),i)};e.prototype._createImageSphere=function(e,t){var r=this._createTexture(e.image);var n=this._createSphereMaterialParameters(t,r);var i=new b.ShaderMaterial(n);var o=this._useMesh(t,e)?new b.Mesh(this._getImageSphereGeo(t,e),i):new b.Mesh(this._getFlatImageSphereGeo(t),i);return o};e.prototype._createImagePlane=function(e,t){var r=this._createTexture(e.image);var n=this._createPlaneMaterialParameters(t,r);var i=new b.ShaderMaterial(n);var o=this._useMesh(t,e)?this._getImagePlaneGeo(t,e):this._getRegularFlatImagePlaneGeo(t);return new b.Mesh(o,i)};e.prototype._createImagePlaneFisheye=function(e,t){var r=this._createTexture(e.image);var n=this._createPlaneMaterialParametersFisheye(t,r);var i=new b.ShaderMaterial(n);var o=this._useMesh(t,e)?this._getImagePlaneGeoFisheye(t,e):this._getRegularFlatImagePlaneGeoFisheye(t);return new b.Mesh(o,i)};e.prototype._createSphereMaterialParameters=function(e,t){var r=e.gpano;var n=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2;var i=2*Math.PI*(r.CroppedAreaLeftPixels-n)/r.FullPanoWidthPixels;var o=2*Math.PI*r.CroppedAreaImageWidthPixels/r.FullPanoWidthPixels;var a=(r.FullPanoHeightPixels-r.CroppedAreaImageHeightPixels)/2;var s=Math.PI*(a-r.CroppedAreaTopPixels)/r.FullPanoHeightPixels;var u=Math.PI*r.CroppedAreaImageHeightPixels/r.FullPanoHeightPixels;var c={depthWrite:false,fragmentShader:l.Shaders.equirectangular.fragment,side:b.DoubleSide,transparent:true,uniforms:{opacity:{value:1},phiLength:{value:o},phiShift:{value:i},projectorMat:{value:e.rt},projectorTex:{value:t},thetaLength:{value:u},thetaShift:{value:s}},vertexShader:l.Shaders.equirectangular.vertex};return c};e.prototype._createCurtainSphereMaterialParameters=function(e,t){var r=e.gpano;var n=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2;var i=2*Math.PI*(r.CroppedAreaLeftPixels-n)/r.FullPanoWidthPixels;var o=2*Math.PI*r.CroppedAreaImageWidthPixels/r.FullPanoWidthPixels;var a=(r.FullPanoHeightPixels-r.CroppedAreaImageHeightPixels)/2;var s=Math.PI*(a-r.CroppedAreaTopPixels)/r.FullPanoHeightPixels;var u=Math.PI*r.CroppedAreaImageHeightPixels/r.FullPanoHeightPixels;var c={depthWrite:false,fragmentShader:l.Shaders.equirectangularCurtain.fragment,side:b.DoubleSide,transparent:true,uniforms:{curtain:{value:1},opacity:{value:1},phiLength:{value:o},phiShift:{value:i},projectorMat:{value:e.rt},projectorTex:{value:t},thetaLength:{value:u},thetaShift:{value:s}},vertexShader:l.Shaders.equirectangularCurtain.vertex};return c};e.prototype._createPlaneMaterialParameters=function(e,t){var r={depthWrite:false,fragmentShader:l.Shaders.perspective.fragment,side:b.DoubleSide,transparent:true,uniforms:{focal:{value:e.focal},k1:{value:e.ck1},k2:{value:e.ck2},opacity:{value:1},projectorMat:{value:e.basicRt},projectorTex:{value:t},radial_peak:{value:!!e.radialPeak?e.radialPeak:0},scale_x:{value:Math.max(e.basicHeight,e.basicWidth)/e.basicWidth},scale_y:{value:Math.max(e.basicWidth,e.basicHeight)/e.basicHeight}},vertexShader:l.Shaders.perspective.vertex};return r};e.prototype._createPlaneMaterialParametersFisheye=function(e,t){var r={depthWrite:false,fragmentShader:l.Shaders.fisheye.fragment,side:b.DoubleSide,transparent:true,uniforms:{focal:{value:e.focal},k1:{value:e.ck1},k2:{value:e.ck2},opacity:{value:1},projectorMat:{value:e.basicRt},projectorTex:{value:t},radial_peak:{value:!!e.radialPeak?e.radialPeak:0},scale_x:{value:Math.max(e.basicHeight,e.basicWidth)/e.basicWidth},scale_y:{value:Math.max(e.basicWidth,e.basicHeight)/e.basicHeight}},vertexShader:l.Shaders.fisheye.vertex};return r};e.prototype._createCurtainPlaneMaterialParametersFisheye=function(e,t){var r={depthWrite:false,fragmentShader:l.Shaders.fisheyeCurtain.fragment,side:b.DoubleSide,transparent:true,uniforms:{curtain:{value:1},focal:{value:e.focal},k1:{value:e.ck1},k2:{value:e.ck2},opacity:{value:1},projectorMat:{value:e.basicRt},projectorTex:{value:t},radial_peak:{value:!!e.radialPeak?e.radialPeak:0},scale_x:{value:Math.max(e.basicHeight,e.basicWidth)/e.basicWidth},scale_y:{value:Math.max(e.basicWidth,e.basicHeight)/e.basicHeight}},vertexShader:l.Shaders.fisheyeCurtain.vertex};return r};e.prototype._createCurtainPlaneMaterialParameters=function(e,t){var r={depthWrite:false,fragmentShader:l.Shaders.perspectiveCurtain.fragment,side:b.DoubleSide,transparent:true,uniforms:{curtain:{value:1},focal:{value:e.focal},k1:{value:e.ck1},k2:{value:e.ck2},opacity:{value:1},projectorMat:{value:e.basicRt},projectorTex:{value:t},radial_peak:{value:!!e.radialPeak?e.radialPeak:0},scale_x:{value:Math.max(e.basicHeight,e.basicWidth)/e.basicWidth},scale_y:{value:Math.max(e.basicWidth,e.basicHeight)/e.basicHeight}},vertexShader:l.Shaders.perspectiveCurtain.vertex};return r};e.prototype._createDistortedCurtainPlaneMaterialParameters=function(e,t){var r={depthWrite:false,fragmentShader:l.Shaders.perspectiveDistortedCurtain.fragment,side:b.DoubleSide,transparent:true,uniforms:{curtain:{value:1},opacity:{value:1},projectorMat:{value:e.projectorMatrix()},projectorTex:{value:t}},vertexShader:l.Shaders.perspectiveDistortedCurtain.vertex};return r};e.prototype._createDistortedPlaneMaterialParameters=function(e,t){var r={depthWrite:false,fragmentShader:l.Shaders.perspectiveDistorted.fragment,side:b.DoubleSide,transparent:true,uniforms:{opacity:{value:1},projectorMat:{value:e.projectorMatrix()},projectorTex:{value:t}},vertexShader:l.Shaders.perspectiveDistorted.vertex};return r};e.prototype._createTexture=function(e){var t=new b.Texture(e);t.minFilter=b.LinearFilter;t.needsUpdate=true;return t};e.prototype._useMesh=function(e,t){return t.mesh.vertices.length&&e.hasValidScale};e.prototype._getImageSphereGeo=function(e,t){var r=(new b.Matrix4).getInverse(e.srt);var n=5*e.scale;var i=this._imageSphereRadius*e.scale;var o=t.mesh.vertices;var a=o.length/3;var s=new Float32Array(o.length);for(var u=0;u<a;++u){var c=3*u;var l=o[c+0];var h=o[c+1];var p=o[c+2];var f=Math.sqrt(l*l+h*h+p*p);var d=Math.max(n,Math.min(f,i));var v=d/f;var m=new b.Vector3(l*v,h*v,p*v);m.applyMatrix4(r);s[c+0]=m.x;s[c+1]=m.y;s[c+2]=m.z}var g=t.mesh.faces;var _=new Uint16Array(g.length);for(var u=0;u<g.length;++u){_[u]=g[u]}var y=new b.BufferGeometry;y.setAttribute("position",new b.BufferAttribute(s,3));y.setIndex(new b.BufferAttribute(_,1));return y};e.prototype._getImagePlaneGeo=function(e,t){var r=3;var n=(new b.Matrix4).getInverse(e.srt);var i=5*e.scale;var o=this._imagePlaneDepth*e.scale;var a=t.mesh.vertices;var s=a.length/3;var u=new Float32Array(a.length);for(var c=0;c<s;++c){var l=3*c;var h=a[l+0];var p=a[l+1];var f=a[l+2];if(c<4){h*=r;p*=r}var d=Math.max(i,Math.min(f,o));var v=d/f;var m=new b.Vector3(h*v,p*v,d);m.applyMatrix4(n);u[l+0]=m.x;u[l+1]=m.y;u[l+2]=m.z}var g=t.mesh.faces;var _=new Uint16Array(g.length);for(var c=0;c<g.length;++c){_[c]=g[c]}var y=new b.BufferGeometry;y.setAttribute("position",new b.BufferAttribute(u,3));y.setIndex(new b.BufferAttribute(_,1));return y};e.prototype._getImagePlaneGeoFisheye=function(e,t){var r=(new b.Matrix4).getInverse(e.srt);var n=5*e.scale;var i=this._imagePlaneDepth*e.scale;var o=t.mesh.vertices;var a=o.length/3;var s=new Float32Array(o.length);for(var u=0;u<a;++u){var c=3*u;var l=o[c+0];var h=o[c+1];var p=o[c+2];var f=Math.sqrt(l*l+h*h+p*p);var d=Math.max(n,Math.min(f,i));var v=d/f;var m=new b.Vector3(l*v,h*v,p*v);m.applyMatrix4(r);s[c+0]=m.x;s[c+1]=m.y;s[c+2]=m.z}var g=t.mesh.faces;var _=new Uint16Array(g.length);for(var u=0;u<g.length;++u){_[u]=g[u]}var y=new b.BufferGeometry;y.setAttribute("position",new b.BufferAttribute(s,3));y.setIndex(new b.BufferAttribute(_,1));return y};e.prototype._getFlatImageSphereGeo=function(e){var t=e.gpano;var r=2*Math.PI*t.CroppedAreaLeftPixels/t.FullPanoWidthPixels;var n=2*Math.PI*t.CroppedAreaImageWidthPixels/t.FullPanoWidthPixels;var i=Math.PI*(t.FullPanoHeightPixels-t.CroppedAreaImageHeightPixels-t.CroppedAreaTopPixels)/t.FullPanoHeightPixels;var o=Math.PI*t.CroppedAreaImageHeightPixels/t.FullPanoHeightPixels;var a=new b.SphereGeometry(this._imageSphereRadius,20,40,r-Math.PI/2,n,i,o);a.applyMatrix4((new b.Matrix4).getInverse(e.rt));return a};e.prototype._getRegularFlatImagePlaneGeo=function(e){var t=e.width;var r=e.height;var n=Math.max(t,r);var i=t/2/n;var o=r/2/n;return this._getFlatImagePlaneGeo(e,i,o)};e.prototype._getFlatImagePlaneGeo=function(e,t,r){var n=[];n.push(e.unprojectSfM([-t,-r],this._imagePlaneDepth));n.push(e.unprojectSfM([t,-r],this._imagePlaneDepth));n.push(e.unprojectSfM([t,r],this._imagePlaneDepth));n.push(e.unprojectSfM([-t,r],this._imagePlaneDepth));return this._createFlatGeometry(n)};e.prototype._getRegularFlatImagePlaneGeoFisheye=function(e){var t=e.width;var r=e.height;var n=Math.max(t,r);var i=t/2/n;var o=r/2/n;return this._getFlatImagePlaneGeoFisheye(e,i,o)};e.prototype._getFlatImagePlaneGeoFisheye=function(e,t,r){var n=[];n.push(e.unprojectSfM([-t,-r],this._imagePlaneDepth));n.push(e.unprojectSfM([t,-r],this._imagePlaneDepth));n.push(e.unprojectSfM([t,r],this._imagePlaneDepth));n.push(e.unprojectSfM([-t,r],this._imagePlaneDepth));return this._createFlatGeometry(n)};e.prototype._getFlatImagePlaneGeoFromBasic=function(e,t,r,n,i){var o=[];o.push(e.unprojectBasic([t,n],this._imagePlaneDepth));o.push(e.unprojectBasic([r,n],this._imagePlaneDepth));o.push(e.unprojectBasic([r,i],this._imagePlaneDepth));o.push(e.unprojectBasic([t,i],this._imagePlaneDepth));return this._createFlatGeometry(o)};e.prototype._createFlatGeometry=function(e){var t=new Float32Array(12);for(var r=0;r<e.length;r++){var n=3*r;t[n+0]=e[r][0];t[n+1]=e[r][1];t[n+2]=e[r][2]}var i=new Uint16Array(6);i[0]=0;i[1]=1;i[2]=3;i[3]=1;i[4]=2;i[5]=3;var o=new b.BufferGeometry;o.setAttribute("position",new b.BufferAttribute(t,3));o.setIndex(new b.BufferAttribute(i,1));return o};return e}();r.MeshFactory=n;r.default=n},{"../../Component":291,three:242}],407:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MeshScene=void 0;var n=e("three");var i=function(){function e(){this._planes={};this._planesOld={};this._planesPeriphery={};this._scene=new n.Scene;this._sceneOld=new n.Scene;this._scenePeriphery=new n.Scene}Object.defineProperty(e.prototype,"planes",{get:function(){return this._planes},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"planesOld",{get:function(){return this._planesOld},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"planesPeriphery",{get:function(){return this._planesPeriphery},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sceneOld",{get:function(){return this._sceneOld},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"scenePeriphery",{get:function(){return this._scenePeriphery},enumerable:false,configurable:true});e.prototype.updateImagePlanes=function(e){this._dispose(this._planesOld,this.sceneOld);for(var t in this._planes){if(!this._planes.hasOwnProperty(t)){continue}var r=this._planes[t];this._scene.remove(r);this._sceneOld.add(r)}for(var t in e){if(!e.hasOwnProperty(t)){continue}this._scene.add(e[t])}this._planesOld=this._planes;this._planes=e};e.prototype.addImagePlanes=function(e){for(var t in e){if(!e.hasOwnProperty(t)){continue}var r=e[t];this._scene.add(r);this._planes[t]=r}};e.prototype.addImagePlanesOld=function(e){for(var t in e){if(!e.hasOwnProperty(t)){continue}var r=e[t];this._sceneOld.add(r);this._planesOld[t]=r}};e.prototype.setImagePlanes=function(e){this._clear();this.addImagePlanes(e)};e.prototype.addPeripheryPlanes=function(e){for(var t in e){if(!e.hasOwnProperty(t)){continue}var r=e[t];this._scenePeriphery.add(r);this._planesPeriphery[t]=r}};e.prototype.setPeripheryPlanes=function(e){this._clearPeriphery();this.addPeripheryPlanes(e)};e.prototype.setImagePlanesOld=function(e){this._clearOld();this.addImagePlanesOld(e)};e.prototype.clear=function(){this._clear();this._clearOld()};e.prototype._clear=function(){this._dispose(this._planes,this._scene);this._planes={}};e.prototype._clearOld=function(){this._dispose(this._planesOld,this._sceneOld);this._planesOld={}};e.prototype._clearPeriphery=function(){this._dispose(this._planesPeriphery,this._scenePeriphery);this._planesPeriphery={}};e.prototype._dispose=function(e,t){for(var r in e){if(!e.hasOwnProperty(r)){continue}var n=e[r];t.remove(n);n.geometry.dispose();n.material.dispose();var i=n.material.uniforms.projectorTex.value;if(i!=null){i.dispose()}}};return e}();r.MeshScene=i;r.default=i},{three:242}],408:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MouseOperator=void 0;var o=e("rxjs");var a=e("rxjs/operators");var n=function(){function e(){}e.filteredPairwiseMouseDrag$=function(n,i){return i.filtered$(n,i.mouseDragStart$).pipe(a.switchMap(function(e){var t=o.concat(o.of(e),i.filtered$(n,i.mouseDrag$));var r=i.filtered$(n,i.mouseDragEnd$).pipe(a.map(function(){return null}));return o.merge(t,r).pipe(a.takeWhile(function(e){return!!e}),a.startWith(null))}),a.pairwise(),a.filter(function(e){return e[0]!=null&&e[1]!=null}))};return e}();r.MouseOperator=n;r.default=n},{rxjs:43,"rxjs/operators":241}],409:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ZoomComponent=void 0;var o=e("rxjs");var a=e("rxjs/operators");var p=e("virtual-dom");var i=e("../../Component");var s=e("../../Geo");var f=e("../../State");var d=e("../utils/ComponentSize");var u=function(i){n(e,i);function e(e,t,r){var n=i.call(this,e,t,r)||this;n._viewportCoords=new s.ViewportCoords;n._zoomDelta$=new o.Subject;return n}e.prototype._activate=function(){var h=this;this._renderSubscription=o.combineLatest(this._navigator.stateService.currentState$,this._navigator.stateService.state$,this._configuration$,this._container.renderService.size$).pipe(a.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];var o=t.state.zoom;var a=p.h("div.ZoomInIcon",[]);var s=o>=3||r===f.State.Waiting?p.h("div.ZoomInButtonDisabled",[a]):p.h("div.ZoomInButton",{onclick:function(){h._zoomDelta$.next(1)}},[a]);var u=p.h("div.ZoomOutIcon",[]);var c=o<=0||r===f.State.Waiting?p.h("div.ZoomOutButtonDisabled",[u]):p.h("div.ZoomOutButton",{onclick:function(){h._zoomDelta$.next(-1)}},[u]);var l=n.size===d.default.Small||n.size===d.default.Automatic&&i.width<640?".ZoomCompact":"";return{name:h._name,vnode:p.h("div.ZoomContainer"+l,{oncontextmenu:function(e){e.preventDefault()}},[s,c])}})).subscribe(this._container.domRenderer.render$);this._zoomSubscription=this._zoomDelta$.pipe(a.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2];var i=h._viewportCoords.unprojectFromViewport(0,0,r.perspective);var o=n.projectBasic(i.toArray());h._navigator.stateService.zoomIn(t,o)})};e.prototype._deactivate=function(){this._renderSubscription.unsubscribe();this._zoomSubscription.unsubscribe()};e.prototype._getDefaultConfiguration=function(){return{size:d.default.Automatic}};e.componentName="zoom";return e}(i.Component);r.ZoomComponent=u;i.ComponentService.register(u);r.default=u},{"../../Component":291,"../../Geo":294,"../../State":298,"../utils/ComponentSize":404,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],410:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.AbortMapillaryError=void 0;var n=e("./MapillaryError");var o=function(r){i(n,r);function n(e){var t=r.call(this,e!=null?e:"The request was aborted.")||this;Object.setPrototypeOf(t,n.prototype);t.name="AbortMapillaryError";return t}return n}(n.MapillaryError);r.AbortMapillaryError=o;r.default=o},{"./MapillaryError":413}],411:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.ArgumentMapillaryError=void 0;var n=e("./MapillaryError");var o=function(r){i(n,r);function n(e){var t=r.call(this,e!=null?e:"The argument is not valid.")||this;Object.setPrototypeOf(t,n.prototype);t.name="ArgumentMapillaryError";return t}return n}(n.MapillaryError);r.ArgumentMapillaryError=o;r.default=o},{"./MapillaryError":413}],412:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.GraphMapillaryError=void 0;var n=e("./MapillaryError");var o=function(r){i(n,r);function n(e){var t=r.call(this,e)||this;Object.setPrototypeOf(t,n.prototype);t.name="GraphMapillaryError";return t}return n}(n.MapillaryError);r.GraphMapillaryError=o;r.default=o},{"./MapillaryError":413}],413:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.MapillaryError=void 0;var n=function(r){i(n,r);function n(e){var t=r.call(this,e)||this;Object.setPrototypeOf(t,n.prototype);t.name="MapillaryError";return t}return n}(Error);r.MapillaryError=n;r.default=n},{}],414:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Camera=void 0;var n=e("three");var i=function(){function t(e){if(e!=null){this._position=(new n.Vector3).fromArray(e.unprojectSfM([0,0],0));this._lookat=(new n.Vector3).fromArray(e.unprojectSfM([0,0],10));this._up=e.upVector();this._focal=this._getFocal(e)}else{this._position=new n.Vector3(0,0,0);this._lookat=new n.Vector3(0,0,1);this._up=new n.Vector3(0,-1,0);this._focal=1}}Object.defineProperty(t.prototype,"position",{get:function(){return this._position},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lookat",{get:function(){return this._lookat},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"up",{get:function(){return this._up},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"focal",{get:function(){return this._focal},set:function(e){this._focal=e},enumerable:false,configurable:true});t.prototype.lerpCameras=function(e,t,r){this._position.subVectors(t.position,e.position).multiplyScalar(r).add(e.position);this._lookat.subVectors(t.lookat,e.lookat).multiplyScalar(r).add(e.lookat);this._up.subVectors(t.up,e.up).multiplyScalar(r).add(e.up);this._focal=(1-r)*e.focal+r*t.focal};t.prototype.copy=function(e){this._position.copy(e.position);this._lookat.copy(e.lookat);this._up.copy(e.up);this._focal=e.focal};t.prototype.clone=function(){var e=new t;e.position.copy(this._position);e.lookat.copy(this._lookat);e.up.copy(this._up);e.focal=this._focal;return e};t.prototype.diff=function(e){var t=this._position.distanceToSquared(e.position);var r=this._lookat.distanceToSquared(e.lookat);var n=this._up.distanceToSquared(e.up);var i=100*Math.abs(this._focal-e.focal);return Math.max(t,r,n,i)};t.prototype._getFocal=function(e){if(e.gpano==null){return e.focal}var t=Math.PI*e.gpano.CroppedAreaImageHeightPixels/e.gpano.FullPanoHeightPixels;var r=.5/Math.tan(t/2);return Math.min(1/(2*(Math.sqrt(2)-1)),Math.max(.5,r))};return t}();r.Camera=i},{three:242}],415:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.computeProjectedPoints=r.computeTranslation=void 0;var p=e("three");var n=e("../Geo");var a=new n.GeoCoords;var s=new n.Spatial;function i(e,t,r){var n=a.geodeticToEnu(e.lat,e.lon,e.alt,r.lat,r.lon,r.alt);var i=s.rotate(n,t);var o=[-i.x,-i.y,-i.z];return o}r.computeTranslation=i;function o(n,e,t,r,i){var o=[];for(var a=0;a<e.length;++a){var s=e[a];var u=t[a];for(var c=0;c<=r;++c){o.push([s[0]+u[0]*c/r,s[1]+u[1]*c/r])}}var l=new p.Camera;l.up.copy(n.upVector());l.position.copy((new p.Vector3).fromArray(n.unprojectSfM([0,0],0)));l.lookAt((new p.Vector3).fromArray(n.unprojectSfM([0,0],10)));l.updateMatrix();l.updateMatrixWorld(true);var h=o.map(function(e){var t=n.unprojectBasic(e,1e4);var r=i.worldToCamera(t,l);return[Math.abs(r[0]/r[2]),Math.abs(r[1]/r[2])]});return h}r.computeProjectedPoints=o},{"../Geo":294,three:242}],416:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GeoCoords=void 0;var n=function(){function e(){this._wgs84a=6378137;this._wgs84b=6356752.31424518}e.prototype.geodeticToEnu=function(e,t,r,n,i,o){var a=this.geodeticToEcef(e,t,r);return this.ecefToEnu(a[0],a[1],a[2],n,i,o)};e.prototype.enuToGeodetic=function(e,t,r,n,i,o){var a=this.enuToEcef(e,t,r,n,i,o);return this.ecefToGeodetic(a[0],a[1],a[2])};e.prototype.ecefToEnu=function(e,t,r,n,i,o){var a=this.geodeticToEcef(n,i,o);var s=[e-a[0],t-a[1],r-a[2]];n=n*Math.PI/180;i=i*Math.PI/180;var u=Math.cos(n);var c=Math.sin(n);var l=Math.cos(i);var h=Math.sin(i);var p=-h*s[0]+l*s[1];var f=-c*l*s[0]-c*h*s[1]+u*s[2];var d=u*l*s[0]+u*h*s[1]+c*s[2];return[p,f,d]};e.prototype.enuToEcef=function(e,t,r,n,i,o){var a=this.geodeticToEcef(n,i,o);n=n*Math.PI/180;i=i*Math.PI/180;var s=Math.cos(n);var u=Math.sin(n);var c=Math.cos(i);var l=Math.sin(i);var h=-l*e-u*c*t+s*c*r+a[0];var p=c*e-u*l*t+s*l*r+a[1];var f=s*t+u*r+a[2];return[h,p,f]};e.prototype.geodeticToEcef=function(e,t,r){var n=this._wgs84a;var i=this._wgs84b;e=e*Math.PI/180;t=t*Math.PI/180;var o=Math.cos(e);var a=Math.sin(e);var s=Math.cos(t);var u=Math.sin(t);var c=n*n;var l=i*i;var h=1/Math.sqrt(c*o*o+l*a*a);var p=(c*h+r)*o;var f=p*s;var d=p*u;var v=(l*h+r)*a;return[f,d,v]};e.prototype.ecefToGeodetic=function(e,t,r){var n=this._wgs84a;var i=this._wgs84b;var o=n*n;var a=i*i;var s=o-a;var u=Math.sqrt(s/o);var c=Math.sqrt(s/a);var l=Math.sqrt(e*e+t*t);var h=Math.atan2(r*n,l*i);var p=Math.sin(h);var f=Math.cos(h);var d=Math.atan2(t,e);var v=Math.atan2(r+c*c*i*p*p*p,l-u*u*n*f*f*f);var m=Math.sin(v);var g=Math.cos(v);var _=n/Math.sqrt(1-u*u*m*m);var y=l/g-_;return[v*180/Math.PI,d*180/Math.PI,y]};return e}();r.GeoCoords=n;r.default=n},{}],417:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.GeoRBush=void 0;var i=e("rbush");var o=function(e){n(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.compareMinX=function(e,t){return e.lat-t.lat};t.prototype.compareMinY=function(e,t){return e.lon-t.lon};t.prototype.toBBox=function(e){return{minX:e.lat,minY:e.lon,maxX:e.lat,maxY:e.lon}};return t}(i);r.GeoRBush=o;r.default=o},{rbush:42}],418:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.segmentIntersection=r.segmentsIntersect=void 0;function i(e){return e>0?1:e<0?-1:0}function a(e,t){return e.x<=Math.max(t.p1.x,t.p2.x)&&e.x>=Math.min(t.p1.x,t.p2.x)&&e.y>=Math.max(t.p1.y,t.p2.y)&&e.y>=Math.min(t.p1.y,t.p2.y)}function f(e,t){var r=e.p2.x-e.p1.x;var n=e.p2.y-e.p1.y;var i=t.p2.x-t.p1.x;var o=t.p2.y-t.p1.y;var a=r*o-n*i;var s=r*r+n*n;var u=i*i+o*o;var c=1e-10;return a*a<c*s*u}function s(e,t,r){var n=(t.y-e.y)*(r.x-t.x)-(r.y-t.y)*(t.x-e.x);return i(n)}function n(e,t){if(f(e,t)){return false}var r=s(e.p1,e.p2,t.p1);var n=s(e.p1,e.p2,t.p2);var i=s(t.p1,t.p2,e.p1);var o=s(t.p1,t.p2,e.p2);if(r!==n&&i!==o){return true}if(r===0&&a(t.p1,e)){return true}if(n===0&&a(t.p2,e)){return true}if(i===0&&a(e.p1,t)){return true}if(o===0&&a(e.p2,t)){return true}return false}r.segmentsIntersect=n;function o(e,t){if(f(e,t)){return undefined}var r=e.p1.x;var n=e.p2.x;var i=e.p1.y;var o=e.p2.y;var a=t.p1.x;var s=t.p2.x;var u=t.p1.y;var c=t.p2.y;var l=(r-n)*(u-c)-(i-o)*(a-s);var h=(r*o-i*n)*(a-s)-(r-n)*(a*c-u*s);var p=(r*o-i*n)*(u-c)-(i-o)*(a*c-u*s);return{x:h/l,y:p/l}}r.segmentIntersection=o},{}],419:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Spatial=void 0;var a=e("three");var n=function(){function e(){this._epsilon=1e-9}e.prototype.azimuthalToBearing=function(e){return-e+Math.PI/2};e.prototype.degToRad=function(e){return Math.PI*e/180};e.prototype.radToDeg=function(e){return 180*e/Math.PI};e.prototype.rotationMatrix=function(e){var t=new a.Vector3(e[0],e[1],e[2]);var r=t.length();if(r>0){t.normalize()}return(new a.Matrix4).makeRotationAxis(t,r)};e.prototype.rotate=function(e,t){var r=new a.Vector3(e[0],e[1],e[2]);var n=this.rotationMatrix(t);r.applyMatrix4(n);return r};e.prototype.opticalCenter=function(e,t){var r=[-e[0],-e[1],-e[2]];var n=[-t[0],-t[1],-t[2]];return this.rotate(n,r)};e.prototype.viewingDirection=function(e){var t=[-e[0],-e[1],-e[2]];return this.rotate([0,0,1],t)};e.prototype.wrap=function(e,t,r){if(r<t){throw new Error("Invalid arguments: max must be larger than min.")}var n=r-t;while(e>r||e<t){if(e>r){e=e-n}else if(e<t){e=e+n}}return e};e.prototype.wrapAngle=function(e){return this.wrap(e,-Math.PI,Math.PI)};e.prototype.clamp=function(e,t,r){if(e<t){return t}if(e>r){return r}return e};e.prototype.angleBetweenVector2=function(e,t,r,n){var i=Math.atan2(n,r)-Math.atan2(t,e);return this.wrapAngle(i)};e.prototype.angleDifference=function(e,t){var r=t-e;return this.wrapAngle(r)};e.prototype.relativeRotationAngle=function(e,t){var r=this.rotationMatrix([-e[0],-e[1],-e[2]]);var n=this.rotationMatrix(t);var i=r.multiply(n);var o=i.elements;var a=o[0]+o[5]+o[10];var s=Math.acos(Math.max(Math.min((a-1)/2,1),-1));return s};e.prototype.angleToPlane=function(e,t){var r=(new a.Vector3).fromArray(e);var n=r.length();if(n<this._epsilon){return 0}var i=r.dot((new a.Vector3).fromArray(t));return Math.asin(i/n)};e.prototype.azimuthal=function(e,t){var r=(new a.Vector3).fromArray(e);var n=(new a.Vector3).fromArray(t);var i=r.clone().dot(n);var o=r.clone().sub(n.clone().multiplyScalar(i));return Math.atan2(o.y,o.x)};e.prototype.distanceFromLatLon=function(e,t,r,n){var i=6371e3;var o=this.degToRad(r-e);var a=this.degToRad(n-t);var s=Math.sin(o/2)*Math.sin(o/2)+Math.cos(this.degToRad(e))*Math.cos(this.degToRad(r))*Math.sin(a/2)*Math.sin(a/2);var u=2*i*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return u};return e}();r.Spatial=n;r.default=n},{three:242}],420:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Transform=void 0;var b=e("three");var n=function(){function e(e,t,r,n,i,o,a,s,u,c,l,h,p){this._orientation=this._getValue(e,1);var f=u!=null?u.width:4;var d=u!=null?u.height:3;var v=this._orientation<5;this._width=this._getValue(t,v?f:d);this._height=this._getValue(r,v?d:f);this._basicAspect=v?this._width/this._height:this._height/this._width;this._basicWidth=v?t:r;this._basicHeight=v?r:t;this._focal=this._getValue(n,1);this._scale=this._getValue(i,0);this._gpano=o!=null?o:null;this._rt=this._getRt(a,s);this._srt=this._getSrt(this._rt,this._scale);this._basicRt=this._getBasicRt(this._rt,e);this._textureScale=!!c?c:[1,1];this._ck1=!!l?l:0;this._ck2=!!h?h:0;this._cameraProjection=!!p?p:!!o?"equirectangular":"perspective";this._radialPeak=this._getRadialPeak(this._ck1,this._ck2)}Object.defineProperty(e.prototype,"ck1",{get:function(){return this._ck1},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ck2",{get:function(){return this._ck2},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"cameraProjection",{get:function(){return this._cameraProjection},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"basicAspect",{get:function(){return this._basicAspect},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"basicHeight",{get:function(){return this._basicHeight},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"basicRt",{get:function(){return this._basicRt},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"basicWidth",{get:function(){return this._basicWidth},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"focal",{get:function(){return this._focal},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"fullPano",{get:function(){return this._gpano!=null&&this._gpano.CroppedAreaLeftPixels===0&&this._gpano.CroppedAreaTopPixels===0&&this._gpano.CroppedAreaImageWidthPixels===this._gpano.FullPanoWidthPixels&&this._gpano.CroppedAreaImageHeightPixels===this._gpano.FullPanoHeightPixels},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"gpano",{get:function(){return this._gpano},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"rt",{get:function(){return this._rt},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"srt",{get:function(){return this._srt},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"scale",{get:function(){return this._scale},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"hasValidScale",{get:function(){return this._scale>.01&&this._scale<50},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"radialPeak",{get:function(){return this._radialPeak},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:false,configurable:true});e.prototype.upVector=function(){var e=this._rt.elements;switch(this._orientation){case 1:return new b.Vector3(-e[1],-e[5],-e[9]);case 3:return new b.Vector3(e[1],e[5],e[9]);case 6:return new b.Vector3(-e[0],-e[4],-e[8]);case 8:return new b.Vector3(e[0],e[4],e[8]);default:return new b.Vector3(-e[1],-e[5],-e[9])}};e.prototype.projectorMatrix=function(){var e=this._normalizedToTextureMatrix();var t=this._focal;var r=(new b.Matrix4).set(t,0,0,0,0,t,0,0,0,0,0,0,0,0,1,0);e.multiply(r);e.multiply(this._rt);return e};e.prototype.projectBasic=function(e){var t=this.projectSfM(e);return this._sfmToBasic(t)};e.prototype.unprojectBasic=function(e,t,r){var n=this._basicToSfm(e);return this.unprojectSfM(n,t,r)};e.prototype.projectSfM=function(e){var t=new b.Vector4(e[0],e[1],e[2],1);t.applyMatrix4(this._rt);return this._bearingToSfm([t.x,t.y,t.z])};e.prototype.unprojectSfM=function(e,t,r){var n=this._sfmToBearing(e);var i=r&&!this.gpano?new b.Vector4(t*n[0]/n[2],t*n[1]/n[2],t,1):new b.Vector4(t*n[0],t*n[1],t*n[2],1);i.applyMatrix4((new b.Matrix4).getInverse(this._rt));return[i.x/i.w,i.y/i.w,i.z/i.w]};e.prototype._sfmToBearing=function(e){if(this._fullPano()){var t=e[0]*2*Math.PI;var r=-e[1]*2*Math.PI;var n=Math.cos(r)*Math.sin(t);var i=-Math.sin(r);var o=Math.cos(r)*Math.cos(t);return[n,i,o]}else if(this._gpano){var a=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels);var s=[e[0]*a+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,e[1]*a+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels];var t=2*Math.PI*(s[0]/this.gpano.FullPanoWidthPixels-.5);var r=-Math.PI*(s[1]/this.gpano.FullPanoHeightPixels-.5);var n=Math.cos(r)*Math.sin(t);var i=-Math.sin(r);var o=Math.cos(r)*Math.cos(t);return[n,i,o]}else if(this._cameraProjection==="fisheye"){var u=[e[0]/this._focal,e[1]/this._focal],c=u[0],l=u[1];var h=Math.sqrt(c*c+l*l);var p=this._distortionFromDistortedRadius(h,this._ck1,this._ck2,this._radialPeak);var f=h/p;var o=Math.cos(f);var d=Math.sin(f);var n=d*c/h;var i=d*l/h;return[n,i,o]}else{var v=[e[0]/this._focal,e[1]/this._focal],c=v[0],l=v[1];var m=Math.sqrt(c*c+l*l);var p=this._distortionFromDistortedRadius(m,this._ck1,this._ck2,this._radialPeak);var g=c/p;var _=l/p;var y=new b.Vector3(g,_,1);y.normalize();return[y.x,y.y,y.z]}};e.prototype._distortionFromDistortedRadius=function(e,t,r,n){var i=1;for(var o=0;o<10;o++){var a=e/i;if(a>n){a=n}i=1+t*Math.pow(a,2)+r*Math.pow(a,4)}return i};e.prototype._bearingToSfm=function(e){if(this._fullPano()){var t=e[0];var r=e[1];var n=e[2];var i=Math.atan2(t,n);var o=Math.atan2(-r,Math.sqrt(t*t+n*n));return[i/(2*Math.PI),-o/(2*Math.PI)]}else if(this._gpano){var t=e[0];var r=e[1];var n=e[2];var i=Math.atan2(t,n);var o=Math.atan2(-r,Math.sqrt(t*t+n*n));var a=[(i/(2*Math.PI)+.5)*this.gpano.FullPanoWidthPixels,(-o/Math.PI+.5)*this.gpano.FullPanoHeightPixels];var s=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels);return[(a[0]-this.gpano.CroppedAreaLeftPixels-this.gpano.CroppedAreaImageWidthPixels/2)/s,(a[1]-this.gpano.CroppedAreaTopPixels-this.gpano.CroppedAreaImageHeightPixels/2)/s]}else if(this._cameraProjection==="fisheye"){if(e[2]>0){var t=e[0],r=e[1],n=e[2];var u=Math.sqrt(t*t+r*r);var c=Math.atan2(u,n);if(c>this._radialPeak){c=this._radialPeak}var l=1+Math.pow(c,2)*(this._ck1+Math.pow(c,2)*this._ck2);var h=this._focal*l*c/u;return[h*t,h*r]}else{return[e[0]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,e[1]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY]}}else{if(e[2]>0){var p=[e[0]/e[2],e[1]/e[2]],f=p[0],d=p[1];var v=f*f+d*d;var m=Math.pow(this._radialPeak,2);if(v>m){v=m}var g=1+this._ck1*v+this._ck2*Math.pow(v,2);return[this._focal*g*f,this._focal*g*d]}else{return[e[0]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,e[1]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY]}}};e.prototype._basicToSfm=function(e){var t;var r;switch(this._orientation){case 1:t=e[0];r=e[1];break;case 3:t=1-e[0];r=1-e[1];break;case 6:t=e[1];r=1-e[0];break;case 8:t=1-e[1];r=e[0];break;default:t=e[0];r=e[1];break}var n=this._width;var i=this._height;var o=Math.max(n,i);var a=t*n/o-n/o/2;var s=r*i/o-i/o/2;return[a,s]};e.prototype._sfmToBasic=function(e){var t=this._width;var r=this._height;var n=Math.max(t,r);var i=(e[0]+t/n/2)/t*n;var o=(e[1]+r/n/2)/r*n;var a;var s;switch(this._orientation){case 1:a=i;s=o;break;case 3:a=1-i;s=1-o;break;case 6:a=1-o;s=i;break;case 8:a=o;s=1-i;break;default:a=i;s=o;break}return[a,s]};e.prototype._fullPano=function(){return this.gpano!=null&&this.gpano.CroppedAreaLeftPixels===0&&this.gpano.CroppedAreaTopPixels===0&&this.gpano.CroppedAreaImageWidthPixels===this.gpano.FullPanoWidthPixels&&this.gpano.CroppedAreaImageHeightPixels===this.gpano.FullPanoHeightPixels};e.prototype._getValue=function(e,t){return e!=null&&e>0?e:t};e.prototype._getRt=function(e,t){var r=new b.Vector3(e[0],e[1],e[2]);var n=r.length();if(n>0){r.normalize()}var i=new b.Matrix4;i.makeRotationAxis(r,n);i.setPosition(new b.Vector3(t[0],t[1],t[2]));return i};e.prototype._getSrt=function(e,t){var r=e.clone();var n=r.elements;n[12]=t*n[12];n[13]=t*n[13];n[14]=t*n[14];r.scale(new b.Vector3(t,t,t));return r};e.prototype._getBasicRt=function(e,t){var r=new b.Vector3(0,0,1);var n=0;switch(t){case 3:n=Math.PI;break;case 6:n=Math.PI/2;break;case 8:n=3*Math.PI/2;break;default:break}return(new b.Matrix4).makeRotationAxis(r,n).multiply(e)};e.prototype._getRadialPeak=function(e,t){var r=5*t;var n=3*e;var i=1;var o=Math.pow(n,2)-4*r*i;if(o<0){return undefined}var a=(-n-Math.sqrt(o))/2/r;var s=(-n+Math.sqrt(o))/2/r;var u=Math.min(a,s);var c=Math.max(a,s);return u>0?Math.sqrt(u):c>0?Math.sqrt(c):undefined};e.prototype._normalizedToTextureMatrix=function(){var e=Math.max(this._width,this._height);var t=this._orientation<5?this._textureScale[0]:this._textureScale[1];var r=this._orientation<5?this._textureScale[1]:this._textureScale[0];var n=e/this._width*t;var i=e/this._height*r;switch(this._orientation){case 1:return(new b.Matrix4).set(n,0,0,.5,0,-i,0,.5,0,0,1,0,0,0,0,1);case 3:return(new b.Matrix4).set(-n,0,0,.5,0,i,0,.5,0,0,1,0,0,0,0,1);case 6:return(new b.Matrix4).set(0,-i,0,.5,-n,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new b.Matrix4).set(0,i,0,.5,n,0,0,.5,0,0,1,0,0,0,0,1);default:return(new b.Matrix4).set(n,0,0,.5,0,-i,0,.5,0,0,1,0,0,0,0,1)}};return e}();r.Transform=n},{three:242}],421:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ViewportCoords=void 0;var a=e("three");var n=function(){function e(){this._unprojectDepth=200}e.prototype.basicToCanvas=function(e,t,r,n,i){var o=n.unprojectBasic([e,t],this._unprojectDepth);var a=this.projectToCanvas(o,r,i);return a};e.prototype.basicToCanvasSafe=function(e,t,r,n,i){var o=this.basicToViewportSafe(e,t,n,i);if(o===null){return null}var a=this.viewportToCanvas(o[0],o[1],r);return a};e.prototype.basicToViewport=function(e,t,r,n){var i=r.unprojectBasic([e,t],this._unprojectDepth);var o=this.projectToViewport(i,n);return o};e.prototype.basicToViewportSafe=function(e,t,r,n){var i=r.unprojectBasic([e,t],this._unprojectDepth);var o=this.worldToCamera(i,n);if(o[2]>0){return null}var a=this.projectToViewport(i,n);return a};e.prototype.cameraToViewport=function(e,t){var r=(new a.Vector3).fromArray(e).applyMatrix4(t.projectionMatrix);return[r.x,r.y]};e.prototype.canvasPosition=function(e,t){var r=t.getBoundingClientRect();var n=e.clientX-r.left-t.clientLeft;var i=e.clientY-r.top-t.clientTop;return[n,i]};e.prototype.canvasToBasic=function(e,t,r,n,i){var o=this.unprojectFromCanvas(e,t,r,i).toArray();var a=n.projectBasic(o);return a};e.prototype.canvasToViewport=function(e,t,r){var n=this.containerToCanvas(r),i=n[0],o=n[1];var a=2*e/i-1;var s=1-2*t/o;return[a,s]};e.prototype.containerToCanvas=function(e){return[e.offsetWidth,e.offsetHeight]};e.prototype.getBasicDistances=function(e,t){var r=this.viewportToBasic(-1,1,e,t);var n=this.viewportToBasic(1,1,e,t);var i=this.viewportToBasic(1,-1,e,t);var o=this.viewportToBasic(-1,-1,e,t);var a=0;var s=0;var u=0;var c=0;if(r[1]<0&&n[1]<0){a=r[1]>n[1]?-r[1]:-n[1]}if(n[0]>1&&i[0]>1){s=n[0]<i[0]?n[0]-1:i[0]-1}if(i[1]>1&&o[1]>1){u=i[1]<o[1]?i[1]-1:o[1]-1}if(o[0]<0&&r[0]<0){c=o[0]>r[0]?-o[0]:-r[0]}return[a,s,u,c]};e.prototype.getPixelDistances=function(e,t,r){var n=this.viewportToBasic(-1,1,t,r);var i=this.viewportToBasic(1,1,t,r);var o=this.viewportToBasic(1,-1,t,r);var a=this.viewportToBasic(-1,-1,t,r);var s=0;var u=0;var c=0;var l=0;var h=this.containerToCanvas(e),p=h[0],f=h[1];if(n[1]<0&&i[1]<0){var d=n[1]>i[1]?n[0]:i[0];var v=this.basicToCanvas(d,0,e,t,r);s=v[1]>0?v[1]:0}if(i[0]>1&&o[0]>1){var m=i[0]<o[0]?i[1]:o[1];var v=this.basicToCanvas(1,m,e,t,r);u=v[0]<p?p-v[0]:0}if(o[1]>1&&a[1]>1){var d=o[1]<a[1]?o[0]:a[0];var v=this.basicToCanvas(d,1,e,t,r);c=v[1]<f?f-v[1]:0}if(a[0]<0&&n[0]<0){var m=a[0]>n[0]?a[1]:n[1];var v=this.basicToCanvas(0,m,e,t,r);l=v[0]>0?v[0]:0}return[s,u,c,l]};e.prototype.insideElement=function(e,t){var r=t.getBoundingClientRect();var n=r.left+t.clientLeft;var i=n+t.clientWidth;var o=r.top+t.clientTop;var a=o+t.clientHeight;return e.clientX>n&&e.clientX<i&&e.clientY>o&&e.clientY<a};e.prototype.projectToCanvas=function(e,t,r){var n=this.projectToViewport(e,r);var i=this.viewportToCanvas(n[0],n[1],t);return i};e.prototype.projectToCanvasSafe=function(e,t,r){var n=this.worldToCamera(e,r);if(n[2]>0){return null}var i=this.projectToViewport(e,r);var o=this.viewportToCanvas(i[0],i[1],t);return o};e.prototype.projectToViewport=function(e,t){var r=new a.Vector3(e[0],e[1],e[2]).project(t);return[r.x,r.y]};e.prototype.unprojectFromCanvas=function(e,t,r,n){var i=this.canvasToViewport(e,t,r);var o=this.unprojectFromViewport(i[0],i[1],n);return o};e.prototype.unprojectFromViewport=function(e,t,r){var n=new a.Vector3(e,t,1).unproject(r);return n};e.prototype.viewportToBasic=function(e,t,r,n){var i=new a.Vector3(e,t,1).unproject(n).toArray();var o=r.projectBasic(i);return o};e.prototype.viewportToCanvas=function(e,t,r){var n=this.containerToCanvas(r),i=n[0],o=n[1];var a=i*(e+1)/2;var s=-o*(t-1)/2;return[a,s]};e.prototype.worldToCamera=function(e,t){var r=new a.Vector3(e[0],e[1],e[2]).applyMatrix4(t.matrixWorldInverse);return r.toArray()};return e}();r.ViewportCoords=n;r.default=n},{three:242}],422:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],423:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FilterCreator=void 0;var n=function(){function e(){}e.prototype.createFilter=function(e){return new Function("node","return "+this._compile(e)+";")};e.prototype._compile=function(e){if(e==null||e.length<=1){return"true"}var t=e[0];var r=t==="=="?this._compileComparisonOp("===",e[1],e[2],false):t==="!="?this._compileComparisonOp("!==",e[1],e[2],false):t===">"||t===">="||t==="<"||t==="<="?this._compileComparisonOp(t,e[1],e[2],true):t==="in"?this._compileInOp(e[1],e.slice(2)):t==="!in"?this._compileNegation(this._compileInOp(e[1],e.slice(2))):t==="all"?this._compileLogicalOp(e.slice(1),"&&"):"true";return"("+r+")"};e.prototype._compare=function(e,t){return e<t?-1:e>t?1:0};e.prototype._compileComparisonOp=function(e,t,r,n){var i=this._compilePropertyReference(t);var o=JSON.stringify(r);return(n?"typeof "+i+"===typeof "+o+"&&":"")+i+e+o};e.prototype._compileInOp=function(e,t){var r=this._compare;var n=JSON.stringify(t.sort(r));var i=this._compilePropertyReference(e);return n+".indexOf("+i+")!==-1"};e.prototype._compileLogicalOp=function(e,t){var r=this._compile.bind(this);return e.map(r).join(t)};e.prototype._compileNegation=function(e){return"!("+e+")"};e.prototype._compilePropertyReference=function(e){return"node["+JSON.stringify(e)+"]"};return e}();r.FilterCreator=n;r.default=n},{}],424:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Graph=void 0;var d=e("rxjs");var v=e("rxjs/operators");var a=e("../Edge");var f=e("../Error");var p=e("../Graph");var s=e("../Geo");var n=function(){function e(e,t,r,n,i,o){this._apiV3=e;this._cachedNodes={};this._cachedNodeTiles={};this._cachedSequenceNodes={};this._cachedSpatialEdges={};this._cachedTiles={};this._cachingFill$={};this._cachingFull$={};this._cachingSequenceNodes$={};this._cachingSequences$={};this._cachingSpatialArea$={};this._cachingTiles$={};this._changed$=new d.Subject;this._defaultAlt=2;this._edgeCalculator=n!=null?n:new a.EdgeCalculator;this._filterCreator=i!=null?i:new p.FilterCreator;this._filter=this._filterCreator.createFilter(undefined);this._graphCalculator=r!=null?r:new p.GraphCalculator;this._configuration=o!=null?o:{maxSequences:50,maxUnusedNodes:100,maxUnusedPreStoredNodes:30,maxUnusedTiles:20};this._nodes={};this._nodeIndex=t!=null?t:new s.GeoRBush(16);this._nodeIndexTiles={};this._nodeToTile={};this._preStored={};this._requiredNodeTiles={};this._requiredSpatialArea={};this._sequences={};this._tilePrecision=7;this._tileThreshold=20}Object.defineProperty(e.prototype,"changed$",{get:function(){return this._changed$},enumerable:false,configurable:true});e.prototype.cacheBoundingBox$=function(h,p){var f=this;var e=this._graphCalculator.encodeHsFromBoundingBox(h,p).filter(function(e){return!(e in f._cachedTiles)}).map(function(e){return e in f._cachingTiles$?f._cachingTiles$[e]:f._cacheTile$(e)});if(e.length===0){e.push(d.of(this))}return d.from(e).pipe(v.mergeAll(),v.last(),v.mergeMap(function(e){var t=f._nodeIndex.search({maxX:p.lat,maxY:p.lon,minX:h.lat,minY:h.lon}).map(function(e){return e.node});var r=[];var n=[];for(var i=0,o=t;i<o.length;i++){var a=o[i];if(a.full){r.push(a)}else{n.push(a.key)}}var s=[];var u=200;while(n.length>0){s.push(n.splice(0,u))}var c=d.of(r);var l=s.map(function(e){return f._apiV3.imageByKeyFill$(e).pipe(v.map(function(e){var t=[];for(var r in e){if(!e.hasOwnProperty(r)){continue}if(f.hasNode(r)){var n=f.getNode(r);if(!n.full){f._makeFull(n,e[r])}t.push(n)}}return t}))});return d.merge(c,d.from(l).pipe(v.mergeAll()))}),v.reduce(function(e,t){return e.concat(t)}))};e.prototype.cacheFill$=function(t){var r=this;if(t in this._cachingFull$){throw new f.GraphMapillaryError("Cannot fill node while caching full ("+t+").")}if(!this.hasNode(t)){throw new f.GraphMapillaryError("Cannot fill node that does not exist in graph ("+t+").")}if(t in this._cachingFill$){return this._cachingFill$[t]}var n=this.getNode(t);if(n.full){throw new f.GraphMapillaryError("Cannot fill node that is already full ("+t+").")}this._cachingFill$[t]=this._apiV3.imageByKeyFill$([t]).pipe(v.tap(function(e){if(!n.full){r._makeFull(n,e[t])}delete r._cachingFill$[t]}),v.map(function(e){return r}),v.finalize(function(){if(t in r._cachingFill$){delete r._cachingFill$[t]}r._changed$.next(r)}),v.publish(),v.refCount());return this._cachingFill$[t]};e.prototype.cacheFull$=function(i){var o=this;if(i in this._cachingFull$){return this._cachingFull$[i]}if(this.hasNode(i)){throw new f.GraphMapillaryError("Cannot cache full node that already exist in graph ("+i+").")}this._cachingFull$[i]=this._apiV3.imageByKeyFull$([i]).pipe(v.tap(function(e){var t=e[i];if(o.hasNode(i)){var r=o.getNode(i);if(!r.full){o._makeFull(r,t)}}else{if(t.sequence_key==null){throw new f.GraphMapillaryError("Node has no sequence key ("+i+").")}var r=new p.Node(t);o._makeFull(r,t);var n=o._graphCalculator.encodeH(r.originalLatLon,o._tilePrecision);o._preStore(n,r);o._setNode(r);delete o._cachingFull$[i]}}),v.map(function(e){return o}),v.finalize(function(){if(i in o._cachingFull$){delete o._cachingFull$[i]}o._changed$.next(o)}),v.publish(),v.refCount());return this._cachingFull$[i]};e.prototype.cacheNodeSequence$=function(e){if(!this.hasNode(e)){throw new f.GraphMapillaryError("Cannot cache sequence edges of node that does not exist in graph ("+e+").")}var t=this.getNode(e);if(t.sequenceKey in this._sequences){throw new f.GraphMapillaryError("Sequence already cached ("+e+"), ("+t.sequenceKey+").")}return this._cacheSequence$(t.sequenceKey)};e.prototype.cacheSequence$=function(e){if(e in this._sequences){throw new f.GraphMapillaryError("Sequence already cached ("+e+")")}return this._cacheSequence$(e)};e.prototype.cacheSequenceEdges=function(e){var t=this.getNode(e);if(!(t.sequenceKey in this._sequences)){throw new f.GraphMapillaryError("Sequence is not cached ("+e+"), ("+t.sequenceKey+")")}var r=this._sequences[t.sequenceKey].sequence;var n=this._edgeCalculator.computeSequenceEdges(t,r);t.cacheSequenceEdges(n)};e.prototype.cacheSequenceNodes$=function(e,t){var o=this;if(!this.hasSequence(e)){throw new f.GraphMapillaryError("Cannot cache sequence nodes of sequence that does not exist in graph ("+e+").")}if(this.hasSequenceNodes(e)){throw new f.GraphMapillaryError("Sequence nodes already cached ("+e+").")}var r=this.getSequence(e);if(r.key in this._cachingSequenceNodes$){return this._cachingSequenceNodes$[r.key]}var n=[];var i=r.keys.slice();var a=50;if(!!t&&i.length>a){var s=i.indexOf(t);var u=Math.max(0,Math.min(s-a/2,i.length-a));n.push(i.splice(u,a))}var c=200;while(i.length>0){n.push(i.splice(0,c))}var l=n.length;var h=d.from(n).pipe(v.mergeMap(function(e){return o._apiV3.imageByKeyFull$(e).pipe(v.tap(function(e){for(var t in e){if(!e.hasOwnProperty(t)){continue}var r=e[t];if(o.hasNode(t)){var n=o.getNode(r.key);if(!n.full){o._makeFull(n,r)}}else{if(r.sequence_key==null){console.warn("Sequence missing, discarding node ("+r.key+")")}var n=new p.Node(r);o._makeFull(n,r);var i=o._graphCalculator.encodeH(n.originalLatLon,o._tilePrecision);o._preStore(i,n);o._setNode(n)}}l--}),v.map(function(e){return o}))},6),v.last(),v.finalize(function(){delete o._cachingSequenceNodes$[r.key];if(l===0){o._cachedSequenceNodes[r.key]=true}}),v.publish(),v.refCount());this._cachingSequenceNodes$[r.key]=h;return h};e.prototype.cacheSpatialArea$=function(o){var a=this;if(!this.hasNode(o)){throw new f.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+o+").")}if(o in this._cachedSpatialEdges){throw new f.GraphMapillaryError("Node already spatially cached ("+o+").")}if(!(o in this._requiredSpatialArea)){throw new f.GraphMapillaryError("Spatial area not determined ("+o+").")}var s=this._requiredSpatialArea[o];if(Object.keys(s.cacheNodes).length===0){throw new f.GraphMapillaryError("Spatial nodes already cached ("+o+").")}if(o in this._cachingSpatialArea$){return this._cachingSpatialArea$[o]}var e=[];while(s.cacheKeys.length>0){e.push(s.cacheKeys.splice(0,200))}var u=e.length;var t=[];var r=function(i){var e=n._apiV3.imageByKeyFill$(i).pipe(v.tap(function(e){for(var t in e){if(!e.hasOwnProperty(t)){continue}var r=s.cacheNodes[t];if(r.full){delete s.cacheNodes[t];continue}var n=e[t];a._makeFull(r,n);delete s.cacheNodes[t]}if(--u===0){delete a._cachingSpatialArea$[o]}}),v.map(function(e){return a}),v.catchError(function(e){for(var t=0,r=i;t<r.length;t++){var n=r[t];if(n in s.all){delete s.all[n]}if(n in s.cacheNodes){delete s.cacheNodes[n]}}if(--u===0){delete a._cachingSpatialArea$[o]}throw e}),v.finalize(function(){if(Object.keys(s.cacheNodes).length===0){a._changed$.next(a)}}),v.publish(),v.refCount());t.push(e)};var n=this;for(var i=0,c=e;i<c.length;i++){var l=c[i];r(l)}this._cachingSpatialArea$[o]=t;return t};e.prototype.cacheSpatialEdges=function(e){if(e in this._cachedSpatialEdges){throw new f.GraphMapillaryError("Spatial edges already cached ("+e+").")}var t=this.getNode(e);var r=this._sequences[t.sequenceKey].sequence;var n=[];var i=r.findPrevKey(t.key);if(i!=null){n.push(i)}var o=r.findNextKey(t.key);if(o!=null){n.push(o)}var a=this._requiredSpatialArea[e].all;var s=[];var u=this._filter;for(var c in a){if(!a.hasOwnProperty(c)){continue}var l=a[c];if(u(l)){s.push(l)}}var h=this._edgeCalculator.getPotentialEdges(t,s,n);var p=this._edgeCalculator.computeStepEdges(t,h,i,o);p=p.concat(this._edgeCalculator.computeTurnEdges(t,h));p=p.concat(this._edgeCalculator.computePanoEdges(t,h));p=p.concat(this._edgeCalculator.computePerspectiveToPanoEdges(t,h));p=p.concat(this._edgeCalculator.computeSimilarEdges(t,h));t.cacheSpatialEdges(p);this._cachedSpatialEdges[e]=t;delete this._requiredSpatialArea[e];delete this._cachedNodeTiles[e]};e.prototype.cacheTiles$=function(n){var i=this;if(n in this._cachedNodeTiles){throw new f.GraphMapillaryError("Tiles already cached ("+n+").")}if(n in this._cachedSpatialEdges){throw new f.GraphMapillaryError("Spatial edges already cached so tiles considered cached ("+n+").")}if(!(n in this._requiredNodeTiles)){throw new f.GraphMapillaryError("Tiles have not been determined ("+n+").")}var o=this._requiredNodeTiles[n];if(o.cache.length===0&&o.caching.length===0){throw new f.GraphMapillaryError("Tiles already cached ("+n+").")}if(!this.hasNode(n)){throw new f.GraphMapillaryError("Cannot cache tiles of node that does not exist in graph ("+n+").")}var e=o.cache.slice();o.caching=this._requiredNodeTiles[n].caching.concat(e);o.cache=[];var t=[];var r=function(r){var e=r in a._cachingTiles$?a._cachingTiles$[r]:a._cacheTile$(r);t.push(e.pipe(v.tap(function(e){var t=o.caching.indexOf(r);if(t>-1){o.caching.splice(t,1)}if(o.caching.length===0&&o.cache.length===0){delete i._requiredNodeTiles[n];i._cachedNodeTiles[n]=true}}),v.catchError(function(e){var t=o.caching.indexOf(r);if(t>-1){o.caching.splice(t,1)}if(o.caching.length===0&&o.cache.length===0){delete i._requiredNodeTiles[n];i._cachedNodeTiles[n]=true}throw e}),v.finalize(function(){i._changed$.next(i)}),v.publish(),v.refCount()))};var a=this;for(var s=0,u=o.caching;s<u.length;s++){var c=u[s];r(c)}return t};e.prototype.initializeCache=function(e){if(e in this._cachedNodes){throw new f.GraphMapillaryError("Node already in cache ("+e+").")}var t=this.getNode(e);t.initializeCache(new p.NodeCache);var r=(new Date).getTime();this._cachedNodes[e]={accessed:r,node:t};this._updateCachedTileAccess(e,r)};e.prototype.isCachingFill=function(e){return e in this._cachingFill$};e.prototype.isCachingFull=function(e){return e in this._cachingFull$};e.prototype.isCachingNodeSequence=function(e){var t=this.getNode(e);return t.sequenceKey in this._cachingSequences$};e.prototype.isCachingSequence=function(e){return e in this._cachingSequences$};e.prototype.isCachingSequenceNodes=function(e){return e in this._cachingSequenceNodes$};e.prototype.isCachingTiles=function(e){return e in this._requiredNodeTiles&&this._requiredNodeTiles[e].cache.length===0&&this._requiredNodeTiles[e].caching.length>0};e.prototype.hasInitializedCache=function(e){return e in this._cachedNodes};e.prototype.hasNode=function(e){var t=(new Date).getTime();this._updateCachedNodeAccess(e,t);this._updateCachedTileAccess(e,t);return e in this._nodes};e.prototype.hasNodeSequence=function(e){var t=this.getNode(e);var r=t.sequenceKey;var n=r in this._sequences;if(n){this._sequences[r].accessed=(new Date).getTime()}return n};e.prototype.hasSequence=function(e){var t=e in this._sequences;if(t){this._sequences[e].accessed=(new Date).getTime()}return t};e.prototype.hasSequenceNodes=function(e){return e in this._cachedSequenceNodes};e.prototype.hasSpatialArea=function(e){if(!this.hasNode(e)){throw new f.GraphMapillaryError("Spatial area nodes cannot be determined if node not in graph ("+e+").")}if(e in this._cachedSpatialEdges){return true}if(e in this._requiredSpatialArea){return Object.keys(this._requiredSpatialArea[e].cacheNodes).length===0}var t=this.getNode(e);var r=this._graphCalculator.boundingBoxCorners(t.latLon,this._tileThreshold);var n=this._nodeIndex.search({maxX:r[1].lat,maxY:r[1].lon,minX:r[0].lat,minY:r[0].lon});var i={all:{},cacheKeys:[],cacheNodes:{}};for(var o=0,a=n;o<a.length;o++){var s=a[o];i.all[s.node.key]=s.node;if(!s.node.full){i.cacheKeys.push(s.node.key);i.cacheNodes[s.node.key]=s.node}}this._requiredSpatialArea[e]=i;return i.cacheKeys.length===0};e.prototype.hasTiles=function(e){var t=this;if(e in this._cachedNodeTiles){return true}if(e in this._cachedSpatialEdges){return true}if(!this.hasNode(e)){throw new f.GraphMapillaryError("Node does not exist in graph ("+e+").")}var r={cache:[],caching:[]};if(!(e in this._requiredNodeTiles)){var n=this.getNode(e);r.cache=this._graphCalculator.encodeHs(n.latLon,this._tilePrecision,this._tileThreshold).filter(function(e){return!(e in t._cachedTiles)});if(r.cache.length>0){this._requiredNodeTiles[e]=r}}else{r=this._requiredNodeTiles[e]}return r.cache.length===0&&r.caching.length===0};e.prototype.getNode=function(e){var t=(new Date).getTime();this._updateCachedNodeAccess(e,t);this._updateCachedTileAccess(e,t);return this._nodes[e]};e.prototype.getSequence=function(e){var t=this._sequences[e];t.accessed=(new Date).getTime();return t.sequence};e.prototype.resetSpatialEdges=function(){var e=Object.keys(this._cachedSpatialEdges);for(var t=0,r=e;t<r.length;t++){var n=r[t];var i=this._cachedSpatialEdges[n];i.resetSpatialEdges();delete this._cachedSpatialEdges[n]}};e.prototype.reset=function(e){var t=[];for(var r=0,n=e;r<n.length;r++){var i=n[r];if(!this.hasNode(i)){throw new Error("Node does not exist "+i)}var o=this.getNode(i);o.resetSequenceEdges();o.resetSpatialEdges();t.push(o)}for(var a=0,s=Object.keys(this._cachedNodes);a<s.length;a++){var u=s[a];if(e.indexOf(u)!==-1){continue}this._cachedNodes[u].node.dispose();delete this._cachedNodes[u]}this._cachedNodeTiles={};this._cachedSpatialEdges={};this._cachedTiles={};this._cachingFill$={};this._cachingFull$={};this._cachingSequences$={};this._cachingSpatialArea$={};this._cachingTiles$={};this._nodes={};this._nodeToTile={};this._preStored={};for(var c=0,l=t;c<l.length;c++){var o=l[c];this._nodes[o.key]=o;var h=this._graphCalculator.encodeH(o.originalLatLon,this._tilePrecision);this._preStore(h,o)}this._requiredNodeTiles={};this._requiredSpatialArea={};this._sequences={};this._nodeIndexTiles={};this._nodeIndex.clear()};e.prototype.setFilter=function(e){this._filter=this._filterCreator.createFilter(e)};e.prototype.uncache=function(e,t){var r={};this._addNewKeys(r,this._cachingFull$);this._addNewKeys(r,this._cachingFill$);this._addNewKeys(r,this._cachingSpatialArea$);this._addNewKeys(r,this._requiredNodeTiles);this._addNewKeys(r,this._requiredSpatialArea);for(var n=0,i=e;n<i.length;n++){var o=i[n];if(o in r){continue}r[o]=true}var a={};for(var o in r){if(!r.hasOwnProperty(o)){continue}var s=this._nodes[o];var u=this._graphCalculator.encodeHs(s.latLon);for(var c=0,l=u;c<l.length;c++){var h=l[c];if(!(h in a)){a[h]=true}}}var p=[];for(var f in this._cachedTiles){if(!this._cachedTiles.hasOwnProperty(f)||f in a){continue}p.push([f,this._cachedTiles[f]])}var d=p.sort(function(e,t){return t[1].accessed-e[1].accessed}).slice(this._configuration.maxUnusedTiles).map(function(e){return e[0]});for(var v=0,m=d;v<m.length;v++){var g=m[v];this._uncacheTile(g,t)}var _=[];var y=[];for(var f in this._preStored){if(!this._preStored.hasOwnProperty(f)||f in this._cachingTiles$){continue}var b=this._preStored[f];for(var o in b){if(!b.hasOwnProperty(o)||o in r){continue}if(b[o].sequenceKey===t){continue}if(o in this._cachedNodes){_.push([this._cachedNodes[o],f])}else{y.push([o,f])}}}var x=_.sort(function(e,t){var r=e[0],n=e[1];var i=t[0],o=t[1];return i.accessed-r.accessed}).slice(this._configuration.maxUnusedPreStoredNodes).map(function(e){var t=e[0],r=e[1];return[t.node.key,r]});this._uncachePreStored(y);this._uncachePreStored(x);var w=[];for(var o in this._cachedNodes){if(!this._cachedNodes.hasOwnProperty(o)||o in r){continue}w.push(this._cachedNodes[o])}var S=w.sort(function(e,t){return t.accessed-e.accessed}).slice(this._configuration.maxUnusedNodes);for(var M=0,C=S;M<C.length;M++){var T=C[M];T.node.uncache();var o=T.node.key;delete this._cachedNodes[o];if(o in this._cachedNodeTiles){delete this._cachedNodeTiles[o]}if(o in this._cachedSpatialEdges){delete this._cachedSpatialEdges[o]}}var E=[];for(var O in this._sequences){if(!this._sequences.hasOwnProperty(O)||O in this._cachingSequences$||O===t){continue}E.push(this._sequences[O])}var P=E.sort(function(e,t){return t.accessed-e.accessed}).slice(this._configuration.maxSequences);for(var A=0,j=P;A<j.length;A++){var R=j[A];var O=R.sequence.key;delete this._sequences[O];if(O in this._cachedSequenceNodes){delete this._cachedSequenceNodes[O]}R.sequence.dispose()}};e.prototype._addNewKeys=function(e,t){for(var r in t){if(!t.hasOwnProperty(r)||!this.hasNode(r)){continue}if(!(r in e)){e[r]=true}}};e.prototype._cacheSequence$=function(t){var r=this;if(t in this._cachingSequences$){return this._cachingSequences$[t]}this._cachingSequences$[t]=this._apiV3.sequenceByKey$([t]).pipe(v.tap(function(e){if(!(t in r._sequences)){r._sequences[t]={accessed:(new Date).getTime(),sequence:new p.Sequence(e[t])}}delete r._cachingSequences$[t]}),v.map(function(e){return r}),v.finalize(function(){if(t in r._cachingSequences$){delete r._cachingSequences$[t]}r._changed$.next(r)}),v.publish(),v.refCount());return this._cachingSequences$[t]};e.prototype._cacheTile$=function(l){var h=this;this._cachingTiles$[l]=this._apiV3.imagesByH$([l]).pipe(v.tap(function(e){var t=e[l];if(l in h._cachedTiles){return}h._nodeIndexTiles[l]=[];h._cachedTiles[l]={accessed:(new Date).getTime(),nodes:[]};var r=h._cachedTiles[l].nodes;var n=h._removeFromPreStore(l);for(var i in t){if(!t.hasOwnProperty(i)){continue}var o=t[i];if(o==null){break}if(o.sequence_key==null){console.warn("Sequence missing, discarding node ("+o.key+")");continue}if(n!=null&&o.key in n){var a=n[o.key];delete n[o.key];r.push(a);var s={lat:a.latLon.lat,lon:a.latLon.lon,node:a};h._nodeIndex.insert(s);h._nodeIndexTiles[l].push(s);h._nodeToTile[a.key]=l;continue}var u=new p.Node(o);r.push(u);var c={lat:u.latLon.lat,lon:u.latLon.lon,node:u};h._nodeIndex.insert(c);h._nodeIndexTiles[l].push(c);h._nodeToTile[u.key]=l;h._setNode(u)}delete h._cachingTiles$[l]}),v.map(function(e){return h}),v.catchError(function(e){delete h._cachingTiles$[l];throw e}),v.publish(),v.refCount());return this._cachingTiles$[l]};e.prototype._makeFull=function(e,t){if(t.calt==null){t.calt=this._defaultAlt}if(t.c_rotation==null){t.c_rotation=this._graphCalculator.rotationFromCompass(t.ca,t.orientation)}e.makeFull(t)};e.prototype._preStore=function(e,t){if(!(e in this._preStored)){this._preStored[e]={}}this._preStored[e][t.key]=t};e.prototype._removeFromPreStore=function(e){var t=null;if(e in this._preStored){t=this._preStored[e];delete this._preStored[e]}return t};e.prototype._setNode=function(e){var t=e.key;if(this.hasNode(t)){throw new f.GraphMapillaryError("Node already exist ("+t+").")}this._nodes[t]=e};e.prototype._uncacheTile=function(e,t){for(var r=0,n=this._cachedTiles[e].nodes;r<n.length;r++){var i=n[r];var o=i.key;delete this._nodeToTile[o];if(o in this._cachedNodes){delete this._cachedNodes[o]}if(o in this._cachedNodeTiles){delete this._cachedNodeTiles[o]}if(o in this._cachedSpatialEdges){delete this._cachedSpatialEdges[o]}if(i.sequenceKey===t){this._preStore(e,i);i.uncache()}else{delete this._nodes[o];if(i.sequenceKey in this._cachedSequenceNodes){delete this._cachedSequenceNodes[i.sequenceKey]}i.dispose()}}for(var a=0,s=this._nodeIndexTiles[e];a<s.length;a++){var u=s[a];this._nodeIndex.remove(u)}delete this._nodeIndexTiles[e];delete this._cachedTiles[e]};e.prototype._uncachePreStored=function(e){var t={};for(var r=0,n=e;r<n.length;r++){var i=n[r],o=i[0],a=i[1];if(o in this._nodes){delete this._nodes[o]}if(o in this._cachedNodes){delete this._cachedNodes[o]}var s=this._preStored[a][o];if(s.sequenceKey in this._cachedSequenceNodes){delete this._cachedSequenceNodes[s.sequenceKey]}delete this._preStored[a][o];s.dispose();t[a]=true}for(var a in t){if(!t.hasOwnProperty(a)){continue}if(Object.keys(this._preStored[a]).length===0){delete this._preStored[a]}}};e.prototype._updateCachedTileAccess=function(e,t){if(e in this._nodeToTile){this._cachedTiles[this._nodeToTile[e]].accessed=t}};e.prototype._updateCachedNodeAccess=function(e,t){if(e in this._cachedNodes){this._cachedNodes[e].accessed=t}};return e}();r.Graph=n;r.default=n},{"../Edge":292,"../Error":293,"../Geo":294,"../Graph":295,rxjs:43,"rxjs/operators":241}],425:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GraphCalculator=void 0;var b=e("latlon-geohash");var c=e("three");var s=e("../Error");var n=e("../Geo");var i=function(){function e(e){this._geoCoords=e!=null?e:new n.GeoCoords}e.prototype.encodeH=function(e,t){if(t===void 0){t=7}return b.encode(e.lat,e.lon,t)};e.prototype.encodeHs=function(e,t,r){if(t===void 0){t=7}if(r===void 0){r=20}var n=b.encode(e.lat,e.lon,t);var i=b.bounds(n);var o=i.ne;var a=i.sw;var s=b.neighbours(n);var u=[0,0,0];var c=this._geoCoords.geodeticToEnu(o.lat,o.lon,0,a.lat,a.lon,0);var l=this._geoCoords.geodeticToEnu(e.lat,e.lon,0,a.lat,a.lon,0);var h=l[0]-u[0];var p=c[0]-l[0];var f=l[1]-u[1];var d=c[1]-l[1];var v=h<r;var m=p<r;var g=f<r;var _=d<r;var y=[n];if(_){y.push(s.n)}if(_&&v){y.push(s.nw)}if(v){y.push(s.w)}if(v&&g){y.push(s.sw)}if(g){y.push(s.s)}if(g&&m){y.push(s.se)}if(m){y.push(s.e)}if(m&&_){y.push(s.ne)}return y};e.prototype.encodeHsFromBoundingBox=function(e,t,r){if(r===void 0){r=7}if(t.lat<=e.lat||t.lon<=e.lon){throw new s.GraphMapillaryError("North east needs to be top right of south west")}var n=(e.lat+t.lat)/2;var i=(e.lon+t.lon)/2;var o=this._geoCoords.geodeticToEnu(t.lat,t.lon,0,n,i,0);var a=Math.max(o[0],o[1]);return this.encodeHs({lat:n,lon:i},r,a)};e.prototype.boundingBoxCorners=function(e,t){var r=this._geoCoords.enuToGeodetic(-t,-t,0,e.lat,e.lon,0);var n=this._geoCoords.enuToGeodetic(t,t,0,e.lat,e.lon,0);return[{lat:r[0],lon:r[1]},{lat:n[0],lon:n[1]}]};e.prototype.rotationFromCompass=function(e,t){var r=0;var n=0;var i=0;switch(t){case 1:r=Math.PI/2;break;case 3:r=-Math.PI/2;i=Math.PI;break;case 6:n=-Math.PI/2;i=-Math.PI/2;break;case 8:n=Math.PI/2;i=Math.PI/2;break;default:break}var o=(new c.Matrix4).makeRotationZ(i);var a=new c.Euler(r,n,e*Math.PI/180,"XYZ");var s=(new c.Matrix4).makeRotationFromEuler(a);var u=(new c.Vector4).setAxisAngleFromRotationMatrix(s.multiply(o));return u.multiplyScalar(u.w).toArray().slice(0,3)};return e}();r.GraphCalculator=i;r.default=i},{"../Error":293,"../Geo":294,"latlon-geohash":21,three:242}],426:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GraphMode=void 0;var n;(function(e){e[e["Sequence"]=0]="Sequence";e[e["Spatial"]=1]="Spatial"})(n=r.GraphMode||(r.GraphMode={}));r.default=n},{}],427:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GraphService=void 0;var c=e("rxjs");var l=e("rxjs/operators");var h=e("../Graph");var n=function(){function e(e,t){this._graph$=c.concat(c.of(e),e.changed$).pipe(l.publishReplay(1),l.refCount());this._graph$.subscribe(function(){});this._graphMode=h.GraphMode.Spatial;this._graphModeSubject$=new c.Subject;this._graphMode$=this._graphModeSubject$.pipe(l.startWith(this._graphMode),l.publishReplay(1),l.refCount());this._graphMode$.subscribe(function(){});this._imageLoadingService=t;this._firstGraphSubjects$=[];this._initializeCacheSubscriptions=[];this._sequenceSubscriptions=[];this._spatialSubscriptions=[]}Object.defineProperty(e.prototype,"graphMode$",{get:function(){return this._graphMode$},enumerable:false,configurable:true});e.prototype.cacheBoundingBox$=function(t,r){return this._graph$.pipe(l.first(),l.mergeMap(function(e){return e.cacheBoundingBox$(t,r)}))};e.prototype.cacheNode$=function(r){var t=this;var n=new c.Subject;this._firstGraphSubjects$.push(n);var e=n.pipe(l.publishReplay(1),l.refCount());var i=e.pipe(l.map(function(e){return e.getNode(r)}),l.mergeMap(function(e){return e.assetsCached?c.of(e):e.cacheAssets$()}),l.publishReplay(1),l.refCount());i.subscribe(function(e){t._imageLoadingService.loadnode$.next(e)},function(e){console.error("Failed to cache node ("+r+")",e)});var o=this._graph$.pipe(l.first(),l.mergeMap(function(e){if(e.isCachingFull(r)||!e.hasNode(r)){return e.cacheFull$(r)}if(e.isCachingFill(r)||!e.getNode(r).full){return e.cacheFill$(r)}return c.of(e)}),l.tap(function(e){if(!e.hasInitializedCache(r)){e.initializeCache(r)}}),l.finalize(function(){if(o==null){return}t._removeFromArray(o,t._initializeCacheSubscriptions);t._removeFromArray(n,t._firstGraphSubjects$)})).subscribe(function(e){n.next(e);n.complete()},function(e){n.error(e)});if(!o.closed){this._initializeCacheSubscriptions.push(o)}var a=e.pipe(l.mergeMap(function(e){if(e.isCachingNodeSequence(r)||!e.hasNodeSequence(r)){return e.cacheNodeSequence$(r)}return c.of(e)}),l.publishReplay(1),l.refCount());var s=a.pipe(l.tap(function(e){if(!e.getNode(r).sequenceEdges.cached){e.cacheSequenceEdges(r)}}),l.finalize(function(){if(s==null){return}t._removeFromArray(s,t._sequenceSubscriptions)})).subscribe(function(e){return},function(e){console.error("Failed to cache sequence edges ("+r+").",e)});if(!s.closed){this._sequenceSubscriptions.push(s)}if(this._graphMode===h.GraphMode.Spatial){var u=e.pipe(l.expand(function(e){if(e.hasTiles(r)){return c.empty()}return c.from(e.cacheTiles$(r)).pipe(l.mergeMap(function(e){return e.pipe(l.mergeMap(function(e){if(e.isCachingTiles(r)){return c.empty()}return c.of(e)}),l.catchError(function(e,t){console.error("Failed to cache tile data ("+r+").",e);return c.empty()}))}))}),l.last(),l.mergeMap(function(e){if(e.hasSpatialArea(r)){return c.of(e)}return c.from(e.cacheSpatialArea$(r)).pipe(l.mergeMap(function(e){return e.pipe(l.catchError(function(e,t){console.error("Failed to cache spatial nodes ("+r+").",e);return c.empty()}))}))}),l.last(),l.mergeMap(function(e){return e.hasNodeSequence(r)?c.of(e):e.cacheNodeSequence$(r)}),l.tap(function(e){if(!e.getNode(r).spatialEdges.cached){e.cacheSpatialEdges(r)}}),l.finalize(function(){if(u==null){return}t._removeFromArray(u,t._spatialSubscriptions)})).subscribe(function(e){return},function(e){console.error("Failed to cache spatial edges ("+r+").",e)});if(!u.closed){this._spatialSubscriptions.push(u)}}return i.pipe(l.first(function(e){return e.assetsCached}))};e.prototype.cacheSequence$=function(t){return this._graph$.pipe(l.first(),l.mergeMap(function(e){if(e.isCachingSequence(t)||!e.hasSequence(t)){return e.cacheSequence$(t)}return c.of(e)}),l.map(function(e){return e.getSequence(t)}))};e.prototype.cacheSequenceNodes$=function(t,r){return this._graph$.pipe(l.first(),l.mergeMap(function(e){if(e.isCachingSequence(t)||!e.hasSequence(t)){return e.cacheSequence$(t)}return c.of(e)}),l.mergeMap(function(e){if(e.isCachingSequenceNodes(t)||!e.hasSequenceNodes(t)){return e.cacheSequenceNodes$(t,r)}return c.of(e)}),l.map(function(e){return e.getSequence(t)}))};e.prototype.setFilter$=function(t){this._resetSubscriptions(this._spatialSubscriptions);return this._graph$.pipe(l.first(),l.tap(function(e){e.resetSpatialEdges();e.setFilter(t)}),l.map(function(e){return undefined}))};e.prototype.setGraphMode=function(e){if(this._graphMode===e){return}if(e===h.GraphMode.Sequence){this._resetSubscriptions(this._spatialSubscriptions)}this._graphMode=e;this._graphModeSubject$.next(this._graphMode)};e.prototype.reset$=function(t){this._abortSubjects(this._firstGraphSubjects$);this._resetSubscriptions(this._initializeCacheSubscriptions);this._resetSubscriptions(this._sequenceSubscriptions);this._resetSubscriptions(this._spatialSubscriptions);return this._graph$.pipe(l.first(),l.tap(function(e){e.reset(t)}),l.map(function(e){return undefined}))};e.prototype.uncache$=function(t,r){return this._graph$.pipe(l.first(),l.tap(function(e){e.uncache(t,r)}),l.map(function(e){return undefined}))};e.prototype._abortSubjects=function(e){for(var t=0,r=e.slice();t<r.length;t++){var n=r[t];this._removeFromArray(n,e);n.error(new Error("Cache node request was aborted."))}};e.prototype._removeFromArray=function(e,t){var r=t.indexOf(e);if(r!==-1){t.splice(r,1)}};e.prototype._resetSubscriptions=function(e){for(var t=0,r=e.slice();t<r.length;t++){var n=r[t];this._removeFromArray(n,e);if(!n.closed){n.unsubscribe()}}};return e}();r.GraphService=n;r.default=n},{"../Graph":295,rxjs:43,"rxjs/operators":241}],428:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ImageLoadingService=void 0;var n=e("rxjs/operators");var i=e("rxjs");var o=function(){function e(){this._loadnode$=new i.Subject;this._loadstatus$=this._loadnode$.pipe(n.scan(function(e,t){var r=e[0];var n=false;if(t.loadStatus.total===0||t.loadStatus.loaded===t.loadStatus.total){if(t.key in r){delete r[t.key];n=true}}else{r[t.key]=t.loadStatus;n=true}return[r,n]},[{},false]),n.filter(function(e){var t=e[0],r=e[1];return r}),n.map(function(e){var t=e[0];return t}),n.publishReplay(1),n.refCount());this._loadstatus$.subscribe(function(){})}Object.defineProperty(e.prototype,"loadnode$",{get:function(){return this._loadnode$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"loadstatus$",{get:function(){return this._loadstatus$},enumerable:false,configurable:true});return e}();r.ImageLoadingService=o},{rxjs:43,"rxjs/operators":241}],429:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MeshReader=void 0;var n=e("pbf");var i=function(){function r(){}r.read=function(e){var t=new n(e);return t.readFields(r._readMeshField,{faces:[],vertices:[]})};r._readMeshField=function(e,t,r){if(e===1){t.vertices.push(r.readFloat())}else if(e===2){t.faces.push(r.readVarint())}};return r}();r.MeshReader=i},{pbf:40}],430:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Node=void 0;var n=e("rxjs/operators");var i=function(){function e(e){this._cache=null;this._core=e;this._fill=null}Object.defineProperty(e.prototype,"assetsCached",{get:function(){return this._core!=null&&this._fill!=null&&this._cache!=null&&this._cache.image!=null&&this._cache.mesh!=null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"alt",{get:function(){return this._fill.calt},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ca",{get:function(){return this._fill.cca!=null?this._fill.cca:this._fill.ca},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"cameraProjection",{get:function(){return this._fill.camera_projection_type},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"capturedAt",{get:function(){return this._fill.captured_at},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"cameraUuid",{get:function(){return this._fill.captured_with_camera_uuid},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"clusterKey",{get:function(){return this._fill.cluster_key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ck1",{get:function(){return this._fill.ck1},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ck2",{get:function(){return this._fill.ck2},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"computedCA",{get:function(){return this._fill.cca},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"computedLatLon",{get:function(){return this._core.cl},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"focal",{get:function(){return this._fill.cfocal},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"full",{get:function(){return this._fill!=null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"fullPano",{get:function(){return this._fill.gpano!=null&&this._fill.gpano.CroppedAreaLeftPixels===0&&this._fill.gpano.CroppedAreaTopPixels===0&&this._fill.gpano.CroppedAreaImageWidthPixels===this._fill.gpano.FullPanoWidthPixels&&this._fill.gpano.CroppedAreaImageHeightPixels===this._fill.gpano.FullPanoHeightPixels},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"gpano",{get:function(){return this._fill.gpano},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"height",{get:function(){return this._fill.height},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"image",{get:function(){return this._cache.image},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"image$",{get:function(){return this._cache.image$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"key",{get:function(){return this._core.key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"latLon",{get:function(){return this._core.cl!=null?this._core.cl:this._core.l},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"loadStatus",{get:function(){return this._cache.loadStatus},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"merged",{get:function(){return this._fill!=null&&this._fill.merge_version!=null&&this._fill.merge_version>0},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mergeCC",{get:function(){return this._fill.merge_cc},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mergeVersion",{get:function(){return this._fill.merge_version},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mesh",{get:function(){return this._cache.mesh},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"organizationKey",{get:function(){return this._fill.organization_key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"orientation",{get:function(){return this._fill.orientation},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"originalCA",{get:function(){return this._fill.ca},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"originalLatLon",{get:function(){return this._core.l},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"pano",{get:function(){return this._fill.gpano!=null&&this._fill.gpano.FullPanoWidthPixels!=null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"private",{get:function(){return this._fill.private},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"projectKey",{get:function(){return this._fill.project!=null?this._fill.project.key:null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"rotation",{get:function(){return this._fill.c_rotation},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"scale",{get:function(){return this._fill.atomic_scale},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sequenceKey",{get:function(){return this._core.sequence_key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sequenceEdges",{get:function(){return this._cache.sequenceEdges},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sequenceEdges$",{get:function(){return this._cache.sequenceEdges$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"spatialEdges",{get:function(){return this._cache.spatialEdges},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"spatialEdges$",{get:function(){return this._cache.spatialEdges$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"userKey",{get:function(){return this._fill.user.key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"username",{get:function(){return this._fill.user.username},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"width",{get:function(){return this._fill.width},enumerable:false,configurable:true});e.prototype.cacheAssets$=function(){var e=this;return this._cache.cacheAssets$(this.key,this.pano,this.merged).pipe(n.map(function(){return e}))};e.prototype.cacheImage$=function(e){var t=this;return this._cache.cacheImage$(this.key,e).pipe(n.map(function(){return t}))};e.prototype.cacheSequenceEdges=function(e){this._cache.cacheSequenceEdges(e)};e.prototype.cacheSpatialEdges=function(e){this._cache.cacheSpatialEdges(e)};e.prototype.dispose=function(){if(this._cache!=null){this._cache.dispose();this._cache=null}this._core=null;this._fill=null};e.prototype.initializeCache=function(e){if(this._cache!=null){throw new Error("Node cache already initialized ("+this.key+").")}this._cache=e};e.prototype.makeFull=function(e){if(e==null){throw new Error("Fill can not be null.")}this._fill=e};e.prototype.resetSequenceEdges=function(){this._cache.resetSequenceEdges()};e.prototype.resetSpatialEdges=function(){this._cache.resetSpatialEdges()};e.prototype.uncache=function(){if(this._cache==null){return}this._cache.dispose();this._cache=null};return e}();r.Node=i;r.default=i},{"rxjs/operators":241}],431:[function(t,e,r){(function(o){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.NodeCache=void 0;var s=t("rxjs");var a=t("rxjs/operators");var u=t("../Graph");var c=t("../Utils");var e=function(){function e(){this._disposed=false;this._image=null;this._loadStatus={loaded:0,total:0};this._mesh=null;this._sequenceEdges={cached:false,edges:[]};this._spatialEdges={cached:false,edges:[]};this._imageChanged$=new s.Subject;this._image$=this._imageChanged$.pipe(a.startWith(null),a.publishReplay(1),a.refCount());this._iamgeSubscription=this._image$.subscribe();this._sequenceEdgesChanged$=new s.Subject;this._sequenceEdges$=this._sequenceEdgesChanged$.pipe(a.startWith(this._sequenceEdges),a.publishReplay(1),a.refCount());this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){});this._spatialEdgesChanged$=new s.Subject;this._spatialEdges$=this._spatialEdgesChanged$.pipe(a.startWith(this._spatialEdges),a.publishReplay(1),a.refCount());this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){});this._cachingAssets$=null}Object.defineProperty(e.prototype,"image",{get:function(){return this._image},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"image$",{get:function(){return this._image$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"loadStatus",{get:function(){return this._loadStatus},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sequenceEdges",{get:function(){return this._sequenceEdges},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sequenceEdges$",{get:function(){return this._sequenceEdges$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"spatialEdges",{get:function(){return this._spatialEdges},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"spatialEdges$",{get:function(){return this._spatialEdges$},enumerable:false,configurable:true});e.prototype.cacheAssets$=function(e,t,r){var n=this;if(this._cachingAssets$!=null){return this._cachingAssets$}var i=t?c.Settings.basePanoramaSize:c.Settings.baseImageSize;this._cachingAssets$=s.combineLatest(this._cacheImage$(e,i),this._cacheMesh$(e,r)).pipe(a.map(function(e){var t=e[0],r=e[1];n._loadStatus.loaded=0;n._loadStatus.total=0;if(r){n._mesh=r.object;n._loadStatus.loaded+=r.loaded.loaded;n._loadStatus.total+=r.loaded.total}if(t){n._image=t.object;n._loadStatus.loaded+=t.loaded.loaded;n._loadStatus.total+=t.loaded.total}return n}),a.finalize(function(){n._cachingAssets$=null}),a.publishReplay(1),a.refCount());this._cachingAssets$.pipe(a.first(function(e){return!!e._image})).subscribe(function(e){n._imageChanged$.next(n._image)},function(e){});return this._cachingAssets$};e.prototype.cacheImage$=function(e,t){var r=this;if(this._image!=null&&t<=Math.max(this._image.width,this._image.height)){return s.of(this)}var n=this._cacheImage$(e,t).pipe(a.first(function(e){return e.object!=null}),a.tap(function(e){r._disposeImage();r._image=e.object}),a.map(function(e){return r}),a.publishReplay(1),a.refCount());n.subscribe(function(e){r._imageChanged$.next(r._image)},function(e){});return n};e.prototype.cacheSequenceEdges=function(e){this._sequenceEdges={cached:true,edges:e};this._sequenceEdgesChanged$.next(this._sequenceEdges)};e.prototype.cacheSpatialEdges=function(e){this._spatialEdges={cached:true,edges:e};this._spatialEdgesChanged$.next(this._spatialEdges)};e.prototype.dispose=function(){this._iamgeSubscription.unsubscribe();this._sequenceEdgesSubscription.unsubscribe();this._spatialEdgesSubscription.unsubscribe();this._disposeImage();this._mesh=null;this._loadStatus.loaded=0;this._loadStatus.total=0;this._sequenceEdges={cached:false,edges:[]};this._spatialEdges={cached:false,edges:[]};this._imageChanged$.next(null);this._sequenceEdgesChanged$.next(this._sequenceEdges);this._spatialEdgesChanged$.next(this._spatialEdges);this._disposed=true;if(this._imageRequest!=null){this._imageRequest.abort()}if(this._meshRequest!=null){this._meshRequest.abort()}};e.prototype.resetSequenceEdges=function(){this._sequenceEdges={cached:false,edges:[]};this._sequenceEdgesChanged$.next(this._sequenceEdges)};e.prototype.resetSpatialEdges=function(){this._spatialEdges={cached:false,edges:[]};this._spatialEdgesChanged$.next(this._spatialEdges)};e.prototype._cacheImage$=function(o,e){var a=this;return s.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",c.Urls.thumbnail(o,e,c.Urls.origin),true);i.responseType="arraybuffer";i.timeout=15e3;i.onload=function(t){if(i.status!==200){a._imageRequest=null;n.error(new Error("Failed to fetch image ("+o+"). Status: "+i.status+", "+i.statusText));return}var r=new Image;r.crossOrigin="Anonymous";r.onload=function(e){a._imageRequest=null;if(a._disposed){window.URL.revokeObjectURL(r.src);n.error(new Error("Image load was aborted ("+o+")"));return}n.next({loaded:{loaded:t.loaded,total:t.total},object:r});n.complete()};r.onerror=function(e){a._imageRequest=null;n.error(new Error("Failed to load image ("+o+")"))};var e=new Blob([i.response]);r.src=window.URL.createObjectURL(e)};i.onprogress=function(e){if(a._disposed){return}n.next({loaded:{loaded:e.loaded,total:e.total},object:null})};i.onerror=function(e){a._imageRequest=null;n.error(new Error("Failed to fetch image ("+o+")"))};i.ontimeout=function(e){a._imageRequest=null;n.error(new Error("Image request timed out ("+o+")"))};i.onabort=function(e){a._imageRequest=null;n.error(new Error("Image request was aborted ("+o+")"))};a._imageRequest=i;i.send(null)})};e.prototype._cacheMesh$=function(t,e){var i=this;return s.Observable.create(function(r){if(!e){r.next(i._createEmptyMeshLoadStatus());r.complete();return}var n=new XMLHttpRequest;n.open("GET",c.Urls.protoMesh(t),true);n.responseType="arraybuffer";n.timeout=15e3;n.onload=function(e){i._meshRequest=null;if(i._disposed){return}var t=n.status===200?u.MeshReader.read(new o(n.response)):{faces:[],vertices:[]};r.next({loaded:{loaded:e.loaded,total:e.total},object:t});r.complete()};n.onprogress=function(e){if(i._disposed){return}r.next({loaded:{loaded:e.loaded,total:e.total},object:null})};n.onerror=function(e){i._meshRequest=null;console.error("Failed to cache mesh ("+t+")");r.next(i._createEmptyMeshLoadStatus());r.complete()};n.ontimeout=function(e){i._meshRequest=null;console.error("Mesh request timed out ("+t+")");r.next(i._createEmptyMeshLoadStatus());r.complete()};n.onabort=function(e){i._meshRequest=null;r.error(new Error("Mesh request was aborted ("+t+")"))};i._meshRequest=n;n.send(null)})};e.prototype._createEmptyMeshLoadStatus=function(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}};e.prototype._disposeImage=function(){if(this._image!=null){window.URL.revokeObjectURL(this._image.src)}this._image=null};return e}();r.NodeCache=e;r.default=e}).call(this,t("buffer").Buffer)},{"../Graph":295,"../Utils":301,buffer:6,rxjs:43,"rxjs/operators":241}],432:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Sequence=void 0;var n=function(){function e(e){this._key=e.key;this._keys=e.keys}Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"keys",{get:function(){return this._keys},enumerable:false,configurable:true});e.prototype.dispose=function(){this._key=null;this._keys=null};e.prototype.findNextKey=function(e){var t=this._keys.indexOf(e);if(t+1>=this._keys.length||t===-1){return null}else{return this._keys[t+1]}};e.prototype.findPrevKey=function(e){var t=this._keys.indexOf(e);if(t===0||t===-1){return null}else{return this._keys[t-1]}};return e}();r.Sequence=n;r.default=n},{}],433:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EdgeCalculator=void 0;var M=e("three");var V=e("../../Edge");var H=e("../../Error");var n=e("../../Geo");var i=function(){function e(e,t,r){this._spatial=new n.Spatial;this._geoCoords=new n.GeoCoords;this._settings=e!=null?e:new V.EdgeCalculatorSettings;this._directions=t!=null?t:new V.EdgeCalculatorDirections;this._coefficients=r!=null?r:new V.EdgeCalculatorCoefficients}e.prototype.getPotentialEdges=function(e,t,r){if(!e.full){throw new H.ArgumentMapillaryError("Node has to be full.")}if(!e.merged){return[]}var n=this._spatial.viewingDirection(e.rotation);var i=this._spatial.angleToPlane(n.toArray(),[0,0,1]);var o=[];for(var a=0,s=t;a<s.length;a++){var u=s[a];if(!u.merged||u.key===e.key){continue}var c=this._geoCoords.geodeticToEnu(u.latLon.lat,u.latLon.lon,u.alt,e.latLon.lat,e.latLon.lon,e.alt);var l=new M.Vector3(c[0],c[1],c[2]);var h=l.length();if(h>this._settings.maxDistance&&r.indexOf(u.key)<0){continue}var p=this._spatial.angleBetweenVector2(n.x,n.y,l.x,l.y);var f=this._spatial.angleToPlane(l.toArray(),[0,0,1]);var d=this._spatial.viewingDirection(u.rotation);var v=this._spatial.angleBetweenVector2(n.x,n.y,d.x,d.y);var m=this._spatial.angleToPlane(d.toArray(),[0,0,1]);var g=m-i;var _=this._spatial.relativeRotationAngle(e.rotation,u.rotation);var y=this._spatial.angleBetweenVector2(1,0,l.x,l.y);var b=u.sequenceKey!=null&&e.sequenceKey!=null&&u.sequenceKey===e.sequenceKey;var x=u.mergeCC==null&&e.mergeCC==null||u.mergeCC===e.mergeCC;var w=u.userKey===e.userKey;var S={capturedAt:u.capturedAt,croppedPano:u.pano&&!u.fullPano,directionChange:v,distance:h,fullPano:u.fullPano,key:u.key,motionChange:p,rotation:_,sameMergeCC:x,sameSequence:b,sameUser:w,sequenceKey:u.sequenceKey,verticalDirectionChange:g,verticalMotion:f,worldMotionAzimuth:y};o.push(S)}return o};e.prototype.computeSequenceEdges=function(e,t){if(!e.full){throw new H.ArgumentMapillaryError("Node has to be full.")}if(e.sequenceKey!==t.key){throw new H.ArgumentMapillaryError("Node and sequence does not correspond.")}var r=[];var n=t.findNextKey(e.key);if(n!=null){r.push({data:{direction:V.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:e.key,to:n})}var i=t.findPrevKey(e.key);if(i!=null){r.push({data:{direction:V.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:e.key,to:i})}return r};e.prototype.computeSimilarEdges=function(t,e){var r=this;if(!t.full){throw new H.ArgumentMapillaryError("Node has to be full.")}var n=t.fullPano;var i={};for(var o=0,a=e;o<a.length;o++){var s=a[o];if(s.sequenceKey==null){continue}if(s.sameSequence){continue}if(n){if(!s.fullPano){continue}}else{if(!s.fullPano&&Math.abs(s.directionChange)>this._settings.similarMaxDirectionChange){continue}}if(s.distance>this._settings.similarMaxDistance){continue}if(s.sameUser&&Math.abs(s.capturedAt-t.capturedAt)<this._settings.similarMinTimeDifference){continue}if(i[s.sequenceKey]==null){i[s.sequenceKey]=[]}i[s.sequenceKey].push(s)}var u=[];var c=t.fullPano?function(e){return e.distance}:function(e){return r._coefficients.similarDistance*e.distance+r._coefficients.similarRotation*e.rotation};for(var l in i){if(!i.hasOwnProperty(l)){continue}var h=Number.MAX_VALUE;var p=null;for(var f=0,d=i[l];f<d.length;f++){var s=d[f];var v=c(s);if(v<h){h=v;p=s}}if(p==null){continue}u.push(p)}return u.map(function(e){return{data:{direction:V.EdgeDirection.Similar,worldMotionAzimuth:e.worldMotionAzimuth},from:t.key,to:e.key}})};e.prototype.computeStepEdges=function(e,t,r,n){if(!e.full){throw new H.ArgumentMapillaryError("Node has to be full.")}var i=[];if(e.pano){return i}for(var o in this._directions.steps){if(!this._directions.steps.hasOwnProperty(o)){continue}var a=this._directions.steps[o];var s=Number.MAX_VALUE;var u=null;var c=null;for(var l=0,h=t;l<h.length;l++){var p=h[l];if(p.croppedPano||p.fullPano){continue}if(Math.abs(p.directionChange)>this._settings.stepMaxDirectionChange){continue}var f=this._spatial.angleDifference(a.motionChange,p.motionChange);var d=this._spatial.angleDifference(p.directionChange,f);var v=Math.max(Math.abs(f),Math.abs(d));if(Math.abs(v)>this._settings.stepMaxDrift){continue}var m=p.key;if(a.useFallback&&(m===r||m===n)){c=p}if(p.distance>this._settings.stepMaxDistance){continue}f=Math.sqrt(f*f+p.verticalMotion*p.verticalMotion);var g=this._coefficients.stepPreferredDistance*Math.abs(p.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*f/this._settings.stepMaxDrift+this._coefficients.stepRotation*p.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(p.sameSequence?0:1)+this._coefficients.stepMergeCCPenalty*(p.sameMergeCC?0:1);if(g<s){s=g;u=p}}u=u==null?c:u;if(u!=null){i.push({data:{direction:a.direction,worldMotionAzimuth:u.worldMotionAzimuth},from:e.key,to:u.key})}}return i};e.prototype.computeTurnEdges=function(e,t){if(!e.full){throw new H.ArgumentMapillaryError("Node has to be full.")}var r=[];if(e.pano){return r}for(var n in this._directions.turns){if(!this._directions.turns.hasOwnProperty(n)){continue}var i=this._directions.turns[n];var o=Number.MAX_VALUE;var a=null;for(var s=0,u=t;s<u.length;s++){var c=u[s];if(c.croppedPano||c.fullPano){continue}if(c.distance>this._settings.turnMaxDistance){continue}var l=i.direction!==V.EdgeDirection.TurnU&&c.distance<this._settings.turnMaxRigDistance&&Math.abs(c.directionChange)>this._settings.turnMinRigDirectionChange;var h=this._spatial.angleDifference(i.directionChange,c.directionChange);var p=void 0;if(l&&c.directionChange*i.directionChange>0&&Math.abs(c.directionChange)<Math.abs(i.directionChange)){p=-Math.PI/2+Math.abs(c.directionChange)}else{if(Math.abs(h)>this._settings.turnMaxDirectionChange){continue}var f=i.motionChange?this._spatial.angleDifference(i.motionChange,c.motionChange):0;f=Math.sqrt(f*f+c.verticalMotion*c.verticalMotion);p=this._coefficients.turnDistance*c.distance/this._settings.turnMaxDistance+this._coefficients.turnMotion*f/Math.PI+this._coefficients.turnSequencePenalty*(c.sameSequence?0:1)+this._coefficients.turnMergeCCPenalty*(c.sameMergeCC?0:1)}if(p<o){o=p;a=c}}if(a!=null){r.push({data:{direction:i.direction,worldMotionAzimuth:a.worldMotionAzimuth},from:e.key,to:a.key})}}return r};e.prototype.computePerspectiveToPanoEdges=function(e,t){if(!e.full){throw new H.ArgumentMapillaryError("Node has to be full.")}if(e.pano){return[]}var r=Number.MAX_VALUE;var n=null;for(var i=0,o=t;i<o.length;i++){var a=o[i];if(!a.fullPano){continue}var s=this._coefficients.panoPreferredDistance*Math.abs(a.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(a.motionChange)/Math.PI+this._coefficients.panoMergeCCPenalty*(a.sameMergeCC?0:1);if(s<r){r=s;n=a}}if(n==null){return[]}return[{data:{direction:V.EdgeDirection.Pano,worldMotionAzimuth:n.worldMotionAzimuth},from:e.key,to:n.key}]};e.prototype.computePanoEdges=function(e,t){if(!e.full){throw new H.ArgumentMapillaryError("Node has to be full.")}if(!e.fullPano){return[]}var r=[];var n=[];var i=[];for(var o=0,a=t;o<a.length;o++){var s=a[o];if(s.distance>this._settings.panoMaxDistance){continue}if(s.fullPano){if(s.distance<this._settings.panoMinDistance){continue}n.push(s)}else{if(s.croppedPano){continue}for(var u in this._directions.panos){if(!this._directions.panos.hasOwnProperty(u)){continue}var c=this._directions.panos[u];var l=this._spatial.angleDifference(s.directionChange,s.motionChange);var h=this._spatial.angleDifference(c.directionChange,l);if(Math.abs(h)>this._settings.panoMaxStepTurnChange){continue}i.push([c.direction,s]);break}}}var p=Math.PI/this._settings.panoMaxItems;var f=[];var d=[];for(var v=0;v<this._settings.panoMaxItems;v++){var m=v/this._settings.panoMaxItems*2*Math.PI;var g=Number.MAX_VALUE;var _=null;for(var y=0,b=n;y<b.length;y++){var s=b[y];var x=this._spatial.angleDifference(m,s.motionChange);if(Math.abs(x)>p){continue}var w=Number.MAX_VALUE;for(var S=0,M=f;S<M.length;S++){var C=M[S];var T=Math.abs(this._spatial.angleDifference(C,s.motionChange));if(T<w){w=T}}if(w<=p){continue}var E=this._coefficients.panoPreferredDistance*Math.abs(s.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(x)/p+this._coefficients.panoSequencePenalty*(s.sameSequence?0:1)+this._coefficients.panoMergeCCPenalty*(s.sameMergeCC?0:1);if(E<g){g=E;_=s}}if(_!=null){f.push(_.motionChange);r.push({data:{direction:V.EdgeDirection.Pano,worldMotionAzimuth:_.worldMotionAzimuth},from:e.key,to:_.key})}else{d.push(m)}}var O={};O[V.EdgeDirection.Pano]=f;O[V.EdgeDirection.StepForward]=[];O[V.EdgeDirection.StepLeft]=[];O[V.EdgeDirection.StepBackward]=[];O[V.EdgeDirection.StepRight]=[];for(var P=0,A=d;P<A.length;P++){var j=A[P];var R=[];for(var u in this._directions.panos){if(!this._directions.panos.hasOwnProperty(u)){continue}var c=this._directions.panos[u];var k=O[V.EdgeDirection.Pano].concat(O[c.direction]).concat(O[c.prev]).concat(O[c.next]);var g=Number.MAX_VALUE;var _=null;for(var L=0,N=i;L<N.length;L++){var s=N[L];if(s[0]!==c.direction){continue}var I=this._spatial.angleDifference(j,s[1].motionChange);if(Math.abs(I)>p){continue}var D=Number.MAX_VALUE;for(var B=0,F=k;B<F.length;B++){var C=F[B];var w=Math.abs(this._spatial.angleDifference(C,s[1].motionChange));if(w<D){D=w}}if(D<=p){continue}var E=this._coefficients.panoPreferredDistance*Math.abs(s[1].distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(I)/p+this._coefficients.panoMergeCCPenalty*(s[1].sameMergeCC?0:1);if(E<g){g=E;_=s}}if(_!=null){R.push(_);r.push({data:{direction:_[0],worldMotionAzimuth:_[1].worldMotionAzimuth},from:e.key,to:_[1].key})}}for(var z=0,$=R;z<$.length;z++){var G=$[z];O[G[0]].push(G[1].motionChange)}}return r};return e}();r.EdgeCalculator=i;r.default=i},{"../../Edge":292,"../../Error":293,"../../Geo":294,three:242}],434:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EdgeCalculatorCoefficients=void 0;var n=function(){function e(){this.panoPreferredDistance=2;this.panoMotion=2;this.panoSequencePenalty=1;this.panoMergeCCPenalty=4;this.stepPreferredDistance=4;this.stepMotion=3;this.stepRotation=4;this.stepSequencePenalty=2;this.stepMergeCCPenalty=6;this.similarDistance=2;this.similarRotation=3;this.turnDistance=4;this.turnMotion=2;this.turnSequencePenalty=1;this.turnMergeCCPenalty=4}return e}();r.EdgeCalculatorCoefficients=n;r.default=n},{}],435:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EdgeCalculatorDirections=void 0;var n=e("../../Edge");var i=function(){function e(){this.steps={};this.turns={};this.panos={};this.steps[n.EdgeDirection.StepForward]={direction:n.EdgeDirection.StepForward,motionChange:0,useFallback:true};this.steps[n.EdgeDirection.StepBackward]={direction:n.EdgeDirection.StepBackward,motionChange:Math.PI,useFallback:true};this.steps[n.EdgeDirection.StepLeft]={direction:n.EdgeDirection.StepLeft,motionChange:Math.PI/2,useFallback:false};this.steps[n.EdgeDirection.StepRight]={direction:n.EdgeDirection.StepRight,motionChange:-Math.PI/2,useFallback:false};this.turns[n.EdgeDirection.TurnLeft]={direction:n.EdgeDirection.TurnLeft,directionChange:Math.PI/2,motionChange:Math.PI/4};this.turns[n.EdgeDirection.TurnRight]={direction:n.EdgeDirection.TurnRight,directionChange:-Math.PI/2,motionChange:-Math.PI/4};this.turns[n.EdgeDirection.TurnU]={direction:n.EdgeDirection.TurnU,directionChange:Math.PI,motionChange:null};this.panos[n.EdgeDirection.StepForward]={direction:n.EdgeDirection.StepForward,directionChange:0,next:n.EdgeDirection.StepLeft,prev:n.EdgeDirection.StepRight};this.panos[n.EdgeDirection.StepBackward]={direction:n.EdgeDirection.StepBackward,directionChange:Math.PI,next:n.EdgeDirection.StepRight,prev:n.EdgeDirection.StepLeft};this.panos[n.EdgeDirection.StepLeft]={direction:n.EdgeDirection.StepLeft,directionChange:Math.PI/2,next:n.EdgeDirection.StepBackward,prev:n.EdgeDirection.StepForward};this.panos[n.EdgeDirection.StepRight]={direction:n.EdgeDirection.StepRight,directionChange:-Math.PI/2,next:n.EdgeDirection.StepForward,prev:n.EdgeDirection.StepBackward}}return e}();r.EdgeCalculatorDirections=i},{"../../Edge":292}],436:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EdgeCalculatorSettings=void 0;var n=function(){function e(){this.panoMinDistance=.1;this.panoMaxDistance=20;this.panoPreferredDistance=5;this.panoMaxItems=4;this.panoMaxStepTurnChange=Math.PI/8;this.rotationMaxDistance=this.turnMaxRigDistance;this.rotationMaxDirectionChange=Math.PI/6;this.rotationMaxVerticalDirectionChange=Math.PI/8;this.similarMaxDirectionChange=Math.PI/8;this.similarMaxDistance=12;this.similarMinTimeDifference=12*3600*1e3;this.stepMaxDistance=20;this.stepMaxDirectionChange=Math.PI/6;this.stepMaxDrift=Math.PI/6;this.stepPreferredDistance=4;this.turnMaxDistance=15;this.turnMaxDirectionChange=2*Math.PI/9;this.turnMaxRigDistance=.65;this.turnMinRigDirectionChange=Math.PI/6}Object.defineProperty(e.prototype,"maxDistance",{get:function(){return Math.max(this.panoMaxDistance,this.similarMaxDistance,this.stepMaxDistance,this.turnMaxDistance)},enumerable:false,configurable:true});return e}();r.EdgeCalculatorSettings=n;r.default=n},{}],437:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EdgeDirection=void 0;var n;(function(e){e[e["Next"]=0]="Next";e[e["Prev"]=1]="Prev";e[e["StepLeft"]=2]="StepLeft";e[e["StepRight"]=3]="StepRight";e[e["StepForward"]=4]="StepForward";e[e["StepBackward"]=5]="StepBackward";e[e["TurnLeft"]=6]="TurnLeft";e[e["TurnRight"]=7]="TurnRight";e[e["TurnU"]=8]="TurnU";e[e["Pano"]=9]="Pano";e[e["Similar"]=10]="Similar"})(n=r.EdgeDirection||(r.EdgeDirection={}))},{}],438:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],439:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],440:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DOMRenderer=void 0;var i=e("rxjs");var o=e("rxjs/operators");var a=e("virtual-dom");var s=e("rxjs");var u=e("../Render");var n=function(){function e(e,t,r){this._adaptiveOperation$=new s.Subject;this._render$=new s.Subject;this._renderAdaptive$=new s.Subject;this._renderService=t;this._currentFrame$=r;var n=a.create(a.h("div.domRenderer",[]));e.appendChild(n);this._offset$=this._adaptiveOperation$.pipe(o.scan(function(e,t){return t(e)},{elementHeight:e.offsetHeight,elementWidth:e.offsetWidth,imageAspect:0,renderMode:u.RenderMode.Fill}),o.filter(function(e){return e.imageAspect>0&&e.elementWidth>0&&e.elementHeight>0}),o.map(function(e){var t=e.elementWidth/e.elementHeight;var r=e.imageAspect/t;var n=0;var i=0;if(e.renderMode===u.RenderMode.Letterbox){if(e.imageAspect>t){n=e.elementHeight*(1-1/r)/2}else{i=e.elementWidth*(1-r)/2}}else{if(e.imageAspect>t){i=-e.elementWidth*(r-1)/2}else{n=-e.elementHeight*(1/r-1)/2}}return{bottom:n,left:i,right:i,top:n}}));this._currentFrame$.pipe(o.filter(function(e){return e.state.currentNode!=null}),o.distinctUntilChanged(function(e,t){return e===t},function(e){return e.state.currentNode.key}),o.map(function(e){return e.state.currentTransform.basicAspect}),o.map(function(t){return function(e){e.imageAspect=t;return e}})).subscribe(this._adaptiveOperation$);i.combineLatest(this._renderAdaptive$.pipe(o.scan(function(e,t){if(t.vnode==null){delete e[t.name]}else{e[t.name]=t.vnode}return e},{})),this._offset$).pipe(o.map(function(e){var t=[];var r=e[0];for(var n in r){if(!r.hasOwnProperty(n)){continue}t.push(r[n])}var i=e[1];var o={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:a.h("div.adaptiveDomRenderer",o,t)}})).subscribe(this._render$);this._vNode$=this._render$.pipe(o.scan(function(e,t){if(t.vnode==null){delete e[t.name]}else{e[t.name]=t.vnode}return e},{}),o.map(function(e){var t=[];for(var r in e){if(!e.hasOwnProperty(r)){continue}t.push(e[r])}return a.h("div.domRenderer",t)}));this._vPatch$=this._vNode$.pipe(o.scan(function(e,t){e.vpatch=a.diff(e.vnode,t);e.vnode=t;return e},{vnode:a.h("div.domRenderer",[]),vpatch:null}),o.pluck("vpatch"));this._element$=this._vPatch$.pipe(o.scan(function(e,t){return a.patch(e,t)},n),o.publishReplay(1),o.refCount());this._element$.subscribe(function(){});this._renderService.size$.pipe(o.map(function(t){return function(e){e.elementWidth=t.width;e.elementHeight=t.height;return e}})).subscribe(this._adaptiveOperation$);this._renderService.renderMode$.pipe(o.map(function(t){return function(e){e.renderMode=t;return e}})).subscribe(this._adaptiveOperation$)}Object.defineProperty(e.prototype,"element$",{get:function(){return this._element$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"render$",{get:function(){return this._render$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"renderAdaptive$",{get:function(){return this._renderAdaptive$},enumerable:false,configurable:true});e.prototype.clear=function(e){this._renderAdaptive$.next({name:e,vnode:null});this._render$.next({name:e,vnode:null})};return e}();r.DOMRenderer=n;r.default=n},{"../Render":297,rxjs:43,"rxjs/operators":241,"virtual-dom":247}],441:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GLRenderStage=void 0;var n;(function(e){e[e["Background"]=0]="Background";e[e["Foreground"]=1]="Foreground"})(n=r.GLRenderStage||(r.GLRenderStage={}));r.default=n},{}],442:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.GLRenderer=void 0;var l=e("rxjs");var h=e("rxjs/operators");var p=e("three");var f=e("../Render");var d=e("../Utils");var n=function(){function e(i,o,e){var a=this;this._renderFrame$=new l.Subject;this._renderCameraOperation$=new l.Subject;this._render$=new l.Subject;this._clear$=new l.Subject;this._renderOperation$=new l.Subject;this._rendererOperation$=new l.Subject;this._eraserOperation$=new l.Subject;this._renderService=o;this._dom=!!e?e:new d.DOM;this._renderer$=this._rendererOperation$.pipe(h.scan(function(e,t){return t(e)},{needsRender:false,renderer:null}),h.filter(function(e){return!!e.renderer}));this._renderCollection$=this._renderOperation$.pipe(h.scan(function(e,t){return t(e)},{}),h.share());this._renderCamera$=this._renderCameraOperation$.pipe(h.scan(function(e,t){return t(e)},{frameId:-1,needsRender:false,perspective:null}));this._eraser$=this._eraserOperation$.pipe(h.startWith(function(e){return e}),h.scan(function(e,t){return t(e)},{needsRender:false}));l.combineLatest(this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$).pipe(h.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];var o=Object.keys(r).map(function(e){return r[e]});return{camera:n,eraser:i,renderer:t,renders:o}}),h.filter(function(e){var t=e.renderer.needsRender||e.camera.needsRender||e.eraser.needsRender;var r=e.camera.frameId;for(var n=0,i=e.renders;n<i.length;n++){var o=i[n];if(o.frameId!==r){return false}t=t||o.needsRender}return t}),h.distinctUntilChanged(function(e,t){return e===t},function(e){return e.eraser.needsRender?-1:e.camera.frameId})).subscribe(function(e){e.renderer.needsRender=false;e.camera.needsRender=false;e.eraser.needsRender=false;var t=e.camera.perspective;var r=[];var n=[];for(var i=0,o=e.renders;i<o.length;i++){var a=o[i];if(a.stage===f.GLRenderStage.Background){r.push(a.render)}else if(a.stage===f.GLRenderStage.Foreground){n.push(a.render)}}var s=e.renderer.renderer;s.clear();for(var u=0,c=r;u<c.length;u++){var a=c[u];a(t,s)}s.clearDepth();for(var l=0,h=n;l<h.length;l++){var a=h[l];a(t,s)}});this._renderFrame$.pipe(h.map(function(t){return function(e){e.frameId=t.frameId;e.perspective=t.perspective;if(t.changed===true){e.needsRender=true}return e}})).subscribe(this._renderCameraOperation$);this._renderFrameSubscribe();var t=this._render$.pipe(h.map(function(t){return function(e){e[t.name]=t.render;return e}}));var r=this._clear$.pipe(h.map(function(t){return function(e){delete e[t];return e}}));l.merge(t,r).subscribe(this._renderOperation$);this._webGLRenderer$=this._render$.pipe(h.first(),h.map(function(e){var t=a._dom.createElement("canvas","mapillary-js-canvas");t.style.position="absolute";t.setAttribute("tabindex","0");i.appendChild(t);var r=o.element;var n=new p.WebGLRenderer({canvas:t});n.setPixelRatio(window.devicePixelRatio);n.setSize(r.offsetWidth,r.offsetHeight);n.setClearColor(new p.Color(2105376),1);n.autoClear=false;return n}),h.publishReplay(1),h.refCount());this._webGLRenderer$.subscribe(function(){});var n=this._webGLRenderer$.pipe(h.first(),h.map(function(t){return function(e){e.needsRender=true;e.renderer=t;return e}}));var s=this._renderService.size$.pipe(h.map(function(t){return function(e){if(e.renderer==null){return e}e.renderer.setSize(t.width,t.height);e.needsRender=true;return e}}));var u=this._clear$.pipe(h.map(function(e){return function(e){if(e.renderer==null){return e}e.needsRender=true;return e}}));l.merge(n,s,u).subscribe(this._rendererOperation$);var c=this._renderCollection$.pipe(h.filter(function(e){return Object.keys(e).length===0}),h.share());c.subscribe(function(e){if(a._renderFrameSubscription==null){return}a._renderFrameSubscription.unsubscribe();a._renderFrameSubscription=null;a._renderFrameSubscribe()});c.pipe(h.map(function(e){return function(e){e.needsRender=true;return e}})).subscribe(this._eraserOperation$)}Object.defineProperty(e.prototype,"render$",{get:function(){return this._render$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"webGLRenderer$",{get:function(){return this._webGLRenderer$},enumerable:false,configurable:true});e.prototype.clear=function(e){this._clear$.next(e)};e.prototype._renderFrameSubscribe=function(){var t=this;this._render$.pipe(h.first(),h.map(function(e){return function(e){e.needsRender=true;return e}})).subscribe(function(e){t._renderCameraOperation$.next(e)});this._renderFrameSubscription=this._render$.pipe(h.first(),h.mergeMap(function(e){return t._renderService.renderCameraFrame$})).subscribe(this._renderFrame$)};return e}();r.GLRenderer=n;r.default=n},{"../Render":297,"../Utils":301,rxjs:43,"rxjs/operators":241,three:242}],443:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RenderCamera=void 0;var n=e("three");var i=e("../Geo");var s=e("../Render");var u=e("../State");var o=function(){function e(e,t,r){this._spatial=new i.Spatial;this._viewportCoords=new i.ViewportCoords;this._initialFov=50;this._alpha=-1;this._renderMode=r;this._zoom=0;this._frameId=-1;this._changed=false;this._changedForFrame=-1;this._currentNodeId=null;this._previousNodeId=null;this._currentPano=false;this._previousPano=false;this._state=null;this._currentProjectedPoints=[];this._previousProjectedPoints=[];this._currentFov=this._initialFov;this._previousFov=this._initialFov;this._camera=new i.Camera;this._perspective=new n.PerspectiveCamera(this._initialFov,this._computeAspect(e,t),.16,1e4);this._perspective.matrixAutoUpdate=false;this._rotation={phi:0,theta:0}}Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"changed",{get:function(){return this._frameId===this._changedForFrame},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"perspective",{get:function(){return this._perspective},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"renderMode",{get:function(){return this._renderMode},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"zoom",{get:function(){return this._zoom},enumerable:false,configurable:true});e.prototype.getTilt=function(){return 90-this._spatial.radToDeg(this._rotation.theta)};e.prototype.fovToZoom=function(e){e=Math.min(90,Math.max(0,e));var t=this._computeCurrentFov(0);var r=this._alpha===1?t:this._interpolateFov(t,this._computePreviousFov(0),this._alpha);var n=Math.tan(r/2*Math.PI/180);var i=Math.tan(e/2*Math.PI/180);var o=Math.log(n/i)/Math.log(2);return o};e.prototype.setFrame=function(e){var t=e.state;if(t.state!==this._state){this._state=t.state;this._changed=true}var r=t.currentNode.key;var n=!!t.previousNode?t.previousNode.key:null;if(r!==this._currentNodeId){this._currentNodeId=r;this._currentPano=!!t.currentTransform.gpano;this._currentProjectedPoints=this._computeProjectedPoints(t.currentTransform);this._changed=true}if(n!==this._previousNodeId){this._previousNodeId=n;this._previousPano=!!t.previousTransform.gpano;this._previousProjectedPoints=this._computeProjectedPoints(t.previousTransform);this._changed=true}var i=t.zoom;if(i!==this._zoom){this._zoom=i;this._changed=true}if(this._changed){this._currentFov=this._computeCurrentFov(this.zoom);this._previousFov=this._computePreviousFov(this._zoom)}var o=t.alpha;if(this._changed||o!==this._alpha){this._alpha=o;this._perspective.fov=this._state===u.State.Earth?60:this._interpolateFov(this._currentFov,this._previousFov,this._alpha);this._changed=true}var a=t.camera;if(this._camera.diff(a)>1e-9){this._camera.copy(a);this._rotation=this._computeRotation(a);this._perspective.up.copy(a.up);this._perspective.position.copy(a.position);this._perspective.matrixAutoUpdate=true;this._perspective.lookAt(a.lookat);this._perspective.matrixAutoUpdate=false;this._perspective.updateMatrix();this._perspective.updateMatrixWorld(false);this._changed=true}if(this._changed){this._perspective.updateProjectionMatrix()}this._setFrameId(e.id)};e.prototype.setRenderMode=function(e){this._renderMode=e;this._perspective.fov=this._computeFov();this._perspective.updateProjectionMatrix();this._changed=true};e.prototype.setSize=function(e){this._perspective.aspect=this._computeAspect(e.width,e.height);this._perspective.fov=this._computeFov();this._perspective.updateProjectionMatrix();this._changed=true};e.prototype._computeAspect=function(e,t){return e===0?0:e/t};e.prototype._computeCurrentFov=function(e){if(this._perspective.aspect===0){return 0}if(!this._currentNodeId){return this._initialFov}return this._currentPano?this._yToFov(1,e):this._computeVerticalFov(this._currentProjectedPoints,this._renderMode,e,this.perspective.aspect)};e.prototype._computeFov=function(){this._currentFov=this._computeCurrentFov(this._zoom);this._previousFov=this._computePreviousFov(this._zoom);return this._interpolateFov(this._currentFov,this._previousFov,this._alpha)};e.prototype._computePreviousFov=function(e){if(this._perspective.aspect===0){return 0}if(!this._currentNodeId){return this._initialFov}return!this._previousNodeId?this._currentFov:this._previousPano?this._yToFov(1,e):this._computeVerticalFov(this._previousProjectedPoints,this._renderMode,e,this.perspective.aspect)};e.prototype._computeProjectedPoints=function(e){var t=[[.5,0],[1,0]];var r=[[.5,0],[0,.5]];var n=100;return i.Geo.computeProjectedPoints(e,t,r,n,this._viewportCoords)};e.prototype._computeRequiredVerticalFov=function(e,t,r){var n=Math.max(e[0]/r,e[1]);return this._yToFov(n,t)};e.prototype._computeRotation=function(e){var t=e.lookat.clone().sub(e.position);var r=e.up.clone();var n=this._spatial.azimuthal(t.toArray(),r.toArray());var i=Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1]);return{phi:n,theta:i}};e.prototype._computeVerticalFov=function(e,t,r,n){var i=this;var o=e.map(function(e){return i._computeRequiredVerticalFov(e,r,n)});var a=t===s.RenderMode.Fill?Math.min.apply(Math,o)*.995:Math.max.apply(Math,o);return a};e.prototype._yToFov=function(e,t){return 2*Math.atan(e/Math.pow(2,t))*180/Math.PI};e.prototype._interpolateFov=function(e,t,r){return r*e+(1-r)*t};e.prototype._setFrameId=function(e){this._frameId=e;if(this._changed){this._changed=false;this._changedForFrame=e}};return e}();r.RenderCamera=o;r.default=o},{"../Geo":294,"../Render":297,"../State":298,three:242}],444:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RenderMode=void 0;var n;(function(e){e[e["Letterbox"]=0]="Letterbox";e[e["Fill"]=1]="Fill"})(n=r.RenderMode||(r.RenderMode={}));r.default=n},{}],445:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RenderService=void 0;var o=e("rxjs/operators");var a=e("rxjs");var s=e("../Geo");var u=e("../Render");var n=function(){function e(e,t,r,n){var i=this;this._element=e;this._currentFrame$=t;this._spatial=new s.Spatial;r=r!=null?r:u.RenderMode.Fill;this._resize$=new a.Subject;this._renderCameraOperation$=new a.Subject;this._size$=new a.BehaviorSubject({height:this._element.offsetHeight,width:this._element.offsetWidth});this._resize$.pipe(o.map(function(){return{height:i._element.offsetHeight,width:i._element.offsetWidth}})).subscribe(this._size$);this._renderMode$=new a.BehaviorSubject(r);this._renderCameraHolder$=this._renderCameraOperation$.pipe(o.startWith(function(e){return e}),o.scan(function(e,t){return t(e)},!!n?n:new u.RenderCamera(this._element.offsetWidth,this._element.offsetHeight,r)),o.publishReplay(1),o.refCount());this._renderCameraFrame$=this._currentFrame$.pipe(o.withLatestFrom(this._renderCameraHolder$),o.tap(function(e){var t=e[0],r=e[1];r.setFrame(t)}),o.map(function(e){return e[1]}),o.publishReplay(1),o.refCount());this._renderCamera$=this._renderCameraFrame$.pipe(o.filter(function(e){return e.changed}),o.publishReplay(1),o.refCount());this._bearing$=this._renderCamera$.pipe(o.map(function(e){var t=i._spatial.radToDeg(i._spatial.azimuthalToBearing(e.rotation.phi));return i._spatial.wrap(t,0,360)}),o.publishReplay(1),o.refCount());this._size$.pipe(o.skip(1),o.map(function(t){return function(e){e.setSize(t);return e}})).subscribe(this._renderCameraOperation$);this._renderMode$.pipe(o.skip(1),o.map(function(t){return function(e){e.setRenderMode(t);return e}})).subscribe(this._renderCameraOperation$);this._bearing$.subscribe(function(){});this._renderCameraHolder$.subscribe(function(){});this._size$.subscribe(function(){});this._renderMode$.subscribe(function(){});this._renderCamera$.subscribe(function(){});this._renderCameraFrame$.subscribe(function(){})}Object.defineProperty(e.prototype,"bearing$",{get:function(){return this._bearing$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"element",{get:function(){return this._element},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"resize$",{get:function(){return this._resize$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"size$",{get:function(){return this._size$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"renderMode$",{get:function(){return this._renderMode$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"renderCameraFrame$",{get:function(){return this._renderCameraFrame$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"renderCamera$",{get:function(){return this._renderCamera$},enumerable:false,configurable:true});return e}();r.RenderService=n;r.default=n},{"../Geo":294,"../Render":297,rxjs:43,"rxjs/operators":241}],446:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],447:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.FrameGenerator=void 0;var n=function(){function e(t){if(t.requestAnimationFrame){this._cancelAnimationFrame=t.cancelAnimationFrame.bind(t);this._requestAnimationFrame=t.requestAnimationFrame.bind(t)}else if(t.mozRequestAnimationFrame){this._cancelAnimationFrame=t.mozCancelAnimationFrame.bind(t);this._requestAnimationFrame=t.mozRequestAnimationFrame.bind(t)}else if(t.webkitRequestAnimationFrame){this._cancelAnimationFrame=t.webkitCancelAnimationFrame.bind(t);this._requestAnimationFrame=t.webkitRequestAnimationFrame.bind(t)}else if(t.msRequestAnimationFrame){this._cancelAnimationFrame=t.msCancelAnimationFrame.bind(t);this._requestAnimationFrame=t.msRequestAnimationFrame.bind(t)}else if(t.oRequestAnimationFrame){this._cancelAnimationFrame=t.oCancelAnimationFrame.bind(t);this._requestAnimationFrame=t.oRequestAnimationFrame.bind(t)}else{this._cancelAnimationFrame=t.clearTimeout.bind(t);this._requestAnimationFrame=function(e){return t.setTimeout(e,1e3/60)}}}Object.defineProperty(e.prototype,"cancelAnimationFrame",{get:function(){return this._cancelAnimationFrame},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"requestAnimationFrame",{get:function(){return this._requestAnimationFrame},enumerable:false,configurable:true});return e}();r.FrameGenerator=n;r.default=n},{}],448:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RotationDelta=void 0;var n=function(){function e(e,t){this._phi=e;this._theta=t}Object.defineProperty(e.prototype,"phi",{get:function(){return this._phi},set:function(e){this._phi=e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"theta",{get:function(){return this._theta},set:function(e){this._theta=e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isZero",{get:function(){return this._phi===0&&this._theta===0},enumerable:false,configurable:true});e.prototype.copy=function(e){this._phi=e.phi;this._theta=e.theta};e.prototype.lerp=function(e,t){this._phi=(1-t)*this._phi+t*e.phi;this._theta=(1-t)*this._theta+t*e.theta};e.prototype.multiply=function(e){this._phi*=e;this._theta*=e};e.prototype.threshold=function(e){this._phi=Math.abs(this._phi)>e?this._phi:0;this._theta=Math.abs(this._theta)>e?this._theta:0};e.prototype.lengthSquared=function(){return this._phi*this._phi+this._theta*this._theta};e.prototype.reset=function(){this._phi=0;this._theta=0};return e}();r.RotationDelta=n;r.default=n},{}],449:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.State=void 0;var n;(function(e){e[e["Earth"]=0]="Earth";e[e["Traversing"]=1]="Traversing";e[e["Waiting"]=2]="Waiting";e[e["WaitingInteractively"]=3]="WaitingInteractively"})(n=r.State||(r.State={}));r.default=n},{}],450:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.StateContext=void 0;var n=e("../State");var i=e("../Geo");var o=function(){function e(e){this._state=new n.TraversingState({alpha:1,camera:new i.Camera,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],transitionMode:e==null?n.TransitionMode.Default:e,zoom:0})}Object.defineProperty(e.prototype,"state",{get:function(){if(this._state instanceof n.EarthState){return n.State.Earth}else if(this._state instanceof n.TraversingState){return n.State.Traversing}else if(this._state instanceof n.WaitingState){return n.State.Waiting}else if(this._state instanceof n.InteractiveWaitingState){return n.State.WaitingInteractively}throw new Error("Invalid state")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"reference",{get:function(){return this._state.reference},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"alpha",{get:function(){return this._state.alpha},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"camera",{get:function(){return this._state.camera},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"zoom",{get:function(){return this._state.zoom},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentNode",{get:function(){return this._state.currentNode},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previousNode",{get:function(){return this._state.previousNode},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentCamera",{get:function(){return this._state.currentCamera},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentTransform",{get:function(){return this._state.currentTransform},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previousTransform",{get:function(){return this._state.previousTransform},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"trajectory",{get:function(){return this._state.trajectory},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this._state.currentIndex},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"lastNode",{get:function(){return this._state.trajectory[this._state.trajectory.length-1]},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"nodesAhead",{get:function(){return this._state.trajectory.length-1-this._state.currentIndex},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"motionless",{get:function(){return this._state.motionless},enumerable:false,configurable:true});e.prototype.earth=function(){this._state=this._state.earth()};e.prototype.traverse=function(){this._state=this._state.traverse()};e.prototype.wait=function(){this._state=this._state.wait()};e.prototype.waitInteractively=function(){this._state=this._state.waitInteractively()};e.prototype.getCenter=function(){return this._state.getCenter()};e.prototype.setCenter=function(e){this._state.setCenter(e)};e.prototype.setZoom=function(e){this._state.setZoom(e)};e.prototype.update=function(e){this._state.update(e)};e.prototype.append=function(e){this._state.append(e)};e.prototype.prepend=function(e){this._state.prepend(e)};e.prototype.remove=function(e){this._state.remove(e)};e.prototype.clear=function(){this._state.clear()};e.prototype.clearPrior=function(){this._state.clearPrior()};e.prototype.cut=function(){this._state.cut()};e.prototype.set=function(e){this._state.set(e)};e.prototype.rotate=function(e){this._state.rotate(e)};e.prototype.rotateUnbounded=function(e){this._state.rotateUnbounded(e)};e.prototype.rotateWithoutInertia=function(e){this._state.rotateWithoutInertia(e)};e.prototype.rotateBasic=function(e){this._state.rotateBasic(e)};e.prototype.rotateBasicUnbounded=function(e){this._state.rotateBasicUnbounded(e)};e.prototype.rotateBasicWithoutInertia=function(e){this._state.rotateBasicWithoutInertia(e)};e.prototype.rotateToBasic=function(e){this._state.rotateToBasic(e)};e.prototype.move=function(e){this._state.move(e)};e.prototype.moveTo=function(e){this._state.moveTo(e)};e.prototype.zoomIn=function(e,t){this._state.zoomIn(e,t)};e.prototype.setSpeed=function(e){this._state.setSpeed(e)};e.prototype.setTransitionMode=function(e){this._state.setTransitionMode(e)};e.prototype.dolly=function(e){this._state.dolly(e)};e.prototype.orbit=function(e){this._state.orbit(e)};e.prototype.truck=function(e){this._state.truck(e)};return e}();r.StateContext=o},{"../Geo":294,"../State":298}],451:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.StateService=void 0;var i=e("rxjs");var o=e("rxjs/operators");var a=e("../State");var n=function(){function e(e){var t=this;this._appendNode$=new i.Subject;this._start$=new i.Subject;this._frame$=new i.Subject;this._fpsSampleRate=30;this._contextOperation$=new i.BehaviorSubject(function(e){return e});this._context$=this._contextOperation$.pipe(o.scan(function(e,t){return t(e)},new a.StateContext(e)),o.publishReplay(1),o.refCount());this._state$=this._context$.pipe(o.map(function(e){return e.state}),o.distinctUntilChanged(),o.publishReplay(1),o.refCount());this._fps$=this._start$.pipe(o.switchMap(function(){return t._frame$.pipe(o.bufferCount(1,t._fpsSampleRate),o.map(function(e){return(new Date).getTime()}),o.pairwise(),o.map(function(e){return Math.max(20,1e3*t._fpsSampleRate/(e[1]-e[0]))}),o.startWith(60))}),o.share());this._currentState$=this._frame$.pipe(o.withLatestFrom(this._fps$,this._context$,function(e,t,r){return[e,t,r]}),o.filter(function(e){return e[2].currentNode!=null}),o.tap(function(e){e[2].update(e[1])}),o.map(function(e){return{fps:e[1],id:e[0],state:e[2]}}),o.share());this._lastState$=this._currentState$.pipe(o.publishReplay(1),o.refCount());var r=this._currentState$.pipe(o.distinctUntilChanged(undefined,function(e){return e.state.currentNode.key}),o.publishReplay(1),o.refCount());var n=new i.Subject;r.subscribe(n);this._currentKey$=new i.BehaviorSubject(null);n.pipe(o.map(function(e){return e.state.currentNode.key})).subscribe(this._currentKey$);this._currentNode$=n.pipe(o.map(function(e){return e.state.currentNode}),o.publishReplay(1),o.refCount());this._currentCamera$=n.pipe(o.map(function(e){return e.state.currentCamera}),o.publishReplay(1),o.refCount());this._currentTransform$=n.pipe(o.map(function(e){return e.state.currentTransform}),o.publishReplay(1),o.refCount());this._reference$=n.pipe(o.map(function(e){return e.state.reference}),o.distinctUntilChanged(function(e,t){return e.lat===t.lat&&e.lon===t.lon},function(e){return{lat:e.lat,lon:e.lon}}),o.publishReplay(1),o.refCount());this._currentNodeExternal$=r.pipe(o.map(function(e){return e.state.currentNode}),o.publishReplay(1),o.refCount());this._appendNode$.pipe(o.map(function(t){return function(e){e.append([t]);return e}})).subscribe(this._contextOperation$);this._inMotionOperation$=new i.Subject;r.pipe(o.map(function(e){return true})).subscribe(this._inMotionOperation$);this._inMotionOperation$.pipe(o.distinctUntilChanged(),o.filter(function(e){return e}),o.switchMap(function(e){return t._currentState$.pipe(o.filter(function(e){return e.state.nodesAhead===0}),o.map(function(e){return[e.state.camera.clone(),e.state.zoom]}),o.pairwise(),o.map(function(e){var t=e[0][0];var r=e[1][0];var n=e[0][1];var i=e[1][1];return t.diff(r)>1e-5||Math.abs(n-i)>1e-5}),o.first(function(e){return!e}))})).subscribe(this._inMotionOperation$);this._inMotion$=this._inMotionOperation$.pipe(o.distinctUntilChanged(),o.publishReplay(1),o.refCount());this._inTranslationOperation$=new i.Subject;r.pipe(o.map(function(e){return true})).subscribe(this._inTranslationOperation$);this._inTranslationOperation$.pipe(o.distinctUntilChanged(),o.filter(function(e){return e}),o.switchMap(function(e){return t._currentState$.pipe(o.filter(function(e){return e.state.nodesAhead===0}),o.map(function(e){return e.state.camera.position.clone()}),o.pairwise(),o.map(function(e){return e[0].distanceToSquared(e[1])!==0}),o.first(function(e){return!e}))})).subscribe(this._inTranslationOperation$);this._inTranslation$=this._inTranslationOperation$.pipe(o.distinctUntilChanged(),o.publishReplay(1),o.refCount());this._state$.subscribe(function(){});this._currentNode$.subscribe(function(){});this._currentCamera$.subscribe(function(){});this._currentTransform$.subscribe(function(){});this._reference$.subscribe(function(){});this._currentNodeExternal$.subscribe(function(){});this._lastState$.subscribe(function(){});this._inMotion$.subscribe(function(){});this._inTranslation$.subscribe(function(){});this._frameId=null;this._frameGenerator=new a.FrameGenerator(window)}Object.defineProperty(e.prototype,"currentState$",{get:function(){return this._currentState$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentNode$",{get:function(){return this._currentNode$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentKey$",{get:function(){return this._currentKey$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentNodeExternal$",{get:function(){return this._currentNodeExternal$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentCamera$",{get:function(){return this._currentCamera$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentTransform$",{get:function(){return this._currentTransform$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"state$",{get:function(){return this._state$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"reference$",{get:function(){return this._reference$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"inMotion$",{get:function(){return this._inMotion$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"inTranslation$",{get:function(){return this._inTranslation$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"appendNode$",{get:function(){return this._appendNode$},enumerable:false,configurable:true});e.prototype.earth=function(){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.earth()})};e.prototype.traverse=function(){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.traverse()})};e.prototype.wait=function(){this._invokeContextOperation(function(e){e.wait()})};e.prototype.waitInteractively=function(){this._invokeContextOperation(function(e){e.waitInteractively()})};e.prototype.appendNodes=function(t){this._invokeContextOperation(function(e){e.append(t)})};e.prototype.prependNodes=function(t){this._invokeContextOperation(function(e){e.prepend(t)})};e.prototype.removeNodes=function(t){this._invokeContextOperation(function(e){e.remove(t)})};e.prototype.clearNodes=function(){this._invokeContextOperation(function(e){e.clear()})};e.prototype.clearPriorNodes=function(){this._invokeContextOperation(function(e){e.clearPrior()})};e.prototype.cutNodes=function(){this._invokeContextOperation(function(e){e.cut()})};e.prototype.setNodes=function(t){this._invokeContextOperation(function(e){e.set(t)})};e.prototype.rotate=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.rotate(t)})};e.prototype.rotateUnbounded=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.rotateUnbounded(t)})};e.prototype.rotateWithoutInertia=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.rotateWithoutInertia(t)})};e.prototype.rotateBasic=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.rotateBasic(t)})};e.prototype.rotateBasicUnbounded=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.rotateBasicUnbounded(t)})};e.prototype.rotateBasicWithoutInertia=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.rotateBasicWithoutInertia(t)})};e.prototype.rotateToBasic=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.rotateToBasic(t)})};e.prototype.move=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.move(t)})};e.prototype.moveTo=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.moveTo(t)})};e.prototype.dolly=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.dolly(t)})};e.prototype.orbit=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.orbit(t)})};e.prototype.truck=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.truck(t)})};e.prototype.zoomIn=function(t,r){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.zoomIn(t,r)})};e.prototype.getCenter=function(){return this._lastState$.pipe(o.first(),o.map(function(e){return e.state.getCenter()}))};e.prototype.getZoom=function(){return this._lastState$.pipe(o.first(),o.map(function(e){return e.state.zoom}))};e.prototype.setCenter=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.setCenter(t)})};e.prototype.setSpeed=function(t){this._invokeContextOperation(function(e){e.setSpeed(t)})};e.prototype.setTransitionMode=function(t){this._invokeContextOperation(function(e){e.setTransitionMode(t)})};e.prototype.setZoom=function(t){this._inMotionOperation$.next(true);this._invokeContextOperation(function(e){e.setZoom(t)})};e.prototype.start=function(){if(this._frameId==null){this._start$.next(null);this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this));this._frame$.next(this._frameId)}};e.prototype.stop=function(){if(this._frameId!=null){this._frameGenerator.cancelAnimationFrame(this._frameId);this._frameId=null}};e.prototype._invokeContextOperation=function(t){this._contextOperation$.next(function(e){t(e);return e})};e.prototype._frame=function(e){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this));this._frame$.next(this._frameId)};return e}();r.StateService=n},{"../State":298,rxjs:43,"rxjs/operators":241}],452:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TransitionMode=void 0;var n;(function(e){e[e["Default"]=0]="Default";e[e["Instantaneous"]=1]="Instantaneous"})(n=r.TransitionMode||(r.TransitionMode={}));r.default=n},{}],453:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],454:[function(e,t,r){"use strict";var i=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.EarthState=void 0;var u=e("three");var o=e("../../State");var n=function(n){i(e,n);function e(e){var t=n.call(this,e)||this;var r=t._camera.lookat.clone().sub(t._camera.position).normalize();t._camera.lookat.copy(t._camera.position);t._camera.position.z=e.camera.position.z+20;t._camera.position.x=e.camera.position.x-16*r.x;t._camera.position.y=e.camera.position.y-16*r.y;t._camera.up.set(0,0,1);return t}e.prototype.traverse=function(){return new o.TraversingState(this)};e.prototype.wait=function(){return new o.WaitingState(this)};e.prototype.waitInteractively=function(){return new o.InteractiveWaitingState(this)};e.prototype.dolly=function(e){var t=this._camera;var r=(new u.Vector3).copy(t.position).sub(t.lookat);var n=r.length();var i=n*Math.pow(2,-e);var o=Math.max(1,Math.min(i,1e3));r.normalize();r.multiplyScalar(o);t.position.copy(t.lookat).add(r)};e.prototype.orbit=function(e){var t=this._camera;var r=(new u.Quaternion).setFromUnitVectors(t.up,new u.Vector3(0,0,1));var n=r.clone().inverse();var i=new u.Vector3;i.copy(t.position).sub(t.lookat);i.applyQuaternion(r);var o=i.length();var a=Math.atan2(i.y,i.x);a+=e.phi;var s=Math.atan2(Math.sqrt(i.x*i.x+i.y*i.y),i.z);s+=e.theta;s=Math.max(.1,Math.min(Math.PI-.1,s));i.x=Math.sin(s)*Math.cos(a);i.y=Math.sin(s)*Math.sin(a);i.z=Math.cos(s);i.applyQuaternion(n);t.position.copy(t.lookat).add(i.multiplyScalar(o))};e.prototype.truck=function(e){this._camera.position.add((new u.Vector3).fromArray(e));this._camera.lookat.add((new u.Vector3).fromArray(e))};e.prototype.update=function(){};return e}(o.StateBase);r.EarthState=n;r.default=n},{"../../State":298,three:242}],455:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.InteractiveStateBase=void 0;var p=e("three");var i=e("../../State");var o=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t._animationSpeed=1/40;t._rotationDelta=new i.RotationDelta(0,0);t._requestedRotationDelta=null;t._basicRotation=[0,0];t._requestedBasicRotation=null;t._requestedBasicRotationUnbounded=null;t._rotationAcceleration=.86;t._rotationIncreaseAlpha=.97;t._rotationDecreaseAlpha=.9;t._rotationThreshold=.001;t._unboundedRotationAlpha=.8;t._desiredZoom=e.zoom;t._minZoom=0;t._maxZoom=3;t._lookatDepth=10;t._desiredLookat=null;t._desiredCenter=null;return t}e.prototype.rotate=function(e){if(this._currentNode==null){return}if(e.phi===0&&e.theta===0){return}this._desiredZoom=this._zoom;this._desiredLookat=null;this._requestedBasicRotation=null;if(this._requestedRotationDelta!=null){this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+e.phi;this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+e.theta}else{this._requestedRotationDelta=new i.RotationDelta(e.phi,e.theta)}};e.prototype.rotateUnbounded=function(e){if(this._currentNode==null){return}this._requestedBasicRotation=null;this._requestedRotationDelta=null;this._applyRotation(e,this._currentCamera);this._applyRotation(e,this._previousCamera);if(!this._desiredLookat){return}var t=(new p.Quaternion).setFromUnitVectors(this._currentCamera.up,new p.Vector3(0,0,1));var r=t.clone().inverse();var n=(new p.Vector3).copy(this._desiredLookat).sub(this._camera.position).applyQuaternion(t);var i=n.length();var o=Math.atan2(n.y,n.x);o+=e.phi;var a=Math.atan2(Math.sqrt(n.x*n.x+n.y*n.y),n.z);a+=e.theta;a=Math.max(.1,Math.min(Math.PI-.1,a));n.x=Math.sin(a)*Math.cos(o);n.y=Math.sin(a)*Math.sin(o);n.z=Math.cos(a);n.applyQuaternion(r);this._desiredLookat.copy(this._camera.position).add(n.multiplyScalar(i))};e.prototype.rotateWithoutInertia=function(e){if(this._currentNode==null){return}this._desiredZoom=this._zoom;this._desiredLookat=null;this._requestedBasicRotation=null;this._requestedRotationDelta=null;var t=Math.PI/(10*Math.pow(2,this._zoom));var r={phi:this._spatial.clamp(e.phi,-t,t),theta:this._spatial.clamp(e.theta,-t,t)};this._applyRotation(r,this._currentCamera);this._applyRotation(r,this._previousCamera)};e.prototype.rotateBasic=function(e){if(this._currentNode==null){return}this._desiredZoom=this._zoom;this._desiredLookat=null;this._requestedRotationDelta=null;if(this._requestedBasicRotation!=null){this._requestedBasicRotation[0]+=e[0];this._requestedBasicRotation[1]+=e[1];var 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()}};e.prototype.rotateBasicUnbounded=function(e){if(this._currentNode==null){return}if(this._requestedBasicRotationUnbounded!=null){this._requestedBasicRotationUnbounded[0]+=e[0];this._requestedBasicRotationUnbounded[1]+=e[1]}else{this._requestedBasicRotationUnbounded=e.slice()}};e.prototype.rotateBasicWithoutInertia=function(e){if(this._currentNode==null){return}this._desiredZoom=this._zoom;this._desiredLookat=null;this._requestedRotationDelta=null;this._requestedBasicRotation=null;var t=.05/Math.pow(2,this._zoom);var r=e.slice();r[0]=this._spatial.clamp(r[0],-t,t);r[1]=this._spatial.clamp(r[1],-t,t);this._applyRotationBasic(r)};e.prototype.rotateToBasic=function(e){if(this._currentNode==null){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);var t=this.currentTransform.unprojectBasic(e,this._lookatDepth);this._currentCamera.lookat.fromArray(t)};e.prototype.zoomIn=function(e,t){if(this._currentNode==null){return}this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+e));var r=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray());var n=r[0];var i=r[1];var o=Math.pow(2,this._zoom);var a=Math.pow(2,this._desiredZoom);var s=t[0];var u=t[1];if(this.currentTransform.gpano!=null&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels){if(s-n>.5){s=s-1}else if(n-s>.5){s=1+s}}var c=s-o/a*(s-n);var l=u-o/a*(u-i);var h=this.currentTransform.gpano;if(this._currentNode.fullPano){c=this._spatial.wrap(c+this._basicRotation[0],0,1);l=this._spatial.clamp(l+this._basicRotation[1],.05,.95)}else if(h!=null&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels){c=this._spatial.wrap(c+this._basicRotation[0],0,1);l=this._spatial.clamp(l+this._basicRotation[1],0,1)}else{c=this._spatial.clamp(c,0,1);l=this._spatial.clamp(l,0,1)}this._desiredLookat=(new p.Vector3).fromArray(this.currentTransform.unprojectBasic([c,l],this._lookatDepth))};e.prototype.setCenter=function(e){this._desiredLookat=null;this._requestedRotationDelta=null;this._requestedBasicRotation=null;this._desiredZoom=this._zoom;var t=[this._spatial.clamp(e[0],0,1),this._spatial.clamp(e[1],0,1)];if(this._currentNode==null){this._desiredCenter=t;return}this._desiredCenter=null;var r=(new p.Vector3).fromArray(this.currentTransform.unprojectBasic(t,this._lookatDepth));var n=this.previousTransform!=null?this.previousTransform:this.currentTransform;var i=(new p.Vector3).fromArray(n.unprojectBasic(t,this._lookatDepth));this._currentCamera.lookat.copy(r);this._previousCamera.lookat.copy(i)};e.prototype.setZoom=function(e){this._desiredLookat=null;this._requestedRotationDelta=null;this._requestedBasicRotation=null;this._zoom=this._spatial.clamp(e,this._minZoom,this._maxZoom);this._desiredZoom=this._zoom};e.prototype._applyRotation=function(e,t){if(t==null){return}var r=(new p.Quaternion).setFromUnitVectors(t.up,new p.Vector3(0,0,1));var n=r.clone().inverse();var i=new p.Vector3;i.copy(t.lookat).sub(t.position);i.applyQuaternion(r);var o=i.length();var a=Math.atan2(i.y,i.x);a+=e.phi;var s=Math.atan2(Math.sqrt(i.x*i.x+i.y*i.y),i.z);s+=e.theta;s=Math.max(.1,Math.min(Math.PI-.1,s));i.x=Math.sin(s)*Math.cos(a);i.y=Math.sin(s)*Math.sin(a);i.z=Math.cos(s);i.applyQuaternion(n);t.lookat.copy(t.position).add(i.multiplyScalar(o))};e.prototype._applyRotationBasic=function(e){var t=this._currentNode;var r=this._previousNode!=null?this.previousNode:this.currentNode;var n=this._currentCamera;var i=this._previousCamera;var o=this.currentTransform;var a=this.previousTransform!=null?this.previousTransform:this.currentTransform;var s=o.projectBasic(n.lookat.toArray());var u=a.projectBasic(i.lookat.toArray());var c=o.gpano;var l=a.gpano;if(t.fullPano){s[0]=this._spatial.wrap(s[0]+e[0],0,1);s[1]=this._spatial.clamp(s[1]+e[1],.05,.95)}else if(c!=null&&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)}else{s[0]=this._spatial.clamp(s[0]+e[0],0,1);s[1]=this._spatial.clamp(s[1]+e[1],0,1)}if(r.fullPano){u[0]=this._spatial.wrap(u[0]+e[0],0,1);u[1]=this._spatial.clamp(u[1]+e[1],.05,.95)}else if(l!=null&&a.gpano.CroppedAreaImageWidthPixels===a.gpano.FullPanoWidthPixels){u[0]=this._spatial.wrap(u[0]+e[0],0,1);u[1]=this._spatial.clamp(u[1]+e[1],0,1)}else{u[0]=this._spatial.clamp(u[0]+e[0],0,1);u[1]=this._spatial.clamp(s[1]+e[1],0,1)}var h=o.unprojectBasic(s,this._lookatDepth);n.lookat.fromArray(h);var p=a.unprojectBasic(u,this._lookatDepth);i.lookat.fromArray(p)};e.prototype._updateZoom=function(e){var t=this._desiredZoom-this._zoom;var r=t>0?1:t<0?-1:0;if(t===0){return}else if(Math.abs(t)<.002){this._zoom=this._desiredZoom;if(this._desiredLookat!=null){this._desiredLookat=null}}else{this._zoom+=r*Math.max(Math.abs(5*e*t),.002)}};e.prototype._updateLookat=function(e){if(this._desiredLookat===null){return}var t=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);if(Math.abs(t)<1e-6){this._currentCamera.lookat.copy(this._desiredLookat);this._desiredLookat=null}else{this._currentCamera.lookat.lerp(this._desiredLookat,5*e)}};e.prototype._updateRotation=function(){if(this._requestedRotationDelta!=null){var e=this._rotationDelta.lengthSquared();var t=this._requestedRotationDelta.lengthSquared();if(t>e){this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha)}else{this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha)}this._requestedRotationDelta=null;return}if(this._rotationDelta.isZero){return}var r=this.currentNode.fullPano?1:this._alpha;this._rotationDelta.multiply(this._rotationAcceleration*r);this._rotationDelta.threshold(this._rotationThreshold)};e.prototype._updateRotationBasic=function(){if(this._requestedBasicRotation!=null){var e=this._basicRotation[0];var t=this._basicRotation[1];var r=this._requestedBasicRotation[0];var n=this._requestedBasicRotation[1];if(Math.abs(r)>Math.abs(e)){this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*e+this._rotationIncreaseAlpha*r}else{this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*e+this._rotationDecreaseAlpha*r}if(Math.abs(n)>Math.abs(t)){this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*t+this._rotationIncreaseAlpha*n}else{this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*t+this._rotationDecreaseAlpha*n}this._requestedBasicRotation=null;return}if(this._requestedBasicRotationUnbounded!=null){var r=this._requestedBasicRotationUnbounded[0];var n=this._requestedBasicRotationUnbounded[1];if(Math.abs(r)>0){this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*r}if(Math.abs(n)>0){this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*n}if(this._desiredLookat!=null){var i=this.currentTransform.projectBasic(this._desiredLookat.toArray());i[0]+=r;i[1]+=n;this._desiredLookat=(new p.Vector3).fromArray(this.currentTransform.unprojectBasic(i,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}if(this._basicRotation[0]===0&&this._basicRotation[1]===0){return}this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0];this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1];if(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]}};e.prototype._clearRotation=function(){if(this._currentNode.fullPano){return}if(this._requestedRotationDelta!=null){this._requestedRotationDelta=null}if(!this._rotationDelta.isZero){this._rotationDelta.reset()}if(this._requestedBasicRotation!=null){this._requestedBasicRotation=null}if(this._basicRotation[0]>0||this._basicRotation[1]>0){this._basicRotation=[0,0]}};e.prototype._setDesiredCenter=function(){if(this._desiredCenter==null){return}var e=(new p.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};e.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||this._previousNode==null?this._zoom:0};return e}(i.StateBase);r.InteractiveStateBase=o;r.default=o},{"../../State":298,three:242}],456:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.InteractiveWaitingState=void 0;var i=e("../../State");var o=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t._adjustCameras();t._motionless=t._motionlessTransition();return t}e.prototype.traverse=function(){return new i.TraversingState(this)};e.prototype.wait=function(){return new i.WaitingState(this)};e.prototype.prepend=function(e){r.prototype.prepend.call(this,e);this._motionless=this._motionlessTransition()};e.prototype.set=function(e){r.prototype.set.call(this,e);this._motionless=this._motionlessTransition()};e.prototype.move=function(e){this._alpha=Math.max(0,Math.min(1,this._alpha+e))};e.prototype.moveTo=function(e){this._alpha=Math.max(0,Math.min(1,e))};e.prototype.update=function(e){this._updateRotation();if(!this._rotationDelta.isZero){this._applyRotation(this._rotationDelta,this._previousCamera);this._applyRotation(this._rotationDelta,this._currentCamera)}this._updateRotationBasic();if(this._basicRotation[0]!==0||this._basicRotation[1]!==0){this._applyRotationBasic(this._basicRotation)}var t=this._animationSpeed*(60/e);this._updateZoom(t);this._updateLookat(t);this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)};e.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha};e.prototype._setCurrentCamera=function(){r.prototype._setCurrentCamera.call(this);this._adjustCameras()};e.prototype._adjustCameras=function(){if(this._previousNode==null){return}if(this._currentNode.fullPano){var e=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){var e=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position))}};return e}(i.InteractiveStateBase);r.InteractiveWaitingState=o;r.default=o},{"../../State":298}],457:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.StateBase=void 0;var a=e("../../Error");var s=e("../../Geo");var n=e("../../State");var i=function(){function e(e){this._spatial=new s.Spatial;this._geoCoords=new s.GeoCoords;this._referenceThreshold=.01;this._transitionMode=e.transitionMode;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(var t=0,r=this._trajectory;t<r.length;t++){var n=r[t];var i=this._nodeToTranslation(n,this._reference);var o=new s.Transform(n.orientation,n.width,n.height,n.focal,n.scale,n.gpano,n.rotation,i,n.image,undefined,n.ck1,n.ck2,n.cameraProjection);this._trajectoryTransforms.push(o);this._trajectoryCameras.push(new s.Camera(o))}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 s.Camera;this._previousCamera=this._trajectoryCameras.length>1&&this.currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}Object.defineProperty(e.prototype,"reference",{get:function(){return this._reference},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"alpha",{get:function(){return this._getAlpha()},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"zoom",{get:function(){return this._zoom},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"trajectory",{get:function(){return this._trajectory},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this._currentIndex},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentNode",{get:function(){return this._currentNode},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previousNode",{get:function(){return this._previousNode},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentCamera",{get:function(){return this._currentCamera},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentTransform",{get:function(){return this._trajectoryTransforms.length>0?this._trajectoryTransforms[this.currentIndex]:null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previousTransform",{get:function(){return this._trajectoryTransforms.length>1&&this.currentIndex>0?this._trajectoryTransforms[this.currentIndex-1]:null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"motionless",{get:function(){return this._motionless},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"transitionMode",{get:function(){return this._transitionMode},enumerable:false,configurable:true});e.prototype.earth=function(){throw new Error("Not implemented")};e.prototype.traverse=function(){throw new Error("Not implemented")};e.prototype.wait=function(){throw new Error("Not implemented")};e.prototype.waitInteractively=function(){throw new Error("Not implemented")};e.prototype.move=function(e){};e.prototype.moveTo=function(e){};e.prototype.rotate=function(e){};e.prototype.rotateUnbounded=function(e){};e.prototype.rotateWithoutInertia=function(e){};e.prototype.rotateBasic=function(e){};e.prototype.rotateBasicUnbounded=function(e){};e.prototype.rotateBasicWithoutInertia=function(e){};e.prototype.rotateToBasic=function(e){};e.prototype.setSpeed=function(e){};e.prototype.zoomIn=function(e,t){};e.prototype.update=function(e){};e.prototype.setCenter=function(e){};e.prototype.setZoom=function(e){};e.prototype.dolly=function(e){};e.prototype.orbit=function(e){};e.prototype.truck=function(e){};e.prototype.append=function(e){if(e.length<1){throw Error("Trajectory can not be empty")}if(this._currentIndex<0){this.set(e)}else{this._trajectory=this._trajectory.concat(e);this._appendToTrajectories(e)}};e.prototype.prepend=function(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();var t=this._setReference(this._currentNode);if(t){this._setTrajectories()}else{this._prependToTrajectories(e)}this._setCurrentCamera()};e.prototype.remove=function(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(var t=0;t<e;t++){this._trajectory.shift();this._trajectoryTransforms.shift();this._trajectoryCameras.shift();this._currentIndex--}this._setCurrentNode()};e.prototype.clearPrior=function(){if(this._currentIndex>0){this.remove(this._currentIndex-1)}};e.prototype.clear=function(){this.cut();if(this._currentIndex>0){this.remove(this._currentIndex-1)}};e.prototype.cut=function(){while(this._trajectory.length-1>this._currentIndex){this._trajectory.pop();this._trajectoryTransforms.pop();this._trajectoryCameras.pop()}};e.prototype.set=function(e){this._setTrajectory(e);this._setCurrentNode();this._setReference(this._currentNode);this._setTrajectories();this._setCurrentCamera()};e.prototype.getCenter=function(){return this._currentNode!=null?this.currentTransform.projectBasic(this._camera.lookat.toArray()):[.5,.5]};e.prototype.setTransitionMode=function(e){this._transitionMode=e};e.prototype._getAlpha=function(){return 1};e.prototype._setCurrent=function(){this._setCurrentNode();var e=this._setReference(this._currentNode);if(e){this._setTrajectories()}this._setCurrentCamera()};e.prototype._setCurrentCamera=function(){this._currentCamera=this._trajectoryCameras[this._currentIndex].clone();this._previousCamera=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()};e.prototype._motionlessTransition=function(){var e=this._currentNode!=null&&this._previousNode!=null;return e&&(this._transitionMode===n.TransitionMode.Instantaneous||!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent()))};e.prototype._setReference=function(e){if(Math.abs(e.latLon.lat-this.reference.lat)<this._referenceThreshold&&Math.abs(e.latLon.lon-this.reference.lon)<this._referenceThreshold){return false}if(this._previousNode!=null&&!this._motionlessTransition()){return false}this._reference.lat=e.latLon.lat;this._reference.lon=e.latLon.lon;this._reference.alt=e.alt;return true};e.prototype._setCurrentNode=function(){this._currentNode=this._trajectory.length>0?this._trajectory[this._currentIndex]:null;this._previousNode=this._currentIndex>0?this._trajectory[this._currentIndex-1]:null};e.prototype._setTrajectory=function(e){if(e.length<1){throw new a.ArgumentMapillaryError("Trajectory can not be empty")}if(this._currentNode!=null){this._trajectory=[this._currentNode].concat(e);this._currentIndex=1}else{this._trajectory=e.slice();this._currentIndex=0}};e.prototype._setTrajectories=function(){this._trajectoryTransforms.length=0;this._trajectoryCameras.length=0;this._appendToTrajectories(this._trajectory)};e.prototype._appendToTrajectories=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];if(!n.assetsCached){throw new a.ArgumentMapillaryError("Assets must be cached when node is added to trajectory")}var i=this._nodeToTranslation(n,this.reference);var o=new s.Transform(n.orientation,n.width,n.height,n.focal,n.scale,n.gpano,n.rotation,i,n.image,undefined,n.ck1,n.ck2,n.cameraProjection);this._trajectoryTransforms.push(o);this._trajectoryCameras.push(new s.Camera(o))}};e.prototype._prependToTrajectories=function(e){for(var t=0,r=e.reverse();t<r.length;t++){var n=r[t];if(!n.assetsCached){throw new a.ArgumentMapillaryError("Assets must be cached when added to trajectory")}var i=this._nodeToTranslation(n,this.reference);var o=new s.Transform(n.orientation,n.width,n.height,n.focal,n.scale,n.gpano,n.rotation,i,n.image,undefined,n.ck1,n.ck2,n.cameraProjection);this._trajectoryTransforms.unshift(o);this._trajectoryCameras.unshift(new s.Camera(o))}};e.prototype._nodeToTranslation=function(e,t){return s.Geo.computeTranslation({alt:e.alt,lat:e.latLon.lat,lon:e.latLon.lon},e.rotation,t)};e.prototype._sameConnectedComponent=function(){var e=this._currentNode;var t=this._previousNode;return!!e&&!!t&&e.mergeCC===t.mergeCC};e.prototype._withinOriginalDistance=function(){var e=this._currentNode;var t=this._previousNode;if(!e||!t){return true}var r=this._spatial.distanceFromLatLon(e.originalLatLon.lat,e.originalLatLon.lon,t.originalLatLon.lat,t.originalLatLon.lon);return r<25};return e}();r.StateBase=i},{"../../Error":293,"../../Geo":294,"../../State":298}],458:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.TraversingState=void 0;var i=e("@mapbox/unitbezier");var o=e("../../State");var a=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t._adjustCameras();t._motionless=t._motionlessTransition();t._baseAlpha=t._alpha;t._speedCoefficient=1;t._unitBezier=new i(.74,.67,.38,.96);t._useBezier=false;return t}e.prototype.earth=function(){return new o.EarthState(this)};e.prototype.wait=function(){return new o.WaitingState(this)};e.prototype.waitInteractively=function(){return new o.InteractiveWaitingState(this)};e.prototype.append=function(e){var t=this._trajectory.length===0;if(t){this._resetTransition()}r.prototype.append.call(this,e);if(t){this._setDesiredCenter();this._setDesiredZoom()}};e.prototype.prepend=function(e){var t=this._trajectory.length===0;if(t){this._resetTransition()}r.prototype.prepend.call(this,e);if(t){this._setDesiredCenter();this._setDesiredZoom()}};e.prototype.set=function(e){r.prototype.set.call(this,e);this._desiredLookat=null;this._resetTransition();this._clearRotation();this._setDesiredCenter();this._setDesiredZoom();if(this._trajectory.length<3){this._useBezier=true}};e.prototype.setSpeed=function(e){this._speedCoefficient=this._spatial.clamp(e,0,10)};e.prototype.update=function(e){if(this._alpha===1&&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}var t=this._animationSpeed*(60/e);this._baseAlpha=Math.min(1,this._baseAlpha+this._speedCoefficient*t);if(this._useBezier){this._alpha=this._unitBezier.solve(this._baseAlpha)}else{this._alpha=this._baseAlpha}this._updateRotation();if(!this._rotationDelta.isZero){this._applyRotation(this._rotationDelta,this._previousCamera);this._applyRotation(this._rotationDelta,this._currentCamera)}this._updateRotationBasic();if(this._basicRotation[0]!==0||this._basicRotation[1]!==0){this._applyRotationBasic(this._basicRotation)}this._updateZoom(t);this._updateLookat(t);this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)};e.prototype._getAlpha=function(){return this._motionless?Math.ceil(this._alpha):this._alpha};e.prototype._setCurrentCamera=function(){r.prototype._setCurrentCamera.call(this);this._adjustCameras()};e.prototype._adjustCameras=function(){if(this._previousNode==null){return}var e=this._camera.lookat.clone().sub(this._camera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position));if(this._currentNode.fullPano){this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}};e.prototype._resetTransition=function(){this._alpha=0;this._baseAlpha=0;this._motionless=this._motionlessTransition()};return e}(o.InteractiveStateBase);r.TraversingState=a;r.default=a},{"../../State":298,"@mapbox/unitbezier":2}],459:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.WaitingState=void 0;var i=e("../../State");var o=function(r){n(e,r);function e(e){var t=r.call(this,e)||this;t._zoom=0;t._adjustCameras();t._motionless=t._motionlessTransition();return t}e.prototype.traverse=function(){return new i.TraversingState(this)};e.prototype.waitInteractively=function(){return new i.InteractiveWaitingState(this)};e.prototype.prepend=function(e){r.prototype.prepend.call(this,e);this._motionless=this._motionlessTransition()};e.prototype.set=function(e){r.prototype.set.call(this,e);this._motionless=this._motionlessTransition()};e.prototype.move=function(e){this._alpha=Math.max(0,Math.min(1,this._alpha+e))};e.prototype.moveTo=function(e){this._alpha=Math.max(0,Math.min(1,e))};e.prototype.update=function(e){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)};e.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha};e.prototype._setCurrentCamera=function(){r.prototype._setCurrentCamera.call(this);this._adjustCameras()};e.prototype._adjustCameras=function(){if(this._previousNode==null){return}if(this._currentNode.fullPano){var e=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){var e=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position))}};return e}(i.StateBase);r.WaitingState=o;r.default=o},{"../../State":298}],460:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ImageTileLoader=void 0;var n=e("rxjs");var i=function(){function e(e,t,r){this._scheme=e;this._host=t;this._origin=r!=null?"?origin="+r:""}e.prototype.getTile=function(i,o,a,s,u,e,t){var r="/"+i+"/"+o+","+a+","+s+","+u+"/"+e+","+t+"/0/default.jpg";var c=this._scheme+"://"+this._host+r+this._origin;var l=null;return[n.Observable.create(function(n){l=new XMLHttpRequest;l.open("GET",c,true);l.responseType="arraybuffer";l.timeout=15e3;l.onload=function(e){if(l.status!==200){n.error(new Error("Failed to fetch tile ("+i+": "+o+","+a+","+s+","+u+"). "+("Status: "+l.status+", "+l.statusText)));return}var t=new Image;t.crossOrigin="Anonymous";t.onload=function(e){n.next(t);n.complete()};t.onerror=function(e){n.error(new Error("Failed to load tile image ("+i+": "+o+","+a+","+s+","+u+")"))};var r=new Blob([l.response]);t.src=window.URL.createObjectURL(r)};l.onerror=function(e){n.error(new Error("Failed to fetch tile ("+i+": "+o+","+a+","+s+","+u+")"))};l.ontimeout=function(e){n.error(new Error("Tile request timed out ("+i+": "+o+","+a+","+s+","+u+")"))};l.onabort=function(e){n.error(new Error("Tile request was aborted ("+i+": "+o+","+a+","+s+","+u+")"))};l.send(null)}),function(){if(l!=null){l.abort()}}]};return e}();r.ImageTileLoader=i;r.default=i},{rxjs:43}],461:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ImageTileStore=void 0;var n=function(){function e(){this._images={}}e.prototype.addImage=function(e,t,r){if(!(r in this._images)){this._images[r]={}}this._images[r][t]=e};e.prototype.dispose=function(){for(var e=0,t=Object.keys(this._images);e<t.length;e++){var r=t[e];var n=this._images[r];for(var i=0,o=Object.keys(n);i<o.length;i++){var a=o[i];window.URL.revokeObjectURL(n[a].src);delete n[a]}delete this._images[r]}};e.prototype.getImage=function(e,t){return this._images[t][e]};e.prototype.hasImage=function(e,t){return t in this._images&&e in this._images[t]};return e}();r.ImageTileStore=n;r.default=n},{}],462:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RegionOfInterestCalculator=void 0;var n=e("../Geo");var i=function(){function e(){this._viewportCoords=new n.ViewportCoords}e.prototype.computeRegionOfInterest=function(e,t,r){var n=this._viewportBoundaryPoints(4);var i=this._viewportPointsBoundingBox(n,e,r);this._clipBoundingBox(i);var o=2/t.width;var a=2/t.height;var s=[[-.5*o,.5*a],[.5*o,.5*a],[.5*o,-.5*a],[-.5*o,-.5*a]];var u=this._viewportPointsBoundingBox(s,e,r);return{bbox:i,pixelHeight:u.maxY-u.minY,pixelWidth:u.maxX-u.minX+(u.minX<u.maxX?0:1)}};e.prototype._viewportBoundaryPoints=function(e){var t=[];var r=[[-1,1],[1,1],[1,-1],[-1,-1]];var n=[[2,0],[0,-2],[-2,0],[0,2]];for(var i=0;i<4;++i){var o=r[i];var a=n[i];for(var s=0;s<e;++s){t.push([o[0]+a[0]*s/e,o[1]+a[1]*s/e])}}return t};e.prototype._viewportPointsBoundingBox=function(e,t,r){var n=this;var i=e.map(function(e){return n._viewportCoords.viewportToBasic(e[0],e[1],r,t.perspective)});if(r.gpano!=null){return this._boundingBoxPano(i)}else{return this._boundingBox(i)}};e.prototype._boundingBox=function(e){var t={maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY};for(var r=0;r<e.length;++r){t.minX=Math.min(t.minX,e[r][0]);t.maxX=Math.max(t.maxX,e[r][0]);t.minY=Math.min(t.minY,e[r][1]);t.maxY=Math.max(t.maxY,e[r][1])}return t};e.prototype._boundingBoxPano=function(e){var r=this;var t=[];var n=[];for(var i=0;i<e.length;++i){t.push(e[i][0]);n.push(e[i][1])}t.sort(function(e,t){return r._sign(e-t)});n.sort(function(e,t){return r._sign(e-t)});var o=this._intervalPano(t);return{maxX:o[1],maxY:n[n.length-1],minX:o[0],minY:n[0]}};e.prototype._intervalPano=function(e){var t=0;var r=-1;for(var n=0;n<e.length-1;++n){var i=e[n+1]-e[n];if(i>t){t=i;r=n}}var o=e[0]+1-e[e.length-1];if(o>t){return[e[0],e[e.length-1]]}else{return[e[r+1],e[r]]}};e.prototype._clipBoundingBox=function(e){e.minX=Math.max(0,Math.min(1,e.minX));e.maxX=Math.max(0,Math.min(1,e.maxX));e.minY=Math.max(0,Math.min(1,e.minY));e.maxY=Math.max(0,Math.min(1,e.maxY))};e.prototype._sign=function(e){return e>0?1:e<0?-1:0};return e}();r.RegionOfInterestCalculator=i;r.default=i},{"../Geo":294}],463:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TextureProvider=void 0;var u=e("rxjs/operators");var g=e("three");var c=e("rxjs");var n=function(){function e(e,t,r,n,i,o,a,s){this._disposed=false;this._key=e;if(t<=0||r<=0){console.warn("Original image size ("+t+", "+r+") is invalid ("+e+"). Tiles will not be loaded.")}this._width=t;this._height=r;this._maxLevel=Math.ceil(Math.log(Math.max(r,t))/Math.log(2));this._currentLevel=-1;this._tileSize=n;this._updated$=new c.Subject;this._createdSubject$=new c.Subject;this._created$=this._createdSubject$.pipe(u.publishReplay(1),u.refCount());this._createdSubscription=this._created$.subscribe(function(){});this._hasSubject$=new c.Subject;this._has$=this._hasSubject$.pipe(u.startWith(false),u.publishReplay(1),u.refCount());this._hasSubscription=this._has$.subscribe(function(){});this._abortFunctions=[];this._tileSubscriptions={};this._renderedCurrentLevelTiles={};this._renderedTiles={};this._background=i;this._camera=null;this._imageTileLoader=o;this._imageTileStore=a;this._renderer=s;this._renderTarget=null;this._roi=null}Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"hasTexture$",{get:function(){return this._has$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"textureUpdated$",{get:function(){return this._updated$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"textureCreated$",{get:function(){return this._created$},enumerable:false,configurable:true});e.prototype.abort=function(){for(var e in this._tileSubscriptions){if(!this._tileSubscriptions.hasOwnProperty(e)){continue}this._tileSubscriptions[e].unsubscribe()}this._tileSubscriptions={};for(var t=0,r=this._abortFunctions;t<r.length;t++){var n=r[t];n()}this._abortFunctions=[]};e.prototype.dispose=function(){if(this._disposed){console.warn("Texture already disposed ("+this._key+")");return}this.abort();if(this._renderTarget!=null){this._renderTarget.dispose();this._renderTarget=null}this._imageTileStore.dispose();this._imageTileStore=null;this._background=null;this._camera=null;this._imageTileLoader=null;this._renderer=null;this._roi=null;this._createdSubscription.unsubscribe();this._hasSubscription.unsubscribe();this._disposed=true};e.prototype.setRegionOfInterest=function(e){if(this._width<=0||this._height<=0){return}this._roi=e;var t=1/this._roi.pixelWidth;var r=1/this._roi.pixelHeight;var n=Math.max(r,t);var i=Math.max(0,Math.min(this._maxLevel,Math.ceil(Math.log(n)/Math.log(2))));if(i!==this._currentLevel){this.abort();this._currentLevel=i;if(!(this._currentLevel in this._renderedTiles)){this._renderedTiles[this._currentLevel]=[]}this._renderedCurrentLevelTiles={};for(var o=0,a=this._renderedTiles[this._currentLevel];o<a.length;o++){var s=a[o];this._renderedCurrentLevelTiles[this._tileKey(this._tileSize,s)]=true}}var u=this._getTileCoords([this._roi.bbox.minX,this._roi.bbox.minY]);var c=this._getTileCoords([this._roi.bbox.maxX,this._roi.bbox.maxY]);var l=this._getTiles(u,c);if(this._camera==null){this._camera=new g.OrthographicCamera(-this._width/2,this._width/2,this._height/2,-this._height/2,-1,1);this._camera.position.z=1;var h=this._renderer.getContext();var p=h.getParameter(h.MAX_TEXTURE_SIZE);var f=Math.max(this._width,this._height);var d=p>f?1:p/f;var v=Math.floor(d*this._width);var m=Math.floor(d*this._height);this._renderTarget=new g.WebGLRenderTarget(v,m,{depthBuffer:false,format:g.RGBFormat,magFilter:g.LinearFilter,minFilter:g.LinearFilter,stencilBuffer:false});this._renderToTarget(0,0,this._width,this._height,this._background);this._createdSubject$.next(this._renderTarget.texture);this._hasSubject$.next(true)}this._fetchTiles(l)};e.prototype.setTileSize=function(e){this._tileSize=e};e.prototype.updateBackground=function(e){this._background=e};e.prototype._fetchTile=function(t,r,n,i,o,a,e,s){var u=this;var c=this._imageTileLoader.getTile(this._key,n,i,o,a,e,s);var l=c[0];var h=c[1];this._abortFunctions.push(h);var p=this._tileKey(this._tileSize,t);var f=l.subscribe(function(e){u._renderToTarget(n,i,o,a,e);u._removeFromDictionary(p,u._tileSubscriptions);u._removeFromArray(h,u._abortFunctions);u._setTileRendered(t,u._currentLevel);u._imageTileStore.addImage(e,p,r);u._updated$.next(true)},function(e){u._removeFromDictionary(p,u._tileSubscriptions);u._removeFromArray(h,u._abortFunctions);console.error(e)});if(!f.closed){this._tileSubscriptions[p]=f}};e.prototype._fetchTiles=function(e){var t=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel);for(var r=0,n=e;r<n.length;r++){var i=n[r];var o=this._tileKey(this._tileSize,i);if(o in this._renderedCurrentLevelTiles||o in this._tileSubscriptions){continue}var a=t*i[0];var s=t*i[1];var u=a+t>this._width?this._width-a:t;var c=s+t>this._height?this._height-s:t;if(this._imageTileStore.hasImage(o,this._currentLevel)){this._renderToTarget(a,s,u,c,this._imageTileStore.getImage(o,this._currentLevel));this._setTileRendered(i,this._currentLevel);this._updated$.next(true);continue}var l=Math.floor(u/t*this._tileSize);var h=Math.floor(c/t*this._tileSize);this._fetchTile(i,this._currentLevel,a,s,u,c,l,h)}};e.prototype._getTileCoords=function(e){var t=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel);var r=Math.ceil(this._width/t)-1;var n=Math.ceil(this._height/t)-1;return[Math.min(Math.floor(this._width*e[0]/t),r),Math.min(Math.floor(this._height*e[1]/t),n)]};e.prototype._getTiles=function(e,t){var r=[];if(e[0]>t[0]){var n=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel);var i=Math.ceil(this._width/n)-1;for(var o=e[0];o<=i;o++){r.push(o)}for(var o=0;o<=t[0];o++){r.push(o)}}else{for(var o=e[0];o<=t[0];o++){r.push(o)}}var a=[];for(var s=0,u=r;s<u.length;s++){var o=u[s];for(var c=e[1];c<=t[1];c++){a.push([o,c])}}return a};e.prototype._removeFromArray=function(e,t){var r=t.indexOf(e);if(r!==-1){t.splice(r,1)}};e.prototype._removeFromDictionary=function(e,t){if(e in t){delete t[e]}};e.prototype._renderToTarget=function(e,t,r,n,i){var o=new g.Texture(i);o.minFilter=g.LinearFilter;o.needsUpdate=true;var a=new g.PlaneGeometry(r,n);var s=new g.MeshBasicMaterial({map:o,side:g.FrontSide});var u=new g.Mesh(a,s);u.position.x=-this._width/2+e+r/2;u.position.y=this._height/2-t-n/2;var c=new g.Scene;c.add(u);var l=this._renderer.getRenderTarget();this._renderer.setRenderTarget(this._renderTarget);this._renderer.render(c,this._camera);this._renderer.setRenderTarget(l);c.remove(u);a.dispose();s.dispose();o.dispose()};e.prototype._setTileRendered=function(e,t){var r=Object.keys(this._renderedTiles).map(function(e){return parseInt(e,10)}).filter(function(e){return e!==t});for(var n=0,i=r;n<i.length;n++){var o=i[n];var a=Math.pow(2,o-t);if(o<t){var s=Math.floor(a*e[0]);var u=Math.floor(a*e[1]);for(var c=0,l=this._renderedTiles[o].slice();c<l.length;c++){var h=l[c];if(h[0]===s&&h[1]===u){var p=this._renderedTiles[o].indexOf(h);this._renderedTiles[o].splice(p,1)}}}else{var f=a*e[0];var d=f+a-1;var v=a*e[1];var m=v+a-1;for(var g=0,_=this._renderedTiles[o].slice();g<_.length;g++){var h=_[g];if(h[0]>=f&&h[0]<=d&&h[1]>=v&&h[1]<=m){var p=this._renderedTiles[o].indexOf(h);this._renderedTiles[o].splice(p,1)}}}if(this._renderedTiles[o].length===0){delete this._renderedTiles[o]}}this._renderedTiles[t].push(e);this._renderedCurrentLevelTiles[this._tileKey(this._tileSize,e)]=true};e.prototype._tileKey=function(e,t){return e+"-"+t[0]+"-"+t[1]};return e}();r.TextureProvider=n;r.default=n},{rxjs:43,"rxjs/operators":241,three:242}],464:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}],465:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DOM=void 0;var n=function(){function e(e){this._document=!!e?e:document}Object.defineProperty(e.prototype,"document",{get:function(){return this._document},enumerable:false,configurable:true});e.prototype.createElement=function(e,t,r){var n=this._document.createElement(e);if(!!t){n.className=t}if(!!r){r.appendChild(n)}return n};return e}();r.DOM=n;r.default=n},{}],466:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.EventEmitter=void 0;var n=function(){function e(){this._events={}}e.prototype.on=function(e,t){this._events[e]=this._events[e]||[];this._events[e].push(t);return};e.prototype.off=function(e,t){if(!e){this._events={};return}if(!this._listens(e)){var r=this._events[e].indexOf(t);if(r>=0){this._events[e].splice(r,1)}if(this._events[e].length){delete this._events[e]}}else{delete this._events[e]}return};e.prototype.fire=function(e,t){if(!this._listens(e)){return}for(var r=0,n=this._events[e];r<n.length;r++){var i=n[r];i.call(this,t)}return};e.prototype._listens=function(e){return!!(this._events&&this._events[e])};return e}();r.EventEmitter=n;r.default=n},{}],467:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Settings=void 0;var n=e("../Viewer");var i=function(){function t(){}Object.defineProperty(t,"baseImageSize",{get:function(){return t._baseImageSize},enumerable:false,configurable:true});Object.defineProperty(t,"basePanoramaSize",{get:function(){return t._basePanoramaSize},enumerable:false,configurable:true});Object.defineProperty(t,"maxImageSize",{get:function(){return t._maxImageSize},enumerable:false,configurable:true});t.setOptions=function(e){t._baseImageSize=e.baseImageSize!=null?e.baseImageSize:n.ImageSize.Size640;t._basePanoramaSize=e.basePanoramaSize!=null?e.basePanoramaSize:n.ImageSize.Size2048;t._maxImageSize=e.maxImageSize!=null?e.maxImageSize:n.ImageSize.Size2048};return t}();r.Settings=i;r.default=i},{"../Viewer":302}],468:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.isWebGLSupported=r.isWebGLSupportedCached=r.isBlobSupported=r.isObjectSupported=r.isJSONSupported=r.isFunctionSupported=r.isArraySupported=r.isBrowser=void 0;function n(){return typeof window!=="undefined"&&typeof document!=="undefined"}r.isBrowser=n;function i(){return!!(Array.prototype&&Array.prototype.filter&&Array.prototype.indexOf&&Array.prototype.map&&Array.prototype.reverse)}r.isArraySupported=i;function o(){return!!(Function.prototype&&Function.prototype.bind)}r.isFunctionSupported=o;function a(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}r.isJSONSupported=a;function s(){return!!(Object.keys&&Object.assign)}r.isObjectSupported=s;function u(){return"Blob"in window&&"URL"in window}r.isBlobSupported=u;var c=undefined;function l(){if(c===undefined){c=h()}return c}r.isWebGLSupportedCached=l;function h(){var e={alpha:false,antialias:false,depth:true,failIfMajorPerformanceCaveat:false,premultipliedAlpha:true,preserveDrawingBuffer:false,stencil:true};var t=document.createElement("canvas");var r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e);if(!r){return false}var n=["OES_standard_derivatives"];var i=r.getSupportedExtensions();for(var o=0,a=n;o<a.length;o++){var s=a[o];if(i.indexOf(s)===-1){return false}}return true}r.isWebGLSupported=h},{}],469:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Urls=void 0;var n=function(){function i(){}Object.defineProperty(i,"explore",{get:function(){return i._scheme+"://"+i._exploreHost},enumerable:false,configurable:true});Object.defineProperty(i,"origin",{get:function(){return i._origin},enumerable:false,configurable:true});Object.defineProperty(i,"tileScheme",{get:function(){return i._scheme},enumerable:false,configurable:true});Object.defineProperty(i,"tileDomain",{get:function(){return i._imageTileHost},enumerable:false,configurable:true});i.clusterReconstruction=function(e){return i._scheme+"://"+i._clusterReconstructionHost+"/"+e+"/v1.0/aligned.jsonz"};i.exporeImage=function(e){return i._scheme+"://"+i._exploreHost+"/app/?pKey="+e+"&focus=photo"};i.exporeUser=function(e){return i._scheme+"://"+i._exploreHost+"/app/user/"+e};i.falcorModel=function(e){return i._scheme+"://"+i._apiHost+"/v3/model.json?client_id="+e};i.protoMesh=function(e){return i._scheme+"://"+i._meshHost+"/v2/mesh/"+e};i.thumbnail=function(e,t,r){var n=!!r?"?origin="+r:"";return i._scheme+"://"+i._imageHost+"/"+e+"/thumb-"+t+".jpg"+n};i.setOptions=function(e){if(!e){return}if(!!e.apiHost){i._apiHost=e.apiHost}if(!!e.clusterReconstructionHost){i._clusterReconstructionHost=e.clusterReconstructionHost}if(!!e.exploreHost){i._exploreHost=e.exploreHost}if(!!e.imageHost){i._imageHost=e.imageHost}if(!!e.imageTileHost){i._imageTileHost=e.imageTileHost}if(!!e.meshHost){i._meshHost=e.meshHost}if(!!e.scheme){i._scheme=e.scheme}};i._apiHost="a.mapillary.com";i._clusterReconstructionHost="cluster-reconstructions.mapillary.com";i._exploreHost="www.mapillary.com";i._imageHost="images.mapillary.com";i._imageTileHost="loris.mapillary.com";i._meshHost="meshes.mapillary.com";i._origin="mapillary.webgl";i._scheme="https";return i}();r.Urls=n;r.default=n},{}],470:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Alignment=void 0;var n;(function(e){e[e["Bottom"]=0]="Bottom";e[e["BottomLeft"]=1]="BottomLeft";e[e["BottomRight"]=2]="BottomRight";e[e["Center"]=3]="Center";e[e["Left"]=4]="Left";e[e["Right"]=5]="Right";e[e["Top"]=6]="Top";e[e["TopLeft"]=7]="TopLeft";e[e["TopRight"]=8]="TopRight"})(n=r.Alignment||(r.Alignment={}));r.default=n},{}],471:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.CacheService=void 0;var n=e("rxjs");var i=e("rxjs/operators");var a=e("../Graph");var o=function(){function e(e,t){this._graphService=e;this._stateService=t;this._started=false}Object.defineProperty(e.prototype,"started",{get:function(){return this._started},enumerable:false,configurable:true});e.prototype.start=function(){var o=this;if(this._started){return}this._uncacheSubscription=this._stateService.currentState$.pipe(i.distinctUntilChanged(undefined,function(e){return e.state.currentNode.key}),i.map(function(e){var t=e.state.trajectory;var r=t.map(function(e){return e.key});var n=t[t.length-1].sequenceKey;return[r,n]}),i.bufferCount(1,5),i.withLatestFrom(this._graphService.graphMode$),i.switchMap(function(e){var t=e[0],r=e[1];var n=t[0][0];var i=r===a.GraphMode.Sequence?t[0][1]:undefined;return o._graphService.uncache$(n,i)})).subscribe(function(){});this._cacheNodeSubscription=this._graphService.graphMode$.pipe(i.skip(1),i.withLatestFrom(this._stateService.currentState$),i.switchMap(function(e){var t=e[0],r=e[1];return t===a.GraphMode.Sequence?o._keyToEdges(r.state.currentNode.key,function(e){return e.sequenceEdges$}):n.from(r.state.trajectory.map(function(e){return e.key}).slice(r.state.currentIndex)).pipe(i.mergeMap(function(e){return o._keyToEdges(e,function(e){return e.spatialEdges$})},6))})).subscribe(function(){});this._started=true};e.prototype.stop=function(){if(!this._started){return}this._uncacheSubscription.unsubscribe();this._uncacheSubscription=null;this._cacheNodeSubscription.unsubscribe();this._cacheNodeSubscription=null;this._started=false};e.prototype._keyToEdges=function(t,e){return this._graphService.cacheNode$(t).pipe(i.switchMap(e),i.first(function(e){return e.cached}),i.timeout(15e3),i.catchError(function(e){console.error("Failed to cache edges ("+t+").",e);return n.empty()}))};return e}();r.CacheService=o;r.default=o},{"../Graph":295,rxjs:43,"rxjs/operators":241}],472:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ComponentController=void 0;var s=e("rxjs/operators");var u=e("../Component");var n=function(){function e(e,t,r,n,i,o){var a=this;this._container=e;this._observer=r;this._navigator=t;this._options=i!=null?i:{};this._key=n;this._navigable=n==null;this._componentService=!!o?o:new u.ComponentService(this._container,this._navigator);this._coverComponent=this._componentService.getCover();this._initializeComponents();if(n){this._initilizeCoverComponent();this._subscribeCoverComponent()}else{this._navigator.movedToKey$.pipe(s.first(function(e){return e!=null})).subscribe(function(e){a._key=e;a._componentService.deactivateCover();a._coverComponent.configure({key:a._key,state:u.CoverState.Hidden});a._subscribeCoverComponent();a._navigator.stateService.start();a._navigator.cacheService.start();a._navigator.panService.start();a._observer.startEmit()})}}Object.defineProperty(e.prototype,"navigable",{get:function(){return this._navigable},enumerable:false,configurable:true});e.prototype.get=function(e){return this._componentService.get(e)};e.prototype.activate=function(e){this._componentService.activate(e)};e.prototype.activateCover=function(){this._coverComponent.configure({state:u.CoverState.Visible})};e.prototype.deactivate=function(e){this._componentService.deactivate(e)};e.prototype.deactivateCover=function(){this._coverComponent.configure({state:u.CoverState.Loading})};e.prototype._initializeComponents=function(){var e=this._options;this._uFalse(e.background,"background");this._uFalse(e.debug,"debug");this._uFalse(e.image,"image");this._uFalse(e.marker,"marker");this._uFalse(e.navigation,"navigation");this._uFalse(e.popup,"popup");this._uFalse(e.route,"route");this._uFalse(e.slider,"slider");this._uFalse(e.spatialData,"spatialData");this._uFalse(e.tag,"tag");this._uTrue(e.attribution,"attribution");this._uTrue(e.bearing,"bearing");this._uTrue(e.cache,"cache");this._uTrue(e.direction,"direction");this._uTrue(e.imagePlane,"imagePlane");this._uTrue(e.keyboard,"keyboard");this._uTrue(e.loading,"loading");this._uTrue(e.mouse,"mouse");this._uTrue(e.sequence,"sequence");this._uTrue(e.stats,"stats");this._uTrue(e.zoom,"zoom")};e.prototype._initilizeCoverComponent=function(){var e=this._options;this._coverComponent.configure({key:this._key});if(e.cover===undefined||e.cover){this.activateCover()}else{this.deactivateCover()}};e.prototype._setNavigable=function(e){if(this._navigable===e){return}this._navigable=e;this._observer.navigable$.next(e)};e.prototype._subscribeCoverComponent=function(){var n=this;this._coverComponent.configuration$.pipe(s.distinctUntilChanged(undefined,function(e){return e.state})).subscribe(function(r){if(r.state===u.CoverState.Loading){n._navigator.stateService.currentKey$.pipe(s.first(),s.switchMap(function(e){var t=e==null||e!==r.key;if(t){n._setNavigable(false)}return t?n._navigator.moveToKey$(r.key):n._navigator.stateService.currentNode$.pipe(s.first())})).subscribe(function(){n._navigator.stateService.start();n._navigator.cacheService.start();n._navigator.panService.start();n._observer.startEmit();n._coverComponent.configure({state:u.CoverState.Hidden});n._componentService.deactivateCover();n._setNavigable(true)},function(e){console.error("Failed to deactivate cover.",e);n._coverComponent.configure({state:u.CoverState.Visible})})}else if(r.state===u.CoverState.Visible){n._observer.stopEmit();n._navigator.stateService.stop();n._navigator.cacheService.stop();n._navigator.playService.stop();n._navigator.panService.stop();n._componentService.activateCover();n._setNavigable(r.key==null)}})};e.prototype._uFalse=function(e,t){if(e===undefined){this._componentService.deactivate(t);return}if(typeof e==="boolean"){if(e){this._componentService.activate(t)}else{this._componentService.deactivate(t)}return}this._componentService.configure(t,e);this._componentService.activate(t)};e.prototype._uTrue=function(e,t){if(e===undefined){this._componentService.activate(t);return}if(typeof e==="boolean"){if(e){this._componentService.activate(t)}else{this._componentService.deactivate(t)}return}this._componentService.configure(t,e);this._componentService.activate(t)};return e}();r.ComponentController=n},{"../Component":291,"rxjs/operators":241}],473:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Container=void 0;var i=e("../Render");var o=e("../Utils");var a=e("../Viewer");var n=function(){function e(e,t,r,n){this._dom=!!n?n:new o.DOM;if(typeof e==="string"){this._container=this._dom.document.getElementById(e);if(!this._container){throw new Error("Container '"+e+"' not found.")}}else if(e instanceof HTMLElement){this._container=e}else{throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}this.id=!!this._container.id?this._container.id:"mapillary-js-fallback-container-id";this._container.classList.add("mapillary-js");this._canvasContainer=this._dom.createElement("div","mapillary-js-interactive",this._container);this._domContainer=this._dom.createElement("div","mapillary-js-dom",this._container);this.renderService=new i.RenderService(this._container,t.currentState$,r.renderMode);this.glRenderer=new i.GLRenderer(this._canvasContainer,this.renderService,this._dom);this.domRenderer=new i.DOMRenderer(this._domContainer,this.renderService,t.currentState$);this.keyboardService=new a.KeyboardService(this._canvasContainer);this.mouseService=new a.MouseService(this._container,this._canvasContainer,this._domContainer,document);this.touchService=new a.TouchService(this._canvasContainer,this._domContainer);this.spriteService=new a.SpriteService(r.sprite)}Object.defineProperty(e.prototype,"element",{get:function(){return this._container},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"canvasContainer",{get:function(){return this._canvasContainer},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"domContainer",{get:function(){return this._domContainer},enumerable:false,configurable:true});return e}();r.Container=n;r.default=n},{"../Render":297,"../Utils":301,"../Viewer":302}],474:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.ImageSize=void 0;var n;(function(e){e[e["Size320"]=320]="Size320";e[e["Size640"]=640]="Size640";e[e["Size1024"]=1024]="Size1024";e[e["Size2048"]=2048]="Size2048"})(n=r.ImageSize||(r.ImageSize={}))},{}],475:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.KeyboardService=void 0;var n=e("rxjs");var i=function(){function e(e){this._keyDown$=n.fromEvent(e,"keydown");this._keyUp$=n.fromEvent(e,"keyup")}Object.defineProperty(e.prototype,"keyDown$",{get:function(){return this._keyDown$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"keyUp$",{get:function(){return this._keyUp$},enumerable:false,configurable:true});return e}();r.KeyboardService=i;r.default=i},{rxjs:43}],476:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.LoadingService=void 0;var n=e("rxjs/operators");var i=e("rxjs");var o=function(){function e(){this._loadersSubject$=new i.Subject;this._loaders$=this._loadersSubject$.pipe(n.scan(function(e,t){if(t.task!==undefined){e[t.task]=t.loading}return e},{}),n.startWith({}),n.publishReplay(1),n.refCount())}Object.defineProperty(e.prototype,"loading$",{get:function(){return this._loaders$.pipe(n.map(function(e){for(var t in e){if(!e.hasOwnProperty(t)){continue}if(e[t]){return true}}return false}),n.debounceTime(100),n.distinctUntilChanged())},enumerable:false,configurable:true});e.prototype.taskLoading$=function(t){return this._loaders$.pipe(n.map(function(e){return!!e[t]}),n.debounceTime(100),n.distinctUntilChanged())};e.prototype.startLoading=function(e){this._loadersSubject$.next({loading:true,task:e})};e.prototype.stopLoading=function(e){this._loadersSubject$.next({loading:false,task:e})};return e}();r.LoadingService=o;r.default=o},{rxjs:43,"rxjs/operators":241}],477:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.MouseService=void 0;var u=e("rxjs");var c=e("rxjs/operators");var n=function(){function e(e,i,t,r){var n=this;this._activeSubject$=new u.BehaviorSubject(false);this._active$=this._activeSubject$.pipe(c.distinctUntilChanged(),c.publishReplay(1),c.refCount());this._claimMouse$=new u.Subject;this._claimWheel$=new u.Subject;this._deferPixelClaims$=new u.Subject;this._deferPixels$=this._deferPixelClaims$.pipe(c.scan(function(e,t){if(t.deferPixels==null){delete e[t.name]}else{e[t.name]=t.deferPixels}return e},{}),c.map(function(e){var t=-1;for(var r in e){if(!e.hasOwnProperty(r)){continue}var n=e[r];if(n>t){t=n}}return t}),c.startWith(-1),c.publishReplay(1),c.refCount());this._deferPixels$.subscribe(function(){});this._documentMouseMove$=u.fromEvent(r,"mousemove");this._documentMouseUp$=u.fromEvent(r,"mouseup");this._mouseDown$=u.fromEvent(i,"mousedown");this._mouseLeave$=u.fromEvent(i,"mouseleave");this._mouseMove$=u.fromEvent(i,"mousemove");this._mouseUp$=u.fromEvent(i,"mouseup");this._mouseOut$=u.fromEvent(i,"mouseout");this._mouseOver$=u.fromEvent(i,"mouseover");this._domMouseDown$=u.fromEvent(t,"mousedown");this._domMouseMove$=u.fromEvent(t,"mousemove");this._click$=u.fromEvent(i,"click");this._contextMenu$=u.fromEvent(i,"contextmenu");this._dblClick$=u.merge(u.fromEvent(e,"click"),u.fromEvent(i,"dblclick")).pipe(c.bufferCount(3,1),c.filter(function(e){var t=e[0];var r=e[1];var n=e[2];return t.type==="click"&&r.type==="click"&&n.type==="dblclick"&&t.target.parentNode===i&&r.target.parentNode===i}),c.map(function(e){return e[2]}),c.share());u.merge(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(function(e){e.preventDefault()});this._mouseWheel$=u.merge(u.fromEvent(i,"wheel"),u.fromEvent(t,"wheel")).pipe(c.share());this._consistentContextMenu$=u.merge(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).pipe(c.bufferCount(3,1),c.filter(function(e){return e[0].type==="mousedown"&&e[1].type==="contextmenu"&&e[2].type==="mouseup"}),c.map(function(e){return e[1]}),c.share());var o=u.merge(u.fromEvent(window,"blur"),this._documentMouseUp$.pipe(c.filter(function(e){return e.button===0}))).pipe(c.share());var a=this._createMouseDragInitiate$(this._mouseDown$,o,true).pipe(c.share());this._mouseDragStart$=this._createMouseDragStart$(a).pipe(c.share());this._mouseDrag$=this._createMouseDrag$(a,o).pipe(c.share());this._mouseDragEnd$=this._createMouseDragEnd$(this._mouseDragStart$,o).pipe(c.share());var s=this._createMouseDragInitiate$(this._domMouseDown$,o,false).pipe(c.share());this._domMouseDragStart$=this._createMouseDragStart$(s).pipe(c.share());this._domMouseDrag$=this._createMouseDrag$(s,o).pipe(c.share());this._domMouseDragEnd$=this._createMouseDragEnd$(this._domMouseDragStart$,o).pipe(c.share());this._proximateClick$=this._mouseDown$.pipe(c.switchMap(function(e){return n._click$.pipe(c.takeUntil(n._createDeferredMouseMove$(e,n._documentMouseMove$)),c.take(1))}),c.share());this._staticClick$=this._mouseDown$.pipe(c.switchMap(function(e){return n._click$.pipe(c.takeUntil(n._documentMouseMove$),c.take(1))}),c.share());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(c.publishReplay(1),c.refCount());this._wheelOwner$=this._createOwner$(this._claimWheel$).pipe(c.publishReplay(1),c.refCount());this._mouseOwner$.subscribe(function(){});this._wheelOwner$.subscribe(function(){})}Object.defineProperty(e.prototype,"active$",{get:function(){return this._active$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"documentMouseMove$",{get:function(){return this._documentMouseMove$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"documentMouseUp$",{get:function(){return this._documentMouseUp$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"domMouseDragStart$",{get:function(){return this._domMouseDragStart$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"domMouseDrag$",{get:function(){return this._domMouseDrag$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"domMouseDragEnd$",{get:function(){return this._domMouseDragEnd$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"domMouseDown$",{get:function(){return this._domMouseDown$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"domMouseMove$",{get:function(){return this._domMouseMove$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseOwner$",{get:function(){return this._mouseOwner$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseDown$",{get:function(){return this._mouseDown$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseMove$",{get:function(){return this._mouseMove$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseLeave$",{get:function(){return this._mouseLeave$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseOut$",{get:function(){return this._mouseOut$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseOver$",{get:function(){return this._mouseOver$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseUp$",{get:function(){return this._mouseUp$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"click$",{get:function(){return this._click$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"dblClick$",{get:function(){return this._dblClick$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"contextMenu$",{get:function(){return this._consistentContextMenu$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseWheel$",{get:function(){return this._mouseWheel$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseDragStart$",{get:function(){return this._mouseDragStart$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseDrag$",{get:function(){return this._mouseDrag$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"mouseDragEnd$",{get:function(){return this._mouseDragEnd$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"proximateClick$",{get:function(){return this._proximateClick$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"staticClick$",{get:function(){return this._staticClick$},enumerable:false,configurable:true});e.prototype.claimMouse=function(e,t){this._claimMouse$.next({name:e,zindex:t})};e.prototype.unclaimMouse=function(e){this._claimMouse$.next({name:e,zindex:null})};e.prototype.deferPixels=function(e,t){this._deferPixelClaims$.next({name:e,deferPixels:t})};e.prototype.undeferPixels=function(e){this._deferPixelClaims$.next({name:e,deferPixels:null})};e.prototype.claimWheel=function(e,t){this._claimWheel$.next({name:e,zindex:t})};e.prototype.unclaimWheel=function(e){this._claimWheel$.next({name:e,zindex:null})};e.prototype.filtered$=function(e,t){return this._filtered(e,t,this._mouseOwner$)};e.prototype.filteredWheel$=function(e,t){return this._filtered(e,t,this._wheelOwner$)};e.prototype._createDeferredMouseMove$=function(n,e){return e.pipe(c.map(function(e){var t=e.clientX-n.clientX;var r=e.clientY-n.clientY;return[e,Math.sqrt(t*t+r*r)]}),c.withLatestFrom(this._deferPixels$),c.filter(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return n>i}),c.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return r}))};e.prototype._createMouseDrag$=function(e,t){var r=this;return e.pipe(c.map(function(e){var t=e[0],r=e[1];return r}),c.switchMap(function(e){return u.concat(u.of(e),r._documentMouseMove$).pipe(c.takeUntil(t))}))};e.prototype._createMouseDragEnd$=function(e,t){return e.pipe(c.switchMap(function(e){return t.pipe(c.first())}))};e.prototype._createMouseDragStart$=function(e){return e.pipe(c.map(function(e){var t=e[0],r=e[1];return t}))};e.prototype._createMouseDragInitiate$=function(e,t,r){var n=this;return e.pipe(c.filter(function(e){return e.button===0}),c.switchMap(function(e){return u.combineLatest(u.of(e),r?n._createDeferredMouseMove$(e,n._documentMouseMove$):n._documentMouseMove$).pipe(c.takeUntil(t),c.take(1))}))};e.prototype._createOwner$=function(e){return e.pipe(c.scan(function(e,t){if(t.zindex==null){delete e[t.name]}else{e[t.name]=t.zindex}return e},{}),c.map(function(e){var t=null;var r=-1;for(var n in e){if(!e.hasOwnProperty(n)){continue}if(e[n]>r){r=e[n];t=n}}return t}),c.startWith(null))};e.prototype._filtered=function(n,e,t){return e.pipe(c.withLatestFrom(t),c.filter(function(e){var t=e[0],r=e[1];return r===n}),c.map(function(e){var t=e[0],r=e[1];return t}))};return e}();r.MouseService=n;r.default=n},{rxjs:43,"rxjs/operators":241}],478:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Navigator=void 0;var h=e("rxjs");var o=e("rxjs/operators");var p=e("../API");var f=e("../Graph");var n=e("../Edge");var i=e("../Error");var d=e("../State");var v=e("../Viewer");var m=e("./PanService");var a=function(){function e(e,t,r,n,i,o,a,s,u,c,l){this._apiV3=n!=null?n:new p.APIv3(e,r);this._imageLoadingService=o!=null?o:new f.ImageLoadingService;this._graphService=i!=null?i:new f.GraphService(new f.Graph(this.apiV3),this._imageLoadingService);this._loadingService=a!=null?a:new v.LoadingService;this._loadingName="navigator";this._stateService=s!=null?s:new d.StateService(t.transitionMode);this._cacheService=u!=null?u:new v.CacheService(this._graphService,this._stateService);this._playService=c!=null?c:new v.PlayService(this._graphService,this._stateService);this._panService=l!=null?l:new m.PanService(this._graphService,this._stateService,t.combinedPanning);this._keyRequested$=new h.BehaviorSubject(null);this._movedToKey$=new h.BehaviorSubject(null);this._request$=null;this._requestSubscription=null;this._nodeRequestSubscription=null}Object.defineProperty(e.prototype,"apiV3",{get:function(){return this._apiV3},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"cacheService",{get:function(){return this._cacheService},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"graphService",{get:function(){return this._graphService},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"imageLoadingService",{get:function(){return this._imageLoadingService},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"loadingService",{get:function(){return this._loadingService},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"movedToKey$",{get:function(){return this._movedToKey$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"panService",{get:function(){return this._panService},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"playService",{get:function(){return this._playService},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"stateService",{get:function(){return this._stateService},enumerable:false,configurable:true});e.prototype.moveToKey$=function(e){this._abortRequest("to key "+e);this._loadingService.startLoading(this._loadingName);var t=this._moveToKey$(e);return this._makeRequest$(t)};e.prototype.moveDir$=function(i){var t=this;this._abortRequest("in dir "+n.EdgeDirection[i]);this._loadingService.startLoading(this._loadingName);var e=this.stateService.currentNode$.pipe(o.first(),o.mergeMap(function(e){return([n.EdgeDirection.Next,n.EdgeDirection.Prev].indexOf(i)>-1?e.sequenceEdges$:e.spatialEdges$).pipe(o.first(),o.map(function(e){for(var t=0,r=e.edges;t<r.length;t++){var n=r[t];if(n.data.direction===i){return n.to}}return null}))}),o.mergeMap(function(e){if(e==null){t._loadingService.stopLoading(t._loadingName);return h.throwError(new Error("Direction ("+i+") does not exist for current node."))}return t._moveToKey$(e)}));return this._makeRequest$(e)};e.prototype.moveCloseTo$=function(t,r){var n=this;this._abortRequest("to lat "+t+", lon "+r);this._loadingService.startLoading(this._loadingName);var e=this.apiV3.imageCloseTo$(t,r).pipe(o.mergeMap(function(e){if(e==null){n._loadingService.stopLoading(n._loadingName);return h.throwError(new Error("No image found close to lat "+t+", lon "+r+"."))}return n._moveToKey$(e.key)}));return this._makeRequest$(e)};e.prototype.setFilter$=function(t){var r=this;this._stateService.clearNodes();return this._movedToKey$.pipe(o.first(),o.mergeMap(function(e){if(e!=null){return r._trajectoryKeys$().pipe(o.mergeMap(function(e){return r._graphService.setFilter$(t).pipe(o.mergeMap(function(){return r._cacheKeys$(e)}))}),o.last())}return r._keyRequested$.pipe(o.first(),o.mergeMap(function(e){if(e!=null){return r._graphService.setFilter$(t).pipe(o.mergeMap(function(){return r._graphService.cacheNode$(e)}))}return r._graphService.setFilter$(t).pipe(o.map(function(){return undefined}))}))}),o.map(function(e){return undefined}))};e.prototype.setToken$=function(t){var r=this;this._abortRequest("to set token");this._stateService.clearNodes();return this._movedToKey$.pipe(o.first(),o.tap(function(e){r._apiV3.setToken(t)}),o.mergeMap(function(e){return e==null?r._graphService.reset$([]):r._trajectoryKeys$().pipe(o.mergeMap(function(e){return r._graphService.reset$(e).pipe(o.mergeMap(function(){return r._cacheKeys$(e)}))}),o.last(),o.map(function(e){return undefined}))}))};e.prototype._cacheKeys$=function(e){var t=this;var r=e.map(function(e){return t._graphService.cacheNode$(e)});return h.from(r).pipe(o.mergeAll())};e.prototype._abortRequest=function(e){if(this._requestSubscription!=null){this._requestSubscription.unsubscribe();this._requestSubscription=null}if(this._nodeRequestSubscription!=null){this._nodeRequestSubscription.unsubscribe();this._nodeRequestSubscription=null}if(this._request$!=null){if(!(this._request$.isStopped||this._request$.hasError)){this._request$.error(new i.AbortMapillaryError("Request aborted by a subsequent request "+e+"."))}this._request$=null}};e.prototype._makeRequest$=function(e){var t=this;var r=new h.ReplaySubject(1);this._requestSubscription=r.subscribe(undefined,function(){});this._request$=r;this._nodeRequestSubscription=e.subscribe(function(e){t._request$=null;r.next(e);r.complete()},function(e){t._request$=null;r.error(e)});return r};e.prototype._moveToKey$=function(e){var t=this;this._keyRequested$.next(e);return this._graphService.cacheNode$(e).pipe(o.tap(function(e){t._stateService.setNodes([e]);t._movedToKey$.next(e.key)}),o.finalize(function(){t._loadingService.stopLoading(t._loadingName)}))};e.prototype._trajectoryKeys$=function(){return this._stateService.currentState$.pipe(o.first(),o.map(function(e){return e.state.trajectory.map(function(e){return e.key})}))};return e}();r.Navigator=a;r.default=a},{"../API":290,"../Edge":292,"../Error":293,"../Graph":295,"../State":298,"../Viewer":302,"./PanService":480,rxjs:43,"rxjs/operators":241}],479:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Observer=void 0;var s=e("rxjs");var c=e("rxjs/operators");var i=e("../Viewer");var n=function(){function e(e,t,r){var n=this;this._container=r;this._eventEmitter=e;this._navigator=t;this._projection=new i.Projection;this._started=false;this._navigable$=new s.Subject;this._navigable$.subscribe(function(e){n._eventEmitter.fire(i.Viewer.navigablechanged,e)});this._navigator.loadingService.loading$.subscribe(function(e){n._eventEmitter.fire(i.Viewer.loadingchanged,e)})}Object.defineProperty(e.prototype,"started",{get:function(){return this._started},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"navigable$",{get:function(){return this._navigable$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"projection",{get:function(){return this._projection},enumerable:false,configurable:true});e.prototype.project$=function(o){var a=this;return s.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentNode$,this._navigator.stateService.reference$).pipe(c.first(),c.map(function(e){var t=e[0],r=e[1],n=e[2];if(a._projection.distanceBetweenLatLons(o,r.latLon)>1e3){return null}var i=a._projection.latLonToCanvas(o,a._container.element,t,n);return!!i?[Math.round(i[0]),Math.round(i[1])]:null}))};e.prototype.projectBasic$=function(i){var o=this;return s.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(c.first(),c.map(function(e){var t=e[0],r=e[1];var n=o._projection.basicToCanvas(i,o._container.element,t,r);return!!n?[Math.round(n[0]),Math.round(n[1])]:null}))};e.prototype.startEmit=function(){var u=this;if(this._started){return}this._started=true;this._currentNodeSubscription=this._navigator.stateService.currentNodeExternal$.subscribe(function(e){u._eventEmitter.fire(i.Viewer.nodechanged,e)});this._sequenceEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(c.switchMap(function(e){return e.sequenceEdges$})).subscribe(function(e){u._eventEmitter.fire(i.Viewer.sequenceedgeschanged,e)});this._spatialEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(c.switchMap(function(e){return e.spatialEdges$})).subscribe(function(e){u._eventEmitter.fire(i.Viewer.spatialedgeschanged,e)});this._moveSubscription=s.combineLatest(this._navigator.stateService.inMotion$,this._container.mouseService.active$,this._container.touchService.active$).pipe(c.map(function(e){return e[0]||e[1]||e[2]}),c.distinctUntilChanged()).subscribe(function(e){if(e){u._eventEmitter.fire(i.Viewer.movestart,null)}else{u._eventEmitter.fire(i.Viewer.moveend,null)}});this._bearingSubscription=this._container.renderService.bearing$.pipe(c.auditTime(100),c.distinctUntilChanged(function(e,t){return Math.abs(t-e)<1})).subscribe(function(e){u._eventEmitter.fire(i.Viewer.bearingchanged,e)});var e=this._container.mouseService.active$.pipe(c.switchMap(function(e){return e?s.empty():u._container.mouseService.mouseMove$}));this._viewerMouseEventSubscription=s.merge(this._mapMouseEvent$(i.Viewer.click,this._container.mouseService.staticClick$),this._mapMouseEvent$(i.Viewer.contextmenu,this._container.mouseService.contextMenu$),this._mapMouseEvent$(i.Viewer.dblclick,this._container.mouseService.dblClick$),this._mapMouseEvent$(i.Viewer.mousedown,this._container.mouseService.mouseDown$),this._mapMouseEvent$(i.Viewer.mousemove,e),this._mapMouseEvent$(i.Viewer.mouseout,this._container.mouseService.mouseOut$),this._mapMouseEvent$(i.Viewer.mouseover,this._container.mouseService.mouseOver$),this._mapMouseEvent$(i.Viewer.mouseup,this._container.mouseService.mouseUp$)).pipe(c.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$),c.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=e[2],a=e[3];var s=u._projection.eventToUnprojection(n,u._container.element,i,o,a);return{basicPoint:s.basicPoint,latLon:s.latLon,originalEvent:n,pixelPoint:s.pixelPoint,target:u._eventEmitter,type:r}})).subscribe(function(e){u._eventEmitter.fire(e.type,e)});this._positionSubscription=this._container.renderService.renderCamera$.pipe(c.distinctUntilChanged(function(e,t){var r=e[0],n=e[1];var i=t[0],o=t[1];return u._closeTo(r,i,.01)&&u._closeTo(n,o,.01)},function(e){return e.camera.position.toArray()})).subscribe(function(){u._eventEmitter.fire(i.Viewer.positionchanged,{target:u._eventEmitter,type:i.Viewer.positionchanged})});this._povSubscription=this._container.renderService.renderCamera$.pipe(c.distinctUntilChanged(function(e,t){var r=e[0],n=e[1];var i=t[0],o=t[1];return u._closeTo(r,i,.001)&&u._closeTo(n,o,.001)},function(e){return[e.rotation.phi,e.rotation.theta]})).subscribe(function(){u._eventEmitter.fire(i.Viewer.povchanged,{target:u._eventEmitter,type:i.Viewer.povchanged})});this._fovSubscription=this._container.renderService.renderCamera$.pipe(c.distinctUntilChanged(function(e,t){return u._closeTo(e,t,.01)},function(e){return e.perspective.fov})).subscribe(function(){u._eventEmitter.fire(i.Viewer.fovchanged,{target:u._eventEmitter,type:i.Viewer.fovchanged})})};e.prototype.stopEmit=function(){if(!this.started){return}this._started=false;this._bearingSubscription.unsubscribe();this._currentNodeSubscription.unsubscribe();this._fovSubscription.unsubscribe();this._moveSubscription.unsubscribe();this._positionSubscription.unsubscribe();this._povSubscription.unsubscribe();this._sequenceEdgesSubscription.unsubscribe();this._spatialEdgesSubscription.unsubscribe();this._viewerMouseEventSubscription.unsubscribe();this._bearingSubscription=null;this._currentNodeSubscription=null;this._fovSubscription=null;this._moveSubscription=null;this._positionSubscription=null;this._povSubscription=null;this._sequenceEdgesSubscription=null;this._spatialEdgesSubscription=null;this._viewerMouseEventSubscription=null};e.prototype.unproject$=function(o){var a=this;return s.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$).pipe(c.first(),c.map(function(e){var t=e[0],r=e[1],n=e[2];var i=a._projection.canvasToUnprojection(o,a._container.element,t,r,n);return i.latLon}))};e.prototype.unprojectBasic$=function(n){var i=this;return s.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(c.first(),c.map(function(e){var t=e[0],r=e[1];return i._projection.canvasToBasic(n,i._container.element,t,r)}))};e.prototype._closeTo=function(e,t,r){return Math.abs(e-t)<=r};e.prototype._mapMouseEvent$=function(t,e){return e.pipe(c.map(function(e){return[t,e]}))};return e}();r.Observer=n;r.default=n},{"../Viewer":302,rxjs:43,"rxjs/operators":241}],480:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.PanService=void 0;var s=e("rxjs");var u=e("rxjs/operators");var L=e("../geo/Geo");var c=e("../geo/GeoCoords");var l=e("../graph/GraphCalculator");var h=e("../geo/Spatial");var n=e("../geo/Transform");var p=e("../geo/ViewportCoords");var f;(function(e){e[e["Disabled"]=0]="Disabled";e[e["Enabled"]=1]="Enabled";e[e["Started"]=2]="Started"})(f||(f={}));var i=function(){function e(e,t,r,n,i,o,a){this._graphService=e;this._stateService=t;this._geoCoords=!!n?n:new c.default;this._graphCalculator=!!i?i:new l.default(this._geoCoords);this._spatial=!!o?o:new h.default;this._viewportCoords=!!a?a:new p.default;this._mode=r!==false?f.Enabled:f.Disabled;this._panNodesSubject$=new s.Subject;this._panNodes$=this._panNodesSubject$.pipe(u.startWith([]),u.publishReplay(1),u.refCount());this._panNodes$.subscribe()}Object.defineProperty(e.prototype,"panNodes$",{get:function(){return this._panNodes$},enumerable:false,configurable:true});e.prototype.enable=function(){if(this._mode!==f.Disabled){return}this._mode=f.Enabled;this.start()};e.prototype.disable=function(){if(this._mode===f.Disabled){return}this.stop();this._mode=f.Disabled};e.prototype.start=function(){var k=this;if(this._mode!==f.Enabled){return}var t=this._stateService.currentNode$.pipe(u.switchMap(function(o){if(!o.merged){return s.of([])}var e=s.of(o);var t=k._graphCalculator.boundingBoxCorners(o.latLon,20);var r=k._graphService.cacheBoundingBox$(t[0],t[1]).pipe(u.catchError(function(e){console.error("Failed to cache periphery bounding box ("+o.key+")",e);return s.empty()}),u.map(function(e){if(o.pano){return[]}var t=[];for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i.key===o.key){continue}if(i.mergeCC!==o.mergeCC){continue}if(i.pano){continue}if(k._distance(i,o)>4){continue}t.push(i)}return t}));return s.combineLatest(e,r).pipe(u.withLatestFrom(k._stateService.reference$),u.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];var o=k._spatial.viewingDirection(r.rotation);var a=L.computeTranslation({lat:r.latLon.lat,lon:r.latLon.lon,alt:r.alt},r.rotation,i);var s=k._createTransform(r,a);var u=k._spatial.wrap(k._spatial.azimuthal(o.toArray(),s.upVector().toArray()),0,2*Math.PI);var c=k._computeProjectedPoints(s);var l=k._computeHorizontalFov(c)/180*Math.PI;var h=Math.PI/8;var p=undefined;var f=undefined;for(var d=0,v=n;d<v.length;d++){var m=v[d];var g=L.computeTranslation({lat:m.latLon.lat,lon:m.latLon.lon,alt:m.alt},m.rotation,i);var _=k._createTransform(m,g);var y=k._computeProjectedPoints(_);var b=k._computeHorizontalFov(y)/180*Math.PI;var x=k._spatial.viewingDirection(m.rotation);var w=k._spatial.wrap(k._spatial.azimuthal(x.toArray(),_.upVector().toArray()),0,2*Math.PI);var S=k._spatial.angleBetweenVector2(o.x,o.y,x.x,x.y);var M=Number.NEGATIVE_INFINITY;if(S>0){if(u>w){M=u-2*Math.PI+l/2-(w-b/2)}else{M=u+l/2-(w-b/2)}}else{if(u<w){M=w+b/2-(u+2*Math.PI-l/2)}else{M=w+b/2-(u-l/2)}}var C=Math.abs(b-M);var T=k._distance(m,r);var E=Math.min(k._timeDifference(m,r),4);var O=20*Math.abs(M-h);var P=Math.min(5,1/Math.min(b/l,1));var A=M>0?-2*C:0;var j=T+E+O+P+A;if(M>0&&M<.5*l&&M<.5*b&&C>.5*l){if(S>0){if(!p){p=[j,m,_,b]}else{if(j<p[0]){p=[j,m,_,b]}}}else{if(!f){f=[j,m,_,b]}else{if(j<f[0]){f=[j,m,_,b]}}}}}var R=[];if(!!p){R.push([p[1],p[2],p[3]])}if(!!f){R.push([f[1],f[2],f[3]])}return R}),u.startWith([]))}));this._panNodesSubscription=this._stateService.currentState$.pipe(u.map(function(e){return e.state.nodesAhead>0}),u.distinctUntilChanged(),u.switchMap(function(e){return e?s.of([]):t})).subscribe(function(e){k._panNodesSubject$.next(e)});this._mode=f.Started};e.prototype.stop=function(){if(this._mode!==f.Started){return}this._panNodesSubscription.unsubscribe();this._panNodesSubject$.next([]);this._mode=f.Enabled};e.prototype._distance=function(e,t){var r=this._geoCoords.geodeticToEnu(e.latLon.lat,e.latLon.lon,e.alt,t.latLon.lat,t.latLon.lon,t.alt),n=r[0],i=r[1],o=r[2];return Math.sqrt(n*n+i*i+o*o)};e.prototype._timeDifference=function(e,t){return Math.abs(e.capturedAt-t.capturedAt)/(1e3*60*60*24*30)};e.prototype._createTransform=function(e,t){return new n.Transform(e.orientation,e.width,e.height,e.focal,e.scale,e.gpano,e.rotation,t,e.assetsCached?e.image:undefined,undefined,e.ck1,e.ck2,e.cameraProjection)};e.prototype._computeProjectedPoints=function(e){var t=[[1,0]];var r=[[0,.5]];var n=20;return L.computeProjectedPoints(e,t,r,n,this._viewportCoords)};e.prototype._computeHorizontalFov=function(e){var t=this;var r=e.map(function(e){return t._coordToFov(e[0])});var n=Math.min.apply(Math,r);return n};e.prototype._coordToFov=function(e){return 2*Math.atan(e)*180/Math.PI};return e}();r.PanService=i},{"../geo/Geo":415,"../geo/GeoCoords":416,"../geo/Spatial":419,"../geo/Transform":420,"../geo/ViewportCoords":421,"../graph/GraphCalculator":425,rxjs:43,"rxjs/operators":241}],481:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.PlayService=void 0;var c=e("rxjs");var p=e("rxjs/operators");var s=e("../Edge");var u=e("../Graph");var n=function(){function r(e,t,r){this._graphService=e;this._stateService=t;this._graphCalculator=!!r?r:new u.GraphCalculator;this._directionSubject$=new c.Subject;this._direction$=this._directionSubject$.pipe(p.startWith(s.EdgeDirection.Next),p.publishReplay(1),p.refCount());this._direction$.subscribe();this._playing=false;this._playingSubject$=new c.Subject;this._playing$=this._playingSubject$.pipe(p.startWith(this._playing),p.publishReplay(1),p.refCount());this._playing$.subscribe();this._speed=.5;this._speedSubject$=new c.Subject;this._speed$=this._speedSubject$.pipe(p.startWith(this._speed),p.publishReplay(1),p.refCount());this._speed$.subscribe();this._nodesAhead=this._mapNodesAhead(this._mapSpeed(this._speed));this._bridging$=null}Object.defineProperty(r.prototype,"playing",{get:function(){return this._playing},enumerable:false,configurable:true});Object.defineProperty(r.prototype,"direction$",{get:function(){return this._direction$},enumerable:false,configurable:true});Object.defineProperty(r.prototype,"playing$",{get:function(){return this._playing$},enumerable:false,configurable:true});Object.defineProperty(r.prototype,"speed$",{get:function(){return this._speed$},enumerable:false,configurable:true});r.prototype.play=function(){var h=this;if(this._playing){return}this._stateService.cutNodes();var e=this._setSpeed(this._speed);this._stateService.setSpeed(e);this._graphModeSubscription=this._speed$.pipe(p.map(function(e){return e>r.sequenceSpeed?u.GraphMode.Sequence:u.GraphMode.Spatial}),p.distinctUntilChanged()).subscribe(function(e){h._graphService.setGraphMode(e)});this._cacheSubscription=c.combineLatest(this._stateService.currentNode$.pipe(p.map(function(e){return[e.sequenceKey,e.key]}),p.distinctUntilChanged(undefined,function(e){var t=e[0],r=e[1];return t})),this._graphService.graphMode$,this._direction$).pipe(p.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=e[2];if(o!==s.EdgeDirection.Next&&o!==s.EdgeDirection.Prev){return c.of([undefined,o])}var a=(i===u.GraphMode.Sequence?h._graphService.cacheSequenceNodes$(r,n):h._graphService.cacheSequence$(r)).pipe(p.retry(3),p.catchError(function(e){console.error(e);return c.of(undefined)}));return c.combineLatest(a,c.of(o))}),p.switchMap(function(e){var t=e[0],r=e[1];if(t===undefined){return c.empty()}var l=t.keys.slice();if(r===s.EdgeDirection.Prev){l.reverse()}return h._stateService.currentState$.pipe(p.map(function(e){return[e.state.trajectory[e.state.trajectory.length-1].key,e.state.nodesAhead]}),p.scan(function(e,t){var r=e[0],n=e[1];var i=t[0],o=t[1];if(r===undefined){r=i}var a=l.length-1;if(o>=h._nodesAhead||l[a]===r){return[r,[]]}var s=l.indexOf(i);var u=l.indexOf(r)+1;var c=Math.min(a,s+h._nodesAhead-o)+1;if(c<=u){return[r,[]]}return[l[c-1],l.slice(u,c)]},[undefined,[]]),p.mergeMap(function(e){var t=e[0],r=e[1];return c.from(r)}))}),p.mergeMap(function(e){return h._graphService.cacheNode$(e).pipe(p.catchError(function(){return c.empty()}))},6)).subscribe();this._playingSubscription=this._stateService.currentState$.pipe(p.filter(function(e){return e.state.nodesAhead<h._nodesAhead}),p.distinctUntilChanged(undefined,function(e){return e.state.lastNode.key}),p.map(function(e){var t=e.state.lastNode;var r=e.state.trajectory;var n=undefined;for(var i=r.length-2;i>=0;i--){var o=r[i];if(o.sequenceKey!==t.sequenceKey){break}if(o.capturedAt!==t.capturedAt){n=o.capturedAt<t.capturedAt;break}}return[e.state.lastNode,n]}),p.withLatestFrom(this._direction$),p.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return c.zip(([s.EdgeDirection.Next,s.EdgeDirection.Prev].indexOf(i)>-1?r.sequenceEdges$:r.spatialEdges$).pipe(p.first(function(e){return e.cached}),p.timeout(15e3)),c.of(i)).pipe(p.map(function(e){var t=e[0],r=e[1];for(var n=0,i=t.edges;n<i.length;n++){var o=i[n];if(o.data.direction===r){return o.to}}return null}),p.switchMap(function(e){return e!=null?h._graphService.cacheNode$(e):h._bridge$(r,n).pipe(p.filter(function(e){return!!e}))}))})).subscribe(function(e){h._stateService.appendNodes([e])},function(e){console.error(e);h.stop()});this._clearSubscription=this._stateService.currentNode$.pipe(p.bufferCount(1,10)).subscribe(function(e){h._stateService.clearPriorNodes()});this._setPlaying(true);var t=this._stateService.currentState$.pipe(p.map(function(e){return e.state}),p.distinctUntilChanged(function(e,t){var r=e[0],n=e[1];var i=t[0],o=t[1];return r===i&&n===o},function(e){return[e.currentNode.key,e.lastNode.key]}),p.filter(function(e){return e.currentNode.key===e.lastNode.key&&e.currentIndex===e.trajectory.length-1}),p.map(function(e){return e.currentNode}));this._stopSubscription=c.combineLatest(t,this._direction$).pipe(p.switchMap(function(e){var t=e[0],r=e[1];var n=([s.EdgeDirection.Next,s.EdgeDirection.Prev].indexOf(r)>-1?t.sequenceEdges$:t.spatialEdges$).pipe(p.first(function(e){return e.cached}),p.timeout(15e3),p.catchError(function(e){console.error(e);return c.of({cached:false,edges:[]})}));return c.combineLatest(c.of(r),n).pipe(p.map(function(e){var t=e[0],r=e[1];for(var n=0,i=r.edges;n<i.length;n++){var o=i[n];if(o.data.direction===t){return true}}return false}))}),p.mergeMap(function(e){if(e||!h._bridging$){return c.of(e)}return h._bridging$.pipe(p.map(function(e){return e!=null}),p.catchError(function(e){console.error(e);return c.of(false)}))}),p.first(function(e){return!e})).subscribe(undefined,undefined,function(){h.stop()});if(this._stopSubscription.closed){this._stopSubscription=null}};r.prototype.setDirection=function(e){this._directionSubject$.next(e)};r.prototype.setSpeed=function(e){e=Math.max(0,Math.min(1,e));if(e===this._speed){return}var t=this._setSpeed(e);if(this._playing){this._stateService.setSpeed(t)}this._speedSubject$.next(this._speed)};r.prototype.stop=function(){if(!this._playing){return}if(!!this._stopSubscription){if(!this._stopSubscription.closed){this._stopSubscription.unsubscribe()}this._stopSubscription=null}this._graphModeSubscription.unsubscribe();this._graphModeSubscription=null;this._cacheSubscription.unsubscribe();this._cacheSubscription=null;this._playingSubscription.unsubscribe();this._playingSubscription=null;this._clearSubscription.unsubscribe();this._clearSubscription=null;this._stateService.setSpeed(1);this._stateService.cutNodes();this._graphService.setGraphMode(u.GraphMode.Spatial);this._setPlaying(false)};r.prototype._bridge$=function(a,s){var u=this;if(s===undefined){return c.of(null)}var e=this._graphCalculator.boundingBoxCorners(a.latLon,25);this._bridging$=this._graphService.cacheBoundingBox$(e[0],e[1]).pipe(p.mergeMap(function(e){var t=null;for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i.sequenceKey===a.sequenceKey||!i.cameraUuid||i.cameraUuid!==a.cameraUuid||i.capturedAt===a.capturedAt||i.capturedAt>a.capturedAt!==s){continue}var o=Math.abs(i.capturedAt-a.capturedAt);if(o>15e3){continue}if(!t||o<Math.abs(t.capturedAt-a.capturedAt)){t=i}}return!!t?u._graphService.cacheNode$(t.key):c.of(null)}),p.finalize(function(){u._bridging$=null}),p.publish(),p.refCount());return this._bridging$};r.prototype._mapSpeed=function(e){var t=2*e-1;return Math.pow(10,t)-.2*t};r.prototype._mapNodesAhead=function(e){return Math.round(Math.max(10,Math.min(50,8+6*e)))};r.prototype._setPlaying=function(e){this._playing=e;this._playingSubject$.next(e)};r.prototype._setSpeed=function(e){this._speed=e;var t=this._mapSpeed(this._speed);this._nodesAhead=this._mapNodesAhead(t);return t};r.sequenceSpeed=.54;return r}();r.PlayService=n;r.default=n},{"../Edge":292,"../Graph":295,rxjs:43,"rxjs/operators":241}],482:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Projection=void 0;var _=e("three");var n=e("../Geo");var i=e("../geo/Spatial");var o=function(){function e(e,t,r){this._geoCoords=!!e?e:new n.GeoCoords;this._spatial=!!r?r:new i.default;this._viewportCoords=!!t?t:new n.ViewportCoords}e.prototype.basicToCanvas=function(e,t,r,n){return this._viewportCoords.basicToCanvasSafe(e[0],e[1],t,n,r.perspective)};e.prototype.canvasToBasic=function(e,t,r,n){var i=this._viewportCoords.canvasToBasic(e[0],e[1],t,n,r.perspective);if(i[0]<0||i[0]>1||i[1]<0||i[1]>1){i=null}return i};e.prototype.eventToUnprojection=function(e,t,r,n,i){var o=this._viewportCoords.canvasPosition(e,t);return this.canvasToUnprojection(o,t,r,n,i)};e.prototype.canvasToUnprojection=function(e,t,r,n,i){var o=e[0];var a=e[1];var s=this._viewportCoords.canvasToViewport(o,a,t),u=s[0],c=s[1];var l=new _.Vector3(u,c,1).unproject(r.perspective);var h=i.projectBasic(l.toArray());if(h[0]<0||h[0]>1||h[1]<0||h[1]>1){h=null}var p=l.clone().sub(r.camera.position).normalize();var f=-2/p.z;var d=null;if(f>0&&f<100&&!!h){var v=p.clone().multiplyScalar(f).add(r.camera.position);var m=this._geoCoords.enuToGeodetic(v.x,v.y,v.z,n.lat,n.lon,n.alt).slice(0,2);d={lat:m[0],lon:m[1]}}var g={basicPoint:h,latLon:d,pixelPoint:[o,a]};return g};e.prototype.cameraToLatLon=function(e,t){var r=e.camera.position;var n=this._geoCoords.enuToGeodetic(r.x,r.y,r.z,t.lat,t.lon,t.alt),i=n[0],o=n[1];return{lat:i,lon:o}};e.prototype.latLonToCanvas=function(e,t,r,n){var i=this._geoCoords.geodeticToEnu(e.lat,e.lon,0,n.lat,n.lon,n.alt);var o=this._viewportCoords.projectToCanvasSafe(i,t,r.perspective);return o};e.prototype.distanceBetweenLatLons=function(e,t){return this._spatial.distanceFromLatLon(e.lat,e.lon,t.lat,t.lon)};return e}();r.Projection=o;r.default=o},{"../Geo":294,"../geo/Spatial":419,three:242}],483:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.SpriteService=void 0;var o=e("rxjs/operators");var a=e("three");var f=e("virtual-dom");var s=e("rxjs");var d=e("../Viewer");var u=function(){function e(){}Object.defineProperty(e.prototype,"json",{set:function(e){this._json=e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"image",{set:function(e){this._image=e;this._texture=new a.Texture(this._image);this._texture.minFilter=a.NearestFilter},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"loaded",{get:function(){return!!(this._image&&this._json)},enumerable:false,configurable:true});e.prototype.getGLSprite=function(e){if(!this.loaded){throw new Error("Sprites cannot be retrieved before the atlas is loaded.")}var t=this._json[e];if(!t){console.warn("Sprite with key"+e+"does not exist in sprite definition.");return new a.Object3D}var r=this._texture.clone();r.needsUpdate=true;var n=this._image.width;var i=this._image.height;r.offset.x=t.x/n;r.offset.y=(i-t.y-t.height)/i;r.repeat.x=t.width/n;r.repeat.y=t.height/i;var o=new a.SpriteMaterial({map:r});return new a.Sprite(o)};e.prototype.getDOMSprite=function(e,t){if(!this.loaded){throw new Error("Sprites cannot be retrieved before the atlas is loaded.")}if(t==null){t=d.Alignment.Center}var r=this._json[e];if(!r){console.warn("Sprite with key"+e+"does not exist in sprite definition.");return f.h("div",{},[])}var n=r.y;var i=r.x+r.width;var o=r.y+r.height;var a=r.x;var s=-r.x;var u=-r.y;var c=this._image.height;var l=this._image.width;switch(t){case d.Alignment.Bottom:case d.Alignment.Center:case d.Alignment.Top:s-=r.width/2;break;case d.Alignment.BottomLeft:case d.Alignment.Left:case d.Alignment.TopLeft:s-=r.width;break;case d.Alignment.BottomRight:case d.Alignment.Right:case d.Alignment.TopRight:default:break}switch(t){case d.Alignment.Center:case d.Alignment.Left:case d.Alignment.Right:u-=r.height/2;break;case d.Alignment.Top:case d.Alignment.TopLeft:case d.Alignment.TopRight:u-=r.height;break;case d.Alignment.Bottom:case d.Alignment.BottomLeft:case d.Alignment.BottomRight:default:break}var h=1/r.pixelRatio;n*=h;i*=h;o*=h;a*=h;s*=h;u*=h;c*=h;l*=h;var p={src:this._image.src,style:{clip:"rect("+n+"px, "+i+"px, "+o+"px, "+a+"px)",height:c+"px",left:s+"px",position:"absolute",top:u+"px",width:l+"px"}};return f.h("img",p,[])};return e}();var n=function(){function e(t){var r=this;this._retina=window.devicePixelRatio>1;this._spriteAtlasOperation$=new s.Subject;this._spriteAtlas$=this._spriteAtlasOperation$.pipe(o.startWith(function(e){return e}),o.scan(function(e,t){return t(e)},new u),o.publishReplay(1),o.refCount());this._spriteAtlas$.subscribe(function(){});if(t==null){return}var n=this._retina?"@2x":"";var i=new XMLHttpRequest;i.open("GET",t+n+".png",true);i.responseType="arraybuffer";i.onload=function(){var t=new Image;t.onload=function(){r._spriteAtlasOperation$.next(function(e){e.image=t;return e})};var e=new Blob([i.response]);t.src=window.URL.createObjectURL(e)};i.onerror=function(e){console.error(new Error("Failed to fetch sprite sheet ("+t+n+".png)"))};i.send();var e=new XMLHttpRequest;e.open("GET",t+n+".json",true);e.responseType="text";e.onload=function(){var t=JSON.parse(e.response);r._spriteAtlasOperation$.next(function(e){e.json=t;return e})};e.onerror=function(e){console.error(new Error("Failed to fetch sheet ("+t+n+".json)"))};e.send()}Object.defineProperty(e.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:false,configurable:true});return e}();r.SpriteService=n;r.default=n},{"../Viewer":302,rxjs:43,"rxjs/operators":241,three:242,"virtual-dom":247}],484:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r.TouchService=void 0;var u=e("rxjs");var c=e("rxjs/operators");var n=function(){function e(e,t){var r=this;this._activeSubject$=new u.BehaviorSubject(false);this._active$=this._activeSubject$.pipe(c.distinctUntilChanged(),c.publishReplay(1),c.refCount());u.fromEvent(t,"touchmove").subscribe(function(e){e.preventDefault()});this._touchStart$=u.fromEvent(e,"touchstart");this._touchMove$=u.fromEvent(e,"touchmove");this._touchEnd$=u.fromEvent(e,"touchend");this._touchCancel$=u.fromEvent(e,"touchcancel");var n=this._touchStart$.pipe(c.filter(function(e){return e.touches.length===1&&e.targetTouches.length===1}),c.share());this._doubleTap$=n.pipe(c.bufferWhen(function(){return n.pipe(c.first(),c.switchMap(function(e){return u.merge(u.timer(300),n).pipe(c.take(1))}))}),c.filter(function(e){return e.length===2}),c.map(function(e){return e[e.length-1]}),c.share());this._doubleTap$.subscribe(function(e){e.preventDefault()});this._singleTouchMove$=this._touchMove$.pipe(c.filter(function(e){return e.touches.length===1&&e.targetTouches.length===1}),c.share());var i=u.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(c.filter(function(e){return e.touches.length===1&&e.targetTouches.length===1}));var o=u.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(c.filter(function(e){return e.touches.length>=1}));var a=u.merge(this._touchEnd$,this._touchCancel$).pipe(c.filter(function(e){return e.touches.length===0}));this._singleTouchDragStart$=i.pipe(c.mergeMap(function(e){return r._singleTouchMove$.pipe(c.takeUntil(u.merge(a,o)),c.take(1))}));this._singleTouchDragEnd$=i.pipe(c.mergeMap(function(e){return u.merge(a,o).pipe(c.first())}));this._singleTouchDrag$=i.pipe(c.switchMap(function(e){return r._singleTouchMove$.pipe(c.skip(1),c.takeUntil(u.merge(o,a)))}));var s=u.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=s.pipe(c.filter(function(e){return e.touches.length===2&&e.targetTouches.length===2}));this._pinchEnd$=s.pipe(c.filter(function(e){return e.touches.length!==2||e.targetTouches.length!==2}));this._pinchOperation$=new u.Subject;this._pinch$=this._pinchOperation$.pipe(c.scan(function(e,t){return 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(c.filter(function(e){return e.touches.length===2&&e.targetTouches.length===2}),c.map(function(b){return function(e){var t=b.touches[0];var r=b.touches[1];var n=Math.min(t.clientX,r.clientX);var i=Math.max(t.clientX,r.clientX);var o=Math.min(t.clientY,r.clientY);var a=Math.max(t.clientY,r.clientY);var s=n+(i-n)/2;var u=o+(a-o)/2;var c=s+t.pageX-t.clientX;var l=u+t.pageY-t.clientY;var h=s+t.screenX-t.clientX;var p=u+t.screenY-t.clientY;var f=Math.abs(t.clientX-r.clientX);var d=Math.abs(t.clientY-r.clientY);var v=Math.sqrt(f*f+d*d);var m=v-e.distance;var g=f-e.distanceX;var _=d-e.distanceY;var y={changeX:g,changeY:_,clientX:s,clientY:u,distance:v,distanceChange:m,distanceX:f,distanceY:d,originalEvent:b,pageX:c,pageY:l,screenX:h,screenY:p,touch1:t,touch2:r};return y}})).subscribe(this._pinchOperation$);this._pinchChange$=this._pinchStart$.pipe(c.switchMap(function(e){return r._pinch$.pipe(c.skip(1),c.takeUntil(r._pinchEnd$))}))}Object.defineProperty(e.prototype,"active$",{get:function(){return this._active$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"doubleTap$",{get:function(){return this._doubleTap$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"touchStart$",{get:function(){return this._touchStart$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"touchMove$",{get:function(){return this._touchMove$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"touchEnd$",{get:function(){return this._touchEnd$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"touchCancel$",{get:function(){return this._touchCancel$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"singleTouchDragStart$",{get:function(){return this._singleTouchDragStart$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"singleTouchDrag$",{get:function(){return this._singleTouchDrag$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"singleTouchDragEnd$",{get:function(){return this._singleTouchDragEnd$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"pinchStart$",{get:function(){return this._pinchStart$},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"pinchEnd$",{get:function(){return this._pinchEnd$},enumerable:false,configurable:true});return e}();r.TouchService=n},{rxjs:43,"rxjs/operators":241}],485:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var n=function(e,t){n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(r,"__esModule",{value:true});r.Viewer=void 0;var o=e("rxjs");var s=e("rxjs/operators");var u=e("when");var c=e("../Viewer");var l=e("../Utils");var i=function(a){n(e,a);function e(e,t,r,n,i){var o=a.call(this)||this;n=n!=null?n:{};l.Settings.setOptions(n);l.Urls.setOptions(n.url);o._navigator=new c.Navigator(t,n,i);o._container=new c.Container(e,o._navigator.stateService,n);o._observer=new c.Observer(o,o._navigator,o._container);o._componentController=new c.ComponentController(o._container,o._navigator,o._observer,r,n.component);return o}Object.defineProperty(e.prototype,"isNavigable",{get:function(){return this._componentController.navigable},enumerable:false,configurable:true});e.prototype.activateCombinedPanning=function(){this._navigator.panService.enable()};e.prototype.activateComponent=function(e){this._componentController.activate(e)};e.prototype.activateCover=function(){this._componentController.activateCover()};e.prototype.deactivateCombinedPanning=function(){this._navigator.panService.disable()};e.prototype.deactivateComponent=function(e){this._componentController.deactivate(e)};e.prototype.deactivateCover=function(){this._componentController.deactivateCover()};e.prototype.getBearing=function(){var e=this;return u.promise(function(t,r){e._container.renderService.bearing$.pipe(s.first()).subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.getCanvasContainer=function(){return this._container.canvasContainer};e.prototype.getCenter=function(){var e=this;return u.promise(function(t,r){e._navigator.stateService.getCenter().subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.getComponent=function(e){return this._componentController.get(e)};e.prototype.getContainer=function(){return this._container.element};e.prototype.getFieldOfView=function(){var e=this;return u.promise(function(t,r){e._container.renderService.renderCamera$.pipe(s.first()).subscribe(function(e){t(e.perspective.fov)},function(e){r(e)})})};e.prototype.getPointOfView=function(){var e=this;return u.promise(function(n,t){o.combineLatest(e._container.renderService.renderCamera$,e._container.renderService.bearing$).pipe(s.first()).subscribe(function(e){var t=e[0],r=e[1];n({bearing:r,tilt:t.getTilt()})},function(e){t(e)})})};e.prototype.getPosition=function(){var i=this;return u.promise(function(n,t){o.combineLatest(i._container.renderService.renderCamera$,i._navigator.stateService.reference$).pipe(s.first()).subscribe(function(e){var t=e[0],r=e[1];n(i._observer.projection.cameraToLatLon(t,r))},function(e){t(e)})})};e.prototype.getZoom=function(){var e=this;return u.promise(function(t,r){e._navigator.stateService.getZoom().subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.moveCloseTo=function(e,t){var n=this.isNavigable?this._navigator.moveCloseTo$(e,t):o.throwError(new Error("Calling moveCloseTo is not supported when viewer is not navigable."));return u.promise(function(t,r){n.subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.moveDir=function(e){var n=this.isNavigable?this._navigator.moveDir$(e):o.throwError(new Error("Calling moveDir is not supported when viewer is not navigable."));return u.promise(function(t,r){n.subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.moveToKey=function(e){var n=this.isNavigable?this._navigator.moveToKey$(e):o.throwError(new Error("Calling moveToKey is not supported when viewer is not navigable."));return u.promise(function(t,r){n.subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.project=function(e){var n=this;return u.promise(function(t,r){n._observer.project$(e).subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.projectFromBasic=function(e){var n=this;return u.promise(function(t,r){n._observer.projectBasic$(e).subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.resize=function(){this._container.renderService.resize$.next(null)};e.prototype.setAuthToken=function(e){var r=this.isNavigable?this._navigator.setToken$(e):o.throwError(new Error("Calling setAuthToken is not supported when viewer is not navigable."));return u.promise(function(e,t){r.subscribe(function(){e(undefined)},function(e){t(e)})})};e.prototype.setCenter=function(e){this._navigator.stateService.setCenter(e)};e.prototype.setFilter=function(r){var n=this;return u.promise(function(e,t){n._navigator.setFilter$(r).subscribe(function(){e(undefined)},function(e){t(e)})})};e.prototype.setFieldOfView=function(r){var n=this;this._container.renderService.renderCamera$.pipe(s.first()).subscribe(function(e){var t=e.fovToZoom(r);n._navigator.stateService.setZoom(t)})};e.prototype.setRenderMode=function(e){this._container.renderService.renderMode$.next(e)};e.prototype.setTransitionMode=function(e){this._navigator.stateService.setTransitionMode(e)};e.prototype.setZoom=function(e){this._navigator.stateService.setZoom(e)};e.prototype.unproject=function(e){var n=this;return u.promise(function(t,r){n._observer.unproject$(e).subscribe(function(e){t(e)},function(e){r(e)})})};e.prototype.unprojectToBasic=function(e){var n=this;return u.promise(function(t,r){n._observer.unprojectBasic$(e).subscribe(function(e){t(e)},function(e){r(e)})})};e.bearingchanged="bearingchanged";e.click="click";e.contextmenu="contextmenu";e.dblclick="dblclick";e.fovchanged="fovchanged";e.loadingchanged="loadingchanged";e.mousedown="mousedown";e.mousemove="mousemove";e.mouseout="mouseout";e.mouseover="mouseover";e.mouseup="mouseup";e.moveend="moveend";e.movestart="movestart";e.navigablechanged="navigablechanged";e.nodechanged="nodechanged";e.positionchanged="positionchanged";e.povchanged="povchanged";e.sequenceedgeschanged="sequenceedgeschanged";e.spatialedgeschanged="spatialedgeschanged";return e}(l.EventEmitter);r.Viewer=i},{"../Utils":301,"../Viewer":302,rxjs:43,"rxjs/operators":241,when:288}],486:[function(e,t,r){arguments[4][305][0].apply(r,arguments)},{dup:305}]},{},[296])(296)});