]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD/mapillary-js/mapillary.min.js
Update to iD v2.4.0
[rails.git] / vendor / assets / iD / iD / mapillary-js / mapillary.min.js
1 !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Mapillary=t()}}(function(){return function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[s]={exports:{}};e[s][0].call(h.exports,function(t){var r=e[s][1][t];return i(r||t)},h,h.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){"use strict";function n(t,e,r){e=e||1;for(var n,s,c,h,l=0;l<t[0].length;l++){var p=t[0][l];(!l||p[0]<n)&&(n=p[0]),(!l||p[1]<s)&&(s=p[1]),(!l||p[0]>c)&&(c=p[0]),(!l||p[1]>h)&&(h=p[1])}var f=c-n,d=h-s,m=Math.min(f,d),v=m/2,g=new u(null,i);if(0===m)return[n,s];for(var y=n;y<c;y+=m)for(var b=s;b<h;b+=m)g.push(new o(y+v,b+v,v,t));var _=a(t),x=new o(n+f/2,s+d/2,0,t);x.d>_.d&&(_=x);for(var w=g.length;g.length;){var S=g.pop();S.d>_.d&&(_=S,r&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,w)),S.max-_.d<=e||(v=S.h/2,g.push(new o(S.x-v,S.y-v,v,t)),g.push(new o(S.x+v,S.y-v,v,t)),g.push(new o(S.x-v,S.y+v,v,t)),g.push(new o(S.x+v,S.y+v,v,t)),w+=4)}return r&&(console.log("num probes: "+w),console.log("best distance: "+_.d)),[_.x,_.y]}function i(t,e){return e.max-t.max}function o(t,e,r,n){this.x=t,this.y=e,this.h=r,this.d=s(t,e,n),this.max=this.d+this.h*Math.SQRT2}function s(t,e,r){for(var n=!1,i=1/0,o=0;o<r.length;o++)for(var s=r[o],a=0,u=s.length,h=u-1;a<u;h=a++){var l=s[a],p=s[h];l[1]>e!=p[1]>e&&t<(p[0]-l[0])*(e-l[1])/(p[1]-l[1])+l[0]&&(n=!n),i=Math.min(i,c(t,e,l,p))}return(n?1:-1)*Math.sqrt(i)}function a(t){for(var e=0,r=0,n=0,i=t[0],s=0,a=i.length,c=a-1;s<a;c=s++){var u=i[s],h=i[c],l=u[0]*h[1]-h[0]*u[1];r+=(u[0]+h[0])*l,n+=(u[1]+h[1])*l,e+=3*l}return 0===e?new o(i[0][0],i[0][1],0,t):new o(r/e,n/e,0,t)}function c(t,e,r,n){var i=r[0],o=r[1],s=n[0]-i,a=n[1]-o;if(0!==s||0!==a){var c=((t-i)*s+(e-o)*a)/(s*s+a*a);c>1?(i=n[0],o=n[1]):c>0&&(i+=s*c,o+=a*c)}return s=t-i,a=e-o,s*s+a*a}var u=t("tinyqueue");e.exports=n,e.exports.default=n},{tinyqueue:177}],2:[function(t,e,r){function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}e.exports=n,n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){void 0===e&&(e=1e-6);var r,n,i,o,s;for(i=t,s=0;s<8;s++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=o/a}if(r=0,n=1,(i=t)<r)return r;if(i>n)return n;for(;r<n;){if(o=this.sampleCurveX(i),Math.abs(o-t)<e)return i;t>o?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],3:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function o(t,e,r){for(var n,o=[],s=e;s<r;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(i(n));return o.join("")}r.byteLength=function(t){return 3*t.length/4-n(t)},r.toByteArray=function(t){var e,r,i,o,s,u=t.length;o=n(t),s=new c(3*u/4-o),r=o>0?u-4:u;var h=0;for(e=0;e<r;e+=4)i=a[t.charCodeAt(e)]<<18|a[t.charCodeAt(e+1)]<<12|a[t.charCodeAt(e+2)]<<6|a[t.charCodeAt(e+3)],s[h++]=i>>16&255,s[h++]=i>>8&255,s[h++]=255&i;return 2===o?(i=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,s[h++]=255&i):1===o&&(i=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,s[h++]=i>>8&255,s[h++]=255&i),s},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i="",a=[],c=0,u=r-n;c<u;c+=16383)a.push(o(t,c,c+16383>u?u:c+16383));return 1===n?(e=t[r-1],i+=s[e>>2],i+=s[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=s[e>>10],i+=s[e>>4&63],i+=s[e<<2&63],i+="="),a.push(i),a.join("")};for(var s=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,l=u.length;h<l;++h)s[h]=u[h],a[u.charCodeAt(h)]=h;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],4:[function(t,e,r){},{}],5:[function(t,e,r){e.exports=function(t){var e=String.prototype.split,r=/()??/.exec("")[1]===t;return function(n,i,o){if("[object RegExp]"!==Object.prototype.toString.call(i))return e.call(n,i,o);var s,a,c,u,h=[],l=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.extended?"x":"")+(i.sticky?"y":""),p=0,i=new RegExp(i.source,l+"g");for(n+="",r||(s=new RegExp("^"+i.source+"$(?!\\s)",l)),o=o===t?-1>>>0:o>>>0;(a=i.exec(n))&&!((c=a.index+a[0].length)>p&&(h.push(n.slice(p,a.index)),!r&&a.length>1&&a[0].replace(s,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===t&&(a[e]=t)}),a.length>1&&a.index<n.length&&Array.prototype.push.apply(h,a.slice(1)),u=a[0].length,p=c,h.length>=o));)i.lastIndex===a.index&&i.lastIndex++;return p===n.length?!u&&i.test("")||h.push(""):h.push(n.slice(p)),h.length>o?h.slice(0,o):h}}()},{}],6:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function s(t){if(p===clearTimeout)return clearTimeout(t);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function a(){v&&d&&(v=!1,d.length?m=d.concat(m):g=-1,m.length&&c())}function c(){if(!v){var t=o(a);v=!0;for(var e=m.length;e;){for(d=m,m=[];++g<e;)d&&d[g].run();g=-1,e=m.length}d=null,v=!1,s(t)}}function u(t,e){this.fun=t,this.array=e}function h(){}var l,p,f=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(t){l=n}try{p="function"==typeof clearTimeout?clearTimeout:i}catch(t){p=i}}();var d,m=[],v=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];m.push(new u(t,e)),1!==m.length||v||o(c)},u.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=h,f.addListener=h,f.once=h,f.off=h,f.removeListener=h,f.removeAllListeners=h,f.emit=h,f.prependListener=h,f.prependOnceListener=h,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],7:[function(t,e,r){"use strict";function n(t){if(t>X)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return o(t,e,r)}function o(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?l(t,e,r):"string"==typeof t?u(t,e):p(t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,e,r){return s(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function c(t){return s(t),n(t<0?0:0|f(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(t,e),o=n(r),s=o.write(t,e);return s!==r&&(o=o.slice(0,s)),o}function h(t){for(var e=t.length<0?0:0|f(t.length),r=n(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function l(t,e,r){if(e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),n.__proto__=i.prototype,n}function p(t){if(i.isBuffer(t)){var e=0|f(t.length),r=n(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(t){if(V(t)||"length"in t)return"number"!=typeof t.length||H(t.length)?n(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function f(t){if(t>=X)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+X.toString(16)+" bytes");return 0|t}function d(t,e){if(i.isBuffer(t))return t.length;if(V(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,H(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(i){var h=-1;for(u=r;u<a;u++)if(o(t,u)===o(e,-1===h?0:u-h)){if(-1===h&&(h=u),u-h+1===c)return h*s}else-1!==h&&(u-=u-h),h=-1}else for(r+c>a&&(r=a-c),u=r;u>=0;u--){for(var l=!0,p=0;p<c;p++)if(o(t,u+p)!==o(e,p)){l=!1;break}if(l)return u}return-1}function b(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(H(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return $(B(e,t.length-r),t,r,n)}function x(t,e,r,n){return $(U(e),t,r,n)}function w(t,e,r,n){return x(t,e,r,n)}function S(t,e,r,n){return $(G(e),t,r,n)}function M(t,e,r,n){return $(z(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?q.fromByteArray(t):q.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,u,h,l;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=t[i+1]))&&(l=(31&o)<<6|63&c)>127&&(s=l);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:c=t[i+1],u=t[i+2],h=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return C(n)}function C(t){var e=t.length;if(e<=Y)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Y));return r}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function P(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function A(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=F(t[o]);return i}function j(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return e=+e,r>>>=0,i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function k(t){if((t=t.trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function z(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}function G(t){return q.toByteArray(k(t))}function $(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function V(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function H(t){return t!==t}var q=t("base64-js"),W=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50;var X=2147483647;r.kMaxLength=X,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return o(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return a(t,e,r)},i.allocUnsafe=function(t){return c(t)},i.allocUnsafeSlow=function(t){return c(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o<s;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},i.isEncoding=function(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!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=i.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!i.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},i.byteLength=d,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?T(this,0,t):m.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),l=0;l<c;++l)if(u[l]!==h[l]){s=u[l],a=h[l];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},i.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},i.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},i.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=i.prototype,n},i.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},i.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},i.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},i.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s<r;++s)this[s]=t;else{var a=i.isBuffer(t)?t:new i(t,n),c=a.length;for(s=0;s<r-e;++s)this[s+e]=a[s%c]}return this};var K=/[^+/0-9A-Za-z-_]/g},{"base64-js":3,ieee754:17}],8:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n=e&&e.length,o=n?e[0]*r:t.length,a=i(t,0,o,r,!0),c=[];if(!a)return c;var u,h,p,f,d,m,v;if(n&&(a=l(t,e,a,r)),t.length>80*r){u=p=t[0],h=f=t[1];for(var g=r;g<o;g+=r)d=t[g],m=t[g+1],d<u&&(u=d),m<h&&(h=m),d>p&&(p=d),m>f&&(f=m);v=Math.max(p-u,f-h)}return s(a,c,r,u,h,v),c}function i(t,e,r,n,i){var o,s;if(i===j(t,e,r,n)>0)for(o=e;o<r;o+=n)s=O(o,t[o],t[o+1],s);else for(o=r-n;o>=e;o-=n)s=O(o,t[o],t[o+1],s);return s&&w(s,s.next)&&(P(s),s=s.next),s}function o(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!w(n,n.next)&&0!==x(n.prev,n,n.next))n=n.next;else{if(P(n),(n=e=n.prev)===n.next)return null;r=!0}}while(r||n!==e);return e}function s(t,e,r,n,i,l,p){if(t){!p&&l&&m(t,n,i,l);for(var f,d,v=t;t.prev!==t.next;)if(f=t.prev,d=t.next,l?c(t,n,i,l):a(t))e.push(f.i/r),e.push(t.i/r),e.push(d.i/r),P(t),t=d.next,v=d.next;else if((t=d)===v){p?1===p?s(t=u(t,e,r),e,r,n,i,l,2):2===p&&h(t,e,r,n,i,l):s(o(t),e,r,n,i,l,1);break}}}function a(t){var e=t.prev,r=t,n=t.next;if(x(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(b(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&x(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function c(t,e,r,n){var i=t.prev,o=t,s=t.next;if(x(i,o,s)>=0)return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,c=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,u=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,l=g(a,c,e,r,n),p=g(u,h,e,r,n),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&b(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&b(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&x(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!w(i,o)&&S(i,n,n.next,o)&&E(i,o)&&E(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),P(n),P(n.next),n=t=o),n=n.next}while(n!==t);return n}function h(t,e,r,n,i,a){var c=t;do{for(var u=c.next.next;u!==c.prev;){if(c.i!==u.i&&_(c,u)){var h=C(c,u);return c=o(c,c.next),h=o(h,h.next),s(c,e,r,n,i,a),void s(h,e,r,n,i,a)}u=u.next}c=c.next}while(c!==t)}function l(t,e,r,n){var s,a,c,u=[];for(s=0,a=e.length;s<a;s++)(c=i(t,e[s]*n,s<a-1?e[s+1]*n:t.length,n,!1))===c.next&&(c.steiner=!0),u.push(y(c));for(u.sort(p),s=0;s<u.length;s++)f(u[s],r),r=o(r,r.next);return r}function p(t,e){return t.x-e.x}function f(t,e){if(e=d(t,e)){var r=C(e,t);o(r,r.next)}}function d(t,e){var r,n=e,i=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s){if(s=a,a===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===s)return r.prev;var c,u=r,h=r.x,l=r.y,p=1/0;for(n=r.next;n!==u;)i>=n.x&&n.x>=h&&b(o<l?i:s,o,h,l,o<l?s:i,o,n.x,n.y)&&((c=Math.abs(o-n.y)/(i-n.x))<p||c===p&&n.x>r.x)&&E(n,t)&&(r=n,p=c),n=n.next;return r}function m(t,e,r,n){var i=t;do{null===i.z&&(i.z=g(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,v(i)}function v(t){var e,r,n,i,o,s,a,c,u=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,n=r,a=0,e=0;e<u&&(a++,n=n.nextZ);e++);for(c=u;a>0||c>0&&n;)0===a?(i=n,n=n.nextZ,c--):0!==c&&n?r.z<=n.z?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,c--):(i=r,r=r.nextZ,a--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(s>1);return t}function g(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function y(t){var e=t,r=t;do{e.x<r.x&&(r=e),e=e.next}while(e!==t);return r}function b(t,e,r,n,i,o,s,a){return(i-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(n-a)-(r-s)*(e-a)>=0&&(r-s)*(o-a)-(i-s)*(n-a)>=0}function _(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!M(t,e)&&E(t,e)&&E(e,t)&&T(t,e)}function x(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function S(t,e,r,n){return!!(w(t,e)&&w(r,n)||w(t,n)&&w(r,e))||x(t,e,r)>0!=x(t,e,n)>0&&x(r,n,t)>0!=x(r,n,e)>0}function M(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&S(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function E(t,e){return x(t.prev,t,t.next)<0?x(t,e,t.next)>=0&&x(t,t.prev,e)>=0:x(t,e,t.prev)<0||x(t,t.next,e)<0}function T(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}function C(t,e){var r=new A(t.i,t.x,t.y),n=new A(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function O(t,e,r,n){var i=new A(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function P(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function j(t,e,r,n){for(var i=0,o=e,s=r-n;o<r;o+=n)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}e.exports=n,n.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,s=Math.abs(j(t,0,o,r));if(i)for(var a=0,c=e.length;a<c;a++){var u=e[a]*r,h=a<c-1?e[a+1]*r:t.length;s-=Math.abs(j(t,u,h,r))}var l=0;for(a=0;a<n.length;a+=3){var p=n[a]*r,f=n[a+1]*r,d=n[a+2]*r;l+=Math.abs((t[p]-t[d])*(t[f+1]-t[p+1])-(t[p]-t[f])*(t[d+1]-t[p+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},n.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)r.vertices.push(t[i][o][s]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],9:[function(t,e,r){"use strict";t("individual/one-version")("ev-store","7");var n="__EV_STORE_KEY@7";e.exports=function(t){var e=t[n];return e||(e=t[n]={}),e}},{"individual/one-version":19}],10:[function(t,e,r){"use strict";function n(t,e){var r;for(r in e)t[r]=e[r];return t}function i(t,e){this._jsongUrl=t,"number"==typeof e&&(e={timeout:e}),this._config=n({timeout:15e3,headers:{}},e||{})}var o=t("./request"),s=t("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:s,get:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:t,method:"get"}),this._config);return o("GET",e,this)},set:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"POST",{jsonGraph:t,method:"set"}),this._config);return e.headers["Content-Type"]="application/x-www-form-urlencoded",o("POST",e,this)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var s=[];s.push("method=call"),s.push("callPath="+encodeURIComponent(JSON.stringify(t))),s.push("arguments="+encodeURIComponent(JSON.stringify(e))),s.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),s.push("paths="+encodeURIComponent(JSON.stringify(i)));var a=n(this.buildQueryObject(this._jsongUrl,"POST",s.join("&")),this._config);return a.headers["Content-Type"]="application/x-www-form-urlencoded",o("POST",a,this)}},i.XMLHttpSource=i,i.default=i,e.exports=i},{"./buildQueryObject":11,"./request":14}],11:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=[],i={url:t},o=-1!==t.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];n.push(t+"="+encodeURIComponent(e))}),"GET"===e?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],12:[function(t,e,r){(function(t){"use strict";e.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 global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e,r,n;if(t.XMLHttpRequest)return new t.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;n<3;n++)try{if(e=r[n],new t.ActiveXObject(e))break}catch(t){}return new t.ActiveXObject(e)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e,r){"use strict";function n(){}function i(t,e,r){r||(r=new Error(e)),t.onError(r)}function o(t,e,r){var n,o;if(e&&t){o=e.responseType,n="response"in e?e.response:e.responseText;var s=1223===e.status?204:e.status;if(s>=200&&s<=399){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(t,"invalid json",r)}return t.onNext(n),void t.onCompleted()}return 401===s||403===s||407===s?i(t,n):410===s?i(t,n):408===s||504===s?i(t,n):i(t,n||"Response code "+s)}}function s(t,e,r,n){i(t,r||e.statusText||"request error",n)}var a=t("./getXMLHttpRequest"),c=t("./getCORSRequest"),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(t){var e=new n;return e.subscribe=function(e,r,n){var i,o;return i="function"==typeof e?{onNext:e,onError:r||h,onCompleted:n||h}:e,"function"==typeof(o=t(i))?{dispose:o}:o},e},e.exports=function(t,e,r){return n.create(function(n){var i,h,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)u.call(e,f)&&(d[f]=e[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?c():a()}catch(t){n.onError(t)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,l=d.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(t){if("json"!==d.responseType)throw t}i.onreadystatechange=function(t){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(t){h||(h=!0,s(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{"./getCORSRequest":12,"./getXMLHttpRequest":13}],15:[function(t,e,r){(function(n){!function(t){if("object"==typeof r&&void 0!==e)e.exports=t();else{("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).falcor=t()}}(function(){return function e(r,n,i){function o(a,c){if(!n[a]){if(!r[a]){var u="function"==typeof t&&t;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var l=n[a]={exports:{}};r[a][0].call(l.exports,function(t){var e=r[a][1][t];return o(e||t)},l,l.exports,e,r,n,i)}return n[a].exports}for(var s="function"==typeof t&&t,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(t,e,r){var n=t(32),i=t(130);n.atom=i.atom,n.ref=i.ref,n.error=i.error,n.pathValue=i.pathValue,n.HttpDataSource=t(125),e.exports=n},{125:125,130:130,32:32}],2:[function(t,e,r){function n(t){var e=t||{};this._root=e._root||new i(e),this._path=e.path||e._path||[],this._scheduler=e.scheduler||e._scheduler||new f,this._source=e.source||e._source,this._request=e.request||e._request||new s(this,this._scheduler),this._ID=C++,"number"==typeof e.maxSize?this._maxSize=e.maxSize:this._maxSize=e._maxSize||n.prototype._maxSize,"number"==typeof e.collectRatio?this._collectRatio=e.collectRatio:this._collectRatio=e._collectRatio||n.prototype._collectRatio,(e.boxed||e.hasOwnProperty("_boxed"))&&(this._boxed=e.boxed||e._boxed),(e.materialized||e.hasOwnProperty("_materialized"))&&(this._materialized=e.materialized||e._materialized),"boolean"==typeof e.treatErrorsAsValues?this._treatErrorsAsValues=e.treatErrorsAsValues:e.hasOwnProperty("_treatErrorsAsValues")&&(this._treatErrorsAsValues=e._treatErrorsAsValues),e.cache&&this.setCache(e.cache)}var i=t(4),o=t(3),s=t(55),a=t(64),c=t(65),u=t(61),h=t(63),l=t(73),p=t(75),f=t(74),d=t(81),m=t(84),v=t(49),g=t(134),y=t(88),b=t(100),_=t(96),x=t(102),w=t(98),S=t(99),M=t(77),E=t(76),T=t(130),C=0,O=t(116),P=function(){},A=t(14),j=t(19),R={pathValue:!0,pathSyntax:!0,json:!0,jsonGraph:!0},L=t(72);e.exports=n,n.ref=T.ref,n.atom=T.atom,n.error=T.error,n.pathValue=T.pathValue,n.prototype.constructor=n,n.prototype._materialized=!1,n.prototype._boxed=!1,n.prototype._progressive=!1,n.prototype._treatErrorsAsValues=!1,n.prototype._maxSize=Math.pow(2,53)-1,n.prototype._collectRatio=.75,n.prototype.get=t(71),n.prototype._getWithPaths=t(70),n.prototype.set=function(){var t=O(arguments,R,"set");return!0!==t?new a(function(e){e.onError(t)}):this._set.apply(this,arguments)},n.prototype.preload=function(){var t=O(arguments,L,"preload");if(!0!==t)return new a(function(e){e.onError(t)});var e=Array.prototype.slice.call(arguments),r=this;return new a(function(t){return r.get.apply(r,e).subscribe(function(){},function(e){t.onError(e)},function(){t.onCompleted()})})},n.prototype._set=function(){var t,e=-1,r=arguments.length,n=arguments[r-1];for(_(n)?r-=1:n=void 0,t=new Array(r);++e<r;)t[e]=arguments[e];return c.create(this,t,n)},n.prototype.call=function(){var t,e=-1,r=arguments.length;for(t=new Array(r);++e<r;){var n=arguments[e];t[e]=n;var i=typeof n;if(e>1&&!Array.isArray(n)||0===e&&!Array.isArray(n)&&"string"!==i||1===e&&!Array.isArray(n)&&!x(n))return new a(function(t){t.onError(new Error("Invalid argument"))})}return u.create(this,t)},n.prototype.invalidate=function(){var t,e=-1,r=arguments.length,n=arguments[r-1];for(t=new Array(r);++e<r;)if(t[e]=g.fromPath(arguments[e]),"object"!=typeof t[e])throw new Error("Invalid argument");h.create(this,t,n).subscribe(P,function(t){throw t})},n.prototype.deref=t(5),n.prototype.getValue=t(16),n.prototype.setValue=t(79),n.prototype._getValueSync=t(24),n.prototype._setValueSync=t(80),n.prototype._derefSync=t(6),n.prototype.setCache=function(t){var e=this._root.cache;if(t!==e){var r=this._root,n=this._path;this._path=[],this._root.cache={},void 0!==e&&v(r,r.expired,y(e),0),S(t)?E(this,[t]):w(t)?M(this,[t]):b(t)&&M(this,[{json:t}]),this._path=n}else void 0===e&&(this._root.cache={});return this},n.prototype.getCache=function(){var t=m(arguments);if(0===t.length)return A(this._root.cache);var e=[{}],r=this._path;return j.getWithPathsAsJSONGraph(this,t,e),this._path=r,e[0].jsonGraph},n.prototype.getVersion=function(t){var e=t&&g.fromPath(t)||[];if(!1===Array.isArray(e))throw new Error("Model#getVersion must be called with an Array path.");return this._path.length&&(e=this._path.concat(e)),this._getVersion(this,e)},n.prototype._syncCheck=function(t){if(Boolean(this._source)&&this._root.syncRefCount<=0&&!1===this._root.unsafeMode)throw new Error("Model#"+t+" may only be called within the context of a request selector.");return!0},n.prototype._clone=function(t){var e=new n(this);for(var r in t){var i=t[r];"delete"===i?delete e[r]:e[r]=i}return e.setCache=void 0,e},n.prototype.batch=function(t){var e=t;"number"==typeof e?e=new p(Math.round(Math.abs(e))):e&&e.schedule||(e=new l);var r=this._clone();return r._request=new s(r,e),r},n.prototype.unbatch=function(){var t=this._clone();return t._request=new s(t,new f),t},n.prototype.treatErrorsAsValues=function(){return this._clone({_treatErrorsAsValues:!0})},n.prototype.asDataSource=function(){return new o(this)},n.prototype._materialize=function(){return this._clone({_materialized:!0})},n.prototype._dematerialize=function(){return this._clone({_materialized:"delete"})},n.prototype.boxValues=function(){return this._clone({_boxed:!0})},n.prototype.unboxValues=function(){return this._clone({_boxed:"delete"})},n.prototype.withoutDataSource=function(){return this._clone({_source:"delete"})},n.prototype.toJSON=function(){return{$type:"ref",value:this._path}},n.prototype.getPath=function(){return d(this._path)},n.prototype._getBoundValue=t(13),n.prototype._getVersion=t(18),n.prototype._getValueSync=t(17),n.prototype._getPathValuesAsPathMap=j.getWithPathsAsPathMap,n.prototype._getPathValuesAsJSONG=j.getWithPathsAsJSONGraph,n.prototype._setPathValuesAsJSON=t(78),n.prototype._setPathValuesAsJSONG=t(78),n.prototype._setPathValuesAsPathMap=t(78),n.prototype._setPathValuesAsValues=t(78),n.prototype._setPathMapsAsJSON=t(77),n.prototype._setPathMapsAsJSONG=t(77),n.prototype._setPathMapsAsPathMap=t(77),n.prototype._setPathMapsAsValues=t(77),n.prototype._setJSONGsAsJSON=t(76),n.prototype._setJSONGsAsJSONG=t(76),n.prototype._setJSONGsAsPathMap=t(76),n.prototype._setJSONGsAsValues=t(76),n.prototype._setCache=t(77),n.prototype._invalidatePathValuesAsJSON=t(48),n.prototype._invalidatePathMapsAsJSON=t(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(t,e,r){function n(t){this._model=t._materialize().treatErrorsAsValues()}n.prototype.get=function(t){return this._model.get.apply(this._model,t)._toJSONG()},n.prototype.set=function(t){return this._model.set(t)._toJSONG()},n.prototype.call=function(t,e,r,n){var i=[t,e,r].concat(n);return this._model.call.apply(this._model,i)._toJSONG()},e.exports=n},{}],4:[function(t,e,r){function n(t){var e=t||{};this.syncRefCount=0,this.expired=e.expired||[],this.unsafeMode=e.unsafeMode||!1,this.collectionScheduler=e.collectionScheduler||new s,this.cache={},i(e.comparator)&&(this.comparator=e.comparator),i(e.errorSelector)&&(this.errorSelector=e.errorSelector),i(e.onChange)&&(this.onChange=e.onChange)}var i=t(96),o=t(91),s=t(74);n.prototype.errorSelector=function(t,e){return e},n.prototype.comparator=function(t,e){return o(t,"value")&&o(e,"value")?t.value===e.value&&t.$type===e.$type&&t.$expires===e.$expires:t===e},e.exports=n},{74:74,91:91,96:96}],5:[function(t,e,r){function n(t,e){var r,n=!1;try{++t._root.syncRefCount,r=t._derefSync(e)}catch(t){r=t,n=!0}finally{--t._root.syncRefCount}return n?i.Observable.throw(r):i.Observable.return(r)}var i=t(159),o=t(134);e.exports=function(t){for(var e=this,r=-1,s=arguments.length-1,a=new Array(s),c=o.fromPath(t);++r<s;)a[r]=o.fromPath(arguments[r+1]);if(0===s)throw new Error("Model#deref requires at least one value path.");return i.Observable.defer(function(){return n(e,c)}).flatMap(function(t){if(Boolean(t)){if(s>0){var r=i.Observable.of(t);return t.get.apply(t,a).catch(i.Observable.empty()).concat(r).last().flatMap(function(){return n(e,c)}).filter(function(t){return t})}return i.Observable.return(t)}if(s>0){var o=a.map(function(t){return c.concat(t)});return e.get.apply(e,o).concat(i.Observable.defer(function(){return n(e,c)})).last().filter(function(t){return t})}return i.Observable.empty()})}},{134:134,159:159}],6:[function(t,e,r){var n=t(134),i=t(13),o=t(8),s=t(118);e.exports=function(t){var e=n.fromPath(t);if(!Array.isArray(e))throw new Error("Model#derefSync must be called with an Array path.");var r=i(this,this._path.concat(e),!1),a=r.path,c=r.value;if(r.found&&void 0!==c&&(c.$type!==s||void 0!==c.value)){if(c.$type)throw new o;return this._clone({_path:a})}}},{118:118,13:13,134:134,8:8}],7:[function(t,e,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.",e.exports=n},{}],8:[function(t,e,r){function n(t,e){this.message=i,this.stack=(new Error).stack,this.boundPath=t,this.shortedPath=e}var i="The boundPath of the model is not valid since a value or error was found before the path end.";(n.prototype=new Error).name="InvalidModelError",n.message=i,e.exports=n},{}],9:[function(t,e,r){function n(t){this.message="An exception was thrown when making a request.",this.stack=(new Error).stack,this.innerError=t}var i="InvalidSourceError";(n.prototype=new Error).name=i,n.is=function(t){return t&&t.name===i},e.exports=n},{}],10:[function(t,e,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).name=i,n.is=function(t){return t&&t.name===i},e.exports=n},{}],11:[function(t,e,r){var n=t(26).create,i=t(22),o=t(27),s=t(120),a=t(33),c=t(29).promote;e.exports=function(t,e,r,u,h,l,p){for(var f,d,m=r,v=h,g=u,y=0;;){if(0===y&&g[a]?(y=v.length,d=g[a]):(f=v[y++],d=m[f]),d){var b=d.$type,_=b&&d.value||d;if(y<v.length){if(b){m=d;break}m=d;continue}if(m=d,b&&o(d))break;if(g[a]||n(g,d),b===s){p?i(t,d,l,null,null,null,v,v.length,p):c(t,d),y=0,v=_,g=d,m=e;continue}break}m=void 0;break}if(y<v.length&&void 0!==m){for(var x=[],w=0;y>w;w++)x[w]=v[w];v=x}return[m,v]}},{120:120,22:22,26:26,27:27,29:29,33:33}],12:[function(t,e,r){var n=t(15),i=t(8),o=t(7);e.exports=function(t,e){return function(r,s,a){var c,u,h,l=a[0],p={values:a,optimizedPaths:[]},f=r._root.cache,d=r._path,m=f,v=d.length,g=[];if(v){if(e)return{criticalError:new o};if((m=n(r,d)).$type)return{criticalError:new i(d,d)};for(c=[],u=0;v>u;++u)c[u]=d[u]}else c=[],v=0;for(u=0,h=s.length;h>u;u++)t(r,f,m,s[u],0,l,p,g,c,v,e);return p}}},{15:15,7:7,8:8}],13:[function(t,e,r){var n=t(17),i=t(8);e.exports=function(t,e,r){var o,s,a,c,u,h=e,l=e;for(o=t._boxed,r=t._materialized,s=t._treatErrorsAsValues,t._boxed=!0,t._materialized=void 0===r||r,t._treatErrorsAsValues=!0,a=n(t,h.concat(null),!0),t._boxed=o,t._materialized=r,t._treatErrorsAsValues=s,h=a.optimizedPath,c=a.shorted,u=a.found,a=a.value;h.length&&null===h[h.length-1];)h.pop();if(u&&c)throw new i(l,h);return{path:h,value:a,shorted:c,found:u}}},{17:17,8:8}],14:[function(t,e,r){function n(t){var e,r,n,i={},o=Object.keys(t);for(r=0,n=o.length;n>r;r++)e=o[r],s(e)||(i[e]=t[e]);return i}function i(t,e,r){Object.keys(t).filter(function(e){return!s(e)&&t[e]}).forEach(function(r){var s=t[r],a=e[r];if(a||(a=e[r]={}),s.$type){var c,u=s.value&&"object"==typeof s.value,h=!t[o];return c=u||h?n(s):s.value,void(e[r]=c)}i(s,a,r)})}var o=t(37),s=t(97);e.exports=function(t){var e={};return i(t,e),e}},{37:37,97:97}],15:[function(t,e,r){e.exports=function(t,e){for(var r=t._root.cache,n=-1,i=e.length;++n<i&&r&&!r.$type;)r=r[e[n]];return r}},{}],16:[function(t,e,r){var n=t(64),i=t(134);e.exports=function(t){for(var e=i.fromPath(t),r=0,o=e.length;++r<o;)if("object"==typeof e[r])return new n(function(t){t.onError(new Error("Paths must be simple paths"))});var s=this;return new n(function(t){return s.get(e).subscribe(function(r){for(var n=r.json,i=-1,o=e.length;n&&++i<o;)n=n[e[i]];t.onNext(n)},function(e){t.onError(e)},function(){t.onCompleted()})})}},{134:134,64:64}],17:[function(t,e,r){var n=t(11),i=t(25),o=t(27),s=t(29).promote,a=t(120),c=t(118),u=t(119);e.exports=function(t,e,r){for(var h,l,p,f,d,m=t._root.cache,v=e.length,g=[],y=!1,b=!1,_=0,x=m,w=m,S=m,M=!0,E=!1;x&&v>_;){if(null!==(h=e[_++])&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if((p=x.$type)===c&&void 0===x.value){S=void 0,M=!1,y=v>_;break}if(v>_){if(p===a){if(o(x)){E=!0,S=void 0,M=!1;break}if(f=n(t,m,m,x,x.value),!(d=f[0])){S=void 0,x=void 0,M=!1;break}p=d.$type,x=d,g=f[1].slice(0)}if(p)break}else S=x;w=x}if(v>_&&!E){for(l=_;v>l;++l)if(null!==e[_]){b=!0;break}for(b?(y=!0,S=void 0):S=x,l=_;v>l;++l)null!==e[l]&&(g[g.length]=e[l])}if(S&&p&&(o(S)?S=void 0:s(t,S)),S&&p===u&&!t._treatErrorsAsValues)throw{path:_===v?e:e.slice(0,_),value:S.value};return S&&t._boxed?S=Boolean(p)&&!r?i(S):S:!S&&t._materialized?S={$type:c}:S&&(S=S.value),{value:S,shorted:y,optimizedPath:g,found:M}}},{11:11,118:118,119:119,120:120,25:25,27:27,29:29}],18:[function(t,e,r){var n=t(46);e.exports=function(t,e){var r=t._getValueSync({_boxed:!0,_root:t._root,_treatErrorsAsValues:t._treatErrorsAsValues},e,!0).value,i=r&&r[n];return null==i?-1:i}},{46:46}],19:[function(t,e,r){var n=t(12),i=t(31),o=n(i,!1),s=n(i,!0);e.exports={getValueSync:t(17),getBoundValue:t(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:s}},{12:12,13:13,17:17,31:31}],20:[function(t,e,r){var n=t(29),i=t(25),o=n.promote;e.exports=function(t,e,r,n,s){var a=e.value;s.errors||(s.errors=[]),t._boxed&&(a=i(e)),s.errors.push({path:n.slice(0,r+1),value:a}),o(t,e)}},{25:25,29:29}],21:[function(t,e,r){function n(t,e,r,n,i,o,s){s.requestedMissingPaths.push(n.slice(0,r).concat(e)),s.optimizedMissingPaths.push(i.slice(0,o).concat(e))}var i=t(30).fastCopy;e.exports=function(t,e,r,o,s,a,c){o.requestedMissingPaths||(o.requestedMissingPaths=[],o.optimizedMissingPaths=[]),n(0,r<e.length?i(e,r):[],r,s,a,c,o)}},{30:30}],22:[function(t,e,r){var n=t(29),i=t(25),o=n.promote,s=t(120),a=t(118),c=t(119),u=t(37);e.exports=function(t,e,r,n,h,l,p,f,d,m){if(r){var v,g,y,b,_,x,w,S,M=!1;if(e&&o(t,e),e&&void 0!==e.value||(M=t._materialized),M)S={$type:a};else if(t._boxed)S=i(e);else if(e.$type===s||e.$type===c)S=d?i(e):e.value;else if(d){var E=e.value&&"object"==typeof e.value,T=!e[u];S=E||T?i(e):e.value}else S=e.value;if(h&&(h.hasValue=!0),d){for((_=r.jsonGraph)||(_=r.jsonGraph={},r.paths=[]),v=0,g=f-1;g>v;v++)b=p[v],_[b]||(_[b]={}),_=_[b];_[b=p[v]]=M?{$type:a}:S,l&&r.paths.push(l.slice(0,n))}else if(0===n)r.json=S;else{for((_=r.json)||(_=r.json={}),v=0;n-1>v;v++)y=l[v],_[y]||(_[y]={}),x=_,w=y,_=_[y];null!==(y=l[v])?_[y]=S:x[w]=S}}}},{118:118,119:119,120:120,25:25,29:29,37:37}],23:[function(t,e,r){var n=t(27),i=t(26),o=t(29),s=i.remove,a=o.splice,c=t(119),u=t(20),h=t(22),l=t(21),p=t(28),f=t(35);e.exports=function(t,e,r,i,o,d,m,v,g,y,b){var _=e&&e.$type,x=e&&void 0===e.value;return e&&_?void(n(e)?(e[f]||(a(t,e),s(e)),l(t,r,i,d,m,v,g)):_===c?(b&&(m[i]=null),y||t._treatErrorsAsValues?h(t,e,o,i,d,m,v,g,y,b):u(t,e,i,m,d)):(b&&(m[i]=null),(!x||x&&t._materialized)&&h(t,e,o,i,d,m,v,g,y,b))):void(p(t)?h(t,e,o,i,d,m,v,g,y,b):l(t,r,i,d,m,v,g))}},{119:119,20:20,21:21,22:22,26:26,27:27,28:28,29:29,35:35}],24:[function(t,e,r){var n=t(134);e.exports=function(t){var e=n.fromPath(t);if(!1===Array.isArray(e))throw new Error("Model#getValueSync must be called with an Array path.");return this._path.length&&(e=this._path.concat(e)),this._syncCheck("getValueSync")&&this._getValueSync(this,e).value}},{134:134}],25:[function(t,e,r){var n=t(40);e.exports=function(t){var e,r,i,o=Object.keys(t);for(e={},r=0,i=o.length;i>r;r++){var s=o[r];s[0]!==n&&(e[s]=t[s])}return e}},{40:40}],26:[function(t,e,r){var n=t(43),i=t(33),o=t(42),s=t(44);e.exports={create:function(t,e){var r=e[s]||0;e[n+r]=t,e[s]=r+1,t[o]=r,t[i]=e},remove:function(t){var e=t[i];if(e){for(var r=t[o],a=e[s];a>r;)e[n+r]=e[n+r+1],++r;e[s]=a-1,t[i]=void 0,t[o]=void 0}}}},{33:33,42:42,43:43,44:44}],27:[function(t,e,r){var n=t(106);e.exports=function(t){var e=void 0===t.$expires&&-1||t.$expires;return-1!==e&&1!==e&&(0===e||e<n())}},{106:106}],28:[function(t,e,r){e.exports=function(t){return t._materialized&&!t._source}},{}],29:[function(t,e,r){var n=t(34),i=t(45),o=t(38),s=t(41),a=t(35);e.exports={promote:function(t,e){var r=t._root,i=r[n];if(i!==e){var a=e[s],c=e[o];c&&(c[s]=a),a&&(a[o]=c),e[s]=void 0,r[n]=e,e[o]=i,i[s]=e}},splice:function(t,e){var r=t._root,c=e[s],u=e[o];u&&(u[s]=c),c&&(c[o]=u),e[s]=void 0,e===r[n]&&(r[n]=void 0),e===r[i]&&(r[i]=void 0),e[a]=!0,r.expired.push(e)}}},{34:34,35:35,38:38,41:41,45:45}],30:[function(t,e,r){e.exports={fastCat:function(t,e){var r,n,i,o=[];for(r=0,n=t.length;n>r;r++)o[r]=t[r];for(i=0,n=e.length;n>i;i++)o[r++]=e[i];return o},fastCatSkipNulls:function(t,e){var r,n,i,o=[];for(r=0,n=t.length;n>r;r++)o[r]=t[r];for(i=0,n=e.length;n>i;i++)null!==e[i]&&(o[r++]=e[i]);return o},fastCopy:function(t,e){var r,n,i,o=[];for(n=0,i=e||0,r=t.length;r>i;n++,i++)o[n]=t[i];return o}}},{}],31:[function(t,e,r){var n=t(11),i=t(23),o=t(27),s=t(143).iterateKeySet,a=t(120),c=t(29).promote;e.exports=function t(e,r,u,h,l,p,f,d,m,v,g,y){var b=y,_=m;if(!u||u&&u.$type||l===h.length)i(e,u,h,l,p,f,d,_,v,g,b);else{var x,w,S=l+1,M=!1,E=x=h[l];if("object"==typeof x&&(M={},E=s(x,M)),void 0!==E||!M.done){var T=v+1;do{b=!1;var C;null===E?C=u:(C=u[E],_[v]=E,d[l]=E);var O=_,P=T;if(C){var A=C.$type,j=A&&C.value||C;if(S<h.length&&A&&A===a&&!o(C)){g&&i(e,C,h,S,p,f,null,_,P,g,b),c(e,C);var R=n(e,r,r,C,j,p,g);b=!0,C=R[0];var L=R[1];for(O=[],P=L.length,w=0;P>w;++w)O[w]=L[w]}}t(e,r,C,h,S,p,f,d,O,P,g,b),M&&!M.done&&(E=s(x,M))}while(M&&!M.done)}}}},{11:11,120:120,143:143,23:23,27:27,29:29}],32:[function(t,e,r){"use strict";function n(t){return new n.Model(t)}"function"==typeof Promise?n.Promise=Promise:n.Promise=t(151),e.exports=n,n.Model=t(2)},{151:151,2:2}],33:[function(t,e,r){e.exports=t(40)+"context"},{40:40}],34:[function(t,e,r){e.exports=t(40)+"head"},{40:40}],35:[function(t,e,r){e.exports=t(40)+"invalidated"},{40:40}],36:[function(t,e,r){e.exports=t(40)+"key"},{40:40}],37:[function(t,e,r){e.exports="$modelCreated"},{}],38:[function(t,e,r){e.exports=t(40)+"next"},{40:40}],39:[function(t,e,r){e.exports=t(40)+"parent"},{40:40}],40:[function(t,e,r){e.exports=String.fromCharCode(30)},{}],41:[function(t,e,r){e.exports=t(40)+"prev"},{40:40}],42:[function(t,e,r){e.exports=t(40)+"ref-index"},{40:40}],43:[function(t,e,r){e.exports=t(40)+"ref"},{40:40}],44:[function(t,e,r){e.exports=t(40)+"refs-length"},{40:40}],45:[function(t,e,r){e.exports=t(40)+"tail"},{40:40}],46:[function(t,e,r){e.exports=t(40)+"version"},{40:40}],47:[function(t,e,r){function n(t,e,r,i,s,a,u,h,l,p){if(!w(t)&&!t.$type)for(var f in t)if(f[0]!==c&&"$"!==f[0]&&y(t,f)){var d=t[f],m=b(d)&&!d.$type,v=o(r,i,s,f,d,m,!1,a,u,h,l,p),_=v[0],x=v[1];_&&(m?n(d,e+1,r,x,_,a,u,h,l,p):T(_,x,f,h)&&E(x,g(_),h,a))}}function i(t,e,r,n,i,s,c,l){if(_(r))return S(r,i,s),[void 0,e];v(s,r);var d=r,m=r.value,g=e;if(null!=(r=r[h]))g=r[u]||e;else{var y=0,b=m.length-1;g=r=e;do{var x=o(e,g,r,m[y],t,b>y,!0,n,i,s,c,l);if(r=x[0],w(r))return x;g=x[1]}while(y++<b);if(d[h]!==r){var M=r[f]||0;r[f]=M+1,r[a+M]=d,d[h]=r,d[p]=M}}return[r,g]}function o(t,e,r,n,o,a,c,u,h,l,p,f){for(var m=r.$type;m===d;){var v=i(o,t,r,u,h,l,p,f);if(r=v[0],w(r))return v;e=v[1],m=r&&r.$type}if(void 0!==m)return[r,e];if(null==n){if(a)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[s])}else e=r,r=e[n];return[r,e]}var s=t(36),a=t(43),c=t(40),u=t(39),h=t(33),l=t(46),p=t(42),f=t(44),d=t(120),m=t(13),v=t(50),g=t(88),y=t(91),b=t(100),_=t(95),x=t(96),w=t(102),S=t(86),M=t(92),E=t(115),T=t(109);e.exports=function(t,e){for(var r=t._root,i=r,o=r.expired,s=M(),a=r._comparator,c=r._errorSelector,h=t._path,p=r.cache,f=h.length?m(t,h).value:p,d=f[u]||p,v=p[l],g=-1,y=e.length;++g<y;)n(e[g].json,0,p,d,f,s,o,i,a,c);var b=p[l],_=r.onChange;x(_)&&v!==b&&_()}},{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(t,e,r){function n(t,e,r,i,s,a,c,u){var h={},l=e<t.length-1,p=t[e],f=x(p,h);do{var d=o(r,i,s,f,l,!1,a,c,u),m=d[0],g=d[1];m&&(l?n(t,e+1,r,g,m,a,c,u):M(m,g,f,u)&&S(g,v(m),u,a)),f=x(p,h)}while(!h.done)}function i(t,e,r,n,i){if(g(e))return _(e,n,i),[void 0,t];m(i,e);var s=e,h=e.value,f=t;if(null!=(e=e[u]))f=e[c]||t;else{var d=0,v=h.length-1;f=e=t;do{var y=o(t,f,e,h[d],v>d,!0,r,n,i);if(e=y[0],b(e))return y;f=y[1]}while(d++<v);if(s[u]!==e){var x=e[p]||0;e[p]=x+1,e[a+x]=s,s[u]=e,s[l]=x}}return[e,f]}function o(t,e,r,n,o,a,c,u,h){for(var l=r.$type;l===f;){var p=i(t,r,c,u,h);if(r=p[0],b(r))return p;e=p[1],l=r.$type}if(void 0!==l)return[r,e];if(null==n){if(o)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[s])}else e=r,r=e[n];return[r,e]}var s=t(36),a=t(43),c=t(39),u=t(33),h=t(46),l=t(42),p=t(44),f=t(120),d=t(13),m=t(50),v=t(88),g=t(95),y=t(96),b=t(102),_=t(86),x=t(143).iterateKeySet,w=t(92),S=t(115),M=t(109);e.exports=function(t,e){for(var r=t._root,i=r,o=r.expired,s=w(),a=t._path,u=r.cache,l=a.length?d(t,a).value:u,p=l[c]||u,f=u[h],m=-1,v=e.length;++m<v;)n(e[m],0,u,p,l,s,o,i);var g=u[h],b=r.onChange;y(b)&&f!==g&&b()}},{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(t,e,r){var n=t(36),i=t(39),o=t(34),s=t(45),a=t(38),c=t(41),u=t(108),h=t(115);e.exports=function(t,e,r,l,p,f){var d=r,m=p;"number"!=typeof m&&(m=.75);var v,g,y,b="number"==typeof f,_=l*m;for(g=e.pop();g;)y=g.$size||0,d-=y,!0===b?h(g,y,t,f):(v=g[i])&&u(g,v,g[n],t),g=e.pop();if(d>=l){var x=t[s];for(g=x;d>=_&&g;)x=x[c],y=g.$size||0,d-=y,!0===b&&h(g,y,t,f),g=x;t[s]=t[c]=g,null==g?t[o]=t[a]=void 0:g[a]=void 0}}},{108:108,115:115,34:34,36:36,38:38,39:39,41:41,45:45}],50:[function(t,e,r){var n=t(121),i=t(34),o=t(45),s=t(38),a=t(41),c=t(100);e.exports=function(t,e){if(c(e)&&e.$expires!==n){var r=t[i],u=t[o],h=e[s],l=e[a];e!==r&&(null!=h&&"object"==typeof h&&(h[a]=l),null!=l&&"object"==typeof l&&(l[s]=h),h=r,null!=r&&"object"==typeof r&&(r[a]=e),t[i]=t[s]=r=e,r[s]=h,r[a]=void 0),null!=u&&e!==u||(t[o]=t[a]=u=l||e)}return e}},{100:100,121:121,34:34,38:38,41:41,45:45}],51:[function(t,e,r){var n=t(34),i=t(45),o=t(38),s=t(41);e.exports=function(t,e){var r=t[n],a=t[i],c=e[o],u=e[s];null!=c&&"object"==typeof c&&(c[s]=u),null!=u&&"object"==typeof u&&(u[o]=c),e===r&&(t[n]=t[o]=c),e===a&&(t[i]=t[s]=u),e[o]=e[s]=void 0,r=a=c=u=void 0}},{34:34,38:38,41:41,45:45}],52:[function(t,e,r){function n(t,e){var r=!1;return function(){r||t._disposed||(r=!0,t._callbacks[e]=null,t._optimizedPaths[e]=[],t._requestedPaths[e]=[],0!==--t._count||t.sent||(t._disposable.dispose(),t.requestQueue.removeRequest(t)))}}function i(t){for(var e=[],r=-1,n=0,i=t.length;i>n;++n)for(var o=t[n],s=0,a=o.length;a>s;++s)e[++r]=o[s];return e}var o=t(59),s=t(60),a=0,c=t(57).GetRequest,u=t(76),h=t(78),l=t(119),p=[],f=function(t,e){this.sent=!1,this.scheduled=!1,this.requestQueue=e,this.id=++a,this.type=c,this._scheduler=t,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};f.prototype={batch:function(t,e,r){var i=this,o=i._optimizedPaths,a=i._requestedPaths,c=i._callbacks,u=o.length;return o[u]=e,a[u]=t,c[u]=r,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){s(i,o,function(t,e){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(a,t,e);for(var r=0,n=c.length;n>r;++r){var o=c[r];o&&o(t,e)}}})})),n(i,u)},add:function(t,e,r){var i,s,a=this,c=o(t,e,a._pathMap);c?(s=c[2],i=c[1]):(s=t,i=e);var u=!1,h=!1;if(i.length<e.length){u=!0;var l=a._callbacks.length;a._callbacks[l]=r,a._requestedPaths[l]=c[0],a._optimizedPaths[l]=[],++a._count,h=n(a,l)}return[u,s,i,h]},_merge:function(t,e,r){var n=this.requestQueue.model,o=n._root,s=o.errorSelector,a=o.comparator,c=n._path;n._path=p;var f=i(t);if(e){var d=e;d instanceof Error&&(d={message:d.message}),d.$type||(d={$type:l,value:d});var m=f.map(function(t){return{path:t,value:d}});h(n,m,null,s,a)}else u(n,[{paths:f,jsonGraph:r.jsonGraph}],null,s,a);n._path=c}},e.exports=f},{119:119,57:57,59:59,60:60,76:76,78:78}],53:[function(t,e,r){function n(){this.length=0,this.pending=!1,this.pathmaps=[],s.call(this,this._subscribe)}var i=t(159),o=i.Observer,s=i.Observable,a=i.Disposable,c=i.SerialDisposable,u=i.CompositeDisposable,h=t(9),l=t(143).iterateKeySet;n.create=function(t,e,r){var n=new this;return n.queue=t,n.model=e,n.index=r,n},(n.prototype=Object.create(s.prototype)).constructor=n,n.prototype.insertPath=function(t,e,r,n,i){var o=n||0,s=i||t.length-1,a=r||this.pathmaps[s+1]||(this.pathmaps[s+1]=Object.create(null));if(void 0===a||null===a)return!1;var c,u,h=t[o],p={};c=l(h,p);do{if(u=a[c],s>o){if(null==u){if(e)return!1;u=a[c]=Object.create(null)}if(!1===this.insertPath(t,e,u,o+1,s))return!1}else a[c]=(u||0)+1,this.length+=1;p.done||(c=l(h,p))}while(!p.done);return!0},n.prototype.removePath=function(t,e,r,n){var i=r||0,o=n||t.length-1,s=e||this.pathmaps[o+1];if(void 0===s||null===s)return!0;var a,c,u=0,h=t[i],p={};a=l(h,p);do{if(void 0!==(c=s[a])&&null!==c){if(o>i){u+=this.removePath(t,c,i+1,o);var f=void 0;for(f in c)break;void 0===f&&delete s[a]}else 0===(c=s[a]=(c||1)-1)&&delete s[a],u+=1,this.length-=1;p.done||(a=l(h,p))}}while(!p.done);return u},n.prototype.getSourceObserver=function(t){var e=this;return o.create(function(r){r.jsonGraph=r.jsonGraph||r.jsong||r.values||r.value,r.index=e.index,t.onNext(r)},function(e){t.onError(e)},function(){t.onCompleted()})},n.prototype._subscribe=function(t){var e=this,r=this.queue;e.pending=!0;var n=!1,i=new c,o=a.create(function(){n||(n=!0,r&&r._remove(e))}),s=new u(i,o);try{i.setDisposable(this.model._source[this.method](this.getSourceArgs()).subscribe(this.getSourceObserver(t)))}catch(t){throw new h(t)}return s},e.exports=n},{143:143,159:159,9:9}],54:[function(t,e,r){function n(t,e){this.total=0,this.model=t,this.requests=[],this.scheduler=e}var i=t(58),o=t(40),s=t(90),a=t(100),c=t(143);n.prototype.set=function(t){return t.paths=c.collapse(t.paths),i.create(this.model,t)},n.prototype._remove=function(t){var e=this.requests,r=e.indexOf(t);-1!==r&&e.splice(r,1)},n.prototype.distributePaths=function(t,e,r){var n,i,o=this.model,s=-1,a=t.length,c=-1,u=e.length,h=[];t:for(;++s<a;){var l=t[s];for(c=-1;++c<u;)if((i=e[c]).insertPath(l,i.pending)){h[c]=i;continue t}n||(n=r.create(this,o,this.total++),e[c]=n,h[u++]=n),n.insertPath(l,!1)}var p=[],f=-1;for(c=-1;++c<u;)null!=(i=h[c])&&(p[++f]=i);return p},n.prototype.mergeJSONGraphs=function(t,e){var r=0,n=[],i=[],c=[],u=t.index,h=e.index;t.index=Math.max(u,h),n[-1]=t.jsonGraph||{},i[-1]=e.jsonGraph||{};t:for(;r>-1;){for(var l=n[r-1],p=i[r-1],f=c[r-1]||(c[r-1]=Object.keys(p));f.length>0;){var d=f.pop();if(d[0]!==o)if(l.hasOwnProperty(d)){var m=l[d],v=s(m),g=p[d],y=s(g);if(a(m)&&a(g)&&!v&&!y){n[r]=m,i[r]=g,r+=1;continue t}h>u&&(l[d]=g)}else l[d]=p[d]}r-=1}return t},e.exports=n},{100:100,143:143,40:40,58:58,90:90}],55:[function(t,e,r){function n(t,e){this.model=t,this.scheduler=e,this.requests=this._requests=[]}var i=t(54),o=t(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,e.exports=n},{54:54,56:56}],56:[function(t,e,r){function n(t,e){this.model=t,this.scheduler=e,this.requests=this._requests=[]}var i=t(57),o=t(52);n.prototype={setScheduler:function(t){this.scheduler=t},get:function(t,e,r){function n(){m||0==--l&&r()}var s,a,c,u=this,h=[],l=0,p=u._requests,f=e,d=t,m=!1;for(s=0,a=p.length;a>s;++s)if((c=p[s]).type===i.GetRequest){if(c.sent){var v=c.add(d,f,n);v[0]&&(d=v[1],f=v[2],h[h.length]=v[3],++l)}else c.batch(d,f,n),f=[],d=[],++l;if(!f.length)break}if(f.length){c=new o(u.scheduler,u),p[p.length]=c,++l;var g=c.batch(d,f,n);h[h.length]=g}return function(){if(!m&&0!==l){m=!0;for(var t=h.length,e=0;t>e;++e)h[e]()}}},removeRequest:function(t){for(var e=this._requests,r=e.length;--r>=0;)if(e[r].id===t.id){e.splice(r,1);break}}},e.exports=n},{52:52,57:57}],57:[function(t,e,r){e.exports={GetRequest:"GET"}},{}],58:[function(t,e,r){function n(){o.call(this)}var i=t(159).Observer,o=t(53),s=t(83),a=t(76),c=t(78),u=new Array(0);n.create=function(t,e){var r=new n;return r.model=t,r.jsonGraphEnvelope=e,r},(n.prototype=Object.create(o.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(t){var e=this.model,r=e._path,n=this.jsonGraphEnvelope.paths,h=e._root,l=h.errorSelector,p=h.comparator;return o.prototype.getSourceObserver.call(this,i.create(function(i){e._path=u;var o=a(e,[{paths:n,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],e._path=r,t.onNext(i)},function(i){e._path=u,c(e,s(n,function(t){return{path:t,value:i}}),null,l,p),e._path=r,t.onError(i)},function(){t.onCompleted()}))},e.exports=n},{159:159,53:53,76:76,78:78,83:83}],59:[function(t,e,r){var n=t(143).hasIntersection,i=t(84);e.exports=function(t,e,r){for(var o=[],s=[],a=[],c=-1,u=-1,h=!1,l=0,p=e.length;p>l;++l){var f=e[l],d=r[f.length];d&&n(d,f,0)?(!h&&l>0&&(s=i(t,0,l),o=i(e,0,l)),a[++c]=t[l],h=!0):h&&(o[++u]=f,s[u]=t[l])}return h?[a,o,s]:null}},{143:143,84:84}],60:[function(t,e,r){var n=t(143),i=n.toTree,o=n.toPaths;e.exports=function(t,e,r){if(0!==t._count){t.sent=!0,t.scheduled=!1;for(var n=t._pathMap,s=0,a=Object.keys(e).length;a>s;++s)for(var c=e[s],u=0,h=c.length;h>u;++u){var l=c[u],p=l.length;if(n[p]){var f=n[p];f[f.length]=l}else n[p]=[l]}for(var d=Object.keys(n),m=0,v=d.length;v>m;++m){var g=d[m];n[g]=i(n[g])}var y,b=t._collasped=o(n);t.requestQueue.model._source.get(b).subscribe(function(t){y=t},function(t){r(t,y)},function(){r(null,y)})}else t.requestQueue.removeRequest(t)}},{143:143}],61:[function(t,e,r){function n(t){a.call(this,t||o)}function i(t){return s.Observable.defer(function(){return t})}function o(t){function e(t){return b.concat(t)}var r=this.args,n=this.model,o=l.fromPath(r[0]),u=r[1]||[],f=(r[2]||[]).map(l.fromPath),d=(r[3]||[]).map(l.fromPath),m=n._clone({_path:[]}),v=m.withoutDataSource(),g=n._path,y=g.concat(o),b=y.slice(0,-1),_=i(n.withoutDataSource().get(o)).map(function(t){for(var e=t.json,r=-1,n=o.length;e&&++r<n;)e=e[o[r]];return{model:m._derefSync(b).boxValues(),localFn:e}}).flatMap(function(t){function r(t,e){var r=e.path;return t.push.apply(t,f.map(function(t){return r.concat(t)})),t}function n(t){return t.path}var o=t&&t.localFn;if("function"==typeof o){var s=t.model,c=s._path,h=o.apply(s,u).reduce(function(t,r){if(Boolean(r.invalidated))t.invalidations.push(t.localThisPath.concat(r.path));else{var n=r.path,i=r.value;Boolean(i)&&"object"==typeof i&&i.$type===p?t.references.push({path:e(n),value:r.value}):t.values.push({path:e(n),value:r.value})}return t},{values:[],references:[],invalidations:[],localThisPath:c}).flatMap(function(t){var e=t.values.concat(t.references);return e.length>0?i(v.set.apply(v,e)._toJSONG()).map(function(e){return{results:t,envelope:e}}):a.return({results:t,envelope:{jsonGraph:{},paths:[]}})}).flatMap(function(t){var o=t.envelope,s=t.results,c=s.values,u=s.references,h=s.invalidations,l=c.map(n).map(e),p=u.reduce(r,[]),f=d.map(e),v=p.concat(f);return(v.length>0?i(m.get.apply(m,l.concat(v))._toJSONG()):a.return(o)).doAction(function(t){t.invalidated=h})});return a.return(h)}return a.empty()}).defaultIfEmpty(function(t){return t&&"object"==typeof t?s.Observable.defer(function(){var e;try{e=t.call(y,u,f,d)}catch(t){e=a.throw(new h(t))}return e}).map(function(t){var e=t.invalidated;return e&&e.length&&m.invalidate.apply(m,e),t}):a.empty()}(n._source)).mergeAll().flatMap(function(t){return i(v.set(t)).reduce(function(t){return t},null).map(function(){return{invalidated:t.invalidated,paths:t.paths.map(function(t){return t.slice(g.length)})}})}),x=new c;return x.add(_.subscribe(function(e){var r=e.paths,o=e.invalidated,s=n.get.apply(n,r);"AsJSONG"===t.outputFormat&&(s=i(s._toJSONG()).doAction(function(t){t.invalidated=o})),x.add(s.subscribe(t))},function(e){t.onError(e)})),x}var s=t(159)&&t(158),a=s.Observable,c=s.CompositeDisposable,u=t(64),h=t(9),l=t(134),p=t(120);n.create=u.create,(n.prototype=Object.create(a.prototype)).constructor=n,n.prototype.invokeSourceRequest=function(t){return this},n.prototype.ensureCollect=function(t){return this},n.prototype.initialize=function(){return this},e.exports=n},{120:120,134:134,158:158,159:159,64:64,9:9}],62:[function(t,e,r){function n(t){i.call(this,t)}var i=t(159).Observable,o=t(64),s=t(134),a=t(88),c=t(49),u=t(81),h=t(46),l=Array.isArray,p=t(101),f=t(98),d=t(99);n.create=o.create,(n.prototype=Object.create(i.prototype)).constructor=n,n.prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var t,e,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],a=[],c=this.args,h=-1,m=c.length;++h<m;){var v,g=c[h];l(g)||"string"==typeof g?(g=s.fromPath(g),v="PathValues"):p(g)?(g.path=s.fromPath(g.path),v="PathValues"):d(g)?v="JSONGs":f(g)&&(v="PathMaps"),e!==v&&(e=v,t={inputType:v,arguments:[]},a.push(t),t.values=o),t.arguments.push(g)}return this.boundPath=u(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(t){return this},n.prototype.ensureCollect=function(t){var e=this.finally(function(){var e=t._root,r=e.cache;e.collectionScheduler.schedule(function(){c(e,e.expired,a(r),t._maxSize,t._collectRatio,r[h])})});return new this.constructor(function(t){return e.subscribe(t)})},e.exports=n},{101:101,134:134,159:159,46:46,49:49,64:64,81:81,88:88,98:98,99:99}],63:[function(t,e,r){function n(t){s.call(this,t||i)}function i(t){for(var e=this.model,r=this.method,n=this.groups,i=-1,s=n.length;++i<s;){var a=n[i],c=a.inputType,u=a.arguments;u.length>0&&(0,e["_"+r+c+"AsJSON"])(e,u)}return t.onCompleted(),o.empty}var o=t(159).Disposable,s=t(62);n.create=s.create,(n.prototype=Object.create(s.prototype)).method="invalidate",n.prototype.constructor=n,e.exports=n},{159:159,62:62}],64:[function(t,e,r){function n(t){this._subscribe=t}function i(t){var e=this.model,r=new this.type;return r.model=e,r.args=this.args,r.outputFormat=t.outputFormat||"AsPathMap",r.isProgressive=t.isProgressive||!1,r.subscribeCount=0,r.subscribeLimit=t.retryLimit||10,r.initialize().invokeSourceRequest(e).ensureCollect(e).subscribe(t)}var o=t(32),s=(t(159)&&t(158)).Observable,a=t(84),c=t(105),u={outputFormat:{value:"AsJSONG"}},h={isProgressive:{value:!0}};n.create=function(t,e){var r=new n(i);return r.args=e,r.type=this,r.model=t,r},(n.prototype=Object.create(s.prototype)).constructor=n,n.prototype._mixin=function(){var t=this,e=a(arguments);return new t.constructor(function(r){return t.subscribe(e.reduce(function(t,e){return Object.create(t,e)},r))})},n.prototype._toJSONG=function(){return this._mixin(u)},n.prototype.progressively=function(){return this._mixin(h)},n.prototype.subscribe=function(t,e,r){var n=t;n&&"object"==typeof n||(n={onNext:t||c,onError:e||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(t,e){var r=this;return new o.Promise(function(t,e){var n,i=!1;r.toArray().subscribe(function(t){n=t.length<=1?t[0]:t},function(t){i=!0,e(t)},function(){!1===i&&t(n)})}).then(t,e)},e.exports=n},{105:105,158:158,159:159,32:32,84:84}],65:[function(t,e,r){function n(t){f.call(this,t||i)}function i(t){return this.isCompleted?s.call(this,t):o.call(this,t)}function o(t){if(this.subscribeCount++>this.subscribeLimit)return t.onError("Loop kill switch thrown."),l.empty;for(var e=[],r=[],n=this.model,i=this.isMaster,o=n._root,u=this.outputFormat,h=o.errorSelector,p=this.method,f=this.groups,d=-1,v=f.length;++d<v;){var g=f[d],y=g.inputType,b=g.arguments;if(b.length>0){var _=(0,n["_"+p+y+u])(n,b,null,h);r.push.apply(r,_[1]),"PathValues"===y?e.push.apply(e,b.map(a)):"JSONGs"===y?e.push.apply(e,m(b,c)):e.push.apply(e,_[0])}}return this.requestedPaths=e,i?(this.isCompleted=!0,s.call(this,t)):void t.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}function s(t){var e=new p(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(e=e._toJSONG()),this.isProgressive&&(e=e.progressively()),e.subscribe(t)}function a(t){return t.path}function c(t){return t.paths}var u=t(159),h=u.Observable,l=u.Disposable,p=t(67),f=t(62),d=t(9),m=t(82),v=new Array(0);n.create=f.create,(n.prototype=Object.create(f.prototype)).method="set",n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(t){var e=this,r=this.catch(function(n){var i;if(n&&!0===n.invokeSourceRequest){var o={},s=t._path,a=n.optimizedPaths;t._path=v,t._getPathValuesAsJSONG(t._materialize().withoutDataSource(),a,[o]),t._path=s,i=t._request.set(o).do(function(t){e.isCompleted=a.length===t.paths.length},function(){e.isCompleted=!0}).materialize().flatMap(function(t){if("C"===t.kind)return h.empty();if("E"===t.kind){var e=t.exception;if(d.is(e))return h.throw(t.exception)}return r})}else i=h.throw(n);return i});return new this.constructor(function(t){return r.subscribe(t)})},e.exports=n},{159:159,62:62,67:67,82:82,9:9}],66:[function(t,e,r){var n=function(t){this.disposed=!1,this.currentDisposable=t};n.prototype={dispose:function(){if(!this.disposed&&this.currentDisposable){this.disposed=!0;var t=this.currentDisposable;t.dispose?t.dispose():t()}}},e.exports=n},{}],67:[function(t,e,r){var n=t(64),i=t(68),o=t(69),s={dispose:function(){}},a=t(159).Observable,c=e.exports=function(t,e,r,n){this.model=t,this.currentRemainingPaths=e,this.isJSONGraph=r||!1,this.isProgressive=n||!1};c.prototype=Object.create(a.prototype),c.prototype.subscribe=n.prototype.subscribe,c.prototype.then=n.prototype.then,c.prototype._toJSONG=function(){return new c(this.model,this.currentRemainingPaths,!0,this.isProgressive)},c.prototype.progressively=function(){return new c(this.model,this.currentRemainingPaths,this.isJSONGraph,!0)},c.prototype._subscribe=function(t){var e=[{}],r=[],n=t.isJSONG=this.isJSONGraph,a=this.isProgressive,c=i(this.model,this.currentRemainingPaths,t,a,n,e,r);return c?o(this,this.model,c,t,e,r,1):s}},{159:159,64:64,68:68,69:69}],68:[function(t,e,r){var n=t(19),i=n.getWithPathsAsJSONGraph,o=n.getWithPathsAsPathMap;e.exports=function(t,e,r,n,s,a,c){var u;if((u=s?i(t,e,a):o(t,e,a)).criticalError)return r.onError(u.criticalError),null;var h=u.hasValue,l=!u.requestedMissingPaths||!t._source,p=a[0].json||a[0].jsonGraph;if(u.errors)for(var f=u.errors,d=c.length,m=0,v=f.length;v>m;++m,++d)c[d]=f[m];if(h&&n||p&&l)try{++t._root.syncRefCount,r.onNext(a[0])}catch(t){throw t}finally{--t._root.syncRefCount}return l?(c.length?r.onError(c):r.onCompleted(),null):u}},{19:19}],69:[function(t,e,r){var n=t(68),i=t(10),o=t(30).fastCat,s=t(49),a=t(88),c=t(66),u=t(46);e.exports=function t(e,r,h,l,p,f,d){if(10===d)throw new i;var m=r._request,v=h.requestedMissingPaths,g=h.optimizedMissingPaths,y=new c,b=[],_=r._path;if(_.length)for(var x=0,w=v.length;w>x;++x)b[x]=o(_,v[x]);else b=v;var S=m.get(b,g,function(){var i=n(r,v,l,e.isProgressive,e.isJSONGraph,p,f);if(i)y.currentDisposable=t(e,r,i,l,p,f,d+1);else{var o=r._root,c=o.cache,h=c[u];s(o,o.expired,a(c),r._maxSize,r._collectRatio,h)}});return y.currentDisposable=S,y}},{10:10,30:30,46:46,49:49,66:66,68:68,88:88}],70:[function(t,e,r){var n=t(67);e.exports=function(t){return new n(this,t)}},{67:67}],71:[function(t,e,r){var n=t(134),i=t(64),o=t(72),s=t(116),a=t(67);e.exports=function(){var t=s(arguments,o,"get");if(!0!==t)return new i(function(e){e.onError(t)});var e=n.fromPathsOrPathValues(arguments);return new a(this,e)}},{116:116,134:134,64:64,67:67,72:72}],72:[function(t,e,r){e.exports={path:!0,pathSyntax:!0}},{}],73:[function(t,e,r){function n(){}var i=t(123),o=t(159).Disposable;n.prototype.schedule=function(t){return i(t),o.empty},n.prototype.scheduleWithState=function(t,e){var r=this;return i(function(){e(r,t)}),o.empty},e.exports=n},{123:123,159:159}],74:[function(t,e,r){function n(){}var i=t(159).Disposable;n.prototype.schedule=function(t){return t(),i.empty},n.prototype.scheduleWithState=function(t,e){return e(this,t),i.empty},e.exports=n},{159:159}],75:[function(t,e,r){function n(t){this.delay=t}var i=t(159).Disposable;n.prototype.schedule=function(t){var e=setTimeout(t,this.delay);return i.create(function(){void 0!==e&&(clearTimeout(e),e=void 0)})},n.prototype.scheduleWithState=function(t,e){var r=this,n=setTimeout(function(){e(r,t)},this.delay);return i.create(function(){void 0!==n&&(clearTimeout(n),n=void 0)})},e.exports=n},{159:159}],76:[function(t,e,r){function n(t,e,r,i,s,a,c,u,h,l,p,d,m,v,g,b,_){for(var x={},w=e<t.length-1,S=t[e],M=y(S,x),E=d.index;;){p.depth=e;var T=o(r,i,s,a,c,u,M,w,!1,p,d,m,v,g,b,_);p[e]=M,p.index=e,d[d.index++]=M;var C=T[0],O=T[1];if(C&&(w?n(t,e+1,r,O,C,a,T[3],T[2],h,l,p,d,m,v,g,b,_):(f(g,C),h.push(p.slice(0,p.index+1)),l.push(d.slice(0,d.index)))),M=y(S,x),x.done)break;d.index=E}}function i(t,e,r,n,i,s,u,p,m,y,b){var _=e.value;if(s.splice(0,s.length),s.push.apply(s,_),d(e))return s.index=_.length,g(e,p,m),[void 0,t,n,r];f(m,e);var x=0,w=e,S=_.length-1,M=e=t,E=n=r;do{var T=o(t,M,e,r,E,n,_[x],S>x,!0,i,s,u,p,m,y,b);if(e=T[0],v(e))return s.index=x,T;M=T[1],n=T[2],E=T[3]}while(x++<S);if(s.index=x,w[c]!==e){var C=e[l]||0;e[l]=C+1,e[a+C]=w,w[c]=e,w[h]=C}return[e,M,n,E]}function o(t,e,r,n,o,a,c,u,h,l,f,d,m,g,y,b){for(var x=r.$type;x===p;){var w=i(t,r,n,a,l,f,d,m,g,y,b);if(r=w[0],v(r))return w;e=w[1],a=w[2],o=w[3],x=r.$type}if(void 0!==x)return[r,e,a,o];if(null==c){if(u)throw new Error("`null` is not allowed in branch key positions.");r&&(c=r[s])}else e=r,o=a,r=e[c],a=o&&o[c];return r=_(e,r,a,c,l,f,d,m,g,y,b),[r,e,a,o]}var s=t(36),a=t(43),c=t(33),u=t(46),h=t(42),l=t(44),p=t(120),f=t(50),d=t(94),m=t(96),v=t(102),g=t(86),y=t(143).iterateKeySet,b=t(92),_=t(103);e.exports=function(t,e,r,i,o){for(var s=t._root,a=s,c=s.expired,h=b(),l=s.cache,p=l[u],f=[],d=[],v=[],g=[],y=-1,_=e.length;++y<_;)for(var x=e[y],w=x.paths,S=x.jsonGraph,M=-1,E=w.length;++M<E;){var T=w[M];d.index=0,n(T,0,l,l,l,S,S,S,v,g,f,d,h,c,a,o,i)}var C=l[u],O=s.onChange;return m(O)&&p!==C&&O(),[v,g]}},{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(t,e,r){function n(t,e,r,i,a,c,u,h,l,p,f,d,m,v){var g=s(t);if(g&&g.length)for(var b=0,x=g.length,w=l.index;;){var S=g[b],M=t[S],E=_(M)&&!M.$type;h.depth=e;var T=o(r,i,a,S,M,E,!1,h,l,p,f,d,m,v);h[e]=S,h.index=e,l[l.index++]=S;var C=T[0],O=T[1];if(C&&(E?n(M,e+1,r,O,C,c,u,h,l,p,f,d,m,v):(y(d,C),c.push(h.slice(0,h.index+1)),u.push(l.slice(0,l.index)))),++b>=x)break;l.index=w}}function i(t,e,r,n,i,s,a,u,p,m){var v=r.value;if(i.splice(0,i.length),i.push.apply(i,v),x(r))return i.index=v.length,M(r,a,u),[void 0,e];y(u,r);var g=r,b=e;if(null!=(r=r[l]))b=r[h]||e,i.index=v.length;else{var _=0,w=v.length-1;b=r=e;do{var E=o(e,b,r,v[_],t,w>_,!0,n,i,s,a,u,p,m);if(r=E[0],S(r))return i.index=_,E;b=E[1]}while(_++<w);if(i.index=_,g[l]!==r){var T=r[d]||0;r[d]=T+1,r[c+T]=g,g[l]=r,g[f]=T}}return[r,b]}function o(t,e,r,n,o,s,c,u,h,l,p,f,d,v){for(var g=r.$type;g===m;){var y=i(o,t,r,u,h,l,p,f,d,v);if(r=y[0],S(r))return y;e=y[1],g=r&&r.$type}if(void 0!==g)return[r,e];if(null==n){if(s)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[a])}else e=r,r=e[n];return r=T(e,r,n,o,s,c,u,h,l,p,f,d,v),[r,e]}function s(t){if(_(t)&&!t.$type){var e=[],r=0;g(t)&&(e[r++]="length");for(var n in t)n[0]!==u&&"$"!==n[0]&&b(t,n)&&(e[r++]=n);return e}}var a=t(36),c=t(43),u=t(40),h=t(39),l=t(33),p=t(46),f=t(42),d=t(44),m=t(120),v=t(13),g=Array.isArray,y=t(50),b=t(91),_=t(100),x=t(95),w=t(96),S=t(102),M=t(86),E=t(92),T=t(104);e.exports=function(t,e,r,i,o){for(var s=t._root,a=s,c=s.expired,u=E(),l=t._path,f=s.cache,d=l.length?v(t,l).value:f,m=d[h]||f,g=f[p],y=[],b=[],_=[],x=l.length,S=-1,M=e.length;++S<M;){var T=e[S],C=l.slice(0);C.index=x,n(T.json,0,f,m,d,b,_,y,C,u,c,a,o,i)}var O=f[p],P=s.onChange;return w(P)&&g!==O&&P(),[b,_]}},{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(t,e,r){function n(t,e,r,i,s,a,c,u,h,l,p,f,d,v,g){for(var y={},b=r<e.length-1,x=e[r],w=_(x,y),S=l.index;;){h.depth=r;var M=o(i,s,a,w,t,b,!1,h,l,p,f,d,v,g);h[r]=w,h.index=r,l[l.index++]=w;var E=M[0],T=M[1];if(E&&(b?n(t,e,r+1,i,T,E,c,u,h,l,p,f,d,v,g):(m(d,E),c.push(h.slice(0,h.index+1)),u.push(l.slice(0,l.index)))),w=_(x,y),y.done)break;l.index=S}}function i(t,e,r,n,i,s,h,f,d,g){var _=r.value;if(i.splice(0,i.length),i.push.apply(i,_),v(r))return i.index=_.length,b(r,h,f),[void 0,e];m(f,r);var x=r,w=e;if(null!=(r=r[u]))w=r[c]||e,i.index=_.length;else{var S=0,M=_.length-1;w=r=e;do{var E=o(e,w,r,_[S],t,M>S,!0,n,i,s,h,f,d,g);if(r=E[0],y(r))return i.index=S,E;w=E[1]}while(S++<M);if(i.index=S,x[u]!==r){var T=r[p]||0;r[p]=T+1,r[a+T]=x,x[u]=r,x[l]=T}}return[r,w]}function o(t,e,r,n,o,a,c,u,h,l,p,d,m,v){for(var g=r.$type;g===f;){var b=i(o,t,r,u,h,l,p,d,m,v);if(r=b[0],y(r))return b;e=b[1],g=r.$type}if(void 0!==g)return[r,e];if(null==n){if(a)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[s])}else e=r,r=e[n];return r=w(e,r,n,o,a,c,u,h,l,p,d,m,v),[r,e]}var s=t(36),a=t(43),c=t(39),u=t(33),h=t(46),l=t(42),p=t(44),f=t(120),d=t(13),m=t(50),v=t(95),g=t(96),y=t(102),b=t(86),_=t(143).iterateKeySet,x=t(92),w=t(104);e.exports=function(t,e,r,i,o){for(var s=t._root,a=s,u=s.expired,l=x(),p=t._path,f=s.cache,m=p.length?d(t,p).value:f,v=m[c]||f,y=f[h],b=[],_=[],w=[],S=p.length,M=-1,E=e.length;++M<E;){var T=e[M],C=T.path,O=T.value,P=p.slice(0);P.index=S,n(O,C,0,f,v,m,_,w,b,P,l,u,a,o,i)}var A=f[h],j=s.onChange;return g(j)&&y!==A&&j(),[_,w]}},{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(t,e,r){var n=t(130),i=t(64),o=t(101);e.exports=function(t,e){for(var r=o(t)?t:n.pathValue(t,e),s=0,a=r.path,c=a.length;++s<c;)if("object"==typeof a[s])return new i(function(t){t.onError(new Error("Paths must be simple paths"))});var u=this;return new i(function(t){return u._set(r).subscribe(function(e){for(var r=e.json,n=-1,i=a.length;r&&++n<i;)r=r[a[n]];t.onNext(r)},function(e){t.onError(e)},function(){t.onCompleted()})})}},{101:101,130:130,64:64}],80:[function(t,e,r){var n=t(134),i=t(101),o=t(78);e.exports=function(t,e,r,s){var a=n.fromPath(t),c=e,u=r,h=s;if(i(a)?(h=u,u=c,c=a):c={path:a,value:c},!1===i(c))throw new Error("Model#setValueSync must be called with an Array path.");return"function"!=typeof u&&(u=this._root._errorSelector),"function"!=typeof h&&(h=this._root._comparator),this._syncCheck("setValueSync")?(o(this,[c]),this._getValueSync(this,c.path).value):void 0}},{101:101,134:134,78:78}],81:[function(t,e,r){e.exports=function(t){if(!t)return t;for(var e=-1,r=t.length,n=[];++e<r;)n[e]=t[e];return n}},{}],82:[function(t,e,r){e.exports=function(t,e){for(var r=-1,n=-1,i=t.length,o=[];++n<i;)for(var s=e(t[n],n,t),a=-1,c=s.length;++a<c;)o[++r]=s[a];return o}},{}],83:[function(t,e,r){e.exports=function(t,e){for(var r=-1,n=t.length,i=new Array(n);++r<n;)i[r]=e(t[r],r,t);return i}},{}],84:[function(t,e,r){e.exports=function(t,e,r){var n=e||0,i=-1,o=t.length-n;0>o&&(o=0),r>0&&o>r&&(o=r);for(var s=new Array(o);++i<o;)s[i]=t[i+n];return s}},{}],85:[function(t,e,r){var n=t(40),i=t(91),o=Array.isArray,s=t(100);e.exports=function(t){var e=t;if(s(e)){e=o(t)?[]:{};var r=t;for(var a in r)a[0]!==n&&i(r,a)&&(e[a]=r[a])}return e}},{100:100,40:40,91:91}],86:[function(t,e,r){var n=t(51),i=t(35);e.exports=function(t,e,r){return t[i]||(t[i]=!0,e.push(t),n(r,t)),t}},{35:35,51:51}],87:[function(t,e,r){var n=t(100);e.exports=function(t){return n(t)&&t.$expires||void 0}},{100:100}],88:[function(t,e,r){var n=t(100);e.exports=function(t){return n(t)&&t.$size||0}},{100:100}],89:[function(t,e,r){var n=t(100);e.exports=function(t){return n(t)&&t.$timestamp||void 0}},{100:100}],90:[function(t,e,r){var n=t(100);e.exports=function(t,e){var r=n(t)&&t.$type||void 0;return e&&r?"branch":r}},{100:100}],91:[function(t,e,r){var n=t(100),i=Object.prototype.hasOwnProperty;e.exports=function(t,e){return n(t)&&i.call(t,e)}},{100:100}],92:[function(t,e,r){var n=1;e.exports=function(){return n++}},{}],93:[function(t,e,r){var n=t(36),i=t(39),o=t(46);e.exports=function(t,e,r,s){return t[n]=r,t[i]=e,t[o]=s,e[r]=t,t}},{36:36,39:39,46:46}],94:[function(t,e,r){var n=t(106),i=t(122),o=t(121);e.exports=function(t){var e=t.$expires;return null!=e&&e!==o&&e!==i&&e<n()}},{106:106,121:121,122:122}],95:[function(t,e,r){var n=t(106),i=t(122),o=t(121);e.exports=function(t){var e=t.$expires;return null!=e&&e!==o&&(e===i||e<n())}},{106:106,121:121,122:122}],96:[function(t,e,r){e.exports=function(t){return Boolean(t)&&"function"==typeof t}},{}],97:[function(t,e,r){var n=t(40);e.exports=function(t){return"$size"===t||t&&t.charAt(0)===n}},{40:40}],98:[function(t,e,r){var n=t(100);e.exports=function(t){return n(t)&&"json"in t}},{100:100}],99:[function(t,e,r){var n=Array.isArray,i=t(100);e.exports=function(t){return i(t)&&n(t.paths)&&(i(t.jsonGraph)||i(t.jsong)||i(t.json)||i(t.values)||i(t.value))}},{100:100}],100:[function(t,e,r){e.exports=function(t){return null!==t&&"object"==typeof t}},{}],101:[function(t,e,r){var n=Array.isArray,i=t(100);e.exports=function(t){return i(t)&&(n(t.path)||"string"==typeof t.path)}},{100:100}],102:[function(t,e,r){e.exports=function(t){return null==t||"object"!=typeof t}},{}],103:[function(t,e,r){var n=t(36),i=t(39),o=t(120),s=t(119),a=t(88),c=t(89),u=t(100),h=t(95),l=t(96),p=t(50),f=t(117),d=t(93),m=t(86),v=t(110),g=t(115),y=t(107);e.exports=function(t,e,r,b,_,x,w,S,M,E,T){var C,O,P,A,j,R,L;if(e===r){if(null===r)return e=f(r,void 0,r),t=g(t,-e.$size,M,w),e=d(e,t,b),p(M,e),e;if(void 0===r)return r;if((A=u(e))&&null==(O=e.$type))return null==e[i]&&(e[n]=b,e[i]=t),e}else(A=u(e))&&(O=e.$type);if(O!==o){if((j=u(r))&&(P=r.$type),A&&!O&&(null==r||j&&!P))return e}else{if(null==r)return h(e)?void m(e,S,M):e;if((j=u(r))&&(P=r.$type)===o)if(e===r){if(null!=e[i])return e}else if(R=e.$timestamp,L=r.$timestamp,!h(e)&&!h(r)&&R>L)return}if(O&&j&&!P)return d(v(e,r,t,b,M),t,b);if(P||!j){if(P===s&&l(T)&&(r=T(y(_,b),r)),P&&e===r)null==e[i]&&(e=f(e,O,e.value),t=g(t,-e.$size,M,w),e=d(e,t,b,w));else{var N=!0;!O&&A||(N=c(r)<c(e)==0,(O||P)&&l(E)&&(N=!E(e,r,x.slice(0,x.index)))),N&&(r=f(r,P,P?r.value:r),C=a(e)-a(r),e=v(e,r,t,b,M),t=g(t,C,M,w),e=d(e,t,b,w))}h(e)?m(e,S,M):p(M,e)}else null==e&&(e=d(r,t,b));return e}},{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(t,e,r){var n=t(120),i=t(119),o=t(90),s=t(88),a=t(89),c=t(95),u=t(102),h=t(96),l=t(117),p=t(86),f=t(93),d=t(110),m=t(115),v=t(114),g=t(107);e.exports=function(t,e,r,y,b,_,x,w,S,M,E,T,C){var O=o(e,_);if(b||_)O&&c(e)&&(O="expired",p(e,M,E)),(O&&O!==n||u(e))&&(e=d(e,{},t,r,E),e=f(e,t,r,S),e=v(e,S));else{var P=y,A=o(P),j=a(P)<a(e)==0;if((O||A)&&h(T)&&(j=!T(e,P,w.slice(0,w.index))),j){A===i&&h(C)&&(P=C(g(x,r),P)),P=l(P,A,A?P.value:P);var R=s(e)-s(P);e=d(e,P,t,r,E),t=m(t,R,E,S),e=f(e,t,r,S)}}return e}},{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(t,e,r){e.exports=function(){}},{}],106:[function(t,e,r){e.exports=Date.now},{}],107:[function(t,e,r){e.exports=function(t,e){var r=t.slice(0,t.depth);return r[r.length]=e,r}},{}],108:[function(t,e,r){var n=t(120),i=t(39),o=t(51),s=t(100),a=t(112),c=t(113);e.exports=function(t,e,r,u){if(s(t)){var h=t.$type;return Boolean(h)&&(h===n&&c(t),o(u,t)),a(t),e[r]=t[i]=void 0,!0}return!1}},{100:100,112:112,113:113,120:120,39:39,51:51}],109:[function(t,e,r){var n=t(91),i=t(40),o=t(108);e.exports=function t(e,r,s,a){if(o(e,r,s,a)){if(null==e.$type)for(var c in e)c[0]!==i&&"$"!==c[0]&&n(e,c)&&t(e[c],e,c,a);return!0}return!1}},{108:108,40:40,91:91}],110:[function(t,e,r){var n=t(100),i=t(111),o=t(109);e.exports=function(t,e,r,s,a){return t===e?t:(n(t)&&(i(t,e),o(t,r,s,a)),r[s]=e,e)}},{100:100,109:109,111:111}],111:[function(t,e,r){var n=t(43),i=t(33),o=t(44);e.exports=function(t,e){for(var r=t[o]||0,s=e[o]||0,a=-1;++a<r;){var c=t[n+a];void 0!==c&&(c[i]=e,e[n+(s+a)]=c,t[n+a]=void 0)}return e[o]=r+s,t[o]=void 0,e}},{33:33,43:43,44:44}],112:[function(t,e,r){var n=t(43),i=t(33),o=t(42),s=t(44);e.exports=function(t){for(var e=-1,r=t[s]||0;++e<r;){var a=t[n+e];null!=a&&(a[i]=a[o]=t[n+e]=void 0)}return t[s]=void 0,t}},{33:33,42:42,43:43,44:44}],113:[function(t,e,r){var n=t(43),i=t(33),o=t(42),s=t(44);e.exports=function(t){var e=t[i];if(e){for(var r=(t[o]||0)-1,a=(e[s]||0)-1;++r<=a;)e[n+r]=e[n+(r+1)];e[s]=a,t[o]=t[i]=e=void 0}return t}},{33:33,42:42,43:43,44:44}],114:[function(t,e,r){var n=t(43),i=t(39),o=t(46),s=t(44);e.exports=function(t,e){var r=[t],a=0;do{var c=r[a--];if(c&&c[o]!==e){c[o]=e,r[a++]=c[i];for(var u=-1,h=c[s]||0;++u<h;)r[a++]=c[n+u]}}while(a>-1);return t}},{39:39,43:43,44:44,46:46}],115:[function(t,e,r){var n=t(36),i=t(46),o=t(39),s=t(108),a=t(114);e.exports=function(t,e,r,c){var u=t;do{var h=u[o];0>=(u.$size=(u.$size||0)-e)&&null!=h?s(u,h,u[n],r):u[i]!==c&&a(u,c),u=h}while(u);return t}},{108:108,114:114,36:36,39:39,46:46}],116:[function(t,e,r){var n=Array.isArray,i=t(101),o=t(99),s=t(98),a=t(134);e.exports=function(t,e,r){for(var c=0,u=t.length;u>c;++c){var h=t[c],l=!1;if(n(h)&&e.path?l=!0:"string"==typeof h&&e.pathSyntax?l=!0:i(h)&&e.pathValue?(h.path=a.fromPath(h.path),l=!0):o(h)&&e.jsonGraph?l=!0:s(h)&&e.json?l=!0:"function"==typeof h&&c+1===u&&e.selector&&(l=!0),!l)return new Error("Unrecognized argument "+typeof h+" ["+String(h)+"] to Model#"+r)}return!0}},{101:101,134:134,98:98,99:99}],117:[function(t,e,r){var n=t(130).atom,i=t(106),o=t(122),s=t(37),a=t(85),c=Array.isArray,u=t(88),h=t(87);e.exports=function(t,e,r){var l=0,p=t,f=e;if(f?(p=a(p),l=u(p),p.$type=f):(p=n(r),f=p.$type,p[s]=!0),null==r)l=51;else if(null==l||0>=l)switch(typeof r){case"object":l=c(r)?50+r.length:51;break;case"string":l=50+r.length;break;default:l=51}var d=h(p);return"number"==typeof d&&o>d&&(p.$expires=i()+-1*d),p.$size=l,p}},{106:106,122:122,130:130,37:37,85:85,87:87,88:88}],118:[function(t,e,r){e.exports="atom"},{}],119:[function(t,e,r){e.exports="error"},{}],120:[function(t,e,r){e.exports="ref"},{}],121:[function(t,e,r){e.exports=1},{}],122:[function(t,e,r){e.exports=0},{}],123:[function(t,e,r){"use strict";function n(t){var e;(e=s.length?s.pop():new i).task=t,o(e)}function i(){this.task=null}var o=t(124),s=[],a=[],c=o.makeRequestCallFromTimer(function(){if(a.length)throw a.shift()});e.exports=n,i.prototype.call=function(){try{this.task.call()}catch(t){n.onerror?n.onerror(t):(a.push(t),c())}finally{this.task=null,s[s.length]=this}}},{124:124}],124:[function(t,e,r){(function(t){"use strict";function r(t){s.length||(o(),a=!0),s[s.length]=t}function n(){for(;c<s.length;){var t=c;if(c+=1,s[t].call(),c>u){for(var e=0,r=s.length-c;r>e;e++)s[e]=s[e+c];s.length-=c,c=0}}s.length=0,c=0,a=!1}function i(t){return function(){function e(){clearTimeout(r),clearInterval(n),t()}var r=setTimeout(e,0),n=setInterval(e,50)}}e.exports=r;var o,s=[],a=!1,c=0,u=1024,h=t.MutationObserver||t.WebKitMutationObserver;o="function"==typeof h?function(t){var e=1,r=new h(t),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){e=-e,n.data=e}}(n):i(n),r.requestFlush=o,r.makeRequestCallFromTimer=i}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(t,e,r){"use strict";function n(t,e){var r;for(r in e)t[r]=e[r];return t}function i(t,e){this._jsongUrl=t,"number"==typeof e&&(e={timeout:e}),this._config=n({timeout:15e3,headers:{}},e||{})}var o=t(129),s=t(126);Array.isArray,i.prototype={constructor:i,buildQueryObject:s,get:function(t){var e=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:t,method:"get"}),this._config);return o("GET",e,this)},set:function(t){var e="POST",r=n(this.buildQueryObject(this._jsongUrl,e,{jsonGraph:t,method:"set"}),this._config);return r.headers["Content-Type"]="application/x-www-form-urlencoded",o(e,r,this)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var s="POST",a=[];a.push("method=call"),a.push("callPath="+encodeURIComponent(JSON.stringify(t))),a.push("arguments="+encodeURIComponent(JSON.stringify(e))),a.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),a.push("paths="+encodeURIComponent(JSON.stringify(i)));var c=n(this.buildQueryObject(this._jsongUrl,s,a.join("&")),this._config);return c.headers["Content-Type"]="application/x-www-form-urlencoded",o(s,c,this)}},i.XMLHttpSource=i,i.default=i,e.exports=i},{126:126,129:129}],126:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=[],i={url:t},o=-1!==t.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];n.push(t+"="+encodeURIComponent(e))}),"GET"===e?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],127:[function(t,e,r){(function(t){"use strict";e.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,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],128:[function(t,e,r){(function(t){"use strict";e.exports=function(){var e,r,n;if(t.XMLHttpRequest)return new t.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;3>n;n++)try{if(e=r[n],new t.ActiveXObject(e))break}catch(t){}return new t.ActiveXObject(e)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(t,e,r){"use strict";function n(){}function i(t,e,r){r||(r=new Error(e)),t.onError(r)}function o(t,e,r){var n,o;if(e&&t){o=e.responseType,n="response"in e?e.response:e.responseText;var s=1223===e.status?204:e.status;if(s>=200&&399>=s){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(t,"invalid json",r)}return t.onNext(n),void t.onCompleted()}return 401===s||403===s||407===s?i(t,n):410===s?i(t,n):408===s||504===s?i(t,n):i(t,n||"Response code "+s)}}function s(t,e,r,n){i(t,r||e.statusText||"request error",n)}var a=t(128),c=t(127),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(t){var e=new n;return e.subscribe=function(e,r,n){var i,o;return i="function"==typeof e?{onNext:e,onError:r||h,onCompleted:n||h}:e,"function"==typeof(o=t(i))?{dispose:o}:o},e},e.exports=function(t,e,r){return n.create(function(n){var i,h,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)u.call(e,f)&&(d[f]=e[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?c():a()}catch(t){n.onError(t)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,l=d.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(t){if("json"!==d.responseType)throw t}i.onreadystatechange=function(t){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(t){h||(h=!0,s(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{127:127,128:128}],130:[function(t,e,r){function n(t,e,r){var n=Object.create(null);if(null!=r){for(var i in r)n[i]=r[i];return n.$type=t,n.value=e,n}return{$type:t,value:e}}var i=t(134);e.exports={ref:function(t,e){return n("ref",i.fromPath(t),e)},atom:function(t,e){return n("atom",t,e)},undefined:function(){return n("atom")},error:function(t,e){return n("error",t,e)},pathValue:function(t,e){return{path:i.fromPath(t),value:e}},pathInvalidation:function(t){return{path:i.fromPath(t),invalidated:!0}}}},{134:134}],131:[function(t,e,r){e.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],132:[function(t,e,r){var n={token:"token",dotSeparator:".",commaSeparator:",",openingBracket:"[",closingBracket:"]",openingBrace:"{",closingBrace:"}",escape:"\\",space:" ",colon:":",quote:"quote",unknown:"unknown"};e.exports=n},{}],133:[function(t,e,r){e.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(t,e,r){if(r)throw t+" -- "+e.parseString+" with next token: "+r;throw t+" -- "+e.parseString}}},{}],134:[function(t,e,r){var n=t(140),i=t(135),o=t(131),s=function(t,e){return i(new n(t,e))};e.exports=s,s.fromPathsOrPathValues=function(t,e){if(!t)return[];for(var r=[],n=0,i=t.length;i>n;n++)"string"==typeof t[n]?r[n]=s(t[n],e):"string"==typeof t[n].path?r[n]={path:s(t[n].path,e),value:t[n].value}:r[n]=t[n];return r},s.fromPath=function(t,e){return t?"string"==typeof t?s(t,e):t:[]},s.RoutedTokens=o},{131:131,135:135,140:140}],135:[function(t,e,r){var n=t(132),i=t(133),o=t(136);e.exports=function(t){for(var e=t.next(),r={},s=[];!e.done;){switch(e.type){case n.token:var a=+e.token[0];isNaN(a)||i.throwError(i.invalidIdentifier,t),s[s.length]=e.token;break;case n.dotSeparator:0===s.length&&i.throwError(i.unexpectedToken,t);break;case n.space:break;case n.openingBracket:o(t,e,r,s);break;default:i.throwError(i.unexpectedToken,t)}e=t.next()}return 0===s.length&&i.throwError(i.invalidPath,t),s}},{132:132,133:133,136:136}],136:[function(t,e,r){var n=t(132),i=t(133),o=i.indexer,s=t(138),a=t(137),c=t(139);e.exports=function(t,e,r,u){var h=t.next(),l=!1,p=1,f=!1;for(r.indexer=[];!h.done;){switch(h.type){case n.token:case n.quote:r.indexer.length===p&&i.throwError(o.requiresComma,t)}switch(h.type){case n.openingBrace:f=!0,c(t,h,r,u);break;case n.token:var d=+h.token;isNaN(d)&&i.throwError(o.needQuotes,t),r.indexer[r.indexer.length]=d;break;case n.dotSeparator:r.indexer.length||i.throwError(o.leadingDot,t),s(t,h,r,u);break;case n.space:break;case n.closingBracket:l=!0;break;case n.quote:a(t,h,r,u);break;case n.openingBracket:i.throwError(o.nested,t);break;case n.commaSeparator:++p;break;default:i.throwError(i.unexpectedToken,t)}if(l)break;h=t.next()}0===r.indexer.length&&i.throwError(o.empty,t),r.indexer.length>1&&f&&i.throwError(o.routedTokens,t),1===r.indexer.length&&(r.indexer=r.indexer[0]),u[u.length]=r.indexer,r.indexer=void 0}},{132:132,133:133,137:137,138:138,139:139}],137:[function(t,e,r){var n=t(132),i=t(133),o=i.quote;e.exports=function(t,e,r,s){for(var a=t.next(),c="",u=e.token,h=!1,l=!1;!a.done;){switch(a.type){case n.token:case n.space:case n.dotSeparator:case n.commaSeparator:case n.openingBracket:case n.closingBracket:case n.openingBrace:case n.closingBrace:h&&i.throwError(o.illegalEscape,t),c+=a.token;break;case n.quote:h?(c+=a.token,h=!1):a.token!==u?c+=a.token:l=!0;break;case n.escape:h=!0;break;default:i.throwError(i.unexpectedToken,t)}if(l)break;a=t.next()}0===c.length&&i.throwError(o.empty,t),r.indexer[r.indexer.length]=c}},{132:132,133:133}],138:[function(t,e,r){var n=t(140),i=t(132),o=t(133);e.exports=function(t,e,r,s){var a,c=t.peek(),u=1,h=!1,l=!0,p=r.indexer.length-1,f=n.toNumber(r.indexer[p]);for(isNaN(f)&&o.throwError(o.range.precedingNaN,t);!h&&!c.done;){switch(c.type){case i.dotSeparator:3===u&&o.throwError(o.unexpectedToken,t),3===++u&&(l=!1);break;case i.token:a=n.toNumber(t.next().token),isNaN(a)&&o.throwError(o.range.suceedingNaN,t),h=!0;break;default:h=!0}if(h)break;t.next(),c=t.peek()}r.indexer[p]={from:f,to:l?a:a-1}}},{132:132,133:133,140:140}],139:[function(t,e,r){var n=t(132),i=t(131),o=t(133),s=o.routed;e.exports=function(t,e,r,a){var c=t.next(),u=!1,h="";switch(c.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(s.invalid,t)}var l=t.next();if(l.type===n.colon&&(u=!0,(l=t.next()).type!==n.token&&o.throwError(s.invalid,t),h=l.token,l=t.next()),l.type===n.closingBrace){var p={type:c.token,named:u,name:h};r.indexer[r.indexer.length]=p}else o.throwError(s.invalid,t)}},{131:131,132:132,133:133}],140:[function(t,e,r){function n(t,e,r){return{token:t,done:r,type:e}}function i(t,e,r){var i,b=!1,_="",x=r?y:g;do{if(i=e+1>=t.length)break;var w=t[e+1];if(void 0===w||-1!==x.indexOf(w)){if(_.length)break;++e;var S;switch(w){case s:S=o.dotSeparator;break;case a:S=o.commaSeparator;break;case c:S=o.openingBracket;break;case u:S=o.closingBracket;break;case h:S=o.openingBrace;break;case l:S=o.closingBrace;break;case v:S=o.space;break;case d:case m:S=o.quote;break;case f:S=o.escape;break;case p:S=o.colon;break;default:S=o.unknown}b=n(w,S,!1);break}_+=w,++e}while(!i);return!b&&_.length&&(b=n(_,o.token,!1)),b||(b={done:!0}),{token:b,idx:e}}var o=t(132),s=".",a=",",c="[",u="]",h="{",l="}",p=":",f="\\",d='"',m="'",v=" ",g="\\'\"[]., ",y="\\{}'\"[]., :",b=e.exports=function(t,e){this._string=t,this._idx=-1,this._extended=e,this.parseString=""};b.prototype={next:function(){var t=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._idx=t.idx,this._nextToken=!1,this.parseString+=t.token.token,t.token},peek:function(){var t=this._nextToken?this._nextToken:i(this._string,this._idx,this._extended);return this._nextToken=t,t.token}},b.toNumber=function(t){return isNaN(+t)?NaN:+t}},{132:132}],141:[function(t,e,r){var n=t(147),i=t(148);e.exports=function(t){var e=t.reduce(function(t,e){var r=e.length;return t[r]||(t[r]=[]),t[r].push(e),t},{});return Object.keys(e).forEach(function(t){e[t]=i(e[t])}),n(e)}},{147:147,148:148}],142:[function(t,e,r){var n=t(144);e.exports=function t(e,r,i){for(var o=e,s=!0;s&&i<r.length;++i){var a=r[i],c=typeof a;if(a&&"object"===c){var u={},h=n(a,u),l=i+1;do{var p=o[h];(s=void 0!==p)&&(s=t(p,r,l)),h=n(a,u)}while(s&&!u.done);break}s=void 0!==(o=o[a])}return s}},{144:144}],143:[function(t,e,r){e.exports={iterateKeySet:t(144),toTree:t(148),toTreeWithUnion:t(149),pathsComplementFromTree:t(146),pathsComplementFromLengthTree:t(145),hasIntersection:t(142),toPaths:t(147),collapse:t(141)}},{141:141,142:142,144:144,145:145,146:146,147:147,148:148,149:149}],144:[function(t,e,r){function n(t,e){var r=e.from=t.from||0,n=e.to=t.to||"number"==typeof t.length&&e.from+t.length-1||0;e.rangeOffset=e.from,e.loaded=!0,r>n&&(e.empty=!0)}function i(t,e){e.done=!1;var r=e.isObject=!(!t||"object"!=typeof t);e.isArray=r&&o(t),e.arrayOffset=0}var o=Array.isArray;e.exports=function(t,e){if(void 0===e.isArray&&i(t,e),e.isArray){var r;do{if(e.loaded&&e.rangeOffset>e.to&&(++e.arrayOffset,e.loaded=!1),e.arrayOffset>=t.length){e.done=!0;break}var o=t[e.arrayOffset];if("object"===typeof o){if(e.loaded||n(o,e),e.empty)continue;r=e.rangeOffset++}else++e.arrayOffset,r=o}while(void 0===r);return r}return e.isObject?(e.loaded||n(t,e),e.rangeOffset>e.to?void(e.done=!0):e.rangeOffset++):(e.done=!0,t)}},{}],145:[function(t,e,r){var n=t(142);e.exports=function(t,e){for(var r=[],i=-1,o=0,s=t.length;s>o;++o){var a=t[o];n(e[a.length],a,0)||(r[++i]=a)}return r}},{142:142}],146:[function(t,e,r){var n=t(142);e.exports=function(t,e){for(var r=[],i=-1,o=0,s=t.length;s>o;++o)n(e,t[o],0)||(r[++i]=t[o]);return r}},{142:142}],147:[function(t,e,r){function n(t){return null!==t&&typeof t===p}function i(t,e,r){var n,o,s,a,l,p,f,d,m,v,g,y,b,_,x=u(String(e)),w=Object.create(null),S=[],M=-1,E=0,T=[],C=0;if(a=[],l=-1,r-1>e){for(p=c(t,a);++l<p;)n=a[l],o=i(t[n],e+1,r),s=o.code,w[s]?o=w[s]:(S[E++]=s,o=w[s]={keys:[],sets:o.sets}),x=u(x+n+s),h(n)&&o.keys.push(parseInt(n,10))||o.keys.push(n);for(;++M<E;)if(n=S[M],o=w[n],a=o.keys,(p=a.length)>0)for(f=o.sets,d=-1,m=f.length,b=a[0];++d<m;){for(g=-1,y=(v=f[d]).length,(_=new Array(y+1))[0]=p>1&&a||b;++g<y;)_[g+1]=v[g];T[C++]=_}}else for(p=c(t,a),T[C++]=p>1?[a]:a;++l<p;)x=u(x+a[l]);return{code:x,sets:T}}function o(t){for(var e=-1,r=t.length;++e<r;){var n=t[e];l(n)&&(t[e]=s(n))}return t}function s(t){for(var e=-1,r=t.length-1,n=r>0;++e<=r;){var i=t[e];if(!h(i)){n=!1;break}t[e]=parseInt(i,10)}if(!0===n){t.sort(a);var o=t[0],s=t[r];if(r>=s-o)return{from:o,to:s}}return t}function a(t,e){return t-e}function c(t,e,r){var n=0;for(var i in t)e[n++]=i;return n>1&&e.sort(r),n}function u(t){for(var e=5381,r=-1,n=t.length;++r<n;)e=(e<<5)+e+t.charCodeAt(r);return String(e)}function h(t){return!l(t)&&t-parseFloat(t)+1>=0}var l=Array.isArray,p="object";e.exports=function(t){var e,r=[],s=0;for(var a in t)if(h(a)&&n(e=t[a]))for(var c=i(e,0,parseInt(a,10)).sets,u=-1,l=c.length;++u<l;)r[s++]=o(c[u]);return r}},{}],148:[function(t,e,r){function n(t,e,r){var o,s=e[r],a={},c=r+1;o=i(s,a);do{var u=t[o];u||(c===e.length?t[o]=null:u=t[o]={}),c<e.length&&n(u,e,c),a.done||(o=i(s,a))}while(!a.done)}var i=t(144);Array.isArray,e.exports=function(t){return t.reduce(function(t,e){return n(t,e,0),t},{})}},{144:144}],149:[function(t,e,r){},{}],150:[function(t,e,r){function n(){h=!1,a.length?u=a.concat(u):l=-1,u.length&&i()}function i(){if(!h){var t=setTimeout(n);h=!0;for(var e=u.length;e;){for(a=u,u=[];++l<e;)a&&a[l].run();l=-1,e=u.length}a=null,h=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function s(){}var a,c=e.exports={},u=[],h=!1,l=-1;c.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new o(t,e)),1!==u.length||h||setTimeout(i,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=s,c.addListener=s,c.once=s,c.off=s,c.removeListener=s,c.removeAllListeners=s,c.emit=s,c.binding=function(t){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(t){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],151:[function(t,e,r){"use strict";e.exports=t(156)},{156:156}],152:[function(t,e,r){"use strict";function n(){}function i(t){try{return t.then}catch(t){return v=t,g}}function o(t,e){try{return t(e)}catch(t){return v=t,g}}function s(t,e,r){try{t(e,r)}catch(t){return v=t,g}}function a(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._37=0,this._12=null,this._59=[],t!==n&&d(t,this)}function c(t,e,r){return new t.constructor(function(i,o){var s=new a(n);s.then(i,o),u(t,new f(e,r,s))})}function u(t,e){for(;3===t._37;)t=t._12;return 0===t._37?void t._59.push(e):void m(function(){var r=1===t._37?e.onFulfilled:e.onRejected;if(null!==r){var n=o(r,t._12);n===g?l(e.promise,v):h(e.promise,n)}else 1===t._37?h(e.promise,t._12):l(e.promise,t._12)})}function h(t,e){if(e===t)return l(t,new TypeError("A promise cannot be resolved with itself."));if(e&&("object"==typeof e||"function"==typeof e)){var r=i(e);if(r===g)return l(t,v);if(r===t.then&&e instanceof a)return t._37=3,t._12=e,void p(t);if("function"==typeof r)return void d(r.bind(e),t)}t._37=1,t._12=e,p(t)}function l(t,e){t._37=2,t._12=e,p(t)}function p(t){for(var e=0;e<t._59.length;e++)u(t,t._59[e]);t._59=null}function f(t,e,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=r}function d(t,e){var r=!1,n=s(t,function(t){r||(r=!0,h(e,t))},function(t){r||(r=!0,l(e,t))});r||n!==g||(r=!0,l(e,v))}var m=t(124),v=null,g={};e.exports=a,a._99=n,a.prototype.then=function(t,e){if(this.constructor!==a)return c(this,t,e);var r=new a(n);return u(this,new f(t,e,r)),r}},{124:124}],153:[function(t,e,r){"use strict";var n=t(152);e.exports=n,n.prototype.done=function(t,e){(arguments.length?this.then.apply(this,arguments):this).then(null,function(t){setTimeout(function(){throw t},0)})}},{152:152}],154:[function(t,e,r){"use strict";function n(t){var e=new i(i._99);return e._37=1,e._12=t,e}var i=t(152);e.exports=i;var o=n(!0),s=n(!1),a=n(null),c=n(void 0),u=n(0),h=n("");i.resolve=function(t){if(t instanceof i)return t;if(null===t)return a;if(void 0===t)return c;if(!0===t)return o;if(!1===t)return s;if(0===t)return u;if(""===t)return h;if("object"==typeof t||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new i(e.bind(t))}catch(t){return new i(function(e,r){r(t)})}return n(t)},i.all=function(t){var e=Array.prototype.slice.call(t);return new i(function(t,r){function n(s,a){if(a&&("object"==typeof a||"function"==typeof a)){if(a instanceof i&&a.then===i.prototype.then){for(;3===a._37;)a=a._12;return 1===a._37?n(s,a._12):(2===a._37&&r(a._12),void a.then(function(t){n(s,t)},r))}var c=a.then;if("function"==typeof c)return void new i(c.bind(a)).then(function(t){n(s,t)},r)}e[s]=a,0==--o&&t(e)}if(0===e.length)return t([]);for(var o=e.length,s=0;s<e.length;s++)n(s,e[s])})},i.reject=function(t){return new i(function(e,r){r(t)})},i.race=function(t){return new i(function(e,r){t.forEach(function(t){i.resolve(t).then(e,r)})})},i.prototype.catch=function(t){return this.then(null,t)}},{152:152}],155:[function(t,e,r){"use strict";var n=t(152);e.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(t,e,r){"use strict";e.exports=t(152),t(153),t(155),t(154),t(157)},{152:152,153:153,154:154,155:155,157:157}],157:[function(t,e,r){"use strict";var n=t(152),i=t(123);e.exports=n,n.denodeify=function(t,e){return e=e||1/0,function(){var r=this,i=Array.prototype.slice.call(arguments,0,e>0?e:0);return new n(function(e,n){i.push(function(t,r){t?n(t):e(r)});var o=t.apply(r,i);!o||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then||e(o)})}},n.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),r="function"==typeof e[e.length-1]?e.pop():null,o=this;try{return t.apply(this,arguments).nodeify(r,o)}catch(t){if(null===r||void 0===r)return new n(function(e,r){r(t)});i(function(){r.call(o,t)})}}},n.prototype.nodeify=function(t,e){return"function"!=typeof t?this:void this.then(function(r){i(function(){t.call(e,null,r)})},function(r){i(function(){t.call(e,r)})})}},{123:123,152:152}],158:[function(t,e,r){(function(n){(function(i){var o={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},s=o[typeof window]&&window||this,a=o[typeof r]&&r&&!r.nodeType&&r,c=o[typeof e]&&e&&!e.nodeType&&e,u=(c&&c.exports,o[typeof n]&&n);!u||u.global!==u&&u.window!==u||(s=u),"object"==typeof e&&e&&e.exports===a?e.exports=i(s,e.exports,t(159)):s.Rx=i(s,{},s.Rx)}).call(this,function(t,e,r,n){function i(){try{return f.apply(this,arguments)}catch(t){return I.e=t,I}}function o(t){if(!M(t))throw new TypeError("fn must be a function");return f=t,i}function s(t,e,r){return new g(function(n){var i=!1,o=null,s=[];return t.subscribe(function(t){var a,c;try{c=e(t)}catch(t){return void n.onError(t)}if(a=0,i)try{a=r(c,o)}catch(t){return void n.onError(t)}else i=!0,o=c;a>0&&(o=c,s=[]),a>=0&&s.push(t)},function(t){n.onError(t)},function(){n.onNext(s),n.onCompleted()})},t)}function a(t){if(0===t.length)throw new R;return t[0]}function c(t,e,r,n){if(0>e)throw new N;return new g(function(i){var o=e;return t.subscribe(function(t){0==o--&&(i.onNext(t),i.onCompleted())},function(t){i.onError(t)},function(){r?(i.onNext(n),i.onCompleted()):i.onError(new N)})},t)}function u(t,e,r){return new g(function(n){var i=r,o=!1;return t.subscribe(function(t){o?n.onError(new Error("Sequence contains more than one element")):(i=t,o=!0)},function(t){n.onError(t)},function(){o||e?(n.onNext(i),n.onCompleted()):n.onError(new R)})},t)}function h(t,e,r){return new g(function(n){return t.subscribe(function(t){n.onNext(t),n.onCompleted()},function(t){n.onError(t)},function(){e?(n.onNext(r),n.onCompleted()):n.onError(new R)})},t)}function l(t,e,r){return new g(function(n){var i=r,o=!1;return t.subscribe(function(t){i=t,o=!0},function(t){n.onError(t)},function(){o||e?(n.onNext(i),n.onCompleted()):n.onError(new R)})},t)}function p(t,e,r,i){var o=j(e,r,3);return new g(function(e){var r=0;return t.subscribe(function(n){var s;try{s=o(n,r,t)}catch(t){return void e.onError(t)}s?(e.onNext(i?r:n),e.onCompleted()):r++},function(t){e.onError(t)},function(){e.onNext(i?-1:n),e.onCompleted()})},t)}var f,d=r.Observable,m=d.prototype,v=r.CompositeDisposable,g=r.AnonymousObservable,y=r.Disposable.empty,b=(r.internals.isEqual,r.helpers),_=b.not,x=b.defaultComparer,w=b.identity,S=b.defaultSubComparer,M=b.isFunction,E=b.isPromise,T=b.isArrayLike,C=b.isIterable,O=r.internals.inherits,P=d.fromPromise,A=d.from,j=r.internals.bindCallback,R=r.EmptyError,L=r.ObservableBase,N=r.ArgumentOutOfRangeError,I={e:{}};m.aggregate=function(){var t,e,r=!1,n=this;return 2===arguments.length?(r=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new g(function(i){var o,s,a;return n.subscribe(function(n){!a&&(a=!0);try{o?s=t(s,n):(s=r?t(e,n):n,o=!0)}catch(t){return i.onError(t)}},function(t){i.onError(t)},function(){a&&i.onNext(s),!a&&r&&i.onNext(e),!a&&!r&&i.onError(new R),i.onCompleted()})},n)};var D=function(t){function e(e,r,n,i){this.source=e,this.acc=r,this.hasSeed=n,this.seed=i,t.call(this)}function r(t,e){this.o=t,this.acc=e.acc,this.hasSeed=e.hasSeed,this.seed=e.seed,this.hasAccumulation=!1,this.result=null,this.hasValue=!1,this.isStopped=!1}return O(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this))},r.prototype.onNext=function(t){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=o(this.acc)(this.result,t):(this.result=this.hasSeed?o(this.acc)(this.seed,t):t,this.hasAccumulation=!0),this.result===I&&this.o.onError(this.result.e))},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.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())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(L);return m.reduce=function(t){var e=!1;if(2===arguments.length){e=!0;var r=arguments[1]}return new D(this,t,e,r)},m.some=function(t,e){var r=this;return t?r.filter(t,e).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)},m.any=function(){return this.some.apply(this,arguments)},m.isEmpty=function(){return this.any().map(_)},m.every=function(t,e){return this.filter(function(e){return!t(e)},e).some().map(_)},m.all=function(){return this.every.apply(this,arguments)},m.includes=function(t,e){function r(t,e){return 0===t&&0===e||t===e||isNaN(t)&&isNaN(e)}var n=this;return new g(function(i){var o=0,s=+e||0;return Math.abs(s)===1/0&&(s=0),0>s?(i.onNext(!1),i.onCompleted(),y):n.subscribe(function(e){o++>=s&&r(e,t)&&(i.onNext(!0),i.onCompleted())},function(t){i.onError(t)},function(){i.onNext(!1),i.onCompleted()})},this)},m.contains=function(t,e){m.includes(t,e)},m.count=function(t,e){return t?this.filter(t,e).count():this.reduce(function(t){return t+1},0)},m.indexOf=function(t,e){var r=this;return new g(function(n){var i=0,o=+e||0;return Math.abs(o)===1/0&&(o=0),0>o?(n.onNext(-1),n.onCompleted(),y):r.subscribe(function(e){i>=o&&e===t&&(n.onNext(i),n.onCompleted()),i++},function(t){n.onError(t)},function(){n.onNext(-1),n.onCompleted()})},r)},m.sum=function(t,e){return t&&M(t)?this.map(t,e).sum():this.reduce(function(t,e){return t+e},0)},m.minBy=function(t,e){return e||(e=S),s(this,t,function(t,r){return-1*e(t,r)})},m.min=function(t){return this.minBy(w,t).map(function(t){return a(t)})},m.maxBy=function(t,e){return e||(e=S),s(this,t,e)},m.max=function(t){return this.maxBy(w,t).map(function(t){return a(t)})},m.average=function(t,e){return t&&M(t)?this.map(t,e).average():this.reduce(function(t,e){return{sum:t.sum+e,count:t.count+1}},{sum:0,count:0}).map(function(t){if(0===t.count)throw new R;return t.sum/t.count})},m.sequenceEqual=function(t,e){var r=this;return e||(e=x),new g(function(n){var i=!1,o=!1,s=[],a=[],c=r.subscribe(function(t){var r,i;if(a.length>0){i=a.shift();try{r=e(i,t)}catch(t){return void n.onError(t)}r||(n.onNext(!1),n.onCompleted())}else o?(n.onNext(!1),n.onCompleted()):s.push(t)},function(t){n.onError(t)},function(){i=!0,0===s.length&&(a.length>0?(n.onNext(!1),n.onCompleted()):o&&(n.onNext(!0),n.onCompleted()))});(T(t)||C(t))&&(t=A(t)),E(t)&&(t=P(t));var u=t.subscribe(function(t){var r;if(s.length>0){var o=s.shift();try{r=e(o,t)}catch(t){return void n.onError(t)}r||(n.onNext(!1),n.onCompleted())}else i?(n.onNext(!1),n.onCompleted()):a.push(t)},function(t){n.onError(t)},function(){o=!0,0===a.length&&(s.length>0?(n.onNext(!1),n.onCompleted()):i&&(n.onNext(!0),n.onCompleted()))});return new v(c,u)},r)},m.elementAt=function(t){return c(this,t,!1)},m.elementAtOrDefault=function(t,e){return c(this,t,!0,e)},m.single=function(t,e){return t&&M(t)?this.where(t,e).single():u(this,!1)},m.singleOrDefault=function(t,e,r){return t&&M(t)?this.filter(t,r).singleOrDefault(null,e):u(this,!0,e)},m.first=function(t,e){return t?this.where(t,e).first():h(this,!1)},m.firstOrDefault=function(t,e,r){return t?this.where(t).firstOrDefault(null,e):h(this,!0,e)},m.last=function(t,e){return t?this.where(t,e).last():l(this,!1)},m.lastOrDefault=function(t,e,r){return t?this.where(t,r).lastOrDefault(null,e):l(this,!0,e)},m.find=function(t,e){return p(this,t,e,!1)},m.findIndex=function(t,e){return p(this,t,e,!0)},m.toSet=function(){if(void 0===t.Set)throw new TypeError;var e=this;return new g(function(r){var n=new t.Set;return e.subscribe(function(t){n.add(t)},function(t){r.onError(t)},function(){r.onNext(n),r.onCompleted()})},e)},m.toMap=function(e,r){if(void 0===t.Map)throw new TypeError;var n=this;return new g(function(i){var o=new t.Map;return n.subscribe(function(t){var n;try{n=e(t)}catch(t){return void i.onError(t)}var s=t;if(r)try{s=r(t)}catch(t){return void i.onError(t)}o.set(n,s)},function(t){i.onError(t)},function(){i.onNext(o),i.onCompleted()})},n)},r})}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(t,e,r){(function(t,n){(function(i){function o(t){for(var e=[],r=0,n=t.length;n>r;r++)e.push(t[r]);return e}function a(t,e){if(ct&&e.stack&&"object"==typeof t&&null!==t&&t.stack&&-1===t.stack.indexOf(lt)){for(var r=[],n=e;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(t.stack);var i=r.join("\n"+lt+"\n");t.stack=c(i)}}function c(t){for(var e=t.split("\n"),r=[],n=0,i=e.length;i>n;n++){var o=e[n];u(o)||h(o)||!o||r.push(o)}return r.join("\n")}function u(t){var e=p(t);if(!e)return!1;var r=e[0],n=e[1];return r===ut&&n>=ht&&jr>=n}function h(t){return-1!==t.indexOf("(module.js:")||-1!==t.indexOf("(node.js:")}function l(){if(ct)try{throw new Error}catch(r){var t=r.stack.split("\n"),e=p(t[0].indexOf("@")>0?t[1]:t[2]);if(!e)return;return ut=e[0],e[1]}}function p(t){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);if(e)return[e[1],Number(e[2])];var r=/at ([^ ]+):(\d+):(?:\d+)$/.exec(t);if(r)return[r[1],Number(r[2])];var n=/.*@(.+):(\d+)$/.exec(t);return n?[n[1],Number(n[2])]:void 0}function f(t){var e=[];if(!$t(t))return e;Gt.nonEnumArgs&&t.length&&Vt(t)&&(t=Wt.call(t));var r=Gt.enumPrototypes&&"function"==typeof t,n=Gt.enumErrorProps&&(t===kt||t instanceof Error);for(var i in t)r&&"prototype"==i||n&&("message"==i||"name"==i)||e.push(i);if(Gt.nonEnumShadows&&t!==Ft){var o=t.constructor,s=-1,a=Mt;if(t===(o&&o.prototype))var c=t===Bt?Lt:t===kt?Pt:Nt.call(t),u=zt[c];for(;++s<a;)i=St[s],u&&u[i]||!It.call(t,i)||e.push(i)}return e}function d(t,e,r){for(var n=-1,i=r(t),o=i.length;++n<o;){var s=i[n];if(!1===e(t[s],s,t))break}return t}function m(t,e){return d(t,e,f)}function v(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function g(t,e,r,n){if(t===e)return 0!==t||1/t==1/e;var i=typeof t,o=typeof e;if(t===t&&(null==t||null==e||"function"!=i&&"object"!=i&&"function"!=o&&"object"!=o))return!1;var s=Nt.call(t),a=Nt.call(e);if(s==Et&&(s=jt),a==Et&&(a=jt),s!=a)return!1;switch(s){case Ct:case Ot:return+t==+e;case At:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case Rt:case Lt:return t==String(e)}var c=s==Tt;if(!c){if(s!=jt||!Gt.nodeClass&&(v(t)||v(e)))return!1;var u=!Gt.argsObject&&Vt(t)?Object:t.constructor,h=!Gt.argsObject&&Vt(e)?Object:e.constructor;if(!(u==h||It.call(t,"constructor")&&It.call(e,"constructor")||at(u)&&u instanceof u&&at(h)&&h instanceof h)&&("constructor"in t&&"constructor"in e))return!1}r||(r=[]),n||(n=[]);for(var l=r.length;l--;)if(r[l]==t)return n[l]==e;var p=0,f=!0;if(r.push(t),n.push(e),c){if(l=t.length,p=e.length,f=p==l)for(;p--;){var d=e[p];if(!(f=g(t[p],d,r,n)))break}}else m(e,function(e,i,o){return It.call(o,i)?(p++,f=It.call(t,i)&&g(t[i],e,r,n)):void 0}),f&&m(t,function(t,e,r){return It.call(r,e)?f=--p>-1:void 0});return r.pop(),n.pop(),f}function y(t,e){for(var r=new Array(t),n=0;t>n;n++)r[n]=e();return r}function b(){try{return Ht.apply(this,arguments)}catch(t){return Zt.e=t,Zt}}function _(t){if(!at(t))throw new TypeError("fn must be a function");return Ht=t,b}function x(t){throw t}function w(t,e){this.id=t,this.value=e}function S(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function M(t,e){e.isDisposed||(e.isDisposed=!0,e.disposable.dispose())}function E(t){this._s=s}function T(t){this._s=s,this._l=s.length,this._i=0}function C(t){this._a=t}function O(t){this._a=t,this._l=R(t),this._i=0}function P(t){return"number"==typeof t&&X.isFinite(t)}function A(t){var e=t[yt];if(!e&&"string"==typeof t)return new E(t)[yt]();if(!e&&t.length!==i)return new C(t)[yt]();if(!e)throw new TypeError("Object is not iterable");return t[yt]()}function j(t){var e=+t;return 0===e?e:isNaN(e)?e:0>e?-1:1}function R(t){var e=+t.length;return isNaN(e)?0:0!==e&&P(e)?0>=(e=j(e)*Math.floor(Math.abs(e)))?0:e>Ye?Ye:e:e}function L(t,e){this.observer=t,this.parent=e}function N(t,e){return fe(t)||(t=ge),new Ze(e,t)}function I(t,e){this.observer=t,this.parent=e}function D(t,e){this.observer=t,this.parent=e}function k(t,e){return new Tr(function(r){var n=new ae,i=new ce;return i.setDisposable(n),n.setDisposable(t.subscribe(function(t){r.onNext(t)},function(t){try{var n=e(t)}catch(t){return r.onError(t)}st(n)&&(n=$e(n));var o=new ae;i.setDisposable(o),o.setDisposable(n.subscribe(r))},function(t){r.onCompleted(t)})),i},t)}function F(){return!1}function B(t,e){var r=this;return new Tr(function(n){var i=0,o=t.length;return r.subscribe(function(r){if(o>i){var s=t[i++],a=_(e)(r,s);if(a===Zt)return n.onError(a.e);n.onNext(a)}else n.onCompleted()},function(t){n.onError(t)},function(){n.onCompleted()})},r)}function F(){return!1}function U(){return[]}function F(){return!1}function z(){return[]}function G(t,e){this.observer=t,this.accumulator=e.accumulator,this.hasSeed=e.hasSeed,this.seed=e.seed,this.hasAccumulation=!1,this.accumulation=null,this.hasValue=!1,this.isStopped=!1}function $(t,e,r){var n=wt(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i}).concatAll()}function V(t,e,r){for(var n=0,i=t.length;i>n;n++)if(r(t[n],e))return n;return-1}function H(t){this.comparer=t,this.set=[]}function q(t,e,r){var n=wt(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i}).mergeAll()}var W={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},X=W[typeof window]&&window||this,Y=W[typeof r]&&r&&!r.nodeType&&r,K=W[typeof e]&&e&&!e.nodeType&&e,Z=K&&K.exports===Y&&Y,J=W[typeof n]&&n;!J||J.global!==J&&J.window!==J||(X=J);var Q={internals:{},config:{Promise:X.Promise},helpers:{}},tt=Q.helpers.noop=function(){},et=(Q.helpers.notDefined=function(t){return void 0===t},Q.helpers.identity=function(t){return t}),rt=(Q.helpers.pluck=function(t){return function(e){return e[t]}},Q.helpers.just=function(t){return function(){return t}},Q.helpers.defaultNow=Date.now),nt=Q.helpers.defaultComparer=function(t,e){return qt(t,e)},it=Q.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},ot=(Q.helpers.defaultKeySerializer=function(t){return t.toString()},Q.helpers.defaultError=function(t){throw t}),st=Q.helpers.isPromise=function(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then},at=(Q.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},Q.helpers.not=function(t){return!t},Q.helpers.isFunction=function(){var t=function(t){return"function"==typeof t||!1};return t(/x/)&&(t=function(t){return"function"==typeof t&&"[object Function]"==Nt.call(t)}),t}());Q.config.longStackSupport=!1;var ct=!1;try{throw new Error}catch(t){ct=!!t.stack}var ut,ht=l(),lt="From previous event:";(Q.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)}).prototype=Error.prototype;var pt=Q.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};pt.prototype=Error.prototype;var ft=Q.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};ft.prototype=Error.prototype;var dt=Q.NotSupportedError=function(t){this.message=t||"This operation is not supported",Error.call(this)};dt.prototype=Error.prototype;var mt=Q.NotImplementedError=function(t){this.message=t||"This operation is not implemented",Error.call(this)};mt.prototype=Error.prototype;var vt=Q.helpers.notImplemented=function(){throw new mt},gt=Q.helpers.notSupported=function(){throw new dt},yt="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";X.Set&&"function"==typeof(new X.Set)["@@iterator"]&&(yt="@@iterator");var bt=Q.doneEnumerator={done:!0,value:i},_t=Q.helpers.isIterable=function(t){return t[yt]!==i},xt=Q.helpers.isArrayLike=function(t){return t&&t.length!==i};Q.helpers.iterator=yt;var wt=Q.internals.bindCallback=function(t,e,r){if(void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)}}return function(){return t.apply(e,arguments)}},St=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Mt=St.length,Et="[object Arguments]",Tt="[object Array]",Ct="[object Boolean]",Ot="[object Date]",Pt="[object Error]",At="[object Number]",jt="[object Object]",Rt="[object RegExp]",Lt="[object String]",Nt=Object.prototype.toString,It=Object.prototype.hasOwnProperty,Dt=Nt.call(arguments)==Et,kt=Error.prototype,Ft=Object.prototype,Bt=String.prototype,Ut=Ft.propertyIsEnumerable;try{!(Nt.call(document)==jt&&!({toString:0}+""))}catch(t){!0}var zt={};zt[Tt]=zt[Ot]=zt[At]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},zt[Ct]=zt[Lt]={constructor:!0,toString:!0,valueOf:!0},zt[Pt]=zt["[object Function]"]=zt[Rt]={constructor:!0,toString:!0},zt[jt]={constructor:!0};var Gt={};!function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var r in new t)e.push(r);for(r in arguments);Gt.enumErrorProps=Ut.call(kt,"message")||Ut.call(kt,"name"),Gt.enumPrototypes=Ut.call(t,"prototype"),Gt.nonEnumArgs=0!=r,Gt.nonEnumShadows=!/valueOf/.test(e)}(1);var $t=Q.internals.isObject=function(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1},Vt=function(t){return!(!t||"object"!=typeof t)&&Nt.call(t)==Et};Dt||(Vt=function(t){return!(!t||"object"!=typeof t)&&It.call(t,"callee")});var Ht,qt=Q.internals.isEqual=function(t,e){return g(t,e,[],[])},Wt=Array.prototype.slice,Xt=this.inherits=Q.internals.inherits=function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r},Yt=Q.internals.addProperties=function(t){for(var e=[],r=1,n=arguments.length;n>r;r++)e.push(arguments[r]);for(var i=0,o=e.length;o>i;i++){var s=e[i];for(var a in s)t[a]=s[a]}},Kt=Q.internals.addRef=function(t,e){return new Tr(function(r){return new te(e.getDisposable(),t.subscribe(r))})},Zt={e:{}};w.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var Jt=Q.internals.PriorityQueue=function(t){this.items=new Array(t),this.length=0},Qt=Jt.prototype;Qt.isHigherPriority=function(t,e){return this.items[t].compareTo(this.items[e])<0},Qt.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var r=this.items[t];this.items[t]=this.items[e],this.items[e]=r,this.percolate(e)}}},Qt.heapify=function(t){if(+t||(t=0),!(t>=this.length||0>t)){var e=2*t+1,r=2*t+2,n=t;if(e<this.length&&this.isHigherPriority(e,n)&&(n=e),r<this.length&&this.isHigherPriority(r,n)&&(n=r),n!==t){var i=this.items[t];this.items[t]=this.items[n],this.items[n]=i,this.heapify(n)}}},Qt.peek=function(){return this.items[0].value},Qt.removeAt=function(t){this.items[t]=this.items[--this.length],this.items[this.length]=i,this.heapify()},Qt.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Qt.enqueue=function(t){var e=this.length++;this.items[e]=new w(Jt.count++,t),this.percolate(e)},Qt.remove=function(t){for(var e=0;e<this.length;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},Jt.count=0;var te=Q.CompositeDisposable=function(){var t,e,r=[];if(Array.isArray(arguments[0]))r=arguments[0],e=r.length;else for(e=arguments.length,r=new Array(e),t=0;e>t;t++)r[t]=arguments[t];for(t=0;e>t;t++)if(!oe(r[t]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},ee=te.prototype;ee.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ee.remove=function(t){var e=!1;if(!this.isDisposed){var r=this.disposables.indexOf(t);-1!==r&&(e=!0,this.disposables.splice(r,1),this.length--,t.dispose())}return e},ee.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var t=this.disposables.length,e=new Array(t),r=0;t>r;r++)e[r]=this.disposables[r];for(this.disposables=[],this.length=0,r=0;t>r;r++)e[r].dispose()}};var re=Q.Disposable=function(t){this.isDisposed=!1,this.action=t||tt};re.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ne=re.create=function(t){return new re(t)},ie=re.empty={dispose:tt},oe=re.isDisposable=function(t){return t&&at(t.dispose)},se=re.checkDisposed=function(t){if(t.isDisposed)throw new pt},ae=Q.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};ae.prototype.getDisposable=function(){return this.current},ae.prototype.setDisposable=function(t){if(this.current)throw new Error("Disposable has already been assigned");var e=this.isDisposed;!e&&(this.current=t),e&&t&&t.dispose()},ae.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var ce=Q.SerialDisposable=function(){this.isDisposed=!1,this.current=null};ce.prototype.getDisposable=function(){return this.current},ce.prototype.setDisposable=function(t){var e=this.isDisposed;if(!e){var r=this.current;this.current=t}r&&r.dispose(),e&&t&&t.dispose()},ce.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var ue=Q.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,0===--this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ie:new t(this)},e}();S.prototype.dispose=function(){this.scheduler.scheduleWithState(this,M)};var he=Q.internals.ScheduledItem=function(t,e,r,n,i){this.scheduler=t,this.state=e,this.action=r,this.dueTime=n,this.comparer=i||it,this.disposable=new ae};he.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},he.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},he.prototype.isCancelled=function(){return this.disposable.isDisposed},he.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var le=Q.Scheduler=function(){function t(t,e,r,n){this.now=t,this._schedule=e,this._scheduleRelative=r,this._scheduleAbsolute=n}function e(t,e){return e(),ie}t.isScheduler=function(e){return e instanceof t};var r=t.prototype;return r.schedule=function(t){return this._schedule(t,e)},r.scheduleWithState=function(t,e){return this._schedule(t,e)},r.scheduleWithRelative=function(t,r){return this._scheduleRelative(r,t,e)},r.scheduleWithRelativeAndState=function(t,e,r){return this._scheduleRelative(t,e,r)},r.scheduleWithAbsolute=function(t,r){return this._scheduleAbsolute(r,t,e)},r.scheduleWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute(t,e,r)},t.now=rt,t.normalize=function(t){return 0>t&&(t=0),t},t}(),pe=le.normalize,fe=le.isScheduler;!function(t){function e(t,e){function r(e){i(e,function(e){var n=!1,i=!1,s=t.scheduleWithState(e,function(t,e){return n?o.remove(s):i=!0,r(e),ie});i||(o.add(s),n=!0)})}var n=e[0],i=e[1],o=new te;return r(n),o}function r(t,e,r){function n(e){o(e,function(e,i){var o=!1,a=!1,c=t[r](e,i,function(t,e){return o?s.remove(c):a=!0,n(e),ie});a||(s.add(c),o=!0)})}var i=e[0],o=e[1],s=new te;return n(i),s}function n(t,e){t(function(r){e(t,r)})}t.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,n)},t.scheduleRecursiveWithState=function(t,r){return this.scheduleWithState([t,r],e)},t.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,n)},t.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative([t,n],e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},t.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,n)},t.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute([t,n],e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})}}(le.prototype),le.prototype,le.prototype.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,e)},le.prototype.schedulePeriodicWithState=function(t,e,r){if(void 0===X.setInterval)throw new dt;e=pe(e);var n=t,i=X.setInterval(function(){n=r(n)},e);return ne(function(){X.clearInterval(i)})},function(t){t.catchError=t.catch=function(t){return new xe(this,t)}}(le.prototype);var de,me,ve=(Q.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(t){throw this._cancel.dispose(),t}}function e(t,e,r,n){this._scheduler=t,this._state=e,this._period=r,this._action=n}return e.prototype.start=function(){var e=new ae;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}(),le.immediate=function(){return new le(rt,function(t,e){return e(this,t)},gt,gt)}()),ge=le.currentThread=function(){function t(){for(;e.length>0;){var t=e.dequeue();!t.isCancelled()&&t.invoke()}}var e,r=new le(rt,function(r,n){var i=new he(this,r,n,this.now());if(e)e.enqueue(i);else{(e=new Jt(4)).enqueue(i);var o=_(t)();if(e=null,o===Zt)return x(o.e)}return i.disposable},gt,gt);return r.scheduleRequired=function(){return!e},r}(),ye=function(){var t,e=tt;if(X.setTimeout)t=X.setTimeout,e=X.clearTimeout;else{if(!X.WScript)throw new dt;t=function(t,e){X.WScript.Sleep(e),t()}}return{setTimeout:t,clearTimeout:e}}(),be=ye.setTimeout,_e=ye.clearTimeout;!function(){function e(t){if(o)be(function(){e(t)},0);else{var r=i[t];if(r){o=!0;var n=_(r)();if(me(t),o=!1,n===Zt)return x(n.e)}}}function r(t){"string"==typeof t.data&&t.data.substring(0,c.length)===c&&e(t.data.substring(c.length))}var n=1,i={},o=!1;me=function(t){delete i[t]};var s=RegExp("^"+String(Nt).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),a="function"==typeof(a=J&&Z&&J.setImmediate)&&!s.test(a)&&a;if(at(a))de=function(t){var r=n++;return i[r]=t,a(function(){e(r)}),r};else if(void 0!==t&&"[object process]"==={}.toString.call(t))de=function(r){var o=n++;return i[o]=r,t.nextTick(function(){e(o)}),o};else if(function(){if(!X.postMessage||X.importScripts)return!1;var t=!1,e=X.onmessage;return X.onmessage=function(){t=!0},X.postMessage("","*"),X.onmessage=e,t}()){var c="ms.rx.schedule"+Math.random();X.addEventListener?X.addEventListener("message",r,!1):X.attachEvent?X.attachEvent("onmessage",r):X.onmessage=r,de=function(t){var e=n++;return i[e]=t,X.postMessage(c+currentId,"*"),e}}else if(X.MessageChannel){var u=new X.MessageChannel;u.port1.onmessage=function(t){e(t.data)},de=function(t){var e=n++;return i[e]=t,u.port2.postMessage(e),e}}else de="document"in X&&"onreadystatechange"in X.document.createElement("script")?function(t){var r=X.document.createElement("script"),o=n++;return i[o]=t,r.onreadystatechange=function(){e(o),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},X.document.documentElement.appendChild(r),o}:function(t){var r=n++;return i[r]=t,be(function(){e(r)},0),r}}();var xe=(le.timeout=le.default=function(){return new le(rt,function(t,e){var r=this,n=new ae,i=de(function(){!n.isDisposed&&n.setDisposable(e(r,t))});return new te(n,ne(function(){me(i)}))},function(t,e,r){var n=this,i=le.normalize(e),o=new ae;if(0===i)return n.scheduleWithState(t,r);var s=be(function(){!o.isDisposed&&o.setDisposable(r(n,t))},i);return new te(o,ne(function(){_e(s)}))},function(t,e,r){return this.scheduleWithRelativeAndState(t,e-this.now(),r)})}(),function(t){function e(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,r){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(r))}function n(t,e,r){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(r))}function i(i,o){this._scheduler=i,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,this._scheduler.now.bind(this._scheduler),e,r,n)}return Xt(i,t),i.prototype._clone=function(t){return new i(t,this._handler)},i.prototype._wrap=function(t){var e=this;return function(r,n){try{return t(e._getRecursiveWrapper(r),n)}catch(t){if(!e._handler(t))throw t;return ie}}},i.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},i.prototype.schedulePeriodicWithState=function(t,e,r){var n=this,i=!1,o=new ae;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return r(t)}catch(t){if(i=!0,!n._handler(t))throw t;return o.dispose(),null}})),o},i}(le)),we=Q.Notification=function(){function t(t,e,r,n,i,o){this.kind=t,this.value=e,this.exception=r,this._accept=n,this._acceptObservable=i,this.toString=o}return t.prototype.accept=function(t,e,r){return t&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,r)},t.prototype.toObservable=function(t){var e=this;return fe(t)||(t=ve),new Tr(function(r){return t.scheduleWithState(e,function(t,e){e._acceptObservable(r),"N"===e.kind&&r.onCompleted()})})},t}(),Se=we.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function r(){return"OnNext("+this.value+")"}return function(n){return new we("N",n,null,t,e,r)}}(),Me=we.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function r(){return"OnError("+this.exception+")"}return function(n){return new we("E",null,n,t,e,r)}}(),Ee=we.createOnCompleted=function(){function t(t,e,r){return r()}function e(t){return t.onCompleted()}function r(){return"OnCompleted()"}return function(){return new we("C",null,null,t,e,r)}}(),Te=Q.Observer=function(){};Te.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Te.prototype.asObserver=function(){return new Ae(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Te.prototype.checked=function(){return new je(this)};var Ce=Te.create=function(t,e,r){return t||(t=tt),e||(e=ot),r||(r=tt),new Ae(t,e,r)};Te.fromNotifier=function(t,e){return new Ae(function(r){return t.call(e,Se(r))},function(r){return t.call(e,Me(r))},function(){return t.call(e,Ee())})},Te.prototype.notifyOn=function(t){return new Re(t,this)},Te.prototype.makeSafe=function(t){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,t)};var Oe,Pe=Q.internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return Xt(e,t),e.prototype.next=vt,e.prototype.error=vt,e.prototype.completed=vt,e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.error(t),!0)},e}(Te),Ae=Q.AnonymousObserver=function(t){function e(e,r,n){t.call(this),this._onNext=e,this._onError=r,this._onCompleted=n}return Xt(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Pe),je=function(t){function e(e){t.call(this),this._observer=e,this._state=0}Xt(e,t);var r=e.prototype;return r.onNext=function(t){this.checkAccess();var e=_(this._observer.onNext).call(this._observer,t);this._state=0,e===Zt&&x(e.e)},r.onError=function(t){this.checkAccess();var e=_(this._observer.onError).call(this._observer,t);this._state=2,e===Zt&&x(e.e)},r.onCompleted=function(){this.checkAccess();var t=_(this._observer.onCompleted).call(this._observer);this._state=2,t===Zt&&x(t.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}(Te),Re=function(t){function e(e,r,n){t.call(this,e,r),this._cancel=n}return Xt(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},e}(Q.internals.ScheduledObserver=function(t){function e(e,r){t.call(this),this.scheduler=e,this.observer=r,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ce}return Xt(e,t),e.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},e.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},e.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},e.prototype.ensureActive=function(){var t=!1,e=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(e.queue.length>0){r=e.queue.shift();try{r()}catch(t){throw e.queue=[],e.hasFaulted=!0,t}t()}else e.isAcquired=!1}))},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},e}(Pe)),Le=Q.Observable=function(){function t(t){if(Q.config.longStackSupport&&ct){try{throw new Error}catch(t){this.stack=t.stack.substring(t.stack.indexOf("\n")+1)}var e=this;this._subscribe=function(r){var n=r.onError.bind(r);return r.onError=function(t){a(t,e),n(t)},t.call(e,r)}}else this._subscribe=t}return Oe=t.prototype,Oe.subscribe=Oe.forEach=function(t,e,r){return this._subscribe("object"==typeof t?t:Ce(t,e,r))},Oe.subscribeOnNext=function(t,e){return this._subscribe(Ce(void 0!==e?function(r){t.call(e,r)}:t))},Oe.subscribeOnError=function(t,e){return this._subscribe(Ce(null,void 0!==e?function(r){t.call(e,r)}:t))},Oe.subscribeOnCompleted=function(t,e){return this._subscribe(Ce(null,null,void 0!==e?function(){t.call(e)}:t))},t}(),Ne=Q.ObservableBase=function(t){function e(t){return t&&at(t.dispose)?t:at(t)?ne(t):ie}function r(t,r){var n=r[0],i=r[1],o=_(i.subscribeCore).call(i,n);return o!==Zt||n.fail(Zt.e)?void n.setDisposable(e(o)):x(Zt.e)}function n(t){var e=new Cr(t),n=[e,this];return ge.scheduleRequired()?ge.scheduleWithState(n,r):r(null,n),e}function i(){t.call(this,n)}return Xt(i,t),i.prototype.subscribeCore=vt,i}(Le),Ie=Q.internals.Enumerable=function(){},De=function(t){function e(e){this.sources=e,t.call(this)}function r(t,e,r){this.o=t,this.s=e,this.e=r,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){var e,n=new ce,i=ve.scheduleRecursiveWithState(this.sources[yt](),function(i,o){if(!e){var s=_(i.next).call(i);if(s===Zt)return t.onError(s.e);if(s.done)return t.onCompleted();var a=s.value;st(a)&&(a=$e(a));var c=new ae;n.setDisposable(c),c.setDisposable(a.subscribe(new r(t,o,i)))}});return new te(n,i,ne(function(){e=!0}))},r.prototype.onNext=function(t){this.isStopped||this.o.onNext(t)},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Ie.prototype.concat=function(){return new De(this)};var ke=function(t){function e(e){this.sources=e,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){var e,r=this.sources[yt](),n=new ce,i=ve.scheduleRecursiveWithState(null,function(i,o){if(!e){var s=_(r.next).call(r);if(s===Zt)return t.onError(s.e);if(s.done)return null!==i?t.onError(i):t.onCompleted();var a=s.value;st(a)&&(a=$e(a));var c=new ae;n.setDisposable(c),c.setDisposable(a.subscribe(function(e){t.onNext(e)},o,function(){t.onCompleted()}))}});return new te(n,i,ne(function(){e=!0}))},e}(Ne);Ie.prototype.catchError=function(){return new ke(this)},Ie.prototype.catchErrorWhen=function(t){var e=this;return new Tr(function(r){var n,i=new Pr,o=new Pr,s=t(i).subscribe(o),a=e[yt](),c=new ce,u=ve.scheduleRecursive(function(t){if(!n){var e=_(a.next).call(a);if(e===Zt)return r.onError(e.e);if(e.done)return void r.onCompleted();var s=e.value;st(s)&&(s=$e(s));var u=new ae,h=new ae;c.setDisposable(new te(h,u)),u.setDisposable(s.subscribe(function(t){r.onNext(t)},function(e){h.setDisposable(o.subscribe(t,function(t){r.onError(t)},function(){r.onCompleted()})),i.onNext(e)},function(){r.onCompleted()}))}});return new te(s,c,u,ne(function(){n=!0}))})};var Fe=function(t){function e(t,e){this.v=t,this.c=null==e?-1:e}function r(t){this.v=t.v,this.l=t.c}return Xt(e,Ie),e.prototype[yt]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?bt:(this.l>0&&this.l--,{done:!1,value:this.v})},e}(),Be=Ie.repeat=function(t,e){return new Fe(t,e)},Ue=function(t){function e(t,e,r){this.s=t,this.fn=e?wt(e,r,3):null}function r(t){this.i=-1,this.s=t.s,this.l=this.s.length,this.fn=t.fn}return Xt(e,Ie),e.prototype[yt]=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]}:bt},e}(),ze=Ie.of=function(t,e,r){return new Ue(t,e,r)};Oe.observeOn=function(t){var e=this;return new Tr(function(r){return e.subscribe(new Re(t,r))},e)},Oe.subscribeOn=function(t){var e=this;return new Tr(function(r){var n=new ae,i=new ce;return i.setDisposable(n),n.setDisposable(t.schedule(function(){i.setDisposable(new S(t,e.subscribe(r)))})),i},e)};var Ge=function(t){function e(e){this.p=e,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.p.then(function(e){t.onNext(e),t.onCompleted()},function(e){t.onError(e)}),ie},e}(Ne),$e=Le.fromPromise=function(t){return new Ge(t)};Oe.toPromise=function(t){if(t||(t=Q.config.Promise),!t)throw new dt("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,r){var n,i=!1;e.subscribe(function(t){n=t,i=!0},r,function(){i&&t(n)})})};var Ve=function(t){function e(e){this.source=e,t.call(this)}function r(t){this.o=t,this.a=[],this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t))},r.prototype.onNext=function(t){this.isStopped||this.a.push(t)},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},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(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.toArray=function(){return new Ve(this)},Le.create=Le.createWithDisposable=function(t,e){return new Tr(t,e)};var He=(Le.defer=function(t){return new Tr(function(e){var r;try{r=t()}catch(t){return ar(t).subscribe(e)}return st(r)&&(r=$e(r)),r.subscribe(e)})},function(t){function e(e){this.scheduler=e,t.call(this)}function r(t,e){this.observer=t,this.parent=e}function n(t,e){e.onCompleted()}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(t,this).run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState(this.observer,n)},e}(Ne)),qe=Le.empty=function(t){return fe(t)||(t=ve),new He(t)},We=function(t){function e(e,r,n){this.iterable=e,this.mapper=r,this.scheduler=n,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new Xe(t,this).run()},e}(Ne),Xe=function(){function t(t,e){this.observer=t,this.parent=e}return t.prototype.run=function(){var t=A(Object(this.parent.iterable)),e=this.observer,r=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,function(n,i){try{var o=t.next()}catch(t){return e.onError(t)}if(o.done)return e.onCompleted();var s=o.value;if(r)try{s=r(s,n)}catch(t){return e.onError(t)}e.onNext(s),i(n+1)})},t}(),Ye=Math.pow(2,53)-1;E.prototype[yt]=function(){return new T(this._s)},T.prototype[yt]=function(){return this},T.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:bt},C.prototype[yt]=function(){return new O(this._a)},O.prototype[yt]=function(){return this},O.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:bt};var Ke=Le.from=function(t,e,r,n){if(null==t)throw new Error("iterable cannot be null.");if(e&&!at(e))throw new Error("mapFn when provided must be a function");if(e)var i=wt(e,r,2);return fe(n)||(n=ge),new We(t,i,n)},Ze=function(t){function e(e,r){this.args=e,this.scheduler=r,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new L(t,this).run()},e}(Ne);L.prototype.run=function(){var t=this.observer,e=this.parent.args,r=e.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(n,i){r>n?(t.onNext(e[n]),i(n+1)):t.onCompleted()})};var Je=Le.fromArray=function(t,e){return fe(e)||(e=ge),new Ze(t,e)};Le.generate=function(t,e,r,n,i){return fe(i)||(i=ge),new Tr(function(o){var s=!0;return i.scheduleRecursiveWithState(t,function(t,i){var a,c;try{s?s=!1:t=r(t),(a=e(t))&&(c=n(t))}catch(t){return o.onError(t)}a?(o.onNext(c),i(t)):o.onCompleted()})})};var Qe=function(t){function e(){t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return ie},e}(Ne),tr=Le.never=function(){return new Qe};Le.of=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return new Ze(e,ge)},Le.ofWithScheduler=function(t){for(var e=arguments.length,r=new Array(e-1),n=1;e>n;n++)r[n-1]=arguments[n];return new Ze(r,t)};var er=function(t){function e(e,r){this.obj=e,this.keys=Object.keys(e),this.scheduler=r,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new I(t,this).run()},e}(Ne);I.prototype.run=function(){var t=this.observer,e=this.parent.obj,r=this.parent.keys,n=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(i,o){if(n>i){var s=r[i];t.onNext([s,e[s]]),o(i+1)}else t.onCompleted()})},Le.pairs=function(t,e){return e||(e=ge),new er(t,e)};var rr=function(t){function e(e,r,n){this.start=e,this.rangeCount=r,this.scheduler=n,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new nr(t,this).run()},e}(Ne),nr=function(){function t(t,e){this.observer=t,this.parent=e}return t.prototype.run=function(){var t=this.parent.start,e=this.parent.rangeCount,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})},t}();Le.range=function(t,e,r){return fe(r)||(r=ge),new rr(t,e,r)};var ir=function(t){function e(e,r,n){this.value=e,this.repeatCount=null==r?-1:r,this.scheduler=n,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new D(t,this).run()},e}(Ne);D.prototype.run=function(){var t=this.observer,e=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,function(r,n){return(-1===r||r>0)&&(t.onNext(e),r>0&&r--),0===r?t.onCompleted():void n(r)})},Le.repeat=function(t,e,r){return fe(r)||(r=ge),new ir(t,e,r)};var or=function(t){function e(e,r){this.value=e,this.scheduler=r,t.call(this)}function r(t,e){this.observer=t,this.parent=e}function n(t,e){var r=e[0],n=e[1];n.onNext(r),n.onCompleted()}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(t,this).run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],n)},e}(Ne),sr=(Le.return=Le.just=Le.returnValue=function(t,e){return fe(e)||(e=ve),new or(t,e)},function(t){function e(e,r){this.error=e,this.scheduler=r,t.call(this)}function r(t,e){this.o=t,this.p=e}function n(t,e){var r=e[0];e[1].onError(r)}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(t,this).run()},r.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],n)},e}(Ne)),ar=Le.throw=Le.throwError=Le.throwException=function(t,e){return fe(e)||(e=ve),new sr(t,e)};Le.using=function(t,e){return new Tr(function(r){var n,i,o=ie;try{(n=t())&&(o=n),i=e(n)}catch(t){return new te(ar(t).subscribe(r),o)}return new te(i.subscribe(r),o)})},Oe.amb=function(t){var e=this;return new Tr(function(r){function n(){o||(o=s,u.dispose())}function i(){o||(o=a,c.dispose())}var o,s="L",a="R",c=new ae,u=new ae;return st(t)&&(t=$e(t)),c.setDisposable(e.subscribe(function(t){n(),o===s&&r.onNext(t)},function(t){n(),o===s&&r.onError(t)},function(){n(),o===s&&r.onCompleted()})),u.setDisposable(t.subscribe(function(t){i(),o===a&&r.onNext(t)},function(t){i(),o===a&&r.onError(t)},function(){i(),o===a&&r.onCompleted()})),new te(c,u)})},Le.amb=function(){var t=tr(),e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var r=0,n=arguments.length;n>r;r++)e.push(arguments[r]);for(var r=0,n=e.length;n>r;r++)t=function(t,e){return t.amb(e)}(t,e[r]);return t},Oe.catch=Oe.catchError=Oe.catchException=function(t){return"function"==typeof t?k(this,t):cr([this,t])};var cr=Le.catchError=Le.catch=Le.catchException=function(){var t=[];if(Array.isArray(arguments[0]))t=arguments[0];else for(var e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return ze(t).catchError()};Oe.combineLatest=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return Array.isArray(e[0])?e[0].unshift(this):e.unshift(this),ur.apply(this,e)};var ur=Le.combineLatest=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new Tr(function(t){function r(e){if(a[e]=!0,c||(c=a.every(et))){try{var r=n.apply(null,h)}catch(e){return t.onError(e)}t.onNext(r)}else u.filter(function(t,r){return r!==e}).every(et)&&t.onCompleted()}function i(e){u[e]=!0,u.every(et)&&t.onCompleted()}for(var o=e.length,s=function(){return!1},a=y(o,s),c=!1,u=y(o,s),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(n){var o=e[n],s=new ae;st(o)&&(o=$e(o)),s.setDisposable(o.subscribe(function(t){h[n]=t,r(n)},function(e){t.onError(e)},function(){i(n)})),l[n]=s}(p);return new te(l)},this)};Oe.concat=function(){for(var t=[],e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return t.unshift(this),lr.apply(null,t)};var hr=function(t){function e(e){this.sources=e,t.call(this)}function r(t,e){this.sources=t,this.o=e}return Xt(e,t),e.prototype.subscribeCore=function(t){return new r(this.sources,t).run()},r.prototype.run=function(){var t,e=new ce,r=this.sources,n=r.length,i=this.o,o=ve.scheduleRecursiveWithState(0,function(o,s){if(!t){if(o===n)return i.onCompleted();var a=r[o];st(a)&&(a=$e(a));var c=new ae;e.setDisposable(c),c.setDisposable(a.subscribe(function(t){i.onNext(t)},function(t){i.onError(t)},function(){s(o+1)}))}});return new te(e,o,ne(function(){t=!0}))},e}(Ne),lr=Le.concat=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{t=new Array(arguments.length);for(var e=0,r=arguments.length;r>e;e++)t[e]=arguments[e]}return new hr(t)};Oe.concatAll=Oe.concatObservable=function(){return this.merge(1)};var pr=function(t){function e(e,r){this.source=e,this.maxConcurrent=r,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){var e=new te;return e.add(this.source.subscribe(new fr(t,this.maxConcurrent,e))),e},e}(Ne),fr=function(){function t(t,e,r){this.o=t,this.max=e,this.g=r,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function e(t,e){this.parent=t,this.sad=e,this.isStopped=!1}return t.prototype.handleSubscribe=function(t){var r=new ae;this.g.add(r),st(t)&&(t=$e(t)),r.setDisposable(t.subscribe(new e(this,r)))},t.prototype.onNext=function(t){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(t)):this.q.push(t))},t.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e.prototype.onNext=function(t){this.isStopped||this.parent.o.onNext(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.parent.o.onError(t))},e.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var t=this.parent;t.g.remove(this.sad),t.q.length>0?t.handleSubscribe(t.q.shift()):(t.activeCount--,t.done&&0===t.activeCount&&t.o.onCompleted())}},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(t),!0)},t}();Oe.merge=function(t){return"number"!=typeof t?dr(this,t):new pr(this,t)};var dr=Le.merge=function(){var t,e,r=[],n=arguments.length;if(arguments[0])if(fe(arguments[0]))for(t=arguments[0],e=1;n>e;e++)r.push(arguments[e]);else for(t=ve,e=0;n>e;e++)r.push(arguments[e]);else for(t=ve,e=1;n>e;e++)r.push(arguments[e]);return Array.isArray(r[0])&&(r=r[0]),N(t,r).mergeAll()},mr=Q.CompositeError=function(t){this.name="NotImplementedError",this.innerErrors=t,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};mr.prototype=Error.prototype,Le.mergeDelayError=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{var e=arguments.length;t=new Array(e);for(var r=0;e>r;r++)t[r]=arguments[r]}var n=N(null,t);return new Tr(function(t){function e(){0===s.length?t.onCompleted():1===s.length?t.onError(s[0]):t.onError(new mr(s))}var r=new te,i=new ae,o=!1,s=[];return r.add(i),i.setDisposable(n.subscribe(function(n){var i=new ae;r.add(i),st(n)&&(n=$e(n)),i.setDisposable(n.subscribe(function(e){t.onNext(e)},function(t){s.push(t),r.remove(i),o&&1===r.length&&e()},function(){r.remove(i),o&&1===r.length&&e()}))},function(t){s.push(t),o=!0,1===r.length&&e()},function(){o=!0,1===r.length&&e()})),r})};var vr=function(t){function e(e){this.source=e,t.call(this)}function r(t,e){this.o=t,this.g=e,this.isStopped=!1,this.done=!1}function n(t,e,r){this.parent=t,this.g=e,this.sad=r,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){var e=new te,n=new ae;return e.add(n),n.setDisposable(this.source.subscribe(new r(t,e))),e},r.prototype.onNext=function(t){if(!this.isStopped){var e=new ae;this.g.add(e),st(t)&&(t=$e(t)),e.setDisposable(t.subscribe(new n(this,this.g,e)))}},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},n.prototype.onNext=function(t){this.isStopped||this.parent.o.onNext(t)},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.parent.o.onError(t))},n.prototype.onCompleted=function(){if(!this.isStopped){var t=this.parent;this.isStopped=!0,t.g.remove(this.sad),t.done&&1===t.g.length&&t.o.onCompleted()}},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(t),!0)},e}(Ne);Oe.mergeAll=Oe.mergeObservable=function(){return new vr(this)},Oe.onErrorResumeNext=function(t){if(!t)throw new Error("Second observable is required");return gr([this,t])};var gr=Le.onErrorResumeNext=function(){var t=[];if(Array.isArray(arguments[0]))t=arguments[0];else for(var e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return new Tr(function(e){var r=0,n=new ce,i=ve.scheduleRecursive(function(i){var o,s;r<t.length?(o=t[r++],st(o)&&(o=$e(o)),s=new ae,n.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),i,i))):e.onCompleted()});return new te(n,i)})};Oe.skipUntil=function(t){var e=this;return new Tr(function(r){var n=!1,i=new te(e.subscribe(function(t){n&&r.onNext(t)},function(t){r.onError(t)},function(){n&&r.onCompleted()}));st(t)&&(t=$e(t));var o=new ae;return i.add(o),o.setDisposable(t.subscribe(function(){n=!0,o.dispose()},function(t){r.onError(t)},function(){o.dispose()})),i},e)};var yr=function(t){function e(e){this.source=e,t.call(this)}function r(t,e){this.o=t,this.inner=e,this.stopped=!1,this.latest=0,this.hasLatest=!1,this.isStopped=!1}function n(t,e){this.parent=t,this.id=e,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){var e=new ce,n=this.source.subscribe(new r(t,e));return new te(n,e)},r.prototype.onNext=function(t){if(!this.isStopped){var e=new ae,r=++this.latest;this.hasLatest=!0,this.inner.setDisposable(e),st(t)&&(t=$e(t)),e.setDisposable(t.subscribe(new n(this,r)))}},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.stopped=!0,!this.hasLatest&&this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},n.prototype.onNext=function(t){this.isStopped||this.parent.latest===this.id&&this.parent.o.onNext(t)},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&this.parent.o.onError(t))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.isStopped&&this.parent.o.onCompleted()))},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(t),!0)},e}(Ne);Oe.switch=Oe.switchLatest=function(){return new yr(this)};var br=function(t){function e(e,r){this.source=e,this.other=st(r)?$e(r):r,t.call(this)}function r(t){this.o=t,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return new te(this.source.subscribe(t),this.other.subscribe(new r(t)))},r.prototype.onNext=function(t){this.isStopped||this.o.onCompleted()},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){!this.isStopped&&(this.isStopped=!0)},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.takeUntil=function(t){return new br(this,t)},Oe.withLatestFrom=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.pop(),i=this;return Array.isArray(e[0])&&(e=e[0]),new Tr(function(t){for(var r=e.length,o=y(r,F),s=!1,a=new Array(r),c=new Array(r+1),u=0;r>u;u++)!function(r){var n=e[r],i=new ae;st(n)&&(n=$e(n)),i.setDisposable(n.subscribe(function(t){a[r]=t,o[r]=!0,s=o.every(et)},function(e){t.onError(e)},tt)),c[r]=i}(u);var h=new ae;return h.setDisposable(i.subscribe(function(e){var r=[e].concat(a);if(s){var i=_(n).apply(null,r);return i===Zt?t.onError(i.e):void t.onNext(i)}},function(e){t.onError(e)},function(){t.onCompleted()})),c[r]=h,new te(c)},this)},Oe.zip=function(){if(Array.isArray(arguments[0]))return B.apply(this,arguments);for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=this,i=e.pop();return e.unshift(n),new Tr(function(t){for(var r=e.length,o=y(r,U),s=y(r,F),a=new Array(r),c=0;r>c;c++)!function(r){var c=e[r],u=new ae;st(c)&&(c=$e(c)),u.setDisposable(c.subscribe(function(e){if(o[r].push(e),o.every(function(t){return t.length>0})){var a=o.map(function(t){return t.shift()}),c=_(i).apply(n,a);if(c===Zt)return t.onError(c.e);t.onNext(c)}else s.filter(function(t,e){return e!==r}).every(et)&&t.onCompleted()},function(e){t.onError(e)},function(){s[r]=!0,s.every(et)&&t.onCompleted()})),a[r]=u}(c);return new te(a)},n)},Le.zip=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.shift();return n.zip.apply(n,e)},Le.zipArray=function(){var t;if(Array.isArray(arguments[0]))t=arguments[0];else{var e=arguments.length;t=new Array(e);for(var r=0;e>r;r++)t[r]=arguments[r]}return new Tr(function(e){for(var r=t.length,n=y(r,z),i=y(r,F),o=new Array(r),s=0;r>s;s++)!function(r){o[r]=new ae,o[r].setDisposable(t[r].subscribe(function(t){if(n[r].push(t),n.every(function(t){return t.length>0})){var o=n.map(function(t){return t.shift()});e.onNext(o)}else if(i.filter(function(t,e){return e!==r}).every(et))return e.onCompleted()},function(t){e.onError(t)},function(){i[r]=!0,i.every(et)&&e.onCompleted()}))}(s);return new te(o)})},Oe.asObservable=function(){var t=this;return new Tr(function(e){return t.subscribe(e)},t)},Oe.bufferWithCount=function(t,e){return"number"!=typeof e&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Oe.dematerialize=function(){var t=this;return new Tr(function(e){return t.subscribe(function(t){return t.accept(e)},function(t){e.onError(t)},function(){e.onCompleted()})},this)},Oe.distinctUntilChanged=function(t,e){var r=this;return e||(e=nt),new Tr(function(n){var i,o=!1;return r.subscribe(function(r){var s=r;if(t&&(s=_(t)(r))===Zt)return n.onError(s.e);if(o){var a=_(e)(i,s);if(a===Zt)return n.onError(a.e)}o&&a||(o=!0,i=s,n.onNext(r))},function(t){n.onError(t)},function(){n.onCompleted()})},this)};var _r=function(t){function e(e,r,n,i){this.source=e,this.t=!r||at(r)?Ce(r||tt,n||tt,i||tt):r,t.call(this)}function r(t,e){this.o=t,this.t=e,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this.t))},r.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.t.onNext).call(this.t,t);e===Zt&&this.o.onError(e.e),this.o.onNext(t)}},r.prototype.onError=function(t){if(!this.isStopped){this.isStopped=!0;var e=_(this.t.onError).call(this.t,t);if(e===Zt)return this.o.onError(e.e);this.o.onError(t)}},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var t=_(this.t.onCompleted).call(this.t);if(t===Zt)return this.o.onError(t.e);this.o.onCompleted()}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.do=Oe.tap=Oe.doAction=function(t,e,r){return new _r(this,t,e,r)},Oe.doOnNext=Oe.tapOnNext=function(t,e){return this.tap(void 0!==e?function(r){t.call(e,r)}:t)},Oe.doOnError=Oe.tapOnError=function(t,e){return this.tap(tt,void 0!==e?function(r){t.call(e,r)}:t)},Oe.doOnCompleted=Oe.tapOnCompleted=function(t,e){return this.tap(tt,null,void 0!==e?function(){t.call(e)}:t)},Oe.finally=Oe.ensure=function(t){var e=this;return new Tr(function(r){var n;try{n=e.subscribe(r)}catch(e){throw t(),e}return ne(function(){try{n.dispose()}catch(t){throw t}finally{t()}})},this)},Oe.finallyAction=function(t){return this.ensure(t)};var xr=function(t){function e(e){this.source=e,t.call(this)}function r(t){this.o=t,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t))},r.prototype.onNext=tt,r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(t),!0)},e}(Ne);Oe.ignoreElements=function(){return new xr(this)},Oe.materialize=function(){var t=this;return new Tr(function(e){return t.subscribe(function(t){e.onNext(Se(t))},function(t){e.onNext(Me(t)),e.onCompleted()},function(){e.onNext(Ee()),e.onCompleted()})},t)},Oe.repeat=function(t){return Be(this,t).concat()},Oe.retry=function(t){return Be(this,t).catchError()},Oe.retryWhen=function(t){return Be(this).catchErrorWhen(t)};var wr=function(t){function e(e,r,n,i){this.source=e,this.accumulator=r,this.hasSeed=n,this.seed=i,t.call(this)}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new G(t,this))},e}(Ne);G.prototype.onNext=function(t){if(!this.isStopped){!this.hasValue&&(this.hasValue=!0);try{this.hasAccumulation?this.accumulation=this.accumulator(this.accumulation,t):(this.accumulation=this.hasSeed?this.accumulator(this.seed,t):t,this.hasAccumulation=!0)}catch(t){return this.observer.onError(t)}this.observer.onNext(this.accumulation)}},G.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.observer.onError(t))},G.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},G.prototype.dispose=function(){this.isStopped=!0},G.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(t),!0)},Oe.scan=function(){var t,e,r=!1;return 2===arguments.length?(r=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new wr(this,e,r,t)},Oe.skipLast=function(t){if(0>t)throw new ft;var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&r.onNext(n.shift())},function(t){r.onError(t)},function(){r.onCompleted()})},e)},Oe.startWith=function(){var t,e=0;arguments.length&&fe(arguments[0])?(t=arguments[0],e=1):t=ve;for(var r=[],n=e,i=arguments.length;i>n;n++)r.push(arguments[n]);return ze([Je(r,t),this]).concat()},Oe.takeLast=function(t){if(0>t)throw new ft;var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&n.shift()},function(t){r.onError(t)},function(){for(;n.length>0;)r.onNext(n.shift());r.onCompleted()})},e)},Oe.takeLastBuffer=function(t){var e=this;return new Tr(function(r){var n=[];return e.subscribe(function(e){n.push(e),n.length>t&&n.shift()},function(t){r.onError(t)},function(){r.onNext(n),r.onCompleted()})},e)},Oe.windowWithCount=function(t,e){var r=this;if(+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new ft;if(null==e&&(e=t),+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new ft;return new Tr(function(n){function i(){var t=new Pr;c.push(t),n.onNext(Kt(t,s))}var o=new ae,s=new ue(o),a=0,c=[];return i(),o.setDisposable(r.subscribe(function(r){for(var n=0,o=c.length;o>n;n++)c[n].onNext(r);var s=a-t+1;s>=0&&s%e==0&&c.shift().onCompleted(),++a%e==0&&i()},function(t){for(;c.length>0;)c.shift().onError(t);n.onError(t)},function(){for(;c.length>0;)c.shift().onCompleted();n.onCompleted()})),s},r)},Oe.selectConcat=Oe.concatMap=function(t,e,r){return at(t)&&at(e)?this.concatMap(function(r,n){var i=t(r,n);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i.map(function(t,i){return e(r,t,n,i)})}):at(t)?$(this,t,r):$(this,function(){return t})},Oe.concatMapObserver=Oe.selectConcatObserver=function(t,e,r,n){var i=this,o=wt(t,n,2),s=wt(e,n,1),a=wt(r,n,0);return new Tr(function(t){var e=0;return i.subscribe(function(r){var n;try{n=o(r,e++)}catch(e){return void t.onError(e)}st(n)&&(n=$e(n)),t.onNext(n)},function(e){var r;try{r=s(e)}catch(e){return void t.onError(e)}st(r)&&(r=$e(r)),t.onNext(r),t.onCompleted()},function(){var e;try{e=a()}catch(e){return void t.onError(e)}st(e)&&(e=$e(e)),t.onNext(e),t.onCompleted()})},this).concatAll()},Oe.defaultIfEmpty=function(t){var e=this;return t===i&&(t=null),new Tr(function(r){var n=!1;return e.subscribe(function(t){n=!0,r.onNext(t)},function(t){r.onError(t)},function(){!n&&r.onNext(t),r.onCompleted()})},e)},H.prototype.push=function(t){var e=-1===V(this.set,t,this.comparer);return e&&this.set.push(t),e},Oe.distinct=function(t,e){var r=this;return e||(e=nt),new Tr(function(n){var i=new H(e);return r.subscribe(function(e){var r=e;if(t)try{r=t(e)}catch(t){return void n.onError(t)}i.push(r)&&n.onNext(e)},function(t){n.onError(t)},function(){n.onCompleted()})},this)};var Sr=function(t){function e(e,r,n){this.source=e,this.selector=wt(r,n,3),t.call(this)}function r(t,e){return function(r,n,i){return t.call(this,e.selector(r,n,i),n,i)}}function n(t,e,r){this.o=t,this.selector=e,this.source=r,this.i=0,this.isStopped=!1}return Xt(e,t),e.prototype.internalMap=function(t,n){return new e(this.source,r(t,this),n)},e.prototype.subscribeCore=function(t){return this.source.subscribe(new n(t,this.selector,this))},n.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.selector)(t,this.i++,this.source);return e===Zt?this.o.onError(e.e):void this.o.onNext(e)}},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.map=Oe.select=function(t,e){var r="function"==typeof t?t:function(){return t};return this instanceof Sr?this.internalMap(r,e):new Sr(this,r,e)},Oe.pluck=function(){var t=arguments,e=arguments.length;if(0===e)throw new Error("List of properties cannot be empty.");return this.map(function(r){for(var n=r,o=0;e>o;o++){var s=n[t[o]];if(void 0===s)return i;n=s}return n})},Oe.flatMapObserver=Oe.selectManyObserver=function(t,e,r,n){var i=this;return new Tr(function(o){var s=0;return i.subscribe(function(e){var r;try{r=t.call(n,e,s++)}catch(t){return void o.onError(t)}st(r)&&(r=$e(r)),o.onNext(r)},function(t){var r;try{r=e.call(n,t)}catch(t){return void o.onError(t)}st(r)&&(r=$e(r)),o.onNext(r),o.onCompleted()},function(){var t;try{t=r.call(n)}catch(t){return void o.onError(t)}st(t)&&(t=$e(t)),o.onNext(t),o.onCompleted()})},i).mergeAll()},Oe.selectMany=Oe.flatMap=function(t,e,r){return at(t)&&at(e)?this.flatMap(function(r,n){var i=t(r,n);return st(i)&&(i=$e(i)),(xt(i)||_t(i))&&(i=Ke(i)),i.map(function(t,i){return e(r,t,n,i)})},r):at(t)?q(this,t,r):q(this,function(){return t})},Oe.selectSwitch=Oe.flatMapLatest=Oe.switchMap=function(t,e){return this.select(t,e).switchLatest()};var Mr=function(t){function e(e,r){this.source=e,this.skipCount=r,t.call(this)}function r(t,e){this.c=e,this.r=e,this.o=t,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t,this.skipCount))},r.prototype.onNext=function(t){this.isStopped||(this.r<=0?this.o.onNext(t):this.r--)},r.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.skip=function(t){if(0>t)throw new ft;return new Mr(this,t)},Oe.skipWhile=function(t,e){var r=this,n=wt(t,e,3);return new Tr(function(t){var e=0,i=!1;return r.subscribe(function(o){if(!i)try{i=!n(o,e++,r)}catch(e){return void t.onError(e)}i&&t.onNext(o)},function(e){t.onError(e)},function(){t.onCompleted()})},r)},Oe.take=function(t,e){if(0>t)throw new ft;if(0===t)return qe(e);var r=this;return new Tr(function(e){var n=t;return r.subscribe(function(t){n-- >0&&(e.onNext(t),0>=n&&e.onCompleted())},function(t){e.onError(t)},function(){e.onCompleted()})},r)},Oe.takeWhile=function(t,e){var r=this,n=wt(t,e,3);return new Tr(function(t){var e=0,i=!0;return r.subscribe(function(o){if(i){try{i=n(o,e++,r)}catch(e){return void t.onError(e)}i?t.onNext(o):t.onCompleted()}},function(e){t.onError(e)},function(){t.onCompleted()})},r)};var Er=function(t){function e(e,r,n){this.source=e,this.predicate=wt(r,n,3),t.call(this)}function r(t,e){return function(r,n,i){return e.predicate(r,n,i)&&t.call(this,r,n,i)}}function n(t,e,r){this.o=t,this.predicate=e,this.source=r,this.i=0,this.isStopped=!1}return Xt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new n(t,this.predicate,this))},e.prototype.internalFilter=function(t,n){return new e(this.source,r(t,this),n)},n.prototype.onNext=function(t){if(!this.isStopped){var e=_(this.predicate)(t,this.i++,this.source);return e===Zt?this.o.onError(e.e):void(e&&this.o.onNext(t))}},n.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.o.onError(t))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.o.onError(t),!0)},e}(Ne);Oe.filter=Oe.where=function(t,e){return this instanceof Er?this.internalFilter(t,e):new Er(this,t,e)},Oe.transduce=function(t){function e(t){return{"@@transducer/init":function(){return t},"@@transducer/step":function(t,e){return t.onNext(e)},"@@transducer/result":function(t){return t.onCompleted()}}}var r=this;return new Tr(function(n){var i=t(e(n));return r.subscribe(function(t){try{i["@@transducer/step"](n,t)}catch(t){n.onError(t)}},function(t){n.onError(t)},function(){i["@@transducer/result"](n)})},r)};var Tr=Q.AnonymousObservable=function(t){function e(t){return t&&at(t.dispose)?t:at(t)?ne(t):ie}function r(t,r){var n=r[0],i=_(r[1])(n);return i!==Zt||n.fail(Zt.e)?void n.setDisposable(e(i)):x(Zt.e)}function n(e,n){this.source=n,t.call(this,function(t){var n=new Cr(t),i=[n,e];return ge.scheduleRequired()?ge.scheduleWithState(i,r):r(null,i),n})}return Xt(n,t),n}(Le),Cr=function(t){function e(e){t.call(this),this.observer=e,this.m=new ae}Xt(e,t);var r=e.prototype;return r.next=function(t){var e=_(this.observer.onNext).call(this.observer,t);e===Zt&&(this.dispose(),x(e.e))},r.error=function(t){var e=_(this.observer.onError).call(this.observer,t);this.dispose(),e===Zt&&x(e.e)},r.completed=function(){var t=_(this.observer.onCompleted).call(this.observer);this.dispose(),t===Zt&&x(t.e)},r.setDisposable=function(t){this.m.setDisposable(t)},r.getDisposable=function(){return this.m.getDisposable()},r.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Pe),Or=function(t,e){this.subject=t,this.observer=e};Or.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Pr=Q.Subject=function(t){function e(t){return se(this),this.isStopped?this.hasError?(t.onError(this.error),ie):(t.onCompleted(),ie):(this.observers.push(t),new Or(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Xt(r,t),Yt(r.prototype,Te.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(se(this),!this.isStopped){this.isStopped=!0;for(var t=0,e=o(this.observers),r=e.length;r>t;t++)e[t].onCompleted();this.observers.length=0}},onError:function(t){if(se(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){if(se(this),!this.isStopped)for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new Ar(t,e)},r}(Le),Ar=(Q.AsyncSubject=function(t){function e(t){return se(this),this.isStopped?(this.hasError?t.onError(this.error):this.hasValue?(t.onNext(this.value),t.onCompleted()):t.onCompleted(),ie):(this.observers.push(t),new Or(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Xt(r,t),Yt(r.prototype,Te,{hasObservers:function(){return se(this),this.observers.length>0},onCompleted:function(){var t;if(se(this),!this.isStopped){this.isStopped=!0;var e=o(this.observers),r=e.length;if(this.hasValue)for(t=0;r>t;t++){var n=e[t];n.onNext(this.value),n.onCompleted()}else for(t=0;r>t;t++)e[t].onCompleted();this.observers.length=0}},onError:function(t){if(se(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=t;for(var e=0,r=o(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){se(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(Le),Q.AnonymousSubject=function(t){function e(t){return this.observable.subscribe(t)}function r(r,n){this.observer=r,this.observable=n,t.call(this,e)}return Xt(r,t),Yt(r.prototype,Te.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),r}(Le));Y&&K?Z?(K.exports=Q).Rx=Q:Y.Rx=Q:X.Rx=Q;var jr=l()}).call(this)}).call(this,t(150),void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{150:150}]},{},[1])(1)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],16:[function(t,e,r){(function(r){var n,i=void 0!==r?r:"undefined"!=typeof window?window:{},o=t("min-document");"undefined"!=typeof document?n=document:(n=i["__GLOBAL_DOCUMENT_CACHE@4"])||(n=i["__GLOBAL_DOCUMENT_CACHE@4"]=o),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":4}],17:[function(t,e,r){r.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,h=-7,l=r?i-1:0,p=r?-1:1,f=t[e+l];for(l+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=p,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,h=(1<<u)-1,l=h>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*m}},{}],18:[function(t,e,r){(function(t){"use strict";var r="undefined"!=typeof window?window:void 0!==t?t:{};e.exports=function(t,e){return t in r?r[t]:(r[t]=e,e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e,r){"use strict";var n=t("./index.js");e.exports=function(t,e,r){var i="__INDIVIDUAL_ONE_VERSION_"+t,o=n(i+"_ENFORCE_SINGLETON",e);if(o!==e)throw new Error("Can only have one copy of "+t+".\nYou already have version "+o+" installed.\nThis means you cannot install version "+e);return n(i,r)}},{"./index.js":18}],20:[function(t,e,r){"use strict";e.exports=function(t){return"object"==typeof t&&null!==t}},{}],21:[function(t,e,r){"use strict";var n={};n.base32="0123456789bcdefghjkmnpqrstuvwxyz",n.encode=function(t,e,r){if(void 0===r){for(var i=1;i<=12;i++){var o=n.encode(t,e,i),s=n.decode(o);if(s.lat==t&&s.lon==e)return o}r=12}if(t=Number(t),e=Number(e),r=Number(r),isNaN(t)||isNaN(e)||isNaN(r))throw new Error("Invalid geohash");for(var a=0,c=0,u=!0,h="",l=-90,p=90,f=-180,d=180;h.length<r;){if(u){var m=(f+d)/2;e>=m?(a=2*a+1,f=m):(a*=2,d=m)}else{var v=(l+p)/2;t>=v?(a=2*a+1,l=v):(a*=2,p=v)}u=!u,5==++c&&(h+=n.base32.charAt(a),c=0,a=0)}return h},n.decode=function(t){var e=n.bounds(t),r=e.sw.lat,i=e.sw.lon,o=e.ne.lat,s=e.ne.lon,a=(r+o)/2,c=(i+s)/2;return a=a.toFixed(Math.floor(2-Math.log(o-r)/Math.LN10)),c=c.toFixed(Math.floor(2-Math.log(s-i)/Math.LN10)),{lat:Number(a),lon:Number(c)}},n.bounds=function(t){if(0===t.length)throw new Error("Invalid geohash");t=t.toLowerCase();for(var e=!0,r=-90,i=90,o=-180,s=180,a=0;a<t.length;a++){var c=t.charAt(a),u=n.base32.indexOf(c);if(-1==u)throw new Error("Invalid geohash");for(var h=4;h>=0;h--){var l=u>>h&1;if(e){var p=(o+s)/2;1==l?o=p:s=p}else{var f=(r+i)/2;1==l?r=f:i=f}e=!e}}return{sw:{lat:r,lon:o},ne:{lat:i,lon:s}}},n.adjacent=function(t,e){if(t=t.toLowerCase(),e=e.toLowerCase(),0===t.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(e))throw new Error("Invalid direction");var r={n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]},i={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]},o=t.slice(-1),s=t.slice(0,-1),a=t.length%2;return-1!=i[e][a].indexOf(o)&&""!==s&&(s=n.adjacent(s,e)),s+n.base32.charAt(r[e][a].indexOf(o))},n.neighbours=function(t){return{n:n.adjacent(t,"n"),ne:n.adjacent(n.adjacent(t,"n"),"e"),e:n.adjacent(t,"e"),se:n.adjacent(n.adjacent(t,"s"),"e"),s:n.adjacent(t,"s"),sw:n.adjacent(n.adjacent(t,"s"),"w"),w:n.adjacent(t,"w"),nw:n.adjacent(n.adjacent(t,"n"),"w")}},void 0!==e&&e.exports&&(e.exports=n)},{}],22:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(t){return i.exec(t).slice(1)};r.resolve=function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(r=s+"/"+r,i="/"===s.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===s(t,-1);return(t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"))||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),s=Math.min(i.length,o.length),a=s,c=0;c<s;c++)if(i[c]!==o[c]){a=c;break}for(var u=[],c=a;c<i.length;c++)u.push("..");return(u=u.concat(o.slice(a))).join("/")},r.sep="/",r.delimiter=":",r.dirname=function(t){var e=o(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(t,e){var r=o(t)[2];return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},r.extname=function(t){return o(t)[3]};var s="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:6}],23:[function(t,e,r){"use strict";function n(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function i(t,e,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return s(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return s(t,n,e);throw new Error("Expected varint not more than 10 bytes")}function o(t){return t.type===n.Bytes?t.readVarint()+t.pos:t.pos+1}function s(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function a(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),c(r,n,e),u(n,e)}function c(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}function u(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}function h(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function l(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function p(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function f(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function d(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function m(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function v(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function g(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function y(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function b(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function _(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function x(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function w(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function S(t,e,r){for(var n="",i=e;i<r;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>r)break;var c,u,h;1===a?o<128&&(s=o):2===a?128==(192&(c=t[i+1]))&&(s=(31&o)<<6|63&c)<=127&&(s=null):3===a?(c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&((s=(15&o)<<12|(63&c)<<6|63&u)<=2047||s>=55296&&s<=57343)&&(s=null)):4===a&&(c=t[i+1],u=t[i+2],h=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&((s=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)<=65535||s>=1114112)&&(s=null)),null===s?(s=65533,a=1):s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|1023&s),n+=String.fromCharCode(s),i+=a}return n}function M(t,e,r){for(var n,i,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}e.exports=n;var E=t("ieee754");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=w(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_(this.buf,this.pos)+4294967296*_(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=_(this.buf,this.pos)+4294967296*w(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=E.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=E.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return r=n[this.pos++],e=127&r,r<128?e:(r=n[this.pos++],e|=(127&r)<<7,r<128?e:(r=n[this.pos++],e|=(127&r)<<14,r<128?e:(r=n[this.pos++],e|=(127&r)<<21,r<128?e:(r=n[this.pos],e|=(15&r)<<28,i(e,t,this)))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=S(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===n.Varint)for(;this.buf[this.pos++]>127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),x(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),x(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),x(this.buf,-1&t,this.pos),x(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),x(this.buf,-1&t,this.pos),x(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?a(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length);var e=++this.pos;this.pos=M(this.buf,t,this.pos);var r=this.pos-e;r>=128&&h(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),E.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),E.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){var r=++this.pos;t(e,this);var n=this.pos-r;n>=128&&h(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){this.writeMessage(t,p,e)},writePackedBoolean:function(t,e){this.writeMessage(t,m,e)},writePackedFloat:function(t,e){this.writeMessage(t,f,e)},writePackedDouble:function(t,e){this.writeMessage(t,d,e)},writePackedFixed32:function(t,e){this.writeMessage(t,v,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,g,e)},writePackedFixed64:function(t,e){this.writeMessage(t,y,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,b,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},{ieee754:17}],24:[function(t,e,r){"use strict";function n(t,e,r,s,a){for(r=r||0,s=s||t.length-1,a=a||o;s>r;){if(s-r>600){var c=s-r+1,u=e-r+1,h=Math.log(c),l=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*l*(c-l)/c)*(u-c/2<0?-1:1);n(t,e,Math.max(r,Math.floor(e-u*l/c+p)),Math.min(s,Math.floor(e+(c-u)*l/c+p)),a)}var f=t[e],d=r,m=s;for(i(t,r,e),a(t[s],f)>0&&i(t,r,s);d<m;){for(i(t,d,m),d++,m--;a(t[d],f)<0;)d++;for(;a(t[m],f)>0;)m--}0===a(t[r],f)?i(t,r,m):i(t,++m,s),m<=e&&(r=m+1),e<=m&&(s=m-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function o(t,e){return t<e?-1:t>e?1:0}e.exports=n},{}],25:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function i(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n<e.length;n++)if(r(t,e[n]))return n;return-1}function o(t,e){s(t,0,t.children.length,e,t)}function s(t,e,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,s=e;s<r;s++)o=t.children[s],a(i,t.leaf?n(o):o);return i}function a(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function c(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function l(t){return t.maxX-t.minX+(t.maxY-t.minY)}function p(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function f(t,e){var r=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-r)*Math.max(0,o-n)}function d(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function m(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function v(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,r,n,i){for(var o,s=[e,r];s.length;)(r=s.pop())-(e=s.pop())<=n||(o=e+Math.ceil((r-e)/n/2)*n,y(t,o,e,r,i),s.push(e,o,o,r))}e.exports=n;var y=t("quickselect");n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!m(t,e))return r;for(var i,o,s,a,c=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],m(t,a=e.leaf?n(s):s)&&(e.leaf?r.push(s):d(t,a)?this._all(s,r):c.push(s));e=c.pop()}return r},collides:function(t){var e=this.data,r=this.toBBox;if(!m(t,e))return!1;for(var n,i,o,s,a=[];e;){for(n=0,i=e.children.length;n<i;n++)if(o=e.children[n],s=e.leaf?r(o):o,m(t,s)){if(e.leaf||d(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,r=t.length;e<r;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=v([]),this},remove:function(t,e){if(!t)return this;for(var r,n,o,s,a=this.data,c=this.toBBox(t),u=[],h=[];a||u.length;){if(a||(a=u.pop(),n=u[u.length-1],r=h.pop(),s=!0),a.leaf&&-1!==(o=i(t,a.children,e)))return a.children.splice(o,1),u.push(a),this._condense(u),this;s||a.leaf||!d(a,c)?n?(r++,a=n.children[r],s=!1):a=null:(u.push(a),h.push(r),r=0,n=a,a=a.children[0])}return this},toBBox:function(t){return t},compareMinX:c,compareMinY:u,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var r=[];t;)t.leaf?e.push.apply(e,t.children):r.push.apply(r,t.children),t=r.pop();return e},_build:function(t,e,r,n){var i,s=r-e+1,a=this._maxEntries;if(s<=a)return i=v(t.slice(e,r+1)),o(i,this.toBBox),i;n||(n=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,n-1))),(i=v([])).leaf=!1,i.height=n;var c,u,h,l,p=Math.ceil(s/a),f=p*Math.ceil(Math.sqrt(a));for(g(t,e,r,f,this.compareMinX),c=e;c<=r;c+=f)for(g(t,c,h=Math.min(c+f-1,r),p,this.compareMinY),u=c;u<=h;u+=p)l=Math.min(u+p-1,h),i.children.push(this._build(t,u,l,n-1));return o(i,this.toBBox),i},_chooseSubtree:function(t,e,r,n){for(var i,o,s,a,c,u,l,f;;){if(n.push(e),e.leaf||n.length-1===r)break;for(l=f=1/0,i=0,o=e.children.length;i<o;i++)c=h(s=e.children[i]),(u=p(t,s)-c)<f?(f=u,l=c<l?c:l,a=s):u===f&&c<l&&(l=c,a=s);e=a||e.children[0]}return e},_insert:function(t,e,r){var n=this.toBBox,i=r?t:n(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),a(s,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var s=this._chooseSplitIndex(r,i,n),a=v(r.children.splice(s,r.children.length-s));a.height=r.height,a.leaf=r.leaf,o(r,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(r,a)},_splitRoot:function(t,e){this.data=v([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,i,o,a,c,u,l,p;for(u=l=1/0,n=e;n<=r-e;n++)a=f(i=s(t,0,n,this.toBBox),o=s(t,n,r,this.toBBox)),c=h(i)+h(o),a<u?(u=a,p=n,l=c<l?c:l):a===u&&c<l&&(l=c,p=n);return p},_chooseSplitAxis:function(t,e,r){var n=t.leaf?this.compareMinX:c,i=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,r,n)<this._allDistMargin(t,e,r,i)&&t.children.sort(n)},_allDistMargin:function(t,e,r,n){t.children.sort(n);var i,o,c=this.toBBox,u=s(t,0,e,c),h=s(t,r-e,r,c),p=l(u)+l(h);for(i=e;i<r-e;i++)o=t.children[i],a(u,t.leaf?c(o):o),p+=l(u);for(i=r-e-1;i>=e;i--)o=t.children[i],a(h,t.leaf?c(o):o),p+=l(h);return p},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)a(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():o(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},{quickselect:24}],26:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Subject"),o=t("./util/ObjectUnsubscribedError"),s=function(t){function e(e){t.call(this),this._value=e}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.ObjectUnsubscribedError;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.Subject);r.BehaviorSubject=s},{"./Subject":34,"./util/ObjectUnsubscribedError":160}],27:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r,n){t.call(this),this.parent=e,this.outerValue=r,this.outerIndex=n,this.index=0}return n(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(t("./Subscriber").Subscriber);r.InnerSubscriber=i},{"./Subscriber":36}],28:[function(t,e,r){"use strict";var n=t("./Observable"),i=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){switch(this.kind){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.error);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();r.Notification=i},{"./Observable":29}],29:[function(t,e,r){"use strict";var n=t("./util/root"),i=t("./util/toSubscriber"),o=t("./symbol/observable"),s=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,o=i.toSubscriber(t,e,r);if(n?n.call(o,this.source):o.add(this.source?this._subscribe(o):this._trySubscribe(o)),o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.syncErrorThrown=!0,t.syncErrorValue=e,t.error(e)}},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var i;i=r.subscribe(function(e){if(i)try{t(e)}catch(t){n(t),i.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[o.observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":155,"./util/root":172,"./util/toSubscriber":174}],30:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],31:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(t("./Subscriber").Subscriber);r.OuterSubscriber=i},{"./Subscriber":36}],32:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Subject"),o=t("./scheduler/queue"),s=t("./Subscription"),a=t("./operator/observeOn"),c=t("./util/ObjectUnsubscribedError"),u=t("./SubjectSubscription"),h=function(t){function e(e,r,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY),t.call(this),this.scheduler=n,this._events=[],this._bufferSize=e<1?1:e,this._windowTime=r<1?1:r}return n(e,t),e.prototype.next=function(e){var r=this._getNow();this._events.push(new l(r,e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,r=this._trimBufferThenGetEvents(),n=this.scheduler;if(this.closed)throw new c.ObjectUnsubscribedError;this.hasError?e=s.Subscription.EMPTY:this.isStopped?e=s.Subscription.EMPTY:(this.observers.push(t),e=new u.SubjectSubscription(this,t)),n&&t.add(t=new a.ObserveOnSubscriber(t,n));for(var i=r.length,o=0;o<i&&!t.closed;o++)t.next(r[o].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||o.queue).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,r=this._windowTime,n=this._events,i=n.length,o=0;o<i&&!(t-n[o].time<r);)o++;return i>e&&(o=Math.max(o,i-e)),o>0&&n.splice(0,o),n},e}(i.Subject);r.ReplaySubject=h;var l=function(){return function(t,e){this.time=t,this.value=e}}()},{"./Subject":34,"./SubjectSubscription":35,"./Subscription":37,"./operator/observeOn":129,"./scheduler/queue":153,"./util/ObjectUnsubscribedError":160}],33:[function(t,e,r){"use strict";var n=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=Date.now?Date.now:function(){return+new Date},t}();r.Scheduler=n},{}],34:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./Observable"),o=t("./Subscriber"),s=t("./Subscription"),a=t("./util/ObjectUnsubscribedError"),c=t("./SubjectSubscription"),u=t("./symbol/rxSubscriber"),h=function(t){function e(e){t.call(this,e),this.destination=e}return n(e,t),e}(o.Subscriber);r.SubjectSubscriber=h;var l=function(t){function e(){t.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return n(e,t),e.prototype[u.rxSubscriber]=function(){return new h(this)},e.prototype.lift=function(t){var e=new p(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new a.ObjectUnsubscribedError;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),i=0;i<r;i++)n[i].next(t)},e.prototype.error=function(t){if(this.closed)throw new a.ObjectUnsubscribedError;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),i=0;i<r;i++)n[i].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new a.ObjectUnsubscribedError;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new a.ObjectUnsubscribedError;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new a.ObjectUnsubscribedError;return this.hasError?(t.error(this.thrownError),s.Subscription.EMPTY):this.isStopped?(t.complete(),s.Subscription.EMPTY):(this.observers.push(t),new c.SubjectSubscription(this,t))},e.prototype.asObservable=function(){var t=new i.Observable;return t.source=this,t},e.create=function(t,e){return new p(t,e)},e}(i.Observable);r.Subject=l;var p=function(t){function e(e,r){t.call(this),this.destination=e,this.source=r}return n(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):s.Subscription.EMPTY},e}(l);r.AnonymousSubject=p},{"./Observable":29,"./SubjectSubscription":35,"./Subscriber":36,"./Subscription":37,"./symbol/rxSubscriber":156,"./util/ObjectUnsubscribedError":160}],35:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this),this.subject=e,this.subscriber=r,this.closed=!1}return n(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},e}(t("./Subscription").Subscription);r.SubjectSubscription=i},{"./Subscription":37}],36:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./util/isFunction"),o=t("./Subscription"),s=t("./Observer"),a=t("./symbol/rxSubscriber"),c=function(t){function e(r,n,i){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=s.empty;break;case 1:if(!r){this.destination=s.empty;break}if("object"==typeof r){r instanceof e?(this.destination=r,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new u(this,r));break}default:this.syncErrorThrowable=!0,this.destination=new u(this,r,n,i)}}return n(e,t),e.prototype[a.rxSubscriber]=function(){return this},e.create=function(t,r,n){var i=new e(t,r,n);return i.syncErrorThrowable=!1,i},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this,e=t._parent,r=t._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=e,this._parents=r,this},e}(o.Subscription);r.Subscriber=c;var u=function(t){function e(e,r,n,o){t.call(this),this._parentSubscriber=e;var a,c=this;i.isFunction(r)?a=r:r&&(a=r.next,n=r.error,o=r.complete,r!==s.empty&&(c=Object.create(r),i.isFunction(c.unsubscribe)&&this.add(c.unsubscribe.bind(c)),c.unsubscribe=this.unsubscribe.bind(this))),this._context=c,this._next=a,this._error=n,this._complete=o}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},e.prototype.__tryOrSetError=function(t,e,r){try{e.call(this._context,r)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(c)},{"./Observer":30,"./Subscription":37,"./symbol/rxSubscriber":156,"./util/isFunction":167}],37:[function(t,e,r){"use strict";function n(t){return t.reduce(function(t,e){return t.concat(e instanceof u.UnsubscriptionError?e.errors:e)},[])}var i=t("./util/isArray"),o=t("./util/isObject"),s=t("./util/isFunction"),a=t("./util/tryCatch"),c=t("./util/errorObject"),u=t("./util/UnsubscriptionError"),h=function(){function t(t){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){var r=this,h=r._parent,l=r._parents,p=r._unsubscribe,f=r._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var d=-1,m=l?l.length:0;h;)h.remove(this),h=++d<m&&l[d]||null;if(s.isFunction(p)&&(g=a.tryCatch(p).call(this))===c.errorObject&&(e=!0,t=t||(c.errorObject.e instanceof u.UnsubscriptionError?n(c.errorObject.e.errors):[c.errorObject.e])),i.isArray(f))for(d=-1,m=f.length;++d<m;){var v=f[d];if(o.isObject(v)){var g=a.tryCatch(v.unsubscribe).call(v);if(g===c.errorObject){e=!0,t=t||[];var y=c.errorObject.e;y instanceof u.UnsubscriptionError?t=t.concat(n(y.errors)):t.push(y)}}}if(e)throw new u.UnsubscriptionError(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if("function"!=typeof r._addParent){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return(this._subscriptions||(this._subscriptions=[])).push(r),r._addParent(this),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.prototype._addParent=function(t){var e=this,r=e._parent,n=e._parents;r&&r!==t?n?-1===n.indexOf(t)&&n.push(t):this._parents=[t]:this._parent=t},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();r.Subscription=h},{"./util/UnsubscriptionError":162,"./util/errorObject":163,"./util/isArray":164,"./util/isFunction":167,"./util/isObject":169,"./util/tryCatch":175}],38:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/combineLatest");n.Observable.combineLatest=i.combineLatest},{"../../Observable":29,"../../observable/combineLatest":97}],39:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/defer");n.Observable.defer=i.defer},{"../../Observable":29,"../../observable/defer":98}],40:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/empty");n.Observable.empty=i.empty},{"../../Observable":29,"../../observable/empty":99}],41:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/from");n.Observable.from=i.from},{"../../Observable":29,"../../observable/from":100}],42:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/fromEvent");n.Observable.fromEvent=i.fromEvent},{"../../Observable":29,"../../observable/fromEvent":101}],43:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/fromPromise");n.Observable.fromPromise=i.fromPromise},{"../../Observable":29,"../../observable/fromPromise":102}],44:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/merge");n.Observable.merge=i.merge},{"../../Observable":29,"../../observable/merge":103}],45:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/of");n.Observable.of=i.of},{"../../Observable":29,"../../observable/of":104}],46:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/throw");n.Observable.throw=i._throw},{"../../Observable":29,"../../observable/throw":105}],47:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/timer");n.Observable.timer=i.timer},{"../../Observable":29,"../../observable/timer":106}],48:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/zip");n.Observable.zip=i.zip},{"../../Observable":29,"../../observable/zip":107}],49:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/buffer");n.Observable.prototype.buffer=i.buffer},{"../../Observable":29,"../../operator/buffer":108}],50:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/bufferCount");n.Observable.prototype.bufferCount=i.bufferCount},{"../../Observable":29,"../../operator/bufferCount":109}],51:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/bufferWhen");n.Observable.prototype.bufferWhen=i.bufferWhen},{"../../Observable":29,"../../operator/bufferWhen":110}],52:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/catch");n.Observable.prototype.catch=i._catch,n.Observable.prototype._catch=i._catch},{"../../Observable":29,"../../operator/catch":111}],53:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/combineLatest");n.Observable.prototype.combineLatest=i.combineLatest},{"../../Observable":29,"../../operator/combineLatest":112}],54:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/concat");n.Observable.prototype.concat=i.concat},{"../../Observable":29,"../../operator/concat":113}],55:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/debounceTime");n.Observable.prototype.debounceTime=i.debounceTime},{"../../Observable":29,"../../operator/debounceTime":114}],56:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/delay");n.Observable.prototype.delay=i.delay},{"../../Observable":29,"../../operator/delay":115}],57:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/distinct");n.Observable.prototype.distinct=i.distinct},{"../../Observable":29,"../../operator/distinct":116}],58:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/distinctUntilChanged");n.Observable.prototype.distinctUntilChanged=i.distinctUntilChanged},{"../../Observable":29,"../../operator/distinctUntilChanged":117}],59:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/do");n.Observable.prototype.do=i._do,n.Observable.prototype._do=i._do},{"../../Observable":29,"../../operator/do":118}],60:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/expand");n.Observable.prototype.expand=i.expand},{"../../Observable":29,"../../operator/expand":119}],61:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/filter");n.Observable.prototype.filter=i.filter},{"../../Observable":29,"../../operator/filter":120}],62:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/finally");n.Observable.prototype.finally=i._finally,n.Observable.prototype._finally=i._finally},{"../../Observable":29,"../../operator/finally":121}],63:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/first");n.Observable.prototype.first=i.first},{"../../Observable":29,"../../operator/first":122}],64:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/last");n.Observable.prototype.last=i.last},{"../../Observable":29,"../../operator/last":123}],65:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/map");n.Observable.prototype.map=i.map},{"../../Observable":29,"../../operator/map":124}],66:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/merge");n.Observable.prototype.merge=i.merge},{"../../Observable":29,"../../operator/merge":125}],67:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/mergeAll");n.Observable.prototype.mergeAll=i.mergeAll},{"../../Observable":29,"../../operator/mergeAll":126}],68:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/mergeMap");n.Observable.prototype.mergeMap=i.mergeMap,n.Observable.prototype.flatMap=i.mergeMap},{"../../Observable":29,"../../operator/mergeMap":127}],69:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/pairwise");n.Observable.prototype.pairwise=i.pairwise},{"../../Observable":29,"../../operator/pairwise":130}],70:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/pluck");n.Observable.prototype.pluck=i.pluck},{"../../Observable":29,"../../operator/pluck":131}],71:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/publish");n.Observable.prototype.publish=i.publish},{"../../Observable":29,"../../operator/publish":132}],72:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/publishReplay");n.Observable.prototype.publishReplay=i.publishReplay},{"../../Observable":29,"../../operator/publishReplay":133}],73:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/scan");n.Observable.prototype.scan=i.scan},{"../../Observable":29,"../../operator/scan":134}],74:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/share");n.Observable.prototype.share=i.share},{"../../Observable":29,"../../operator/share":135}],75:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/skip");n.Observable.prototype.skip=i.skip},{"../../Observable":29,"../../operator/skip":136}],76:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/skipUntil");n.Observable.prototype.skipUntil=i.skipUntil},{"../../Observable":29,"../../operator/skipUntil":137}],77:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/skipWhile");n.Observable.prototype.skipWhile=i.skipWhile},{"../../Observable":29,"../../operator/skipWhile":138}],78:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/startWith");n.Observable.prototype.startWith=i.startWith},{"../../Observable":29,"../../operator/startWith":139}],79:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/switchMap");n.Observable.prototype.switchMap=i.switchMap},{"../../Observable":29,"../../operator/switchMap":140}],80:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/take");n.Observable.prototype.take=i.take},{"../../Observable":29,"../../operator/take":141}],81:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/takeUntil");n.Observable.prototype.takeUntil=i.takeUntil},{"../../Observable":29,"../../operator/takeUntil":142}],82:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/throttleTime");n.Observable.prototype.throttleTime=i.throttleTime},{"../../Observable":29,"../../operator/throttleTime":144}],83:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/withLatestFrom");n.Observable.prototype.withLatestFrom=i.withLatestFrom},{"../../Observable":29,"../../operator/withLatestFrom":145}],84:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/zip");n.Observable.prototype.zip=i.zipProto},{"../../Observable":29,"../../operator/zip":146}],85:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Observable"),o=t("./ScalarObservable"),s=t("./EmptyObservable"),a=function(t){function e(e,r){t.call(this),this.arrayLike=e,this.scheduler=r,r||1!==e.length||(this._isScalar=!0,this.value=e[0])}return n(e,t),e.create=function(t,r){var n=t.length;return 0===n?new s.EmptyObservable:1===n?new o.ScalarObservable(t[0],r):new e(t,r)},e.dispatch=function(t){var e=t.arrayLike,r=t.index,n=t.length,i=t.subscriber;i.closed||(r>=n?i.complete():(i.next(e[r]),t.index=r+1,this.schedule(t)))},e.prototype._subscribe=function(t){var r=this,n=r.arrayLike,i=r.scheduler,o=n.length;if(i)return i.schedule(e.dispatch,0,{arrayLike:n,index:0,length:o,subscriber:t});for(var s=0;s<o&&!t.closed;s++)t.next(n[s]);t.complete()},e}(i.Observable);r.ArrayLikeObservable=a},{"../Observable":29,"./EmptyObservable":89,"./ScalarObservable":95}],86:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Observable"),o=t("./ScalarObservable"),s=t("./EmptyObservable"),a=t("../util/isScheduler"),c=function(t){function e(e,r){t.call(this),this.array=e,this.scheduler=r,r||1!==e.length||(this._isScalar=!0,this.value=e[0])}return n(e,t),e.create=function(t,r){return new e(t,r)},e.of=function(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];var n=t[t.length-1];a.isScheduler(n)?t.pop():n=null;var i=t.length;return i>1?new e(t,n):1===i?new o.ScalarObservable(t[0],n):new s.EmptyObservable(n)},e.dispatch=function(t){var e=t.array,r=t.index,n=t.count,i=t.subscriber;r>=n?i.complete():(i.next(e[r]),i.closed||(t.index=r+1,this.schedule(t)))},e.prototype._subscribe=function(t){var r=this.array,n=r.length,i=this.scheduler;if(i)return i.schedule(e.dispatch,0,{array:r,index:0,count:n,subscriber:t});for(var o=0;o<n&&!t.closed;o++)t.next(r[o]);t.complete()},e}(i.Observable);r.ArrayObservable=c},{"../Observable":29,"../util/isScheduler":171,"./EmptyObservable":89,"./ScalarObservable":95}],87:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subject"),o=t("../Observable"),s=t("../Subscriber"),a=t("../Subscription"),c=function(t){function e(e,r){t.call(this),this.source=e,this.subjectFactory=r,this._refCount=0,this._isComplete=!1}return n(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new a.Subscription).add(this.source.subscribe(new h(this.getSubject(),this))),t.closed?(this._connection=null,t=a.Subscription.EMPTY):this._connection=t),t},e.prototype.refCount=function(){return this.lift(new l(this))},e}(o.Observable);r.ConnectableObservable=c;var u=c.prototype;r.connectableObservableDescriptor={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:u._subscribe},_isComplete:{value:u._isComplete,writable:!0},getSubject:{value:u.getSubject},connect:{value:u.connect},refCount:{value:u.refCount}};var h=function(t){function e(e,r){t.call(this,e),this.connectable=r}return n(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(i.SubjectSubscriber),l=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var r=this.connectable;r._refCount++;var n=new p(t,r),i=e.subscribe(n);return n.closed||(n.connection=r.connect()),i},t}(),p=function(t){function e(e,r){t.call(this,e),this.connectable=r}return n(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var r=this.connection,n=t._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},e}(s.Subscriber)},{"../Observable":29,"../Subject":34,"../Subscriber":36,"../Subscription":37}],88:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Observable"),o=t("../util/subscribeToResult"),s=t("../OuterSubscriber"),a=function(t){function e(e){t.call(this),this.observableFactory=e}return n(e,t),e.create=function(t){return new e(t)},e.prototype._subscribe=function(t){return new c(t,this.observableFactory)},e}(i.Observable);r.DeferObservable=a;var c=function(t){function e(e,r){t.call(this,e),this.factory=r,this.tryDefer()}return n(e,t),e.prototype.tryDefer=function(){try{this._callFactory()}catch(t){this._error(t)}},e.prototype._callFactory=function(){var t=this.factory();t&&this.add(o.subscribeToResult(this,t))},e}(s.OuterSubscriber)},{"../Observable":29,"../OuterSubscriber":31,"../util/subscribeToResult":173}],89:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e){t.call(this),this.scheduler=e}return n(e,t),e.create=function(t){return new e(t)},e.dispatch=function(t){t.subscriber.complete()},e.prototype._subscribe=function(t){var r=this.scheduler;if(r)return r.schedule(e.dispatch,0,{subscriber:t});t.complete()},e}(t("../Observable").Observable);r.EmptyObservable=i},{"../Observable":29}],90:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this),this.error=e,this.scheduler=r}return n(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.error;t.subscriber.error(e)},e.prototype._subscribe=function(t){var r=this.error,n=this.scheduler;if(t.syncErrorThrowable=!0,n)return n.schedule(e.dispatch,0,{error:r,subscriber:t});t.error(r)},e}(t("../Observable").Observable);r.ErrorObservable=i},{"../Observable":29}],91:[function(t,e,r){"use strict";function n(t){return!!t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}function i(t){return!!t&&"function"==typeof t.on&&"function"==typeof t.off}function o(t){return!!t&&"[object NodeList]"===d.call(t)}function s(t){return!!t&&"[object HTMLCollection]"===d.call(t)}function a(t){return!!t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}var c=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},u=t("../Observable"),h=t("../util/tryCatch"),l=t("../util/isFunction"),p=t("../util/errorObject"),f=t("../Subscription"),d=Object.prototype.toString,m=function(t){function e(e,r,n,i){t.call(this),this.sourceObj=e,this.eventName=r,this.selector=n,this.options=i}return c(e,t),e.create=function(t,r,n,i){return l.isFunction(n)&&(i=n,n=void 0),new e(t,r,i,n)},e.setupSubscription=function(t,r,c,u,h){var l;if(o(t)||s(t))for(var p=0,d=t.length;p<d;p++)e.setupSubscription(t[p],r,c,u,h);else if(a(t)){var m=t;t.addEventListener(r,c,h),l=function(){return m.removeEventListener(r,c)}}else if(i(t)){var v=t;t.on(r,c),l=function(){return v.off(r,c)}}else{if(!n(t))throw new TypeError("Invalid event target");var g=t;t.addListener(r,c),l=function(){return g.removeListener(r,c)}}u.add(new f.Subscription(l))},e.prototype._subscribe=function(t){var r=this.sourceObj,n=this.eventName,i=this.options,o=this.selector,s=o?function(){for(var e=[],r=0;r<arguments.length;r++)e[r-0]=arguments[r];var n=h.tryCatch(o).apply(void 0,e);n===p.errorObject?t.error(p.errorObject.e):t.next(n)}:function(e){return t.next(e)};e.setupSubscription(r,n,s,t,i)},e}(u.Observable);r.FromEventObservable=m},{"../Observable":29,"../Subscription":37,"../util/errorObject":163,"../util/isFunction":167,"../util/tryCatch":175}],92:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/isArray"),o=t("../util/isArrayLike"),s=t("../util/isPromise"),a=t("./PromiseObservable"),c=t("./IteratorObservable"),u=t("./ArrayObservable"),h=t("./ArrayLikeObservable"),l=t("../symbol/iterator"),p=t("../Observable"),f=t("../operator/observeOn"),d=t("../symbol/observable"),m=function(t){function e(e,r){t.call(this,null),this.ish=e,this.scheduler=r}return n(e,t),e.create=function(t,r){if(null!=t){if("function"==typeof t[d.observable])return t instanceof p.Observable&&!r?t:new e(t,r);if(i.isArray(t))return new u.ArrayObservable(t,r);if(s.isPromise(t))return new a.PromiseObservable(t,r);if("function"==typeof t[l.iterator]||"string"==typeof t)return new c.IteratorObservable(t,r);if(o.isArrayLike(t))return new h.ArrayLikeObservable(t,r)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")},e.prototype._subscribe=function(t){var e=this.ish,r=this.scheduler;return null==r?e[d.observable]().subscribe(t):e[d.observable]().subscribe(new f.ObserveOnSubscriber(t,r,0))},e}(p.Observable);r.FromObservable=m},{"../Observable":29,"../operator/observeOn":129,"../symbol/iterator":154,"../symbol/observable":155,"../util/isArray":164,"../util/isArrayLike":165,"../util/isPromise":170,"./ArrayLikeObservable":85,"./ArrayObservable":86,"./IteratorObservable":93,"./PromiseObservable":94}],93:[function(t,e,r){"use strict";function n(t){var e=t[h.iterator];if(!e&&"string"==typeof t)return new p(t);if(!e&&void 0!==t.length)return new f(t);if(!e)throw new TypeError("object is not iterable");return t[h.iterator]()}function i(t){var e=+t.length;return isNaN(e)?0:0!==e&&o(e)?(e=s(e)*Math.floor(Math.abs(e)))<=0?0:e>d?d:e:e}function o(t){return"number"==typeof t&&c.root.isFinite(t)}function s(t){var e=+t;return 0===e?e:isNaN(e)?e:e<0?-1:1}var a=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},c=t("../util/root"),u=t("../Observable"),h=t("../symbol/iterator"),l=function(t){function e(e,r){if(t.call(this),this.scheduler=r,null==e)throw new Error("iterator cannot be null.");this.iterator=n(e)}return a(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.index,r=t.hasError,n=t.iterator,i=t.subscriber;if(r)i.error(t.error);else{var o=n.next();o.done?i.complete():(i.next(o.value),t.index=e+1,i.closed?"function"==typeof n.return&&n.return():this.schedule(t))}},e.prototype._subscribe=function(t){var r=this,n=r.iterator,i=r.scheduler;if(i)return i.schedule(e.dispatch,0,{index:0,iterator:n,subscriber:t});for(;;){var o=n.next();if(o.done){t.complete();break}if(t.next(o.value),t.closed){"function"==typeof n.return&&n.return();break}}},e}(u.Observable);r.IteratorObservable=l;var p=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length),this.str=t,this.idx=e,this.len=r}return t.prototype[h.iterator]=function(){return this},t.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.str.charAt(this.idx++)}:{done:!0,value:void 0}},t}(),f=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=i(t)),this.arr=t,this.idx=e,this.len=r}return t.prototype[h.iterator]=function(){return this},t.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.arr[this.idx++]}:{done:!0,value:void 0}},t}(),d=Math.pow(2,53)-1},{"../Observable":29,"../symbol/iterator":154,"../util/root":172}],94:[function(t,e,r){"use strict";function n(t){var e=t.value,r=t.subscriber;r.closed||(r.next(e),r.complete())}function i(t){var e=t.err,r=t.subscriber;r.closed||r.error(e)}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},s=t("../util/root"),a=function(t){function e(e,r){t.call(this),this.promise=e,this.scheduler=r}return o(e,t),e.create=function(t,r){return new e(t,r)},e.prototype._subscribe=function(t){var e=this,r=this.promise,o=this.scheduler;if(null==o)this._isScalar?t.closed||(t.next(this.value),t.complete()):r.then(function(r){e.value=r,e._isScalar=!0,t.closed||(t.next(r),t.complete())},function(e){t.closed||t.error(e)}).then(null,function(t){s.root.setTimeout(function(){throw t})});else if(this._isScalar){if(!t.closed)return o.schedule(n,0,{value:this.value,subscriber:t})}else r.then(function(r){e.value=r,e._isScalar=!0,t.closed||t.add(o.schedule(n,0,{value:r,subscriber:t}))},function(e){t.closed||t.add(o.schedule(i,0,{err:e,subscriber:t}))}).then(null,function(t){s.root.setTimeout(function(){throw t})})},e}(t("../Observable").Observable);r.PromiseObservable=a},{"../Observable":29,"../util/root":172}],95:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this),this.value=e,this.scheduler=r,this._isScalar=!0,r&&(this._isScalar=!1)}return n(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.done,r=t.value,n=t.subscriber;e?n.complete():(n.next(r),n.closed||(t.done=!0,this.schedule(t)))},e.prototype._subscribe=function(t){var r=this.value,n=this.scheduler;if(n)return n.schedule(e.dispatch,0,{done:!1,value:r,subscriber:t});t.next(r),t.closed||t.complete()},e}(t("../Observable").Observable);r.ScalarObservable=i},{"../Observable":29}],96:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/isNumeric"),o=t("../Observable"),s=t("../scheduler/async"),a=t("../util/isScheduler"),c=t("../util/isDate"),u=function(t){function e(e,r,n){void 0===e&&(e=0),t.call(this),this.period=-1,this.dueTime=0,i.isNumeric(r)?this.period=Number(r)<1&&1||Number(r):a.isScheduler(r)&&(n=r),a.isScheduler(n)||(n=s.async),this.scheduler=n,this.dueTime=c.isDate(e)?+e-this.scheduler.now():e}return n(e,t),e.create=function(t,r,n){return void 0===t&&(t=0),new e(t,r,n)},e.dispatch=function(t){var e=t.index,r=t.period,n=t.subscriber,i=this;if(n.next(e),!n.closed){if(-1===r)return n.complete();t.index=e+1,i.schedule(t,r)}},e.prototype._subscribe=function(t){var r=this,n=r.period,i=r.dueTime;return r.scheduler.schedule(e.dispatch,i,{index:0,period:n,subscriber:t})},e}(o.Observable);r.TimerObservable=u},{"../Observable":29,"../scheduler/async":152,"../util/isDate":166,"../util/isNumeric":168,"../util/isScheduler":171}],97:[function(t,e,r){"use strict";var n=t("../util/isScheduler"),i=t("../util/isArray"),o=t("./ArrayObservable"),s=t("../operator/combineLatest");r.combineLatest=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=null,a=null;return n.isScheduler(t[t.length-1])&&(a=t.pop()),"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&i.isArray(t[0])&&(t=t[0]),new o.ArrayObservable(t,a).lift(new s.CombineLatestOperator(r))}},{"../operator/combineLatest":112,"../util/isArray":164,"../util/isScheduler":171,"./ArrayObservable":86}],98:[function(t,e,r){"use strict";var n=t("./DeferObservable");r.defer=n.DeferObservable.create},{"./DeferObservable":88}],99:[function(t,e,r){"use strict";var n=t("./EmptyObservable");r.empty=n.EmptyObservable.create},{"./EmptyObservable":89}],100:[function(t,e,r){"use strict";var n=t("./FromObservable");r.from=n.FromObservable.create},{"./FromObservable":92}],101:[function(t,e,r){"use strict";var n=t("./FromEventObservable");r.fromEvent=n.FromEventObservable.create},{"./FromEventObservable":91}],102:[function(t,e,r){"use strict";var n=t("./PromiseObservable");r.fromPromise=n.PromiseObservable.create},{"./PromiseObservable":94}],103:[function(t,e,r){"use strict";var n=t("../operator/merge");r.merge=n.mergeStatic},{"../operator/merge":125}],104:[function(t,e,r){"use strict";var n=t("./ArrayObservable");r.of=n.ArrayObservable.of},{"./ArrayObservable":86}],105:[function(t,e,r){"use strict";var n=t("./ErrorObservable");r._throw=n.ErrorObservable.create},{"./ErrorObservable":90}],106:[function(t,e,r){"use strict";var n=t("./TimerObservable");r.timer=n.TimerObservable.create},{"./TimerObservable":96}],107:[function(t,e,r){"use strict";var n=t("../operator/zip");r.zip=n.zipStatic},{"../operator/zip":146}],108:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.buffer=function(t){return this.lift(new s(t))};var s=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.closingNotifier))},t}(),a=function(t){function e(e,r){t.call(this,e),this.buffer=[],this.add(o.subscribeToResult(this,r))}return n(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype.notifyNext=function(t,e,r,n,i){var o=this.buffer;this.buffer=[],this.destination.next(o)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],109:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.bufferCount=function(t,e){return void 0===e&&(e=null),this.lift(new o(t,e))};var o=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?a:s}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),s=function(t){function e(e,r){t.call(this,e),this.bufferSize=r,this.buffer=[]}return n(e,t),e.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},e}(i.Subscriber),a=function(t){function e(e,r,n){t.call(this,e),this.bufferSize=r,this.startBufferEvery=n,this.buffers=[],this.count=0}return n(e,t),e.prototype._next=function(t){var e=this,r=e.bufferSize,n=e.startBufferEvery,i=e.buffers,o=e.count;this.count++,o%n==0&&i.push([]);for(var s=i.length;s--;){var a=i[s];a.push(t),a.length===r&&(i.splice(s,1),this.destination.next(a))}},e.prototype._complete=function(){for(var e=this,r=e.buffers,n=e.destination;r.length>0;){var i=r.shift();i.length>0&&n.next(i)}t.prototype._complete.call(this)},e}(i.Subscriber)},{"../Subscriber":36}],110:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscription"),o=t("../util/tryCatch"),s=t("../util/errorObject"),a=t("../OuterSubscriber"),c=t("../util/subscribeToResult");r.bufferWhen=function(t){return this.lift(new u(t))};var u=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.closingSelector))},t}(),h=function(t){function e(e,r){t.call(this,e),this.closingSelector=r,this.subscribing=!1,this.openBuffer()}return n(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},e.prototype.notifyNext=function(t,e,r,n,i){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e=this.buffer;this.buffer&&this.destination.next(e),this.buffer=[];var r=o.tryCatch(this.closingSelector)();r===s.errorObject?this.error(s.errorObject.e):(t=new i.Subscription,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(c.subscribeToResult(this,r)),this.subscribing=!1)},e}(a.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscription":37,"../util/errorObject":163,"../util/subscribeToResult":173,"../util/tryCatch":175}],111:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r._catch=function(t){var e=new s(t),r=this.lift(e);return e.caught=r};var s=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.selector,this.caught))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.selector=r,this.caught=n}return n(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=void 0;try{r=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle(),this.add(o.subscribeToResult(this,r))}},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],112:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../observable/ArrayObservable"),o=t("../util/isArray"),s=t("../OuterSubscriber"),a=t("../util/subscribeToResult"),c={};r.combineLatest=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=null;return"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&o.isArray(t[0])&&(t=t[0].slice()),t.unshift(this),this.lift.call(new i.ArrayObservable(t),new u(r))};var u=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.project))},t}();r.CombineLatestOperator=u;var h=function(t){function e(e,r){t.call(this,e),this.project=r,this.active=0,this.values=[],this.observables=[]}return n(e,t),e.prototype._next=function(t){this.values.push(c),this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{this.active=e,this.toRespond=e;for(var r=0;r<e;r++){var n=t[r];this.add(a.subscribeToResult(this,n,n,r))}}},e.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,i){var o=this.values,s=o[r],a=this.toRespond?s===c?--this.toRespond:this.toRespond:0;o[r]=e,0===a&&(this.project?this._tryProject(o):this.destination.next(o.slice()))},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.OuterSubscriber);r.CombineLatestSubscriber=h},{"../OuterSubscriber":31,"../observable/ArrayObservable":86,"../util/isArray":164,"../util/subscribeToResult":173}],113:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=null,n=t;return o.isScheduler(n[t.length-1])&&(r=n.pop()),null===r&&1===t.length&&t[0]instanceof i.Observable?t[0]:new s.ArrayObservable(t,r).lift(new a.MergeAllOperator(1))}var i=t("../Observable"),o=t("../util/isScheduler"),s=t("../observable/ArrayObservable"),a=t("./mergeAll");r.concat=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return this.lift.call(n.apply(void 0,[this].concat(t)))},r.concatStatic=n},{"../Observable":29,"../observable/ArrayObservable":86,"../util/isScheduler":171,"./mergeAll":126}],114:[function(t,e,r){"use strict";function n(t){t.debouncedNext()}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber"),s=t("../scheduler/async");r.debounceTime=function(t,e){return void 0===e&&(e=s.async),this.lift(new a(t,e))};var a=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.dueTime,this.scheduler))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.dueTime=r,this.scheduler=n,this.debouncedSubscription=null,this.lastValue=null,this.hasValue=!1}return i(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(n,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){this.clearDebounce(),this.hasValue&&(this.destination.next(this.lastValue),this.lastValue=null,this.hasValue=!1)},e.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},e}(o.Subscriber)},{"../Subscriber":36,"../scheduler/async":152}],115:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../scheduler/async"),o=t("../util/isDate"),s=t("../Subscriber"),a=t("../Notification");r.delay=function(t,e){void 0===e&&(e=i.async);var r=o.isDate(t)?+t-e.now():Math.abs(t);return this.lift(new c(r,e))};var c=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.delay,this.scheduler))},t}(),u=function(t){function e(e,r,n){t.call(this,e),this.delay=r,this.scheduler=n,this.queue=[],this.active=!1,this.errored=!1}return n(e,t),e.dispatch=function(t){for(var e=t.source,r=e.queue,n=t.scheduler,i=t.destination;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(t,o)}else e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,r=new h(e.now()+this.delay,t);this.queue.push(r),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(a.Notification.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t)},e.prototype._complete=function(){this.scheduleNotification(a.Notification.createComplete())},e}(s.Subscriber),h=function(){return function(t,e){this.time=t,this.notification=e}}()},{"../Notification":28,"../Subscriber":36,"../scheduler/async":152,"../util/isDate":166}],116:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult"),s=t("../util/Set");r.distinct=function(t,e){return this.lift(new a(t,e))};var a=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.keySelector,this.flushes))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.keySelector=r,this.values=new s.Set,n&&this.add(o.subscribeToResult(this,n))}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.values.clear()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,r=this.destination;try{e=this.keySelector(t)}catch(t){return void r.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var r=this.values;r.has(t)||(r.add(t),this.destination.next(e))},e}(i.OuterSubscriber);r.DistinctSubscriber=c},{"../OuterSubscriber":31,"../util/Set":161,"../util/subscribeToResult":173}],117:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/tryCatch"),s=t("../util/errorObject");r.distinctUntilChanged=function(t,e){return this.lift(new a(t,e))};var a=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.compare,this.keySelector))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.keySelector=n,this.hasKey=!1,"function"==typeof r&&(this.compare=r)}return n(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e=t;if(this.keySelector&&(e=o.tryCatch(this.keySelector)(t))===s.errorObject)return this.destination.error(s.errorObject.e);var r=!1;if(this.hasKey){if((r=o.tryCatch(this.compare)(this.key,e))===s.errorObject)return this.destination.error(s.errorObject.e)}else this.hasKey=!0;!1===Boolean(r)&&(this.key=e,this.destination.next(t))},e}(i.Subscriber)},{"../Subscriber":36,"../util/errorObject":163,"../util/tryCatch":175}],118:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r._do=function(t,e,r){return this.lift(new o(t,e,r))};var o=function(){function t(t,e,r){this.nextOrObserver=t,this.error=e,this.complete=r}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.nextOrObserver,this.error,this.complete))},t}(),s=function(t){function e(e,r,n,o){t.call(this,e);var s=new i.Subscriber(r,n,o);s.syncErrorThrowable=!0,this.add(s),this.safeSubscriber=s}return n(e,t),e.prototype._next=function(t){var e=this.safeSubscriber;e.next(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.next(t)},e.prototype._error=function(t){var e=this.safeSubscriber;e.error(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.error(t)},e.prototype._complete=function(){var t=this.safeSubscriber;t.complete(),t.syncErrorThrown?this.destination.error(t.syncErrorValue):this.destination.complete()},e}(i.Subscriber)},{"../Subscriber":36}],119:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/tryCatch"),o=t("../util/errorObject"),s=t("../OuterSubscriber"),a=t("../util/subscribeToResult");r.expand=function(t,e,r){return void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=void 0),e=(e||0)<1?Number.POSITIVE_INFINITY:e,this.lift(new c(t,e,r))};var c=function(){function t(t,e,r){this.project=t,this.concurrent=e,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.concurrent,this.scheduler))},t}();r.ExpandOperator=c;var u=function(t){function e(e,r,n,i){t.call(this,e),this.project=r,this.concurrent=n,this.scheduler=i,this.index=0,this.active=0,this.hasCompleted=!1,n<Number.POSITIVE_INFINITY&&(this.buffer=[])}return n(e,t),e.dispatch=function(t){var e=t.subscriber,r=t.result,n=t.value,i=t.index;e.subscribeToProjection(r,n,i)},e.prototype._next=function(t){var r=this.destination;if(r.closed)this._complete();else{var n=this.index++;if(this.active<this.concurrent){r.next(t);var s=i.tryCatch(this.project)(t,n);if(s===o.errorObject)r.error(o.errorObject.e);else if(this.scheduler){var a={subscriber:this,result:s,value:t,index:n};this.add(this.scheduler.schedule(e.dispatch,0,a))}else this.subscribeToProjection(s,t,n)}else this.buffer.push(t)}},e.prototype.subscribeToProjection=function(t,e,r){this.active++,this.add(a.subscribeToResult(this,t,e,r))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,i){this._next(e)},e.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e&&e.length>0&&this._next(e.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(s.OuterSubscriber);r.ExpandSubscriber=u},{"../OuterSubscriber":31,"../util/errorObject":163,"../util/subscribeToResult":173,"../util/tryCatch":175}],120:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.filter=function(t,e){return this.lift(new o(t,e))};var o=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.predicate,this.thisArg))},t}(),s=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return n(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":36}],121:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../Subscription");r._finally=function(t){return this.lift(new s(t))};var s=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.callback))},t}(),a=function(t){function e(e,r){t.call(this,e),this.add(new o.Subscription(r))}return n(e,t),e}(i.Subscriber)},{"../Subscriber":36,"../Subscription":37}],122:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/EmptyError");r.first=function(t,e,r){return this.lift(new s(t,e,r,this))};var s=function(){function t(t,e,r,n){this.predicate=t,this.resultSelector=e,this.defaultValue=r,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),a=function(t){function e(e,r,n,i,o){t.call(this,e),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.index=0,this.hasCompleted=!1,this._emitted=!1}return n(e,t),e.prototype._next=function(t){var e=this.index++;this.predicate?this._tryPredicate(t,e):this._emit(t,e)},e.prototype._tryPredicate=function(t,e){var r;try{r=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}r&&this._emit(t,e)},e.prototype._emit=function(t,e){this.resultSelector?this._tryResultSelector(t,e):this._emitFinal(t)},e.prototype._tryResultSelector=function(t,e){var r;try{r=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this._emitFinal(r)},e.prototype._emitFinal=function(t){var e=this.destination;this._emitted||(this._emitted=!0,e.next(t),e.complete(),this.hasCompleted=!0)},e.prototype._complete=function(){var t=this.destination;this.hasCompleted||void 0===this.defaultValue?this.hasCompleted||t.error(new o.EmptyError):(t.next(this.defaultValue),t.complete())},e}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":159}],123:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/EmptyError");r.last=function(t,e,r){return this.lift(new s(t,e,r,this))};var s=function(){function t(t,e,r,n){this.predicate=t,this.resultSelector=e,this.defaultValue=r,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),a=function(t){function e(e,r,n,i,o){t.call(this,e),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.hasValue=!1,this.index=0,void 0!==i&&(this.lastValue=i,this.hasValue=!0)}return n(e,t),e.prototype._next=function(t){var e=this.index++;if(this.predicate)this._tryPredicate(t,e);else{if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},e.prototype._tryPredicate=function(t,e){var r;try{r=this.predicate(t,e,this.source)}catch(t){return void this.destination.error(t)}if(r){if(this.resultSelector)return void this._tryResultSelector(t,e);this.lastValue=t,this.hasValue=!0}},e.prototype._tryResultSelector=function(t,e){var r;try{r=this.resultSelector(t,e)}catch(t){return void this.destination.error(t)}this.lastValue=r,this.hasValue=!0},e.prototype._complete=function(){var t=this.destination;this.hasValue?(t.next(this.lastValue),t.complete()):t.error(new o.EmptyError)},e}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":159}],124:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.map=function(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new o(t,e))};var o=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.project,this.thisArg))},t}();r.MapOperator=o;var s=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return n(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":36}],125:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=Number.POSITIVE_INFINITY,n=null,c=t[t.length-1];return a.isScheduler(c)?(n=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(r=t.pop())):"number"==typeof c&&(r=t.pop()),null===n&&1===t.length&&t[0]instanceof i.Observable?t[0]:new o.ArrayObservable(t,n).lift(new s.MergeAllOperator(r))}var i=t("../Observable"),o=t("../observable/ArrayObservable"),s=t("./mergeAll"),a=t("../util/isScheduler");r.merge=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return this.lift.call(n.apply(void 0,[this].concat(t)))},r.mergeStatic=n},{"../Observable":29,"../observable/ArrayObservable":86,"../util/isScheduler":171,"./mergeAll":126}],126:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.mergeAll=function(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),this.lift(new s(t))};var s=function(){function t(t){this.concurrent=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.concurrent))},t}();r.MergeAllOperator=s;var a=function(t){function e(e,r){t.call(this,e),this.concurrent=r,this.hasCompleted=!1,this.buffer=[],this.active=0}return n(e,t),e.prototype._next=function(t){this.active<this.concurrent?(this.active++,this.add(o.subscribeToResult(this,t))):this.buffer.push(t)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete()},e.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(i.OuterSubscriber);r.MergeAllSubscriber=a},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],127:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/subscribeToResult"),o=t("../OuterSubscriber");r.mergeMap=function(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"number"==typeof e&&(r=e,e=null),this.lift(new s(t,e,r))};var s=function(){function t(t,e,r){void 0===r&&(r=Number.POSITIVE_INFINITY),this.project=t,this.resultSelector=e,this.concurrent=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.resultSelector,this.concurrent))},t}();r.MergeMapOperator=s;var a=function(t){function e(e,r,n,i){void 0===i&&(i=Number.POSITIVE_INFINITY),t.call(this,e),this.project=r,this.resultSelector=n,this.concurrent=i,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}return n(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e,t,r)},e.prototype._innerSub=function(t,e,r){this.add(i.subscribeToResult(this,t,e,r))},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,i){this.resultSelector?this._notifyResultSelector(t,e,r,n):this.destination.next(e)},e.prototype._notifyResultSelector=function(t,e,r,n){var i;try{i=this.resultSelector(t,e,r,n)}catch(t){return void this.destination.error(t)}this.destination.next(i)},e.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(o.OuterSubscriber);r.MergeMapSubscriber=a},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],128:[function(t,e,r){"use strict";var n=t("../observable/ConnectableObservable");r.multicast=function(t,e){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return this.lift(new i(r,e));var o=Object.create(this,n.connectableObservableDescriptor);return o.source=this,o.subjectFactory=r,o};var i=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var r=this.selector,n=this.subjectFactory(),i=r(n).subscribe(t);return i.add(e.subscribe(n)),i},t}();r.MulticastOperator=i},{"../observable/ConnectableObservable":87}],129:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../Notification");r.observeOn=function(t,e){return void 0===e&&(e=0),this.lift(new s(t,e))};var s=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.scheduler,this.delay))},t}();r.ObserveOnOperator=s;var a=function(t){function e(e,r,n){void 0===n&&(n=0),t.call(this,e),this.scheduler=r,this.delay=n}return n(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination;e.observe(r),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.add(this.scheduler.schedule(e.dispatch,this.delay,new c(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.Notification.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.Notification.createError(t))},e.prototype._complete=function(){this.scheduleMessage(o.Notification.createComplete())},e}(i.Subscriber);r.ObserveOnSubscriber=a;var c=function(){return function(t,e){this.notification=t,this.destination=e}}();r.ObserveOnMessage=c},{"../Notification":28,"../Subscriber":36}],130:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.pairwise=function(){return this.lift(new o)};var o=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new s(t))},t}(),s=function(t){function e(e){t.call(this,e),this.hasPrev=!1}return n(e,t),e.prototype._next=function(t){this.hasPrev?this.destination.next([this.prev,t]):this.hasPrev=!0,this.prev=t},e}(i.Subscriber)},{"../Subscriber":36}],131:[function(t,e,r){"use strict";function n(t,e){return function(r){for(var n=r,i=0;i<e;i++){var o=n[t[i]];if(void 0===o)return;n=o}return n}}var i=t("./map");r.pluck=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=t.length;if(0===r)throw new Error("list of properties cannot be empty.");return i.map.call(this,n(t,r))}},{"./map":124}],132:[function(t,e,r){"use strict";var n=t("../Subject"),i=t("./multicast");r.publish=function(t){return t?i.multicast.call(this,function(){return new n.Subject},t):i.multicast.call(this,new n.Subject)}},{"../Subject":34,"./multicast":128}],133:[function(t,e,r){"use strict";var n=t("../ReplaySubject"),i=t("./multicast");r.publishReplay=function(t,e,r){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===e&&(e=Number.POSITIVE_INFINITY),i.multicast.call(this,new n.ReplaySubject(t,e,r))}},{"../ReplaySubject":32,"./multicast":128}],134:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.scan=function(t,e){var r=!1;return arguments.length>=2&&(r=!0),this.lift(new o(t,e,r))};var o=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.accumulator,this.seed,this.hasSeed))},t}(),s=function(t){function e(e,r,n,i){t.call(this,e),this.accumulator=r,this._seed=n,this.hasSeed=i,this.index=0}return n(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.accumulator(this.seed,t,r)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":36}],135:[function(t,e,r){"use strict";function n(){return new o.Subject}var i=t("./multicast"),o=t("../Subject");r.share=function(){return i.multicast.call(this,n).refCount()}},{"../Subject":34,"./multicast":128}],136:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.skip=function(t){return this.lift(new o(t))};var o=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.total))},t}(),s=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return n(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":36}],137:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.skipUntil=function(t){return this.lift(new s(t))};var s=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.notifier))},t}(),a=function(t){function e(e,r){t.call(this,e),this.hasValue=!1,this.isInnerStopped=!1,this.add(o.subscribeToResult(this,r))}return n(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype._complete=function(){this.isInnerStopped?t.prototype._complete.call(this):this.unsubscribe()},e.prototype.notifyNext=function(t,e,r,n,i){this.hasValue=!0},e.prototype.notifyComplete=function(){this.isInnerStopped=!0,this.isStopped&&t.prototype._complete.call(this)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],138:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.skipWhile=function(t){return this.lift(new o(t))};var o=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.predicate))},t}(),s=function(t){function e(e,r){t.call(this,e),this.predicate=r,this.skipping=!0,this.index=0}return n(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(i.Subscriber)},{"../Subscriber":36}],139:[function(t,e,r){"use strict";var n=t("../observable/ArrayObservable"),i=t("../observable/ScalarObservable"),o=t("../observable/EmptyObservable"),s=t("./concat"),a=t("../util/isScheduler");r.startWith=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=t[t.length-1];a.isScheduler(r)?t.pop():r=null;var c=t.length;return 1===c?s.concatStatic(new i.ScalarObservable(t[0],r),this):c>1?s.concatStatic(new n.ArrayObservable(t,r),this):s.concatStatic(new o.EmptyObservable(r),this)}},{"../observable/ArrayObservable":86,"../observable/EmptyObservable":89,"../observable/ScalarObservable":95,"../util/isScheduler":171,"./concat":113}],140:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.switchMap=function(t,e){return this.lift(new s(t,e))};var s=function(){function t(t,e){this.project=t,this.resultSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.resultSelector))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.resultSelector=n,this.index=0}return n(e,t),e.prototype._next=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this._innerSub(e,t,r)},e.prototype._innerSub=function(t,e,r){var n=this.innerSubscription;n&&n.unsubscribe(),this.add(this.innerSubscription=o.subscribeToResult(this,t,e,r))},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.innerSubscription=null},e.prototype.notifyComplete=function(e){this.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e,r,n,i){this.resultSelector?this._tryNotifyNext(t,e,r,n):this.destination.next(e)},e.prototype._tryNotifyNext=function(t,e,r,n){var i;try{i=this.resultSelector(t,e,r,n)}catch(t){return void this.destination.error(t)}this.destination.next(i)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],141:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber"),o=t("../util/ArgumentOutOfRangeError"),s=t("../observable/EmptyObservable");r.take=function(t){return 0===t?new s.EmptyObservable:this.lift(new a(t))};var a=function(){function t(t){if(this.total=t,this.total<0)throw new o.ArgumentOutOfRangeError}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.total))},t}(),c=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return n(e,t),e.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},e}(i.Subscriber)},{"../Subscriber":36,"../observable/EmptyObservable":89,"../util/ArgumentOutOfRangeError":158}],142:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.takeUntil=function(t){return this.lift(new s(t))};var s=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.notifier))},t}(),a=function(t){function e(e,r){t.call(this,e),this.notifier=r,this.add(o.subscribeToResult(this,r))}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.complete()},e.prototype.notifyComplete=function(){},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],143:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.defaultThrottleConfig={leading:!0,trailing:!1},r.throttle=function(t,e){return void 0===e&&(e=r.defaultThrottleConfig),this.lift(new s(t,e.leading,e.trailing))};var s=function(){function t(t,e,r){this.durationSelector=t,this.leading=e,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.durationSelector,this.leading,this.trailing))},t}(),a=function(t){function e(e,r,n,i){t.call(this,e),this.destination=e,this.durationSelector=r,this._leading=n,this._trailing=i,this._hasTrailingValue=!1}return n(e,t),e.prototype._next=function(t){if(this.throttled)this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t);else{var e=this.tryDurationSelector(t);e&&this.add(this.throttled=o.subscribeToResult(this,e)),this._leading&&(this.destination.next(t),this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=t))}},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype._unsubscribe=function(){var t=this,e=t.throttled;t._trailingValue,t._hasTrailingValue,t._trailing;this._trailingValue=null,this._hasTrailingValue=!1,e&&(this.remove(e),this.throttled=null,e.unsubscribe())},e.prototype._sendTrailing=function(){var t=this,e=t.destination,r=t.throttled,n=t._trailing,i=t._trailingValue,o=t._hasTrailingValue;r&&n&&o&&(e.next(i),this._trailingValue=null,this._hasTrailingValue=!1)},e.prototype.notifyNext=function(t,e,r,n,i){this._sendTrailing(),this._unsubscribe()},e.prototype.notifyComplete=function(){this._sendTrailing(),this._unsubscribe()},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],144:[function(t,e,r){"use strict";function n(t){t.subscriber.clearThrottle()}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber"),s=t("../scheduler/async"),a=t("./throttle");r.throttleTime=function(t,e,r){return void 0===e&&(e=s.async),void 0===r&&(r=a.defaultThrottleConfig),this.lift(new c(t,e,r.leading,r.trailing))};var c=function(){function t(t,e,r,n){this.duration=t,this.scheduler=e,this.leading=r,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),u=function(t){function e(e,r,n,i,o){t.call(this,e),this.duration=r,this.scheduler=n,this.leading=i,this.trailing=o,this._hasTrailingValue=!1,this._trailingValue=null}return i(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(n,this.duration,{subscriber:this})),this.leading&&this.destination.next(t))},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(o.Subscriber)},{"../Subscriber":36,"../scheduler/async":152,"./throttle":143}],145:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../OuterSubscriber"),o=t("../util/subscribeToResult");r.withLatestFrom=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r;"function"==typeof t[t.length-1]&&(r=t.pop());var n=t;return this.lift(new s(n,r))};var s=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.observables,this.project))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.observables=r,this.project=n,this.toRespond=[];var i=r.length;this.values=new Array(i);for(s=0;s<i;s++)this.toRespond.push(s);for(var s=0;s<i;s++){var a=r[s];this.add(o.subscribeToResult(this,a,a,s))}}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.values[r]=e;var o=this.toRespond;if(o.length>0){var s=o.indexOf(r);-1!==s&&o.splice(s,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":173}],146:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=t[t.length-1];return"function"==typeof r&&t.pop(),new o.ArrayObservable(t).lift(new l(r))}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../observable/ArrayObservable"),s=t("../util/isArray"),a=t("../Subscriber"),c=t("../OuterSubscriber"),u=t("../util/subscribeToResult"),h=t("../symbol/iterator");r.zipProto=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return this.lift.call(n.apply(void 0,[this].concat(t)))},r.zipStatic=n;var l=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new p(t,this.project))},t}();r.ZipOperator=l;var p=function(t){function e(e,r,n){void 0===n&&(n=Object.create(null)),t.call(this,e),this.iterators=[],this.active=0,this.project="function"==typeof r?r:null,this.values=n}return i(e,t),e.prototype._next=function(t){var e=this.iterators;s.isArray(t)?e.push(new d(t)):"function"==typeof t[h.iterator]?e.push(new f(t[h.iterator]())):e.push(new m(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(0!==e){this.active=e;for(var r=0;r<e;r++){var n=t[r];n.stillUnsubscribed?this.add(n.subscribe(n,r)):this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){0===--this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,r=this.destination,n=0;n<e;n++)if("function"==typeof(s=t[n]).hasValue&&!s.hasValue())return;for(var i=!1,o=[],n=0;n<e;n++){var s=t[n],a=s.next();if(s.hasCompleted()&&(i=!0),a.done)return void r.complete();o.push(a.value)}this.project?this._tryProject(o):r.next(o),i&&r.complete()},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(a.Subscriber);r.ZipSubscriber=p;var f=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return t&&t.done},t}(),d=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[h.iterator]=function(){return this},t.prototype.next=function(t){var e=this.index++,r=this.array;return e<this.length?{value:r[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),m=function(t){function e(e,r,n){t.call(this,e),this.parent=r,this.observable=n,this.stillUnsubscribed=!0,this.buffer=[],this.isComplete=!1}return i(e,t),e.prototype[h.iterator]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,i){this.buffer.push(e),this.parent.checkIterators()},e.prototype.subscribe=function(t,e){return u.subscribeToResult(this,this.observable,this,e)},e}(c.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscriber":36,"../observable/ArrayObservable":86,"../symbol/iterator":154,"../util/isArray":164,"../util/subscribeToResult":173}],147:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this)}return n(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(t("../Subscription").Subscription);r.Action=i},{"../Subscription":37}],148:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../util/root"),o=function(t){function e(e,r){t.call(this,e,r),this.scheduler=e,this.work=r,this.pending=!1}return n(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t,this.pending=!0;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,e)),this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),i.root.setInterval(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){return void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending?e:i.root.clearInterval(e)&&void 0||void 0},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r=!1,n=void 0;try{this.work(t)}catch(t){r=!0,n=!!t&&t||new Error(t)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,r=e.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(t("./Action").Action);r.AsyncAction=o},{"../util/root":172,"./Action":147}],149:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments),this.actions=[],this.active=!1,this.scheduled=void 0}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var r;this.active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(t("../Scheduler").Scheduler);r.AsyncScheduler=i},{"../Scheduler":33}],150:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e,r){t.call(this,e,r),this.scheduler=e,this.work=r}return n(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):e.flush(this)},e}(t("./AsyncAction").AsyncAction);r.QueueAction=i},{"./AsyncAction":148}],151:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e}(t("./AsyncScheduler").AsyncScheduler);r.QueueScheduler=i},{"./AsyncScheduler":149}],152:[function(t,e,r){"use strict";var n=t("./AsyncAction"),i=t("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":148,"./AsyncScheduler":149}],153:[function(t,e,r){"use strict";var n=t("./QueueAction"),i=t("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":150,"./QueueScheduler":151}],154:[function(t,e,r){"use strict";function n(t){var e=t.Symbol;if("function"==typeof e)return e.iterator||(e.iterator=e("iterator polyfill")),e.iterator;var r=t.Set;if(r&&"function"==typeof(new r)["@@iterator"])return"@@iterator";var n=t.Map;if(n)for(var i=Object.getOwnPropertyNames(n.prototype),o=0;o<i.length;++o){var s=i[o];if("entries"!==s&&"size"!==s&&n.prototype[s]===n.prototype.entries)return s}return"@@iterator"}var i=t("../util/root");r.symbolIteratorPonyfill=n,r.iterator=n(i.root),r.$$iterator=r.iterator},{"../util/root":172}],155:[function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var i=t("../util/root");r.getSymbolObservable=n,r.observable=n(i.root),r.$$observable=r.observable},{"../util/root":172}],156:[function(t,e,r){"use strict";var n=t("../util/root").root.Symbol;r.rxSubscriber="function"==typeof n&&"function"==typeof n.for?n.for("rxSubscriber"):"@@rxSubscriber",r.$$rxSubscriber=r.rxSubscriber},{"../util/root":172}],157:[function(t,e,r){"use strict";var n=t("./root"),i=function(){return function(t){t.requestAnimationFrame?(this.cancelAnimationFrame=t.cancelAnimationFrame.bind(t),this.requestAnimationFrame=t.requestAnimationFrame.bind(t)):t.mozRequestAnimationFrame?(this.cancelAnimationFrame=t.mozCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.mozRequestAnimationFrame.bind(t)):t.webkitRequestAnimationFrame?(this.cancelAnimationFrame=t.webkitCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.webkitRequestAnimationFrame.bind(t)):t.msRequestAnimationFrame?(this.cancelAnimationFrame=t.msCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.msRequestAnimationFrame.bind(t)):t.oRequestAnimationFrame?(this.cancelAnimationFrame=t.oCancelAnimationFrame.bind(t),this.requestAnimationFrame=t.oRequestAnimationFrame.bind(t)):(this.cancelAnimationFrame=t.clearTimeout.bind(t),this.requestAnimationFrame=function(e){return t.setTimeout(e,1e3/60)})}}();r.RequestAnimationFrameDefinition=i,r.AnimationFrame=new i(n.root)},{"./root":172}],158:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){var e=t.call(this,"argument out of range");this.name=e.name="ArgumentOutOfRangeError",this.stack=e.stack,this.message=e.message}return n(e,t),e}(Error);r.ArgumentOutOfRangeError=i},{}],159:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){var e=t.call(this,"no elements in sequence");this.name=e.name="EmptyError",this.stack=e.stack,this.message=e.message}return n(e,t),e}(Error);r.EmptyError=i},{}],160:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(){var e=t.call(this,"object unsubscribed");this.name=e.name="ObjectUnsubscribedError",this.stack=e.stack,this.message=e.message}return n(e,t),e}(Error);r.ObjectUnsubscribedError=i},{}],161:[function(t,e,r){"use strict";function n(){return function(){function t(){this._values=[]}return t.prototype.add=function(t){this.has(t)||this._values.push(t)},t.prototype.has=function(t){return-1!==this._values.indexOf(t)},Object.defineProperty(t.prototype,"size",{get:function(){return this._values.length},enumerable:!0,configurable:!0}),t.prototype.clear=function(){this._values.length=0},t}()}var i=t("./root");r.minimalSetImpl=n,r.Set=i.root.Set||n()},{"./root":172}],162:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e){t.call(this),this.errors=e;var r=Error.call(this,e?e.length+" errors occurred during unsubscription:\n  "+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n  "):"");this.name=r.name="UnsubscriptionError",this.stack=r.stack,this.message=r.message}return n(e,t),e}(Error);r.UnsubscriptionError=i},{}],163:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],164:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],165:[function(t,e,r){"use strict";r.isArrayLike=function(t){return t&&"number"==typeof t.length}},{}],166:[function(t,e,r){"use strict";r.isDate=function(t){return t instanceof Date&&!isNaN(+t)}},{}],167:[function(t,e,r){"use strict";r.isFunction=function(t){return"function"==typeof t}},{}],168:[function(t,e,r){"use strict";var n=t("../util/isArray");r.isNumeric=function(t){return!n.isArray(t)&&t-parseFloat(t)+1>=0}},{"../util/isArray":164}],169:[function(t,e,r){"use strict";r.isObject=function(t){return null!=t&&"object"==typeof t}},{}],170:[function(t,e,r){"use strict";r.isPromise=function(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}},{}],171:[function(t,e,r){"use strict";r.isScheduler=function(t){return t&&"function"==typeof t.schedule}},{}],172:[function(t,e,r){(function(t){"use strict";var e="undefined"!=typeof window&&window,n="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,i=void 0!==t&&t,o=e||i||n;r.root=o,function(){if(!o)throw new Error("RxJS could not find any global context (window, self, global)")}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],173:[function(t,e,r){"use strict";var n=t("./root"),i=t("./isArrayLike"),o=t("./isPromise"),s=t("./isObject"),a=t("../Observable"),c=t("../symbol/iterator"),u=t("../InnerSubscriber"),h=t("../symbol/observable");r.subscribeToResult=function(t,e,r,l){var p=new u.InnerSubscriber(t,r,l);if(p.closed)return null;if(e instanceof a.Observable)return e._isScalar?(p.next(e.value),p.complete(),null):e.subscribe(p);if(i.isArrayLike(e)){for(var f=0,d=e.length;f<d&&!p.closed;f++)p.next(e[f]);p.closed||p.complete()}else{if(o.isPromise(e))return e.then(function(t){p.closed||(p.next(t),p.complete())},function(t){return p.error(t)}).then(null,function(t){n.root.setTimeout(function(){throw t})}),p;if(e&&"function"==typeof e[c.iterator])for(var m=e[c.iterator]();;){var v=m.next();if(v.done){p.complete();break}if(p.next(v.value),p.closed)break}else if(e&&"function"==typeof e[h.observable]){var g=e[h.observable]();if("function"==typeof g.subscribe)return g.subscribe(new u.InnerSubscriber(t,r,l));p.error(new TypeError("Provided object does not correctly implement Symbol.observable"))}else{var y="You provided "+(s.isObject(e)?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.";p.error(new TypeError(y))}}return null}},{"../InnerSubscriber":27,"../Observable":29,"../symbol/iterator":154,"../symbol/observable":155,"./isArrayLike":165,"./isObject":169,"./isPromise":170,"./root":172}],174:[function(t,e,r){"use strict";var n=t("../Subscriber"),i=t("../symbol/rxSubscriber"),o=t("../Observer");r.toSubscriber=function(t,e,r){if(t){if(t instanceof n.Subscriber)return t;if(t[i.rxSubscriber])return t[i.rxSubscriber]()}return t||e||r?new n.Subscriber(t,e,r):new n.Subscriber(o.empty)}},{"../Observer":30,"../Subscriber":36,"../symbol/rxSubscriber":156}],175:[function(t,e,r){"use strict";function n(){try{return i.apply(this,arguments)}catch(t){return o.errorObject.e=t,o.errorObject}}var i,o=t("./errorObject");r.tryCatch=function(t){return i=t,n}},{"./errorObject":163}],176:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.THREE=t.THREE||{})}(this,function(t){function e(){}function r(t,e){this.x=t||0,this.y=e||0}function n(t,e,i,o,s,a,c,u,h,l){Object.defineProperty(this,"id",{value:wi++}),this.uuid=xi.generateUUID(),this.name="",this.image=void 0!==t?t:n.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:n.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:1001,this.wrapT=void 0!==o?o:1001,this.magFilter=void 0!==s?s:1006,this.minFilter=void 0!==a?a:1008,this.anisotropy=void 0!==h?h:1,this.format=void 0!==c?c:1023,this.type=void 0!==u?u:1009,this.offset=new r(0,0),this.repeat=new r(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:3e3,this.version=0,this.onUpdate=null}function i(t,e,r,n){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==n?n:1}function o(t,e,r){this.uuid=xi.generateUUID(),this.width=t,this.height=e,this.scissor=new i(0,0,t,e),this.scissorTest=!1,this.viewport=new i(0,0,t,e),void 0===(r=r||{}).minFilter&&(r.minFilter=1006),this.texture=new n(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function s(t,e,r){o.call(this,t,e,r),this.activeMipMapLevel=this.activeCubeFace=0}function a(t,e,r,n){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==n?n:1}function c(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0}function u(){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 h(t,e,r,i,o,s,a,c,u,h,l,p){n.call(this,null,s,a,c,u,h,i,o,l,p),this.image={data:t,width:e,height:r},this.magFilter=void 0!==u?u:1003,this.minFilter=void 0!==h?h:1003,this.flipY=this.generateMipmaps=!1,this.unpackAlignment=1}function l(t,e,r,i,o,s,a,c,u,h){t=void 0!==t?t:[],n.call(this,t,void 0!==e?e:301,r,i,o,s,a,c,u,h),this.flipY=!1}function p(t,e,r){var n=t[0];if(0>=n||0<n)return t;var i=e*r,o=Ei[i];if(void 0===o&&(o=new Float32Array(i),Ei[i]=o),0!==e)for(n.toArray(o,0),n=1,i=0;n!==e;++n)i+=r,t[n].toArray(o,i);return o}function f(t,e){var r=Ti[e];void 0===r&&(r=new Int32Array(e),Ti[e]=r);for(var n=0;n!==e;++n)r[n]=t.allocTextureUnit();return r}function d(t,e){t.uniform1f(this.addr,e)}function m(t,e){t.uniform1i(this.addr,e)}function v(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function g(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function y(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function b(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function _(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Oi.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Oi))}function x(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Ci.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Ci))}function w(t,e,r){var n=r.allocTextureUnit();t.uniform1i(this.addr,n),r.setTexture2D(e||Si,n)}function S(t,e,r){var n=r.allocTextureUnit();t.uniform1i(this.addr,n),r.setTextureCube(e||Mi,n)}function M(t,e){t.uniform2iv(this.addr,e)}function E(t,e){t.uniform3iv(this.addr,e)}function T(t,e){t.uniform4iv(this.addr,e)}function C(t){switch(t){case 5126:return d;case 35664:return v;case 35665:return g;case 35666:return y;case 35674:return b;case 35675:return _;case 35676:return x;case 35678:case 36198:return w;case 35680:return S;case 5124:case 35670:return m;case 35667:case 35671:return M;case 35668:case 35672:return E;case 35669:case 35673:return T}}function O(t,e){t.uniform1fv(this.addr,e)}function P(t,e){t.uniform1iv(this.addr,e)}function A(t,e){t.uniform2fv(this.addr,p(e,this.size,2))}function j(t,e){t.uniform3fv(this.addr,p(e,this.size,3))}function R(t,e){t.uniform4fv(this.addr,p(e,this.size,4))}function L(t,e){t.uniformMatrix2fv(this.addr,!1,p(e,this.size,4))}function N(t,e){t.uniformMatrix3fv(this.addr,!1,p(e,this.size,9))}function I(t,e){t.uniformMatrix4fv(this.addr,!1,p(e,this.size,16))}function D(t,e,r){var n=e.length,i=f(r,n);for(t.uniform1iv(this.addr,i),t=0;t!==n;++t)r.setTexture2D(e[t]||Si,i[t])}function k(t,e,r){var n=e.length,i=f(r,n);for(t.uniform1iv(this.addr,i),t=0;t!==n;++t)r.setTextureCube(e[t]||Mi,i[t])}function F(t){switch(t){case 5126:return O;case 35664:return A;case 35665:return j;case 35666:return R;case 35674:return L;case 35675:return N;case 35676:return I;case 35678:return D;case 35680:return k;case 5124:case 35670:return P;case 35667:case 35671:return M;case 35668:case 35672:return E;case 35669:case 35673:return T}}function B(t,e,r){this.id=t,this.addr=r,this.setValue=C(e.type)}function U(t,e,r){this.id=t,this.addr=r,this.size=e.size,this.setValue=F(e.type)}function z(t){this.id=t,this.seq=[],this.map={}}function G(t,e,r){this.seq=[],this.map={},this.renderer=r,r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(var n=0;n<r;++n){var i=t.getActiveUniform(e,n),o=t.getUniformLocation(e,i.name),s=this,a=i.name,c=a.length;for(Pi.lastIndex=0;;){var u=Pi.exec(a),h=Pi.lastIndex,l=u[1],p=u[3];if("]"===u[2]&&(l|=0),void 0===p||"["===p&&h+2===c){a=s,i=void 0===p?new B(l,i,o):new U(l,i,o),a.seq.push(i),a.map[i.id]=i;break}void 0===(p=s.map[l])&&(p=new z(l),l=s,s=p,l.seq.push(s),l.map[s.id]=s),s=p}}}function $(t,e,r){return void 0===e&&void 0===r?this.set(t):this.setRGB(t,e,r)}function V(t,e){this.min=void 0!==t?t:new r(1/0,1/0),this.max=void 0!==e?e:new r(-1/0,-1/0)}function H(t,e){var n,i,o,s,a,u,h,l,p,f,d,m,v,g,y,b,_=t.context,x=t.state;this.render=function(w,S,M){if(0!==e.length){w=new c;var E=M.w/M.z,T=.5*M.z,C=.5*M.w,O=new r((R=16/M.w)*E,R),P=new c(1,1,0),A=new r(1,1),j=new V;if(j.min.set(M.x,M.y),j.max.set(M.x+(M.z-16),M.y+(M.w-16)),void 0===g){var R=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),L=new Uint16Array([0,1,2,0,2,3]);d=_.createBuffer(),m=_.createBuffer(),_.bindBuffer(_.ARRAY_BUFFER,d),_.bufferData(_.ARRAY_BUFFER,R,_.STATIC_DRAW),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,m),_.bufferData(_.ELEMENT_ARRAY_BUFFER,L,_.STATIC_DRAW),y=_.createTexture(),b=_.createTexture(),x.bindTexture(_.TEXTURE_2D,y),_.texImage2D(_.TEXTURE_2D,0,_.RGB,16,16,0,_.RGB,_.UNSIGNED_BYTE,null),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.NEAREST),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.NEAREST),x.bindTexture(_.TEXTURE_2D,b),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,16,16,0,_.RGBA,_.UNSIGNED_BYTE,null),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.NEAREST),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.NEAREST);var R=v={vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},L=_.createProgram(),N=_.createShader(_.FRAGMENT_SHADER),I=_.createShader(_.VERTEX_SHADER),D="precision "+t.getPrecision()+" float;\n";_.shaderSource(N,D+R.fragmentShader),_.shaderSource(I,D+R.vertexShader),_.compileShader(N),_.compileShader(I),_.attachShader(L,N),_.attachShader(L,I),_.linkProgram(L),g=L,p=_.getAttribLocation(g,"position"),f=_.getAttribLocation(g,"uv"),n=_.getUniformLocation(g,"renderType"),i=_.getUniformLocation(g,"map"),o=_.getUniformLocation(g,"occlusionMap"),s=_.getUniformLocation(g,"opacity"),a=_.getUniformLocation(g,"color"),u=_.getUniformLocation(g,"scale"),h=_.getUniformLocation(g,"rotation"),l=_.getUniformLocation(g,"screenPosition")}for(_.useProgram(g),x.initAttributes(),x.enableAttribute(p),x.enableAttribute(f),x.disableUnusedAttributes(),_.uniform1i(o,0),_.uniform1i(i,1),_.bindBuffer(_.ARRAY_BUFFER,d),_.vertexAttribPointer(p,2,_.FLOAT,!1,16,0),_.vertexAttribPointer(f,2,_.FLOAT,!1,16,8),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,m),x.disable(_.CULL_FACE),x.buffers.depth.setMask(!1),L=0,N=e.length;L<N;L++)if(R=16/M.w,O.set(R*E,R),I=e[L],w.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),w.applyMatrix4(S.matrixWorldInverse),w.applyMatrix4(S.projectionMatrix),P.copy(w),A.x=M.x+P.x*T+T-8,A.y=M.y+P.y*C+C-8,!0===j.containsPoint(A)){x.activeTexture(_.TEXTURE0),x.bindTexture(_.TEXTURE_2D,null),x.activeTexture(_.TEXTURE1),x.bindTexture(_.TEXTURE_2D,y),_.copyTexImage2D(_.TEXTURE_2D,0,_.RGB,A.x,A.y,16,16,0),_.uniform1i(n,0),_.uniform2f(u,O.x,O.y),_.uniform3f(l,P.x,P.y,P.z),x.disable(_.BLEND),x.enable(_.DEPTH_TEST),_.drawElements(_.TRIANGLES,6,_.UNSIGNED_SHORT,0),x.activeTexture(_.TEXTURE0),x.bindTexture(_.TEXTURE_2D,b),_.copyTexImage2D(_.TEXTURE_2D,0,_.RGBA,A.x,A.y,16,16,0),_.uniform1i(n,1),x.disable(_.DEPTH_TEST),x.activeTexture(_.TEXTURE1),x.bindTexture(_.TEXTURE_2D,y),_.drawElements(_.TRIANGLES,6,_.UNSIGNED_SHORT,0),I.positionScreen.copy(P),I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares(),_.uniform1i(n,2),x.enable(_.BLEND);for(var D=0,k=I.lensFlares.length;D<k;D++){var F=I.lensFlares[D];.001<F.opacity&&.001<F.scale&&(P.x=F.x,P.y=F.y,P.z=F.z,R=F.size*F.scale/M.w,O.x=R*E,O.y=R,_.uniform3f(l,P.x,P.y,P.z),_.uniform2f(u,O.x,O.y),_.uniform1f(h,F.rotation),_.uniform1f(s,F.opacity),_.uniform3f(a,F.color.r,F.color.g,F.color.b),x.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),t.setTexture2D(F.texture,1),_.drawElements(_.TRIANGLES,6,_.UNSIGNED_SHORT,0))}}x.enable(_.CULL_FACE),x.enable(_.DEPTH_TEST),x.buffers.depth.setMask(!0),t.resetGLState()}}}function q(t,e){function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var i,o,s,u,h,l,p,f,d,m,v,g,y,b,_,x,w,S,M,E,T,C=t.context,O=t.state,P=new c,A=new a,j=new c;this.render=function(a,c){if(0!==e.length){if(void 0===E){var R=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),L=new Uint16Array([0,1,2,0,2,3]);S=C.createBuffer(),M=C.createBuffer(),C.bindBuffer(C.ARRAY_BUFFER,S),C.bufferData(C.ARRAY_BUFFER,R,C.STATIC_DRAW),C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,M),C.bufferData(C.ELEMENT_ARRAY_BUFFER,L,C.STATIC_DRAW);var R=C.createProgram(),L=C.createShader(C.VERTEX_SHADER),N=C.createShader(C.FRAGMENT_SHADER);C.shaderSource(L,["precision "+t.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),C.shaderSource(N,["precision "+t.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),C.compileShader(L),C.compileShader(N),C.attachShader(R,L),C.attachShader(R,N),C.linkProgram(R),E=R,x=C.getAttribLocation(E,"position"),w=C.getAttribLocation(E,"uv"),i=C.getUniformLocation(E,"uvOffset"),o=C.getUniformLocation(E,"uvScale"),s=C.getUniformLocation(E,"rotation"),u=C.getUniformLocation(E,"scale"),h=C.getUniformLocation(E,"color"),l=C.getUniformLocation(E,"map"),p=C.getUniformLocation(E,"opacity"),f=C.getUniformLocation(E,"modelViewMatrix"),d=C.getUniformLocation(E,"projectionMatrix"),m=C.getUniformLocation(E,"fogType"),v=C.getUniformLocation(E,"fogDensity"),g=C.getUniformLocation(E,"fogNear"),y=C.getUniformLocation(E,"fogFar"),b=C.getUniformLocation(E,"fogColor"),_=C.getUniformLocation(E,"alphaTest"),(R=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,R.height=8,(L=R.getContext("2d")).fillStyle="white",L.fillRect(0,0,8,8),(T=new n(R)).needsUpdate=!0}C.useProgram(E),O.initAttributes(),O.enableAttribute(x),O.enableAttribute(w),O.disableUnusedAttributes(),O.disable(C.CULL_FACE),O.enable(C.BLEND),C.bindBuffer(C.ARRAY_BUFFER,S),C.vertexAttribPointer(x,2,C.FLOAT,!1,16,0),C.vertexAttribPointer(w,2,C.FLOAT,!1,16,8),C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,M),C.uniformMatrix4fv(d,!1,c.projectionMatrix.elements),O.activeTexture(C.TEXTURE0),C.uniform1i(l,0),L=R=0,(N=a.fog)?(C.uniform3f(b,N.color.r,N.color.g,N.color.b),N.isFog?(C.uniform1f(g,N.near),C.uniform1f(y,N.far),C.uniform1i(m,1),L=R=1):N.isFogExp2&&(C.uniform1f(v,N.density),C.uniform1i(m,2),L=R=2)):(C.uniform1i(m,0),L=R=0);for(var N=0,I=e.length;N<I;N++)(k=e[N]).modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,k.matrixWorld),k.z=-k.modelViewMatrix.elements[14];e.sort(r);for(var D=[],N=0,I=e.length;N<I;N++){var k=e[N],F=k.material;if(!1!==F.visible){k.onBeforeRender(t,a,c,void 0,F,void 0),C.uniform1f(_,F.alphaTest),C.uniformMatrix4fv(f,!1,k.modelViewMatrix.elements),k.matrixWorld.decompose(P,A,j),D[0]=j.x,D[1]=j.y;var B=0;a.fog&&F.fog&&(B=L),R!==B&&(C.uniform1i(m,B),R=B),null!==F.map?(C.uniform2f(i,F.map.offset.x,F.map.offset.y),C.uniform2f(o,F.map.repeat.x,F.map.repeat.y)):(C.uniform2f(i,0,0),C.uniform2f(o,1,1)),C.uniform1f(p,F.opacity),C.uniform3f(h,F.color.r,F.color.g,F.color.b),C.uniform1f(s,F.rotation),C.uniform2fv(u,D),O.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst,F.blendEquationAlpha,F.blendSrcAlpha,F.blendDstAlpha,F.premultipliedAlpha),O.buffers.depth.setTest(F.depthTest),O.buffers.depth.setMask(F.depthWrite),F.map?t.setTexture2D(F.map,0):t.setTexture2D(T,0),C.drawElements(C.TRIANGLES,6,C.UNSIGNED_SHORT,0),k.onAfterRender(t,a,c,void 0,F,void 0)}}O.enable(C.CULL_FACE),t.resetGLState()}}}function W(){Object.defineProperty(this,"id",{value:Ii++}),this.uuid=xi.generateUUID(),this.name="",this.type="Material",this.lights=this.fog=!0,this.blending=1,this.side=0,this.shading=2,this.vertexColors=0,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.clippingPlanes=null,this.clipShadows=this.clipIntersection=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.needsUpdate=this.visible=!0}function X(t){W.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,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function Y(t){W.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.lights=this.fog=!1,this.setValues(t)}function K(t,e){this.min=void 0!==t?t:new c(1/0,1/0,1/0),this.max=void 0!==e?e:new c(-1/0,-1/0,-1/0)}function Z(t,e){this.center=void 0!==t?t:new c,this.radius=void 0!==e?e:0}function J(){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 Q(t,e){this.normal=void 0!==t?t:new c(1,0,0),this.constant=void 0!==e?e:0}function tt(t,e,r,n,i,o){this.planes=[void 0!==t?t:new Q,void 0!==e?e:new Q,void 0!==r?r:new Q,void 0!==n?n:new Q,void 0!==i?i:new Q,void 0!==o?o:new Q]}function et(t,e,n,s){function a(e,r,n,i){var o,s=e.geometry;o=_;var a=e.customDepthMaterial;return n&&(o=x,a=e.customDistanceMaterial),a?o=a:(a=!1,r.morphTargets&&(s&&s.isBufferGeometry?a=s.morphAttributes&&s.morphAttributes.position&&0<s.morphAttributes.position.length:s&&s.isGeometry&&(a=s.morphTargets&&0<s.morphTargets.length)),e.isSkinnedMesh&&!1===r.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e),e=e.isSkinnedMesh&&r.skinning,s=0,a&&(s|=1),e&&(s|=2),o=o[s]),t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length&&(s=o.uuid,a=r.uuid,void 0===(e=w[s])&&(e={},w[s]=e),void 0===(s=e[a])&&(s=o.clone(),e[a]=s),o=s),o.visible=r.visible,o.wireframe=r.wireframe,a=r.side,j.renderSingleSided&&2==a&&(a=0),j.renderReverseSided&&(0===a?a=1:1===a&&(a=0)),o.side=a,o.clipShadows=r.clipShadows,o.clippingPlanes=r.clippingPlanes,o.wireframeLinewidth=r.wireframeLinewidth,o.linewidth=r.linewidth,n&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function h(e,r,i,o){if(!1!==e.visible){if(e.layers.test(r.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||f.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld);var s=n.update(e),c=e.material;if(Array.isArray(c))for(var u=s.groups,l=0,p=u.length;l<p;l++){var d=u[l],m=c[d.materialIndex];m&&m.visible&&(m=a(e,m,o,b),t.renderBufferDirect(i,null,s,m,e,d))}else c.visible&&(m=a(e,c,o,b),t.renderBufferDirect(i,null,s,m,e,null))}for(s=0,c=(e=e.children).length;s<c;s++)h(e[s],r,i,o)}}var l=t.context,p=t.state,f=new tt,d=new u,m=e.shadows,v=new r,g=new r(s.maxTextureSize,s.maxTextureSize),y=new c,b=new c,_=Array(4),x=Array(4),w={},S=[new c(1,0,0),new c(-1,0,0),new c(0,0,1),new c(0,0,-1),new c(0,1,0),new c(0,-1,0)],M=[new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,0,1),new c(0,0,-1)],E=[new i,new i,new i,new i,new i,new i];(e=new Y).depthPacking=3201,e.clipping=!0,s=Ni.distanceRGBA;for(var T=Ri.clone(s.uniforms),C=0;4!==C;++C){var O=0!=(1&C),P=0!=(2&C),A=e.clone();A.morphTargets=O,A.skinning=P,_[C]=A,O=new X({defines:{USE_SHADOWMAP:""},uniforms:T,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,morphTargets:O,skinning:P,clipping:!0}),x[C]=O}var j=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.renderSingleSided=this.renderReverseSided=!0,this.render=function(e,r){if(!1!==j.enabled&&(!1!==j.autoUpdate||!1!==j.needsUpdate)&&0!==m.length){p.disable(l.BLEND),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var n,i=0,s=m.length;i<s;i++){var a=m[i];n=a.shadow;var c=a&&a.isPointLight;if(void 0===n)console.warn("THREE.WebGLShadowMap:",a,"has no shadow.");else{var u=n.camera;if(v.copy(n.mapSize),v.min(g),c){var _=v.x,x=v.y;E[0].set(2*_,x,_,x),E[1].set(0,x,_,x),E[2].set(3*_,x,_,x),E[3].set(_,x,_,x),E[4].set(3*_,0,_,x),E[5].set(_,0,_,x),v.x*=4,v.y*=2}for(null===n.map&&(n.map=new o(v.x,v.y,{minFilter:1003,magFilter:1003,format:1023}),n.map.texture.name=a.name+".shadowMap",u.updateProjectionMatrix()),n.isSpotLightShadow&&n.update(a),_=n.map,x=n.matrix,b.setFromMatrixPosition(a.matrixWorld),u.position.copy(b),c?(n=6,x.makeTranslation(-b.x,-b.y,-b.z)):(n=1,y.setFromMatrixPosition(a.target.matrixWorld),u.lookAt(y),u.updateMatrixWorld(),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(u.projectionMatrix),x.multiply(u.matrixWorldInverse)),t.setRenderTarget(_),t.clear(),a=0;a<n;a++)c&&(y.copy(u.position),y.add(S[a]),u.up.copy(M[a]),u.lookAt(y),u.updateMatrixWorld(),p.viewport(E[a])),d.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),f.setFromMatrix(d),h(e,r,u,c)}}i=t.getClearColor(),s=t.getClearAlpha(),t.setClearColor(i,s),j.needsUpdate=!1}}}function rt(t){var e={};return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e[t.uuid]},remove:function(r){r.isInterleavedBufferAttribute&&(r=r.data);var n=e[r.uuid];n&&(t.deleteBuffer(n.buffer),delete e[r.uuid])},update:function(r,n){if(r.isInterleavedBufferAttribute&&(r=r.data),void 0===(i=e[r.uuid])){var i=r.uuid,o=r,s=o.array,a=o.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,c=t.createBuffer();t.bindBuffer(n,c),t.bufferData(n,s,a),o.onUploadCallback(),a=t.FLOAT,s instanceof Float32Array?a=t.FLOAT:s instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):s instanceof Uint16Array?a=t.UNSIGNED_SHORT:s instanceof Int16Array?a=t.SHORT:s instanceof Uint32Array?a=t.UNSIGNED_INT:s instanceof Int32Array?a=t.INT:s instanceof Int8Array?a=t.BYTE:s instanceof Uint8Array&&(a=t.UNSIGNED_BYTE),e[i]={buffer:c,type:a,bytesPerElement:s.BYTES_PER_ELEMENT,version:o.version}}else i.version<r.version&&(o=r,s=o.array,c=o.updateRange,t.bindBuffer(n,i.buffer),!1===o.dynamic?t.bufferData(n,s,t.STATIC_DRAW):-1===c.count?t.bufferSubData(n,0,s):0===c.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(n,c.offset*s.BYTES_PER_ELEMENT,s.subarray(c.offset,c.offset+c.count)),c.count=-1),i.version=r.version)}}}function nt(t,e,r,n){this._x=t||0,this._y=e||0,this._z=r||0,this._order=n||nt.DefaultOrder}function it(){this.mask=1}function ot(){Object.defineProperty(this,"id",{value:Di++}),this.uuid=xi.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DefaultUp.clone();var t=new c,e=new nt,r=new a,n=new c(1,1,1);e.onChange(function(){r.setFromEuler(e,!1)}),r.onChange(function(){e.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:n},modelViewMatrix:{value:new u},normalMatrix:{value:new J}}),this.matrix=new u,this.matrixWorld=new u,this.matrixAutoUpdate=ot.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new it,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function st(){ot.call(this),this.type="Camera",this.matrixWorldInverse=new u,this.projectionMatrix=new u}function at(t,e,r,n,i,o){st.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=r,this.bottom=n,this.near=void 0!==i?i:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function ct(t,e,r,n){st.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t: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!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ut(t,e,r,n,i,o){this.a=t,this.b=e,this.c=r,this.normal=n&&n.isVector3?n:new c,this.vertexNormals=Array.isArray(n)?n:[],this.color=i&&i.isColor?i:new $,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0}function ht(){Object.defineProperty(this,"id",{value:ki++}),this.uuid=xi.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 lt(t,e,r){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=xi.generateUUID(),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===r,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function pt(t,e){lt.call(this,new Int8Array(t),e)}function ft(t,e){lt.call(this,new Uint8Array(t),e)}function dt(t,e){lt.call(this,new Uint8ClampedArray(t),e)}function mt(t,e){lt.call(this,new Int16Array(t),e)}function vt(t,e){lt.call(this,new Uint16Array(t),e)}function gt(t,e){lt.call(this,new Int32Array(t),e)}function yt(t,e){lt.call(this,new Uint32Array(t),e)}function bt(t,e){lt.call(this,new Float32Array(t),e)}function _t(t,e){lt.call(this,new Float64Array(t),e)}function xt(){this.indices=[],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 wt(t){if(0===t.length)return-1/0;for(var e=t[0],r=1,n=t.length;r<n;++r)t[r]>e&&(e=t[r]);return e}function St(){Object.defineProperty(this,"id",{value:ki++}),this.uuid=xi.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}}function Mt(t,e,r,n,i,o){ht.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Et(t,e,r,n,i,o)),this.mergeVertices()}function Et(t,e,r,n,i,o){function s(t,e,r,n,i,o,s,m,v,g,y){var b=o/v,_=s/g,x=o/2,w=s/2,S=m/2;s=v+1;var M,E,T=g+1,C=o=0,O=new c;for(E=0;E<T;E++){var P=E*_-w;for(M=0;M<s;M++)O[t]=(M*b-x)*n,O[e]=P*i,O[r]=S,h.push(O.x,O.y,O.z),O[t]=0,O[e]=0,O[r]=0<m?1:-1,l.push(O.x,O.y,O.z),p.push(M/v),p.push(1-E/g),o+=1}for(E=0;E<g;E++)for(M=0;M<v;M++)t=f+M+s*(E+1),e=f+(M+1)+s*(E+1),r=f+(M+1)+s*E,u.push(f+M+s*E,t,r),u.push(t,e,r),C+=6;a.addGroup(d,C,y),d+=C,f+=o}St.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:o};var a=this;n=Math.floor(n)||1,i=Math.floor(i)||1;var u=[],h=[],l=[],p=[],f=0,d=0;s("z","y","x",-1,-1,r,e,t,o=Math.floor(o)||1,i,0),s("z","y","x",1,-1,r,e,-t,o,i,1),s("x","z","y",1,1,t,r,e,n,o,2),s("x","z","y",1,-1,t,r,-e,n,o,3),s("x","y","z",1,-1,t,e,r,n,i,4),s("x","y","z",-1,-1,t,e,-r,n,i,5),this.setIndex(u),this.addAttribute("position",new bt(h,3)),this.addAttribute("normal",new bt(l,3)),this.addAttribute("uv",new bt(p,2))}function Tt(t,e,r,n){ht.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new Ct(t,e,r,n)),this.mergeVertices()}function Ct(t,e,r,n){St.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n};var i=t/2,o=e/2,s=(r=Math.floor(r)||1)+1,a=(n=Math.floor(n)||1)+1,c=t/r,u=e/n,h=[],l=[],p=[],f=[];for(t=0;t<a;t++){var d=t*u-o;for(e=0;e<s;e++)l.push(e*c-i,-d,0),p.push(0,0,1),f.push(e/r),f.push(1-t/n)}for(t=0;t<n;t++)for(e=0;e<r;e++)i=e+s*(t+1),o=e+1+s*(t+1),a=e+1+s*t,h.push(e+s*t,i,a),h.push(i,o,a);this.setIndex(h),this.addAttribute("position",new bt(l,3)),this.addAttribute("normal",new bt(p,3)),this.addAttribute("uv",new bt(f,2))}function Ot(t){W.call(this),this.type="MeshBasicMaterial",this.color=new $(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.lights=this.morphTargets=this.skinning=!1,this.setValues(t)}function Pt(t,e){this.origin=void 0!==t?t:new c,this.direction=void 0!==e?e:new c}function At(t,e){this.start=void 0!==t?t:new c,this.end=void 0!==e?e:new c}function jt(t,e,r){this.a=void 0!==t?t:new c,this.b=void 0!==e?e:new c,this.c=void 0!==r?r:new c}function Rt(t,e){ot.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new St,this.material=void 0!==e?e:new Ot({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function Lt(t,e,r,n){function i(t,r){e.buffers.color.setClear(t.r,t.g,t.b,r,n)}var o,s,a,c,u=new $(0),h=0;return{getClearColor:function(){return u},setClearColor:function(t,e){u.set(t),i(u,h=void 0!==e?e:1)},getClearAlpha:function(){return h},setClearAlpha:function(t){i(u,h=t)},render:function(e,n,l){null===(e=e.background)?i(u,h):e&&e.isColor&&(i(e,1),l=!0),(t.autoClear||l)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),e&&e.isCubeTexture?(void 0===a&&(a=new ct,c=new Rt(new Et(5,5,5),new X({uniforms:Ni.cube.uniforms,vertexShader:Ni.cube.vertexShader,fragmentShader:Ni.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))),a.projectionMatrix.copy(n.projectionMatrix),a.matrixWorld.extractRotation(n.matrixWorld),a.matrixWorldInverse.getInverse(a.matrixWorld),c.material.uniforms.tCube.value=e,c.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,c.matrixWorld),r.update(c),t.renderBufferDirect(a,null,c.geometry,c.material,c,null)):e&&e.isTexture&&(void 0===o&&(o=new at(-1,1,1,-1,0,1),s=new Rt(new Ct(2,2),new Ot({depthTest:!1,depthWrite:!1,fog:!1}))),s.material.map=e,r.update(s),t.renderBufferDirect(o,null,s.geometry,s.material,s,null))}}}function Nt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function It(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Dt(){var t=[],e=-1,r=[],n=-1;return{opaque:t,transparent:r,init:function(){n=e=-1},push:function(i,o,s,a,c){var u,h;s.transparent?(u=r,h=++n):(u=t,h=++e),(h=u[h])?(h.id=i.id,h.object=i,h.geometry=o,h.material=s,h.program=s.program,h.renderOrder=i.renderOrder,h.z=a,h.group=c):(h={id:i.id,object:i,geometry:o,material:s,program:s.program,renderOrder:i.renderOrder,z:a,group:c},u.push(h))},finish:function(){t.length=e+1,r.length=n+1},sort:function(){t.sort(Nt),r.sort(It)}}}function kt(){var t={};return{get:function(e,r){var n=e.id+","+r.id,i=t[n];return void 0===i&&(i=new Dt,t[n]=i),i},dispose:function(){t={}}}}function Ft(t,e,r){var n,i,o;this.setMode=function(t){n=t},this.setIndex=function(t){i=t.type,o=t.bytesPerElement},this.render=function(e,s){t.drawElements(n,s,i,e*o),r.calls++,r.vertices+=s,n===t.TRIANGLES&&(r.faces+=s/3)},this.renderInstances=function(s,a,c){var u=e.get("ANGLE_instanced_arrays");null===u?console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(u.drawElementsInstancedANGLE(n,c,i,a*o,s.maxInstancedCount),r.calls++,r.vertices+=c*s.maxInstancedCount,n===t.TRIANGLES&&(r.faces+=s.maxInstancedCount*c/3))}}function Bt(t,e,r){var n;this.setMode=function(t){n=t},this.render=function(e,i){t.drawArrays(n,e,i),r.calls++,r.vertices+=i,n===t.TRIANGLES&&(r.faces+=i/3)},this.renderInstances=function(i,o,s){var a=e.get("ANGLE_instanced_arrays");if(null===a)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var c=i.attributes.position;c.isInterleavedBufferAttribute?(s=c.data.count,a.drawArraysInstancedANGLE(n,0,s,i.maxInstancedCount)):a.drawArraysInstancedANGLE(n,o,s,i.maxInstancedCount),r.calls++,r.vertices+=s*i.maxInstancedCount,n===t.TRIANGLES&&(r.faces+=i.maxInstancedCount*s/3)}}}function Ut(t,e,r){function n(t){t=t.target;var s=i[t.id];null!==s.index&&e.remove(s.index);for(var a in s.attributes)e.remove(s.attributes[a]);t.removeEventListener("dispose",n),delete i[t.id],(a=o[t.id])&&(e.remove(a),delete o[t.id]),(a=o[s.id])&&(e.remove(a),delete o[s.id]),r.geometries--}var i={},o={};return{get:function(t,e){var o=i[e.id];return o||(e.addEventListener("dispose",n),e.isBufferGeometry?o=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new St).setFromObject(t)),o=e._bufferGeometry),i[e.id]=o,r.geometries++,o)},update:function(r){var n=r.index,i=r.attributes;null!==n&&e.update(n,t.ELEMENT_ARRAY_BUFFER);for(var o in i)e.update(i[o],t.ARRAY_BUFFER);r=r.morphAttributes;for(o in r)for(var n=r[o],i=0,s=n.length;i<s;i++)e.update(n[i],t.ARRAY_BUFFER)},getWireframeAttribute:function(r){if(n=o[r.id])return n;var n=[],i=r.index,s=r.attributes;if(null!==i)for(var i=i.array,s=0,a=i.length;s<a;s+=3){var c=i[s+0],u=i[s+1],h=i[s+2];n.push(c,u,u,h,h,c)}else for(i=s.position.array,s=0,a=i.length/3-1;s<a;s+=3)c=s+0,u=s+1,h=s+2,n.push(c,u,u,h,h,c);return n=new(65535<wt(n)?yt:vt)(n,1),e.update(n,t.ELEMENT_ARRAY_BUFFER),o[r.id]=n}}}function zt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new c,color:new $,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"SpotLight":n={position:new c,direction:new c,color:new $,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"PointLight":n={position:new c,color:new $,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"HemisphereLight":n={direction:new c,skyColor:new $,groundColor:new $};break;case"RectAreaLight":n={color:new $,position:new c,halfWidth:new c,halfHeight:new c}}return t[e.id]=n}}}function Gt(t,e,r){var n={};return{update:function(t){var i=r.frame,o=t.geometry,s=e.get(t,o);return n[s.id]!==i&&(o.isGeometry&&s.updateFromObject(t),e.update(s),n[s.id]=i),s},clear:function(){n={}}}}function $t(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}function Vt(t,e,r){var n=t.createShader(e);return t.shaderSource(n,r),t.compileShader(n),!1===t.getShaderParameter(n,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),$t(r)),n}function Ht(t){switch(t){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 ) )"];default:throw Error("unsupported encoding: "+t)}}function qt(t,e){var r=Ht(e);return"vec4 "+t+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function Wt(t,e){var r=Ht(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function Xt(t,e){var r;switch(e){case 1:r="Linear";break;case 2:r="Reinhard";break;case 3:r="Uncharted2";break;case 4:r="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}function Yt(t,e,r){return t=t||{},[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&r.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&r.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&r.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Zt).join("\n")}function Kt(t){var e,r=[];for(e in t){var n=t[e];!1!==n&&r.push("#define "+e+" "+n)}return r.join("\n")}function Zt(t){return""!==t}function Jt(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function Qt(t){return t.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,function(t,e){var r=Li[e];if(void 0===r)throw Error("Can not resolve #include <"+e+">");return Qt(r)})}function te(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,n){for(t="",e=parseInt(e);e<parseInt(r);e++)t+=n.replace(/\[ i \]/g,"[ "+e+" ]");return t})}function ee(t,e,r,n,i){var o=t.context,s=r.extensions,a=r.defines,c=n.vertexShader,u=n.fragmentShader,h="SHADOWMAP_TYPE_BASIC";1===i.shadowMapType?h="SHADOWMAP_TYPE_PCF":2===i.shadowMapType&&(h="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(r.envMap.mapping){case 301:case 302:l="ENVMAP_TYPE_CUBE";break;case 306:case 307:l="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:l="ENVMAP_TYPE_EQUIREC";break;case 305:l="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case 302:case 304:p="ENVMAP_MODE_REFRACTION"}switch(r.combine){case 0:f="ENVMAP_BLENDING_MULTIPLY";break;case 1:f="ENVMAP_BLENDING_MIX";break;case 2:f="ENVMAP_BLENDING_ADD"}}var d=0<t.gammaFactor?t.gammaFactor:1,s=Yt(s,i,t.extensions),m=Kt(a),v=o.createProgram();r.isRawShaderMaterial?(a=[m,"\n"].filter(Zt).join("\n"),n=[s,m,"\n"].filter(Zt).join("\n")):(a=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.name,m,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(Zt).join("\n"),n=[s,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.name,m,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+d,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+l:"",i.envMap?"#define "+p:"",i.envMap?"#define "+f:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Li.tonemapping_pars_fragment:"",0!==i.toneMapping?Xt("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?Li.encodings_pars_fragment:"",i.mapEncoding?qt("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?qt("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?qt("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?Wt("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(Zt).join("\n")),c=Jt(c=Qt(c),i),u=Jt(u=Qt(u),i),r.isShaderMaterial||(c=te(c),u=te(u)),u=n+u,c=Vt(o,o.VERTEX_SHADER,a+c),u=Vt(o,o.FRAGMENT_SHADER,u),o.attachShader(v,c),o.attachShader(v,u),void 0!==r.index0AttributeName?o.bindAttribLocation(v,0,r.index0AttributeName):!0===i.morphTargets&&o.bindAttribLocation(v,0,"position"),o.linkProgram(v),i=o.getProgramInfoLog(v),h=o.getShaderInfoLog(c),l=o.getShaderInfoLog(u),f=p=!0,!1===o.getProgramParameter(v,o.LINK_STATUS)?(p=!1,console.error("THREE.WebGLProgram: shader error: ",o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(v,o.VALIDATE_STATUS),"gl.getProgramInfoLog",i,h,l)):""!==i?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",i):""!==h&&""!==l||(f=!1),f&&(this.diagnostics={runnable:p,material:r,programLog:i,vertexShader:{log:h,prefix:a},fragmentShader:{log:l,prefix:n}}),o.deleteShader(c),o.deleteShader(u);var g;this.getUniforms=function(){return void 0===g&&(g=new G(o,v,t)),g};var y;return this.getAttributes=function(){if(void 0===y){for(var t={},e=o.getProgramParameter(v,o.ACTIVE_ATTRIBUTES),r=0;r<e;r++){var n=o.getActiveAttrib(v,r).name;t[n]=o.getAttribLocation(v,n)}y=t}return y},this.destroy=function(){o.deleteProgram(v),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Fi++,this.code=e,this.usedTimes=1,this.program=v,this.vertexShader=c,this.fragmentShader=u,this}function re(t,e){function r(t,e){var r;return t?t.isTexture?r=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),r=t.texture.encoding):r=3e3,3e3===r&&e&&(r=3007),r}var n=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},o="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering".split(" ");this.getParameters=function(n,o,s,a,c,u){var h,l=i[n.type];if(u.isSkinnedMesh)if(h=u.skeleton.bones,e.floatVertexTextures)h=1024;else{var p=Math.min(Math.floor((e.maxVertexUniforms-20)/4),h.length);p<h.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+h.length+" bones. This GPU supports "+p+"."),h=0):h=p}else h=0;p=t.getPrecision(),null!==n.precision&&(p=e.getMaxPrecision(n.precision))!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",p,"instead.");var f=t.getRenderTarget();return{shaderID:l,precision:p,supportsVertexTextures:e.vertexTextures,outputEncoding:r(f?f.texture:null,t.gammaOutput),map:!!n.map,mapEncoding:r(n.map,t.gammaInput),envMap:!!n.envMap,envMapMode:n.envMap&&n.envMap.mapping,envMapEncoding:r(n.envMap,t.gammaInput),envMapCubeUV:!!n.envMap&&(306===n.envMap.mapping||307===n.envMap.mapping),lightMap:!!n.lightMap,aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:r(n.emissiveMap,t.gammaInput),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,combine:n.combine,vertexColors:n.vertexColors,fog:!!s,useFog:n.fog,fogExp:s&&s.isFogExp2,flatShading:1===n.shading,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:n.skinning&&0<h,maxBones:h,useVertexTexture:e.floatVertexTextures,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numClippingPlanes:a,numClipIntersection:c,dithering:n.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.receiveShadow&&0<o.shadows.length,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:2===n.side,flipSided:1===n.side,depthPacking:void 0!==n.depthPacking&&n.depthPacking}},this.getProgramCode=function(e,r){var n=[];if(r.shaderID?n.push(r.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)n.push(i),n.push(e.defines[i]);for(i=0;i<o.length;i++)n.push(r[o[i]]);return n.push(e.onBeforeCompile.toString()),n.push(t.gammaOutput),n.join()},this.acquireProgram=function(e,r,i,o){for(var s,a=0,c=n.length;a<c;a++){var u=n[a];if(u.code===o){++(s=u).usedTimes;break}}return void 0===s&&(s=new ee(t,o,e,r,i),n.push(s)),s},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=n.indexOf(t);n[e]=n[n.length-1],n.pop(),t.destroy()}},this.programs=n}function ne(t,e,r,n,i,o,s){function a(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return n.width=Math.floor(t.width*r),n.height=Math.floor(t.height*r),n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return xi.isPowerOfTwo(t.width)&&xi.isPowerOfTwo(t.height)}function u(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function h(e){return 1003===e||1004===e||1005===e?t.NEAREST:t.LINEAR}function l(e){(e=e.target).removeEventListener("dispose",l);t:{var r=n.get(e);if(e.image&&r.__image__webglTextureCube)t.deleteTexture(r.__image__webglTextureCube);else{if(void 0===r.__webglInit)break t;t.deleteTexture(r.__webglTexture)}n.remove(e)}s.textures--}function p(e){(e=e.target).removeEventListener("dispose",p);var r=n.get(e),i=n.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(i=0;6>i;i++)t.deleteFramebuffer(r.__webglFramebuffer[i]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[i]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}s.textures--}function f(e,h){var p=n.get(e);if(0<e.version&&p.__version!==e.version)if(void 0===(m=e.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==m.complete){void 0===p.__webglInit&&(p.__webglInit=!0,e.addEventListener("dispose",l),p.__webglTexture=t.createTexture(),s.textures++),r.activeTexture(t.TEXTURE0+h),r.bindTexture(t.TEXTURE_2D,p.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,e.unpackAlignment);var f=a(e.image,i.maxTextureSize);(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)&&!1===c(f)&&((m=f)instanceof HTMLImageElement||m instanceof HTMLCanvasElement?((v=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=xi.nearestPowerOfTwo(m.width),v.height=xi.nearestPowerOfTwo(m.height),v.getContext("2d").drawImage(m,0,0,v.width,v.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+m.width+"x"+m.height+"). Resized to "+v.width+"x"+v.height,m),f=v):f=m);var m=c(f),v=o(e.format),y=o(e.type);d(t.TEXTURE_2D,e,m);var b=e.mipmaps;if(e.isDepthTexture){if(b=t.DEPTH_COMPONENT,1015===e.type){if(!g)throw Error("Float Depth Texture only supported in WebGL2.0");b=t.DEPTH_COMPONENT32F}else g&&(b=t.DEPTH_COMPONENT16);1026===e.format&&b===t.DEPTH_COMPONENT&&1012!==e.type&&1014!==e.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),e.type=1012,y=o(e.type)),1027===e.format&&(b=t.DEPTH_STENCIL,1020!==e.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),e.type=1020,y=o(e.type))),r.texImage2D(t.TEXTURE_2D,0,b,f.width,f.height,0,v,y,null)}else if(e.isDataTexture)if(0<b.length&&m){for(var _=0,x=b.length;_<x;_++)f=b[_],r.texImage2D(t.TEXTURE_2D,_,v,f.width,f.height,0,v,y,f.data);e.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,v,f.width,f.height,0,v,y,f.data);else if(e.isCompressedTexture)for(_=0,x=b.length;_<x;_++)f=b[_],1023!==e.format&&1022!==e.format?-1<r.getCompressedTextureFormats().indexOf(v)?r.compressedTexImage2D(t.TEXTURE_2D,_,v,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.texImage2D(t.TEXTURE_2D,_,v,f.width,f.height,0,v,y,f.data);else if(0<b.length&&m){for(_=0,x=b.length;_<x;_++)f=b[_],r.texImage2D(t.TEXTURE_2D,_,v,v,y,f);e.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,v,v,y,f);return u(e,m)&&t.generateMipmap(t.TEXTURE_2D),p.__version=e.version,void(e.onUpdate&&e.onUpdate(e))}console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}r.activeTexture(t.TEXTURE0+h),r.bindTexture(t.TEXTURE_2D,p.__webglTexture)}function d(r,s,a){a?(t.texParameteri(r,t.TEXTURE_WRAP_S,o(s.wrapS)),t.texParameteri(r,t.TEXTURE_WRAP_T,o(s.wrapT)),t.texParameteri(r,t.TEXTURE_MAG_FILTER,o(s.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,o(s.minFilter))):(t.texParameteri(r,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(r,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),1001===s.wrapS&&1001===s.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",s),t.texParameteri(r,t.TEXTURE_MAG_FILTER,h(s.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,h(s.minFilter)),1003!==s.minFilter&&1006!==s.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",s)),!(a=e.get("EXT_texture_filter_anisotropic"))||1015===s.type&&null===e.get("OES_texture_float_linear")||1016===s.type&&null===e.get("OES_texture_half_float_linear")||!(1<s.anisotropy||n.get(s).__currentAnisotropy)||(t.texParameterf(r,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy)}function m(e,i,s,a){var c=o(i.texture.format),u=o(i.texture.type);r.texImage2D(a,0,c,i.width,i.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,s,a,n.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function v(e,r){t.bindRenderbuffer(t.RENDERBUFFER,e),r.depthBuffer&&!r.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,r.width,r.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):r.depthBuffer&&r.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,r.width,r.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,r.width,r.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}var g="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=f,this.setTextureCube=function(e,h){var p=n.get(e);if(6===e.image.length)if(0<e.version&&p.__version!==e.version){p.__image__webglTextureCube||(e.addEventListener("dispose",l),p.__image__webglTextureCube=t.createTexture(),s.textures++),r.activeTexture(t.TEXTURE0+h),r.bindTexture(t.TEXTURE_CUBE_MAP,p.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var f=e&&e.isCompressedTexture,m=e.image[0]&&e.image[0].isDataTexture,v=[],g=0;6>g;g++)v[g]=f||m?m?e.image[g].image:e.image[g]:a(e.image[g],i.maxCubemapSize);var y=c(v[0]),b=o(e.format),_=o(e.type);for(d(t.TEXTURE_CUBE_MAP,e,y),g=0;6>g;g++)if(f)for(var x,w=v[g].mipmaps,S=0,M=w.length;S<M;S++)x=w[S],1023!==e.format&&1022!==e.format?-1<r.getCompressedTextureFormats().indexOf(b)?r.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,S,b,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,S,b,x.width,x.height,0,b,_,x.data);else m?r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,b,v[g].width,v[g].height,0,b,_,v[g].data):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,b,b,_,v[g]);u(e,y)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),p.__version=e.version,e.onUpdate&&e.onUpdate(e)}else r.activeTexture(t.TEXTURE0+h),r.bindTexture(t.TEXTURE_CUBE_MAP,p.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,i){r.activeTexture(t.TEXTURE0+i),r.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)},this.setupRenderTarget=function(e){var i=n.get(e),o=n.get(e.texture);e.addEventListener("dispose",p),o.__webglTexture=t.createTexture(),s.textures++;var a=!0===e.isWebGLRenderTargetCube,h=c(e);if(a){i.__webglFramebuffer=[];for(var l=0;6>l;l++)i.__webglFramebuffer[l]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(a){for(r.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),d(t.TEXTURE_CUBE_MAP,e.texture,h),l=0;6>l;l++)m(i.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);u(e.texture,h)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),r.bindTexture(t.TEXTURE_CUBE_MAP,null)}else r.bindTexture(t.TEXTURE_2D,o.__webglTexture),d(t.TEXTURE_2D,e.texture,h),m(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),u(e.texture,h)&&t.generateMipmap(t.TEXTURE_2D),r.bindTexture(t.TEXTURE_2D,null);if(e.depthBuffer){if(i=n.get(e),o=!0===e.isWebGLRenderTargetCube,e.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");if(e&&e.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(n.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),f(e.depthTexture,0),i=n.get(e.depthTexture).__webglTexture,1026===e.depthTexture.format)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(1027!==e.depthTexture.format)throw Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}else if(o)for(i.__webglDepthbuffer=[],o=0;6>o;o++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),v(i.__webglDepthbuffer[o],e);else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),v(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var i=e.texture;u(i,c(e))&&(e=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,i=n.get(i).__webglTexture,r.bindTexture(e,i),t.generateMipmap(e),r.bindTexture(e,null))}}function ie(){var t={};return{get:function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},remove:function(e){delete t[e.uuid]},clear:function(){t={}}}}function oe(t,e,r){function n(e,r,n){var i=new Uint8Array(4),o=t.createTexture();for(t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST),e=0;e<n;e++)t.texImage2D(r+e,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i);return o}function o(e){!0!==b[e]&&(t.enable(e),b[e]=!0)}function s(e){!1!==b[e]&&(t.disable(e),b[e]=!1)}function a(e,n,i,a,c,u,h,l){0!==e?o(t.BLEND):s(t.BLEND),5===e||e===x&&l===O||(2===e?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):3===e?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):4===e?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),x=e,O=l),5===e?(c=c||n,u=u||i,h=h||a,n===w&&c===E||(t.blendEquationSeparate(r(n),r(c)),w=n,E=c),i===S&&a===M&&u===T&&h===C||(t.blendFuncSeparate(r(i),r(a),r(u),r(h)),S=i,M=a,T=u,C=h)):C=T=E=M=S=w=null}function c(e){P!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),P=e)}function u(e){0!==e?(o(t.CULL_FACE),e!==A&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):s(t.CULL_FACE),A=e}function h(e,r,n){e?(o(t.POLYGON_OFFSET_FILL),(R!==r||L!==n)&&(t.polygonOffset(r,n),R=r,L=n)):s(t.POLYGON_OFFSET_FILL)}function l(e){void 0===e&&(e=t.TEXTURE0+I-1),k!==e&&(t.activeTexture(e),k=e)}var p=new function(){var e=!1,r=new i,n=null,o=new i;return{setMask:function(r){n===r||e||(t.colorMask(r,r,r,r),n=r)},setLocked:function(t){e=t},setClear:function(e,n,i,s,a){!0===a&&(e*=s,n*=s,i*=s),r.set(e,n,i,s),!1===o.equals(r)&&(t.clearColor(e,n,i,s),o.copy(r))},reset:function(){e=!1,n=null,o.set(0,0,0,1)}}},f=new function(){var e=!1,r=null,n=null,i=null;return{setTest:function(e){e?o(t.DEPTH_TEST):s(t.DEPTH_TEST)},setMask:function(n){r===n||e||(t.depthMask(n),r=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);n=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,i=n=r=null}}},d=new function(){var e=!1,r=null,n=null,i=null,a=null,c=null,u=null,h=null,l=null;return{setTest:function(e){e?o(t.STENCIL_TEST):s(t.STENCIL_TEST)},setMask:function(n){r===n||e||(t.stencilMask(n),r=n)},setFunc:function(e,r,o){n===e&&i===r&&a===o||(t.stencilFunc(e,r,o),n=e,i=r,a=o)},setOp:function(e,r,n){c===e&&u===r&&h===n||(t.stencilOp(e,r,n),c=e,u=r,h=n)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,l=h=u=c=a=i=n=r=null}}},m=t.getParameter(t.MAX_VERTEX_ATTRIBS),v=new Uint8Array(m),g=new Uint8Array(m),y=new Uint8Array(m),b={},_=null,x=null,w=null,S=null,M=null,E=null,T=null,C=null,O=!1,P=null,A=null,j=null,R=null,L=null,N=null,I=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),m=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),D=1<=parseFloat(m),k=null,F={},B=new i,U=new i,z={};return z[t.TEXTURE_2D]=n(t.TEXTURE_2D,t.TEXTURE_2D,1),z[t.TEXTURE_CUBE_MAP]=n(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:p,depth:f,stencil:d},init:function(){p.setClear(0,0,0,1),f.setClear(1),d.setClear(0),o(t.DEPTH_TEST),f.setFunc(3),c(!1),u(1),o(t.CULL_FACE),o(t.BLEND),a(1)},initAttributes:function(){for(var t=0,e=v.length;t<e;t++)v[t]=0},enableAttribute:function(r){v[r]=1,0===g[r]&&(t.enableVertexAttribArray(r),g[r]=1),0!==y[r]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),y[r]=0)},enableAttributeAndDivisor:function(r,n){v[r]=1,0===g[r]&&(t.enableVertexAttribArray(r),g[r]=1),y[r]!==n&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,n),y[r]=n)},disableUnusedAttributes:function(){for(var e=0,r=g.length;e!==r;++e)g[e]!==v[e]&&(t.disableVertexAttribArray(e),g[e]=0)},enable:o,disable:s,getCompressedTextureFormats:function(){if(null===_&&(_=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var r=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),n=0;n<r.length;n++)_.push(r[n]);return _},setBlending:a,setMaterial:function(e){2===e.side?s(t.CULL_FACE):o(t.CULL_FACE),c(1===e.side),!0===e.transparent?a(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):a(0),f.setFunc(e.depthFunc),f.setTest(e.depthTest),f.setMask(e.depthWrite),p.setMask(e.colorWrite),h(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:c,setCullFace:u,setLineWidth:function(e){e!==j&&(D&&t.lineWidth(e),j=e)},setPolygonOffset:h,getScissorTest:function(){return N},setScissorTest:function(e){(N=e)?o(t.SCISSOR_TEST):s(t.SCISSOR_TEST)},activeTexture:l,bindTexture:function(e,r){null===k&&l();var n=F[k];void 0===n&&(n={type:void 0,texture:void 0},F[k]=n),n.type===e&&n.texture===r||(t.bindTexture(e,r||z[e]),n.type=e,n.texture=r)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===B.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),B.copy(e))},viewport:function(e){!1===U.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),U.copy(e))},reset:function(){for(var e=0;e<g.length;e++)1===g[e]&&(t.disableVertexAttribArray(e),g[e]=0);b={},k=_=null,F={},A=P=x=null,p.reset(),f.reset(),d.reset()}}}function se(t,e,r){function n(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}var i,o=void 0!==r.precision?r.precision:"highp";(s=n(o))!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s),r=!0===r.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth");var s=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),a=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=t.getParameter(t.MAX_TEXTURE_SIZE),u=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),h=t.getParameter(t.MAX_VERTEX_ATTRIBS),l=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),p=t.getParameter(t.MAX_VARYING_VECTORS),f=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),d=0<a,m=!!e.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var r=e.get("EXT_texture_filter_anisotropic");return i=null!==r?t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:o,logarithmicDepthBuffer:r,maxTextures:s,maxVertexTextures:a,maxTextureSize:c,maxCubemapSize:u,maxAttributes:h,maxVertexUniforms:l,maxVaryings:p,maxFragmentUniforms:f,vertexTextures:d,floatFragmentTextures:m,floatVertexTextures:d&&m}}function ae(t){ct.call(this),this.cameras=t||[]}function ce(t){var e=this,r=null,n=null;"VRFrameData"in window&&(n=new window.VRFrameData);var o=new u,s=new u,a=new u,c=new ct;c.bounds=new i(0,0,.5,1),c.layers.enable(1);var h=new ct;h.bounds=new i(.5,0,.5,1),h.layers.enable(2);var l=new ae([c,h]);l.layers.enable(1),l.layers.enable(2);var p,f;window.addEventListener("vrdisplaypresentchange",function(){if(r.isPresenting){var n=(i=r.getEyeParameters("left")).renderWidth,i=i.renderHeight;f=t.getPixelRatio(),p=t.getSize(),t.setDrawingBufferSize(2*n,i,1)}else e.enabled&&t.setDrawingBufferSize(p.width,p.height,f)},!1),this.standing=this.enabled=!1,this.getDevice=function(){return r},this.setDevice=function(t){void 0!==t&&(r=t)},this.getCamera=function(t){if(null===r)return t;r.depthNear=t.near,r.depthFar=t.far,r.getFrameData(n);var e=n.pose;return null!==e.position?t.position.fromArray(e.position):t.position.set(0,0,0),null!==e.orientation&&t.quaternion.fromArray(e.orientation),t.updateMatrixWorld(),e=r.stageParameters,this.standing&&e&&(s.fromArray(e.sittingToStandingTransform),a.getInverse(s),t.matrixWorld.multiply(s),t.matrixWorldInverse.multiply(a)),!1===r.isPresenting?t:(l.matrixWorld.copy(t.matrixWorld),l.matrixWorldInverse.copy(t.matrixWorldInverse),c.matrixWorldInverse.fromArray(n.leftViewMatrix),h.matrixWorldInverse.fromArray(n.rightViewMatrix),this.standing&&e&&(c.matrixWorldInverse.multiply(a),h.matrixWorldInverse.multiply(a)),null!==(t=t.parent)&&(o.getInverse(t.matrixWorld),c.matrixWorldInverse.multiply(o),h.matrixWorldInverse.multiply(o)),c.matrixWorld.getInverse(c.matrixWorldInverse),h.matrixWorld.getInverse(h.matrixWorldInverse),c.projectionMatrix.fromArray(n.leftProjectionMatrix),h.projectionMatrix.fromArray(n.rightProjectionMatrix),l.projectionMatrix.copy(c.projectionMatrix),(t=r.getLayers()).length&&(null!==(t=t[0]).leftBounds&&4===t.leftBounds.length&&c.bounds.fromArray(t.leftBounds),null!==t.rightBounds&&4===t.rightBounds.length&&h.bounds.fromArray(t.rightBounds)),l)},this.getStandingMatrix=function(){return s},this.submitFrame=function(){r&&r.isPresenting&&r.submitFrame()}}function ue(t){var e={};return{get:function(r){if(void 0!==e[r])return e[r];var n;switch(r){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(r)}return null===n&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),e[r]=n}}}function he(){function t(){u.value!==n&&(u.value=n,u.needsUpdate=0<i),r.numPlanes=i,r.numIntersection=0}function e(t,e,n,i){var o=null!==t?t.length:0,s=null;if(0!==o){if(s=u.value,!0!==i||null===s)for(i=n+4*o,e=e.matrixWorldInverse,c.getNormalMatrix(e),(null===s||s.length<i)&&(s=new Float32Array(i)),i=0;i!==o;++i,n+=4)a.copy(t[i]).applyMatrix4(e,c),a.normal.toArray(s,n),s[n+3]=a.constant;u.value=s,u.needsUpdate=!0}return r.numPlanes=o,s}var r=this,n=null,i=0,o=!1,s=!1,a=new Q,c=new J,u={value:null,needsUpdate:!1};this.uniform=u,this.numIntersection=this.numPlanes=0,this.init=function(t,r,s){var a=0!==t.length||r||0!==i||o;return o=r,n=e(t,s,0),i=t.length,a},this.beginShadows=function(){s=!0,e(null)},this.endShadows=function(){s=!1,t()},this.setState=function(r,a,c,h,l,p){if(!o||null===r||0===r.length||s&&!c)s?e(null):t();else{var f=4*(c=s?0:i),d=l.clippingState||null;for(u.value=d,d=e(r,h,f,p),r=0;r!==f;++r)d[r]=n[r];l.clippingState=d,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=c}}}function le(t){function e(){yt.init(),yt.scissor($.copy(J).multiplyScalar(Z)),yt.viewport(W.copy(nt).multiplyScalar(Z))}function r(){U=I=null,B="",F=-1,yt.reset()}function n(t){t.preventDefault(),r(),e(),bt.clear(),Mt.clear()}function o(t){(t=t.target).removeEventListener("dispose",o),s(t),bt.remove(t)}function s(t){var e=bt.get(t).program;t.program=void 0,void 0!==e&&Et.releaseProgram(e)}function a(t,e,r){t.render(function(t){N.renderBufferImmediate(t,e,r)})}function l(t,e){return Math.abs(e[0])-Math.abs(t[0])}function p(t,e,r){if(t.visible){if(t.layers.test(e.layers))if(t.isLight)P.push(t);else if(t.isSprite)t.frustumCulled&&!it.intersectsSprite(t)||R.push(t);else if(t.isLensFlare)L.push(t);else if(t.isImmediateRenderObject)r&&ut.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ct),A.push(t,null,t.material,ut.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||it.intersectsObject(t))){r&&ut.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ct);var n=Mt.update(t),i=t.material;if(Array.isArray(i))for(var o=n.groups,s=0,a=o.length;s<a;s++){var c=o[s],u=i[c.materialIndex];u&&u.visible&&A.push(t,n,u,ut.z,c)}else i.visible&&A.push(t,n,i,ut.z,null)}for(s=0,a=(t=t.children).length;s<a;s++)p(t[s],e,r)}}function f(t,e,r,n){for(var i=0,o=t.length;i<o;i++){var s=(u=t[i]).object,a=u.geometry,c=void 0===n?u.material:n,u=u.group;if(r.isArrayCamera){z=r;for(var h=r.cameras,l=0,p=h.length;l<p;l++){var f=h[l];if(s.layers.test(f.layers)){var m=(y=f.bounds).x*Y,v=y.y*K,g=y.z*Y,y=y.w*K;N.setViewport(m,v,g,y),N.setScissor(m,v,g,y),N.setScissorTest(!0),d(s,e,f,a,c,u)}}}else z=null,d(s,e,r,a,c,u)}}function d(t,e,r,n,i,o){if(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.onBeforeRender(N,e,r,n,i,o),t.isImmediateRenderObject){yt.setMaterial(i);var s=v(r,e.fog,i,t);B="",a(t,s,i)}else N.renderBufferDirect(r,e.fog,n,i,t,o);t.onAfterRender(N,e,r,n,i,o)}function m(t,e,r){var n=bt.get(t);r=Et.getParameters(t,pt,e,ot.numPlanes,ot.numIntersection,r);var i=Et.getProgramCode(t,r),a=n.program,c=!0;if(void 0===a)t.addEventListener("dispose",o);else if(a.code!==i)s(t);else{if(void 0!==r.shaderID)return;c=!1}if(c&&(r.shaderID?(a=Ni[r.shaderID],n.shader={name:t.type,uniforms:Ri.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}):n.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader},t.onBeforeCompile(n.shader),a=Et.acquireProgram(t,n.shader,r,i),n.program=a,t.program=a),r=a.getAttributes(),t.morphTargets)for(i=t.numSupportedMorphTargets=0;i<N.maxMorphTargets;i++)0<=r["morphTarget"+i]&&t.numSupportedMorphTargets++;if(t.morphNormals)for(i=t.numSupportedMorphNormals=0;i<N.maxMorphNormals;i++)0<=r["morphNormal"+i]&&t.numSupportedMorphNormals++;r=n.shader.uniforms,(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=ot.numPlanes,n.numIntersection=ot.numIntersection,r.clippingPlanes=ot.uniform),n.fog=e,n.lightsHash=pt.hash,t.lights&&(r.ambientLightColor.value=pt.ambient,r.directionalLights.value=pt.directional,r.spotLights.value=pt.spot,r.rectAreaLights.value=pt.rectArea,r.pointLights.value=pt.point,r.hemisphereLights.value=pt.hemi,r.directionalShadowMap.value=pt.directionalShadowMap,r.directionalShadowMatrix.value=pt.directionalShadowMatrix,r.spotShadowMap.value=pt.spotShadowMap,r.spotShadowMatrix.value=pt.spotShadowMatrix,r.pointShadowMap.value=pt.pointShadowMap,r.pointShadowMatrix.value=pt.pointShadowMatrix),t=n.program.getUniforms(),t=G.seqWithValue(t.seq,r),n.uniformsList=t}function v(t,e,r,n){X=0;var i=bt.get(r);st&&(at||t!==U)&&ot.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,t,i,t===U&&r.id===F),!1===r.needsUpdate&&(void 0===i.program?r.needsUpdate=!0:r.fog&&i.fog!==e?r.needsUpdate=!0:r.lights&&i.lightsHash!==pt.hash?r.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===ot.numPlanes&&i.numIntersection===ot.numIntersection||(r.needsUpdate=!0)),r.needsUpdate&&(m(r,e,n),r.needsUpdate=!1);var o=!1,s=!1,a=!1,c=i.program,u=c.getUniforms(),l=i.shader.uniforms;if(c.id!==I&&(mt.useProgram(c.program),I=c.id,a=s=o=!0),r.id!==F&&(F=r.id,s=!0),(o||t!==U)&&(u.setValue(mt,"projectionMatrix",t.projectionMatrix),gt.logarithmicDepthBuffer&&u.setValue(mt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),U!==(z||t)&&(U=z||t,a=s=!0),(r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.envMap)&&void 0!==(o=u.map.cameraPosition)&&o.setValue(mt,ut.setFromMatrixPosition(t.matrixWorld)),(r.isMeshPhongMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&u.setValue(mt,"viewMatrix",t.matrixWorldInverse)),r.skinning&&(u.setOptional(mt,n,"bindMatrix"),u.setOptional(mt,n,"bindMatrixInverse"),t=n.skeleton))if(o=t.bones,gt.floatVertexTextures){if(void 0===t.boneTexture){var o=Math.sqrt(4*o.length),o=xi.nextPowerOfTwo(Math.ceil(o)),o=Math.max(o,4),p=new Float32Array(o*o*4);p.set(t.boneMatrices);var f=new h(p,o,o,1023,1015);t.boneMatrices=p,t.boneTexture=f,t.boneTextureSize=o}u.setValue(mt,"boneTexture",t.boneTexture),u.setValue(mt,"boneTextureSize",t.boneTextureSize)}else u.setOptional(mt,t,"boneMatrices");if(s){if(u.setValue(mt,"toneMappingExposure",N.toneMappingExposure),u.setValue(mt,"toneMappingWhitePoint",N.toneMappingWhitePoint),r.lights&&(s=a,l.ambientLightColor.needsUpdate=s,l.directionalLights.needsUpdate=s,l.pointLights.needsUpdate=s,l.spotLights.needsUpdate=s,l.rectAreaLights.needsUpdate=s,l.hemisphereLights.needsUpdate=s),e&&r.fog&&(l.fogColor.value=e.color,e.isFog?(l.fogNear.value=e.near,l.fogFar.value=e.far):e.isFogExp2&&(l.fogDensity.value=e.density)),r.isMeshBasicMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshNormalMaterial||r.isMeshDepthMaterial){l.opacity.value=r.opacity,l.diffuse.value=r.color,r.emissive&&l.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),l.map.value=r.map,l.specularMap.value=r.specularMap,l.alphaMap.value=r.alphaMap,r.lightMap&&(l.lightMap.value=r.lightMap,l.lightMapIntensity.value=r.lightMapIntensity),r.aoMap&&(l.aoMap.value=r.aoMap,l.aoMapIntensity.value=r.aoMapIntensity);var d;r.map?d=r.map:r.specularMap?d=r.specularMap:r.displacementMap?d=r.displacementMap:r.normalMap?d=r.normalMap:r.bumpMap?d=r.bumpMap:r.roughnessMap?d=r.roughnessMap:r.metalnessMap?d=r.metalnessMap:r.alphaMap?d=r.alphaMap:r.emissiveMap&&(d=r.emissiveMap),void 0!==d&&(d.isWebGLRenderTarget&&(d=d.texture),e=d.offset,d=d.repeat,l.offsetRepeat.value.set(e.x,e.y,d.x,d.y)),l.envMap.value=r.envMap,l.flipEnvMap.value=r.envMap&&r.envMap.isCubeTexture?-1:1,l.reflectivity.value=r.reflectivity,l.refractionRatio.value=r.refractionRatio}r.isLineBasicMaterial?(l.diffuse.value=r.color,l.opacity.value=r.opacity):r.isLineDashedMaterial?(l.diffuse.value=r.color,l.opacity.value=r.opacity,l.dashSize.value=r.dashSize,l.totalSize.value=r.dashSize+r.gapSize,l.scale.value=r.scale):r.isPointsMaterial?(l.diffuse.value=r.color,l.opacity.value=r.opacity,l.size.value=r.size*Z,l.scale.value=.5*K,l.map.value=r.map,null!==r.map&&(d=r.map.offset,r=r.map.repeat,l.offsetRepeat.value.set(d.x,d.y,r.x,r.y))):r.isMeshLambertMaterial?r.emissiveMap&&(l.emissiveMap.value=r.emissiveMap):r.isMeshToonMaterial?(g(l,r),r.gradientMap&&(l.gradientMap.value=r.gradientMap)):r.isMeshPhongMaterial?g(l,r):r.isMeshPhysicalMaterial?(l.clearCoat.value=r.clearCoat,l.clearCoatRoughness.value=r.clearCoatRoughness,y(l,r)):r.isMeshStandardMaterial?y(l,r):r.isMeshDepthMaterial?r.displacementMap&&(l.displacementMap.value=r.displacementMap,l.displacementScale.value=r.displacementScale,l.displacementBias.value=r.displacementBias):r.isMeshNormalMaterial&&(r.bumpMap&&(l.bumpMap.value=r.bumpMap,l.bumpScale.value=r.bumpScale),r.normalMap&&(l.normalMap.value=r.normalMap,l.normalScale.value.copy(r.normalScale)),r.displacementMap&&(l.displacementMap.value=r.displacementMap,l.displacementScale.value=r.displacementScale,l.displacementBias.value=r.displacementBias)),void 0!==l.ltcMat&&(l.ltcMat.value=ji.LTC_MAT_TEXTURE),void 0!==l.ltcMag&&(l.ltcMag.value=ji.LTC_MAG_TEXTURE),G.upload(mt,i.uniformsList,l,N)}return u.setValue(mt,"modelViewMatrix",n.modelViewMatrix),u.setValue(mt,"normalMatrix",n.normalMatrix),u.setValue(mt,"modelMatrix",n.matrixWorld),c}function g(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function y(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function b(t,e){var r,n,i,o,s,a,c,u=0,h=0,l=0,p=e.matrixWorldInverse,f=0,d=0,m=0,v=0,g=0;for(r=0,n=t.length;r<n;r++)if(i=t[r],o=i.color,s=i.intensity,a=i.distance,c=i.shadow&&i.shadow.map?i.shadow.map.texture:null,i.isAmbientLight)u+=o.r*s,h+=o.g*s,l+=o.b*s;else if(i.isDirectionalLight){var y=Tt.get(i);y.color.copy(i.color).multiplyScalar(i.intensity),y.direction.setFromMatrixPosition(i.matrixWorld),ut.setFromMatrixPosition(i.target.matrixWorld),y.direction.sub(ut),y.direction.transformDirection(p),(y.shadow=i.castShadow)&&(o=i.shadow,y.shadowBias=o.bias,y.shadowRadius=o.radius,y.shadowMapSize=o.mapSize),pt.directionalShadowMap[f]=c,pt.directionalShadowMatrix[f]=i.shadow.matrix,pt.directional[f]=y,f++}else i.isSpotLight?((y=Tt.get(i)).position.setFromMatrixPosition(i.matrixWorld),y.position.applyMatrix4(p),y.color.copy(o).multiplyScalar(s),y.distance=a,y.direction.setFromMatrixPosition(i.matrixWorld),ut.setFromMatrixPosition(i.target.matrixWorld),y.direction.sub(ut),y.direction.transformDirection(p),y.coneCos=Math.cos(i.angle),y.penumbraCos=Math.cos(i.angle*(1-i.penumbra)),y.decay=0===i.distance?0:i.decay,(y.shadow=i.castShadow)&&(o=i.shadow,y.shadowBias=o.bias,y.shadowRadius=o.radius,y.shadowMapSize=o.mapSize),pt.spotShadowMap[m]=c,pt.spotShadowMatrix[m]=i.shadow.matrix,pt.spot[m]=y,m++):i.isRectAreaLight?((y=Tt.get(i)).color.copy(o).multiplyScalar(s/(i.width*i.height)),y.position.setFromMatrixPosition(i.matrixWorld),y.position.applyMatrix4(p),lt.identity(),ht.copy(i.matrixWorld),ht.premultiply(p),lt.extractRotation(ht),y.halfWidth.set(.5*i.width,0,0),y.halfHeight.set(0,.5*i.height,0),y.halfWidth.applyMatrix4(lt),y.halfHeight.applyMatrix4(lt),pt.rectArea[v]=y,v++):i.isPointLight?((y=Tt.get(i)).position.setFromMatrixPosition(i.matrixWorld),y.position.applyMatrix4(p),y.color.copy(i.color).multiplyScalar(i.intensity),y.distance=i.distance,y.decay=0===i.distance?0:i.decay,(y.shadow=i.castShadow)&&(o=i.shadow,y.shadowBias=o.bias,y.shadowRadius=o.radius,y.shadowMapSize=o.mapSize),pt.pointShadowMap[d]=c,pt.pointShadowMatrix[d]=i.shadow.matrix,pt.point[d]=y,d++):i.isHemisphereLight&&((y=Tt.get(i)).direction.setFromMatrixPosition(i.matrixWorld),y.direction.transformDirection(p),y.direction.normalize(),y.skyColor.copy(i.color).multiplyScalar(s),y.groundColor.copy(i.groundColor).multiplyScalar(s),pt.hemi[g]=y,g++);pt.ambient[0]=u,pt.ambient[1]=h,pt.ambient[2]=l,pt.directional.length=f,pt.spot.length=m,pt.rectArea.length=v,pt.point.length=d,pt.hemi.length=g,pt.hash=f+","+d+","+m+","+v+","+g+","+pt.shadows.length}function _(t){var e;if(1e3===t)return mt.REPEAT;if(1001===t)return mt.CLAMP_TO_EDGE;if(1002===t)return mt.MIRRORED_REPEAT;if(1003===t)return mt.NEAREST;if(1004===t)return mt.NEAREST_MIPMAP_NEAREST;if(1005===t)return mt.NEAREST_MIPMAP_LINEAR;if(1006===t)return mt.LINEAR;if(1007===t)return mt.LINEAR_MIPMAP_NEAREST;if(1008===t)return mt.LINEAR_MIPMAP_LINEAR;if(1009===t)return mt.UNSIGNED_BYTE;if(1017===t)return mt.UNSIGNED_SHORT_4_4_4_4;if(1018===t)return mt.UNSIGNED_SHORT_5_5_5_1;if(1019===t)return mt.UNSIGNED_SHORT_5_6_5;if(1010===t)return mt.BYTE;if(1011===t)return mt.SHORT;if(1012===t)return mt.UNSIGNED_SHORT;if(1013===t)return mt.INT;if(1014===t)return mt.UNSIGNED_INT;if(1015===t)return mt.FLOAT;if(1016===t&&null!==(e=vt.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(1021===t)return mt.ALPHA;if(1022===t)return mt.RGB;if(1023===t)return mt.RGBA;if(1024===t)return mt.LUMINANCE;if(1025===t)return mt.LUMINANCE_ALPHA;if(1026===t)return mt.DEPTH_COMPONENT;if(1027===t)return mt.DEPTH_STENCIL;if(100===t)return mt.FUNC_ADD;if(101===t)return mt.FUNC_SUBTRACT;if(102===t)return mt.FUNC_REVERSE_SUBTRACT;if(200===t)return mt.ZERO;if(201===t)return mt.ONE;if(202===t)return mt.SRC_COLOR;if(203===t)return mt.ONE_MINUS_SRC_COLOR;if(204===t)return mt.SRC_ALPHA;if(205===t)return mt.ONE_MINUS_SRC_ALPHA;if(206===t)return mt.DST_ALPHA;if(207===t)return mt.ONE_MINUS_DST_ALPHA;if(208===t)return mt.DST_COLOR;if(209===t)return mt.ONE_MINUS_DST_COLOR;if(210===t)return mt.SRC_ALPHA_SATURATE;if((2001===t||2002===t||2003===t||2004===t)&&null!==(e=vt.get("WEBGL_compressed_texture_s3tc"))){if(2001===t)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(2002===t)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(2003===t)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(2004===t)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((2100===t||2101===t||2102===t||2103===t)&&null!==(e=vt.get("WEBGL_compressed_texture_pvrtc"))){if(2100===t)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(2101===t)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(2102===t)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(2103===t)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(2151===t&&null!==(e=vt.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((103===t||104===t)&&null!==(e=vt.get("EXT_blend_minmax"))){if(103===t)return e.MIN_EXT;if(104===t)return e.MAX_EXT}return 1020===t&&null!==(e=vt.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer","86");var x=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),w=void 0!==t.context?t.context:null,S=void 0!==t.alpha&&t.alpha,M=void 0===t.depth||t.depth,E=void 0===t.stencil||t.stencil,T=void 0!==t.antialias&&t.antialias,C=void 0===t.premultipliedAlpha||t.premultipliedAlpha,O=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,P=[],A=null,j=new Float32Array(8),R=[],L=[];this.domElement=x,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1,this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var N=this,I=null,D=null,k=null,F=-1,B="",U=null,z=null,$=new i,V=null,W=new i,X=0,Y=x.width,K=x.height,Z=1,J=new i(0,0,Y,K),Q=!1,nt=new i(0,0,Y,K),it=new tt,ot=new he,st=!1,at=!1,ct=new u,ut=new c,ht=new u,lt=new u,pt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},ft={geometries:0,textures:0},dt={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:dt,memory:ft,programs:null};var mt;try{if(S={alpha:S,depth:M,stencil:E,antialias:T,premultipliedAlpha:C,preserveDrawingBuffer:O},null===(mt=w||x.getContext("webgl",S)||x.getContext("experimental-webgl",S))){if(null!==x.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}void 0===mt.getShaderPrecisionFormat&&(mt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),x.addEventListener("webglcontextlost",n,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var vt=new ue(mt);vt.get("WEBGL_depth_texture"),vt.get("OES_texture_float"),vt.get("OES_texture_float_linear"),vt.get("OES_texture_half_float"),vt.get("OES_texture_half_float_linear"),vt.get("OES_standard_derivatives"),vt.get("ANGLE_instanced_arrays"),vt.get("OES_element_index_uint")&&(St.MaxIndex=4294967296);var gt=new se(mt,vt,t),yt=new oe(mt,vt,_),bt=new ie,_t=new ne(mt,vt,yt,bt,gt,_,ft),xt=new rt(mt),wt=new Ut(mt,xt,ft),Mt=new Gt(mt,wt,dt),Et=new re(this,gt),Tt=new zt,Ct=new kt,Ot=new Lt(this,yt,Mt,C),Pt=new ce(this);this.info.programs=Et.programs;var At=new Bt(mt,vt,dt),jt=new Ft(mt,vt,dt);e(),this.context=mt,this.capabilities=gt,this.extensions=vt,this.properties=bt,this.renderLists=Ct,this.state=yt,this.vr=Pt;var Rt=new et(this,pt,Mt,gt);this.shadowMap=Rt;var Nt=new q(this,R),It=new H(this,L);this.getContext=function(){return mt},this.getContextAttributes=function(){return mt.getContextAttributes()},this.forceContextLoss=function(){var t=vt.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return gt.getMaxAnisotropy()},this.getPrecision=function(){return gt.precision},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(t){void 0!==t&&(Z=t,this.setSize(Y,K,!1))},this.getSize=function(){return{width:Y,height:K}},this.setSize=function(t,e,r){var n=Pt.getDevice();n&&n.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Y=t,K=e,x.width=t*Z,x.height=e*Z,!1!==r&&(x.style.width=t+"px",x.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(){return{width:Y*Z,height:K*Z}},this.setDrawingBufferSize=function(t,e,r){Y=t,K=e,Z=r,x.width=t*r,x.height=e*r,this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,n){nt.set(t,K-e-n,r,n),yt.viewport(W.copy(nt).multiplyScalar(Z))},this.setScissor=function(t,e,r,n){J.set(t,K-e-n,r,n),yt.scissor($.copy(J).multiplyScalar(Z))},this.setScissorTest=function(t){yt.setScissorTest(Q=t)},this.getClearColor=Ot.getClearColor,this.setClearColor=Ot.setClearColor,this.getClearAlpha=Ot.getClearAlpha,this.setClearAlpha=Ot.setClearAlpha,this.clear=function(t,e,r){var n=0;(void 0===t||t)&&(n|=mt.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=mt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(n|=mt.STENCIL_BUFFER_BIT),mt.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.clearTarget=function(t,e,r,n){this.setRenderTarget(t),this.clear(e,r,n)},this.resetGLState=r,this.dispose=function(){x.removeEventListener("webglcontextlost",n,!1),Ct.dispose()},this.renderBufferImmediate=function(t,e,r){yt.initAttributes();var n=bt.get(t);if(t.hasPositions&&!n.position&&(n.position=mt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=mt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=mt.createBuffer()),t.hasColors&&!n.color&&(n.color=mt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(mt.bindBuffer(mt.ARRAY_BUFFER,n.position),mt.bufferData(mt.ARRAY_BUFFER,t.positionArray,mt.DYNAMIC_DRAW),yt.enableAttribute(e.position),mt.vertexAttribPointer(e.position,3,mt.FLOAT,!1,0,0)),t.hasNormals){if(mt.bindBuffer(mt.ARRAY_BUFFER,n.normal),!r.isMeshPhongMaterial&&!r.isMeshStandardMaterial&&!r.isMeshNormalMaterial&&1===r.shading)for(var i=0,o=3*t.count;i<o;i+=9){var s=t.normalArray,a=(s[i+0]+s[i+3]+s[i+6])/3,c=(s[i+1]+s[i+4]+s[i+7])/3,u=(s[i+2]+s[i+5]+s[i+8])/3;s[i+0]=a,s[i+1]=c,s[i+2]=u,s[i+3]=a,s[i+4]=c,s[i+5]=u,s[i+6]=a,s[i+7]=c,s[i+8]=u}mt.bufferData(mt.ARRAY_BUFFER,t.normalArray,mt.DYNAMIC_DRAW),yt.enableAttribute(e.normal),mt.vertexAttribPointer(e.normal,3,mt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(mt.bindBuffer(mt.ARRAY_BUFFER,n.uv),mt.bufferData(mt.ARRAY_BUFFER,t.uvArray,mt.DYNAMIC_DRAW),yt.enableAttribute(e.uv),mt.vertexAttribPointer(xt.uv,2,mt.FLOAT,!1,0,0)),t.hasColors&&0!==r.vertexColors&&(mt.bindBuffer(mt.ARRAY_BUFFER,n.color),mt.bufferData(mt.ARRAY_BUFFER,t.colorArray,mt.DYNAMIC_DRAW),yt.enableAttribute(e.color),mt.vertexAttribPointer(e.color,3,mt.FLOAT,!1,0,0)),yt.disableUnusedAttributes(),mt.drawArrays(mt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,n,i,o){yt.setMaterial(n);var s=v(t,e,n,i),a=!1;if((t=r.id+"_"+s.id+"_"+(!0===n.wireframe))!==B&&(B=t,a=!0),void 0!==(e=i.morphTargetInfluences)){var c=[];t=0;for(var u=e.length;t<u;t++)a=e[t],c.push([a,t]);c.sort(l),8<c.length&&(c.length=8);f=r.morphAttributes;for(t=0,u=c.length;t<u;t++)a=c[t],j[t]=a[0],0!==a[0]?(e=a[1],!0===n.morphTargets&&f.position&&r.addAttribute("morphTarget"+t,f.position[e]),!0===n.morphNormals&&f.normal&&r.addAttribute("morphNormal"+t,f.normal[e])):(!0===n.morphTargets&&r.removeAttribute("morphTarget"+t),!0===n.morphNormals&&r.removeAttribute("morphNormal"+t));for(t=c.length,e=j.length;t<e;t++)j[t]=0;s.getUniforms().setValue(mt,"morphTargetInfluences",j),a=!0}e=r.index,u=r.attributes.position,c=1,!0===n.wireframe&&(e=wt.getWireframeAttribute(r),c=2);var h;if(t=At,null!==e&&(h=xt.get(e),(t=jt).setIndex(h)),a){if(a=void 0,r&&r.isInstancedBufferGeometry&&null===vt.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===a&&(a=0),yt.initAttributes();var p,f=r.attributes,s=s.getAttributes(),d=n.defaultAttributeValues;for(p in s){var m=s[p];if(0<=m)if(void 0!==(M=f[p])){var g=M.normalized,y=M.itemSize,b=(x=xt.get(M)).buffer,_=x.type,x=x.bytesPerElement;if(M.isInterleavedBufferAttribute){var w=M.data,S=w.stride,M=M.offset;w&&w.isInstancedInterleavedBuffer?(yt.enableAttributeAndDivisor(m,w.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=w.meshPerAttribute*w.count)):yt.enableAttribute(m),mt.bindBuffer(mt.ARRAY_BUFFER,b),mt.vertexAttribPointer(m,y,_,g,S*x,(a*S+M)*x)}else M.isInstancedBufferAttribute?(yt.enableAttributeAndDivisor(m,M.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=M.meshPerAttribute*M.count)):yt.enableAttribute(m),mt.bindBuffer(mt.ARRAY_BUFFER,b),mt.vertexAttribPointer(m,y,_,g,0,a*y*x)}else if(void 0!==d&&void 0!==(g=d[p]))switch(g.length){case 2:mt.vertexAttrib2fv(m,g);break;case 3:mt.vertexAttrib3fv(m,g);break;case 4:mt.vertexAttrib4fv(m,g);break;default:mt.vertexAttrib1fv(m,g)}}yt.disableUnusedAttributes()}null!==e&&mt.bindBuffer(mt.ELEMENT_ARRAY_BUFFER,h.buffer)}if(h=0,null!==e?h=e.count:void 0!==u&&(h=u.count),e=r.drawRange.start*c,u=null!==o?o.start*c:0,p=Math.max(e,u),0!==(o=Math.max(0,Math.min(h,e+r.drawRange.count*c,u+(null!==o?o.count*c:1/0))-1-p+1))){if(i.isMesh)if(!0===n.wireframe)yt.setLineWidth(n.wireframeLinewidth*(null===D?Z:1)),t.setMode(mt.LINES);else switch(i.drawMode){case 0:t.setMode(mt.TRIANGLES);break;case 1:t.setMode(mt.TRIANGLE_STRIP);break;case 2:t.setMode(mt.TRIANGLE_FAN)}else i.isLine?(void 0===(n=n.linewidth)&&(n=1),yt.setLineWidth(n*(null===D?Z:1)),i.isLineSegments?t.setMode(mt.LINES):i.isLineLoop?t.setMode(mt.LINE_LOOP):t.setMode(mt.LINE_STRIP)):i.isPoints&&t.setMode(mt.POINTS);r&&r.isInstancedBufferGeometry?0<r.maxInstancedCount&&t.renderInstances(r,p,o):t.render(p,o)}},this.compile=function(t,e){P=[],t.traverse(function(t){t.isLight&&P.push(t)}),b(P,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var r=0;r<e.material.length;r++)m(e.material[r],t.fog,e);else m(e.material,t.fog,e)})},this.animate=function(t){function e(){t(),(Pt.getDevice()||window).requestAnimationFrame(e)}(Pt.getDevice()||window).requestAnimationFrame(e)},this.render=function(t,e,r,n){if(e&&e.isCamera){B="",F=-1,U=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),Pt.enabled&&(e=Pt.getCamera(e)),ct.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),it.setFromMatrix(ct),P.length=0,R.length=0,L.length=0,at=this.localClippingEnabled,st=ot.init(this.clippingPlanes,at,e),(A=Ct.get(t,e)).init(),p(t,e,N.sortObjects),A.finish(),!0===N.sortObjects&&A.sort(),st&&ot.beginShadows();for(var i=P,o=0,s=0,a=i.length;s<a;s++){var c=i[s];c.castShadow&&(pt.shadows[o]=c,o++)}pt.shadows.length=o,Rt.render(t,e),b(P,e),st&&ot.endShadows(),dt.frame++,dt.calls=0,dt.vertices=0,dt.faces=0,dt.points=0,void 0===r&&(r=null),this.setRenderTarget(r),Ot.render(t,e,n),n=A.opaque,i=A.transparent,t.overrideMaterial?(o=t.overrideMaterial,n.length&&f(n,t,e,o),i.length&&f(i,t,e,o)):(n.length&&f(n,t,e),i.length&&f(i,t,e)),Nt.render(t,e),It.render(t,e,W),r&&_t.updateRenderTargetMipmap(r),yt.buffers.depth.setTest(!0),yt.buffers.depth.setMask(!0),yt.buffers.color.setMask(!0),e.isArrayCamera&&N.setScissorTest(!1),Pt.enabled&&Pt.submitFrame()}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(t,e){yt.setCullFace(t),yt.setFlipSided(0===e)},this.allocTextureUnit=function(){var t=X;return t>=gt.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+gt.maxTextures),X+=1,t},this.setTexture2D=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),_t.setTexture2D(e,r)}}(),this.setTexture=function(){var t=!1;return function(e,r){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),_t.setTexture2D(e,r)}}(),this.setTextureCube=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?_t.setTextureCube(e,r):_t.setTextureCubeDynamic(e,r)}}(),this.getRenderTarget=function(){return D},this.setRenderTarget=function(t){(D=t)&&void 0===bt.get(t).__webglFramebuffer&&_t.setupRenderTarget(t);var e,r=t&&t.isWebGLRenderTargetCube;t?(e=bt.get(t),e=r?e.__webglFramebuffer[t.activeCubeFace]:e.__webglFramebuffer,$.copy(t.scissor),V=t.scissorTest,W.copy(t.viewport)):(e=null,$.copy(J).multiplyScalar(Z),V=Q,W.copy(nt).multiplyScalar(Z)),k!==e&&(mt.bindFramebuffer(mt.FRAMEBUFFER,e),k=e),yt.scissor($),yt.setScissorTest(V),yt.viewport(W),r&&(r=bt.get(t.texture),mt.framebufferTexture2D(mt.FRAMEBUFFER,mt.COLOR_ATTACHMENT0,mt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel))},this.readRenderTargetPixels=function(t,e,r,n,i,o){if(t&&t.isWebGLRenderTarget){var s=bt.get(t).__webglFramebuffer;if(s){var a=!1;s!==k&&(mt.bindFramebuffer(mt.FRAMEBUFFER,s),a=!0);try{var c=t.texture,u=c.format,h=c.type;1023!==u&&_(u)!==mt.getParameter(mt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||_(h)===mt.getParameter(mt.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(vt.get("OES_texture_float")||vt.get("WEBGL_color_buffer_float"))||1016===h&&vt.get("EXT_color_buffer_half_float")?mt.checkFramebufferStatus(mt.FRAMEBUFFER)===mt.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=r&&r<=t.height-i&&mt.readPixels(e,r,n,i,_(u),_(h),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&&mt.bindFramebuffer(mt.FRAMEBUFFER,k)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function pe(t,e){this.name="",this.color=new $(t),this.density=void 0!==e?e:25e-5}function fe(t,e,r){this.name="",this.color=new $(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3}function de(){ot.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function me(t,e,r,n,i){ot.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,n,i)}function ve(t){W.call(this),this.type="SpriteMaterial",this.color=new $(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(t)}function ge(t){ot.call(this),this.type="Sprite",this.material=void 0!==t?t:new ve}function ye(){ot.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function be(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var r=0,n=this.bones.length;r<n;r++)this.boneInverses.push(new u)}}function _e(){ot.call(this),this.type="Bone"}function xe(t,e){Rt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new u,this.bindMatrixInverse=new u;var r=new be(r=this.initBones());this.bind(r,this.matrixWorld),this.normalizeSkinWeights()}function we(t){W.call(this),this.type="LineBasicMaterial",this.color=new $(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.lights=!1,this.setValues(t)}function Se(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Me(t,e);ot.call(this),this.type="Line",this.geometry=void 0!==t?t:new St,this.material=void 0!==e?e:new we({color:16777215*Math.random()})}function Me(t,e){Se.call(this,t,e),this.type="LineSegments"}function Ee(t,e){Se.call(this,t,e),this.type="LineLoop"}function Te(t){W.call(this),this.type="PointsMaterial",this.color=new $(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Ce(t,e){ot.call(this),this.type="Points",this.geometry=void 0!==t?t:new St,this.material=void 0!==e?e:new Te({color:16777215*Math.random()})}function Oe(){ot.call(this),this.type="Group"}function Pe(t,e,r,i,o,s,a,c,u){function h(){requestAnimationFrame(h),t.readyState>=t.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}n.call(this,t,e,r,i,o,s,a,c,u),this.generateMipmaps=!1;var l=this;h()}function Ae(t,e,r,i,o,s,a,c,u,h,l,p){n.call(this,null,s,a,c,u,h,i,o,l,p),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1}function je(t,e,r,i,o,s,a,c,u){n.call(this,t,e,r,i,o,s,a,c,u),this.needsUpdate=!0}function Re(t,e,r,i,o,s,a,c,u,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===h&&(r=1012),void 0===r&&1027===h&&(r=1020),n.call(this,null,i,o,s,a,c,h,r,u),this.image={width:t,height:e},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=this.flipY=!1}function Le(t){St.call(this),this.type="WireframeGeometry";var e,r,n,i,o,s,a=[],u=[0,0],h={},l=["a","b","c"];if(t&&t.isGeometry){var p=t.faces;for(e=0,n=p.length;e<n;e++){var f=p[e];for(r=0;3>r;r++)o=f[l[r]],s=f[l[(r+1)%3]],u[0]=Math.min(o,s),u[1]=Math.max(o,s),o=u[0]+","+u[1],void 0===h[o]&&(h[o]={index1:u[0],index2:u[1]})}for(o in h)e=h[o],l=t.vertices[e.index1],a.push(l.x,l.y,l.z),l=t.vertices[e.index2],a.push(l.x,l.y,l.z)}else if(t&&t.isBufferGeometry){var d,l=new c;if(null!==t.index){for(p=t.attributes.position,f=t.index,0===(d=t.groups).length&&(d=[{start:0,count:f.count,materialIndex:0}]),t=0,i=d.length;t<i;++t)for(e=d[t],r=e.start,n=e.count,e=r,n=r+n;e<n;e+=3)for(r=0;3>r;r++)o=f.getX(e+r),s=f.getX(e+(r+1)%3),u[0]=Math.min(o,s),u[1]=Math.max(o,s),o=u[0]+","+u[1],void 0===h[o]&&(h[o]={index1:u[0],index2:u[1]});for(o in h)e=h[o],l.fromBufferAttribute(p,e.index1),a.push(l.x,l.y,l.z),l.fromBufferAttribute(p,e.index2),a.push(l.x,l.y,l.z)}else for(p=t.attributes.position,e=0,n=p.count/3;e<n;e++)for(r=0;3>r;r++)h=3*e+r,l.fromBufferAttribute(p,h),a.push(l.x,l.y,l.z),h=3*e+(r+1)%3,l.fromBufferAttribute(p,h),a.push(l.x,l.y,l.z)}this.addAttribute("position",new bt(a,3))}function Ne(t,e,r){ht.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r},this.fromBufferGeometry(new Ie(t,e,r)),this.mergeVertices()}function Ie(t,e,r){St.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:r};var n,i,o=[],s=[],a=[],u=[],h=new c,l=new c,p=new c,f=new c,d=new c,m=e+1;for(n=0;n<=r;n++){var v=n/r;for(i=0;i<=e;i++){var g=i/e,l=t(g,v,l);s.push(l.x,l.y,l.z),0<=g-1e-5?(p=t(g-1e-5,v,p),f.subVectors(l,p)):(p=t(g+1e-5,v,p),f.subVectors(p,l)),0<=v-1e-5?(p=t(g,v-1e-5,p),d.subVectors(l,p)):(p=t(g,v+1e-5,p),d.subVectors(p,l)),h.crossVectors(f,d).normalize(),a.push(h.x,h.y,h.z),u.push(g,v)}}for(n=0;n<r;n++)for(i=0;i<e;i++)t=n*m+i+1,h=(n+1)*m+i+1,l=(n+1)*m+i,o.push(n*m+i,t,l),o.push(t,h,l);this.setIndex(o),this.addAttribute("position",new bt(s,3)),this.addAttribute("normal",new bt(a,3)),this.addAttribute("uv",new bt(u,2))}function De(t,e,r,n){ht.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:n},this.fromBufferGeometry(new ke(t,e,r,n)),this.mergeVertices()}function ke(t,e,n,i){function o(t){u.push(t.x,t.y,t.z)}function s(e,r){var n=3*e;r.x=t[n+0],r.y=t[n+1],r.z=t[n+2]}function a(t,e,r,n){0>n&&1===t.x&&(h[e]=t.x-1),0===r.x&&0===r.z&&(h[e]=n/2/Math.PI+.5)}St.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},n=n||1;var u=[],h=[];!function(t){for(var r=new c,n=new c,i=new c,a=0;a<e.length;a+=3){s(e[a+0],r),s(e[a+1],n),s(e[a+2],i);var u,h,l=r,p=n,f=i,d=Math.pow(2,t),m=[];for(u=0;u<=d;u++){m[u]=[];var v=l.clone().lerp(f,u/d),g=p.clone().lerp(f,u/d),y=d-u;for(h=0;h<=y;h++)m[u][h]=0===h&&u===d?v:v.clone().lerp(g,h/y)}for(u=0;u<d;u++)for(h=0;h<2*(d-u)-1;h++)l=Math.floor(h/2),0==h%2?(o(m[u][l+1]),o(m[u+1][l]),o(m[u][l])):(o(m[u][l+1]),o(m[u+1][l+1]),o(m[u+1][l]))}}(i=i||0),function(t){for(var e=new c,r=0;r<u.length;r+=3)e.x=u[r+0],e.y=u[r+1],e.z=u[r+2],e.normalize().multiplyScalar(t),u[r+0]=e.x,u[r+1]=e.y,u[r+2]=e.z}(n),function(){for(var t=new c,e=0;e<u.length;e+=3)t.x=u[e+0],t.y=u[e+1],t.z=u[e+2],h.push(Math.atan2(t.z,-t.x)/2/Math.PI+.5,1-(Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5));for(var t=new c,e=new c,n=new c,i=new c,o=new r,s=new r,l=new r,p=0,f=0;p<u.length;p+=9,f+=6){t.set(u[p+0],u[p+1],u[p+2]),e.set(u[p+3],u[p+4],u[p+5]),n.set(u[p+6],u[p+7],u[p+8]),o.set(h[f+0],h[f+1]),s.set(h[f+2],h[f+3]),l.set(h[f+4],h[f+5]),i.copy(t).add(e).add(n).divideScalar(3);var d=Math.atan2(i.z,-i.x);a(o,f+0,t,d),a(s,f+2,e,d),a(l,f+4,n,d)}for(t=0;t<h.length;t+=6)e=h[t+0],n=h[t+2],i=h[t+4],o=Math.min(e,n,i),.9<Math.max(e,n,i)&&.1>o&&(.2>e&&(h[t+0]+=1),.2>n&&(h[t+2]+=1),.2>i&&(h[t+4]+=1))}(),this.addAttribute("position",new bt(u,3)),this.addAttribute("normal",new bt(u.slice(),3)),this.addAttribute("uv",new bt(h,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Fe(t,e){ht.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Be(t,e)),this.mergeVertices()}function Be(t,e){ke.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],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ue(t,e){ht.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ze(t,e)),this.mergeVertices()}function ze(t,e){ke.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],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ge(t,e){ht.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new $e(t,e)),this.mergeVertices()}function $e(t,e){var r=(1+Math.sqrt(5))/2;ke.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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ve(t,e){ht.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new He(t,e)),this.mergeVertices()}function He(t,e){var r=(1+Math.sqrt(5))/2,n=1/r;ke.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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function qe(t,e,r,n,i,o){ht.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:n,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed."),t=new We(t,e,r,n,i),this.tangents=t.tangents,this.normals=t.normals,this.binormals=t.binormals,this.fromBufferGeometry(t),this.mergeVertices()}function We(t,e,n,i,o){function s(r){var o=t.getPointAt(r/e),s=a.normals[r];for(r=a.binormals[r],h=0;h<=i;h++){var c=h/i*Math.PI*2,u=Math.sin(c),c=-Math.cos(c);p.x=c*s.x+u*r.x,p.y=c*s.y+u*r.y,p.z=c*s.z+u*r.z,p.normalize(),m.push(p.x,p.y,p.z),l.x=o.x+n*p.x,l.y=o.y+n*p.y,l.z=o.z+n*p.z,d.push(l.x,l.y,l.z)}}St.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:o},e=e||64,n=n||1,i=i||8,o=o||!1;var a=t.computeFrenetFrames(e,o);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var u,h,l=new c,p=new c,f=new r,d=[],m=[],v=[],g=[];for(u=0;u<e;u++)s(u);for(s(!1===o?e:0),u=0;u<=e;u++)for(h=0;h<=i;h++)f.x=u/e,f.y=h/i,v.push(f.x,f.y);!function(){for(h=1;h<=e;h++)for(u=1;u<=i;u++){var t=(i+1)*h+(u-1),r=(i+1)*h+u,n=(i+1)*(h-1)+u;g.push((i+1)*(h-1)+(u-1),t,n),g.push(t,r,n)}}(),this.setIndex(g),this.addAttribute("position",new bt(d,3)),this.addAttribute("normal",new bt(m,3)),this.addAttribute("uv",new bt(v,2))}function Xe(t,e,r,n,i,o,s){ht.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:n,p:i,q:o},void 0!==s&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ye(t,e,r,n,i,o)),this.mergeVertices()}function Ye(t,e,r,n,i,o){function s(t,e,r,n,i){var o=Math.sin(t);e=r/e*t,r=Math.cos(e),i.x=n*(2+r)*.5*Math.cos(t),i.y=n*(2+r)*o*.5,i.z=n*Math.sin(e)*.5}St.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:n,p:i,q:o},t=t||100,e=e||40,r=Math.floor(r)||64,n=Math.floor(n)||8,i=i||2,o=o||3;var a,u,h=[],l=[],p=[],f=[],d=new c,m=new c,v=new c,g=new c,y=new c,b=new c,_=new c;for(a=0;a<=r;++a)for(u=a/r*i*Math.PI*2,s(u,i,o,t,v),s(u+.01,i,o,t,g),b.subVectors(g,v),_.addVectors(g,v),y.crossVectors(b,_),_.crossVectors(y,b),y.normalize(),_.normalize(),u=0;u<=n;++u){var x=u/n*Math.PI*2,w=-e*Math.cos(x),x=e*Math.sin(x);d.x=v.x+(w*_.x+x*y.x),d.y=v.y+(w*_.y+x*y.y),d.z=v.z+(w*_.z+x*y.z),l.push(d.x,d.y,d.z),m.subVectors(d,v).normalize(),p.push(m.x,m.y,m.z),f.push(a/r),f.push(u/n)}for(u=1;u<=r;u++)for(a=1;a<=n;a++)t=(n+1)*u+(a-1),e=(n+1)*u+a,i=(n+1)*(u-1)+a,h.push((n+1)*(u-1)+(a-1),t,i),h.push(t,e,i);this.setIndex(h),this.addAttribute("position",new bt(l,3)),this.addAttribute("normal",new bt(p,3)),this.addAttribute("uv",new bt(f,2))}function Ke(t,e,r,n,i){ht.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:n,arc:i},this.fromBufferGeometry(new Ze(t,e,r,n,i)),this.mergeVertices()}function Ze(t,e,r,n,i){St.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:n,arc:i},t=t||100,e=e||40,r=Math.floor(r)||8,n=Math.floor(n)||6,i=i||2*Math.PI;var o,s,a=[],u=[],h=[],l=[],p=new c,f=new c,d=new c;for(o=0;o<=r;o++)for(s=0;s<=n;s++){var m=s/n*i,v=o/r*Math.PI*2;f.x=(t+e*Math.cos(v))*Math.cos(m),f.y=(t+e*Math.cos(v))*Math.sin(m),f.z=e*Math.sin(v),u.push(f.x,f.y,f.z),p.x=t*Math.cos(m),p.y=t*Math.sin(m),d.subVectors(f,p).normalize(),h.push(d.x,d.y,d.z),l.push(s/n),l.push(o/r)}for(o=1;o<=r;o++)for(s=1;s<=n;s++)t=(n+1)*(o-1)+s-1,e=(n+1)*(o-1)+s,i=(n+1)*o+s,a.push((n+1)*o+s-1,t,i),a.push(t,e,i);this.setIndex(a),this.addAttribute("position",new bt(u,3)),this.addAttribute("normal",new bt(h,3)),this.addAttribute("uv",new bt(l,2))}function Je(t,e){ht.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new Qe(t,e)),this.mergeVertices()}function Qe(t,e){void 0!==t&&(St.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals())}function tr(t,e){ht.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new er(t,e)),this.mergeVertices()}function er(t,e){var r=(e=e||{}).font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new ht;r=r.generateShapes(t,e.size,e.curveSegments),e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),Qe.call(this,r,e),this.type="TextBufferGeometry"}function rr(t,e,r,n,i,o,s){ht.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new nr(t,e,r,n,i,o,s)),this.mergeVertices()}function nr(t,e,r,n,i,o,s){St.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:s},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var a,u,h=(o=void 0!==o?o:0)+(s=void 0!==s?s:Math.PI),l=0,p=[],f=new c,d=new c,m=[],v=[],g=[],y=[];for(u=0;u<=r;u++){var b=[],_=u/r;for(a=0;a<=e;a++){var x=a/e;f.x=-t*Math.cos(n+x*i)*Math.sin(o+_*s),f.y=t*Math.cos(o+_*s),f.z=t*Math.sin(n+x*i)*Math.sin(o+_*s),v.push(f.x,f.y,f.z),d.set(f.x,f.y,f.z).normalize(),g.push(d.x,d.y,d.z),y.push(x,1-_),b.push(l++)}p.push(b)}for(u=0;u<r;u++)for(a=0;a<e;a++)t=p[u][a+1],n=p[u][a],i=p[u+1][a],s=p[u+1][a+1],(0!==u||0<o)&&m.push(t,n,s),(u!==r-1||h<Math.PI)&&m.push(n,i,s);this.setIndex(m),this.addAttribute("position",new bt(v,3)),this.addAttribute("normal",new bt(g,3)),this.addAttribute("uv",new bt(y,2))}function ir(t,e,r,n,i,o){ht.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new or(t,e,r,n,i,o)),this.mergeVertices()}function or(t,e,n,i,o,s){St.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:s},t=t||20,e=e||50,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var a,u,h=[],l=[],p=[],f=[],d=t,m=(e-t)/(i=void 0!==i?Math.max(1,i):1),v=new c,g=new r;for(a=0;a<=i;a++){for(u=0;u<=n;u++)t=o+u/n*s,v.x=d*Math.cos(t),v.y=d*Math.sin(t),l.push(v.x,v.y,v.z),p.push(0,0,1),g.x=(v.x/e+1)/2,g.y=(v.y/e+1)/2,f.push(g.x,g.y);d+=m}for(a=0;a<i;a++)for(e=a*(n+1),u=0;u<n;u++)t=u+e,o=t+n+1,s=t+n+2,d=t+1,h.push(t,o,d),h.push(o,s,d);this.setIndex(h),this.addAttribute("position",new bt(l,3)),this.addAttribute("normal",new bt(p,3)),this.addAttribute("uv",new bt(f,2))}function sr(t,e,r,n){ht.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:n},this.fromBufferGeometry(new ar(t,e,r,n)),this.mergeVertices()}function ar(t,e,n,i){St.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e)||12,n=n||0,i=i||2*Math.PI,i=xi.clamp(i,0,2*Math.PI);var o,s,a=[],u=[],h=[],l=1/e,p=new c,f=new r;for(o=0;o<=e;o++){s=n+o*l*i;var d=Math.sin(s),m=Math.cos(s);for(s=0;s<=t.length-1;s++)p.x=t[s].x*d,p.y=t[s].y,p.z=t[s].x*m,u.push(p.x,p.y,p.z),f.x=o/e,f.y=s/(t.length-1),h.push(f.x,f.y)}for(o=0;o<e;o++)for(s=0;s<t.length-1;s++)n=s+o*t.length,l=n+t.length,p=n+t.length+1,f=n+1,a.push(n,l,f),a.push(l,p,f);if(this.setIndex(a),this.addAttribute("position",new bt(u,3)),this.addAttribute("uv",new bt(h,2)),this.computeVertexNormals(),i===2*Math.PI)for(i=this.attributes.normal.array,a=new c,u=new c,h=new c,n=e*t.length*3,s=o=0;o<t.length;o++,s+=3)a.x=i[s+0],a.y=i[s+1],a.z=i[s+2],u.x=i[n+s+0],u.y=i[n+s+1],u.z=i[n+s+2],h.addVectors(a,u).normalize(),i[s+0]=i[n+s+0]=h.x,i[s+1]=i[n+s+1]=h.y,i[s+2]=i[n+s+2]=h.z}function cr(t,e){ht.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new ur(t,e)),this.mergeVertices()}function ur(t,e){function r(t){var r,a,u=i.length/3,h=(t=t.extractPoints(e)).shape,l=t.holes;if(!1===Bi.isClockWise(h))for(h=h.reverse(),t=0,r=l.length;t<r;t++)a=l[t],!0===Bi.isClockWise(a)&&(l[t]=a.reverse());var p=Bi.triangulateShape(h,l);for(t=0,r=l.length;t<r;t++)a=l[t],h=h.concat(a);for(t=0,r=h.length;t<r;t++)a=h[t],i.push(a.x,a.y,0),o.push(0,0,1),s.push(a.x,a.y);for(t=0,r=p.length;t<r;t++)h=p[t],n.push(h[0]+u,h[1]+u,h[2]+u),c+=3}St.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var n=[],i=[],o=[],s=[],a=0,c=0;if(!1===Array.isArray(t))r(t);else for(var u=0;u<t.length;u++)r(t[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(n),this.addAttribute("position",new bt(i,3)),this.addAttribute("normal",new bt(o,3)),this.addAttribute("uv",new bt(s,2))}function hr(t,e){St.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e};var r,n,i,o=[],s=Math.cos(xi.DEG2RAD*(void 0!==e?e:1)),a=[0,0],c={},u=["a","b","c"];t.isBufferGeometry?(i=new ht).fromBufferGeometry(t):i=t.clone(),i.mergeVertices(),i.computeFaceNormals();for(var h=i.vertices,l=0,p=(i=i.faces).length;l<p;l++)for(var f=i[l],d=0;3>d;d++)r=f[u[d]],n=f[u[(d+1)%3]],a[0]=Math.min(r,n),a[1]=Math.max(r,n),r=a[0]+","+a[1],void 0===c[r]?c[r]={index1:a[0],index2:a[1],face1:l,face2:void 0}:c[r].face2=l;for(r in c)(void 0===(a=c[r]).face2||i[a.face1].normal.dot(i[a.face2].normal)<=s)&&(u=h[a.index1],o.push(u.x,u.y,u.z),u=h[a.index2],o.push(u.x,u.y,u.z));this.addAttribute("position",new bt(o,3))}function lr(t,e,r,n,i,o,s,a){ht.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new pr(t,e,r,n,i,o,s,a)),this.mergeVertices()}function pr(t,e,n,i,o,s,a,u){function h(n){var o,s,h,g=new r,_=new c,x=0,w=!0===n?t:e,S=!0===n?1:-1;for(s=v,o=1;o<=i;o++)f.push(0,y*S,0),d.push(0,S,0),m.push(.5,.5),v++;for(h=v,o=0;o<=i;o++){var M=o/i*u+a,E=Math.cos(M),M=Math.sin(M);_.x=w*M,_.y=y*S,_.z=w*E,f.push(_.x,_.y,_.z),d.push(0,S,0),g.x=.5*E+.5,g.y=.5*M*S+.5,m.push(g.x,g.y),v++}for(o=0;o<i;o++)g=s+o,_=h+o,!0===n?p.push(_,_+1,g):p.push(_+1,_,g),x+=3;l.addGroup(b,x,!0===n?1:2),b+=x}St.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:o,openEnded:s,thetaStart:a,thetaLength:u};var l=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,i=Math.floor(i)||8,o=Math.floor(o)||1,s=void 0!==s&&s,a=void 0!==a?a:0,u=void 0!==u?u:2*Math.PI;var p=[],f=[],d=[],m=[],v=0,g=[],y=n/2,b=0;!function(){var r,s,h=new c,_=new c,x=0,w=(e-t)/n;for(s=0;s<=o;s++){var S=[],M=s/o,E=M*(e-t)+t;for(r=0;r<=i;r++){var T=r/i,C=T*u+a,O=Math.sin(C),C=Math.cos(C);_.x=E*O,_.y=-M*n+y,_.z=E*C,f.push(_.x,_.y,_.z),h.set(O,w,C).normalize(),d.push(h.x,h.y,h.z),m.push(T,1-M),S.push(v++)}g.push(S)}for(r=0;r<i;r++)for(s=0;s<o;s++)h=g[s+1][r],_=g[s+1][r+1],w=g[s][r+1],p.push(g[s][r],h,w),p.push(h,_,w),x+=6;l.addGroup(b,x,0),b+=x}(),!1===s&&(0<t&&h(!0),0<e&&h(!1)),this.setIndex(p),this.addAttribute("position",new bt(f,3)),this.addAttribute("normal",new bt(d,3)),this.addAttribute("uv",new bt(m,2))}function fr(t,e,r,n,i,o,s){lr.call(this,0,t,e,r,n,i,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:s}}function dr(t,e,r,n,i,o,s){pr.call(this,0,t,e,r,n,i,o,s),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:s}}function mr(t,e,r,n){ht.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new vr(t,e,r,n)),this.mergeVertices()}function vr(t,e,n,i){St.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var o,s,a=[],u=[],h=[],l=[],p=new c,f=new r;for(u.push(0,0,0),h.push(0,0,1),l.push(.5,.5),s=0,o=3;s<=e;s++,o+=3){var d=n+s/e*i;p.x=t*Math.cos(d),p.y=t*Math.sin(d),u.push(p.x,p.y,p.z),h.push(0,0,1),f.x=(u[o]/t+1)/2,f.y=(u[o+1]/t+1)/2,l.push(f.x,f.y)}for(o=1;o<=e;o++)a.push(o,o+1,0);this.setIndex(a),this.addAttribute("position",new bt(u,3)),this.addAttribute("normal",new bt(h,3)),this.addAttribute("uv",new bt(l,2))}function gr(t){X.call(this,{uniforms:Ri.merge([ji.lights,{opacity:{value:1}}]),vertexShader:Li.shadow_vert,fragmentShader:Li.shadow_frag}),this.transparent=this.lights=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function yr(t){X.call(this,t),this.type="RawShaderMaterial"}function br(t){W.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new $(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(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.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)}function _r(t){br.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoatRoughness=this.clearCoat=0,this.setValues(t)}function xr(t){W.call(this),this.type="MeshPhongMaterial",this.color=new $(16777215),this.specular=new $(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(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(t)}function wr(t){xr.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Sr(t){W.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.morphNormals=this.morphTargets=this.skinning=this.lights=this.fog=!1,this.setValues(t)}function Mr(t){W.call(this),this.type="MeshLambertMaterial",this.color=new $(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $(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(t)}function Er(t){W.call(this),this.type="LineDashedMaterial",this.color=new $(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Tr(t,e,r){var n=this,i=!1,o=0,s=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){s++,!1===i&&void 0!==n.onStart&&n.onStart(t,o,s),i=!0},this.itemEnd=function(t){o++,void 0!==n.onProgress&&n.onProgress(t,o,s),o===s&&(i=!1,void 0!==n.onLoad)&&n.onLoad()},this.itemError=function(t){void 0!==n.onError&&n.onError(t)}}function Cr(t){this.manager=void 0!==t?t:$i}function Or(t){this.manager=void 0!==t?t:$i,this._parser=null}function Pr(t){this.manager=void 0!==t?t:$i,this._parser=null}function Ar(t){this.manager=void 0!==t?t:$i}function jr(t){this.manager=void 0!==t?t:$i}function Rr(t){this.manager=void 0!==t?t:$i}function Lr(t,e){ot.call(this),this.type="Light",this.color=new $(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Nr(t,e,r){Lr.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ot.DefaultUp),this.updateMatrix(),this.groundColor=new $(e)}function Ir(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new r(512,512),this.map=null,this.matrix=new u}function Dr(){Ir.call(this,new ct(50,1,.5,500))}function kr(t,e,r,n,i,o){Lr.call(this,t,e),this.type="SpotLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/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 Dr}function Fr(t,e,r,n){Lr.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new Ir(new ct(90,1,.5,500))}function Br(){Ir.call(this,new at(-5,5,5,-5,.5,500))}function Ur(t,e){Lr.call(this,t,e),this.type="DirectionalLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.shadow=new Br}function zr(t,e){Lr.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Gr(t,e,r,n){Lr.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==r?r:10,this.height=void 0!==n?n:10}function $r(t,e,r,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(r),this.sampleValues=e,this.valueSize=r}function Vr(t,e,r,n){$r.call(this,t,e,r,n),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function Hr(t,e,r,n){$r.call(this,t,e,r,n)}function qr(t,e,r,n){$r.call(this,t,e,r,n)}function Wr(t,e,r,n){if(void 0===t)throw Error("track name is undefined");if(void 0===e||0===e.length)throw Error("no keyframes in track named "+t);this.name=t,this.times=Vi.convertArray(e,this.TimeBufferType),this.values=Vi.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()}function Xr(t,e,r,n){Wr.call(this,t,e,r,n)}function Yr(t,e,r,n){$r.call(this,t,e,r,n)}function Kr(t,e,r,n){Wr.call(this,t,e,r,n)}function Zr(t,e,r,n){Wr.call(this,t,e,r,n)}function Jr(t,e,r,n){Wr.call(this,t,e,r,n)}function Qr(t,e,r){Wr.call(this,t,e,r)}function tn(t,e,r,n){Wr.call(this,t,e,r,n)}function en(t,e,r,n){Wr.apply(this,arguments)}function rn(t,e,r){this.name=t,this.tracks=r,this.duration=void 0!==e?e:-1,this.uuid=xi.generateUUID(),0>this.duration&&this.resetDuration(),this.optimize()}function nn(t){this.manager=void 0!==t?t:$i,this.textures={}}function on(t){this.manager=void 0!==t?t:$i}function sn(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function an(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:$i,this.withCredentials=!1}function cn(t){this.manager=void 0!==t?t:$i,this.texturePath=""}function un(t,e,r,n,i){var o=t*t;return(2*r-2*n+(e=.5*(n-e))+(i=.5*(i-r)))*t*o+(-3*r+3*n-2*e-i)*o+e*t+r}function hn(t,e,r,n){var i=1-t;return i*i*e+2*(1-t)*t*r+t*t*n}function ln(t,e,r,n,i){var o=1-t,s=1-t;return o*o*o*e+3*s*s*t*r+3*(1-t)*t*t*n+t*t*t*i}function pn(){this.arcLengthDivisions=200}function fn(t,e){this.arcLengthDivisions=200,this.v1=t,this.v2=e}function dn(){this.arcLengthDivisions=200,this.curves=[],this.autoClose=!1}function mn(t,e,r,n,i,o,s,a){this.arcLengthDivisions=200,this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=n,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a||0}function vn(t){this.arcLengthDivisions=200,this.points=void 0===t?[]:t}function gn(t,e,r,n){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r,this.v3=n}function yn(t,e,r){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r}function bn(t){dn.call(this),this.currentPoint=new r,t&&this.fromPoints(t)}function _n(){bn.apply(this,arguments),this.holes=[]}function xn(){this.subPaths=[],this.currentPath=null}function wn(t){this.data=t}function Sn(t){this.manager=void 0!==t?t:$i}function Mn(t){this.manager=void 0!==t?t:$i}function En(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ct,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ct,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Tn(t,e,r){ot.call(this),this.type="CubeCamera";var n=new ct(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new c(1,0,0)),this.add(n);var i=new ct(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new c(-1,0,0)),this.add(i);var o=new ct(90,1,t,e);o.up.set(0,0,1),o.lookAt(new c(0,1,0)),this.add(o);var a=new ct(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new c(0,-1,0)),this.add(a);var u=new ct(90,1,t,e);u.up.set(0,-1,0),u.lookAt(new c(0,0,1)),this.add(u);var h=new ct(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new c(0,0,-1)),this.add(h),this.renderTarget=new s(r,r,{format:1022,magFilter:1006,minFilter:1006}),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,s=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,n,r),r.activeCubeFace=1,t.render(e,i,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,a,r),r.activeCubeFace=4,t.render(e,u,r),r.texture.generateMipmaps=s,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)}}function Cn(){ot.call(this),this.type="AudioListener",this.context=Ji.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function On(t){ot.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Pn(t){On.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function An(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function jn(t,e,r){switch(this.binding=t,this.valueSize=r,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*r),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0}function Rn(t,e,r){r=r||Ln.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Ln(t,e,r){this.path=e,this.parsedPath=r||Ln.parseTrackName(e),this.node=Ln.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Nn(t){this.uuid=xi.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function In(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,e=(t=e.tracks).length,r=Array(e);for(var n={endingStart:2400,endingEnd:2400},i=0;i!==e;++i){var o=t[i].createInterpolant(null);r[i]=o,o.settings=n}this._interpolantSettings=n,this._interpolants=r,this._propertyBindings=Array(e),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=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Dn(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function kn(t,e){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=e),this.value=t}function Fn(){St.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Bn(t,e,r,n){this.uuid=xi.generateUUID(),this.data=t,this.itemSize=e,this.offset=r,this.normalized=!0===n}function Un(t,e){this.uuid=xi.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function zn(t,e,r){Un.call(this,t,e),this.meshPerAttribute=r||1}function Gn(t,e,r){lt.call(this,t,e),this.meshPerAttribute=r||1}function $n(t,e,r,n){this.ray=new Pt(t,e),this.near=r||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Vn(t,e){return t.distance-e.distance}function Hn(t,e,r,n){if(!1!==t.visible&&(t.raycast(e,r),!0===n)){n=0;for(var i=(t=t.children).length;n<i;n++)Hn(t[n],e,r,!0)}}function qn(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1}function Wn(t,e,r){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==r?r:0,this}function Xn(t,e,r){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==r?r:0,this}function Yn(t,e){Rt.call(this,t,e),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length;this.createAnimation("__default",0,r-1,r/1),this.setAnimationWeight("__default",1)}function Kn(t){ot.call(this),this.material=t,this.render=function(t){}}function Zn(t,e,r,n){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16711680,n=void 0!==n?n:1,e=0,(r=this.object.geometry)&&r.isGeometry?e=3*r.faces.length:r&&r.isBufferGeometry&&(e=r.attributes.normal.count),r=new St,e=new bt(6*e,3),r.addAttribute("position",e),Me.call(this,r,new we({color:t,linewidth:n})),this.matrixAutoUpdate=!1,this.update()}function Jn(t){ot.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,t=new St;for(var e=[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],r=0,n=1;32>r;r++,n++){var i=r/32*Math.PI*2,o=n/32*Math.PI*2;e.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}t.addAttribute("position",new bt(e,3)),e=new we({fog:!1}),this.cone=new Me(t,e),this.add(this.cone),this.update()}function Qn(t){var e=[];t&&t.isBone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,Qn(t.children[r]));return e}function ti(t){for(var e=Qn(t),r=new St,n=[],i=[],o=new $(0,0,1),s=new $(0,1,0),a=0;a<e.length;a++){var c=e[a];c.parent&&c.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(o.r,o.g,o.b),i.push(s.r,s.g,s.b))}r.addAttribute("position",new bt(n,3)),r.addAttribute("color",new bt(i,3)),n=new we({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0}),Me.call(this,r,n),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.onBeforeRender()}function ei(t,e){this.light=t,this.light.updateMatrixWorld();var r=new nr(e,4,2),n=new Ot({wireframe:!0,fog:!1});n.color.copy(this.light.color),Rt.call(this,r,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function ri(t){ot.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,t=new we({color:t.color});var e=new St;e.addAttribute("position",new lt(new Float32Array(15),3)),this.add(new Se(e,t)),this.update()}function ni(t,e){ot.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var r=new ze(e);r.rotateY(.5*Math.PI);var n=new Ot({vertexColors:2,wireframe:!0}),i=r.getAttribute("position"),i=new Float32Array(3*i.count);r.addAttribute("color",new lt(i,3)),this.add(new Rt(r,n)),this.update()}function ii(t,e,r,n){t=t||10,e=e||10,r=new $(void 0!==r?r:4473924),n=new $(void 0!==n?n:8947848);var i=e/2,o=t/e,s=t/2;t=[];for(var a=[],c=0,u=0,h=-s;c<=e;c++,h+=o){t.push(-s,0,h,s,0,h),t.push(h,0,-s,h,0,s);var l=c===i?r:n;l.toArray(a,u),u+=3,l.toArray(a,u),u+=3,l.toArray(a,u),u+=3,l.toArray(a,u),u+=3}(e=new St).addAttribute("position",new bt(t,3)),e.addAttribute("color",new bt(a,3)),r=new we({vertexColors:2}),Me.call(this,e,r)}function oi(t,e,r,n,i,o){t=t||10,e=e||16,r=r||8,n=n||64,i=new $(void 0!==i?i:4473924),o=new $(void 0!==o?o:8947848);var s,a,c,u,h,l=[],p=[];for(c=0;c<=e;c++)a=c/e*2*Math.PI,s=Math.sin(a)*t,a=Math.cos(a)*t,l.push(0,0,0),l.push(s,0,a),h=1&c?i:o,p.push(h.r,h.g,h.b),p.push(h.r,h.g,h.b);for(c=0;c<=r;c++)for(h=1&c?i:o,u=t-t/r*c,e=0;e<n;e++)a=e/n*2*Math.PI,s=Math.sin(a)*u,a=Math.cos(a)*u,l.push(s,0,a),p.push(h.r,h.g,h.b),a=(e+1)/n*2*Math.PI,s=Math.sin(a)*u,a=Math.cos(a)*u,l.push(s,0,a),p.push(h.r,h.g,h.b);(t=new St).addAttribute("position",new bt(l,3)),t.addAttribute("color",new bt(p,3)),l=new we({vertexColors:2}),Me.call(this,t,l)}function si(t,e,r,n){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16776960,n=void 0!==n?n:1,e=0,(r=this.object.geometry)&&r.isGeometry?e=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new St,e=new bt(6*e,3),r.addAttribute("position",e),Me.call(this,r,new we({color:t,linewidth:n})),this.matrixAutoUpdate=!1,this.update()}function ai(t,e){ot.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var r=new St;r.addAttribute("position",new bt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var n=new we({fog:!1});this.add(new Se(r,n)),(r=new St).addAttribute("position",new bt([0,0,0,0,0,1],3)),this.add(new Se(r,n)),this.update()}function ci(t){function e(t,e,n){r(t,n),r(e,n)}function r(t,e){o.push(0,0,0),s.push(e.r,e.g,e.b),void 0===a[t]&&(a[t]=[]),a[t].push(o.length/3-1)}var n=new St,i=new we({color:16777215,vertexColors:1}),o=[],s=[],a={},c=new $(16755200),u=new $(16711680),h=new $(43775),l=new $(16777215),p=new $(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",u),e("p","n2",u),e("p","n3",u),e("p","n4",u),e("u1","u2",h),e("u2","u3",h),e("u3","u1",h),e("c","t",l),e("p","c",p),e("cn1","cn2",p),e("cn3","cn4",p),e("cf1","cf2",p),e("cf3","cf4",p),n.addAttribute("position",new bt(o,3)),n.addAttribute("color",new bt(s,3)),Me.call(this,n,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function ui(t,e){this.object=t,void 0===e&&(e=16776960);var r=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]),n=new Float32Array(24),i=new St;i.setIndex(new lt(r,1)),i.addAttribute("position",new lt(n,3)),Me.call(this,i,new we({color:e})),this.matrixAutoUpdate=!1,this.update()}function hi(t,e,r,n,i,o){ot.call(this),void 0===n&&(n=16776960),void 0===r&&(r=1),void 0===i&&(i=.2*r),void 0===o&&(o=.2*i),void 0===Qi&&((Qi=new St).addAttribute("position",new bt([0,0,0,0,1,0],3)),(to=new pr(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new Se(Qi,new we({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Rt(to,new Ot({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(r,i,o)}function li(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t];(t=new St).addAttribute("position",new bt(e,3)),t.addAttribute("color",new bt([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),e=new we({vertexColors:2}),Me.call(this,t,e)}function pi(){var t=0,e=0,r=0,n=0;return{initCatmullRom:function(i,o,s,a,c){t=o,e=i=c*(s-i),r=-3*o+3*s-2*i-(a=c*(a-o)),n=2*o-2*s+i+a},initNonuniformCatmullRom:function(i,o,s,a,c,u,h){t=o,e=i=((o-i)/c-(s-i)/(c+u)+(s-o)/u)*u,r=-3*o+3*s-2*i-(a=((s-o)/u-(a-o)/(u+h)+(a-s)/h)*u),n=2*o-2*s+i+a},calc:function(i){var o=i*i;return t+e*i+r*o+n*o*i}}}function fi(t){this.arcLengthDivisions=200,2>t.length&&console.warn("THREE.CatmullRomCurve3: Points array needs at least two entries."),this.points=t||[],this.closed=!1}function di(t,e,r,n){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r,this.v3=n}function mi(t,e,r){this.arcLengthDivisions=200,this.v0=t,this.v1=e,this.v2=r}function vi(t,e){this.arcLengthDivisions=200,this.v1=t,this.v2=e}function gi(t,e,r,n,i,o){mn.call(this,t,e,r,r,n,i,o)}function yi(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom",this.closed=!0}function bi(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom"}function _i(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),fi.call(this,t),this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0<t?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),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)&&(e[i]=n[i])}return e}),Object.assign(e.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var n=r.indexOf(e);-1!==n&&r.splice(n,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var r=0,n=(e=e.slice(0)).length;r<n;r++)e[r].call(this,t)}}}});var xi={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=Array(36),n=0;return function(){for(var i=0;36>i;i++)8===i||13===i||18===i||23===i?r[i]="-":14===i?r[i]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),t=15&n,n>>=4,r[i]=e[19===i?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,n,i){return n+(t-e)*(i-n)/(r-e)},lerp:function(t,e,r){return(1-r)*t+r*e},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*xi.DEG2RAD},radToDeg:function(t){return t*xi.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.defineProperties(r.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(r.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new r,e=new r;return function(r,n){return t.set(r,r),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return 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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return t=this.y-t.y,e*e+t*t},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*r-o*n+t.x,this.y=i*n+o*r+t.y,this}});var wi=0;n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=300,Object.defineProperty(n.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(n.prototype,e.prototype,{constructor:n,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=xi.generateUUID()),void 0===t.images[r.uuid]){var n,i=t.images,o=r.uuid,s=r.uuid;void 0!==r.toDataURL?n=r:(n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n.width=r.width,n.height=r.height,n.getContext("2d").drawImage(r,0,0,r.width,r.height)),n=2048<n.width||2048<n.height?n.toDataURL("image/jpeg",.6):n.toDataURL("image/png"),i[o]={uuid:s,url:n}}e.image=r.uuid}return t.textures[this.uuid]=e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.multiply(this.repeat),t.add(this.offset),0>t.x||1<t.x)switch(this.wrapS){case 1e3:t.x-=Math.floor(t.x);break;case 1001:t.x=0>t.x?0:1;break;case 1002:t.x=1===Math.abs(Math.floor(t.x)%2)?Math.ceil(t.x)-t.x:t.x-Math.floor(t.x)}if(0>t.y||1<t.y)switch(this.wrapT){case 1e3:t.y-=Math.floor(t.y);break;case 1001:t.y=0>t.y?0:1;break;case 1002:t.y=1===Math.abs(Math.floor(t.y)%2)?Math.ceil(t.y)-t.y:t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(i.prototype,{isVector4:!0,set:function(t,e,r,n){return this.x=t,this.y=e,this.z=r,this.w=n,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){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: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*n+t[12]*i,this.y=t[1]*e+t[5]*r+t[9]*n+t[13]*i,this.z=t[2]*e+t[6]*r+t[10]*n+t[14]*i,this.w=t[3]*e+t[7]*r+t[11]*n+t[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,n,i=(t=t.elements)[0];n=t[4];var o=t[8],s=t[1],a=t[5],c=t[9];r=t[2],e=t[6];var u=t[10];return.01>Math.abs(n-s)&&.01>Math.abs(o-r)&&.01>Math.abs(c-e)?.1>Math.abs(n+s)&&.1>Math.abs(o+r)&&.1>Math.abs(c+e)&&.1>Math.abs(i+a+u-3)?(this.set(1,0,0,0),this):(t=Math.PI,i=(i+1)/2,a=(a+1)/2,u=(u+1)/2,n=(n+s)/4,o=(o+r)/4,c=(c+e)/4,i>a&&i>u?.01>i?(e=0,n=r=.707106781):(e=Math.sqrt(i),r=n/e,n=o/e):a>u?.01>a?(e=.707106781,r=0,n=.707106781):(r=Math.sqrt(a),e=n/r,n=c/r):.01>u?(r=e=.707106781,n=0):(n=Math.sqrt(u),e=o/n,r=c/n),this.set(e,r,n,t),this):(t=Math.sqrt((e-c)*(e-c)+(o-r)*(o-r)+(s-n)*(s-n)),.001>Math.abs(t)&&(t=1),this.x=(e-c)/t,this.y=(o-r)/t,this.z=(s-n)/t,this.w=Math.acos((i+a+u-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,n){return void 0===t&&(t=new i,e=new i),t.set(r,r,r,r),e.set(n,n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return 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),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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)},lengthManhattan: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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(o.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.isWebGLRenderTargetCube=!0,Object.assign(a,{slerp:function(t,e,r,n){return r.copy(t).slerp(e,n)},slerpFlat:function(t,e,r,n,i,o,s){var a=r[n+0],c=r[n+1],u=r[n+2];r=r[n+3],n=i[o+0];var h=i[o+1],l=i[o+2];if(i=i[o+3],r!==i||a!==n||c!==h||u!==l){o=1-s;var p=a*n+c*h+u*l+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,s=Math.sin(s*p)/d),a=a*o+n*(f*=s),c=c*o+h*f,u=u*o+l*f,r=r*o+i*f,o===1-s&&(s=1/Math.sqrt(a*a+c*c+u*u+r*r),a*=s,c*=s,u*=s,r*=s)}t[e]=a,t[e+1]=c,t[e+2]=u,t[e+3]=r}}),Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(a.prototype,{set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=t._x,n=t._y,i=t._z,o=t.order,s=Math.cos,a=Math.sin,c=s(r/2),u=s(n/2),s=s(i/2),r=a(r/2),n=a(n/2),i=a(i/2);return"XYZ"===o?(this._x=r*u*s+c*n*i,this._y=c*n*s-r*u*i,this._z=c*u*i+r*n*s,this._w=c*u*s-r*n*i):"YXZ"===o?(this._x=r*u*s+c*n*i,this._y=c*n*s-r*u*i,this._z=c*u*i-r*n*s,this._w=c*u*s+r*n*i):"ZXY"===o?(this._x=r*u*s-c*n*i,this._y=c*n*s+r*u*i,this._z=c*u*i+r*n*s,this._w=c*u*s-r*n*i):"ZYX"===o?(this._x=r*u*s-c*n*i,this._y=c*n*s+r*u*i,this._z=c*u*i-r*n*s,this._w=c*u*s+r*n*i):"YZX"===o?(this._x=r*u*s+c*n*i,this._y=c*n*s+r*u*i,this._z=c*u*i-r*n*s,this._w=c*u*s-r*n*i):"XZY"===o&&(this._x=r*u*s-c*n*i,this._y=c*n*s-r*u*i,this._z=c*u*i+r*n*s,this._w=c*u*s+r*n*i),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,n=Math.sin(r);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var n=e[8],i=e[1],o=e[5],s=e[9],a=e[2],c=e[6],u=r+o+(e=e[10]);return 0<u?(r=.5/Math.sqrt(u+1),this._w=.25/r,this._x=(c-s)*r,this._y=(n-a)*r,this._z=(i-t)*r):r>o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(c-s)/r,this._x=.25*r,this._y=(t+i)/r,this._z=(n+a)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(n-a)/r,this._x=(t+i)/r,this._y=.25*r,this._z=(s+c)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(i-t)/r,this._x=(n+a)/r,this._y=(s+c)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new c;return function(r,n){return void 0===e&&(e=new c),1e-6>(t=r.dot(n)+1)?(t=0,Math.abs(r.x)>Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var r=t._x,n=t._y,i=t._z,o=t._w,s=e._x,a=e._y,c=e._z,u=e._w;return this._x=r*u+o*s+n*c-i*a,this._y=n*u+o*a+i*s-r*c,this._z=i*u+o*c+r*a-n*s,this._w=o*u-r*s-n*a-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,n=this._y,i=this._z,o=this._w;if(0>(a=o*t._w+r*t._x+n*t._y+i*t._z)?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=o,this._x=r,this._y=n,this._z=i,this;c=Math.sqrt(1-a*a);if(.001>Math.abs(c))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(n+this._y),this._z=.5*(i+this._z),this;var s=Math.atan2(c,a),a=Math.sin((1-e)*s)/c,c=Math.sin(e*s)/c;return this._w=o*a+this._w*c,this._x=r*a+this._x*c,this._y=n*a+this._y*c,this._z=i*a+this._z*c,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(c.prototype,{isVector3:!0,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new a;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new a;return function(e,r){return this.applyQuaternion(t.setFromAxisAngle(e,r))}}(),applyMatrix3:function(t){var e=this.x,r=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*n,this.y=t[1]*e+t[4]*r+t[7]*n,this.z=t[2]*e+t[5]*r+t[8]*n,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=1/((t=t.elements)[3]*e+t[7]*r+t[11]*n+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*n+t[12])*i,this.y=(t[1]*e+t[5]*r+t[9]*n+t[13])*i,this.z=(t[2]*e+t[6]*r+t[10]*n+t[14])*i,this},applyQuaternion:function(t){var e=this.x,r=this.y,n=this.z,i=t.x,o=t.y,s=t.z,a=(t=t.w)*e+o*n-s*r,c=t*r+s*e-i*n,u=t*n+i*r-o*e,e=-i*e-o*r-s*n;return this.x=a*t+e*-i+c*-s-u*-o,this.y=c*t+e*-o+u*-i-a*-s,this.z=u*t+e*-s+a*-o-c*-i,this},project:function(){var t=new u;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new u;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*n,this.y=t[1]*e+t[5]*r+t[9]*n,this.z=t[2]*e+t[6]*r+t[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new c,e=new c;return function(r,n){return t.set(r,r,r),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return 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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,n=this.y,i=this.z;return this.x=n*t.z-i*t.y,this.y=i*t.x-r*t.z,this.z=r*t.y-n*t.x,this},crossVectors:function(t,e){var r=t.x,n=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-i*s,this.y=i*o-r*a,this.z=r*s-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new c;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new c;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(xi.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return t=this.z-t.z,e*e+r*r+t*t},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return t=t.elements,this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length();return t=this.setFromMatrixColumn(t,2).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(u.prototype,{isMatrix4:!0,set:function(t,e,r,n,i,o,s,a,c,u,h,l,p,f,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=n,v[1]=i,v[5]=o,v[9]=s,v[13]=a,v[2]=c,v[6]=u,v[10]=h,v[14]=l,v[3]=p,v[7]=f,v[11]=d,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new u).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t=new c;return function(e){var r=this.elements,n=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length();return e=1/t.setFromMatrixColumn(e,2).length(),r[0]=n[0]*i,r[1]=n[1]*i,r[2]=n[2]*i,r[4]=n[4]*o,r[5]=n[5]*o,r[6]=n[6]*o,r[8]=n[8]*e,r[9]=n[9]*e,r[10]=n[10]*e,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,n=t.y,i=t.z,o=Math.cos(r),r=Math.sin(r),s=Math.cos(n),n=Math.sin(n),a=Math.cos(i),i=Math.sin(i);if("XYZ"===t.order){t=o*a;var c=o*i,u=r*a,h=r*i;e[0]=s*a,e[4]=-s*i,e[8]=n,e[1]=c+u*n,e[5]=t-h*n,e[9]=-r*s,e[2]=h-t*n,e[6]=u+c*n,e[10]=o*s}else"YXZ"===t.order?(t=s*a,c=s*i,u=n*a,h=n*i,e[0]=t+h*r,e[4]=u*r-c,e[8]=o*n,e[1]=o*i,e[5]=o*a,e[9]=-r,e[2]=c*r-u,e[6]=h+t*r,e[10]=o*s):"ZXY"===t.order?(t=s*a,c=s*i,u=n*a,h=n*i,e[0]=t-h*r,e[4]=-o*i,e[8]=u+c*r,e[1]=c+u*r,e[5]=o*a,e[9]=h-t*r,e[2]=-o*n,e[6]=r,e[10]=o*s):"ZYX"===t.order?(t=o*a,c=o*i,u=r*a,h=r*i,e[0]=s*a,e[4]=u*n-c,e[8]=t*n+h,e[1]=s*i,e[5]=h*n+t,e[9]=c*n-u,e[2]=-n,e[6]=r*s,e[10]=o*s):"YZX"===t.order?(t=o*s,c=o*n,u=r*s,h=r*n,e[0]=s*a,e[4]=h-t*i,e[8]=u*i+c,e[1]=i,e[5]=o*a,e[9]=-r*a,e[2]=-n*a,e[6]=c*i+u,e[10]=t-h*i):"XZY"===t.order&&(t=o*s,c=o*n,u=r*s,h=r*n,e[0]=s*a,e[4]=-i,e[8]=n*a,e[1]=t*i+h,e[5]=o*a,e[9]=c*i-u,e[2]=u*i-c,e[6]=r*a,e[10]=h*i+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t._x,n=t._y,i=t._z,o=t._w,s=i+i;t=r*(u=r+r);var a=r*(h=n+n),r=r*s,c=n*h,n=n*s,i=i*s,u=o*u,h=o*h,o=o*s;return e[0]=1-(c+i),e[4]=a-o,e[8]=r+h,e[1]=a+o,e[5]=1-(t+i),e[9]=n-u,e[2]=r-h,e[6]=n+u,e[10]=1-(t+c),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new c,e=new c,r=new c;return function(n,i,o){var s=this.elements;return r.subVectors(n,i),0===r.lengthSq()&&(r.z=1),r.normalize(),t.crossVectors(o,r),0===t.lengthSq()&&(1===Math.abs(o.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),t.crossVectors(o,r)),t.normalize(),e.crossVectors(r,t),s[0]=t.x,s[4]=e.x,s[8]=r.x,s[1]=t.y,s[5]=e.y,s[9]=r.y,s[2]=t.z,s[6]=e.z,s[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,o=r[0],s=r[4],a=r[8],c=r[12],u=r[1],h=r[5],l=r[9],p=r[13],f=r[2],d=r[6],m=r[10],v=r[14],g=r[3],y=r[7],b=r[11],r=r[15],_=n[0],x=n[4],w=n[8],S=n[12],M=n[1],E=n[5],T=n[9],C=n[13],O=n[2],P=n[6],A=n[10],j=n[14],R=n[3],L=n[7],N=n[11],n=n[15];return i[0]=o*_+s*M+a*O+c*R,i[4]=o*x+s*E+a*P+c*L,i[8]=o*w+s*T+a*A+c*N,i[12]=o*S+s*C+a*j+c*n,i[1]=u*_+h*M+l*O+p*R,i[5]=u*x+h*E+l*P+p*L,i[9]=u*w+h*T+l*A+p*N,i[13]=u*S+h*C+l*j+p*n,i[2]=f*_+d*M+m*O+v*R,i[6]=f*x+d*E+m*P+v*L,i[10]=f*w+d*T+m*A+v*N,i[14]=f*S+d*C+m*j+v*n,i[3]=g*_+y*M+b*O+r*R,i[7]=g*x+y*E+b*P+r*L,i[11]=g*w+y*T+b*A+r*N,i[15]=g*S+y*C+b*j+r*n,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var r=0,n=e.count;r<n;r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix4(this),e.setXYZ(r,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],r=t[4],n=t[8],i=t[12],o=t[1],s=t[5],a=t[9],c=t[13],u=t[2],h=t[6],l=t[10],p=t[14];return t[3]*(+i*a*h-n*c*h-i*s*l+r*c*l+n*s*p-r*a*p)+t[7]*(+e*a*p-e*c*l+i*o*l-n*o*p+n*c*u-i*a*u)+t[11]*(+e*c*h-e*s*p-i*o*h+r*o*p+i*s*u-r*c*u)+t[15]*(-n*s*u-e*a*h+e*s*l+n*o*h-r*o*l+r*a*u)},transpose:function(){var t,e=this.elements;return 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,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,n=t.elements,i=n[0],o=n[1],s=n[2],a=n[3],c=n[4],u=n[5],h=n[6],l=n[7],p=n[8],f=n[9],d=n[10],m=n[11],v=n[12],g=n[13],y=n[14],b=f*y*l-g*d*l+g*h*m-u*y*m-f*h*(n=n[15])+u*d*n,_=v*d*l-p*y*l-v*h*m+c*y*m+p*h*n-c*d*n,x=p*g*l-v*f*l+v*u*m-c*g*m-p*u*n+c*f*n,w=v*f*h-p*g*h-v*u*d+c*g*d+p*u*y-c*f*y,S=i*b+o*_+s*x+a*w;if(0===S){if(!0===e)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return S=1/S,r[0]=b*S,r[1]=(g*d*a-f*y*a-g*s*m+o*y*m+f*s*n-o*d*n)*S,r[2]=(u*y*a-g*h*a+g*s*l-o*y*l-u*s*n+o*h*n)*S,r[3]=(f*h*a-u*d*a-f*s*l+o*d*l+u*s*m-o*h*m)*S,r[4]=_*S,r[5]=(p*y*a-v*d*a+v*s*m-i*y*m-p*s*n+i*d*n)*S,r[6]=(v*h*a-c*y*a-v*s*l+i*y*l+c*s*n-i*h*n)*S,r[7]=(c*d*a-p*h*a+p*s*l-i*d*l-c*s*m+i*h*m)*S,r[8]=x*S,r[9]=(v*f*a-p*g*a-v*o*m+i*g*m+p*o*n-i*f*n)*S,r[10]=(c*g*a-v*u*a+v*o*l-i*g*l-c*o*n+i*u*n)*S,r[11]=(p*u*a-c*f*a-p*o*l+i*f*l+c*o*m-i*u*m)*S,r[12]=w*S,r[13]=(p*g*s-v*f*s+v*o*d-i*g*d-p*o*y+i*f*y)*S,r[14]=(v*u*s-c*g*s-v*o*h+i*g*h+c*o*y-i*u*y)*S,r[15]=(c*f*s-p*u*s+p*o*h-i*f*h-c*o*d+i*u*d)*S,this},scale:function(t){var e=this.elements,r=t.x,n=t.y;return t=t.z,e[0]*=r,e[4]*=n,e[8]*=t,e[1]*=r,e[5]*=n,e[9]*=t,e[2]*=r,e[6]*=n,e[10]*=t,e[3]*=r,e[7]*=n,e[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=1-r,o=t.x,s=t.y,a=t.z,c=i*o,u=i*s;return this.set(c*o+r,c*s-n*a,c*a+n*s,0,c*s+n*a,u*s+r,u*a-n*o,0,c*a-n*s,u*a+n*o,i*a*a+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(t,e,r){return this.set(1,e,r,0,t,1,r,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t=new c,e=new u;return function(r,n,i){var o=this.elements,s=t.set(o[0],o[1],o[2]).length(),a=t.set(o[4],o[5],o[6]).length(),c=t.set(o[8],o[9],o[10]).length();0>this.determinant()&&(s=-s),r.x=o[12],r.y=o[13],r.z=o[14],e.copy(this),r=1/s;var o=1/a,u=1/c;return e.elements[0]*=r,e.elements[1]*=r,e.elements[2]*=r,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=u,e.elements[9]*=u,e.elements[10]*=u,n.setFromRotationMatrix(e),i.x=s,i.y=a,i.z=c,this}}(),makePerspective:function(t,e,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 s=this.elements;return s[0]=2*i/(e-t),s[4]=0,s[8]=(e+t)/(e-t),s[12]=0,s[1]=0,s[5]=2*i/(r-n),s[9]=(r+n)/(r-n),s[13]=0,s[2]=0,s[6]=0,s[10]=-(o+i)/(o-i),s[14]=-2*o*i/(o-i),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this},makeOrthographic:function(t,e,r,n,i,o){var s=this.elements,a=1/(e-t),c=1/(r-n),u=1/(o-i);return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-(e+t)*a,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-(r+n)*c,s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-(o+i)*u,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;16>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;16>r;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}}),h.prototype=Object.create(n.prototype),h.prototype.constructor=h,h.prototype.isDataTexture=!0,(l.prototype=Object.create(n.prototype)).constructor=l,l.prototype.isCubeTexture=!0,Object.defineProperty(l.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Si=new n,Mi=new l,Ei=[],Ti=[],Ci=new Float32Array(16),Oi=new Float32Array(9);z.prototype.setValue=function(t,e){for(var r=this.seq,n=0,i=r.length;n!==i;++n){var o=r[n];o.setValue(t,e[o.id])}};var Pi=/([\w\d_]+)(\])?(\[|\.)?/g;G.prototype.setValue=function(t,e,r){void 0!==(e=this.map[e])&&e.setValue(t,r,this.renderer)},G.prototype.setOptional=function(t,e,r){void 0!==(e=e[r])&&this.setValue(t,r,e)},G.upload=function(t,e,r,n){for(var i=0,o=e.length;i!==o;++i){var s=e[i],a=r[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,n)}},G.seqWithValue=function(t,e){for(var r=[],n=0,i=t.length;n!==i;++n){var o=t[n];o.id in e&&r.push(o)}return r};var Ai={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,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};Object.assign($.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.b=this.g=this.r=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return 0>r&&(r+=1),1<r&&--r,r<1/6?t+6*(e-t)*r:.5>r?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,n){return e=xi.euclideanModulo(e,1),r=xi.clamp(r,0,1),n=xi.clamp(n,0,1),0===r?this.r=this.g=this.b=n:(r=.5>=n?n*(1+r):n+r-n*r,n=2*n-r,this.r=t(n,r,e+1/3),this.g=t(n,r,e),this.b=t(n,r,e-1/3)),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)){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)){var n=parseFloat(r[1])/360,i=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(n,i,o)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(r=r[1],3===(n=r.length))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&&(void 0!==(r=Ai[t])?this.setHex(r):console.warn("THREE.Color: Unknown color "+t)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=0<e?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),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(t){t=t||{h:0,s:0,l:0};var e,r=this.r,n=this.g,i=this.b,o=Math.max(r,n,i),s=((c=Math.min(r,n,i))+o)/2;if(c===o)c=e=0;else{var a=o-c,c=.5>=s?a/(o+c):a/(2-o-c);switch(o){case r:e=(n-i)/a+(n<i?6:0);break;case n:e=(i-r)/a+2;break;case i:e=(r-n)/a+4}e/=6}return t.h=e,t.s=c,t.l=s,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var n=this.getHSL();return n.h+=t,n.s+=e,n.l+=r,this.setHSL(n.h,n.s,n.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var ji={common:{diffuse:{value:new $(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new i(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},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 r(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 $(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new $(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new i(0,0,1,1)}}},Ri={merge:function(t){for(var e={},r=0;r<t.length;r++){var n,i=this.clone(t[r]);for(n in i)e[n]=i[n]}return e},clone:function(t){var e,r={};for(e in t){r[e]={};for(var n in t[e]){var i=t[e][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?r[e][n]=i.clone():Array.isArray(i)?r[e][n]=i.slice():r[e][n]=i}}return r}},Li={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",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( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\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}\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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, 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_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 theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\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.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - 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 * transpose( 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\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\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\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\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",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\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",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#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(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}\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};\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 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:"  gl_FragColor = linearToOutputTexel( gl_FragColor );\n",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.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\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.w );\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.w );\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.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, 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.x, max( value.g, value.b ) );\n\tfloat D      = max( maxRange / maxRGB, 1.0 );\n\tD            = min( floor( D ) / 255.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 = value.rgb * cLogLuvM;\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 = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = asin( flipNormal * reflectVec.y ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * 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\tenvColor = envMapTexelToLinear( envColor );\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\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n  varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\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\n",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\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",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 = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\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#endif\n#if NUM_SPOT_LIGHTS > 0\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#endif\n#if NUM_DIR_LIGHTS > 0\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#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\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 ltcMat;\tuniform sampler2D ltcMag;\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\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\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\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 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 blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, 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\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\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\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",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\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#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\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3(   1,   0, t.y ),\n\t\t\tvec3(   0, t.z,   0 ),\n\t\t\tvec3( t.w,   0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), 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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * 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 ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\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 += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#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 ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\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\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\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}\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}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n  gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\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 ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\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\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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 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\n",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\n",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#endif\n",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  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\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}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.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#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\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>\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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\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>\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}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\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 <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\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_pars_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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * 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 <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\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}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\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_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\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 <normal_flip>\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}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\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>\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}\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_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\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_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\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}\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}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\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_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\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}\n",meshphysical_vert:"#define PHYSICAL\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}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\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>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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>\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#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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_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 <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#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}\n"},Ni={basic:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.fog]),vertexShader:Li.meshbasic_vert,fragmentShader:Li.meshbasic_frag},lambert:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.fog,ji.lights,{emissive:{value:new $(0)}}]),vertexShader:Li.meshlambert_vert,fragmentShader:Li.meshlambert_frag},phong:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.bumpmap,ji.normalmap,ji.displacementmap,ji.gradientmap,ji.fog,ji.lights,{emissive:{value:new $(0)},specular:{value:new $(1118481)},shininess:{value:30}}]),vertexShader:Li.meshphong_vert,fragmentShader:Li.meshphong_frag},standard:{uniforms:Ri.merge([ji.common,ji.aomap,ji.lightmap,ji.emissivemap,ji.bumpmap,ji.normalmap,ji.displacementmap,ji.roughnessmap,ji.metalnessmap,ji.fog,ji.lights,{emissive:{value:new $(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag},points:{uniforms:Ri.merge([ji.points,ji.fog]),vertexShader:Li.points_vert,fragmentShader:Li.points_frag},dashed:{uniforms:Ri.merge([ji.common,ji.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Li.linedashed_vert,fragmentShader:Li.linedashed_frag},depth:{uniforms:Ri.merge([ji.common,ji.displacementmap]),vertexShader:Li.depth_vert,fragmentShader:Li.depth_frag},normal:{uniforms:Ri.merge([ji.common,ji.bumpmap,ji.normalmap,ji.displacementmap,{opacity:{value:1}}]),vertexShader:Li.normal_vert,fragmentShader:Li.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Li.cube_vert,fragmentShader:Li.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Li.equirect_vert,fragmentShader:Li.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new c}},vertexShader:Li.distanceRGBA_vert,fragmentShader:Li.distanceRGBA_frag}};Ni.physical={uniforms:Ri.merge([Ni.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag},Object.assign(V.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new r;return function(e,r){var n=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return t=t||new r,this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return t=t||new r,this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new r).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new r).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Ii=0;Object.assign(W.prototype,e.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0===r)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else{var n=this[e];void 0===n?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[e]="overdraw"===e?Number(r):r}}},toJSON:function(t){function e(t){var e,r=[];for(e in t){var n=t[e];delete n.metadata,r.push(n)}return r}var r=void 0===t;r&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};return 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.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),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.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),2!==this.shading&&(n.shading=this.shading),0!==this.side&&(n.side=this.side),0!==this.vertexColors&&(n.vertexColors=this.vertexColors),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,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),n.skinning=this.skinning,n.morphTargets=this.morphTargets,n.dithering=this.dithering,r&&(r=e(t.textures),t=e(t.images),0<r.length&&(n.textures=r),0<t.length&&(n.images=t)),n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;r=null;if(null!==(t=t.clippingPlanes))for(var e=t.length,r=Array(e),n=0;n!==e;++n)r[n]=t[n].clone();return this.clippingPlanes=r,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),X.prototype=Object.create(W.prototype),X.prototype.constructor=X,X.prototype.isShaderMaterial=!0,X.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ri.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},X.prototype.toJSON=function(t){return t=W.prototype.toJSON.call(this,t),t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},Y.prototype=Object.create(W.prototype),Y.prototype.constructor=Y,Y.prototype.isMeshDepthMaterial=!0,Y.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(K.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-1/0,a=0,c=t.length;a<c;a+=3){var u=t[a],h=t[a+1],l=t[a+2];u<e&&(e=u),h<r&&(r=h),l<n&&(n=l),u>i&&(i=u),h>o&&(o=h),l>s&&(s=l)}return this.min.set(e,r,n),this.max.set(i,o,s),this},setFromBufferAttribute:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-1/0,a=0,c=t.count;a<c;a++){var u=t.getX(a),h=t.getY(a),l=t.getZ(a);u<e&&(e=u),h<r&&(r=h),l<n&&(n=l),u>i&&(i=u),h>o&&(o=h),l>s&&(s=l)}return this.min.set(e,r,n),this.max.set(i,o,s),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new c;return function(e,r){var n=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return t=t||new c,this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return t=t||new c,this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new c;return function(e){var r=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var n,i;if(void 0!==(n=e.geometry))if(n.isGeometry){var o=n.vertices;for(n=0,i=o.length;n<i;n++)t.copy(o[n]),t.applyMatrix4(e.matrixWorld),r.expandByPoint(t)}else if(n.isBufferGeometry&&void 0!==(o=n.attributes.position))for(n=0,i=o.count;n<i;n++)t.fromBufferAttribute(o,n).applyMatrix4(e.matrixWorld),r.expandByPoint(t)}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new c).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t=new c;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return 0<t.normal.x?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),0<t.normal.y?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},clampPoint:function(t,e){return(e||new c).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new c;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new c;return function(e){return e=e||new Z,this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new c,new c,new c,new c,new c,new c,new c,new c];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Z.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new K;return function(e,r){var n=this.center;void 0!==r?n.copy(r):t.setFromPoints(e).getCenter(n);for(var i=0,o=0,s=e.length;o<s;o++)i=Math.max(i,n.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),n=e||new c;return n.copy(t),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){return(t=t||new K).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(J.prototype,{isMatrix3:!0,set:function(t,e,r,n,i,o,s,a,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=s,u[3]=e,u[4]=i,u[5]=a,u[6]=r,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},setFromMatrix4:function(t){return t=t.elements,this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var t=new c;return function(e){for(var r=0,n=e.count;r<n;r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix3(this),e.setXYZ(r,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,o=r[0],s=r[3],a=r[6],c=r[1],u=r[4],h=r[7],l=r[2],p=r[5],r=r[8],f=n[0],d=n[3],m=n[6],v=n[1],g=n[4],y=n[7],b=n[2],_=n[5],n=n[8];return i[0]=o*f+s*v+a*b,i[3]=o*d+s*g+a*_,i[6]=o*m+s*y+a*n,i[1]=c*f+u*v+h*b,i[4]=c*d+u*g+h*_,i[7]=c*m+u*y+h*n,i[2]=l*f+p*v+r*b,i[5]=l*d+p*g+r*_,i[8]=l*m+p*y+r*n,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],c=t[7];return e*o*(t=t[8])-e*s*c-r*i*t+r*s*a+n*i*c-n*o*a},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var r=t.elements,n=this.elements,i=r[0],o=r[1],s=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],p=(r=r[8])*c-u*l,f=u*h-r*a,d=l*a-c*h,m=i*p+o*f+s*d;if(0===m){if(!0===e)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return m=1/m,n[0]=p*m,n[1]=(s*l-r*o)*m,n[2]=(u*o-s*c)*m,n[3]=f*m,n[4]=(r*i-s*h)*m,n[5]=(s*a-u*i)*m,n[6]=d*m,n[7]=(o*h-l*i)*m,n[8]=(c*i-o*a)*m,this},transpose:function(){var t,e=this.elements;return 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,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;9>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;9>r;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}}),Object.assign(Q.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,n){return this.normal.set(t,e,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new c,e=new c;return function(r,n,i){return n=t.subVectors(i,n).cross(e.subVectors(r,n)).normalize(),this.setFromNormalAndCoplanarPoint(n,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new c).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new c;return function(e,r){var n=r||new c,i=e.delta(t),o=this.normal.dot(i);return 0!==o?0>(o=-(e.start.dot(this.normal)+this.constant)/o)||1<o?void 0:n.copy(i).multiplyScalar(o).add(e.start):0===this.distanceToPoint(e.start)?n.copy(e.start):void 0}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start);return t=this.distanceToPoint(t.end),0>e&&0<t||0>t&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new c).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new c,e=new J;return function(r,n){var i=this.coplanarPoint(t).applyMatrix4(r),o=n||e.getNormalMatrix(r),o=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(o),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(tt.prototype,{set:function(t,e,r,n,i,o){var s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(r),s[3].copy(n),s[4].copy(i),s[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;6>r;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(v=t.elements)[0];var r=v[1],n=v[2],i=v[3],o=v[4],s=v[5],a=v[6],c=v[7],u=v[8],h=v[9],l=v[10],p=v[11],f=v[12],d=v[13],m=v[14],v=v[15];return e[0].setComponents(i-t,c-o,p-u,v-f).normalize(),e[1].setComponents(i+t,c+o,p+u,v+f).normalize(),e[2].setComponents(i+r,c+s,p+h,v+d).normalize(),e[3].setComponents(i-r,c-s,p-h,v-d).normalize(),e[4].setComponents(i-n,c-a,p-l,v-m).normalize(),e[5].setComponents(i+n,c+a,p+l,v+m).normalize(),this},intersectsObject:function(){var t=new Z;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new Z;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var n=0;6>n;n++)if(e[n].distanceToPoint(r)<t)return!1;return!0},intersectsBox:function(){var t=new c,e=new c;return function(r){for(var n=this.planes,i=0;6>i;i++){s=n[i];t.x=0<s.normal.x?r.min.x:r.max.x,e.x=0<s.normal.x?r.max.x:r.min.x,t.y=0<s.normal.y?r.min.y:r.max.y,e.y=0<s.normal.y?r.max.y:r.min.y,t.z=0<s.normal.z?r.min.z:r.max.z,e.z=0<s.normal.z?r.max.z:r.min.z;var o=s.distanceToPoint(t),s=s.distanceToPoint(e);if(0>o&&0>s)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;6>r;r++)if(0>e[r].distanceToPoint(t))return!1;return!0}}),nt.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),nt.DefaultOrder="XYZ",Object.defineProperties(nt.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(nt.prototype,{isEuler:!0,set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var n=xi.clamp;t=(l=t.elements)[0];var i=l[4],o=l[8],s=l[1],a=l[5],c=l[9],u=l[2],h=l[6],l=l[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-c,l),this._z=Math.atan2(-i,t)):(this._x=Math.atan2(h,a),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(c,-1,1)),.99999>Math.abs(c)?(this._y=Math.atan2(o,l),this._z=Math.atan2(s,a)):(this._y=Math.atan2(-u,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(-u,l),this._z=Math.atan2(-i,a)):(this._y=0,this._z=Math.atan2(s,t))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(h,l),this._z=Math.atan2(s,t)):(this._x=0,this._z=Math.atan2(-i,a))):"YZX"===e?(this._z=Math.asin(n(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(-c,a),this._y=Math.atan2(-u,t)):(this._x=0,this._y=Math.atan2(o,l))):"XZY"===e?(this._z=Math.asin(-n(i,-1,1)),.99999>Math.abs(i)?(this._x=Math.atan2(h,a),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-c,l),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new u;return function(e,r,n){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new a;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(it.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask=this.mask|1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Di=0;ot.DefaultUp=new c(0,1,0),ot.DefaultMatrixAutoUpdate=!0,Object.assign(ot.prototype,e.prototype,{isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new a;return function(e,r){return t.setFromAxisAngle(e,r),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new c(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new c(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new c(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new c;return function(e,r){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(r)),this}}(),translateX:function(){var t=new c(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new c(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new c(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new u;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new u;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}return-1!==(e=this.children.indexOf(t))&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r].getObjectByProperty(t,e);if(void 0!==i)return i}},getWorldPosition:function(t){return t=t||new c,this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new c,e=new c;return function(r){return r=r||new a,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new a;return function(e){return e=e||new nt,this.getWorldQuaternion(t),e.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new c,e=new a;return function(r){return r=r||new c,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new a;return function(e){return e=e||new c,this.getWorldQuaternion(t),e.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].updateMatrixWorld(t)},toJSON:function(t){function e(e,r){return void 0===e[r.uuid]&&(e[r.uuid]=r.toJSON(t)),r.uuid}function r(t){var e,r=[];for(e in t){var n=t[e];delete n.metadata,r.push(n)}return r}var n=void 0===t||""===t,i={};n&&(t={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var o={};if(o.uuid=this.uuid,o.type=this.type,""!==this.name&&(o.name=this.name),"{}"!==JSON.stringify(this.userData)&&(o.userData=this.userData),!0===this.castShadow&&(o.castShadow=!0),!0===this.receiveShadow&&(o.receiveShadow=!0),!1===this.visible&&(o.visible=!1),o.matrix=this.matrix.toArray(),void 0!==this.geometry&&(o.geometry=e(t.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var s=[],a=0,c=this.material.length;a<c;a++)s.push(e(t.materials,this.material[a]));o.material=s}else o.material=e(t.materials,this.material);if(0<this.children.length)for(o.children=[],a=0;a<this.children.length;a++)o.children.push(this.children[a].toJSON(t).object);return n&&(n=r(t.geometries),s=r(t.materials),a=r(t.textures),c=r(t.images),0<n.length&&(i.geometries=n),0<s.length&&(i.materials=s),0<a.length&&(i.textures=a),0<c.length&&(i.images=c)),i.object=o,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++)this.add(t.children[r].clone());return this}}),st.prototype=Object.assign(Object.create(ot.prototype),{constructor:st,isCamera:!0,copy:function(t,e){return ot.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new a;return function(e){return e=e||new c,this.getWorldQuaternion(t),e.set(0,0,-1).applyQuaternion(t)}}(),updateMatrixWorld:function(t){ot.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),at.prototype=Object.assign(Object.create(st.prototype),{constructor:at,isOrthographicCamera:!0,copy:function(t,e){return st.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,r,n,i,o){this.view={fullWidth:t,fullHeight:e,offsetX:r,offsetY:n,width:i,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(n=(this.right+this.left)/2)-t,n=n+t,t=(o=(this.top+this.bottom)/2)+e,e=o-e;if(null!==this.view)var n=this.zoom/(this.view.width/this.view.fullWidth),e=this.zoom/(this.view.height/this.view.fullHeight),i=(this.right-this.left)/this.view.width,o=(this.top-this.bottom)/this.view.height,r=r+this.view.offsetX/n*i,n=r+this.view.width/n*i,t=t-this.view.offsetY/e*o,e=t-this.view.height/e*o;this.projectionMatrix.makeOrthographic(r,n,t,e,this.near,this.far)},toJSON:function(t){return t=ot.prototype.toJSON.call(this,t),t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),ct.prototype=Object.assign(Object.create(st.prototype),{constructor:ct,isPerspectiveCamera:!0,copy:function(t,e){return st.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){t=.5*this.getFilmHeight()/t,this.fov=2*xi.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*xi.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*xi.RAD2DEG*Math.atan(Math.tan(.5*xi.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(t,e,r,n,i,o){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:r,offsetY:n,width:i,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=2*(s=t*Math.tan(.5*xi.DEG2RAD*this.fov)/this.zoom),r=-.5*(a=this.aspect*e),n=this.view;if(null!==n)var i=n.fullWidth,o=n.fullHeight,r=r+n.offsetX*a/i,s=s-n.offsetY*e/o,a=n.width/i*a,e=n.height/o*e;0!==(n=this.filmOffset)&&(r+=t*n/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+a,s,s-e,t,this.far)},toJSON:function(t){return t=ot.prototype.toJSON.call(this,t),t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),Object.assign(ut.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var ki=0;Object.assign(ht.prototype,e.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new J).getNormalMatrix(t),r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(t);for(r=0,n=this.faces.length;r<n;r++){(t=this.faces[r]).normal.applyMatrix3(e).normalize();for(var i=0,o=t.vertexNormals.length;i<o;i++)t.vertexNormals[i].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:function(){var t=new u;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new u;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new u;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new u;return function(e,r,n){return t.makeTranslation(e,r,n),this.applyMatrix(t),this}}(),scale:function(){var t=new u;return function(e,r,n){return t.makeScale(e,r,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new ot;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,r,i){i=new ut(t,e,r,void 0!==a?[p[t].clone(),p[e].clone(),p[r].clone()]:[],void 0!==u?[n.colors[t].clone(),n.colors[e].clone(),n.colors[r].clone()]:[],i),n.faces.push(i),void 0!==h&&n.faceVertexUvs[0].push([f[t].clone(),f[e].clone(),f[r].clone()]),void 0!==l&&n.faceVertexUvs[1].push([d[t].clone(),d[e].clone(),d[r].clone()])}var n=this,i=null!==t.index?t.index.array:void 0,o=t.attributes,s=o.position.array,a=void 0!==o.normal?o.normal.array:void 0,u=void 0!==o.color?o.color.array:void 0,h=void 0!==o.uv?o.uv.array:void 0,l=void 0!==o.uv2?o.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var p=[],f=[],d=[],m=o=0;o<s.length;o+=3,m+=2)n.vertices.push(new c(s[o],s[o+1],s[o+2])),void 0!==a&&p.push(new c(a[o],a[o+1],a[o+2])),void 0!==u&&n.colors.push(new $(u[o],u[o+1],u[o+2])),void 0!==h&&f.push(new r(h[m],h[m+1])),void 0!==l&&d.push(new r(l[m],l[m+1]));var v=t.groups;if(0<v.length)for(o=0;o<v.length;o++)for(var s=v[o],g=s.start,y=s.count,m=g,g=g+y;m<g;m+=3)void 0!==i?e(i[m],i[m+1],i[m+2],s.materialIndex):e(m,m+1,m+2,s.materialIndex);else if(void 0!==i)for(o=0;o<i.length;o+=3)e(i[o],i[o+1],i[o+2]);else for(o=0;o<s.length/3;o+=3)e(o,o+1,o+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=0===(e=this.boundingSphere.radius)?1:1/e,r=new u;return r.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new c,e=new c,r=0,n=this.faces.length;r<n;r++){var i=this.faces[r],o=this.vertices[i.a],s=this.vertices[i.b];t.subVectors(this.vertices[i.c],s),e.subVectors(o,s),t.cross(e),t.normalize(),i.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,r,n;for(n=Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)n[e]=new c;if(t){var i,o,s,a=new c,u=new c;for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],i=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c],a.subVectors(s,o),u.subVectors(i,o),a.cross(u),n[r.a].add(a),n[r.b].add(a),n[r.c].add(a)}else for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n[r.a].add(r.normal),n[r.b].add(r.normal),n[r.c].add(r.normal);for(e=0,r=this.vertices.length;e<r;e++)n[e].normalize();for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],3===(i=r.vertexNormals).length?(i[0].copy(n[r.a]),i[1].copy(n[r.b]),i[2].copy(n[r.c])):(i[0]=n[r.a].clone(),i[1]=n[r.b].clone(),i[2]=n[r.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,r;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(r=this.faces[t]).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 t,e,r,n,i;for(r=0,n=this.faces.length;r<n;r++)for((i=this.faces[r]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;t<e;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var o=new ht;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[],i=this.morphNormals[t].faceNormals;var s,a,u=this.morphNormals[t].vertexNormals;for(r=0,n=this.faces.length;r<n;r++)s=new c,a={a:new c,b:new c,c:new c},i.push(s),u.push(a)}for(u=this.morphNormals[t],o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,n=this.faces.length;r<n;r++)i=this.faces[r],s=u.faceNormals[r],a=u.vertexNormals[r],s.copy(i.normal),a.a.copy(i.vertexNormals[0]),a.b.copy(i.vertexNormals[1]),a.c.copy(i.vertexNormals[2])}for(r=0,n=this.faces.length;r<n;r++)i=this.faces[r],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,r=0,n=e.length;r<n;r++)0<r&&(t+=e[r].distanceTo(e[r-1])),this.lineDistances[r]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new K),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Z),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(t&&t.isGeometry){var n,i=this.vertices.length,o=this.vertices,s=t.vertices,a=this.faces,c=t.faces,u=this.faceVertexUvs[0],h=t.faceVertexUvs[0],l=this.colors,p=t.colors;void 0===r&&(r=0),void 0!==e&&(n=(new J).getNormalMatrix(e)),t=0;for(var f=s.length;t<f;t++){var d=s[t].clone();void 0!==e&&d.applyMatrix4(e),o.push(d)}for(t=0,f=p.length;t<f;t++)l.push(p[t].clone());for(t=0,f=c.length;t<f;t++){var m=(s=c[t]).vertexNormals,p=s.vertexColors;for((l=new ut(s.a+i,s.b+i,s.c+i)).normal.copy(s.normal),void 0!==n&&l.normal.applyMatrix3(n).normalize(),e=0,o=m.length;e<o;e++)d=m[e].clone(),void 0!==n&&d.applyMatrix3(n).normalize(),l.vertexNormals.push(d);for(l.color.copy(s.color),e=0,o=p.length;e<o;e++)d=p[e],l.vertexColors.push(d.clone());l.materialIndex=s.materialIndex+r,a.push(l)}for(t=0,f=h.length;t<f;t++)if(r=h[t],n=[],void 0!==r){for(e=0,o=r.length;e<o;e++)n.push(r[e].clone());u.push(n)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,r,n={},i=[],o=[],s=Math.pow(10,4);for(e=0,r=this.vertices.length;e<r;e++)t=this.vertices[e],t=Math.round(t.x*s)+"_"+Math.round(t.y*s)+"_"+Math.round(t.z*s),void 0===n[t]?(n[t]=e,i.push(this.vertices[e]),o[e]=i.length-1):o[e]=o[n[t]];for(n=[],e=0,r=this.faces.length;e<r;e++)for(s=this.faces[e],s.a=o[s.a],s.b=o[s.b],s.c=o[s.c],s=[s.a,s.b,s.c],t=0;3>t;t++)if(s[t]===s[(t+1)%3]){n.push(e);break}for(e=n.length-1;0<=e;e--)for(s=n[e],this.faces.splice(s,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(s,1);return e=this.vertices.length-i.length,this.vertices=i,e},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,r=0;r<e;r++)t[r]._id=r;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var n,i,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];for(o&&o.length===e&&(n=[]),s&&s.length===e&&(i=[]),r=0;r<e;r++){var a=t[r]._id;n&&n.push(o[a]),i&&i.push(s[a])}n&&(this.faceVertexUvs[0]=n),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==u[e]?u[e]:(u[e]=c.length/3,c.push(t.x,t.y,t.z),u[e])}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==l[e]?l[e]:(l[e]=h.length,h.push(t.getHex()),l[e])}function n(t){var e=t.x.toString()+t.y.toString();return void 0!==f[e]?f[e]:(f[e]=p.length/2,p.push(t.x,t.y),f[e])}var i={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),void 0!==this.parameters){var o,s=this.parameters;for(o in s)void 0!==s[o]&&(i[o]=s[o]);return i}for(s=[],o=0;o<this.vertices.length;o++){a=this.vertices[o];s.push(a.x,a.y,a.z)}var a=[],c=[],u={},h=[],l={},p=[],f={};for(o=0;o<this.faces.length;o++){var d=this.faces[o],m=void 0!==this.faceVertexUvs[0][o],v=0<d.normal.length(),g=0<d.vertexNormals.length,y=1!==d.color.r||1!==d.color.g||1!==d.color.b,b=0<d.vertexColors.length,_=t(_=t(_=t(_=t(_=t(_=t(_=t(_=t(_=0,0,0),1,!0),2,!1),3,m),4,v),5,g),6,y),7,b);a.push(_),a.push(d.a,d.b,d.c),a.push(d.materialIndex),m&&(m=this.faceVertexUvs[0][o],a.push(n(m[0]),n(m[1]),n(m[2]))),v&&a.push(e(d.normal)),g&&(v=d.vertexNormals,a.push(e(v[0]),e(v[1]),e(v[2]))),y&&a.push(r(d.color)),b&&(d=d.vertexColors,a.push(r(d[0]),r(d[1]),r(d[2])))}return i.data={},i.data.vertices=s,i.data.normals=c,0<h.length&&(i.data.colors=h),0<p.length&&(i.data.uvs=[p]),i.data.faces=a,i},clone:function(){return(new ht).copy(this)},copy:function(t){var e,r,n,i,o,s;for(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=t.name,e=0,r=(n=t.vertices).length;e<r;e++)this.vertices.push(n[e].clone());for(e=0,r=(n=t.colors).length;e<r;e++)this.colors.push(n[e].clone());for(e=0,r=(n=t.faces).length;e<r;e++)this.faces.push(n[e].clone());for(e=0,r=t.faceVertexUvs.length;e<r;e++){var a=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),n=0,i=a.length;n<i;n++){var c=a[n],u=[];for(o=0,s=c.length;o<s;o++)u.push(c[o].clone());this.faceVertexUvs[e].push(u)}}for(e=0,r=(o=t.morphTargets).length;e<r;e++){if(s={},s.name=o[e].name,void 0!==o[e].vertices)for(s.vertices=[],n=0,i=o[e].vertices.length;n<i;n++)s.vertices.push(o[e].vertices[n].clone());if(void 0!==o[e].normals)for(s.normals=[],n=0,i=o[e].normals.length;n<i;n++)s.normals.push(o[e].normals[n].clone());this.morphTargets.push(s)}for(e=0,r=(o=t.morphNormals).length;e<r;e++){if(s={},void 0!==o[e].vertexNormals)for(s.vertexNormals=[],n=0,i=o[e].vertexNormals.length;n<i;n++)a=o[e].vertexNormals[n],c={},c.a=a.a.clone(),c.b=a.b.clone(),c.c=a.c.clone(),s.vertexNormals.push(c);if(void 0!==o[e].faceNormals)for(s.faceNormals=[],n=0,i=o[e].faceNormals.length;n<i;n++)s.faceNormals.push(o[e].faceNormals[n].clone());this.morphNormals.push(s)}for(e=0,r=(n=t.skinWeights).length;e<r;e++)this.skinWeights.push(n[e].clone());for(e=0,r=(n=t.skinIndices).length;e<r;e++)this.skinIndices.push(n[e].clone());for(e=0,r=(n=t.lineDistances).length;e<r;e++)this.lineDistances.push(n[e]);return null!==(e=t.boundingBox)&&(this.boundingBox=e.clone()),null!==(e=t.boundingSphere)&&(this.boundingSphere=e.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(lt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(lt.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var n=0,i=this.itemSize;n<i;n++)this.array[t+n]=e.array[r+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),o=new $),e[r++]=o.r,e[r++]=o.g,e[r++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var o=t[n];e[r++]=o.a,e[r++]=o.b,e[r++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,i=0,o=t.length;i<o;i++){var s=t[i];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),s=new r),e[n++]=s.x,e[n++]=s.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),o=new c),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,n=0,o=t.length;n<o;n++){var s=t[n];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),s=new i),e[r++]=s.x,e[r++]=s.y,e[r++]=s.z,e[r++]=s.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=n,this},setXYZW:function(t,e,r,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=n,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(pt.prototype=Object.create(lt.prototype)).constructor=pt,(ft.prototype=Object.create(lt.prototype)).constructor=ft,(dt.prototype=Object.create(lt.prototype)).constructor=dt,(mt.prototype=Object.create(lt.prototype)).constructor=mt,vt.prototype=Object.create(lt.prototype),vt.prototype.constructor=vt,(gt.prototype=Object.create(lt.prototype)).constructor=gt,yt.prototype=Object.create(lt.prototype),yt.prototype.constructor=yt,bt.prototype=Object.create(lt.prototype),bt.prototype.constructor=bt,(_t.prototype=Object.create(lt.prototype)).constructor=_t,Object.assign(xt.prototype,{computeGroups:function(t){var e,r=[],n=void 0;t=t.faces;for(var i=0;i<t.length;i++){var o=t[i];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*i-e.start,r.push(e)),e={start:3*i,materialIndex:n})}void 0!==e&&(e.count=3*i-e.start,r.push(e)),this.groups=r},fromGeometry:function(t){var e,n=t.faces,i=t.vertices,o=t.faceVertexUvs,s=o[0]&&0<o[0].length,a=o[1]&&0<o[1].length,c=t.morphTargets,u=c.length;if(0<u){e=[];for(g=0;g<u;g++)e[g]=[];this.morphTargets.position=e}var h,l=t.morphNormals,p=l.length;if(0<p){for(h=[],g=0;g<p;g++)h[g]=[];this.morphTargets.normal=h}for(var f=t.skinIndices,d=t.skinWeights,m=f.length===i.length,v=d.length===i.length,g=0;g<n.length;g++){var y=n[g];this.vertices.push(i[y.a],i[y.b],i[y.c]);var b=y.vertexNormals;for(3===b.length?this.normals.push(b[0],b[1],b[2]):(b=y.normal,this.normals.push(b,b,b)),3===(b=y.vertexColors).length?this.colors.push(b[0],b[1],b[2]):(b=y.color,this.colors.push(b,b,b)),!0===s&&(void 0!==(b=o[0][g])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new r,new r,new r))),!0===a&&(void 0!==(b=o[1][g])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new r,new r,new r))),b=0;b<u;b++){var _=c[b].vertices;e[b].push(_[y.a],_[y.b],_[y.c])}for(b=0;b<p;b++)_=l[b].vertexNormals[g],h[b].push(_.a,_.b,_.c);m&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(d[y.a],d[y.b],d[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}}),St.MaxIndex=65535,Object.assign(St.prototype,e.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(65535<wt(t)?yt:vt)(t,1):this.index=t},addAttribute:function(t,e,r){if(e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute){if("index"!==t)return this.attributes[t]=e,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)}else console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new lt(e,r))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;return void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0),void 0!==(e=this.attributes.normal)&&((new J).getNormalMatrix(t).applyToBufferAttribute(e),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new u;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new u;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new u;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new u;return function(e,r,n){return t.makeTranslation(e,r,n),this.applyMatrix(t),this}}(),scale:function(){var t=new u;return function(e,r,n){return t.makeScale(e,r,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new ot;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){t=new bt(3*e.vertices.length,3);var r=new bt(3*e.colors.length,3);this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length&&(t=new bt(e.lineDistances.length,1),this.addAttribute("lineDistance",t.copyArray(e.lineDistances))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var r=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(r=void 0,e.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}return!0===e.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new xt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){r=new Float32Array(3*t.vertices.length);this.addAttribute("position",new lt(r,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(r=new Float32Array(3*t.normals.length),this.addAttribute("normal",new lt(r,3).copyVector3sArray(t.normals))),0<t.colors.length&&(r=new Float32Array(3*t.colors.length),this.addAttribute("color",new lt(r,3).copyColorsArray(t.colors))),0<t.uvs.length&&(r=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new lt(r,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new lt(r,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(r=new(65535<wt(t.indices)?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new lt(r,1).copyIndicesArray(t.indices))),this.groups=t.groups;for(var e in t.morphTargets){for(var r=[],n=t.morphTargets[e],i=0,o=n.length;i<o;i++){var s=n[i],a=new bt(3*s.length,3);r.push(a.copyVector3sArray(s))}this.morphAttributes[e]=r}return 0<t.skinIndices.length&&(e=new bt(4*t.skinIndices.length,4),this.addAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(e=new bt(4*t.skinWeights.length,4),this.addAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new K);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):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(){var t=new K,e=new c;return function(){null===this.boundingSphere&&(this.boundingSphere=new Z);var r=this.attributes.position;if(r){var n=this.boundingSphere.center;t.setFromBufferAttribute(r),t.getCenter(n);for(var i=0,o=0,s=r.count;o<s;o++)e.x=r.getX(o),e.y=r.getY(o),e.z=r.getZ(o),i=Math.max(i,n.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(i),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 t=this.index,e=this.attributes,r=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new lt(new Float32Array(n.length),3));else for(var i=e.normal.array,o=0,s=i.length;o<s;o++)i[o]=0;var a,u,h,i=e.normal.array,l=new c,p=new c,f=new c,d=new c,m=new c;if(t){t=t.array,0===r.length&&this.addGroup(0,t.length);for(var v=0,g=r.length;v<g;++v)for(o=r[v],s=o.start,a=o.count,o=s,s+=a;o<s;o+=3)a=3*t[o+0],u=3*t[o+1],h=3*t[o+2],l.fromArray(n,a),p.fromArray(n,u),f.fromArray(n,h),d.subVectors(f,p),m.subVectors(l,p),d.cross(m),i[a]+=d.x,i[a+1]+=d.y,i[a+2]+=d.z,i[u]+=d.x,i[u+1]+=d.y,i[u+2]+=d.z,i[h]+=d.x,i[h+1]+=d.y,i[h+2]+=d.z}else for(o=0,s=n.length;o<s;o+=9)l.fromArray(n,o),p.fromArray(n,o+3),f.fromArray(n,o+6),d.subVectors(f,p),m.subVectors(l,p),d.cross(m),i[o]=d.x,i[o+1]=d.y,i[o+2]=d.z,i[o+3]=d.x,i[o+4]=d.y,i[o+5]=d.z,i[o+6]=d.x,i[o+7]=d.y,i[o+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0);var r,n=this.attributes;for(r in n)if(void 0!==t.attributes[r])for(var i=n[r].array,o=t.attributes[r],s=o.array,a=0,o=o.itemSize*e;a<s.length;a++,o++)i[o]=s[a];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,n,i=this.attributes.normal,o=0,s=i.count;o<s;o++)t=i.getX(o),e=i.getY(o),r=i.getZ(o),n=1/Math.sqrt(t*t+e*e+r*r),i.setXYZ(o,t*n,e*n,r*n)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new St,r=this.index.array,n=this.attributes;for(t in n){for(var i,o=(s=n[t]).array,s=s.itemSize,a=new o.constructor(r.length*s),c=0,u=0,h=r.length;u<h;u++){i=r[u]*s;for(var l=0;l<s;l++)a[c++]=o[i++]}e.addAttribute(t,new lt(a,s))}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e,r=this.parameters;for(e in r)void 0!==r[e]&&(t[e]=r[e]);return t}t.data={attributes:{}};var n=this.index;null!==n&&(r=Array.prototype.slice.call(n.array),t.data.index={type:n.array.constructor.name,array:r}),n=this.attributes;for(e in n){var i=n[e],r=Array.prototype.slice.call(i.array);t.data.attributes[e]={itemSize:i.itemSize,type:i.array.constructor.name,array:r,normalized:i.normalized}}return 0<(e=this.groups).length&&(t.data.groups=JSON.parse(JSON.stringify(e))),null!==(e=this.boundingSphere)&&(t.data.boundingSphere={center:e.center.toArray(),radius:e.radius}),t},clone:function(){return(new St).copy(this)},copy:function(t){var e,r,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.name=t.name,null!==(r=t.index)&&this.setIndex(r.clone()),r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());var i=t.morphAttributes;for(e in i){var o=[],s=i[e];for(r=0,n=s.length;r<n;r++)o.push(s[r].clone());this.morphAttributes[e]=o}for(r=0,n=(e=t.groups).length;r<n;r++)i=e[r],this.addGroup(i.start,i.count,i.materialIndex);return null!==(e=t.boundingBox)&&(this.boundingBox=e.clone()),null!==(e=t.boundingSphere)&&(this.boundingSphere=e.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(Mt.prototype=Object.create(ht.prototype)).constructor=Mt,Et.prototype=Object.create(St.prototype),Et.prototype.constructor=Et,(Tt.prototype=Object.create(ht.prototype)).constructor=Tt,Ct.prototype=Object.create(St.prototype),Ct.prototype.constructor=Ct,Ot.prototype=Object.create(W.prototype),Ot.prototype.constructor=Ot,Ot.prototype.isMeshBasicMaterial=!0,Ot.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.assign(Pt.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new c).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new c;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var r=e||new c;r.subVectors(t,this.origin);var n=r.dot(this.direction);return 0>n?r.copy(this.origin):r.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new c;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new c,e=new c,r=new c;return function(n,i,o,s){t.copy(n).add(i).multiplyScalar(.5),e.copy(i).sub(n).normalize(),r.copy(this.origin).sub(t);var a,c=.5*n.distanceTo(i),u=-this.direction.dot(e),h=r.dot(this.direction),l=-r.dot(e),p=r.lengthSq(),f=Math.abs(1-u*u);return 0<f?(n=u*l-h,i=u*h-l,a=c*f,0<=n?i>=-a?i<=a?(c=1/f,n*=c,i*=c,u=n*(n+u*i+2*h)+i*(u*n+i+2*l)+p):(i=c,n=Math.max(0,-(u*i+h)),u=-n*n+i*(i+2*l)+p):(i=-c,n=Math.max(0,-(u*i+h)),u=-n*n+i*(i+2*l)+p):i<=-a?(n=Math.max(0,-(-u*c+h)),i=0<n?-c:Math.min(Math.max(-c,-l),c),u=-n*n+i*(i+2*l)+p):i<=a?(n=0,i=Math.min(Math.max(-c,-l),c),u=i*(i+2*l)+p):(n=Math.max(0,-(u*c+h)),i=0<n?c:Math.min(Math.max(-c,-l),c),u=-n*n+i*(i+2*l)+p)):(i=0<u?-c:c,n=Math.max(0,-(u*i+h)),u=-n*n+i*(i+2*l)+p),o&&o.copy(this.direction).multiplyScalar(n).add(this.origin),s&&s.copy(e).multiplyScalar(i).add(t),u}}(),intersectSphere:function(){var t=new c;return function(e,r){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),i=t.dot(t)-n*n,o=e.radius*e.radius;return i>o?null:(o=Math.sqrt(o-i),i=n-o,n+=o,0>i&&0>n?null:0>i?this.at(n,r):this.at(i,r))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(t.normal)+t.constant)/e)?t:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var r,n,i,o,s;n=1/this.direction.x,o=1/this.direction.y,s=1/this.direction.z;var a=this.origin;return 0<=n?(r=(t.min.x-a.x)*n,n*=t.max.x-a.x):(r=(t.max.x-a.x)*n,n*=t.min.x-a.x),0<=o?(i=(t.min.y-a.y)*o,o*=t.max.y-a.y):(i=(t.max.y-a.y)*o,o*=t.min.y-a.y),r>o||i>n?null:((i>r||r!==r)&&(r=i),(o<n||n!==n)&&(n=o),0<=s?(i=(t.min.z-a.z)*s,s*=t.max.z-a.z):(i=(t.max.z-a.z)*s,s*=t.min.z-a.z),r>s||i>n?null:((i>r||r!==r)&&(r=i),(s<n||n!==n)&&(n=s),0>n?null:this.at(0<=r?r:n,e)))},intersectsBox:function(){var t=new c;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new c,e=new c,r=new c,n=new c;return function(i,o,s,a,c){if(e.subVectors(o,i),r.subVectors(s,i),n.crossVectors(e,r),0<(o=this.direction.dot(n))){if(a)return null;a=1}else{if(!(0>o))return null;a=-1,o=-o}return t.subVectors(this.origin,i),0>(i=a*this.direction.dot(r.crossVectors(t,r)))?null:0>(s=a*this.direction.dot(e.cross(t)))||i+s>o?null:0>(i=-a*t.dot(n))?null:this.at(i/o,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(At.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new c).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new c).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new c;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new c,e=new c;return function(r,n){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var i=e.dot(e),i=e.dot(t)/i;return n&&(i=xi.clamp(i,0,1)),i}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new c,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(jt,{normal:function(){var t=new c;return function(e,r,n,i){return(i=i||new c).subVectors(n,r),t.subVectors(e,r),i.cross(t),0<(e=i.lengthSq())?i.multiplyScalar(1/Math.sqrt(e)):i.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new c,e=new c,r=new c;return function(n,i,o,s,a){t.subVectors(s,i),e.subVectors(o,i),r.subVectors(n,i),n=t.dot(t),i=t.dot(e),o=t.dot(r);var u=e.dot(e);s=e.dot(r);var h=n*u-i*i;return a=a||new c,0===h?a.set(-2,-1,-1):(h=1/h,u=(u*o-i*s)*h,n=(n*s-i*o)*h,a.set(1-u-n,n,u))}}(),containsPoint:function(){var t=new c;return function(e,r,n,i){return 0<=(e=jt.barycoordFromPoint(e,r,n,i,t)).x&&0<=e.y&&1>=e.x+e.y}}()}),Object.assign(jt.prototype,{set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,n){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new c,e=new c;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new c).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return jt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new Q).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return jt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return jt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new Q,e=[new At,new At,new At],r=new c,n=new c;return function(i,o){var s=o||new c,a=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,r),!0===this.containsPoint(r))s.copy(r);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;u<e.length;u++){e[u].closestPointToPoint(r,!0,n);var h=r.distanceToSquared(n);h<a&&(a=h,s.copy(n))}}return s}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Rt.prototype=Object.assign(Object.create(ot.prototype),{constructor:Rt,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return ot.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t,e,r=this.geometry;if(r.isBufferGeometry){if(r=r.morphAttributes,0<(t=Object.keys(r)).length){var n=r[t[0]];if(void 0!==n)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},r=0,t=n.length;r<t;r++)e=n[r].name||String(r),this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=r}}else if(void 0!==(n=r.morphTargets)&&0<n.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},r=0,t=n.length;r<t;r++)e=n[r].name||String(r),this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=r},raycast:function(){function t(t,e,r,n,i,o,s){return jt.barycoordFromPoint(t,e,r,n,y),i.multiplyScalar(y.x),o.multiplyScalar(y.y),s.multiplyScalar(y.z),i.add(o).add(s),i.clone()}function e(t,e,r,n,i,o,s){var a=t.material;return null===(1===a.side?r.intersectTriangle(o,i,n,!0,s):r.intersectTriangle(n,i,o,2!==a.side,s))?null:(_.copy(s),_.applyMatrix4(t.matrixWorld),(r=e.ray.origin.distanceTo(_))<e.near||r>e.far?null:{distance:r,point:_.clone(),object:t})}function n(r,n,i,o,s,c,u,p){return a.fromBufferAttribute(o,c),h.fromBufferAttribute(o,u),l.fromBufferAttribute(o,p),(r=e(r,n,i,a,h,l,b))&&(s&&(m.fromBufferAttribute(s,c),v.fromBufferAttribute(s,u),g.fromBufferAttribute(s,p),r.uv=t(b,a,h,l,m,v,g)),r.face=new ut(c,u,p,jt.normal(a,h,l)),r.faceIndex=c),r}var i=new u,o=new Pt,s=new Z,a=new c,h=new c,l=new c,p=new c,f=new c,d=new c,m=new r,v=new r,g=new r,y=new c,b=new c,_=new c;return function(r,c){var u=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===u.boundingSphere&&u.computeBoundingSphere(),s.copy(u.boundingSphere),s.applyMatrix4(_),!1!==r.ray.intersectsSphere(s)&&(i.getInverse(_),o.copy(r.ray).applyMatrix4(i),null===u.boundingBox||!1!==o.intersectsBox(u.boundingBox)))){var x;if(u.isBufferGeometry){var w,S,M,E,y=u.index,T=u.attributes.position,_=u.attributes.uv;if(null!==y)for(M=0,E=y.count;M<E;M+=3)u=y.getX(M),w=y.getX(M+1),S=y.getX(M+2),(x=n(this,r,o,T,_,u,w,S))&&(x.faceIndex=Math.floor(M/3),c.push(x));else for(M=0,E=T.count;M<E;M+=3)u=M,w=M+1,S=M+2,(x=n(this,r,o,T,_,u,w,S))&&(x.index=u,c.push(x))}else if(u.isGeometry){var C,_=Array.isArray(y);M=u.vertices,E=u.faces,0<(w=u.faceVertexUvs[0]).length&&(T=w);for(var O=0,P=E.length;O<P;O++){var A=E[O];if(void 0!==(x=_?y[A.materialIndex]:y)){if(w=M[A.a],S=M[A.b],C=M[A.c],!0===x.morphTargets){x=u.morphTargets;var j=this.morphTargetInfluences;a.set(0,0,0),h.set(0,0,0),l.set(0,0,0);for(var R=0,L=x.length;R<L;R++){var N=j[R];if(0!==N){var I=x[R].vertices;a.addScaledVector(p.subVectors(I[A.a],w),N),h.addScaledVector(f.subVectors(I[A.b],S),N),l.addScaledVector(d.subVectors(I[A.c],C),N)}}a.add(w),h.add(S),l.add(C),w=a,S=h,C=l}(x=e(this,r,o,w,S,C,b))&&(T&&T[O]&&(j=T[O],m.copy(j[0]),v.copy(j[1]),g.copy(j[2]),x.uv=t(b,w,S,C,m,v,g)),x.face=A,x.faceIndex=O,c.push(x))}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Fi=0;ae.prototype=Object.assign(Object.create(ct.prototype),{constructor:ae,isArrayCamera:!0}),pe.prototype.isFogExp2=!0,pe.prototype.clone=function(){return new pe(this.color.getHex(),this.density)},pe.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},fe.prototype.isFog=!0,fe.prototype.clone=function(){return new fe(this.color.getHex(),this.near,this.far)},fe.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},de.prototype=Object.assign(Object.create(ot.prototype),{constructor:de,copy:function(t,e){return ot.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=ot.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),me.prototype=Object.assign(Object.create(ot.prototype),{constructor:me,isLensFlare:!0,copy:function(t){ot.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,r=t.lensFlares.length;e<r;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,r,n,i,o){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===i&&(i=new $(16777215)),void 0===n&&(n=1),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:i,blending:n})},updateLensFlares:function(){var t,e,r=this.lensFlares.length,n=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(t=0;t<r;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+n*e.distance,e.y=this.positionScreen.y+i*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),ve.prototype=Object.create(W.prototype),ve.prototype.constructor=ve,ve.prototype.isSpriteMaterial=!0,ve.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},ge.prototype=Object.assign(Object.create(ot.prototype),{constructor:ge,isSprite:!0,raycast:function(){var t=new c,e=new c,r=new c;return function(n,i){e.setFromMatrixPosition(this.matrixWorld),n.ray.closestPointToPoint(e,t),r.setFromMatrixScale(this.matrixWorld);var o=r.x*r.y/4;e.distanceToSquared(t)>o||(o=n.ray.origin.distanceTo(t))<n.near||o>n.far||i.push({distance:o,point:t.clone(),face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ye.prototype=Object.assign(Object.create(ot.prototype),{constructor:ye,copy:function(t){ot.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e<r;e++){var n=t[e];this.addLevel(n.object.clone(),n.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,n=0;n<r.length&&!(e<r[n].distance);n++);r.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,r=1,n=e.length;r<n&&!(t<e[r].distance);r++);return e[r-1].object},raycast:function(){var t=new c;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(t);this.getObjectForDistance(n).raycast(e,r)}}(),update:function(){var t=new c,e=new c;return function(r){var n=this.levels;if(1<n.length){t.setFromMatrixPosition(r.matrixWorld),e.setFromMatrixPosition(this.matrixWorld),r=t.distanceTo(e),n[0].object.visible=!0;for(var i=1,o=n.length;i<o&&r>=n[i].distance;i++)n[i-1].object.visible=!1,n[i].object.visible=!0;for(;i<o;i++)n[i].object.visible=!1}}}(),toJSON:function(t){(t=ot.prototype.toJSON.call(this,t)).object.levels=[];for(var e=this.levels,r=0,n=e.length;r<n;r++){var i=e[r];t.object.levels.push({object:i.object.uuid,distance:i.distance})}return t}}),Object.assign(be.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new u;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},pose:function(){var t,e,r;for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new u,e=new u;return function(){for(var r=this.bones,n=this.boneInverses,i=this.boneMatrices,o=this.boneTexture,s=0,a=r.length;s<a;s++)t.multiplyMatrices(r[s]?r[s].matrixWorld:e,n[s]),t.toArray(i,16*s);void 0!==o&&(o.needsUpdate=!0)}}(),clone:function(){return new be(this.bones,this.boneInverses)}}),_e.prototype=Object.assign(Object.create(ot.prototype),{constructor:_e,isBone:!0}),xe.prototype=Object.assign(Object.create(Rt.prototype),{constructor:xe,isSkinnedMesh:!0,initBones:function(){var t,e,r,n,i=[];if(this.geometry&&void 0!==this.geometry.bones){for(r=0,n=this.geometry.bones.length;r<n;r++)e=this.geometry.bones[r],t=new _e,i.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(r=0,n=this.geometry.bones.length;r<n;r++)-1!==(e=this.geometry.bones[r]).parent&&null!==e.parent&&void 0!==i[e.parent]?i[e.parent].add(i[r]):this.add(i[r])}return this.updateMatrixWorld(!0),i},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++)1/0!==(t=1/(r=this.geometry.skinWeights[e]).lengthManhattan())?r.multiplyScalar(t):r.set(1,0,0,0);else if(this.geometry&&this.geometry.isBufferGeometry){var r=new i,n=this.geometry.attributes.skinWeight;for(e=0;e<n.count;e++)r.x=n.getX(e),r.y=n.getY(e),r.z=n.getZ(e),r.w=n.getW(e),t=1/r.lengthManhattan(),1/0!==t?r.multiplyScalar(t):r.set(1,0,0,0),n.setXYZW(e,r.x,r.y,r.z,r.w)}},updateMatrixWorld:function(t){Rt.prototype.updateMatrixWorld.call(this,t),"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)}}),we.prototype=Object.create(W.prototype),we.prototype.constructor=we,we.prototype.isLineBasicMaterial=!0,we.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},Se.prototype=Object.assign(Object.create(ot.prototype),{constructor:Se,isLine:!0,raycast:function(){var t=new u,e=new Pt,r=new Z;return function(n,i){var o=(o=n.linePrecision)*o,s=this.geometry,a=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(a),!1!==n.ray.intersectsSphere(r)){t.getInverse(a),e.copy(n.ray).applyMatrix4(t);var u=new c,h=new c,a=new c,l=new c,p=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var f=s.index,d=s.attributes.position.array;if(null!==f)for(var f=f.array,s=0,m=f.length-1;s<m;s+=p){var v=f[s+1];u.fromArray(d,3*f[s]),h.fromArray(d,3*v),(v=e.distanceSqToSegment(u,h,l,a))>o||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))<n.near||v>n.far||i.push({distance:v,point:a.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else for(s=0,m=d.length/3-1;s<m;s+=p)u.fromArray(d,3*s),h.fromArray(d,3*s+3),(v=e.distanceSqToSegment(u,h,l,a))>o||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))<n.near||v>n.far||i.push({distance:v,point:a.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else if(s.isGeometry)for(u=s.vertices,h=u.length,s=0;s<h-1;s+=p)(v=e.distanceSqToSegment(u[s],u[s+1],l,a))>o||(l.applyMatrix4(this.matrixWorld),(v=n.ray.origin.distanceTo(l))<n.near||v>n.far||i.push({distance:v,point:a.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Me.prototype=Object.assign(Object.create(Se.prototype),{constructor:Me,isLineSegments:!0}),Ee.prototype=Object.assign(Object.create(Se.prototype),{constructor:Ee,isLineLoop:!0}),Te.prototype=Object.create(W.prototype),Te.prototype.constructor=Te,Te.prototype.isPointsMaterial=!0,Te.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Ce.prototype=Object.assign(Object.create(ot.prototype),{constructor:Ce,isPoints:!0,raycast:function(){var t=new u,e=new Pt,r=new Z;return function(n,i){function o(t,r){var o=e.distanceSqToPoint(t);if(o<l){var a=e.closestPointToPoint(t);a.applyMatrix4(u);var c=n.ray.origin.distanceTo(a);c<n.near||c>n.far||i.push({distance:c,distanceToRay:Math.sqrt(o),point:a.clone(),index:r,face:null,object:s})}}var s=this,a=this.geometry,u=this.matrixWorld,h=n.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(u),r.radius+=h,!1!==n.ray.intersectsSphere(r)){t.getInverse(u),e.copy(n.ray).applyMatrix4(t);var l=(h=h/((this.scale.x+this.scale.y+this.scale.z)/3))*h,h=new c;if(a.isBufferGeometry){var p=a.index,a=a.attributes.position.array;if(null!==p)for(var f=p.array,p=0,d=f.length;p<d;p++){var m=f[p];h.fromArray(a,3*m),o(h,m)}else for(p=0,f=a.length/3;p<f;p++)h.fromArray(a,3*p),o(h,p)}else for(h=a.vertices,p=0,f=h.length;p<f;p++)o(h[p],p)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Oe.prototype=Object.assign(Object.create(ot.prototype),{constructor:Oe}),(Pe.prototype=Object.create(n.prototype)).constructor=Pe,(Ae.prototype=Object.create(n.prototype)).constructor=Ae,Ae.prototype.isCompressedTexture=!0,(je.prototype=Object.create(n.prototype)).constructor=je,(Re.prototype=Object.create(n.prototype)).constructor=Re,Re.prototype.isDepthTexture=!0,(Le.prototype=Object.create(St.prototype)).constructor=Le,(Ne.prototype=Object.create(ht.prototype)).constructor=Ne,(Ie.prototype=Object.create(St.prototype)).constructor=Ie,(De.prototype=Object.create(ht.prototype)).constructor=De,ke.prototype=Object.create(St.prototype),ke.prototype.constructor=ke,(Fe.prototype=Object.create(ht.prototype)).constructor=Fe,(Be.prototype=Object.create(ke.prototype)).constructor=Be,(Ue.prototype=Object.create(ht.prototype)).constructor=Ue,ze.prototype=Object.create(ke.prototype),ze.prototype.constructor=ze,(Ge.prototype=Object.create(ht.prototype)).constructor=Ge,($e.prototype=Object.create(ke.prototype)).constructor=$e,(Ve.prototype=Object.create(ht.prototype)).constructor=Ve,(He.prototype=Object.create(ke.prototype)).constructor=He,(qe.prototype=Object.create(ht.prototype)).constructor=qe,(We.prototype=Object.create(St.prototype)).constructor=We,(Xe.prototype=Object.create(ht.prototype)).constructor=Xe,(Ye.prototype=Object.create(St.prototype)).constructor=Ye,(Ke.prototype=Object.create(ht.prototype)).constructor=Ke,(Ze.prototype=Object.create(St.prototype)).constructor=Ze;var Bi={area:function(t){for(var e=t.length,r=0,n=e-1,i=0;i<e;n=i++)r+=t[n].x*t[i].y-t[i].x*t[n].y;return.5*r},triangulate:function(t,e){var r=t.length;if(3>r)return null;var n,i,o,s=[],a=[],c=[];if(0<Bi.area(t))for(i=0;i<r;i++)a[i]=i;else for(i=0;i<r;i++)a[i]=r-1-i;var u=2*r;for(i=r-1;2<r;){if(0>=u--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(n=i)&&(n=0),r<=(i=n+1)&&(i=0),r<=(o=i+1)&&(o=0);var h;t:{var l,p,f,d,m,v,g,y;if(l=t[a[n]].x,p=t[a[n]].y,f=t[a[i]].x,d=t[a[i]].y,m=t[a[o]].x,v=t[a[o]].y,0>=(f-l)*(v-p)-(d-p)*(m-l))h=!1;else{var b,_,x,w,S,M,E,T,C,O;for(b=m-f,_=v-d,x=l-m,w=p-v,S=f-l,M=d-p,h=0;h<r;h++)if(g=t[a[h]].x,y=t[a[h]].y,!(g===l&&y===p||g===f&&y===d||g===m&&y===v)&&(E=g-l,T=y-p,C=g-f,O=y-d,g-=m,y-=v,C=b*O-_*C,E=S*T-M*E,T=x*y-w*g,C>=-Number.EPSILON&&T>=-Number.EPSILON&&E>=-Number.EPSILON)){h=!1;break t}h=!0}}if(h){for(s.push([t[a[n]],t[a[i]],t[a[o]]]),c.push([a[n],a[i],a[o]]),n=i,o=i+1;o<r;n++,o++)a[n]=a[o];u=2*--r}}return e?c:s},triangulateShape:function(t,e){function r(t){var e=t.length;2<e&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function i(t,e,r,i,o){var s=e.x-t.x,a=e.y-t.y,c=i.x-r.x,u=i.y-r.y,h=t.x-r.x,l=t.y-r.y,p=a*c-s*u,f=a*h-s*l;if(Math.abs(p)>Number.EPSILON){if(0<p){if(0>f||f>p)return[];if(0>(c=u*h-c*l)||c>p)return[]}else{if(0<f||f<p)return[];if(0<(c=u*h-c*l)||c<p)return[]}return 0===c?!o||0!==f&&f!==p?[t]:[]:c===p?!o||0!==f&&f!==p?[e]:[]:0===f?[r]:f===p?[i]:(o=c/p,[{x:t.x+o*s,y:t.y+o*a}])}return 0!==f||u*h!=c*l?[]:(a=0===s&&0===a,c=0===c&&0===u,a&&c?t.x!==r.x||t.y!==r.y?[]:[t]:a?n(r,i,t)?[t]:[]:c?n(t,e,r)?[r]:[]:(0!==s?(t.x<e.x?(s=t,c=t.x,a=e,t=e.x):(s=e,c=e.x,a=t,t=t.x),r.x<i.x?(e=r,p=r.x,u=i,r=i.x):(e=i,p=i.x,u=r,r=r.x)):(t.y<e.y?(s=t,c=t.y,a=e,t=e.y):(s=e,c=e.y,a=t,t=t.y),r.y<i.y?(e=r,p=r.y,u=i,r=i.y):(e=i,p=i.y,u=r,r=r.y)),c<=p?t<p?[]:t===p?o?[]:[e]:t<=r?[e,a]:[e,u]:c>r?[]:c===r?o?[]:[s]:t<=r?[s,a]:[s,u]))}function o(t,e,r,n){var i=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var s=n.x-t.x;return n=n.y-t.y,t=i*r-o*e,i=i*n-o*s,Math.abs(t)>Number.EPSILON?(e=s*r-n*e,0<t?0<=i&&0<=e:0<=i||0<=e):0<i}r(t),e.forEach(r);var s,a,c,u,h,l={};for(c=t.concat(),s=0,a=e.length;s<a;s++)Array.prototype.push.apply(c,e[s]);for(s=0,a=c.length;s<a;s++)h=c[s].x+":"+c[s].y,void 0!==l[h]&&console.warn("THREE.ShapeUtils: Duplicate point",h,s),l[h]=s;s=function(t,e){var r,n,s,a,c,u,h,l,p,f=t.concat(),d=[],m=[],v=0;for(n=e.length;v<n;v++)d.push(v);h=0;for(var g=2*d.length;0<d.length;){if(0>--g){console.log("Infinite Loop! Holes left:"+d.length+", Probably Hole outside Shape!");break}for(s=h;s<f.length;s++){for(a=f[s],n=-1,v=0;v<d.length;v++)if(c=d[v],u=a.x+":"+a.y+":"+c,void 0===m[u]){for(r=e[c],l=0;l<r.length;l++)if(c=r[l],function(t,e){var n=f.length-1,i=t-1;0>i&&(i=n);var s=t+1;return s>n&&(s=0),!!(n=o(f[t],f[i],f[s],r[e]))&&(n=r.length-1,0>(i=e-1)&&(i=n),(s=e+1)>n&&(s=0),!!(n=o(r[e],r[i],r[s],f[t])))}(s,l)&&!function(t,e){var r,n;for(r=0;r<f.length;r++)if(n=r+1,n%=f.length,0<(n=i(t,e,f[r],f[n],!0)).length)return!0;return!1}(a,c)&&!function(t,r){var n,o,s,a;for(n=0;n<d.length;n++)for(o=e[d[n]],s=0;s<o.length;s++)if(a=s+1,a%=o.length,0<(a=i(t,r,o[s],o[a],!0)).length)return!0;return!1}(a,c)){n=l,d.splice(v,1),h=f.slice(0,s+1),c=f.slice(s),l=r.slice(n),p=r.slice(0,n+1),f=h.concat(l).concat(p).concat(c),h=s;break}if(0<=n)break;m[u]=!0}if(0<=n)break}}return f}(t,e);var p=Bi.triangulate(s,!1);for(s=0,a=p.length;s<a;s++)for(u=p[s],c=0;3>c;c++)h=u[c].x+":"+u[c].y,void 0!==(h=l[h])&&(u[c]=h);return p.concat()},isClockWise:function(t){return 0>Bi.area(t)}};(Je.prototype=Object.create(ht.prototype)).constructor=Je,Qe.prototype=Object.create(St.prototype),Qe.prototype.constructor=Qe,Qe.prototype.getArrays=function(){var t=(t=this.getAttribute("position"))?Array.prototype.slice.call(t.array):[],e=(e=this.getAttribute("uv"))?Array.prototype.slice.call(e.array):[],r=this.index;return{position:t,uv:e,index:r=r?Array.prototype.slice.call(r.array):[]}},Qe.prototype.addShapeList=function(t,e){var r=t.length;e.arrays=this.getArrays();for(var n=0;n<r;n++)this.addShape(t[n],e);this.setIndex(e.arrays.index),this.addAttribute("position",new bt(e.arrays.position,3)),this.addAttribute("uv",new bt(e.arrays.uv,2))},Qe.prototype.addShape=function(t,e){function n(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,n){var i,o,s;o=t.x-e.x,s=t.y-e.y,i=n.x-t.x;var a=n.y-t.y,c=o*o+s*s;if(Math.abs(o*a-s*i)>Number.EPSILON){var u=Math.sqrt(c),h=Math.sqrt(i*i+a*a),c=e.x-s/u;if(e=e.y+o/u,a=((n.x-a/h-c)*a-(n.y+i/h-e)*i)/(o*a-s*i),i=c+o*a-t.x,o=e+s*a-t.y,2>=(s=i*i+o*o))return new r(i,o);s=Math.sqrt(s/2)}else t=!1,o>Number.EPSILON?i>Number.EPSILON&&(t=!0):o<-Number.EPSILON?i<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(a)&&(t=!0),t?(i=-s,s=Math.sqrt(c)):(i=o,o=s,s=Math.sqrt(c/2));return new r(i/s,o/s)}function o(t,e){var r,n;for(H=t.length;0<=--H;){r=H,0>(n=H-1)&&(n=t.length-1);var i,o=T+2*S;for(i=0;i<o;i++){var s=$*i,a=e+n+s,c=e+n+(l=$*(i+1)),l=e+r+l;u(e+r+s),u(a),u(l),u(a),u(c),u(l),s=v.length/3,h((s=P.generateSideWallUV(L,v,s-6,s-3,s-2,s-1))[0]),h(s[1]),h(s[3]),h(s[1]),h(s[2]),h(s[3])}}}function s(t,e,r){b.push(t),b.push(e),b.push(r)}function a(t,e,r){u(t),u(e),u(r),t=v.length/3,h((t=P.generateTopUV(L,v,t-3,t-2,t-1))[0]),h(t[1]),h(t[2])}function u(t){g.push(v.length/3),v.push(b[3*t+0]),v.push(b[3*t+1]),v.push(b[3*t+2])}function h(t){y.push(t.x),y.push(t.y)}var l,p,f,d,m,v=(_=e.arrays?e.arrays:this.getArrays()).position,g=_.index,y=_.uv,b=[],_=void 0!==e.amount?e.amount:100,x=void 0!==e.bevelThickness?e.bevelThickness:6,w=void 0!==e.bevelSize?e.bevelSize:x-2,S=void 0!==e.bevelSegments?e.bevelSegments:3,M=void 0===e.bevelEnabled||e.bevelEnabled,E=void 0!==e.curveSegments?e.curveSegments:12,T=void 0!==e.steps?e.steps:1,C=e.extrudePath,O=!1,P=void 0!==e.UVGenerator?e.UVGenerator:Je.WorldUVGenerator;C&&(l=C.getSpacedPoints(T),O=!0,M=!1,p=void 0!==e.frames?e.frames:C.computeFrenetFrames(T,!1),f=new c,d=new c,m=new c),M||(w=x=S=0);var A,j,R,L=this,E=(C=t.extractPoints(E)).shape,N=C.holes;if(!Bi.isClockWise(E))for(E=E.reverse(),j=0,R=N.length;j<R;j++)A=N[j],Bi.isClockWise(A)&&(N[j]=A.reverse());var I=Bi.triangulateShape(E,N),D=E;for(j=0,R=N.length;j<R;j++)A=N[j],E=E.concat(A);var k,F,B,U,z,G,$=E.length,V=I.length,C=[],H=0;for(k=(B=D.length)-1,F=H+1;H<B;H++,k++,F++)k===B&&(k=0),F===B&&(F=0),C[H]=i(D[H],D[k],D[F]);var q,W=[],X=C.concat();for(j=0,R=N.length;j<R;j++){for(A=N[j],q=[],H=0,k=(B=A.length)-1,F=H+1;H<B;H++,k++,F++)k===B&&(k=0),F===B&&(F=0),q[H]=i(A[H],A[k],A[F]);W.push(q),X=X.concat(q)}for(k=0;k<S;k++){for(B=k/S,U=x*Math.cos(B*Math.PI/2),F=w*Math.sin(B*Math.PI/2),H=0,B=D.length;H<B;H++)z=n(D[H],C[H],F),s(z.x,z.y,-U);for(j=0,R=N.length;j<R;j++)for(A=N[j],q=W[j],H=0,B=A.length;H<B;H++)z=n(A[H],q[H],F),s(z.x,z.y,-U)}for(F=w,H=0;H<$;H++)z=M?n(E[H],X[H],F):E[H],O?(d.copy(p.normals[0]).multiplyScalar(z.x),f.copy(p.binormals[0]).multiplyScalar(z.y),m.copy(l[0]).add(d).add(f),s(m.x,m.y,m.z)):s(z.x,z.y,0);for(B=1;B<=T;B++)for(H=0;H<$;H++)z=M?n(E[H],X[H],F):E[H],O?(d.copy(p.normals[B]).multiplyScalar(z.x),f.copy(p.binormals[B]).multiplyScalar(z.y),m.copy(l[B]).add(d).add(f),s(m.x,m.y,m.z)):s(z.x,z.y,_/T*B);for(k=S-1;0<=k;k--){for(B=k/S,U=x*Math.cos(B*Math.PI/2),F=w*Math.sin(B*Math.PI/2),H=0,B=D.length;H<B;H++)z=n(D[H],C[H],F),s(z.x,z.y,_+U);for(j=0,R=N.length;j<R;j++)for(A=N[j],q=W[j],H=0,B=A.length;H<B;H++)z=n(A[H],q[H],F),O?s(z.x,z.y+l[T-1].y,l[T-1].x+U):s(z.x,z.y,_+U)}!function(){var t=v.length/3;if(M){var r=0*$;for(H=0;H<V;H++)G=I[H],a(G[2]+r,G[1]+r,G[0]+r);for(r=$*(T+2*S),H=0;H<V;H++)G=I[H],a(G[0]+r,G[1]+r,G[2]+r)}else{for(H=0;H<V;H++)G=I[H],a(G[2],G[1],G[0]);for(H=0;H<V;H++)G=I[H],a(G[0]+$*T,G[1]+$*T,G[2]+$*T)}L.addGroup(t,v.length/3-t,void 0!==e.material?e.material:0)}(),function(){var t=v.length/3,r=0;for(o(D,r),r+=D.length,j=0,R=N.length;j<R;j++)A=N[j],o(A,r),r+=A.length;L.addGroup(t,v.length/3-t,void 0!==e.extrudeMaterial?e.extrudeMaterial:1)}(),e.arrays||(this.setIndex(g),this.addAttribute("position",new bt(v,3)),this.addAttribute("uv",new bt(e.arrays.uv,2)))},Je.WorldUVGenerator={generateTopUV:function(t,e,n,i,o){t=e[3*i],i=e[3*i+1];var s=e[3*o];return o=e[3*o+1],[new r(e[3*n],e[3*n+1]),new r(t,i),new r(s,o)]},generateSideWallUV:function(t,e,n,i,o,s){t=e[3*n];var a=e[3*n+1];n=e[3*n+2];var c=e[3*i],u=e[3*i+1];i=e[3*i+2];var h=e[3*o],l=e[3*o+1];o=e[3*o+2];var p=e[3*s],f=e[3*s+1];return e=e[3*s+2],.01>Math.abs(a-u)?[new r(t,1-n),new r(c,1-i),new r(h,1-o),new r(p,1-e)]:[new r(a,1-n),new r(u,1-i),new r(l,1-o),new r(f,1-e)]}},(tr.prototype=Object.create(ht.prototype)).constructor=tr,(er.prototype=Object.create(Qe.prototype)).constructor=er,(rr.prototype=Object.create(ht.prototype)).constructor=rr,nr.prototype=Object.create(St.prototype),nr.prototype.constructor=nr,(ir.prototype=Object.create(ht.prototype)).constructor=ir,(or.prototype=Object.create(St.prototype)).constructor=or,(sr.prototype=Object.create(ht.prototype)).constructor=sr,(ar.prototype=Object.create(St.prototype)).constructor=ar,(cr.prototype=Object.create(ht.prototype)).constructor=cr,(ur.prototype=Object.create(St.prototype)).constructor=ur,(hr.prototype=Object.create(St.prototype)).constructor=hr,lr.prototype=Object.create(ht.prototype),lr.prototype.constructor=lr,pr.prototype=Object.create(St.prototype),pr.prototype.constructor=pr,(fr.prototype=Object.create(lr.prototype)).constructor=fr,(dr.prototype=Object.create(pr.prototype)).constructor=dr,(mr.prototype=Object.create(ht.prototype)).constructor=mr,(vr.prototype=Object.create(St.prototype)).constructor=vr;var Ui=Object.freeze({WireframeGeometry:Le,ParametricGeometry:Ne,ParametricBufferGeometry:Ie,TetrahedronGeometry:Fe,TetrahedronBufferGeometry:Be,OctahedronGeometry:Ue,OctahedronBufferGeometry:ze,IcosahedronGeometry:Ge,IcosahedronBufferGeometry:$e,DodecahedronGeometry:Ve,DodecahedronBufferGeometry:He,PolyhedronGeometry:De,PolyhedronBufferGeometry:ke,TubeGeometry:qe,TubeBufferGeometry:We,TorusKnotGeometry:Xe,TorusKnotBufferGeometry:Ye,TorusGeometry:Ke,TorusBufferGeometry:Ze,TextGeometry:tr,TextBufferGeometry:er,SphereGeometry:rr,SphereBufferGeometry:nr,RingGeometry:ir,RingBufferGeometry:or,PlaneGeometry:Tt,PlaneBufferGeometry:Ct,LatheGeometry:sr,LatheBufferGeometry:ar,ShapeGeometry:cr,ShapeBufferGeometry:ur,ExtrudeGeometry:Je,ExtrudeBufferGeometry:Qe,EdgesGeometry:hr,ConeGeometry:fr,ConeBufferGeometry:dr,CylinderGeometry:lr,CylinderBufferGeometry:pr,CircleGeometry:mr,CircleBufferGeometry:vr,BoxGeometry:Mt,BoxBufferGeometry:Et});(gr.prototype=Object.create(X.prototype)).constructor=gr,gr.prototype.isShadowMaterial=!0,(yr.prototype=Object.create(X.prototype)).constructor=yr,yr.prototype.isRawShaderMaterial=!0,br.prototype=Object.create(W.prototype),br.prototype.constructor=br,br.prototype.isMeshStandardMaterial=!0,br.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(_r.prototype=Object.create(br.prototype)).constructor=_r,_r.prototype.isMeshPhysicalMaterial=!0,_r.prototype.copy=function(t){return br.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},xr.prototype=Object.create(W.prototype),xr.prototype.constructor=xr,xr.prototype.isMeshPhongMaterial=!0,xr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(wr.prototype=Object.create(xr.prototype)).constructor=wr,wr.prototype.isMeshToonMaterial=!0,wr.prototype.copy=function(t){return xr.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},(Sr.prototype=Object.create(W.prototype)).constructor=Sr,Sr.prototype.isMeshNormalMaterial=!0,Sr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(Mr.prototype=Object.create(W.prototype)).constructor=Mr,Mr.prototype.isMeshLambertMaterial=!0,Mr.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},(Er.prototype=Object.create(W.prototype)).constructor=Er,Er.prototype.isLineDashedMaterial=!0,Er.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var zi=Object.freeze({ShadowMaterial:gr,SpriteMaterial:ve,RawShaderMaterial:yr,ShaderMaterial:X,PointsMaterial:Te,MeshPhysicalMaterial:_r,MeshStandardMaterial:br,MeshPhongMaterial:xr,MeshToonMaterial:wr,MeshNormalMaterial:Sr,MeshLambertMaterial:Mr,MeshDepthMaterial:Y,MeshBasicMaterial:Ot,LineDashedMaterial:Er,LineBasicMaterial:we,Material:W}),Gi={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},$i=new Tr;Object.assign(Cr.prototype,{load:function(t,e,r,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,o=Gi.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){e&&e(o),i.manager.itemEnd(t)},0),o;if(c=t.match(/^data:(.*?)(;base64)?,(.*)$/)){var s=c[1],a=!!c[2],c=c[3],c=window.decodeURIComponent(c);a&&(c=window.atob(c));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":u=new ArrayBuffer(c.length);for(var l=new Uint8Array(u),a=0;a<c.length;a++)l[a]=c.charCodeAt(a);"blob"===h&&(u=new Blob([u],{type:s}));break;case"document":u=(new DOMParser).parseFromString(c,s);break;case"json":u=JSON.parse(c);break;default:u=c}window.setTimeout(function(){e&&e(u),i.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){n&&n(e),i.manager.itemEnd(t),i.manager.itemError(t)},0)}}else{var p=new XMLHttpRequest;p.open("GET",t,!0),p.addEventListener("load",function(r){var o=r.target.response;Gi.add(t,o),200===this.status?(e&&e(o),i.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(o),i.manager.itemEnd(t)):(n&&n(r),i.manager.itemEnd(t),i.manager.itemError(t))},!1),void 0!==r&&p.addEventListener("progress",function(t){r(t)},!1),p.addEventListener("error",function(e){n&&n(e),i.manager.itemEnd(t),i.manager.itemError(t)},!1),void 0!==this.responseType&&(p.responseType=this.responseType),void 0!==this.withCredentials&&(p.withCredentials=this.withCredentials),p.overrideMimeType&&p.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(s in this.requestHeader)p.setRequestHeader(s,this.requestHeader[s]);p.send(null)}return i.manager.itemStart(t),p},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(Or.prototype,{load:function(t,e,r,n){var i=this,o=[],s=new Ae;s.image=o;var a=new Cr(this.manager);if(a.setPath(this.path),a.setResponseType("arraybuffer"),Array.isArray(t))for(var c=0,u=0,h=t.length;u<h;++u)!function(u){a.load(t[u],function(t){t=i._parser(t,!0),o[u]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(c+=1)&&(1===t.mipmapCount&&(s.minFilter=1006),s.format=t.format,s.needsUpdate=!0,e&&e(s))},r,n)}(u);else a.load(t,function(t){if((t=i._parser(t,!0)).isCubemap)for(var r=t.mipmaps.length/t.mipmapCount,n=0;n<r;n++){o[n]={mipmaps:[]};for(var a=0;a<t.mipmapCount;a++)o[n].mipmaps.push(t.mipmaps[n*t.mipmapCount+a]),o[n].format=t.format,o[n].width=t.width,o[n].height=t.height}else s.image.width=t.width,s.image.height=t.height,s.mipmaps=t.mipmaps;1===t.mipmapCount&&(s.minFilter=1006),s.format=t.format,s.needsUpdate=!0,e&&e(s)},r,n);return s},setPath:function(t){return this.path=t,this}}),Object.assign(Pr.prototype,{load:function(t,e,r,n){var i=this,o=new h,s=new Cr(this.manager);return s.setResponseType("arraybuffer"),s.load(t,function(t){(t=i._parser(t))&&(void 0!==t.image?o.image=t.image:void 0!==t.data&&(o.image.width=t.width,o.image.height=t.height,o.image.data=t.data),o.wrapS=void 0!==t.wrapS?t.wrapS:1001,o.wrapT=void 0!==t.wrapT?t.wrapT:1001,o.magFilter=void 0!==t.magFilter?t.magFilter:1006,o.minFilter=void 0!==t.minFilter?t.minFilter:1008,o.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(o.format=t.format),void 0!==t.type&&(o.type=t.type),void 0!==t.mipmaps&&(o.mipmaps=t.mipmaps),1===t.mipmapCount&&(o.minFilter=1006),o.needsUpdate=!0,e&&e(o,t))},r,n),o}}),Object.assign(Ar.prototype,{load:function(t,e,r,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,o=Gi.get(t);return void 0!==o?(i.manager.itemStart(t),setTimeout(function(){e&&e(o),i.manager.itemEnd(t)},0),o):((r=document.createElementNS("http://www.w3.org/1999/xhtml","img")).addEventListener("load",function(){Gi.add(t,this),e&&e(this),i.manager.itemEnd(t)},!1),r.addEventListener("error",function(e){n&&n(e),i.manager.itemEnd(t),i.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(r.crossOrigin=this.crossOrigin),i.manager.itemStart(t),r.src=t,r)},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(jr.prototype,{load:function(t,e,r,n){var i=new l,o=new Ar(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var s=0;for(r=0;r<t.length;++r)!function(r){o.load(t[r],function(t){i.images[r]=t,6==++s&&(i.needsUpdate=!0,e&&e(i))},void 0,n)}(r);return i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Rr.prototype,{load:function(t,e,r,i){var o=new Ar(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var s=new n;return s.image=o.load(t,function(){var r=0<t.search(/\.(jpg|jpeg)$/)||0===t.search(/^data\:image\/jpeg/);s.format=r?1022:1023,s.needsUpdate=!0,void 0!==e&&e(s)},r,i),s},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Lr.prototype=Object.assign(Object.create(ot.prototype),{constructor:Lr,isLight:!0,copy:function(t){return ot.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){return t=ot.prototype.toJSON.call(this,t),t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Nr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Nr,isHemisphereLight:!0,copy:function(t){return Lr.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Ir.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Dr.prototype=Object.assign(Object.create(Ir.prototype),{constructor:Dr,isSpotLightShadow:!0,update:function(t){var e=this.camera,r=2*xi.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height;t=t.distance||e.far,r===e.fov&&n===e.aspect&&t===e.far||(e.fov=r,e.aspect=n,e.far=t,e.updateProjectionMatrix())}}),kr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:kr,isSpotLight:!0,copy:function(t){return Lr.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Fr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Fr,isPointLight:!0,copy:function(t){return Lr.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Br.prototype=Object.assign(Object.create(Ir.prototype),{constructor:Br}),Ur.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Ur,isDirectionalLight:!0,copy:function(t){return Lr.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),zr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:zr,isAmbientLight:!0}),Gr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Gr,isRectAreaLight:!0,copy:function(t){return Lr.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){return t=Lr.prototype.toJSON.call(this,t),t.object.width=this.width,t.object.height=this.height,t}});var Vi={arraySlice:function(t,e,r){return Vi.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==r?r:t.length)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,r=Array(e),n=0;n!==e;++n)r[n]=n;return r.sort(function(e,r){return t[e]-t[r]}),r},sortedArray:function(t,e,r){for(var n=t.length,i=new t.constructor(n),o=0,s=0;s!==n;++o)for(var a=r[o]*e,c=0;c!==e;++c)i[s++]=t[a+c];return i},flattenJSON:function(t,e,r,n){for(var i=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[i++];if(void 0!==o){var s=o[n];if(void 0!==s)if(Array.isArray(s))do{void 0!==(s=o[n])&&(e.push(o.time),r.push.apply(r,s)),o=t[i++]}while(void 0!==o);else if(void 0!==s.toArray)do{void 0!==(s=o[n])&&(e.push(o.time),s.toArray(r,r.length)),o=t[i++]}while(void 0!==o);else do{void 0!==(s=o[n])&&(e.push(o.time),r.push(s)),o=t[i++]}while(void 0!==o)}}};Object.assign($r.prototype,{evaluate:function(t){var e=this.parameterPositions,r=this._cachedIndex,n=e[r],i=e[r-1];t:{e:{r:{n:if(!(t<n)){for(var o=r+2;;){if(void 0===n){if(t<i)break n;return this._cachedIndex=r=e.length,this.afterEnd_(r-1,t,i)}if(r===o)break;if(i=n,n=e[++r],t<n)break e}n=e.length;break r}if(t>=i)break t;for(t<(o=e[1])&&(r=2,i=o),o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(r===o)break;if(n=i,i=e[--r-1],t>=i)break e}n=r,r=0}for(;r<n;)i=r+n>>>1,t<e[i]?n=i:r=i+1;if(n=e[r],void 0===(i=e[r-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return this._cachedIndex=r=e.length,this.afterEnd_(r-1,i,t)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e=this.resultBuffer,r=this.sampleValues,n=this.valueSize;t*=n;for(var i=0;i!==n;++i)e[i]=r[t+i];return e},interpolate_:function(t,e,r,n){throw Error("call to abstract method")},intervalChanged_:function(t,e,r){}}),Object.assign($r.prototype,{beforeStart_:$r.prototype.copySampleValue_,afterEnd_:$r.prototype.copySampleValue_}),Vr.prototype=Object.assign(Object.create($r.prototype),{constructor:Vr,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,r){var n=this.parameterPositions,i=t-2,o=t+1,s=n[i],a=n[o];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:i=t,s=2*e-r;break;case 2402:s=e+n[i=n.length-2]-n[i+1];break;default:i=t,s=r}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:o=t,a=2*r-e;break;case 2402:o=1,a=r+n[1]-n[0];break;default:o=t-1,a=e}t=.5*(r-e),n=this.valueSize,this._weightPrev=t/(e-s),this._weightNext=t/(a-r),this._offsetPrev=i*n,this._offsetNext=o*n},interpolate_:function(t,e,r,n){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(t*=s)-s,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,l=this._weightNext,p=(r-e)/(n-e);for(e=-h*(n=(r=p*p)*p)+2*h*r-h*p,h=(1+h)*n+(-1.5-2*h)*r+(-.5+h)*p+1,p=(-1-l)*n+(1.5+l)*r+.5*p,l=l*n-l*r,r=0;r!==s;++r)i[r]=e*o[c+r]+h*o[a+r]+p*o[t+r]+l*o[u+r];return i}}),Hr.prototype=Object.assign(Object.create($r.prototype),{constructor:Hr,interpolate_:function(t,e,r,n){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(t*=s)-s;for(r=1-(e=(r-e)/(n-e)),n=0;n!==s;++n)i[n]=o[a+n]*r+o[t+n]*e;return i}}),qr.prototype=Object.assign(Object.create($r.prototype),{constructor:qr,interpolate_:function(t,e,r,n){return this.copySampleValue_(t-1)}});var Hi;Hi={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new qr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Hr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Vr(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(e);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrackPrototype:",e)}else this.createInterpolant=e},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(t){if(0!==t)for(var e=this.times,r=0,n=e.length;r!==n;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,n=e.length;r!==n;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,n=r.length,i=0,o=n-1;i!==n&&r[i]<t;)++i;for(;-1!==o&&r[o]>e;)--o;return++o,0===i&&o===n||(i>=o&&(o=Math.max(o,1),i=o-1),n=this.getValueSize(),this.times=Vi.arraySlice(r,i,o),this.values=Vi.arraySlice(this.values,i*n,o*n)),this},validate:function(){var t=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),t=!1);var e=this.times,r=this.values,n=e.length;0===n&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),t=!1);for(var i=null,o=0;o!==n;o++){var s=e[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,o,s),t=!1;break}if(null!==i&&i>s){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,o,s,i),t=!1;break}i=s}if(void 0!==r&&Vi.isTypedArray(r))for(o=0,e=r.length;o!==e;++o)if(n=r[o],isNaN(n)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,o,n),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),n=2302===this.getInterpolation(),i=1,o=t.length-1,s=1;s<o;++s){var a=!1;if((l=t[s])!==t[s+1]&&(1!==s||l!==l[0]))if(n)a=!0;else for(var c=s*r,u=c-r,h=c+r,l=0;l!==r;++l){var p=e[c+l];if(p!==e[u+l]||p!==e[h+l]){a=!0;break}}if(a){if(s!==i)for(t[i]=t[s],a=s*r,c=i*r,l=0;l!==r;++l)e[c+l]=e[a+l];++i}}if(0<o){for(t[i]=t[o],a=o*r,c=i*r,l=0;l!==r;++l)e[c+l]=e[a+l];++i}return i!==t.length&&(this.times=Vi.arraySlice(t,0,i),this.values=Vi.arraySlice(e,0,i*r)),this}},Xr.prototype=Object.assign(Object.create(Hi),{constructor:Xr,ValueTypeName:"vector"}),Yr.prototype=Object.assign(Object.create($r.prototype),{constructor:Yr,interpolate_:function(t,e,r,n){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize;for(e=(r-e)/(n-e),r=(t*=s)+s;t!==r;t+=4)a.slerpFlat(i,0,o,t-s,o,t,e);return i}}),Kr.prototype=Object.assign(Object.create(Hi),{constructor:Kr,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Yr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Zr.prototype=Object.assign(Object.create(Hi),{constructor:Zr,ValueTypeName:"number"}),Jr.prototype=Object.assign(Object.create(Hi),{constructor:Jr,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Qr.prototype=Object.assign(Object.create(Hi),{constructor:Qr,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),tn.prototype=Object.assign(Object.create(Hi),{constructor:tn,ValueTypeName:"color"}),en.prototype=Hi,Hi.constructor=en,Object.assign(en,{parse:function(t){if(void 0===t.type)throw Error("track type undefined, can not parse");var e=en._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var r=[],n=[];Vi.flattenJSON(t.keys,r,n,"value"),t.times=r,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){if(void 0!==(e=t.constructor).toJSON)e=e.toJSON(t);else{var e={name:t.name,times:Vi.convertArray(t.times,Array),values:Vi.convertArray(t.values,Array)},r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Zr;case"vector":case"vector2":case"vector3":case"vector4":return Xr;case"color":return tn;case"quaternion":return Kr;case"bool":case"boolean":return Qr;case"string":return Jr}throw Error("Unsupported typeName: "+t)}}),Object.assign(rn,{parse:function(t){for(var e=[],r=t.tracks,n=1/(t.fps||1),i=0,o=r.length;i!==o;++i)e.push(en.parse(r[i]).scale(n));return new rn(t.name,t.duration,e)},toJSON:function(t){var e=[],r=t.tracks;t={name:t.name,duration:t.duration,tracks:e};for(var n=0,i=r.length;n!==i;++n)e.push(en.toJSON(r[n]));return t},CreateFromMorphTargetSequence:function(t,e,r,n){for(var i=e.length,o=[],s=0;s<i;s++){u=[];(c=[]).push((s+i-1)%i,s,(s+1)%i),u.push(0,1,0);var a=Vi.getKeyframeOrder(c),c=Vi.sortedArray(c,1,a),u=Vi.sortedArray(u,1,a);n||0!==c[0]||(c.push(i),u.push(u[0])),o.push(new Zr(".morphTargetInfluences["+e[s].name+"]",c,u).scale(1/r))}return new rn(t,-1,o)},findByName:function(t,e){var r=t;Array.isArray(t)||(r=t.geometry&&t.geometry.animations||t.animations);for(var n=0;n<r.length;n++)if(r[n].name===e)return r[n];return null},CreateClipsFromMorphTargetSequences:function(t,e,r){for(var n={},i=/^([\w-]*?)([\d]+)$/,o=0,s=t.length;o<s;o++){var a=t[o],c=a.name.match(i);if(c&&1<c.length){var u=c[1];(c=n[u])||(n[u]=c=[]),c.push(a)}}t=[];for(u in n)t.push(rn.CreateFromMorphTargetSequence(u,n[u],e,r));return t},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var r=function(t,e,r,n,i){if(0!==r.length){var o=[],s=[];Vi.flattenJSON(r,o,s,n),0!==o.length&&i.push(new t(e,o,s))}},n=[],i=t.name||"default",o=t.length||-1,s=t.fps||30,a=t.hierarchy||[],c=0;c<a.length;c++){var u=a[c].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var o={},h=0;h<u.length;h++)if(u[h].morphTargets)for(d=0;d<u[h].morphTargets.length;d++)o[u[h].morphTargets[d]]=-1;for(var l in o){for(var p=[],f=[],d=0;d!==u[h].morphTargets.length;++d){var m=u[h];p.push(m.time),f.push(m.morphTarget===l?1:0)}n.push(new Zr(".morphTargetInfluence["+l+"]",p,f))}o=o.length*(s||1)}else h=".bones["+e[c].name+"]",r(Xr,h+".position",u,"pos",n),r(Kr,h+".quaternion",u,"rot",n),r(Xr,h+".scale",u,"scl",n)}return 0===n.length?null:new rn(i,o,n)}}),Object.assign(rn.prototype,{resetDuration:function(){for(var t=0,e=0,r=this.tracks.length;e!==r;++e)var n=this.tracks[e],t=Math.max(t,n.times[n.times.length-1]);this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(nn.prototype,{load:function(t,e,r,n){var i=this;new Cr(i.manager).load(t,function(t){e(i.parse(JSON.parse(t)))},r,n)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var n=this.textures,i=new zi[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearCoat&&(i.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(i.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(i.uniforms=t.uniforms),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(i.vertexColors=t.vertexColors),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.shading&&(i.shading=t.shading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.side&&(i.side=t.side),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(i.skinning=t.skinning),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=e(t.map)),void 0!==t.alphaMap&&(i.alphaMap=e(t.alphaMap),i.transparent=!0),void 0!==t.bumpMap&&(i.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=e(t.normalMap)),void 0!==t.normalScale){var o=t.normalScale;!1===Array.isArray(o)&&(o=[o,o]),i.normalScale=(new r).fromArray(o)}return void 0!==t.displacementMap&&(i.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=e(t.specularMap)),void 0!==t.envMap&&(i.envMap=e(t.envMap)),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.lightMap&&(i.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=e(t.gradientMap)),i}}),Object.assign(on.prototype,{load:function(t,e,r,n){var i=this;new Cr(i.manager).load(t,function(t){e(i.parse(JSON.parse(t)))},r,n)},parse:function(t){var e=new St;void 0!==(o=t.data.index)&&(o=new qi[o.type](o.array),e.setIndex(new lt(o,1)));var r,n=t.data.attributes;for(r in n){var i=n[r],o=new qi[i.type](i.array);e.addAttribute(r,new lt(o,i.itemSize,i.normalized))}if(void 0!==(r=t.data.groups||t.data.drawcalls||t.data.offsets))for(o=0,n=r.length;o!==n;++o)i=r[o],e.addGroup(i.start,i.count,i.materialIndex);return void 0!==(t=t.data.boundingSphere)&&(r=new c,void 0!==t.center&&r.fromArray(t.center),e.boundingSphere=new Z(r,t.radius)),e}});var qi={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};sn.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,n=e.length;r<n;r+=2){var i=e[r+1];if(e[r].test(t))return i}return null}},Object.assign(sn.prototype,{crossOrigin:void 0,extractUrlBase:function(t){return 1===(t=t.split("/")).length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(t,e,r){for(var n=[],i=0;i<t.length;++i)n[i]=this.createMaterial(t[i],e,r);return n},createMaterial:function(){var t={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},e=new $,r=new Rr,n=new nn;return function(i,o,s){function a(t,e,n,i,a){t=o+t;var c=sn.Handlers.get(t);return null!==c?t=c.load(t):(r.setCrossOrigin(s),t=r.load(t)),void 0!==e&&(t.repeat.fromArray(e),1!==e[0]&&(t.wrapS=1e3),1!==e[1]&&(t.wrapT=1e3)),void 0!==n&&t.offset.fromArray(n),void 0!==i&&("repeat"===i[0]&&(t.wrapS=1e3),"mirror"===i[0]&&(t.wrapS=1002),"repeat"===i[1]&&(t.wrapT=1e3),"mirror"===i[1]&&(t.wrapT=1002)),void 0!==a&&(t.anisotropy=a),e=xi.generateUUID(),u[e]=t,e}var c,u={},h={uuid:xi.generateUUID(),type:"MeshLambertMaterial"};for(c in i){var l=i[c];switch(c){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=l;break;case"blending":h.blending=t[l];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",c,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(l).getHex();break;case"colorSpecular":h.specular=e.fromArray(l).getHex();break;case"colorEmissive":h.emissive=e.fromArray(l).getHex();break;case"specularCoef":h.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(h.type="MeshPhongMaterial"),"standard"===l.toLowerCase()&&(h.type="MeshStandardMaterial");break;case"mapDiffuse":h.map=a(l,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":h.emissiveMap=a(l,i.mapEmissiveRepeat,i.mapEmissiveOffset,i.mapEmissiveWrap,i.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":h.lightMap=a(l,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=a(l,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=a(l,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=a(l,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=a(l,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":h.metalnessMap=a(l,i.mapMetalnessRepeat,i.mapMetalnessOffset,i.mapMetalnessWrap,i.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":h.roughnessMap=a(l,i.mapRoughnessRepeat,i.mapRoughnessOffset,i.mapRoughnessWrap,i.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":h.alphaMap=a(l,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=1;break;case"doubleSided":h.side=2;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[c]=l;break;case"vertexColors":!0===l&&(h.vertexColors=2),"face"===l&&(h.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",c,l)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,1>h.opacity&&(h.transparent=!0),n.setTextures(u),n.parse(h)}}()}),Object.assign(an.prototype,{load:function(t,e,r,n){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:sn.prototype.extractUrlBase(t),s=new Cr(this.manager);s.setWithCredentials(this.withCredentials),s.load(t,function(r){var n=(r=JSON.parse(r)).metadata;if(void 0!==n&&void 0!==(n=n.type)){if("object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}r=i.parse(r,o),e(r.geometry,r.materials)},r,n)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){void 0!==t.data&&(t=t.data),t.scale=void 0!==t.scale?1/t.scale:1;var n,o,s,a,u,h,l,p,f,d,m,v,g,y,b=new ht,_=t,x=_.faces;f=_.vertices;var w=_.normals,S=_.colors;h=_.scale;var M=0;if(void 0!==_.uvs){for(n=0;n<_.uvs.length;n++)_.uvs[n].length&&M++;for(n=0;n<M;n++)b.faceVertexUvs[n]=[]}for(a=0,u=f.length;a<u;)n=new c,n.x=f[a++]*h,n.y=f[a++]*h,n.z=f[a++]*h,b.vertices.push(n);for(a=0,u=x.length;a<u;)if(f=x[a++],d=1&f,s=2&f,n=8&f,l=16&f,m=32&f,h=64&f,f&=128,d){if(d=new ut,d.a=x[a],d.b=x[a+1],d.c=x[a+3],v=new ut,v.a=x[a+1],v.b=x[a+2],v.c=x[a+3],a+=4,s&&(s=x[a++],d.materialIndex=s,v.materialIndex=s),s=b.faces.length,n)for(n=0;n<M;n++)for(g=_.uvs[n],b.faceVertexUvs[n][s]=[],b.faceVertexUvs[n][s+1]=[],o=0;4>o;o++)p=x[a++],y=g[2*p],p=g[2*p+1],y=new r(y,p),2!==o&&b.faceVertexUvs[n][s].push(y),0!==o&&b.faceVertexUvs[n][s+1].push(y);if(l&&(l=3*x[a++],d.normal.set(w[l++],w[l++],w[l]),v.normal.copy(d.normal)),m)for(n=0;4>n;n++)l=3*x[a++],m=new c(w[l++],w[l++],w[l]),2!==n&&d.vertexNormals.push(m),0!==n&&v.vertexNormals.push(m);if(h&&(h=x[a++],h=S[h],d.color.setHex(h),v.color.setHex(h)),f)for(n=0;4>n;n++)h=x[a++],h=S[h],2!==n&&d.vertexColors.push(new $(h)),0!==n&&v.vertexColors.push(new $(h));b.faces.push(d),b.faces.push(v)}else{if(d=new ut,d.a=x[a++],d.b=x[a++],d.c=x[a++],s&&(s=x[a++],d.materialIndex=s),s=b.faces.length,n)for(n=0;n<M;n++)for(g=_.uvs[n],b.faceVertexUvs[n][s]=[],o=0;3>o;o++)p=x[a++],y=g[2*p],p=g[2*p+1],y=new r(y,p),b.faceVertexUvs[n][s].push(y);if(l&&(l=3*x[a++],d.normal.set(w[l++],w[l++],w[l])),m)for(n=0;3>n;n++)l=3*x[a++],m=new c(w[l++],w[l++],w[l]),d.vertexNormals.push(m);if(h&&(h=x[a++],d.color.setHex(S[h])),f)for(n=0;3>n;n++)h=x[a++],d.vertexColors.push(new $(S[h]));b.faces.push(d)}if(_=t,a=void 0!==_.influencesPerVertex?_.influencesPerVertex:2,_.skinWeights)for(u=0,x=_.skinWeights.length;u<x;u+=a)b.skinWeights.push(new i(_.skinWeights[u],1<a?_.skinWeights[u+1]:0,2<a?_.skinWeights[u+2]:0,3<a?_.skinWeights[u+3]:0));if(_.skinIndices)for(u=0,x=_.skinIndices.length;u<x;u+=a)b.skinIndices.push(new i(_.skinIndices[u],1<a?_.skinIndices[u+1]:0,2<a?_.skinIndices[u+2]:0,3<a?_.skinIndices[u+3]:0));if(b.bones=_.bones,b.bones&&0<b.bones.length&&(b.skinWeights.length!==b.skinIndices.length||b.skinIndices.length!==b.vertices.length)&&console.warn("When skinning, number of vertices ("+b.vertices.length+"), skinIndices ("+b.skinIndices.length+"), and skinWeights ("+b.skinWeights.length+") should match."),u=t,x=u.scale,void 0!==u.morphTargets)for(_=0,a=u.morphTargets.length;_<a;_++)for(b.morphTargets[_]={},b.morphTargets[_].name=u.morphTargets[_].name,b.morphTargets[_].vertices=[],w=b.morphTargets[_].vertices,S=u.morphTargets[_].vertices,M=0,f=S.length;M<f;M+=3)h=new c,h.x=S[M]*x,h.y=S[M+1]*x,h.z=S[M+2]*x,w.push(h);if(void 0!==u.morphColors&&0<u.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),x=b.faces,u=u.morphColors[0].colors,_=0,a=x.length;_<a;_++)x[_].color.fromArray(u,3*_);for(_=[],a=[],void 0!==(u=t).animation&&a.push(u.animation),void 0!==u.animations&&(u.animations.length?a=a.concat(u.animations):a.push(u.animations)),u=0;u<a.length;u++)(x=rn.parseAnimation(a[u],b.bones))&&_.push(x);return b.morphTargets&&(a=rn.CreateClipsFromMorphTargetSequences(b.morphTargets,10),_=_.concat(a)),0<_.length&&(b.animations=_),b.computeFaceNormals(),b.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:b}:(_=sn.prototype.initMaterials(t.materials,e,this.crossOrigin),{geometry:b,materials:_})}}),Object.assign(cn.prototype,{load:function(t,e,r,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this;new Cr(i.manager).load(t,function(r){var o=null;try{o=JSON.parse(r)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}void 0===(r=o.metadata)||void 0===r.type||"geometry"===r.type.toLowerCase()?console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead."):i.parse(o,e)},r,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(i)}),n=this.parseTextures(t.textures,n),n=this.parseMaterials(t.materials,n),i=this.parseObject(t.object,r,n);return t.animations&&(i.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0===e||e(i),i},parseGeometries:function(t){var e={};if(void 0!==t)for(var r=new an,n=new on,i=0,o=t.length;i<o;i++){var s,a=t[i];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Ui[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Ui[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Ui[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Ui[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 Ui[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Ui[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":s=new Ui[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Ui[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Ui[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Ui[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Ui[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"BufferGeometry":s=n.parse(a);break;case"Geometry":s=r.parse(a,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+a.type+'"');continue}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),e[a.uuid]=s}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var n=new nn;n.setTextures(e);for(var i=0,o=t.length;i<o;i++){var s=t[i];if("MultiMaterial"===s.type){for(var a=[],c=0;c<s.materials.length;c++)a.push(n.parse(s.materials[c]));r[s.uuid]=a}else r[s.uuid]=n.parse(s)}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var n=rn.parse(t[r]);e.push(n)}return e},parseImages:function(t,e){var r=this,n={};if(void 0!==t&&0<t.length){var i=new Ar(o=new Tr(e));i.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var a=t[o],c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a.url)?a.url:r.texturePath+a.url;n[a.uuid]=function(t){return r.manager.itemStart(t),i.load(t,function(){r.manager.itemEnd(t)},void 0,function(){r.manager.itemEnd(t),r.manager.itemError(t)})}(c)}}return n},parseTextures:function(t,e){function r(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var i={};if(void 0!==t)for(var o=0,s=t.length;o<s;o++){var a=t[o];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var c=new n(e[a.image]);c.needsUpdate=!0,c.uuid=a.uuid,void 0!==a.name&&(c.name=a.name),void 0!==a.mapping&&(c.mapping=r(a.mapping,Wi)),void 0!==a.offset&&c.offset.fromArray(a.offset),void 0!==a.repeat&&c.repeat.fromArray(a.repeat),void 0!==a.wrap&&(c.wrapS=r(a.wrap[0],Xi),c.wrapT=r(a.wrap[1],Xi)),void 0!==a.minFilter&&(c.minFilter=r(a.minFilter,Yi)),void 0!==a.magFilter&&(c.magFilter=r(a.magFilter,Yi)),void 0!==a.anisotropy&&(c.anisotropy=a.anisotropy),void 0!==a.flipY&&(c.flipY=a.flipY),i[a.uuid]=c}return i},parseObject:function(){var t=new u;return function(e,r,n){function i(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]}function o(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],r=0,i=t.length;r<i;r++){var o=t[r];void 0===n[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),e.push(n[o])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}var s;switch(e.type){case"Scene":s=new de,void 0!==e.background&&Number.isInteger(e.background)&&(s.background=new $(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?s.fog=new fe(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(s.fog=new pe(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":s=new ct(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new at(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":s=new zr(e.color,e.intensity);break;case"DirectionalLight":s=new Ur(e.color,e.intensity);break;case"PointLight":s=new Fr(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new Gr(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new kr(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":s=new Nr(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":s=i(e.geometry);var a=o(e.material);s=s.bones&&0<s.bones.length?new xe(s,a):new Rt(s,a);break;case"LOD":s=new ye;break;case"Line":s=new Se(i(e.geometry),o(e.material),e.mode);break;case"LineLoop":s=new Ee(i(e.geometry),o(e.material));break;case"LineSegments":s=new Me(i(e.geometry),o(e.material));break;case"PointCloud":case"Points":s=new Ce(i(e.geometry),o(e.material));break;case"Sprite":s=new ge(o(e.material));break;case"Group":s=new Oe;break;default:s=new ot}if(s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(s.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.userData&&(s.userData=e.userData),void 0!==e.children)for(var c in e.children)s.add(this.parseObject(e.children[c],r,n));if("LOD"===e.type)for(e=e.levels,a=0;a<e.length;a++){var u=e[a];void 0!==(c=s.getObjectByProperty("uuid",u.object))&&s.addLevel(c,u.distance)}return s}}()});var Wi={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Xi={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Yi={NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008};Object.assign(pn.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,n=[],i=this.getPoint(0),o=0;for(n.push(0),r=1;r<=t;r++)e=this.getPoint(r/t),o+=e.distanceTo(i),n.push(o),i=e;return this.cacheArcLengths=n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,n,i=this.getLengths(),o=i.length;n=e||t*i[o-1];for(var s,a=0,c=o-1;a<=c;)if(r=Math.floor(a+(c-a)/2),0>(s=i[r]-n))a=r+1;else{if(!(0<s)){c=r;break}c=r-1}return r=c,i[r]===n?r/(o-1):(a=i[r],(r+(n-a)/(i[r+1]-a))/(o-1))},getTangent:function(t){var e=t-1e-4;return t+=1e-4,0>e&&(e=0),1<t&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)},computeFrenetFrames:function(t,e){var r,n,i=new c,o=[],s=[],a=[],h=new c,l=new u;for(r=0;r<=t;r++)n=r/t,o[r]=this.getTangentAt(n),o[r].normalize();s[0]=new c,a[0]=new c,r=Number.MAX_VALUE,n=Math.abs(o[0].x);var p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(n<=r&&(r=n,i.set(1,0,0)),p<=r&&(r=p,i.set(0,1,0)),f<=r&&i.set(0,0,1),h.crossVectors(o[0],i).normalize(),s[0].crossVectors(o[0],h),a[0].crossVectors(o[0],s[0]),r=1;r<=t;r++)s[r]=s[r-1].clone(),a[r]=a[r-1].clone(),h.crossVectors(o[r-1],o[r]),h.length()>Number.EPSILON&&(h.normalize(),i=Math.acos(xi.clamp(o[r-1].dot(o[r]),-1,1)),s[r].applyMatrix4(l.makeRotationAxis(h,i))),a[r].crossVectors(o[r],s[r]);if(!0===e)for(i=Math.acos(xi.clamp(s[0].dot(s[t]),-1,1)),i/=t,0<o[0].dot(h.crossVectors(s[0],s[t]))&&(i=-i),r=1;r<=t;r++)s[r].applyMatrix4(l.makeRotationAxis(o[r],i*r)),a[r].crossVectors(o[r],s[r]);return{tangents:o,normals:s,binormals:a}}}),(fn.prototype=Object.create(pn.prototype)).constructor=fn,fn.prototype.isLineCurve=!0,fn.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},fn.prototype.getPointAt=function(t){return this.getPoint(t)},fn.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},dn.prototype=Object.assign(Object.create(pn.prototype),{constructor:dn,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new fn(e,t))},getPoint:function(t){var e=t*this.getLength(),r=this.getCurveLengths();for(t=0;t<r.length;){if(r[t]>=e)return e=r[t]-e,t=this.curves[t],r=t.getLength(),t.getPointAt(0===r?0:1-e/r);t++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.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 t=[],e=0,r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,r=[],n=0,i=this.curves;n<i.length;n++)for(var o=i[n],o=o.getPoints(o&&o.isEllipseCurve?2*t:o&&o.isLineCurve?1:o&&o.isSplineCurve?t*o.points.length:t),s=0;s<o.length;s++){var a=o[s];e&&e.equals(a)||(r.push(a),e=a)}return this.autoClose&&1<r.length&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r},createPointsGeometry:function(t){return t=this.getPoints(t),this.createGeometry(t)},createSpacedPointsGeometry:function(t){return t=this.getSpacedPoints(t),this.createGeometry(t)},createGeometry:function(t){for(var e=new ht,r=0,n=t.length;r<n;r++){var i=t[r];e.vertices.push(new c(i.x,i.y,i.z||0))}return e}}),mn.prototype=Object.create(pn.prototype),mn.prototype.constructor=mn,mn.prototype.isEllipseCurve=!0,mn.prototype.getPoint=function(t){for(var e=2*Math.PI,n=this.aEndAngle-this.aStartAngle,i=Math.abs(n)<Number.EPSILON;0>n;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(n=i?0:e),!0!==this.aClockwise||i||(n=n===e?-e:n-e),e=this.aStartAngle+t*n,t=this.aX+this.xRadius*Math.cos(e);var o=this.aY+this.yRadius*Math.sin(e);return 0!==this.aRotation&&(e=Math.cos(this.aRotation),n=Math.sin(this.aRotation),i=t-this.aX,o-=this.aY,t=i*e-o*n+this.aX,o=i*n+o*e+this.aY),new r(t,o)},(vn.prototype=Object.create(pn.prototype)).constructor=vn,vn.prototype.isSplineCurve=!0,vn.prototype.getPoint=function(t){var e=(e=((s=this.points).length-1)*t)-(t=Math.floor(e)),n=s[0===t?t:t-1],i=s[t],o=s[t>s.length-2?s.length-1:t+1],s=s[t>s.length-3?s.length-1:t+2];return new r(un(e,n.x,i.x,o.x,s.x),un(e,n.y,i.y,o.y,s.y))},(gn.prototype=Object.create(pn.prototype)).constructor=gn,gn.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,o=this.v3;return new r(ln(t,e.x,n.x,i.x,o.x),ln(t,e.y,n.y,i.y,o.y))},(yn.prototype=Object.create(pn.prototype)).constructor=yn,yn.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new r(hn(t,e.x,n.x,i.x),hn(t,e.y,n.y,i.y))};var Ki=Object.assign(Object.create(dn.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var n=new fn(this.currentPoint.clone(),new r(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,i){t=new yn(this.currentPoint.clone(),new r(t,e),new r(n,i)),this.curves.push(t),this.currentPoint.set(n,i)},bezierCurveTo:function(t,e,n,i,o,s){t=new gn(this.currentPoint.clone(),new r(t,e),new r(n,i),new r(o,s)),this.curves.push(t),this.currentPoint.set(o,s)},splineThru:function(t){var e=new vn(e=[this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,r,n,i,o){this.absarc(t+this.currentPoint.x,e+this.currentPoint.y,r,n,i,o)},absarc:function(t,e,r,n,i,o){this.absellipse(t,e,r,r,n,i,o)},ellipse:function(t,e,r,n,i,o,s,a){this.absellipse(t+this.currentPoint.x,e+this.currentPoint.y,r,n,i,o,s,a)},absellipse:function(t,e,r,n,i,o,s,a){t=new mn(t,e,r,n,i,o,s,a),0<this.curves.length&&((e=t.getPoint(0)).equals(this.currentPoint)||this.lineTo(e.x,e.y)),this.curves.push(t),t=t.getPoint(1),this.currentPoint.copy(t)}});bn.prototype=Ki,Ki.constructor=bn,_n.prototype=Object.assign(Object.create(Ki),{constructor:_n,getPointsHoles:function(t){for(var e=[],r=0,n=this.holes.length;r<n;r++)e[r]=this.holes[r].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),Object.assign(xn.prototype,{moveTo:function(t,e){this.currentPath=new bn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,r,n){this.currentPath.quadraticCurveTo(t,e,r,n)},bezierCurveTo:function(t,e,r,n,i,o){this.currentPath.bezierCurveTo(t,e,r,n,i,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function r(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r],o=new _n;o.curves=i.curves,e.push(o)}return e}var n=Bi.isClockWise,i=this.subPaths;if(0===i.length)return[];if(!0===e)return r(i);var o,s,a,c=[];if(1===i.length)return s=i[0],a=new _n,a.curves=s.curves,c.push(a),c;var u=!n(i[0].getPoints()),u=t?!u:u;a=[];var h,l=[],p=[],f=0;l[f]=void 0,p[f]=[];for(var d=0,m=i.length;d<m;d++)s=i[d],h=s.getPoints(),o=n(h),(o=t?!o:o)?(!u&&l[f]&&f++,l[f]={s:new _n,p:h},l[f].s.curves=s.curves,u&&f++,p[f]=[]):p[f].push({h:s,p:h[0]});if(!l[0])return r(i);if(1<l.length){for(d=!1,s=[],n=0,i=l.length;n<i;n++)a[n]=[];for(n=0,i=l.length;n<i;n++)for(o=p[n],u=0;u<o.length;u++){for(f=o[u],h=!0,m=0;m<l.length;m++)(function(t,e){for(var r=e.length,n=!1,i=r-1,o=0;o<r;i=o++){var s=e[i],a=e[o],c=a.x-s.x,u=a.y-s.y;if(Math.abs(u)>Number.EPSILON){if(0>u&&(s=e[o],c=-c,a=e[i],u=-u),!(t.y<s.y||t.y>a.y))if(t.y===s.y){if(t.x===s.x)return!0}else{if(0==(i=u*(t.x-s.x)-c*(t.y-s.y)))return!0;0>i||(n=!n)}}else if(t.y===s.y&&(a.x<=t.x&&t.x<=s.x||s.x<=t.x&&t.x<=a.x))return!0}return n})(f.p,l[m].p)&&(n!==m&&s.push({froms:n,tos:m,hole:u}),h?(h=!1,a[m].push(f)):d=!0);h&&a[n].push(f)}0<s.length&&(d||(p=a))}for(d=0,n=l.length;d<n;d++)for(a=l[d].s,c.push(a),s=p[d],i=0,o=s.length;i<o;i++)a.holes.push(s[i].h);return c}}),Object.assign(wn.prototype,{isFont:!0,generateShapes:function(t,e,r){void 0===e&&(e=100),void 0===r&&(r=4);var n=this.data;t=String(t).split("");var i=e/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,s=0,a=0;e=[];for(var c=0;c<t.length;c++){var u=t[c];if("\n"===u)s=0,a-=o;else{var h;h=i;var l=s,p=a;if(u=n.glyphs[u]||n.glyphs["?"]){var f,d,m,v,g,y,b,_,x=new xn,w=[];if(u.o)for(var S=u._cachedOutline||(u._cachedOutline=u.o.split(" ")),M=0,E=S.length;M<E;)switch(S[M++]){case"m":f=S[M++]*h+l,d=S[M++]*h+p,x.moveTo(f,d);break;case"l":f=S[M++]*h+l,d=S[M++]*h+p,x.lineTo(f,d);break;case"q":if(f=S[M++]*h+l,d=S[M++]*h+p,g=S[M++]*h+l,y=S[M++]*h+p,x.quadraticCurveTo(g,y,f,d),v=w[w.length-1]){m=v.x,v=v.y;for(var T=1;T<=r;T++){var C=T/r;hn(C,m,g,f),hn(C,v,y,d)}}break;case"b":if(f=S[M++]*h+l,d=S[M++]*h+p,g=S[M++]*h+l,y=S[M++]*h+p,b=S[M++]*h+l,_=S[M++]*h+p,x.bezierCurveTo(g,y,b,_,f,d),v=w[w.length-1])for(m=v.x,v=v.y,T=1;T<=r;T++)C=T/r,ln(C,m,g,b,f),ln(C,v,y,_,d)}h={offsetX:u.ha*h,path:x}}else h=void 0;s+=h.offsetX,e.push(h.path)}}for(r=[],n=0,t=e.length;n<t;n++)Array.prototype.push.apply(r,e[n].toShapes());return r}}),Object.assign(Sn.prototype,{load:function(t,e,r,n){var i=this;new Cr(this.manager).load(t,function(t){var r;try{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),e&&e(t)},r,n)},parse:function(t){return new wn(t)}});var Zi,Ji={getContext:function(){return void 0===Zi&&(Zi=new(window.AudioContext||window.webkitAudioContext)),Zi},setContext:function(t){Zi=t}};Object.assign(Mn.prototype,{load:function(t,e,r,n){var i=new Cr(this.manager);i.setResponseType("arraybuffer"),i.load(t,function(t){Ji.getContext().decodeAudioData(t,function(t){e(t)})},r,n)}}),Object.assign(En.prototype,{update:function(){var t,e,r,n,i,o,s,a,c=new u,h=new u;return function(u){if(t!==this||e!==u.focus||r!==u.fov||n!==u.aspect*this.aspect||i!==u.near||o!==u.far||s!==u.zoom||a!==this.eyeSep){t=this,e=u.focus,r=u.fov,n=u.aspect*this.aspect,i=u.near,o=u.far,s=u.zoom;var l,p,f=u.projectionMatrix.clone(),d=(a=this.eyeSep/2)*i/e,m=i*Math.tan(xi.DEG2RAD*r*.5)/s;h.elements[12]=-a,c.elements[12]=a,l=-m*n+d,p=m*n+d,f.elements[0]=2*i/(p-l),f.elements[8]=(p+l)/(p-l),this.cameraL.projectionMatrix.copy(f),l=-m*n-d,p=m*n-d,f.elements[0]=2*i/(p-l),f.elements[8]=(p+l)/(p-l),this.cameraR.projectionMatrix.copy(f)}this.cameraL.matrixWorld.copy(u.matrixWorld).multiply(h),this.cameraR.matrixWorld.copy(u.matrixWorld).multiply(c)}}()}),(Tn.prototype=Object.create(ot.prototype)).constructor=Tn,Cn.prototype=Object.assign(Object.create(ot.prototype),{constructor:Cn,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)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new c,e=new a,r=new c,n=new c;return function(i){ot.prototype.updateMatrixWorld.call(this,i),i=this.context.listener;var o=this.up;this.matrixWorld.decompose(t,e,r),n.set(0,0,-1).applyQuaternion(e),i.positionX?(i.positionX.setValueAtTime(t.x,this.context.currentTime),i.positionY.setValueAtTime(t.y,this.context.currentTime),i.positionZ.setValueAtTime(t.z,this.context.currentTime),i.forwardX.setValueAtTime(n.x,this.context.currentTime),i.forwardY.setValueAtTime(n.y,this.context.currentTime),i.forwardZ.setValueAtTime(n.z,this.context.currentTime),i.upX.setValueAtTime(o.x,this.context.currentTime),i.upY.setValueAtTime(o.y,this.context.currentTime),i.upZ.setValueAtTime(o.z,this.context.currentTime)):(i.setPosition(t.x,t.y,t.z),i.setOrientation(n.x,n.y,n.z,o.x,o.y,o.z))}}()}),On.prototype=Object.assign(Object.create(ot.prototype),{constructor:On,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else{if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}},pause:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);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 t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},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(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),Pn.prototype=Object.assign(Object.create(On.prototype),{constructor:Pn,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new c;return function(e){ot.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(An.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),r=0;r<e.length;r++)t+=e[r];return t/e.length}}),Object.assign(jn.prototype,{accumulate:function(t,e){var r=this.buffer,n=this.valueSize,i=t*n+n,o=this.cumulativeWeight;if(0===o){for(o=0;o!==n;++o)r[i+o]=r[o];o=e}else o+=e,this._mixBufferRegion(r,i,0,e/o,n);this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,r=this.buffer;t=t*e+e;var n=this.cumulativeWeight,i=this.binding;this.cumulativeWeight=0,1>n&&this._mixBufferRegion(r,t,3*e,1-n,e);for(var n=e,o=e+e;n!==o;++n)if(r[n]!==r[n+e]){i.setValue(r,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,r=3*e;this.binding.getValue(t,r);for(var n=e;n!==r;++n)t[n]=t[r+n%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,r,n,i){if(.5<=n)for(n=0;n!==i;++n)t[e+n]=t[r+n]},_slerp:function(t,e,r,n){a.slerpFlat(t,e,t,e,t,r,n)},_lerp:function(t,e,r,n,i){for(var o=1-n,s=0;s!==i;++s){var a=e+s;t[a]=t[a]*o+t[r+s]*n}}}),Object.assign(Rn.prototype,{getValue:function(t,e){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}}),Object.assign(Ln,{Composite:Rn,create:function(t,e,r){return t&&t.isAnimationObjectGroup?new Ln.Composite(t,e,r):new Ln(t,e,r)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var t=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),e=["material","materials","bones"];return function(r){var n=t.exec(r);if(!n)throw Error("PropertyBinding: Cannot parse trackName: "+r);var i=(n={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]}).nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var o=n.nodeName.substring(i+1);-1!==e.indexOf(o)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+r);return n}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r<t.bones.length;r++){var n=t.bones[r];if(n.name===e)return n}return null}(t.skeleton);if(r)return r}if(t.children){var n=function(t){for(var r=0;r<t.length;r++){var i=t[r];if(i.name===e||i.uuid===e||(i=n(i.children)))return i}return null};if(r=n(t.children))return r}return null}}),Object.assign(Ln.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(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)t[e++]=r[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++]},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,n=e.propertyName,i=e.propertyIndex;if(t||(this.node=t=Ln.findNode(this.rootNode,e.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);for(t=t.skeleton.bones,r=0;r<t.length;r++)if(t[r].name===o){o=r;break}break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}if(void 0===(o=t[n]))console.error("THREE.PropertyBinding: Trying to update property for track: "+e.nodeName+"."+n+" but it wasn't found.",t);else{if(e=this.Versioning.None,void 0!==t.needsUpdate?(e=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(e=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t),r=this.BindingType.Direct,void 0!==i){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(r=0;r<this.node.geometry.morphAttributes.position.length;r++)if(t.geometry.morphAttributes.position[r].name===i){i=r;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(r=0;r<this.node.geometry.morphTargets.length;r++)if(t.geometry.morphTargets[r].name===i){i=r;break}}}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][e]}}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(Ln.prototype,{_getValue_unbound:Ln.prototype.getValue,_setValue_unbound:Ln.prototype.setValue}),Object.assign(Nn.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,r=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,o=this._paths,s=this._parsedPaths,a=this._bindings,c=a.length,u=0,h=arguments.length;u!==h;++u){var l=arguments[u],p=i[f=l.uuid];if(void 0===p){p=r++,i[f]=p,e.push(l);for(var f=0,d=c;f!==d;++f)a[f].push(new Ln(l,o[f],s[f]))}else if(p<n){var m=--n;for(i[(d=e[m]).uuid]=p,e[p]=d,i[f]=m,e[m]=l,f=0,d=c;f!==d;++f){var v=a[f],g=v[p];v[p]=v[m],void 0===g&&(g=new Ln(l,o[f],s[f])),v[m]=g}}else void 0!==e[p]&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(t){for(var e=this._objects,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,o=i.length,s=0,a=arguments.length;s!==a;++s){var c=arguments[s],u=c.uuid,h=n[u];if(void 0!==h&&h>=r){var l=r++,p=e[l];for(n[p.uuid]=h,e[h]=p,n[u]=l,e[l]=c,c=0,u=o;c!==u;++c){var f=(p=i[c])[h];p[h]=p[l],p[l]=f}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,s=o.length,a=0,c=arguments.length;a!==c;++a){var u=arguments[a].uuid,h=i[u];if(void 0!==h)if(delete i[u],h<n){var l=e[u=--n],p=--r,f=e[p];for(i[l.uuid]=h,e[h]=l,i[f.uuid]=u,e[u]=f,e.pop(),l=0,f=s;l!==f;++l){var d=o[l],m=d[p];d[h]=d[u],d[u]=m,d.pop()}}else for(p=--r,f=e[p],i[f.uuid]=h,e[h]=f,e.pop(),l=0,f=s;l!==f;++l)d=o[l],d[h]=d[p],d.pop()}this.nCachedObjects_=n},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,n=r[t],i=this._bindings;if(void 0!==n)return i[n];var o=this._paths,s=this._parsedPaths,a=this._objects,c=this.nCachedObjects_,u=Array(a.length),n=i.length;for(r[t]=n,o.push(t),s.push(e),i.push(u),r=c,n=a.length;r!==n;++r)u[r]=new Ln(a[r],t,e);return u},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var n=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=r,o[r]=a,o.pop(),i[r]=i[s],i.pop(),n[r]=n[s],n.pop()}}}),Object.assign(In.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,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(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){r=this._clip.duration;var n=t._clip.duration,i=r/n;t.warp(1,n/r,e),this.warp(i,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,r){var n=this._mixer,i=n.time,o=this._timeScaleInterpolant,s=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=n._lendControlInterpolant()),n=o.parameterPositions,o=o.sampleValues,n[0]=i,n[1]=i+r,o[0]=t/s,o[1]=e/s,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,n){if(this.enabled){if(null!==(i=this._startTime)){if(0>(e=(t-i)*r)||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants;for(var i=this._propertyBindings,o=0,s=e.length;o!==s;++o)e[o].evaluate(r),i[o].accumulate(n,t)}}else this._updateWeight(t)},_updateWeight:function(t){e=0;if(this.enabled){var e=this.weight,r=this._weightInterpolant;if(null!==r){var n=r.evaluate(t)[0],e=e*n;t>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){e=0;if(!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;if(null!==r){e=e*r.evaluate(t)[0];t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e},_updateTime:function(t){o=this.time+t;if(0===t)return o;var e=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r)t:{if(-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1)),o>=e)o=e;else{if(!(0>o))break t;o=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1})}else{if(r=2202===r,-1===n&&(0<=t?(n=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),o>=e||0>o){var i=Math.floor(o/e),o=o-e*i,n=n+Math.abs(i),s=this.repetitions-n;0>s?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,o=0<t?e:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1})):(0===s?(t=0>t,this._setEndings(t,!t,r)):this._setEndings(!1,!1,r),this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i}))}if(r&&1==(1&n))return this.time=o,e-o}return this.time=o},_setEndings:function(t,e,r){var n=this._interpolantSettings;r?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(t,e,r){var n=this._mixer,i=n.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=n._lendControlInterpolant()),n=o.parameterPositions,o=o.sampleValues,n[0]=i,o[0]=e,n[1]=i+t,o[1]=r,this}}),Object.assign(Dn.prototype,e.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,n=t._clip.tracks,i=n.length,o=t._propertyBindings,s=t._interpolants,a=r.uuid,c=this._bindingsByRootAndName,u=c[a];for(void 0===u&&(u={},c[a]=u),c=0;c!==i;++c){var h=n[c],l=h.name,p=u[l];if(void 0===p){if(void 0!==(p=o[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,a,l));continue}++(p=new jn(Ln.create(r,l,e&&e._propertyBindings[c].binding.parsedPath),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,a,l)}o[c]=p,s[c].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.uuid,n=this._actionsByClip[r];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,r,e)}for(r=0,n=(e=t._propertyBindings).length;r!==n;++r){var i=e[r];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,n=e.length;r!==n;++r){var i=e[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&t<this._nActiveActions},_addInactiveAction:function(t,e,r){var n=this._actions,i=this._actionsByClip,o=i[e];void 0===o?(o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=o):(e=o.knownActions,t._byClipCacheIndex=e.length,e.push(t)),t._cacheIndex=n.length,n.push(t),o.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=(n=this._actions)[n.length-1],r=t._cacheIndex;e._cacheIndex=r,n[r]=e,n.pop(),t._cacheIndex=null;var n=t._clip.uuid,i=(r=(e=this._actionsByClip)[n]).knownActions,o=i[i.length-1],s=t._byClipCacheIndex;o._byClipCacheIndex=s,i[s]=o,i.pop(),t._byClipCacheIndex=null,delete r.actionByRoot[(t._localRoot||this._root).uuid],0===i.length&&delete e[n],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=0,r=(t=t._propertyBindings).length;e!==r;++e){var n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,n=this._nActiveActions++,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,n=--this._nActiveActions,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_addInactiveBinding:function(t,e,r){var n=this._bindingsByRootAndName,i=n[e],o=this._bindings;void 0===i&&(i={},n[e]=i),i[r]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=(n=t.binding).rootNode.uuid,n=n.path,i=this._bindingsByRootAndName,o=i[r],s=e[e.length-1];t=t._cacheIndex,s._cacheIndex=t,e[t]=s,e.pop(),delete o[n];t:{for(var a in o)break t;delete i[r]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,n=this._nActiveBindings++,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,n=--this._nActiveBindings,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&(r=new Hr(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=e,t[e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,n=--this._nActiveControlInterpolants,i=e[n];t.__cacheIndex=n,e[n]=t,i.__cacheIndex=r,e[r]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var r=(i=e||this._root).uuid,n="string"==typeof t?rn.findByName(i,t):t,i=null!==n?n.uuid:t,o=this._actionsByClip[i],s=null;if(void 0!==o){if(void 0!==(s=o.actionByRoot[r]))return s;s=o.knownActions[0],null===n&&(n=s._clip)}return null===n?null:(n=new In(this,n,e),this._bindAction(n,s),this._addInactiveAction(n,i,r),n)},existingAction:function(t,e){var r=(n=e||this._root).uuid,n="string"==typeof t?rn.findByName(n,t):t;return void 0!==(n=this._actionsByClip[n?n.uuid:t])?n.actionByRoot[r]||null:null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions,r=this._bindings,n=this._nActiveBindings,i=this._nActiveBindings=this._nActiveActions=0;i!==e;++i)t[i].reset();for(i=0;i!==n;++i)r[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,n=this.time+=t,i=Math.sign(t),o=this._accuIndex^=1,s=0;s!==r;++s)e[s]._update(n,t,i,o);for(t=this._bindings,e=this._nActiveBindings,s=0;s!==e;++s)t[s].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions;t=t.uuid;var r=this._actionsByClip,n=r[t];if(void 0!==n){for(var i=0,o=(n=n.knownActions).length;i!==o;++i){var s=n[i];this._deactivateAction(s);var a=s._cacheIndex,c=e[e.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,c._cacheIndex=a,e[a]=c,e.pop(),this._removeInactiveBindingsForAction(s)}delete r[t]}},uncacheRoot:function(t){t=t.uuid;var e,r=this._actionsByClip;for(e in r){var n=r[e].actionByRoot[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}if(void 0!==(e=this._bindingsByRootAndName[t]))for(var i in e)(t=e[i]).restoreOriginalState(),this._removeInactiveBinding(t)},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),kn.prototype.clone=function(){return new kn(void 0===this.value.clone?this.value:this.value.clone())},Fn.prototype=Object.assign(Object.create(St.prototype),{constructor:Fn,isInstancedBufferGeometry:!0,addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:r})},copy:function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var n=t[e];this.addGroup(n.start,n.count,n.materialIndex)}return this}}),Object.defineProperties(Bn.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Bn.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=n,this},setXYZW:function(t,e,r,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=n,this.data.array[t+3]=i,this}}),Object.defineProperty(Un.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Un.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var n=0,i=this.stride;n<i;n++)this.array[t+n]=e.array[r+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),zn.prototype=Object.assign(Object.create(Un.prototype),{constructor:zn,isInstancedInterleavedBuffer:!0,copy:function(t){return Un.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Gn.prototype=Object.assign(Object.create(lt.prototype),{constructor:Gn,isInstancedBufferAttribute:!0,copy:function(t){return lt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign($n.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var r=[];return Hn(t,this,r,e),r.sort(Vn),r},intersectObjects:function(t,e){var r=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var n=0,i=t.length;n<i;n++)Hn(t[n],this,r,e);return r.sort(Vn),r}}),Object.assign(qn.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(){return this.getDelta(),this.elapsedTime},getDelta:function(){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}}),Object.assign(Wn.prototype,{set:function(t,e,r){return this.radius=t,this.phi=e,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(xi.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(Xn.prototype,{set:function(t,e,r){return this.radius=t,this.theta=e,this.y=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),(Yn.prototype=Object.create(Rt.prototype)).constructor=Yn,Yn.prototype.createAnimation=function(t,e,r,n){e={start:e,end:r,length:r-e+1,fps:n,duration:(r-e)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[t]=e,this.animationsList.push(e)},Yn.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/i,n={},i=this.geometry,o=0,s=i.morphTargets.length;o<s;o++){var a=i.morphTargets[o].name.match(r);if(a&&1<a.length){var c=a[1];n[c]||(n[c]={start:1/0,end:-1/0}),o<(a=n[c]).start&&(a.start=o),o>a.end&&(a.end=o),e||(e=c)}}for(c in n)a=n[c],this.createAnimation(c,a.start,a.end,t);this.firstAnimation=e},Yn.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},Yn.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},Yn.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},Yn.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},Yn.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},Yn.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},Yn.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},Yn.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},Yn.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},Yn.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},Yn.prototype.update=function(t){for(var e=0,r=this.animationsList.length;e<r;e++){var n=this.animationsList[e];if(n.active){var i=n.duration/n.length;n.time+=n.direction*t,n.mirroredLoop?(n.time>n.duration||0>n.time)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),0>n.time&&(n.time=0,n.directionBackwards=!1)):(n.time%=n.duration,0>n.time&&(n.time+=n.duration));var o=n.start+xi.clamp(Math.floor(n.time/i),0,n.length-1),s=n.weight;o!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*s,this.morphTargetInfluences[o]=0,n.lastFrame=n.currentFrame,n.currentFrame=o),i=n.time%i/i,n.directionBackwards&&(i=1-i),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=i*s,this.morphTargetInfluences[n.lastFrame]=(1-i)*s):this.morphTargetInfluences[n.currentFrame]=s}}},(Kn.prototype=Object.create(ot.prototype)).constructor=Kn,Kn.prototype.isImmediateRenderObject=!0,(Zn.prototype=Object.create(Me.prototype)).constructor=Zn,Zn.prototype.update=function(){var t=new c,e=new c,r=new J;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,s=this.object.geometry;if(s&&s.isGeometry)for(var a=s.vertices,c=s.faces,u=s=0,h=c.length;u<h;u++)for(var l=c[u],p=0,f=l.vertexNormals.length;p<f;p++){var d=l.vertexNormals[p];t.copy(a[l[n[p]]]).applyMatrix4(i),e.copy(d).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(s,t.x,t.y,t.z),s+=1,o.setXYZ(s,e.x,e.y,e.z),s+=1}else if(s&&s.isBufferGeometry)for(n=s.attributes.position,a=s.attributes.normal,p=s=0,f=n.count;p<f;p++)t.set(n.getX(p),n.getY(p),n.getZ(p)).applyMatrix4(i),e.set(a.getX(p),a.getY(p),a.getZ(p)),e.applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(s,t.x,t.y,t.z),s+=1,o.setXYZ(s,e.x,e.y,e.z),s+=1;o.needsUpdate=!0}}(),(Jn.prototype=Object.create(ot.prototype)).constructor=Jn,Jn.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Jn.prototype.update=function(){var t=new c,e=new c;return function(){this.light.updateMatrixWorld();var r=this.light.distance?this.light.distance:1e3,n=r*Math.tan(this.light.angle);this.cone.scale.set(n,n,r),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color)}}(),(ti.prototype=Object.create(Me.prototype)).constructor=ti,ti.prototype.onBeforeRender=function(){var t=new c,e=new u,r=new u;return function(){var n=this.bones,i=this.geometry,o=i.getAttribute("position");r.getInverse(this.root.matrixWorld);for(var s=0,a=0;s<n.length;s++){var c=n[s];c.parent&&c.parent.isBone&&(e.multiplyMatrices(r,c.matrixWorld),t.setFromMatrixPosition(e),o.setXYZ(a,t.x,t.y,t.z),e.multiplyMatrices(r,c.parent.matrixWorld),t.setFromMatrixPosition(e),o.setXYZ(a+1,t.x,t.y,t.z),a+=2)}i.getAttribute("position").needsUpdate=!0}}(),(ei.prototype=Object.create(Rt.prototype)).constructor=ei,ei.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},ei.prototype.update=function(){this.material.color.copy(this.light.color)},(ri.prototype=Object.create(ot.prototype)).constructor=ri,ri.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ri.prototype.update=function(){var t=this.children[0];t.material.color.copy(this.light.color);var e=.5*this.light.width,r=.5*this.light.height,n=(t=t.geometry.attributes.position).array;n[0]=e,n[1]=-r,n[2]=0,n[3]=e,n[4]=r,n[5]=0,n[6]=-e,n[7]=r,n[8]=0,n[9]=-e,n[10]=-r,n[11]=0,n[12]=e,n[13]=-r,n[14]=0,t.needsUpdate=!0},(ni.prototype=Object.create(ot.prototype)).constructor=ni,ni.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},ni.prototype.update=function(){var t=new c,e=new $,r=new $;return function(){var n=this.children[0],i=n.geometry.getAttribute("color");e.copy(this.light.color),r.copy(this.light.groundColor);for(var o=0,s=i.count;o<s;o++){var a=o<s/2?e:r;i.setXYZ(o,a.r,a.g,a.b)}n.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),i.needsUpdate=!0}}(),(ii.prototype=Object.create(Me.prototype)).constructor=ii,(oi.prototype=Object.create(Me.prototype)).constructor=oi,(si.prototype=Object.create(Me.prototype)).constructor=si,si.prototype.update=function(){var t=new c,e=new c,r=new J;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,i=this.geometry.attributes.position,o=this.object.geometry,s=o.vertices,a=0,c=0,u=(o=o.faces).length;c<u;c++){var h=o[c],l=h.normal;t.copy(s[h.a]).add(s[h.b]).add(s[h.c]).divideScalar(3).applyMatrix4(n),e.copy(l).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),i.setXYZ(a,t.x,t.y,t.z),a+=1,i.setXYZ(a,e.x,e.y,e.z),a+=1}i.needsUpdate=!0}}(),(ai.prototype=Object.create(ot.prototype)).constructor=ai,ai.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},ai.prototype.update=function(){var t=new c,e=new c,r=new c;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(e,t);var n=this.children[0],i=this.children[1];n.lookAt(r),n.material.color.copy(this.light.color),i.lookAt(r),i.scale.z=r.length()}}(),(ci.prototype=Object.create(Me.prototype)).constructor=ci,ci.prototype.update=function(){function t(t,o,s,a){if(n.set(o,s,a).unproject(i),void 0!==(t=r[t]))for(o=e.getAttribute("position"),s=0,a=t.length;s<a;s++)o.setXYZ(t[s],n.x,n.y,n.z)}var e,r,n=new c,i=new st;return function(){e=this.geometry,r=this.pointMap,i.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),(ui.prototype=Object.create(Me.prototype)).constructor=ui,ui.prototype.update=function(){var t=new K;return function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&t.setFromObject(this.object),!t.isEmpty()){e=t.min;var r=t.max,n=this.geometry.attributes.position,i=n.array;i[0]=r.x,i[1]=r.y,i[2]=r.z,i[3]=e.x,i[4]=r.y,i[5]=r.z,i[6]=e.x,i[7]=e.y,i[8]=r.z,i[9]=r.x,i[10]=e.y,i[11]=r.z,i[12]=r.x,i[13]=r.y,i[14]=e.z,i[15]=e.x,i[16]=r.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=r.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),ui.prototype.setFromObject=function(t){return this.object=t,this.update(),this};var Qi,to;(hi.prototype=Object.create(ot.prototype)).constructor=hi,hi.prototype.setDirection=function(){var t,e=new c;return function(r){.99999<r.y?this.quaternion.set(0,0,0,1):-.99999>r.y?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),hi.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},hi.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},(li.prototype=Object.create(Me.prototype)).constructor=li;var eo=new c,ro=new pi,no=new pi,io=new pi;fi.prototype=Object.create(pn.prototype),fi.prototype.constructor=fi,fi.prototype.getPoint=function(t){var e=this.points;t*=(s=e.length)-(this.closed?0:1),t-=a=Math.floor(t),this.closed?a+=0<a?0:(Math.floor(Math.abs(a)/e.length)+1)*e.length:0===t&&a===s-1&&(a=s-2,t=1);var r,n,i;if(this.closed||0<a?r=e[(a-1)%s]:(eo.subVectors(e[0],e[1]).add(e[0]),r=eo),n=e[a%s],i=e[(a+1)%s],this.closed||a+2<s?e=e[(a+2)%s]:(eo.subVectors(e[s-1],e[s-2]).add(e[s-1]),e=eo),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var o="chordal"===this.type?.5:.25,s=Math.pow(r.distanceToSquared(n),o),a=Math.pow(n.distanceToSquared(i),o),o=Math.pow(i.distanceToSquared(e),o);1e-4>a&&(a=1),1e-4>s&&(s=a),1e-4>o&&(o=a),ro.initNonuniformCatmullRom(r.x,n.x,i.x,e.x,s,a,o),no.initNonuniformCatmullRom(r.y,n.y,i.y,e.y,s,a,o),io.initNonuniformCatmullRom(r.z,n.z,i.z,e.z,s,a,o)}else"catmullrom"===this.type&&(s=void 0!==this.tension?this.tension:.5,ro.initCatmullRom(r.x,n.x,i.x,e.x,s),no.initCatmullRom(r.y,n.y,i.y,e.y,s),io.initCatmullRom(r.z,n.z,i.z,e.z,s));return new c(ro.calc(t),no.calc(t),io.calc(t))},(di.prototype=Object.create(pn.prototype)).constructor=di,di.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2,i=this.v3;return new c(ln(t,e.x,r.x,n.x,i.x),ln(t,e.y,r.y,n.y,i.y),ln(t,e.z,r.z,n.z,i.z))},(mi.prototype=Object.create(pn.prototype)).constructor=mi,mi.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2;return new c(hn(t,e.x,r.x,n.x),hn(t,e.y,r.y,n.y),hn(t,e.z,r.z,n.z))},(vi.prototype=Object.create(pn.prototype)).constructor=vi,vi.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new c;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},(gi.prototype=Object.create(mn.prototype)).constructor=gi,pn.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(pn.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},yi.prototype=Object.create(fi.prototype),bi.prototype=Object.create(fi.prototype),_i.prototype=Object.create(fi.prototype),Object.assign(_i.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),ii.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},ti.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(V.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(K.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),At.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},xi.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(J.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(u.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new c),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.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.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,r,n,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,r,i,o)}}),Q.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},a.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Pt.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(_n.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Je(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new cr(this,t)}}),Object.assign(r.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(c.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(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,r){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(i.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),ht.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(ot.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},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.defineProperties(ye.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(be.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(pn.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),ct.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Lr.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(lt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(St.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},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.")}}),Object.defineProperties(St.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(kn.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(W.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new $}}}),Object.defineProperties(xr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(X.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(le.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},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.")}}),Object.defineProperties(le.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(et.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(t){t=1!==t,console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(o.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),On.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Mn).load(t,function(t){e.setBuffer(t)}),this},An.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},t.WebGLRenderTargetCube=s,t.WebGLRenderTarget=o,t.WebGLRenderer=le,t.ShaderLib=Ni,t.UniformsLib=ji,t.UniformsUtils=Ri,t.ShaderChunk=Li,t.FogExp2=pe,t.Fog=fe,t.Scene=de,t.LensFlare=me,t.Sprite=ge,t.LOD=ye,t.SkinnedMesh=xe,t.Skeleton=be,t.Bone=_e,t.Mesh=Rt,t.LineSegments=Me,t.LineLoop=Ee,t.Line=Se,t.Points=Ce,t.Group=Oe,t.VideoTexture=Pe,t.DataTexture=h,t.CompressedTexture=Ae,t.CubeTexture=l,t.CanvasTexture=je,t.DepthTexture=Re,t.Texture=n,t.CompressedTextureLoader=Or,t.DataTextureLoader=Pr,t.CubeTextureLoader=jr,t.TextureLoader=Rr,t.ObjectLoader=cn,t.MaterialLoader=nn,t.BufferGeometryLoader=on,t.DefaultLoadingManager=$i,t.LoadingManager=Tr,t.JSONLoader=an,t.ImageLoader=Ar,t.FontLoader=Sn,t.FileLoader=Cr,t.Loader=sn,t.Cache=Gi,t.AudioLoader=Mn,t.SpotLightShadow=Dr,t.SpotLight=kr,t.PointLight=Fr,t.RectAreaLight=Gr,t.HemisphereLight=Nr,t.DirectionalLightShadow=Br,t.DirectionalLight=Ur,t.AmbientLight=zr,t.LightShadow=Ir,t.Light=Lr,t.StereoCamera=En,t.PerspectiveCamera=ct,t.OrthographicCamera=at,t.CubeCamera=Tn,t.ArrayCamera=ae,t.Camera=st,t.AudioListener=Cn,t.PositionalAudio=Pn,t.AudioContext=Ji,t.AudioAnalyser=An,t.Audio=On,t.VectorKeyframeTrack=Xr,t.StringKeyframeTrack=Jr,t.QuaternionKeyframeTrack=Kr,t.NumberKeyframeTrack=Zr,t.ColorKeyframeTrack=tn,t.BooleanKeyframeTrack=Qr,t.PropertyMixer=jn,t.PropertyBinding=Ln,t.KeyframeTrack=en,t.AnimationUtils=Vi,t.AnimationObjectGroup=Nn,t.AnimationMixer=Dn,t.AnimationClip=rn,t.Uniform=kn,t.InstancedBufferGeometry=Fn,t.BufferGeometry=St,t.GeometryIdCount=function(){return ki++},t.Geometry=ht,t.InterleavedBufferAttribute=Bn,t.InstancedInterleavedBuffer=zn,t.InterleavedBuffer=Un,t.InstancedBufferAttribute=Gn,t.Face3=ut,t.Object3D=ot,t.Raycaster=$n,t.Layers=it,t.EventDispatcher=e,t.Clock=qn,t.QuaternionLinearInterpolant=Yr,t.LinearInterpolant=Hr,t.DiscreteInterpolant=qr,t.CubicInterpolant=Vr,t.Interpolant=$r,t.Triangle=jt,t.Math=xi,t.Spherical=Wn,t.Cylindrical=Xn,t.Plane=Q,t.Frustum=tt,t.Sphere=Z,t.Ray=Pt,t.Matrix4=u,t.Matrix3=J,t.Box3=K,t.Box2=V,t.Line3=At,t.Euler=nt,t.Vector4=i,t.Vector3=c,t.Vector2=r,t.Quaternion=a,t.Color=$,t.MorphBlendMesh=Yn,t.ImmediateRenderObject=Kn,t.VertexNormalsHelper=Zn,t.SpotLightHelper=Jn,t.SkeletonHelper=ti,t.PointLightHelper=ei,t.RectAreaLightHelper=ri,t.HemisphereLightHelper=ni,t.GridHelper=ii,t.PolarGridHelper=oi,t.FaceNormalsHelper=si,t.DirectionalLightHelper=ai,t.CameraHelper=ci,t.BoxHelper=ui,t.ArrowHelper=hi,t.AxisHelper=li,t.CatmullRomCurve3=fi,t.CubicBezierCurve3=di,t.QuadraticBezierCurve3=mi,t.LineCurve3=vi,t.ArcCurve=gi,t.EllipseCurve=mn,t.SplineCurve=vn,t.CubicBezierCurve=gn,t.QuadraticBezierCurve=yn,t.LineCurve=fn,t.Shape=_n,t.Path=bn,t.ShapePath=xn,t.Font=wn,t.CurvePath=dn,t.Curve=pn,t.ShapeUtils=Bi,t.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new Oe,n=0,i=e.length;n<i;n++)r.add(new Rt(t,e[n]));return r},detach:function(t,e,r){t.applyMatrix(e.matrixWorld),e.remove(t),r.add(t)},attach:function(t,e,r){t.applyMatrix((new u).getInverse(r.matrixWorld)),e.remove(t),r.add(t)}},t.WireframeGeometry=Le,t.ParametricGeometry=Ne,t.ParametricBufferGeometry=Ie,t.TetrahedronGeometry=Fe,t.TetrahedronBufferGeometry=Be,t.OctahedronGeometry=Ue,t.OctahedronBufferGeometry=ze,t.IcosahedronGeometry=Ge,t.IcosahedronBufferGeometry=$e,t.DodecahedronGeometry=Ve,t.DodecahedronBufferGeometry=He,t.PolyhedronGeometry=De,t.PolyhedronBufferGeometry=ke,t.TubeGeometry=qe,t.TubeBufferGeometry=We,t.TorusKnotGeometry=Xe,t.TorusKnotBufferGeometry=Ye,t.TorusGeometry=Ke,t.TorusBufferGeometry=Ze,t.TextGeometry=tr,t.TextBufferGeometry=er,t.SphereGeometry=rr,t.SphereBufferGeometry=nr,t.RingGeometry=ir,t.RingBufferGeometry=or,t.PlaneGeometry=Tt,t.PlaneBufferGeometry=Ct,t.LatheGeometry=sr,t.LatheBufferGeometry=ar,t.ShapeGeometry=cr,t.ShapeBufferGeometry=ur,t.ExtrudeGeometry=Je,t.ExtrudeBufferGeometry=Qe,t.EdgesGeometry=hr,t.ConeGeometry=fr,t.ConeBufferGeometry=dr,t.CylinderGeometry=lr,t.CylinderBufferGeometry=pr,t.CircleGeometry=mr,t.CircleBufferGeometry=vr,t.BoxGeometry=Mt,t.BoxBufferGeometry=Et,t.ShadowMaterial=gr,t.SpriteMaterial=ve,t.RawShaderMaterial=yr,t.ShaderMaterial=X,t.PointsMaterial=Te,t.MeshPhysicalMaterial=_r,t.MeshStandardMaterial=br,t.MeshPhongMaterial=xr,t.MeshToonMaterial=wr,t.MeshNormalMaterial=Sr,t.MeshLambertMaterial=Mr,t.MeshDepthMaterial=Y,t.MeshBasicMaterial=Ot,t.LineDashedMaterial=Er,t.LineBasicMaterial=we,t.Material=W,t.Float64BufferAttribute=_t,t.Float32BufferAttribute=bt,t.Uint32BufferAttribute=yt,t.Int32BufferAttribute=gt,t.Uint16BufferAttribute=vt,t.Int16BufferAttribute=mt,t.Uint8ClampedBufferAttribute=dt,t.Uint8BufferAttribute=ft,t.Int8BufferAttribute=pt,t.BufferAttribute=lt,t.REVISION="86",t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},t.CullFaceNone=0,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.FrontFaceDirectionCW=0,t.FrontFaceDirectionCCW=1,t.BasicShadowMap=0,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.FrontSide=0,t.BackSide=1,t.DoubleSide=2,t.FlatShading=1,t.SmoothShading=2,t.NoColors=0,t.FaceColors=1,t.VertexColors=2,t.NoBlending=0,t.NormalBlending=1,t.AdditiveBlending=2,t.SubtractiveBlending=3,t.MultiplyBlending=4,t.CustomBlending=5,t.AddEquation=100,t.SubtractEquation=101,t.ReverseSubtractEquation=102,t.MinEquation=103,t.MaxEquation=104,t.ZeroFactor=200,t.OneFactor=201,t.SrcColorFactor=202,t.OneMinusSrcColorFactor=203,t.SrcAlphaFactor=204,t.OneMinusSrcAlphaFactor=205,t.DstAlphaFactor=206,t.OneMinusDstAlphaFactor=207,t.DstColorFactor=208,t.OneMinusDstColorFactor=209,t.SrcAlphaSaturateFactor=210,t.NeverDepth=0,t.AlwaysDepth=1,t.LessDepth=2,t.LessEqualDepth=3,t.EqualDepth=4,t.GreaterEqualDepth=5,t.GreaterDepth=6,t.NotEqualDepth=7,t.MultiplyOperation=0,t.MixOperation=1,t.AddOperation=2,t.NoToneMapping=0,t.LinearToneMapping=1,t.ReinhardToneMapping=2,t.Uncharted2ToneMapping=3,t.CineonToneMapping=4,t.UVMapping=300,t.CubeReflectionMapping=301,t.CubeRefractionMapping=302,t.EquirectangularReflectionMapping=303,t.EquirectangularRefractionMapping=304,t.SphericalReflectionMapping=305,t.CubeUVReflectionMapping=306,t.CubeUVRefractionMapping=307,t.RepeatWrapping=1e3,t.ClampToEdgeWrapping=1001,t.MirroredRepeatWrapping=1002,t.NearestFilter=1003,t.NearestMipMapNearestFilter=1004,t.NearestMipMapLinearFilter=1005,t.LinearFilter=1006,t.LinearMipMapNearestFilter=1007,t.LinearMipMapLinearFilter=1008,t.UnsignedByteType=1009,t.ByteType=1010,t.ShortType=1011,t.UnsignedShortType=1012,t.IntType=1013,t.UnsignedIntType=1014,t.FloatType=1015,t.HalfFloatType=1016,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedInt248Type=1020,t.AlphaFormat=1021,t.RGBFormat=1022,t.RGBAFormat=1023,t.LuminanceFormat=1024,t.LuminanceAlphaFormat=1025,t.RGBEFormat=1023,t.DepthFormat=1026,t.DepthStencilFormat=1027,t.RGB_S3TC_DXT1_Format=2001,t.RGBA_S3TC_DXT1_Format=2002,t.RGBA_S3TC_DXT3_Format=2003,t.RGBA_S3TC_DXT5_Format=2004,t.RGB_PVRTC_4BPPV1_Format=2100,t.RGB_PVRTC_2BPPV1_Format=2101,t.RGBA_PVRTC_4BPPV1_Format=2102,t.RGBA_PVRTC_2BPPV1_Format=2103,t.RGB_ETC1_Format=2151,t.LoopOnce=2200,t.LoopRepeat=2201,t.LoopPingPong=2202,t.InterpolateDiscrete=2300,t.InterpolateLinear=2301,t.InterpolateSmooth=2302,t.ZeroCurvatureEnding=2400,t.ZeroSlopeEnding=2401,t.WrapAroundEnding=2402,t.TrianglesDrawMode=0,t.TriangleStripDrawMode=1,t.TriangleFanDrawMode=2,t.LinearEncoding=3e3,t.sRGBEncoding=3001,t.GammaEncoding=3007,t.RGBEEncoding=3002,t.LogLuvEncoding=3003,t.RGBM7Encoding=3004,t.RGBM16Encoding=3005,t.RGBDEncoding=3006,t.BasicDepthPacking=3200,t.RGBADepthPacking=3201,t.CubeGeometry=Mt,t.Face4=function(t,e,r,n,i,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ut(t,e,r,i,o,s)},t.LineStrip=0,t.LinePieces=1,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MultiMaterial=function(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t},t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Ce(t,e)},t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ge(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Ce(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Te(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Te(t)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Te(t)},t.Vertex=function(t,e,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new c(t,e,r)},t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new lt(t,e).setDynamic(!0)},t.Int8Attribute=function(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new pt(t,e)},t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new ft(t,e)},t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new dt(t,e)},t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new mt(t,e)},t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new vt(t,e)},t.Int32Attribute=function(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new gt(t,e)},t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new yt(t,e)},t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new bt(t,e)},t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new _t(t,e)},t.ClosedSplineCurve3=yi,t.SplineCurve3=bi,t.Spline=_i,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new ui(t,e)},t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Me(new hr(t.geometry),new we({color:void 0!==e?e:16777215}))},t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Me(new Le(t.geometry),new we({color:void 0!==e?e:16777215}))},t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Cr(t)},t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Pr(t)},t.GeometryUtils={merge:function(t,e,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},t.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new Rr;return i.setCrossOrigin(this.crossOrigin),t=i.load(t,r,void 0,n),e&&(t.mapping=e),t},loadTextureCube:function(t,e,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new jr;return i.setCrossOrigin(this.crossOrigin),t=i.load(t,r,void 0,n),e&&(t.mapping=e),t},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},t.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},Object.defineProperty(t,"__esModule",{value:!0})})},{}],177:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||i,this.length>0)for(var r=this.length>>1;r>=0;r--)this._down(r)}function i(t,e){return t<e?-1:t>e?1:0}e.exports=n,n.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return--this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length,i=n>>1,o=e[t];t<i;){var s=1+(t<<1),a=s+1,c=e[s];if(a<n&&r(e[a],c)<0&&(s=a,c=e[a]),r(c,o)>=0)break;e[t]=c,t=s}e[t]=o}}},{}],178:[function(t,e,r){(function(){function t(t){function e(e,r,n,i,o,s){for(;o>=0&&o<s;o+=t){var a=i?i[o]:o;n=r(n,e[a],a,e)}return n}return function(r,n,i,o){n=x(n,o,4);var s=!O(r)&&_.keys(r),a=(s||r).length,c=t>0?0:a-1;return arguments.length<3&&(i=r[s?s[c]:c],c+=t),e(r,n,i,s,c,a)}}function n(t){return function(e,r,n){r=w(r,n);for(var i=C(e),o=t>0?0:i-1;o>=0&&o<i;o+=t)if(r(e[o],o,e))return o;return-1}}function i(t,e,r){return function(n,i,o){var s=0,a=C(n);if("number"==typeof o)t>0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(r&&o&&a)return o=r(n,i),n[o]===i?o:-1;if(i!==i)return(o=e(p.call(n,s,a),_.isNaN))>=0?o+s:-1;for(o=t>0?s:a-1;o>=0&&o<a;o+=t)if(n[o]===i)return o;return-1}}function o(t,e){var r=L.length,n=t.constructor,i=_.isFunction(n)&&n.prototype||u,o="constructor";for(_.has(t,o)&&!_.contains(e,o)&&e.push(o);r--;)(o=L[r])in t&&t[o]!==i[o]&&!_.contains(e,o)&&e.push(o)}var s=this,a=s._,c=Array.prototype,u=Object.prototype,h=Function.prototype,l=c.push,p=c.slice,f=u.toString,d=u.hasOwnProperty,m=Array.isArray,v=Object.keys,g=h.bind,y=Object.create,b=function(){},_=function(t){return t instanceof _?t:this instanceof _?void(this._wrapped=t):new _(t)};void 0!==r?(void 0!==e&&e.exports&&(r=e.exports=_),r._=_):s._=_,_.VERSION="1.8.3";var x=function(t,e,r){if(void 0===e)return t;switch(null==r?3:r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)};case 4:return function(r,n,i,o){return t.call(e,r,n,i,o)}}return function(){return t.apply(e,arguments)}},w=function(t,e,r){return null==t?_.identity:_.isFunction(t)?x(t,e,r):_.isObject(t)?_.matcher(t):_.property(t)};_.iteratee=function(t,e){return w(t,e,1/0)};var S=function(t,e){return function(r){var n=arguments.length;if(n<2||null==r)return r;for(var i=1;i<n;i++)for(var o=arguments[i],s=t(o),a=s.length,c=0;c<a;c++){var u=s[c];e&&void 0!==r[u]||(r[u]=o[u])}return r}},M=function(t){if(!_.isObject(t))return{};if(y)return y(t);b.prototype=t;var e=new b;return b.prototype=null,e},E=function(t){return function(e){return null==e?void 0:e[t]}},T=Math.pow(2,53)-1,C=E("length"),O=function(t){var e=C(t);return"number"==typeof e&&e>=0&&e<=T};_.each=_.forEach=function(t,e,r){e=x(e,r);var n,i;if(O(t))for(n=0,i=t.length;n<i;n++)e(t[n],n,t);else{var o=_.keys(t);for(n=0,i=o.length;n<i;n++)e(t[o[n]],o[n],t)}return t},_.map=_.collect=function(t,e,r){e=w(e,r);for(var n=!O(t)&&_.keys(t),i=(n||t).length,o=Array(i),s=0;s<i;s++){var a=n?n[s]:s;o[s]=e(t[a],a,t)}return o},_.reduce=_.foldl=_.inject=t(1),_.reduceRight=_.foldr=t(-1),_.find=_.detect=function(t,e,r){var n;if(void 0!==(n=O(t)?_.findIndex(t,e,r):_.findKey(t,e,r))&&-1!==n)return t[n]},_.filter=_.select=function(t,e,r){var n=[];return e=w(e,r),_.each(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n},_.reject=function(t,e,r){return _.filter(t,_.negate(w(e)),r)},_.every=_.all=function(t,e,r){e=w(e,r);for(var n=!O(t)&&_.keys(t),i=(n||t).length,o=0;o<i;o++){var s=n?n[o]:o;if(!e(t[s],s,t))return!1}return!0},_.some=_.any=function(t,e,r){e=w(e,r);for(var n=!O(t)&&_.keys(t),i=(n||t).length,o=0;o<i;o++){var s=n?n[o]:o;if(e(t[s],s,t))return!0}return!1},_.contains=_.includes=_.include=function(t,e,r,n){return O(t)||(t=_.values(t)),("number"!=typeof r||n)&&(r=0),_.indexOf(t,e,r)>=0},_.invoke=function(t,e){var r=p.call(arguments,2),n=_.isFunction(e);return _.map(t,function(t){var i=n?e:t[e];return null==i?i:i.apply(t,r)})},_.pluck=function(t,e){return _.map(t,_.property(e))},_.where=function(t,e){return _.filter(t,_.matcher(e))},_.findWhere=function(t,e){return _.find(t,_.matcher(e))},_.max=function(t,e,r){var n,i,o=-1/0,s=-1/0;if(null==e&&null!=t)for(var a=0,c=(t=O(t)?t:_.values(t)).length;a<c;a++)(n=t[a])>o&&(o=n);else e=w(e,r),_.each(t,function(t,r,n){((i=e(t,r,n))>s||i===-1/0&&o===-1/0)&&(o=t,s=i)});return o},_.min=function(t,e,r){var n,i,o=1/0,s=1/0;if(null==e&&null!=t)for(var a=0,c=(t=O(t)?t:_.values(t)).length;a<c;a++)(n=t[a])<o&&(o=n);else e=w(e,r),_.each(t,function(t,r,n){((i=e(t,r,n))<s||i===1/0&&o===1/0)&&(o=t,s=i)});return o},_.shuffle=function(t){for(var e,r=O(t)?t:_.values(t),n=r.length,i=Array(n),o=0;o<n;o++)(e=_.random(0,o))!==o&&(i[o]=i[e]),i[e]=r[o];return i},_.sample=function(t,e,r){return null==e||r?(O(t)||(t=_.values(t)),t[_.random(t.length-1)]):_.shuffle(t).slice(0,Math.max(0,e))},_.sortBy=function(t,e,r){return e=w(e,r),_.pluck(_.map(t,function(t,r,n){return{value:t,index:r,criteria:e(t,r,n)}}).sort(function(t,e){var r=t.criteria,n=e.criteria;if(r!==n){if(r>n||void 0===r)return 1;if(r<n||void 0===n)return-1}return t.index-e.index}),"value")};var P=function(t){return function(e,r,n){var i={};return r=w(r,n),_.each(e,function(n,o){var s=r(n,o,e);t(i,n,s)}),i}};_.groupBy=P(function(t,e,r){_.has(t,r)?t[r].push(e):t[r]=[e]}),_.indexBy=P(function(t,e,r){t[r]=e}),_.countBy=P(function(t,e,r){_.has(t,r)?t[r]++:t[r]=1}),_.toArray=function(t){return t?_.isArray(t)?p.call(t):O(t)?_.map(t,_.identity):_.values(t):[]},_.size=function(t){return null==t?0:O(t)?t.length:_.keys(t).length},_.partition=function(t,e,r){e=w(e,r);var n=[],i=[];return _.each(t,function(t,r,o){(e(t,r,o)?n:i).push(t)}),[n,i]},_.first=_.head=_.take=function(t,e,r){if(null!=t)return null==e||r?t[0]:_.initial(t,t.length-e)},_.initial=function(t,e,r){return p.call(t,0,Math.max(0,t.length-(null==e||r?1:e)))},_.last=function(t,e,r){if(null!=t)return null==e||r?t[t.length-1]:_.rest(t,Math.max(0,t.length-e))},_.rest=_.tail=_.drop=function(t,e,r){return p.call(t,null==e||r?1:e)},_.compact=function(t){return _.filter(t,_.identity)};var A=function(t,e,r,n){for(var i=[],o=0,s=n||0,a=C(t);s<a;s++){var c=t[s];if(O(c)&&(_.isArray(c)||_.isArguments(c))){e||(c=A(c,e,r));var u=0,h=c.length;for(i.length+=h;u<h;)i[o++]=c[u++]}else r||(i[o++]=c)}return i};_.flatten=function(t,e){return A(t,e,!1)},_.without=function(t){return _.difference(t,p.call(arguments,1))},_.uniq=_.unique=function(t,e,r,n){_.isBoolean(e)||(n=r,r=e,e=!1),null!=r&&(r=w(r,n));for(var i=[],o=[],s=0,a=C(t);s<a;s++){var c=t[s],u=r?r(c,s,t):c;e?(s&&o===u||i.push(c),o=u):r?_.contains(o,u)||(o.push(u),i.push(c)):_.contains(i,c)||i.push(c)}return i},_.union=function(){return _.uniq(A(arguments,!0,!0))},_.intersection=function(t){for(var e=[],r=arguments.length,n=0,i=C(t);n<i;n++){var o=t[n];if(!_.contains(e,o)){for(var s=1;s<r&&_.contains(arguments[s],o);s++);s===r&&e.push(o)}}return e},_.difference=function(t){var e=A(arguments,!0,!0,1);return _.filter(t,function(t){return!_.contains(e,t)})},_.zip=function(){return _.unzip(arguments)},_.unzip=function(t){for(var e=t&&_.max(t,C).length||0,r=Array(e),n=0;n<e;n++)r[n]=_.pluck(t,n);return r},_.object=function(t,e){for(var r={},n=0,i=C(t);n<i;n++)e?r[t[n]]=e[n]:r[t[n][0]]=t[n][1];return r},_.findIndex=n(1),_.findLastIndex=n(-1),_.sortedIndex=function(t,e,r,n){for(var i=(r=w(r,n,1))(e),o=0,s=C(t);o<s;){var a=Math.floor((o+s)/2);r(t[a])<i?o=a+1:s=a}return o},_.indexOf=i(1,_.findIndex,_.sortedIndex),_.lastIndexOf=i(-1,_.findLastIndex),_.range=function(t,e,r){null==e&&(e=t||0,t=0),r=r||1;for(var n=Math.max(Math.ceil((e-t)/r),0),i=Array(n),o=0;o<n;o++,t+=r)i[o]=t;return i};var j=function(t,e,r,n,i){if(!(n instanceof e))return t.apply(r,i);var o=M(t.prototype),s=t.apply(o,i);return _.isObject(s)?s:o};_.bind=function(t,e){if(g&&t.bind===g)return g.apply(t,p.call(arguments,1));if(!_.isFunction(t))throw new TypeError("Bind must be called on a function");var r=p.call(arguments,2),n=function(){return j(t,n,e,this,r.concat(p.call(arguments)))};return n},_.partial=function(t){var e=p.call(arguments,1),r=function(){for(var n=0,i=e.length,o=Array(i),s=0;s<i;s++)o[s]=e[s]===_?arguments[n++]:e[s];for(;n<arguments.length;)o.push(arguments[n++]);return j(t,r,this,this,o)};return r},_.bindAll=function(t){var e,r,n=arguments.length;if(n<=1)throw new Error("bindAll must be passed function names");for(e=1;e<n;e++)t[r=arguments[e]]=_.bind(t[r],t);return t},_.memoize=function(t,e){var r=function(n){var i=r.cache,o=""+(e?e.apply(this,arguments):n);return _.has(i,o)||(i[o]=t.apply(this,arguments)),i[o]};return r.cache={},r},_.delay=function(t,e){var r=p.call(arguments,2);return setTimeout(function(){return t.apply(null,r)},e)},_.defer=_.partial(_.delay,_,1),_.throttle=function(t,e,r){var n,i,o,s=null,a=0;r||(r={});var c=function(){a=!1===r.leading?0:_.now(),s=null,o=t.apply(n,i),s||(n=i=null)};return function(){var u=_.now();a||!1!==r.leading||(a=u);var h=e-(u-a);return n=this,i=arguments,h<=0||h>e?(s&&(clearTimeout(s),s=null),a=u,o=t.apply(n,i),s||(n=i=null)):s||!1===r.trailing||(s=setTimeout(c,h)),o}},_.debounce=function(t,e,r){var n,i,o,s,a,c=function(){var u=_.now()-s;u<e&&u>=0?n=setTimeout(c,e-u):(n=null,r||(a=t.apply(o,i),n||(o=i=null)))};return function(){o=this,i=arguments,s=_.now();var u=r&&!n;return n||(n=setTimeout(c,e)),u&&(a=t.apply(o,i),o=i=null),a}},_.wrap=function(t,e){return _.partial(e,t)},_.negate=function(t){return function(){return!t.apply(this,arguments)}},_.compose=function(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}},_.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},_.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},_.once=_.partial(_.before,2);var R=!{toString:null}.propertyIsEnumerable("toString"),L=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];_.keys=function(t){if(!_.isObject(t))return[];if(v)return v(t);var e=[];for(var r in t)_.has(t,r)&&e.push(r);return R&&o(t,e),e},_.allKeys=function(t){if(!_.isObject(t))return[];var e=[];for(var r in t)e.push(r);return R&&o(t,e),e},_.values=function(t){for(var e=_.keys(t),r=e.length,n=Array(r),i=0;i<r;i++)n[i]=t[e[i]];return n},_.mapObject=function(t,e,r){e=w(e,r);for(var n,i=_.keys(t),o=i.length,s={},a=0;a<o;a++)s[n=i[a]]=e(t[n],n,t);return s},_.pairs=function(t){for(var e=_.keys(t),r=e.length,n=Array(r),i=0;i<r;i++)n[i]=[e[i],t[e[i]]];return n},_.invert=function(t){for(var e={},r=_.keys(t),n=0,i=r.length;n<i;n++)e[t[r[n]]]=r[n];return e},_.functions=_.methods=function(t){var e=[];for(var r in t)_.isFunction(t[r])&&e.push(r);return e.sort()},_.extend=S(_.allKeys),_.extendOwn=_.assign=S(_.keys),_.findKey=function(t,e,r){e=w(e,r);for(var n,i=_.keys(t),o=0,s=i.length;o<s;o++)if(n=i[o],e(t[n],n,t))return n},_.pick=function(t,e,r){var n,i,o={},s=t;if(null==s)return o;_.isFunction(e)?(i=_.allKeys(s),n=x(e,r)):(i=A(arguments,!1,!1,1),n=function(t,e,r){return e in r},s=Object(s));for(var a=0,c=i.length;a<c;a++){var u=i[a],h=s[u];n(h,u,s)&&(o[u]=h)}return o},_.omit=function(t,e,r){if(_.isFunction(e))e=_.negate(e);else{var n=_.map(A(arguments,!1,!1,1),String);e=function(t,e){return!_.contains(n,e)}}return _.pick(t,e,r)},_.defaults=S(_.allKeys,!0),_.create=function(t,e){var r=M(t);return e&&_.extendOwn(r,e),r},_.clone=function(t){return _.isObject(t)?_.isArray(t)?t.slice():_.extend({},t):t},_.tap=function(t,e){return e(t),t},_.isMatch=function(t,e){var r=_.keys(e),n=r.length;if(null==t)return!n;for(var i=Object(t),o=0;o<n;o++){var s=r[o];if(e[s]!==i[s]||!(s in i))return!1}return!0};var N=function(t,e,r,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof _&&(t=t._wrapped),e instanceof _&&(e=e._wrapped);var i=f.call(t);if(i!==f.call(e))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:0==+t?1/+t==1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e}var o="[object Array]"===i;if(!o){if("object"!=typeof t||"object"!=typeof e)return!1;var s=t.constructor,a=e.constructor;if(s!==a&&!(_.isFunction(s)&&s instanceof s&&_.isFunction(a)&&a instanceof a)&&"constructor"in t&&"constructor"in e)return!1}r=r||[],n=n||[];for(var c=r.length;c--;)if(r[c]===t)return n[c]===e;if(r.push(t),n.push(e),o){if((c=t.length)!==e.length)return!1;for(;c--;)if(!N(t[c],e[c],r,n))return!1}else{var u,h=_.keys(t);if(c=h.length,_.keys(e).length!==c)return!1;for(;c--;)if(u=h[c],!_.has(e,u)||!N(t[u],e[u],r,n))return!1}return r.pop(),n.pop(),!0};_.isEqual=function(t,e){return N(t,e)},_.isEmpty=function(t){return null==t||(O(t)&&(_.isArray(t)||_.isString(t)||_.isArguments(t))?0===t.length:0===_.keys(t).length)},_.isElement=function(t){return!(!t||1!==t.nodeType)},_.isArray=m||function(t){return"[object Array]"===f.call(t)},_.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},_.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){_["is"+t]=function(e){return f.call(e)==="[object "+t+"]"}}),_.isArguments(arguments)||(_.isArguments=function(t){return _.has(t,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(_.isFunction=function(t){return"function"==typeof t||!1}),_.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},_.isNaN=function(t){return _.isNumber(t)&&t!==+t},_.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"===f.call(t)},_.isNull=function(t){return null===t},_.isUndefined=function(t){return void 0===t},_.has=function(t,e){return null!=t&&d.call(t,e)},_.noConflict=function(){return s._=a,this},_.identity=function(t){return t},_.constant=function(t){return function(){return t}},_.noop=function(){},_.property=E,_.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},_.matcher=_.matches=function(t){return t=_.extendOwn({},t),function(e){return _.isMatch(e,t)}},_.times=function(t,e,r){var n=Array(Math.max(0,t));e=x(e,r,1);for(var i=0;i<t;i++)n[i]=e(i);return n},_.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},_.now=Date.now||function(){return(new Date).getTime()};var I={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},D=_.invert(I),k=function(t){var e=function(e){return t[e]},r="(?:"+_.keys(t).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(i,e):t}};_.escape=k(I),_.unescape=k(D),_.result=function(t,e,r){var n=null==t?void 0:t[e];return void 0===n&&(n=r),_.isFunction(n)?n.call(t):n};var F=0;_.uniqueId=function(t){var e=++F+"";return t?t+e:e},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var B=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\u2028|\u2029/g,G=function(t){return"\\"+U[t]};_.template=function(t,e,r){!e&&r&&(e=r),e=_.defaults({},e,_.templateSettings);var n=RegExp([(e.escape||B).source,(e.interpolate||B).source,(e.evaluate||B).source].join("|")+"|$","g"),i=0,o="__p+='";t.replace(n,function(e,r,n,s,a){return o+=t.slice(i,a).replace(z,G),i=a+e.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\n__p+='"),e}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var s=new Function(e.variable||"obj","_",o)}catch(t){throw t.source=o,t}var a=function(t){return s.call(this,t,_)},c=e.variable||"obj";return a.source="function("+c+"){\n"+o+"}",a},_.chain=function(t){var e=_(t);return e._chain=!0,e};var $=function(t,e){return t._chain?_(e).chain():e};_.mixin=function(t){_.each(_.functions(t),function(e){var r=_[e]=t[e];_.prototype[e]=function(){var t=[this._wrapped];return l.apply(t,arguments),$(this,r.apply(_,t))}})},_.mixin(_),_.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=c[t];_.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],$(this,r)}}),_.each(["concat","join","slice"],function(t){var e=c[t];_.prototype[t]=function(){return $(this,e.apply(this._wrapped,arguments))}}),_.prototype.value=function(){return this._wrapped},_.prototype.valueOf=_.prototype.toJSON=_.prototype.value,_.prototype.toString=function(){return""+this._wrapped}}).call(this)},{}],179:[function(t,e,r){var n=t("./vdom/create-element.js");e.exports=n},{"./vdom/create-element.js":185}],180:[function(t,e,r){var n=t("./vtree/diff.js");e.exports=n},{"./vtree/diff.js":205}],181:[function(t,e,r){var n=t("./virtual-hyperscript/index.js");e.exports=n},{"./virtual-hyperscript/index.js":192}],182:[function(t,e,r){var n=t("./diff.js"),i=t("./patch.js"),o=t("./h.js"),s=t("./create-element.js"),a=t("./vnode/vnode.js"),c=t("./vnode/vtext.js");e.exports={diff:n,patch:i,h:o,create:s,VNode:a,VText:c}},{"./create-element.js":179,"./diff.js":180,"./h.js":181,"./patch.js":183,"./vnode/vnode.js":201,"./vnode/vtext.js":203}],183:[function(t,e,r){var n=t("./vdom/patch.js");e.exports=n},{"./vdom/patch.js":188}],184:[function(t,e,r){function n(t,e,r,n){if(n){var i=n[e];if(a(i))i.unhook&&i.unhook(t,e,r);else if("attributes"===e)for(var o in i)t.removeAttribute(o);else if("style"===e)for(var s in i)t.style[s]="";else t[e]="string"==typeof i?"":null}}function i(t,e,r,n,i){var a=r?r[n]:void 0;if("attributes"!==n)if(a&&s(a)&&o(a)!==o(i))t[n]=i;else{s(t[n])||(t[n]={});var c="style"===n?"":void 0;for(var u in i){var h=i[u];t[n][u]=void 0===h?c:h}}else for(var l in i){var p=i[l];void 0===p?t.removeAttribute(l):t.setAttribute(l,p)}}function o(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__?t.__proto__:t.constructor?t.constructor.prototype:void 0}var s=t("is-object"),a=t("../vnode/is-vhook.js");e.exports=function(t,e,r){for(var o in e){var c=e[o];void 0===c?n(t,o,c,r):a(c)?(n(t,o,c,r),c.hook&&c.hook(t,o,r?r[o]:void 0)):s(c)?i(t,0,r,o,c):t[o]=c}}},{"../vnode/is-vhook.js":196,"is-object":20}],185:[function(t,e,r){function n(t,e){var r=e?e.document||i:i,h=e?e.warn:null;if(t=u(t).a,c(t))return t.init();if(a(t))return r.createTextNode(t.text);if(!s(t))return h&&h("Item is not a valid virtual dom node",t),null;var l=null===t.namespace?r.createElement(t.tagName):r.createElementNS(t.namespace,t.tagName),p=t.properties;o(l,p);for(var f=t.children,d=0;d<f.length;d++){var m=n(f[d],e);m&&l.appendChild(m)}return l}var i=t("global/document"),o=t("./apply-properties"),s=t("../vnode/is-vnode.js"),a=t("../vnode/is-vtext.js"),c=t("../vnode/is-widget.js"),u=t("../vnode/handle-thunk.js");e.exports=n},{"../vnode/handle-thunk.js":194,"../vnode/is-vnode.js":197,"../vnode/is-vtext.js":198,"../vnode/is-widget.js":199,"./apply-properties":184,"global/document":16}],186:[function(t,e,r){function n(t,e,r,o,a){if(o=o||{},t){i(r,a,a)&&(o[a]=t);var c=e.children;if(c)for(var u=t.childNodes,h=0;h<e.children.length;h++){a+=1;var l=c[h]||s,p=a+(l.count||0);i(r,a,p)&&n(u[h],l,r,o,a),a=p}}return o}function i(t,e,r){if(0===t.length)return!1;for(var n,i,o=0,s=t.length-1;o<=s;){if(n=(s+o)/2>>0,i=t[n],o===s)return i>=e&&i<=r;if(i<e)o=n+1;else{if(!(i>r))return!0;s=n-1}}return!1}function o(t,e){return t>e?1:-1}var s={};e.exports=function(t,e,r,i){return r&&0!==r.length?(r.sort(o),n(t,e,r,i,0)):{}}},{}],187:[function(t,e,r){function n(t,e){var r=t.parentNode;return r&&r.removeChild(t),c(t,e),null}function i(t,e,r){var n=r.render(e,r);return t&&t.appendChild(n),t}function o(t,e,r,n){var i;if(3===t.nodeType)t.replaceData(0,t.length,r.text),i=t;else{var o=t.parentNode;i=n.render(r,n),o&&i!==t&&o.replaceChild(i,t)}return i}function s(t,e,r,n){var i,o=d(e,r);i=o?r.update(e,t)||t:n.render(r,n);var s=t.parentNode;return s&&i!==t&&s.replaceChild(i,t),o||c(t,e),i}function a(t,e,r,n){var i=t.parentNode,o=n.render(r,n);return i&&o!==t&&i.replaceChild(o,t),o}function c(t,e){"function"==typeof e.destroy&&p(e)&&e.destroy(t)}function u(t,e){for(var r,n,i,o=t.childNodes,s={},a=0;a<e.removes.length;a++)r=o[(n=e.removes[a]).from],n.key&&(s[n.key]=r),t.removeChild(r);for(var c=o.length,u=0;u<e.inserts.length;u++)r=s[(i=e.inserts[u]).key],t.insertBefore(r,i.to>=c++?null:o[i.to])}function h(t,e){return t&&e&&t!==e&&t.parentNode&&t.parentNode.replaceChild(e,t),e}var l=t("./apply-properties"),p=t("../vnode/is-widget.js"),f=t("../vnode/vpatch.js"),d=t("./update-widget");e.exports=function(t,e,r){var c=t.type,p=t.vNode,d=t.patch;switch(c){case f.REMOVE:return n(e,p);case f.INSERT:return i(e,d,r);case f.VTEXT:return o(e,0,d,r);case f.WIDGET:return s(e,p,d,r);case f.VNODE:return a(e,0,d,r);case f.ORDER:return u(e,d),e;case f.PROPS:return l(e,d,p.properties),e;case f.THUNK:return h(e,r.patch(e,d,r));default:return e}}},{"../vnode/is-widget.js":199,"../vnode/vpatch.js":202,"./apply-properties":184,"./update-widget":189}],188:[function(t,e,r){function n(t,e,r){return r=r||{},r.patch=r.patch&&r.patch!==n?r.patch:i,r.render=r.render||u,r.patch(t,e,r)}function i(t,e,r){var n=s(e);if(0===n.length)return t;var i=h(t,e.a,n),c=t.ownerDocument;r.document||c===a||(r.document=c);for(var u=0;u<n.length;u++){var l=n[u];t=o(t,i[l],e[l],r)}return t}function o(t,e,r,n){if(!e)return t;var i;if(c(r))for(var o=0;o<r.length;o++)i=l(r[o],e,n),e===t&&(t=i);else i=l(r,e,n),e===t&&(t=i);return t}function s(t){var e=[];for(var r in t)"a"!==r&&e.push(Number(r));return e}var a=t("global/document"),c=t("x-is-array"),u=t("./create-element"),h=t("./dom-index"),l=t("./patch-op");e.exports=n},{"./create-element":185,"./dom-index":186,"./patch-op":187,"global/document":16,"x-is-array":224}],189:[function(t,e,r){var n=t("../vnode/is-widget.js");e.exports=function(t,e){return!(!n(t)||!n(e))&&("name"in t&&"name"in e?t.id===e.id:t.init===e.init)}},{"../vnode/is-widget.js":199}],190:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.value=t}var i=t("ev-store");e.exports=n,n.prototype.hook=function(t,e){i(t)[e.substr(3)]=this.value},n.prototype.unhook=function(t,e){i(t)[e.substr(3)]=void 0}},{"ev-store":9}],191:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.value=t}e.exports=n,n.prototype.hook=function(t,e){t[e]!==this.value&&(t[e]=this.value)}},{}],192:[function(t,e,r){"use strict";function n(t,e,r,i){if("string"==typeof t)e.push(new l(t));else if("number"==typeof t)e.push(new l(String(t)));else if(o(t))e.push(t);else{if(!u(t)){if(null===t||void 0===t)return;throw a({foreignObject:t,parentVnode:{tagName:r,properties:i}})}for(var s=0;s<t.length;s++)n(t[s],e,r,i)}}function i(t){for(var e in t)if(t.hasOwnProperty(e)){var r=t[e];if(m(r))continue;"ev-"===e.substr(0,3)&&(t[e]=b(r))}}function o(t){return p(t)||f(t)||d(t)||v(t)}function s(t){return"string"==typeof t||u(t)||o(t)}function a(t){var e=new Error;return e.type="virtual-hyperscript.unexpected.virtual-element",e.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+c(t.foreignObject)+".\nThe parent vnode is:\n"+c(t.parentVnode),e.foreignObject=t.foreignObject,e.parentVnode=t.parentVnode,e}function c(t){try{return JSON.stringify(t,null,"    ")}catch(e){return String(t)}}var u=t("x-is-array"),h=t("../vnode/vnode.js"),l=t("../vnode/vtext.js"),p=t("../vnode/is-vnode"),f=t("../vnode/is-vtext"),d=t("../vnode/is-widget"),m=t("../vnode/is-vhook"),v=t("../vnode/is-thunk"),g=t("./parse-tag.js"),y=t("./hooks/soft-set-hook.js"),b=t("./hooks/ev-hook.js");e.exports=function(t,e,r){var o,a,c,u,l=[];return!r&&s(e)&&(r=e,a={}),a=a||e||{},o=g(t,a),a.hasOwnProperty("key")&&(c=a.key,a.key=void 0),a.hasOwnProperty("namespace")&&(u=a.namespace,a.namespace=void 0),"INPUT"!==o||u||!a.hasOwnProperty("value")||void 0===a.value||m(a.value)||(a.value=y(a.value)),i(a),void 0!==r&&null!==r&&n(r,l,o,a),new h(o,a,l,c,u)}},{"../vnode/is-thunk":195,"../vnode/is-vhook":196,"../vnode/is-vnode":197,"../vnode/is-vtext":198,"../vnode/is-widget":199,"../vnode/vnode.js":201,"../vnode/vtext.js":203,"./hooks/ev-hook.js":190,"./hooks/soft-set-hook.js":191,"./parse-tag.js":193,"x-is-array":224}],193:[function(t,e,r){"use strict";var n=t("browser-split"),i=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,o=/^\.|#/;e.exports=function(t,e){if(!t)return"DIV";var r=!e.hasOwnProperty("id"),s=n(t,i),a=null;o.test(s[1])&&(a="DIV");var c,u,h,l;for(l=0;l<s.length;l++)(u=s[l])&&(h=u.charAt(0),a?"."===h?(c=c||[]).push(u.substring(1,u.length)):"#"===h&&r&&(e.id=u.substring(1,u.length)):a=u);return c&&(e.className&&c.push(e.className),e.className=c.join(" ")),e.namespace?a:a.toUpperCase()}},{"browser-split":5}],194:[function(t,e,r){function n(t,e){var r=t.vnode;if(r||(r=t.vnode=t.render(e)),!(i(r)||o(r)||s(r)))throw new Error("thunk did not return a valid node");return r}var i=t("./is-vnode"),o=t("./is-vtext"),s=t("./is-widget"),a=t("./is-thunk");e.exports=function(t,e){var r=t,i=e;return a(e)&&(i=n(e,t)),a(t)&&(r=n(t,null)),{a:r,b:i}}},{"./is-thunk":195,"./is-vnode":197,"./is-vtext":198,"./is-widget":199}],195:[function(t,e,r){e.exports=function(t){return t&&"Thunk"===t.type}},{}],196:[function(t,e,r){e.exports=function(t){return t&&("function"==typeof t.hook&&!t.hasOwnProperty("hook")||"function"==typeof t.unhook&&!t.hasOwnProperty("unhook"))}},{}],197:[function(t,e,r){var n=t("./version");e.exports=function(t){return t&&"VirtualNode"===t.type&&t.version===n}},{"./version":200}],198:[function(t,e,r){var n=t("./version");e.exports=function(t){return t&&"VirtualText"===t.type&&t.version===n}},{"./version":200}],199:[function(t,e,r){e.exports=function(t){return t&&"Widget"===t.type}},{}],200:[function(t,e,r){e.exports="2"},{}],201:[function(t,e,r){function n(t,e,r,n,i){this.tagName=t,this.properties=e||u,this.children=r||h,this.key=null!=n?String(n):void 0,this.namespace="string"==typeof i?i:null;var l,p=r&&r.length||0,f=0,d=!1,m=!1,v=!1;for(var g in e)if(e.hasOwnProperty(g)){var y=e[g];c(y)&&y.unhook&&(l||(l={}),l[g]=y)}for(var b=0;b<p;b++){var _=r[b];o(_)?(f+=_.count||0,!d&&_.hasWidgets&&(d=!0),!m&&_.hasThunks&&(m=!0),v||!_.hooks&&!_.descendantHooks||(v=!0)):!d&&s(_)?"function"==typeof _.destroy&&(d=!0):!m&&a(_)&&(m=!0)}this.count=p+f,this.hasWidgets=d,this.hasThunks=m,this.hooks=l,this.descendantHooks=v}var i=t("./version"),o=t("./is-vnode"),s=t("./is-widget"),a=t("./is-thunk"),c=t("./is-vhook");e.exports=n;var u={},h=[];n.prototype.version=i,n.prototype.type="VirtualNode"},{"./is-thunk":195,"./is-vhook":196,"./is-vnode":197,"./is-widget":199,"./version":200}],202:[function(t,e,r){function n(t,e,r){this.type=Number(t),this.vNode=e,this.patch=r}var i=t("./version");n.NONE=0,n.VTEXT=1,n.VNODE=2,n.WIDGET=3,n.PROPS=4,n.ORDER=5,n.INSERT=6,n.REMOVE=7,n.THUNK=8,e.exports=n,n.prototype.version=i,n.prototype.type="VirtualPatch"},{"./version":200}],203:[function(t,e,r){function n(t){this.text=String(t)}var i=t("./version");e.exports=n,n.prototype.version=i,n.prototype.type="VirtualText"},{"./version":200}],204:[function(t,e,r){function n(t,e){var r;for(var a in t){a in e||((r=r||{})[a]=void 0);var c=t[a],u=e[a];if(c!==u)if(o(c)&&o(u))if(i(u)!==i(c))(r=r||{})[a]=u;else if(s(u))(r=r||{})[a]=u;else{var h=n(c,u);h&&((r=r||{})[a]=h)}else(r=r||{})[a]=u}for(var l in e)l in t||((r=r||{})[l]=e[l]);return r}function i(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__?t.__proto__:t.constructor?t.constructor.prototype:void 0}var o=t("is-object"),s=t("../vnode/is-vhook");e.exports=n},{"../vnode/is-vhook":196,"is-object":20}],205:[function(t,e,r){function n(t,e){var r={a:t};return i(t,e,r,0),r}function i(t,e,r,n){if(t!==e){var i=r[n],a=!1;if(x(t)||x(e))c(t,e,r,n);else if(null==e)_(t)||(s(t,r,n),i=r[n]),i=m(i,new g(g.REMOVE,t,e));else if(y(e))if(y(t))if(t.tagName===e.tagName&&t.namespace===e.namespace&&t.key===e.key){var u=S(t.properties,e.properties);u&&(i=m(i,new g(g.PROPS,t,u))),i=o(t,e,r,i,n)}else i=m(i,new g(g.VNODE,t,e)),a=!0;else i=m(i,new g(g.VNODE,t,e)),a=!0;else b(e)?b(t)?t.text!==e.text&&(i=m(i,new g(g.VTEXT,t,e))):(i=m(i,new g(g.VTEXT,t,e)),a=!0):_(e)&&(_(t)||(a=!0),i=m(i,new g(g.WIDGET,t,e)));i&&(r[n]=i),a&&s(t,r,n)}}function o(t,e,r,n,o){for(var s=t.children,a=p(s,e.children),c=a.children,u=s.length,h=c.length,l=u>h?u:h,f=0;f<l;f++){var d=s[f],v=c[f];o+=1,d?i(d,v,r,o):v&&(n=m(n,new g(g.INSERT,null,v))),y(d)&&d.count&&(o+=d.count)}return a.moves&&(n=m(n,new g(g.ORDER,t,a.moves))),n}function s(t,e,r){h(t,e,r),a(t,e,r)}function a(t,e,r){if(_(t))"function"==typeof t.destroy&&(e[r]=m(e[r],new g(g.REMOVE,t,null)));else if(y(t)&&(t.hasWidgets||t.hasThunks))for(var n=t.children,i=n.length,o=0;o<i;o++){var s=n[o];a(s,e,r+=1),y(s)&&s.count&&(r+=s.count)}else x(t)&&c(t,null,e,r)}function c(t,e,r,i){var o=w(t,e),s=n(o.a,o.b);u(s)&&(r[i]=new g(g.THUNK,null,s))}function u(t){for(var e in t)if("a"!==e)return!0;return!1}function h(t,e,r){if(y(t)){if(t.hooks&&(e[r]=m(e[r],new g(g.PROPS,t,l(t.hooks)))),t.descendantHooks||t.hasThunks)for(var n=t.children,i=n.length,o=0;o<i;o++){var s=n[o];h(s,e,r+=1),y(s)&&s.count&&(r+=s.count)}}else x(t)&&c(t,null,e,r)}function l(t){var e={};for(var r in t)e[r]=void 0;return e}function p(t,e){var r=d(e),n=r.keys,i=r.free;if(i.length===e.length)return{children:e,moves:null};var o=d(t),s=o.keys;if(o.free.length===t.length)return{children:e,moves:null};for(var a=[],c=0,u=i.length,h=0,l=0;l<t.length;l++){var p,m=t[l];m.key?n.hasOwnProperty(m.key)?(p=n[m.key],a.push(e[p])):(p=l-h++,a.push(null)):c<u?(p=i[c++],a.push(e[p])):(p=l-h++,a.push(null))}for(var v=c>=i.length?e.length:i[c],g=0;g<e.length;g++){var y=e[g];y.key?s.hasOwnProperty(y.key)||a.push(y):g>=v&&a.push(y)}for(var b,_=a.slice(),x=0,w=[],S=[],M=0;M<e.length;){var E=e[M];for(b=_[x];null===b&&_.length;)w.push(f(_,x,null)),b=_[x];b&&b.key===E.key?(x++,M++):E.key?(b&&b.key&&n[b.key]!==M+1?(w.push(f(_,x,b.key)),(b=_[x])&&b.key===E.key?x++:S.push({key:E.key,to:M})):S.push({key:E.key,to:M}),M++):b&&b.key&&w.push(f(_,x,b.key))}for(;x<_.length;)b=_[x],w.push(f(_,x,b&&b.key));return w.length!==h||S.length?{children:a,moves:{removes:w,inserts:S}}:{children:a,moves:null}}function f(t,e,r){return t.splice(e,1),{from:e,key:r}}function d(t){for(var e={},r=[],n=t.length,i=0;i<n;i++){var o=t[i];o.key?e[o.key]=i:r.push(i)}return{keys:e,free:r}}function m(t,e){return t?(v(t)?t.push(e):t=[t,e],t):e}var v=t("x-is-array"),g=t("../vnode/vpatch"),y=t("../vnode/is-vnode"),b=t("../vnode/is-vtext"),_=t("../vnode/is-widget"),x=t("../vnode/is-thunk"),w=t("../vnode/handle-thunk"),S=t("./diff-props");e.exports=n},{"../vnode/handle-thunk":194,"../vnode/is-thunk":195,"../vnode/is-vnode":197,"../vnode/is-vtext":198,"../vnode/is-widget":199,"../vnode/vpatch":202,"./diff-props":204,"x-is-array":224}],206:[function(t,e,r){!function(t){"use strict";t(function(t){return t("./makePromise")({scheduler:new(t("./Scheduler"))(t("./env").asap)})})}(function(r){e.exports=r(t)})},{"./Scheduler":207,"./env":219,"./makePromise":221}],207:[function(t,e,r){!function(t){"use strict";t(function(){function t(t){this._async=t,this._running=!1,this._queue=this,this._queueLen=0,this._afterQueue={},this._afterQueueLen=0;var e=this;this.drain=function(){e._drain()}}return t.prototype.enqueue=function(t){this._queue[this._queueLen++]=t,this.run()},t.prototype.afterQueue=function(t){this._afterQueue[this._afterQueueLen++]=t,this.run()},t.prototype.run=function(){this._running||(this._running=!0,this._async(this.drain))},t.prototype._drain=function(){for(var t=0;t<this._queueLen;++t)this._queue[t].run(),this._queue[t]=void 0;for(this._queueLen=0,this._running=!1,t=0;t<this._afterQueueLen;++t)this._afterQueue[t].run(),this._afterQueue[t]=void 0;this._afterQueueLen=0},t})}(function(t){e.exports=t()})},{}],208:[function(t,e,r){!function(t){"use strict";t(function(){function t(e){Error.call(this),this.message=e,this.name=t.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t})}(function(t){e.exports=t()})},{}],209:[function(t,e,r){!function(t){"use strict";t(function(){function t(t,r){function n(e,n){if(e.i<0)return r(e.f,e.thisArg,e.params,n);t._handler(e.args[e.i]).fold(i,e,void 0,n)}function i(t,e,r){t.params[t.i]=e,t.i-=1,n(t,r)}return arguments.length<2&&(r=e),function(e,i,o){var s=t._defer(),a=o.length;return n({f:e,thisArg:i,args:o,params:new Array(a),i:a-1,call:r},s._handler),s}}function e(t,e,r,n){try{n.resolve(t.apply(e,r))}catch(t){n.reject(t)}}return t.tryCatchResolve=e,t})}(function(t){e.exports=t()})},{}],210:[function(t,e,r){!function(t){"use strict";t(function(t){var e=t("../state"),r=t("../apply");return function(t){function n(e,r){for(var n=r.length,i=new Array(n),o=0,s=0;o<n;++o)r[o]&&(i[s++]=t._handler(e[o]).value);return i.length=s,i}function i(r){var n;return r instanceof t&&(n=r._handler.join()),n&&0===n.state()||!n?a(r).then(e.fulfilled,e.rejected):(n._unreport(),e.inspect(n))}function o(t){return function(e,r,n){return s(t,void 0,[e,r,n])}}var s=r(t),a=t.resolve,c=t.all,u=Array.prototype.reduce,h=Array.prototype.reduceRight,l=Array.prototype.slice;return t.any=function(e){for(var r,n,i=t._defer(),o=i._handler,s=e.length>>>0,a=s,c=[],u=0;u<s;++u)if(void 0!==(n=e[u])||u in e){if((r=t._handler(n)).state()>0){o.become(r),t._visitRemaining(e,u,r);break}r.visit(o,function(t){c=null,this.resolve(t)},function(t){this.resolved||(c.push(t),0==--a&&this.reject(c))})}else--a;return 0===a&&o.reject(new RangeError("any(): array must not be empty")),i},t.some=function(e,r){var n,i,o,s=t._defer(),a=s._handler,c=[],u=[],h=e.length>>>0,l=0;for(o=0;o<h;++o)(void 0!==(i=e[o])||o in e)&&++l;for(r=Math.max(r,0),n=l-r+1,r>(l=Math.min(r,l))?a.reject(new RangeError("some(): array must contain at least "+r+" item(s), but had "+l)):0===l&&a.resolve(c),o=0;o<h;++o)(void 0!==(i=e[o])||o in e)&&t._handler(i).visit(a,function(t){this.resolved||(c.push(t),0==--l&&(u=null,this.resolve(c)))},function(t){this.resolved||(u.push(t),0==--n&&(c=null,this.reject(u)))},a.notify);return s},t.settle=function(t){return c(t.map(i))},t.map=function(e,r){return t._traverse(r,e)},t.filter=function(e,r){var i=l.call(e);return t._traverse(r,i).then(function(t){return n(i,t)})},t.reduce=function(t,e){return arguments.length>2?u.call(t,o(e),arguments[2]):u.call(t,o(e))},t.reduceRight=function(t,e){return arguments.length>2?h.call(t,o(e),arguments[2]):h.call(t,o(e))},t.prototype.spread=function(t){return this.then(c).then(function(e){return t.apply(this,e)})},t}})}(function(r){e.exports=r(t)})},{"../apply":209,"../state":222}],211:[function(t,e,r){!function(t){"use strict";t(function(){function t(){throw new TypeError("catch predicate must be a function")}function e(t,e){return r(e)?t instanceof e:e(t)}function r(t){return t===Error||null!=t&&t.prototype instanceof Error}function n(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function i(t){return t}return function(r){function o(t,r){return function(n){return e(n,r)?t.call(this,n):u(n)}}function s(t,e,r,i){var o=t.call(e);return n(o)?a(o,r,i):r(i)}function a(t,e,r){return c(t).then(function(){return e(r)})}var c=r.resolve,u=r.reject,h=r.prototype.catch;return r.prototype.done=function(t,e){this._handler.visit(this._handler.receiver,t,e)},r.prototype.catch=r.prototype.otherwise=function(e){return arguments.length<2?h.call(this,e):"function"!=typeof e?this.ensure(t):h.call(this,o(arguments[1],e))},r.prototype.finally=r.prototype.ensure=function(t){return"function"!=typeof t?this:this.then(function(e){return s(t,this,i,e)},function(e){return s(t,this,u,e)})},r.prototype.else=r.prototype.orElse=function(t){return this.then(void 0,function(){return t})},r.prototype.yield=function(t){return this.then(function(){return t})},r.prototype.tap=function(t){return this.then(t).yield(this)},r}})}(function(t){e.exports=t()})},{}],212:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.fold=function(e,r){var n=this._beget();return this._handler.fold(function(r,n,i){t._handler(r).fold(function(t,r,n){n.resolve(e.call(this,r,t))},n,this,i)},r,n._handler.receiver,n._handler),n},t}})}(function(t){e.exports=t()})},{}],213:[function(t,e,r){!function(t){"use strict";t(function(t){var e=t("../state").inspect;return function(t){return t.prototype.inspect=function(){return e(t._handler(this))},t}})}(function(r){e.exports=r(t)})},{"../state":222}],214:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){function e(t,n,i,o){function s(o,s){return r(i(o)).then(function(){return e(t,n,i,s)})}return r(o).then(function(e){return r(n(e)).then(function(n){return n?e:r(t(e)).spread(s)})})}var r=t.resolve;return t.iterate=function(t,r,n,i){return e(function(e){return[e,t(e)]},r,n,i)},t.unfold=e,t}})}(function(t){e.exports=t()})},{}],215:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.progress=function(t){return this.then(void 0,void 0,t)},t}})}(function(t){e.exports=t()})},{}],216:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t,e,n,i){return r.setTimer(function(){t(n,i,e)},e)}var r=t("../env"),n=t("../TimeoutError");return function(t){function i(t,r,n){e(o,t,r,n)}function o(t,e){e.resolve(t)}function s(t,e,r){var i=void 0===t?new n("timed out after "+r+"ms"):t;e.reject(i)}return t.prototype.delay=function(t){var e=this._beget();return this._handler.fold(i,t,void 0,e._handler),e},t.prototype.timeout=function(t,n){var i=this._beget(),o=i._handler,a=e(s,t,n,i._handler);return this._handler.visit(o,function(t){r.clearTimer(a),this.resolve(t)},function(t){r.clearTimer(a),this.reject(t)},o.notify),i},t}})}(function(r){e.exports=r(t)})},{"../TimeoutError":208,"../env":219}],217:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t){throw t}function r(){}var n=t("../env").setTimer,i=t("../format");return function(t){function o(t){t.handled||(f.push(t),h("Potentially unhandled rejection ["+t.id+"] "+i.formatError(t.value)))}function s(t){var e=f.indexOf(t);e>=0&&(f.splice(e,1),l("Handled previous rejection ["+t.id+"] "+i.formatObject(t.value)))}function a(t,e){p.push(t,e),null===d&&(d=n(c,0))}function c(){for(d=null;p.length>0;)p.shift()(p.shift())}var u,h=r,l=r;"undefined"!=typeof console&&(u=console,h=void 0!==u.error?function(t){u.error(t)}:function(t){u.log(t)},l=void 0!==u.info?function(t){u.info(t)}:function(t){u.log(t)}),t.onPotentiallyUnhandledRejection=function(t){a(o,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){a(s,t)},t.onFatalRejection=function(t){a(e,t.value)};var p=[],f=[],d=null;return t}})}(function(r){e.exports=r(t)})},{"../env":219,"../format":220}],218:[function(t,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.with=t.prototype.withThis=function(t){var e=this._beget(),r=e._handler;return r.receiver=t,this._handler.chain(r,t),e},t}})}(function(t){e.exports=t()})},{}],219:[function(t,e,r){(function(r){!function(t){"use strict";t(function(t){var e,n="undefined"!=typeof setTimeout&&setTimeout,i=function(t,e){return setTimeout(t,e)},o=function(t){return clearTimeout(t)},s=function(t){return n(t,0)};if(void 0!==r&&"[object process]"===Object.prototype.toString.call(r))s=function(t){return r.nextTick(t)};else if(e="undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver)s=function(t){var e,r=document.createTextNode("");new t(function(){var t=e;e=void 0,t()}).observe(r,{characterData:!0});var n=0;return function(t){e=t,r.data=n^=1}}(e);else if(!n){var a=t("vertx");i=function(t,e){return a.setTimer(e,t)},o=a.cancelTimer,s=a.runOnLoop||a.runOnContext}return{setTimer:i,clearTimer:o,asap:s}})}(function(r){e.exports=r(t)})}).call(this,t("_process"))},{_process:6}],220:[function(t,e,r){!function(t){"use strict";t(function(){function t(t){var r=String(t);return"[object Object]"===r&&"undefined"!=typeof JSON&&(r=e(t,r)),r}function e(t,e){try{return JSON.stringify(t)}catch(t){return e}}return{formatError:function(e){var r="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:t(e);return e instanceof Error?r:r+" (WARNING: non-Error used)"},formatObject:t,tryStringify:e}})}(function(t){e.exports=t()})},{}],221:[function(t,e,r){(function(t){!function(e){"use strict";e(function(){return function(e){function r(t,e){this._handler=t===v?e:n(t)}function n(t){function e(t){r.reject(t)}var r=new y;try{t(function(t){r.resolve(t)},e,function(t){r.notify(t)})}catch(t){e(t)}return r}function i(t){return j(t)?t:new r(v,new b(f(t)))}function o(t){return new r(v,new b(new w(t)))}function s(){return K}function a(t,e){return new e(v,new y(t.receiver,t.join().context))}function c(t,e,n){function i(t,e,r){h[t]=e,0==--c&&r.become(new x(h))}for(var o,s="function"==typeof e?function(r,o,s){s.resolved||u(n,i,r,t(e,o,r),s)}:i,a=new y,c=n.length>>>0,h=new Array(c),l=0;l<n.length&&!a.resolved;++l)void 0!==(o=n[l])||l in n?u(n,s,l,o,a):--c;return 0===c&&a.become(new x(h)),new r(v,a)}function u(t,e,r,n,i){if(R(n)){var o=d(n),s=o.state();0===s?o.fold(e,r,void 0,i):s>0?e(r,o.value,i):(i.become(o),h(t,r+1,o))}else e(r,n,i)}function h(t,e,r){for(var n=e;n<t.length;++n)l(f(t[n]),r)}function l(t,e){if(t!==e){var r=t.state();0===r?t.visit(t,void 0,t._unreport):r<0&&t._unreport()}}function p(t){var e,n,i,o=new y;for(e=0;e<t.length;++e)if(void 0!==(n=t[e])||e in t){if(0!==(i=f(n)).state()){o.become(i),h(t,e+1,i);break}i.visit(o,o.resolve,o.reject)}return new r(v,o)}function f(t){return j(t)?t._handler.join():R(t)?m(t):new x(t)}function d(t){return j(t)?t._handler.join():m(t)}function m(t){try{var e=t.then;return"function"==typeof e?new _(e,t):new x(t)}catch(t){return new w(t)}}function v(){}function g(){}function y(t,e){r.createContext(this,e),this.consumers=void 0,this.receiver=t,this.handler=void 0,this.resolved=!1}function b(t){this.handler=t}function _(t,e){y.call(this),H.enqueue(new O(t,e,this))}function x(t){r.createContext(this),this.value=t}function w(t){r.createContext(this),this.id=++Y,this.value=t,this.handled=!1,this.reported=!1,this._report()}function S(t,e){this.rejection=t,this.context=e}function M(t){this.rejection=t}function E(){return new w(new TypeError("Promise cycle"))}function T(t,e){this.continuation=t,this.handler=e}function C(t,e){this.handler=e,this.value=t}function O(t,e,r){this._then=t,this.thenable=e,this.resolver=r}function P(t,e,r,n,i){try{t.call(e,r,n,i)}catch(t){n(t)}}function A(t,e,r,n){this.f=t,this.z=e,this.c=r,this.to=n,this.resolver=X,this.receiver=this}function j(t){return t instanceof r}function R(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function L(t,e,n,i){if("function"!=typeof t)return i.become(e);r.enterContext(e),k(t,e.value,n,i),r.exitContext()}function N(t,e,n,i,o){if("function"!=typeof t)return o.become(n);r.enterContext(n),F(t,e,n.value,i,o),r.exitContext()}function I(t,e,n,i,o){if("function"!=typeof t)return o.notify(e);r.enterContext(n),B(t,e,i,o),r.exitContext()}function D(t,e,r){try{return t(e,r)}catch(t){return o(t)}}function k(t,e,r,n){try{n.become(f(t.call(r,e)))}catch(t){n.become(new w(t))}}function F(t,e,r,n,i){try{t.call(n,e,r,i)}catch(t){i.become(new w(t))}}function B(t,e,r,n){try{n.notify(t.call(r,e))}catch(t){n.notify(t)}}function U(t,e){e.prototype=W(t.prototype),e.prototype.constructor=e}function z(t,e){return e}function G(){}function $(){if("function"==typeof CustomEvent)try{return new CustomEvent("unhandledRejection")instanceof CustomEvent}catch(t){}return!1}function V(){if("undefined"!=typeof document&&"function"==typeof document.createEvent)try{return document.createEvent("CustomEvent").initCustomEvent("eventType",!1,!0,{}),!0}catch(t){}return!1}var H=e.scheduler,q=void 0!==t&&null!==t&&"function"==typeof t.emit?function(e,r){return"unhandledRejection"===e?t.emit(e,r.value,r):t.emit(e,r)}:"undefined"!=typeof self&&$()?function(t,e){return function(r,n){var i=new e(r,{detail:{reason:n.value,key:n},bubbles:!1,cancelable:!0});return!t.dispatchEvent(i)}}(self,CustomEvent):"undefined"!=typeof self&&V()?function(t,e){return function(r,n){var i=e.createEvent("CustomEvent");return i.initCustomEvent(r,!1,!0,{reason:n.value,key:n}),!t.dispatchEvent(i)}}(self,document):G,W=Object.create||function(t){function e(){}return e.prototype=t,new e};r.resolve=i,r.reject=o,r.never=s,r._defer=function(){return new r(v,new y)},r._handler=f,r.prototype.then=function(t,e,r){var n=this._handler,i=n.join().state();if("function"!=typeof t&&i>0||"function"!=typeof e&&i<0)return new this.constructor(v,n);var o=this._beget(),s=o._handler;return n.chain(s,n.receiver,t,e,r),o},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype._beget=function(){return a(this._handler,this.constructor)},r.all=function(t){return c(z,null,t)},r.race=function(t){return"object"!=typeof t||null===t?o(new TypeError("non-iterable passed to race()")):0===t.length?s():1===t.length?i(t[0]):p(t)},r._traverse=function(t,e){return c(D,t,e)},r._visitRemaining=h,v.prototype.when=v.prototype.become=v.prototype.notify=v.prototype.fail=v.prototype._unreport=v.prototype._report=G,v.prototype._state=0,v.prototype.state=function(){return this._state},v.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},v.prototype.chain=function(t,e,r,n,i){this.when({resolver:t,receiver:e,fulfilled:r,rejected:n,progress:i})},v.prototype.visit=function(t,e,r,n){this.chain(X,t,e,r,n)},v.prototype.fold=function(t,e,r,n){this.when(new A(t,e,r,n))},U(v,g),g.prototype.become=function(t){t.fail()};var X=new g;U(v,y),y.prototype._state=0,y.prototype.resolve=function(t){this.become(f(t))},y.prototype.reject=function(t){this.resolved||this.become(new w(t))},y.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if((t=t.handler)===this)return this.handler=E();return t},y.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var r=0;r<t.length;++r)e.when(t[r])},y.prototype.become=function(t){this.resolved||(this.resolved=!0,this.handler=t,void 0!==this.consumers&&H.enqueue(this),void 0!==this.context&&t._report(this.context))},y.prototype.when=function(t){this.resolved?H.enqueue(new T(t,this.handler)):void 0===this.consumers?this.consumers=[t]:this.consumers.push(t)},y.prototype.notify=function(t){this.resolved||H.enqueue(new C(t,this))},y.prototype.fail=function(t){var e=void 0===t?this.context:t;this.resolved&&this.handler.join().fail(e)},y.prototype._report=function(t){this.resolved&&this.handler.join()._report(t)},y.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},U(v,b),b.prototype.when=function(t){H.enqueue(new T(t,this))},b.prototype._report=function(t){this.join()._report(t)},b.prototype._unreport=function(){this.join()._unreport()},U(y,_),U(v,x),x.prototype._state=1,x.prototype.fold=function(t,e,r,n){N(t,e,this,r,n)},x.prototype.when=function(t){L(t.fulfilled,this,t.receiver,t.resolver)};var Y=0;U(v,w),w.prototype._state=-1,w.prototype.fold=function(t,e,r,n){n.become(this)},w.prototype.when=function(t){"function"==typeof t.rejected&&this._unreport(),L(t.rejected,this,t.receiver,t.resolver)},w.prototype._report=function(t){H.afterQueue(new S(this,t))},w.prototype._unreport=function(){this.handled||(this.handled=!0,H.afterQueue(new M(this)))},w.prototype.fail=function(t){this.reported=!0,q("unhandledRejection",this),r.onFatalRejection(this,void 0===t?this.context:t)},S.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,q("unhandledRejection",this.rejection)||r.onPotentiallyUnhandledRejection(this.rejection,this.context))},M.prototype.run=function(){this.rejection.reported&&(q("rejectionHandled",this.rejection)||r.onPotentiallyUnhandledRejectionHandled(this.rejection))},r.createContext=r.enterContext=r.exitContext=r.onPotentiallyUnhandledRejection=r.onPotentiallyUnhandledRejectionHandled=r.onFatalRejection=G;var K=new r(v,new v);return T.prototype.run=function(){this.handler.join().when(this.continuation)},C.prototype.run=function(){var t=this.handler.consumers;if(void 0!==t)for(var e,r=0;r<t.length;++r)I((e=t[r]).progress,this.value,this.handler,e.receiver,e.resolver)},O.prototype.run=function(){var t=this.resolver;P(this._then,this.thenable,function(e){t.resolve(e)},function(e){t.reject(e)},function(e){t.notify(e)})},A.prototype.fulfilled=function(t){this.f.call(this.c,this.z,t,this.to)},A.prototype.rejected=function(t){this.to.reject(t)},A.prototype.progress=function(t){this.to.notify(t)},r}})}(function(t){e.exports=t()})}).call(this,t("_process"))},{_process:6}],222:[function(t,e,r){!function(t){"use strict";t(function(){function t(){return{state:"pending"}}function e(t){return{state:"rejected",reason:t}}function r(t){return{state:"fulfilled",value:t}}return{pending:t,fulfilled:r,rejected:e,inspect:function(n){var i=n.state();return 0===i?t():i>0?r(n.value):e(n.value)}}})}(function(t){e.exports=t()})},{}],223:[function(t,e,r){!function(t){"use strict";t(function(t){function e(t,e,r,n){var i=m.resolve(t);return arguments.length<2?i:i.then(e,r,n)}function r(t){return function(){for(var e=0,r=arguments.length,n=new Array(r);e<r;++e)n[e]=arguments[e];return v(t,this,n)}}function n(t){for(var e=0,r=arguments.length-1,n=new Array(r);e<r;++e)n[e]=arguments[e+1];return v(t,this,n)}function i(){function t(t){n._handler.resolve(t)}function e(t){n._handler.reject(t)}function r(t){n._handler.notify(t)}var n=m._defer();this.promise=n,this.resolve=t,this.reject=e,this.notify=r,this.resolver={resolve:t,reject:e,notify:r}}var o=t("./lib/decorators/timed"),s=t("./lib/decorators/array"),a=t("./lib/decorators/flow"),c=t("./lib/decorators/fold"),u=t("./lib/decorators/inspect"),h=t("./lib/decorators/iterate"),l=t("./lib/decorators/progress"),p=t("./lib/decorators/with"),f=t("./lib/decorators/unhandledRejection"),d=t("./lib/TimeoutError"),m=[s,a,c,h,l,u,p,o,f].reduce(function(t,e){return e(t)},t("./lib/Promise")),v=t("./lib/apply")(m);return e.promise=function(t){return new m(t)},e.resolve=m.resolve,e.reject=m.reject,e.lift=r,e.try=n,e.attempt=n,e.iterate=m.iterate,e.unfold=m.unfold,e.join=function(){return m.all(arguments)},e.all=function(t){return e(t,m.all)},e.settle=function(t){return e(t,m.settle)},e.any=r(m.any),e.some=r(m.some),e.race=r(m.race),e.map=function(t,r){return e(t,function(t){return m.map(t,r)})},e.filter=function(t,r){return e(t,function(t){return m.filter(t,r)})},e.reduce=r(m.reduce),e.reduceRight=r(m.reduceRight),e.isPromiseLike=function(t){return t&&"function"==typeof t.then},e.Promise=m,e.defer=function(){return new i},e.TimeoutError=d,e})}(function(r){e.exports=r(t)})},{"./lib/Promise":206,"./lib/TimeoutError":208,"./lib/apply":209,"./lib/decorators/array":210,"./lib/decorators/flow":211,"./lib/decorators/fold":212,"./lib/decorators/inspect":213,"./lib/decorators/iterate":214,"./lib/decorators/progress":215,"./lib/decorators/timed":216,"./lib/decorators/unhandledRejection":217,"./lib/decorators/with":218}],224:[function(t,e,r){var n=Array.isArray,i=Object.prototype.toString;e.exports=n||function(t){return"[object Array]"===i.call(t)}},{}],225:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./api/APIv3");r.APIv3=n.APIv3;var i=t("./api/ModelCreator");r.ModelCreator=i.ModelCreator},{"./api/APIv3":237,"./api/ModelCreator":238}],226:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./component/Component");r.Component=n.Component;var i=t("./component/ComponentService");r.ComponentService=i.ComponentService;var o=t("./component/AttributionComponent");r.AttributionComponent=o.AttributionComponent;var s=t("./component/BackgroundComponent");r.BackgroundComponent=s.BackgroundComponent;var a=t("./component/BearingComponent");r.BearingComponent=a.BearingComponent;var c=t("./component/CacheComponent");r.CacheComponent=c.CacheComponent;var u=t("./component/CoverComponent");r.CoverComponent=u.CoverComponent;var h=t("./component/DebugComponent");r.DebugComponent=h.DebugComponent;var l=t("./component/direction/DirectionComponent");r.DirectionComponent=l.DirectionComponent;var p=t("./component/direction/DirectionDOMCalculator");r.DirectionDOMCalculator=p.DirectionDOMCalculator;var f=t("./component/direction/DirectionDOMRenderer");r.DirectionDOMRenderer=f.DirectionDOMRenderer;var d=t("./component/ImageComponent");r.ImageComponent=d.ImageComponent;var m=t("./component/KeyboardComponent");r.KeyboardComponent=m.KeyboardComponent;var v=t("./component/LoadingComponent");r.LoadingComponent=v.LoadingComponent;var g=t("./component/marker/marker/Marker");r.Marker=g.Marker;var y=t("./component/marker/MarkerComponent");r.MarkerComponent=y.MarkerComponent;var b=t("./component/marker/MarkerScene");r.MarkerScene=b.MarkerScene;var _=t("./component/marker/MarkerSet");r.MarkerSet=_.MarkerSet;var x=t("./component/mouse/MouseComponent");r.MouseComponent=x.MouseComponent;var w=t("./component/mouse/MouseHandlerBase");r.MouseHandlerBase=w.MouseHandlerBase;var S=t("./component/mouse/BounceHandler");r.BounceHandler=S.BounceHandler;var M=t("./component/mouse/DragPanHandler");r.DragPanHandler=M.DragPanHandler;var E=t("./component/mouse/DoubleClickZoomHandler");r.DoubleClickZoomHandler=E.DoubleClickZoomHandler;var T=t("./component/mouse/ScrollZoomHandler");r.ScrollZoomHandler=T.ScrollZoomHandler;var C=t("./component/mouse/TouchZoomHandler");r.TouchZoomHandler=C.TouchZoomHandler;var O=t("./component/popup/popup/Popup");r.Popup=O.Popup;var P=t("./component/popup/PopupComponent");r.PopupComponent=P.PopupComponent;var A=t("./component/NavigationComponent");r.NavigationComponent=A.NavigationComponent;var j=t("./component/RouteComponent");r.RouteComponent=j.RouteComponent;var R=t("./component/sequence/SequenceComponent");r.SequenceComponent=R.SequenceComponent;var L=t("./component/sequence/SequenceDOMRenderer");r.SequenceDOMRenderer=L.SequenceDOMRenderer;var N=t("./component/sequence/SequenceDOMInteraction");r.SequenceDOMInteraction=N.SequenceDOMInteraction;var I=t("./component/imageplane/ImagePlaneComponent");r.ImagePlaneComponent=I.ImagePlaneComponent;var D=t("./component/imageplane/ImagePlaneFactory");r.ImagePlaneFactory=D.ImagePlaneFactory;var k=t("./component/imageplane/ImagePlaneGLRenderer");r.ImagePlaneGLRenderer=k.ImagePlaneGLRenderer;var F=t("./component/imageplane/ImagePlaneScene");r.ImagePlaneScene=F.ImagePlaneScene;var B=t("./component/imageplane/ImagePlaneShaders");r.ImagePlaneShaders=B.ImagePlaneShaders;var U=t("./component/marker/marker/SimpleMarker");r.SimpleMarker=U.SimpleMarker;var z=t("./component/marker/marker/CircleMarker");r.CircleMarker=z.CircleMarker;var G=t("./component/imageplane/SliderComponent");r.SliderComponent=G.SliderComponent;var $=t("./component/StatsComponent");r.StatsComponent=$.StatsComponent;var V=t("./component/tag/tag/Tag");r.Tag=V.Tag;var H=t("./component/tag/tag/OutlineTag");r.OutlineTag=H.OutlineTag;var q=t("./component/tag/tag/RenderTag");r.RenderTag=q.RenderTag;var W=t("./component/tag/tag/OutlineRenderTag");r.OutlineRenderTag=W.OutlineRenderTag;var X=t("./component/tag/tag/OutlineCreateTag");r.OutlineCreateTag=X.OutlineCreateTag;var Y=t("./component/tag/tag/SpotTag");r.SpotTag=Y.SpotTag;var K=t("./component/tag/tag/SpotRenderTag");r.SpotRenderTag=K.SpotRenderTag;var Z=t("./component/tag/TagComponent");r.TagComponent=Z.TagComponent;var J=t("./component/tag/TagCreator");r.TagCreator=J.TagCreator;var Q=t("./component/tag/TagDOMRenderer");r.TagDOMRenderer=Q.TagDOMRenderer;var tt=t("./component/tag/TagMode");r.TagMode=tt.TagMode;var et=t("./component/tag/TagOperation");r.TagOperation=et.TagOperation;var rt=t("./component/tag/TagScene");r.TagScene=rt.TagScene;var nt=t("./component/tag/TagSet");r.TagSet=nt.TagSet;var it=t("./component/tag/geometry/Geometry");r.Geometry=it.Geometry;var ot=t("./component/tag/geometry/VertexGeometry");r.VertexGeometry=ot.VertexGeometry;var st=t("./component/tag/geometry/RectGeometry");r.RectGeometry=st.RectGeometry;var at=t("./component/tag/geometry/PointGeometry");r.PointGeometry=at.PointGeometry;var ct=t("./component/tag/geometry/PolygonGeometry");r.PolygonGeometry=ct.PolygonGeometry;var ut=t("./component/tag/error/GeometryTagError");r.GeometryTagError=ut.GeometryTagError},{"./component/AttributionComponent":239,"./component/BackgroundComponent":240,"./component/BearingComponent":241,"./component/CacheComponent":242,"./component/Component":243,"./component/ComponentService":244,"./component/CoverComponent":245,"./component/DebugComponent":246,"./component/ImageComponent":247,"./component/KeyboardComponent":248,"./component/LoadingComponent":249,"./component/NavigationComponent":250,"./component/RouteComponent":251,"./component/StatsComponent":252,"./component/direction/DirectionComponent":253,"./component/direction/DirectionDOMCalculator":254,"./component/direction/DirectionDOMRenderer":255,"./component/imageplane/ImagePlaneComponent":256,"./component/imageplane/ImagePlaneFactory":257,"./component/imageplane/ImagePlaneGLRenderer":258,"./component/imageplane/ImagePlaneScene":259,"./component/imageplane/ImagePlaneShaders":260,"./component/imageplane/SliderComponent":261,"./component/marker/MarkerComponent":263,"./component/marker/MarkerScene":264,"./component/marker/MarkerSet":265,"./component/marker/marker/CircleMarker":266,"./component/marker/marker/Marker":267,"./component/marker/marker/SimpleMarker":268,"./component/mouse/BounceHandler":269,"./component/mouse/DoubleClickZoomHandler":270,"./component/mouse/DragPanHandler":271,"./component/mouse/MouseComponent":272,"./component/mouse/MouseHandlerBase":273,"./component/mouse/ScrollZoomHandler":274,"./component/mouse/TouchZoomHandler":275,"./component/popup/PopupComponent":277,"./component/popup/popup/Popup":278,"./component/sequence/SequenceComponent":279,"./component/sequence/SequenceDOMInteraction":280,"./component/sequence/SequenceDOMRenderer":281,"./component/tag/TagComponent":283,"./component/tag/TagCreator":284,"./component/tag/TagDOMRenderer":285,"./component/tag/TagMode":286,"./component/tag/TagOperation":287,"./component/tag/TagScene":288,"./component/tag/TagSet":289,"./component/tag/error/GeometryTagError":290,"./component/tag/geometry/Geometry":291,"./component/tag/geometry/PointGeometry":292,"./component/tag/geometry/PolygonGeometry":293,"./component/tag/geometry/RectGeometry":294,"./component/tag/geometry/VertexGeometry":295,"./component/tag/tag/OutlineCreateTag":296,"./component/tag/tag/OutlineRenderTag":297,"./component/tag/tag/OutlineTag":298,"./component/tag/tag/RenderTag":299,"./component/tag/tag/SpotRenderTag":300,"./component/tag/tag/SpotTag":301,"./component/tag/tag/Tag":302}],227:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./graph/edge/EdgeDirection");r.EdgeDirection=n.EdgeDirection;var i=t("./graph/edge/EdgeCalculatorSettings");r.EdgeCalculatorSettings=i.EdgeCalculatorSettings;var o=t("./graph/edge/EdgeCalculatorDirections");r.EdgeCalculatorDirections=o.EdgeCalculatorDirections;var s=t("./graph/edge/EdgeCalculatorCoefficients");r.EdgeCalculatorCoefficients=s.EdgeCalculatorCoefficients;var a=t("./graph/edge/EdgeCalculator");r.EdgeCalculator=a.EdgeCalculator},{"./graph/edge/EdgeCalculator":320,"./graph/edge/EdgeCalculatorCoefficients":321,"./graph/edge/EdgeCalculatorDirections":322,"./graph/edge/EdgeCalculatorSettings":323,"./graph/edge/EdgeDirection":324}],228:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./error/ArgumentMapillaryError");r.ArgumentMapillaryError=n.ArgumentMapillaryError;var i=t("./error/GraphMapillaryError");r.GraphMapillaryError=i.GraphMapillaryError;var o=t("./error/MapillaryError");r.MapillaryError=o.MapillaryError},{"./error/ArgumentMapillaryError":303,"./error/GraphMapillaryError":304,"./error/MapillaryError":305}],229:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./geo/Camera");r.Camera=n.Camera;var i=t("./geo/GeoCoords");r.GeoCoords=i.GeoCoords;var o=t("./geo/ViewportCoords");r.ViewportCoords=o.ViewportCoords;var s=t("./geo/Spatial");r.Spatial=s.Spatial;var a=t("./geo/Transform");r.Transform=a.Transform},{"./geo/Camera":306,"./geo/GeoCoords":307,"./geo/Spatial":308,"./geo/Transform":309,"./geo/ViewportCoords":310}],230:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./graph/FilterCreator");r.FilterCreator=n.FilterCreator;var i=t("./graph/Graph");r.Graph=i.Graph;var o=t("./graph/GraphCalculator");r.GraphCalculator=o.GraphCalculator;var s=t("./graph/GraphService");r.GraphService=s.GraphService;var a=t("./graph/ImageLoadingService");r.ImageLoadingService=a.ImageLoadingService;var c=t("./graph/MeshReader");r.MeshReader=c.MeshReader;var u=t("./graph/Node");r.Node=u.Node;var h=t("./graph/NodeCache");r.NodeCache=h.NodeCache;var l=t("./graph/Sequence");r.Sequence=l.Sequence},{"./graph/FilterCreator":311,"./graph/Graph":312,"./graph/GraphCalculator":313,"./graph/GraphService":314,"./graph/ImageLoadingService":315,"./graph/MeshReader":316,"./graph/Node":317,"./graph/NodeCache":318,"./graph/Sequence":319}],231:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./Edge");r.EdgeDirection=n.EdgeDirection;var i=t("./Render");r.RenderMode=i.RenderMode;var o=t("./Viewer");r.Alignment=o.Alignment,r.ImageSize=o.ImageSize,r.Viewer=o.Viewer;var s=t("./component/tag/Tag");r.TagComponent=s;var a=t("./component/marker/Marker");r.MarkerComponent=a;var c=t("./component/popup/Popup");r.PopupComponent=c},{"./Edge":227,"./Render":232,"./Viewer":236,"./component/marker/Marker":262,"./component/popup/Popup":276,"./component/tag/Tag":282}],232:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./render/DOMRenderer");r.DOMRenderer=n.DOMRenderer;var i=t("./render/GLRenderer");r.GLRenderer=i.GLRenderer;var o=t("./render/GLRenderStage");r.GLRenderStage=o.GLRenderStage;var s=t("./render/RenderCamera");r.RenderCamera=s.RenderCamera;var a=t("./render/RenderMode");r.RenderMode=a.RenderMode;var c=t("./render/RenderService");r.RenderService=c.RenderService},{"./render/DOMRenderer":325,"./render/GLRenderStage":326,"./render/GLRenderer":327,"./render/RenderCamera":328,"./render/RenderMode":329,"./render/RenderService":330}],233:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./state/State");r.State=n.State;var i=t("./state/states/StateBase");r.StateBase=i.StateBase;var o=t("./state/StateContext");r.StateContext=o.StateContext;var s=t("./state/StateService");r.StateService=s.StateService;var a=t("./state/states/TraversingState");r.TraversingState=a.TraversingState;var c=t("./state/states/WaitingState");r.WaitingState=c.WaitingState},{"./state/State":331,"./state/StateContext":332,"./state/StateService":333,"./state/states/StateBase":334,"./state/states/TraversingState":335,"./state/states/WaitingState":336}],234:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./tiles/ImageTileLoader");r.ImageTileLoader=n.ImageTileLoader;var i=t("./tiles/ImageTileStore");r.ImageTileStore=i.ImageTileStore;var o=t("./tiles/TextureProvider");r.TextureProvider=o.TextureProvider;var s=t("./tiles/RegionOfInterestCalculator");r.RegionOfInterestCalculator=s.RegionOfInterestCalculator},{"./tiles/ImageTileLoader":337,"./tiles/ImageTileStore":338,"./tiles/RegionOfInterestCalculator":339,"./tiles/TextureProvider":340}],235:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./utils/EventEmitter");r.EventEmitter=n.EventEmitter;var i=t("./utils/Settings");r.Settings=i.Settings;var o=t("./utils/Urls");r.Urls=o.Urls},{"./utils/EventEmitter":341,"./utils/Settings":342,"./utils/Urls":343}],236:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./viewer/Alignment");r.Alignment=n.Alignment;var i=t("./viewer/CacheService");r.CacheService=i.CacheService;var o=t("./viewer/ComponentController");r.ComponentController=o.ComponentController;var s=t("./viewer/Container");r.Container=s.Container;var a=t("./viewer/Observer");r.Observer=a.Observer;var c=t("./viewer/ImageSize");r.ImageSize=c.ImageSize;var u=t("./viewer/LoadingService");r.LoadingService=u.LoadingService;var h=t("./viewer/MouseService");r.MouseService=h.MouseService;var l=t("./viewer/Navigator");r.Navigator=l.Navigator;var p=t("./viewer/Projection");r.Projection=p.Projection;var f=t("./viewer/SpriteService");r.SpriteService=f.SpriteService;var d=t("./viewer/TouchService");r.TouchService=d.TouchService;var m=t("./viewer/Viewer");r.Viewer=m.Viewer},{"./viewer/Alignment":344,"./viewer/CacheService":345,"./viewer/ComponentController":346,"./viewer/Container":347,"./viewer/ImageSize":348,"./viewer/LoadingService":349,"./viewer/MouseService":350,"./viewer/Navigator":351,"./viewer/Observer":352,"./viewer/Projection":353,"./viewer/SpriteService":354,"./viewer/TouchService":355,"./viewer/Viewer":356}],237:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Observable");t("rxjs/add/observable/defer"),t("rxjs/add/observable/fromPromise"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/map");var i=t("../API"),o=function(){function t(t,e,r){this._clientId=t,this._modelCreator=null!=r?r:new i.ModelCreator,this._model=this._modelCreator.createModel(t,e),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"],this._propertiesFill=["captured_at","user","project"],this._propertiesKey=["key"],this._propertiesSequence=["keys"],this._propertiesSpatial=["atomic_scale","ca","calt","cca","cfocal","gpano","height","merge_cc","merge_version","c_rotation","orientation","width"],this._propertiesUser=["username"]}return t.prototype.imageByKeyFill$=function(t){return this._catchInvalidateGet$(this._wrapPromise$(this._model.get([this._pathImageByKey,t,this._propertiesKey.concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).map(function(e){if(!e)throw new Error("Images ("+t.join(", ")+") could not be found.");return e.json.imageByKey}),this._pathImageByKey,t)},t.prototype.imageByKeyFull$=function(t){return this._catchInvalidateGet$(this._wrapPromise$(this._model.get([this._pathImageByKey,t,this._propertiesKey.concat(this._propertiesCore).concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).map(function(e){if(!e)throw new Error("Images ("+t.join(", ")+") could not be found.");return e.json.imageByKey}),this._pathImageByKey,t)},t.prototype.imageCloseTo$=function(t,e){var r=e+":"+t;return this._catchInvalidateGet$(this._wrapPromise$(this._model.get([this._pathImageCloseTo,[r],this._propertiesKey.concat(this._propertiesCore).concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).map(function(t){return null!=t?t.json.imageCloseTo[r]:null}),this._pathImageCloseTo,[r])},t.prototype.imagesByH$=function(t){var e=this;return this._catchInvalidateGet$(this._wrapPromise$(this._model.get([this._pathImagesByH,t,{from:0,to:this._pageCount},this._propertiesKey.concat(this._propertiesCore),this._propertiesKey])).map(function(r){if(null==r){r={json:{imagesByH:{}}};for(var n=0,i=t;n<i.length;n++){var o=i[n];r.json.imagesByH[o]={};for(var s=0;s<=e._pageCount;s++)r.json.imagesByH[o][s]=null}}return r.json.imagesByH}),this._pathImagesByH,t)},t.prototype.imageViewAdd$=function(t){return this._catchInvalidateCall$(this._wrapPromise$(this._model.call([this._pathImageViewAdd],[t])),this._pathImageViewAdd,t)},t.prototype.invalidateImageByKey=function(t){this._invalidateGet(this._pathImageByKey,t)},t.prototype.invalidateImagesByH=function(t){this._invalidateGet(this._pathImagesByH,t)},t.prototype.invalidateSequenceByKey=function(t){this._invalidateGet(this._pathSequenceByKey,t)},t.prototype.setToken=function(t){this._model.invalidate([]),this._model=null,this._model=this._modelCreator.createModel(this._clientId,t)},t.prototype.sequenceByKey$=function(t){return this._catchInvalidateGet$(this._wrapPromise$(this._model.get([this._pathSequenceByKey,t,this._propertiesKey.concat(this._propertiesSequence)])).map(function(t){return t.json.sequenceByKey}),this._pathSequenceByKey,t)},t.prototype.sequenceViewAdd$=function(t){return this._catchInvalidateCall$(this._wrapPromise$(this._model.call([this._pathSequenceViewAdd],[t])),this._pathSequenceViewAdd,t)},Object.defineProperty(t.prototype,"clientId",{get:function(){return this._clientId},enumerable:!0,configurable:!0}),t.prototype._catchInvalidateGet$=function(t,e,r){var n=this;return t.catch(function(t){throw n._invalidateGet(e,r),t})},t.prototype._catchInvalidateCall$=function(t,e,r){var n=this;return t.catch(function(t){throw n._invalidateCall(e,r),t})},t.prototype._invalidateGet=function(t,e){this._model.invalidate([t,e])},t.prototype._invalidateCall=function(t,e){this._model.invalidate([t],[e])},t.prototype._wrapPromise$=function(t){return n.Observable.defer(function(){return n.Observable.fromPromise(t)})},t}();r.APIv3=o,r.default=o},{"../API":225,"rxjs/Observable":29,"rxjs/add/observable/defer":39,"rxjs/add/observable/fromPromise":43,"rxjs/add/operator/catch":52,"rxjs/add/operator/map":65}],238:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("falcor"),i=t("falcor-http-datasource"),o=t("../Utils"),s=function(){function t(){}return t.prototype.createModel=function(t,e){var r={crossDomain:!0,withCredentials:!1};return null!=e&&(r.headers={Authorization:"Bearer "+e}),new n.Model({maxSize:16777216,source:new i(o.Urls.falcorModel(t),r)})},t}();r.ModelCreator=s,r.default=s},{"../Utils":235,falcor:15,"falcor-http-datasource":10}],239:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("../Component"),s=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){var t=this;this._disposable=this._navigator.stateService.currentNode$.map(function(e){return{name:t._name,vnode:t._getAttributionNode(e.username,e.key)}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getAttributionNode=function(t,e){return i.h("div.Attribution",{},[i.h("a",{href:"https://www.mapillary.com/app/user/"+t,target:"_blank",textContent:"@"+t},[]),i.h("span",{textContent:"|"},[]),i.h("a",{href:"https://www.mapillary.com/app/?pKey="+e+"&focus=photo",target:"_blank",textContent:"mapillary.com"},[])])},e.componentName="attribution",e}(o.Component);r.AttributionComponent=s,o.ComponentService.register(s),r.default=s},{"../Component":226,"virtual-dom":182}],240:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("../Component"),s=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){this._container.domRenderer.render$.next({name:this._name,vnode:this._getBackgroundNode("The viewer can't display the given photo.")})},e.prototype._deactivate=function(){},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getBackgroundNode=function(t){return i.h("div.BackgroundWrapper",{},[i.h("p",{textContent:t},[])])},e.componentName="background",e}(o.Component);r.BackgroundComponent=s,o.ComponentService.register(s),r.default=s},{"../Component":226,"virtual-dom":182}],241:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("rxjs/Observable"),s=t("../Component"),a=t("../Geo"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._spatial=new a.Spatial,i._svgNamespace="http://www.w3.org/2000/svg",i._distinctThreshold=Math.PI/90,i}return n(e,t),e.prototype._activate=function(){var t=this,e=this._navigator.stateService.currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).map(function(e){var r=e.state.currentNode,n=e.state.currentTransform;if(r.pano){var i=2*Math.PI*r.gpano.CroppedAreaImageWidthPixels/r.gpano.FullPanoWidthPixels;return[t._spatial.degToRad(r.ca),i]}var o=Math.max(n.basicWidth,n.basicHeight);o<=0&&console.warn("Original image size ("+n.basicWidth+", "+n.basicHeight+") is invalid ("+r.key+". Not showing available fov.");var s=o>0?2*Math.atan(.5*n.basicWidth/(o*n.focal)):0;return[t._spatial.degToRad(r.ca),s]}).distinctUntilChanged(function(e,r){return Math.abs(r[0]-e[0])<t._distinctThreshold&&Math.abs(r[1]-e[1])<t._distinctThreshold}),r=this._container.renderService.renderCamera$.map(function(e){var r=t._spatial.degToRad(e.perspective.fov),n=e.perspective.aspect===Number.POSITIVE_INFINITY?Math.PI:2*Math.atan(e.perspective.aspect*Math.tan(.5*r));return[t._spatial.azimuthalToBearing(e.rotation.phi),n]}).distinctUntilChanged(function(e,r){return Math.abs(r[0]-e[0])<t._distinctThreshold&&Math.abs(r[1]-e[1])<t._distinctThreshold});this._renderSubscription=o.Observable.combineLatest(e,r).map(function(e){var r=i.h("div.BearingIndicatorBackground",{oncontextmenu:function(t){t.preventDefault()}},[i.h("div.BearingIndicatorBackgroundRectangle",{},[]),i.h("div.BearingIndicatorBackgroundCircle",{},[])]),n=i.h("div.BearingIndicatorNorth",{},[]),o=t._createCircleSector(e[0][0],e[0][1],"#000"),s=t._createCircleSector(e[1][0],e[1][1],"#fff"),a=t._createCircleSectorCompass(o,s);return{name:t._name,vnode:i.h("div.BearingIndicator",{},[r,n,a])}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._renderSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._createCircleSectorCompass=function(t,e){var r=i.h("g",{attributes:{transform:"translate(1,1)"},namespace:this._svgNamespace},[t,e]),n=i.h("circle",{attributes:{cx:"1",cy:"1",fill:"#abb1b9",r:"0.291667",stroke:"#000","stroke-width":"0.0833333"},namespace:this._svgNamespace},[]);return i.h("svg",{attributes:{viewBox:"0 0 2 2"},namespace:this._svgNamespace,style:{bottom:"4px",height:"48px",left:"4px",position:"absolute",width:"48px"}},[r,n])},e.prototype._createCircleSector=function(t,e,r){if(e>2*Math.PI-Math.PI/90)return i.h("circle",{attributes:{cx:"0",cy:"0",fill:r,r:"1"},namespace:this._svgNamespace},[]);var n=t-e/2-Math.PI/2,o=n+e,s=Math.cos(n),a=Math.sin(n),c=Math.cos(o),u=Math.sin(o),h="M 0 0 "+s+" "+a+" A 1 1 0 "+(e>=Math.PI?1:0)+" 1 "+c+" "+u;return i.h("path",{attributes:{d:h,fill:r},namespace:this._svgNamespace},[])},e.componentName="bearing",e}(s.Component);r.BearingComponent=c,s.ComponentService.register(c),r.default=c},{"../Component":226,"../Geo":229,"rxjs/Observable":29,"virtual-dom":182}],242:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/from"),t("rxjs/add/observable/merge"),t("rxjs/add/observable/of"),t("rxjs/add/observable/zip"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/distinct"),t("rxjs/add/operator/expand"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/mergeAll"),t("rxjs/add/operator/skip"),t("rxjs/add/operator/switchMap");var o=t("../Edge"),s=t("../Component"),a=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype.setDepth=function(t){this.configure({depth:t})},e.prototype._activate=function(){var t=this;this._sequenceSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}).filter(function(t){return t.cached}),this._configuration$).switchMap(function(e){var r=e[0],n=e[1],s=Math.max(0,Math.min(4,n.depth.sequence)),a=t._cache$(r.edges,o.EdgeDirection.Next,s),c=t._cache$(r.edges,o.EdgeDirection.Prev,s);return i.Observable.merge(a,c).catch(function(t,e){return console.error("Failed to cache sequence edges.",t),i.Observable.empty()})}).subscribe(function(){}),this._spatialSubscription=this._navigator.stateService.currentNode$.switchMap(function(t){return i.Observable.combineLatest(i.Observable.of(t),t.spatialEdges$.filter(function(t){return t.cached}))}).combineLatest(this._configuration$,function(t,e){return[t[0],t[1],e]}).switchMap(function(e){var r=e[0],n=e[1].edges,s=e[2].depth,a=Math.max(0,Math.min(2,s.pano)),c=r.pano?0:Math.max(0,Math.min(3,s.step)),u=r.pano?0:Math.max(0,Math.min(1,s.turn)),h=t._cache$(n,o.EdgeDirection.Pano,a),l=t._cache$(n,o.EdgeDirection.StepForward,c),p=t._cache$(n,o.EdgeDirection.StepBackward,c),f=t._cache$(n,o.EdgeDirection.StepLeft,c),d=t._cache$(n,o.EdgeDirection.StepRight,c),m=t._cache$(n,o.EdgeDirection.TurnLeft,u),v=t._cache$(n,o.EdgeDirection.TurnRight,u),g=t._cache$(n,o.EdgeDirection.TurnU,u);return i.Observable.merge(l,p,f,d,h,m,v,g).catch(function(t,e){return console.error("Failed to cache spatial edges.",t),i.Observable.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(t,e,r){var n=this;return i.Observable.zip(i.Observable.of(t),i.Observable.of(r)).expand(function(t){var r=t[0],o=t[1],s=[];if(o>0)for(var a=0,c=r;a<c.length;a++){var u=c[a];u.data.direction===e&&s.push(i.Observable.zip(n._navigator.graphService.cacheNode$(u.to).mergeMap(function(t){return n._nodeToEdges$(t,e)}),i.Observable.of(o-1)))}return i.Observable.from(s).mergeAll()}).skip(1)},e.prototype._nodeToEdges$=function(t,e){return([o.EdgeDirection.Next,o.EdgeDirection.Prev].indexOf(e)>-1?t.sequenceEdges$:t.spatialEdges$).first(function(t){return t.cached}).map(function(t){return t.edges})},e.componentName="cache",e}(s.Component);r.CacheComponent=a,s.ComponentService.register(a),r.default=a},{"../Component":226,"../Edge":227,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/expand":60,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeAll":67,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/skip":75,"rxjs/add/operator/switchMap":79}],243:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/BehaviorSubject"),o=t("rxjs/Subject");t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var s=function(t){function e(e,r,n){var s=t.call(this)||this;return s._activated$=new i.BehaviorSubject(!1),s._configurationSubject$=new o.Subject,s._activated=!1,s._container=r,s._name=e,s._navigator=n,s._configuration$=s._configurationSubject$.startWith(s.defaultConfiguration).scan(function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}).publishReplay(1).refCount(),s._configuration$.subscribe(function(){}),s}return n(e,t),Object.defineProperty(e.prototype,"activated",{get:function(){return this._activated},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activated$",{get:function(){return this._activated$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultConfiguration",{get:function(){return this._getDefaultConfiguration()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),e.prototype.activate=function(t){this._activated||(void 0!==t&&this._configurationSubject$.next(t),this._activated=!0,this._activate(),this._activated$.next(!0))},e.prototype.configure=function(t){this._configurationSubject$.next(t)},e.prototype.deactivate=function(){this._activated&&(this._activated=!1,this._deactivate(),this._container.domRenderer.clear(this._name),this._container.glRenderer.clear(this._name),this._activated$.next(!1))},e.prototype.resize=function(){},e.componentName="not_worthy",e}(t("../Utils").EventEmitter);r.Component=s,r.default=s},{"../Utils":235,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78}],244:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=t("../Error"),o=function(){function t(e,r){this._components={},this._container=e,this._navigator=r;for(var i=0,o=n.values(t.registeredComponents);i<o.length;i++){var s=o[i];this._components[s.componentName]={active:!1,component:new s(s.componentName,e,r)}}this._coverComponent=new t.registeredCoverComponent("cover",e,r),this._coverComponent.activate(),this._coverActivated=!0}return t.register=function(e){void 0===t.registeredComponents[e.componentName]&&(t.registeredComponents[e.componentName]=e)},t.registerCover=function(e){t.registeredCoverComponent=e},t.prototype.activateCover=function(){if(!this._coverActivated){this._coverActivated=!0;for(var t=0,e=n.values(this._components);t<e.length;t++){var r=e[t];r.active&&r.component.deactivate()}}},t.prototype.deactivateCover=function(){if(this._coverActivated){this._coverActivated=!1;for(var t=0,e=n.values(this._components);t<e.length;t++){var r=e[t];r.active&&r.component.activate()}}},t.prototype.activate=function(t){this._checkName(t),this._components[t].active=!0,this._coverActivated||this.get(t).activate()},t.prototype.configure=function(t,e){this._checkName(t),this.get(t).configure(e)},t.prototype.deactivate=function(t){this._checkName(t),this._components[t].active=!1,this._coverActivated||this.get(t).deactivate()},t.prototype.resize=function(){for(var t=0,e=n.values(this._components);t<e.length;t++)e[t].component.resize()},t.prototype.get=function(t){return this._components[t].component},t.prototype.getCover=function(){return this._coverComponent},t.prototype._checkName=function(t){if(!(t in this._components))throw new i.ArgumentMapillaryError("Component does not exist: "+t)},t.registeredComponents={},t}();r.ComponentService=o,r.default=o},{"../Error":228,underscore:178}],245:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom");t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/withLatestFrom");var o=t("../Component"),s=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){var t=this;this._keyDisposable=this._navigator.stateService.currentNode$.withLatestFrom(this._configuration$,function(t,e){return[t,e]}).filter(function(t){return t[0].key!==t[1].key}).map(function(t){return t[0]}).map(function(t){return{key:t.key,src:t.image.src}}).subscribe(this._configurationSubject$),this._disposable=this._configuration$.map(function(e){return e.key?e.visible?{name:t._name,vnode:t._getCoverButtonVNode(e)}:{name:t._name,vnode:i.h("div.Cover.CoverDone",[t._getCoverBackgroundVNode(e)])}:{name:t._name,vnode:i.h("div",[])}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe(),this._keyDisposable.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{loading:!1,visible:!0}},e.prototype._getCoverButtonVNode=function(t){var e=this,r=t.loading?"div.Cover.CoverLoading":"div.Cover";return i.h(r,[this._getCoverBackgroundVNode(t),i.h("button.CoverButton",{onclick:function(){e.configure({loading:!0})}},["Explore"]),i.h("a.CoverLogo",{href:"https://www.mapillary.com",target:"_blank"},[])])},e.prototype._getCoverBackgroundVNode=function(t){var e={style:{backgroundImage:null!=t.src?"url("+t.src+")":"url(https://d1cuyjsrcm0gby.cloudfront.net/"+t.key+"/thumb-640.jpg)"}},r=[];return t.loading&&r.push(i.h("div.Spinner",{},[])),r.push(i.h("div.CoverBackgroundGradient",{},[])),i.h("div.CoverBackground",e,r)},e.componentName="cover",e}(o.Component);r.CoverComponent=s,o.ComponentService.registerCover(s),r.default=s},{"../Component":226,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/withLatestFrom":83,"virtual-dom":182}],246:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("underscore"),o=t("virtual-dom"),s=t("rxjs/BehaviorSubject");t("rxjs/add/operator/combineLatest");var a=t("../Component"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._open$=new s.BehaviorSubject(!1),i._displaying=!1,i}return n(e,t),e.prototype._activate=function(){var t=this;this._disposable=this._navigator.stateService.currentState$.combineLatest(this._open$,this._navigator.imageLoadingService.loadstatus$,function(e,r,n){return{name:t._name,vnode:t._getDebugVNode(r,t._getDebugInfo(e,n))}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getDebugInfo=function(t,e){var r=[];r.push(o.h("h2","Node")),t.state.currentNode&&r.push(o.h("p","currentNode: "+t.state.currentNode.key)),t.state.previousNode&&r.push(o.h("p","previousNode: "+t.state.previousNode.key)),r.push(o.h("h2","Loading"));for(var n=0,s=0,a=0,c=0,u=i.values(e);c<u.length;c++){var h=u[c];n+=h.loaded,h.loaded!==h.total?a++:s++}return r.push(o.h("p","Loaded Images: "+s)),r.push(o.h("p","Loading Images: "+a)),r.push(o.h("p","Total bytes loaded: "+n)),r.push(o.h("h2","Camera")),r.push(o.h("p","camera.position.x: "+t.state.camera.position.x)),r.push(o.h("p","camera.position.y: "+t.state.camera.position.y)),r.push(o.h("p","camera.position.z: "+t.state.camera.position.z)),r.push(o.h("p","camera.lookat.x: "+t.state.camera.lookat.x)),r.push(o.h("p","camera.lookat.y: "+t.state.camera.lookat.y)),r.push(o.h("p","camera.lookat.z: "+t.state.camera.lookat.z)),r.push(o.h("p","camera.up.x: "+t.state.camera.up.x)),r.push(o.h("p","camera.up.y: "+t.state.camera.up.y)),r.push(o.h("p","camera.up.z: "+t.state.camera.up.z)),r},e.prototype._getDebugVNode=function(t,e){return t?o.h("div.Debug",{},[o.h("h2",{},["Debug"]),this._getDebugVNodeButton(t),o.h("pre",{},e)]):this._getDebugVNodeButton(t)},e.prototype._getDebugVNodeButton=function(t){var e=t?"Disable Debug":"D",r=t?"":".DebugButtonFixed";return t?o.h("button.DebugButton"+r,{onclick:this._closeDebugElement.bind(this)},[e]):o.h("button.DebugButton"+r,{onclick:this._openDebugElement.bind(this)},[e])},e.prototype._closeDebugElement=function(t){this._open$.next(!1)},e.prototype._openDebugElement=function(){this._open$.next(!0)},e.componentName="debug",e}(a.Component);r.DebugComponent=c,a.ComponentService.register(c),r.default=c},{"../Component":226,"rxjs/BehaviorSubject":26,"rxjs/add/operator/combineLatest":53,underscore:178,"virtual-dom":182}],247:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom");t("rxjs/add/operator/combineLatest");var o=t("../Component"),s=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._canvasId=r.id+"-"+i._name,i}return n(e,t),e.prototype._activate=function(){var t=this;this.drawSubscription=this._container.domRenderer.element$.combineLatest(this._navigator.stateService.currentNode$,function(e,r){return{canvas:document.getElementById(t._canvasId),node:r}}).subscribe(function(t){var e=t.canvas,r=t.node;if(!r||!e)return null;var n=e.parentElement,i=n.offsetWidth,o=n.offsetHeight;e.width=i,e.height=o,e.getContext("2d").drawImage(r.image,0,0,i,o)}),this._container.domRenderer.renderAdaptive$.next({name:this._name,vnode:i.h("canvas#"+this._canvasId,[])})},e.prototype._deactivate=function(){this.drawSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="image",e}(o.Component);r.ImageComponent=s,o.ComponentService.register(s),r.default=s},{"../Component":226,"rxjs/add/operator/combineLatest":53,"virtual-dom":182}],248:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable");t("rxjs/add/observable/fromEvent"),t("rxjs/add/operator/withLatestFrom");var o=t("../Edge"),s=t("../Component"),a=t("../Geo"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._spatial=new a.Spatial,i._perspectiveDirections=[o.EdgeDirection.StepForward,o.EdgeDirection.StepBackward,o.EdgeDirection.StepLeft,o.EdgeDirection.StepRight,o.EdgeDirection.TurnLeft,o.EdgeDirection.TurnRight,o.EdgeDirection.TurnU],i}return n(e,t),e.prototype._activate=function(){var t=this,e=this._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}),r=this._navigator.stateService.currentNode$.switchMap(function(t){return t.spatialEdges$});this._disposable=i.Observable.fromEvent(document,"keydown").withLatestFrom(this._navigator.stateService.currentState$,e,r,function(t,e,r,n){return{event:t,frame:e,sequenceEdges:r,spatialEdges:n}}).subscribe(function(e){e.frame.state.currentNode.pano?t._navigatePanorama(e.event,e.sequenceEdges,e.spatialEdges,e.frame.state.camera):t._navigatePerspective(e.event,e.sequenceEdges,e.spatialEdges)})},e.prototype._deactivate=function(){this._disposable.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._navigatePanorama=function(t,e,r,n){var i=0,s=null,a=null,c=this._rotationFromCamera(n).phi;switch(t.keyCode){case 37:if(t.shiftKey||t.altKey)break;i=Math.PI/2+c,s=o.EdgeDirection.StepLeft;break;case 38:if(t.shiftKey)break;if(t.altKey){a=o.EdgeDirection.Next;break}i=c,s=o.EdgeDirection.StepForward;break;case 39:if(t.shiftKey||t.altKey)break;i=-Math.PI/2+c,s=o.EdgeDirection.StepRight;break;case 40:if(t.shiftKey)break;if(t.altKey){a=o.EdgeDirection.Prev;break}i=Math.PI+c,s=o.EdgeDirection.StepBackward;break;default:return}if(t.preventDefault(),null==a){if(null!=s&&r.cached){i=this._spatial.wrapAngle(i);for(var u=Math.PI/4,h=r.edges.filter(function(t){return t.data.direction===o.EdgeDirection.Pano||t.data.direction===s}),l=Number.MAX_VALUE,p=null,f=0,d=h;f<d.length;f++){var m=d[f],v=Math.abs(this._spatial.wrapAngle(m.data.worldMotionAzimuth-i));v<Math.min(l,u)&&(l=v,p=m.to)}null!=p&&this._navigator.moveToKey$(p).subscribe(function(t){},function(t){console.error(t)})}}else this._moveInDir(a,e)},e.prototype._rotationFromCamera=function(t){var e=t.lookat.clone().sub(t.position),r=e.clone().dot(t.up),n=e.clone().sub(t.up.clone().multiplyScalar(r));return{phi:Math.atan2(n.y,n.x),theta:Math.PI/2-this._spatial.angleToPlane(e.toArray(),[0,0,1])}},e.prototype._navigatePerspective=function(t,e,r){var n=null,i=null;switch(t.keyCode){case 37:if(t.altKey)break;n=t.shiftKey?o.EdgeDirection.TurnLeft:o.EdgeDirection.StepLeft;break;case 38:if(t.altKey){i=o.EdgeDirection.Next;break}n=t.shiftKey?o.EdgeDirection.Pano:o.EdgeDirection.StepForward;break;case 39:if(t.altKey)break;n=t.shiftKey?o.EdgeDirection.TurnRight:o.EdgeDirection.StepRight;break;case 40:if(t.altKey){i=o.EdgeDirection.Prev;break}n=t.shiftKey?o.EdgeDirection.TurnU:o.EdgeDirection.StepBackward;break;default:return}t.preventDefault(),null==i?this._moveInDir(n,r):this._moveInDir(i,e)},e.prototype._moveInDir=function(t,e){if(e.cached)for(var r=0,n=e.edges;r<n.length;r++){var i=n[r];if(i.data.direction===t)return void this._navigator.moveToKey$(i.to).subscribe(function(t){},function(t){console.error(t)})}},e.componentName="keyboard",e}(s.Component);r.KeyboardComponent=c,s.ComponentService.register(c),r.default=c},{"../Component":226,"../Edge":227,"../Geo":229,"rxjs/Observable":29,"rxjs/add/observable/fromEvent":42,"rxjs/add/operator/withLatestFrom":83}],249:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("underscore"),o=t("virtual-dom");t("rxjs/add/operator/combineLatest");var s=t("../Component"),a=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){var t=this;this._loadingSubscription=this._navigator.loadingService.loading$.combineLatest(this._navigator.imageLoadingService.loadstatus$,function(e,r){if(!e)return{name:"loading",vnode:t._getBarVNode(100)};for(var n=0,o=0,s=0,a=i.values(r);s<a.length;s++){var c=a[s];c.loaded!==c.total&&(o+=c.loaded,n+=c.total)}var u=100;return 0!==n&&(u=o/n*100),{name:t._name,vnode:t._getBarVNode(u)}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._loadingSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getBarVNode=function(t){var e={},r={};return 100!==t?(e.width=t.toFixed(0)+"%",e.opacity="1"):(e.width="100%",e.opacity="0"),o.h("div.Loading",{style:r},[o.h("div.LoadingBar",{style:e},[])])},e.componentName="loading",e}(s.Component);r.LoadingComponent=a,s.ComponentService.register(a),r.default=a},{"../Component":226,"rxjs/add/operator/combineLatest":53,underscore:178,"virtual-dom":182}],250:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("rxjs/Observable");t("rxjs/add/operator/map"),t("rxjs/add/operator/first");var s=t("../Edge"),a=t("../Component"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._dirNames={},i._dirNames[s.EdgeDirection.StepForward]="Forward",i._dirNames[s.EdgeDirection.StepBackward]="Backward",i._dirNames[s.EdgeDirection.StepLeft]="Left",i._dirNames[s.EdgeDirection.StepRight]="Right",i._dirNames[s.EdgeDirection.TurnLeft]="Turnleft",i._dirNames[s.EdgeDirection.TurnRight]="Turnright",i._dirNames[s.EdgeDirection.TurnU]="Turnaround",i}return n(e,t),e.prototype._activate=function(){var t=this;this._renderSubscription=this._navigator.stateService.currentNode$.switchMap(function(t){return t.pano?o.Observable.of([]):o.Observable.combineLatest(t.sequenceEdges$,t.spatialEdges$,function(t,e){return t.edges.concat(e.edges)})}).map(function(e){for(var r=[],n=0,o=e;n<o.length;n++){var s=o[n].data.direction,a=t._dirNames[s];null!=a&&r.push(t._createVNode(s,a))}return{name:t._name,vnode:i.h("div.NavigationComponent",r)}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._renderSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._createVNode=function(t,e){var r=this;return i.h("span.Direction.Direction"+e,{onclick:function(e){r._navigator.moveDir$(t).subscribe(function(t){},function(t){console.error(t)})}},[])},e.componentName="navigation",e}(a.Component);r.NavigationComponent=c,a.ComponentService.register(c),r.default=c},{"../Component":226,"../Edge":227,"rxjs/Observable":29,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"virtual-dom":182}],251:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("underscore"),o=t("virtual-dom"),s=t("rxjs/Observable");t("rxjs/add/observable/fromPromise"),t("rxjs/add/observable/of"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/distinct"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/pluck"),t("rxjs/add/operator/scan");var a=t("../Component"),c=function(){return function(){}}(),u=function(){return function(){}}(),h=function(){return function(){this.nodeInstructions=[],this.nodeInstructionsOrdered=[]}}(),l=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){var t,e=this;t=this._navigator.stateService.currentState$.filter(function(t){return t.id%2==0}).filter(function(t){return t.state.nodesAhead<15}).distinctUntilChanged(void 0,function(t){return t.state.lastNode.key});var r;r=this.configuration$.mergeMap(function(t){return s.Observable.from(t.paths)}).distinct(function(t){return t.sequenceKey}).mergeMap(function(t){return e._navigator.apiV3.sequenceByKey$([t.sequenceKey]).map(function(e){return e[t.sequenceKey]})}).combineLatest(this.configuration$,function(t,e){for(var r=0,n=[],i=0,o=e.paths;i<o.length;i++){var s=o[i];if(s.sequenceKey===t.key){for(var a=[],c=!1,u=0,h=t.keys;u<h.length;u++){var l=h[u];if(s.startKey===l&&(c=!0),c){for(var p=null,f=0,d=s.infoKeys;f<d.length;f++){var m=d[f];m.key===l&&(p=m.description)}a.push({description:p,key:l})}s.stopKey===l&&(c=!1)}n.push({nodeInstructions:a,place:r})}r++}return n}).scan(function(t,e){for(var r=0,n=e;r<n.length;r++){var o=n[r];t.nodeInstructionsOrdered[o.place]=o.nodeInstructions}return t.nodeInstructions=i.flatten(t.nodeInstructionsOrdered),t},new h),this._disposable=t.combineLatest(r,this.configuration$,function(t,e,r){return{conf:r,frame:t,routeTrack:e}}).scan(function(t,r){return void 0===r.conf.playing||r.conf.playing?(t.routeTrack=r.routeTrack,t.currentNode=r.frame.state.currentNode,t.lastNode=r.frame.state.lastNode,t.playing=!0):(e._navigator.stateService.cutNodes(),t.playing=!1),t},new u).filter(function(t){return t.playing}).filter(function(t){for(var e=0,r=t.routeTrack.nodeInstructions;e<r.length;e++){var n=r[e];if(n&&n.key===t.lastNode.key)return!0}return!1}).distinctUntilChanged(void 0,function(t){return t.lastNode.key}).mergeMap(function(t){for(var r=0,n=0,i=t.routeTrack.nodeInstructions;n<i.length&&i[n].key!==t.lastNode.key;n++)r++;var o=t.routeTrack.nodeInstructions[r+1];return o?e._navigator.graphService.cacheNode$(o.key):s.Observable.of(null)}).combineLatest(this.configuration$,function(t,e){return{conf:e,node:t}}).filter(function(t){return null!==t.node&&t.conf.playing}).pluck("node").subscribe(this._navigator.stateService.appendNode$),this._disposableDescription=this._navigator.stateService.currentNode$.combineLatest(r,this.configuration$,function(t,e,r){if(void 0!==r.playing&&!r.playing)return"quit";for(var n=null,i=0,o=e.nodeInstructions;i<o.length;i++){var s=o[i];if(s.key===t.key){n=s.description;break}}return n}).scan(function(t,e){return e!==t.description&&null!==e?(t.description=e,t.showsLeft=6):t.showsLeft--,"quit"===e&&(t.description=null),t},new c).map(function(t){return t.showsLeft>0&&t.description?{name:e._name,vnode:e._getRouteAnnotationNode(t.description)}:{name:e._name,vnode:o.h("div",[])}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe(),this._disposableDescription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype.play=function(){this.configure({playing:!0})},e.prototype.stop=function(){this.configure({playing:!1})},e.prototype._getRouteAnnotationNode=function(t){return o.h("div.RouteFrame",{},[o.h("p",{textContent:t},[])])},e.componentName="route",e}(a.Component);r.RouteComponent=l,a.ComponentService.register(l),r.default=l},{"../Component":226,"rxjs/Observable":29,"rxjs/add/observable/fromPromise":43,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":73,underscore:178,"virtual-dom":182}],252:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable");t("rxjs/add/operator/buffer"),t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/scan");var o=t("../Component"),s=function(t){function e(e,r,n){return t.call(this,e,r,n)||this}return n(e,t),e.prototype._activate=function(){var t=this;this._sequenceSubscription=this._navigator.stateService.currentNode$.scan(function(t,e){var r=e.sequenceKey;return t.report=[],r in t.reported||(t.report=[r],t.reported[r]=!0),t},{report:[],reported:{}}).filter(function(t){return t.report.length>0}).mergeMap(function(e){return t._navigator.apiV3.sequenceViewAdd$(e.report).catch(function(t,r){return console.error("Failed to report sequence stats ("+e.report+")",t),i.Observable.empty()})}).subscribe(function(){}),this._imageSubscription=this._navigator.stateService.currentNode$.map(function(t){return t.key}).buffer(this._navigator.stateService.currentNode$.debounceTime(5e3)).scan(function(t,e){t.report=[];for(var r=0,n=e;r<n.length;r++){var i=n[r];i in t.reported||(t.report.push(i),t.reported[i]=!0)}return t},{report:[],reported:{}}).filter(function(t){return t.report.length>0}).mergeMap(function(e){return t._navigator.apiV3.imageViewAdd$(e.report).catch(function(t,r){return console.error("Failed to report image stats ("+e.report+")",t),i.Observable.empty()})}).subscribe(function(){})},e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._imageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="stats",e}(o.Component);r.StatsComponent=s,o.ComponentService.register(s),r.default=s},{"../Component":226,"rxjs/Observable":29,"rxjs/add/operator/buffer":49,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":73}],253:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("rxjs/Observable"),s=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/do"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/share");var a=t("../../Component"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._renderer=new a.DirectionDOMRenderer(i.defaultConfiguration,r.element),i._hoveredKeySubject$=new s.Subject,i._hoveredKey$=i._hoveredKeySubject$.share(),i}return n(e,t),Object.defineProperty(e.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),e.prototype.setHighlightKey=function(t){this.configure({highlightKey:t})},e.prototype.setMinWidth=function(t){this.configure({minWidth:t})},e.prototype.setMaxWidth=function(t){this.configure({maxWidth:t})},e.prototype.resize=function(){this._renderer.resize(this._container.element)},e.prototype._activate=function(){var t=this;this._configurationSubscription=this._configuration$.subscribe(function(e){t._renderer.setConfiguration(e)}),this._nodeSubscription=this._navigator.stateService.currentNode$.do(function(e){t._container.domRenderer.render$.next({name:t._name,vnode:i.h("div",{},[])}),t._renderer.setNode(e)}).withLatestFrom(this._configuration$).switchMap(function(e){var r=e[0],n=e[1];return r.spatialEdges$.withLatestFrom(n.distinguishSequence?t._navigator.graphService.cacheSequence$(r.sequenceKey).catch(function(t,e){return console.error("Failed to cache sequence ("+r.sequenceKey+")",t),o.Observable.empty()}):o.Observable.of(null))}).subscribe(function(e){t._renderer.setEdges(e[0],e[1])}),this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.do(function(e){t._renderer.setRenderCamera(e)}).map(function(e){return t._renderer}).filter(function(t){return t.needsRender}).map(function(e){return{name:t._name,vnode:e.render(t._navigator)}}).subscribe(this._container.domRenderer.render$),this._hoveredKeySubscription=o.Observable.combineLatest([this._container.domRenderer.element$,this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$.startWith(null),this._container.mouseService.mouseUp$.startWith(null)],function(t,e,r,n){return t}).map(function(t){for(var e=t.getElementsByClassName("DirectionsPerspective"),r=0;r<e.length;r++){var n=e.item(r).querySelector(":hover");if(null!=n&&n.hasAttribute("data-key"))return n.getAttribute("data-key")}return null}).distinctUntilChanged().subscribe(this._hoveredKeySubject$)},e.prototype._deactivate=function(){this._configurationSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this._renderCameraSubscription.unsubscribe(),this._hoveredKeySubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{distinguishSequence:!1,maxWidth:460,minWidth:260}},e.componentName="direction",e}(a.Component);r.DirectionComponent=c,a.ComponentService.register(c),r.default=c},{"../../Component":226,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/share":74,"virtual-dom":182}],254:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../Geo"),i=function(){function t(t,e){this._spatial=new n.Spatial,this._minThresholdWidth=320,this._maxThresholdWidth=1480,this._minThresholdHeight=240,this._maxThresholdHeight=820,this._configure(t),this._resize(e),this._reset()}return Object.defineProperty(t.prototype,"minWidth",{get:function(){return this._minWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){return this._maxWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerWidth",{get:function(){return this._containerWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerWidthCss",{get:function(){return this._containerWidthCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerMarginCss",{get:function(){return this._containerMarginCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerLeftCss",{get:function(){return this._containerLeftCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerHeight",{get:function(){return this._containerHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerHeightCss",{get:function(){return this._containerHeightCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerBottomCss",{get:function(){return this._containerBottomCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stepCircleSize",{get:function(){return this._stepCircleSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stepCircleSizeCss",{get:function(){return this._stepCircleSizeCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stepCircleMarginCss",{get:function(){return this._stepCircleMarginCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"turnCircleSize",{get:function(){return this._turnCircleSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"turnCircleSizeCss",{get:function(){return this._turnCircleSizeCss},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"outerRadius",{get:function(){return this._outerRadius},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"innerRadius",{get:function(){return this._innerRadius},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffset",{get:function(){return this._shadowOffset},enumerable:!0,configurable:!0}),t.prototype.configure=function(t){this._configure(t),this._reset()},t.prototype.resize=function(t){this._resize(t),this._reset()},t.prototype.angleToCoordinates=function(t){return[Math.cos(t),Math.sin(t)]},t.prototype.relativeAngleToCoordiantes=function(t,e){var r=this._spatial.wrapAngle(t-e);return this.angleToCoordinates(r)},t.prototype._configure=function(t){this._minWidth=t.minWidth,this._maxWidth=this._getMaxWidth(t.minWidth,t.maxWidth)},t.prototype._resize=function(t){this._elementWidth=t.offsetWidth,this._elementHeight=t.offsetHeight},t.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)},t.prototype._getContainerWidth=function(t,e){var r=(t-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth),n=(e-this._minThresholdHeight)/(this._maxThresholdHeight-this._minThresholdHeight),i=Math.max(0,Math.min(1,Math.min(r,n)));return i=.04*Math.round(25*i),this._minWidth+i*(this._maxWidth-this._minWidth)},t.prototype._getContainerHeight=function(t){return.77*t},t.prototype._getStepCircleDiameter=function(t){return.34*t},t.prototype._getTurnCircleDiameter=function(t){return.3*t},t.prototype._getOuterRadius=function(t){return.31*t},t.prototype._getInnerRadius=function(t){return.125*t},t.prototype._numberToCssPixels=function(t){return t+"px"},t.prototype._getMaxWidth=function(t,e){return t>e?t:e},t}();r.DirectionDOMCalculator=i,r.default=i},{"../../Geo":229}],255:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("virtual-dom"),i=t("../../Component"),o=t("../../Edge"),s=t("../../Geo"),a=function(){function t(t,e){this._isEdge=!1,this._spatial=new s.Spatial,this._calculator=new i.DirectionDOMCalculator(t,e),this._node=null,this._rotation={phi:0,theta:0},this._epsilon=.5*Math.PI/180,this._highlightKey=null,this._distinguishSequence=!1,this._needsRender=!1,this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[],this._stepDirections=[o.EdgeDirection.StepForward,o.EdgeDirection.StepBackward,o.EdgeDirection.StepLeft,o.EdgeDirection.StepRight],this._turnDirections=[o.EdgeDirection.TurnLeft,o.EdgeDirection.TurnRight,o.EdgeDirection.TurnU],this._turnNames={},this._turnNames[o.EdgeDirection.TurnLeft]="TurnLeft",this._turnNames[o.EdgeDirection.TurnRight]="TurnRight",this._turnNames[o.EdgeDirection.TurnU]="TurnAround";var r=!!document.documentMode;this._isEdge=!r&&!!window.StyleMedia}return Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.render=function(t){this._needsRender=!1;var e=this._rotation,r=[],n=[];return this._node.pano?r=r.concat(this._createPanoArrows(t,e)):(r=(r=r.concat(this._createPerspectiveToPanoArrows(t,e))).concat(this._createStepArrows(t,e)),n=n.concat(this._createTurnArrows(t))),this._getContainer(r,n,e)},t.prototype.setEdges=function(t,e){this._setEdges(t,e),this._setNeedsRender()},t.prototype.setNode=function(t){this._node=t,this._clearEdges(),this._setNeedsRender()},t.prototype.setRenderCamera=function(t){var e=t.rotation;Math.abs(e.phi-this._rotation.phi)<this._epsilon||(this._rotation=e,this._setNeedsRender())},t.prototype.setConfiguration=function(t){var e=!1;this._highlightKey===t.highlightKey&&this._distinguishSequence===t.distinguishSequence||(this._highlightKey=t.highlightKey,this._distinguishSequence=t.distinguishSequence,e=!0),this._calculator.minWidth===t.minWidth&&this._calculator.maxWidth===t.maxWidth||(this._calculator.configure(t),e=!0),e&&this._setNeedsRender()},t.prototype.resize=function(t){this._calculator.resize(t),this._setNeedsRender()},t.prototype._setNeedsRender=function(){null!=this._node&&(this._needsRender=!0)},t.prototype._clearEdges=function(){this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[]},t.prototype._setEdges=function(t,e){this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[];for(var r=0,n=t.edges;r<n.length;r++){var i=(c=n[r]).data.direction;this._stepDirections.indexOf(i)>-1?this._stepEdges.push(c):this._turnDirections.indexOf(i)>-1?this._turnEdges.push(c):c.data.direction===o.EdgeDirection.Pano&&this._panoEdges.push(c)}if(this._distinguishSequence&&null!=e)for(var s=0,a=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);s<a.length;s++)for(var c=a[s],u=c.to,h=0,l=e.keys;h<l.length;h++)if(l[h]===u){this._sequenceEdgeKeys.push(u);break}},t.prototype._createPanoArrows=function(t,e){for(var r=[],n=0,i=this._panoEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByKey(t,o.to,o.data.worldMotionAzimuth,e,this._calculator.outerRadius,"DirectionsArrowPano"))}for(var s=0,a=this._stepEdges;s<a.length;s++){var c=a[s];r.push(this._createPanoToPerspectiveArrow(t,c.to,c.data.worldMotionAzimuth,e,c.data.direction))}return r},t.prototype._createPanoToPerspectiveArrow=function(t,e,r,n,i){var s=Math.PI/8,a=n.phi;switch(i){case o.EdgeDirection.StepBackward:a=n.phi-Math.PI;break;case o.EdgeDirection.StepLeft:a=n.phi+Math.PI/2;break;case o.EdgeDirection.StepRight:a=n.phi-Math.PI/2}return Math.abs(this._spatial.wrapAngle(r-a))<s?this._createVNodeByKey(t,e,r,n,this._calculator.outerRadius,"DirectionsArrowStep"):this._createVNodeDisabled(e,r,n)},t.prototype._createPerspectiveToPanoArrows=function(t,e){for(var r=[],n=0,i=this._panoEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByKey(t,o.to,o.data.worldMotionAzimuth,e,this._calculator.innerRadius,"DirectionsArrowPano",!0))}return r},t.prototype._createStepArrows=function(t,e){for(var r=[],n=0,i=this._stepEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByDirection(t,o.to,o.data.worldMotionAzimuth,e,o.data.direction))}return r},t.prototype._createTurnArrows=function(t){for(var e=[],r=0,n=this._turnEdges;r<n.length;r++){var i=n[r],o=i.data.direction,s=this._turnNames[o];e.push(this._createVNodeByTurn(t,i.to,s,o))}return e},t.prototype._createVNodeByKey=function(t,e,r,n,i,o,s){return this._createVNode(e,r,n,i,o,"DirectionsCircle",function(r){t.moveToKey$(e).subscribe(function(t){},function(t){console.error(t)})},s)},t.prototype._createVNodeByDirection=function(t,e,r,n,i){return this._createVNode(e,r,n,this._calculator.outerRadius,"DirectionsArrowStep","DirectionsCircle",function(e){t.moveDir$(i).subscribe(function(t){},function(t){console.error(t)})})},t.prototype._createVNodeByTurn=function(t,e,r,i){var s={height:this._calculator.turnCircleSizeCss,transform:"rotate(0)",width:this._calculator.turnCircleSizeCss};switch(i){case o.EdgeDirection.TurnLeft:s.left="5px",s.top="5px";break;case o.EdgeDirection.TurnRight:s.right="5px",s.top="5px";break;case o.EdgeDirection.TurnU:s.left="5px",s.bottom="5px"}var a={attributes:{"data-key":e},onclick:function(e){t.moveDir$(i).subscribe(function(t){},function(t){console.error(t)})},style:s},c="TurnCircle";this._sequenceEdgeKeys.indexOf(e)>-1&&(c+="Sequence"),this._highlightKey===e&&(c+="Highlight");var u=n.h("div."+r,{},[]);return n.h("div."+c,a,[u])},t.prototype._createVNodeDisabled=function(t,e,r){return this._createVNode(t,e,r,this._calculator.outerRadius,"DirectionsArrowDisabled","DirectionsCircleDisabled")},t.prototype._createVNode=function(t,e,r,i,o,s,a,c){var u=this._calculator.angleToCoordinates(e-r.phi),h=Math.round(-i*u[1]+.5*this._calculator.containerWidth),l=Math.round(-i*u[0]+.5*this._calculator.containerHeight),p=this._calculator.relativeAngleToCoordiantes(e,r.phi),f=this._calculator.shadowOffset,d="drop-shadow("+-f*p[1]+"px "+f*p[0]+"px 1px rgba(0,0,0,0.8))",m={style:{"-webkit-filter":d,filter:d}},v=n.h("div."+o,m,[]),g=-this._spatial.radToDeg(e-r.phi),y=c?"translate("+h+"px, "+l+"px) rotate("+g+"deg) translateZ(-0.01px)":"translate("+h+"px, "+l+"px) rotate("+g+"deg)",b={attributes:{"data-key":t},onclick:a,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:y,width:this._calculator.stepCircleSizeCss}};return this._sequenceEdgeKeys.indexOf(t)>-1&&(s+="Sequence"),this._highlightKey===t&&(s+="Highlight"),n.h("div."+s,b,[v])},t.prototype._getContainer=function(t,e,r){var i=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",o={oncontextmenu:function(t){t.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:i,width:this._calculator.containerWidthCss}};return n.h("div.DirectionsPerspective",o,e.concat(t))},t}();r.DirectionDOMRenderer=a,r.default=a},{"../../Component":226,"../../Edge":227,"../../Geo":229,"virtual-dom":182}],256:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/operator/catch"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/pairwise"),t("rxjs/add/operator/publish"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/skipWhile"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/takeUntil"),t("rxjs/add/operator/withLatestFrom");var s=t("../../Component"),a=t("../../Render"),c=t("../../Tiles"),u=t("../../Utils"),h=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._imageTileLoader=new c.ImageTileLoader(u.Urls.tileScheme,u.Urls.tileDomain,u.Urls.origin),i._roiCalculator=new c.RegionOfInterestCalculator,i._rendererOperation$=new o.Subject,i._rendererCreator$=new o.Subject,i._rendererDisposer$=new o.Subject,i._renderer$=i._rendererOperation$.scan(function(t,e){return e(t)},null).filter(function(t){return null!=t}).distinctUntilChanged(void 0,function(t){return t.frameId}),i._rendererCreator$.map(function(){return function(t){if(null!=t)throw new Error("Multiple image plane states can not be created at the same time");return new s.ImagePlaneGLRenderer}}).subscribe(i._rendererOperation$),i._rendererDisposer$.map(function(){return function(t){return t.dispose(),null}}).subscribe(i._rendererOperation$),i}return n(e,t),e.prototype._activate=function(){var t=this;this._rendererSubscription=this._renderer$.map(function(e){var r={name:t._name,render:{frameId:e.frameId,needsRender:e.needsRender,render:e.render.bind(e),stage:a.GLRenderStage.Background}};return e.clearNeedsRender(),r}).subscribe(this._container.glRenderer.render$),this._rendererCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(t){return function(e){return e.updateFrame(t),e}}).subscribe(this._rendererOperation$);var e=this._navigator.stateService.currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).combineLatest(this._configuration$).filter(function(t){return!0===t[1].imageTiling}).map(function(t){return t[0]}).withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$).map(function(e){var r=e[0].state,n=e[1],i=e[2],o=r.currentNode,s=r.currentTransform,a=Math.max(i.width,i.height)>1024?1024:512;return new c.TextureProvider(o.key,s.basicWidth,s.basicHeight,a,o.image,t._imageTileLoader,new c.ImageTileStore,n)}).publishReplay(1).refCount();this._textureProviderSubscription=e.subscribe(function(){}),this._setTextureProviderSubscription=e.map(function(t){return function(e){return e.setTextureProvider(t.key,t),e}}).subscribe(this._rendererOperation$),this._abortTextureProviderSubscription=e.pairwise().subscribe(function(t){t[0].abort()});var r=this._container.renderService.renderCameraFrame$.map(function(t){return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf()]}).pairwise().skipWhile(function(t){return t[1][2]-t[0][2]<0||0===t[1][2]}).map(function(t){var e=t[0][0].equals(t[1][0]),r=t[0][1].equals(t[1][1]),n=t[0][2]===t[1][2];return e&&r&&n}).distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._container.renderService.renderCameraFrame$.first()}).withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$);this._setRegionOfInterestSubscription=e.switchMap(function(e){return r.map(function(r){return[t._roiCalculator.computeRegionOfInterest(r[0],r[1],r[2]),e]})}).filter(function(t){return!t[1].disposed}).subscribe(function(t){var e=t[0];t[1].setRegionOfInterest(e)});var n=e.switchMap(function(t){return t.hasTexture$}).startWith(!1).publishReplay(1).refCount();this._hasTextureSubscription=n.subscribe(function(){});var o=this._navigator.stateService.currentNode$.debounceTime(1e3).withLatestFrom(n).filter(function(t){return!t[1]}).map(function(t){return t[0]}).filter(function(t){return t.pano?u.Settings.maxImageSize>u.Settings.basePanoramaSize:u.Settings.maxImageSize>u.Settings.baseImageSize}).switchMap(function(t){var e=t.pano?u.Settings.basePanoramaSize:u.Settings.baseImageSize;return Math.max(t.image.width,t.image.height)>e?i.Observable.empty():t.cacheImage$(u.Settings.maxImageSize).map(function(t){return[t.image,t]}).takeUntil(n.filter(function(t){return t})).catch(function(e,r){return console.error("Failed to fetch high res image ("+t.key+")",e),i.Observable.empty()})}).publish().refCount();this._updateBackgroundSubscription=o.withLatestFrom(e).subscribe(function(t){t[0][1].key!==t[1].key||t[1].disposed||t[1].updateBackground(t[0][0])}),this._updateTextureImageSubscription=o.map(function(t){return function(e){return e.updateTextureImage(t[0],t[1]),e}}).subscribe(this._rendererOperation$)},e.prototype._deactivate=function(){this._rendererDisposer$.next(null),this._abortTextureProviderSubscription.unsubscribe(),this._hasTextureSubscription.unsubscribe(),this._rendererSubscription.unsubscribe(),this._setRegionOfInterestSubscription.unsubscribe(),this._setTextureProviderSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._textureProviderSubscription.unsubscribe(),this._updateBackgroundSubscription.unsubscribe(),this._updateTextureImageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{imageTiling:!1}},e.componentName="imagePlane",e}(s.Component);r.ImagePlaneComponent=h,s.ComponentService.register(h),r.default=h},{"../../Component":226,"../../Render":232,"../../Tiles":234,"../../Utils":235,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publish":71,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/skipWhile":77,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/takeUntil":81,"rxjs/add/operator/withLatestFrom":83}],257:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../../Component"),o=function(){function t(t,e){this._imagePlaneDepth=null!=t?t:200,this._imageSphereRadius=null!=e?e:200}return t.prototype.createMesh=function(t,e){return t.pano?this._createImageSphere(t,e):this._createImagePlane(t,e)},t.prototype._createImageSphere=function(t,e){var r=this._createTexture(t.image),i=this._createSphereMaterialParameters(e,r),o=new n.ShaderMaterial(i);return this._useMesh(e,t)?new n.Mesh(this._getImageSphereGeo(e,t),o):new n.Mesh(this._getFlatImageSphereGeo(e),o)},t.prototype._createImagePlane=function(t,e){var r=this._createTexture(t.image),i=this._createPlaneMaterialParameters(e,r),o=new n.ShaderMaterial(i),s=this._useMesh(e,t)?this._getImagePlaneGeo(e,t):this._getFlatImagePlaneGeo(e);return new n.Mesh(s,o)},t.prototype._createSphereMaterialParameters=function(t,e){var r=t.gpano,o=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2,s=2*Math.PI*(r.CroppedAreaLeftPixels-o)/r.FullPanoWidthPixels,a=2*Math.PI*r.CroppedAreaImageWidthPixels/r.FullPanoWidthPixels,c=(r.FullPanoHeightPixels-r.CroppedAreaImageHeightPixels)/2,u=Math.PI*(c-r.CroppedAreaTopPixels)/r.FullPanoHeightPixels,h=Math.PI*r.CroppedAreaImageHeightPixels/r.FullPanoHeightPixels;return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.equirectangular.fragment,side:n.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},phiLength:{type:"f",value:a},phiShift:{type:"f",value:s},projectorMat:{type:"m4",value:t.rt},projectorTex:{type:"t",value:e},thetaLength:{type:"f",value:h},thetaShift:{type:"f",value:u}},vertexShader:i.ImagePlaneShaders.equirectangular.vertex}},t.prototype._createPlaneMaterialParameters=function(t,e){return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.perspective.fragment,side:n.DoubleSide,transparent:!0,uniforms:{bbox:{type:"v4",value:new n.Vector4(0,0,1,1)},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:t.projectorMatrix()},projectorTex:{type:"t",value:e}},vertexShader:i.ImagePlaneShaders.perspective.vertex}},t.prototype._createTexture=function(t){var e=new n.Texture(t);return e.minFilter=n.LinearFilter,e.needsUpdate=!0,e},t.prototype._useMesh=function(t,e){return e.mesh.vertices.length&&t.hasValidScale},t.prototype._getImageSphereGeo=function(t,e){for(var r=(new n.Matrix4).getInverse(t.srt),i=5*t.scale,o=this._imageSphereRadius*t.scale,s=e.mesh.vertices,a=s.length/3,c=new Float32Array(s.length),u=0;u<a;++u){var h=3*u,l=s[h+0],p=s[h+1],f=s[h+2],d=Math.sqrt(l*l+p*p+f*f),m=Math.max(i,Math.min(d,o))/d,v=new n.Vector3(l*m,p*m,f*m);v.applyMatrix4(r),c[h+0]=v.x,c[h+1]=v.y,c[h+2]=v.z}for(var g=e.mesh.faces,y=new Uint16Array(g.length),u=0;u<g.length;++u)y[u]=g[u];var b=new n.BufferGeometry;return b.addAttribute("position",new n.BufferAttribute(c,3)),b.setIndex(new n.BufferAttribute(y,1)),b},t.prototype._getImagePlaneGeo=function(t,e){for(var r=(new n.Matrix4).getInverse(t.srt),i=5*t.scale,o=this._imagePlaneDepth*t.scale,s=e.mesh.vertices,a=s.length/3,c=new Float32Array(s.length),u=0;u<a;++u){var h=3*u,l=s[h+0],p=s[h+1],f=s[h+2],d=Math.max(i,Math.min(f,o)),m=d/f,v=new n.Vector3(l*m,p*m,d);v.applyMatrix4(r),c[h+0]=v.x,c[h+1]=v.y,c[h+2]=v.z}for(var g=e.mesh.faces,y=new Uint16Array(g.length),u=0;u<g.length;++u)y[u]=g[u];var b=new n.BufferGeometry;return b.addAttribute("position",new n.BufferAttribute(c,3)),b.setIndex(new n.BufferAttribute(y,1)),b},t.prototype._getFlatImageSphereGeo=function(t){var e=t.gpano,r=2*Math.PI*e.CroppedAreaLeftPixels/e.FullPanoWidthPixels,i=2*Math.PI*e.CroppedAreaImageWidthPixels/e.FullPanoWidthPixels,o=Math.PI*(e.FullPanoHeightPixels-e.CroppedAreaImageHeightPixels-e.CroppedAreaTopPixels)/e.FullPanoHeightPixels,s=Math.PI*e.CroppedAreaImageHeightPixels/e.FullPanoHeightPixels,a=new n.SphereGeometry(this._imageSphereRadius,20,40,r-Math.PI/2,i,o,s);return a.applyMatrix((new n.Matrix4).getInverse(t.rt)),a},t.prototype._getFlatImagePlaneGeo=function(t){var e=t.width,r=t.height,i=Math.max(e,r),o=e/2/i,s=r/2/i,a=[];a.push(t.unprojectSfM([-o,-s],this._imagePlaneDepth)),a.push(t.unprojectSfM([o,-s],this._imagePlaneDepth)),a.push(t.unprojectSfM([o,s],this._imagePlaneDepth)),a.push(t.unprojectSfM([-o,s],this._imagePlaneDepth));for(var c=new Float32Array(12),u=0;u<a.length;u++){var h=3*u;c[h+0]=a[u][0],c[h+1]=a[u][1],c[h+2]=a[u][2]}var l=new Uint16Array(6);l[0]=0,l[1]=1,l[2]=3,l[3]=1,l[4]=2,l[5]=3;var p=new n.BufferGeometry;return p.addAttribute("position",new n.BufferAttribute(c,3)),p.setIndex(new n.BufferAttribute(l,1)),p},t}();r.ImagePlaneFactory=o,r.default=o},{"../../Component":226,three:176}],258:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../Component"),i=t("../../Geo"),o=function(){function t(){this._imagePlaneFactory=new n.ImagePlaneFactory,this._imagePlaneScene=new n.ImagePlaneScene,this._alpha=0,this._alphaOld=0,this._fadeOutSpeed=.05,this._lastCamera=new i.Camera,this._epsilon=1e-6,this._currentKey=null,this._previousKey=null,this._providerDisposers={},this._frameId=0,this._needsRender=!1}return Object.defineProperty(t.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.indicateNeedsRender=function(){this._needsRender=!0},t.prototype.updateFrame=function(t){this._updateFrameId(t.id),this._needsRender=this._updateAlpha(t.state.alpha)||this._needsRender,this._needsRender=this._updateAlphaOld(t.state.alpha)||this._needsRender,this._needsRender=this._updateImagePlanes(t.state)||this._needsRender},t.prototype.setTextureProvider=function(t,e){var r=this;if(t===this._currentKey){var n=e.textureCreated$.subscribe(function(t){r._updateTexture(t)}),i=e.textureUpdated$.subscribe(function(t){r._needsRender=!0});t in this._providerDisposers&&((0,this._providerDisposers[t])(),delete this._providerDisposers[t]),this._providerDisposers[t]=function(){n.unsubscribe(),i.unsubscribe(),e.dispose()}}},t.prototype._updateTexture=function(t){this._needsRender=!0;for(var e=0,r=this._imagePlaneScene.imagePlanes;e<r.length;e++){var n=r[e].material,i=n.uniforms.projectorTex.value;n.uniforms.projectorTex.value=null,i.dispose(),n.uniforms.projectorTex.value=t}},t.prototype.updateTextureImage=function(t,e){if(this._currentKey===e.key){this._needsRender=!0;for(var r=0,n=this._imagePlaneScene.imagePlanes;r<n.length;r++){var i=n[r].material.uniforms.projectorTex.value;i.image=t,i.needsUpdate=!0}}},t.prototype.render=function(t,e){for(var r=this._imagePlaneScene.imagePlanesOld.length?1:this._alpha,n=0,i=this._imagePlaneScene.imagePlanes;n<i.length;n++)(u=i[n]).material.uniforms.opacity.value=r;for(var o=0,s=this._imagePlaneScene.imagePlanesOld;o<s.length;o++)(u=s[o]).material.uniforms.opacity.value=this._alphaOld;e.render(this._imagePlaneScene.scene,t),e.render(this._imagePlaneScene.sceneOld,t);for(var a=0,c=this._imagePlaneScene.imagePlanes;a<c.length;a++){var u=c[a];u.material.uniforms.opacity.value=this._alpha}e.render(this._imagePlaneScene.scene,t)},t.prototype.clearNeedsRender=function(){this._needsRender=!1},t.prototype.dispose=function(){this._imagePlaneScene.clear()},t.prototype._updateFrameId=function(t){this._frameId=t},t.prototype._updateAlpha=function(t){return t!==this._alpha&&(this._alpha=t,!0)},t.prototype._updateAlphaOld=function(t){return!(t<1||0===this._alphaOld)&&(this._alphaOld=Math.max(0,this._alphaOld-this._fadeOutSpeed),!0)},t.prototype._updateImagePlanes=function(t){if(null==t.currentNode||t.currentNode.key===this._currentKey)return!1;var e=null!=t.previousNode?t.previousNode.key:null,r=t.currentNode.key;if(this._previousKey!==e&&this._previousKey!==r&&this._previousKey in this._providerDisposers&&((0,this._providerDisposers[this._previousKey])(),delete this._providerDisposers[this._previousKey]),null!=e){if(e!==this._currentKey&&e!==this._previousKey){var n=this._imagePlaneFactory.createMesh(t.previousNode,t.previousTransform);this._imagePlaneScene.updateImagePlanes([n])}this._previousKey=e}this._currentKey=r;var i=this._imagePlaneFactory.createMesh(t.currentNode,t.currentTransform);return this._imagePlaneScene.updateImagePlanes([i]),this._alphaOld=1,!0},t}();r.ImagePlaneGLRenderer=o,r.default=o},{"../../Component":226,"../../Geo":229}],259:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(){this.scene=new n.Scene,this.sceneOld=new n.Scene,this.imagePlanes=[],this.imagePlanesOld=[]}return t.prototype.updateImagePlanes=function(t){this._dispose(this.imagePlanesOld,this.sceneOld);for(var e=0,r=this.imagePlanes;e<r.length;e++){o=r[e];this.scene.remove(o),this.sceneOld.add(o)}for(var n=0,i=t;n<i.length;n++){var o=i[n];this.scene.add(o)}this.imagePlanesOld=this.imagePlanes,this.imagePlanes=t},t.prototype.addImagePlanes=function(t){for(var e=0,r=t;e<r.length;e++){var n=r[e];this.scene.add(n),this.imagePlanes.push(n)}},t.prototype.addImagePlanesOld=function(t){for(var e=0,r=t;e<r.length;e++){var n=r[e];this.sceneOld.add(n),this.imagePlanesOld.push(n)}},t.prototype.setImagePlanes=function(t){this._clear(),this.addImagePlanes(t)},t.prototype.setImagePlanesOld=function(t){this._clearOld(),this.addImagePlanesOld(t)},t.prototype.clear=function(){this._clear(),this._clearOld()},t.prototype._clear=function(){this._dispose(this.imagePlanes,this.scene),this.imagePlanes.length=0},t.prototype._clearOld=function(){this._dispose(this.imagePlanesOld,this.sceneOld),this.imagePlanesOld.length=0},t.prototype._dispose=function(t,e){for(var r=0,n=t;r<n.length;r++){var i=n[r];e.remove(i),i.geometry.dispose(),i.material.dispose();var o=i.material.uniforms.projectorTex.value;null!=o&&o.dispose()}},t}();r.ImagePlaneScene=i,r.default=i},{three:176}],260:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});t("path");var n=function(){function t(){}return t.equirectangular={fragment:"#ifdef GL_ES\nprecision highp 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}"},t.perspective={fragment:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform vec4 bbox;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float x = vRstq.x / vRstq.w;\n    float y = vRstq.y / vRstq.w;\n\n    vec4 baseColor;\n    if (x > bbox[0] && y > bbox[1] && x < bbox[2] && y < bbox[3]) {\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}"},t}();r.ImagePlaneShaders=n},{path:22}],261:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/fromEvent"),t("rxjs/add/observable/of"),t("rxjs/add/observable/zip"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom"),t("rxjs/add/operator/zip");var s=t("../../State"),a=t("../../Render"),c=t("../../Utils"),u=t("../../Component"),h=function(){function t(){this._imagePlaneFactory=new u.ImagePlaneFactory,this._imagePlaneScene=new u.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._curtain=1}return Object.defineProperty(t.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"curtain",{get:function(){return this._curtain},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"glNeedsRender",{get:function(){return this._glNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domNeedsRender",{get:function(){return this._domNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sliderVisible",{get:function(){return this._sliderVisible},set:function(t){this._sliderVisible=t,this._domNeedsRender=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return null==this._currentKey||null==this._previousKey||this._currentPano},enumerable:!0,configurable:!0}),t.prototype.update=function(t){this._updateFrameId(t.id);var e=this._updateImagePlanes(t.state);this._domNeedsRender=e||this._domNeedsRender,e=this._updateCurtain(t.state.alpha)||e,this._glNeedsRender=e||this._glNeedsRender},t.prototype.updateTexture=function(t,e){var r=e.key===this._currentKey?this._imagePlaneScene.imagePlanes:e.key===this._previousKey?this._imagePlaneScene.imagePlanesOld:[];if(0!==r.length){this._glNeedsRender=!0;for(var n=0,i=r;n<i.length;n++){var o=i[n].material.uniforms.projectorTex.value;o.image=t,o.needsUpdate=!0}}},t.prototype.render=function(t,e){this.disabled||e.render(this._imagePlaneScene.sceneOld,t),e.render(this._imagePlaneScene.scene,t)},t.prototype.dispose=function(){this._imagePlaneScene.clear()},t.prototype.clearGLNeedsRender=function(){this._glNeedsRender=!1},t.prototype.clearDomNeedsRender=function(){this._domNeedsRender=!1},t.prototype._updateFrameId=function(t){this._frameId=t},t.prototype._updateImagePlanes=function(t){if(null!=t.currentNode){var e=!1;return null!=t.previousNode&&this._previousKey!==t.previousNode.key&&(e=!0,this._previousKey=t.previousNode.key,this._imagePlaneScene.setImagePlanesOld([this._imagePlaneFactory.createMesh(t.previousNode,t.previousTransform)])),this._currentKey!==t.currentNode.key&&(e=!0,this._currentKey=t.currentNode.key,this._currentPano=t.currentNode.pano,this._imagePlaneScene.setImagePlanes([this._imagePlaneFactory.createMesh(t.currentNode,t.currentTransform)]),this.disabled||this._updateBbox()),e}},t.prototype._updateCurtain=function(t){return!(this.disabled||Math.abs(this._curtain-t)<.001)&&(this._curtain=t,this._updateBbox(),!0)},t.prototype._updateBbox=function(){for(var t=0,e=this._imagePlaneScene.imagePlanes;t<e.length;t++)e[t].material.uniforms.bbox.value.z=this._curtain},t}(),l=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._sliderStateOperation$=new o.Subject,i._sliderStateCreator$=new o.Subject,i._sliderStateDisposer$=new o.Subject,i._sliderState$=i._sliderStateOperation$.scan(function(t,e){return e(t)},null).filter(function(t){return null!=t}).distinctUntilChanged(void 0,function(t){return t.frameId}),i._sliderStateCreator$.map(function(){return function(t){if(null!=t)throw new Error("Multiple slider states can not be created at the same time");return new h}}).subscribe(i._sliderStateOperation$),i._sliderStateDisposer$.map(function(){return function(t){return t.dispose(),null}}).subscribe(i._sliderStateOperation$),i}return n(e,t),e.prototype.setKeys=function(t){this.configure({keys:t})},e.prototype.setInitialPosition=function(t){this.configure({initialPosition:t})},e.prototype.setSliderVisible=function(t){this.configure({sliderVisible:t})},e.prototype._activate=function(){var t=this;this._sliderContainer=this._createElement("div","mapillary-js-slider-container",this._container.element),this._sliderWrapper=this._createElement("div","SliderWrapper",this._sliderContainer),this._sliderControl=this._createElement("input","SliderControl",this._sliderWrapper),this._sliderControl.setAttribute("type","range"),this._sliderControl.setAttribute("min","0"),this._sliderControl.setAttribute("max","1000"),this._sliderControl.style.visibility="hidden",this._moveToHandler=function(e){var r=Number(e.target.value)/1e3;t._navigator.stateService.moveTo(r)},this._sliderControl.addEventListener("input",this._moveToHandler),this._sliderControl.addEventListener("change",this._moveToHandler),i.Observable.combineLatest(this._navigator.stateService.state$,this._configuration$).first().subscribe(function(e){var r=e[0],n=e[1];if(r===s.State.Traversing){t._navigator.stateService.wait();var i=null!=n.initialPosition?n.initialPosition:1;t._sliderControl.value=(1e3*i).toString(),t._navigator.stateService.moveTo(i)}}),this._glRenderSubscription=this._sliderState$.map(function(e){var r={name:t._name,render:{frameId:e.frameId,needsRender:e.glNeedsRender,render:e.render.bind(e),stage:a.GLRenderStage.Background}};return e.clearGLNeedsRender(),r}).subscribe(this._container.glRenderer.render$),this._domRenderSubscription=this._sliderState$.filter(function(t){return t.domNeedsRender}).subscribe(function(e){t._sliderControl.value=(1e3*e.curtain).toString();var r=e.disabled||!e.sliderVisible?"hidden":"visible";t._sliderControl.style.visibility=r,e.clearDomNeedsRender()}),this._sliderStateCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(t){return function(e){return e.update(t),e}}).subscribe(this._sliderStateOperation$),this._setSliderVisibleSubscription=this._configuration$.map(function(t){return null==t.sliderVisible||t.sliderVisible}).distinctUntilChanged().map(function(t){return function(e){return e.sliderVisible=t,e}}).subscribe(this._sliderStateOperation$),this._setKeysSubscription=this._configuration$.filter(function(t){return null!=t.keys}).switchMap(function(e){return i.Observable.zip(t._catchCacheNode$(e.keys.background),t._catchCacheNode$(e.keys.foreground)).map(function(t){return{background:t[0],foreground:t[1]}}).zip(t._navigator.stateService.currentState$.first()).map(function(t){return{nodes:t[0],state:t[1].state}})}).subscribe(function(e){null!=e.state.currentNode&&null!=e.state.previousNode&&e.state.currentNode.key===e.nodes.foreground.key&&e.state.previousNode.key===e.nodes.background.key||(e.state.currentNode.key!==e.nodes.background.key?e.state.currentNode.key!==e.nodes.foreground.key||1!==e.state.trajectory.length?(t._navigator.stateService.setNodes([e.nodes.background]),t._navigator.stateService.setNodes([e.nodes.foreground])):t._navigator.stateService.prependNodes([e.nodes.background]):t._navigator.stateService.setNodes([e.nodes.foreground]))},function(t){console.error(t)});var e=this._navigator.stateService.currentState$.map(function(t){return t.state.previousNode}).filter(function(t){return null!=t}).distinctUntilChanged(void 0,function(t){return t.key});this._nodeSubscription=i.Observable.merge(e,this._navigator.stateService.currentNode$).filter(function(t){return t.pano?c.Settings.maxImageSize>c.Settings.basePanoramaSize:c.Settings.maxImageSize>c.Settings.baseImageSize}).mergeMap(function(t){var e=t.pano?c.Settings.basePanoramaSize:c.Settings.baseImageSize;return Math.max(t.image.width,t.image.height)>e?i.Observable.empty():t.cacheImage$(c.Settings.maxImageSize).map(function(t){return[t.image,t]}).catch(function(e,r){return console.error("Failed to fetch high res slider image ("+t.key+")",e),i.Observable.empty()})}).map(function(t){var e=t[0],r=t[1];return function(t){return t.updateTexture(e,r),t}}).subscribe(this._sliderStateOperation$)},e.prototype._deactivate=function(){var t=this;this._navigator.stateService.state$.first().subscribe(function(e){e===s.State.Waiting&&t._navigator.stateService.traverse()}),this._sliderStateDisposer$.next(null),this._setKeysSubscription.unsubscribe(),this._setSliderVisibleSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this.configure({keys:null}),this._sliderControl.removeEventListener("input",this._moveToHandler),this._sliderControl.removeEventListener("change",this._moveToHandler),this._container.element.removeChild(this._sliderContainer),this._moveToHandler=null,this._sliderControl=null,this._sliderWrapper=null,this._sliderContainer=null},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._catchCacheNode$=function(t){return this._navigator.graphService.cacheNode$(t).catch(function(e,r){return console.error("Failed to cache slider node ("+t+")",e),i.Observable.empty()})},e.prototype._createElement=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n},e.componentName="slider",e}(u.Component);r.SliderComponent=l,u.ComponentService.register(l),r.default=l},{"../../Component":226,"../../Render":232,"../../State":233,"../../Utils":235,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/fromEvent":42,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83,"rxjs/add/operator/zip":84}],262:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./MarkerComponent");r.MarkerComponent=n.MarkerComponent;var i=t("./marker/SimpleMarker");r.SimpleMarker=i.SimpleMarker;var o=t("./marker/CircleMarker");r.CircleMarker=o.CircleMarker},{"./MarkerComponent":263,"./marker/CircleMarker":266,"./marker/SimpleMarker":268}],263:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=t("when"),s=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/map");var a=t("../../Component"),c=t("../../Render"),u=t("../../Graph"),h=t("../../Geo"),l=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._relativeGroundAltitude=-2,i._geoCoords=new h.GeoCoords,i._graphCalculator=new u.GraphCalculator,i._markerScene=new a.MarkerScene,i._markerSet=new a.MarkerSet,i._viewportCoords=new h.ViewportCoords,i}return n(e,t),e.prototype.add=function(t){this._markerSet.add(t)},e.prototype.get=function(t){return this._markerSet.get(t)},e.prototype.getAll=function(){return this._markerSet.getAll()},e.prototype.getMarkerIdAt=function(t){var e=this;return o.promise(function(r,n){e._container.renderService.renderCamera$.first().map(function(r){var n=e._viewportCoords.canvasToViewport(t[0],t[1],e._container.element);return e._markerScene.intersectObjects(n,r.perspective)}).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.has=function(t){return this._markerSet.has(t)},e.prototype.remove=function(t){this._markerSet.remove(t)},e.prototype.removeAll=function(){this._markerSet.removeAll()},e.prototype._activate=function(){var t=this,r=this._navigator.stateService.currentState$.map(function(e){return e.state.camera.position.z+t._relativeGroundAltitude}).distinctUntilChanged(function(t,e){return Math.abs(t-e)<.01}).publishReplay(1).refCount(),n=s.Observable.combineLatest(r,this._navigator.stateService.reference$).first().map(function(){}).publishReplay(1).refCount(),o=this._configuration$.map(function(t){return{visibleBBoxSize:Math.max(1,Math.min(200,t.visibleBBoxSize))}}),a=this._navigator.stateService.currentNode$.map(function(t){return t.latLon}).publishReplay(1).refCount(),u=s.Observable.combineLatest(o,a).map(function(e){var r=e[0],n=e[1];return t._graphCalculator.boundingBoxCorners(n,r.visibleBBoxSize/2)}).publishReplay(1).refCount(),h=s.Observable.combineLatest(s.Observable.of(this._markerSet).concat(this._markerSet.changed$),u).map(function(t){var e=t[0],r=t[1];return e.search(r)});this._setChangedSubscription=n.switchMap(function(){return h.withLatestFrom(t._navigator.stateService.reference$,r)}).subscribe(function(e){for(var r=e[0],n=e[1],i=e[2],o=t._geoCoords,s=t._markerScene,a=s.markers,c=Object.assign({},a),u=0,h=r;u<h.length;u++){var l=h[u];if(l.id in a)delete c[l.id];else{var p=o.geodeticToEnu(l.latLon.lat,l.latLon.lon,n.alt+i,n.lat,n.lon,n.alt);s.add(l,p)}}for(var f in c)c.hasOwnProperty(f)&&s.remove(f)}),this._markersUpdatedSubscription=n.switchMap(function(){return t._markerSet.updated$.withLatestFrom(u,t._navigator.stateService.reference$,r)}).subscribe(function(e){for(var r=e[0],n=e[1],i=n[0],o=n[1],s=e[2],a=e[3],c=t._geoCoords,u=t._markerScene,h=0,l=r;h<l.length;h++){var p=l[h],f=u.has(p.id),d=p.latLon.lat>i.lat&&p.latLon.lat<o.lat&&p.latLon.lon>i.lon&&p.latLon.lon<o.lon;if(d){var m=c.geodeticToEnu(p.latLon.lat,p.latLon.lon,s.alt+a,s.lat,s.lon,s.alt);u.add(p,m)}else!d&&f&&u.remove(p.id)}}),this._referenceSubscription=this._navigator.stateService.reference$.skip(1).withLatestFrom(r).subscribe(function(e){for(var r=e[0],n=e[1],i=t._geoCoords,o=t._markerScene,s=0,a=o.getAll();s<a.length;s++){var c=a[s],u=i.geodeticToEnu(c.latLon.lat,c.latLon.lon,r.alt+n,r.lat,r.lon,r.alt);o.update(c.id,u)}}),this._adjustHeightSubscription=r.skip(1).withLatestFrom(this._navigator.stateService.reference$,a).subscribe(function(e){for(var r=e[0],n=e[1],i=e[2],o=t._geoCoords,s=t._markerScene,a=o.geodeticToEnu(i.lat,i.lon,n.alt+r,n.lat,n.lon,n.alt),c=0,u=s.getAll();c<u.length;c++){var h=u[c],l=o.geodeticToEnu(h.latLon.lat,h.latLon.lon,n.alt+r,n.lat,n.lon,n.alt),p=l[0]-a[0],f=l[1]-a[1],d=Math.sqrt(p*p+f*f);d>50||s.lerpAltitude(h.id,r,Math.min(1,Math.max(0,1.2-1.2*d/50)))}}),this._renderSubscription=this._navigator.stateService.currentState$.map(function(e){var r=t._markerScene;return{name:t._name,render:{frameId:e.id,needsRender:r.needsRender,render:r.render.bind(r),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$);var l=s.Observable.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).map(function(e){var r=e[0],n=e[1],i=t._container.element,o=t._viewportCoords.canvasPosition(n,i),s=o[0],a=o[1],c=t._viewportCoords.canvasToViewport(s,a,i);return t._markerScene.intersectObjects(c,r.perspective)}).publishReplay(1).refCount(),p=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).map(function(t){return!0}),f=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).map(function(t){return!1}),d=s.Observable.merge(p,f).startWith(!1);this._dragEventSubscription=p.withLatestFrom(l).merge(s.Observable.combineLatest(f,s.Observable.of(null))).startWith([!1,null]).pairwise().subscribe(function(r){var n=r[0],i=r[1],o=i[0],s=o?e.dragstart:e.dragend,a=o?i[1]:n[1],c={marker:t._markerScene.get(a),target:t,type:s};t.fire(s,c)}),this._mouseClaimSubscription=s.Observable.combineLatest(this._container.mouseService.active$,l,d).map(function(t){var e=t[0],r=t[1],n=t[2];return!e&&null!=r||n}).distinctUntilChanged().subscribe(function(e){e?t._container.mouseService.claimMouse(t._name,1):t._container.mouseService.unclaimMouse(t._name)});var m=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).withLatestFrom(l,this._container.renderService.renderCamera$).map(function(e){var r=e[0],n=e[1],i=e[2],o=t._markerScene.get(n),s=t._container.element,a=t._viewportCoords.projectToCanvas(o.geometry.position.toArray(),s,i.perspective),c=a[0],u=a[1],h=t._viewportCoords.canvasPosition(r,s);return[o,[h[0]-c,h[1]-u],i]}).publishReplay(1).refCount();this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).withLatestFrom(m,this._navigator.stateService.reference$,o).subscribe(function(r){var n=r[0],o=r[1],s=o[0],a=o[1],c=o[2],u=r[2],h=r[3];if(t._markerScene.has(s.id)){var l=t._container.element,p=t._viewportCoords.canvasPosition(n,l),f=p[0],d=p[1],m=f-a[0],v=d-a[1],g=t._viewportCoords.canvasToViewport(m,v,l),y=g[0],b=g[1],_=new i.Vector3(y,b,1).unproject(c.perspective).sub(c.perspective.position).normalize(),x=Math.min(t._relativeGroundAltitude/_.z,h.visibleBBoxSize/2-.1);if(!(x<0)){var w=_.clone().multiplyScalar(x).add(c.perspective.position);w.z=c.perspective.position.z+t._relativeGroundAltitude;var S=t._geoCoords.enuToGeodetic(w.x,w.y,w.z,u.lat,u.lon,u.alt),M=S[0],E=S[1];t._markerScene.update(s.id,w.toArray(),{lat:M,lon:E}),t._markerSet.update(s);var T={marker:s,target:t,type:e.changed};t.fire(e.changed,T)}}})},e.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()},e.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}},e.componentName="marker",e.changed="changed",e.dragstart="dragstart",e.dragend="dragend",e}(a.Component);r.MarkerComponent=l,a.ComponentService.register(l),r.default=l},{"../../Component":226,"../../Geo":229,"../../Graph":230,"../../Render":232,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/map":65,three:176,when:223}],264:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t,e){this._needsRender=!1,this._interactiveObjects=[],this._markers={},this._objectMarkers={},this._raycaster=e||new n.Raycaster,this._scene=t||new n.Scene}return Object.defineProperty(t.prototype,"markers",{get:function(){return this._markers},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){t.id in this._markers&&this._dispose(t.id),t.createGeometry(e),this._scene.add(t.geometry),this._markers[t.id]=t;for(var r=0,n=t.getInteractiveObjects();r<n.length;r++){var i=n[r];this._interactiveObjects.push(i),this._objectMarkers[i.uuid]=t.id}this._needsRender=!0},t.prototype.clear=function(){for(var t in this._markers)this._markers.hasOwnProperty&&this._dispose(t);this._needsRender=!0},t.prototype.get=function(t){return this._markers[t]},t.prototype.getAll=function(){var t=this;return Object.keys(this._markers).map(function(e){return t._markers[e]})},t.prototype.has=function(t){return t in this._markers},t.prototype.intersectObjects=function(t,e){var r=t[0],i=t[1];this._raycaster.setFromCamera(new n.Vector2(r,i),e);for(var o=0,s=this._raycaster.intersectObjects(this._interactiveObjects);o<s.length;o++){var a=s[o];if(a.object.uuid in this._objectMarkers)return this._objectMarkers[a.object.uuid]}return null},t.prototype.lerpAltitude=function(t,e,r){t in this._markers&&(this._markers[t].lerpAltitude(e,r),this._needsRender=!0)},t.prototype.remove=function(t){t in this._markers&&(this._dispose(t),this._needsRender=!0)},t.prototype.render=function(t,e){e.render(this._scene,t),this._needsRender=!1},t.prototype.update=function(t,e,r){t in this._markers&&(this._markers[t].updatePosition(e,r),this._needsRender=!0)},t.prototype._dispose=function(t){var e=this._markers[t];this._scene.remove(e.geometry);for(var r=0,n=e.getInteractiveObjects();r<n.length;r++){var i=n[r],o=this._interactiveObjects.indexOf(i);-1!==o?this._interactiveObjects.splice(o,1):console.warn("Object does not exist ("+i.id+") for "+t),delete this._objectMarkers[i.uuid]}e.disposeGeometry(),delete this._markers[t]},t}();r.MarkerScene=i,r.default=i},{three:176}],265:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rbush"),i=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan");var o=function(){function t(){this._hash={},this._index=n(16,[".lon",".lat",".lon",".lat"]),this._indexChanged$=new i.Subject,this._updated$=new i.Subject}return Object.defineProperty(t.prototype,"changed$",{get:function(){return this._indexChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"updated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),t.prototype.add=function(t){for(var e=[],r=this._hash,n=this._index,i=0,o=t;i<o.length;i++){var s=o[i],a=s.id;a in r&&(n.remove(r[a]),e.push(s));var c={lat:s.latLon.lat,lon:s.latLon.lon,marker:s};r[a]=c,n.insert(c)}e.length>0&&this._updated$.next(e),t.length>e.length&&this._indexChanged$.next(this)},t.prototype.has=function(t){return t in this._hash},t.prototype.get=function(t){return this.has(t)?this._hash[t].marker:void 0},t.prototype.getAll=function(){return this._index.all().map(function(t){return t.marker})},t.prototype.remove=function(t){for(var e=this._hash,r=this._index,n=!1,i=0,o=t;i<o.length;i++){var s=o[i];if(s in e){var a=e[s];r.remove(a),delete e[s],n=!0}}n&&this._indexChanged$.next(this)},t.prototype.removeAll=function(){this._hash={},this._index.clear(),this._indexChanged$.next(this)},t.prototype.search=function(t){var e=t[0],r=t[1];return this._index.search({maxX:r.lon,maxY:r.lat,minX:e.lon,minY:e.lat}).map(function(t){return t.marker})},t.prototype.update=function(t){var e=this._hash,r=this._index,n=t.id;if(n in e){r.remove(e[n]);var i={lat:t.latLon.lat,lon:t.latLon.lon,marker:t};e[n]=i,r.insert(i)}},t}();r.MarkerSet=o,r.default=o},{rbush:25,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73}],266:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=function(t){function e(e,r,n){var i=t.call(this,e,r)||this;return n=n||{},i._color=null!=n.color?n.color:16777215,i._opacity=null!=n.opacity?n.opacity:.4,i._radius=null!=n.radius?n.radius:1,i}return n(e,t),e.prototype._createGeometry=function(t){var e=new i.Mesh(new i.CircleGeometry(this._radius,16),new i.MeshBasicMaterial({color:this._color,opacity:this._opacity,transparent:!0}));e.up.fromArray([0,0,1]),e.renderOrder=-1;var r=new i.Object3D;r.add(e),r.position.fromArray(t),this._geometry=r},e.prototype._disposeGeometry=function(){for(var t=0,e=this._geometry.children;t<e.length;t++){var r=e[t];r.geometry.dispose(),r.material.dispose()}},e.prototype._getInteractiveObjects=function(){return[]},e}(t("../../../Component").Marker);r.CircleMarker=o,r.default=o},{"../../../Component":226,three:176}],267:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t,e){this._id=t,this._latLon=e}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"latLon",{get:function(){return this._latLon},enumerable:!0,configurable:!0}),t.prototype.createGeometry=function(t){this._geometry||(this._createGeometry(t),this._geometry.updateMatrixWorld(!0))},t.prototype.disposeGeometry=function(){this._geometry&&(this._disposeGeometry(),this._geometry=void 0)},t.prototype.getInteractiveObjects=function(){return this._geometry?this._getInteractiveObjects():[]},t.prototype.lerpAltitude=function(t,e){this._geometry&&(this._geometry.position.z=(1-e)*this._geometry.position.z+e*t)},t.prototype.updatePosition=function(t,e){e&&(this._latLon.lat=e.lat,this._latLon.lon=e.lon),this._geometry&&(this._geometry.position.fromArray(t),this._geometry.updateMatrixWorld(!0))},t}();r.Marker=n,r.default=n},{}],268:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=function(t){function e(e,r,n){var i=t.call(this,e,r)||this;return n=n||{},i._ballColor=null!=n.ballColor?n.ballColor:16711680,i._ballOpacity=null!=n.ballOpacity?n.ballOpacity:.8,i._circleToRayAngle=2,i._color=null!=n.color?n.color:16711680,i._interactive=!!n.interactive,i._opacity=null!=n.opacity?n.opacity:.4,i._radius=null!=n.radius?n.radius:1,i}return n(e,t),e.prototype._createGeometry=function(t){var e=this._radius,r=new i.Mesh(this._markerGeometry(e,8,8),new i.MeshBasicMaterial({color:this._color,opacity:this._opacity,shading:i.SmoothShading,transparent:!0}));r.renderOrder=1;var n=new i.Mesh(new i.SphereGeometry(e/2,8,8),new i.MeshBasicMaterial({color:this._ballColor,opacity:this._ballOpacity,shading:i.SmoothShading,transparent:!0}));n.position.z=this._markerHeight(e);var o=new i.Object3D;o.add(n),o.add(r),o.position.fromArray(t),this._geometry=o},e.prototype._disposeGeometry=function(){for(var t=0,e=this._geometry.children;t<e.length;t++){var r=e[t];r.geometry.dispose(),r.material.dispose()}},e.prototype._getInteractiveObjects=function(){return this._interactive?[this._geometry.children[0]]:[]},e.prototype._markerHeight=function(t){var e=Math.tan(Math.PI-this._circleToRayAngle);return t*Math.sqrt(1+e*e)},e.prototype._markerGeometry=function(t,e,r){var n=new i.Geometry;e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6);for(var o=this._markerHeight(t),s=[],a=0;a<=r;++a){for(var c=[],u=0;u<=e;++u){var h=u/e*Math.PI*2,l=a/r*Math.PI,p=void 0;if(l<this._circleToRayAngle)p=t;else{var f=Math.tan(l-this._circleToRayAngle);p=t*Math.sqrt(1+f*f)}var d=new i.Vector3;d.x=p*Math.cos(h)*Math.sin(l),d.y=p*Math.sin(h)*Math.sin(l),d.z=p*Math.cos(l)+o,n.vertices.push(d),c.push(n.vertices.length-1)}s.push(c)}for(a=0;a<r;++a)for(u=0;u<e;++u){var m=s[a][u+1],v=s[a][u],g=s[a+1][u],y=s[a+1][u+1],b=n.vertices[m].clone().normalize(),_=n.vertices[v].clone().normalize(),x=n.vertices[g].clone().normalize(),w=n.vertices[y].clone().normalize();n.faces.push(new i.Face3(m,v,y,[b,_,w])),n.faces.push(new i.Face3(v,g,y,[_.clone(),x,w.clone()]))}return n.computeFaceNormals(),n.boundingSphere=new i.Sphere(new i.Vector3,t+o),n},e}(t("../../../Component").Marker);r.SimpleMarker=o,r.default=o},{"../../../Component":226,three:176}],269:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=function(t){function e(e,r,n,i,o){var s=t.call(this,e,r,n,i)||this;return s._spatial=o,s._basicDistanceThreshold=.001,s._basicRotationThreshold=.05,s._bounceCoeff=.1,s}return n(e,t),e.prototype._enable=function(){var t=this,e=this._navigator.stateService.currentState$.map(function(t){return t.state.alpha<1});this._bounceSubscription=i.Observable.combineLatest(e,this._navigator.stateService.inTranslation$,this._container.mouseService.active$,this._container.touchService.active$).map(function(t){return t[0]||t[1]||t[2]||t[3]}).distinctUntilChanged().switchMap(function(e){return e?i.Observable.empty():i.Observable.combineLatest(t._container.renderService.renderCamera$,t._navigator.stateService.currentTransform$.first())}).subscribe(function(e){var r=e[0],n=r.perspective,i=e[1];if((i.hasValidScale||!(r.camera.focal<.1))&&0!==r.perspective.aspect&&r.perspective.aspect!==Number.POSITIVE_INFINITY){var o=t._basicDistanceThreshold/Math.pow(2,r.zoom),s=t._viewportCoords.viewportToBasic(0,0,i,n);if(!(Math.abs(s[0]-.5)<o&&Math.abs(s[1]-.5)<o)){var a=t._viewportCoords.getBasicDistances(i,n),c=0,u=0;if(!(a[0]<o&&a[1]<o&&a[2]<o&&a[3]<o||Math.abs(a[0]-a[2])<o&&Math.abs(a[1]-a[3])<o)){var h=t._bounceCoeff;a[1]>0&&0===a[3]?c=-h*a[1]:0===a[1]&&a[3]>0?c=h*a[3]:a[1]>0&&a[3]>0&&(c=h*(a[3]-a[1])/2),a[0]>0&&0===a[2]?u=h*a[0]:0===a[0]&&a[2]>0?u=-h*a[2]:a[0]>0&&a[2]>0&&(u=h*(a[0]-a[2])/2);var l=t._basicRotationThreshold;c=t._spatial.clamp(c,-l,l),u=t._spatial.clamp(u,-l,l),t._navigator.stateService.rotateBasicUnbounded([c,u])}}}})},e.prototype._disable=function(){this._bounceSubscription.unsubscribe()},e.prototype._getConfiguration=function(t){return{}},e}(t("../../Component").MouseHandlerBase);r.BounceHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],270:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._enable=function(){var t=this;this._zoomSubscription=i.Observable.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.map(function(t){var e=t.touches[0];return{clientX:e.clientX,clientY:e.clientY,shiftKey:t.shiftKey}})).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,s=t._viewportCoords.canvasPosition(r,o),a=s[0],c=s[1],u=t._viewportCoords.unprojectFromCanvas(a,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.shiftKey?-1:1;t._navigator.stateService.zoomIn(l,h)})},e.prototype._disable=function(){this._zoomSubscription.unsubscribe()},e.prototype._getConfiguration=function(t){return{doubleClickZoom:t}},e}(t("../../Component").MouseHandlerBase);r.DoubleClickZoomHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],271:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=t("rxjs/Observable"),s=function(t){function e(e,r,n,i,o){var s=t.call(this,e,r,n,i)||this;return s._spatial=o,s._basicRotationThreshold=.05,s._forceCoeff=.2,s}return n(e,t),e.prototype._enable=function(){var t=this,e=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).map(function(t){return!0}),r=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).map(function(t){return!1});this._activeMouseSubscription=o.Observable.merge(e,r).subscribe(this._container.mouseService.activate$),this._preventDefaultSubscription=o.Observable.merge(e,r).switchMap(function(e){return e?t._container.mouseService.documentMouseMove$:o.Observable.empty()}).merge(this._container.touchService.touchMove$).subscribe(function(t){t.preventDefault()});var n=this._container.touchService.singleTouchDragStart$.map(function(t){return!0}),s=this._container.touchService.singleTouchDragEnd$.map(function(t){return!1});this._activeTouchSubscription=o.Observable.merge(n,s).subscribe(this._container.touchService.activate$),this._rotateBasicSubscription=this._navigator.stateService.currentState$.map(function(t){return t.state.currentNode.fullPano||t.state.nodesAhead<1}).distinctUntilChanged().switchMap(function(e){if(!e)return o.Observable.empty();var r=o.Observable.merge(t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDragStart$),t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDrag$),t._container.mouseService.filtered$(t._component.name,t._container.mouseService.mouseDragEnd$).map(function(t){return null})).pairwise().filter(function(t){return null!=t[0]&&null!=t[1]}),n=o.Observable.merge(t._container.touchService.singleTouchDragStart$,t._container.touchService.singleTouchDrag$,t._container.touchService.singleTouchDragEnd$.map(function(t){return null})).map(function(t){return null!=t&&t.touches.length>0?t.touches[0]:null}).pairwise().filter(function(t){return null!=t[0]&&null!=t[1]});return o.Observable.merge(r,n)}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,this._navigator.stateService.currentCamera$).map(function(e){var r=e[0],n=e[1],o=e[2],s=e[3].clone(),a=r[0],c=r[1],u=c.clientX-a.clientX,h=c.clientY-a.clientY,l=t._container.element,p=t._viewportCoords.canvasPosition(c,l),f=p[0],d=p[1],m=t._viewportCoords.unprojectFromCanvas(f,d,l,n.perspective).sub(n.perspective.position),v=t._viewportCoords.unprojectFromCanvas(f-u,d,l,n.perspective).sub(n.perspective.position),g=t._viewportCoords.unprojectFromCanvas(f,d-h,l,n.perspective).sub(n.perspective.position),y=(u>0?1:-1)*v.angleTo(m),b=(h>0?-1:1)*g.angleTo(m),_=(new i.Quaternion).setFromUnitVectors(s.up,new i.Vector3(0,0,1)),x=_.clone().inverse(),w=new i.Vector3;w.copy(s.lookat).sub(s.position),w.applyQuaternion(_);var S=w.length(),M=Math.atan2(w.y,w.x);M+=y;var E=Math.atan2(Math.sqrt(w.x*w.x+w.y*w.y),w.z);E+=b,E=Math.max(.01,Math.min(Math.PI-.01,E)),w.x=Math.sin(E)*Math.cos(M),w.y=Math.sin(E)*Math.sin(M),w.z=Math.cos(E),w.applyQuaternion(x);var T=(new i.Vector3).copy(s.position).add(w.multiplyScalar(S)),C=o.projectBasic(T.toArray()),O=o.projectBasic(s.lookat.toArray()),P=C[0]-O[0],A=C[1]-O[1];Math.abs(P)>1?P=0:P>.5?P-=1:P<-.5&&(P+=1);var j=t._basicRotationThreshold;if(P=t._spatial.clamp(P,-j,j),A=t._spatial.clamp(A,-j,j),o.fullPano)return[P,A];var R=t._viewportCoords.getPixelDistances(t._container.element,o,n.perspective),L=t._forceCoeff;return R[0]>0&&A<0&&C[1]<.5&&(A/=Math.max(1,L*R[0])),R[1]>0&&P>0&&C[0]>.5&&(P/=Math.max(1,L*R[1])),R[2]>0&&A>0&&C[1]>.5&&(A/=Math.max(1,L*R[2])),R[3]>0&&P<0&&C[0]<.5&&(P/=Math.max(1,L*R[3])),[P,A]}).subscribe(function(e){t._navigator.stateService.rotateBasic(e)})},e.prototype._disable=function(){this._activeMouseSubscription.unsubscribe(),this._activeTouchSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._rotateBasicSubscription.unsubscribe(),this._activeMouseSubscription=null,this._activeTouchSubscription=null,this._preventDefaultSubscription=null,this._rotateBasicSubscription=null},e.prototype._getConfiguration=function(t){return{dragPan:t}},e}(t("../../Component").MouseHandlerBase);r.DragPanHandler=s,r.default=s},{"../../Component":226,"rxjs/Observable":29,three:176}],272:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),t("rxjs/add/observable/merge"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/withLatestFrom");var i=t("../../Component"),o=t("../../Geo"),s=function(t){function e(e,r,n){var s=t.call(this,e,r,n)||this,a=new o.Spatial,c=new o.ViewportCoords;return s._spatial=a,s._viewportCoords=c,s._bounceHandler=new i.BounceHandler(s,r,n,c,a),s._doubleClickZoomHandler=new i.DoubleClickZoomHandler(s,r,n,c),s._dragPanHandler=new i.DragPanHandler(s,r,n,c,a),s._scrollZoomHandler=new i.ScrollZoomHandler(s,r,n,c),s._touchZoomHandler=new i.TouchZoomHandler(s,r,n,c),s}return n(e,t),Object.defineProperty(e.prototype,"doubleClickZoom",{get:function(){return this._doubleClickZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dragPan",{get:function(){return this._dragPanHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollZoom",{get:function(){return this._scrollZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchZoom",{get:function(){return this._touchZoomHandler},enumerable:!0,configurable:!0}),e.prototype._activate=function(){var t=this;this._bounceHandler.enable(),this._configurationSubscription=this._configuration$.subscribe(function(e){e.doubleClickZoom?t._doubleClickZoomHandler.enable():t._doubleClickZoomHandler.disable(),e.dragPan?t._dragPanHandler.enable():t._dragPanHandler.disable(),e.scrollZoom?t._scrollZoomHandler.enable():t._scrollZoomHandler.disable(),e.touchZoom?t._touchZoomHandler.enable():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._scrollZoomHandler.disable(),this._touchZoomHandler.disable()},e.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:!0,dragPan:!0,scrollZoom:!0,touchZoom:!0}},e.componentName="mouse",e}(i.Component);r.MouseComponent=s,i.ComponentService.register(s),r.default=s},{"../../Component":226,"../../Geo":229,"rxjs/add/observable/merge":44,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/withLatestFrom":83}],273:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t,e,r,n){this._component=t,this._container=e,this._navigator=r,this._viewportCoords=n,this._enabled=!1}return Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),t.prototype.enable=function(){!this._enabled&&this._component.activated&&(this._enable(),this._enabled=!0,this._component.configure(this._getConfiguration(!0)))},t.prototype.disable=function(){this._enabled&&(this._disable(),this._enabled=!1,this._component.activated&&this._component.configure(this._getConfiguration(!1)))},t}();r.MouseHandlerBase=n,r.default=n},{}],274:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._enable=function(){var t=this;this._preventDefaultSubscription=this._container.mouseService.mouseWheel$.subscribe(function(t){t.preventDefault()}),this._zoomSubscription=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseWheel$).withLatestFrom(this._navigator.stateService.currentState$,function(t,e){return[t,e]}).filter(function(t){var e=t[1].state;return e.currentNode.fullPano||e.nodesAhead<1}).map(function(t){return t[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(t,e,r){return[t,e,r]}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,s=t._viewportCoords.canvasPosition(r,o),a=s[0],c=s[1],u=t._viewportCoords.unprojectFromCanvas(a,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.deltaY;1===r.deltaMode?l*=40:2===r.deltaMode&&(l*=800);var p=-3*l/t._viewportCoords.containerToCanvas(o)[1];t._navigator.stateService.zoomIn(p,h)})},e.prototype._disable=function(){this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(t){return{scrollZoom:t}},e}(t("../../Component").MouseHandlerBase);r.ScrollZoomHandler=i,r.default=i},{"../../Component":226}],275:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._enable=function(){var t=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(t){t.originalEvent.preventDefault()});var e=this._container.touchService.pinchStart$.map(function(t){return!0}),r=this._container.touchService.pinchEnd$.map(function(t){return!1});this._activeSubscription=i.Observable.merge(e,r).subscribe(this._container.touchService.activate$),this._zoomSubscription=this._container.touchService.pinch$.withLatestFrom(this._navigator.stateService.currentState$).filter(function(t){var e=t[1].state;return e.currentNode.fullPano||e.nodesAhead<1}).map(function(t){return t[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=t._container.element,s=t._viewportCoords.canvasPosition(r,o),a=s[0],c=s[1],u=t._viewportCoords.unprojectFromCanvas(a,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=t._viewportCoords.containerToCanvas(o),p=l[0],f=l[1],d=3*r.distanceChange/Math.min(p,f);t._navigator.stateService.zoomIn(d,h)})},e.prototype._disable=function(){this._activeSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(t){return{touchZoom:t}},e}(t("../../Component").MouseHandlerBase);r.TouchZoomHandler=o,r.default=o},{"../../Component":226,"rxjs/Observable":29}],276:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./popup/Popup");r.Popup=n.Popup;var i=t("./PopupComponent");r.PopupComponent=i.PopupComponent},{"./PopupComponent":277,"./popup/Popup":278}],277:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject"),s=t("../../Component"),a=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._popups=[],i._added$=new o.Subject,i._popups$=new o.Subject,i}return n(e,t),e.prototype.add=function(t){for(var e=0,r=t;e<r.length;e++){var n=r[e];-1===this._popups.indexOf(n)&&(this._popups.push(n),this._activated&&n.setParentContainer(this._popupContainer))}this._added$.next(t),this._popups$.next(this._popups)},e.prototype.getAll=function(){return this._popups.slice()},e.prototype.remove=function(t){for(var e=0,r=t;e<r.length;e++){var n=r[e];this._remove(n)}this._popups$.next(this._popups)},e.prototype.removeAll=function(){for(var t=0,e=this._popups.slice();t<e.length;t++){var r=e[t];this._remove(r)}this._popups$.next(this._popups)},e.prototype._activate=function(){var t=this;this._popupContainer=document.createElement("div"),this._popupContainer.className="mapillary-js-popup-container",this._container.element.appendChild(this._popupContainer);for(var e=0,r=this._popups;e<r.length;e++)r[e].setParentContainer(this._popupContainer);this._updateAllSubscription=i.Observable.combineLatest(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$).subscribe(function(e){for(var r=e[0],n=e[1],i=e[2],o=0,s=t._popups;o<s.length;o++)s[o].update(r,n,i)});var n=this._popups$.startWith(this._popups).switchMap(function(t){return i.Observable.from(t).mergeMap(function(t){return t.changed$})}).map(function(t){return[t]});this._updateAddedChangedSubscription=this._added$.merge(n).withLatestFrom(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$).subscribe(function(t){for(var e=t[0],r=t[1],n=t[2],i=t[3],o=0,s=e;o<s.length;o++)s[o].update(r,n,i)})},e.prototype._deactivate=function(){this._updateAllSubscription.unsubscribe(),this._updateAddedChangedSubscription.unsubscribe();for(var t=0,e=this._popups;t<e.length;t++)e[t].remove();this._container.element.removeChild(this._popupContainer),delete this._popupContainer},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._remove=function(t){var e=this._popups.indexOf(t);if(-1!==e){var r=this._popups.splice(e,1)[0];this._activated&&r.remove()}},e.componentName="popup",e}(s.Component);r.PopupComponent=a,s.ComponentService.register(a),r.default=a},{"../../Component":226,"rxjs/Observable":29,"rxjs/Subject":34}],278:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("../../../Geo"),o=t("../../../Viewer"),s=function(){function t(t,e){this._options={},t&&(this._options.clean=t.clean,this._options.float=t.float,this._options.offset=t.offset,this._options.opacity=t.opacity,this._options.position=t.position),this._viewportCoords=e||new i.ViewportCoords,this._notifyChanged$=new n.Subject}return Object.defineProperty(t.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),t.prototype.remove=function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._parentContainer&&delete this._parentContainer},t.prototype.setBasicPoint=function(t){this._point=t.slice(),this._rect=null,this._notifyChanged$.next(this)},t.prototype.setBasicRect=function(t){this._rect=t.slice(),this._point=null,this._notifyChanged$.next(this)},t.prototype.setDOMContent=function(t){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content);var e="mapillaryjs-popup-content"+(!0===this._options.clean?"-clean":"");this._content=this._createElement("div",e,this._container),this._content.appendChild(t),this._notifyChanged$.next(this)},t.prototype.setHTML=function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(!(e=n.firstChild))break;r.appendChild(e)}this.setDOMContent(r)},t.prototype.setText=function(t){this.setDOMContent(document.createTextNode(t))},t.prototype.setParentContainer=function(t){this._parentContainer=t},t.prototype.update=function(t,e,r){if(this._parentContainer&&this._content&&(this._point||this._rect)){this._container||(this._container=this._createElement("div","mapillaryjs-popup",this._parentContainer),!0!==this._options.clean&&this._options.float!==o.Alignment.Center&&(this._tip=this._createElement("div","mapillaryjs-popup-tip",this._container),this._createElement("div","mapillaryjs-popup-tip-inner",this._tip)),this._container.appendChild(this._content),this._parentContainer.appendChild(this._container),null!=this._options.opacity&&(this._container.style.opacity=this._options.opacity.toString()));var n=null,i=this._alignmentToPopupAligment(this._options.position),s=this._alignmentToPopupAligment(this._options.float);if(null!=this._point?n=this._viewportCoords.basicToCanvasSafe(this._point[0],this._point[1],{offsetHeight:e.height,offsetWidth:e.width},r,t.perspective):(n=(v=this._rectToPixel(this._rect,i,t,e,r))[0],i=v[1],s||(s=i)),null!=n){if(this._container.style.visibility="visible",!s){var a=this._container.offsetWidth,c=this._container.offsetHeight,u=this._pixelToFloats(n,e,a,c);s=0===u.length?"bottom":u.join("-")}if(this._options.offset){var h=this._options.offset,l=(h>=0?1:-1)*Math.round(Math.sqrt(.5*Math.pow(h,2))),p={bottom:[0,h],"bottom-left":[-l,l],"bottom-right":[l,l],center:[0,0],left:[-h,0],right:[h,0],top:[0,-h],"top-left":[-l,-l],"top-right":[l,-l]};n=[n[0]+p[s][0],n[1]+p[s][1]]}n=[Math.round(n[0]),Math.round(n[1])];var f={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%)"},d=this._container.classList;for(var m in f)f.hasOwnProperty(m)&&d.remove("mapillaryjs-popup-float-"+m);d.add("mapillaryjs-popup-float-"+s),this._container.style.transform=f[s]+" translate("+n[0]+"px,"+n[1]+"px)";var v}else this._container.style.visibility="hidden"}},t.prototype._createElement=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n},t.prototype._rectToPixel=function(t,e,r,n,i){if(!e){for(var o=this._container.offsetWidth,s=this._container.offsetHeight,a={bottom:[0,s/2],"bottom-left":[-o/2,s/2],"bottom-right":[o/2,s/2],left:[-o/2,0],right:[o/2,0],top:[0,-s/2],"top-left":[-o/2,-s/2],"top-right":[o/2,-s/2]},c=[0,null,null],u=0,h=["bottom","top","left","right"];u<h.length;u++){var l=h[u],p=this._pointFromRectPosition(t,l),f=this._viewportCoords.basicToCanvasSafe(p[0],p[1],{offsetHeight:n.height,offsetWidth:n.width},i,r.perspective);if(null!=f){var d=a[l],m=[f[0]+d[0],f[1]+d[1]];if(0===this._pixelToFloats(m,n,o,s/2).length&&f[0]>0&&f[0]<n.width&&f[1]>0&&f[1]<n.height)return[f,l];var v=Math.max(m[0]-o/2,0),g=Math.min(m[0]+o/2,n.width),y=Math.max(m[1]-s/2,0),b=Math.min(m[1]+s/2,n.height),_=Math.max(0,g-v)*Math.max(0,b-y);_>c[0]&&(c[0]=_,c[1]=f,c[2]=l)}}if(c[0]>0)return[c[1],c[2]]}var x=this._pointFromRectPosition(t,e);return[this._viewportCoords.basicToCanvasSafe(x[0],x[1],{offsetHeight:n.height,offsetWidth:n.width},i,r.perspective),null!=e?e:"bottom"]},t.prototype._alignmentToPopupAligment=function(t){switch(t){case o.Alignment.Bottom:return"bottom";case o.Alignment.BottomLeft:return"bottom-left";case o.Alignment.BottomRight:return"bottom-right";case o.Alignment.Center:return"center";case o.Alignment.Left:return"left";case o.Alignment.Right:return"right";case o.Alignment.Top:return"top";case o.Alignment.TopLeft:return"top-left";case o.Alignment.TopRight:return"top-right";default:return null}},t.prototype._pixelToFloats=function(t,e,r,n){var i=[];return t[1]<n?i.push("bottom"):t[1]>e.height-n&&i.push("top"),t[0]<r/2?i.push("right"):t[0]>e.width-r/2&&i.push("left"),i},t.prototype._pointFromRectPosition=function(t,e){switch(e){case"bottom":return[(t[0]+t[2])/2,t[3]];case"bottom-left":return[t[0],t[3]];case"bottom-right":return[t[2],t[3]];case"center":return[(t[0]+t[2])/2,(t[1]+t[3])/2];case"left":return[t[0],(t[1]+t[3])/2];case"right":return[t[2],(t[1]+t[3])/2];case"top":return[(t[0]+t[2])/2,t[1]];case"top-left":return[t[0],t[1]];case"top-right":return[t[2],t[1]];default:return[(t[0]+t[2])/2,t[3]]}},t}();r.Popup=s,r.default=s},{"../../../Geo":229,"../../../Viewer":236,"rxjs/Subject":34}],279:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/of"),t("rxjs/add/operator/bufferCount"),t("rxjs/add/operator/concat"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/takeUntil"),t("rxjs/add/operator/withLatestFrom");var s=t("../../Component"),a=t("../../Edge"),c=function(t){function e(e,r,n){var i=t.call(this,e,r,n)||this;return i._nodesAhead=5,i._configurationOperation$=new o.Subject,i._sequenceDOMRenderer=new s.SequenceDOMRenderer(r.element),i._sequenceDOMInteraction=new s.SequenceDOMInteraction,i._containerWidth$=new o.Subject,i._hoveredKeySubject$=new o.Subject,i._hoveredKey$=i._hoveredKeySubject$.share(),i._edgeStatus$=i._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}).publishReplay(1).refCount(),i}return n(e,t),Object.defineProperty(e.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),e.prototype.play=function(){this.configure({playing:!0})},e.prototype.stop=function(){this.configure({playing:!1})},e.prototype.setDirection=function(t){this.configure({direction:t})},e.prototype.setHighlightKey=function(t){this.configure({highlightKey:t})},e.prototype.setMaxWidth=function(t){this.configure({maxWidth:t})},e.prototype.setMinWidth=function(t){this.configure({minWidth:t})},e.prototype.setVisible=function(t){this.configure({visible:t})},e.prototype.resize=function(){var t=this;this._configuration$.first().map(function(e){return t._sequenceDOMRenderer.getContainerWidth(t._container.element,e)}).subscribe(function(e){t._containerWidth$.next(e)})},e.prototype._activate=function(){var t=this;this._renderSubscription=i.Observable.combineLatest(this._edgeStatus$,this._configuration$,this._containerWidth$).map(function(e){var r=e[0],n=e[1],i=e[2],o=t._sequenceDOMRenderer.render(r,n,i,t,t._sequenceDOMInteraction,t._navigator);return{name:t._name,vnode:o}}).subscribe(this._container.domRenderer.render$),this._containerWidthSubscription=this._configuration$.distinctUntilChanged(function(t,e){return t[0]===e[0]&&t[1]===e[1]},function(t){return[t.minWidth,t.maxWidth]}).map(function(e){return t._sequenceDOMRenderer.getContainerWidth(t._container.element,e)}).subscribe(this._containerWidth$),this._configurationSubscription=this._configurationOperation$.scan(function(t,e){return e(t)},{playing:!1}).finally(function(){null!=t._playingSubscription&&(t._navigator.stateService.cutNodes(),t._stop())}).subscribe(function(){}),this._configuration$.map(function(e){return function(r){return e.playing!==r.playing&&(t._navigator.stateService.cutNodes(),e.playing?t._play():t._stop()),r.playing=e.playing,r}}).subscribe(this._configurationOperation$),this._stopSubscription=this._configuration$.switchMap(function(e){var r=e.playing?t._edgeStatus$:i.Observable.empty(),n=i.Observable.of(e.direction);return i.Observable.combineLatest(r,n)}).map(function(t){var e=t[0],r=t[1];if(!e.cached)return!0;for(var n=0,i=e.edges;n<i.length;n++)if(i[n].data.direction===r)return!0;return!1}).filter(function(t){return!t}).map(function(t){return{playing:!1}}).subscribe(this._configurationSubject$),this._hoveredKeySubscription=this._sequenceDOMInteraction.mouseEnterDirection$.switchMap(function(e){return t._edgeStatus$.map(function(t){for(var r=0,n=t.edges;r<n.length;r++){var i=n[r];if(i.data.direction===e)return i.to}return null}).takeUntil(t._sequenceDOMInteraction.mouseLeaveDirection$).concat(i.Observable.of(null))}).distinctUntilChanged().subscribe(this._hoveredKeySubject$)},e.prototype._deactivate=function(){this._stopSubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._configurationSubscription.unsubscribe(),this._containerWidthSubscription.unsubscribe(),this._hoveredKeySubscription.unsubscribe(),this.stop()},e.prototype._getDefaultConfiguration=function(){return{direction:a.EdgeDirection.Next,maxWidth:117,minWidth:70,playing:!1,visible:!0}},e.prototype._play=function(){var t=this;this._playingSubscription=this._navigator.stateService.currentState$.filter(function(e){return e.state.nodesAhead<t._nodesAhead}).map(function(t){return t.state.lastNode}).distinctUntilChanged(void 0,function(t){return t.key}).withLatestFrom(this._configuration$,function(t,e){return[t,e.direction]}).switchMap(function(t){return([a.EdgeDirection.Next,a.EdgeDirection.Prev].indexOf(t[1])>-1?t[0].sequenceEdges$:t[0].spatialEdges$).filter(function(t){return t.cached}).zip(i.Observable.of(t[1]),function(t,e){return[t,e]})}).map(function(t){for(var e=t[1],r=0,n=t[0].edges;r<n.length;r++){var i=n[r];if(i.data.direction===e)return i.to}return null}).filter(function(t){return null!=t}).switchMap(function(e){return t._navigator.graphService.cacheNode$(e)}).subscribe(function(e){t._navigator.stateService.appendNodes([e])},function(e){console.error(e),t.stop()}),this._clearSubscription=this._navigator.stateService.currentNode$.bufferCount(1,7).subscribe(function(e){t._navigator.stateService.clearPriorNodes()}),this.fire(e.playingchanged,!0)},e.prototype._stop=function(){this._playingSubscription.unsubscribe(),this._playingSubscription=null,this._clearSubscription.unsubscribe(),this._clearSubscription=null,this.fire(e.playingchanged,!1)},e.componentName="sequence",e.playingchanged="playingchanged",e}(s.Component);r.SequenceComponent=c,s.ComponentService.register(c),r.default=c},{"../../Component":226,"../../Edge":227,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/of":45,"rxjs/add/operator/bufferCount":50,"rxjs/add/operator/concat":54,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/finally":62,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/takeUntil":81,"rxjs/add/operator/withLatestFrom":83}],280:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=function(){function t(){this._mouseEnterDirection$=new n.Subject,this._mouseLeaveDirection$=new n.Subject}return Object.defineProperty(t.prototype,"mouseEnterDirection$",{get:function(){return this._mouseEnterDirection$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseLeaveDirection$",{get:function(){return this._mouseLeaveDirection$},enumerable:!0,configurable:!0}),t}();r.SequenceDOMInteraction=i,r.default=i},{"rxjs/Subject":34}],281:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("virtual-dom"),i=t("../../Edge"),o=function(){function t(t){this._minThresholdWidth=320,this._maxThresholdWidth=1480,this._minThresholdHeight=240,this._maxThresholdHeight=820}return t.prototype.render=function(t,e,r,o,s,a){if(!1===e.visible)return n.h("div.SequenceContainer",{},[]);for(var c=null,u=null,h=0,l=t.edges;h<l.length;h++){var p=l[h];p.data.direction===i.EdgeDirection.Next&&(c=p.to),p.data.direction===i.EdgeDirection.Prev&&(u=p.to)}var f=this._createPlayingButton(c,u,e,o),d=this._createSequenceArrows(c,u,e,s,a),m={oncontextmenu:function(t){t.preventDefault()},style:{height:.27*r+"px",width:r+"px"}};return n.h("div.SequenceContainer",m,d.concat([f]))},t.prototype.getContainerWidth=function(t,e){var r=t.offsetWidth,n=t.offsetHeight,i=e.minWidth,o=e.maxWidth;o<i&&(o=i);var s=(r-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth),a=(n-this._minThresholdHeight)/(this._maxThresholdHeight-this._minThresholdHeight);return i+Math.max(0,Math.min(1,Math.min(s,a)))*(o-i)},t.prototype._createPlayingButton=function(t,e,r,o){var s=r.direction===i.EdgeDirection.Next&&null!=t||r.direction===i.EdgeDirection.Prev&&null!=e,a={onclick:r.playing?function(t){o.stop()}:s?function(t){o.play()}:null,style:{}},c=r.playing?"Stop":s?"Play":"PlayDisabled",u=n.h("div.SequenceComponentIcon",{className:c},[]),h=s?"SequencePlay":"SequencePlayDisabled";return n.h("div."+h,a,[u])},t.prototype._createSequenceArrows=function(t,e,r,o,s){var a={onclick:null!=t?function(t){s.moveDir$(i.EdgeDirection.Next).subscribe(function(t){},function(t){console.error(t)})}:null,onmouseenter:function(t){o.mouseEnterDirection$.next(i.EdgeDirection.Next)},onmouseleave:function(t){o.mouseLeaveDirection$.next(i.EdgeDirection.Next)},style:{}},c={onclick:null!=e?function(t){s.moveDir$(i.EdgeDirection.Prev).subscribe(function(t){},function(t){console.error(t)})}:null,onmouseenter:function(t){o.mouseEnterDirection$.next(i.EdgeDirection.Prev)},onmouseleave:function(t){o.mouseLeaveDirection$.next(i.EdgeDirection.Prev)},style:{}},u=this._getStepClassName(i.EdgeDirection.Next,t,r.highlightKey),h=this._getStepClassName(i.EdgeDirection.Prev,e,r.highlightKey),l=n.h("div.SequenceComponentIcon",[]),p=n.h("div.SequenceComponentIcon",[]);return[n.h("div."+u,a,[l]),n.h("div."+h,c,[p])]},t.prototype._getStepClassName=function(t,e,r){var n=t===i.EdgeDirection.Next?"SequenceStepNext":"SequenceStepPrev";return null==e?n+="Disabled":r===e&&(n+="Highlight"),n},t}();r.SequenceDOMRenderer=o,r.default=o},{"../../Edge":227,"virtual-dom":182}],282:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./error/GeometryTagError");r.GeometryTagError=n.GeometryTagError;var i=t("./geometry/PointGeometry");r.PointGeometry=i.PointGeometry;var o=t("./geometry/RectGeometry");r.RectGeometry=o.RectGeometry;var s=t("./geometry/PolygonGeometry");r.PolygonGeometry=s.PolygonGeometry;var a=t("./tag/OutlineTag");r.OutlineTag=a.OutlineTag;var c=t("./tag/SpotTag");r.SpotTag=c.SpotTag;var u=t("./TagComponent");r.TagComponent=u.TagComponent;var h=t("./TagMode");r.TagMode=h.TagMode},{"./TagComponent":283,"./TagMode":286,"./error/GeometryTagError":290,"./geometry/PointGeometry":292,"./geometry/PolygonGeometry":293,"./geometry/RectGeometry":294,"./tag/OutlineTag":298,"./tag/SpotTag":301}],283:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("when"),o=t("rxjs/Observable"),s=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/empty"),t("rxjs/add/observable/from"),t("rxjs/add/observable/merge"),t("rxjs/add/observable/of"),t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/concat"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/do"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/skip"),t("rxjs/add/operator/skipUntil"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/take"),t("rxjs/add/operator/takeUntil"),t("rxjs/add/operator/withLatestFrom");var a=t("../../Component"),c=t("../../Geo"),u=t("../../Render"),h=function(t){function e(r,n,i){var u=t.call(this,r,n,i)||this;return u._tagDomRenderer=new a.TagDOMRenderer,u._tagScene=new a.TagScene,u._tagSet=new a.TagSet,u._tagCreator=new a.TagCreator(u,i),u._viewportCoords=new c.ViewportCoords,u._renderTags$=u._tagSet.changed$.map(function(t){var e=t.getAll();return e.sort(function(t,e){var r=t.tag.id,n=e.tag.id;return r<n?-1:r>n?1:0}),e}).share(),u._tagChanged$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return o.Observable.merge(t.tag.changed$,t.tag.geometryChanged$)})}).share(),u._renderTagGLChanged$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.glObjectsChanged$})}).share(),u._tagInterationInitiated$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$.map(function(t){return t.tag.id})})}).share(),u._tagInteractionAbort$=o.Observable.merge(u._container.mouseService.documentMouseUp$).map(function(t){}).share(),u._activeTag$=u._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$})}).merge(u._tagInteractionAbort$.map(function(){return{offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:null}})).share(),u._createGeometryChanged$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.geometryChanged$:o.Observable.empty()}).share(),u._createGLObjectsChanged$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.glObjectsChanged$:o.Observable.empty()}).share(),u._tagCreated$=u._tagCreator.tag$.switchMap(function(t){return null!=t?t.created$:o.Observable.empty()}).share(),u._vertexGeometryCreated$=u._tagCreated$.map(function(t){return t.geometry}).share(),u._pointGeometryCreated$=new s.Subject,u._geometryCreated$=o.Observable.merge(u._vertexGeometryCreated$,u._pointGeometryCreated$).share(),u._basicClick$=u._container.mouseService.staticClick$.withLatestFrom(u._container.renderService.renderCamera$,u._navigator.stateService.currentTransform$,function(t,e,r){return[t,e,r]}).map(function(t){var e=t[0],r=t[1],n=t[2];return u._mouseEventToBasic(e,u._container.element,r,n)}).share(),u._validBasicClick$=u._basicClick$.filter(function(t){var e=t[0],r=t[1];return 0<=e&&e<=1&&0<=r&&r<=1}).share(),u._creatingConfiguration$=u._configuration$.distinctUntilChanged(function(t,e){return t.mode===e.mode},function(t){return{createColor:t.createColor,mode:t.mode}}).publishReplay(1).refCount(),u._creating$=u._creatingConfiguration$.map(function(t){return t.mode!==a.TagMode.Default}).publishReplay(1).refCount(),u._creatingConfiguration$.subscribe(function(t){u.fire(e.modechanged,t.mode)}),u}return n(e,t),e.prototype.add=function(t){var e=this;this._activated?this._navigator.stateService.currentTransform$.first().subscribe(function(r){e._tagSet.add(t,r);var n=t.map(function(t){return e._tagSet.get(t.id)});e._tagScene.add(n)}):this._tagSet.addDeactivated(t)},e.prototype.changeMode=function(t){this.configure({mode:t})},e.prototype.get=function(t){if(this._activated){var e=this._tagSet.get(t);return void 0!==e?e.tag:void 0}return this._tagSet.getDeactivated(t)},e.prototype.getAll=function(){return this.activated?this._tagSet.getAll().map(function(t){return t.tag}):this._tagSet.getAllDeactivated()},e.prototype.getTagIdsAt=function(t){var e=this;return i.promise(function(r,n){e._container.renderService.renderCamera$.first().map(function(r){var n=e._viewportCoords.canvasToViewport(t[0],t[1],e._container.element);return e._tagScene.intersectObjects(n,r.perspective)}).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.has=function(t){return this._activated?this._tagSet.has(t):this._tagSet.hasDeactivated(t)},e.prototype.remove=function(t){this._activated?(this._tagSet.remove(t),this._tagScene.remove(t)):this._tagSet.removeDeactivated(t)},e.prototype.removeAll=function(){this._activated?(this._tagSet.removeAll(),this._tagScene.removeAll()):this._tagSet.removeAllDeactivated()},e.prototype._activate=function(){var t=this;this._preventDefaultSubscription=this._activeTag$.switchMap(function(e){return null!=e.tag?t._container.mouseService.documentMouseMove$:o.Observable.empty()}).subscribe(function(t){t.preventDefault()}),this._geometryCreatedEventSubscription=this._geometryCreated$.subscribe(function(r){t.fire(e.geometrycreated,r)}),this._tagsChangedEventSubscription=this._renderTags$.subscribe(function(r){t.fire(e.tagschanged,t)});var r=this.configuration$.switchMap(function(e){return e.mode!==a.TagMode.Default?t._navigator.stateService.currentTransform$.map(function(t){return null}):o.Observable.empty()}).publishReplay(1).refCount();this._deleteCreatingSubscription=r.skip(1).subscribe(function(){t._tagCreator.delete$.next(null)});var n=this._tagCreator.tag$.switchMap(function(t){return null!=t?t.aborted$.map(function(t){return null}):o.Observable.empty()}),i=this._tagCreated$.map(function(t){return null}),s=this._pointGeometryCreated$.map(function(t){return null});this._stopCreateSubscription=o.Observable.merge(n,i,s).subscribe(function(){t.changeMode(a.TagMode.Default)});var c=o.Observable.combineLatest(this._creatingConfiguration$,r).map(function(t){return t[0]}).publishReplay(1).refCount();this._createSubscription=c.switchMap(function(e){return e.mode===a.TagMode.CreateRect||e.mode===a.TagMode.CreatePolygon?t._validBasicClick$.take(1):o.Observable.empty()}).subscribe(this._tagCreator.create$),this._createPointSubscription=c.switchMap(function(e){return e.mode===a.TagMode.CreatePoint?t._validBasicClick$.take(1):o.Observable.empty()}).map(function(t){return new a.PointGeometry(t)}).subscribe(this._pointGeometryCreated$);var h=o.Observable.merge(this._container.mouseService.mouseMove$,this._container.mouseService.domMouseMove$).share();this._setCreateVertexSubscription=o.Observable.combineLatest(h,this._tagCreator.tag$,this._container.renderService.renderCamera$).filter(function(t){return null!=t[1]}).withLatestFrom(this._navigator.stateService.currentTransform$,function(t,e){return[t[0],t[1],t[2],e]}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=e[3],s=t._mouseEventToBasic(r,t._container.element,i,o);n.geometry instanceof a.RectGeometry?n.geometry.setVertex2d(3,s,o):n.geometry instanceof a.PolygonGeometry&&n.geometry.setVertex2d(n.geometry.polygon.length-2,s,o)}),this._addPointSubscription=c.switchMap(function(e){return e.mode===a.TagMode.CreateRect||e.mode===a.TagMode.CreatePolygon?t._basicClick$.skipUntil(t._validBasicClick$).skip(1):o.Observable.empty()}).withLatestFrom(this._tagCreator.tag$,function(t,e){return[t,e]}).subscribe(function(t){var e=t[0];t[1].addPoint(e)}),this._containerClassListSubscription=this._creating$.subscribe(function(e){e?t._container.element.classList.add("component-tag-create"):t._container.element.classList.remove("component-tag-create")}),this._deleteCreatedSubscription=this._creating$.subscribe(function(e){t._tagCreator.delete$.next(null)}),this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(e){t._tagScene.hasCreateTag()&&t._tagScene.removeCreateTag(),null!=e&&t._tagScene.addCreateTag(e)}),this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(e){t._tagScene.updateCreateTagObjects(e)}),this._claimMouseSubscription=this._tagInterationInitiated$.switchMap(function(e){return h.takeUntil(t._tagInteractionAbort$).take(1)}).subscribe(function(e){t._container.mouseService.claimMouse(t._name,1)}),this._mouseDragSubscription=this._activeTag$.withLatestFrom(h,function(t,e){return[t,e]}).switchMap(function(e){var r=e[0],n=e[1];if(r.operation===a.TagOperation.None)return o.Observable.empty();var i=o.Observable.of(n).concat(t._container.mouseService.filtered$(t._name,t._container.mouseService.domMouseDrag$).filter(function(e){return t._viewportCoords.insideElement(e,t._container.element)}));return o.Observable.combineLatest(i,t._container.renderService.renderCamera$).withLatestFrom(o.Observable.of(r),t._navigator.stateService.currentTransform$,function(t,e,r){return[t[0],t[1],e,r]})}).subscribe(function(e){var r=e[0],n=e[1],i=e[2],o=e[3];if(i.operation!==a.TagOperation.None){var s=t._mouseEventToBasic(r,t._container.element,n,o,i.offsetX,i.offsetY);i.operation===a.TagOperation.Centroid?i.tag.geometry.setCentroid2d(s,o):i.operation===a.TagOperation.Vertex&&i.tag.geometry.setVertex2d(i.vertexIndex,s,o)}}),this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseDragEnd$).subscribe(function(e){t._container.mouseService.unclaimMouse(t._name)}),this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(e){t._tagScene.updateObjects(e)}),this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(e){t._tagScene.update()}),this._domSubscription=this._renderTags$.startWith([]).do(function(e){t._container.domRenderer.render$.next({name:t._name,vnode:t._tagDomRenderer.clear()})}).combineLatest(this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.startWith(null),this._tagCreator.tag$.merge(this._createGeometryChanged$).startWith(null),function(t,e,r,n,i,o){return[e,r,n,t,i,o]}).map(function(e){return{name:t._name,vnode:t._tagDomRenderer.render(e[3],e[5],e[1],e[0].perspective,e[2])}}).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.map(function(e){var r=t._tagScene;return{name:t._name,render:{frameId:e.id,needsRender:r.needsRender,render:r.render.bind(r),stage:u.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$),this._navigator.stateService.currentTransform$.first().subscribe(function(e){t._tagSet.activate(e),t._tagScene.add(t._tagSet.getAll())})},e.prototype._deactivate=function(){this._tagScene.clear(),this._tagSet.deactivate(),this._tagCreator.delete$.next(null),this._claimMouseSubscription.unsubscribe(),this._mouseDragSubscription.unsubscribe(),this._unclaimMouseSubscription.unsubscribe(),this._updateGLObjectsSubscription.unsubscribe(),this._updateTagSceneSubscription.unsubscribe(),this._stopCreateSubscription.unsubscribe(),this._deleteCreatingSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._createPointSubscription.unsubscribe(),this._setCreateVertexSubscription.unsubscribe(),this._addPointSubscription.unsubscribe(),this._deleteCreatedSubscription.unsubscribe(),this._setGLCreateTagSubscription.unsubscribe(),this._createGLObjectsChangedSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._containerClassListSubscription.unsubscribe(),this._domSubscription.unsubscribe(),this._glSubscription.unsubscribe(),this._geometryCreatedEventSubscription.unsubscribe(),this._tagsChangedEventSubscription.unsubscribe(),this._container.element.classList.remove("component-tag-create")},e.prototype._getDefaultConfiguration=function(){return{createColor:16777215,mode:a.TagMode.Default}},e.prototype._mouseEventToBasic=function(t,e,r,n,i,o){i=null!=i?i:0,o=null!=o?o:0;var s=this._viewportCoords.canvasPosition(t,e),a=s[0],c=s[1];return this._viewportCoords.canvasToBasic(a-i,c-o,e,n,r.perspective)},e.componentName="tag",e.modechanged="modechanged",e.geometrycreated="geometrycreated",e.tagschanged="tagschanged",e}(a.Component);r.TagComponent=h,a.ComponentService.register(h),r.default=h},{"../../Component":226,"../../Geo":229,"../../Render":232,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/empty":40,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/concat":54,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/skip":75,"rxjs/add/operator/skipUntil":76,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/take":80,"rxjs/add/operator/takeUntil":81,"rxjs/add/operator/withLatestFrom":83,when:223}],284:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/withLatestFrom");var i=t("../../Component"),o=function(){function t(t,e){this._component=t,this._navigator=e,this._tagOperation$=new n.Subject,this._create$=new n.Subject,this._delete$=new n.Subject,this._tag$=this._tagOperation$.scan(function(t,e){return e(t)},null).share(),this._create$.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$).map(function(t){var e=t[0],r=t[1],n=t[2];return function(t){if(r.mode===i.TagMode.CreateRect){o=new i.RectGeometry([e[0],e[1],e[0],e[1]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}if(r.mode===i.TagMode.CreatePolygon){var o=new i.PolygonGeometry([[e[0],e[1]],[e[0],e[1]],[e[0],e[1]]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}return null}}).subscribe(this._tagOperation$),this._delete$.map(function(){return function(t){return null}}).subscribe(this._tagOperation$)}return Object.defineProperty(t.prototype,"create$",{get:function(){return this._create$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"delete$",{get:function(){return this._delete$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tag$",{get:function(){return this._tag$},enumerable:!0,configurable:!0}),t}();r.TagCreator=o,r.default=o},{"../../Component":226,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/withLatestFrom":83}],285:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("virtual-dom"),i=function(){function t(){}return t.prototype.render=function(t,e,r,i,o){for(var s=[],a=0,c=t;a<c.length;a++){var u=c[a];s=s.concat(u.getDOMObjects(r,i,o))}return null!=e&&(s=s.concat(e.getDOMObjects(i,o))),n.h("div.TagContainer",{},s)},t.prototype.clear=function(){return n.h("div",{},[])},t}();r.TagDOMRenderer=i},{"virtual-dom":182}],286:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Default=0]="Default",t[t.CreatePoint=1]="CreatePoint",t[t.CreatePolygon=2]="CreatePolygon",t[t.CreateRect=3]="CreateRect"}(n=r.TagMode||(r.TagMode={})),r.default=n},{}],287:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.None=0]="None",t[t.Centroid=1]="Centroid",t[t.Vertex=2]="Vertex"}(n=r.TagOperation||(r.TagOperation={})),r.default=n},{}],288:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t,e){this._createTag=null,this._needsRender=!1,this._raycaster=e||new n.Raycaster,this._scene=t||new n.Scene,this._objectTags={},this._retrievableObjects=[],this._tags={}}return Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.add=function(t){for(var e=0,r=t;e<r.length;e++){var n=r[e];n.tag.id in this._tags&&this._remove(n.tag.id),this._add(n)}this._needsRender=!0},t.prototype.addCreateTag=function(t){for(var e=0,r=t.glObjects;e<r.length;e++){var n=r[e];this._scene.add(n)}this._createTag={tag:t,objects:t.glObjects},this._needsRender=!0},t.prototype.clear=function(){for(var t=0,e=Object.keys(this._tags);t<e.length;t++){var r=e[t];this._remove(r)}this._needsRender=!1},t.prototype.get=function(t){return this.has(t)?this._tags[t].tag:void 0},t.prototype.has=function(t){return t in this._tags},t.prototype.hasCreateTag=function(){return null!=this._createTag},t.prototype.intersectObjects=function(t,e){var r=t[0],i=t[1];this._raycaster.setFromCamera(new n.Vector2(r,i),e);for(var o=[],s=0,a=this._raycaster.intersectObjects(this._retrievableObjects);s<a.length;s++){var c=a[s];c.object.uuid in this._objectTags&&o.push(this._objectTags[c.object.uuid])}return o},t.prototype.remove=function(t){for(var e=0,r=t;e<r.length;e++){var n=r[e];this._remove(n)}this._needsRender=!0},t.prototype.removeAll=function(){for(var t=0,e=Object.keys(this._tags);t<e.length;t++){var r=e[t];this._remove(r)}this._needsRender=!0},t.prototype.removeCreateTag=function(){if(null!=this._createTag){for(var t=0,e=this._createTag.objects;t<e.length;t++){var r=e[t];this._scene.remove(r)}this._createTag.tag.dispose(),this._createTag=null,this._needsRender=!0}},t.prototype.render=function(t,e){e.render(this._scene,t),this._needsRender=!1},t.prototype.update=function(){this._needsRender=!0},t.prototype.updateCreateTagObjects=function(t){if(this._createTag.tag!==t)throw new Error("Create tags do not have the same reference.");for(var e=0,r=this._createTag.objects;e<r.length;e++){o=r[e];this._scene.remove(o)}for(var n=0,i=t.glObjects;n<i.length;n++){var o=i[n];this._scene.add(o)}this._createTag.objects=t.glObjects,this._needsRender=!0},t.prototype.updateObjects=function(t){var e=t.tag.id;if(this._tags[e].tag!==t)throw new Error("Tags do not have the same reference.");var r=this._tags[e];this._removeObjects(r),delete this._tags[e],this._add(t),this._needsRender=!0},t.prototype._add=function(t){var e=t.tag.id,r={tag:t,objects:[],retrievableObjects:[]};this._tags[e]=r;for(var n=0,i=t.getGLObjects();n<i.length;n++){var o=i[n];r.objects.push(o),this._scene.add(o)}for(var s=0,a=t.getRetrievableObjects();s<a.length;s++){var c=a[s];r.retrievableObjects.push(c),this._retrievableObjects.push(c),this._objectTags[c.uuid]=t.tag.id}},t.prototype._remove=function(t){var e=this._tags[t];this._removeObjects(e),e.tag.dispose(),delete this._tags[t]},t.prototype._removeObjects=function(t){for(var e=0,r=t.objects;e<r.length;e++){var n=r[e];this._scene.remove(n)}for(var i=0,o=t.retrievableObjects;i<o.length;i++){var s=o[i],a=this._retrievableObjects.indexOf(s);-1!==a&&this._retrievableObjects.splice(a,1)}},t}();r.TagScene=i,r.default=i},{three:176}],289:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share");var i=t("../../Component"),o=function(){function t(){this._active=!1,this._hash={},this._hashDeactivated={},this._notifyChanged$=new n.Subject}return Object.defineProperty(t.prototype,"active",{get:function(){return this._active},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),t.prototype.activate=function(t){if(!this._active){for(var e in this._hashDeactivated)if(this._hashDeactivated.hasOwnProperty(e)){var r=this._hashDeactivated[e];this._add(r,t)}this._hashDeactivated={},this._active=!0,this._notifyChanged$.next(this)}},t.prototype.deactivate=function(){if(this._active){for(var t in this._hash)this._hash.hasOwnProperty(t)&&(this._hashDeactivated[t]=this._hash[t].tag);this._hash={},this._active=!1}},t.prototype.add=function(t,e){this._assertActivationState(!0);for(var r=0,n=t;r<n.length;r++){var i=n[r];this._add(i,e)}this._notifyChanged$.next(this)},t.prototype.addDeactivated=function(t){this._assertActivationState(!1);for(var e=0,r=t;e<r.length;e++){var n=r[e];if(!(n instanceof i.OutlineTag||n instanceof i.SpotTag))throw new Error("Tag type not supported");this._hashDeactivated[n.id]=n}},t.prototype.get=function(t){return this.has(t)?this._hash[t]:void 0},t.prototype.getAll=function(){var t=this._hash;return Object.keys(t).map(function(e){return t[e]})},t.prototype.getAllDeactivated=function(){var t=this._hashDeactivated;return Object.keys(t).map(function(e){return t[e]})},t.prototype.getDeactivated=function(t){return this.hasDeactivated(t)?this._hashDeactivated[t]:void 0},t.prototype.has=function(t){return t in this._hash},t.prototype.hasDeactivated=function(t){return t in this._hashDeactivated},t.prototype.remove=function(t){this._assertActivationState(!0);for(var e=this._hash,r=0,n=t;r<n.length;r++){var i=n[r];i in e&&delete e[i]}this._notifyChanged$.next(this)},t.prototype.removeAll=function(){this._assertActivationState(!0),this._hash={},this._notifyChanged$.next(this)},t.prototype.removeAllDeactivated=function(){this._assertActivationState(!1),this._hashDeactivated={}},t.prototype.removeDeactivated=function(t){this._assertActivationState(!1);for(var e=this._hashDeactivated,r=0,n=t;r<n.length;r++){var i=n[r];i in e&&delete e[i]}},t.prototype._add=function(t,e){if(t instanceof i.OutlineTag)this._hash[t.id]=new i.OutlineRenderTag(t,e);else{if(!(t instanceof i.SpotTag))throw new Error("Tag type not supported");this._hash[t.id]=new i.SpotRenderTag(t,e)}},t.prototype._assertActivationState=function(t){if(t!==this._active)throw new Error("Tag set not in correct state for operation.")},t}();r.TagSet=o,r.default=o},{"../../Component":226,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74}],290:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../../Error"),o=function(t){function e(e){var r=t.call(this,null!=e?e:"The provided geometry value is incorrect")||this;return r.name="GeometryTagError",r}return n(e,t),e}(i.MapillaryError);r.GeometryTagError=o,r.default=i.MapillaryError},{"../../../Error":228}],291:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=function(){function t(){this._notifyChanged$=new n.Subject}return Object.defineProperty(t.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),t}();r.Geometry=i,r.default=i},{"rxjs/Subject":34}],292:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../../Component"),o=function(t){function e(e){var r=t.call(this)||this,n=e[0],o=e[1];if(n<0||n>1||o<0||o>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].");return r._point=e.slice(),r}return n(e,t),Object.defineProperty(e.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),e.prototype.getCentroid2d=function(){return this._point.slice()},e.prototype.getCentroid3d=function(t){return t.unprojectBasic(this._point,200)},e.prototype.setCentroid2d=function(t,e){var r=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];this._point[0]=r[0],this._point[1]=r[1],this._notifyChanged$.next(this)},e}(i.Geometry);r.PointGeometry=o},{"../../../Component":226}],293:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../../Component"),o=function(t){function e(e,r){var n=t.call(this)||this,o=e.length;if(o<3)throw new i.GeometryTagError("A polygon must have three or more positions.");if(e[0][0]!==e[o-1][0]||e[0][1]!==e[o-1][1])throw new i.GeometryTagError("First and last positions must be equivalent.");n._polygon=[];for(var s=0,a=e;s<a.length;s++){if((f=a[s])[0]<0||f[0]>1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");n._polygon.push(f.slice())}if(n._holes=[],null==r)return n;for(var c=0;c<r.length;c++){var u=r[c],h=u.length;if(h<3)throw new i.GeometryTagError("A polygon hole must have three or more positions.");if(u[0][0]!==u[h-1][0]||u[0][1]!==u[h-1][1])throw new i.GeometryTagError("First and last positions of hole must be equivalent.");n._holes.push([]);for(var l=0,p=u;l<p.length;l++){var f=p[l];if(f[0]<0||f[0]>1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");n._holes[c].push(f.slice())}}return n}return n(e,t),Object.defineProperty(e.prototype,"polygon",{get:function(){return this._polygon},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"holes",{get:function(){return this._holes},enumerable:!0,configurable:!0}),e.prototype.addVertex2d=function(t){var e=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];this._polygon.splice(this._polygon.length-1,0,e),this._notifyChanged$.next(this)},e.prototype.getVertex2d=function(t){return this._polygon[t].slice()},e.prototype.removeVertex2d=function(t){if(t<0||t>=this._polygon.length||this._polygon.length<4)throw new i.GeometryTagError("Index for removed vertex must be valid.");if(t>0&&t<this._polygon.length-1)this._polygon.splice(t,1);else{this._polygon.splice(0,1),this._polygon.pop();var e=this._polygon[0].slice();this._polygon.push(e)}this._notifyChanged$.next(this)},e.prototype.setVertex2d=function(t,e,r){var n=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];0===t||t===this._polygon.length-1?(this._polygon[0]=n.slice(),this._polygon[this._polygon.length-1]=n.slice()):this._polygon[t]=n.slice(),this._notifyChanged$.next(this)},e.prototype.setCentroid2d=function(t,e){for(var r=this._polygon.map(function(t){return t[0]}),n=this._polygon.map(function(t){return t[1]}),i=Math.min.apply(Math,r),o=Math.max.apply(Math,r),s=Math.min.apply(Math,n),a=Math.max.apply(Math,n),c=this.getCentroid2d(),u=-i,h=1-o,l=-s,p=1-a,f=Math.max(u,Math.min(h,t[0]-c[0])),d=Math.max(l,Math.min(p,t[1]-c[1])),m=0,v=this._polygon;m<v.length;m++){var g=v[m];g[0]+=f,g[1]+=d}this._notifyChanged$.next(this)},e.prototype.getPoints3d=function(t){return this.getVertices3d(t)},e.prototype.getVertex3d=function(t,e){return e.unprojectBasic(this._polygon[t],200)},e.prototype.getVertices2d=function(){return this._polygon.slice()},e.prototype.getVertices3d=function(t){return this._polygon.map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getHoleVertices3d=function(t){for(var e=[],r=0,n=this._holes;r<n.length;r++){var i=n[r].map(function(e){return t.unprojectBasic(e,200)});e.push(i)}return e},e.prototype.getCentroid2d=function(){for(var t=this._polygon,e=0,r=0,n=0,i=0;i<t.length-1;i++){var o=t[i][0],s=t[i][1],a=t[i+1][0],c=t[i+1][1],u=o*c-a*s;e+=u,r+=(o+a)*u,n+=(s+c)*u}return e/=2,r/=6*e,n/=6*e,[r,n]},e.prototype.getCentroid3d=function(t){var e=this.getCentroid2d();return t.unprojectBasic(e,200)},e.prototype.getTriangles3d=function(t){return this._triangulate(this._polygon,this.getPoints3d(t),this._holes,this.getHoleVertices3d(t))},e.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._polygon.slice())},e.prototype.getPoleOfAccessibility3d=function(t){var e=this._getPoleOfInaccessibility2d(this._polygon.slice());return t.unprojectBasic(e,200)},e}(i.VertexGeometry);r.PolygonGeometry=o,r.default=o},{"../../../Component":226}],294:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../../Component"),o=function(t){function e(e){var r=t.call(this)||this;if(e[1]>e[3])throw new i.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var n=0,o=e;n<o.length;n++){var s=o[n];if(s<0||s>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}return r._rect=e.slice(0,4),r._rect[0]>r._rect[2]&&(r._inverted=!0),r}return n(e,t),Object.defineProperty(e.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),e.prototype.setVertex2d=function(t,e,r){var n=this._rect.slice(),i=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))],o=[];if(0===t?(o[0]=i[0],o[1]=n[1],o[2]=n[2],o[3]=i[1]):1===t?(o[0]=i[0],o[1]=i[1],o[2]=n[2],o[3]=n[3]):2===t?(o[0]=n[0],o[1]=i[1],o[2]=i[0],o[3]=n[3]):3===t&&(o[0]=n[0],o[1]=n[1],o[2]=i[0],o[3]=i[1]),r.gpano){var s=t<2&&i[0]>.75&&n[0]<.25||t>=2&&this._inverted&&i[0]>.75&&n[2]<.25,a=t<2&&this._inverted&&i[0]<.25&&n[0]>.75||t>=2&&i[0]<.25&&n[2]>.75;s||a?this._inverted=!this._inverted:(o[0]-n[0]<-.25&&(o[0]=n[0]),o[2]-n[2]>.25&&(o[2]=n[2])),(!this._inverted&&o[0]>o[2]||this._inverted&&o[0]<o[2])&&(o[0]=n[0],o[2]=n[2])}else o[0]>o[2]&&(o[0]=n[0],o[2]=n[2]);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(t,e){var r=this._rect.slice(),n=r[0],i=this._inverted?r[2]+1:r[2],o=r[1],s=r[3],a=n+(i-n)/2,c=o+(s-o)/2,u=0;if(null!=e.gpano&&e.gpano.CroppedAreaImageWidthPixels===e.gpano.FullPanoWidthPixels)u=this._inverted?t[0]+1-a:t[0]-a;else{var h=-n,l=1-i;u=Math.max(h,Math.min(l,t[0]-a))}var p=-o,f=1-s,d=Math.max(p,Math.min(f,t[1]-c));this._rect[0]=r[0]+u,this._rect[1]=r[1]+d,this._rect[2]=r[2]+u,this._rect[3]=r[3]+d,this._rect[0]<0?(this._rect[0]+=1,this._inverted=!this._inverted):this._rect[0]>1&&(this._rect[0]-=1,this._inverted=!this._inverted),this._rect[2]<0?(this._rect[2]+=1,this._inverted=!this._inverted):this._rect[2]>1&&(this._rect[2]-=1,this._inverted=!this._inverted),this._notifyChanged$.next(this)},e.prototype.getPoints3d=function(t){return this._getPoints2d(t).map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getVertex2d=function(t){return this._rectToVertices2d(this._rect)[t]},e.prototype.getVertex3d=function(t,e){return e.unprojectBasic(this._rectToVertices2d(this._rect)[t],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 t=this._rect,e=t[0],r=this._inverted?t[2]+1:t[2],n=t[1];return[e+(r-e)/2,n+(t[3]-n)/2]},e.prototype.getCentroid3d=function(t){var e=this.getCentroid2d();return t.unprojectBasic(e,200)},e.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))},e.prototype.getPoleOfAccessibility3d=function(t){var e=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return t.unprojectBasic(e,200)},e.prototype.getTriangles3d=function(t){return this._triangulate(this._rectToVertices2d(this._rect),this.getVertices3d(t))},e.prototype.validate=function(t){var e=this._rect;return!(!this._inverted&&t[0]<e[0]||t[0]-e[2]>.25||t[1]<e[1])},e.prototype._getPoints2d=function(t){for(var e=this._rectToVertices2d(this._rect),r=e.length-1,n=[],i=0;i<r;++i)for(var o=e[i][0],s=e[i][1],a=(e[i+1][0]-o)/9,c=(e[i+1][1]-s)/9,u=0;u<10;++u){var h=[o+u*a,s+u*c];n.push(h)}return n},e.prototype._rectToVertices2d=function(t){return[[t[0],t[3]],[t[0],t[1]],[this._inverted?t[2]+1:t[2],t[1]],[this._inverted?t[2]+1:t[2],t[3]],[t[0],t[3]]]},e}(i.VertexGeometry);r.RectGeometry=o,r.default=o},{"../../../Component":226}],295:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("earcut"),o=t("@mapbox/polylabel"),s=function(t){function e(){return t.call(this)||this}return n(e,t),e.prototype._getPoleOfInaccessibility2d=function(t){return o([t],.03)},e.prototype._triangulate=function(t,e,r,n){for(var o=[t.slice(0,-1)],s=0,a=null!=r?r:[];s<a.length;s++){var c=a[s];o.push(c.slice(0,-1))}for(var u=e.slice(0,-1),h=0,l=null!=n?n:[];h<l.length;h++){var p=l[h];u=u.concat(p.slice(0,-1))}for(var f=i.flatten(o),d=i(f.vertices,f.holes,f.dimensions),m=[],v=0;v<d.length;++v){var g=u[d[v]];m.push(g[0]),m.push(g[1]),m.push(g[2])}return m},e}(t("../../../Component").Geometry);r.VertexGeometry=s,r.default=s},{"../../../Component":226,"@mapbox/polylabel":1,earcut:8}],296:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("virtual-dom"),o=t("rxjs/Subject"),s=t("../../../Component"),a=t("../../../Geo"),c=function(){function t(t,e,r,n){var i=this;this._geometry=t,this._options={color:null==e.color?16777215:e.color},this._transform=r,this._viewportCoords=n||new a.ViewportCoords,this._outline=this._createOutine(),this._glObjects=[this._outline],this._aborted$=new o.Subject,this._created$=new o.Subject,this._glObjectsChanged$=new o.Subject,this._geometryChangedSubscription=this._geometry.changed$.subscribe(function(t){i._disposeOutline(),i._outline=i._createOutine(),i._glObjects=[i._outline],i._glObjectsChanged$.next(i)})}return Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"glObjects",{get:function(){return this._glObjects},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"aborted$",{get:function(){return this._aborted$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"created$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometryChanged$",{get:function(){var t=this;return this._geometry.changed$.map(function(e){return t})},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._disposeOutline(),this._geometryChangedSubscription.unsubscribe()},t.prototype.getDOMObjects=function(t,e){var r=this,n=[],o={offsetHeight:e.height,offsetWidth:e.width},a=function(t){t.stopPropagation(),r._aborted$.next(r)};if(this._geometry instanceof s.RectGeometry){var c=this._geometry.getVertex2d(1),u=c[0],h=c[1],l=this._viewportCoords.basicToCanvasSafe(u,h,o,this._transform,t);if(null!=l){var p={style:{background:P=this._colorToBackground(this._options.color),transform:A=this._canvasToTransform(l)}},f={onclick:a,style:{transform:A}};n.push(i.h("div.TagInteractor",f,[])),n.push(i.h("div.TagVertex",p,[]))}}else if(this._geometry instanceof s.PolygonGeometry){var d=this._geometry,m=d.getVertex2d(0),v=m[0],g=m[1],y=this._viewportCoords.basicToCanvasSafe(v,g,o,this._transform,t);if(null!=y){var f={onclick:d.polygon.length>4?function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-2),r._created$.next(r)}:a,style:{transform:A=this._canvasToTransform(y)}},b=d.polygon.length>4?"TagCompleter":"TagInteractor";n.push(i.h("div."+b,f,[]))}if(d.polygon.length>3){var _=d.getVertex2d(d.polygon.length-3),x=_[0],w=_[1],S=this._viewportCoords.basicToCanvasSafe(x,w,o,this._transform,t);if(null!=S){f={onclick:function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-3)},style:{transform:A=this._canvasToTransform(S)}};n.push(i.h("div.TagInteractor",f,[]))}}var M=d.polygon.slice();M.splice(-2,2);for(var E=0,T=M;E<T.length;E++){var C=T[E],O=this._viewportCoords.basicToCanvasSafe(C[0],C[1],o,this._transform,t);if(null!=O){var P=this._colorToBackground(this._options.color),A=this._canvasToTransform(O),p={style:{background:P,transform:A}};n.push(i.h("div.TagVertex",p,[]))}}}return n},t.prototype.addPoint=function(t){if(this._geometry instanceof s.RectGeometry){if(!this._geometry.validate(t))return;this._created$.next(this)}else this._geometry instanceof s.PolygonGeometry&&this._geometry.addVertex2d(t)},t.prototype._canvasToTransform=function(t){return"translate(-50%,-50%) translate("+Math.round(t[0])+"px,"+Math.round(t[1])+"px)"},t.prototype._colorToBackground=function(t){return"#"+("000000"+t.toString(16)).substr(-6)},t.prototype._createOutine=function(){var t=this._geometry.getPoints3d(this._transform),e=this._getLinePositions(t),r=new n.BufferGeometry;r.addAttribute("position",new n.BufferAttribute(e,3));var i=new n.LineBasicMaterial({color:this._options.color,linewidth:1});return new n.Line(r,i)},t.prototype._disposeOutline=function(){if(null!=this._outline){var t=this._outline;t.geometry.dispose(),t.material.dispose(),this._outline=null,this._glObjects=[]}},t.prototype._getLinePositions=function(t){for(var e=t.length,r=new Float32Array(3*e),n=0;n<e;++n){var i=3*n,o=t[n];r[i]=o[0],r[i+1]=o[1],r[i+2]=o[2]}return r},t}();r.OutlineCreateTag=c,r.default=c},{"../../../Component":226,"../../../Geo":229,"rxjs/Subject":34,three:176,"virtual-dom":182}],297:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=t("virtual-dom"),s=t("../../../Component"),a=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n._fill=r.gpano?null:n._createFill(),n._holes=n._tag.lineWidth>=1?n._createHoles():[],n._outline=n._tag.lineWidth>=1?n._createOutline():null,n._geometryChangedSubscription=n._tag.geometry.changed$.subscribe(function(t){null!=n._fill&&n._updateFillGeometry(),n._holes.length>0&&n._updateHoleGeometries(),null!=n._outline&&n._updateOulineGeometry()}),n._changedSubscription=n._tag.changed$.subscribe(function(t){var e=!1;null!=n._fill&&n._updateFillMaterial(n._fill.material),null==n._outline?n._tag.lineWidth>=1&&(n._holes=n._createHoles(),n._outline=n._createOutline(),e=!0):(n._updateHoleMaterials(),n._updateOutlineMaterial()),e&&n._glObjectsChanged$.next(n)}),n}return n(e,t),e.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline(),this._changedSubscription.unsubscribe(),this._geometryChangedSubscription.unsubscribe()},e.prototype.getDOMObjects=function(t,e,r){var n=this,i=[],a=this._tag.geometry instanceof s.RectGeometry,c=!this._transform.gpano,u={offsetHeight:r.height,offsetWidth:r.width};if(null!=this._tag.icon&&(a||c)){var h=this._tag.geometry instanceof s.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfAccessibility2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,u,this._transform,e);if(null!=f){var d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:s.TagOperation.None,tag:n._tag})};if(t.loaded){var m=t.getDOMSprite(this._tag.icon,this._tag.iconFloat),v={onclick:function(t){t.stopPropagation(),n._tag.click$.next(n._tag)},onmousedown:d,style:{transform:S="translate("+Math.round(f[0])+"px,"+Math.round(f[1])+"px)"}};i.push(o.h("div.TagSymbol",v,[m]))}}}else if(null!=this._tag.text&&(a||c)){var g=this._tag.geometry instanceof s.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfAccessibility2d(),y=g[0],b=g[1],_=this._viewportCoords.basicToCanvasSafe(y,b,u,this._transform,e);if(null!=_){var x=Math.round(_[0]),w=Math.round(_[1]),S=this._tag.geometry instanceof s.RectGeometry?"translate("+x+"px,"+w+"px)":"translate(-50%, -50%) translate("+x+"px,"+w+"px)",v={onmousedown:d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:s.TagOperation.None,tag:n._tag})},style:{color:this._colorToCss(this._tag.textColor),transform:S},textContent:this._tag.text};i.push(o.h("span.TagSymbol",v,[]))}}if(!this._tag.editable)return i;var M=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof s.RectGeometry){var E=this._tag.geometry.getCentroid2d(),T=E[0],C=E[1],O=this._viewportCoords.basicToCanvasSafe(T,C,u,this._transform,e);if(null!=O){v={onmousedown:d=this._interact(s.TagOperation.Centroid),style:{background:M,transform:S="translate(-50%, -50%) translate("+Math.round(O[0])+"px,"+Math.round(O[1])+"px)"}};i.push(o.h("div.TagMover",v,[]))}}for(var P=this._tag.geometry.getVertices2d(),A=0;A<P.length-1;A++)if(!a||!(null!=this._tag.icon&&A===this._tag.iconIndex||null==this._tag.icon&&null!=this._tag.text&&3===A)){var j=P[A],R=j[0],L=j[1],N=this._viewportCoords.basicToCanvasSafe(R,L,u,this._transform,e);if(null!=N){v={onmousedown:d=this._interact(s.TagOperation.Vertex,A),style:{background:M,transform:S="translate(-50%, -50%) translate("+Math.round(N[0])+"px,"+Math.round(N[1])+"px)"}};if(a&&(v.style.cursor=A%2==0?"nesw-resize":"nwse-resize"),i.push(o.h("div.TagResizer",v,[])),this._tag.indicateVertices){var I={style:{background:M,transform:S}};i.push(o.h("div.TagVertex",I,[]))}}}return i},e.prototype.getGLObjects=function(){var t=[];null!=this._fill&&t.push(this._fill);for(var e=0,r=this._holes;e<r.length;e++){var n=r[e];t.push(n)}return null!=this._outline&&t.push(this._outline),t},e.prototype.getRetrievableObjects=function(){return null!=this._fill?[this._fill]:[]},e.prototype._colorToCss=function(t){return"#"+("000000"+t.toString(16)).substr(-6)},e.prototype._createFill=function(){var t=this._tag.geometry.getTriangles3d(this._transform),e=new Float32Array(t),r=new i.BufferGeometry;r.addAttribute("position",new i.BufferAttribute(e,3)),r.computeBoundingSphere();var n=new i.MeshBasicMaterial({side:i.DoubleSide,transparent:!0});return this._updateFillMaterial(n),new i.Mesh(r,n)},e.prototype._createHoles=function(){var t=[];if(this._tag.geometry instanceof s.PolygonGeometry)for(var e=0,r=this._tag.geometry.getHoleVertices3d(this._transform);e<r.length;e++){var n=r[e],i=this._createLine(n);t.push(i)}return t},e.prototype._createLine=function(t){var e=this._getLinePositions(t),r=new i.BufferGeometry;r.addAttribute("position",new i.BufferAttribute(e,3)),r.computeBoundingSphere();var n=new i.LineBasicMaterial;this._updateLineBasicMaterial(n);var o=new i.Line(r,n);return o.renderOrder=1,o},e.prototype._createOutline=function(){var t=this._tag.geometry.getPoints3d(this._transform);return this._createLine(t)},e.prototype._disposeFill=function(){null!=this._fill&&(this._fill.geometry.dispose(),this._fill.material.dispose(),this._fill=null)},e.prototype._disposeHoles=function(){for(var t=0,e=this._holes;t<e.length;t++){var r=e[t];r.geometry.dispose(),r.material.dispose()}this._holes=[]},e.prototype._disposeOutline=function(){null!=this._outline&&(this._outline.geometry.dispose(),this._outline.material.dispose(),this._outline=null)},e.prototype._getLinePositions=function(t){for(var e=t.length,r=new Float32Array(3*e),n=0;n<e;++n){var i=3*n,o=t[n];r[i+0]=o[0],r[i+1]=o[1],r[i+2]=o[2]}return r},e.prototype._interact=function(t,e){var r=this;return function(n){var i=n.offsetX-n.target.offsetWidth/2,o=n.offsetY-n.target.offsetHeight/2;r._interact$.next({offsetX:i,offsetY:o,operation:t,tag:r._tag,vertexIndex:e})}},e.prototype._updateFillGeometry=function(){var t=this._tag.geometry.getTriangles3d(this._transform),e=new Float32Array(t),r=this._fill.geometry,n=r.getAttribute("position");n.array.length===e.length?(n.set(e),n.needsUpdate=!0):(r.removeAttribute("position"),r.addAttribute("position",new i.BufferAttribute(e,3))),r.computeBoundingSphere()},e.prototype._updateFillMaterial=function(t){t.color=new i.Color(this._tag.fillColor),t.opacity=this._tag.fillOpacity,t.needsUpdate=!0},e.prototype._updateHoleGeometries=function(){var t=this._tag.geometry.getHoleVertices3d(this._transform);if(t.length!==this._holes.length)throw new Error("Changing the number of holes is not supported.");for(var e=0;e<this._holes.length;e++){var r=t[e],n=this._holes[e];this._updateLine(n,r)}},e.prototype._updateHoleMaterials=function(){for(var t=0,e=this._holes;t<e.length;t++){var r=e[t].material;this._updateLineBasicMaterial(r)}},e.prototype._updateLine=function(t,e){var r=this._getLinePositions(e),n=t.geometry,i=n.getAttribute("position");i.set(r),i.needsUpdate=!0,n.computeBoundingSphere()},e.prototype._updateOulineGeometry=function(){var t=this._tag.geometry.getPoints3d(this._transform);this._updateLine(this._outline,t)},e.prototype._updateOutlineMaterial=function(){var t=this._outline.material;this._updateLineBasicMaterial(t)},e.prototype._updateLineBasicMaterial=function(t){t.color=new i.Color(this._tag.lineColor),t.linewidth=Math.max(this._tag.lineWidth,1),t.visible=this._tag.lineWidth>=1&&this._tag.lineOpacity>0,t.opacity=this._tag.lineOpacity,t.transparent=this._tag.lineOpacity<1,t.needsUpdate=!0},e}(s.RenderTag);r.OutlineRenderTag=a},{"../../../Component":226,three:176,"virtual-dom":182}],298:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Subject"),o=t("../../../Component"),s=t("../../../Viewer"),a=function(t){function e(r,n,o){var a=t.call(this,r,n)||this;return o=o||{},a._editable=null!=o.editable&&o.editable,a._fillColor=null==o.fillColor?16777215:o.fillColor,a._fillOpacity=null==o.fillOpacity?0:o.fillOpacity,a._icon=void 0===o.icon?null:o.icon,a._iconFloat=null==o.iconFloat?s.Alignment.Center:o.iconFloat,a._iconIndex=null==o.iconIndex?3:o.iconIndex,a._indicateVertices=null==o.indicateVertices||o.indicateVertices,a._lineColor=null==o.lineColor?16777215:o.lineColor,a._lineOpacity=null==o.lineOpacity?1:o.lineOpacity,a._lineWidth=null==o.lineWidth?1:o.lineWidth,a._text=void 0===o.text?null:o.text,a._textColor=null==o.textColor?16777215:o.textColor,a._click$=new i.Subject,a._click$.subscribe(function(t){a.fire(e.click,a)}),a}return n(e,t),Object.defineProperty(e.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(t){this._editable=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillColor",{get:function(){return this._fillColor},set:function(t){this._fillColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(t){this._fillOpacity=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(t){this._iconFloat=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(t){this._iconIndex=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(t){this._indicateVertices=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineColor",{get:function(){return this._lineColor},set:function(t){this._lineColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(t){this._lineOpacity=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(t){this._textColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),e.prototype.setOptions=function(t){this._editable=null==t.editable?this._editable:t.editable,this._icon=void 0===t.icon?this._icon:t.icon,this._iconFloat=null==t.iconFloat?this._iconFloat:t.iconFloat,this._iconIndex=null==t.iconIndex?this._iconIndex:t.iconIndex,this._indicateVertices=null==t.indicateVertices?this._indicateVertices:t.indicateVertices,this._lineColor=null==t.lineColor?this._lineColor:t.lineColor,this._lineWidth=null==t.lineWidth?this._lineWidth:t.lineWidth,this._fillColor=null==t.fillColor?this._fillColor:t.fillColor,this._fillOpacity=null==t.fillOpacity?this._fillOpacity:t.fillOpacity,this._text=void 0===t.text?this._text:t.text,this._textColor=null==t.textColor?this._textColor:t.textColor,this._notifyChanged$.next(this)},e.click="click",e}(o.Tag);r.OutlineTag=a,r.default=a},{"../../../Component":226,"../../../Viewer":236,"rxjs/Subject":34}],299:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("../../../Geo"),o=function(){function t(t,e,r){this._tag=t,this._transform=e,this._viewportCoords=r||new i.ViewportCoords,this._glObjectsChanged$=new n.Subject,this._interact$=new n.Subject}return Object.defineProperty(t.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"interact$",{get:function(){return this._interact$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tag",{get:function(){return this._tag},enumerable:!0,configurable:!0}),t}();r.RenderTag=o,r.default=o},{"../../../Geo":229,"rxjs/Subject":34}],300:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("virtual-dom"),o=t("../../../Component"),s=t("../../../Viewer"),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.dispose=function(){},e.prototype.getDOMObjects=function(t,e,r){var n=this,a=this._tag,c={offsetHeight:r.height,offsetWidth:r.width},u=[],h=a.geometry.getCentroid2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,c,this._transform,e);if(null!=f){var d=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:o.TagOperation.None,tag:a})},m=Math.round(f[0]),v=Math.round(f[1]);if(null!=a.icon){if(t.loaded){var g=t.getDOMSprite(a.icon,s.Alignment.Bottom),y={onmousedown:d,style:{pointerEvents:"all",transform:"translate("+m+"px,"+(v+8)+"px)"}};u.push(i.h("div",y,[g]))}}else if(null!=a.text){var b="translate(-50%,0%) translate("+m+"px,"+(v+8)+"px)",y={onmousedown:d,style:{color:this._colorToCss(a.textColor),transform:b},textContent:a.text};u.push(i.h("span.TagSymbol",y,[]))}var _=this._interact(o.TagOperation.Centroid,a),x=this._colorToCss(a.color),w="translate(-50%,-50%) translate("+m+"px,"+v+"px)";if(a.editable){var S={onmousedown:_,style:{background:x,transform:w}};u.push(i.h("div.TagSpotInteractor",S,[]))}var M={style:{background:x,transform:w}};u.push(i.h("div.TagVertex",M,[]))}return u},e.prototype.getGLObjects=function(){return[]},e.prototype.getRetrievableObjects=function(){return[]},e.prototype._colorToCss=function(t){return"#"+("000000"+t.toString(16)).substr(-6)},e.prototype._interact=function(t,e,r){var n=this;return function(i){var o=i.offsetX-i.target.offsetWidth/2,s=i.offsetY-i.target.offsetHeight/2;n._interact$.next({offsetX:o,offsetY:s,operation:t,tag:e,vertexIndex:r})}},e}(o.RenderTag);r.SpotRenderTag=a},{"../../../Component":226,"../../../Viewer":236,"virtual-dom":182}],301:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e,r,n){var i=t.call(this,e,r)||this;return n=n||{},i._color=null==n.color?16777215:n.color,i._editable=null!=n.editable&&n.editable,i._icon=void 0===n.icon?null:n.icon,i._text=void 0===n.text?null:n.text,i._textColor=null==n.textColor?16777215:n.textColor,i}return n(e,t),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(t){this._editable=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(t){this._textColor=t,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),e.prototype.setOptions=function(t){this._color=null==t.color?this._color:t.color,this._editable=null==t.editable?this._editable:t.editable,this._icon=void 0===t.icon?this._icon:t.icon,this._text=void 0===t.text?this._text:t.text,this._textColor=null==t.textColor?this._textColor:t.textColor,this._notifyChanged$.next(this)},e}(t("../../../Component").Tag);r.SpotTag=i,r.default=i},{"../../../Component":226}],302:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/share");var o=function(t){function e(r,n){var o=t.call(this)||this;return o._id=r,o._geometry=n,o._notifyChanged$=new i.Subject,o._notifyChanged$.subscribe(function(t){o.fire(e.changed,o)}),o._geometry.changed$.subscribe(function(t){o.fire(e.geometrychanged,o)}),o}return n(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometryChanged$",{get:function(){var t=this;return this._geometry.changed$.map(function(e){return t}).share()},enumerable:!0,configurable:!0}),e.changed="changed",e.geometrychanged="geometrychanged",e}(t("../../../Utils").EventEmitter);r.Tag=o,r.default=o},{"../../../Utils":235,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/share":74}],303:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,null!=e?e:"The argument is not valid.")||this;return r.name="ArgumentMapillaryError",r}return n(e,t),e}(t("./MapillaryError").MapillaryError);r.ArgumentMapillaryError=i,r.default=i},{"./MapillaryError":305}],304:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,e)||this;return r.name="GraphMapillaryError",r}return n(e,t),e}(t("./MapillaryError").MapillaryError);r.GraphMapillaryError=i,r.default=i},{"./MapillaryError":305}],305:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(t){function e(e){var r=t.call(this,e)||this;return r.name="MapillaryError",r}return n(e,t),e}(Error);r.MapillaryError=i,r.default=i},{}],306:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t){null!=t?(this._position=(new n.Vector3).fromArray(t.unprojectSfM([0,0],0)),this._lookat=(new n.Vector3).fromArray(t.unprojectSfM([0,0],10)),this._up=t.upVector(),this._focal=this._getFocal(t)):(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)}return Object.defineProperty(t.prototype,"position",{get:function(){return this._position},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lookat",{get:function(){return this._lookat},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"up",{get:function(){return this._up},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"focal",{get:function(){return this._focal},set:function(t){this._focal=t},enumerable:!0,configurable:!0}),t.prototype.lerpCameras=function(t,e,r){this._position.subVectors(e.position,t.position).multiplyScalar(r).add(t.position),this._lookat.subVectors(e.lookat,t.lookat).multiplyScalar(r).add(t.lookat),this._up.subVectors(e.up,t.up).multiplyScalar(r).add(t.up),this._focal=(1-r)*t.focal+r*e.focal},t.prototype.copy=function(t){this._position.copy(t.position),this._lookat.copy(t.lookat),this._up.copy(t.up),this._focal=t.focal},t.prototype.clone=function(){var e=new t;return e.position.copy(this._position),e.lookat.copy(this._lookat),e.up.copy(this._up),e.focal=this._focal,e},t.prototype.diff=function(t){var e=this._position.distanceToSquared(t.position),r=this._lookat.distanceToSquared(t.lookat),n=this._up.distanceToSquared(t.up),i=100*Math.abs(this._focal-t.focal);return Math.max(e,r,n,i)},t.prototype._getFocal=function(t){if(null==t.gpano)return t.focal;var e=Math.PI*t.gpano.CroppedAreaImageHeightPixels/t.gpano.FullPanoHeightPixels,r=.5/Math.tan(e/2);return Math.min(1/(2*(Math.sqrt(2)-1)),Math.max(.5,r))},t}();r.Camera=i},{three:176}],307:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._wgs84a=6378137,this._wgs84b=6356752.31424518}return t.prototype.geodeticToEnu=function(t,e,r,n,i,o){var s=this.geodeticToEcef(t,e,r);return this.ecefToEnu(s[0],s[1],s[2],n,i,o)},t.prototype.enuToGeodetic=function(t,e,r,n,i,o){var s=this.enuToEcef(t,e,r,n,i,o);return this.ecefToGeodetic(s[0],s[1],s[2])},t.prototype.ecefToEnu=function(t,e,r,n,i,o){var s=this.geodeticToEcef(n,i,o),a=[t-s[0],e-s[1],r-s[2]];n=n*Math.PI/180,i=i*Math.PI/180;var c=Math.cos(n),u=Math.sin(n),h=Math.cos(i),l=Math.sin(i);return[-l*a[0]+h*a[1],-u*h*a[0]-u*l*a[1]+c*a[2],c*h*a[0]+c*l*a[1]+u*a[2]]},t.prototype.enuToEcef=function(t,e,r,n,i,o){var s=this.geodeticToEcef(n,i,o);n=n*Math.PI/180,i=i*Math.PI/180;var a=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i);return[-h*t-c*u*e+a*u*r+s[0],u*t-c*h*e+a*h*r+s[1],a*e+c*r+s[2]]},t.prototype.geodeticToEcef=function(t,e,r){var n=this._wgs84a,i=this._wgs84b;t=t*Math.PI/180,e=e*Math.PI/180;var o=Math.cos(t),s=Math.sin(t),a=Math.cos(e),c=Math.sin(e),u=n*n,h=i*i,l=1/Math.sqrt(u*o*o+h*s*s),p=(u*l+r)*o;return[p*a,p*c,(h*l+r)*s]},t.prototype.ecefToGeodetic=function(t,e,r){var n=this._wgs84a,i=this._wgs84b,o=n*n,s=i*i,a=o-s,c=Math.sqrt(a/o),u=Math.sqrt(a/s),h=Math.sqrt(t*t+e*e),l=Math.atan2(r*n,h*i),p=Math.sin(l),f=Math.cos(l),d=Math.atan2(e,t),m=Math.atan2(r+u*u*i*p*p*p,h-c*c*n*f*f*f),v=Math.sin(m),g=h/Math.cos(m)-n/Math.sqrt(1-c*c*v*v);return[180*m/Math.PI,180*d/Math.PI,g]},t}();r.GeoCoords=n,r.default=n},{}],308:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(){this._epsilon=1e-9}return t.prototype.azimuthalToBearing=function(t){return-t+Math.PI/2},t.prototype.degToRad=function(t){return Math.PI*t/180},t.prototype.radToDeg=function(t){return 180*t/Math.PI},t.prototype.rotationMatrix=function(t){var e=new n.Vector3(t[0],t[1],t[2]),r=e.length();return r>0&&e.normalize(),(new n.Matrix4).makeRotationAxis(e,r)},t.prototype.rotate=function(t,e){var r=new n.Vector3(t[0],t[1],t[2]),i=this.rotationMatrix(e);return r.applyMatrix4(i),r},t.prototype.opticalCenter=function(t,e){var r=[-t[0],-t[1],-t[2]],n=[-e[0],-e[1],-e[2]];return this.rotate(n,r)},t.prototype.viewingDirection=function(t){var e=[-t[0],-t[1],-t[2]];return this.rotate([0,0,1],e)},t.prototype.wrap=function(t,e,r){if(r<e)throw new Error("Invalid arguments: max must be larger than min.");for(var n=r-e;t>r||t<e;)t>r?t-=n:t<e&&(t+=n);return t},t.prototype.wrapAngle=function(t){return this.wrap(t,-Math.PI,Math.PI)},t.prototype.clamp=function(t,e,r){return t<e?e:t>r?r:t},t.prototype.angleBetweenVector2=function(t,e,r,n){var i=Math.atan2(n,r)-Math.atan2(e,t);return this.wrapAngle(i)},t.prototype.angleDifference=function(t,e){var r=e-t;return this.wrapAngle(r)},t.prototype.relativeRotationAngle=function(t,e){var r=this.rotationMatrix([-t[0],-t[1],-t[2]]),n=this.rotationMatrix(e),i=r.multiply(n).elements;return Math.acos((i[0]+i[5]+i[10]-1)/2)},t.prototype.angleToPlane=function(t,e){var r=(new n.Vector3).fromArray(t),i=r.length();if(i<this._epsilon)return 0;var o=r.dot((new n.Vector3).fromArray(e));return Math.asin(o/i)},t.prototype.distanceFromLatLon=function(t,e,r,n){var i=this.degToRad(r-t),o=this.degToRad(n-e),s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t)*Math.cos(r)*Math.sin(o/2)*Math.sin(o/2);return 12742e3*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))},t}();r.Spatial=i,r.default=i},{three:176}],309:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(t,e,r){this._orientation=this._getValue(t.orientation,1);var n=null!=e?e.width:4,i=null!=e?e.height:3,o=this._orientation<5;this._width=this._getValue(t.width,o?n:i),this._height=this._getValue(t.height,o?i:n),this._basicAspect=o?this._width/this._height:this._height/this._width,this._basicWidth=o?t.width:t.height,this._basicHeight=o?t.height:t.width,this._focal=this._getValue(t.focal,1),this._scale=this._getValue(t.scale,0),this._gpano=null!=t.gpano?t.gpano:null,this._rt=this._getRt(t.rotation,r),this._srt=this._getSrt(this._rt,this._scale)}return Object.defineProperty(t.prototype,"basicAspect",{get:function(){return this._basicAspect},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"basicHeight",{get:function(){return this._basicHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"basicWidth",{get:function(){return this._basicWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"focal",{get:function(){return this._focal},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullPano",{get:function(){return null!=this._gpano&&0===this._gpano.CroppedAreaLeftPixels&&0===this._gpano.CroppedAreaTopPixels&&this._gpano.CroppedAreaImageWidthPixels===this._gpano.FullPanoWidthPixels&&this._gpano.CroppedAreaImageHeightPixels===this._gpano.FullPanoHeightPixels},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gpano",{get:function(){return this._gpano},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"orientation",{get:function(){return this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rt",{get:function(){return this._rt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"srt",{get:function(){return this._srt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this._scale},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasValidScale",{get:function(){return this._scale>.01&&this._scale<50},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),t.prototype.upVector=function(){var t=this._rt.elements;switch(this._orientation){case 1:return new n.Vector3(-t[1],-t[5],-t[9]);case 3:return new n.Vector3(t[1],t[5],t[9]);case 6:return new n.Vector3(-t[0],-t[4],-t[8]);case 8:return new n.Vector3(t[0],t[4],t[8]);default:return new n.Vector3(-t[1],-t[5],-t[9])}},t.prototype.projectorMatrix=function(){var t=this._normalizedToTextureMatrix(),e=this._focal,r=(new n.Matrix4).set(e,0,0,0,0,e,0,0,0,0,0,0,0,0,1,0);return t.multiply(r),t.multiply(this._rt),t},t.prototype.projectBasic=function(t){var e=this.projectSfM(t);return this._sfmToBasic(e)},t.prototype.unprojectBasic=function(t,e){var r=this._basicToSfm(t);return this.unprojectSfM(r,e)},t.prototype.projectSfM=function(t){var e=new n.Vector4(t[0],t[1],t[2],1);return e.applyMatrix4(this._rt),this._bearingToSfm([e.x,e.y,e.z])},t.prototype.unprojectSfM=function(t,e){var r=this._sfmToBearing(t),i=new n.Vector4(e*r[0],e*r[1],e*r[2],1);return i.applyMatrix4((new n.Matrix4).getInverse(this._rt)),[i.x/i.w,i.y/i.w,i.z/i.w]},t.prototype._sfmToBearing=function(t){if(this._fullPano()){var e=2*t[0]*Math.PI,r=2*-t[1]*Math.PI;return[s=Math.cos(r)*Math.sin(e),a=-Math.sin(r),c=Math.cos(r)*Math.cos(e)]}if(this._gpano){var i=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),o=[t[0]*i+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,t[1]*i+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels],e=2*Math.PI*(o[0]/this.gpano.FullPanoWidthPixels-.5),r=-Math.PI*(o[1]/this.gpano.FullPanoHeightPixels-.5),s=Math.cos(r)*Math.sin(e),a=-Math.sin(r),c=Math.cos(r)*Math.cos(e);return[s,a,c]}var u=new n.Vector3(t[0],t[1],this._focal);return u.normalize(),[u.x,u.y,u.z]},t.prototype._bearingToSfm=function(t){if(this._fullPano()){var e=t[0],r=t[1],n=t[2],i=Math.atan2(e,n),o=Math.atan2(-r,Math.sqrt(e*e+n*n));return[i/(2*Math.PI),-o/(2*Math.PI)]}if(this._gpano){var e=t[0],r=t[1],n=t[2],i=Math.atan2(e,n),o=Math.atan2(-r,Math.sqrt(e*e+n*n)),s=[(i/(2*Math.PI)+.5)*this.gpano.FullPanoWidthPixels,(-o/Math.PI+.5)*this.gpano.FullPanoHeightPixels],a=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels);return[(s[0]-this.gpano.CroppedAreaLeftPixels-this.gpano.CroppedAreaImageWidthPixels/2)/a,(s[1]-this.gpano.CroppedAreaTopPixels-this.gpano.CroppedAreaImageHeightPixels/2)/a]}return t[2]>0?[t[0]*this._focal/t[2],t[1]*this._focal/t[2]]:[t[0]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,t[1]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY]},t.prototype._basicToSfm=function(t){var e,r;switch(this._orientation){case 1:e=t[0],r=t[1];break;case 3:e=1-t[0],r=1-t[1];break;case 6:e=t[1],r=1-t[0];break;case 8:e=1-t[1],r=t[0];break;default:e=t[0],r=t[1]}var n=this._width,i=this._height,o=Math.max(n,i);return[e*n/o-n/o/2,r*i/o-i/o/2]},t.prototype._sfmToBasic=function(t){var e,r,n=this._width,i=this._height,o=Math.max(n,i),s=(t[0]+n/o/2)/n*o,a=(t[1]+i/o/2)/i*o;switch(this._orientation){case 1:e=s,r=a;break;case 3:e=1-s,r=1-a;break;case 6:e=1-a,r=s;break;case 8:e=a,r=1-s;break;default:e=s,r=a}return[e,r]},t.prototype._fullPano=function(){return null!=this.gpano&&0===this.gpano.CroppedAreaLeftPixels&&0===this.gpano.CroppedAreaTopPixels&&this.gpano.CroppedAreaImageWidthPixels===this.gpano.FullPanoWidthPixels&&this.gpano.CroppedAreaImageHeightPixels===this.gpano.FullPanoHeightPixels},t.prototype._getValue=function(t,e){return null!=t&&t>0?t:e},t.prototype._getRt=function(t,e){var r=new n.Vector3(t[0],t[1],t[2]),i=r.length();i>0&&r.normalize();var o=new n.Matrix4;return o.makeRotationAxis(r,i),o.setPosition(new n.Vector3(e[0],e[1],e[2])),o},t.prototype._getSrt=function(t,e){var r=t.clone(),i=r.elements;return i[12]=e*i[12],i[13]=e*i[13],i[14]=e*i[14],r.scale(new n.Vector3(e,e,e)),r},t.prototype._normalizedToTextureMatrix=function(){var t=Math.max(this._width,this._height),e=t/this._width,r=t/this._height;switch(this._orientation){case 1:return(new n.Matrix4).set(e,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1);case 3:return(new n.Matrix4).set(-e,0,0,.5,0,r,0,.5,0,0,1,0,0,0,0,1);case 6:return(new n.Matrix4).set(0,-r,0,.5,-e,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new n.Matrix4).set(0,r,0,.5,e,0,0,.5,0,0,1,0,0,0,0,1);default:return(new n.Matrix4).set(e,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1)}},t}();r.Transform=i},{three:176}],310:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=function(){function t(){this._unprojectDepth=200}return t.prototype.basicToCanvas=function(t,e,r,n,i){var o=n.unprojectBasic([t,e],this._unprojectDepth);return this.projectToCanvas(o,r,i)},t.prototype.basicToCanvasSafe=function(t,e,r,n,i){var o=n.unprojectBasic([t,e],this._unprojectDepth),s=this.worldToCamera(o,i);if(s[2]>0)return null;var a=this.cameraToViewport(s,i),c=a[0],u=a[1];return this.viewportToCanvas(c,u,r)},t.prototype.basicToViewport=function(t,e,r,n){var i=r.unprojectBasic([t,e],this._unprojectDepth);return this.projectToViewport(i,n)},t.prototype.cameraToViewport=function(t,e){var r=(new n.Vector3).fromArray(t).applyMatrix4(e.projectionMatrix);return[r.x,r.y]},t.prototype.canvasPosition=function(t,e){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]},t.prototype.canvasToBasic=function(t,e,r,n,i){var o=this.unprojectFromCanvas(t,e,r,i).toArray();return n.projectBasic(o)},t.prototype.canvasToViewport=function(t,e,r){var n=this.containerToCanvas(r);return[2*t/n[0]-1,1-2*e/n[1]]},t.prototype.containerToCanvas=function(t){return[t.offsetWidth,t.offsetHeight]},t.prototype.getBasicDistances=function(t,e){var r=this.viewportToBasic(-1,1,t,e),n=this.viewportToBasic(1,1,t,e),i=this.viewportToBasic(1,-1,t,e),o=this.viewportToBasic(-1,-1,t,e),s=0,a=0,c=0,u=0;return r[1]<0&&n[1]<0&&(s=r[1]>n[1]?-r[1]:-n[1]),n[0]>1&&i[0]>1&&(a=n[0]<i[0]?n[0]-1:i[0]-1),i[1]>1&&o[1]>1&&(c=i[1]<o[1]?i[1]-1:o[1]-1),o[0]<0&&r[0]<0&&(u=o[0]>r[0]?-o[0]:-r[0]),[s,a,c,u]},t.prototype.getPixelDistances=function(t,e,r){var n=this.viewportToBasic(-1,1,e,r),i=this.viewportToBasic(1,1,e,r),o=this.viewportToBasic(1,-1,e,r),s=this.viewportToBasic(-1,-1,e,r),a=0,c=0,u=0,h=0,l=this.containerToCanvas(t),p=l[0],f=l[1];if(n[1]<0&&i[1]<0){d=n[1]>i[1]?n[0]:i[0];a=(v=this.basicToCanvas(d,0,t,e,r))[1]>0?v[1]:0}if(i[0]>1&&o[0]>1){m=i[0]<o[0]?i[1]:o[1];c=(v=this.basicToCanvas(1,m,t,e,r))[0]<p?p-v[0]:0}if(o[1]>1&&s[1]>1){var d=o[1]<s[1]?o[0]:s[0];u=(v=this.basicToCanvas(d,1,t,e,r))[1]<f?f-v[1]:0}if(s[0]<0&&n[0]<0){var m=s[0]>n[0]?s[1]:n[1],v=this.basicToCanvas(0,m,t,e,r);h=v[0]>0?v[0]:0}return[a,c,u,h]},t.prototype.insideElement=function(t,e){var r=e.getBoundingClientRect(),n=r.left+e.clientLeft,i=n+e.clientWidth,o=r.top+e.clientTop,s=o+e.clientHeight;return t.clientX>n&&t.clientX<i&&t.clientY>o&&t.clientY<s},t.prototype.projectToCanvas=function(t,e,r){var n=this.projectToViewport(t,r);return this.viewportToCanvas(n[0],n[1],e)},t.prototype.projectToViewport=function(t,e){var r=new n.Vector3(t[0],t[1],t[2]).project(e);return[r.x,r.y]},t.prototype.unprojectFromCanvas=function(t,e,r,n){var i=this.canvasToViewport(t,e,r);return this.unprojectFromViewport(i[0],i[1],n)},t.prototype.unprojectFromViewport=function(t,e,r){return new n.Vector3(t,e,1).unproject(r)},t.prototype.viewportToBasic=function(t,e,r,i){var o=new n.Vector3(t,e,1).unproject(i).toArray();return r.projectBasic(o)},t.prototype.viewportToCanvas=function(t,e,r){var n=this.containerToCanvas(r);return[n[0]*(t+1)/2,-n[1]*(e-1)/2]},t.prototype.worldToCamera=function(t,e){return new n.Vector3(t[0],t[1],t[2]).applyMatrix4(e.matrixWorldInverse).toArray()},t}();r.ViewportCoords=i,r.default=i},{three:176}],311:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.createFilter=function(t){return new Function("node","return "+this._compile(t)+";")},t.prototype._compile=function(t){if(null==t||t.length<=1)return"true";var e=t[0];return"("+("=="===e?this._compileComparisonOp("===",t[1],t[2],!1):"!="===e?this._compileComparisonOp("!==",t[1],t[2],!1):">"===e||">="===e||"<"===e||"<="===e?this._compileComparisonOp(e,t[1],t[2],!0):"in"===e?this._compileInOp(t[1],t.slice(2)):"!in"===e?this._compileNegation(this._compileInOp(t[1],t.slice(2))):"all"===e?this._compileLogicalOp(t.slice(1),"&&"):"true")+")"},t.prototype._compare=function(t,e){return t<e?-1:t>e?1:0},t.prototype._compileComparisonOp=function(t,e,r,n){var i=this._compilePropertyReference(e),o=JSON.stringify(r);return(n?"typeof "+i+"===typeof "+o+"&&":"")+i+t+o},t.prototype._compileInOp=function(t,e){var r=this._compare;return JSON.stringify(e.sort(r))+".indexOf("+this._compilePropertyReference(t)+")!==-1"},t.prototype._compileLogicalOp=function(t,e){var r=this._compile.bind(this);return t.map(r).join(e)},t.prototype._compileNegation=function(t){return"!("+t+")"},t.prototype._compilePropertyReference=function(t){return"node["+JSON.stringify(t)+"]"},t}();r.FilterCreator=n,r.default=n},{}],312:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rbush"),i=t("rxjs/Subject");t("rxjs/add/observable/from"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/do"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publish");var o=t("../Edge"),s=t("../Error"),a=t("../Graph"),c=function(){function t(t,e,r,s,c,u){this._apiV3=t,this._cachedNodes={},this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._changed$=new i.Subject,this._defaultAlt=2,this._edgeCalculator=null!=s?s:new o.EdgeCalculator,this._filterCreator=null!=c?c:new a.FilterCreator,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=r?r:new a.GraphCalculator,this._configuration=null!=u?u:{maxSequences:50,maxUnusedNodes:100,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=e?e:n(16,[".lat",".lon",".lat",".lon"]),this._nodeIndexTiles={},this._nodeToTile={},this._preStored={},this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._tilePrecision=7,this._tileThreshold=20}return Object.defineProperty(t.prototype,"changed$",{get:function(){return this._changed$},enumerable:!0,configurable:!0}),t.prototype.cacheFill$=function(t){var e=this;if(t in this._cachingFull$)throw new s.GraphMapillaryError("Cannot fill node while caching full ("+t+").");if(!this.hasNode(t))throw new s.GraphMapillaryError("Cannot fill node that does not exist in graph ("+t+").");if(t in this._cachingFill$)return this._cachingFill$[t];var r=this.getNode(t);if(r.full)throw new s.GraphMapillaryError("Cannot fill node that is already full ("+t+").");return this._cachingFill$[t]=this._apiV3.imageByKeyFill$([t]).do(function(n){r.full||e._makeFull(r,n[t]),delete e._cachingFill$[t]}).map(function(t){return e}).finally(function(){t in e._cachingFill$&&delete e._cachingFill$[t],e._changed$.next(e)}).publish().refCount(),this._cachingFill$[t]},t.prototype.cacheFull$=function(t){var e=this;if(t in this._cachingFull$)return this._cachingFull$[t];if(this.hasNode(t))throw new s.GraphMapillaryError("Cannot cache full node that already exist in graph ("+t+").");return this._cachingFull$[t]=this._apiV3.imageByKeyFull$([t]).do(function(r){var n=r[t];if(e.hasNode(t))(i=e.getNode(t)).full||e._makeFull(i,n);else{if(null==n.sequence||null==n.sequence.key)throw new s.GraphMapillaryError("Node has no sequence ("+t+").");var i=new a.Node(n);e._makeFull(i,n);var o=e._graphCalculator.encodeH(i.originalLatLon,e._tilePrecision);e._preStore(o,i),e._setNode(i),delete e._cachingFull$[t]}}).map(function(t){return e}).finally(function(){t in e._cachingFull$&&delete e._cachingFull$[t],e._changed$.next(e)}).publish().refCount(),this._cachingFull$[t]},t.prototype.cacheNodeSequence$=function(t){if(!this.hasNode(t))throw new s.GraphMapillaryError("Cannot cache sequence edges of node that does not exist in graph ("+t+").");var e=this.getNode(t);if(e.sequenceKey in this._sequences)throw new s.GraphMapillaryError("Sequence already cached ("+t+"), ("+e.sequenceKey+").");return this._cacheSequence$(e.sequenceKey)},t.prototype.cacheSequence$=function(t){if(t in this._sequences)throw new s.GraphMapillaryError("Sequence already cached ("+t+")");return this._cacheSequence$(t)},t.prototype.cacheSequenceEdges=function(t){var e=this.getNode(t);if(!(e.sequenceKey in this._sequences))throw new s.GraphMapillaryError("Sequence is not cached ("+t+"), ("+e.sequenceKey+")");var r=this._sequences[e.sequenceKey].sequence,n=this._edgeCalculator.computeSequenceEdges(e,r);e.cacheSequenceEdges(n)},t.prototype.cacheSpatialArea$=function(t){var e=this;if(!this.hasNode(t))throw new s.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+t+").");if(t in this._cachedSpatialEdges)throw new s.GraphMapillaryError("Node already spatially cached ("+t+").");if(!(t in this._requiredSpatialArea))throw new s.GraphMapillaryError("Spatial area not determined ("+t+").");var r=this._requiredSpatialArea[t];if(0===Object.keys(r.cacheNodes).length)throw new s.GraphMapillaryError("Spatial nodes already cached ("+t+").");if(t in this._cachingSpatialArea$)return this._cachingSpatialArea$[t];for(var n=[];r.cacheKeys.length>0;)n.push(r.cacheKeys.splice(0,200));for(var i=n.length,o=[],a=this,c=0,u=n;c<u.length;c++)!function(n){var s=a._apiV3.imageByKeyFill$(n).do(function(n){for(var o in n)if(n.hasOwnProperty(o)){var s=r.cacheNodes[o];if(s.full)delete r.cacheNodes[o];else{var a=n[o];e._makeFull(s,a),delete r.cacheNodes[o]}}0==--i&&delete e._cachingSpatialArea$[t]}).map(function(t){return e}).catch(function(o){for(var s=0,a=n;s<a.length;s++){var c=a[s];c in r.all&&delete r.all[c],c in r.cacheNodes&&delete r.cacheNodes[c]}throw 0==--i&&delete e._cachingSpatialArea$[t],o}).finally(function(){0===Object.keys(r.cacheNodes).length&&e._changed$.next(e)}).publish().refCount();o.push(s)}(u[c]);return this._cachingSpatialArea$[t]=o,o},t.prototype.cacheSpatialEdges=function(t){if(t in this._cachedSpatialEdges)throw new s.GraphMapillaryError("Spatial edges already cached ("+t+").");var e=this.getNode(t),r=this._sequences[e.sequenceKey].sequence,n=[],i=r.findPrevKey(e.key);null!=i&&n.push(i);var o=r.findNextKey(e.key);null!=o&&n.push(o);var a=this._requiredSpatialArea[t].all,c=[],u=this._filter;for(var h in a)if(a.hasOwnProperty(h)){var l=a[h];u(l)&&c.push(l)}var p=this._edgeCalculator.getPotentialEdges(e,c,n),f=this._edgeCalculator.computeStepEdges(e,p,i,o);f=(f=(f=(f=f.concat(this._edgeCalculator.computeTurnEdges(e,p))).concat(this._edgeCalculator.computePanoEdges(e,p))).concat(this._edgeCalculator.computePerspectiveToPanoEdges(e,p))).concat(this._edgeCalculator.computeSimilarEdges(e,p)),e.cacheSpatialEdges(f),this._cachedSpatialEdges[t]=e,delete this._requiredSpatialArea[t],delete this._cachedNodeTiles[t]},t.prototype.cacheTiles$=function(t){var e=this;if(t in this._cachedNodeTiles)throw new s.GraphMapillaryError("Tiles already cached ("+t+").");if(t in this._cachedSpatialEdges)throw new s.GraphMapillaryError("Spatial edges already cached so tiles considered cached ("+t+").");if(!(t in this._requiredNodeTiles))throw new s.GraphMapillaryError("Tiles have not been determined ("+t+").");var r=this._requiredNodeTiles[t];if(0===r.cache.length&&0===r.caching.length)throw new s.GraphMapillaryError("Tiles already cached ("+t+").");if(!this.hasNode(t))throw new s.GraphMapillaryError("Cannot cache tiles of node that does not exist in graph ("+t+").");var n=r.cache.slice();r.caching=this._requiredNodeTiles[t].caching.concat(n),r.cache=[];for(var i=[],o=this,c=0,u=r.caching;c<u.length;c++)!function(n){var s=null;n in o._cachingTiles$?s=o._cachingTiles$[n]:(s=o._apiV3.imagesByH$([n]).do(function(t){var r=t[n];if(!(n in e._cachedTiles)){e._nodeIndexTiles[n]=[],e._cachedTiles[n]={accessed:(new Date).getTime(),nodes:[]};var i=e._cachedTiles[n].nodes,o=e._removeFromPreStore(n);for(var s in r)if(r.hasOwnProperty(s)){var c=r[s];if(null==c)break;if(null!=c.sequence&&null!=c.sequence.key)if(null!=o&&c.key in o){var u=o[c.key];delete o[c.key],i.push(u);var h={lat:u.latLon.lat,lon:u.latLon.lon,node:u};e._nodeIndex.insert(h),e._nodeIndexTiles[n].push(h),e._nodeToTile[u.key]=n}else{var l=new a.Node(c);i.push(l);var p={lat:l.latLon.lat,lon:l.latLon.lon,node:l};e._nodeIndex.insert(p),e._nodeIndexTiles[n].push(p),e._nodeToTile[l.key]=n,e._setNode(l)}else console.warn("Sequence missing, discarding ("+c.key+")")}delete e._cachingTiles$[n]}}).map(function(t){return e}).catch(function(t){throw delete e._cachingTiles$[n],t}).publish().refCount(),o._cachingTiles$[n]=s),i.push(s.do(function(i){var o=r.caching.indexOf(n);o>-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete e._requiredNodeTiles[t],e._cachedNodeTiles[t]=!0)}).catch(function(i){var o=r.caching.indexOf(n);throw o>-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete e._requiredNodeTiles[t],e._cachedNodeTiles[t]=!0),i}).finally(function(){e._changed$.next(e)}).publish().refCount())}(u[c]);return i},t.prototype.initializeCache=function(t){if(t in this._cachedNodes)throw new s.GraphMapillaryError("Node already in cache ("+t+").");var e=this.getNode(t);e.initializeCache(new a.NodeCache);var r=(new Date).getTime();this._cachedNodes[t]={accessed:r,node:e},this._updateCachedTileAccess(t,r)},t.prototype.isCachingFill=function(t){return t in this._cachingFill$},t.prototype.isCachingFull=function(t){return t in this._cachingFull$},t.prototype.isCachingNodeSequence=function(t){return this.getNode(t).sequenceKey in this._cachingSequences$},t.prototype.isCachingSequence=function(t){return t in this._cachingSequences$},t.prototype.isCachingTiles=function(t){return t in this._requiredNodeTiles&&0===this._requiredNodeTiles[t].cache.length&&this._requiredNodeTiles[t].caching.length>0},t.prototype.hasInitializedCache=function(t){return t in this._cachedNodes},t.prototype.hasNode=function(t){var e=(new Date).getTime();return this._updateCachedNodeAccess(t,e),this._updateCachedTileAccess(t,e),t in this._nodes},t.prototype.hasNodeSequence=function(t){var e=this.getNode(t).sequenceKey,r=e in this._sequences;return r&&(this._sequences[e].accessed=(new Date).getTime()),r},t.prototype.hasSequence=function(t){var e=t in this._sequences;return e&&(this._sequences[t].accessed=(new Date).getTime()),e},t.prototype.hasSpatialArea=function(t){if(!this.hasNode(t))throw new s.GraphMapillaryError("Spatial area nodes cannot be determined if node not in graph ("+t+").");if(t in this._cachedSpatialEdges)return!0;if(t in this._requiredSpatialArea)return 0===Object.keys(this._requiredSpatialArea[t].cacheNodes).length;for(var e=this.getNode(t),r=this._graphCalculator.boundingBoxCorners(e.latLon,this._tileThreshold),n={all:{},cacheKeys:[],cacheNodes:{}},i=0,o=this._nodeIndex.search({maxX:r[1].lat,maxY:r[1].lon,minX:r[0].lat,minY:r[0].lon});i<o.length;i++){var a=o[i];n.all[a.node.key]=a.node,a.node.full||(n.cacheKeys.push(a.node.key),n.cacheNodes[a.node.key]=a.node)}return this._requiredSpatialArea[t]=n,0===n.cacheKeys.length},t.prototype.hasTiles=function(t){var e=this;if(t in this._cachedNodeTiles)return!0;if(t in this._cachedSpatialEdges)return!0;if(!this.hasNode(t))throw new s.GraphMapillaryError("Node does not exist in graph ("+t+").");var r={cache:[],caching:[]};if(t in this._requiredNodeTiles)r=this._requiredNodeTiles[t];else{var n=this.getNode(t);r.cache=this._graphCalculator.encodeHs(n.latLon,this._tilePrecision,this._tileThreshold).filter(function(t){return!(t in e._cachedTiles)}),r.cache.length>0&&(this._requiredNodeTiles[t]=r)}return 0===r.cache.length&&0===r.caching.length},t.prototype.getNode=function(t){var e=(new Date).getTime();return this._updateCachedNodeAccess(t,e),this._updateCachedTileAccess(t,e),this._nodes[t]},t.prototype.getSequence=function(t){var e=this._sequences[t];return e.accessed=(new Date).getTime(),e.sequence},t.prototype.resetSpatialEdges=function(){for(var t=0,e=Object.keys(this._cachedSpatialEdges);t<e.length;t++){var r=e[t];this._cachedSpatialEdges[r].resetSpatialEdges(),delete this._cachedSpatialEdges[r]}},t.prototype.reset=function(t){for(var e=[],r=0,n=t;r<n.length;r++){var i=n[r];if(!this.hasNode(i))throw new Error("Node does not exist "+i);(h=this.getNode(i)).resetSequenceEdges(),h.resetSpatialEdges(),e.push(h)}for(var o=0,s=Object.keys(this._cachedNodes);o<s.length;o++){var a=s[o];-1===t.indexOf(a)&&(this._cachedNodes[a].node.dispose(),delete this._cachedNodes[a])}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,u=e;c<u.length;c++){var h=u[c];this._nodes[h.key]=h;var l=this._graphCalculator.encodeH(h.originalLatLon,this._tilePrecision);this._preStore(l,h)}this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._nodeIndexTiles={},this._nodeIndex.clear()},t.prototype.setFilter=function(t){this._filter=this._filterCreator.createFilter(t)},t.prototype.uncache=function(t){var e={};this._addNewKeys(e,this._cachingFull$),this._addNewKeys(e,this._cachingFill$),this._addNewKeys(e,this._cachingTiles$),this._addNewKeys(e,this._cachingSpatialArea$),this._addNewKeys(e,this._requiredNodeTiles),this._addNewKeys(e,this._requiredSpatialArea);for(var r=0,n=t;r<n.length;r++)(o=n[r])in e||(e[o]=!0);var i={};for(var o in e)if(e.hasOwnProperty(o))for(var s=this._nodes[o],a=0,c=this._graphCalculator.encodeHs(s.latLon);a<c.length;a++){var u=c[a];u in i||(i[u]=!0)}var h=[];for(var l in this._cachedTiles)!this._cachedTiles.hasOwnProperty(l)||l in i||h.push([l,this._cachedTiles[l]]);for(var p=0,f=h.sort(function(t,e){return e[1].accessed-t[1].accessed}).slice(this._configuration.maxUnusedTiles).map(function(t){return t[0]});p<f.length;p++){var d=f[p];this._uncacheTile(d)}var m=[];for(var o in this._cachedNodes)!this._cachedNodes.hasOwnProperty(o)||o in e||m.push(this._cachedNodes[o]);for(var v=0,g=m.sort(function(t,e){return e.accessed-t.accessed}).slice(this._configuration.maxUnusedNodes);v<g.length;v++){var y=g[v];y.node.uncache();o=y.node.key;delete this._cachedNodes[o],o in this._cachedNodeTiles&&delete this._cachedNodeTiles[o],o in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[o]}var b=[];for(var _ in this._sequences)!this._sequences.hasOwnProperty(_)||_ in this._cachingSequences$||b.push(this._sequences[_]);for(var x=0,w=b.sort(function(t,e){return e.accessed-t.accessed}).slice(this._configuration.maxSequences);x<w.length;x++){var S=w[x],_=S.sequence.key;delete this._sequences[_],S.sequence.dispose()}},t.prototype._addNewKeys=function(t,e){for(var r in e)e.hasOwnProperty(r)&&this.hasNode(r)&&(r in t||(t[r]=!0))},t.prototype._cacheSequence$=function(t){var e=this;return t in this._cachingSequences$?this._cachingSequences$[t]:(this._cachingSequences$[t]=this._apiV3.sequenceByKey$([t]).do(function(r){t in e._sequences||(e._sequences[t]={accessed:(new Date).getTime(),sequence:new a.Sequence(r[t])}),delete e._cachingSequences$[t]}).map(function(t){return e}).finally(function(){t in e._cachingSequences$&&delete e._cachingSequences$[t],e._changed$.next(e)}).publish().refCount(),this._cachingSequences$[t])},t.prototype._makeFull=function(t,e){null==e.calt&&(e.calt=this._defaultAlt),null==e.c_rotation&&(e.c_rotation=this._graphCalculator.rotationFromCompass(e.ca,e.orientation)),t.makeFull(e)},t.prototype._preStore=function(t,e){t in this._preStored||(this._preStored[t]={}),this._preStored[t][e.key]=e},t.prototype._removeFromPreStore=function(t){var e=null;return t in this._preStored&&(e=this._preStored[t],delete this._preStored[t]),e},t.prototype._setNode=function(t){var e=t.key;if(this.hasNode(e))throw new s.GraphMapillaryError("Node already exist ("+e+").");this._nodes[e]=t},t.prototype._uncacheTile=function(t){for(var e=0,r=this._cachedTiles[t].nodes;e<r.length;e++){var n=r[e],i=n.key;delete this._nodes[i],delete this._nodeToTile[i],i in this._cachedNodes&&delete this._cachedNodes[i],i in this._cachedNodeTiles&&delete this._cachedNodeTiles[i],i in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[i],n.dispose()}for(var o=0,s=this._nodeIndexTiles[t];o<s.length;o++){var a=s[o];this._nodeIndex.remove(a)}delete this._nodeIndexTiles[t],delete this._cachedTiles[t]},t.prototype._updateCachedTileAccess=function(t,e){t in this._nodeToTile&&(this._cachedTiles[this._nodeToTile[t]].accessed=e)},t.prototype._updateCachedNodeAccess=function(t,e){t in this._cachedNodes&&(this._cachedNodes[t].accessed=e)},t}();r.Graph=c,r.default=c},{"../Edge":227,"../Error":228,"../Graph":230,rbush:25,"rxjs/Subject":34,"rxjs/add/observable/from":41,"rxjs/add/operator/catch":52,"rxjs/add/operator/do":59,"rxjs/add/operator/finally":62,"rxjs/add/operator/map":65,"rxjs/add/operator/publish":71}],313:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("latlon-geohash"),i=t("three"),o=t("../Geo"),s=function(){function t(){}return t.n="n",t.nw="nw",t.w="w",t.sw="sw",t.s="s",t.se="se",t.e="e",t.ne="ne",t}(),a=function(){function t(t){this._geoCoords=null!=t?t:new o.GeoCoords}return t.prototype.encodeH=function(t,e){return void 0===e&&(e=7),n.encode(t.lat,t.lon,e)},t.prototype.encodeHs=function(t,e,r){void 0===e&&(e=7),void 0===r&&(r=20);var i=n.encode(t.lat,t.lon,e),o=n.bounds(i),a=o.ne,c=o.sw,u=n.neighbours(i),h=[0,0,0],l=this._geoCoords.geodeticToEnu(a.lat,a.lon,0,c.lat,c.lon,0),p=this._geoCoords.geodeticToEnu(t.lat,t.lon,0,c.lat,c.lon,0),f=p[0]-h[0]<r,d=l[0]-p[0]<r,m=p[1]-h[1]<r,v=l[1]-p[1]<r,g=[i];return v&&g.push(u[s.n]),v&&f&&g.push(u[s.nw]),f&&g.push(u[s.w]),f&&m&&g.push(u[s.sw]),m&&g.push(u[s.s]),m&&d&&g.push(u[s.se]),d&&g.push(u[s.e]),d&&v&&g.push(u[s.ne]),g},t.prototype.boundingBoxCorners=function(t,e){var r=this._geoCoords.enuToGeodetic(-e,-e,0,t.lat,t.lon,0),n=this._geoCoords.enuToGeodetic(e,e,0,t.lat,t.lon,0);return[{lat:r[0],lon:r[1]},{lat:n[0],lon:n[1]}]},t.prototype.rotationFromCompass=function(t,e){var r=0,n=0,o=0;switch(e){case 1:r=Math.PI/2;break;case 3:r=-Math.PI/2,o=Math.PI;break;case 6:n=-Math.PI/2,o=-Math.PI/2;break;case 8:n=Math.PI/2,o=Math.PI/2}var s=(new i.Matrix4).makeRotationZ(o),a=new i.Euler(r,n,t*Math.PI/180,"XYZ"),c=(new i.Matrix4).makeRotationFromEuler(a),u=(new i.Vector4).setAxisAngleFromRotationMatrix(c.multiply(s));return u.multiplyScalar(u.w).toArray().slice(0,3)},t}();r.GraphCalculator=a,r.default=a},{"../Geo":229,"latlon-geohash":21,three:176}],314:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Observable"),i=t("rxjs/Subject");t("rxjs/add/operator/catch"),t("rxjs/add/operator/concat"),t("rxjs/add/operator/do"),t("rxjs/add/operator/expand"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/first"),t("rxjs/add/operator/last"),t("rxjs/add/operator/map"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/publishReplay");var o=function(){function t(t,e){this._graph$=n.Observable.of(t).concat(t.changed$).publishReplay(1).refCount(),this._graph$.subscribe(function(){}),this._imageLoadingService=e,this._firstGraphSubjects$=[],this._initializeCacheSubscriptions=[],this._sequenceSubscriptions=[],this._spatialSubscriptions=[]}return t.prototype.cacheNode$=function(t){var e=this,r=new i.Subject;this._firstGraphSubjects$.push(r);var o=r.publishReplay(1).refCount(),s=o.map(function(e){return e.getNode(t)}).mergeMap(function(t){return t.assetsCached?n.Observable.of(t):t.cacheAssets$()}).publishReplay(1).refCount();s.subscribe(function(t){e._imageLoadingService.loadnode$.next(t)},function(e){console.error("Failed to cache node ("+t+")",e)});var a=this._graph$.first().mergeMap(function(e){return e.isCachingFull(t)||!e.hasNode(t)?e.cacheFull$(t):e.isCachingFill(t)||!e.getNode(t).full?e.cacheFill$(t):n.Observable.of(e)}).do(function(e){e.hasInitializedCache(t)||e.initializeCache(t)}).finally(function(){null!=a&&(e._removeFromArray(a,e._initializeCacheSubscriptions),e._removeFromArray(r,e._firstGraphSubjects$))}).subscribe(function(t){r.next(t),r.complete()},function(t){r.error(t)});a.closed||this._initializeCacheSubscriptions.push(a);var c=o.mergeMap(function(e){return e.isCachingNodeSequence(t)||!e.hasNodeSequence(t)?e.cacheNodeSequence$(t):n.Observable.of(e)}).do(function(e){e.getNode(t).sequenceEdges.cached||e.cacheSequenceEdges(t)}).finally(function(){null!=c&&e._removeFromArray(c,e._sequenceSubscriptions)}).subscribe(function(t){},function(e){console.error("Failed to cache sequence edges ("+t+").",e)});c.closed||this._sequenceSubscriptions.push(c);var u=o.expand(function(e){return e.hasTiles(t)?n.Observable.empty():n.Observable.from(e.cacheTiles$(t)).mergeMap(function(e){return e.mergeMap(function(e){return e.isCachingTiles(t)?n.Observable.empty():n.Observable.of(e)}).catch(function(e,r){return console.error("Failed to cache tile data ("+t+").",e),n.Observable.empty()})})}).last().mergeMap(function(e){return e.hasSpatialArea(t)?n.Observable.of(e):n.Observable.from(e.cacheSpatialArea$(t)).mergeMap(function(e){return e.catch(function(e,r){return console.error("Failed to cache spatial nodes ("+t+").",e),n.Observable.empty()})})}).last().mergeMap(function(e){return e.hasNodeSequence(t)?n.Observable.of(e):e.cacheNodeSequence$(t)}).do(function(e){e.getNode(t).spatialEdges.cached||e.cacheSpatialEdges(t)}).finally(function(){null!=u&&e._removeFromArray(u,e._spatialSubscriptions)}).subscribe(function(t){},function(e){console.error("Failed to cache spatial edges ("+t+").",e)});return u.closed||this._spatialSubscriptions.push(u),s.first(function(t){return t.assetsCached})},t.prototype.cacheSequence$=function(t){return this._graph$.first().mergeMap(function(e){return e.isCachingSequence(t)||!e.hasSequence(t)?e.cacheSequence$(t):n.Observable.of(e)}).map(function(e){return e.getSequence(t)})},t.prototype.setFilter$=function(t){return this._resetSubscriptions(this._spatialSubscriptions),this._graph$.first().do(function(e){e.resetSpatialEdges(),e.setFilter(t)})},t.prototype.reset$=function(t){return this._abortSubjects(this._firstGraphSubjects$),this._resetSubscriptions(this._initializeCacheSubscriptions),this._resetSubscriptions(this._sequenceSubscriptions),this._resetSubscriptions(this._spatialSubscriptions),this._graph$.first().do(function(e){e.reset(t)})},t.prototype.uncache$=function(t){return this._graph$.first().do(function(e){e.uncache(t)})},t.prototype._abortSubjects=function(t){for(var e=0,r=t.slice();e<r.length;e++){var n=r[e];this._removeFromArray(n,t),n.error(new Error("Cache node request was aborted."))}},t.prototype._removeFromArray=function(t,e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)},t.prototype._resetSubscriptions=function(t){for(var e=0,r=t.slice();e<r.length;e++){var n=r[e];this._removeFromArray(n,t),n.closed||n.unsubscribe()}},t}();r.GraphService=o,r.default=o},{"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/operator/catch":52,"rxjs/add/operator/concat":54,"rxjs/add/operator/do":59,"rxjs/add/operator/expand":60,"rxjs/add/operator/finally":62,"rxjs/add/operator/first":63,"rxjs/add/operator/last":64,"rxjs/add/operator/map":65,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72}],315:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=function(){function t(){this._loadnode$=new n.Subject,this._loadstatus$=this._loadnode$.scan(function(t,e){return t[e.key]=e.loadStatus,t},{}).publishReplay(1).refCount(),this._loadstatus$.subscribe(function(){})}return Object.defineProperty(t.prototype,"loadnode$",{get:function(){return this._loadnode$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadstatus$",{get:function(){return this._loadstatus$},enumerable:!0,configurable:!0}),t}();r.ImageLoadingService=i},{"rxjs/Subject":34}],316:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("pbf"),i=function(){function t(){}return t.read=function(e){return new n(e).readFields(t._readMeshField,{faces:[],vertices:[]})},t._readMeshField=function(t,e,r){1===t?e.vertices.push(r.readFloat()):2===t&&e.faces.push(r.readVarint())},t}();r.MeshReader=i},{pbf:23}],317:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/map");var n=function(){function t(t){this._cache=null,this._core=t,this._fill=null}return Object.defineProperty(t.prototype,"assetsCached",{get:function(){return null!=this._core&&null!=this._fill&&null!=this._cache&&null!=this._cache.image&&null!=this._cache.mesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alt",{get:function(){return this._fill.calt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ca",{get:function(){return null!=this._fill.cca?this._fill.cca:this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"capturedAt",{get:function(){return this._fill.captured_at},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"computedCA",{get:function(){return this._fill.cca},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"computedLatLon",{get:function(){return this._core.cl},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"focal",{get:function(){return this._fill.cfocal},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return null!=this._fill},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullPano",{get:function(){return null!=this._fill.gpano&&0===this._fill.gpano.CroppedAreaLeftPixels&&0===this._fill.gpano.CroppedAreaTopPixels&&this._fill.gpano.CroppedAreaImageWidthPixels===this._fill.gpano.FullPanoWidthPixels&&this._fill.gpano.CroppedAreaImageHeightPixels===this._fill.gpano.FullPanoHeightPixels},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gpano",{get:function(){return this._fill.gpano},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._fill.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"image",{get:function(){return this._cache.image},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this._core.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"latLon",{get:function(){return null!=this._core.cl?this._core.cl:this._core.l},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadStatus",{get:function(){return this._cache.loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"merged",{get:function(){return null!=this._fill&&null!=this._fill.merge_version&&this._fill.merge_version>0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mergeCC",{get:function(){return this._fill.merge_cc},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mergeVersion",{get:function(){return this._fill.merge_version},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._cache.mesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"orientation",{get:function(){return this._fill.orientation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalCA",{get:function(){return this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalLatLon",{get:function(){return this._core.l},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pano",{get:function(){return null!=this._fill.gpano&&null!=this._fill.gpano.FullPanoWidthPixels},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectKey",{get:function(){return null!=this._fill.project?this._fill.project.key:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._fill.c_rotation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this._fill.atomic_scale},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceKey",{get:function(){return this._core.sequence.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges",{get:function(){return this._cache.sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges$",{get:function(){return this._cache.sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges",{get:function(){return this._cache.spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges$",{get:function(){return this._cache.spatialEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"userKey",{get:function(){return this._fill.user.key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"username",{get:function(){return this._fill.user.username},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._fill.width},enumerable:!0,configurable:!0}),t.prototype.cacheAssets$=function(){var t=this;return this._cache.cacheAssets$(this.key,this.pano,this.merged).map(function(e){return t})},t.prototype.cacheImage$=function(t){var e=this;return this._cache.cacheImage$(this.key,t).map(function(t){return e})},t.prototype.cacheSequenceEdges=function(t){this._cache.cacheSequenceEdges(t)},t.prototype.cacheSpatialEdges=function(t){this._cache.cacheSpatialEdges(t)},t.prototype.dispose=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null),this._core=null,this._fill=null},t.prototype.initializeCache=function(t){if(null!=this._cache)throw new Error("Node cache already initialized ("+this.key+").");this._cache=t},t.prototype.makeFull=function(t){if(null==t)throw new Error("Fill can not be null.");this._fill=t},t.prototype.resetSequenceEdges=function(){this._cache.resetSequenceEdges()},t.prototype.resetSpatialEdges=function(){this._cache.resetSpatialEdges()},t.prototype.uncache=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null)},t}();r.Node=n,r.default=n},{"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/map":65}],318:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/publishReplay");var o=t("../Graph"),s=t("../Utils"),a=function(){function t(){this._disposed=!1,this._image=null,this._loadStatus={loaded:0,total:0},this._mesh=null,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$=new n.Subject,this._sequenceEdges$=this._sequenceEdgesChanged$.startWith(this._sequenceEdges).publishReplay(1).refCount(),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){}),this._spatialEdgesChanged$=new n.Subject,this._spatialEdges$=this._spatialEdgesChanged$.startWith(this._spatialEdges).publishReplay(1).refCount(),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){}),this._cachingAssets$=null}return Object.defineProperty(t.prototype,"image",{get:function(){return this._image},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadStatus",{get:function(){return this._loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges",{get:function(){return this._sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sequenceEdges$",{get:function(){return this._sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges",{get:function(){return this._spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spatialEdges$",{get:function(){return this._spatialEdges$},enumerable:!0,configurable:!0}),t.prototype.cacheAssets$=function(t,e,r){var n=this;if(null!=this._cachingAssets$)return this._cachingAssets$;var o=e?s.Settings.basePanoramaSize:s.Settings.baseImageSize;return this._cachingAssets$=i.Observable.combineLatest(this._cacheImage$(t,o),this._cacheMesh$(t,r),function(t,e){return n._loadStatus.loaded=0,n._loadStatus.total=0,e&&(n._mesh=e.object,n._loadStatus.loaded+=e.loaded.loaded,n._loadStatus.total+=e.loaded.total),t&&(n._image=t.object,n._loadStatus.loaded+=t.loaded.loaded,n._loadStatus.total+=t.loaded.total),n}).finally(function(){n._cachingAssets$=null}).publishReplay(1).refCount(),this._cachingAssets$},t.prototype.cacheImage$=function(t,e){var r=this;return null!=this._image&&e<=Math.max(this._image.width,this._image.height)?i.Observable.of(this):this._cacheImage$(t,e).first(function(t){return null!=t.object}).do(function(t){r._disposeImage(),r._image=t.object}).map(function(t){return r})},t.prototype.cacheSequenceEdges=function(t){this._sequenceEdges={cached:!0,edges:t},this._sequenceEdgesChanged$.next(this._sequenceEdges)},t.prototype.cacheSpatialEdges=function(t){this._spatialEdges={cached:!0,edges:t},this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype.dispose=function(){this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges),this._disposed=!0,null!=this._imageRequest&&this._imageRequest.abort(),null!=this._meshRequest&&this._meshRequest.abort()},t.prototype.resetSequenceEdges=function(){this._sequenceEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges)},t.prototype.resetSpatialEdges=function(){this._spatialEdges={cached:!1,edges:[]},this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype._cacheImage$=function(t,e){var r=this;return i.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",s.Urls.thumbnail(t,e),!0),i.responseType="arraybuffer",i.timeout=15e3,i.onload=function(e){if(200!==i.status)return r._imageRequest=null,void n.error(new Error("Failed to fetch image ("+t+"). Status: "+i.status+", "+i.statusText));var o=new Image;o.crossOrigin="Anonymous",o.onload=function(i){if(r._imageRequest=null,r._disposed)return window.URL.revokeObjectURL(o.src),void n.error(new Error("Image load was aborted ("+t+")"));n.next({loaded:{loaded:e.loaded,total:e.total},object:o}),n.complete()},o.onerror=function(e){r._imageRequest=null,n.error(new Error("Failed to load image ("+t+")"))};var s=new Blob([i.response]);o.src=window.URL.createObjectURL(s)},i.onprogress=function(t){r._disposed||n.next({loaded:{loaded:t.loaded,total:t.total},object:null})},i.onerror=function(e){r._imageRequest=null,n.error(new Error("Failed to fetch image ("+t+")"))},i.ontimeout=function(e){r._imageRequest=null,n.error(new Error("Image request timed out ("+t+")"))},i.onabort=function(e){r._imageRequest=null,n.error(new Error("Image request was aborted ("+t+")"))},r._imageRequest=i,i.send(null)})},t.prototype._cacheMesh$=function(t,r){var n=this;return i.Observable.create(function(i){if(!r)return i.next(n._createEmptyMeshLoadStatus()),void i.complete();var a=new XMLHttpRequest;a.open("GET",s.Urls.protoMesh(t),!0),a.responseType="arraybuffer",a.timeout=15e3,a.onload=function(t){if(n._meshRequest=null,!n._disposed){var r=200===a.status?o.MeshReader.read(new e(a.response)):{faces:[],vertices:[]};i.next({loaded:{loaded:t.loaded,total:t.total},object:r}),i.complete()}},a.onprogress=function(t){n._disposed||i.next({loaded:{loaded:t.loaded,total:t.total},object:null})},a.onerror=function(e){n._meshRequest=null,console.error("Failed to cache mesh ("+t+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},a.ontimeout=function(e){n._meshRequest=null,console.error("Mesh request timed out ("+t+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},a.onabort=function(e){n._meshRequest=null,i.error(new Error("Mesh request was aborted ("+t+")"))},n._meshRequest=a,a.send(null)})},t.prototype._createEmptyMeshLoadStatus=function(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}},t.prototype._disposeImage=function(){null!=this._image&&window.URL.revokeObjectURL(this._image.src),this._image=null},t}();r.NodeCache=a,r.default=a}).call(this,t("buffer").Buffer)},{"../Graph":230,"../Utils":235,buffer:7,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/publishReplay":72}],319:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=function(){function t(t){this._key=t.key,this._keys=t.keys}return Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keys",{get:function(){return this._keys},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._key=null,this._keys=null},t.prototype.findNextKey=function(t){var e=n.indexOf(this._keys,t);return e+1>=this._keys.length||-1===e?null:this._keys[e+1]},t.prototype.findPrevKey=function(t){var e=n.indexOf(this._keys,t);return 0===e||-1===e?null:this._keys[e-1]},t}();r.Sequence=i,r.default=i},{underscore:178}],320:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../../Edge"),o=t("../../Error"),s=t("../../Geo"),a=function(){function t(t,e,r){this._spatial=new s.Spatial,this._geoCoords=new s.GeoCoords,this._settings=null!=t?t:new i.EdgeCalculatorSettings,this._directions=null!=e?e:new i.EdgeCalculatorDirections,this._coefficients=null!=r?r:new i.EdgeCalculatorCoefficients}return t.prototype.getPotentialEdges=function(t,e,r){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(!t.merged)return[];for(var i=this._spatial.viewingDirection(t.rotation),s=this._spatial.angleToPlane(i.toArray(),[0,0,1]),a=[],c=0,u=e;c<u.length;c++){var h=u[c];if(h.merged&&h.key!==t.key){var l=this._geoCoords.geodeticToEnu(h.latLon.lat,h.latLon.lon,h.alt,t.latLon.lat,t.latLon.lon,t.alt),p=new n.Vector3(l[0],l[1],l[2]),f=p.length();if(!(f>this._settings.maxDistance&&r.indexOf(h.key)<0)){var d=this._spatial.angleBetweenVector2(i.x,i.y,p.x,p.y),m=this._spatial.angleToPlane(p.toArray(),[0,0,1]),v=this._spatial.viewingDirection(h.rotation),g=this._spatial.angleBetweenVector2(i.x,i.y,v.x,v.y),y=this._spatial.angleToPlane(v.toArray(),[0,0,1])-s,b=this._spatial.relativeRotationAngle(t.rotation,h.rotation),_=this._spatial.angleBetweenVector2(1,0,p.x,p.y),x=null!=h.sequenceKey&&null!=t.sequenceKey&&h.sequenceKey===t.sequenceKey,w=null==h.mergeCC&&null==t.mergeCC||h.mergeCC===t.mergeCC,S=h.userKey===t.userKey,M={capturedAt:h.capturedAt,croppedPano:h.pano&&!h.fullPano,directionChange:g,distance:f,fullPano:h.fullPano,key:h.key,motionChange:d,rotation:b,sameMergeCC:w,sameSequence:x,sameUser:S,sequenceKey:h.sequenceKey,verticalDirectionChange:y,verticalMotion:m,worldMotionAzimuth:_};a.push(M)}}}return a},t.prototype.computeSequenceEdges=function(t,e){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(t.sequenceKey!==e.key)throw new o.ArgumentMapillaryError("Node and sequence does not correspond.");var r=[],n=e.findNextKey(t.key);null!=n&&r.push({data:{direction:i.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:t.key,to:n});var s=e.findPrevKey(t.key);return null!=s&&r.push({data:{direction:i.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:t.key,to:s}),r},t.prototype.computeSimilarEdges=function(t,e){var r=this;if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");for(var n=t.fullPano,s={},a=0,c=e;a<c.length;a++)if(null!=(v=c[a]).sequenceKey&&!v.sameSequence&&v.sameMergeCC){if(n){if(!v.fullPano)continue}else if(!v.fullPano&&Math.abs(v.directionChange)>this._settings.similarMaxDirectionChange)continue;v.distance>this._settings.similarMaxDistance||v.sameUser&&Math.abs(v.capturedAt-t.capturedAt)<this._settings.similarMinTimeDifference||(null==s[v.sequenceKey]&&(s[v.sequenceKey]=[]),s[v.sequenceKey].push(v))}var u=[],h=t.fullPano?function(t){return t.distance}:function(t){return r._coefficients.similarDistance*t.distance+r._coefficients.similarRotation*t.rotation};for(var l in s)if(s.hasOwnProperty(l)){for(var p=Number.MAX_VALUE,f=null,d=0,m=s[l];d<m.length;d++){var v=m[d],g=h(v);g<p&&(p=g,f=v)}null!=f&&u.push(f)}return u.map(function(e){return{data:{direction:i.EdgeDirection.Similar,worldMotionAzimuth:e.worldMotionAzimuth},from:t.key,to:e.key}})},t.prototype.computeStepEdges=function(t,e,r,n){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");var i=[];if(t.pano)return i;for(var s in this._directions.steps)if(this._directions.steps.hasOwnProperty(s)){for(var a=this._directions.steps[s],c=Number.MAX_VALUE,u=null,h=null,l=0,p=e;l<p.length;l++){var f=p[l];if(!f.croppedPano&&!f.fullPano&&!(Math.abs(f.directionChange)>this._settings.stepMaxDirectionChange)){var d=this._spatial.angleDifference(a.motionChange,f.motionChange),m=this._spatial.angleDifference(f.directionChange,d),v=Math.max(Math.abs(d),Math.abs(m));if(!(Math.abs(v)>this._settings.stepMaxDrift)){var g=f.key;if(!a.useFallback||g!==r&&g!==n||(h=f),!(f.distance>this._settings.stepMaxDistance)){d=Math.sqrt(d*d+f.verticalMotion*f.verticalMotion);var y=this._coefficients.stepPreferredDistance*Math.abs(f.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*d/this._settings.stepMaxDrift+this._coefficients.stepRotation*f.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(f.sameSequence?0:1)+this._coefficients.stepMergeCCPenalty*(f.sameMergeCC?0:1);y<c&&(c=y,u=f)}}}}null!=(u=null==u?h:u)&&i.push({data:{direction:a.direction,worldMotionAzimuth:u.worldMotionAzimuth},from:t.key,to:u.key})}return i},t.prototype.computeTurnEdges=function(t,e){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");var r=[];if(t.pano)return r;for(var n in this._directions.turns)if(this._directions.turns.hasOwnProperty(n)){for(var s=this._directions.turns[n],a=Number.MAX_VALUE,c=null,u=0,h=e;u<h.length;u++){var l=h[u];if(!l.croppedPano&&!l.fullPano&&!(l.distance>this._settings.turnMaxDistance)){var p=s.direction!==i.EdgeDirection.TurnU&&l.distance<this._settings.turnMaxRigDistance&&Math.abs(l.directionChange)>this._settings.turnMinRigDirectionChange,f=this._spatial.angleDifference(s.directionChange,l.directionChange),d=void 0;if(p&&l.directionChange*s.directionChange>0&&Math.abs(l.directionChange)<Math.abs(s.directionChange))d=-Math.PI/2+Math.abs(l.directionChange);else{if(Math.abs(f)>this._settings.turnMaxDirectionChange)continue;var m=s.motionChange?this._spatial.angleDifference(s.motionChange,l.motionChange):0;m=Math.sqrt(m*m+l.verticalMotion*l.verticalMotion),d=this._coefficients.turnDistance*l.distance/this._settings.turnMaxDistance+this._coefficients.turnMotion*m/Math.PI+this._coefficients.turnSequencePenalty*(l.sameSequence?0:1)+this._coefficients.turnMergeCCPenalty*(l.sameMergeCC?0:1)}d<a&&(a=d,c=l)}}null!=c&&r.push({data:{direction:s.direction,worldMotionAzimuth:c.worldMotionAzimuth},from:t.key,to:c.key})}return r},t.prototype.computePerspectiveToPanoEdges=function(t,e){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(t.pano)return[];for(var r=Number.MAX_VALUE,n=null,s=0,a=e;s<a.length;s++){var c=a[s];if(c.fullPano){var u=this._coefficients.panoPreferredDistance*Math.abs(c.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(c.motionChange)/Math.PI+this._coefficients.panoMergeCCPenalty*(c.sameMergeCC?0:1);u<r&&(r=u,n=c)}}return null==n?[]:[{data:{direction:i.EdgeDirection.Pano,worldMotionAzimuth:n.worldMotionAzimuth},from:t.key,to:n.key}]},t.prototype.computePanoEdges=function(t,e){if(!t.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(!t.fullPano)return[];for(var r=[],n=[],s=[],a=0,c=e;a<c.length;a++)if(!((w=c[a]).distance>this._settings.panoMaxDistance))if(w.fullPano){if(w.distance<this._settings.panoMinDistance)continue;n.push(w)}else{if(w.croppedPano)continue;for(var u in this._directions.panos)if(this._directions.panos.hasOwnProperty(u)){var h=this._directions.panos[u],l=this._spatial.angleDifference(w.directionChange,w.motionChange),p=this._spatial.angleDifference(h.directionChange,l);if(!(Math.abs(p)>this._settings.panoMaxStepTurnChange)){s.push([h.direction,w]);break}}}for(var f=Math.PI/this._settings.panoMaxItems,d=[],m=[],v=0;v<this._settings.panoMaxItems;v++){for(var g=v/this._settings.panoMaxItems*2*Math.PI,y=Number.MAX_VALUE,b=null,_=0,x=n;_<x.length;_++){var w=x[_],S=this._spatial.angleDifference(g,w.motionChange);if(!(Math.abs(S)>f)){for(var M=Number.MAX_VALUE,E=0,T=d;E<T.length;E++){var C=T[E],O=Math.abs(this._spatial.angleDifference(C,w.motionChange));O<M&&(M=O)}M<=f||(z=this._coefficients.panoPreferredDistance*Math.abs(w.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(S)/f+this._coefficients.panoSequencePenalty*(w.sameSequence?0:1)+this._coefficients.panoMergeCCPenalty*(w.sameMergeCC?0:1))<y&&(y=z,b=w)}}null!=b?(d.push(b.motionChange),r.push({data:{direction:i.EdgeDirection.Pano,worldMotionAzimuth:b.worldMotionAzimuth},from:t.key,to:b.key})):m.push(g)}var P={};P[i.EdgeDirection.Pano]=d,P[i.EdgeDirection.StepForward]=[],P[i.EdgeDirection.StepLeft]=[],P[i.EdgeDirection.StepBackward]=[],P[i.EdgeDirection.StepRight]=[];for(var A=0,j=m;A<j.length;A++){var R=j[A],L=[];for(var u in this._directions.panos)if(this._directions.panos.hasOwnProperty(u)){for(var h=this._directions.panos[u],N=P[i.EdgeDirection.Pano].concat(P[h.direction]).concat(P[h.prev]).concat(P[h.next]),y=Number.MAX_VALUE,b=null,I=0,D=s;I<D.length;I++)if((w=D[I])[0]===h.direction){var k=this._spatial.angleDifference(R,w[1].motionChange);if(!(Math.abs(k)>f)){for(var F=Number.MAX_VALUE,B=0,U=N;B<U.length;B++){C=U[B];(M=Math.abs(this._spatial.angleDifference(C,w[1].motionChange)))<F&&(F=M)}if(!(F<=f)){var z=this._coefficients.panoPreferredDistance*Math.abs(w[1].distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(k)/f+this._coefficients.panoMergeCCPenalty*(w[1].sameMergeCC?0:1);z<y&&(y=z,b=w)}}}null!=b&&(L.push(b),r.push({data:{direction:b[0],worldMotionAzimuth:b[1].worldMotionAzimuth},from:t.key,to:b[1].key}))}for(var G=0,$=L;G<$.length;G++){var V=$[G];P[V[0]].push(V[1].motionChange)}}return r},t}();r.EdgeCalculator=a,r.default=a},{"../../Edge":227,"../../Error":228,"../../Geo":229,three:176}],321:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return function(){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}}();r.EdgeCalculatorCoefficients=n,r.default=n},{}],322:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../Edge"),i=function(){return function(){this.steps={},this.turns={},this.panos={},this.steps[n.EdgeDirection.StepForward]={direction:n.EdgeDirection.StepForward,motionChange:0,useFallback:!0},this.steps[n.EdgeDirection.StepBackward]={direction:n.EdgeDirection.StepBackward,motionChange:Math.PI,useFallback:!0},this.steps[n.EdgeDirection.StepLeft]={direction:n.EdgeDirection.StepLeft,motionChange:Math.PI/2,useFallback:!1},this.steps[n.EdgeDirection.StepRight]={direction:n.EdgeDirection.StepRight,motionChange:-Math.PI/2,useFallback:!1},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}}}();r.EdgeCalculatorDirections=i},{"../../Edge":227}],323:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){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=432e5,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}return Object.defineProperty(t.prototype,"maxDistance",{get:function(){return Math.max(this.panoMaxDistance,this.similarMaxDistance,this.stepMaxDistance,this.turnMaxDistance)},enumerable:!0,configurable:!0}),t}();r.EdgeCalculatorSettings=n,r.default=n},{}],324:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!function(t){t[t.Next=0]="Next",t[t.Prev=1]="Prev",t[t.StepLeft=2]="StepLeft",t[t.StepRight=3]="StepRight",t[t.StepForward=4]="StepForward",t[t.StepBackward=5]="StepBackward",t[t.TurnLeft=6]="TurnLeft",t[t.TurnRight=7]="TurnRight",t[t.TurnU=8]="TurnU",t[t.Pano=9]="Pano",t[t.Similar=10]="Similar"}(r.EdgeDirection||(r.EdgeDirection={}))},{}],325:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=t("virtual-dom"),o=t("rxjs/Subject");t("rxjs/add/operator/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/pluck"),t("rxjs/add/operator/scan");var s=t("../Render"),a=function(){function t(t,e,r){this._adaptiveOperation$=new o.Subject,this._render$=new o.Subject,this._renderAdaptive$=new o.Subject,this._renderService=e,this._currentFrame$=r;var a=i.create(i.h("div.domRenderer",[]));t.appendChild(a),this._offset$=this._adaptiveOperation$.scan(function(t,e){return e(t)},{elementHeight:t.offsetHeight,elementWidth:t.offsetWidth,imageAspect:0,renderMode:s.RenderMode.Fill}).filter(function(t){return t.imageAspect>0&&t.elementWidth>0&&t.elementHeight>0}).map(function(t){var e=t.elementWidth/t.elementHeight,r=t.imageAspect/e,n=0,i=0;return t.renderMode===s.RenderMode.Letterbox?t.imageAspect>e?n=t.elementHeight*(1-1/r)/2:i=t.elementWidth*(1-r)/2:t.imageAspect>e?i=-t.elementWidth*(r-1)/2:n=-t.elementHeight*(1/r-1)/2,{bottom:n,left:i,right:i,top:n}}),this._currentFrame$.filter(function(t){return null!=t.state.currentNode}).distinctUntilChanged(function(t,e){return t===e},function(t){return t.state.currentNode.key}).map(function(t){return t.state.currentTransform.basicAspect}).map(function(t){return function(e){return e.imageAspect=t,e}}).subscribe(this._adaptiveOperation$),this._renderAdaptive$.scan(function(t,e){return null==e.vnode?delete t[e.name]:t[e.name]=e.vnode,t},{}).combineLatest(this._offset$).map(function(t){var e=n.values(t[0]),r=t[1],o={style:{bottom:r.bottom+"px",left:r.left+"px","pointer-events":"none",position:"absolute",right:r.right+"px",top:r.top+"px"}};return{name:"adaptiveDomRenderer",vnode:i.h("div.adaptiveDomRenderer",o,e)}}).subscribe(this._render$),this._vNode$=this._render$.scan(function(t,e){return null==e.vnode?delete t[e.name]:t[e.name]=e.vnode,t},{}).map(function(t){var e=n.values(t);return i.h("div.domRenderer",e)}),this._vPatch$=this._vNode$.scan(function(t,e){return t.vpatch=i.diff(t.vnode,e),t.vnode=e,t},{vnode:i.h("div.domRenderer",[]),vpatch:null}).pluck("vpatch"),this._element$=this._vPatch$.scan(function(t,e){return i.patch(t,e)},a).publishReplay(1).refCount(),this._element$.subscribe(function(){}),this._renderService.size$.map(function(t){return function(e){return e.elementWidth=t.width,e.elementHeight=t.height,e}}).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.map(function(t){return function(e){return e.renderMode=t,e}}).subscribe(this._adaptiveOperation$)}return Object.defineProperty(t.prototype,"element$",{get:function(){return this._element$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderAdaptive$",{get:function(){return this._renderAdaptive$},enumerable:!0,configurable:!0}),t.prototype.clear=function(t){this._renderAdaptive$.next({name:t,vnode:null}),this._render$.next({name:t,vnode:null})},t}();r.DOMRenderer=a,r.default=a},{"../Render":232,"rxjs/Subject":34,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":73,underscore:178,"virtual-dom":182}],326:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Background=0]="Background",t[t.Foreground=1]="Foreground"}(n=r.GLRenderStage||(r.GLRenderStage={})),r.default=n},{}],327:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share"),t("rxjs/add/operator/startWith");var s=t("../Render"),a=function(){function t(t,e){var r=this;this._renderFrame$=new o.Subject,this._renderCameraOperation$=new o.Subject,this._render$=new o.Subject,this._clear$=new o.Subject,this._renderOperation$=new o.Subject,this._rendererOperation$=new o.Subject,this._eraserOperation$=new o.Subject,this._renderService=e,this._renderer$=this._rendererOperation$.scan(function(t,e){return e(t)},{needsRender:!1,renderer:null}),this._renderCollection$=this._renderOperation$.scan(function(t,e){return e(t)},{}).share(),this._renderCamera$=this._renderCameraOperation$.scan(function(t,e){return e(t)},{frameId:-1,needsRender:!1,perspective:null}),this._eraser$=this._eraserOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},{needsRender:!1}),i.Observable.combineLatest([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],function(t,e,r,n){return{camera:r,eraser:n,renderer:t,renders:Object.keys(e).map(function(t){return e[t]})}}).filter(function(t){for(var e=t.renderer.needsRender||t.camera.needsRender||t.eraser.needsRender,r=t.camera.frameId,n=0,i=t.renders;n<i.length;n++){var o=i[n];if(o.frameId!==r)return!1;e=e||o.needsRender}return e}).distinctUntilChanged(function(t,e){return t===e},function(t){return t.eraser.needsRender?-1:t.camera.frameId}).subscribe(function(t){t.renderer.needsRender=!1,t.camera.needsRender=!1,t.eraser.needsRender=!1;for(var e=t.camera.perspective,r=[],n=[],i=0,o=t.renders;i<o.length;i++)(p=o[i]).stage===s.GLRenderStage.Background?r.push(p.render):p.stage===s.GLRenderStage.Foreground&&n.push(p.render);var a=t.renderer.renderer;a.clear();for(var c=0,u=r;c<u.length;c++)(p=u[c])(e,a);a.clearDepth();for(var h=0,l=n;h<l.length;h++){var p=l[h];p(e,a)}}),this._renderFrame$.map(function(t){return function(e){return e.frameId=t.frameId,e.perspective=t.perspective,!0===t.changed&&(e.needsRender=!0),e}}).subscribe(this._renderCameraOperation$),this._renderFrameSubscribe();var a=this._render$.map(function(t){return function(e){return e[t.name]=t.render,e}}),c=this._clear$.map(function(t){return function(e){return delete e[t],e}});i.Observable.merge(a,c).subscribe(this._renderOperation$),this._webGLRenderer$=this._render$.first().map(function(r){var i=e.element,o=new n.WebGLRenderer;return o.setPixelRatio(window.devicePixelRatio),o.setSize(i.offsetWidth,i.offsetHeight),o.setClearColor(new n.Color(2105376),1),o.autoClear=!1,o.domElement.style.position="absolute",t.appendChild(o.domElement),o}).publishReplay(1).refCount(),this._webGLRenderer$.subscribe(function(){});var u=this._webGLRenderer$.first().map(function(t){return function(e){return e.needsRender=!0,e.renderer=t,e}}),h=this._renderService.size$.map(function(t){return function(e){return null==e.renderer?e:(e.renderer.setSize(t.width,t.height),e.needsRender=!0,e)}}),l=this._clear$.map(function(t){return function(t){return null==t.renderer?t:(t.needsRender=!0,t)}});i.Observable.merge(u,h,l).subscribe(this._rendererOperation$);var p=this._renderCollection$.filter(function(t){return 0===Object.keys(t).length}).share();p.subscribe(function(t){null!=r._renderFrameSubscription&&(r._renderFrameSubscription.unsubscribe(),r._renderFrameSubscription=null,r._renderFrameSubscribe())}),p.map(function(t){return function(t){return t.needsRender=!0,t}}).subscribe(this._eraserOperation$)}return Object.defineProperty(t.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"webGLRenderer$",{get:function(){return this._webGLRenderer$},enumerable:!0,configurable:!0}),t.prototype.clear=function(t){this._clear$.next(t)},t.prototype._renderFrameSubscribe=function(){var t=this;this._render$.first().map(function(t){return function(t){return t.needsRender=!0,t}}).subscribe(function(e){t._renderCameraOperation$.next(e)}),this._renderFrameSubscription=this._render$.first().mergeMap(function(e){return t._renderService.renderCameraFrame$}).subscribe(this._renderFrame$)},t}();r.GLRenderer=a,r.default=a},{"../Render":232,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/scan":73,"rxjs/add/operator/share":74,"rxjs/add/operator/startWith":78,three:176}],328:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../Geo"),o=t("../Render"),s=function(){function t(t,e,r){this.alpha=-1,this.zoom=0,this._frameId=-1,this._changed=!1,this._changedForFrame=-1,this.currentAspect=1,this.currentPano=!1,this.previousAspect=1,this.previousPano=!1,this.renderMode=r,this._spatial=new i.Spatial,this._camera=new i.Camera;var o=this._getPerspectiveCameraAspect(t,e);this._perspective=new n.PerspectiveCamera(50,o,.4,1e4),this._perspective.matrixAutoUpdate=!1,this._rotation={phi:0,theta:0}}return Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"changed",{get:function(){return this.frameId===this._changedForFrame},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"frameId",{get:function(){return this._frameId},set:function(t){this._frameId=t,this._changed&&(this._changed=!1,this._changedForFrame=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"perspective",{get:function(){return this._perspective},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},enumerable:!0,configurable:!0}),t.prototype.updateAspect=function(t,e){var r=this._getPerspectiveCameraAspect(t,e);this._perspective.aspect=r,this._changed=!0},t.prototype.updateProjection=function(){var t=this._getAspect(this.currentAspect,this.currentPano,this.perspective.aspect),e=this._getAspect(this.previousAspect,this.previousPano,this.perspective.aspect),r=(1-this.alpha)*e+this.alpha*t,n=this._getVerticalFov(r,this._camera.focal,this.zoom);this._perspective.fov=n,this._perspective.updateProjectionMatrix(),this._changed=!0},t.prototype.updatePerspective=function(t){this._perspective.up.copy(t.up),this._perspective.position.copy(t.position),this._perspective.lookAt(t.lookat),this._perspective.updateMatrix(),this._perspective.updateMatrixWorld(!1),this._changed=!0},t.prototype.updateRotation=function(t){this._rotation=this._getRotation(t)},t.prototype._getVerticalFov=function(t,e,r){return 2*Math.atan(.5/(Math.pow(2,r)*t*e))*180/Math.PI},t.prototype._getAspect=function(t,e,r){if(e)return 1;var n=Math.max(1,1/t);return(this.renderMode===o.RenderMode.Letterbox?t>r:t<r)?n*r:n*t},t.prototype._getPerspectiveCameraAspect=function(t,e){return 0===t?0:t/e},t.prototype._getRotation=function(t){var e=t.lookat.clone().sub(t.position),r=t.up.clone(),n=e.clone().dot(r),i=e.clone().sub(r.clone().multiplyScalar(n));return{phi:Math.atan2(i.y,i.x),theta:Math.PI/2-this._spatial.angleToPlane(e.toArray(),[0,0,1])}},t}();r.RenderCamera=s,r.default=s},{"../Geo":229,"../Render":232,three:176}],329:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Letterbox=0]="Letterbox",t[t.Fill=1]="Fill"}(n=r.RenderMode||(r.RenderMode={})),r.default=n},{}],330:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Subject"),i=t("rxjs/BehaviorSubject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/do"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/skip"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/withLatestFrom");var o=t("../Geo"),s=t("../Render"),a=function(){function t(t,e,r){var a=this;this._element=t,this._currentFrame$=e,this._spatial=new o.Spatial,r=null!=r?r:s.RenderMode.Fill,this._resize$=new n.Subject,this._renderCameraOperation$=new n.Subject,this._size$=new i.BehaviorSubject({height:this._element.offsetHeight,width:this._element.offsetWidth}),this._resize$.map(function(){return{height:a._element.offsetHeight,width:a._element.offsetWidth}}).subscribe(this._size$),this._renderMode$=new i.BehaviorSubject(r),this._renderCameraHolder$=this._renderCameraOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},new s.RenderCamera(this._element.offsetWidth,this._element.offsetHeight,r)).publishReplay(1).refCount(),this._renderCameraFrame$=this._currentFrame$.withLatestFrom(this._renderCameraHolder$,function(t,e){return[t,e]}).do(function(t){var e=t[0],r=t[1],n=e.state.camera;if(r.alpha!==e.state.alpha||r.zoom!==e.state.zoom||r.camera.diff(n)>1e-9){var i=e.state.currentTransform,o=null!=e.state.previousTransform?e.state.previousTransform:e.state.currentTransform,s=null!=e.state.previousNode?e.state.previousNode:e.state.currentNode;r.currentAspect=i.basicAspect,r.currentPano=e.state.currentNode.pano,r.previousAspect=o.basicAspect,r.previousPano=s.pano,r.alpha=e.state.alpha,r.zoom=e.state.zoom,r.camera.copy(n),r.updatePerspective(n),r.updateRotation(n),r.updateProjection()}r.frameId=e.id}).map(function(t){return t[1]}).publishReplay(1).refCount(),this._renderCamera$=this._renderCameraFrame$.filter(function(t){return t.changed}).publishReplay(1).refCount(),this._bearing$=this._renderCamera$.map(function(t){var e=a._spatial.radToDeg(a._spatial.azimuthalToBearing(t.rotation.phi));return a._spatial.wrap(e,0,360)}).publishReplay(1).refCount(),this._size$.skip(1).map(function(t){return function(e){return e.updateAspect(t.width,t.height),e.updateProjection(),e}}).subscribe(this._renderCameraOperation$),this._renderMode$.skip(1).map(function(t){return function(e){return e.renderMode=t,e.updateProjection(),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(){})}return Object.defineProperty(t.prototype,"bearing$",{get:function(){return this._bearing$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this._element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"resize$",{get:function(){return this._resize$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size$",{get:function(){return this._size$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderMode$",{get:function(){return this._renderMode$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderCameraFrame$",{get:function(){return this._renderCameraFrame$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderCamera$",{get:function(){return this._renderCamera$},enumerable:!0,configurable:!0}),t}();r.RenderService=a,r.default=a},{"../Geo":229,"../Render":232,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/skip":75,"rxjs/add/operator/startWith":78,"rxjs/add/operator/withLatestFrom":83}],331:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Traversing=0]="Traversing",t[t.Waiting=1]="Waiting"}(n=r.State||(r.State={})),r.default=n},{}],332:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../State"),i=t("../Geo"),o=function(){function t(){this._state=new n.TraversingState({alpha:1,camera:new i.Camera,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],zoom:0})}return t.prototype.traverse=function(){this._state=this._state.traverse()},t.prototype.wait=function(){this._state=this._state.wait()},Object.defineProperty(t.prototype,"state",{get:function(){if(this._state instanceof n.TraversingState)return n.State.Traversing;if(this._state instanceof n.WaitingState)return n.State.Waiting;throw new Error("Invalid state")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reference",{get:function(){return this._state.reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._state.alpha},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._state.camera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this._state.zoom},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._state.currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousNode",{get:function(){return this._state.previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera",{get:function(){return this._state.currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform",{get:function(){return this._state.currentTransform},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousTransform",{get:function(){return this._state.previousTransform},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trajectory",{get:function(){return this._state.trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentIndex",{get:function(){return this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastNode",{get:function(){return this._state.trajectory[this._state.trajectory.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodesAhead",{get:function(){return this._state.trajectory.length-1-this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"motionless",{get:function(){return this._state.motionless},enumerable:!0,configurable:!0}),t.prototype.getCenter=function(){return this._state.getCenter()},t.prototype.setCenter=function(t){this._state.setCenter(t)},t.prototype.setZoom=function(t){this._state.setZoom(t)},t.prototype.update=function(t){this._state.update(t)},t.prototype.append=function(t){this._state.append(t)},t.prototype.prepend=function(t){this._state.prepend(t)},t.prototype.remove=function(t){this._state.remove(t)},t.prototype.clear=function(){this._state.clear()},t.prototype.clearPrior=function(){this._state.clearPrior()},t.prototype.cut=function(){this._state.cut()},t.prototype.set=function(t){this._state.set(t)},t.prototype.rotate=function(t){this._state.rotate(t)},t.prototype.rotateBasic=function(t){this._state.rotateBasic(t)},t.prototype.rotateBasicUnbounded=function(t){this._state.rotateBasicUnbounded(t)},t.prototype.rotateToBasic=function(t){this._state.rotateToBasic(t)},t.prototype.move=function(t){this._state.move(t)},t.prototype.moveTo=function(t){this._state.moveTo(t)},t.prototype.zoomIn=function(t,e){this._state.zoomIn(t,e)},t}();r.StateContext=o},{"../Geo":229,"../State":233}],333:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Subject"),o=t("rxjs/util/AnimationFrame");t("rxjs/add/operator/bufferCount"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/do"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/pairwise"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom");var s=t("../State"),a=function(){function t(){var t=this;this._appendNode$=new i.Subject,this._start$=new i.Subject,this._frame$=new i.Subject,this._fpsSampleRate=30,this._contextOperation$=new n.BehaviorSubject(function(t){return t}),this._context$=this._contextOperation$.scan(function(t,e){return e(t)},new s.StateContext).publishReplay(1).refCount(),this._state$=this._context$.map(function(t){return t.state}).distinctUntilChanged().publishReplay(1).refCount(),this._fps$=this._start$.switchMap(function(){return t._frame$.bufferCount(1,t._fpsSampleRate).map(function(t){return(new Date).getTime()}).pairwise().map(function(e){return Math.max(20,1e3*t._fpsSampleRate/(e[1]-e[0]))}).startWith(60)}).share(),this._currentState$=this._frame$.withLatestFrom(this._fps$,this._context$,function(t,e,r){return[t,e,r]}).filter(function(t){return null!=t[2].currentNode}).do(function(t){t[2].update(t[1])}).map(function(t){return{fps:t[1],id:t[0],state:t[2]}}).share(),this._lastState$=this._currentState$.publishReplay(1).refCount();var e=this._currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).publishReplay(1).refCount(),r=new i.Subject;e.subscribe(r),this._currentKey$=new n.BehaviorSubject(null),r.map(function(t){return t.state.currentNode.key}).subscribe(this._currentKey$),this._currentNode$=r.map(function(t){return t.state.currentNode}).publishReplay(1).refCount(),this._currentCamera$=r.map(function(t){return t.state.currentCamera}).publishReplay(1).refCount(),this._currentTransform$=r.map(function(t){return t.state.currentTransform}).publishReplay(1).refCount(),this._reference$=r.map(function(t){return t.state.reference}).distinctUntilChanged(function(t,e){return t.lat===e.lat&&t.lon===e.lon},function(t){return{lat:t.lat,lon:t.lon}}).publishReplay(1).refCount(),this._currentNodeExternal$=e.map(function(t){return t.state.currentNode}).publishReplay(1).refCount(),this._appendNode$.map(function(t){return function(e){return e.append([t]),e}}).subscribe(this._contextOperation$),this._inMotionOperation$=new i.Subject,e.map(function(t){return!0}).subscribe(this._inMotionOperation$),this._inMotionOperation$.distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._currentState$.filter(function(t){return 0===t.state.nodesAhead}).map(function(t){return[t.state.camera.clone(),t.state.zoom]}).pairwise().map(function(t){var e=t[0][0],r=t[1][0],n=t[0][1],i=t[1][1];return e.diff(r)>1e-5||Math.abs(n-i)>1e-5}).first(function(t){return!t})}).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._inTranslationOperation$=new i.Subject,e.map(function(t){return!0}).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.distinctUntilChanged().filter(function(t){return t}).switchMap(function(e){return t._currentState$.filter(function(t){return 0===t.state.nodesAhead}).map(function(t){return t.state.camera.position.clone()}).pairwise().map(function(t){return 0!==t[0].distanceToSquared(t[1])}).first(function(t){return!t})}).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.distinctUntilChanged().publishReplay(1).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 o.RequestAnimationFrameDefinition(window)}return Object.defineProperty(t.prototype,"currentState$",{get:function(){return this._currentState$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode$",{get:function(){return this._currentNode$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentKey$",{get:function(){return this._currentKey$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNodeExternal$",{get:function(){return this._currentNodeExternal$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera$",{get:function(){return this._currentCamera$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform$",{get:function(){return this._currentTransform$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state$",{get:function(){return this._state$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reference$",{get:function(){return this._reference$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inMotion$",{get:function(){return this._inMotion$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inTranslation$",{get:function(){return this._inTranslation$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appendNode$",{get:function(){return this._appendNode$},enumerable:!0,configurable:!0}),t.prototype.traverse=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.traverse()})},t.prototype.wait=function(){this._invokeContextOperation(function(t){t.wait()})},t.prototype.appendNodes=function(t){this._invokeContextOperation(function(e){e.append(t)})},t.prototype.prependNodes=function(t){this._invokeContextOperation(function(e){e.prepend(t)})},t.prototype.removeNodes=function(t){this._invokeContextOperation(function(e){e.remove(t)})},t.prototype.clearNodes=function(){this._invokeContextOperation(function(t){t.clear()})},t.prototype.clearPriorNodes=function(){this._invokeContextOperation(function(t){t.clearPrior()})},t.prototype.cutNodes=function(){this._invokeContextOperation(function(t){t.cut()})},t.prototype.setNodes=function(t){this._invokeContextOperation(function(e){e.set(t)})},t.prototype.rotate=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotate(t)})},t.prototype.rotateBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasic(t)})},t.prototype.rotateBasicUnbounded=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasicUnbounded(t)})},t.prototype.rotateToBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateToBasic(t)})},t.prototype.move=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.move(t)})},t.prototype.moveTo=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.moveTo(t)})},t.prototype.zoomIn=function(t,e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(r){r.zoomIn(t,e)})},t.prototype.getCenter=function(){return this._lastState$.first().map(function(t){return t.state.getCenter()})},t.prototype.getZoom=function(){return this._lastState$.first().map(function(t){return t.state.zoom})},t.prototype.setCenter=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setCenter(t)})},t.prototype.setZoom=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setZoom(t)})},t.prototype.start=function(){null==this._frameId&&(this._start$.next(null),this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId))},t.prototype.stop=function(){null!=this._frameId&&(this._frameGenerator.cancelAnimationFrame(this._frameId),this._frameId=null)},t.prototype._invokeContextOperation=function(t){this._contextOperation$.next(function(e){return t(e),e})},t.prototype._frame=function(t){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)},t}();r.StateService=a},{"../State":233,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/bufferCount":50,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83,"rxjs/util/AnimationFrame":157}],334:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../../Error"),i=t("../../Geo"),o=function(){function t(t){this._spatial=new i.Spatial,this._geoCoords=new i.GeoCoords,this._referenceThreshold=.01,this._reference=t.reference,this._alpha=t.alpha,this._camera=t.camera.clone(),this._zoom=t.zoom,this._currentIndex=t.currentIndex,this._trajectory=t.trajectory.slice(),this._trajectoryTransforms=[],this._trajectoryCameras=[];for(var e=0,r=this._trajectory;e<r.length;e++){var n=r[e],o=this._nodeToTranslation(n),s=new i.Transform(n,n.image,o);this._trajectoryTransforms.push(s),this._trajectoryCameras.push(new i.Camera(s))}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 i.Camera,this._previousCamera=this._trajectoryCameras.length>1&&this.currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}return Object.defineProperty(t.prototype,"reference",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._getAlpha()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this._zoom},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trajectory",{get:function(){return this._trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentIndex",{get:function(){return this._currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousNode",{get:function(){return this._previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentCamera",{get:function(){return this._currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTransform",{get:function(){return this._trajectoryTransforms.length>0?this._trajectoryTransforms[this.currentIndex]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousTransform",{get:function(){return this._trajectoryTransforms.length>1&&this.currentIndex>0?this._trajectoryTransforms[this.currentIndex-1]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"motionless",{get:function(){return this._motionless},enumerable:!0,configurable:!0}),t.prototype.append=function(t){if(t.length<1)throw Error("Trajectory can not be empty");this._currentIndex<0?this.set(t):(this._trajectory=this._trajectory.concat(t),this._appendToTrajectories(t))},t.prototype.prepend=function(t){if(t.length<1)throw Error("Trajectory can not be empty");this._trajectory=t.slice().concat(this._trajectory),this._currentIndex+=t.length,this._setCurrentNode(),this._setReference(this._currentNode)?this._setTrajectories():this._prependToTrajectories(t),this._setCurrentCamera()},t.prototype.remove=function(t){if(t<0)throw Error("n must be a positive integer");if(this._currentIndex-1<t)throw Error("Current and previous nodes can not be removed");for(var e=0;e<t;e++)this._trajectory.shift(),this._trajectoryTransforms.shift(),this._trajectoryCameras.shift(),this._currentIndex--;this._setCurrentNode()},t.prototype.clearPrior=function(){this._currentIndex>0&&this.remove(this._currentIndex-1)},t.prototype.clear=function(){this.cut(),this._currentIndex>0&&this.remove(this._currentIndex-1)},t.prototype.cut=function(){for(;this._trajectory.length-1>this._currentIndex;)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()},t.prototype.set=function(t){this._setTrajectory(t),this._setCurrentNode(),this._setReference(this._currentNode),this._setTrajectories(),this._setCurrentCamera()},t.prototype.getCenter=function(){return null!=this._currentNode?this.currentTransform.projectBasic(this._camera.lookat.toArray()):[.5,.5]},t.prototype._setCurrent=function(){this._setCurrentNode(),this._setReference(this._currentNode)&&this._setTrajectories(),this._setCurrentCamera()},t.prototype._setCurrentCamera=function(){this._currentCamera=this._trajectoryCameras[this._currentIndex].clone(),this._previousCamera=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()},t.prototype._motionlessTransition=function(){return null!=this._currentNode&&null!=this._previousNode&&!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent())},t.prototype._setReference=function(t){return!(Math.abs(t.latLon.lat-this.reference.lat)<this._referenceThreshold&&Math.abs(t.latLon.lon-this.reference.lon)<this._referenceThreshold)&&(!(null!=this._previousNode&&!this._motionlessTransition())&&(this._reference.lat=t.latLon.lat,this._reference.lon=t.latLon.lon,this._reference.alt=t.alt,!0))},t.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},t.prototype._setTrajectory=function(t){if(t.length<1)throw new n.ArgumentMapillaryError("Trajectory can not be empty");null!=this._currentNode?(this._trajectory=[this._currentNode].concat(t),this._currentIndex=1):(this._trajectory=t.slice(),this._currentIndex=0)},t.prototype._setTrajectories=function(){this._trajectoryTransforms.length=0,this._trajectoryCameras.length=0,this._appendToTrajectories(this._trajectory)},t.prototype._appendToTrajectories=function(t){for(var e=0,r=t;e<r.length;e++){var o=r[e];if(!o.assetsCached)throw new n.ArgumentMapillaryError("Assets must be cached when node is added to trajectory");var s=this._nodeToTranslation(o),a=new i.Transform(o,o.image,s);this._trajectoryTransforms.push(a),this._trajectoryCameras.push(new i.Camera(a))}},t.prototype._prependToTrajectories=function(t){for(var e=0,r=t.reverse();e<r.length;e++){var o=r[e];if(!o.assetsCached)throw new n.ArgumentMapillaryError("Assets must be cached when added to trajectory");var s=this._nodeToTranslation(o),a=new i.Transform(o,o.image,s);this._trajectoryTransforms.unshift(a),this._trajectoryCameras.unshift(new i.Camera(a))}},t.prototype._nodeToTranslation=function(t){var e=this._geoCoords.geodeticToEnu(t.latLon.lat,t.latLon.lon,t.alt,this._reference.lat,this._reference.lon,this._reference.alt),r=this._spatial.rotate(e,t.rotation);return[-r.x,-r.y,-r.z]},t.prototype._sameConnectedComponent=function(){var t=this._currentNode,e=this._previousNode;return!(t&&t.mergeCC&&e&&e.mergeCC)||t.mergeCC===e.mergeCC},t.prototype._withinOriginalDistance=function(){var t=this._currentNode,e=this._previousNode;return!t||!e||this._spatial.distanceFromLatLon(t.originalLatLon.lat,t.originalLatLon.lon,e.originalLatLon.lat,e.originalLatLon.lon)<25},t}();r.StateBase=o},{"../../Error":228,"../../Geo":229}],335:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("three"),o=t("@mapbox/unitbezier"),s=t("../../State"),a=function(){function t(t,e){this._phi=t,this._theta=e}return Object.defineProperty(t.prototype,"phi",{get:function(){return this._phi},set:function(t){this._phi=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"theta",{get:function(){return this._theta},set:function(t){this._theta=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isZero",{get:function(){return 0===this._phi&&0===this._theta},enumerable:!0,configurable:!0}),t.prototype.copy=function(t){this._phi=t.phi,this._theta=t.theta},t.prototype.lerp=function(t,e){this._phi=(1-e)*this._phi+e*t.phi,this._theta=(1-e)*this._theta+e*t.theta},t.prototype.multiply=function(t){this._phi*=t,this._theta*=t},t.prototype.threshold=function(t){this._phi=Math.abs(this._phi)>t?this._phi:0,this._theta=Math.abs(this._theta)>t?this._theta:0},t.prototype.lengthSquared=function(){return this._phi*this._phi+this._theta*this._theta},t.prototype.reset=function(){this._phi=0,this._theta=0},t}(),c=function(t){function e(e){var r=t.call(this,e)||this;return r._adjustCameras(),r._motionless=r._motionlessTransition(),r._baseAlpha=r._alpha,r._animationSpeed=.025,r._unitBezier=new o(.74,.67,.38,.96),r._useBezier=!1,r._rotationDelta=new a(0,0),r._requestedRotationDelta=null,r._basicRotation=[0,0],r._requestedBasicRotation=null,r._requestedBasicRotationUnbounded=null,r._rotationAcceleration=.86,r._rotationIncreaseAlpha=.97,r._rotationDecreaseAlpha=.9,r._rotationThreshold=.001,r._unboundedRotationAlpha=.8,r._desiredZoom=e.zoom,r._minZoom=0,r._maxZoom=3,r._lookatDepth=10,r._desiredLookat=null,r._desiredCenter=null,r}return n(e,t),e.prototype.traverse=function(){throw new Error("Not implemented")},e.prototype.wait=function(){return new s.WaitingState(this)},e.prototype.append=function(e){var r=0===this._trajectory.length;r&&this._resetTransition(),t.prototype.append.call(this,e),r&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.prepend=function(e){var r=0===this._trajectory.length;r&&this._resetTransition(),t.prototype.prepend.call(this,e),r&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.set=function(e){t.prototype.set.call(this,e),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)},e.prototype.move=function(t){throw new Error("Not implemented")},e.prototype.moveTo=function(t){throw new Error("Not implemented")},e.prototype.rotate=function(t){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedBasicRotation=null,null!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+t.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+t.theta):this._requestedRotationDelta=new a(t.phi,t.theta))},e.prototype.rotateBasic=function(t){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,null!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=t[0],this._requestedBasicRotation[1]+=t[1];var e=.05/Math.pow(2,this._zoom);this._requestedBasicRotation[0]=this._spatial.clamp(this._requestedBasicRotation[0],-e,e),this._requestedBasicRotation[1]=this._spatial.clamp(this._requestedBasicRotation[1],-e,e)}else this._requestedBasicRotation=t.slice()},e.prototype.rotateBasicUnbounded=function(t){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=t[0],this._requestedBasicRotationUnbounded[1]+=t[1]):this._requestedBasicRotationUnbounded=t.slice())},e.prototype.rotateToBasic=function(t){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,t[0]=this._spatial.clamp(t[0],0,1),t[1]=this._spatial.clamp(t[1],0,1);var e=this.currentTransform.unprojectBasic(t,this._lookatDepth);this._currentCamera.lookat.fromArray(e)}},e.prototype.zoomIn=function(t,e){if(null!=this._currentNode){this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+t));var r=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray()),n=r[0],o=r[1],s=Math.pow(2,this._zoom),a=Math.pow(2,this._desiredZoom),c=e[0],u=e[1];null!=this.currentTransform.gpano&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels&&(c-n>.5?c-=1:n-c>.5&&(c=1+c));var h=c-s/a*(c-n),l=u-s/a*(u-o),p=this.currentTransform.gpano;this._currentNode.fullPano?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),l=this._spatial.clamp(l+this._basicRotation[1],.05,.95)):null!=p&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels?(h=this._spatial.wrap(h+this._basicRotation[0],0,1),l=this._spatial.clamp(l+this._basicRotation[1],0,1)):(h=this._spatial.clamp(h,0,1),l=this._spatial.clamp(l,0,1)),this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic([h,l],this._lookatDepth))}},e.prototype.setCenter=function(t){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._desiredZoom=this._zoom;var e=[this._spatial.clamp(t[0],0,1),this._spatial.clamp(t[1],0,1)];if(null!=this._currentNode){this._desiredCenter=null;var r=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(e,this._lookatDepth)),n=null!=this.previousTransform?this.previousTransform:this.currentTransform,o=(new i.Vector3).fromArray(n.unprojectBasic(e,this._lookatDepth));this._currentCamera.lookat.copy(r),this._previousCamera.lookat.copy(o)}else this._desiredCenter=e},e.prototype.setZoom=function(t){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._zoom=this._spatial.clamp(t,this._minZoom,this._maxZoom),this._desiredZoom=this._zoom},e.prototype.update=function(t){1===this._alpha&&this._currentIndex+this._alpha<this._trajectory.length&&(this._currentIndex+=1,this._useBezier=this._trajectory.length<3&&this._currentIndex+1===this._trajectory.length,this._setCurrent(),this._resetTransition(),this._clearRotation(),this._desiredZoom=this._currentNode.fullPano?this._zoom:0,this._desiredLookat=null);var e=this._animationSpeed*(60/t);this._baseAlpha=Math.min(1,this._baseAlpha+e),this._useBezier?this._alpha=this._unitBezier.solve(this._baseAlpha):this._alpha=this._baseAlpha,this._updateRotation(),this._rotationDelta.isZero||(this._applyRotation(this._previousCamera),this._applyRotation(this._currentCamera)),this._updateRotationBasic(),0===this._basicRotation[0]&&0===this._basicRotation[1]||this._applyRotationBasic(),this._updateZoom(e),this._updateLookat(e),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(){t.prototype._setCurrentCamera.call(this),this._adjustCameras()},e.prototype._adjustCameras=function(){if(null!=this._previousNode){var t=this._camera.lookat.clone().sub(this._camera.position);this._previousCamera.lookat.copy(t.clone().add(this._previousCamera.position)),this._currentNode.fullPano&&this._currentCamera.lookat.copy(t.clone().add(this._currentCamera.position))}},e.prototype._resetTransition=function(){this._alpha=0,this._baseAlpha=0,this._motionless=this._motionlessTransition()},e.prototype._applyRotation=function(t){if(null!=t){var e=(new i.Quaternion).setFromUnitVectors(t.up,new i.Vector3(0,0,1)),r=e.clone().inverse(),n=new i.Vector3;n.copy(t.lookat).sub(t.position),n.applyQuaternion(e);var o=n.length(),s=Math.atan2(n.y,n.x);s+=this._rotationDelta.phi;var a=Math.atan2(Math.sqrt(n.x*n.x+n.y*n.y),n.z);a+=this._rotationDelta.theta,a=Math.max(.1,Math.min(Math.PI-.1,a)),n.x=Math.sin(a)*Math.cos(s),n.y=Math.sin(a)*Math.sin(s),n.z=Math.cos(a),n.applyQuaternion(r),t.lookat.copy(t.position).add(n.multiplyScalar(o))}},e.prototype._applyRotationBasic=function(){var t=this._currentNode,e=null!=this._previousNode?this.previousNode:this.currentNode,r=this._currentCamera,n=this._previousCamera,i=this.currentTransform,o=null!=this.previousTransform?this.previousTransform:this.currentTransform,s=i.projectBasic(r.lookat.toArray()),a=o.projectBasic(n.lookat.toArray()),c=i.gpano,u=o.gpano;t.fullPano?(s[0]=this._spatial.wrap(s[0]+this._basicRotation[0],0,1),s[1]=this._spatial.clamp(s[1]+this._basicRotation[1],.05,.95)):null!=c&&i.gpano.CroppedAreaImageWidthPixels===i.gpano.FullPanoWidthPixels?(s[0]=this._spatial.wrap(s[0]+this._basicRotation[0],0,1),s[1]=this._spatial.clamp(s[1]+this._basicRotation[1],0,1)):(s[0]=this._spatial.clamp(s[0]+this._basicRotation[0],0,1),s[1]=this._spatial.clamp(s[1]+this._basicRotation[1],0,1)),e.fullPano?(a[0]=this._spatial.wrap(a[0]+this._basicRotation[0],0,1),a[1]=this._spatial.clamp(a[1]+this._basicRotation[1],.05,.95)):null!=u&&o.gpano.CroppedAreaImageWidthPixels===o.gpano.FullPanoWidthPixels?(a[0]=this._spatial.wrap(a[0]+this._basicRotation[0],0,1),a[1]=this._spatial.clamp(a[1]+this._basicRotation[1],0,1)):(a[0]=this._spatial.clamp(a[0]+this._basicRotation[0],0,1),a[1]=this._spatial.clamp(s[1]+this._basicRotation[1],0,1));var h=i.unprojectBasic(s,this._lookatDepth);r.lookat.fromArray(h);var l=o.unprojectBasic(a,this._lookatDepth);n.lookat.fromArray(l)},e.prototype._updateZoom=function(t){var e=this._desiredZoom-this._zoom,r=e>0?1:e<0?-1:0;0!==e&&(Math.abs(e)<.002?(this._zoom=this._desiredZoom,null!=this._desiredLookat&&(this._desiredLookat=null)):this._zoom+=r*Math.max(Math.abs(5*t*e),.002))},e.prototype._updateLookat=function(t){if(null!==this._desiredLookat){var e=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(e)<1e-6?(this._currentCamera.lookat.copy(this._desiredLookat),this._desiredLookat=null):this._currentCamera.lookat.lerp(this._desiredLookat,5*t)}},e.prototype._updateRotation=function(){if(null!=this._requestedRotationDelta){var t=this._rotationDelta.lengthSquared();return this._requestedRotationDelta.lengthSquared()>t?this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha):this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha),void(this._requestedRotationDelta=null)}this._rotationDelta.isZero||(this._rotationDelta.multiply(this._rotationAcceleration),this._rotationDelta.threshold(this._rotationThreshold))},e.prototype._updateRotationBasic=function(){if(null!=this._requestedBasicRotation){var t=this._basicRotation[0],e=this._basicRotation[1],r=this._requestedBasicRotation[0],n=this._requestedBasicRotation[1];return Math.abs(r)>Math.abs(t)?this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*t+this._rotationIncreaseAlpha*r:this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*t+this._rotationDecreaseAlpha*r,Math.abs(n)>Math.abs(e)?this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*e+this._rotationIncreaseAlpha*n:this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*e+this._rotationDecreaseAlpha*n,void(this._requestedBasicRotation=null)}if(null!=this._requestedBasicRotationUnbounded){var r=this._requestedBasicRotationUnbounded[0],n=this._requestedBasicRotationUnbounded[1];if(Math.abs(r)>0&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*r),Math.abs(n)>0&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*n),null!=this._desiredLookat){var o=this.currentTransform.projectBasic(this._desiredLookat.toArray());o[0]+=r,o[1]+=n,this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(o,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}0===this._basicRotation[0]&&0===this._basicRotation[1]||(this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0],this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1],Math.abs(this._basicRotation[0])<this._rotationThreshold/Math.pow(2,this._zoom)&&Math.abs(this._basicRotation[1])<this._rotationThreshold/Math.pow(2,this._zoom)&&(this._basicRotation=[0,0]))},e.prototype._clearRotation=function(){this._currentNode.fullPano||(null!=this._requestedRotationDelta&&(this._requestedRotationDelta=null),this._rotationDelta.isZero||this._rotationDelta.reset(),null!=this._requestedBasicRotation&&(this._requestedBasicRotation=null),(this._basicRotation[0]>0||this._basicRotation[1]>0)&&(this._basicRotation=[0,0]))},e.prototype._setDesiredCenter=function(){if(null!=this._desiredCenter){var t=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(this._desiredCenter,this._lookatDepth)).sub(this._currentCamera.position);this._currentCamera.lookat.copy(this._currentCamera.position.clone().add(t)),this._previousCamera.lookat.copy(this._previousCamera.position.clone().add(t)),this._desiredCenter=null}},e.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0},e}(s.StateBase);r.TraversingState=c},{"../../State":233,"@mapbox/unitbezier":2,three:176}],336:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("../../State"),o=function(t){function e(e){var r=t.call(this,e)||this;return r._zoom=0,r._adjustCameras(),r._motionless=r._motionlessTransition(),r}return n(e,t),e.prototype.traverse=function(){return new i.TraversingState(this)},e.prototype.wait=function(){throw new Error("Not implemented")},e.prototype.prepend=function(e){t.prototype.prepend.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.set=function(e){t.prototype.set.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.rotate=function(t){},e.prototype.rotateBasic=function(t){},e.prototype.rotateBasicUnbounded=function(t){},e.prototype.rotateToBasic=function(t){},e.prototype.zoomIn=function(t,e){},e.prototype.move=function(t){this._alpha=Math.max(0,Math.min(1,this._alpha+t))},e.prototype.moveTo=function(t){this._alpha=Math.max(0,Math.min(1,t))},e.prototype.update=function(t){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},e.prototype.setCenter=function(t){},e.prototype.setZoom=function(t){},e.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},e.prototype._setCurrentCamera=function(){t.prototype._setCurrentCamera.call(this),this._adjustCameras()},e.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){t=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(t.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){var t=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(t.clone().add(this._previousCamera.position))}}},e}(i.StateBase);r.WaitingState=o},{"../../State":233}],337:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Observable"),i=function(){function t(t,e,r){this._scheme=t,this._host=e,this._origin=null!=r?"?origin="+r:""}return t.prototype.getTile=function(t,e,r,i,o,s,a){var c="/"+t+"/"+e+","+r+","+i+","+o+"/"+s+","+a+"/0/default.jpg",u=this._scheme+"://"+this._host+c+this._origin,h=null;return[n.Observable.create(function(n){(h=new XMLHttpRequest).open("GET",u,!0),h.responseType="arraybuffer",h.timeout=15e3,h.onload=function(s){if(200===h.status){var a=new Image;a.crossOrigin="Anonymous",a.onload=function(t){n.next(a),n.complete()},a.onerror=function(s){n.error(new Error("Failed to load tile image ("+t+": "+e+","+r+","+i+","+o+")"))};var c=new Blob([h.response]);a.src=window.URL.createObjectURL(c)}else n.error(new Error("Failed to fetch tile ("+t+": "+e+","+r+","+i+","+o+"). Status: "+h.status+", "+h.statusText))},h.onerror=function(s){n.error(new Error("Failed to fetch tile ("+t+": "+e+","+r+","+i+","+o+")"))},h.ontimeout=function(s){n.error(new Error("Tile request timed out ("+t+": "+e+","+r+","+i+","+o+")"))},h.onabort=function(s){n.error(new Error("Tile request was aborted ("+t+": "+e+","+r+","+i+","+o+")"))},h.send(null)}),function(){null!=h&&h.abort()}]},t}();r.ImageTileLoader=i,r.default=i},{"rxjs/Observable":29}],338:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._images={}}return t.prototype.addImage=function(t,e,r){r in this._images||(this._images[r]={}),this._images[r][e]=t},t.prototype.dispose=function(){for(var t=0,e=Object.keys(this._images);t<e.length;t++){for(var r=e[t],n=this._images[r],i=0,o=Object.keys(n);i<o.length;i++){var s=o[i];window.URL.revokeObjectURL(n[s].src),delete n[s]}delete this._images[r]}},t.prototype.getImage=function(t,e){return this._images[e][t]},t.prototype.hasImage=function(t,e){return e in this._images&&t in this._images[e]},t}();r.ImageTileStore=n,r.default=n},{}],339:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Geo"),i=function(){function t(){this._viewportCoords=new n.ViewportCoords}return t.prototype.computeRegionOfInterest=function(t,e,r){var n=this._viewportBoundaryPoints(4),i=this._viewportPointsBoundingBox(n,t,r);this._clipBoundingBox(i);var o=2/e.width,s=2/e.height,a=[[-.5*o,.5*s],[.5*o,.5*s],[.5*o,-.5*s],[-.5*o,-.5*s]],c=this._viewportPointsBoundingBox(a,t,r);return{bbox:i,pixelHeight:c.maxY-c.minY,pixelWidth:c.maxX-c.minX+(c.minX<c.maxX?0:1)}},t.prototype._viewportBoundaryPoints=function(t){for(var e=[],r=[[-1,1],[1,1],[1,-1],[-1,-1]],n=[[2,0],[0,-2],[-2,0],[0,2]],i=0;i<4;++i)for(var o=r[i],s=n[i],a=0;a<t;++a)e.push([o[0]+s[0]*a/t,o[1]+s[1]*a/t]);return e},t.prototype._viewportPointsBoundingBox=function(t,e,r){var n=this,i=t.map(function(t){return n._viewportCoords.viewportToBasic(t[0],t[1],r,e.perspective)});return null!=r.gpano?this._boundingBoxPano(i):this._boundingBox(i)},t.prototype._boundingBox=function(t){for(var e={maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY},r=0;r<t.length;++r)e.minX=Math.min(e.minX,t[r][0]),e.maxX=Math.max(e.maxX,t[r][0]),e.minY=Math.min(e.minY,t[r][1]),e.maxY=Math.max(e.maxY,t[r][1]);return e},t.prototype._boundingBoxPano=function(t){for(var e=this,r=[],n=[],i=0;i<t.length;++i)r.push(t[i][0]),n.push(t[i][1]);r.sort(function(t,r){return e._sign(t-r)}),n.sort(function(t,r){return e._sign(t-r)});var o=this._intervalPano(r);return{maxX:o[1],maxY:n[n.length-1],minX:o[0],minY:n[0]}},t.prototype._intervalPano=function(t){for(var e=0,r=-1,n=0;n<t.length-1;++n){var i=t[n+1]-t[n];i>e&&(e=i,r=n)}return t[0]+1-t[t.length-1]>e?[t[0],t[t.length-1]]:[t[r+1],t[r]]},t.prototype._clipBoundingBox=function(t){t.minX=Math.max(0,Math.min(1,t.minX)),t.maxX=Math.max(0,Math.min(1,t.maxX)),t.minY=Math.max(0,Math.min(1,t.minY)),t.maxY=Math.max(0,Math.min(1,t.maxY))},t.prototype._sign=function(t){return t>0?1:t<0?-1:0},t}();r.RegionOfInterestCalculator=i,r.default=i},{"../Geo":229}],340:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("rxjs/Subject"),o=function(){function t(t,e,r,n,o,s,a,c){this._disposed=!1,this._key=t,(e<=0||r<=0)&&console.warn("Original image size ("+e+", "+r+") is invalid ("+t+"). Tiles will not be loaded."),this._width=e,this._height=r,this._maxLevel=Math.ceil(Math.log(Math.max(r,e))/Math.log(2)),this._currentLevel=-1,this._tileSize=n,this._updated$=new i.Subject,this._createdSubject$=new i.Subject,this._created$=this._createdSubject$.publishReplay(1).refCount(),this._createdSubscription=this._created$.subscribe(function(){}),this._hasSubject$=new i.Subject,this._has$=this._hasSubject$.startWith(!1).publishReplay(1).refCount(),this._hasSubscription=this._has$.subscribe(function(){}),this._abortFunctions=[],this._tileSubscriptions={},this._renderedCurrentLevelTiles={},this._renderedTiles={},this._background=o,this._camera=null,this._imageTileLoader=s,this._imageTileStore=a,this._renderer=c,this._renderTarget=null,this._roi=null}return Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasTexture$",{get:function(){return this._has$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureUpdated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureCreated$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),t.prototype.abort=function(){for(var t in this._tileSubscriptions)this._tileSubscriptions.hasOwnProperty(t)&&this._tileSubscriptions[t].unsubscribe();this._tileSubscriptions={};for(var e=0,r=this._abortFunctions;e<r.length;e++)(0,r[e])();this._abortFunctions=[]},t.prototype.dispose=function(){this._disposed?console.warn("Texture already disposed ("+this._key+")"):(this.abort(),null!=this._renderTarget&&(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=!0)},t.prototype.setRegionOfInterest=function(t){if(!(this._width<=0||this._height<=0)){this._roi=t;var e=1/this._roi.pixelWidth,r=1/this._roi.pixelHeight,i=Math.max(r,e),o=Math.max(0,Math.min(this._maxLevel,Math.round(Math.log(i)/Math.log(2)+.25)));if(o!==this._currentLevel){this.abort(),this._currentLevel=o,this._currentLevel in this._renderedTiles||(this._renderedTiles[this._currentLevel]=[]),this._renderedCurrentLevelTiles={};for(var s=0,a=this._renderedTiles[this._currentLevel];s<a.length;s++){var c=a[s];this._renderedCurrentLevelTiles[this._tileKey(c)]=!0}}var u=this._getTileCoords([this._roi.bbox.minX,this._roi.bbox.minY]),h=this._getTileCoords([this._roi.bbox.maxX,this._roi.bbox.maxY]),l=this._getTiles(u,h);if(null==this._camera){this._camera=new n.OrthographicCamera(-this._width/2,this._width/2,this._height/2,-this._height/2,-1,1),this._camera.position.z=1;var p=this._renderer.getContext(),f=p.getParameter(p.MAX_TEXTURE_SIZE),d=Math.max(this._width,this._height),m=f>d?1:f/d,v=Math.floor(m*this._width),g=Math.floor(m*this._height);this._renderTarget=new n.WebGLRenderTarget(v,g,{depthBuffer:!1,format:n.RGBFormat,magFilter:n.LinearFilter,minFilter:n.LinearFilter,stencilBuffer:!1}),this._renderToTarget(0,0,this._width,this._height,this._background),this._createdSubject$.next(this._renderTarget.texture),this._hasSubject$.next(!0)}this._fetchTiles(l)}},t.prototype.updateBackground=function(t){this._background=t},t.prototype._fetchTile=function(t,e,r,n,i,o,s,a){var c=this,u=this._imageTileLoader.getTile(this._key,r,n,i,o,s,a),h=u[0],l=u[1];this._abortFunctions.push(l);var p=this._tileKey(t),f=h.subscribe(function(s){c._renderToTarget(r,n,i,o,s),c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),c._setTileRendered(t,c._currentLevel),c._imageTileStore.addImage(s,p,e),c._updated$.next(!0)},function(t){c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),console.error(t)});f.closed||(this._tileSubscriptions[p]=f)},t.prototype._fetchTiles=function(t){for(var e=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=0,n=t;r<n.length;r++){var i=n[r],o=this._tileKey(i);if(!(o in this._renderedCurrentLevelTiles||o in this._tileSubscriptions)){var s=e*i[0],a=e*i[1],c=s+e>this._width?this._width-s:e,u=a+e>this._height?this._height-a:e;if(this._imageTileStore.hasImage(o,this._currentLevel))this._renderToTarget(s,a,c,u,this._imageTileStore.getImage(o,this._currentLevel)),this._setTileRendered(i,this._currentLevel),this._updated$.next(!0);else{var h=Math.floor(c/e*this._tileSize),l=Math.floor(u/e*this._tileSize);this._fetchTile(i,this._currentLevel,s,a,c,u,h,l)}}}},t.prototype._getTileCoords=function(t){var e=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=Math.ceil(this._width/e)-1,n=Math.ceil(this._height/e)-1;return[Math.min(Math.floor(this._width*t[0]/e),r),Math.min(Math.floor(this._height*t[1]/e),n)]},t.prototype._getTiles=function(t,e){var r=[];if(t[0]>e[0]){for(var n=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),i=Math.ceil(this._width/n)-1,o=t[0];o<=i;o++)r.push(o);for(o=0;o<=e[0];o++)r.push(o)}else for(o=t[0];o<=e[0];o++)r.push(o);for(var s=[],a=0,c=r;a<c.length;a++)for(var o=c[a],u=t[1];u<=e[1];u++)s.push([o,u]);return s},t.prototype._removeFromArray=function(t,e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)},t.prototype._removeFromDictionary=function(t,e){t in e&&delete e[t]},t.prototype._renderToTarget=function(t,e,r,i,o){var s=new n.Texture(o);s.minFilter=n.LinearFilter,s.needsUpdate=!0;var a=new n.PlaneGeometry(r,i),c=new n.MeshBasicMaterial({map:s,side:n.FrontSide}),u=new n.Mesh(a,c);u.position.x=-this._width/2+t+r/2,u.position.y=this._height/2-e-i/2;var h=new n.Scene;h.add(u),this._renderer.render(h,this._camera,this._renderTarget),this._renderer.setRenderTarget(void 0),h.remove(u),a.dispose(),c.dispose(),s.dispose()},t.prototype._setTileRendered=function(t,e){for(var r=0,n=Object.keys(this._renderedTiles).map(function(t){return parseInt(t,10)}).filter(function(t){return t!==e});r<n.length;r++){var i=n[r],o=Math.pow(2,i-e);if(i<e){for(var s=Math.floor(o*t[0]),a=Math.floor(o*t[1]),c=0,u=this._renderedTiles[i].slice();c<u.length;c++)if((v=u[c])[0]===s&&v[1]===a){g=this._renderedTiles[i].indexOf(v);this._renderedTiles[i].splice(g,1)}}else for(var h=o*t[0],l=h+o-1,p=o*t[1],f=p+o-1,d=0,m=this._renderedTiles[i].slice();d<m.length;d++){var v=m[d];if(v[0]>=h&&v[0]<=l&&v[1]>=p&&v[1]<=f){var g=this._renderedTiles[i].indexOf(v);this._renderedTiles[i].splice(g,1)}}0===this._renderedTiles[i].length&&delete this._renderedTiles[i]}this._renderedTiles[e].push(t),this._renderedCurrentLevelTiles[this._tileKey(t)]=!0},t.prototype._tileKey=function(t){return t[0]+"-"+t[1]},t}();r.TextureProvider=o,r.default=o},{"rxjs/Subject":34,three:176}],341:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){this._events={}}return t.prototype.on=function(t,e){this._events[t]=this._events[t]||[],this._events[t].push(e)},t.prototype.off=function(t,e){if(t)if(this._listens(t))delete this._events[t];else{var r=this._events[t].indexOf(e);r>=0&&this._events[t].splice(r,1),this._events[t].length&&delete this._events[t]}else this._events={}},t.prototype.fire=function(t,e){if(this._listens(t))for(var r=0,n=this._events[t];r<n.length;r++)n[r].call(this,e)},t.prototype._listens=function(t){return!(!this._events||!this._events[t])},t}();r.EventEmitter=n,r.default=n},{}],342:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Viewer"),i=function(){function t(){}return t.setOptions=function(e){t._baseImageSize=null!=e.baseImageSize?e.baseImageSize:n.ImageSize.Size640,t._basePanoramaSize=null!=e.basePanoramaSize?e.basePanoramaSize:n.ImageSize.Size2048,t._maxImageSize=null!=e.maxImageSize?e.maxImageSize:n.ImageSize.Size2048},Object.defineProperty(t,"baseImageSize",{get:function(){return t._baseImageSize},enumerable:!0,configurable:!0}),Object.defineProperty(t,"basePanoramaSize",{get:function(){return t._basePanoramaSize},enumerable:!0,configurable:!0}),Object.defineProperty(t,"maxImageSize",{get:function(){return t._maxImageSize},enumerable:!0,configurable:!0}),t}();r.Settings=i,r.default=i},{"../Viewer":236}],343:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){}return Object.defineProperty(t,"tileScheme",{get:function(){return"https"},enumerable:!0,configurable:!0}),Object.defineProperty(t,"tileDomain",{get:function(){return"d2qb1440i7l50o.cloudfront.net"},enumerable:!0,configurable:!0}),Object.defineProperty(t,"origin",{get:function(){return"mapillary.webgl"},enumerable:!0,configurable:!0}),t.thumbnail=function(t,e){return"https://d1cuyjsrcm0gby.cloudfront.net/"+t+"/thumb-"+e+".jpg?origin="+this.origin},t.falcorModel=function(t){return"https://a.mapillary.com/v3/model.json?client_id="+t},t.protoMesh=function(t){return"https://d1brzeo354iq2l.cloudfront.net/v2/mesh/"+t},t}();r.Urls=n,r.default=n},{}],344:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(t){t[t.Bottom=0]="Bottom",t[t.BottomLeft=1]="BottomLeft",t[t.BottomRight=2]="BottomRight",t[t.Center=3]="Center",t[t.Left=4]="Left",t[t.Right=5]="Right",t[t.Top=6]="Top",t[t.TopLeft=7]="TopLeft",t[t.TopRight=8]="TopRight"}(n=r.Alignment||(r.Alignment={})),r.default=n},{}],345:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t("rxjs/add/operator/bufferCount"),t("rxjs/add/operator/delay"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/map"),t("rxjs/add/operator/switchMap");var n=function(){function t(t,e){this._graphService=t,this._stateService=e,this._started=!1}return Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),t.prototype.start=function(){var t=this;this._started||(this._uncacheSubscription=this._stateService.currentState$.distinctUntilChanged(void 0,function(t){return t.state.currentNode.key}).map(function(t){return t.state.trajectory.map(function(t){return t.key})}).bufferCount(1,5).switchMap(function(e){var r=e[0];return t._graphService.uncache$(r)}).subscribe(function(){}),this._started=!0)},t.prototype.stop=function(){this._started&&(this._uncacheSubscription.unsubscribe(),this._uncacheSubscription=null,this._started=!1)},t}();r.CacheService=n,r.default=n},{"rxjs/add/operator/bufferCount":50,"rxjs/add/operator/delay":56,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/map":65,"rxjs/add/operator/switchMap":79}],346:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Component"),i=function(){function t(t,e,r,i,o){var s=this;this._container=t,this._observer=r,this._navigator=e,this._options=null!=o?o:{},this._key=i,this._componentService=new n.ComponentService(this._container,this._navigator),this._coverComponent=this._componentService.getCover(),this._initializeComponents(),i?(this._initilizeCoverComponent(),this._subscribeCoverComponent()):this._navigator.movedToKey$.first(function(t){return null!=t}).subscribe(function(t){s._key=t,s._componentService.deactivateCover(),s._coverComponent.configure({key:s._key,loading:!1,visible:!1}),s._subscribeCoverComponent(),s._navigator.stateService.start(),s._observer.startEmit()})}return t.prototype.get=function(t){return this._componentService.get(t)},t.prototype.activate=function(t){this._componentService.activate(t)},t.prototype.activateCover=function(){this._coverComponent.configure({loading:!1,visible:!0})},t.prototype.deactivate=function(t){this._componentService.deactivate(t)},t.prototype.deactivateCover=function(){this._coverComponent.configure({loading:!0,visible:!0})},t.prototype.resize=function(){this._componentService.resize()},t.prototype._initializeComponents=function(){var t=this._options;this._uFalse(t.background,"background"),this._uFalse(t.debug,"debug"),this._uFalse(t.image,"image"),this._uFalse(t.marker,"marker"),this._uFalse(t.navigation,"navigation"),this._uFalse(t.popup,"popup"),this._uFalse(t.route,"route"),this._uFalse(t.slider,"slider"),this._uFalse(t.tag,"tag"),this._uTrue(t.attribution,"attribution"),this._uTrue(t.bearing,"bearing"),this._uTrue(t.cache,"cache"),this._uTrue(t.direction,"direction"),this._uTrue(t.imagePlane,"imagePlane"),this._uTrue(t.keyboard,"keyboard"),this._uTrue(t.loading,"loading"),this._uTrue(t.mouse,"mouse"),this._uTrue(t.sequence,"sequence"),this._uTrue(t.stats,"stats")},t.prototype._initilizeCoverComponent=function(){var t=this._options;this._coverComponent.configure({key:this._key}),void 0===t.cover||t.cover?this.activateCover():this.deactivateCover()},t.prototype._subscribeCoverComponent=function(){var t=this;this._coverComponent.configuration$.subscribe(function(e){e.loading?t._navigator.stateService.currentKey$.first().switchMap(function(r){return null==r||r!==e.key?t._navigator.moveToKey$(e.key):t._navigator.stateService.currentNode$.first()}).subscribe(function(e){t._navigator.stateService.start(),t._observer.startEmit(),t._coverComponent.configure({loading:!1,visible:!1}),t._componentService.deactivateCover()},function(e){console.error("Failed to deactivate cover.",e),t._coverComponent.configure({loading:!1,visible:!0})}):e.visible&&(t._observer.stopEmit(),t._navigator.stateService.stop(),t._componentService.activateCover())})},t.prototype._uFalse=function(t,e){void 0!==t?"boolean"!=typeof t?(this._componentService.configure(e,t),this._componentService.activate(e)):t?this._componentService.activate(e):this._componentService.deactivate(e):this._componentService.deactivate(e)},t.prototype._uTrue=function(t,e){void 0!==t?"boolean"!=typeof t?(this._componentService.configure(e,t),this._componentService.activate(e)):t?this._componentService.activate(e):this._componentService.deactivate(e):this._componentService.activate(e)},t}();r.ComponentController=i},{"../Component":226}],347:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Render"),i=t("../Viewer"),o=function(){function t(t,e,r){if(this.id=t,this._container=document.getElementById(t),!this._container)throw new Error("Container '"+t+"' not found.");this._container.classList.add("mapillary-js"),this._canvasContainer=document.createElement("div"),this._canvasContainer.className="mapillary-js-interactive",this._domContainer=document.createElement("div"),this._domContainer.className="mapillary-js-dom",this._container.appendChild(this._canvasContainer),this._container.appendChild(this._domContainer),this.renderService=new n.RenderService(this._container,e.currentState$,r.renderMode),this.glRenderer=new n.GLRenderer(this._canvasContainer,this.renderService),this.domRenderer=new n.DOMRenderer(this._domContainer,this.renderService,e.currentState$),this.mouseService=new i.MouseService(this._container,this._canvasContainer,this._domContainer),this.touchService=new i.TouchService(this._canvasContainer,this._domContainer),this.spriteService=new i.SpriteService(r.sprite)}return Object.defineProperty(t.prototype,"element",{get:function(){return this._container},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canvasContainer",{get:function(){return this.canvasContainer},enumerable:!0,configurable:!0}),t}();r.Container=o,r.default=o},{"../Render":232,"../Viewer":236}],348:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!function(t){t[t.Size320=320]="Size320",t[t.Size640=640]="Size640",t[t.Size1024=1024]="Size1024",t[t.Size2048=2048]="Size2048"}(r.ImageSize||(r.ImageSize={}))},{}],349:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("underscore"),i=t("rxjs/Subject");t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var o=function(){function t(){this._loadersSubject$=new i.Subject,this._loaders$=this._loadersSubject$.scan(function(t,e){return void 0!==e.task&&(t[e.task]=e.loading),t},{}).startWith({}).publishReplay(1).refCount()}return Object.defineProperty(t.prototype,"loading$",{get:function(){return this._loaders$.map(function(t){return n.reduce(t,function(t,e){return t||e},!1)}).debounceTime(100).distinctUntilChanged()},enumerable:!0,configurable:!0}),t.prototype.taskLoading$=function(t){return this._loaders$.map(function(e){return!!e[t]}).debounceTime(100).distinctUntilChanged()},t.prototype.startLoading=function(t){this._loadersSubject$.next({loading:!0,task:t})},t.prototype.stopLoading=function(t){this._loadersSubject$.next({loading:!1,task:t})},t}();r.LoadingService=o,r.default=o},{"rxjs/Subject":34,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/map":65,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78,underscore:178}],350:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/fromEvent"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/mergeMap"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom");var s=t("../Geo"),a=function(){function t(t,e,r,a){var c=this;this._canvasContainer=e,this._domContainer=r,this._viewportCoords=null!=a?a:new s.ViewportCoords,this._activeSubject$=new n.BehaviorSubject(!1),this._active$=this._activeSubject$.distinctUntilChanged().publishReplay(1).refCount(),this._claimMouse$=new o.Subject,this._documentMouseMove$=i.Observable.fromEvent(document,"mousemove"),this._documentMouseUp$=i.Observable.fromEvent(document,"mouseup"),this._mouseDown$=i.Observable.fromEvent(e,"mousedown"),this._mouseLeave$=i.Observable.fromEvent(e,"mouseleave"),this._mouseMove$=i.Observable.fromEvent(e,"mousemove"),this._mouseUp$=i.Observable.fromEvent(e,"mouseup"),this._mouseOut$=i.Observable.fromEvent(e,"mouseout"),this._mouseOver$=i.Observable.fromEvent(e,"mouseover"),this._domMouseDown$=i.Observable.fromEvent(r,"mousedown"),this._domMouseMove$=i.Observable.fromEvent(r,"mousemove"),this._click$=i.Observable.fromEvent(e,"click"),this._contextMenu$=i.Observable.fromEvent(e,"contextmenu"),this._dblClick$=i.Observable.merge(i.Observable.fromEvent(t,"click"),i.Observable.fromEvent(e,"dblclick")).bufferCount(3,1).filter(function(t){var r=t[0],n=t[1],i=t[2];return"click"===r.type&&"click"===n.type&&"dblclick"===i.type&&r.target.parentNode===e&&n.target.parentNode===e}).map(function(t){return t[2]}).share(),i.Observable.merge(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(function(t){t.preventDefault()}),this._mouseWheel$=i.Observable.merge(i.Observable.fromEvent(e,"wheel"),i.Observable.fromEvent(r,"wheel")),this._consistentContextMenu$=i.Observable.merge(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).bufferCount(3,1).filter(function(t){return"mousedown"===t[0].type&&"contextmenu"===t[1].type&&"mouseup"===t[2].type}).map(function(t){return t[1]}).share();var u=i.Observable.merge(i.Observable.fromEvent(window,"blur"),this._documentMouseUp$.filter(function(t){return 0===t.button})).share(),h=this._mouseDown$.filter(function(t){return 0===t.button}).share();this._mouseDragStart$=h.mergeMap(function(t){return c._documentMouseMove$.takeUntil(u).take(1)}),this._mouseDrag$=h.mergeMap(function(t){return c._documentMouseMove$.skip(1).takeUntil(u)}),this._mouseDragEnd$=this._mouseDragStart$.mergeMap(function(t){return u.first()});var l=this._domMouseDown$.filter(function(t){return 0===t.button}).share();this._domMouseDragStart$=l.mergeMap(function(t){return c._documentMouseMove$.takeUntil(u).take(1)}),this._domMouseDrag$=l.mergeMap(function(t){return c._documentMouseMove$.skip(1).takeUntil(u)}),this._domMouseDragEnd$=this._domMouseDragStart$.mergeMap(function(t){return u.first()}),this._staticClick$=this._mouseDown$.switchMap(function(t){return c._click$.takeUntil(c._mouseMove$).take(1)}),this._mouseOwner$=this._claimMouse$.scan(function(t,e){return null==e.zindex?delete t[e.name]:t[e.name]=e.zindex,t},{}).map(function(t){var e=null,r=-1;for(var n in t)t.hasOwnProperty(n)&&t[n]>r&&(r=t[n],e=n);return e}).publishReplay(1).refCount(),this._mouseOwner$.subscribe(function(){})}return Object.defineProperty(t.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentMouseMove$",{get:function(){return this._documentMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentMouseUp$",{get:function(){return this._documentMouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDragStart$",{get:function(){return this._domMouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDrag$",{get:function(){return this._domMouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDragEnd$",{get:function(){return this._domMouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseDown$",{get:function(){return this._domMouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"domMouseMove$",{get:function(){return this._domMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOwner$",{get:function(){return this._mouseOwner$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDown$",{get:function(){return this._mouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseMove$",{get:function(){return this._mouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseLeave$",{get:function(){return this._mouseLeave$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOut$",{get:function(){return this._mouseOut$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseOver$",{get:function(){return this._mouseOver$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseUp$",{get:function(){return this._mouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dblClick$",{get:function(){return this._dblClick$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contextMenu$",{get:function(){return this._consistentContextMenu$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseWheel$",{get:function(){return this._mouseWheel$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDragStart$",{get:function(){return this._mouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDrag$",{get:function(){return this._mouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mouseDragEnd$",{get:function(){return this._mouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"staticClick$",{get:function(){return this._staticClick$},enumerable:!0,configurable:!0}),t.prototype.claimMouse=function(t,e){this._claimMouse$.next({name:t,zindex:e})},t.prototype.unclaimMouse=function(t){this._claimMouse$.next({name:t,zindex:null})},t.prototype.filtered$=function(t,e){return e.withLatestFrom(this.mouseOwner$,function(t,e){return[t,e]}).filter(function(e){return e[1]===t}).map(function(t){return t[0]})},t}();r.MouseService=a,r.default=a},{"../Geo":229,"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/fromEvent":42,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79,"rxjs/add/operator/withLatestFrom":83}],351:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/ReplaySubject");t("rxjs/add/observable/throw"),t("rxjs/add/operator/do"),t("rxjs/add/operator/finally"),t("rxjs/add/operator/first"),t("rxjs/add/operator/map"),t("rxjs/add/operator/mergeMap");var s=t("../API"),a=t("../Graph"),c=t("../Edge"),u=t("../State"),h=t("../Viewer"),l=function(){function t(t,e,r,i,o,c,l,p){this._apiV3=null!=r?r:new s.APIv3(t,e),this._imageLoadingService=null!=o?o:new a.ImageLoadingService,this._graphService=null!=i?i:new a.GraphService(new a.Graph(this.apiV3),this._imageLoadingService),this._loadingService=null!=c?c:new h.LoadingService,this._loadingName="navigator",this._stateService=null!=l?l:new u.StateService,this._cacheService=null!=p?p:new h.CacheService(this._graphService,this._stateService),this._cacheService.start(),this._keyRequested$=new n.BehaviorSubject(null),this._movedToKey$=new n.BehaviorSubject(null),this._request$=null,this._requestSubscription=null,this._nodeRequestSubscription=null}return Object.defineProperty(t.prototype,"apiV3",{get:function(){return this._apiV3},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"graphService",{get:function(){return this._graphService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageLoadingService",{get:function(){return this._imageLoadingService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadingService",{get:function(){return this._loadingService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"movedToKey$",{get:function(){return this._movedToKey$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stateService",{get:function(){return this._stateService},enumerable:!0,configurable:!0}),t.prototype.moveToKey$=function(t){this._abortRequest("to key "+t),this._loadingService.startLoading(this._loadingName);var e=this._moveToKey$(t);return this._makeRequest$(e)},t.prototype.moveDir$=function(t){var e=this;this._abortRequest("in dir "+c.EdgeDirection[t]),this._loadingService.startLoading(this._loadingName);var r=this.stateService.currentNode$.first().mergeMap(function(e){return([c.EdgeDirection.Next,c.EdgeDirection.Prev].indexOf(t)>-1?e.sequenceEdges$:e.spatialEdges$).first().map(function(e){for(var r=0,n=e.edges;r<n.length;r++){var i=n[r];if(i.data.direction===t)return i.to}return null})}).mergeMap(function(r){return null==r?(e._loadingService.stopLoading(e._loadingName),i.Observable.throw(new Error("Direction ("+t+") does not exist for current node."))):e._moveToKey$(r)});return this._makeRequest$(r)},t.prototype.moveCloseTo$=function(t,e){var r=this;this._abortRequest("to lat "+t+", lon "+e),this._loadingService.startLoading(this._loadingName);var n=this.apiV3.imageCloseTo$(t,e).mergeMap(function(n){return null==n?(r._loadingService.stopLoading(r._loadingName),i.Observable.throw(new Error("No image found close to lat "+t+", lon "+e+"."))):r._moveToKey$(n.key)});return this._makeRequest$(n)},t.prototype.setFilter$=function(t){var e=this;return this._stateService.clearNodes(),this._movedToKey$.first().mergeMap(function(r){return null!=r?e._trajectoryKeys$().mergeMap(function(r){return e._graphService.setFilter$(t).mergeMap(function(t){return e._cacheKeys$(r)})}).last():e._keyRequested$.mergeMap(function(r){return null!=r?e._graphService.setFilter$(t).mergeMap(function(t){return e._graphService.cacheNode$(r)}):e._graphService.setFilter$(t).map(function(t){})})}).map(function(t){})},t.prototype.setToken$=function(t){var e=this;return this._abortRequest("to set token"),this._stateService.clearNodes(),this._movedToKey$.first().do(function(r){e._apiV3.setToken(t)}).mergeMap(function(t){return null==t?e._graphService.reset$([]).map(function(t){}):e._trajectoryKeys$().mergeMap(function(t){return e._graphService.reset$(t).mergeMap(function(r){return e._cacheKeys$(t)})}).last().map(function(t){})})},t.prototype._cacheKeys$=function(t){var e=this,r=t.map(function(t){return e._graphService.cacheNode$(t)});return i.Observable.from(r).mergeAll()},t.prototype._abortRequest=function(t){null!=this._requestSubscription&&(this._requestSubscription.unsubscribe(),this._requestSubscription=null),null!=this._nodeRequestSubscription&&(this._nodeRequestSubscription.unsubscribe(),this._nodeRequestSubscription=null),null!=this._request$&&(this._request$.error(new Error("Request aborted by a subsequent request "+t+".")),this._request$=null)},t.prototype._makeRequest$=function(t){var e=this;return this._request$=new o.ReplaySubject(1),this._requestSubscription=this._request$.subscribe(void 0,function(t){}),this._nodeRequestSubscription=t.subscribe(function(t){e._request$.next(t),e._request$.complete()},function(t){e._request$.error(t)}),this._request$},t.prototype._moveToKey$=function(t){var e=this;return this._keyRequested$.next(t),this._graphService.cacheNode$(t).do(function(t){e._stateService.setNodes([t]),e._movedToKey$.next(t.key)}).finally(function(){e._loadingService.stopLoading(e._loadingName)})},t.prototype._trajectoryKeys$=function(){return this._stateService.currentState$.first().map(function(t){return t.state.trajectory.map(function(t){return t.key})})},t}();r.Navigator=l,r.default=l},{"../API":225,"../Edge":227,"../Graph":230,"../State":233,"../Viewer":236,"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/ReplaySubject":32,"rxjs/add/observable/throw":46,"rxjs/add/operator/do":59,"rxjs/add/operator/finally":62,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/mergeMap":68}],352:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/map"),t("rxjs/add/operator/throttleTime");var i=t("../Viewer"),o=function(){function t(t,e,r){var n=this;this._container=r,this._eventEmitter=t,this._navigator=e,this._projection=new i.Projection,this._started=!1,this._navigator.loadingService.loading$.subscribe(function(t){n._eventEmitter.fire(i.Viewer.loadingchanged,t)})}return Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),t.prototype.projectBasic$=function(t){var e=this;return n.Observable.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).first().map(function(r){var n=r[0],i=r[1],o=e._projection.basicToCanvas(t,e._container.element,n,i);return[Math.round(o[0]),Math.round(o[1])]})},t.prototype.startEmit=function(){var t=this;if(!this._started){this._started=!0,this._currentNodeSubscription=this._navigator.stateService.currentNodeExternal$.subscribe(function(e){t._eventEmitter.fire(i.Viewer.nodechanged,e)}),this._sequenceEdgesSubscription=this._navigator.stateService.currentNodeExternal$.switchMap(function(t){return t.sequenceEdges$}).subscribe(function(e){t._eventEmitter.fire(i.Viewer.sequenceedgeschanged,e)}),this._spatialEdgesSubscription=this._navigator.stateService.currentNodeExternal$.switchMap(function(t){return t.spatialEdges$}).subscribe(function(e){t._eventEmitter.fire(i.Viewer.spatialedgeschanged,e)}),this._moveSubscription=n.Observable.combineLatest(this._navigator.stateService.inMotion$,this._container.mouseService.active$,this._container.touchService.active$).map(function(t){return t[0]||t[1]||t[2]}).distinctUntilChanged().subscribe(function(e){e?t._eventEmitter.fire(i.Viewer.movestart,null):t._eventEmitter.fire(i.Viewer.moveend,null)}),this._bearingSubscription=this._container.renderService.bearing$.throttleTime(100).distinctUntilChanged(function(t,e){return Math.abs(e-t)<1}).subscribe(function(e){t._eventEmitter.fire(i.Viewer.bearingchanged,e)});var e=this._container.mouseService.active$.switchMap(function(e){return e?n.Observable.empty():t._container.mouseService.mouseMove$});this._viewerMouseEventSubscription=n.Observable.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$)).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$).map(function(e){var r=e[0],n=r[0],i=r[1],o=e[1],s=e[2],a=e[3],c=t._projection.eventToUnprojection(i,t._container.element,o,s,a);return{basicPoint:c.basicPoint,latLon:c.latLon,originalEvent:i,pixelPoint:c.pixelPoint,target:t._eventEmitter,type:n}}).subscribe(function(e){t._eventEmitter.fire(e.type,e)})}},t.prototype.stopEmit=function(){this.started&&(this._started=!1,this._bearingSubscription.unsubscribe(),this._currentNodeSubscription.unsubscribe(),this._moveSubscription.unsubscribe(),this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._viewerMouseEventSubscription.unsubscribe(),this._bearingSubscription=null,this._currentNodeSubscription=null,this._moveSubscription=null,this._sequenceEdgesSubscription=null,this._spatialEdgesSubscription=null,this._viewerMouseEventSubscription=null)},t.prototype.unproject$=function(t){var e=this;return n.Observable.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$).first().map(function(r){var n=r[0],i=r[1],o=r[2];return e._projection.canvasToUnprojection(t,e._container.element,n,i,o).latLon})},t.prototype.unprojectBasic$=function(t){var e=this;return n.Observable.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).first().map(function(r){var n=r[0],i=r[1];return e._projection.canvasToBasic(t,e._container.element,n,i)})},t.prototype._mapMouseEvent$=function(t,e){return e.map(function(e){return[t,e]})},t}();r.Observer=o,r.default=o},{"../Viewer":236,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/map":65,"rxjs/add/operator/throttleTime":82}],353:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("../Geo"),o=function(){function t(t,e){this._geoCoords=t||new i.GeoCoords,this._viewportCoords=e||new i.ViewportCoords}return t.prototype.basicToCanvas=function(t,e,r,n){return this._viewportCoords.basicToCanvas(t[0],t[1],e,n,r.perspective)},t.prototype.canvasToBasic=function(t,e,r,n){var i=this._viewportCoords.canvasToBasic(t[0],t[1],e,n,r.perspective);return(i[0]<0||i[0]>1||i[1]<0||i[1]>1)&&(i=null),i},t.prototype.eventToUnprojection=function(t,e,r,n,i){var o=this._viewportCoords.canvasPosition(t,e);return this.canvasToUnprojection(o,e,r,n,i)},t.prototype.canvasToUnprojection=function(t,e,r,i,o){var s=t[0],a=t[1],c=this._viewportCoords.canvasToViewport(s,a,e),u=c[0],h=c[1],l=new n.Vector3(u,h,1).unproject(r.perspective),p=o.projectBasic(l.toArray());(p[0]<0||p[0]>1||p[1]<0||p[1]>1)&&(p=null);var f=l.clone().sub(r.camera.position).normalize(),d=-2/f.z,m=null;if(d>0&&d<100&&p){var v=f.clone().multiplyScalar(d).add(r.camera.position),g=this._geoCoords.enuToGeodetic(v.x,v.y,v.z,i.lat,i.lon,i.alt).slice(0,2);m={lat:g[0],lon:g[1]}}return{basicPoint:p,latLon:m,pixelPoint:[s,a]}},t}();r.Projection=o,r.default=o},{"../Geo":229,three:176}],354:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("three"),i=t("virtual-dom"),o=t("rxjs/Subject");t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var s=t("../Viewer"),a=function(){function t(){}return Object.defineProperty(t.prototype,"json",{set:function(t){this._json=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"image",{set:function(t){this._image=t,this._texture=new n.Texture(this._image),this._texture.minFilter=n.NearestFilter},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return!(!this._image||!this._json)},enumerable:!0,configurable:!0}),t.prototype.getGLSprite=function(t){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");var e=this._json[t];if(!e)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),new n.Object3D;var r=this._texture.clone();r.needsUpdate=!0;var i=this._image.width,o=this._image.height;r.offset.x=e.x/i,r.offset.y=(o-e.y-e.height)/o,r.repeat.x=e.width/i,r.repeat.y=e.height/o;var s=new n.SpriteMaterial({map:r});return new n.Sprite(s)},t.prototype.getDOMSprite=function(t,e){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==e&&(e=s.Alignment.Center);var r=this._json[t];if(!r)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),i.h("div",{},[]);var n=r.y,o=r.x+r.width,a=r.y+r.height,c=r.x,u=-r.x,h=-r.y,l=this._image.height,p=this._image.width;switch(e){case s.Alignment.Bottom:case s.Alignment.Center:case s.Alignment.Top:u-=r.width/2;break;case s.Alignment.BottomLeft:case s.Alignment.Left:case s.Alignment.TopLeft:u-=r.width;break;case s.Alignment.BottomRight:case s.Alignment.Right:case s.Alignment.BottomRight:}switch(e){case s.Alignment.Center:case s.Alignment.Left:case s.Alignment.Right:h-=r.height/2;break;case s.Alignment.Top:case s.Alignment.TopLeft:case s.Alignment.TopRight:h-=r.height;break;case s.Alignment.Bottom:case s.Alignment.BottomLeft:case s.Alignment.BottomRight:}var f=1/r.pixelRatio;n*=f,o*=f,a*=f,c*=f,u*=f,h*=f,l*=f,p*=f;var d={src:this._image.src,style:{clip:"rect("+n+"px, "+o+"px, "+a+"px, "+c+"px)",height:l+"px",left:u+"px",position:"absolute",top:h+"px",width:p+"px"}};return i.h("img",d,[])},t}(),c=function(){function t(t){var e=this;if(this._retina=window.devicePixelRatio>1,this._spriteAtlasOperation$=new o.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},new a).publishReplay(1).refCount(),this._spriteAtlas$.subscribe(function(){}),null!=t){var r=this._retina?"@2x":"",n=new XMLHttpRequest;n.open("GET",t+r+".png",!0),n.responseType="arraybuffer",n.onload=function(){var t=new Image;t.onload=function(){e._spriteAtlasOperation$.next(function(e){return e.image=t,e})};var r=new Blob([n.response]);t.src=window.URL.createObjectURL(r)},n.onerror=function(e){console.error(new Error("Failed to fetch sprite sheet ("+t+r+".png)"))},n.send();var i=new XMLHttpRequest;i.open("GET",t+r+".json",!0),i.responseType="text",i.onload=function(){var t=JSON.parse(i.response);e._spriteAtlasOperation$.next(function(e){return e.json=t,e})},i.onerror=function(e){console.error(new Error("Failed to fetch sheet ("+t+r+".json)"))},i.send()}}return Object.defineProperty(t.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),t}();r.SpriteService=c,r.default=c},{"../Viewer":236,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":73,"rxjs/add/operator/startWith":78,three:176,"virtual-dom":182}],355:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/timer"),t("rxjs/add/operator/bufferWhen"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/merge"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap");var s=function(){function t(t,e){var r=this;this._canvasContainer=t,this._domContainer=e,this._activeSubject$=new n.BehaviorSubject(!1),this._active$=this._activeSubject$.distinctUntilChanged().publishReplay(1).refCount(),i.Observable.fromEvent(e,"touchmove").subscribe(function(t){t.preventDefault()}),this._touchStart$=i.Observable.fromEvent(t,"touchstart"),this._touchMove$=i.Observable.fromEvent(t,"touchmove"),this._touchEnd$=i.Observable.fromEvent(t,"touchend"),this._touchCancel$=i.Observable.fromEvent(t,"touchcancel");var s=this._touchStart$.filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}).share();this._doubleTap$=s.bufferWhen(function(){return s.first().switchMap(function(t){return i.Observable.timer(300).merge(s).take(1)})}).filter(function(t){return 2===t.length}).map(function(t){return t[t.length-1]}).share(),this._doubleTap$.subscribe(function(t){t.preventDefault()}),this._singleTouchMove$=this._touchMove$.filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}).share();var a=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}),c=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return t.touches.length>=1}),u=i.Observable.merge(this._touchEnd$,this._touchCancel$).filter(function(t){return 0===t.touches.length});this._singleTouchDragStart$=a.mergeMap(function(t){return r._singleTouchMove$.takeUntil(i.Observable.merge(u,c)).take(1)}),this._singleTouchDragEnd$=a.mergeMap(function(t){return i.Observable.merge(u,c).first()}),this._singleTouchDrag$=a.switchMap(function(t){return r._singleTouchMove$.skip(1).takeUntil(i.Observable.merge(c,u))});var h=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=h.filter(function(t){return 2===t.touches.length&&2===t.targetTouches.length}),this._pinchEnd$=h.filter(function(t){return 2!==t.touches.length||2!==t.targetTouches.length}),this._pinchOperation$=new o.Subject,this._pinch$=this._pinchOperation$.scan(function(t,e){return e(t)},{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$.filter(function(t){return 2===t.touches.length&&2===t.targetTouches.length}).map(function(t){return function(e){var r=t.touches[0],n=t.touches[1],i=Math.min(r.clientX,n.clientX),o=Math.max(r.clientX,n.clientX),s=Math.min(r.clientY,n.clientY),a=i+(o-i)/2,c=s+(Math.max(r.clientY,n.clientY)-s)/2,u=a+r.pageX-r.clientX,h=c+r.pageY-r.clientY,l=a+r.screenX-r.clientX,p=c+r.screenY-r.clientY,f=Math.abs(r.clientX-n.clientX),d=Math.abs(r.clientY-n.clientY),m=Math.sqrt(f*f+d*d),v=m-e.distance;return{changeX:f-e.distanceX,changeY:d-e.distanceY,clientX:a,clientY:c,distance:m,distanceChange:v,distanceX:f,distanceY:d,originalEvent:t,pageX:u,pageY:h,screenX:l,screenY:p,touch1:r,touch2:n}}}).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.switchMap(function(t){return r._pinch$.skip(1).takeUntil(r._pinchEnd$)})}return Object.defineProperty(t.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doubleTap$",{get:function(){return this._doubleTap$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchStart$",{get:function(){return this._touchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchMove$",{get:function(){return this._touchMove$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchEnd$",{get:function(){return this._touchEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchCancel$",{get:function(){return this._touchCancel$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDragStart$",{get:function(){return this._singleTouchDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDrag$",{get:function(){return this._singleTouchDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"singleTouchDragEnd$",{get:function(){return this._singleTouchDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchStart$",{get:function(){return this._pinchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchEnd$",{get:function(){return this._pinchEnd$},enumerable:!0,configurable:!0}),t}();r.TouchService=s},{"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/timer":47,"rxjs/add/operator/bufferWhen":51,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/scan":73,"rxjs/add/operator/switchMap":79}],356:[function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=t("when"),o=t("../Viewer"),s=t("../Utils"),a=function(t){function e(e,r,n,i,a){var c=t.call(this)||this;return i=null!=i?i:{},s.Settings.setOptions(i),c._navigator=new o.Navigator(r,a),c._container=new o.Container(e,c._navigator.stateService,i),c._observer=new o.Observer(c,c._navigator,c._container),c._componentController=new o.ComponentController(c._container,c._navigator,c._observer,n,i.component),c}return n(e,t),e.prototype.activateComponent=function(t){this._componentController.activate(t)},e.prototype.activateCover=function(){this._componentController.activateCover()},e.prototype.deactivateComponent=function(t){this._componentController.deactivate(t)},e.prototype.deactivateCover=function(){this._componentController.deactivateCover()},e.prototype.getBearing=function(){var t=this;return i.promise(function(e,r){t._container.renderService.bearing$.first().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.getCenter=function(){var t=this;return i.promise(function(e,r){t._navigator.stateService.getCenter().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.getComponent=function(t){return this._componentController.get(t)},e.prototype.getContainer=function(){return this._container.element},e.prototype.getZoom=function(){var t=this;return i.promise(function(e,r){t._navigator.stateService.getZoom().subscribe(function(t){e(t)},function(t){r(t)})})},e.prototype.moveCloseTo=function(t,e){var r=this;return i.promise(function(n,i){r._navigator.moveCloseTo$(t,e).subscribe(function(t){n(t)},function(t){i(t)})})},e.prototype.moveDir=function(t){var e=this;return i.promise(function(r,n){e._navigator.moveDir$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.moveToKey=function(t){var e=this;return i.promise(function(r,n){e._navigator.moveToKey$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.projectFromBasic=function(t){var e=this;return i.promise(function(r,n){e._observer.projectBasic$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},e.prototype.setAuthToken=function(t){var e=this;return i.promise(function(r,n){e._navigator.setToken$(t).subscribe(function(){r(void 0)},function(t){n(t)})})},e.prototype.setCenter=function(t){this._navigator.stateService.setCenter(t)},e.prototype.setFilter=function(t){var e=this;return i.promise(function(r,n){e._navigator.setFilter$(t).subscribe(function(){r(void 0)},function(t){n(t)})})},e.prototype.setRenderMode=function(t){this._container.renderService.renderMode$.next(t)},e.prototype.setZoom=function(t){this._navigator.stateService.setZoom(t)},e.prototype.unproject=function(t){var e=this;return i.promise(function(r,n){e._observer.unproject$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.prototype.unprojectToBasic=function(t){var e=this;return i.promise(function(r,n){e._observer.unprojectBasic$(t).subscribe(function(t){r(t)},function(t){n(t)})})},e.bearingchanged="bearingchanged",e.click="click",e.contextmenu="contextmenu",e.dblclick="dblclick",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.nodechanged="nodechanged",e.sequenceedgeschanged="sequenceedgeschanged",e.spatialedgeschanged="spatialedgeschanged",e}(s.EventEmitter);r.Viewer=a},{"../Utils":235,"../Viewer":236,when:223}]},{},[231])(231)});