]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/assets/iD/iD/mapillary-js/mapillary.min.js
Merge remote-tracking branch 'upstream/pull/2083'
[rails.git] / vendor / assets / iD / iD / mapillary-js / mapillary.min.js
index 050eb1d8dd8f6123f54f3f8228737aa9a5104ce4..2c40a41e264ffb2304f9c92b810e7d952f78fdaa 100644 (file)
@@ -1,35 +1 @@
-!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Mapillary=t()}}(function(){var t;return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[a]={exports:{}};e[a][0].call(h.exports,function(t){var r=e[a][1][t];return i(r?r:t)},h,h.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[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 3*t.length/4-n(t)}function o(t){var e,r,i,o,a,s,c=t.length;a=n(t),s=new l(3*c/4-a),i=a>0?c-4:c;var u=0;for(e=0,r=0;e<i;e+=4,r+=3)o=h[t.charCodeAt(e)]<<18|h[t.charCodeAt(e+1)]<<12|h[t.charCodeAt(e+2)]<<6|h[t.charCodeAt(e+3)],s[u++]=o>>16&255,s[u++]=o>>8&255,s[u++]=255&o;return 2===a?(o=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[u++]=255&o):1===a&&(o=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[u++]=o>>8&255,s[u++]=255&o),s}function a(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(a(n));return i.join("")}function c(t){for(var e,r=t.length,n=r%3,i="",o=[],a=16383,c=0,h=r-n;c<h;c+=a)o.push(s(t,c,c+a>h?h:c+a));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),o.push(i),o.join("")}r.byteLength=i,r.toByteArray=o,r.fromByteArray=c;for(var u=[],h=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=p.length;f<d;++f)u[f]=p[f],h[p.charCodeAt(f)]=f;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},{}],2:[function(t,e,r){},{}],3:[function(t,e,r){e.exports=function(t){var e,r=String.prototype.split,n=/()??/.exec("")[1]===t;return e=function(e,i,o){if("[object RegExp]"!==Object.prototype.toString.call(i))return r.call(e,i,o);var a,s,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(e+="",n||(a=new RegExp("^"+i.source+"$(?!\\s)",l)),o=o===t?-1>>>0:o>>>0;(s=i.exec(e))&&(c=s.index+s[0].length,!(c>p&&(h.push(e.slice(p,s.index)),!n&&s.length>1&&s[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===t&&(s[e]=t)}),s.length>1&&s.index<e.length&&Array.prototype.push.apply(h,s.slice(1)),u=s[0].length,p=c,h.length>=o)));)i.lastIndex===s.index&&i.lastIndex++;return p===e.length?!u&&i.test("")||h.push(""):h.push(e.slice(p)),h.length>o?h.slice(0,o):h}}()},{}],4:[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 a(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 s(){v&&d&&(v=!1,d.length?m=d.concat(m):g=-1,m.length&&c())}function c(){if(!v){var t=o(s);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,a(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.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}},{}],5:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(i()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=a.prototype):(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(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 h(this,t)}return s(this,t,e,r)}function s(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?f(t,e,r,n):"string"==typeof e?l(t,e,r):d(t,e)}function c(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 u(t,e,r,n){return c(e),e<=0?o(t,e):void 0!==r?"string"==typeof n?o(t,e).fill(r,n):o(t,e).fill(r):o(t,e)}function h(t,e){if(c(e),t=o(t,e<0?0:0|m(e)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(e,r);t=o(t,n);var i=t.write(e,r);return i!==n&&(t=t.slice(0,i)),t}function p(t,e){var r=e.length<0?0:0|m(e.length);t=o(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function f(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),a.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=a.prototype):t=p(t,e),t}function d(t,e){if(a.isBuffer(e)){var r=0|m(e.length);return t=o(t,r),0===t.length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||K(e.length)?o(t,0):p(t,e);if("Buffer"===e.type&&Q(e.data))return p(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function m(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function v(t){return+t!=t&&(t=0),a.alloc(+t)}function g(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(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 H(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(n)return H(t).length;e=(""+e).toLowerCase(),n=!0}}function y(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 L(this,e,r);case"utf8":case"utf-8":return P(this,e,r);case"ascii":return j(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return O(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function _(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:x(t,e,r,n,i);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):x(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function x(t,e,r,n,i){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,c/=2,r/=2}var u;if(i){var h=-1;for(u=r;u<s;u++)if(o(t,u)===o(e,h===-1?0:u-h)){if(h===-1&&(h=u),u-h+1===c)return h*a}else h!==-1&&(u-=u-h),h=-1}else for(r+c>s&&(r=s-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 w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),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 a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function S(t,e,r,n){return Y(H(e,t.length-r),t,r,n)}function M(t,e,r,n){return Y(W(e),t,r,n)}function E(t,e,r,n){return M(t,e,r,n)}function T(t,e,r,n){return Y(X(e),t,r,n)}function C(t,e,r,n){return Y(q(e,t.length-r),t,r,n)}function O(t,e,r){return 0===e&&r===t.length?Z.fromByteArray(t):Z.fromByteArray(t.slice(e,r))}function P(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=r){var c,u,h,l;switch(s){case 1:o<128&&(a=o);break;case 2:c=t[i+1],128===(192&c)&&(l=(31&o)<<6|63&c,l>127&&(a=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,l>2047&&(l<55296||l>57343)&&(a=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,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return A(n)}function A(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=tt));return r}function j(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 R(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 L(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+=$(t[o]);return i}function N(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 I(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 D(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function k(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function F(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function U(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 B(t,e,r,n,i){return i||U(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(t,e,r,n,23,4),r+4}function z(t,e,r,n,i){return i||U(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(t,e,r,n,52,8),r+8}function G(t){if(t=V(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function V(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function $(t){return t<16?"0"+t.toString(16):t.toString(16)}function H(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+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=(i-55296<<10|r-56320)+65536}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 W(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function q(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function X(t){return Z.toByteArray(G(t))}function Y(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 K(t){return t!==t}var Z=t("base64-js"),J=t("ieee754"),Q=t("isarray");r.Buffer=a,r.SlowBuffer=v,r.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,r){return s(null,t,e,r)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,r){return u(null,t,e,r)},a.allocUnsafe=function(t){return h(null,t)},a.allocUnsafeSlow=function(t){return h(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(t,e){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},a.byteLength=g,a.prototype._isBuffer=!0,a.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)b(this,e,e+1);return this},a.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)b(this,e,e+3),b(this,e+1,e+2);return this},a.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)b(this,e,e+7),b(this,e+1,e+6),b(this,e+2,e+5),b(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?P(this,0,t):y.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.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+">"},a.prototype.compare=function(t,e,r,n,i){if(!a.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===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,c=Math.min(o,s),u=this.slice(n,i),h=t.slice(e,r),l=0;l<c;++l)if(u[l]!==h[l]){o=u[l],s=h[l];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1},a.prototype.indexOf=function(t,e,r){return _(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return _(this,t,e,r,!1)},a.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 w(this,t,e,r);case"utf8":case"utf-8":return S(this,t,e,r);case"ascii":return M(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var n;if(a.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=a.prototype;else{var i=e-t;n=new a(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},a.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||I(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},a.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||I(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},a.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},a.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),J.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),J.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),J.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),J.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;D(this,t,e,r,i,0)}var o=1,a=0;for(this[e]=255&t;++a<r&&(o*=256);)this[e+a]=t/o&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;D(this,t,e,r,i,0)}var o=r-1,a=1;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=t/a&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return z(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return z(this,t,e,!1,r)},a.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||!a.TYPED_ARRAY_SUPPORT)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},a.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 i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.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 o;if("number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=a.isBuffer(t)?t:H(new a(t,n).toString()),c=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%c]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":1,ieee754:15,isarray:19}],6:[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,s=i(t,0,o,r,!0),c=[];if(!s)return c;var u,h,p,f,d,m,v;if(n&&(s=l(t,e,s,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 a(s,c,r,u,h,v),c}function i(t,e,r,n,i){var o,a;if(i===j(t,e,r,n)>0)for(o=e;o<r;o+=n)a=O(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=O(o,t[o],t[o+1],a);return a&&w(a,a.next)&&(P(a),a=a.next),a}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===n.next)return null;r=!0}while(r||n!==e);return e}function a(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):s(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,t===v){p?1===p?(t=u(t,e,r),a(t,e,r,n,i,l,2)):2===p&&h(t,e,r,n,i,l):a(o(t),e,r,n,i,l,1);break}}}function s(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,a=t.next;if(x(i,o,a)>=0)return!1;for(var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,c=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,u=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,h=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,l=g(s,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,a.x,a.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,a.x,a.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,s){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),a(c,e,r,n,i,s),void a(h,e,r,n,i,s)}u=u.next}c=c.next}while(c!==t)}function l(t,e,r,n){var a,s,c,u,h,l=[];for(a=0,s=e.length;a<s;a++)c=e[a]*n,u=a<s-1?e[a+1]*n:t.length,h=i(t,c,u,n,!1),h===h.next&&(h.steiner=!0),l.push(y(h));for(l.sort(p),a=0;a<l.length;a++)f(l[a],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,a=-(1/0);do{if(o<=n.y&&o>=n.next.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===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===a)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:a,o,h,l,o<l?a:i,o,n.x,n.y)&&(c=Math.abs(o-n.y)/(i-n.x),(c<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,a,s,c,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<u&&(s++,n=n.nextZ,n);e++);for(c=u;s>0||c>0&&n;)0===s?(i=n,n=n.nextZ,c--):0!==c&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,c--):(i=r,r=r.nextZ,s--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>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,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=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,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=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,a=Math.abs(j(t,0,o,r));if(i)for(var s=0,c=e.length;s<c;s++){var u=e[s]*r,h=s<c-1?e[s+1]*r:t.length;a-=Math.abs(j(t,u,h,r))}var l=0;for(s=0;s<n.length;s+=3){var p=n[s]*r,f=n[s+1]*r,d=n[s+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===a&&0===l?0:Math.abs((l-a)/a)},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 a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],7:[function(t,e,r){"use strict";function n(t){var e=t[a];return e||(e=t[a]={}),e}var i=t("individual/one-version"),o="7";i("ev-store",o);var a="__EV_STORE_KEY@"+o;e.exports=n},{"individual/one-version":17}],8:[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){if(this._jsongUrl=t,"number"==typeof e){var r={timeout:e};e=r}this._config=n({timeout:15e3,headers:{}},e||{})}var o=t("./request"),a=t("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:a,get:function(t){var e="GET",r=this.buildQueryObject(this._jsongUrl,e,{paths:t,method:"get"}),i=n(r,this._config),a=this;return o(e,i,a)},set:function(t){var e="POST",r=this.buildQueryObject(this._jsongUrl,e,{jsonGraph:t,method:"set"}),i=n(r,this._config);i.headers["Content-Type"]="application/x-www-form-urlencoded";var a=this;return o(e,i,a)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var a="POST",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 c=this.buildQueryObject(this._jsongUrl,a,s.join("&")),u=n(c,this._config);u.headers["Content-Type"]="application/x-www-form-urlencoded";var h=this;return o(a,u,h)}},i.XMLHttpSource=i,i.default=i,e.exports=i},{"./buildQueryObject":9,"./request":12}],9:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i=[],o={url:t},a=t.indexOf("?")!==-1,s=a?"&":"?";return"string"==typeof r?i.push(r):(n=Object.keys(r),
-n.forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];i.push(t+"="+encodeURIComponent(e))})),"GET"===e?o.url+=s+i.join("&"):o.data=i.join("&"),o}},{}],10:[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:{})},{}],11:[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:{})},{}],12:[function(t,e,r){"use strict";function n(){}function i(t,e,r){return n.create(function(n){var i,o,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)h.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?u():c()}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=d.withCredentials!==!1,l=d.headers;for(p in l)h.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&&(o||(o=!0,a(n,i,t)))},i.ontimeout=function(t){o||(o=!0,s(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){o||4===i.readyState||(o=!0,i.abort())}})}function o(t,e,r){r||(r=new Error(e)),t.onError(r)}function a(t,e,r){var n,i;if(e&&t){i=e.responseType,n="response"in e?e.response:e.responseText;var a=1223===e.status?204:e.status;if(a>=200&&a<=399){try{"json"!==i&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(e){o(t,"invalid json",e)}return t.onNext(n),void t.onCompleted()}return 401===a||403===a||407===a?o(t,n):410===a?o(t,n):408===a||504===a?o(t,n):o(t,n||"Response code "+a)}}function s(t,e,r,n){o(t,r||e.statusText||"request error",n)}var c=t("./getXMLHttpRequest"),u=t("./getCORSRequest"),h=Object.prototype.hasOwnProperty,l=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||l,onCompleted:n||l}:e,o=t(i),"function"==typeof o?{dispose:o}:o},e},e.exports=i},{"./getCORSRequest":10,"./getXMLHttpRequest":11}],13:[function(e,r,n){(function(i){!function(e){if("object"==typeof n&&"undefined"!=typeof r)r.exports=e();else if("function"==typeof t&&t.amd)t([],e);else{var o;o="undefined"!=typeof window?window:"undefined"!=typeof i?i:"undefined"!=typeof self?self:this,o.falcor=e()}}(function(){var t;return function t(r,n,i){function o(s,c){if(!n[s]){if(!r[s]){var u="function"==typeof e&&e;if(!c&&u)return u(s,!0);if(a)return a(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var l=n[s]={exports:{}};r[s][0].call(l.exports,function(t){var e=r[s][1][t];return o(e?e:t)},l,l.exports,t,r,n,i)}return n[s].exports}for(var a="function"==typeof e&&e,s=0;s<i.length;s++)o(i[s]);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 a(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),a=t(55),s=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 t!==!0?new s(function(e){e.onError(t)}):this._set.apply(this,arguments)},n.prototype.preload=function(){var t=O(arguments,L,"preload");if(t!==!0)return new s(function(e){e.onError(t)});var e=Array.prototype.slice.call(arguments),r=this;return new s(function(t){return r.get.apply(r,e).subscribe(function(){},function(e){t.onError(e)},function(){t.onCompleted()})})},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 s(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={},"undefined"!=typeof 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"undefined"==typeof 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(Array.isArray(e)===!1)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&&this._root.unsafeMode===!1)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 a(r,e),r},n.prototype.unbatch=function(){var t=this._clone();return t._request=new a(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 a,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),a=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,a=arguments.length-1,s=new Array(a),c=o.fromPath(t);++r<a;)s[r]=o.fromPath(arguments[r+1]);if(0===a)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(a>0){var r=i.Observable.of(t);return t.get.apply(t,s).catch(i.Observable.empty()).concat(r).last().flatMap(function(){return n(e,c)}).filter(function(t){return t})}return i.Observable.return(t)}if(a>0){var o=s.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),a=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),s=r.path,c=r.value,u=r.found;if(u&&void 0!==c&&(c.$type!==a||void 0!==c.value)){if(c.$type)throw new o;return this._clone({_path:s})}}},{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=o,this.stack=(new Error).stack,this.boundPath=t,this.shortedPath=e}var i="InvalidModelError",o="The boundPath of the model is not valid since a value or error was found before the path end.";n.prototype=new Error,n.prototype.name=i,n.message=o,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,n.prototype.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,n.prototype.name=i,n.is=function(t){return t&&t.name===i},e.exports=n},{}],11:[function(t,e,r){function n(t,e,r,n,i,l,p){for(var f,d,m=r,v=i,g=n,y=0;;){if(0===y&&g[u]?(y=v.length,d=g[u]):(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&&s(d))break;if(g[u]||o(g,d),b===c){p?a(t,d,l,null,null,null,v,v.length,p):h(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]}var i=t(26),o=i.create,a=t(22),s=t(27),c=t(120),u=t(33),h=t(29).promote;e.exports=n},{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,a,s){var c,u,h,l=s[0],p={values:s,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),m.$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=a.length;h>u;u++)t(r,f,m,a[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,a,s,c,u,h=e,l=e;for(o=t._boxed,r=t._materialized,a=t._treatErrorsAsValues,t._boxed=!0,t._materialized=void 0===r||r,t._treatErrorsAsValues=!0,s=n(t,h.concat(null),!0),t._boxed=o,t._materialized=r,t._treatErrorsAsValues=a,h=s.optimizedPath,c=s.shorted,u=s.found,s=s.value;h.length&&null===h[h.length-1];)h.pop();if(u&&c)throw new i(l,h);return{path:h,value:s,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],a(e)||(i[e]=t[e]);return i}function i(t,e,r){Object.keys(t).filter(function(e){return!a(e)&&t[e]}).forEach(function(r){var a=t[r],s=e[r];if(s||(s=e[r]={}),a.$type){var c,u=a.value&&"object"==typeof a.value,h=!t[o];return c=u||h?n(a):a.value,void(e[r]=c)}i(a,s,r)})}var o=t(37),a=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 a=this;return new n(function(t){return a.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),a=t(29).promote,s=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(h=e[_++],null!==h&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if(p=x.$type,p===c&&void 0===x.value){S=void 0,M=!1,y=v>_;break}if(v>_){if(p===s){if(o(x)){E=!0,S=void 0,M=!1;break}if(f=n(t,m,m,x,x.value),d=f[0],!d){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:a(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),a=n(i,!0);e.exports={getValueSync:t(17),getBoundValue:t(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:a}},{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,a){var s=e.value;a.errors||(a.errors=[]),t._boxed&&(s=i(e)),a.errors.push({path:n.slice(0,r+1),value:s}),o(t,e)}},{25:25,29:29}],21:[function(t,e,r){function n(t,e,r,n,i,o,a){a.requestedMissingPaths.push(n.slice(0,r).concat(e)),a.optimizedMissingPaths.push(i.slice(0,o).concat(e))}var i=t(30),o=i.fastCopy;e.exports=function(t,e,r,i,a,s,c){var u;i.requestedMissingPaths||(i.requestedMissingPaths=[],i.optimizedMissingPaths=[]),u=r<e.length?o(e,r):[],n(t,u,r,a,s,c,i)}},{30:30}],22:[function(t,e,r){var n=t(29),i=t(25),o=n.promote,a=t(120),s=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:s};else if(t._boxed)S=i(e);else if(e.$type===a||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],_[b]=M?{$type:s}: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];y=l[v],null!==y?_[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),a=i.remove,s=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]||(s(t,e),a(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(Array.isArray(e)===!1)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 a=o[r];a[0]!==n&&(e[a]=t[a])}return e}},{40:40}],26:[function(t,e,r){function n(t,e){var r=e[c]||0;e[o+r]=t,e[c]=r+1,t[s]=r,t[a]=e}function i(t){var e=t[a];if(e){for(var r=t[s],n=e[c];n>r;)e[o+r]=e[o+r+1],++r;e[c]=n-1,t[a]=void 0,t[s]=void 0}}var o=t(43),a=t(33),s=t(42),c=t(44);e.exports={create:n,remove:i}},{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){function n(t,e){var r=t._root,n=r[o];if(n!==e){var i=e[c],a=e[s];a&&(a[c]=i),i&&(i[s]=a),e[c]=void 0,r[o]=e,e[s]=n,n[c]=e}}function i(t,e){var r=t._root,n=e[c],i=e[s];i&&(i[c]=n),n&&(n[s]=i),e[c]=void 0,e===r[o]&&(r[o]=void 0),e===r[a]&&(r[a]=void 0),e[u]=!0,r.expired.push(e)}var o=t(34),a=t(45),s=t(38),c=t(41),u=t(35);e.exports={promote:n,splice:i}},{34:34,35:35,38:38,41:41,45:45}],30:[function(t,e,r){function n(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}function i(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}function o(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}e.exports={fastCat:o,fastCatSkipNulls:i,fastCopy:n}},{}],31:[function(t,e,r){var n=t(11),i=t(23),o=t(27),a=t(143).iterateKeySet,s=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)return void i(e,u,h,l,p,f,d,_,v,g,b);var x,w;x=h[l];var S="object"==typeof x,M=l+1,E=!1,T=x;if(S&&(E={},T=a(x,E)),void 0!==T||!E.done){var C=v+1;do{b=!1;var O;null===T?O=u:(O=u[T],_[v]=T,d[l]=T);var P=_,A=C;if(O){var j=O.$type,R=j&&O.value||O;if(M<h.length&&j&&j===s&&!o(O)){g&&i(e,O,h,M,p,f,null,_,A,g,b),c(e,O);var L=n(e,r,r,O,R,p,g);b=!0,O=L[0];var N=L[1];for(P=[],A=N.length,w=0;A>w;++w)P[w]=N[w]}}t(e,r,O,h,M,p,f,d,P,A,g,b),E&&!E.done&&(T=a(x,E))}while(E&&!E.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,a,s,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,a,f,d,m,!1,s,u,h,l,p),_=v[0],x=v[1];_&&(m?n(d,e+1,r,x,_,s,u,h,l,p):T(_,x,f,h)&&E(x,g(_),h,s))}}function i(t,e,r,n,i,a,c,l){if(_(r))return S(r,i,a),[void 0,e];v(a,r);var d=r,m=r.value,g=e;if(r=r[h],null!=r)g=r[u]||e;else{var y=0,b=m.length-1;g=r=e;do{var x=m[y],M=b>y,E=o(e,g,r,x,t,M,!0,n,i,a,c,l);if(r=E[0],w(r))return E;g=E[1]}while(y++<b);if(d[h]!==r){var T=r[f]||0;r[f]=T+1,r[s+T]=d,d[h]=r,d[p]=T}}return[r,g]}function o(t,e,r,n,o,s,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(s)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[a])}else e=r,r=e[n];return[r,e]}var a=t(36),s=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,a=M(),s=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;){var b=e[g];n(b.json,0,p,d,f,a,o,i,s,c)}var _=p[l],w=r.onChange;x(w)&&v!==_&&w()}},{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,a,s,c,u){var h={},l=e<t.length-1,p=t[e],f=x(p,h);do{var d=o(r,i,a,f,l,!1,s,c,u),m=d[0],g=d[1];m&&(l?n(t,e+1,r,g,m,s,c,u):M(m,g,f,u)&&S(g,v(m),u,s)),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 a=e,h=e.value,f=t;if(e=e[u],null!=e)f=e[c]||t;else{var d=0,v=h.length-1;f=e=t;do{var y=h[d],x=v>d,w=o(t,f,e,y,x,!0,r,n,i);if(e=w[0],b(e))return w;f=w[1]}while(d++<v);if(a[u]!==e){var S=e[p]||0;e[p]=S+1,e[s+S]=a,a[u]=e,a[l]=S}}return[e,f]}function o(t,e,r,n,o,s,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[a])}else e=r,r=e[n];return[r,e]}var a=t(36),s=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,a=w(),s=t._path,u=r.cache,l=s.length?d(t,s).value:u,p=l[c]||u,f=u[h],m=-1,v=e.length;++m<v;){var g=e[m];n(g,0,u,p,l,a,o,i)}var b=u[h],_=r.onChange;y(_)&&f!==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),a=t(45),s=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,b===!0?h(g,y,t,f):(v=g[i])&&u(g,v,g[n],t),g=e.pop();if(d>=l){var x=t[a];for(g=x;d>=_&&g;)x=x[c],y=g.$size||0,d-=y,b===!0&&h(g,y,t,f),g=x;t[a]=t[c]=g,null==g?t[o]=t[s]=void 0:g[s]=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),a=t(38),s=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[a],l=e[s];e!==r&&(null!=h&&"object"==typeof h&&(h[s]=l),null!=l&&"object"==typeof l&&(l[a]=h),h=r,null!=r&&"object"==typeof r&&(r[s]=e),t[i]=t[a]=r=e,r[a]=h,r[s]=void 0),null!=u&&e!==u||(t[o]=t[s]=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),a=t(41);e.exports=function(t,e){var r=t[n],s=t[i],c=e[o],u=e[a];null!=c&&"object"==typeof c&&(c[a]=u),null!=u&&"object"==typeof u&&(u[o]=c),e===r&&(t[n]=t[o]=c),e===s&&(t[i]=t[a]=u),e[o]=e[a]=void 0,r=s=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(){if(!r&&!t._disposed){r=!0,t._callbacks[e]=null,t._optimizedPaths[e]=[],t._requestedPaths[e]=[];var n=--t._count;0!==n||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],a=0,s=o.length;s>a;++a)e[++r]=o[a];return e}var o=t(59),a=t(60),s=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=++s,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,s=i._requestedPaths,c=i._callbacks,u=o.length;return o[u]=e,s[u]=t,c[u]=r,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){a(i,o,function(t,e){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(s,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,a,s=this,c=o(t,e,s._pathMap);c?(a=c[2],i=c[1]):(a=t,i=e);var u=!1,h=!1;if(i.length<e.length){u=!0;var l=s._callbacks.length;s._callbacks[l]=r,s._requestedPaths[l]=c[0],s._optimizedPaths[l]=[],++s._count,h=n(s,l)}return[u,a,i,h]},_merge:function(t,e,r){var n=this,o=n.requestQueue.model,a=o._root,s=a.errorSelector,c=a.comparator,f=o._path;o._path=p;var d=i(t);if(e){var m=e;m instanceof Error&&(m={message:m.message}),m.$type||(m={$type:l,value:m});var v=d.map(function(t){return{path:t,value:m}});h(o,v,null,s,c)}else u(o,[{paths:d,jsonGraph:r.jsonGraph}],null,s,c);o._path=f}},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=[],a.call(this,this._subscribe)}var i=t(159),o=i.Observer,a=i.Observable,s=i.Disposable,c=i.SerialDisposable,u=i.CompositeDisposable,h=t(9),l=t(143),p=l.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(a.prototype),n.prototype.constructor=n,n.prototype.insertPath=function(t,e,r,n,i){var o=n||0,a=i||t.length-1,s=r||this.pathmaps[a+1]||(this.pathmaps[a+1]=Object.create(null));if(void 0===s||null===s)return!1;var c,u,h=t[o],l={};c=p(h,l);do{if(u=s[c],a>o){if(null==u){if(e)return!1;u=s[c]=Object.create(null)}if(this.insertPath(t,e,u,o+1,a)===!1)return!1}else s[c]=(u||0)+1,this.length+=1;l.done||(c=p(h,l))}while(!l.done);return!0},n.prototype.removePath=function(t,e,r,n){var i=r||0,o=n||t.length-1,a=e||this.pathmaps[o+1];if(void 0===a||null===a)return!0;var s,c,u=0,h=t[i],l={};s=p(h,l);do if(c=a[s],void 0!==c&&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 a[s]}else c=a[s]=(c||1)-1,0===c&&delete a[s],u+=1,this.length-=1;l.done||(s=p(h,l))}while(!l.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=s.create(function(){n||(n=!0,r&&r._remove(e))}),a=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 a},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),a=t(90),s=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,a=-1,s=t.length,c=-1,u=e.length,h=[];t:for(;++a<s;){var l=t[a];for(c=-1;++c<u;)if(i=e[c],i.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;)i=h[c],null!=i&&(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=a(m),g=p[d],y=a(g);if(s(m)&&s(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||(--l,0===l&&r())}var a,s,c,u=this,h=[],l=0,p=u._requests,f=e,d=t,m=!1;for(a=0,s=p.length;s>a;++a)if(c=p[a],c.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(){a.call(this)}var i=t(159),o=i.Observer,a=t(53),s=t(83),c=t(76),u=t(78),h=new Array(0);n.create=function(t,e){var r=new n;return r.model=t,r.jsonGraphEnvelope=e,r},n.prototype=Object.create(a.prototype),n.prototype.constructor=n,n.prototype.method="set",n.prototype.insertPath=function(){
-return!1},n.prototype.removePath=function(){return 0},n.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},n.prototype.getSourceObserver=function(t){var e=this.model,r=e._path,n=this.jsonGraphEnvelope.paths,i=e._root,l=i.errorSelector,p=i.comparator;return a.prototype.getSourceObserver.call(this,o.create(function(i){e._path=h;var o=c(e,[{paths:n,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],e._path=r,t.onNext(i)},function(i){e._path=h,u(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=[],a=[],s=[],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&&(a=i(t,0,l),o=i(e,0,l)),s[++c]=t[l],h=!0):h&&(o[++u]=f,a[u]=t[l])}return h?[s,o,a]: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)return void t.requestQueue.removeRequest(t);t.sent=!0,t.scheduled=!1;for(var n=t._pathMap,a=Object.keys(e),s=0,c=a.length;c>s;++s)for(var u=e[s],h=0,l=u.length;l>h;++h){var p=u[h],f=p.length;if(n[f]){var d=n[f];d[d.length]=p}else n[f]=[p]}for(var m=Object.keys(n),v=0,g=m.length;g>v;++v){var y=m[v];n[y]=i(n[y])}var b,_=t._collasped=o(n);t.requestQueue.model._source.get(_).subscribe(function(t){b=t},function(t){r(t,b)},function(){r(null,b)})}},{143:143}],61:[function(t,e,r){function n(t){s.call(this,t||o)}function i(t){return a.Observable.defer(function(){return t})}function o(t){function e(t){function e(t,e){if(Boolean(e.invalidated))t.invalidations.push(t.localThisPath.concat(e.path));else{var r=e.path,n=e.value;Boolean(n)&&"object"==typeof n&&n.$type===p?t.references.push({path:o(r),value:e.value}):t.values.push({path:o(r),value:e.value})}return t}function r(t){var e=t.values.concat(t.references);return e.length>0?i(b.set.apply(b,e)._toJSONG()).map(function(e){return{results:t,envelope:e}}):s.return({results:t,envelope:{jsonGraph:{},paths:[]}})}function n(t){var e,r=t.envelope,n=t.results,u=n.values,h=n.references,l=n.invalidations,p=u.map(c).map(o),f=h.reduce(a,[]),d=g.map(o),m=f.concat(d);return e=m.length>0?i(y.get.apply(y,p.concat(m))._toJSONG()):s.return(r),e.doAction(function(t){t.invalidated=l})}function a(t,e){var r=e.path;return t.push.apply(t,v.map(function(t){return r.concat(t)})),t}function c(t){return t.path}var u=t&&t.localFn;if("function"==typeof u){var h=t.model,l=h._path,f=u.apply(h,m).reduce(e,{values:[],references:[],invalidations:[],localThisPath:l}).flatMap(r).flatMap(n);return s.return(f)}return s.empty()}function r(t){function e(t){var e=t.invalidated;return e&&e.length&&y.invalidate.apply(y,e),t}return t&&"object"==typeof t?a.Observable.defer(function(){var e;try{e=t.call(x,m,v,g)}catch(t){e=s.throw(new h(t))}return e}).map(e):s.empty()}function n(t){return i(b.set(t)).reduce(function(t){return t},null).map(function(){return{invalidated:t.invalidated,paths:t.paths.map(function(t){return t.slice(_.length)})}})}function o(t){return w.concat(t)}var u=this.args,f=this.model,d=l.fromPath(u[0]),m=u[1]||[],v=(u[2]||[]).map(l.fromPath),g=(u[3]||[]).map(l.fromPath),y=f._clone({_path:[]}),b=y.withoutDataSource(),_=f._path,x=_.concat(d),w=x.slice(0,-1),S=i(f.withoutDataSource().get(d)).map(function(t){for(var e=t.json,r=-1,n=d.length;e&&++r<n;)e=e[d[r]];var i=y._derefSync(w).boxValues();return{model:i,localFn:e}}).flatMap(e).defaultIfEmpty(r(f._source)).mergeAll().flatMap(n),M=new c;return M.add(S.subscribe(function(e){var r=e.paths,n=e.invalidated,o=f.get.apply(f,r);"AsJSONG"===t.outputFormat&&(o=i(o._toJSONG()).doAction(function(t){t.invalidated=n})),M.add(o.subscribe(t))},function(e){t.onError(e)})),M}var a=t(159)&&t(158),s=a.Observable,c=a.CompositeDisposable,u=t(64),h=t(9),l=t(134),p=t(120);n.create=u.create,n.prototype=Object.create(s.prototype),n.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){o.call(this,t)}var i=t(159),o=i.Observable,a=t(64),s=t(134),c=t(88),u=t(49),h=t(81),l=t(46),p=Array.isArray,f=t(101),d=t(98),m=t(99);n.create=a.create,n.prototype=Object.create(o.prototype),n.prototype.constructor=n,n.prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var t,e,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],a=[],c=this.args,u=-1,l=c.length;++u<l;){var v,g=c[u];p(g)||"string"==typeof g?(g=s.fromPath(g),v="PathValues"):f(g)?(g.path=s.fromPath(g.path),v="PathValues"):m(g)?v="JSONGs":d(g)&&(v="PathMaps"),e!==v&&(e=v,t={inputType:v,arguments:[]},a.push(t),t.values=o),t.arguments.push(g)}return this.boundPath=h(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(){u(e,e.expired,c(r),t._maxSize,t._collectRatio,r[l])})});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,o=n.length;++i<o;){var s=n[i],c=s.inputType,u=s.arguments;if(u.length>0){var h="_"+r+c+"AsJSON",l=e[h];l(e,u)}}return t.onCompleted(),a.empty}var o=t(159),a=o.Disposable,s=t(62);n.create=s.create,n.prototype=Object.create(s.prototype),n.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),a=t(159)&&t(158),s=a.Observable,c=t(84),u=t(105),h={outputFormat:{value:"AsJSONG"}},l={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),n.prototype.constructor=n,n.prototype._mixin=function(){var t=this,e=c(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(h)},n.prototype.progressively=function(){return this._mixin(l)},n.prototype.subscribe=function(t,e,r){var n=t;n&&"object"==typeof n||(n={onNext:t||u,onError:e||u,onCompleted:r||u});var i=this._subscribe(n);switch(typeof i){case"function":return{dispose:i};case"object":return i||{dispose:u};default:return{dispose:u}}},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(){i===!1&&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?a.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 _="_"+p+y+u,x=n[_],w=x(n,b,null,h);r.push.apply(r,w[1]),"PathValues"===y?e.push.apply(e,b.map(s)):"JSONGs"===y?e.push.apply(e,m(b,c)):e.push.apply(e,w[0])}}return this.requestedPaths=e,i?(this.isCompleted=!0,a.call(this,t)):void t.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}function a(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 s(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),n.prototype.method="set",n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(t){var e=this,r=this.catch(function(n){var i;if(n&&n.invokeSourceRequest===!0){var o={},a=t._path,s=n.optimizedPaths;t._path=v,t._getPathValuesAsJSONG(t._materialize().withoutDataSource(),s,[o]),t._path=a,i=t._request.set(o).do(function(t){e.isCompleted=s.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),a={dispose:function(){}},s=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(s.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,s=this.isProgressive,c=i(this.model,this.currentRemainingPaths,t,s,n,e,r);return c?o(this,this.model,c,t,e,r,1):a}},{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,a,s,c){var u;if(u=a?i(t,e,s):o(t,e,s),u.criticalError)return r.onError(u.criticalError),null;var h=u.hasValue,l=!u.requestedMissingPaths||!t._source,p=s[0].json||s[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(s[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,a=t(49),s=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];a(o,o.expired,s(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),a=t(116),s=t(67);e.exports=function(){var t=a(arguments,o,"get");if(t!==!0)return new i(function(e){e.onError(t)});var e=n.fromPathsOrPathValues(arguments);return new s(this,e)}},{116:116,134:134,64:64,67:67,72:72}],72:[function(t,e,r){e.exports={path:!0,pathSyntax:!0}},{}],73:[function(t,e,r){function n(){}var i=t(123),o=t(159),a=o.Disposable;n.prototype.schedule=function(t){return i(t),a.empty},n.prototype.scheduleWithState=function(t,e){var r=this;return i(function(){e(r,t)}),a.empty},e.exports=n},{123:123,159:159}],74:[function(t,e,r){function n(){}var i=t(159),o=i.Disposable;n.prototype.schedule=function(t){return t(),o.empty},n.prototype.scheduleWithState=function(t,e){return e(this,t),o.empty},e.exports=n},{159:159}],75:[function(t,e,r){function n(t){this.delay=t}var i=t(159),o=i.Disposable;n.prototype.schedule=function(t){var e=setTimeout(t,this.delay);return o.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 o.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,a,s,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,a,s,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,s,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,a,u,p,m,y,b){var _=e.value;if(a.splice(0,a.length),a.push.apply(a,_),d(e))return a.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=_[x],C=S>x,O=o(t,M,e,r,E,n,T,C,!0,i,a,u,p,m,y,b);if(e=O[0],v(e))return a.index=x,O;M=O[1],n=O[2],E=O[3]}while(x++<S);if(a.index=x,w[c]!==e){var P=e[l]||0;e[l]=P+1,e[s+P]=w,w[c]=e,w[h]=P}return[e,M,n,E]}function o(t,e,r,n,o,s,c,u,h,l,f,d,m,g,y,b){for(var x=r.$type;x===p;){var w=i(t,r,n,s,l,f,d,m,g,y,b);if(r=w[0],v(r))return w;e=w[1],s=w[2],o=w[3],x=r.$type}if(void 0!==x)return[r,e,s,o];if(null==c){if(u)throw new Error("`null` is not allowed in branch key positions.");r&&(c=r[a])}else e=r,o=s,r=e[c],s=o&&o[c];return r=_(e,r,s,c,l,f,d,m,g,y,b),[r,e,s,o]}var a=t(36),s=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 a=t._root,s=a,c=a.expired,h=b(),l=a.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,s,o,i)}var C=l[u],O=a.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,s,c,u,h,l,p,f,d,m,v){var g=a(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,s,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,a,s,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,s,u),[void 0,e];y(u,r);var g=r,b=e;if(r=r[l],null!=r)b=r[h]||e,i.index=v.length;else{var _=0,w=v.length-1;b=r=e;do{var E=v[_],T=w>_,C=o(e,b,r,E,t,T,!0,n,i,a,s,u,p,m);if(r=C[0],S(r))return i.index=_,C;b=C[1]}while(_++<w);if(i.index=_,g[l]!==r){var O=r[d]||0;r[d]=O+1,r[c+O]=g,g[l]=r,g[f]=O}}return[r,b]}function o(t,e,r,n,o,a,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(a)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[s])}else e=r,r=e[n];return r=T(e,r,n,o,a,c,u,h,l,p,f,d,v),[r,e]}function a(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 s=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 a=t._root,s=a,c=a.expired,u=E(),l=t._path,f=a.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,s,o,i)}var O=f[p],P=a.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,a,s,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,a,s,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,a,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(r=r[u],null!=r)w=r[c]||e,i.index=_.length;else{var S=0,M=_.length-1;w=r=e;do{var E=_[S],T=M>S,C=o(e,w,r,E,t,T,!0,n,i,a,h,f,d,g);if(r=C[0],y(r))return i.index=S,C;w=C[1]}while(S++<M);if(i.index=S,x[u]!==r){var O=r[p]||0;r[p]=O+1,r[s+O]=x,x[u]=r,x[l]=O}}return[r,w]}function o(t,e,r,n,o,s,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(s)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[a])}else e=r,r=e[n];return r=w(e,r,n,o,s,c,u,h,l,p,d,m,v),[r,e]}var a=t(36),s=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 a=t._root,s=a,u=a.expired,l=x(),p=t._path,f=a.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,s,o,i)}var A=f[h],j=a.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),a=0,s=r.path,c=s.length;++a<c;)if("object"==typeof s[a])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=s.length;r&&++n<i;)r=r[s[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,a){var s=n.fromPath(t),c=e,u=r,h=a;if(i(s)?(h=u,u=c,c=s):c={path:s,value:c},i(c)===!1)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 a=e(t[n],n,t),s=-1,c=a.length;++s<c;)o[++r]=a[s];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 a=new Array(o);++i<o;)a[i]=t[i+n];return a}},{}],85:[function(t,e,r){var n=t(40),i=t(91),o=Array.isArray,a=t(100);e.exports=function(t){var e=t;if(a(e)){e=o(t)?[]:{};var r=t;for(var s in r)s[0]!==n&&i(r,s)&&(e[s]=r[s])}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,a){return t[n]=r,t[i]=e,t[o]=a,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){var n="function";e.exports=function(t){return Boolean(t)&&typeof t===n}},{}],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){var n="object";e.exports=function(t){return null!==t&&typeof t===n}},{}],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){var n="object";e.exports=function(t){return null==t||typeof t!==n}},{}],103:[function(t,e,r){var n=t(36),i=t(39),o=t(120),a=t(119),s=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),A&&(O=e.$type,null==O))return null==e[i]&&(e[n]=b,e[i]=t),e}else A=u(e),A&&(O=e.$type);if(O!==o){if(j=u(r),j&&(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),j&&(P=r.$type,P===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===a&&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=s(e)-s(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),a=t(88),s=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=s(P)<s(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=a(e)-a(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),a=t(100),s=t(112),c=t(113);e.exports=function(t,e,r,u){if(a(t)){var h=t.$type;return Boolean(h)&&(h===n&&c(t),o(u,t)),s(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,a,s){if(o(e,r,a,s)){if(null==e.$type)for(var c in e)c[0]!==i&&"$"!==c[0]&&n(e,c)&&t(e[c],e,c,s);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,a,s){return t===e?t:(n(t)&&(i(t,e),o(t,r,a,s)),r[a]=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,a=e[o]||0,s=-1;++s<r;){var c=t[n+s];void 0!==c&&(c[i]=e,e[n+(a+s)]=c,t[n+s]=void 0)}return e[o]=r+a,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),a=t(44);e.exports=function(t){for(var e=-1,r=t[a]||0;++e<r;){var s=t[n+e];null!=s&&(s[i]=s[o]=t[n+e]=void 0)}return t[a]=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),a=t(44);e.exports=function(t){var e=t[i];if(e){for(var r=(t[o]||0)-1,s=(e[a]||0)-1;++r<=s;)e[n+r]=e[n+(r+1)];e[a]=s,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),a=t(44);e.exports=function(t,e){var r=[t],s=0;do{var c=r[s--];if(c&&c[o]!==e){c[o]=e,r[s++]=c[i];for(var u=-1,h=c[a]||0;++u<h;)r[s++]=c[n+u]}}while(s>-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),a=t(108),s=t(114);e.exports=function(t,e,r,c){var u=t;do{var h=u[o],l=u.$size=(u.$size||0)-e;0>=l&&null!=h?a(u,h,u[n],r):u[i]!==c&&s(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),a=t(98),s=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=s.fromPath(h.path),l=!0):o(h)&&e.jsonGraph?l=!0:a(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),i=n.atom,o=t(106),a=t(122),s=t(37),c=50,u=t(85),h=Array.isArray,l=t(88),p=t(87);e.exports=function(t,e,r){var n=0,f=t,d=e;if(d?(f=u(f),n=l(f),f.$type=d):(f=i(r),d=f.$type,f[s]=!0),null==r)n=c+1;else if(null==n||0>=n)switch(typeof r){case"object":n=h(r)?c+r.length:c+1;break;case"string":n=c+r.length;break;default:n=c+1}var m=p(f);return"number"==typeof m&&a>m&&(f.$expires=o()+-1*m),f.$size=n,f}},{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(){if(c.length)throw c.shift()}function i(t){var e;e=s.length?s.pop():new o,e.task=t,a(e)}function o(){this.task=null}var a=t(124),s=[],c=[],u=a.makeRequestCallFromTimer(n);e.exports=i,o.prototype.call=function(){try{this.task.call()}catch(t){i.onerror?i.onerror(t):(c.push(t),u())}finally{this.task=null,s[s.length]=this}}},{124:124}],124:[function(t,e,r){(function(t){"use strict";function r(t){s.length||(a(),c=!0),s[s.length]=t}function n(){for(;u<s.length;){var t=u;if(u+=1,s[t].call(),u>h){for(var e=0,r=s.length-u;r>e;e++)s[e]=s[e+u];s.length-=u,u=0}}s.length=0,u=0,c=!1}function i(t){var e=1,r=new l(t),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){e=-e,n.data=e}}function o(t){return function(){function e(){clearTimeout(r),clearInterval(n),t()}var r=setTimeout(e,0),n=setInterval(e,50)}}e.exports=r;var a,s=[],c=!1,u=0,h=1024,l=t.MutationObserver||t.WebKitMutationObserver;a="function"==typeof l?i(n):o(n),r.requestFlush=a,r.makeRequestCallFromTimer=o}).call(this,"undefined"!=typeof i?i:"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){if(this._jsongUrl=t,"number"==typeof e){var r={timeout:e};e=r}this._config=n({timeout:15e3,headers:{}},e||{})}var o=t(129),a=t(126);Array.isArray,i.prototype={constructor:i,buildQueryObject:a,get:function(t){var e="GET",r=this.buildQueryObject(this._jsongUrl,e,{paths:t,method:"get"}),i=n(r,this._config),a=this;return o(e,i,a)},set:function(t){var e="POST",r=this.buildQueryObject(this._jsongUrl,e,{jsonGraph:t,method:"set"}),i=n(r,this._config);i.headers["Content-Type"]="application/x-www-form-urlencoded";var a=this;return o(e,i,a)},call:function(t,e,r,i){e=e||[],r=r||[],i=i||[];var a="POST",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 c=this.buildQueryObject(this._jsongUrl,a,s.join("&")),u=n(c,this._config);u.headers["Content-Type"]="application/x-www-form-urlencoded";var h=this;return o(a,u,h)}},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=[],o={url:t},a=-1!==t.indexOf("?"),s=a?"&":"?";return"string"==typeof r?i.push(r):(n=Object.keys(r),n.forEach(function(t){var e="object"==typeof r[t]?JSON.stringify(r[t]):r[t];i.push(t+"="+encodeURIComponent(e))})),"GET"===e?o.url+=s+i.join("&"):o.data=i.join("&"),o}},{}],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,"undefined"!=typeof i?i:"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,"undefined"!=typeof i?i:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(t,e,r){"use strict";function n(){}function i(t,e,r){return n.create(function(n){var i,o,l,p,f,d={method:t||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in e)h.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?u():c()}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=d.withCredentials!==!1,l=d.headers;for(p in l)h.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&&(o||(o=!0,a(n,i,t)))},i.ontimeout=function(t){o||(o=!0,s(n,i,"timeout error",t))},i.send(d.data)}catch(t){n.onError(t)}return function(){o||4===i.readyState||(o=!0,i.abort())}})}function o(t,e,r){r||(r=new Error(e)),t.onError(r)}function a(t,e,r){var n,i;if(e&&t){i=e.responseType,n="response"in e?e.response:e.responseText;var a=1223===e.status?204:e.status;if(a>=200&&399>=a){try{"json"!==i&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(e){o(t,"invalid json",e)}return t.onNext(n),void t.onCompleted()}return 401===a||403===a||407===a?o(t,n):410===a?o(t,n):408===a||504===a?o(t,n):o(t,n||"Response code "+a)}}function s(t,e,r,n){o(t,r||e.statusText||"request error",n)}var c=t(128),u=t(127),h=Object.prototype.hasOwnProperty,l=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||l,onCompleted:n||l}:e,o=t(i),"function"==typeof o?{dispose:o}:o},e},e.exports=i},{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),a=function(t,e){return i(new n(t,e))};e.exports=a,a.fromPathsOrPathValues=function(t,e){if(!t)return[];for(var r=[],n=0,i=t.length;i>n;n++)"string"==typeof t[n]?r[n]=a(t[n],e):"string"==typeof t[n].path?r[n]={path:a(t[n].path,e),value:t[n].value}:r[n]=t[n];return r},a.fromPath=function(t,e){return t?"string"==typeof t?a(t,e):t:[]},a.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={},a=[];!e.done;){switch(e.type){case n.token:var s=+e.token[0];isNaN(s)||i.throwError(i.invalidIdentifier,t),a[a.length]=e.token;break;case n.dotSeparator:0===a.length&&i.throwError(i.unexpectedToken,t);break;case n.space:break;case n.openingBracket:o(t,e,r,a);break;default:i.throwError(i.unexpectedToken,t)}e=t.next()}return 0===a.length&&i.throwError(i.invalidPath,t),a}},{132:132,133:133,136:136}],136:[function(t,e,r){var n=t(132),i=t(133),o=i.indexer,a=t(138),s=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),a(t,h,r,u);break;case n.space:break;case n.closingBracket:l=!0;break;case n.quote:s(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,a){for(var s=t.next(),c="",u=e.token,h=!1,l=!1;!s.done;){switch(s.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+=s.token;break;case n.quote:h?(c+=s.token,h=!1):s.token!==u?c+=s.token:l=!0;break;case n.escape:h=!0;break;default:i.throwError(i.unexpectedToken,t)}if(l)break;s=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,a){var s,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),++u,3===u&&(l=!1);break;case i.token:s=n.toNumber(t.next().token),isNaN(s)&&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?s:s-1}}},{132:132,133:133,140:140}],139:[function(t,e,r){var n=t(132),i=t(131),o=t(133),a=o.routed;e.exports=function(t,e,r,s){var c=t.next(),u=!1,h="";switch(c.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(a.invalid,t)}var l=t.next();if(l.type===n.colon&&(u=!0,l=t.next(),l.type!==n.token&&o.throwError(a.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(a.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 a:S=o.dotSeparator;break;case s: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),a=".",s=",",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,a=!0;a&&i<r.length;++i){var s=r[i],c=typeof s;if(s&&"object"===c){var u={},h=n(s,u),l=i+1;do{var p=o[h];a=void 0!==p,a&&(a=t(p,r,l)),h=n(s,u)}while(a&&!u.done);break}o=o[s],a=void 0!==o}return a}},{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{e.loaded&&e.rangeOffset>e.to&&(++e.arrayOffset,e.loaded=!1);var o=e.arrayOffset,a=t.length;if(o>=a){e.done=!0;break}var s=t[e.arrayOffset],c=typeof s;if("object"===c){if(e.loaded||n(s,e),e.empty)continue;r=e.rangeOffset++}else++e.arrayOffset,r=s}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,a=t.length;a>o;++o){var s=t[o];n(e[s.length],s,0)||(r[++i]=s)}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,a=t.length;a>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,a,s,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(s=[],l=-1,r-1>e){for(p=c(t,s);++l<p;)n=s[l],o=i(t[n],e+1,r),a=o.code,w[a]?o=w[a]:(S[E++]=a,o=w[a]={keys:[],sets:o.sets}),x=u(x+n+a),h(n)&&o.keys.push(parseInt(n,10))||o.keys.push(n);for(;++M<E;)if(n=S[M],o=w[n],s=o.keys,p=s.length,p>0)for(f=o.sets,d=-1,m=f.length,b=s[0];++d<m;){for(v=f[d],g=-1,y=v.length,_=new Array(y+1),_[0]=p>1&&s||b;++g<y;)_[g+1]=v[g];T[C++]=_}}else for(p=c(t,s),p>1?T[C++]=[s]:T[C++]=s;++l<p;)x=u(x+s[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]=a(n))}return t}function a(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(n===!0){t.sort(s);var o=t[0],a=t[r];if(r>=a-o)return{from:o,to:a}}return t}function s(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=[],a=0;for(var s in t)if(h(s)&&n(e=t[s]))for(var c=i(e,0,parseInt(s,10)).sets,u=-1,l=c.length;++u<l;)r[a++]=o(c[u]);return r}},{}],148:[function(t,e,r){function n(t,e,r){var o,a=e[r],s={},c=r+1;o=i(a,s);do{var u=t[o];u||(c===e.length?t[o]=null:u=t[o]={}),c<e.length&&n(u,e,c),s.done||(o=i(a,s))}while(!s.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,s.length?u=s.concat(u):l=-1,u.length&&i()}function i(){if(!h){var t=setTimeout(n);h=!0;for(var e=u.length;e;){for(s=u,u=[];++l<e;)s&&s[l].run();l=-1,e=u.length}s=null,h=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function a(){}var s,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=a,c.addListener=a,c.once=a,c.off=a,c.removeListener=a,c.removeAllListeners=a,c.emit=a,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 a(t,e,r){try{t(e,r)}catch(t){return v=t,g}}function s(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 a=new s(n);a.then(i,o),u(t,new f(e,r,a))})}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)return void(1===t._37?h(e.promise,t._12):l(e.promise,t._12));var n=o(r,t._12);n===g?l(e.promise,v):h(e.promise,n)})}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 s)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=a(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=s,s._99=n,s.prototype.then=function(t,e){if(this.constructor!==s)return c(this,t,e);var r=new s(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){var r=arguments.length?this.then.apply(this,arguments):this;r.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),a=n(!1),s=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 s;if(void 0===t)return c;if(t===!0)return o;if(t===!1)return a;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(a,s){if(s&&("object"==typeof s||"function"==typeof s)){if(s instanceof i&&s.then===i.prototype.then){for(;3===s._37;)s=s._12;return 1===s._37?n(a,s._12):(2===s._37&&r(s._12),void s.then(function(t){n(a,t)},r))}var c=s.then;if("function"==typeof c){var u=new i(c.bind(s));return void u.then(function(t){n(a,t)},r)}}e[a]=s,0===--o&&t(e)}if(0===e.length)return t([]);for(var o=e.length,a=0;a<e.length;a++)n(a,e[a])})},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||"undefined"==typeof 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(e,r,n){(function(i){(function(o){var a={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},s=a[typeof window]&&window||this,c=a[typeof n]&&n&&!n.nodeType&&n,u=a[typeof r]&&r&&!r.nodeType&&r,h=(u&&u.exports===c&&c,a[typeof i]&&i);!h||h.global!==h&&h.window!==h||(s=h),"function"==typeof t&&t.amd?t(["rx"],function(t,e){return o(s,e,t)}):"object"==typeof r&&r&&r.exports===c?r.exports=o(s,r.exports,e(159)):s.Rx=o(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 a(t,e,r){return new g(function(n){var i=!1,o=null,a=[];return t.subscribe(function(t){var s,c;try{c=e(t)}catch(t){return void n.onError(t)}if(s=0,i)try{s=r(c,o)}catch(t){return void n.onError(t)}else i=!0,o=c;s>0&&(o=c,a=[]),s>=0&&a.push(t)},function(t){n.onError(t)},function(){n.onNext(a),n.onCompleted()})},t)}function s(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 a;try{a=o(n,r,t)}catch(t){return void e.onError(t)}a?(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,a,s;return n.subscribe(function(n){!s&&(s=!0);try{o?a=t(a,n):(a=r?t(e,n):n,o=!0)}catch(t){return i.onError(t)}},function(t){i.onError(t)},function(){s&&i.onNext(a),!s&&r&&i.onNext(e),!s&&!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,a=+e||0;return Math.abs(a)===1/0&&(a=0),0>a?(i.onNext(!1),i.onCompleted(),y):n.subscribe(function(e){o++>=a&&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),a(this,t,function(t,r){return-1*e(t,r)})},m.min=function(t){return this.minBy(w,t).map(function(t){return s(t)})},m.maxBy=function(t,e){return e||(e=S),a(this,t,e)},m.max=function(t){return this.maxBy(w,t).map(function(t){return s(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,a=[],s=[],c=r.subscribe(function(t){var r,i;if(s.length>0){i=s.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()):a.push(t)},function(t){n.onError(t)},function(){i=!0,0===a.length&&(s.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(a.length>0){var o=a.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()):s.push(t)},function(t){n.onError(t)},function(){o=!0,0===s.length&&(a.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("undefined"==typeof 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("undefined"==typeof 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 a=t;if(r)try{a=r(t)}catch(t){return void i.onError(t)}o.set(n,a)},function(t){i.onError(t)},function(){i.onNext(o),i.onCompleted()})},n)},r})}).call(this,"undefined"!=typeof i?i:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(e,r,n){(function(e,i){(function(o){function a(t){for(var e=[],r=0,n=t.length;n>r;r++)e.push(t[r]);return e}function c(t,e){if(ut&&e.stack&&"object"==typeof t&&null!==t&&t.stack&&-1===t.stack.indexOf(pt)){for(var r=[],n=e;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(t.stack);var i=r.join("\n"+pt+"\n");t.stack=u(i)}}function u(t){for(var e=t.split("\n"),r=[],n=0,i=e.length;i>n;n++){var o=e[n];h(o)||l(o)||!o||r.push(o)}return r.join("\n")}function h(t){var e=f(t);if(!e)return!1;var r=e[0],n=e[1];return r===ht&&n>=lt&&Dr>=n}function l(t){return-1!==t.indexOf("(module.js:")||-1!==t.indexOf("(node.js:")}function p(){if(ut)try{throw new Error}catch(n){var t=n.stack.split("\n"),e=t[0].indexOf("@")>0?t[1]:t[2],r=f(e);if(!r)return;return ht=r[0],r[1]}}function f(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 d(t){var e=[];if(!qt(t))return e;Wt.nonEnumArgs&&t.length&&Xt(t)&&(t=Zt.call(t));var r=Wt.enumPrototypes&&"function"==typeof t,n=Wt.enumErrorProps&&(t===zt||t instanceof Error);for(var i in t)r&&"prototype"==i||n&&("message"==i||"name"==i)||e.push(i);if(Wt.nonEnumShadows&&t!==Gt){var o=t.constructor,a=-1,s=Ct;if(t===(o&&o.prototype))var c=t===Vt?kt:t===zt?Rt:Ft.call(t),u=Ht[c];for(;++a<s;)i=Tt[a],u&&u[i]||!Ut.call(t,i)||e.push(i)}return e}function m(t,e,r){for(var n=-1,i=r(t),o=i.length;++n<o;){var a=i[n];if(e(t[a],a,t)===!1)break}return t}function v(t,e){return m(t,e,d)}function g(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function y(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 a=Ft.call(t),s=Ft.call(e);if(a==Ot&&(a=It),s==Ot&&(s=It),a!=s)return!1;switch(a){case At:case jt:return+t==+e;case Nt:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case Dt:case kt:return t==String(e)}var c=a==Pt;if(!c){if(a!=It||!Wt.nodeClass&&(g(t)||g(e)))return!1;var u=!Wt.argsObject&&Xt(t)?Object:t.constructor,h=!Wt.argsObject&&Xt(e)?Object:e.constructor;if(!(u==h||Ut.call(t,"constructor")&&Ut.call(e,"constructor")||ct(u)&&u instanceof u&&ct(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=y(t[p],d,r,n)))break}}else v(e,function(e,i,o){return Ut.call(o,i)?(p++,f=Ut.call(t,i)&&y(t[i],e,r,n)):void 0}),f&&v(t,function(t,e,r){return Ut.call(r,e)?f=--p>-1:void 0});return r.pop(),n.pop(),f}function b(t,e){for(var r=new Array(t),n=0;t>n;n++)r[n]=e();return r}function _(){try{return Yt.apply(this,arguments)}catch(t){return ee.e=t,ee}}function x(t){if(!ct(t))throw new TypeError("fn must be a function");return Yt=t,_}function w(t){throw t}function S(t,e){this.id=t,this.value=e}function M(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function E(t,e){e.isDisposed||(e.isDisposed=!0,e.disposable.dispose())}function T(t){this._s=s}function C(t){this._s=s,this._l=s.length,this._i=0}function O(t){this._a=t}function P(t){this._a=t,this._l=L(t),this._i=0}function A(t){return"number"==typeof t&&Y.isFinite(t)}function j(t){var e,r=t[_t];if(!r&&"string"==typeof t)return e=new T(t),e[_t]();if(!r&&t.length!==o)return e=new O(t),e[_t]();if(!r)throw new TypeError("Object is not iterable");return t[_t]()}function R(t){var e=+t;return 0===e?e:isNaN(e)?e:0>e?-1:1}function L(t){var e=+t.length;return isNaN(e)?0:0!==e&&A(e)?(e=R(e)*Math.floor(Math.abs(e)),0>=e?0:e>tr?tr:e):e}function N(t,e){this.observer=t,this.parent=e}function I(t,e){return ge(t)||(t=xe),new rr(e,t)}function D(t,e){this.observer=t,this.parent=e}function k(t,e){this.observer=t,this.parent=e}function F(t,e){return new jr(function(r){var n=new le,i=new pe;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=Xe(n));var o=new le;i.setDisposable(o),o.setDisposable(n.subscribe(r))},function(t){r.onCompleted(t)})),i},t)}function U(){return!1}function B(t,e){var r=this;return new jr(function(n){var i=0,o=t.length;return r.subscribe(function(r){if(o>i){var a=t[i++],s=x(e)(r,a);if(s===ee)return n.onError(s.e);n.onNext(s)}else n.onCompleted()},function(t){n.onError(t)},function(){n.onCompleted()})},r)}function U(){return!1}function z(){return[]}function U(){return!1}function G(){return[]}function V(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=Et(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return st(i)&&(i=Xe(i)),(St(i)||wt(i))&&(i=er(i)),i}).concatAll()}function H(t,e,r){for(var n=0,i=t.length;i>n;n++)if(r(t[n],e))return n;return-1}function W(t){this.comparer=t,this.set=[]}function q(t,e,r){var n=Et(e,r,3);return t.map(function(e,r){var i=n(e,r,t);return st(i)&&(i=Xe(i)),(St(i)||wt(i))&&(i=er(i)),i}).mergeAll()}var X={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},Y=X[typeof window]&&window||this,K=X[typeof n]&&n&&!n.nodeType&&n,Z=X[typeof r]&&r&&!r.nodeType&&r,J=Z&&Z.exports===K&&K,Q=X[typeof i]&&i;!Q||Q.global!==Q&&Q.window!==Q||(Y=Q);var tt={internals:{},config:{Promise:Y.Promise},helpers:{}},et=tt.helpers.noop=function(){},rt=(tt.helpers.notDefined=function(t){return"undefined"==typeof t},tt.helpers.identity=function(t){return t}),nt=(tt.helpers.pluck=function(t){return function(e){return e[t]}},tt.helpers.just=function(t){return function(){return t}},tt.helpers.defaultNow=Date.now),it=tt.helpers.defaultComparer=function(t,e){return Kt(t,e)},ot=tt.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},at=(tt.helpers.defaultKeySerializer=function(t){return t.toString()},tt.helpers.defaultError=function(t){throw t}),st=tt.helpers.isPromise=function(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then},ct=(tt.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},tt.helpers.not=function(t){return!t},tt.helpers.isFunction=function(){var t=function(t){return"function"==typeof t||!1};return t(/x/)&&(t=function(t){return"function"==typeof t&&"[object Function]"==Ft.call(t)}),t}());tt.config.longStackSupport=!1;var ut=!1;try{throw new Error}catch(t){ut=!!t.stack}var ht,lt=p(),pt="From previous event:",ft=tt.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};ft.prototype=Error.prototype;var dt=tt.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};dt.prototype=Error.prototype;var mt=tt.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};mt.prototype=Error.prototype;var vt=tt.NotSupportedError=function(t){this.message=t||"This operation is not supported",Error.call(this)};vt.prototype=Error.prototype;var gt=tt.NotImplementedError=function(t){this.message=t||"This operation is not implemented",Error.call(this)};gt.prototype=Error.prototype;var yt=tt.helpers.notImplemented=function(){throw new gt},bt=tt.helpers.notSupported=function(){throw new vt},_t="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";Y.Set&&"function"==typeof(new Y.Set)["@@iterator"]&&(_t="@@iterator");var xt=tt.doneEnumerator={done:!0,value:o},wt=tt.helpers.isIterable=function(t){return t[_t]!==o},St=tt.helpers.isArrayLike=function(t){return t&&t.length!==o};tt.helpers.iterator=_t;var Mt,Et=tt.internals.bindCallback=function(t,e,r){if("undefined"==typeof 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)}},Tt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ct=Tt.length,Ot="[object Arguments]",Pt="[object Array]",At="[object Boolean]",jt="[object Date]",Rt="[object Error]",Lt="[object Function]",Nt="[object Number]",It="[object Object]",Dt="[object RegExp]",kt="[object String]",Ft=Object.prototype.toString,Ut=Object.prototype.hasOwnProperty,Bt=Ft.call(arguments)==Ot,zt=Error.prototype,Gt=Object.prototype,Vt=String.prototype,$t=Gt.propertyIsEnumerable;try{Mt=!(Ft.call(document)==It&&!({toString:0}+""))}catch(t){Mt=!0}var Ht={};Ht[Pt]=Ht[jt]=Ht[Nt]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Ht[At]=Ht[kt]={constructor:!0,toString:!0,valueOf:!0},Ht[Rt]=Ht[Lt]=Ht[Dt]={constructor:!0,toString:!0},Ht[It]={constructor:!0};var Wt={};!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);Wt.enumErrorProps=$t.call(zt,"message")||$t.call(zt,"name"),
-Wt.enumPrototypes=$t.call(t,"prototype"),Wt.nonEnumArgs=0!=r,Wt.nonEnumShadows=!/valueOf/.test(e)}(1);var qt=tt.internals.isObject=function(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1},Xt=function(t){return!(!t||"object"!=typeof t)&&Ft.call(t)==Ot};Bt||(Xt=function(t){return!(!t||"object"!=typeof t)&&Ut.call(t,"callee")});var Yt,Kt=tt.internals.isEqual=function(t,e){return y(t,e,[],[])},Zt=({}.hasOwnProperty,Array.prototype.slice),Jt=this.inherits=tt.internals.inherits=function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r},Qt=tt.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 a=e[i];for(var s in a)t[s]=a[s]}},te=tt.internals.addRef=function(t,e){return new jr(function(r){return new ie(e.getDisposable(),t.subscribe(r))})},ee={e:{}};S.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var re=tt.internals.PriorityQueue=function(t){this.items=new Array(t),this.length=0},ne=re.prototype;ne.isHigherPriority=function(t,e){return this.items[t].compareTo(this.items[e])<0},ne.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)}}},ne.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)}}},ne.peek=function(){return this.items[0].value},ne.removeAt=function(t){this.items[t]=this.items[--this.length],this.items[this.length]=o,this.heapify()},ne.dequeue=function(){var t=this.peek();return this.removeAt(0),t},ne.enqueue=function(t){var e=this.length++;this.items[e]=new S(re.count++,t),this.percolate(e)},ne.remove=function(t){for(var e=0;e<this.length;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},re.count=0;var ie=tt.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(!ue(r[t]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},oe=ie.prototype;oe.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},oe.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},oe.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 ae=tt.Disposable=function(t){this.isDisposed=!1,this.action=t||et};ae.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var se=ae.create=function(t){return new ae(t)},ce=ae.empty={dispose:et},ue=ae.isDisposable=function(t){return t&&ct(t.dispose)},he=ae.checkDisposed=function(t){if(t.isDisposed)throw new dt},le=tt.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};le.prototype.getDisposable=function(){return this.current},le.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()},le.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var pe=tt.SerialDisposable=function(){this.isDisposed=!1,this.current=null};pe.prototype.getDisposable=function(){return this.current},pe.prototype.setDisposable=function(t){var e=this.isDisposed;if(!e){var r=this.current;this.current=t}r&&r.dispose(),e&&t&&t.dispose()},pe.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.current;this.current=null}t&&t.dispose()};var fe=tt.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,this.disposable.count--,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?ce:new t(this)},e}();M.prototype.dispose=function(){this.scheduler.scheduleWithState(this,E)};var de=tt.internals.ScheduledItem=function(t,e,r,n,i){this.scheduler=t,this.state=e,this.action=r,this.dueTime=n,this.comparer=i||ot,this.disposable=new le};de.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},de.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},de.prototype.isCancelled=function(){return this.disposable.isDisposed},de.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var me=tt.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(),ce}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=nt,t.normalize=function(t){return 0>t&&(t=0),t},t}(),ve=me.normalize,ge=me.isScheduler;!function(t){function e(t,e){function r(e){i(e,function(e){var n=!1,i=!1,a=t.scheduleWithState(e,function(t,e){return n?o.remove(a):i=!0,r(e),ce});i||(o.add(a),n=!0)})}var n=e[0],i=e[1],o=new ie;return r(n),o}function r(t,e,r){function n(e){o(e,function(e,i){var o=!1,s=!1,c=t[r](e,i,function(t,e){return o?a.remove(c):s=!0,n(e),ce});s||(a.add(c),o=!0)})}var i=e[0],o=e[1],a=new ie;return n(i),a}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")})}}(me.prototype),function(t){me.prototype.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,e)},me.prototype.schedulePeriodicWithState=function(t,e,r){if("undefined"==typeof Y.setInterval)throw new vt;e=ve(e);var n=t,i=Y.setInterval(function(){n=r(n)},e);return se(function(){Y.clearInterval(i)})}}(me.prototype),function(t){t.catchError=t.catch=function(t){return new Ee(this,t)}}(me.prototype);var ye,be,_e=(tt.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 le;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}(),me.immediate=function(){function t(t,e){return e(this,t)}return new me(nt,t,bt,bt)}()),xe=me.currentThread=function(){function t(){for(;r.length>0;){var t=r.dequeue();!t.isCancelled()&&t.invoke()}}function e(e,n){var i=new de(this,e,n,this.now());if(r)r.enqueue(i);else{r=new re(4),r.enqueue(i);var o=x(t)();if(r=null,o===ee)return w(o.e)}return i.disposable}var r,n=new me(nt,e,bt,bt);return n.scheduleRequired=function(){return!r},n}(),we=function(){var t,e=et;if(Y.setTimeout)t=Y.setTimeout,e=Y.clearTimeout;else{if(!Y.WScript)throw new vt;t=function(t,e){Y.WScript.Sleep(e),t()}}return{setTimeout:t,clearTimeout:e}}(),Se=we.setTimeout,Me=we.clearTimeout;!function(){function t(e){if(a)Se(function(){t(e)},0);else{var r=o[e];if(r){a=!0;var n=x(r)();if(be(e),a=!1,n===ee)return w(n.e)}}}function r(){if(!Y.postMessage||Y.importScripts)return!1;var t=!1,e=Y.onmessage;return Y.onmessage=function(){t=!0},Y.postMessage("","*"),Y.onmessage=e,t}function n(e){"string"==typeof e.data&&e.data.substring(0,u.length)===u&&t(e.data.substring(u.length))}var i=1,o={},a=!1;be=function(t){delete o[t]};var s=RegExp("^"+String(Ft).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=Q&&J&&Q.setImmediate)&&!s.test(c)&&c;if(ct(c))ye=function(e){var r=i++;return o[r]=e,c(function(){t(r)}),r};else if("undefined"!=typeof e&&"[object process]"==={}.toString.call(e))ye=function(r){var n=i++;return o[n]=r,e.nextTick(function(){t(n)}),n};else if(r()){var u="ms.rx.schedule"+Math.random();Y.addEventListener?Y.addEventListener("message",n,!1):Y.attachEvent?Y.attachEvent("onmessage",n):Y.onmessage=n,ye=function(t){var e=i++;return o[e]=t,Y.postMessage(u+currentId,"*"),e}}else if(Y.MessageChannel){var h=new Y.MessageChannel;h.port1.onmessage=function(e){t(e.data)},ye=function(t){var e=i++;return o[e]=t,h.port2.postMessage(e),e}}else ye="document"in Y&&"onreadystatechange"in Y.document.createElement("script")?function(e){var r=Y.document.createElement("script"),n=i++;return o[n]=e,r.onreadystatechange=function(){t(n),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},Y.document.documentElement.appendChild(r),n}:function(e){var r=i++;return o[r]=e,Se(function(){t(r)},0),r}}();var Ee=(me.timeout=me.default=function(){function t(t,e){var r=this,n=new le,i=ye(function(){!n.isDisposed&&n.setDisposable(e(r,t))});return new ie(n,se(function(){be(i)}))}function e(t,e,r){var n=this,i=me.normalize(e),o=new le;if(0===i)return n.scheduleWithState(t,r);var a=Se(function(){!o.isDisposed&&o.setDisposable(r(n,t))},i);return new ie(o,se(function(){Me(a)}))}function r(t,e,r){return this.scheduleWithRelativeAndState(t,e-this.now(),r)}return new me(nt,t,e,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 Jt(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 ce}}},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 le;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}(me)),Te=tt.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 ge(t)||(t=_e),new jr(function(r){return t.scheduleWithState(e,function(t,e){e._acceptObservable(r),"N"===e.kind&&r.onCompleted()})})},t}(),Ce=Te.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 Te("N",n,null,t,e,r)}}(),Oe=Te.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 Te("E",null,n,t,e,r)}}(),Pe=Te.createOnCompleted=function(){function t(t,e,r){return r()}function e(t){return t.onCompleted()}function r(){return"OnCompleted()"}return function(){return new Te("C",null,null,t,e,r)}}(),Ae=tt.Observer=function(){};Ae.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},Ae.prototype.asObserver=function(){return new Ne(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Ae.prototype.checked=function(){return new Ie(this)};var je=Ae.create=function(t,e,r){return t||(t=et),e||(e=at),r||(r=et),new Ne(t,e,r)};Ae.fromNotifier=function(t,e){return new Ne(function(r){return t.call(e,Ce(r))},function(r){return t.call(e,Oe(r))},function(){return t.call(e,Pe())})},Ae.prototype.notifyOn=function(t){return new ke(t,this)},Ae.prototype.makeSafe=function(t){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,t)};var Re,Le=tt.internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return Jt(e,t),e.prototype.next=yt,e.prototype.error=yt,e.prototype.completed=yt,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}(Ae),Ne=tt.AnonymousObserver=function(t){function e(e,r,n){t.call(this),this._onNext=e,this._onError=r,this._onCompleted=n}return Jt(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}(Le),Ie=function(t){function e(e){t.call(this),this._observer=e,this._state=0}Jt(e,t);var r=e.prototype;return r.onNext=function(t){this.checkAccess();var e=x(this._observer.onNext).call(this._observer,t);this._state=0,e===ee&&w(e.e)},r.onError=function(t){this.checkAccess();var e=x(this._observer.onError).call(this._observer,t);this._state=2,e===ee&&w(e.e)},r.onCompleted=function(){this.checkAccess();var t=x(this._observer.onCompleted).call(this._observer);this._state=2,t===ee&&w(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}(Ae),De=tt.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 pe}return Jt(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))return void(e.isAcquired=!1);r=e.queue.shift();try{r()}catch(t){throw e.queue=[],e.hasFaulted=!0,t}t()}))},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},e}(Le),ke=function(t){function e(e,r,n){t.call(this,e,r),this._cancel=n}return Jt(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}(De),Fe=tt.Observable=function(){function t(t){if(tt.config.longStackSupport&&ut){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){c(t,e),n(t)},t.call(e,r)}}else this._subscribe=t}return Re=t.prototype,Re.subscribe=Re.forEach=function(t,e,r){return this._subscribe("object"==typeof t?t:je(t,e,r))},Re.subscribeOnNext=function(t,e){return this._subscribe(je("undefined"!=typeof e?function(r){t.call(e,r)}:t))},Re.subscribeOnError=function(t,e){return this._subscribe(je(null,"undefined"!=typeof e?function(r){t.call(e,r)}:t))},Re.subscribeOnCompleted=function(t,e){return this._subscribe(je(null,null,"undefined"!=typeof e?function(){t.call(e)}:t))},t}(),Ue=tt.ObservableBase=function(t){function e(t){return t&&ct(t.dispose)?t:ct(t)?se(t):ce}function r(t,r){var n=r[0],i=r[1],o=x(i.subscribeCore).call(i,n);return o!==ee||n.fail(ee.e)?void n.setDisposable(e(o)):w(ee.e)}function n(t){var e=new Rr(t),n=[e,this];return xe.scheduleRequired()?xe.scheduleWithState(n,r):r(null,n),e}function i(){t.call(this,n)}return Jt(i,t),i.prototype.subscribeCore=yt,i}(Fe),Be=tt.internals.Enumerable=function(){},ze=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 Jt(e,t),e.prototype.subscribeCore=function(t){var e,n=new pe,i=_e.scheduleRecursiveWithState(this.sources[_t](),function(i,o){if(!e){var a=x(i.next).call(i);if(a===ee)return t.onError(a.e);if(a.done)return t.onCompleted();var s=a.value;st(s)&&(s=Xe(s));var c=new le;n.setDisposable(c),c.setDisposable(s.subscribe(new r(t,o,i)))}});return new ie(n,i,se(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}(Ue);Be.prototype.concat=function(){return new ze(this)};var Ge=function(t){function e(e){this.sources=e,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e,r=this.sources[_t](),n=new pe,i=_e.scheduleRecursiveWithState(null,function(i,o){if(!e){var a=x(r.next).call(r);if(a===ee)return t.onError(a.e);if(a.done)return null!==i?t.onError(i):t.onCompleted();var s=a.value;st(s)&&(s=Xe(s));var c=new le;n.setDisposable(c),c.setDisposable(s.subscribe(function(e){t.onNext(e)},o,function(){t.onCompleted()}))}});return new ie(n,i,se(function(){e=!0}))},e}(Ue);Be.prototype.catchError=function(){return new Ge(this)},Be.prototype.catchErrorWhen=function(t){var e=this;return new jr(function(r){var n,i,o=new Nr,a=new Nr,s=t(o),c=s.subscribe(a),u=e[_t](),h=new pe,l=_e.scheduleRecursive(function(t){if(!n){var e=x(u.next).call(u);if(e===ee)return r.onError(e.e);if(e.done)return void(i?r.onError(i):r.onCompleted());var s=e.value;st(s)&&(s=Xe(s));var c=new le,l=new le;h.setDisposable(new ie(l,c)),c.setDisposable(s.subscribe(function(t){r.onNext(t)},function(e){l.setDisposable(a.subscribe(t,function(t){r.onError(t)},function(){r.onCompleted()})),o.onNext(e)},function(){r.onCompleted()}))}});return new ie(c,h,l,se(function(){n=!0}))})};var Ve=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 Jt(e,t),e.prototype[_t]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?xt:(this.l>0&&this.l--,{done:!1,value:this.v})},e}(Be),$e=Be.repeat=function(t,e){return new Ve(t,e)},He=function(t){function e(t,e,r){this.s=t,this.fn=e?Et(e,r,3):null}function r(t){this.i=-1,this.s=t.s,this.l=this.s.length,this.fn=t.fn}return Jt(e,t),e.prototype[_t]=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]}:xt},e}(Be),We=Be.of=function(t,e,r){return new He(t,e,r)};Re.observeOn=function(t){var e=this;return new jr(function(r){return e.subscribe(new ke(t,r))},e)},Re.subscribeOn=function(t){var e=this;return new jr(function(r){var n=new le,i=new pe;return i.setDisposable(n),n.setDisposable(t.schedule(function(){i.setDisposable(new M(t,e.subscribe(r)))})),i},e)};var qe=function(t){function e(e){this.p=e,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){return this.p.then(function(e){t.onNext(e),t.onCompleted()},function(e){t.onError(e)}),ce},e}(Ue),Xe=Fe.fromPromise=function(t){return new qe(t)};Re.toPromise=function(t){if(t||(t=tt.config.Promise),!t)throw new vt("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 Ye=function(t){function e(e){this.source=e,t.call(this)}function r(t){this.o=t,this.a=[],this.isStopped=!1}return Jt(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}(Ue);Re.toArray=function(){return new Ye(this)},Fe.create=Fe.createWithDisposable=function(t,e){return new jr(t,e)};var Ke=(Fe.defer=function(t){return new jr(function(e){var r;try{r=t()}catch(t){return pr(t).subscribe(e)}return st(r)&&(r=Xe(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 Jt(e,t),e.prototype.subscribeCore=function(t){var e=new r(t,this);return e.run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState(this.observer,n)},e}(Ue)),Ze=Fe.empty=function(t){return ge(t)||(t=_e),new Ke(t)},Je=function(t){function e(e,r,n){this.iterable=e,this.mapper=r,this.scheduler=n,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new Qe(t,this);return e.run()},e}(Ue),Qe=function(){function t(t,e){this.observer=t,this.parent=e}return t.prototype.run=function(){function t(t,e){try{var o=r.next()}catch(t){return n.onError(t)}if(o.done)return n.onCompleted();var a=o.value;if(i)try{a=i(a,t)}catch(t){return n.onError(t)}n.onNext(a),e(t+1)}var e=Object(this.parent.iterable),r=j(e),n=this.observer,i=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,t)},t}(),tr=Math.pow(2,53)-1;T.prototype[_t]=function(){return new C(this._s)},C.prototype[_t]=function(){return this},C.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:xt},O.prototype[_t]=function(){return new P(this._a)},P.prototype[_t]=function(){return this},P.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:xt};var er=Fe.from=function(t,e,r,n){if(null==t)throw new Error("iterable cannot be null.");if(e&&!ct(e))throw new Error("mapFn when provided must be a function");if(e)var i=Et(e,r,2);return ge(n)||(n=xe),new Je(t,i,n)},rr=function(t){function e(e,r){this.args=e,this.scheduler=r,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new N(t,this);return e.run()},e}(Ue);N.prototype.run=function(){function t(t,i){n>t?(e.onNext(r[t]),i(t+1)):e.onCompleted()}var e=this.observer,r=this.parent.args,n=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,t)};var nr=Fe.fromArray=function(t,e){return ge(e)||(e=xe),new rr(t,e)};Fe.generate=function(t,e,r,n,i){return ge(i)||(i=xe),new jr(function(o){var a=!0;return i.scheduleRecursiveWithState(t,function(t,i){var s,c;try{a?a=!1:t=r(t),s=e(t),s&&(c=n(t))}catch(t){return o.onError(t)}s?(o.onNext(c),i(t)):o.onCompleted()})})};var ir=function(t){function e(){t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){return ce},e}(Ue),or=Fe.never=function(){return new ir};Fe.of=function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return new rr(e,xe)},Fe.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 rr(r,t)};var ar=function(t){function e(e,r){this.obj=e,this.keys=Object.keys(e),this.scheduler=r,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new D(t,this);return e.run()},e}(Ue);D.prototype.run=function(){function t(t,o){if(i>t){var a=n[t];e.onNext([a,r[a]]),o(t+1)}else e.onCompleted()}var e=this.observer,r=this.parent.obj,n=this.parent.keys,i=n.length;return this.parent.scheduler.scheduleRecursiveWithState(0,t)},Fe.pairs=function(t,e){return e||(e=xe),new ar(t,e)};var sr=function(t){function e(e,r,n){this.start=e,this.rangeCount=r,this.scheduler=n,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new cr(t,this);return e.run()},e}(Ue),cr=function(){function t(t,e){this.observer=t,this.parent=e}return t.prototype.run=function(){function t(t,i){r>t?(n.onNext(e+t),i(t+1)):n.onCompleted()}var e=this.parent.start,r=this.parent.rangeCount,n=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,t)},t}();Fe.range=function(t,e,r){return ge(r)||(r=xe),new sr(t,e,r)};var ur=function(t){function e(e,r,n){this.value=e,this.repeatCount=null==r?-1:r,this.scheduler=n,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new k(t,this);return e.run()},e}(Ue);k.prototype.run=function(){function t(t,n){return(-1===t||t>0)&&(e.onNext(r),t>0&&t--),0===t?e.onCompleted():void n(t)}var e=this.observer,r=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,t)},Fe.repeat=function(t,e,r){return ge(r)||(r=xe),new ur(t,e,r)};var hr=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 Jt(e,t),e.prototype.subscribeCore=function(t){var e=new r(t,this);return e.run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],n)},e}(Ue),lr=(Fe.return=Fe.just=Fe.returnValue=function(t,e){return ge(e)||(e=_e),new hr(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],n=e[1];n.onError(r)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new r(t,this);return e.run()},r.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],n)},e}(Ue)),pr=Fe.throw=Fe.throwError=Fe.throwException=function(t,e){return ge(e)||(e=_e),new lr(t,e)};Fe.using=function(t,e){return new jr(function(r){var n,i,o=ce;try{n=t(),n&&(o=n),i=e(n)}catch(t){return new ie(pr(t).subscribe(r),o)}return new ie(i.subscribe(r),o)})},Re.amb=function(t){var e=this;return new jr(function(r){function n(){o||(o=a,u.dispose())}function i(){o||(o=s,c.dispose())}var o,a="L",s="R",c=new le,u=new le;return st(t)&&(t=Xe(t)),c.setDisposable(e.subscribe(function(t){n(),o===a&&r.onNext(t)},function(t){n(),o===a&&r.onError(t)},function(){n(),o===a&&r.onCompleted()})),u.setDisposable(t.subscribe(function(t){i(),o===s&&r.onNext(t)},function(t){i(),o===s&&r.onError(t)},function(){i(),o===s&&r.onCompleted()})),new ie(c,u)})},Fe.amb=function(){function t(t,e){return t.amb(e)}var e=or(),r=[];if(Array.isArray(arguments[0]))r=arguments[0];else for(var n=0,i=arguments.length;i>n;n++)r.push(arguments[n]);for(var n=0,i=r.length;i>n;n++)e=t(e,r[n]);return e},Re.catch=Re.catchError=Re.catchException=function(t){return"function"==typeof t?F(this,t):fr([this,t])};var fr=Fe.catchError=Fe.catch=Fe.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 We(t).catchError()};Re.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),dr.apply(this,e)};var dr=Fe.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 jr(function(t){function r(e){if(s[e]=!0,c||(c=s.every(rt))){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(rt)&&t.onCompleted()}function i(e){u[e]=!0,u.every(rt)&&t.onCompleted()}for(var o=e.length,a=function(){return!1},s=b(o,a),c=!1,u=b(o,a),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(n){var o=e[n],a=new le;st(o)&&(o=Xe(o)),a.setDisposable(o.subscribe(function(t){h[n]=t,r(n)},function(e){t.onError(e)},function(){i(n)})),l[n]=a}(p);return new ie(l)},this)};Re.concat=function(){for(var t=[],e=0,r=arguments.length;r>e;e++)t.push(arguments[e]);return t.unshift(this),vr.apply(null,t)};var mr=function(t){function e(e){this.sources=e,t.call(this)}function r(t,e){this.sources=t,this.o=e}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new r(this.sources,t);return e.run()},r.prototype.run=function(){var t,e=new pe,r=this.sources,n=r.length,i=this.o,o=_e.scheduleRecursiveWithState(0,function(o,a){if(!t){if(o===n)return i.onCompleted();var s=r[o];st(s)&&(s=Xe(s));var c=new le;e.setDisposable(c),c.setDisposable(s.subscribe(function(t){i.onNext(t)},function(t){i.onError(t)},function(){a(o+1)}))}});return new ie(e,o,se(function(){t=!0}))},e}(Ue),vr=Fe.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 mr(t)};Re.concatAll=Re.concatObservable=function(){return this.merge(1)};var gr=function(t){function e(e,r){this.source=e,this.maxConcurrent=r,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){var e=new ie;return e.add(this.source.subscribe(new yr(t,this.maxConcurrent,e))),e},e}(Ue),yr=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 le;this.g.add(r),st(t)&&(t=Xe(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}();Re.merge=function(t){return"number"!=typeof t?br(this,t):new gr(this,t)};var br=Fe.merge=function(){var t,e,r=[],n=arguments.length;if(arguments[0])if(ge(arguments[0]))for(t=arguments[0],e=1;n>e;e++)r.push(arguments[e]);else for(t=_e,e=0;n>e;e++)r.push(arguments[e]);else for(t=_e,e=1;n>e;e++)r.push(arguments[e]);return Array.isArray(r[0])&&(r=r[0]),I(t,r).mergeAll()},_r=tt.CompositeError=function(t){this.name="NotImplementedError",this.innerErrors=t,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};_r.prototype=Error.prototype,Fe.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=I(null,t);return new jr(function(t){function e(){0===a.length?t.onCompleted():1===a.length?t.onError(a[0]):t.onError(new _r(a))}var r=new ie,i=new le,o=!1,a=[];return r.add(i),i.setDisposable(n.subscribe(function(n){var i=new le;r.add(i),st(n)&&(n=Xe(n)),i.setDisposable(n.subscribe(function(e){t.onNext(e)},function(t){a.push(t),r.remove(i),o&&1===r.length&&e()},function(){r.remove(i),o&&1===r.length&&e()}))},function(t){a.push(t),o=!0,1===r.length&&e()},function(){o=!0,1===r.length&&e()})),r})};var xr=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 Jt(e,t),e.prototype.subscribeCore=function(t){var e=new ie,n=new le;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 le;this.g.add(e),st(t)&&(t=Xe(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}(Ue);Re.mergeAll=Re.mergeObservable=function(){return new xr(this)},Re.onErrorResumeNext=function(t){if(!t)throw new Error("Second observable is required");return wr([this,t])};var wr=Fe.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 jr(function(e){var r=0,n=new pe,i=_e.scheduleRecursive(function(i){var o,a;r<t.length?(o=t[r++],st(o)&&(o=Xe(o)),a=new le,n.setDisposable(a),a.setDisposable(o.subscribe(e.onNext.bind(e),i,i))):e.onCompleted()});return new ie(n,i)})};Re.skipUntil=function(t){var e=this;return new jr(function(r){var n=!1,i=new ie(e.subscribe(function(t){n&&r.onNext(t)},function(t){r.onError(t)},function(){n&&r.onCompleted()}));st(t)&&(t=Xe(t));var o=new le;return i.add(o),o.setDisposable(t.subscribe(function(){n=!0,o.dispose()},function(t){r.onError(t)},function(){o.dispose()})),i},e)};var Sr=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 Jt(e,t),e.prototype.subscribeCore=function(t){var e=new pe,n=this.source.subscribe(new r(t,e));return new ie(n,e)},r.prototype.onNext=function(t){if(!this.isStopped){var e=new le,r=++this.latest;this.hasLatest=!0,this.inner.setDisposable(e),st(t)&&(t=Xe(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}(Ue);Re.switch=Re.switchLatest=function(){return new Sr(this)};var Mr=function(t){function e(e,r){this.source=e,this.other=st(r)?Xe(r):r,t.call(this)}function r(t){this.o=t,this.isStopped=!1}return Jt(e,t),e.prototype.subscribeCore=function(t){return new ie(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}(Ue);Re.takeUntil=function(t){return new Mr(this,t)},Re.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 jr(function(t){for(var r=e.length,o=b(r,U),a=!1,s=new Array(r),c=new Array(r+1),u=0;r>u;u++)!function(r){var n=e[r],i=new le;st(n)&&(n=Xe(n)),i.setDisposable(n.subscribe(function(t){s[r]=t,o[r]=!0,a=o.every(rt)},function(e){t.onError(e)},et)),c[r]=i}(u);var h=new le;return h.setDisposable(i.subscribe(function(e){var r=[e].concat(s);if(a){var i=x(n).apply(null,r);return i===ee?t.onError(i.e):void t.onNext(i)}},function(e){t.onError(e)},function(){t.onCompleted()})),c[r]=h,new ie(c)},this)},Re.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 jr(function(t){for(var r=e.length,o=b(r,z),a=b(r,U),s=new Array(r),c=0;r>c;c++)!function(r){var c=e[r],u=new le;st(c)&&(c=Xe(c)),u.setDisposable(c.subscribe(function(e){if(o[r].push(e),o.every(function(t){return t.length>0})){var s=o.map(function(t){return t.shift()}),c=x(i).apply(n,s);if(c===ee)return t.onError(c.e);t.onNext(c)}else a.filter(function(t,e){return e!==r}).every(rt)&&t.onCompleted()},function(e){t.onError(e)},function(){a[r]=!0,a.every(rt)&&t.onCompleted()})),s[r]=u}(c);return new ie(s)},n)},Fe.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)},Fe.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 jr(function(e){for(var r=t.length,n=b(r,G),i=b(r,U),o=new Array(r),a=0;r>a;a++)!function(r){o[r]=new le,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(rt))return e.onCompleted()},function(t){e.onError(t)},function(){i[r]=!0,i.every(rt)&&e.onCompleted()}))}(a);return new ie(o)})},Re.asObservable=function(){var t=this;return new jr(function(e){return t.subscribe(e)},t)},Re.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})},Re.dematerialize=function(){var t=this;return new jr(function(e){return t.subscribe(function(t){return t.accept(e)},function(t){e.onError(t)},function(){e.onCompleted()})},this)},Re.distinctUntilChanged=function(t,e){var r=this;return e||(e=it),new jr(function(n){var i,o=!1;return r.subscribe(function(r){var a=r;if(t&&(a=x(t)(r),a===ee))return n.onError(a.e);if(o){var s=x(e)(i,a);if(s===ee)return n.onError(s.e)}o&&s||(o=!0,i=a,n.onNext(r))},function(t){n.onError(t)},function(){n.onCompleted()})},this)};var Er=function(t){function e(e,r,n,i){this.source=e,this.t=!r||ct(r)?je(r||et,n||et,i||et):r,t.call(this)}function r(t,e){this.o=t,this.t=e,this.isStopped=!1}return Jt(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=x(this.t.onNext).call(this.t,t);e===ee&&this.o.onError(e.e),this.o.onNext(t)}},r.prototype.onError=function(t){if(!this.isStopped){this.isStopped=!0;var e=x(this.t.onError).call(this.t,t);if(e===ee)return this.o.onError(e.e);this.o.onError(t)}},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var t=x(this.t.onCompleted).call(this.t);if(t===ee)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}(Ue);Re.do=Re.tap=Re.doAction=function(t,e,r){return new Er(this,t,e,r)},Re.doOnNext=Re.tapOnNext=function(t,e){return this.tap("undefined"!=typeof e?function(r){t.call(e,r)}:t)},Re.doOnError=Re.tapOnError=function(t,e){return this.tap(et,"undefined"!=typeof e?function(r){t.call(e,r)}:t)},Re.doOnCompleted=Re.tapOnCompleted=function(t,e){return this.tap(et,null,"undefined"!=typeof e?function(){t.call(e)}:t)},Re.finally=Re.ensure=function(t){var e=this;return new jr(function(r){var n;try{n=e.subscribe(r)}catch(e){throw t(),e}return se(function(){try{n.dispose()}catch(t){throw t}finally{t()}})},this)},Re.finallyAction=function(t){return this.ensure(t)};var Tr=function(t){function e(e){this.source=e,t.call(this)}function r(t){this.o=t,this.isStopped=!1}return Jt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new r(t))},r.prototype.onNext=et,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}(Ue);Re.ignoreElements=function(){return new Tr(this)},Re.materialize=function(){var t=this;return new jr(function(e){return t.subscribe(function(t){e.onNext(Ce(t))},function(t){e.onNext(Oe(t)),e.onCompleted()},function(){e.onNext(Pe()),e.onCompleted()})},t)},Re.repeat=function(t){return $e(this,t).concat()},Re.retry=function(t){return $e(this,t).catchError()},Re.retryWhen=function(t){return $e(this).catchErrorWhen(t)};var Cr=function(t){function e(e,r,n,i){this.source=e,this.accumulator=r,this.hasSeed=n,this.seed=i,t.call(this)}return Jt(e,t),e.prototype.subscribeCore=function(t){return this.source.subscribe(new V(t,this))},e}(Ue);V.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)}},V.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.observer.onError(t))},V.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},V.prototype.dispose=function(){this.isStopped=!0},V.prototype.fail=function(t){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(t),!0)},Re.scan=function(){var t,e,r=!1;return 2===arguments.length?(r=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new Cr(this,e,r,t)},Re.skipLast=function(t){if(0>t)throw new mt;var e=this;return new jr(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)},Re.startWith=function(){var t,e=0;arguments.length&&ge(arguments[0])?(t=arguments[0],e=1):t=_e;for(var r=[],n=e,i=arguments.length;i>n;n++)r.push(arguments[n]);return We([nr(r,t),this]).concat()},Re.takeLast=function(t){if(0>t)throw new mt;var e=this;return new jr(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)},Re.takeLastBuffer=function(t){var e=this;return new jr(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)},Re.windowWithCount=function(t,e){var r=this;if(+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new mt;if(null==e&&(e=t),+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new mt;return new jr(function(n){function i(){var t=new Nr;c.push(t),n.onNext(te(t,a))}var o=new le,a=new fe(o),s=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 a=s-t+1;a>=0&&a%e===0&&c.shift().onCompleted(),++s%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()})),a},r)},Re.selectConcat=Re.concatMap=function(t,e,r){return ct(t)&&ct(e)?this.concatMap(function(r,n){var i=t(r,n);return st(i)&&(i=Xe(i)),(St(i)||wt(i))&&(i=er(i)),i.map(function(t,i){return e(r,t,n,i)})}):ct(t)?$(this,t,r):$(this,function(){return t})},Re.concatMapObserver=Re.selectConcatObserver=function(t,e,r,n){var i=this,o=Et(t,n,2),a=Et(e,n,1),s=Et(r,n,0);return new jr(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=Xe(n)),t.onNext(n)},function(e){var r;try{r=a(e)}catch(e){return void t.onError(e)}st(r)&&(r=Xe(r)),t.onNext(r),t.onCompleted()},function(){var e;try{e=s()}catch(e){return void t.onError(e)}st(e)&&(e=Xe(e)),t.onNext(e),t.onCompleted()})},this).concatAll()},Re.defaultIfEmpty=function(t){var e=this;return t===o&&(t=null),new jr(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)},W.prototype.push=function(t){var e=-1===H(this.set,t,this.comparer);return e&&this.set.push(t),e},Re.distinct=function(t,e){var r=this;return e||(e=it),new jr(function(n){var i=new W(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 Or=function(t){function e(e,r,n){this.source=e,this.selector=Et(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 Jt(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=x(this.selector)(t,this.i++,this.source);return e===ee?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}(Ue);Re.map=Re.select=function(t,e){var r="function"==typeof t?t:function(){return t};return this instanceof Or?this.internalMap(r,e):new Or(this,r,e)},Re.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,i=0;e>i;i++){var a=n[t[i]];if("undefined"==typeof a)return o;n=a}return n})},Re.flatMapObserver=Re.selectManyObserver=function(t,e,r,n){var i=this;return new jr(function(o){var a=0;return i.subscribe(function(e){var r;try{r=t.call(n,e,a++)}catch(t){return void o.onError(t)}st(r)&&(r=Xe(r)),o.onNext(r)},function(t){var r;try{r=e.call(n,t)}catch(t){return void o.onError(t)}st(r)&&(r=Xe(r)),o.onNext(r),o.onCompleted()},function(){var t;try{t=r.call(n)}catch(t){return void o.onError(t)}st(t)&&(t=Xe(t)),o.onNext(t),o.onCompleted()})},i).mergeAll()},Re.selectMany=Re.flatMap=function(t,e,r){return ct(t)&&ct(e)?this.flatMap(function(r,n){var i=t(r,n);return st(i)&&(i=Xe(i)),(St(i)||wt(i))&&(i=er(i)),i.map(function(t,i){return e(r,t,n,i)})},r):ct(t)?q(this,t,r):q(this,function(){return t})},Re.selectSwitch=Re.flatMapLatest=Re.switchMap=function(t,e){return this.select(t,e).switchLatest()};var Pr=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 Jt(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}(Ue);Re.skip=function(t){if(0>t)throw new mt;return new Pr(this,t)},Re.skipWhile=function(t,e){var r=this,n=Et(t,e,3);return new jr(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)},Re.take=function(t,e){if(0>t)throw new mt;if(0===t)return Ze(e);var r=this;return new jr(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)},Re.takeWhile=function(t,e){var r=this,n=Et(t,e,3);return new jr(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 Ar=function(t){function e(e,r,n){this.source=e,this.predicate=Et(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 Jt(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=x(this.predicate)(t,this.i++,this.source);return e===ee?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}(Ue);Re.filter=Re.where=function(t,e){return this instanceof Ar?this.internalFilter(t,e):new Ar(this,t,e)},Re.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 jr(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 jr=tt.AnonymousObservable=function(t){function e(t){return t&&ct(t.dispose)?t:ct(t)?se(t):ce}function r(t,r){var n=r[0],i=r[1],o=x(i)(n);return o!==ee||n.fail(ee.e)?void n.setDisposable(e(o)):w(ee.e)}function n(e,n){function i(t){var n=new Rr(t),i=[n,e];return xe.scheduleRequired()?xe.scheduleWithState(i,r):r(null,i),n}this.source=n,t.call(this,i)}return Jt(n,t),n}(Fe),Rr=function(t){function e(e){t.call(this),this.observer=e,this.m=new le}Jt(e,t);var r=e.prototype;return r.next=function(t){var e=x(this.observer.onNext).call(this.observer,t);e===ee&&(this.dispose(),w(e.e))},r.error=function(t){var e=x(this.observer.onError).call(this.observer,t);this.dispose(),e===ee&&w(e.e)},r.completed=function(){var t=x(this.observer.onCompleted).call(this.observer);this.dispose(),t===ee&&w(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}(Le),Lr=function(t,e){this.subject=t,this.observer=e};Lr.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 Nr=tt.Subject=function(t){function e(t){return he(this),this.isStopped?this.hasError?(t.onError(this.error),ce):(t.onCompleted(),ce):(this.observers.push(t),new Lr(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Jt(r,t),Qt(r.prototype,Ae.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(he(this),!this.isStopped){this.isStopped=!0;for(var t=0,e=a(this.observers),r=e.length;r>t;t++)e[t].onCompleted();this.observers.length=0}},onError:function(t){if(he(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;for(var e=0,r=a(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){if(he(this),!this.isStopped)for(var e=0,r=a(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 Ir(t,e)},r}(Fe),Ir=(tt.AsyncSubject=function(t){function e(t){return he(this),this.isStopped?(this.hasError?t.onError(this.error):this.hasValue?(t.onNext(this.value),t.onCompleted()):t.onCompleted(),ce):(this.observers.push(t),new Lr(this,t))}function r(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Jt(r,t),Qt(r.prototype,Ae,{hasObservers:function(){return he(this),this.observers.length>0},onCompleted:function(){var t,e;if(he(this),!this.isStopped){this.isStopped=!0;var r=a(this.observers),e=r.length;if(this.hasValue)for(t=0;e>t;t++){var n=r[t];n.onNext(this.value),n.onCompleted()}else for(t=0;e>t;t++)r[t].onCompleted();this.observers.length=0}},onError:function(t){if(he(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=t;for(var e=0,r=a(this.observers),n=r.length;n>e;e++)r[e].onError(t);this.observers.length=0}},onNext:function(t){he(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(Fe),tt.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 Jt(r,t),Qt(r.prototype,Ae.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),r}(Fe));"function"==typeof t&&"object"==typeof t.amd&&t.amd?(Y.Rx=tt,t(function(){return tt})):K&&Z?J?(Z.exports=tt).Rx=tt:K.Rx=tt:Y.Rx=tt;var Dr=p()}).call(this)}).call(this,e(150),"undefined"!=typeof i?i:"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:{})},{}],14:[function(t,e,r){(function(r){var n="undefined"!=typeof r?r:"undefined"!=typeof window?window:{},i=t("min-document");if("undefined"!=typeof document)e.exports=document;else{var o=n["__GLOBAL_DOCUMENT_CACHE@4"];o||(o=n["__GLOBAL_DOCUMENT_CACHE@4"]=i),e.exports=o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":2}],15:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,c=(1<<s)-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+=s;h>0;o=256*o+t[e+l],l+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+l],l+=p,h-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:(f?-1:1)*(1/0);a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,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?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),e+=a+l>=1?p/c:p*Math.pow(2,1-l),e*c>=2&&(a++,c/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(e*c-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*m}},{}],16:[function(t,e,r){(function(t){"use strict";function r(t,e){return t in n?n[t]:(n[t]=e,e)}var n="undefined"!=typeof window?window:"undefined"!=typeof t?t:{};e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],17:[function(t,e,r){"use strict";function n(t,e,r){var n="__INDIVIDUAL_ONE_VERSION_"+t,o=n+"_ENFORCE_SINGLETON",a=i(o,e);if(a!==e)throw new Error("Can only have one copy of "+t+".\nYou already have version "+a+" installed.\nThis means you cannot install version "+e);return i(n,r)}var i=t("./index.js");e.exports=n},{"./index.js":16}],18:[function(t,e,r){"use strict";e.exports=function(t){return"object"==typeof t&&null!==t}},{}],19:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],20:[function(t,e,r){"use strict";var n={};n.base32="0123456789bcdefghjkmnpqrstuvwxyz",n.encode=function(t,e,r){if("undefined"==typeof r){for(var i=1;i<=12;i++){var o=n.encode(t,e,i),a=n.decode(o);if(a.lat==t&&a.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 s=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?(s=2*s+1,f=m):(s*=2,d=m)}else{var v=(l+p)/2;t>=v?(s=2*s+1,l=v):(s*=2,p=v)}u=!u,5==++c&&(h+=n.base32.charAt(s),c=0,s=0)}return h},n.decode=function(t){var e=n.bounds(t),r=e.sw.lat,i=e.sw.lon,o=e.ne.lat,a=e.ne.lon,s=(r+o)/2,c=(i+a)/2;return s=s.toFixed(Math.floor(2-Math.log(o-r)/Math.LN10)),c=c.toFixed(Math.floor(2-Math.log(a-i)/Math.LN10)),{lat:Number(s),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,a=180,s=0;s<t.length;s++){var c=t.charAt(s),u=n.base32.indexOf(c);if(u==-1)throw new Error("Invalid geohash");for(var h=4;h>=0;h--){var l=u>>h&1;if(e){var p=(o+a)/2;1==l?o=p:a=p}else{var f=(r+i)/2;1==l?r=f:i=f}e=!e}}var d={sw:{lat:r,lon:o},ne:{lat:i,lon:a}};return d},n.adjacent=function(t,e){if(t=t.toLowerCase(),e=e.toLowerCase(),0===t.length)throw new Error("Invalid geohash");if("nsew".indexOf(e)==-1)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),a=t.slice(0,-1),s=t.length%2;return i[e][s].indexOf(o)!=-1&&""!==a&&(a=n.adjacent(a,e)),a+n.base32.charAt(r[e][s].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")}},"undefined"!=typeof e&&e.exports&&(e.exports=n)},{}],21:[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 a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.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="/"===a(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||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("/")),a=Math.min(i.length,o.length),s=a,c=0;c<a;c++)if(i[c]!==o[c]){s=c;break}for(var u=[],c=s;c<i.length;c++)u.push("..");return u=u.concat(o.slice(s)),u.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 a="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:4}],22:[function(t,e,r){"use strict";function n(t){this.buf=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 a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return a(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 a(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function s(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),4294967295^r?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],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var c,u,h;1===s?o<128&&(a=o):2===s?(c=t[i+1],128===(192&c)&&(a=(31&o)<<6|63&c,a<=127&&(a=null))):3===s?(c=t[i+1],u=t[i+2],128===(192&c)&&128===(192&u)&&(a=(15&o)<<12|(63&c)<<6|63&u,(a<=2047||a>=55296&&a<=57343)&&(a=null))):4===s&&(c=t[i+1],u=t[i+2],h=t[i+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(a=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h,(a<=65535||a>=1114112)&&(a=null))),null===a?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|1023&a),n+=String.fromCharCode(a),i+=s}return n}function M(t,e,r){for(var n,i,o=0;o<e.length;o++){if(n=e.charCodeAt(o),n>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;var T=4294967296,C=1/T;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)+_(this.buf,this.pos+4)*T;return this.pos+=8,t},readSFixed64:function(){var t=_(this.buf,this.pos)+w(this.buf,this.pos+4)*T;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,t&-1,this.pos),x(this.buf,Math.floor(t*C),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),x(this.buf,t&-1,this.pos),x(this.buf,Math.floor(t*C),this.pos+4),this.pos+=8},writeVarint:function(t){return t=+t||0,t>268435455||t<0?void s(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(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),this.pos++;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){this.pos++;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:15}],23:[function(t,e,r){"use strict";function n(t,e,r,a,s){for(r=r||0,a=a||t.length-1,s=s||o;a>r;){if(a-r>600){var c=a-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),f=Math.max(r,Math.floor(e-u*l/c+p)),d=Math.min(a,Math.floor(e+(c-u)*l/c+p));n(t,e,f,d,s)}var m=t[e],v=r,g=a;for(i(t,r,e),s(t[a],m)>0&&i(t,r,a);v<g;){for(i(t,v,g),v++,g--;s(t[v],m)<0;)v++;for(;s(t[g],m)>0;)g--}0===s(t[r],m)?i(t,r,g):(g++,i(t,g,a)),g<=e&&(r=g+1),e<=g&&(a=g-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},{}],24:[function(t,e,r){"use strict";function n(t,e){return this instanceof n?(this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),void this.clear()):new n(t,e)}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){a(t,0,t.children.length,e,t)}function a(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,a=e;a<r;a++)o=t.children[a],s(i,t.leaf?n(o):o);return i}function s(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,a=[e,r];a.length;)r=a.pop(),e=a.pop(),r-e<=n||(o=e+Math.ceil((r-e)/n/2)*n,y(t,o,e,r,i),a.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,a,s,c=[];e;){for(i=0,o=e.children.length;i<o;i++)a=e.children[i],s=e.leaf?n(a):a,m(t,s)&&(e.leaf?r.push(a):d(t,s)?this._all(a,r):c.push(a));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,a,s=[];e;){for(n=0,i=e.children.length;n<i;n++)if(o=e.children[n],a=e.leaf?r(o):o,m(t,a)){if(e.leaf||d(t,a))return!0;s.push(o)}e=s.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,a,s=this.data,c=this.toBBox(t),u=[],h=[];s||u.length;){if(s||(s=u.pop(),n=u[u.length-1],r=h.pop(),a=!0),s.leaf&&(o=i(t,s.children,e),o!==-1))return s.children.splice(o,1),u.push(s),this._condense(u),this;a||s.leaf||!d(s,c)?n?(r++,s=n.children[r],a=!1):s=null:(u.push(s),h.push(r),r=0,n=s,s=s.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,a=r-e+1,s=this._maxEntries;if(a<=s)return i=v(t.slice(e,r+1)),o(i,this.toBBox),i;n||(n=Math.ceil(Math.log(a)/Math.log(s)),s=Math.ceil(a/Math.pow(s,n-1))),i=v([]),i.leaf=!1,i.height=n;var c,u,h,l,p=Math.ceil(a/s),f=p*Math.ceil(Math.sqrt(s));for(g(t,e,r,f,this.compareMinX),c=e;c<=r;c+=f)for(h=Math.min(c+f-1,r),g(t,c,h,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,a,s,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++)a=e.children[i],c=h(a),u=p(t,a)-c,u<f?(f=u,l=c<l?c:l,s=a):u===f&&c<l&&(l=c,s=a);e=s||e.children[0]}return e},_insert:function(t,e,r){var n=this.toBBox,i=r?t:n(t),o=[],a=this._chooseSubtree(i,this.data,e,o);for(a.children.push(t),s(a,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 a=this._chooseSplitIndex(r,i,n),s=v(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,o(r,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},_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,s,c,u,l,p;for(u=l=1/0,n=e;n<=r-e;n++)i=a(t,0,n,this.toBBox),o=a(t,n,r,this.toBBox),s=f(i,o),c=h(i)+h(o),s<u?(u=s,p=n,l=c<l?c:l):s===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,o=this._allDistMargin(t,e,r,n),a=this._allDistMargin(t,e,r,i);o<a&&t.children.sort(n)},_allDistMargin:function(t,e,r,n){t.children.sort(n);var i,o,c=this.toBBox,u=a(t,0,e,c),h=a(t,r-e,r,c),p=l(u)+l(h);for(i=e;i<r-e;i++)o=t.children[i],s(u,t.leaf?c(o):o),p+=l(u);for(i=r-e-1;i>=e;i--)o=t.children[i],s(h,t.leaf?c(o):o),p+=l(h);return p},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)s(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,e.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:23}],25:[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"),a=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=a},{"./Subject":33,"./util/ObjectUnsubscribedError":145}],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("./Subscriber"),o=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}(i.Subscriber);r.InnerSubscriber=o},{"./Subscriber":35}],27:[function(t,e,r){"use strict";var n=t("./Observable"),i=function(){function t(t,e,r){this.kind=t,this.value=e,this.exception=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.exception);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){var n=this.kind;switch(n){case"N":return t&&t(this.value);case"E":return e&&e(this.exception);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(){var t=this.kind;switch(t){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.exception);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return"undefined"!=typeof e?new t("N",e):this.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return this.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();r.Notification=i},{"./Observable":28}],28:[function(t,e,r){"use strict";var n=t("./util/root"),i=t("./util/toSubscriber"),o=t("./symbol/observable"),a=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):o.add(this._subscribe(o)),o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},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=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=a},{"./symbol/observable":141,"./util/root":153,"./util/toSubscriber":155}],29:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],30:[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=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}(i.Subscriber);r.OuterSubscriber=o},{"./Subscriber":35}],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=t("./Subject"),o=t("./scheduler/queue"),a=t("./operator/observeOn"),s=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 c(r,e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(e){var r=this._trimBufferThenGetEvents(),n=this.scheduler;n&&e.add(e=new a.ObserveOnSubscriber(e,n));for(var i=r.length,o=0;o<i&&!e.closed;o++)e.next(r[o].value);return t.prototype._subscribe.call(this,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=s;var c=function(){function t(t,e){this.time=t,this.value=e}return t}()},{"./Subject":33,"./operator/observeOn":118,"./scheduler/queue":139}],32:[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},{}],33:[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"),a=t("./Subscription"),s=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 s.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 s.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 s.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._subscribe=function(t){if(this.closed)throw new s.ObjectUnsubscribedError;return this.hasError?(t.error(this.thrownError),a.Subscription.EMPTY):this.isStopped?(t.complete(),a.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){var e=this.source;return e?this.source.subscribe(t):a.Subscription.EMPTY},e}(l);r.AnonymousSubject=p},{"./Observable":28,"./SubjectSubscription":34,"./Subscriber":35,"./Subscription":36,"./symbol/rxSubscriber":142,"./util/ObjectUnsubscribedError":145}],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("./Subscription"),o=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);r!==-1&&e.splice(r,1)}}},e}(i.Subscription);r.SubjectSubscription=o},{"./Subscription":36}],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=t("./util/isFunction"),o=t("./Subscription"),a=t("./Observer"),s=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=a.empty;break;case 1:if(!r){this.destination=a.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[s.$$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}(o.Subscription);r.Subscriber=c;var u=function(t){function e(e,r,n,o){t.call(this),this._parent=e;var a,s=this;i.isFunction(r)?a=r:r&&(s=r,a=r.next,n=r.error,o=r.complete,i.isFunction(s.unsubscribe)&&this.add(s.unsubscribe.bind(s)),s.unsubscribe=this.unsubscribe.bind(this)),this._context=s,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._parent;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._parent;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(){if(!this.isStopped){var t=this._parent;this._complete?t.syncErrorThrowable?(this.__tryOrSetError(t,this._complete),this.unsubscribe()):(this.__tryOrUnsub(this._complete),this.unsubscribe()):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._parent;this._context=null,this._parent=null,t.unsubscribe()},e}(c)},{"./Observer":29,"./Subscription":36,"./symbol/rxSubscriber":142,"./util/isFunction":149}],36:[function(t,e,r){"use strict";var n=t("./util/isArray"),i=t("./util/isObject"),o=t("./util/isFunction"),a=t("./util/tryCatch"),s=t("./util/errorObject"),c=t("./util/UnsubscriptionError"),u=function(){function t(t){this.closed=!1,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){this.closed=!0;var r=this,u=r._unsubscribe,h=r._subscriptions;if(this._subscriptions=null,o.isFunction(u)){var l=a.tryCatch(u).call(this);l===s.errorObject&&(e=!0,(t=t||[]).push(s.errorObject.e))}if(n.isArray(h))for(var p=-1,f=h.length;++p<f;){var d=h[p];if(i.isObject(d)){var l=a.tryCatch(d.unsubscribe).call(d);if(l===s.errorObject){e=!0,t=t||[];var m=s.errorObject.e;m instanceof c.UnsubscriptionError?t=t.concat(m.errors):t.push(m)}}}if(e)throw new c.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)break;this.closed?r.unsubscribe():(this._subscriptions||(this._subscriptions=[])).push(r);break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return r},t.prototype.remove=function(e){if(null!=e&&e!==this&&e!==t.EMPTY){var r=this._subscriptions;if(r){var n=r.indexOf(e);n!==-1&&r.splice(n,1)}}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();r.Subscription=u},{"./util/UnsubscriptionError":146,"./util/errorObject":147,"./util/isArray":148,"./util/isFunction":149,"./util/isObject":150,"./util/tryCatch":156}],37:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/combineLatest");n.Observable.combineLatest=i.combineLatest},{"../../Observable":28,"../../observable/combineLatest":90}],38:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/defer");n.Observable.defer=i.defer},{"../../Observable":28,"../../observable/defer":91}],39:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/empty");n.Observable.empty=i.empty},{"../../Observable":28,"../../observable/empty":92}],40:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/from");n.Observable.from=i.from},{"../../Observable":28,"../../observable/from":93}],41:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/fromEvent");n.Observable.fromEvent=i.fromEvent},{"../../Observable":28,"../../observable/fromEvent":94}],42:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/fromPromise");n.Observable.fromPromise=i.fromPromise},{"../../Observable":28,"../../observable/fromPromise":95}],43:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/merge");n.Observable.merge=i.merge},{"../../Observable":28,"../../observable/merge":96}],44:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/of");n.Observable.of=i.of},{"../../Observable":28,"../../observable/of":97}],45:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/throw");n.Observable.throw=i._throw},{"../../Observable":28,"../../observable/throw":98}],46:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../observable/zip");n.Observable.zip=i.zip},{"../../Observable":28,"../../observable/zip":99}],47:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/buffer");n.Observable.prototype.buffer=i.buffer},{"../../Observable":28,"../../operator/buffer":100}],48:[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":28,"../../operator/catch":101}],49:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/combineLatest");n.Observable.prototype.combineLatest=i.combineLatest},{"../../Observable":28,"../../operator/combineLatest":102}],50:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/concat");n.Observable.prototype.concat=i.concat},{"../../Observable":28,"../../operator/concat":103}],51:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/debounceTime");n.Observable.prototype.debounceTime=i.debounceTime},{"../../Observable":28,"../../operator/debounceTime":104}],52:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/distinct");n.Observable.prototype.distinct=i.distinct},{"../../Observable":28,"../../operator/distinct":105}],53:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/distinctUntilChanged");n.Observable.prototype.distinctUntilChanged=i.distinctUntilChanged},{"../../Observable":28,"../../operator/distinctUntilChanged":106}],54:[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":28,"../../operator/do":107}],55:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/expand");n.Observable.prototype.expand=i.expand},{"../../Observable":28,"../../operator/expand":108}],56:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/filter");n.Observable.prototype.filter=i.filter},{"../../Observable":28,"../../operator/filter":109
-}],57:[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":28,"../../operator/finally":110}],58:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/first");n.Observable.prototype.first=i.first},{"../../Observable":28,"../../operator/first":111}],59:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/last");n.Observable.prototype.last=i.last},{"../../Observable":28,"../../operator/last":112}],60:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/map");n.Observable.prototype.map=i.map},{"../../Observable":28,"../../operator/map":113}],61:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/merge");n.Observable.prototype.merge=i.merge},{"../../Observable":28,"../../operator/merge":114}],62:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/mergeAll");n.Observable.prototype.mergeAll=i.mergeAll},{"../../Observable":28,"../../operator/mergeAll":115}],63:[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":28,"../../operator/mergeMap":116}],64:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/pairwise");n.Observable.prototype.pairwise=i.pairwise},{"../../Observable":28,"../../operator/pairwise":119}],65:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/pluck");n.Observable.prototype.pluck=i.pluck},{"../../Observable":28,"../../operator/pluck":120}],66:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/publish");n.Observable.prototype.publish=i.publish},{"../../Observable":28,"../../operator/publish":121}],67:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/publishReplay");n.Observable.prototype.publishReplay=i.publishReplay},{"../../Observable":28,"../../operator/publishReplay":122}],68:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/scan");n.Observable.prototype.scan=i.scan},{"../../Observable":28,"../../operator/scan":123}],69:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/share");n.Observable.prototype.share=i.share},{"../../Observable":28,"../../operator/share":124}],70:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/skip");n.Observable.prototype.skip=i.skip},{"../../Observable":28,"../../operator/skip":125}],71:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/skipUntil");n.Observable.prototype.skipUntil=i.skipUntil},{"../../Observable":28,"../../operator/skipUntil":126}],72:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/startWith");n.Observable.prototype.startWith=i.startWith},{"../../Observable":28,"../../operator/startWith":127}],73:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/switchMap");n.Observable.prototype.switchMap=i.switchMap},{"../../Observable":28,"../../operator/switchMap":128}],74:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/take");n.Observable.prototype.take=i.take},{"../../Observable":28,"../../operator/take":129}],75:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/takeUntil");n.Observable.prototype.takeUntil=i.takeUntil},{"../../Observable":28,"../../operator/takeUntil":130}],76:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/withLatestFrom");n.Observable.prototype.withLatestFrom=i.withLatestFrom},{"../../Observable":28,"../../operator/withLatestFrom":131}],77:[function(t,e,r){"use strict";var n=t("../../Observable"),i=t("../../operator/zip");n.Observable.prototype.zip=i.zipProto},{"../../Observable":28,"../../operator/zip":132}],78:[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"),a=t("./EmptyObservable"),s=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 a.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;if(!i.closed){if(r>=n)return void i.complete();i.next(e[r]),t.index=r+1,this.schedule(t)}},e.prototype._subscribe=function(t){var r=0,n=this,i=n.arrayLike,o=n.scheduler,a=i.length;if(o)return o.schedule(e.dispatch,0,{arrayLike:i,index:r,length:a,subscriber:t});for(var s=0;s<a&&!t.closed;s++)t.next(i[s]);t.complete()},e}(i.Observable);r.ArrayLikeObservable=s},{"../Observable":28,"./EmptyObservable":82,"./ScalarObservable":89}],79:[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"),a=t("./EmptyObservable"),s=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];s.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 a.EmptyObservable(n)},e.dispatch=function(t){var e=t.array,r=t.index,n=t.count,i=t.subscriber;return r>=n?void i.complete():(i.next(e[r]),void(i.closed||(t.index=r+1,this.schedule(t))))},e.prototype._subscribe=function(t){var r=0,n=this.array,i=n.length,o=this.scheduler;if(o)return o.schedule(e.dispatch,0,{array:n,index:r,count:i,subscriber:t});for(var a=0;a<i&&!t.closed;a++)t.next(n[a]);t.complete()},e}(i.Observable);r.ArrayObservable=c},{"../Observable":28,"../util/isScheduler":152,"./EmptyObservable":82,"./ScalarObservable":89}],80:[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"),a=t("../Subscriber"),s=t("../Subscription"),c=function(t){function e(e,r){t.call(this),this.source=e,this.subjectFactory=r,this._refCount=0}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||(t=this._connection=new s.Subscription,t.add(this.source.subscribe(new u(this.getSubject(),this))),t.closed?(this._connection=null,t=s.Subscription.EMPTY):this._connection=t),t},e.prototype.refCount=function(){return this.lift(new h(this))},e}(o.Observable);r.ConnectableObservable=c;var u=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._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),h=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var r=this.connectable;r._refCount++;var n=new l(t,r),i=e._subscribe(n);return n.closed||(n.connection=r.connect()),i},t}(),l=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)return void(this.connection=null);this.connectable=null;var e=t._refCount;if(e<=0)return void(this.connection=null);if(t._refCount=e-1,e>1)return void(this.connection=null);var r=this.connection,n=t._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()},e}(a.Subscriber)},{"../Observable":28,"../Subject":33,"../Subscriber":35,"../Subscription":36}],81:[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"),a=t("../OuterSubscriber"),s=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=s;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}(a.OuterSubscriber)},{"../Observable":28,"../OuterSubscriber":30,"../util/subscribeToResult":154}],82:[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=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){var e=t.subscriber;e.complete()},e.prototype._subscribe=function(t){var r=this.scheduler;return r?r.schedule(e.dispatch,0,{subscriber:t}):void t.complete()},e}(i.Observable);r.EmptyObservable=o},{"../Observable":28}],83:[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=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,r=t.subscriber;r.error(e)},e.prototype._subscribe=function(t){var r=this.error,n=this.scheduler;return n?n.schedule(e.dispatch,0,{error:r,subscriber:t}):void t.error(r)},e}(i.Observable);r.ErrorObservable=o},{"../Observable":28}],84:[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]"===t.toString()}function a(t){return!!t&&"[object HTMLCollection]"===t.toString()}function s(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=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)||a(t))for(var p=0,d=t.length;p<d;p++)e.setupSubscription(t[p],r,c,u,h);else if(s(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)){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,a=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,a,t,i)},e}(u.Observable);r.FromEventObservable=d},{"../Observable":28,"../Subscription":36,"../util/errorObject":147,"../util/isFunction":149,"../util/tryCatch":156}],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("../util/isArray"),o=t("../util/isPromise"),a=t("./PromiseObservable"),s=t("./IteratorObservable"),c=t("./ArrayObservable"),u=t("./ArrayLikeObservable"),h=t("../symbol/iterator"),l=t("../Observable"),p=t("../operator/observeOn"),f=t("../symbol/observable"),d=function(t){return t&&"number"==typeof t.length},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[f.$$observable])return t instanceof l.Observable&&!r?t:new e(t,r);if(i.isArray(t))return new c.ArrayObservable(t,r);if(o.isPromise(t))return new a.PromiseObservable(t,r);if("function"==typeof t[h.$$iterator]||"string"==typeof t)return new s.IteratorObservable(t,r);if(d(t))return new u.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[f.$$observable]().subscribe(t):e[f.$$observable]().subscribe(new p.ObserveOnSubscriber(t,r,0))},e}(l.Observable);r.FromObservable=m},{"../Observable":28,"../operator/observeOn":118,"../symbol/iterator":140,"../symbol/observable":141,"../util/isArray":148,"../util/isPromise":151,"./ArrayLikeObservable":78,"./ArrayObservable":79,"./IteratorObservable":86,"./PromiseObservable":88}],86:[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=a(e)*Math.floor(Math.abs(e)),e<=0?0:e>d?d:e):e}function o(t){return"number"==typeof t&&c.root.isFinite(t)}function a(t){var e=+t;return 0===e?e:isNaN(e)?e:e<0?-1:1}var s=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 s(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)return void i.error(t.error);var o=n.next();return o.done?void i.complete():(i.next(o.value),t.index=e+1,void(i.closed||this.schedule(t)))},e.prototype._subscribe=function(t){var r=0,n=this,i=n.iterator,o=n.scheduler;if(o)return o.schedule(e.dispatch,0,{index:r,iterator:i,subscriber:t});for(;;){var a=i.next();if(a.done){t.complete();break}if(t.next(a.value),t.closed)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":28,"../symbol/iterator":140,"../util/root":153}],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("../Observable"),o=t("../observable/ConnectableObservable"),a=function(t){function e(e,r,n){t.call(this),this.source=e,this.subjectFactory=r,this.selector=n}return n(e,t),e.prototype._subscribe=function(t){var e=this,r=e.selector,n=e.source,i=new o.ConnectableObservable(n,this.subjectFactory),a=r(i).subscribe(t);return a.add(i.connect()),a},e}(i.Observable);r.MulticastObservable=a},{"../Observable":28,"../observable/ConnectableObservable":80}],88:[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)},a=t("../util/root"),s=t("../Observable"),c=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){a.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){a.root.setTimeout(function(){throw t})})},e}(s.Observable);r.PromiseObservable=c},{"../Observable":28,"../util/root":153}],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=t("../Observable"),o=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;return e?void n.complete():(n.next(r),void(n.closed||(t.done=!0,this.schedule(t))))},e.prototype._subscribe=function(t){var r=this.value,n=this.scheduler;return n?n.schedule(e.dispatch,0,{done:!1,value:r,subscriber:t}):(t.next(r),void(t.closed||t.complete()))},e}(i.Observable);r.ScalarObservable=o},{"../Observable":28}],90:[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=null;return i.isScheduler(t[t.length-1])&&(n=t.pop()),"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&o.isArray(t[0])&&(t=t[0]),new a.ArrayObservable(t,n).lift(new s.CombineLatestOperator(r))}var i=t("../util/isScheduler"),o=t("../util/isArray"),a=t("./ArrayObservable"),s=t("../operator/combineLatest");r.combineLatest=n},{"../operator/combineLatest":102,"../util/isArray":148,"../util/isScheduler":152,"./ArrayObservable":79}],91:[function(t,e,r){"use strict";var n=t("./DeferObservable");r.defer=n.DeferObservable.create},{"./DeferObservable":81}],92:[function(t,e,r){"use strict";var n=t("./EmptyObservable");r.empty=n.EmptyObservable.create},{"./EmptyObservable":82}],93:[function(t,e,r){"use strict";var n=t("./FromObservable");r.from=n.FromObservable.create},{"./FromObservable":85}],94:[function(t,e,r){"use strict";var n=t("./FromEventObservable");r.fromEvent=n.FromEventObservable.create},{"./FromEventObservable":84}],95:[function(t,e,r){"use strict";var n=t("./PromiseObservable");r.fromPromise=n.PromiseObservable.create},{"./PromiseObservable":88}],96:[function(t,e,r){"use strict";var n=t("../operator/merge");r.merge=n.mergeStatic},{"../operator/merge":114}],97:[function(t,e,r){"use strict";var n=t("./ArrayObservable");r.of=n.ArrayObservable.of},{"./ArrayObservable":79}],98:[function(t,e,r){"use strict";var n=t("./ErrorObservable");r._throw=n.ErrorObservable.create},{"./ErrorObservable":83}],99:[function(t,e,r){"use strict";var n=t("../operator/zip");r.zip=n.zipStatic},{"../operator/zip":132}],100:[function(t,e,r){"use strict";function n(t){return this.lift(new s(t))}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("../OuterSubscriber"),a=t("../util/subscribeToResult");r.buffer=n;var s=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.closingNotifier))},t}(),c=function(t){function e(e,r){t.call(this,e),this.buffer=[],this.add(a.subscribeToResult(this,r))}return i(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}(o.OuterSubscriber)},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],101:[function(t,e,r){"use strict";function n(t){var e=new s(t),r=this.lift(e);return e.caught=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("../OuterSubscriber"),a=t("../util/subscribeToResult");r._catch=n;var s=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.selector,this.caught))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.selector=r,this.caught=n}return i(e,t),e.prototype.error=function(t){if(!this.isStopped){var e=void 0;try{e=this.selector(t,this.caught)}catch(t){return void this.destination.error(t)}this.unsubscribe(),this.destination.remove(this),a.subscribeToResult(this,e)}},e}(o.OuterSubscriber)},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],102:[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;return"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&a.isArray(t[0])&&(t=t[0]),t.unshift(this),new o.ArrayObservable(t).lift(new h(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"),a=t("../util/isArray"),s=t("../OuterSubscriber"),c=t("../util/subscribeToResult"),u={};r.combineLatest=n;var h=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e._subscribe(new l(t,this.project))},t}();r.CombineLatestOperator=h;var l=function(t){function e(e,r){t.call(this,e),this.project=r,this.active=0,this.values=[],this.observables=[]}return i(e,t),e.prototype._next=function(t){this.values.push(u),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(c.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,a=o[r],s=this.toRespond?a===u?--this.toRespond:this.toRespond:0;o[r]=e,0===s&&(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=l},{"../OuterSubscriber":30,"../observable/ArrayObservable":79,"../util/isArray":148,"../util/subscribeToResult":154}],103:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return i.apply(void 0,[this].concat(t))}function i(){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()),new a.ArrayObservable(t,r).lift(new s.MergeAllOperator(1))}var o=t("../util/isScheduler"),a=t("../observable/ArrayObservable"),s=t("./mergeAll");r.concat=n,r.concatStatic=i},{"../observable/ArrayObservable":79,"../util/isScheduler":152,"./mergeAll":115}],104:[function(t,e,r){"use strict";function n(t,e){return void 0===e&&(e=s.async),this.lift(new c(t,e))}function i(t){t.debouncedNext()}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)},a=t("../Subscriber"),s=t("../scheduler/async");r.debounceTime=n;var c=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e._subscribe(new u(t,this.dueTime,this.scheduler))},t}(),u=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 o(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(i,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}(a.Subscriber)},{"../Subscriber":35,"../scheduler/async":138}],105:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}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("../OuterSubscriber"),a=t("../util/subscribeToResult");r.distinct=n;var s=function(){function t(t,e){this.compare=t,this.flushes=e}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.compare,this.flushes))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.values=[],"function"==typeof r&&(this.compare=r),n&&this.add(a.subscribeToResult(this,n))}return i(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.values.length=0},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype._next=function(t){var e=!1,r=this.values,n=r.length;try{for(var i=0;i<n;i++)if(this.compare(r[i],t))return void(e=!0)}catch(t){return void this.destination.error(t)}this.values.push(t),this.destination.next(t)},e.prototype.compare=function(t,e){return t===e},e}(o.OuterSubscriber);r.DistinctSubscriber=c},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],106:[function(t,e,r){"use strict";function n(t,e){return this.lift(new c(t,e))}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"),a=t("../util/tryCatch"),s=t("../util/errorObject");r.distinctUntilChanged=n;var c=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e._subscribe(new u(t,this.compare,this.keySelector))},t}(),u=function(t){function e(e,r,n){t.call(this,e),this.keySelector=n,this.hasKey=!1,"function"==typeof r&&(this.compare=r)}return i(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e=this.keySelector,r=t;if(e&&(r=a.tryCatch(this.keySelector)(t),r===s.errorObject))return this.destination.error(s.errorObject.e);var n=!1;if(this.hasKey){if(n=a.tryCatch(this.compare)(this.key,r),n===s.errorObject)return this.destination.error(s.errorObject.e)}else this.hasKey=!0;Boolean(n)===!1&&(this.key=r,this.destination.next(t))},e}(o.Subscriber)},{"../Subscriber":35,"../util/errorObject":147,"../util/tryCatch":156}],107:[function(t,e,r){"use strict";function n(t,e,r){return this.lift(new a(t,e,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("../Subscriber");r._do=n;var a=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,i){t.call(this,e);var a=new o.Subscriber(r,n,i);a.syncErrorThrowable=!0,this.add(a),this.safeSubscriber=a}return i(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}(o.Subscriber)},{"../Subscriber":35}],108:[function(t,e,r){"use strict";function n(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 u(t,e,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("../util/tryCatch"),a=t("../util/errorObject"),s=t("../OuterSubscriber"),c=t("../util/subscribeToResult");r.expand=n;var u=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 h(t,this.project,this.concurrent,this.scheduler))},t}();r.ExpandOperator=u;var h=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 i(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)return void this._complete();var n=this.index++;if(this.active<this.concurrent){r.next(t);var i=o.tryCatch(this.project)(t,n);if(i===a.errorObject)r.error(a.errorObject.e);else if(this.scheduler){var s={subscriber:this,result:i,value:t,index:n};this.add(this.scheduler.schedule(e.dispatch,0,s))}else this.subscribeToProjection(i,t,n)}else this.buffer.push(t)},e.prototype.subscribeToProjection=function(t,e,r){this.active++,this.add(c.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=h},{"../OuterSubscriber":30,"../util/errorObject":147,"../util/subscribeToResult":154,"../util/tryCatch":156}],109:[function(t,e,r){"use strict";function n(t,e){return this.lift(new a(t,e))}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");r.filter=n;var a=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 i(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}(o.Subscriber)},{"../Subscriber":35}],110:[function(t,e,r){"use strict";function n(t){return this.lift(new s(t))}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"),a=t("../Subscription");r._finally=n;var s=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.callback))},t}(),c=function(t){function e(e,r){t.call(this,e),this.add(new a.Subscription(r))}return i(e,t),e}(o.Subscriber)},{"../Subscriber":35,"../Subscription":36}],111:[function(t,e,r){"use strict";function n(t,e,r){return this.lift(new s(t,e,r,this))}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"),a=t("../util/EmptyError");r.first=n;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 c(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),c=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}return i(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){return this.resultSelector?void this._tryResultSelector(t,e):void 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;e.next(t),e.complete(),this.hasCompleted=!0},e.prototype._complete=function(){var t=this.destination;this.hasCompleted||"undefined"==typeof this.defaultValue?this.hasCompleted||t.error(new a.EmptyError):(t.next(this.defaultValue),t.complete())},e}(o.Subscriber)},{"../Subscriber":35,"../util/EmptyError":144}],112:[function(t,e,r){"use strict";function n(t,e,r){return this.lift(new s(t,e,r,this))}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"),a=t("../util/EmptyError");r.last=n;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 c(t,this.predicate,this.resultSelector,this.defaultValue,this.source))},t}(),c=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,"undefined"!=typeof i&&(this.lastValue=i,this.hasValue=!0)}return i(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 a.EmptyError)},e}(o.Subscriber)},{"../Subscriber":35,"../util/EmptyError":144}],113:[function(t,e,r){"use strict";function n(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new a(t,e))}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");r.map=n;var a=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=a;var s=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return i(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}(o.Subscriber)},{"../Subscriber":35}],114:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return t.unshift(this),i.apply(this,t)}function i(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=Number.POSITIVE_INFINITY,n=null,i=t[t.length-1];return s.isScheduler(i)?(n=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(r=t.pop())):"number"==typeof i&&(r=t.pop()),1===t.length?t[0]:new o.ArrayObservable(t,n).lift(new a.MergeAllOperator(r))}var o=t("../observable/ArrayObservable"),a=t("./mergeAll"),s=t("../util/isScheduler");r.merge=n,r.mergeStatic=i},{"../observable/ArrayObservable":79,"../util/isScheduler":152,"./mergeAll":115}],115:[function(t,e,r){"use strict";function n(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),this.lift(new s(t))}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("../OuterSubscriber"),a=t("../util/subscribeToResult");r.mergeAll=n;var s=function(){function t(t){this.concurrent=t}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.concurrent))},t}();r.MergeAllOperator=s;var c=function(t){function e(e,r){t.call(this,e),this.concurrent=r,this.hasCompleted=!1,this.buffer=[],this.active=0}return i(e,t),e.prototype._next=function(t){this.active<this.concurrent?(this.active++,this.add(a.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}(o.OuterSubscriber);r.MergeAllSubscriber=c},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],116:[function(t,e,r){"use strict";function n(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 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("../util/subscribeToResult"),a=t("../OuterSubscriber");r.mergeMap=n;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 c(t,this.project,this.resultSelector,this.concurrent))},t}();r.MergeMapOperator=s;var c=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 i(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(o.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}(a.OuterSubscriber);r.MergeMapSubscriber=c},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],117:[function(t,e,r){"use strict";function n(t,e){var r;return r="function"==typeof t?t:function(){return t},e?new i.MulticastObservable(this,r,e):new o.ConnectableObservable(this,r)}var i=t("../observable/MulticastObservable"),o=t("../observable/ConnectableObservable");r.multicast=n},{"../observable/ConnectableObservable":80,"../observable/MulticastObservable":87}],118:[function(t,e,r){"use strict";function n(t,e){return void 0===e&&(e=0),this.lift(new s(t,e))}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"),a=t("../Notification");r.observeOn=n;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 c(t,this.scheduler,this.delay))},t}();r.ObserveOnOperator=s;var c=function(t){function e(e,r,n){void 0===n&&(n=0),t.call(this,e),this.scheduler=r,this.delay=n}return i(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination;e.observe(r)},e.prototype.scheduleMessage=function(t){this.add(this.scheduler.schedule(e.dispatch,this.delay,new u(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(a.Notification.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(a.Notification.createError(t))},e.prototype._complete=function(){this.scheduleMessage(a.Notification.createComplete())},e}(o.Subscriber);r.ObserveOnSubscriber=c;var u=function(){function t(t,e){this.notification=t,this.destination=e}return t}();r.ObserveOnMessage=u},{"../Notification":27,"../Subscriber":35}],119:[function(t,e,r){"use strict";function n(){return this.lift(new a)}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");r.pairwise=n;var a=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 i(e,t),e.prototype._next=function(t){this.hasPrev?this.destination.next([this.prev,t]):this.hasPrev=!0,this.prev=t},e}(o.Subscriber)},{"../Subscriber":35}],120:[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.length;if(0===r)throw new Error("list of properties cannot be empty.");return o.map.call(this,i(t,r))}function i(t,e){var r=function(r){for(var n=r,i=0;i<e;i++){var o=n[t[i]];if("undefined"==typeof o)return;n=o}return n};return r}var o=t("./map");r.pluck=n},{"./map":113}],121:[function(t,e,r){"use strict";function n(t){return t?o.multicast.call(this,function(){return new i.Subject},t):o.multicast.call(this,new i.Subject)}var i=t("../Subject"),o=t("./multicast");r.publish=n},{"../Subject":33,"./multicast":117}],122:[function(t,e,r){"use strict";function n(t,e,r){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===e&&(e=Number.POSITIVE_INFINITY),o.multicast.call(this,new i.ReplaySubject(t,e,r))}var i=t("../ReplaySubject"),o=t("./multicast");r.publishReplay=n},{"../ReplaySubject":31,"./multicast":117}],123:[function(t,e,r){"use strict";function n(t,e){return this.lift(new a(t,e))}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");r.scan=n;var a=function(){function t(t,e){this.accumulator=t,this.seed=e}return t.prototype.call=function(t,e){return e._subscribe(new s(t,this.accumulator,this.seed))},t}(),s=function(t){function e(e,r,n){t.call(this,e),this.accumulator=r,this.index=0,this.accumulatorSet=!1,this.seed=n,this.accumulatorSet="undefined"!=typeof n}return i(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.accumulatorSet=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){return this.accumulatorSet?this._tryNext(t):(this.seed=t,void 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}(o.Subscriber)},{"../Subscriber":35}],124:[function(t,e,r){"use strict";function n(){return new a.Subject}function i(){return o.multicast.call(this,n).refCount()}var o=t("./multicast"),a=t("../Subject");r.share=i},{"../Subject":33,"./multicast":117}],125:[function(t,e,r){"use strict";function n(t){return this.lift(new a(t))}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");r.skip=n;var a=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 i(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(o.Subscriber)},{"../Subscriber":35}],126:[function(t,e,r){"use strict";function n(t){return this.lift(new s(t))}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("../OuterSubscriber"),a=t("../util/subscribeToResult");r.skipUntil=n;var s=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.notifier))},t}(),c=function(t){function e(e,r){t.call(this,e),this.hasValue=!1,this.isInnerStopped=!1,this.add(a.subscribeToResult(this,r))}return i(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}(o.OuterSubscriber)},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],127:[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];c.isScheduler(r)?t.pop():r=null;var n=t.length;return 1===n?s.concatStatic(new o.ScalarObservable(t[0],r),this):n>1?s.concatStatic(new i.ArrayObservable(t,r),this):s.concatStatic(new a.EmptyObservable(r),this)}var i=t("../observable/ArrayObservable"),o=t("../observable/ScalarObservable"),a=t("../observable/EmptyObservable"),s=t("./concat"),c=t("../util/isScheduler");r.startWith=n},{"../observable/ArrayObservable":79,"../observable/EmptyObservable":82,"../observable/ScalarObservable":89,"../util/isScheduler":152,"./concat":103}],128:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}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("../OuterSubscriber"),a=t("../util/subscribeToResult");r.switchMap=n;var s=function(){function t(t,e){this.project=t,this.resultSelector=e}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.project,this.resultSelector))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.resultSelector=n,this.index=0}return i(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=a.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}(o.OuterSubscriber)},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],129:[function(t,e,r){"use strict";function n(t){return 0===t?new s.EmptyObservable:this.lift(new c(t))}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"),a=t("../util/ArgumentOutOfRangeError"),s=t("../observable/EmptyObservable");r.take=n;var c=function(){function t(t){if(this.total=t,this.total<0)throw new a.ArgumentOutOfRangeError}return t.prototype.call=function(t,e){return e._subscribe(new u(t,this.total))},t}(),u=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return i(e,t),e.prototype._next=function(t){var e=this.total;++this.count<=e&&(this.destination.next(t),this.count===e&&(this.destination.complete(),this.unsubscribe()))},e}(o.Subscriber)},{"../Subscriber":35,"../observable/EmptyObservable":82,"../util/ArgumentOutOfRangeError":143}],130:[function(t,e,r){"use strict";function n(t){return this.lift(new s(t))}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("../OuterSubscriber"),a=t("../util/subscribeToResult");r.takeUntil=n;var s=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.notifier))},t}(),c=function(t){function e(e,r){t.call(this,e),this.notifier=r,this.add(a.subscribeToResult(this,r))}return i(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.complete()},e.prototype.notifyComplete=function(){},e}(o.OuterSubscriber)},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],131:[function(t,e,r){"use strict";function n(){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 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("../OuterSubscriber"),a=t("../util/subscribeToResult");r.withLatestFrom=n;var s=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e._subscribe(new c(t,this.observables,this.project))},t}(),c=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(var o=0;o<i;o++)this.toRespond.push(o);for(var o=0;o<i;o++){var s=r[o];this.add(a.subscribeToResult(this,s,s,o))}}return i(e,t),e.prototype.notifyNext=function(t,e,r,n,i){this.values[r]=e;var o=this.toRespond;if(o.length>0){var a=o.indexOf(r);a!==-1&&o.splice(a,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}(o.OuterSubscriber)},{"../OuterSubscriber":30,"../util/subscribeToResult":154}],132:[function(t,e,r){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return t.unshift(this),i.apply(this,t)}function i(){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 a.ArrayObservable(t).lift(new p(r))}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)},a=t("../observable/ArrayObservable"),s=t("../util/isArray"),c=t("../Subscriber"),u=t("../OuterSubscriber"),h=t("../util/subscribeToResult"),l=t("../symbol/iterator");r.zipProto=n,r.zipStatic=i;var p=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e._subscribe(new f(t,this.project))},t}();r.ZipOperator=p;var f=function(t){function e(e,r,n){void 0===n&&(n=Object.create(null)),t.call(this,e),this.index=0,this.iterators=[],this.active=0,this.project="function"==typeof r?r:null,this.values=n}return o(e,t),e.prototype._next=function(t){var e=this.iterators,r=this.index++;s.isArray(t)?e.push(new m(t)):"function"==typeof t[l.$$iterator]?e.push(new d(t[l.$$iterator]())):e.push(new v(this.destination,this,t,r))},e.prototype._complete=function(){var t=this.iterators,e=t.length;this.active=e;for(var r=0;r<e;r++){var n=t[r];n.stillUnsubscribed?this.add(n.subscribe(n,r)):this.active--}},e.prototype.notifyInactive=function(){this.active--,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++){var i=t[n];if("function"==typeof i.hasValue&&!i.hasValue())return}for(var o=!1,a=[],n=0;n<e;n++){var i=t[n],s=i.next();if(i.hasCompleted()&&(o=!0),s.done)return void r.complete();a.push(s.value)}this.project?this._tryProject(a):r.next(a),o&&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}(c.Subscriber);r.ZipSubscriber=f;var d=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}(),m=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[l.$$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}(),v=function(t){function e(e,r,n,i){t.call(this,e),this.parent=r,this.observable=n,this.index=i,this.stillUnsubscribed=!0,this.buffer=[],this.isComplete=!1}return o(e,t),e.prototype[l.$$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 h.subscribeToResult(this,this.observable,this,e)},e}(u.OuterSubscriber)},{"../OuterSubscriber":30,"../Subscriber":35,"../observable/ArrayObservable":79,"../symbol/iterator":140,"../util/isArray":148,"../util/subscribeToResult":154}],133:[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=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}(i.Subscription);r.Action=o},{"../Subscription":36}],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("../util/root"),o=t("./Action"),a=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?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);return r?r:void(this.pending===!1&&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.delay=null,this.state=null,this.pending=!1,this.scheduler=null,n!==-1&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null))},e}(o.Action);r.AsyncAction=a},{"../util/root":153,"./Action":133}],135:[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"),o=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)return void e.push(t);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}(i.Scheduler);r.AsyncScheduler=o},{"../Scheduler":32}],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("./AsyncAction"),o=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?t.prototype.requestAsyncId.call(this,e,r,n):e.flush(this)},e}(i.AsyncAction);r.QueueAction=o},{"./AsyncAction":134}],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("./AsyncScheduler"),o=function(t){function e(){t.apply(this,arguments)}return n(e,t),e}(i.AsyncScheduler);r.QueueScheduler=o},{"./AsyncScheduler":135}],138:[function(t,e,r){"use strict";var n=t("./AsyncAction"),i=t("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":134,"./AsyncScheduler":135}],139:[function(t,e,r){"use strict";var n=t("./QueueAction"),i=t("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":136,"./QueueScheduler":137}],140:[function(t,e,r){"use strict";var n=t("../util/root"),i=n.root.Symbol;if("function"==typeof i)i.iterator?r.$$iterator=i.iterator:"function"==typeof i.for&&(r.$$iterator=i.for("iterator"));else if(n.root.Set&&"function"==typeof(new n.root.Set)["@@iterator"])r.$$iterator="@@iterator";else if(n.root.Map)for(var o=Object.getOwnPropertyNames(n.root.Map.prototype),a=0;a<o.length;++a){var s=o[a];if("entries"!==s&&"size"!==s&&n.root.Map.prototype[s]===n.root.Map.prototype.entries){r.$$iterator=s;break}}else r.$$iterator="@@iterator"},{"../util/root":153}],141:[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)},{"../util/root":153}],142:[function(t,e,r){"use strict";var n=t("../util/root"),i=n.root.Symbol;r.$$rxSubscriber="function"==typeof i&&"function"==typeof i.for?i.for("rxSubscriber"):"@@rxSubscriber"},{"../util/root":153}],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=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},{}],144:[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},{}],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=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},{}],146:[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},{}],147:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],148:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],149:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],150:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],151:[function(t,e,r){"use strict";function n(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}r.isPromise=n},{}],152:[function(t,e,r){"use strict";function n(t){return t&&"function"==typeof t.schedule;
-}r.isScheduler=n},{}],153:[function(t,e,r){(function(t){"use strict";var e={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1};r.root=e[typeof self]&&self||e[typeof window]&&window;var n=e[typeof t]&&t;!n||n.global!==n&&n.window!==n||(r.root=n)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],154:[function(t,e,r){"use strict";function n(t,e,r,n){var l=new u.InnerSubscriber(t,r,n);if(l.closed)return null;if(e instanceof s.Observable)return e._isScalar?(l.next(e.value),l.complete(),null):e.subscribe(l);if(o.isArray(e)){for(var p=0,f=e.length;p<f&&!l.closed;p++)l.next(e[p]);l.closed||l.complete()}else{if(a.isPromise(e))return e.then(function(t){l.closed||(l.next(t),l.complete())},function(t){return l.error(t)}).then(null,function(t){i.root.setTimeout(function(){throw t})}),l;if("function"==typeof e[c.$$iterator])for(var d=e[c.$$iterator]();;){var m=d.next();if(m.done){l.complete();break}if(l.next(m.value),l.closed)break}else if("function"==typeof e[h.$$observable]){var v=e[h.$$observable]();if("function"==typeof v.subscribe)return v.subscribe(new u.InnerSubscriber(t,r,n));l.error(new Error("invalid observable"))}else l.error(new TypeError("unknown type returned"))}return null}var i=t("./root"),o=t("./isArray"),a=t("./isPromise"),s=t("../Observable"),c=t("../symbol/iterator"),u=t("../InnerSubscriber"),h=t("../symbol/observable");r.subscribeToResult=n},{"../InnerSubscriber":26,"../Observable":28,"../symbol/iterator":140,"../symbol/observable":141,"./isArray":148,"./isPromise":151,"./root":153}],155:[function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof i.Subscriber)return t;if(t[o.$$rxSubscriber])return t[o.$$rxSubscriber]()}return t||e||r?new i.Subscriber(t,e,r):new i.Subscriber}var i=t("../Subscriber"),o=t("../symbol/rxSubscriber");r.toSubscriber=n},{"../Subscriber":35,"../symbol/rxSubscriber":142}],156:[function(t,e,r){"use strict";function n(){try{return o.apply(this,arguments)}catch(t){return a.errorObject.e=t,a.errorObject}}function i(t){return o=t,n}var o,a=t("./errorObject");r.tryCatch=i},{"./errorObject":147}],157:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.THREE=e.THREE||{})}(this,function(t){function e(){}function r(t,e){this.x=t||0,this.y=e||0}function n(t,e,i,o,a,s,c,u,h,l){Object.defineProperty(this,"id",{value:qn++}),this.uuid=Wn.generateUUID(),this.sourceFile=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!==a?a:1006,this.minFilter=void 0!==s?s: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=Wn.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),r=r||{},void 0===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 a(t,e,r){o.call(this,t,e,r),this.activeMipMapLevel=this.activeCubeFace=0}function s(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=new Float32Array([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,a,s,c,u,h){t=void 0!==t?t:[],n.call(this,t,void 0!==e?e:301,r,i,o,a,s,c,u,h),this.flipY=!1}function l(t,e,r){var n=t[0];if(0>=n||0<n)return t;var i=e*r,o=Kn[i];if(void 0===o&&(o=new Float32Array(i),Kn[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 p(t,e){var r=Zn[e];void 0===r&&(r=new Int32Array(e),Zn[e]=r);for(var n=0;n!==e;++n)r[n]=t.allocTextureUnit();return r}function f(t,e){t.uniform1f(this.addr,e)}function d(t,e){t.uniform1i(this.addr,e)}function m(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function v(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 g(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function y(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function b(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function _(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function x(t,e,r){var n=r.allocTextureUnit();t.uniform1i(this.addr,n),r.setTexture2D(e||Xn,n)}function w(t,e,r){var n=r.allocTextureUnit();t.uniform1i(this.addr,n),r.setTextureCube(e||Yn,n)}function S(t,e){t.uniform2iv(this.addr,e)}function M(t,e){t.uniform3iv(this.addr,e)}function E(t,e){t.uniform4iv(this.addr,e)}function T(t){switch(t){case 5126:return f;case 35664:return m;case 35665:return v;case 35666:return g;case 35674:return y;case 35675:return b;case 35676:return _;case 35678:return x;case 35680:return w;case 5124:case 35670:return d;case 35667:case 35671:return S;case 35668:case 35672:return M;case 35669:case 35673:return E}}function C(t,e){t.uniform1fv(this.addr,e)}function O(t,e){t.uniform1iv(this.addr,e)}function P(t,e){t.uniform2fv(this.addr,l(e,this.size,2))}function A(t,e){t.uniform3fv(this.addr,l(e,this.size,3))}function j(t,e){t.uniform4fv(this.addr,l(e,this.size,4))}function R(t,e){t.uniformMatrix2fv(this.addr,!1,l(e,this.size,4))}function L(t,e){t.uniformMatrix3fv(this.addr,!1,l(e,this.size,9))}function N(t,e){t.uniformMatrix4fv(this.addr,!1,l(e,this.size,16))}function I(t,e,r){var n=e.length,i=p(r,n);for(t.uniform1iv(this.addr,i),t=0;t!==n;++t)r.setTexture2D(e[t]||Xn,i[t])}function D(t,e,r){var n=e.length,i=p(r,n);for(t.uniform1iv(this.addr,i),t=0;t!==n;++t)r.setTextureCube(e[t]||Yn,i[t])}function k(t){switch(t){case 5126:return C;case 35664:return P;case 35665:return A;case 35666:return j;case 35674:return R;case 35675:return L;case 35676:return N;case 35678:return I;case 35680:return D;case 5124:case 35670:return O;case 35667:case 35671:return S;case 35668:case 35672:return M;case 35669:case 35673:return E}}function F(t,e,r){this.id=t,this.addr=r,this.setValue=T(e.type)}function U(t,e,r){this.id=t,this.addr=r,this.size=e.size,this.setValue=k(e.type)}function B(t){this.id=t,this.seq=[],this.map={}}function z(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),a=this,s=i.name,c=s.length;for(Jn.lastIndex=0;;){var u=Jn.exec(s),h=Jn.lastIndex,l=u[1],p=u[3];if("]"===u[2]&&(l|=0),void 0===p||"["===p&&h+2===c){s=a,i=void 0===p?new F(l,i,o):new U(l,i,o),s.seq.push(i),s.map[i.id]=i;break}p=a.map[l],void 0===p&&(p=new B(l),l=a,a=p,l.seq.push(a),l.map[a.id]=a),a=p}}}function G(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 $(t,e){var n,i,o,a,s,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=16/M.w,P=new r(O*E,O),A=new c(1,1,0),j=new r(1,1),R=new V;if(R.min.set(M.x,M.y),R.max.set(M.x+(M.z-16),M.y+(M.w-16)),void 0===g){var O=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,O,_.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 O=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+O.fragmentShader),_.shaderSource(I,D+O.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"),a=_.getUniformLocation(g,"opacity"),s=_.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.setDepthWrite(!1),L=0,N=e.length;L<N;L++)if(O=16/M.w,P.set(O*E,O),I=e[L],w.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),w.applyMatrix4(S.matrixWorldInverse),w.applyProjection(S.projectionMatrix),A.copy(w),j.x=M.x+A.x*T+T-8,j.y=M.y+A.y*C+C-8,!0===R.containsPoint(j)){x.activeTexture(_.TEXTURE0),x.bindTexture(_.TEXTURE_2D,null),x.activeTexture(_.TEXTURE1),x.bindTexture(_.TEXTURE_2D,y),_.copyTexImage2D(_.TEXTURE_2D,0,_.RGB,j.x,j.y,16,16,0),_.uniform1i(n,0),_.uniform2f(u,P.x,P.y),_.uniform3f(l,A.x,A.y,A.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,j.x,j.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(A),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&&(A.x=F.x,A.y=F.y,A.z=F.z,O=F.size*F.scale/M.w,P.x=O*E,P.y=O,_.uniform3f(l,A.x,A.y,A.z),_.uniform2f(u,P.x,P.y),_.uniform1f(h,F.rotation),_.uniform1f(a,F.opacity),_.uniform3f(s,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.setDepthWrite(!0),t.resetGLState()}}}function H(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,a,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 s,j=new c;this.render=function(s,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;","uniform 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;","uniform 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"),a=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"),R.width=8,R.height=8,L=R.getContext("2d"),L.fillStyle="white",L.fillRect(0,0,8,8),T=new n(R),T.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=s.fog)?(C.uniform3f(b,N.color.r,N.color.g,N.color.b),N&&N.isFog?(C.uniform1f(g,N.near),C.uniform1f(y,N.far),C.uniform1i(m,1),L=R=1):N&&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++){var D=e[N];D.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,D.matrixWorld),D.z=-D.modelViewMatrix.elements[14]}e.sort(r);for(var k=[],N=0,I=e.length;N<I;N++){var D=e[N],F=D.material;!1!==F.visible&&(C.uniform1f(_,F.alphaTest),C.uniformMatrix4fv(f,!1,D.modelViewMatrix.elements),D.matrixWorld.decompose(P,A,j),k[0]=j.x,k[1]=j.y,D=0,s.fog&&F.fog&&(D=L),R!==D&&(C.uniform1i(m,D),R=D),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(a,F.rotation),C.uniform2fv(u,k),O.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),O.setDepthTest(F.depthTest),O.setDepthWrite(F.depthWrite),F.map?t.setTexture2D(F.map,0):t.setTexture2D(T,0),C.drawElements(C.TRIANGLES,6,C.UNSIGNED_SHORT,0))}O.enable(C.CULL_FACE),t.resetGLState()}}}function W(){Object.defineProperty(this,"id",{value:ii++}),this.uuid=Wn.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.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.premultipliedAlpha=!1,this.overdraw=0,this._needsUpdate=this.visible=!0}function q(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 X(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 Y(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 K(t,e){this.center=void 0!==t?t:new c,this.radius=void 0!==e?e:0}function Z(){this.elements=new Float32Array([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 J(t,e){this.normal=void 0!==t?t:new c(1,0,0),this.constant=void 0!==e?e:0}function Q(t,e,r,n,i,o){this.planes=[void 0!==t?t:new J,void 0!==e?e:new J,void 0!==r?r:new J,void 0!==n?n:new J,void 0!==i?i:new J,void 0!==o?o:new J]}function tt(t,e,n,a){function s(e,r,n,i){var o,a=e.geometry;o=x;var s=e.customDepthMaterial;return n&&(o=w,s=e.customDistanceMaterial),s?o=s:(s=!1,r.morphTargets&&(a&&a.isBufferGeometry?s=a.morphAttributes&&a.morphAttributes.position&&0<a.morphAttributes.position.length:a&&a.isGeometry&&(s=a.morphTargets&&0<a.morphTargets.length)),e=e.isSkinnedMesh&&r.skinning,a=0,s&&(a|=1),e&&(a|=2),o=o[a]),t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length&&(a=o.uuid,s=r.uuid,e=S[a],void 0===e&&(e={},S[a]=e),a=e[s],void 0===a&&(a=o.clone(),e[s]=a),o=a),o.visible=r.visible,o.wireframe=r.wireframe,s=r.side,R.renderSingleSided&&2==s&&(s=0),R.renderReverseSided&&(0===s?s=1:1===s&&(s=0)),o.side=s,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(t,e,r){if(!1!==t.visible){0!==(t.layers.mask&e.layers.mask)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!1===t.frustumCulled||!0===f.intersectsObject(t))&&!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),_.push(t)),t=t.children;for(var n=0,i=t.length;n<i;n++)h(t[n],e,r)}}var l=t.context,p=t.state,f=new Q,d=new u,m=e.shadows,v=new r,g=new r(a.maxTextureSize,a.maxTextureSize),y=new c,b=new c,_=[],x=Array(4),w=Array(4),S={},M=[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)],E=[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)],T=[new i,new i,new i,new i,new i,new i];e=new X,e.depthPacking=3201,e.clipping=!0,a=ni.distanceRGBA;for(var C=Qn.clone(a.uniforms),O=0;4!==O;++O){var P=0!==(1&O),A=0!==(2&O),j=e.clone();j.morphTargets=P,j.skinning=A,x[O]=j,P=new q({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,morphTargets:P,skinning:A,clipping:!0}),w[O]=P}var R=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!==R.enabled&&(!1!==R.autoUpdate||!1!==R.needsUpdate)&&0!==m.length){p.clearColor(1,1,1,1),p.disable(l.BLEND),p.setDepthTest(!0),p.setScissorTest(!1);for(var i,a,c=0,u=m.length;c<u;c++){var x=m[c],w=x.shadow;if(void 0===w)console.warn("THREE.WebGLShadowMap:",x,"has no shadow.");else{var S=w.camera;if(v.copy(w.mapSize),v.min(g),x&&x.isPointLight){i=6,a=!0;var C=v.x,O=v.y;T[0].set(2*C,O,C,O),T[1].set(0,O,C,O),T[2].set(3*C,O,C,O),T[3].set(C,O,C,O),T[4].set(3*C,0,C,O),T[5].set(C,0,C,O),v.x*=4,v.y*=2}else i=1,a=!1;for(null===w.map&&(w.map=new o(v.x,v.y,{minFilter:1003,magFilter:1003,format:1023}),S.updateProjectionMatrix()),w&&w.isSpotLightShadow&&w.update(x),C=w.map,w=w.matrix,b.setFromMatrixPosition(x.matrixWorld),S.position.copy(b),t.setRenderTarget(C),t.clear(),C=0;C<i;C++){a?(y.copy(S.position),y.add(M[C]),S.up.copy(E[C]),S.lookAt(y),p.viewport(T[C])):(y.setFromMatrixPosition(x.target.matrixWorld),S.lookAt(y)),S.updateMatrixWorld(),S.matrixWorldInverse.getInverse(S.matrixWorld),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(S.projectionMatrix),w.multiply(S.matrixWorldInverse),d.multiplyMatrices(S.projectionMatrix,S.matrixWorldInverse),f.setFromMatrix(d),_.length=0,h(e,r,S);for(var O=0,P=_.length;O<P;O++){var A=_[O],j=n.update(A),L=A.material;if(L&&L.isMultiMaterial)for(var N=j.groups,L=L.materials,I=0,D=N.length;I<D;I++){var k=N[I],F=L[k.materialIndex];!0===F.visible&&(F=s(A,F,a,b),t.renderBufferDirect(S,null,j,F,A,k))}else F=s(A,L,a,b),t.renderBufferDirect(S,null,j,F,A,null)}}}}i=t.getClearColor(),a=t.getClearAlpha(),t.setClearColor(i,a),R.needsUpdate=!1}}}function et(t,e){this.origin=void 0!==t?t:new c,this.direction=void 0!==e?e:new c}function rt(t,e,r,n){this._x=t||0,this._y=e||0,this._z=r||0,this._order=n||rt.DefaultOrder}function nt(){this.mask=1}function it(){Object.defineProperty(this,"id",{value:oi++}),this.uuid=Wn.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=it.DefaultUp.clone();var t=new c,e=new rt,r=new s,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 Z}}),this.matrix=new u,this.matrixWorld=new u,this.matrixAutoUpdate=it.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new nt,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function ot(t,e){this.start=void 0!==t?t:new c,this.end=void 0!==e?e:new c}function at(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 st(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 G,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0}function ct(t){W.call(this),this.type="MeshBasicMaterial",this.color=new G(16777215),this.aoMap=this.map=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 ut(t,e,r){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Wn.generateUUID(),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.version=0}function ht(t,e){return new ut(new Uint16Array(t),e)}function lt(t,e){return new ut(new Uint32Array(t),e)}function pt(t,e){return new ut(new Float32Array(t),e)}function ft(){Object.defineProperty(this,"id",{value:ai++}),this.uuid=Wn.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 dt(){Object.defineProperty(this,"id",{value:ai++}),this.uuid=Wn.generateUUID(),this.name="",this.type="DirectGeometry",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 mt(){Object.defineProperty(this,"id",{value:ai++}),this.uuid=Wn.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 vt(t,e){it.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new mt,this.material=void 0!==e?e:new ct({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function gt(t,e,r,n,i,o){function a(t,e,r,n,i,o,a,u,h,_,x){var w=o/h,S=a/_,M=o/2,E=a/2,T=u/2;a=h+1;for(var C=_+1,O=o=0,P=new c,A=0;A<C;A++)for(var j=A*S-E,R=0;R<a;R++)P[t]=(R*w-M)*n,P[e]=j*i,P[r]=T,p[m]=P.x,p[m+1]=P.y,p[m+2]=P.z,P[t]=0,P[e]=0,P[r]=0<u?1:-1,f[m]=P.x,f[m+1]=P.y,f[m+2]=P.z,d[v]=R/h,d[v+1]=1-A/_,m+=3,v+=2,o+=1;for(A=0;A<_;A++)for(R=0;R<h;R++)t=y+R+a*(A+1),e=y+(R+1)+a*(A+1),r=y+(R+1)+a*A,l[g]=y+R+a*A,l[g+1]=t,l[g+2]=r,l[g+3]=t,l[g+4]=e,l[g+5]=r,g+=6,O+=6;s.addGroup(b,O,x),b+=O,y+=o}mt.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:o};var s=this;n=Math.floor(n)||1,i=Math.floor(i)||1,o=Math.floor(o)||1;var u=function(t,e,r){return t=0+(t+1)*(e+1)*2+(t+1)*(r+1)*2+(r+1)*(e+1)*2}(n,i,o),h=function(t,e,r){return t=0+t*e*2+t*r*2+r*e*2,6*t}(n,i,o),l=new(65535<h?Uint32Array:Uint16Array)(h),p=new Float32Array(3*u),f=new Float32Array(3*u),d=new Float32Array(2*u),m=0,v=0,g=0,y=0,b=0;a("z","y","x",-1,-1,r,e,t,o,i,0),a("z","y","x",1,-1,r,e,-t,o,i,1),a("x","z","y",1,1,t,r,e,n,o,2),a("x","z","y",1,-1,t,r,-e,n,o,3),a("x","y","z",1,-1,t,e,r,n,i,4),a("x","y","z",-1,-1,t,e,-r,n,i,5),this.setIndex(new ut(l,1)),this.addAttribute("position",new ut(p,3)),this.addAttribute("normal",new ut(f,3)),this.addAttribute("uv",new ut(d,2))}function yt(t,e,r,n){mt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n};var i=t/2,o=e/2;r=Math.floor(r)||1,n=Math.floor(n)||1;var a=r+1,s=n+1,c=t/r,u=e/n;e=new Float32Array(a*s*3),t=new Float32Array(a*s*3);for(var h=new Float32Array(a*s*2),l=0,p=0,f=0;f<s;f++)for(var d=f*u-o,m=0;m<a;m++)e[l]=m*c-i,e[l+1]=-d,t[l+2]=1,h[p]=m/r,h[p+1]=1-f/n,l+=3,p+=2;for(l=0,i=new(65535<e.length/3?Uint32Array:Uint16Array)(r*n*6),f=0;f<n;f++)for(m=0;m<r;m++)o=m+a*(f+1),s=m+1+a*(f+1),c=m+1+a*f,i[l]=m+a*f,i[l+1]=o,i[l+2]=c,i[l+3]=o,i[l+4]=s,i[l+5]=c,l+=6;this.setIndex(new ut(i,1)),this.addAttribute("position",new ut(e,3)),this.addAttribute("normal",new ut(t,3)),this.addAttribute("uv",new ut(h,2))}function bt(){it.call(this),this.type="Camera",this.matrixWorldInverse=new u,this.projectionMatrix=new u}function _t(t,e,r,n){bt.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 xt(t,e,r,n,i,o){bt.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 wt(t,e,r){var n,i,o;return{setMode:function(t){n=t},setIndex:function(r){r.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(i=t.UNSIGNED_INT,o=4):(i=t.UNSIGNED_SHORT,o=2)},render:function(e,a){t.drawElements(n,a,i,e*o),r.calls++,r.vertices+=a,n===t.TRIANGLES&&(r.faces+=a/3)},renderInstances:function(a,s,c){var u=e.get("ANGLE_instanced_arrays");null===u?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(u.drawElementsInstancedANGLE(n,c,i,s*o,a.maxInstancedCount),r.calls++,r.vertices+=c*a.maxInstancedCount,n===t.TRIANGLES&&(r.faces+=a.maxInstancedCount*c/3))}}}function St(t,e,r){var n;return{setMode:function(t){n=t},render:function(e,i){t.drawArrays(n,e,i),r.calls++,r.vertices+=i,n===t.TRIANGLES&&(r.faces+=i/3)},renderInstances:function(i){var o=e.get("ANGLE_instanced_arrays");if(null===o)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var a=i.attributes.position,a=a&&a.isInterleavedBufferAttribute?a.data.count:a.count;o.drawArraysInstancedANGLE(n,0,a,i.maxInstancedCount),r.calls++,r.vertices+=a*i.maxInstancedCount,n===t.TRIANGLES&&(r.faces+=i.maxInstancedCount*a/3)}}}}function Mt(){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 G,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"SpotLight":
-n={position:new c,direction:new c,color:new G,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 G,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"HemisphereLight":n={direction:new c,skyColor:new G,groundColor:new G}}return t[e.id]=n}}}function Et(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}function Tt(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),Et(r)),n}function Ct(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 Ot(t,e){var r=Ct(e);return"vec4 "+t+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function Pt(t,e){var r=Ct(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function At(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 jt(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(Lt).join("\n")}function Rt(t){var e,r=[];for(e in t){var n=t[e];!1!==n&&r.push("#define "+e+" "+n)}return r.join("\n")}function Lt(t){return""!==t}function Nt(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function It(t){return t.replace(/#include +<([\w\d.]+)>/g,function(t,e){var r=ti[e];if(void 0===r)throw Error("Can not resolve #include <"+e+">");return It(r)})}function Dt(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 kt(t,e,r,n){var i=t.context,o=r.extensions,a=r.defines,s=r.__webglShader.vertexShader,c=r.__webglShader.fragmentShader,u="SHADOWMAP_TYPE_BASIC";1===n.shadowMapType?u="SHADOWMAP_TYPE_PCF":2===n.shadowMapType&&(u="SHADOWMAP_TYPE_PCF_SOFT");var h="ENVMAP_TYPE_CUBE",l="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(r.envMap.mapping){case 301:case 302:h="ENVMAP_TYPE_CUBE";break;case 306:case 307:h="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:h="ENVMAP_TYPE_EQUIREC";break;case 305:h="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case 302:case 304:l="ENVMAP_MODE_REFRACTION"}switch(r.combine){case 0:p="ENVMAP_BLENDING_MULTIPLY";break;case 1:p="ENVMAP_BLENDING_MIX";break;case 2:p="ENVMAP_BLENDING_ADD"}}var f=0<t.gammaFactor?t.gammaFactor:1,o=jt(o,n,t.extensions),d=Rt(a),m=i.createProgram();r.isRawShaderMaterial?(a=[d,"\n"].filter(Lt).join("\n"),u=[o,d,"\n"].filter(Lt).join("\n")):(a=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+r.__webglShader.name,d,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+f,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.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(Lt).join("\n"),u=[o,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+r.__webglShader.name,d,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+l:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(n.numClippingPlanes-n.numClipIntersection),n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?ti.tonemapping_pars_fragment:"",0!==n.toneMapping?At("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?ti.encodings_pars_fragment:"",n.mapEncoding?Ot("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Ot("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Ot("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Pt("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(Lt).join("\n")),s=It(s,n),s=Nt(s,n),c=It(c,n),c=Nt(c,n),r.isShaderMaterial||(s=Dt(s),c=Dt(c)),c=u+c,s=Tt(i,i.VERTEX_SHADER,a+s),c=Tt(i,i.FRAGMENT_SHADER,c),i.attachShader(m,s),i.attachShader(m,c),void 0!==r.index0AttributeName?i.bindAttribLocation(m,0,r.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),n=i.getProgramInfoLog(m),h=i.getShaderInfoLog(s),l=i.getShaderInfoLog(c),f=p=!0,!1===i.getProgramParameter(m,i.LINK_STATUS)?(p=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(m,i.VALIDATE_STATUS),"gl.getProgramInfoLog",n,h,l)):""!==n?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",n):""!==h&&""!==l||(f=!1),f&&(this.diagnostics={runnable:p,material:r,programLog:n,vertexShader:{log:h,prefix:a},fragmentShader:{log:l,prefix:u}}),i.deleteShader(s),i.deleteShader(c);var v;this.getUniforms=function(){return void 0===v&&(v=new z(i,m,t)),v};var g;return this.getAttributes=function(){if(void 0===g){for(var t={},e=i.getProgramParameter(m,i.ACTIVE_ATTRIBUTES),r=0;r<e;r++){var n=i.getActiveAttrib(m,r).name;t[n]=i.getAttribLocation(m,n)}g=t}return g},this.destroy=function(){i.deleteProgram(m),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=si++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=s,this.fragmentShader=c,this}function Ft(t,e){function r(t,e){var r;return t?t&&t.isTexture?r=t.encoding:t&&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",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 alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking".split(" ");this.getParameters=function(n,o,a,s,c,u){var h,l=i[n.type];e.floatVertexTextures&&u&&u.skeleton&&u.skeleton.useVertexTexture?h=1024:(h=Math.floor((e.maxVertexUniforms-20)/4),void 0!==u&&u&&u.isSkinnedMesh&&(h=Math.min(u.skeleton.bones.length,h),h<u.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+u.skeleton.bones.length+", this GPU supports just "+h+" (try OpenGL instead of ANGLE)")));var p=t.getPrecision();null!==n.precision&&(p=e.getMaxPrecision(n.precision),p!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",p,"instead."));var f=t.getCurrentRenderTarget();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,combine:n.combine,vertexColors:n.vertexColors,fog:!!a,useFog:n.fog,fogExp:a&&a.isFogExp2,flatShading:1===n.shading,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:n.skinning,maxBones:h,useVertexTexture:e.floatVertexTextures&&u&&u.skeleton&&u.skeleton.useVertexTexture,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numHemiLights:o.hemi.length,numClippingPlanes:s,numClipIntersection:c,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(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)r.push(n),r.push(t.defines[n]);for(n=0;n<o.length;n++)r.push(e[o[n]]);return r.join()},this.acquireProgram=function(e,r,i){for(var o,a=0,s=n.length;a<s;a++){var c=n[a];if(c.code===i){o=c,++o.usedTimes;break}}return void 0===o&&(o=new kt(t,i,e,r),n.push(o)),o},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 Ut(t,e,r){function n(t){var a=t.target;t=o[a.id],null!==t.index&&i(t.index);var s,c=t.attributes;for(s in c)i(c[s]);a.removeEventListener("dispose",n),delete o[a.id],s=e.get(a),s.wireframe&&i(s.wireframe),e.delete(a),a=e.get(t),a.wireframe&&i(a.wireframe),e.delete(t),r.memory.geometries--}function i(r){var n;n=r.isInterleavedBufferAttribute?e.get(r.data).__webglBuffer:e.get(r).__webglBuffer,void 0!==n&&(t.deleteBuffer(n),r.isInterleavedBufferAttribute?e.delete(r.data):e.delete(r))}var o={};return{get:function(t){var e=t.geometry;if(void 0!==o[e.id])return o[e.id];e.addEventListener("dispose",n);var i;return e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new mt).setFromObject(t)),i=e._bufferGeometry),o[e.id]=i,r.memory.geometries++,i}}}function Bt(t,e,r){function n(r,n){var i=r.isInterleavedBufferAttribute?r.data:r,o=e.get(i);void 0===o.__webglBuffer?(o.__webglBuffer=t.createBuffer(),t.bindBuffer(n,o.__webglBuffer),t.bufferData(n,i.array,i.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW),o.version=i.version):o.version!==i.version&&(t.bindBuffer(n,o.__webglBuffer),!1===i.dynamic?t.bufferData(n,i.array,t.STATIC_DRAW):-1===i.updateRange.count?t.bufferSubData(n,0,i.array):0===i.updateRange.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,i.updateRange.offset*i.array.BYTES_PER_ELEMENT,i.array.subarray(i.updateRange.offset,i.updateRange.offset+i.updateRange.count)),i.updateRange.count=0),o.version=i.version)}var i=new Ut(t,e,r);return{getAttributeBuffer:function(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer},getWireframeAttribute:function(r){var i=e.get(r);if(void 0!==i.wireframe)return i.wireframe;var o=[],a=r.index,s=r.attributes;if(r=s.position,null!==a)for(var a=a.array,s=0,c=a.length;s<c;s+=3){var u=a[s+0],h=a[s+1],l=a[s+2];o.push(u,h,h,l,l,u)}else for(a=s.position.array,s=0,c=a.length/3-1;s<c;s+=3)u=s+0,h=s+1,l=s+2,o.push(u,h,h,l,l,u);return o=new ut(new(65535<r.count?Uint32Array:Uint16Array)(o),1),n(o,t.ELEMENT_ARRAY_BUFFER),i.wireframe=o},update:function(e){var r=i.get(e);e.geometry.isGeometry&&r.updateFromObject(e),e=r.index;var o=r.attributes;null!==e&&n(e,t.ELEMENT_ARRAY_BUFFER);for(var a in o)n(o[a],t.ARRAY_BUFFER);e=r.morphAttributes;for(a in e)for(var o=e[a],s=0,c=o.length;s<c;s++)n(o[s],t.ARRAY_BUFFER);return r}}}function zt(t,e,r,n,i,o,a){function s(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 Wn.isPowerOfTwo(t.width)&&Wn.isPowerOfTwo(t.height)}function u(e){return 1003===e||1004===e||1005===e?t.NEAREST:t.LINEAR}function h(e){e=e.target,e.removeEventListener("dispose",h);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.delete(e)}v.textures--}function l(e){e=e.target,e.removeEventListener("dispose",l);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&&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.delete(e.texture),n.delete(e)}v.textures--}function p(e,a){var u=n.get(e);if(0<e.version&&u.__version!==e.version){var l=e.image;if(void 0===l)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==l.complete){void 0===u.__webglInit&&(u.__webglInit=!0,e.addEventListener("dispose",h),u.__webglTexture=t.createTexture(),v.textures++),r.activeTexture(t.TEXTURE0+a),r.bindTexture(t.TEXTURE_2D,u.__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 p=s(e.image,i.maxTextureSize);if((1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)&&!1===c(p))if(l=p,l instanceof HTMLImageElement||l instanceof HTMLCanvasElement){var d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");d.width=Wn.nearestPowerOfTwo(l.width),d.height=Wn.nearestPowerOfTwo(l.height),d.getContext("2d").drawImage(l,0,0,d.width,d.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+l.width+"x"+l.height+"). Resized to "+d.width+"x"+d.height,l),p=d}else p=l;var l=c(p),d=o(e.format),m=o(e.type);f(t.TEXTURE_2D,e,l);var y=e.mipmaps;if(e&&e.isDepthTexture){if(y=t.DEPTH_COMPONENT,1015===e.type){if(!g)throw Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else g&&(y=t.DEPTH_COMPONENT16);1027===e.format&&(y=t.DEPTH_STENCIL),r.texImage2D(t.TEXTURE_2D,0,y,p.width,p.height,0,d,m,null)}else if(e&&e.isDataTexture)if(0<y.length&&l){for(var b=0,_=y.length;b<_;b++)p=y[b],r.texImage2D(t.TEXTURE_2D,b,d,p.width,p.height,0,d,m,p.data);e.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,d,p.width,p.height,0,d,m,p.data);else if(e&&e.isCompressedTexture)for(b=0,_=y.length;b<_;b++)p=y[b],1023!==e.format&&1022!==e.format?-1<r.getCompressedTextureFormats().indexOf(d)?r.compressedTexImage2D(t.TEXTURE_2D,b,d,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.texImage2D(t.TEXTURE_2D,b,d,p.width,p.height,0,d,m,p.data);else if(0<y.length&&l){for(b=0,_=y.length;b<_;b++)p=y[b],r.texImage2D(t.TEXTURE_2D,b,d,d,m,p);e.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,d,d,m,p);return e.generateMipmaps&&l&&t.generateMipmap(t.TEXTURE_2D),u.__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+a),r.bindTexture(t.TEXTURE_2D,u.__webglTexture)}function f(r,a,s){s?(t.texParameteri(r,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(r,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(r,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(r,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(r,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(r,t.TEXTURE_MAG_FILTER,u(a.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,u(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),!(s=e.get("EXT_texture_filter_anisotropic"))||1015===a.type&&null===e.get("OES_texture_float_linear")||1016===a.type&&null===e.get("OES_texture_half_float_linear")||!(1<a.anisotropy||n.get(a).__currentAnisotropy)||(t.texParameterf(r,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}function d(e,i,a,s){var c=o(i.texture.format),u=o(i.texture.type);r.texImage2D(s,0,c,i.width,i.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,n.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function m(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 v=a.memory,g="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=p,this.setTextureCube=function(e,a){var u=n.get(e);if(6===e.image.length)if(0<e.version&&u.__version!==e.version){u.__image__webglTextureCube||(e.addEventListener("dispose",h),u.__image__webglTextureCube=t.createTexture(),v.textures++),r.activeTexture(t.TEXTURE0+a),r.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,p=e.image[0]&&e.image[0].isDataTexture,d=[],m=0;6>m;m++)d[m]=l||p?p?e.image[m].image:e.image[m]:s(e.image[m],i.maxCubemapSize);var g=c(d[0]),y=o(e.format),b=o(e.type);for(f(t.TEXTURE_CUBE_MAP,e,g),m=0;6>m;m++)if(l)for(var _,x=d[m].mipmaps,w=0,S=x.length;w<S;w++)_=x[w],1023!==e.format&&1022!==e.format?-1<r.getCompressedTextureFormats().indexOf(y)?r.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,y,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,y,_.width,_.height,0,y,b,_.data);else p?r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,d[m].width,d[m].height,0,y,b,d[m].data):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,y,b,d[m]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),u.__version=e.version,e.onUpdate&&e.onUpdate(e)}else r.activeTexture(t.TEXTURE0+a),r.bindTexture(t.TEXTURE_CUBE_MAP,u.__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",l),o.__webglTexture=t.createTexture(),v.textures++;var a=e&&e.isWebGLRenderTargetCube,s=c(e);if(a){i.__webglFramebuffer=[];for(var u=0;6>u;u++)i.__webglFramebuffer[u]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(a){for(r.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),f(t.TEXTURE_CUBE_MAP,e.texture,s),u=0;6>u;u++)d(i.__webglFramebuffer[u],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+u);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),r.bindTexture(t.TEXTURE_CUBE_MAP,null)}else r.bindTexture(t.TEXTURE_2D,o.__webglTexture),f(t.TEXTURE_2D,e.texture,s),d(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),r.bindTexture(t.TEXTURE_2D,null);if(e.depthBuffer){if(i=n.get(e),o=e&&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),p(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(),m(i.__webglDepthbuffer[o],e);else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),m(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var i=e.texture;i.generateMipmaps&&c(e)&&1003!==i.minFilter&&1006!==i.minFilter&&(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 Gt(){var t={};return{get:function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},delete:function(e){delete t[e.uuid]},clear:function(){t={}}}}function Vt(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!==w[e]&&(t.enable(e),w[e]=!0)}function a(e){!1!==w[e]&&(t.disable(e),w[e]=!1)}function s(e,n,i,s,c,u,h,l){0!==e?o(t.BLEND):a(t.BLEND),e===M&&l===j||(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)),M=e,j=l),5===e?(c=c||n,u=u||i,h=h||s,n===E&&c===O||(t.blendEquationSeparate(r(n),r(c)),E=n,O=c),i===T&&s===C&&u===P&&h===A||(t.blendFuncSeparate(r(i),r(s),r(u),r(h)),T=i,C=s,P=u,A=h)):A=P=O=C=T=E=null}function c(t){v.setFunc(t)}function u(e){R!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),R=e)}function h(e){0!==e?(o(t.CULL_FACE),e!==L&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):a(t.CULL_FACE),L=e}function l(e){void 0===e&&(e=t.TEXTURE0+F-1),U!==e&&(t.activeTexture(e),U=e)}function p(t,e,r,n){m.setClear(t,e,r,n)}function f(t){v.setClear(t)}function d(t){g.setClear(t)}var m=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,a){r.set(e,n,i,a),!1===o.equals(r)&&(t.clearColor(e,n,i,a),o.copy(r))},reset:function(){e=!1,n=null,o.set(0,0,0,1)}}},v=new function(){var e=!1,r=null,n=null,i=null;return{setTest:function(e){e?o(t.DEPTH_TEST):a(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}}},g=new function(){var e=!1,r=null,n=null,i=null,s=null,c=null,u=null,h=null,l=null;return{setTest:function(e){e?o(t.STENCIL_TEST):a(t.STENCIL_TEST)},setMask:function(n){r===n||e||(t.stencilMask(n),r=n)},setFunc:function(e,r,o){n===e&&i===r&&s===o||(t.stencilFunc(e,r,o),n=e,i=r,s=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=s=i=n=r=null}}},y=t.getParameter(t.MAX_VERTEX_ATTRIBS),b=new Uint8Array(y),_=new Uint8Array(y),x=new Uint8Array(y),w={},S=null,M=null,E=null,T=null,C=null,O=null,P=null,A=null,j=!1,R=null,L=null,N=null,I=null,D=null,k=null,F=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),U=null,B={},z=new i,G=new i,V={};return V[t.TEXTURE_2D]=n(t.TEXTURE_2D,t.TEXTURE_2D,1),V[t.TEXTURE_CUBE_MAP]=n(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:m,depth:v,stencil:g},init:function(){p(0,0,0,1),f(1),d(0),o(t.DEPTH_TEST),c(3),u(!1),h(1),o(t.CULL_FACE),o(t.BLEND),s(1)},initAttributes:function(){for(var t=0,e=b.length;t<e;t++)b[t]=0},enableAttribute:function(r){b[r]=1,0===_[r]&&(t.enableVertexAttribArray(r),_[r]=1),0!==x[r]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),x[r]=0)},enableAttributeAndDivisor:function(e,r,n){b[e]=1,0===_[e]&&(t.enableVertexAttribArray(e),_[e]=1),x[e]!==r&&(n.vertexAttribDivisorANGLE(e,r),x[e]=r)},disableUnusedAttributes:function(){for(var e=0,r=_.length;e!==r;++e)_[e]!==b[e]&&(t.disableVertexAttribArray(e),_[e]=0)},enable:o,disable:a,getCompressedTextureFormats:function(){if(null===S&&(S=[],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++)S.push(r[n]);return S},setBlending:s,setColorWrite:function(t){m.setMask(t)},setDepthTest:function(t){v.setTest(t)},setDepthWrite:function(t){v.setMask(t)},setDepthFunc:c,setStencilTest:function(t){g.setTest(t)},setStencilWrite:function(t){g.setMask(t)},setStencilFunc:function(t,e,r){g.setFunc(t,e,r)},setStencilOp:function(t,e,r){g.setOp(t,e,r)},setFlipSided:u,setCullFace:h,setLineWidth:function(e){e!==N&&(t.lineWidth(e),N=e)},setPolygonOffset:function(e,r,n){e?(o(t.POLYGON_OFFSET_FILL),(I!==r||D!==n)&&(t.polygonOffset(r,n),I=r,D=n)):a(t.POLYGON_OFFSET_FILL)},getScissorTest:function(){return k},setScissorTest:function(e){(k=e)?o(t.SCISSOR_TEST):a(t.SCISSOR_TEST)},activeTexture:l,bindTexture:function(e,r){null===U&&l();var n=B[U];void 0===n&&(n={type:void 0,texture:void 0},B[U]=n),n.type===e&&n.texture===r||(t.bindTexture(e,r||V[e]),n.type=e,n.texture=r)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments);
-}catch(t){console.error(t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}},clearColor:p,clearDepth:f,clearStencil:d,scissor:function(e){!1===z.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),z.copy(e))},viewport:function(e){!1===G.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),G.copy(e))},reset:function(){for(var e=0;e<_.length;e++)1===_[e]&&(t.disableVertexAttribArray(e),_[e]=0);w={},U=S=null,B={},L=R=M=null,m.reset(),v.reset(),g.reset()}}}function $t(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",a=n(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a),r=!0===r.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth");var a=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),s=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<s,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:a,maxVertexTextures:s,maxTextureSize:c,maxCubemapSize:u,maxAttributes:h,maxVertexUniforms:l,maxVaryings:p,maxFragmentUniforms:f,vertexTextures:d,floatFragmentTextures:m,floatVertexTextures:d&&m}}function Ht(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 Wt(){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,a=null;if(0!==o){if(a=u.value,!0!==i||null===a)for(i=n+4*o,e=e.matrixWorldInverse,c.getNormalMatrix(e),(null===a||a.length<i)&&(a=new Float32Array(i)),i=0;i!==o;++i,n+=4)s.copy(t[i]).applyMatrix4(e,c),s.normal.toArray(a,n),a[n+3]=s.constant;u.value=a,u.needsUpdate=!0}return r.numPlanes=o,a}var r=this,n=null,i=0,o=!1,a=!1,s=new J,c=new Z,u={value:null,needsUpdate:!1};this.uniform=u,this.numIntersection=this.numPlanes=0,this.init=function(t,r,a){var s=0!==t.length||r||0!==i||o;return o=r,n=e(t,a,0),i=t.length,s},this.beginShadows=function(){a=!0,e(null)},this.endShadows=function(){a=!1,t()},this.setState=function(r,s,c,h,l,p){if(!o||null===r||0===r.length||a&&!c)a?e(null):t();else{c=a?0:i;var f=4*c,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=s?this.numPlanes:0,this.numPlanes+=c}}}function qt(t){function e(t,e,r,n){!0===C&&(t*=n,e*=n,r*=n),Rt.clearColor(t,e,r,n)}function r(){Rt.init(),Rt.scissor(Y.copy(st).multiplyScalar(at)),Rt.viewport(J.copy(ht).multiplyScalar(at)),e(rt.r,rt.g,rt.b,nt)}function n(){X=F=null,W="",V=-1,Rt.reset()}function o(t){t.preventDefault(),n(),r(),Lt.clear()}function a(t){t=t.target,t.removeEventListener("dispose",a),s(t),Lt.delete(t)}function s(t){var e=Lt.get(t).program;t.program=void 0,void 0!==e&&Dt.releaseProgram(e)}function h(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.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 p(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function f(t,e,r,n,i){var o;r.transparent?(n=R,o=++L):(n=A,o=++j),o=n[o],void 0!==o?(o.id=t.id,o.object=t,o.geometry=e,o.material=r,o.z=Tt.z,o.group=i):(o={id:t.id,object:t,geometry:e,material:r,z:Tt.z,group:i},n.push(o))}function d(t){if(!lt.intersectsSphere(t))return!1;var e=pt.numPlanes;if(0===e)return!0;var r=k.clippingPlanes,n=t.center;t=-t.radius;var i=0;do if(r[i].distanceToPoint(n)<t)return!1;while(++i!==e);return!0}function m(t,e){if(!1!==t.visible){if(0!==(t.layers.mask&e.layers.mask))if(t.isLight)P.push(t);else if(t.isSprite){var r;(r=!1===t.frustumCulled)||(bt.center.set(0,0,0),bt.radius=.7071067811865476,bt.applyMatrix4(t.matrixWorld),r=!0===d(bt)),r&&I.push(t)}else if(t.isLensFlare)D.push(t);else if(t.isImmediateRenderObject)!0===k.sortObjects&&(Tt.setFromMatrixPosition(t.matrixWorld),Tt.applyProjection(Et)),f(t,null,t.material,Tt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),(r=!1===t.frustumCulled)||(r=t.geometry,null===r.boundingSphere&&r.computeBoundingSphere(),bt.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),r=!0===d(bt)),r)){var n=t.material;if(!0===n.visible)if(!0===k.sortObjects&&(Tt.setFromMatrixPosition(t.matrixWorld),Tt.applyProjection(Et)),r=It.update(t),n.isMultiMaterial)for(var i=r.groups,o=n.materials,n=0,a=i.length;n<a;n++){var s=i[n],c=o[s.materialIndex];!0===c.visible&&f(t,r,c,Tt.z,s)}else f(t,r,n,Tt.z,null)}for(r=t.children,n=0,a=r.length;n<a;n++)m(r[n],e)}}function v(t,e,r,n){for(var i=0,o=t.length;i<o;i++){var a=t[i],s=a.object,c=a.geometry,u=void 0===n?a.material:n,a=a.group;if(s.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.onBeforeRender(k,e,r,c,u,a),s.isImmediateRenderObject){g(u);var h=y(r,e.fog,u,s);W="",s.render(function(t){k.renderBufferImmediate(t,h,u)})}else k.renderBufferDirect(r,e.fog,c,u,s,a);s.onAfterRender(k,e,r,c,u,a)}}function g(t){2===t.side?Rt.disable(Pt.CULL_FACE):Rt.enable(Pt.CULL_FACE),Rt.setFlipSided(1===t.side),!0===t.transparent?Rt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Rt.setBlending(0),Rt.setDepthFunc(t.depthFunc),Rt.setDepthTest(t.depthTest),Rt.setDepthWrite(t.depthWrite),Rt.setColorWrite(t.colorWrite),Rt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function y(t,e,r,n){et=0;var i=Lt.get(r);if(ft&&(dt||t!==X)&&pt.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,t,i,t===X&&r.id===V),!1===r.needsUpdate&&(void 0===i.program?r.needsUpdate=!0:r.fog&&i.fog!==e?r.needsUpdate=!0:r.lights&&i.lightsHash!==Ct.hash?r.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===pt.numPlanes&&i.numIntersection===pt.numIntersection||(r.needsUpdate=!0)),r.needsUpdate){t:{var o=Lt.get(r),c=Dt.getParameters(r,Ct,e,pt.numPlanes,pt.numIntersection,n),u=Dt.getProgramCode(r,c),h=o.program,l=!0;if(void 0===h)r.addEventListener("dispose",a);else if(h.code!==u)s(r);else{if(void 0!==c.shaderID)break t;l=!1}if(l&&(c.shaderID?(h=ni[c.shaderID],o.__webglShader={name:r.type,uniforms:Qn.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}):o.__webglShader={name:r.type,uniforms:r.uniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader},r.__webglShader=o.__webglShader,h=Dt.acquireProgram(r,c,u),o.program=h,r.program=h),c=h.getAttributes(),r.morphTargets)for(u=r.numSupportedMorphTargets=0;u<k.maxMorphTargets;u++)0<=c["morphTarget"+u]&&r.numSupportedMorphTargets++;if(r.morphNormals)for(u=r.numSupportedMorphNormals=0;u<k.maxMorphNormals;u++)0<=c["morphNormal"+u]&&r.numSupportedMorphNormals++;c=o.__webglShader.uniforms,(r.isShaderMaterial||r.isRawShaderMaterial)&&!0!==r.clipping||(o.numClippingPlanes=pt.numPlanes,o.numIntersection=pt.numIntersection,c.clippingPlanes=pt.uniform),o.fog=e,o.lightsHash=Ct.hash,r.lights&&(c.ambientLightColor.value=Ct.ambient,c.directionalLights.value=Ct.directional,c.spotLights.value=Ct.spot,c.pointLights.value=Ct.point,c.hemisphereLights.value=Ct.hemi,c.directionalShadowMap.value=Ct.directionalShadowMap,c.directionalShadowMatrix.value=Ct.directionalShadowMatrix,c.spotShadowMap.value=Ct.spotShadowMap,c.spotShadowMatrix.value=Ct.spotShadowMatrix,c.pointShadowMap.value=Ct.pointShadowMap,c.pointShadowMatrix.value=Ct.pointShadowMatrix),u=o.program.getUniforms(),c=z.seqWithValue(u.seq,c),o.uniformsList=c}r.needsUpdate=!1}var p=!1,l=h=!1,o=i.program,c=o.getUniforms(),u=i.__webglShader.uniforms;if(o.id!==F&&(Pt.useProgram(o.program),F=o.id,l=h=p=!0),r.id!==V&&(V=r.id,h=!0),(p||t!==X)&&(c.set(Pt,t,"projectionMatrix"),jt.logarithmicDepthBuffer&&c.setValue(Pt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==X&&(X=t,l=h=!0),(r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.envMap)&&(p=c.map.cameraPosition,void 0!==p&&p.setValue(Pt,Tt.setFromMatrixPosition(t.matrixWorld))),(r.isMeshPhongMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&c.setValue(Pt,"viewMatrix",t.matrixWorldInverse),c.set(Pt,k,"toneMappingExposure"),c.set(Pt,k,"toneMappingWhitePoint")),r.skinning&&(c.setOptional(Pt,n,"bindMatrix"),c.setOptional(Pt,n,"bindMatrixInverse"),t=n.skeleton)&&(jt.floatVertexTextures&&t.useVertexTexture?(c.set(Pt,t,"boneTexture"),c.set(Pt,t,"boneTextureWidth"),c.set(Pt,t,"boneTextureHeight")):c.setOptional(Pt,t,"boneMatrices")),h){if(r.lights&&(t=l,u.ambientLightColor.needsUpdate=t,u.directionalLights.needsUpdate=t,u.pointLights.needsUpdate=t,u.spotLights.needsUpdate=t,u.hemisphereLights.needsUpdate=t),e&&r.fog&&(u.fogColor.value=e.color,e.isFog?(u.fogNear.value=e.near,u.fogFar.value=e.far):e.isFogExp2&&(u.fogDensity.value=e.density)),r.isMeshBasicMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshDepthMaterial){u.opacity.value=r.opacity,u.diffuse.value=r.color,r.emissive&&u.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),u.map.value=r.map,u.specularMap.value=r.specularMap,u.alphaMap.value=r.alphaMap,r.aoMap&&(u.aoMap.value=r.aoMap,u.aoMapIntensity.value=r.aoMapIntensity);var f;r.map?f=r.map:r.specularMap?f=r.specularMap:r.displacementMap?f=r.displacementMap:r.normalMap?f=r.normalMap:r.bumpMap?f=r.bumpMap:r.roughnessMap?f=r.roughnessMap:r.metalnessMap?f=r.metalnessMap:r.alphaMap?f=r.alphaMap:r.emissiveMap&&(f=r.emissiveMap),void 0!==f&&(f.isWebGLRenderTarget&&(f=f.texture),e=f.offset,f=f.repeat,u.offsetRepeat.value.set(e.x,e.y,f.x,f.y)),u.envMap.value=r.envMap,u.flipEnvMap.value=r.envMap&&r.envMap.isCubeTexture?-1:1,u.reflectivity.value=r.reflectivity,u.refractionRatio.value=r.refractionRatio}r.isLineBasicMaterial?(u.diffuse.value=r.color,u.opacity.value=r.opacity):r.isLineDashedMaterial?(u.diffuse.value=r.color,u.opacity.value=r.opacity,u.dashSize.value=r.dashSize,u.totalSize.value=r.dashSize+r.gapSize,u.scale.value=r.scale):r.isPointsMaterial?(u.diffuse.value=r.color,u.opacity.value=r.opacity,u.size.value=r.size*at,u.scale.value=.5*ot,u.map.value=r.map,null!==r.map&&(f=r.map.offset,r=r.map.repeat,u.offsetRepeat.value.set(f.x,f.y,r.x,r.y))):r.isMeshLambertMaterial?(r.lightMap&&(u.lightMap.value=r.lightMap,u.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(u.emissiveMap.value=r.emissiveMap)):r.isMeshPhongMaterial?(u.specular.value=r.specular,u.shininess.value=Math.max(r.shininess,1e-4),r.lightMap&&(u.lightMap.value=r.lightMap,u.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(u.emissiveMap.value=r.emissiveMap),r.bumpMap&&(u.bumpMap.value=r.bumpMap,u.bumpScale.value=r.bumpScale),r.normalMap&&(u.normalMap.value=r.normalMap,u.normalScale.value.copy(r.normalScale)),r.displacementMap&&(u.displacementMap.value=r.displacementMap,u.displacementScale.value=r.displacementScale,u.displacementBias.value=r.displacementBias)):r.isMeshPhysicalMaterial?(u.clearCoat.value=r.clearCoat,u.clearCoatRoughness.value=r.clearCoatRoughness,b(u,r)):r.isMeshStandardMaterial?b(u,r):r.isMeshDepthMaterial?r.displacementMap&&(u.displacementMap.value=r.displacementMap,u.displacementScale.value=r.displacementScale,u.displacementBias.value=r.displacementBias):r.isMeshNormalMaterial&&(u.opacity.value=r.opacity),z.upload(Pt,i.uniformsList,u,k)}return c.set(Pt,n,"modelViewMatrix"),c.set(Pt,n,"normalMatrix"),c.setValue(Pt,"modelMatrix",n.matrixWorld),o}function b(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.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),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 _(t){var e;if(1e3===t)return Pt.REPEAT;if(1001===t)return Pt.CLAMP_TO_EDGE;if(1002===t)return Pt.MIRRORED_REPEAT;if(1003===t)return Pt.NEAREST;if(1004===t)return Pt.NEAREST_MIPMAP_NEAREST;if(1005===t)return Pt.NEAREST_MIPMAP_LINEAR;if(1006===t)return Pt.LINEAR;if(1007===t)return Pt.LINEAR_MIPMAP_NEAREST;if(1008===t)return Pt.LINEAR_MIPMAP_LINEAR;if(1009===t)return Pt.UNSIGNED_BYTE;if(1017===t)return Pt.UNSIGNED_SHORT_4_4_4_4;if(1018===t)return Pt.UNSIGNED_SHORT_5_5_5_1;if(1019===t)return Pt.UNSIGNED_SHORT_5_6_5;if(1010===t)return Pt.BYTE;if(1011===t)return Pt.SHORT;if(1012===t)return Pt.UNSIGNED_SHORT;if(1013===t)return Pt.INT;if(1014===t)return Pt.UNSIGNED_INT;if(1015===t)return Pt.FLOAT;if(1016===t&&(e=At.get("OES_texture_half_float"),null!==e))return e.HALF_FLOAT_OES;if(1021===t)return Pt.ALPHA;if(1022===t)return Pt.RGB;if(1023===t)return Pt.RGBA;if(1024===t)return Pt.LUMINANCE;if(1025===t)return Pt.LUMINANCE_ALPHA;if(1026===t)return Pt.DEPTH_COMPONENT;if(1027===t)return Pt.DEPTH_STENCIL;if(100===t)return Pt.FUNC_ADD;if(101===t)return Pt.FUNC_SUBTRACT;if(102===t)return Pt.FUNC_REVERSE_SUBTRACT;if(200===t)return Pt.ZERO;if(201===t)return Pt.ONE;if(202===t)return Pt.SRC_COLOR;if(203===t)return Pt.ONE_MINUS_SRC_COLOR;if(204===t)return Pt.SRC_ALPHA;if(205===t)return Pt.ONE_MINUS_SRC_ALPHA;if(206===t)return Pt.DST_ALPHA;if(207===t)return Pt.ONE_MINUS_DST_ALPHA;if(208===t)return Pt.DST_COLOR;if(209===t)return Pt.ONE_MINUS_DST_COLOR;if(210===t)return Pt.SRC_ALPHA_SATURATE;if((2001===t||2002===t||2003===t||2004===t)&&(e=At.get("WEBGL_compressed_texture_s3tc"),null!==e)){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)&&(e=At.get("WEBGL_compressed_texture_pvrtc"),null!==e)){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&&(e=At.get("WEBGL_compressed_texture_etc1"),null!==e))return e.COMPRESSED_RGB_ETC1_WEBGL;if((103===t||104===t)&&(e=At.get("EXT_blend_minmax"),null!==e)){if(103===t)return e.MIN_EXT;if(104===t)return e.MAX_EXT}return 1020===t&&(e=At.get("WEBGL_depth_texture"),null!==e)?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer","82"),t=t||{};var x=void 0!==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=[],j=-1,R=[],L=-1,N=new Float32Array(8),I=[],D=[];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 k=this,F=null,U=null,B=null,V=-1,W="",X=null,Y=new i,Z=null,J=new i,et=0,rt=new G(0),nt=0,it=x.width,ot=x.height,at=1,st=new i(0,0,it,ot),ut=!1,ht=new i(0,0,it,ot),lt=new Q,pt=new Wt,ft=!1,dt=!1,bt=new K,Et=new u,Tt=new c,Ct={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ot={calls:0,vertices:0,faces:0,points:0};this.info={render:Ot,memory:{geometries:0,textures:0},programs:null};var Pt;try{if(S={alpha:S,depth:M,stencil:E,antialias:T,premultipliedAlpha:C,preserveDrawingBuffer:O},Pt=w||x.getContext("webgl",S)||x.getContext("experimental-webgl",S),null===Pt){if(null!==x.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}void 0===Pt.getShaderPrecisionFormat&&(Pt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),x.addEventListener("webglcontextlost",o,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var At=new Ht(Pt);At.get("WEBGL_depth_texture"),At.get("OES_texture_float"),At.get("OES_texture_float_linear"),At.get("OES_texture_half_float"),At.get("OES_texture_half_float_linear"),At.get("OES_standard_derivatives"),At.get("ANGLE_instanced_arrays"),At.get("OES_element_index_uint")&&(mt.MaxIndex=4294967296);var jt=new $t(Pt,At,t),Rt=new Vt(Pt,At,_),Lt=new Gt,Nt=new zt(Pt,At,Rt,Lt,jt,_,this.info),It=new Bt(Pt,Lt,this.info),Dt=new Ft(this,jt),kt=new Mt;this.info.programs=Dt.programs;var Ut=new St(Pt,At,Ot),qt=new wt(Pt,At,Ot),Xt=new xt(-1,1,1,-1,0,1),Yt=new _t,Kt=new vt(new yt(2,2),new ct({depthTest:!1,depthWrite:!1,fog:!1}));t=ni.cube;var Zt=new vt(new gt(5,5,5),new q({uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}));r(),this.context=Pt,this.capabilities=jt,this.extensions=At,this.properties=Lt,this.state=Rt;var Jt=new tt(this,Ct,It,jt);this.shadowMap=Jt;var Qt=new H(this,I),te=new $(this,D);this.getContext=function(){return Pt},this.getContextAttributes=function(){return Pt.getContextAttributes()},this.forceContextLoss=function(){At.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return jt.getMaxAnisotropy()},this.getPrecision=function(){return jt.precision},this.getPixelRatio=function(){return at},this.setPixelRatio=function(t){void 0!==t&&(at=t,this.setSize(ht.z,ht.w,!1))},this.getSize=function(){return{width:it,height:ot}},this.setSize=function(t,e,r){it=t,ot=e,x.width=t*at,x.height=e*at,!1!==r&&(x.style.width=t+"px",x.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,n){Rt.viewport(ht.set(t,e,r,n))},this.setScissor=function(t,e,r,n){Rt.scissor(st.set(t,e,r,n))},this.setScissorTest=function(t){Rt.setScissorTest(ut=t)},this.getClearColor=function(){return rt},this.setClearColor=function(t,r){rt.set(t),nt=void 0!==r?r:1,e(rt.r,rt.g,rt.b,nt)},this.getClearAlpha=function(){return nt},this.setClearAlpha=function(t){nt=t,e(rt.r,rt.g,rt.b,nt)},this.clear=function(t,e,r){var n=0;(void 0===t||t)&&(n|=Pt.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Pt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(n|=Pt.STENCIL_BUFFER_BIT),Pt.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=n,this.dispose=function(){R=[],L=-1,A=[],j=-1,x.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,r){Rt.initAttributes();var n=Lt.get(t);if(t.hasPositions&&!n.position&&(n.position=Pt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Pt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Pt.createBuffer()),t.hasColors&&!n.color&&(n.color=Pt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(Pt.bindBuffer(Pt.ARRAY_BUFFER,n.position),Pt.bufferData(Pt.ARRAY_BUFFER,t.positionArray,Pt.DYNAMIC_DRAW),Rt.enableAttribute(e.position),Pt.vertexAttribPointer(e.position,3,Pt.FLOAT,!1,0,0)),t.hasNormals){if(Pt.bindBuffer(Pt.ARRAY_BUFFER,n.normal),!r.isMeshPhongMaterial&&!r.isMeshStandardMaterial&&1===r.shading)for(var i=0,o=3*t.count;i<o;i+=9){var a=t.normalArray,s=(a[i+0]+a[i+3]+a[i+6])/3,c=(a[i+1]+a[i+4]+a[i+7])/3,u=(a[i+2]+a[i+5]+a[i+8])/3;a[i+0]=s,a[i+1]=c,a[i+2]=u,a[i+3]=s,a[i+4]=c,a[i+5]=u,a[i+6]=s,a[i+7]=c,a[i+8]=u}Pt.bufferData(Pt.ARRAY_BUFFER,t.normalArray,Pt.DYNAMIC_DRAW),Rt.enableAttribute(e.normal),Pt.vertexAttribPointer(e.normal,3,Pt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(Pt.bindBuffer(Pt.ARRAY_BUFFER,n.uv),Pt.bufferData(Pt.ARRAY_BUFFER,t.uvArray,Pt.DYNAMIC_DRAW),Rt.enableAttribute(e.uv),Pt.vertexAttribPointer(e.uv,2,Pt.FLOAT,!1,0,0)),t.hasColors&&0!==r.vertexColors&&(Pt.bindBuffer(Pt.ARRAY_BUFFER,n.color),Pt.bufferData(Pt.ARRAY_BUFFER,t.colorArray,Pt.DYNAMIC_DRAW),Rt.enableAttribute(e.color),Pt.vertexAttribPointer(e.color,3,Pt.FLOAT,!1,0,0)),Rt.disableUnusedAttributes(),Pt.drawArrays(Pt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,n,i,o){g(n);var a=y(t,e,n,i),s=!1;if(t=r.id+"_"+a.id+"_"+n.wireframe,t!==W&&(W=t,s=!0),e=i.morphTargetInfluences,void 0!==e){var c=[];t=0;for(var u=e.length;t<u;t++)s=e[t],c.push([s,t]);c.sort(h),8<c.length&&(c.length=8);var l=r.morphAttributes;for(t=0,u=c.length;t<u;t++)s=c[t],N[t]=s[0],0!==s[0]?(e=s[1],!0===n.morphTargets&&l.position&&r.addAttribute("morphTarget"+t,l.position[e]),!0===n.morphNormals&&l.normal&&r.addAttribute("morphNormal"+t,l.normal[e])):(!0===n.morphTargets&&r.removeAttribute("morphTarget"+t),!0===n.morphNormals&&r.removeAttribute("morphNormal"+t));for(t=c.length,e=N.length;t<e;t++)N[t]=0;a.getUniforms().setValue(Pt,"morphTargetInfluences",N),s=!0}if(e=r.index,u=r.attributes.position,c=1,!0===n.wireframe&&(e=It.getWireframeAttribute(r),c=2),null!==e?(t=qt,t.setIndex(e)):t=Ut,s){var p,s=void 0;if(r&&r.isInstancedBufferGeometry&&(p=At.get("ANGLE_instanced_arrays"),null===p))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===s&&(s=0),Rt.initAttributes();var f,l=r.attributes,a=a.getAttributes(),d=n.defaultAttributeValues;for(f in a){var m=a[f];if(0<=m){var v=l[f];if(void 0!==v){var b=Pt.FLOAT,_=v.array,x=v.normalized;_ instanceof Float32Array?b=Pt.FLOAT:_ instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):_ instanceof Uint16Array?b=Pt.UNSIGNED_SHORT:_ instanceof Int16Array?b=Pt.SHORT:_ instanceof Uint32Array?b=Pt.UNSIGNED_INT:_ instanceof Int32Array?b=Pt.INT:_ instanceof Int8Array?b=Pt.BYTE:_ instanceof Uint8Array&&(b=Pt.UNSIGNED_BYTE);var _=v.itemSize,w=It.getAttributeBuffer(v);if(v.isInterleavedBufferAttribute){var S=v.data,M=S.stride,v=v.offset;S&&S.isInstancedInterleavedBuffer?(Rt.enableAttributeAndDivisor(m,S.meshPerAttribute,p),void 0===r.maxInstancedCount&&(r.maxInstancedCount=S.meshPerAttribute*S.count)):Rt.enableAttribute(m),Pt.bindBuffer(Pt.ARRAY_BUFFER,w),Pt.vertexAttribPointer(m,_,b,x,M*S.array.BYTES_PER_ELEMENT,(s*M+v)*S.array.BYTES_PER_ELEMENT)}else v.isInstancedBufferAttribute?(Rt.enableAttributeAndDivisor(m,v.meshPerAttribute,p),void 0===r.maxInstancedCount&&(r.maxInstancedCount=v.meshPerAttribute*v.count)):Rt.enableAttribute(m),Pt.bindBuffer(Pt.ARRAY_BUFFER,w),Pt.vertexAttribPointer(m,_,b,x,0,s*_*v.array.BYTES_PER_ELEMENT)}else if(void 0!==d&&(b=d[f],void 0!==b))switch(b.length){case 2:Pt.vertexAttrib2fv(m,b);break;case 3:Pt.vertexAttrib3fv(m,b);break;case 4:Pt.vertexAttrib4fv(m,b);break;default:Pt.vertexAttrib1fv(m,b)}}}Rt.disableUnusedAttributes()}null!==e&&Pt.bindBuffer(Pt.ELEMENT_ARRAY_BUFFER,It.getAttributeBuffer(e))}if(p=0,null!==e?p=e.count:void 0!==u&&(p=u.count),e=r.drawRange.start*c,u=null!==o?o.start*c:0,f=Math.max(e,u),o=Math.max(0,Math.min(p,e+r.drawRange.count*c,u+(null!==o?o.count*c:1/0))-1-f+1),0!==o){if(i.isMesh)if(!0===n.wireframe)Rt.setLineWidth(n.wireframeLinewidth*(null===U?at:1)),t.setMode(Pt.LINES);else switch(i.drawMode){case 0:t.setMode(Pt.TRIANGLES);break;case 1:t.setMode(Pt.TRIANGLE_STRIP);break;case 2:t.setMode(Pt.TRIANGLE_FAN)}else i.isLine?(n=n.linewidth,void 0===n&&(n=1),Rt.setLineWidth(n*(null===U?at:1)),i.isLineSegments?t.setMode(Pt.LINES):t.setMode(Pt.LINE_STRIP)):i.isPoints&&t.setMode(Pt.POINTS);r&&r.isInstancedBufferGeometry?0<r.maxInstancedCount&&t.renderInstances(r,f,o):t.render(f,o)}},this.render=function(t,r,n,i){if(void 0!==r&&!0!==r.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{W="",V=-1,X=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===r.parent&&r.updateMatrixWorld(),r.matrixWorldInverse.getInverse(r.matrixWorld),Et.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),lt.setFromMatrix(Et),P.length=0,L=j=-1,I.length=0,D.length=0,dt=this.localClippingEnabled,ft=pt.init(this.clippingPlanes,dt,r),m(t,r),A.length=j+1,R.length=L+1,!0===k.sortObjects&&(A.sort(l),R.sort(p)),ft&&pt.beginShadows();for(var o=P,a=0,s=0,c=o.length;s<c;s++){var h=o[s];h.castShadow&&(Ct.shadows[a++]=h)}Ct.shadows.length=a,Jt.render(t,r);for(var f,d,g,y,o=P,b=h=0,_=0,x=r.matrixWorldInverse,w=0,S=0,M=0,E=0,a=0,s=o.length;a<s;a++)if(c=o[a],f=c.color,d=c.intensity,g=c.distance,y=c.shadow&&c.shadow.map?c.shadow.map.texture:null,c.isAmbientLight)h+=f.r*d,b+=f.g*d,_+=f.b*d;else if(c.isDirectionalLight){var T=kt.get(c);T.color.copy(c.color).multiplyScalar(c.intensity),T.direction.setFromMatrixPosition(c.matrixWorld),Tt.setFromMatrixPosition(c.target.matrixWorld),T.direction.sub(Tt),T.direction.transformDirection(x),(T.shadow=c.castShadow)&&(T.shadowBias=c.shadow.bias,T.shadowRadius=c.shadow.radius,T.shadowMapSize=c.shadow.mapSize),Ct.directionalShadowMap[w]=y,Ct.directionalShadowMatrix[w]=c.shadow.matrix,Ct.directional[w++]=T}else c.isSpotLight?(T=kt.get(c),T.position.setFromMatrixPosition(c.matrixWorld),T.position.applyMatrix4(x),T.color.copy(f).multiplyScalar(d),T.distance=g,T.direction.setFromMatrixPosition(c.matrixWorld),Tt.setFromMatrixPosition(c.target.matrixWorld),T.direction.sub(Tt),T.direction.transformDirection(x),T.coneCos=Math.cos(c.angle),T.penumbraCos=Math.cos(c.angle*(1-c.penumbra)),T.decay=0===c.distance?0:c.decay,(T.shadow=c.castShadow)&&(T.shadowBias=c.shadow.bias,T.shadowRadius=c.shadow.radius,T.shadowMapSize=c.shadow.mapSize),Ct.spotShadowMap[M]=y,Ct.spotShadowMatrix[M]=c.shadow.matrix,Ct.spot[M++]=T):c.isPointLight?(T=kt.get(c),T.position.setFromMatrixPosition(c.matrixWorld),T.position.applyMatrix4(x),T.color.copy(c.color).multiplyScalar(c.intensity),T.distance=c.distance,T.decay=0===c.distance?0:c.decay,(T.shadow=c.castShadow)&&(T.shadowBias=c.shadow.bias,T.shadowRadius=c.shadow.radius,T.shadowMapSize=c.shadow.mapSize),Ct.pointShadowMap[S]=y,void 0===Ct.pointShadowMatrix[S]&&(Ct.pointShadowMatrix[S]=new u),Tt.setFromMatrixPosition(c.matrixWorld).negate(),Ct.pointShadowMatrix[S].identity().setPosition(Tt),Ct.point[S++]=T):c.isHemisphereLight&&(T=kt.get(c),T.direction.setFromMatrixPosition(c.matrixWorld),T.direction.transformDirection(x),T.direction.normalize(),T.skyColor.copy(c.color).multiplyScalar(d),T.groundColor.copy(c.groundColor).multiplyScalar(d),Ct.hemi[E++]=T);Ct.ambient[0]=h,Ct.ambient[1]=b,Ct.ambient[2]=_,Ct.directional.length=w,Ct.spot.length=M,Ct.point.length=S,Ct.hemi.length=E,Ct.hash=w+","+S+","+M+","+E+","+Ct.shadows.length,ft&&pt.endShadows(),Ot.calls=0,Ot.vertices=0,Ot.faces=0,Ot.points=0,void 0===n&&(n=null),this.setRenderTarget(n),o=t.background,null===o?e(rt.r,rt.g,rt.b,nt):o&&o.isColor&&(e(o.r,o.g,o.b,1),i=!0),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),o&&o.isCubeTexture?(Yt.projectionMatrix.copy(r.projectionMatrix),Yt.matrixWorld.extractRotation(r.matrixWorld),Yt.matrixWorldInverse.getInverse(Yt.matrixWorld),Zt.material.uniforms.tCube.value=o,Zt.modelViewMatrix.multiplyMatrices(Yt.matrixWorldInverse,Zt.matrixWorld),It.update(Zt),k.renderBufferDirect(Yt,null,Zt.geometry,Zt.material,Zt,null)):o&&o.isTexture&&(Kt.material.map=o,It.update(Kt),k.renderBufferDirect(Xt,null,Kt.geometry,Kt.material,Kt,null)),t.overrideMaterial?(i=t.overrideMaterial,v(A,t,r,i),v(R,t,r,i)):(Rt.setBlending(0),v(A,t,r),v(R,t,r)),Qt.render(t,r),te.render(t,r,J),n&&Nt.updateRenderTargetMipmap(n),Rt.setDepthTest(!0),Rt.setDepthWrite(!0),Rt.setColorWrite(!0)}},this.setFaceCulling=function(t,e){Rt.setCullFace(t),Rt.setFlipSided(0===e)},this.allocTextureUnit=function(){var t=et;return t>=jt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+jt.maxTextures),et+=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),Nt.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),Nt.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?Nt.setTextureCube(e,r):Nt.setTextureCubeDynamic(e,r)}}(),this.getCurrentRenderTarget=function(){return U},this.setRenderTarget=function(t){(U=t)&&void 0===Lt.get(t).__webglFramebuffer&&Nt.setupRenderTarget(t);var e,r=t&&t.isWebGLRenderTargetCube;t?(e=Lt.get(t),e=r?e.__webglFramebuffer[t.activeCubeFace]:e.__webglFramebuffer,Y.copy(t.scissor),Z=t.scissorTest,J.copy(t.viewport)):(e=null,Y.copy(st).multiplyScalar(at),Z=ut,J.copy(ht).multiplyScalar(at)),B!==e&&(Pt.bindFramebuffer(Pt.FRAMEBUFFER,e),B=e),Rt.scissor(Y),Rt.setScissorTest(Z),Rt.viewport(J),r&&(r=Lt.get(t.texture),Pt.framebufferTexture2D(Pt.FRAMEBUFFER,Pt.COLOR_ATTACHMENT0,Pt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel))},this.readRenderTargetPixels=function(t,e,r,n,i,o){if(!1===(t&&t.isWebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=Lt.get(t).__webglFramebuffer;if(a){var s=!1;a!==B&&(Pt.bindFramebuffer(Pt.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,h=c.type;1023!==u&&_(u)!==Pt.getParameter(Pt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||_(h)===Pt.getParameter(Pt.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(At.get("OES_texture_float")||At.get("WEBGL_color_buffer_float"))||1016===h&&At.get("EXT_color_buffer_half_float")?Pt.checkFramebufferStatus(Pt.FRAMEBUFFER)===Pt.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=r&&r<=t.height-i&&Pt.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{s&&Pt.bindFramebuffer(Pt.FRAMEBUFFER,B)}}}}}function Xt(t,e){this.name="",this.color=new G(t),this.density=void 0!==e?e:25e-5}function Yt(t,e,r){this.name="",this.color=new G(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3}function Kt(){it.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function Zt(t,e,r,n,i){it.call(this),this.lensFlares=[],this.positionScreen=new c,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,n,i)}function Jt(t){W.call(this),this.type="SpriteMaterial",this.color=new G(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(t)}function Qt(t){it.call(this),this.type="Sprite",this.material=void 0!==t?t:new Jt}function te(){it.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ee(t,e,r,i,o,a,s,c,u,h,l,p){n.call(this,null,a,s,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 re(t,e,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new u,t=t||[],this.bones=t.slice(0),this.useVertexTexture?(t=Math.sqrt(4*this.bones.length),t=Wn.nextPowerOfTwo(Math.ceil(t)),this.boneTextureHeight=this.boneTextureWidth=t=Math.max(t,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new ee(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,1023,1015)):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 for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new u)}function ne(t){it.call(this),this.type="Bone",this.skin=t}function ie(t,e,r){if(vt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new u,this.bindMatrixInverse=new u,t=[],this.geometry&&void 0!==this.geometry.bones){for(var n,i=0,o=this.geometry.bones.length;i<o;++i)n=this.geometry.bones[i],e=new ne(this),t.push(e),e.name=n.name,e.position.fromArray(n.pos),e.quaternion.fromArray(n.rotq),void 0!==n.scl&&e.scale.fromArray(n.scl);for(i=0,o=this.geometry.bones.length;i<o;++i)n=this.geometry.bones[i],-1!==n.parent&&null!==n.parent&&void 0!==t[n.parent]?t[n.parent].add(t[i]):this.add(t[i])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new re(t,void 0,r),this.matrixWorld)}function oe(t){W.call(this),this.type="LineBasicMaterial",this.color=new G(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.lights=!1,this.setValues(t)}function ae(t,e,r){return 1===r?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new se(t,e)):(it.call(this),this.type="Line",this.geometry=void 0!==t?t:new mt,void(this.material=void 0!==e?e:new oe({color:16777215*Math.random()})))}function se(t,e){ae.call(this,t,e),this.type="LineSegments"}function ce(t){W.call(this),this.type="PointsMaterial",this.color=new G(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function ue(t,e){it.call(this),this.type="Points",this.geometry=void 0!==t?t:new mt,this.material=void 0!==e?e:new ce({color:16777215*Math.random()})}function he(){it.call(this),this.type="Group"}function le(t,e,r,i,o,a,s,c,u){function h(){requestAnimationFrame(h),t.readyState>=t.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}n.call(this,t,e,r,i,o,a,s,c,u),this.generateMipmaps=!1;var l=this;h()}function pe(t,e,r,i,o,a,s,c,u,h,l,p){n.call(this,null,a,s,c,u,h,i,o,l,p),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1}function fe(t,e,r,i,o,a,s,c,u){n.call(this,t,e,r,i,o,a,s,c,u),this.needsUpdate=!0}function de(t,e,r,i,o,a,s,c,u,h){if(h=void 0!==h?h:1026,1026!==h&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n.call(this,null,i,o,a,s,c,h,r,u),this.image={width:t,height:e},this.type=void 0!==r?r:1012,this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=this.flipY=!1}function me(t){function e(t,e){return t-e}mt.call(this);var r=[0,0],n={},i=["a","b","c"];if(t&&t.isGeometry){var o=t.vertices,a=t.faces,s=0,c=new Uint32Array(6*a.length);t=0;for(var u=a.length;t<u;t++)for(var h=a[t],l=0;3>l;l++){r[0]=h[i[l]],r[1]=h[i[(l+1)%3]],r.sort(e);var p=r.toString();void 0===n[p]&&(c[2*s]=r[0],c[2*s+1]=r[1],n[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,u=s;t<u;t++)for(l=0;2>l;l++)n=o[c[2*t+l]],s=6*t+3*l,r[s+0]=n.x,r[s+1]=n.y,r[s+2]=n.z;this.addAttribute("position",new ut(r,3))}else if(t&&t.isBufferGeometry){if(null!==t.index){for(u=t.index.array,o=t.attributes.position,i=t.groups,s=0,0===i.length&&t.addGroup(0,u.length),c=new Uint32Array(2*u.length),a=0,h=i.length;a<h;++a){t=i[a],l=t.start,p=t.count,t=l;for(var f=l+p;t<f;t+=3)for(l=0;3>l;l++)r[0]=u[t+l],r[1]=u[t+(l+1)%3],r.sort(e),p=r.toString(),void 0===n[p]&&(c[2*s]=r[0],c[2*s+1]=r[1],n[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,u=s;t<u;t++)for(l=0;2>l;l++)s=6*t+3*l,n=c[2*t+l],r[s+0]=o.getX(n),r[s+1]=o.getY(n),r[s+2]=o.getZ(n)}else for(o=t.attributes.position.array,s=o.length/3,c=s/3,r=new Float32Array(6*s),t=0,u=c;t<u;t++)for(l=0;3>l;l++)s=18*t+6*l,c=9*t+3*l,r[s+0]=o[c],r[s+1]=o[c+1],r[s+2]=o[c+2],n=9*t+(l+1)%3*3,r[s+3]=o[n],r[s+4]=o[n+1],r[s+5]=o[n+2];this.addAttribute("position",new ut(r,3))}}function ve(t,e,r){mt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:r};var n,i,o,a,s,c=[],u=[],h=e+1;for(n=0;n<=r;n++)for(s=n/r,i=0;i<=e;i++)a=i/e,o=t(a,s),c.push(o.x,o.y,o.z),u.push(a,s);t=[];var l;for(n=0;n<r;n++)for(i=0;i<e;i++)o=n*h+i,a=n*h+i+1,s=(n+1)*h+i+1,l=(n+1)*h+i,t.push(o,a,l),t.push(a,s,l);this.setIndex((65535<t.length?lt:ht)(t,1)),this.addAttribute("position",pt(c,3)),this.addAttribute("uv",pt(u,2)),this.computeVertexNormals()}function ge(t,e,r){ft.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r},this.fromBufferGeometry(new ve(t,e,r)),this.mergeVertices()}function ye(t,e,n,i){function o(t){u.push(t.x,t.y,t.z)}function a(e,r){var n=3*e;r.x=t[n+0],r.y=t[n+1],r.z=t[n+2]}function s(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)}mt.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,s=0;s<e.length;s+=3){a(e[s+0],r),a(e[s+1],n),a(e[s+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||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,a=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]),a.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);s(o,f+0,t,d),s(a,f+2,e,d),s(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",pt(u,3)),this.addAttribute("normal",pt(u.slice(),3)),this.addAttribute("uv",pt(h,2)),this.normalizeNormals(),this.boundingSphere=new K(new c,n)}function be(t,e){ye.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 _e(t,e){ft.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new be(t,e)),this.mergeVertices()}function xe(t,e){ye.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 we(t,e){ft.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new xe(t,e)),this.mergeVertices()}function Se(t,e){var r=(1+Math.sqrt(5))/2;ye.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 Me(t,e){ft.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Se(t,e)),this.mergeVertices()}function Ee(t,e){var r=(1+Math.sqrt(5))/2,n=1/r;ye.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 Te(t,e){ft.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ee(t,e)),this.mergeVertices()}function Ce(t,e,r,n){ft.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:n},this.fromBufferGeometry(new ye(t,e,r,n)),this.mergeVertices()}function Oe(t,e,n,i,o){function a(r){var o=t.getPointAt(r/e),a=s.normals[r];for(r=s.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*a.x+u*r.x,p.y=c*a.y+u*r.y,p.z=c*a.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)}}mt.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 s=t.computeFrenetFrames(e,o);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;var u,h,l=new c,p=new c,f=new r,d=[],m=[],v=[],g=[];for(u=0;u<e;u++)a(u);for(a(!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((65535<g.length?lt:ht)(g,1)),this.addAttribute("position",pt(d,3)),this.addAttribute("normal",pt(m,3)),this.addAttribute("uv",pt(v,2))}function Pe(t,e,r,n,i,o){ft.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 Oe(t,e,r,n,i),this.tangents=t.tangents,this.normals=t.normals,this.binormals=t.binormals,this.fromBufferGeometry(t),this.mergeVertices()}function Ae(t,e,n,i,o,a){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}mt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:o,q:a},t=t||100,e=e||40,n=Math.floor(n)||64,i=Math.floor(i)||8,o=o||2,a=a||3;var u,h,l=(i+1)*(n+1),p=i*n*6,p=new ut(new(65535<p?Uint32Array:Uint16Array)(p),1),f=new ut(new Float32Array(3*l),3),d=new ut(new Float32Array(3*l),3),l=new ut(new Float32Array(2*l),2),m=0,v=0,g=new c,y=new c,b=new r,_=new c,x=new c,w=new c,S=new c,M=new c;for(u=0;u<=n;++u)for(h=u/n*o*Math.PI*2,s(h,o,a,t,_),s(h+.01,o,a,t,x),S.subVectors(x,_),M.addVectors(x,_),w.crossVectors(S,M),M.crossVectors(w,S),w.normalize(),M.normalize(),h=0;h<=i;++h){var E=h/i*Math.PI*2,T=-e*Math.cos(E),E=e*Math.sin(E);g.x=_.x+(T*M.x+E*w.x),g.y=_.y+(T*M.y+E*w.y),g.z=_.z+(T*M.z+E*w.z),f.setXYZ(m,g.x,g.y,g.z),y.subVectors(g,_).normalize(),d.setXYZ(m,y.x,y.y,y.z),b.x=u/n,b.y=h/i,l.setXY(m,b.x,b.y),m++}for(h=1;h<=n;h++)for(u=1;u<=i;u++)t=(i+1)*h+(u-1),e=(i+1)*h+u,o=(i+1)*(h-1)+u,p.setX(v,(i+1)*(h-1)+(u-1)),v++,p.setX(v,t),v++,p.setX(v,o),v++,p.setX(v,t),v++,p.setX(v,e),v++,p.setX(v,o),v++;this.setIndex(p),this.addAttribute("position",f),this.addAttribute("normal",d),this.addAttribute("uv",l)}function je(t,e,r,n,i,o,a){ft.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:n,p:i,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ae(t,e,r,n,i,o)),this.mergeVertices()}function Re(t,e,r,n,i){mt.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,a,s=(r+1)*(n+1),u=r*n*6,u=new(65535<u?Uint32Array:Uint16Array)(u),h=new Float32Array(3*s),l=new Float32Array(3*s),s=new Float32Array(2*s),p=0,f=0,d=0,m=new c,v=new c,g=new c;for(o=0;o<=r;o++)for(a=0;a<=n;a++){var y=a/n*i,b=o/r*Math.PI*2;v.x=(t+e*Math.cos(b))*Math.cos(y),v.y=(t+e*Math.cos(b))*Math.sin(y),v.z=e*Math.sin(b),h[p]=v.x,h[p+1]=v.y,h[p+2]=v.z,m.x=t*Math.cos(y),m.y=t*Math.sin(y),g.subVectors(v,m).normalize(),l[p]=g.x,l[p+1]=g.y,l[p+2]=g.z,s[f]=a/n,s[f+1]=o/r,p+=3,f+=2}for(o=1;o<=r;o++)for(a=1;a<=n;a++)t=(n+1)*(o-1)+a-1,e=(n+1)*(o-1)+a,i=(n+1)*o+a,u[d]=(n+1)*o+a-1,u[d+1]=t,u[d+2]=i,u[d+3]=t,u[d+4]=e,u[d+5]=i,d+=6;this.setIndex(new ut(u,1)),this.addAttribute("position",new ut(h,3)),this.addAttribute("normal",new ut(l,3)),this.addAttribute("uv",new ut(s,2))}function Le(t,e,r,n,i){ft.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:n,arc:i},this.fromBufferGeometry(new Re(t,e,r,n,i))}function Ne(t,e){"undefined"!=typeof t&&(ft.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeFaceNormals())}function Ie(t,e){e=e||{};var r=e.font;return!1===(r&&r.isFont)?(console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new ft):(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),Ne.call(this,r,e),void(this.type="TextGeometry"))}function De(t,e,r,n,i,o,a){mt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:a},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,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;for(var s=o+a,u=(e+1)*(r+1),h=new ut(new Float32Array(3*u),3),l=new ut(new Float32Array(3*u),3),u=new ut(new Float32Array(2*u),2),p=0,f=[],d=new c,m=0;m<=r;m++){for(var v=[],g=m/r,y=0;y<=e;y++){var b=y/e,_=-t*Math.cos(n+b*i)*Math.sin(o+g*a),x=t*Math.cos(o+g*a),w=t*Math.sin(n+b*i)*Math.sin(o+g*a);d.set(_,x,w).normalize(),h.setXYZ(p,_,x,w),l.setXYZ(p,d.x,d.y,d.z),u.setXY(p,b,1-g),v.push(p),p++}f.push(v)}for(n=[],m=0;m<r;m++)for(y=0;y<e;y++)i=f[m][y+1],a=f[m][y],p=f[m+1][y],d=f[m+1][y+1],(0!==m||0<o)&&n.push(i,a,d),(m!==r-1||s<Math.PI)&&n.push(a,p,d);this.setIndex(new(65535<h.count?lt:ht)(n,1)),this.addAttribute("position",h),this.addAttribute("normal",l),this.addAttribute("uv",u),this.boundingSphere=new K(new c,t)}function ke(t,e,r,n,i,o,a){ft.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new De(t,e,r,n,i,o,a))}function Fe(t,e,n,i,o,a){mt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:a},t=t||20,e=e||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8,i=void 0!==i?Math.max(1,i):1;var s,u,h=(n+1)*(i+1),l=n*i*6,l=new ut(new(65535<l?Uint32Array:Uint16Array)(l),1),p=new ut(new Float32Array(3*h),3),f=new ut(new Float32Array(3*h),3),h=new ut(new Float32Array(2*h),2),d=0,m=0,v=t,g=(e-t)/i,y=new c,b=new r;for(t=0;t<=i;t++){for(u=0;u<=n;u++)s=o+u/n*a,y.x=v*Math.cos(s),y.y=v*Math.sin(s),p.setXYZ(d,y.x,y.y,y.z),f.setXYZ(d,0,0,1),b.x=(y.x/e+1)/2,b.y=(y.y/e+1)/2,h.setXY(d,b.x,b.y),d++;v+=g}for(t=0;t<i;t++)for(e=t*(n+1),u=0;u<n;u++)o=s=u+e,a=s+n+1,d=s+n+2,s+=1,l.setX(m,o),m++,l.setX(m,a),m++,l.setX(m,d),m++,l.setX(m,o),m++,l.setX(m,d),m++,l.setX(m,s),m++;this.setIndex(l),this.addAttribute("position",p),this.addAttribute("normal",f),this.addAttribute("uv",h)}function Ue(t,e,r,n,i,o){ft.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new Fe(t,e,r,n,i,o))}function Be(t,e,r,n){ft.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new yt(t,e,r,n))}function ze(t,e,n,i){mt.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=Wn.clamp(i,0,2*Math.PI);for(var o=(e+1)*t.length,a=e*t.length*6,s=new ut(new(65535<a?Uint32Array:Uint16Array)(a),1),u=new ut(new Float32Array(3*o),3),h=new ut(new Float32Array(2*o),2),l=0,p=0,f=1/e,d=new c,m=new r,o=0;o<=e;o++)for(var a=n+o*f*i,v=Math.sin(a),g=Math.cos(a),a=0;a<=t.length-1;a++)d.x=t[a].x*v,d.y=t[a].y,d.z=t[a].x*g,u.setXYZ(l,d.x,d.y,d.z),m.x=o/e,m.y=a/(t.length-1),h.setXY(l,m.x,m.y),l++;for(o=0;o<e;o++)for(a=0;a<t.length-1;a++)n=a+o*t.length,l=n+t.length,f=n+t.length+1,d=n+1,s.setX(p,n),p++,s.setX(p,l),p++,s.setX(p,d),p++,s.setX(p,l),p++,s.setX(p,f),p++,s.setX(p,d),p++;if(this.setIndex(s),this.addAttribute("position",u),this.addAttribute("uv",h),this.computeVertexNormals(),i===2*Math.PI)for(i=this.attributes.normal.array,s=new c,u=new c,h=new c,n=e*t.length*3,a=o=0;o<t.length;o++,a+=3)s.x=i[a+0],s.y=i[a+1],s.z=i[a+2],u.x=i[n+a+0],u.y=i[n+a+1],u.z=i[n+a+2],h.addVectors(s,u).normalize(),i[a+0]=i[n+a+0]=h.x,i[a+1]=i[n+a+1]=h.y,i[a+2]=i[n+a+2]=h.z}function Ge(t,e,r,n){ft.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:n},this.fromBufferGeometry(new ze(t,e,r,n)),this.mergeVertices()}function Ve(t,e){ft.call(this),this.type="ShapeGeometry",!1===Array.isArray(t)&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()}function $e(t,e){function r(t,e){return t-e}mt.call(this);var n,i=Math.cos(Wn.DEG2RAD*(void 0!==e?e:1)),o=[0,0],a={},s=["a","b","c"];t&&t.isBufferGeometry?(n=new ft,n.fromBufferGeometry(t)):n=t.clone(),n.mergeVertices(),n.computeFaceNormals();var c=n.vertices;n=n.faces;for(var u=0,h=n.length;u<h;u++)for(var l=n[u],p=0;3>p;p++){o[0]=l[s[p]],o[1]=l[s[(p+1)%3]],o.sort(r);var f=o.toString();void 0===a[f]?a[f]={vert1:o[0],vert2:o[1],face1:u,face2:void 0}:a[f].face2=u}o=[];for(f in a)s=a[f],(void 0===s.face2||n[s.face1].normal.dot(n[s.face2].normal)<=i)&&(u=c[s.vert1],o.push(u.x),o.push(u.y),o.push(u.z),u=c[s.vert2],o.push(u.x),o.push(u.y),o.push(u.z));this.addAttribute("position",new ut(new Float32Array(o),3))}function He(t,e,n,i,o,a,s,u){function h(n){var o,a,h,p=new r,f=new c,d=0,x=!0===n?t:e,M=!0===n?1:-1;for(a=b,o=1;o<=i;o++)v.setXYZ(b,0,w*M,0),g.setXYZ(b,0,M,0),p.x=.5,p.y=.5,y.setXY(b,p.x,p.y),b++;for(h=b,o=0;o<=i;o++){var E=o/i*u+s,T=Math.cos(E),E=Math.sin(E);f.x=x*E,f.y=w*M,f.z=x*T,v.setXYZ(b,f.x,f.y,f.z),g.setXYZ(b,0,M,0),p.x=.5*T+.5,p.y=.5*E*M+.5,y.setXY(b,p.x,p.y),b++}for(o=0;o<i;o++)p=a+o,f=h+o,!0===n?(m.setX(_,f),_++,m.setX(_,f+1)):(m.setX(_,f+1),_++,m.setX(_,f)),_++,m.setX(_,p),_++,d+=3;l.addGroup(S,d,!0===n?1:2),S+=d}mt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:o,openEnded:a,thetaStart:s,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,a=void 0!==a&&a,s=void 0!==s?s:0,u=void 0!==u?u:2*Math.PI;var p=0;!1===a&&(0<t&&p++,0<e&&p++);var f=function(){var t=(i+1)*(o+1);return!1===a&&(t+=(i+1)*p+i*p),t}(),d=function(){var t=i*o*6;return!1===a&&(t+=i*p*3),t}(),m=new ut(new(65535<d?Uint32Array:Uint16Array)(d),1),v=new ut(new Float32Array(3*f),3),g=new ut(new Float32Array(3*f),3),y=new ut(new Float32Array(2*f),2),b=0,_=0,x=[],w=n/2,S=0;!function(){var r,a,h=new c,p=new c,f=0,d=(e-t)/n;for(a=0;a<=o;a++){var M=[],E=a/o,T=E*(e-t)+t;for(r=0;r<=i;r++){var C=r/i,O=C*u+s,P=Math.sin(O),O=Math.cos(O);p.x=T*P,p.y=-E*n+w,p.z=T*O,v.setXYZ(b,p.x,p.y,p.z),h.set(P,d,O).normalize(),g.setXYZ(b,h.x,h.y,h.z),y.setXY(b,C,1-E),M.push(b),b++}x.push(M)}for(r=0;r<i;r++)for(a=0;a<o;a++)h=x[a+1][r],p=x[a+1][r+1],d=x[a][r+1],m.setX(_,x[a][r]),_++,m.setX(_,h),_++,m.setX(_,d),_++,m.setX(_,h),_++,m.setX(_,p),_++,m.setX(_,d),_++,f+=6;l.addGroup(S,f,0),S+=f}(),!1===a&&(0<t&&h(!0),0<e&&h(!1)),this.setIndex(m),this.addAttribute("position",v),this.addAttribute("normal",g),this.addAttribute("uv",y)}function We(t,e,r,n,i,o,a,s){ft.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new He(t,e,r,n,i,o,a,s)),this.mergeVertices()}function qe(t,e,r,n,i,o,a){We.call(this,0,t,e,r,n,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:a}}function Xe(t,e,r,n,i,o,a){He.call(this,0,t,e,r,n,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:a}}function Ye(t,e,r,n){mt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var i=e+2,o=new Float32Array(3*i),a=new Float32Array(3*i),i=new Float32Array(2*i);a[2]=1,i[0]=.5,i[1]=.5;for(var s=0,u=3,h=2;s<=e;s++,u+=3,h+=2){var l=r+s/e*n;o[u]=t*Math.cos(l),o[u+1]=t*Math.sin(l),a[u+2]=1,i[h]=(o[u]/t+1)/2,i[h+1]=(o[u+1]/t+1)/2}for(r=[],u=1;u<=e;u++)r.push(u,u+1,0);this.setIndex(new ut(new Uint16Array(r),1)),this.addAttribute("position",new ut(o,3)),this.addAttribute("normal",new ut(a,3)),this.addAttribute("uv",new ut(i,2)),this.boundingSphere=new K(new c,t)}function Ke(t,e,r,n){ft.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new Ye(t,e,r,n))}function Ze(t,e,r,n,i,o){ft.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new gt(t,e,r,n,i,o)),this.mergeVertices()}function Je(){q.call(this,{uniforms:Qn.merge([ri.lights,{opacity:{value:1}}]),vertexShader:ti.shadow_vert,fragmentShader:ti.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}}})}function Qe(t){q.call(this,t),this.type="RawShaderMaterial"}function tr(t){this.uuid=Wn.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0}function er(t){W.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new G(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new G(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 rr(t){er.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoatRoughness=this.clearCoat=0,this.setValues(t)}function nr(t){W.call(this),this.type="MeshPhongMaterial",this.color=new G(16777215),this.specular=new G(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new G(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 ir(t){W.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=this.lights=this.fog=!1,this.setValues(t)}function or(t){W.call(this),this.type="MeshLambertMaterial",this.color=new G(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new G(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 ar(t){W.call(this),this.type="LineDashedMaterial",this.color=new G(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function sr(t,e,r){var n=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++,!1===i&&void 0!==n.onStart&&n.onStart(t,o,a),i=!0},this.itemEnd=function(t){o++,void 0!==n.onProgress&&n.onProgress(t,o,a),o===a&&(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:pi}function ur(t){this.manager=void 0!==t?t:pi,this._parser=null}function hr(t){this.manager=void 0!==t?t:pi,this._parser=null}function lr(t){this.manager=void 0!==t?t:pi}function pr(t){this.manager=void 0!==t?t:pi}function fr(t){this.manager=void 0!==t?t:pi}function dr(t,e){it.call(this),this.type="Light",this.color=new G(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function mr(t,e,r){dr.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(it.DefaultUp),this.updateMatrix(),this.groundColor=new G(e)}function vr(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new r(512,512),this.map=null,this.matrix=new u}function gr(){vr.call(this,new _t(50,1,.5,500))}function yr(t,e,r,n,i,o){dr.call(this,t,e),this.type="SpotLight",this.position.copy(it.DefaultUp),this.updateMatrix(),this.target=new it,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 gr}function br(t,e,r,n){dr.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 vr(new _t(90,1,.5,500))}function _r(t){vr.call(this,new xt(-5,5,5,-5,.5,500))}function xr(t,e){dr.call(this,t,e),this.type="DirectionalLight",this.position.copy(it.DefaultUp),this.updateMatrix(),this.target=new it,this.shadow=new _r}function wr(t,e){dr.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Sr(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 Mr(t,e,r,n){Sr.call(this,t,e,r,n),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function Er(t,e,r,n){Sr.call(this,t,e,r,n)}function Tr(t,e,r,n){Sr.call(this,t,e,r,n)}function Cr(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=fi.convertArray(e,this.TimeBufferType),this.values=fi.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()}function Or(t,e,r,n){Cr.call(this,t,e,r,n)}function Pr(t,e,r,n){Sr.call(this,t,e,r,n)}function Ar(t,e,r,n){Cr.call(this,t,e,r,n)}function jr(t,e,r,n){Cr.call(this,t,e,r,n)}function Rr(t,e,r,n){Cr.call(this,t,e,r,n)}function Lr(t,e,r){Cr.call(this,t,e,r)}function Nr(t,e,r,n){Cr.call(this,t,e,r,n)}function Ir(t,e,r,n){Cr.apply(this,arguments)}function Dr(t,e,r){this.name=t,this.tracks=r,this.duration=void 0!==e?e:-1,this.uuid=Wn.generateUUID(),0>this.duration&&this.resetDuration(),this.optimize()}function kr(t){this.manager=void 0!==t?t:pi,this.textures={}}function Fr(t){this.manager=void 0!==t?t:pi}function Ur(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function Br(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:pi,this.withCredentials=!1}function zr(t){this.manager=void 0!==t?t:pi,this.texturePath=""}function Gr(){}function Vr(t,e){this.v1=t,this.v2=e}function $r(){this.curves=[],this.autoClose=!1}function Hr(t,e,r,n,i,o,a,s){this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=n,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function Wr(t){this.points=void 0===t?[]:t}function qr(t,e,r,n){this.v0=t,this.v1=e,this.v2=r,this.v3=n}function Xr(t,e,r){this.v0=t,this.v1=e,this.v2=r}function Yr(){Kr.apply(this,arguments),this.holes=[]}function Kr(t){$r.call(this),this.currentPoint=new r,t&&this.fromPoints(t)}function Zr(){this.subPaths=[],this.currentPath=null}function Jr(t){this.data=t}function Qr(t){this.manager=void 0!==t?t:pi}function tn(){return void 0===gi&&(gi=new(window.AudioContext||window.webkitAudioContext)),gi}function en(t){this.manager=void 0!==t?t:pi}function rn(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new _t,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new _t,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function nn(t,e,r){it.call(this),this.type="CubeCamera";var n=new _t(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new c(1,0,0)),this.add(n);var i=new _t(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new c(-1,0,0)),this.add(i);var o=new _t(90,1,t,e);o.up.set(0,0,1),o.lookAt(new c(0,1,0)),this.add(o);var s=new _t(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new c(0,-1,0)),this.add(s);var u=new _t(90,1,t,e);u.up.set(0,-1,0),u.lookAt(new c(0,0,1)),this.add(u);var h=new _t(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new c(0,0,-1)),this.add(h),this.renderTarget=new a(r,r,{format:1022,magFilter:1006,minFilter:1006}),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,a=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,s,r),r.activeCubeFace=4,t.render(e,u,r),r.texture.generateMipmaps=a,r.activeCubeFace=5,
-t.render(e,h,r),t.setRenderTarget(null)}}function on(){it.call(this),this.type="AudioListener",this.context=tn(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function an(t){it.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function sn(t){an.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function cn(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 un(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 hn(t,e,r){this.path=e,this.parsedPath=r||hn.parseTrackName(e),this.node=hn.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function ln(t){this.uuid=Wn.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 pn(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,t=e.tracks,e=t.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 fn(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function dn(t,e){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=e),this.value=t}function mn(){mt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function vn(t,e,r,n){this.uuid=Wn.generateUUID(),this.data=t,this.itemSize=e,this.offset=r,this.normalized=!0===n}function gn(t,e){this.uuid=Wn.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.version=0}function yn(t,e,r){gn.call(this,t,e),this.meshPerAttribute=r||1}function bn(t,e,r){ut.call(this,t,e),this.meshPerAttribute=r||1}function _n(t,e,r,n){this.ray=new et(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 xn(t,e){return t.distance-e.distance}function wn(t,e,r,n){if(!1!==t.visible&&(t.raycast(e,r),!0===n)){t=t.children,n=0;for(var i=t.length;n<i;n++)wn(t[n],e,r,!0)}}function Sn(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1}function Mn(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 En(t,e){vt.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 Tn(t){it.call(this),this.material=t,this.render=function(t){}}function Cn(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 mt,e=new pt(6*e,3),r.addAttribute("position",e),se.call(this,r,new oe({color:t,linewidth:n})),this.matrixAutoUpdate=!1,this.update()}function On(t){it.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,t=new mt;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 pt(e,3)),e=new oe({fog:!1}),this.cone=new se(t,e),this.add(this.cone),this.update()}function Pn(t){this.bones=this.getBoneList(t);for(var e=new ft,r=0;r<this.bones.length;r++){var n=this.bones[r];n.parent&&n.parent.isBone&&(e.vertices.push(new c),e.vertices.push(new c),e.colors.push(new G(0,0,1)),e.colors.push(new G(0,1,0)))}e.dynamic=!0,r=new oe({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0}),se.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function An(t,e){this.light=t,this.light.updateMatrixWorld();var r=new De(e,4,2),n=new ct({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),vt.call(this,r,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function jn(t,e){it.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new G,new G];var r=new ke(e,4,2);r.rotateX(-Math.PI/2);for(var n=0;8>n;n++)r.faces[n].color=this.colors[4>n?0:1];n=new ct({vertexColors:1,wireframe:!0}),this.lightSphere=new vt(r,n),this.add(this.lightSphere),this.update()}function Rn(t,e,r,n){e=e||1,r=new G(void 0!==r?r:4473924),n=new G(void 0!==n?n:8947848);for(var i=e/2,o=2*t/e,a=[],s=[],c=0,u=0,h=-t;c<=e;c++,h+=o){a.push(-t,0,h,t,0,h),a.push(h,0,-t,h,0,t);var l=c===i?r:n;l.toArray(s,u),u+=3,l.toArray(s,u),u+=3,l.toArray(s,u),u+=3,l.toArray(s,u),u+=3}t=new mt,t.addAttribute("position",new pt(a,3)),t.addAttribute("color",new pt(s,3)),a=new oe({vertexColors:2}),se.call(this,t,a)}function Ln(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 mt,e=new pt(6*e,3),r.addAttribute("position",e),se.call(this,r,new oe({color:t,linewidth:n})),this.matrixAutoUpdate=!1,this.update()}function Nn(t,e){it.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var r=new mt;r.addAttribute("position",new pt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var n=new oe({fog:!1});this.add(new ae(r,n)),r=new mt,r.addAttribute("position",new pt([0,0,0,0,0,1],3)),this.add(new ae(r,n)),this.update()}function In(t){function e(t,e,n){r(t,n),r(e,n)}function r(t,e){n.vertices.push(new c),n.colors.push(new G(e)),void 0===o[t]&&(o[t]=[]),o[t].push(n.vertices.length-1)}var n=new ft,i=new oe({color:16777215,vertexColors:1}),o={};e("n1","n2",16755200),e("n2","n4",16755200),e("n4","n3",16755200),e("n3","n1",16755200),e("f1","f2",16755200),e("f2","f4",16755200),e("f4","f3",16755200),e("f3","f1",16755200),e("n1","f1",16755200),e("n2","f2",16755200),e("n3","f3",16755200),e("n4","f4",16755200),e("p","n1",16711680),e("p","n2",16711680),e("p","n3",16711680),e("p","n4",16711680),e("u1","u2",43775),e("u2","u3",43775),e("u3","u1",43775),e("c","t",16777215),e("p","c",3355443),e("cn1","cn2",3355443),e("cn3","cn4",3355443),e("cf1","cf2",3355443),e("cf3","cf4",3355443),se.call(this,n,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}function Dn(t,e){var r=void 0!==e?e:8947848;this.object=t,this.box=new Y,vt.call(this,new Ze(1,1,1),new ct({color:r,wireframe:!0}))}function kn(t,e){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 mt;i.setIndex(new ut(r,1)),i.addAttribute("position",new ut(n,3)),se.call(this,i,new oe({color:e})),void 0!==t&&this.update(t)}function Fn(t,e,r,n,i,o){it.call(this),void 0===n&&(n=16776960),void 0===r&&(r=1),void 0===i&&(i=.2*r),void 0===o&&(o=.2*i),this.position.copy(e),this.line=new ae(yi,new oe({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new vt(bi,new ct({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(r,i,o)}function Un(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);t=new mt,t.addAttribute("position",new ut(e,3)),t.addAttribute("color",new ut(r,3)),e=new oe({vertexColors:2}),se.call(this,t,e)}function Bn(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),_i.call(this,t),this.type="catmullrom",this.closed=!0}function zn(t,e,r,n,i,o){Hr.call(this,t,e,r,r,n,i,o)}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),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*)\s*\(/)[1]}}),void 0===Object.assign&&function(){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;var r,n=[],i=e.length;for(r=0;r<i;r++)n[r]=e[r];for(r=0;r<i;r++)n[r].call(this,t)}}}});var Gn={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},Vn={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},$n={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Hn={NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008},Wn={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*t*(3-2*t))},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},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*Wn.DEG2RAD},radToDeg:function(t){return t*Wn.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++,t}};r.prototype={constructor:r,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},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 isFinite(t)?(this.x*=t,this.y*=t):this.y=this.x=0,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,e;return function(n,i){return void 0===t&&(t=new r,e=new r),t.set(n,n),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/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())},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.multiplyScalar(t/this.length())},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},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],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}},n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=300,n.prototype={constructor:n,isTexture:!0,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return 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.4,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=Wn.generateUUID()),void 0===t.images[r.uuid]){var n,i=t.images,o=r.uuid,a=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:a,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(n.prototype,e.prototype);var qn=0;i.prototype={constructor:i,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 isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):this.w=this.z=this.y=this.x=0,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;t=t.elements;var i=t[0];n=t[4];var o=t[8],a=t[1],s=t[5],c=t[9];r=t[2],e=t[6];var u=t[10];return.01>Math.abs(n-a)&&.01>Math.abs(o-r)&&.01>Math.abs(c-e)?.1>Math.abs(n+a)&&.1>Math.abs(o+r)&&.1>Math.abs(c+e)&&.1>Math.abs(i+s+u-3)?(this.set(1,0,0,0),this):(t=Math.PI,i=(i+1)/2,s=(s+1)/2,u=(u+1)/2,n=(n+a)/4,o=(o+r)/4,c=(c+e)/4,i>s&&i>u?.01>i?(e=0,n=r=.707106781):(e=Math.sqrt(i),r=n/e,n=o/e):s>u?.01>s?(e=.707106781,r=0,n=.707106781):(r=Math.sqrt(s),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)+(a-n)*(a-n)),.001>Math.abs(t)&&(t=1),this.x=(e-c)/t,this.y=(o-r)/t,this.z=(a-n)/t,this.w=Math.acos((i+s+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)}}(),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())},setLength:function(t){return this.multiplyScalar(t/this.length())},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},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],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"})}}),a.prototype=Object.create(o.prototype),a.prototype.constructor=a,a.prototype.isWebGLRenderTargetCube=!0,s.prototype={constructor:s,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},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(!1===(t&&t.isEuler))throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=Math.cos(t._x/2),n=Math.cos(t._y/2),i=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),c=t.order;return"XYZ"===c?(this._x=o*n*i+r*a*s,this._y=r*a*i-o*n*s,this._z=r*n*s+o*a*i,this._w=r*n*i-o*a*s):"YXZ"===c?(this._x=o*n*i+r*a*s,this._y=r*a*i-o*n*s,this._z=r*n*s-o*a*i,this._w=r*n*i+o*a*s):"ZXY"===c?(this._x=o*n*i-r*a*s,this._y=r*a*i+o*n*s,this._z=r*n*s+o*a*i,this._w=r*n*i-o*a*s):"ZYX"===c?(this._x=o*n*i-r*a*s,this._y=r*a*i+o*n*s,this._z=r*n*s-o*a*i,this._w=r*n*i+o*a*s):"YZX"===c?(this._x=o*n*i+r*a*s,this._y=r*a*i+o*n*s,this._z=r*n*s-o*a*i,this._w=r*n*i-o*a*s):"XZY"===c&&(this._x=o*n*i-r*a*s,this._y=r*a*i-o*n*s,this._z=r*n*s+o*a*i,this._w=r*n*i+o*a*s),!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],a=e[9],s=e[2],c=e[6],e=e[10],u=r+o+e;return 0<u?(r=.5/Math.sqrt(u+1),this._w=.25/r,this._x=(c-a)*r,this._y=(n-s)*r,this._z=(i-t)*r):r>o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(c-a)/r,this._x=.25*r,this._y=(t+i)/r,this._z=(n+s)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(n-s)/r,this._x=(t+i)/r,this._y=.25*r,this._z=(a+c)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(i-t)/r,this._x=(n+s)/r,this._y=(a+c)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(r,n){return void 0===t&&(t=new c),e=r.dot(n)+1,1e-6>e?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,n),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,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,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=r*u+o*a+n*c-i*s,this._y=n*u+o*s+i*a-r*c,this._z=i*u+o*c+r*s-n*a,this._w=o*u-r*a-n*s-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,a=o*t._w+r*t._x+n*t._y+i*t._z;if(0>a?(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;var s=Math.sqrt(1-a*a);if(.001>Math.abs(s))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 c=Math.atan2(s,a),a=Math.sin((1-e)*c)/s,s=Math.sin(e*c)/s;return this._w=o*a+this._w*s,this._x=r*a+this._x*s,this._y=n*a+this._y*s,this._z=i*a+this._z*s,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(s,{slerp:function(t,e,r,n){return r.copy(t).slerp(e,n)},slerpFlat:function(t,e,r,n,i,o,a){var s=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||s!==n||c!==h||u!==l){o=1-a;var p=s*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,a=Math.sin(a*p)/d),f*=a,s=s*o+n*f,c=c*o+h*f,u=u*o+l*f,r=r*o+i*f,o===1-a&&(a=1/Math.sqrt(s*s+c*c+u*u+r*r),s*=a,c*=a,u*=a,r*=a)}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=r}}),c.prototype={constructor:c,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 isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):this.z=this.y=this.x=0,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;return function(e){
-return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new s),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,r){return void 0===t&&(t=new s),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;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*n+t[12],this.y=t[1]*e+t[5]*r+t[9]*n+t[13],this.z=t[2]*e+t[6]*r+t[10]*n+t[14],this},applyProjection:function(t){var e=this.x,r=this.y,n=this.z;t=t.elements;var i=1/(t[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,a=t.z;t=t.w;var s=t*e+o*n-a*r,c=t*r+a*e-i*n,u=t*n+i*r-o*e,e=-i*e-o*r-a*n;return this.x=s*t+e*-i+c*-a-u*-o,this.y=c*t+e*-o+u*-i-s*-a,this.z=u*t+e*-a+s*-o-c*-i,this},project:function(){var t;return function(e){return void 0===t&&(t=new u),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new u),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(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,e;return function(r,n){return void 0===t&&(t=new c,e=new c),t.set(r,r,r),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/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())},setLength:function(t){return this.multiplyScalar(t/this.length())},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,a=e.y,s=e.z;return this.x=n*s-i*a,this.y=i*o-r*s,this.z=r*a-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new c),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new c),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(Wn.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},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},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){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var r=t;t=e,e=r}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},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},u.prototype={constructor:u,isMatrix4:!0,set:function(t,e,r,n,i,o,a,s,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]=a,v[13]=s,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){return this.elements.set(t.elements),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;return function(e){void 0===t&&(t=new c);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){!1===(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),a=Math.cos(n),n=Math.sin(n),s=Math.cos(i),i=Math.sin(i);if("XYZ"===t.order){t=o*s;var c=o*i,u=r*s,h=r*i;e[0]=a*s,e[4]=-a*i,e[8]=n,e[1]=c+u*n,e[5]=t-h*n,e[9]=-r*a,e[2]=h-t*n,e[6]=u+c*n,e[10]=o*a}else"YXZ"===t.order?(t=a*s,c=a*i,u=n*s,h=n*i,e[0]=t+h*r,e[4]=u*r-c,e[8]=o*n,e[1]=o*i,e[5]=o*s,e[9]=-r,e[2]=c*r-u,e[6]=h+t*r,e[10]=o*a):"ZXY"===t.order?(t=a*s,c=a*i,u=n*s,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*s,e[9]=h-t*r,e[2]=-o*n,e[6]=r,e[10]=o*a):"ZYX"===t.order?(t=o*s,c=o*i,u=r*s,h=r*i,e[0]=a*s,e[4]=u*n-c,e[8]=t*n+h,e[1]=a*i,e[5]=h*n+t,e[9]=c*n-u,e[2]=-n,e[6]=r*a,e[10]=o*a):"YZX"===t.order?(t=o*a,c=o*n,u=r*a,h=r*n,e[0]=a*s,e[4]=h-t*i,e[8]=u*i+c,e[1]=i,e[5]=o*s,e[9]=-r*s,e[2]=-n*s,e[6]=c*i+u,e[10]=t-h*i):"XZY"===t.order&&(t=o*a,c=o*n,u=r*a,h=r*n,e[0]=a*s,e[4]=-i,e[8]=n*s,e[1]=t*i+h,e[5]=o*s,e[9]=c*i-u,e[2]=u*i-c,e[6]=r*s,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,a=r+r,s=n+n,c=i+i;t=r*a;var u=r*s,r=r*c,h=n*s,n=n*c,i=i*c,a=o*a,s=o*s,o=o*c;return e[0]=1-(h+i),e[4]=u-o,e[8]=r+s,e[1]=u+o,e[5]=1-(t+i),e[9]=n-a,e[2]=r-s,e[6]=n+a,e[10]=1-(t+h),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,e,r;return function(n,i,o){void 0===t&&(t=new c,e=new c,r=new c);var a=this.elements;return r.subVectors(n,i).normalize(),0===r.lengthSq()&&(r.z=1),t.crossVectors(o,r).normalize(),0===t.lengthSq()&&(r.z+=1e-4,t.crossVectors(o,r).normalize()),e.crossVectors(r,t),a[0]=t.x,a[4]=e.x,a[8]=r.x,a[1]=t.y,a[5]=e.y,a[9]=r.y,a[2]=t.z,a[6]=e.z,a[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],a=r[4],s=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*_+a*M+s*O+c*R,i[4]=o*x+a*E+s*P+c*L,i[8]=o*w+a*T+s*A+c*N,i[12]=o*S+a*C+s*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},multiplyToArray:function(t,e,r){var n=this.elements;return this.multiplyMatrices(t,e),r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],r[4]=n[4],r[5]=n[5],r[6]=n[6],r[7]=n[7],r[8]=n[8],r[9]=n[9],r[10]=n[10],r[11]=n[11],r[12]=n[12],r[13]=n[13],r[14]=n[14],r[15]=n[15],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},applyToVector3Array:function(){var t;return function(e,r,n){void 0===t&&(t=new c),void 0===r&&(r=0),void 0===n&&(n=e.length);for(var i=0;i<n;i+=3,r+=3)t.fromArray(e,r),t.applyMatrix4(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,n){void 0===t&&(t=new c),void 0===r&&(r=0),void 0===n&&(n=e.length/e.itemSize);for(var i=0;i<n;i++,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],a=t[5],s=t[9],c=t[13],u=t[2],h=t[6],l=t[10],p=t[14];return t[3]*(+i*s*h-n*c*h-i*a*l+r*c*l+n*a*p-r*s*p)+t[7]*(+e*s*p-e*c*l+i*o*l-n*o*p+n*c*u-i*s*u)+t[11]*(+e*c*h-e*a*p-i*o*h+r*o*p+i*a*u-r*c*u)+t[15]*(-n*a*u-e*s*h+e*a*l+n*o*h-r*o*l+r*s*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},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just 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)}}(),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],a=n[2],s=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],n=n[15],b=f*y*l-g*d*l+g*h*m-u*y*m-f*h*n+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*_+a*x+s*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*s-f*y*s-g*a*m+o*y*m+f*a*n-o*d*n)*S,r[2]=(u*y*s-g*h*s+g*a*l-o*y*l-u*a*n+o*h*n)*S,r[3]=(f*h*s-u*d*s-f*a*l+o*d*l+u*a*m-o*h*m)*S,r[4]=_*S,r[5]=(p*y*s-v*d*s+v*a*m-i*y*m-p*a*n+i*d*n)*S,r[6]=(v*h*s-c*y*s-v*a*l+i*y*l+c*a*n-i*h*n)*S,r[7]=(c*d*s-p*h*s+p*a*l-i*d*l-c*a*m+i*h*m)*S,r[8]=x*S,r[9]=(v*f*s-p*g*s-v*o*m+i*g*m+p*o*n-i*f*n)*S,r[10]=(c*g*s-v*u*s+v*o*l-i*g*l-c*o*n+i*u*n)*S,r[11]=(p*u*s-c*f*s-p*o*l+i*f*l+c*o*m-i*u*m)*S,r[12]=w*S,r[13]=(p*g*a-v*f*a+v*o*d-i*g*d-p*o*y+i*f*y)*S,r[14]=(v*u*a-c*g*a-v*o*h+i*g*h+c*o*y-i*u*y)*S,r[15]=(c*f*a-p*u*a+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,a=t.y,s=t.z,c=i*o,u=i*a;return this.set(c*o+r,c*a-n*s,c*s+n*a,0,c*a+n*s,u*a+r,u*s-n*o,0,c*s-n*a,u*s+n*o,i*s*s+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},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t,e;return function(r,n,i){void 0===t&&(t=new c,e=new u);var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),h=t.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],e.elements.set(this.elements),r=1/a;var o=1/s,l=1/h;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]*=l,e.elements[9]*=l,e.elements[10]*=l,n.setFromRotationMatrix(e),i.x=a,i.y=s,i.z=h,this}}(),makeFrustum:function(t,e,r,n,i,o){var a=this.elements;return a[0]=2*i/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*i/(n-r),a[9]=(n+r)/(n-r),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+i)/(o-i),a[14]=-2*o*i/(o-i),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,e,r,n){t=r*Math.tan(Wn.DEG2RAD*t*.5);var i=-t;return this.makeFrustum(i*e,t*e,i,t,r,n)},makeOrthographic:function(t,e,r,n,i,o){var a=this.elements,s=1/(e-t),c=1/(r-n),u=1/(o-i);return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-((e+t)*s),a[1]=0,a[5]=2*c,a[9]=0,a[13]=-((r+n)*c),a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-((o+i)*u),a[3]=0,a[7]=0,a[11]=0,a[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.isCubeTexture=!0,Object.defineProperty(h.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Xn=new n,Yn=new h,Kn=[],Zn=[];B.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 Jn=/([\w\d_]+)(\])?(\[|\.)?/g;z.prototype.setValue=function(t,e,r){e=this.map[e],void 0!==e&&e.setValue(t,r,this.renderer)},z.prototype.set=function(t,e,r){var n=this.map[r];void 0!==n&&n.setValue(t,e[r],this.renderer)},z.prototype.setOptional=function(t,e,r){e=e[r],void 0!==e&&this.setValue(t,r,e)},z.upload=function(t,e,r,n){for(var i=0,o=e.length;i!==o;++i){var a=e[i],s=r[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,n)}},z.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 Qn={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}},ti={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:"bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\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}\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 = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\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 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}\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:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\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 += normal * ( 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  return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n  return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n  return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n  return 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  return 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  return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n  float maxComponent = max( max( value.r, value.g ), value.b );\n  float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n  return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n  return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n  float maxRGB = max( value.x, max( value.g, value.b ) );\n  float M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n  M            = ceil( M * 255.0 ) / 255.0;\n  return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n    return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n    float maxRGB = max( value.x, max( value.g, value.b ) );\n    float D      = max( maxRange / maxRGB, 1.0 );\n    D            = min( floor( D ) / 255.0, 1.0 );\n    return 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  vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n  Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n  vec4 vResult;\n  vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n  float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n  vResult.w = fract(Le);\n  vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n  return 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  float Le = value.z * 255.0 + value.w;\n  vec3 Xp_Y_XYZp;\n  Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n  Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n  Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n  vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n  return 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 = saturate( flipNormal * reflectVec.y * 0.5 + 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 envMapIntenstiy;\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_fragment:"#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\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\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",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\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.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_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 ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\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_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\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * 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 = flipNormal * 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\t#include <normal_flip>\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 = flipNormal * 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 = flipNormal * 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( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * 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 = flipNormal * 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\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\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}\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_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 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\t\t\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.r;\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 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\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  return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n  return 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  return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n  return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n  return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n  return ( 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:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\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\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\treturn (\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\treturn (\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\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\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 boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\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\tskinned  = bindMatrixInverse * skinned;\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  return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n  color *= toneMappingExposure;\n  return 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  color *= toneMappingExposure;\n  return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n  color *= toneMappingExposure;\n  color = max( vec3( 0.0 ), color - 0.004 );\n  return 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\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\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#include <begin_vertex>\n\t#include <displacementmap_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}\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 <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}\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 <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;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\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 <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}\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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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 <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}\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 <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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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 <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 <displacementmap_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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_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\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\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 <specularmap_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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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 <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\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 <displacementmap_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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",normal_frag:"uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n",normal_vert:"varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\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 <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}\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"};G.prototype={constructor:G,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=Wn.euclideanModulo(e,1),r=Wn.clamp(r,0,1),n=Wn.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)){var n=r[2];switch(r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n)){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],n=r.length,3===n)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===n)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0<t.length&&(r=ei[t],void 0!==r?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),a=Math.min(r,n,i),s=(a+o)/2;if(a===o)a=e=0;else{var c=o-a,a=.5>=s?c/(o+a):c/(2-o-a);switch(o){case r:e=(n-i)/c+(n<i?6:0);break;case n:e=(i-r)/c+2;break;case i:e=(r-n)/c+4}e/=6}return t.h=e,t.s=a,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 ei={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},ri={common:{diffuse:{value:new G(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}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new G(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:{}}}},points:{diffuse:{value:new G(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new i(0,0,1,1)}}},ni={basic:{uniforms:Qn.merge([ri.common,ri.aomap,ri.fog]),vertexShader:ti.meshbasic_vert,fragmentShader:ti.meshbasic_frag},lambert:{uniforms:Qn.merge([ri.common,ri.aomap,ri.lightmap,ri.emissivemap,ri.fog,ri.lights,{emissive:{value:new G(0)}}]),vertexShader:ti.meshlambert_vert,fragmentShader:ti.meshlambert_frag},phong:{uniforms:Qn.merge([ri.common,ri.aomap,ri.lightmap,ri.emissivemap,ri.bumpmap,ri.normalmap,ri.displacementmap,ri.fog,ri.lights,{emissive:{value:new G(0)},specular:{value:new G(1118481)},shininess:{value:30}}]),vertexShader:ti.meshphong_vert,fragmentShader:ti.meshphong_frag},standard:{uniforms:Qn.merge([ri.common,ri.aomap,ri.lightmap,ri.emissivemap,ri.bumpmap,ri.normalmap,ri.displacementmap,ri.roughnessmap,ri.metalnessmap,ri.fog,ri.lights,{emissive:{value:new G(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ti.meshphysical_vert,fragmentShader:ti.meshphysical_frag},points:{uniforms:Qn.merge([ri.points,ri.fog]),vertexShader:ti.points_vert,fragmentShader:ti.points_frag},dashed:{uniforms:Qn.merge([ri.common,ri.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ti.linedashed_vert,fragmentShader:ti.linedashed_frag},depth:{uniforms:Qn.merge([ri.common,ri.displacementmap]),vertexShader:ti.depth_vert,fragmentShader:ti.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:ti.normal_vert,fragmentShader:ti.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ti.cube_vert,fragmentShader:ti.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:ti.equirect_vert,fragmentShader:ti.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new c}},vertexShader:ti.distanceRGBA_vert,fragmentShader:ti.distanceRGBA_frag}};ni.physical={uniforms:Qn.merge([ni.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:ti.meshphysical_vert,fragmentShader:ti.meshphysical_frag},V.prototype={constructor:V,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)}},W.prototype={constructor:W,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},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.4,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),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),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,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.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection,t=t.clippingPlanes;var e=null;if(null!==t)for(var r=t.length,e=Array(r),n=0;n!==r;++n)e[n]=t[n].clone();return this.clippingPlanes=e,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(W.prototype,e.prototype);var ii=0;q.prototype=Object.create(W.prototype),q.prototype.constructor=q,q.prototype.isShaderMaterial=!0,q.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Qn.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},q.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},X.prototype=Object.create(W.prototype),X.prototype.constructor=X,X.prototype.isMeshDepthMaterial=!0,X.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},Y.prototype={constructor:Y,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),a=-(1/0),s=0,c=t.length;s<c;s+=3){var u=t[s],h=t[s+1],l=t[s+2];u<e&&(e=u),h<r&&(r=h),l<n&&(n=l),u>i&&(i=u),h>o&&(o=h),l>a&&(a=l)}this.min.set(e,r,n),this.max.set(i,o,a)},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(){var t=new c;return function(e){var r=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var n=e.geometry;if(void 0!==n)if(n&&n.isGeometry)for(var n=n.vertices,i=0,o=n.length;i<o;i++)t.copy(n[i]),t.applyMatrix4(e.matrixWorld),r.expandByPoint(t);else if(n&&n.isBufferGeometry&&(o=n.attributes.position,void 0!==o)){var a;for(o&&o.isInterleavedBufferAttribute?(n=o.data.array,i=o.offset,a=o.data.stride):(n=o.array,i=0,a=3),o=n.length;i<o;i+=a)t.fromArray(n,i),t.applyMatrix4(e.matrixWorld),r.expandByPoint(t)}}),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=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},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;return function(e){return void 0===t&&(t=new c),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 K,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)}},K.prototype={constructor:K,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new Y;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,a=e.length;o<a;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 Y,t.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}},Z.prototype={constructor:Z,isMatrix3:!0,set:function(t,e,r,n,i,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=i,u[5]=s,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){return t=t.elements,this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],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},applyToVector3Array:function(){var t;return function(e,r,n){void 0===t&&(t=new c),void 0===r&&(r=0),void 0===n&&(n=e.length);for(var i=0;i<n;i+=3,r+=3)t.fromArray(e,r),t.applyMatrix3(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,n){void 0===t&&(t=new c),void 0===r&&(r=0),void 0===n&&(n=e.length/e.itemSize);for(var i=0;i<n;i++,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}}(),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],a=t[5],s=t[6],c=t[7],t=t[8];return e*o*t-e*a*c-r*i*t+r*a*s+n*i*c-n*o*s},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],a=r[2],s=r[3],c=r[4],u=r[5],h=r[6],l=r[7],r=r[8],p=r*c-u*l,f=u*h-r*s,d=l*s-c*h,m=i*p+o*f+a*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]=(a*l-r*o)*m,n[2]=(u*o-a*c)*m,n[3]=f*m,n[4]=(r*i-a*h)*m,n[5]=(a*s-u*i)*m,n[6]=d*m,n[7]=(o*h-l*i)*m,n[8]=(c*i-o*s)*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},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(t,e)},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},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}},J.prototype={constructor:J,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?(o=-(e.start.dot(this.normal)+this.constant)/o,0>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 Z;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}},Q.prototype={constructor:Q,set:function(t,e,r,n,i,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(r),a[3].copy(n),a[4].copy(i),a[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,r=t.elements;t=r[0];var n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],c=r[6],u=r[7],h=r[8],l=r[9],p=r[10],f=r[11],d=r[12],m=r[13],v=r[14],r=r[15];return e[0].setComponents(o-t,u-a,f-h,r-d).normalize(),e[1].setComponents(o+t,u+a,f+h,r+d).normalize(),e[2].setComponents(o+n,u+s,f+l,r+m).normalize(),e[3].setComponents(o-n,u-s,f-l,r-m).normalize(),e[4].setComponents(o-i,u-c,f-p,r-v).normalize(),e[5].setComponents(o+i,u+c,f+p,r+v).normalize(),this},intersectsObject:function(){var t=new K;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 K;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++){var o=n[i];t.x=0<o.normal.x?r.min.x:r.max.x,e.x=0<o.normal.x?r.max.x:r.min.x,t.y=0<o.normal.y?r.min.y:r.max.y,e.y=0<o.normal.y?r.max.y:r.min.y,t.z=0<o.normal.z?r.min.z:r.max.z,e.z=0<o.normal.z?r.max.z:r.min.z;var a=o.distanceToPoint(t),o=o.distanceToPoint(e);if(0>a&&0>o)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}},et.prototype={constructor:et,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,a){t.copy(n).add(i).multiplyScalar(.5),e.copy(i).sub(n).normalize(),r.copy(this.origin).sub(t);var s,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,s=c*f,0<=n?i>=-s?i<=s?(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<=-s?(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<=s?(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),a&&a.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:(t=-(this.origin.dot(t.normal)+t.constant)/e,0<=t?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,a;n=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=n?(r=(t.min.x-s.x)*n,n*=t.max.x-s.x):(r=(t.max.x-s.x)*n,n*=t.min.x-s.x),0<=o?(i=(t.min.y-s.y)*o,o*=t.max.y-s.y):(i=(t.max.y-s.y)*o,o*=t.min.y-s.y),r>o||i>n?null:((i>r||r!==r)&&(r=i),(o<n||n!==n)&&(n=o),0<=a?(i=(t.min.z-s.z)*a,a*=t.max.z-s.z):(i=(t.max.z-s.z)*a,a*=t.min.z-s.z),r>a||i>n?null:((i>r||r!==r)&&(r=i),(a<n||n!==n)&&(n=a),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,a,s,c){if(e.subVectors(o,i),r.subVectors(a,i),n.crossVectors(e,r),o=this.direction.dot(n),0<o){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,i),i=s*this.direction.dot(r.crossVectors(t,r)),0>i?null:(a=s*this.direction.dot(e.cross(t)),0>a||i+a>o?null:(i=-s*t.dot(n),0>i?null:this.at(i/o,c)))}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},rt.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),rt.DefaultOrder="XYZ",rt.prototype={constructor:rt,isEuler:!0,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},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=Wn.clamp,i=t.elements;t=i[0];var o=i[4],a=i[8],s=i[1],c=i[5],u=i[9],h=i[2],l=i[6],i=i[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(n(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-u,i),this._z=Math.atan2(-o,t)):(this._x=Math.atan2(l,c),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(u,-1,1)),.99999>Math.abs(u)?(this._y=Math.atan2(a,i),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-h,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-h,i),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(s,t))):"ZYX"===e?(this._y=Math.asin(-n(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(l,i),this._z=Math.atan2(s,t)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===e?(this._z=Math.asin(n(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,t)):(this._x=0,this._y=Math.atan2(a,i))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(l,c),this._y=Math.atan2(a,t)):(this._x=Math.atan2(-u,i),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,r,n){return void 0===t&&(t=new u),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 s;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(){}},nt.prototype={constructor:nt,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!==(this.mask&t.mask)}},it.DefaultUp=new c(0,1,0),it.DefaultMatrixAutoUpdate=!0,Object.assign(it.prototype,e.prototype,{
-isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},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 s;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){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]);e=this.children.indexOf(t),-1!==e&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1))},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 s,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new s;return function(e){return e=e||new rt,this.getWorldQuaternion(t),e.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new c,e=new s;return function(r){return r=r||new c,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new s;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){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==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(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||""===t,n={};r&&(t={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),i.material=this.material.uuid),0<this.children.length){i.children=[];for(var o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(r){var r=e(t.geometries),o=e(t.materials),a=e(t.textures);t=e(t.images),0<r.length&&(n.geometries=r),0<o.length&&(n.materials=o),0<a.length&&(n.textures=a),0<t.length&&(n.images=t)}return n.object=i,n},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.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}});var oi=0;ot.prototype={constructor:ot,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=Wn.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)}},at.normal=function(){var t=new c;return function(e,r,n,i){return i=i||new c,i.subVectors(n,r),t.subVectors(e,r),i.cross(t),e=i.lengthSq(),0<e?i.multiplyScalar(1/Math.sqrt(e)):i.set(0,0,0)}}(),at.barycoordFromPoint=function(){var t=new c,e=new c,r=new c;return function(n,i,o,a,s){t.subVectors(a,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);a=e.dot(r);var h=n*u-i*i;return s=s||new c,0===h?s.set(-2,-1,-1):(h=1/h,u=(u*o-i*a)*h,n=(n*a-i*o)*h,s.set(1-u-n,n,u))}}(),at.containsPoint=function(){var t=new c;return function(e,r,n,i){return e=at.barycoordFromPoint(e,r,n,i,t),0<=e.x&&0<=e.y&&1>=e.x+e.y}}(),at.prototype={constructor:at,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 at.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new J).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return at.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return at.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,r,n;return function(i,o){void 0===t&&(t=new J,e=[new ot,new ot,new ot],r=new c,n=new c);var a=o||new c,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,r),!0===this.containsPoint(r))a.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<s&&(s=h,a.copy(n))}}return a}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},st.prototype={constructor:st,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}},ct.prototype=Object.create(W.prototype),ct.prototype.constructor=ct,ct.prototype.isMeshBasicMaterial=!0,ct.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,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},ut.prototype={constructor:ut,isBufferAttribute:!0,set needsUpdate(t){!0===t&&this.version++},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 G),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 a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new r),e[n++]=a.x,e[n++]=a.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 a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new i),e[r++]=a.x,e[r++]=a.y,e[r++]=a.z,e[r++]=a.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},clone:function(){return(new this.constructor).copy(this)}},Object.assign(ft.prototype,e.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new Z).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],t.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;return function(e){return void 0===t&&(t=new u),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,n){return void 0===t&&(t=new u),t.makeTranslation(e,r,n),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,n){return void 0===t&&(t=new u),t.makeScale(e,r,n),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new it),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,r,i){var o=void 0!==s?[p[t].clone(),p[e].clone(),p[r].clone()]:[],a=void 0!==u?[n.colors[t].clone(),n.colors[e].clone(),n.colors[r].clone()]:[];i=new st(t,e,r,o,a,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,a=o.position.array,s=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<a.length;o+=3,m+=2)n.vertices.push(new c(a[o],a[o+1],a[o+2])),void 0!==s&&p.push(new c(s[o],s[o+1],s[o+2])),void 0!==u&&n.colors.push(new G(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]));if(void 0!==i)if(a=t.groups,0<a.length)for(o=0;o<a.length;o++)for(var v=a[o],g=v.start,y=v.count,m=g,g=g+y;m<g;m+=3)e(i[m],i[m+1],i[m+2],v.materialIndex);else for(o=0;o<i.length;o+=3)e(i[o],i[o+1],i[o+2]);else for(o=0;o<a.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=this.boundingSphere.radius,e=0===e?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],a=this.vertices[i.b];t.subVectors(this.vertices[i.c],a),e.subVectors(o,a),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,a,s=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],a=this.vertices[r.c],s.subVectors(a,o),u.subVectors(i,o),s.cross(u),n[r.a].add(s),n[r.b].add(s),n[r.c].add(s)}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],i=r.vertexNormals,3===i.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++){r=this.faces[t];var n=r.vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,n,i;for(r=0,n=this.faces.length;r<n;r++)for(i=this.faces[r],i.__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 ft;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 a,s,u=this.morphNormals[t].vertexNormals;for(r=0,n=this.faces.length;r<n;r++)a=new c,s={a:new c,b:new c,c:new c},i.push(a),u.push(s)}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],a=u.faceNormals[r],s=u.vertexNormals[r],a.copy(i.normal),s.a.copy(i.vertexNormals[0]),s.b.copy(i.vertexNormals[1]),s.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},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},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 Y),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new K),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(!1===(t&&t.isGeometry))console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);else{var n,i=this.vertices.length,o=this.vertices,a=t.vertices,s=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 Z).getNormalMatrix(e)),t=0;for(var f=a.length;t<f;t++){var d=a[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 a=c[t],m=a.vertexNormals,p=a.vertexColors,l=new st(a.a+i,a.b+i,a.c+i);for(l.normal.copy(a.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(a.color),e=0,o=p.length;e<o;e++)d=p[e],l.vertexColors.push(d.clone());l.materialIndex=a.materialIndex+r,s.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)}}},mergeMesh:function(t){!1===(t&&t.isMesh)?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,r,n={},i=[],o=[],a=Math.pow(10,4);for(e=0,r=this.vertices.length;e<r;e++)t=this.vertices[e],t=Math.round(t.x*a)+"_"+Math.round(t.y*a)+"_"+Math.round(t.z*a),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(a=this.faces[e],a.a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],t=0;3>t;t++)if(a[t]===a[(t+1)%3]){n.push(e);break}for(e=n.length-1;0<=e;e--)for(a=n[e],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(a,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],a=this.faceVertexUvs[1];for(o&&o.length===e&&(n=[]),a&&a.length===e&&(i=[]),r=0;r<e;r++){var s=t[r]._id;n&&n.push(o[s]),i&&i.push(a[s])}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.4,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,a=this.parameters;for(o in a)void 0!==a[o]&&(i[o]=a[o]);return i}for(a=[],o=0;o<this.vertices.length;o++){var s=this.vertices[o];a.push(s.x,s.y,s.z)}var s=[],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,_=0,_=t(_,0,0),_=t(_,1,!0),_=t(_,2,!1),_=t(_,3,m),_=t(_,4,v),_=t(_,5,g),_=t(_,6,y),_=t(_,7,b);s.push(_),s.push(d.a,d.b,d.c),s.push(d.materialIndex),m&&(m=this.faceVertexUvs[0][o],s.push(n(m[0]),n(m[1]),n(m[2]))),v&&s.push(e(d.normal)),g&&(v=d.vertexNormals,s.push(e(v[0]),e(v[1]),e(v[2]))),y&&s.push(r(d.color)),b&&(d=d.vertexColors,s.push(r(d[0]),r(d[1]),r(d[2])))}return i.data={},i.data.vertices=a,i.data.normals=c,0<h.length&&(i.data.colors=h),0<p.length&&(i.data.uvs=[p]),i.data.faces=s,i},clone:function(){return(new ft).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var e=t.vertices,r=0,n=e.length;r<n;r++)this.vertices.push(e[r].clone());for(e=t.colors,r=0,n=e.length;r<n;r++)this.colors.push(e[r].clone());for(e=t.faces,r=0,n=e.length;r<n;r++)this.faces.push(e[r].clone());for(r=0,n=t.faceVertexUvs.length;r<n;r++){e=t.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var i=0,o=e.length;i<o;i++){for(var a=e[i],s=[],c=0,u=a.length;c<u;c++)s.push(a[c].clone());this.faceVertexUvs[r].push(s)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var ai=0;Object.assign(dt.prototype,e.prototype,{computeBoundingBox:ft.prototype.computeBoundingBox,computeBoundingSphere:ft.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){var e,r,n=[];t=t.faces;for(var i=0;i<t.length;i++){var o=t[i];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*i-e.start,n.push(e)),e={start:3*i,materialIndex:r})}void 0!==e&&(e.count=3*i-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,n=t.faces,i=t.vertices,o=t.faceVertexUvs,a=o[0]&&0<o[0].length,s=o[1]&&0<o[1].length,c=t.morphTargets,u=c.length;if(0<u){e=[];for(var h=0;h<u;h++)e[h]=[];this.morphTargets.position=e}var l,p=t.morphNormals,f=p.length;if(0<f){for(l=[],h=0;h<f;h++)l[h]=[];this.morphTargets.normal=l}for(var d=t.skinIndices,m=t.skinWeights,v=d.length===i.length,g=m.length===i.length,h=0;h<n.length;h++){var y=n[h];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)),b=y.vertexColors,3===b.length?this.colors.push(b[0],b[1],b[2]):(b=y.color,this.colors.push(b,b,b)),!0===a&&(b=o[0][h],void 0!==b?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new r,new r,new r))),!0===s&&(b=o[1][h],void 0!==b?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),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<f;b++)_=p[b].vertexNormals[h],l[b].push(_.a,_.b,_.c);v&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[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},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.assign(mt.prototype,e.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e,r){if(!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute))console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new ut(e,r));else{if("index"!==t)return this.attributes[t]=e,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)}},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.applyToVector3Array(e.array),e.needsUpdate=!0),e=this.attributes.normal,void 0!==e&&((new Z).getNormalMatrix(t).applyToVector3Array(e.array),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,n){return void 0===t&&(t=new u),t.makeTranslation(e,r,n),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,n){return void 0===t&&(t=new u),t.makeScale(e,r,n),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new it),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&&t.isPoints||t&&t.isLine){t=new pt(3*e.vertices.length,3);var r=new pt(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 pt(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&&t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t&&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&&(r=this.attributes.position,void 0!==r&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(r=this.attributes.normal,void 0!==r&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(r=this.attributes.color,void 0!==r&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(r=this.attributes.uv,void 0!==r&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,void 0!==r&&(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 dt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);this.addAttribute("position",new ut(e,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(e=new Float32Array(3*t.normals.length),this.addAttribute("normal",new ut(e,3).copyVector3sArray(t.normals))),0<t.colors.length&&(e=new Float32Array(3*t.colors.length),this.addAttribute("color",new ut(e,3).copyColorsArray(t.colors))),0<t.uvs.length&&(e=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new ut(e,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(e=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new ut(e,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(e=new(65535<t.vertices.length?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new ut(e,1).copyIndicesArray(t.indices))),this.groups=t.groups;for(var r in t.morphTargets){for(var e=[],n=t.morphTargets[r],i=0,o=n.length;i<o;i++){var a=n[i],s=new pt(3*a.length,3);e.push(s.copyVector3sArray(a))}this.morphAttributes[r]=e}return 0<t.skinIndices.length&&(r=new pt(4*t.skinIndices.length,4),this.addAttribute("skinIndex",r.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(r=new pt(4*t.skinWeights.length,4),this.addAttribute("skinWeight",r.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 Y);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(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 Y,e=new c;return function(){null===this.boundingSphere&&(this.boundingSphere=new K);var r=this.attributes.position;if(r){var r=r.array,n=this.boundingSphere.center;t.setFromArray(r),t.getCenter(n);for(var i=0,o=0,a=r.length;o<a;o+=3)e.fromArray(r,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 ut(new Float32Array(n.length),3));else for(var i=e.normal.array,o=0,a=i.length;o<a;o++)i[o]=0;var s,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],a=o.start,s=o.count,o=a,a+=s;o<a;o+=3)s=3*t[o+0],u=3*t[o+1],h=3*t[o+2],l.fromArray(n,s),p.fromArray(n,u),f.fromArray(n,h),d.subVectors(f,p),m.subVectors(l,p),d.cross(m),i[s]+=d.x,i[s+1]+=d.y,i[s+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,a=n.length;o<a;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(!1!==(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],a=o.array,s=0,o=o.itemSize*e;s<a.length;s++,o++)i[o]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,n=this.attributes.normal.array,i=0,o=n.length;i<o;i+=3)t=n[i],e=n[i+1],r=n[i+2],t=1/Math.sqrt(t*t+e*e+r*r),n[i]*=t,n[i+1]*=t,n[i+2]*=t},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new mt,r=this.index.array,n=this.attributes;for(t in n){for(var i,o=n[t],a=o.array,o=o.itemSize,s=new a.constructor(r.length*o),c=0,u=0,h=r.length;u<h;u++){i=r[u]*o;for(var l=0;l<o;l++)s[c++]=a[i++]}e.addAttribute(t,new ut(s,o))}return e},toJSON:function(){var t={metadata:{version:4.4,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 e=this.groups,0<e.length&&(t.data.groups=JSON.parse(JSON.stringify(e))),e=this.boundingSphere,null!==e&&(t.data.boundingSphere={center:e.center.toArray(),radius:e.radius}),t},clone:function(){return(new mt).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var r,e=t.attributes;for(r in e)this.addAttribute(r,e[r].clone());for(t=t.groups,r=0,e=t.length;r<e;r++){var n=t[r];this.addGroup(n.start,n.count,n.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),mt.MaxIndex=65535,vt.prototype=Object.assign(Object.create(it.prototype),{constructor:vt,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return it.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t=this.geometry.morphTargets;if(void 0!==t&&0<t.length){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,r=t.length;e<r;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[t[e].name]=e}},raycast:function(){function t(t,e,r,n,i,o,a){return at.barycoordFromPoint(t,e,r,n,y),i.multiplyScalar(y.x),o.multiplyScalar(y.y),a.multiplyScalar(y.z),i.add(o).add(a),i.clone()}function e(t,e,r,n,i,o,a){var s=t.material;return null===(1===s.side?r.intersectTriangle(o,i,n,!0,a):r.intersectTriangle(n,i,o,2!==s.side,a))?null:(_.copy(a),_.applyMatrix4(t.matrixWorld),r=e.ray.origin.distanceTo(_),r<e.near||r>e.far?null:{distance:r,point:_.clone(),object:t})}function n(r,n,i,o,a,c,u,p){return s.fromArray(o,3*c),h.fromArray(o,3*u),l.fromArray(o,3*p),(r=e(r,n,i,s,h,l,b))&&(a&&(m.fromArray(a,2*c),v.fromArray(a,2*u),g.fromArray(a,2*p),r.uv=t(b,s,h,l,m,v,g)),r.face=new st(c,u,p,at.normal(s,h,l)),r.faceIndex=c),r}var i=new u,o=new et,a=new K,s=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(),a.copy(u.boundingSphere),a.applyMatrix4(_),!1!==r.ray.intersectsSphere(a)&&(i.getInverse(_),o.copy(r.ray).applyMatrix4(i),null===u.boundingBox||!1!==o.intersectsBox(u.boundingBox)))){var x,w;if(u&&u.isBufferGeometry){var S,M,y=u.index,_=u.attributes,u=_.position.array;if(void 0!==_.uv&&(x=_.uv.array),null!==y)for(var _=y.array,E=0,T=_.length;E<T;E+=3)y=_[E],S=_[E+1],M=_[E+2],(w=n(this,r,o,u,x,y,S,M))&&(w.faceIndex=Math.floor(E/3),c.push(w));else for(E=0,T=u.length;E<T;E+=9)y=E/3,S=y+1,M=y+2,(w=n(this,r,o,u,x,y,S,M))&&(w.index=y,c.push(w))}else if(u&&u.isGeometry){var C,O,_=y&&y.isMultiMaterial,E=!0===_?y.materials:null,T=u.vertices;S=u.faces,M=u.faceVertexUvs[0],0<M.length&&(x=M);for(var P=0,A=S.length;P<A;P++){var j=S[P];if(w=!0===_?E[j.materialIndex]:y,void 0!==w){if(M=T[j.a],C=T[j.b],O=T[j.c],!0===w.morphTargets){w=u.morphTargets;var R=this.morphTargetInfluences;s.set(0,0,0),h.set(0,0,0),l.set(0,0,0);for(var L=0,N=w.length;L<N;L++){var I=R[L];if(0!==I){var D=w[L].vertices;s.addScaledVector(p.subVectors(D[j.a],M),I),h.addScaledVector(f.subVectors(D[j.b],C),I),l.addScaledVector(d.subVectors(D[j.c],O),I)}}s.add(M),h.add(C),l.add(O),M=s,C=h,O=l}(w=e(this,r,o,M,C,O,b))&&(x&&(R=x[P],m.copy(R[0]),v.copy(R[1]),g.copy(R[2]),w.uv=t(b,M,C,O,m,v,g)),w.face=j,w.faceIndex=P,c.push(w))}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),gt.prototype=Object.create(mt.prototype),gt.prototype.constructor=gt,yt.prototype=Object.create(mt.prototype),yt.prototype.constructor=yt,bt.prototype=Object.create(it.prototype),bt.prototype.constructor=bt,bt.prototype.isCamera=!0,bt.prototype.getWorldDirection=function(){var t=new s;return function(e){return e=e||new c,this.getWorldQuaternion(t),e.set(0,0,-1).applyQuaternion(t)}}(),bt.prototype.lookAt=function(){var t=new u;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),bt.prototype.clone=function(){return(new this.constructor).copy(this)},bt.prototype.copy=function(t){return it.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},_t.prototype=Object.assign(Object.create(bt.prototype),{constructor:_t,isPerspectiveCamera:!0,copy:function(t){return bt.prototype.copy.call(this,t),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*Wn.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Wn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Wn.RAD2DEG*Math.atan(Math.tan(.5*Wn.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=t*Math.tan(.5*Wn.DEG2RAD*this.fov)/this.zoom,r=2*e,n=this.aspect*r,i=-.5*n,o=this.view;if(null!==o)var a=o.fullWidth,s=o.fullHeight,i=i+o.offsetX*n/a,e=e-o.offsetY*r/s,n=o.width/a*n,r=o.height/s*r;o=this.filmOffset,0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makeFrustum(i,i+n,e-r,e,t,this.far)},toJSON:function(t){return t=it.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}}),xt.prototype=Object.assign(Object.create(bt.prototype),{constructor:xt,isOrthographicCamera:!0,copy:function(t){return bt.prototype.copy.call(this,t),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=(this.right+this.left)/2,n=(this.top+this.bottom)/2,i=r-t,r=r+t,t=n+e,e=n-e;if(null!==this.view)var r=this.zoom/(this.view.width/this.view.fullWidth),e=this.zoom/(this.view.height/this.view.fullHeight),o=(this.right-this.left)/this.view.width,n=(this.top-this.bottom)/this.view.height,i=i+this.view.offsetX/r*o,r=i+this.view.width/r*o,t=t-this.view.offsetY/e*n,e=t-this.view.height/e*n;this.projectionMatrix.makeOrthographic(i,r,t,e,this.near,this.far)},toJSON:function(t){return t=it.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}});var si=0;Xt.prototype.isFogExp2=!0,Xt.prototype.clone=function(){return new Xt(this.color.getHex(),this.density)},Xt.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Yt.prototype.isFog=!0,Yt.prototype.clone=function(){return new Yt(this.color.getHex(),this.near,this.far)},Yt.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Kt.prototype=Object.create(it.prototype),Kt.prototype.constructor=Kt,Kt.prototype.copy=function(t,e){return it.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},Kt.prototype.toJSON=function(t){var e=it.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},Zt.prototype=Object.assign(Object.create(it.prototype),{constructor:Zt,isLensFlare:!0,copy:function(t){it.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 G(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)}}),Jt.prototype=Object.create(W.prototype),Jt.prototype.constructor=Jt,Jt.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},Qt.prototype=Object.assign(Object.create(it.prototype),{constructor:Qt,isSprite:!0,raycast:function(){var t=new c;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.distanceSqToPoint(t);n>this.scale.x*this.scale.y/4||r.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),te.prototype=Object.assign(Object.create(it.prototype),{constructor:te,copy:function(t){it.prototype.copy.call(this,t,!1),t=t.levels;for(var e=0,r=t.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=it.prototype.toJSON.call(this,t),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}}),ee.prototype=Object.create(n.prototype),ee.prototype.constructor=ee,ee.prototype.isDataTexture=!0,Object.assign(re.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(){for(var t,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;return function(){for(var e=0,r=this.bones.length;e<r;e++)t.multiplyMatrices(this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix,this.boneInverses[e]),t.toArray(this.boneMatrices,16*e);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new re(this.bones,this.boneInverses,this.useVertexTexture)}}),ne.prototype=Object.assign(Object.create(it.prototype),{constructor:ne,isBone:!0,copy:function(t){return it.prototype.copy.call(this,t),this.skin=t.skin,this}}),ie.prototype=Object.assign(Object.create(vt.prototype),{constructor:ie,isSkinnedMesh:!0,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(){if(this.geometry&&this.geometry.isGeometry)for(var t=0;t<this.geometry.skinWeights.length;t++){var e=this.geometry.skinWeights[t],r=1/e.lengthManhattan();1/0!==r?e.multiplyScalar(r):e.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var e=new i,n=this.geometry.attributes.skinWeight,t=0;t<n.count;t++)e.x=n.getX(t),e.y=n.getY(t),e.z=n.getZ(t),e.w=n.getW(t),r=1/e.lengthManhattan(),1/0!==r?e.multiplyScalar(r):e.set(1,0,0,0),n.setXYZW(t,e.x,e.y,e.z,e.w)},updateMatrixWorld:function(t){vt.prototype.updateMatrixWorld.call(this,!0),"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,this.skeleton.useVertexTexture).copy(this)}}),oe.prototype=Object.create(W.prototype),oe.prototype.constructor=oe,oe.prototype.isLineBasicMaterial=!0,oe.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},ae.prototype=Object.assign(Object.create(it.prototype),{constructor:ae,isLine:!0,raycast:function(){var t=new u,e=new et,r=new K;return function(n,i){var o=n.linePrecision,o=o*o,a=this.geometry,s=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(s),!1!==n.ray.intersectsSphere(r)){t.getInverse(s),e.copy(n.ray).applyMatrix4(t);var u=new c,h=new c,s=new c,l=new c,p=this&&this.isLineSegments?2:1;if(a&&a.isBufferGeometry){var f=a.index,d=a.attributes.position.array;if(null!==f)for(var f=f.array,a=0,m=f.length-1;a<m;a+=p){var v=f[a+1];u.fromArray(d,3*f[a]),h.fromArray(d,3*v),v=e.distanceSqToSegment(u,h,l,s),v>o||(l.applyMatrix4(this.matrixWorld),v=n.ray.origin.distanceTo(l),v<n.near||v>n.far||i.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,m=d.length/3-1;a<m;a+=p)u.fromArray(d,3*a),h.fromArray(d,3*a+3),v=e.distanceSqToSegment(u,h,l,s),v>o||(l.applyMatrix4(this.matrixWorld),v=n.ray.origin.distanceTo(l),v<n.near||v>n.far||i.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a&&a.isGeometry)for(u=a.vertices,h=u.length,a=0;a<h-1;a+=p)v=e.distanceSqToSegment(u[a],u[a+1],l,s),v>o||(l.applyMatrix4(this.matrixWorld),v=n.ray.origin.distanceTo(l),v<n.near||v>n.far||i.push({distance:v,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),se.prototype=Object.assign(Object.create(ae.prototype),{constructor:se,isLineSegments:!0}),ce.prototype=Object.create(W.prototype),ce.prototype.constructor=ce,ce.prototype.isPointsMaterial=!0,ce.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},ue.prototype=Object.assign(Object.create(it.prototype),{constructor:ue,isPoints:!0,raycast:function(){var t=new u,e=new et,r=new K;return function(n,i){function o(t,r){var o=e.distanceSqToPoint(t);if(o<l){var s=e.closestPointToPoint(t);s.applyMatrix4(u);var c=n.ray.origin.distanceTo(s);c<n.near||c>n.far||i.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,u=this.matrixWorld,h=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(u),!1!==n.ray.intersectsSphere(r)){t.getInverse(u),e.copy(n.ray).applyMatrix4(t);var h=h/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,h=new c;if(s&&s.isBufferGeometry){var p=s.index,s=s.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(s,3*m),o(h,m)}else for(p=0,f=s.length/3;p<f;p++)h.fromArray(s,3*p),o(h,p)}else for(h=s.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)}}),he.prototype=Object.assign(Object.create(it.prototype),{constructor:he}),le.prototype=Object.create(n.prototype),le.prototype.constructor=le,pe.prototype=Object.create(n.prototype),pe.prototype.constructor=pe,pe.prototype.isCompressedTexture=!0,fe.prototype=Object.create(n.prototype),fe.prototype.constructor=fe,de.prototype=Object.create(n.prototype),de.prototype.constructor=de,de.prototype.isDepthTexture=!0,me.prototype=Object.create(mt.prototype),me.prototype.constructor=me,ve.prototype=Object.create(mt.prototype),ve.prototype.constructor=ve,ge.prototype=Object.create(ft.prototype),ge.prototype.constructor=ge,ye.prototype=Object.create(mt.prototype),ye.prototype.constructor=ye,be.prototype=Object.create(ye.prototype),be.prototype.constructor=be,_e.prototype=Object.create(ft.prototype),_e.prototype.constructor=_e,xe.prototype=Object.create(ye.prototype),xe.prototype.constructor=xe,we.prototype=Object.create(ft.prototype),we.prototype.constructor=we,Se.prototype=Object.create(ye.prototype),Se.prototype.constructor=Se,Me.prototype=Object.create(ft.prototype),Me.prototype.constructor=Me,Ee.prototype=Object.create(ye.prototype),Ee.prototype.constructor=Ee,Te.prototype=Object.create(ft.prototype),Te.prototype.constructor=Te,Ce.prototype=Object.create(ft.prototype),Ce.prototype.constructor=Ce,Oe.prototype=Object.create(mt.prototype),Oe.prototype.constructor=Oe,Pe.prototype=Object.create(ft.prototype),Pe.prototype.constructor=Pe,Ae.prototype=Object.create(mt.prototype),Ae.prototype.constructor=Ae,je.prototype=Object.create(ft.prototype),je.prototype.constructor=je,Re.prototype=Object.create(mt.prototype),Re.prototype.constructor=Re,Le.prototype=Object.create(ft.prototype),Le.prototype.constructor=Le;var ci={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(){return function(t,e){var r=t.length;if(3>r)return null;var n,i,o,a=[],s=[],c=[];if(0<ci.area(t))for(i=0;i<r;i++)s[i]=i;else for(i=0;i<r;i++)s[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}n=i,r<=n&&(n=0),i=n+1,r<=i&&(i=0),o=i+1,r<=o&&(o=0);var h;t:{var l,p,f,d,m,v,g,y;if(l=t[s[n]].x,p=t[s[n]].y,f=t[s[i]].x,d=t[s[i]].y,m=t[s[o]].x,v=t[s[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[s[h]].x,y=t[s[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(a.push([t[s[n]],t[s[i]],t[s[o]]]),c.push([s[n],s[i],s[o]]),n=i,o=i+1;o<r;n++,o++)s[n]=s[o];r--,u=2*r}}return e?c:a}}(),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 a=e.x-t.x,s=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=s*c-a*u,f=s*h-a*l;if(Math.abs(p)>Number.EPSILON){if(0<p){if(0>f||f>p)return[];if(c=u*h-c*l,0>c||c>p)return[]}else{if(0<f||f<p)return[];if(c=u*h-c*l,0<c||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*a,y:t.y+o*s}])}return 0!==f||u*h!==c*l?[]:(s=0===a&&0===s,c=0===c&&0===u,s&&c?t.x!==r.x||t.y!==r.y?[]:[t]:s?n(r,i,t)?[t]:[]:c?n(t,e,r)?[r]:[]:(0!==a?(t.x<e.x?(a=t,c=t.x,s=e,t=e.x):(a=e,c=e.x,s=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?(a=t,c=t.y,s=e,t=e.y):(a=e,c=e.y,s=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,s]:[e,u]:c>r?[]:c===r?o?[]:[a]:t<=r?[a,s]:[a,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 a=n.x-t.x;return n=n.y-t.y,t=i*r-o*e,i=i*n-o*a,Math.abs(t)>Number.EPSILON?(e=a*r-n*e,0<t?0<=i&&0<=e:0<=i||0<=e):0<i}r(t),e.forEach(r);var a,s,c,u,h,l={};for(c=t.concat(),a=0,s=e.length;a<s;a++)Array.prototype.push.apply(c,e[a]);for(a=0,s=c.length;a<s;a++)h=c[a].x+":"+c[a].y,void 0!==l[h]&&console.warn("THREE.ShapeUtils: Duplicate point",h,a),l[h]=a;a=function(t,e){function r(t,e){var r=v.length-1,n=t-1;0>n&&(n=r);var i=t+1;return i>r&&(i=0),!!(r=o(v[t],v[n],v[i],s[e]))&&(r=s.length-1,n=e-1,0>n&&(n=r),i=e+1,i>r&&(i=0),!!(r=o(s[e],s[n],s[i],v[t])))}function n(t,e){var r,n;for(r=0;r<v.length;r++)if(n=r+1,n%=v.length,n=i(t,e,v[r],v[n],!0),0<n.length)return!0;return!1}function a(t,r){var n,o,a,s;for(n=0;n<g.length;n++)for(o=e[g[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,s=i(t,r,o[a],o[s],!0),0<s.length)return!0;return!1}var s,c,u,h,l,p,f,d,m,v=t.concat(),g=[],y=[],b=0;for(c=e.length;b<c;b++)g.push(b);f=0;for(var _=2*g.length;0<g.length;){if(_--,0>_){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(u=f;u<v.length;u++){for(h=v[u],c=-1,b=0;b<g.length;b++)if(l=g[b],p=h.x+":"+h.y+":"+l,void 0===y[p]){for(s=e[l],d=0;d<s.length;d++)if(l=s[d],r(u,d)&&!n(h,l)&&!a(h,l)){c=d,g.splice(b,1),f=v.slice(0,u+1),l=v.slice(u),d=s.slice(c),m=s.slice(0,c+1),v=f.concat(d).concat(m).concat(l),f=u;break}if(0<=c)break;y[p]=!0}if(0<=c)break}}return v}(t,e);var p=ci.triangulate(a,!1);for(a=0,s=p.length;a<s;a++)for(u=p[a],c=0;3>c;c++)h=u[c].x+":"+u[c].y,h=l[h],void 0!==h&&(u[c]=h);return p.concat()},isClockWise:function(t){return 0>ci.area(t)},b2:function(){return function(t,e,r,n){var i=1-t;return i*i*e+2*(1-t)*t*r+t*t*n}}(),b3:function(){return function(t,e,r,n,i){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*r+3*(1-t)*t*t*n+t*t*t*i}}()};Ne.prototype=Object.create(ft.prototype),Ne.prototype.constructor=Ne,Ne.prototype.addShapeList=function(t,e){for(var r=t.length,n=0;n<r;n++)this.addShape(t[n],e)},Ne.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,a;o=t.x-e.x,a=t.y-e.y,i=n.x-t.x;var s=n.y-t.y,c=o*o+a*a;if(Math.abs(o*s-a*i)>Number.EPSILON){var u=Math.sqrt(c),h=Math.sqrt(i*i+s*s),c=e.x-a/u;if(e=e.y+o/u,s=((n.x-s/h-c)*s-(n.y+i/h-e)*i)/(o*s-a*i),i=c+o*s-t.x,o=e+a*s-t.y,a=i*i+o*o,2>=a)return new r(i,o);a=Math.sqrt(a/2)}else t=!1,o>Number.EPSILON?i>Number.EPSILON&&(t=!0):o<-Number.EPSILON?i<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(s)&&(t=!0),t?(i=-a,a=Math.sqrt(c)):(i=o,o=a,a=Math.sqrt(c/2));return new r(i/a,o/a)}function o(t,e){var r,n;for(B=t.length;0<=--B;){r=B,n=B-1,0>n&&(n=t.length-1);var i,o=_+2*g;for(i=0;i<o;i++){var a=F*i,s=F*(i+1),c=e+r+a,a=e+n+a,u=e+n+s,s=e+r+s,c=c+O,a=a+O,u=u+O,s=s+O;C.faces.push(new st(c,a,s,null,null,1)),C.faces.push(new st(a,u,s,null,null,1)),c=S.generateSideWallUV(C,c,a,u,s),C.faceVertexUvs[0].push([c[0],c[1],c[3]]),C.faceVertexUvs[0].push([c[1],c[2],c[3]])}}}function a(t,e,r){C.vertices.push(new c(t,e,r))}function s(t,e,r){t+=O,e+=O,r+=O,C.faces.push(new st(t,e,r,null,null,0)),t=S.generateTopUV(C,t,e,r),C.faceVertexUvs[0].push(t)}var u,h,l,p,f,d=void 0!==e.amount?e.amount:100,m=void 0!==e.bevelThickness?e.bevelThickness:6,v=void 0!==e.bevelSize?e.bevelSize:m-2,g=void 0!==e.bevelSegments?e.bevelSegments:3,y=void 0===e.bevelEnabled||e.bevelEnabled,b=void 0!==e.curveSegments?e.curveSegments:12,_=void 0!==e.steps?e.steps:1,x=e.extrudePath,w=!1,S=void 0!==e.UVGenerator?e.UVGenerator:Ne.WorldUVGenerator;x&&(u=x.getSpacedPoints(_),w=!0,y=!1,h=void 0!==e.frames?e.frames:x.computeFrenetFrames(_,!1),l=new c,p=new c,f=new c),y||(v=m=g=0);var M,E,T,C=this,O=this.vertices.length,x=t.extractPoints(b),b=x.shape,P=x.holes;if(x=!ci.isClockWise(b)){for(b=b.reverse(),E=0,T=P.length;E<T;E++)M=P[E],ci.isClockWise(M)&&(P[E]=M.reverse());x=!1}var A=ci.triangulateShape(b,P),j=b;for(E=0,T=P.length;E<T;E++)M=P[E],b=b.concat(M);var R,L,N,I,D,k,F=b.length,U=A.length,x=[],B=0;for(N=j.length,R=N-1,L=B+1;B<N;B++,R++,L++)R===N&&(R=0),L===N&&(L=0),x[B]=i(j[B],j[R],j[L]);var z,G=[],V=x.concat();for(E=0,T=P.length;E<T;E++){for(M=P[E],z=[],B=0,N=M.length,R=N-1,L=B+1;B<N;B++,R++,L++)R===N&&(R=0),L===N&&(L=0),z[B]=i(M[B],M[R],M[L]);G.push(z),V=V.concat(z)}for(R=0;R<g;R++){for(N=R/g,I=m*Math.cos(N*Math.PI/2),L=v*Math.sin(N*Math.PI/2),B=0,N=j.length;B<N;B++)D=n(j[B],x[B],L),a(D.x,D.y,-I);for(E=0,T=P.length;E<T;E++)for(M=P[E],z=G[E],B=0,N=M.length;B<N;B++)D=n(M[B],z[B],L),a(D.x,D.y,-I)}for(L=v,B=0;B<F;B++)D=y?n(b[B],V[B],L):b[B],w?(p.copy(h.normals[0]).multiplyScalar(D.x),l.copy(h.binormals[0]).multiplyScalar(D.y),f.copy(u[0]).add(p).add(l),a(f.x,f.y,f.z)):a(D.x,D.y,0);for(N=1;N<=_;N++)for(B=0;B<F;B++)D=y?n(b[B],V[B],L):b[B],w?(p.copy(h.normals[N]).multiplyScalar(D.x),l.copy(h.binormals[N]).multiplyScalar(D.y),f.copy(u[N]).add(p).add(l),a(f.x,f.y,f.z)):a(D.x,D.y,d/_*N);for(R=g-1;0<=R;R--){for(N=R/g,I=m*Math.cos(N*Math.PI/2),L=v*Math.sin(N*Math.PI/2),B=0,N=j.length;B<N;B++)D=n(j[B],x[B],L),a(D.x,D.y,d+I);for(E=0,T=P.length;E<T;E++)for(M=P[E],z=G[E],B=0,N=M.length;B<N;B++)D=n(M[B],z[B],L),w?a(D.x,D.y+u[_-1].y,u[_-1].x+I):a(D.x,D.y,d+I)}!function(){if(y){var t=0*F;for(B=0;B<U;B++)k=A[B],s(k[2]+t,k[1]+t,k[0]+t);for(t=F*(_+2*g),B=0;B<U;B++)k=A[B],s(k[0]+t,k[1]+t,k[2]+t)}else{for(B=0;B<U;B++)k=A[B],s(k[2],k[1],k[0]);for(B=0;B<U;B++)k=A[B],s(k[0]+F*_,k[1]+F*_,k[2]+F*_)}}(),function(){var t=0;for(o(j,t),t+=j.length,E=0,T=P.length;E<T;E++)M=P[E],o(M,t),t+=M.length}()},Ne.WorldUVGenerator={generateTopUV:function(t,e,n,i){return t=t.vertices,e=t[e],n=t[n],i=t[i],[new r(e.x,e.y),new r(n.x,n.y),new r(i.x,i.y)]},generateSideWallUV:function(t,e,n,i,o){return t=t.vertices,e=t[e],n=t[n],i=t[i],o=t[o],.01>Math.abs(e.y-n.y)?[new r(e.x,1-e.z),new r(n.x,1-n.z),new r(i.x,1-i.z),new r(o.x,1-o.z)]:[new r(e.y,1-e.z),new r(n.y,1-n.z),new r(i.y,1-i.z),new r(o.y,1-o.z)]}},Ie.prototype=Object.create(Ne.prototype),Ie.prototype.constructor=Ie,De.prototype=Object.create(mt.prototype),De.prototype.constructor=De,ke.prototype=Object.create(ft.prototype),ke.prototype.constructor=ke,Fe.prototype=Object.create(mt.prototype),Fe.prototype.constructor=Fe,Ue.prototype=Object.create(ft.prototype),Ue.prototype.constructor=Ue,Be.prototype=Object.create(ft.prototype),Be.prototype.constructor=Be,ze.prototype=Object.create(mt.prototype),ze.prototype.constructor=ze,Ge.prototype=Object.create(ft.prototype),Ge.prototype.constructor=Ge,Ve.prototype=Object.create(ft.prototype),Ve.prototype.constructor=Ve,Ve.prototype.addShapeList=function(t,e){for(var r=0,n=t.length;r<n;r++)this.addShape(t[r],e);return this},Ve.prototype.addShape=function(t,e){void 0===e&&(e={});var r,n,i,o=e.material,a=void 0===e.UVGenerator?Ne.WorldUVGenerator:e.UVGenerator,s=this.vertices.length;r=t.extractPoints(void 0!==e.curveSegments?e.curveSegments:12);var u=r.shape,h=r.holes;if(!ci.isClockWise(u))for(u=u.reverse(),r=0,n=h.length;r<n;r++)i=h[r],ci.isClockWise(i)&&(h[r]=i.reverse());var l=ci.triangulateShape(u,h);for(r=0,n=h.length;r<n;r++)i=h[r],u=u.concat(i);for(h=u.length,n=l.length,r=0;r<h;r++)i=u[r],this.vertices.push(new c(i.x,i.y,0));for(r=0;r<n;r++)h=l[r],u=h[0]+s,i=h[1]+s,h=h[2]+s,this.faces.push(new st(u,i,h,null,null,o)),this.faceVertexUvs[0].push(a.generateTopUV(this,u,i,h))},$e.prototype=Object.create(mt.prototype),$e.prototype.constructor=$e,He.prototype=Object.create(mt.prototype),He.prototype.constructor=He,We.prototype=Object.create(ft.prototype),We.prototype.constructor=We,qe.prototype=Object.create(We.prototype),qe.prototype.constructor=qe,Xe.prototype=Object.create(He.prototype),Xe.prototype.constructor=Xe,Ye.prototype=Object.create(mt.prototype),Ye.prototype.constructor=Ye,Ke.prototype=Object.create(ft.prototype),Ke.prototype.constructor=Ke,Ze.prototype=Object.create(ft.prototype),Ze.prototype.constructor=Ze;var ui=Object.freeze({WireframeGeometry:me,ParametricGeometry:ge,ParametricBufferGeometry:ve,TetrahedronGeometry:_e,TetrahedronBufferGeometry:be,OctahedronGeometry:we,OctahedronBufferGeometry:xe,IcosahedronGeometry:Me,IcosahedronBufferGeometry:Se,DodecahedronGeometry:Te,DodecahedronBufferGeometry:Ee,PolyhedronGeometry:Ce,PolyhedronBufferGeometry:ye,TubeGeometry:Pe,TubeBufferGeometry:Oe,TorusKnotGeometry:je,TorusKnotBufferGeometry:Ae,TorusGeometry:Le,TorusBufferGeometry:Re,TextGeometry:Ie,SphereBufferGeometry:De,SphereGeometry:ke,RingGeometry:Ue,RingBufferGeometry:Fe,PlaneBufferGeometry:yt,PlaneGeometry:Be,LatheGeometry:Ge,LatheBufferGeometry:ze,ShapeGeometry:Ve,ExtrudeGeometry:Ne,EdgesGeometry:$e,ConeGeometry:qe,ConeBufferGeometry:Xe,CylinderGeometry:We,CylinderBufferGeometry:He,CircleBufferGeometry:Ye,CircleGeometry:Ke,BoxBufferGeometry:gt,BoxGeometry:Ze});Je.prototype=Object.create(q.prototype),Je.prototype.constructor=Je,
-Je.prototype.isShadowMaterial=!0,Qe.prototype=Object.create(q.prototype),Qe.prototype.constructor=Qe,Qe.prototype.isRawShaderMaterial=!0,tr.prototype={constructor:tr,isMultiMaterial:!0,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,n=0,i=r.length;n<i;n++){var o=r[n].toJSON(t);delete o.metadata,e.materials.push(o)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},er.prototype=Object.create(W.prototype),er.prototype.constructor=er,er.prototype.isMeshStandardMaterial=!0,er.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},rr.prototype=Object.create(er.prototype),rr.prototype.constructor=rr,rr.prototype.isMeshPhysicalMaterial=!0,rr.prototype.copy=function(t){return er.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},nr.prototype=Object.create(W.prototype),nr.prototype.constructor=nr,nr.prototype.isMeshPhongMaterial=!0,nr.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},ir.prototype=Object.create(W.prototype),ir.prototype.constructor=ir,ir.prototype.isMeshNormalMaterial=!0,ir.prototype.copy=function(t){return W.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},or.prototype=Object.create(W.prototype),or.prototype.constructor=or,or.prototype.isMeshLambertMaterial=!0,or.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},ar.prototype=Object.create(W.prototype),ar.prototype.constructor=ar,ar.prototype.isLineDashedMaterial=!0,ar.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 hi=Object.freeze({ShadowMaterial:Je,SpriteMaterial:Jt,RawShaderMaterial:Qe,ShaderMaterial:q,PointsMaterial:ce,MultiMaterial:tr,MeshPhysicalMaterial:rr,MeshStandardMaterial:er,MeshPhongMaterial:nr,MeshNormalMaterial:ir,MeshLambertMaterial:or,MeshDepthMaterial:X,MeshBasicMaterial:ct,LineDashedMaterial:ar,LineBasicMaterial:oe,Material:W}),li={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={}}},pi=new sr;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=li.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){e&&e(o),i.manager.itemEnd(t)},0),o;var a=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){var s=a[1],c=!!a[2],a=a[3],a=window.decodeURIComponent(a);c&&(a=window.atob(a));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":u=new ArrayBuffer(a.length);for(var l=new Uint8Array(u),c=0;c<a.length;c++)l[c]=a.charCodeAt(c);"blob"===h&&(u=new Blob([u],{type:s}));break;case"document":u=(new DOMParser).parseFromString(a,s);break;case"json":u=JSON.parse(a);break;default:u=a}window.setTimeout(function(){e&&e(u),i.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){n&&n(e),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;li.add(t,o),200===this.status?(e&&e(o),i.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),i.manager.itemEnd(t)):(n&&n(r),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.itemError(t)},!1),void 0!==this.responseType&&(p.responseType=this.responseType),void 0!==this.withCredentials&&(p.withCredentials=this.withCredentials),p.overrideMimeType&&p.overrideMimeType("text/plain"),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}}),Object.assign(ur.prototype,{load:function(t,e,r,n){function i(i){c.load(t[i],function(t){t=o._parser(t,!0),a[i]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},u+=1,6===u&&(1===t.mipmapCount&&(s.minFilter=1006),s.format=t.format,s.needsUpdate=!0,e&&e(s))},r,n)}var o=this,a=[],s=new pe;s.image=a;var c=new cr(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(t))for(var u=0,h=0,l=t.length;h<l;++h)i(h);else c.load(t,function(t){if(t=o._parser(t,!0),t.isCubemap)for(var r=t.mipmaps.length/t.mipmapCount,n=0;n<r;n++){a[n]={mipmaps:[]};for(var i=0;i<t.mipmapCount;i++)a[n].mipmaps.push(t.mipmaps[n*t.mipmapCount+i]),a[n].format=t.format,a[n].width=t.width,a[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(hr.prototype,{load:function(t,e,r,n){var i=this,o=new ee,a=new cr(this.manager);return a.setResponseType("arraybuffer"),a.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(lr.prototype,{load:function(t,e,r,n){var i=this,o=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(o.onload=function(){o.onload=null,URL.revokeObjectURL(o.src),e&&e(o),i.manager.itemEnd(t)},o.onerror=n,0===t.indexOf("data:"))o.src=t;else{var a=new cr;a.setPath(this.path),a.setResponseType("blob"),a.setWithCredentials(this.withCredentials),a.load(t,function(t){o.src=URL.createObjectURL(t)},r,n)}return i.manager.itemStart(t),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(pr.prototype,{load:function(t,e,r,n){function i(r){a.load(t[r],function(t){o.images[r]=t,s++,6===s&&(o.needsUpdate=!0,e&&e(o))},void 0,n)}var o=new h,a=new lr(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var s=0;for(r=0;r<t.length;++r)i(r);return o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(fr.prototype,{load:function(t,e,r,i){var o=new n,a=new lr(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setWithCredentials(this.withCredentials),a.setPath(this.path),a.load(t,function(r){var n=0<t.search(/\.(jpg|jpeg)$/)||0===t.search(/^data\:image\/jpeg/);o.format=n?1022:1023,o.image=r,o.needsUpdate=!0,void 0!==e&&e(o)},r,i),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),dr.prototype=Object.assign(Object.create(it.prototype),{constructor:dr,isLight:!0,copy:function(t){return it.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){return t=it.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}}),mr.prototype=Object.assign(Object.create(dr.prototype),{constructor:mr,isHemisphereLight:!0,copy:function(t){return dr.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(vr.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}}),gr.prototype=Object.assign(Object.create(vr.prototype),{constructor:gr,isSpotLightShadow:!0,update:function(t){var e=2*Wn.RAD2DEG*t.angle,r=this.mapSize.width/this.mapSize.height;t=t.distance||500;var n=this.camera;e===n.fov&&r===n.aspect&&t===n.far||(n.fov=e,n.aspect=r,n.far=t,n.updateProjectionMatrix())}}),yr.prototype=Object.assign(Object.create(dr.prototype),{constructor:yr,isSpotLight:!0,copy:function(t){return dr.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}}),br.prototype=Object.assign(Object.create(dr.prototype),{constructor:br,isPointLight:!0,copy:function(t){return dr.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),_r.prototype=Object.assign(Object.create(vr.prototype),{constructor:_r}),xr.prototype=Object.assign(Object.create(dr.prototype),{constructor:xr,isDirectionalLight:!0,copy:function(t){return dr.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),wr.prototype=Object.assign(Object.create(dr.prototype),{constructor:wr,isAmbientLight:!0});var fi={arraySlice:function(t,e,r){return fi.isTypedArray(t)?new t.constructor(t.subarray(e,r)):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,a=0;a!==n;++o)for(var s=r[o]*e,c=0;c!==e;++c)i[a++]=t[s+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 a=o[n];if(void 0!==a)if(Array.isArray(a)){do a=o[n],void 0!==a&&(e.push(o.time),r.push.apply(r,a)),o=t[i++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[n],void 0!==a&&(e.push(o.time),a.toArray(r,r.length)),o=t[i++];while(void 0!==o)}else do a=o[n],void 0!==a&&(e.push(o.time),r.push(a)),o=t[i++];while(void 0!==o)}}};Sr.prototype={constructor:Sr,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(o=e[1],t<o&&(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],i=e[r-1],void 0===i)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(Sr.prototype,{beforeStart_:Sr.prototype.copySampleValue_,afterEnd_:Sr.prototype.copySampleValue_}),Mr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Mr,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,r){var n=this.parameterPositions,i=t-2,o=t+1,a=n[i],s=n[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:i=t,a=2*e-r;break;case 2402:i=n.length-2,a=e+n[i]-n[i+1];break;default:i=t,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=t,s=2*r-e;break;case 2402:o=1,s=r+n[1]-n[0];break;default:o=t-1,s=e}t=.5*(r-e),n=this.valueSize,this._weightPrev=t/(e-a),this._weightNext=t/(s-r),this._offsetPrev=i*n,this._offsetNext=o*n},interpolate_:function(t,e,r,n){var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize;t*=a;var s=t-a,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,l=this._weightNext,p=(r-e)/(n-e);for(r=p*p,n=r*p,e=-h*n+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!==a;++r)i[r]=e*o[c+r]+h*o[s+r]+p*o[t+r]+l*o[u+r];return i}}),Er.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Er,interpolate_:function(t,e,r,n){var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize;t*=a;var s=t-a;for(e=(r-e)/(n-e),r=1-e,n=0;n!==a;++n)i[n]=o[s+n]*r+o[t+n]*e;return i}}),Tr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Tr,interpolate_:function(t,e,r,n){return this.copySampleValue_(t-1)}});var di;di={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Tr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Er(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Mr(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(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=fi.arraySlice(r,i,o),this.values=fi.arraySlice(this.values,i*n,o*n)),this},validate:function(){var t=!0,e=this.getValueSize();0!==e-Math.floor(e)&&(console.error("invalid value size in track",this),t=!1);var r=this.times,e=this.values,n=r.length;0===n&&(console.error("track is empty",this),t=!1);for(var i=null,o=0;o!==n;o++){var a=r[o];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,o,a),t=!1;break}if(null!==i&&i>a){console.error("out of order keys",this,o,a,i),t=!1;break}i=a}if(void 0!==e&&fi.isTypedArray(e))for(o=0,r=e.length;o!==r;++o)if(n=e[o],isNaN(n)){console.error("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,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(n)s=!0;else for(var u=a*r,h=u-r,l=u+r,c=0;c!==r;++c){var p=e[u+c];if(p!==e[h+c]||p!==e[l+c]){s=!0;break}}if(s){if(a!==i)for(t[i]=t[a],s=a*r,u=i*r,c=0;c!==r;++c)e[u+c]=e[s+c];++i}}if(0<o){for(t[i]=t[o],s=o*r,u=i*r,c=0;c!==r;++c)e[u+c]=e[s+c];++i}return i!==t.length&&(this.times=fi.arraySlice(t,0,i),this.values=fi.arraySlice(e,0,i*r)),this}},Or.prototype=Object.assign(Object.create(di),{constructor:Or,ValueTypeName:"vector"}),Pr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Pr,interpolate_:function(t,e,r,n){var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize;for(t*=a,e=(r-e)/(n-e),r=t+a;t!==r;t+=4)s.slerpFlat(i,0,o,t-a,o,t,e);return i}}),Ar.prototype=Object.assign(Object.create(di),{constructor:Ar,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Pr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),jr.prototype=Object.assign(Object.create(di),{constructor:jr,ValueTypeName:"number"}),Rr.prototype=Object.assign(Object.create(di),{constructor:Rr,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Lr.prototype=Object.assign(Object.create(di),{constructor:Lr,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Nr.prototype=Object.assign(Object.create(di),{constructor:Nr,ValueTypeName:"color"}),Ir.prototype=di,di.constructor=Ir,Object.assign(Ir,{parse:function(t){if(void 0===t.type)throw Error("track type undefined, can not parse");var e=Ir._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var r=[],n=[];fi.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){var e=t.constructor;if(void 0!==e.toJSON)e=e.toJSON(t);else{var e={name:t.name,times:fi.convertArray(t.times,Array),values:fi.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 jr;case"vector":case"vector2":case"vector3":case"vector4":return Or;case"color":return Nr;case"quaternion":return Ar;case"bool":case"boolean":return Lr;case"string":return Rr}throw Error("Unsupported typeName: "+t)}}),Dr.prototype={constructor:Dr,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(Dr,{parse:function(t){for(var e=[],r=t.tracks,n=1/(t.fps||1),i=0,o=r.length;i!==o;++i)e.push(Ir.parse(r[i]).scale(n));return new Dr(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(Ir.toJSON(r[n]));return t},CreateFromMorphTargetSequence:function(t,e,r,n){for(var i=e.length,o=[],a=0;a<i;a++){var s=[],c=[];s.push((a+i-1)%i,a,(a+1)%i),c.push(0,1,0);var u=fi.getKeyframeOrder(s),s=fi.sortedArray(s,1,u),c=fi.sortedArray(c,1,u);n||0!==s[0]||(s.push(i),c.push(c[0])),o.push(new jr(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/r))}return new Dr(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,a=t.length;o<a;o++){var s=t[o],c=s.name.match(i);if(c&&1<c.length){var u=c[1];(c=n[u])||(n[u]=c=[]),c.push(s)}}t=[];for(u in n)t.push(Dr.CreateFromMorphTargetSequence(u,n[u],e,r));return t},parseAnimation:function(t,e){if(!t)return console.error("  no animation in JSONLoader data"),null;for(var r=function(t,e,r,n,i){if(0!==r.length){var o=[],a=[];fi.flattenJSON(r,o,a,n),0!==o.length&&i.push(new t(e,o,a))}},n=[],i=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var u=s[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(var l=0;l<u[h].morphTargets.length;l++)o[u[h].morphTargets[l]]=-1;for(var p in o){for(var f=[],d=[],l=0;l!==u[h].morphTargets.length;++l){var m=u[h];f.push(m.time),d.push(m.morphTarget===p?1:0)}n.push(new jr(".morphTargetInfluence["+p+"]",f,d))}o=o.length*(a||1)}else h=".bones["+e[c].name+"]",r(Or,h+".position",u,"pos",n),r(Ar,h+".quaternion",u,"rot",n),r(Or,h+".scale",u,"scl",n)}return 0===n.length?null:new Dr(i,o,n)}}),Object.assign(kr.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 hi[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.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)}if(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.materials)for(var o=0,a=t.materials.length;o<a;o++)i.materials.push(this.parse(t.materials[o]));return i}}),Object.assign(Fr.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 mt,r=t.data.index,n={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==r&&(r=new n[r.type](r.array),e.setIndex(new ut(r,1)));var i,o=t.data.attributes;for(i in o){var a=o[i],r=new n[a.type](a.array);e.addAttribute(i,new ut(r,a.itemSize,a.normalized))}if(n=t.data.groups||t.data.drawcalls||t.data.offsets,void 0!==n)for(i=0,r=n.length;i!==r;++i)o=n[i],e.addGroup(o.start,o.count,o.materialIndex);return t=t.data.boundingSphere,void 0!==t&&(n=new c,void 0!==t.center&&n.fromArray(t.center),e.boundingSphere=new K(n,t.radius)),e}}),Ur.prototype={constructor:Ur,crossOrigin:void 0,extractUrlBase:function(t){return t=t.split("/"),1===t.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,e,r;return function(n,i,o){function a(t,r,n,a,s){t=i+t;var u=Ur.Handlers.get(t);return null!==u?t=u.load(t):(e.setCrossOrigin(o),t=e.load(t)),void 0!==r&&(t.repeat.fromArray(r),1!==r[0]&&(t.wrapS=1e3),1!==r[1]&&(t.wrapT=1e3)),void 0!==n&&t.offset.fromArray(n),void 0!==a&&("repeat"===a[0]&&(t.wrapS=1e3),"mirror"===a[0]&&(t.wrapS=1002),"repeat"===a[1]&&(t.wrapT=1e3),"mirror"===a[1]&&(t.wrapT=1002)),void 0!==s&&(t.anisotropy=s),r=Wn.generateUUID(),c[r]=t,r}void 0===t&&(t=new G),void 0===e&&(e=new fr),void 0===r&&(r=new kr);var s,c={},u={uuid:Wn.generateUUID(),type:"MeshLambertMaterial"};for(s in n){var h=n[s];switch(s){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=h;break;case"blending":u.blending=Gn[h];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",s,"is no longer supported.");break;case"colorDiffuse":u.color=t.fromArray(h).getHex();break;case"colorSpecular":u.specular=t.fromArray(h).getHex();break;case"colorEmissive":u.emissive=t.fromArray(h).getHex();break;case"specularCoef":u.shininess=h;break;case"shading":"basic"===h.toLowerCase()&&(u.type="MeshBasicMaterial"),"phong"===h.toLowerCase()&&(u.type="MeshPhongMaterial"),"standard"===h.toLowerCase()&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=a(h,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=a(h,n.mapEmissiveRepeat,n.mapEmissiveOffset,n.mapEmissiveWrap,n.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=a(h,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=a(h,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=a(h,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=h;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=a(h,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=[h,h];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=a(h,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=a(h,n.mapMetalnessRepeat,n.mapMetalnessOffset,n.mapMetalnessWrap,n.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=a(h,n.mapRoughnessRepeat,n.mapRoughnessOffset,n.mapRoughnessWrap,n.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=a(h,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=1;break;case"doubleSided":u.side=2;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=h;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[s]=h;break;case"vertexColors":!0===h&&(u.vertexColors=2),"face"===h&&(u.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",s,h)}}return"MeshBasicMaterial"===u.type&&delete u.emissive,"MeshPhongMaterial"!==u.type&&delete u.specular,1>u.opacity&&(u.transparent=!0),
-r.setTextures(c),r.parse(u)}}()},Ur.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(Br.prototype,{load:function(t,e,r,n){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Ur.prototype.extractUrlBase(t),a=new cr(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(r){r=JSON.parse(r);var n=r.metadata;if(void 0!==n&&(n=n.type,void 0!==n)){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){var n=new ft,o=void 0!==t.scale?1/t.scale:1;return function(e){var i,o,a,s,u,h,l,p,f,d,m,v,g,y=t.faces;h=t.vertices;var b=t.normals,_=t.colors,x=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&x++;for(i=0;i<x;i++)n.faceVertexUvs[i]=[]}for(s=0,u=h.length;s<u;)i=new c,i.x=h[s++]*e,i.y=h[s++]*e,i.z=h[s++]*e,n.vertices.push(i);for(s=0,u=y.length;s<u;)if(e=y[s++],f=1&e,a=2&e,i=8&e,l=16&e,d=32&e,h=64&e,e&=128,f){if(f=new st,f.a=y[s],f.b=y[s+1],f.c=y[s+3],m=new st,m.a=y[s+1],m.b=y[s+2],m.c=y[s+3],s+=4,a&&(a=y[s++],f.materialIndex=a,m.materialIndex=a),a=n.faces.length,i)for(i=0;i<x;i++)for(v=t.uvs[i],n.faceVertexUvs[i][a]=[],n.faceVertexUvs[i][a+1]=[],o=0;4>o;o++)p=y[s++],g=v[2*p],p=v[2*p+1],g=new r(g,p),2!==o&&n.faceVertexUvs[i][a].push(g),0!==o&&n.faceVertexUvs[i][a+1].push(g);if(l&&(l=3*y[s++],f.normal.set(b[l++],b[l++],b[l]),m.normal.copy(f.normal)),d)for(i=0;4>i;i++)l=3*y[s++],d=new c(b[l++],b[l++],b[l]),2!==i&&f.vertexNormals.push(d),0!==i&&m.vertexNormals.push(d);if(h&&(h=y[s++],h=_[h],f.color.setHex(h),m.color.setHex(h)),e)for(i=0;4>i;i++)h=y[s++],h=_[h],2!==i&&f.vertexColors.push(new G(h)),0!==i&&m.vertexColors.push(new G(h));n.faces.push(f),n.faces.push(m)}else{if(f=new st,f.a=y[s++],f.b=y[s++],f.c=y[s++],a&&(a=y[s++],f.materialIndex=a),a=n.faces.length,i)for(i=0;i<x;i++)for(v=t.uvs[i],n.faceVertexUvs[i][a]=[],o=0;3>o;o++)p=y[s++],g=v[2*p],p=v[2*p+1],g=new r(g,p),n.faceVertexUvs[i][a].push(g);if(l&&(l=3*y[s++],f.normal.set(b[l++],b[l++],b[l])),d)for(i=0;3>i;i++)l=3*y[s++],d=new c(b[l++],b[l++],b[l]),f.vertexNormals.push(d);if(h&&(h=y[s++],f.color.setHex(_[h])),e)for(i=0;3>i;i++)h=y[s++],f.vertexColors.push(new G(_[h]));n.faces.push(f)}}(o),function(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var r=0,o=t.skinWeights.length;r<o;r+=e)n.skinWeights.push(new i(t.skinWeights[r],1<e?t.skinWeights[r+1]:0,2<e?t.skinWeights[r+2]:0,3<e?t.skinWeights[r+3]:0));if(t.skinIndices)for(r=0,o=t.skinIndices.length;r<o;r+=e)n.skinIndices.push(new i(t.skinIndices[r],1<e?t.skinIndices[r+1]:0,2<e?t.skinIndices[r+2]:0,3<e?t.skinIndices[r+3]:0));n.bones=t.bones,n.bones&&0<n.bones.length&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)&&console.warn("When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var r=0,i=t.morphTargets.length;r<i;r++){n.morphTargets[r]={},n.morphTargets[r].name=t.morphTargets[r].name,n.morphTargets[r].vertices=[];for(var o=n.morphTargets[r].vertices,a=t.morphTargets[r].vertices,s=0,u=a.length;s<u;s+=3){var h=new c;h.x=a[s]*e,h.y=a[s+1]*e,h.z=a[s+2]*e,o.push(h)}}if(void 0!==t.morphColors&&0<t.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),e=n.faces,o=t.morphColors[0].colors,r=0,i=e.length;r<i;r++)e[r].color.fromArray(o,3*r)}(o),function(){var e=[],r=[];void 0!==t.animation&&r.push(t.animation),void 0!==t.animations&&(t.animations.length?r=r.concat(t.animations):r.push(t.animations));for(var i=0;i<r.length;i++){var o=Dr.parseAnimation(r[i],n.bones);o&&e.push(o)}n.morphTargets&&(r=Dr.CreateClipsFromMorphTargetSequences(n.morphTargets,10),e=e.concat(r)),0<e.length&&(n.animations=e)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:n}:(o=Ur.prototype.initMaterials(t.materials,e,this.crossOrigin),{geometry:n,materials:o})}}),Object.assign(zr.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(t){i.parse(JSON.parse(t),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 Br,n=new Fr,i=0,o=t.length;i<o;i++){var a,s=t[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new ui[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new ui[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new ui[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new ui[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new ui[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new ui[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":a=new ui[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new ui[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new ui[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new ui[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new ui[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=n.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var n=new kr;n.setTextures(e);for(var i=0,o=t.length;i<o;i++){var a=n.parse(t[i]);r[a.uuid]=a}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var n=Dr.parse(t[r]);e.push(n)}return e},parseImages:function(t,e){function r(t){return n.manager.itemStart(t),a.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemError(t)})}var n=this,i={};if(void 0!==t&&0<t.length){var o=new sr(e),a=new lr(o);a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var c=t[o],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.texturePath+c.url;i[c.uuid]=r(u)}}return i},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,a=t.length;o<a;o++){var s=t[o];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new n(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=r(s.mapping,Vn)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=r(s.wrap[0],$n),c.wrapT=r(s.wrap[1],$n)),void 0!==s.minFilter&&(c.minFilter=r(s.minFilter,Hn)),void 0!==s.magFilter&&(c.magFilter=r(s.magFilter,Hn)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),i[s.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)return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}var a;switch(e.type){case"Scene":a=new Kt,void 0!==e.background&&Number.isInteger(e.background)&&(a.background=new G(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new Yt(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new Xt(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":a=new _t(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new xt(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new wr(e.color,e.intensity);break;case"DirectionalLight":a=new xr(e.color,e.intensity);break;case"PointLight":a=new br(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":a=new yr(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new mr(e.color,e.groundColor,e.intensity);break;case"Mesh":a=i(e.geometry);var s=o(e.material);a=a.bones&&0<a.bones.length?new ie(a,s):new vt(a,s);break;case"LOD":a=new te;break;case"Line":a=new ae(i(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new se(i(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new ue(i(e.geometry),o(e.material));break;case"Sprite":a=new Qt(o(e.material));break;case"Group":a=new he;break;default:a=new it}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var c in e.children)a.add(this.parseObject(e.children[c],r,n));if("LOD"===e.type)for(e=e.levels,s=0;s<e.length;s++){var u=e[s];c=a.getObjectByProperty("uuid",u.object),void 0!==c&&a.addLevel(c,u.distance)}return a}}()}),Gr.prototype={constructor:Gr,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},getPoints:function(t){t||(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return e},getSpacedPoints:function(t){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(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),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?e:t*i[o-1];for(var a,s=0,c=o-1;s<=c;)if(r=Math.floor(s+(c-s)/2),a=i[r]-n,0>a)s=r+1;else{if(!(0<a)){c=r;break}c=r-1}return r=c,i[r]===n?r/(o-1):(s=i[r],(r+(n-s)/(i[r+1]-s))/(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=[],a=[],s=[],h=new c,l=new u;for(r=0;r<=t;r++)n=r/t,o[r]=this.getTangentAt(n),o[r].normalize();a[0]=new c,s[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(),a[0].crossVectors(o[0],h),s[0].crossVectors(o[0],a[0]),r=1;r<=t;r++)a[r]=a[r-1].clone(),s[r]=s[r-1].clone(),h.crossVectors(o[r-1],o[r]),h.length()>Number.EPSILON&&(h.normalize(),i=Math.acos(Wn.clamp(o[r-1].dot(o[r]),-1,1)),a[r].applyMatrix4(l.makeRotationAxis(h,i))),s[r].crossVectors(o[r],a[r]);if(!0===e)for(i=Math.acos(Wn.clamp(a[0].dot(a[t]),-1,1)),i/=t,0<o[0].dot(h.crossVectors(a[0],a[t]))&&(i=-i),r=1;r<=t;r++)a[r].applyMatrix4(l.makeRotationAxis(o[r],i*r)),s[r].crossVectors(o[r],a[r]);return{tangents:o,normals:a,binormals:s}}},Gr.create=function(t,e){return t.prototype=Object.create(Gr.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Vr.prototype=Object.create(Gr.prototype),Vr.prototype.constructor=Vr,Vr.prototype.isLineCurve=!0,Vr.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},Vr.prototype.getPointAt=function(t){return this.getPoint(t)},Vr.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},$r.prototype=Object.assign(Object.create(Gr.prototype),{constructor:$r,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 Vr(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.getLengths()},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){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),a=0;a<o.length;a++){var s=o[a];e&&e.equals(s)||(r.push(s),e=s)}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 ft,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}}),Hr.prototype=Object.create(Gr.prototype),Hr.prototype.constructor=Hr,Hr.prototype.isEllipseCurve=!0,Hr.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)};var mi={tangentQuadraticBezier:function(t,e,r,n){return 2*(1-t)*(r-e)+2*t*(n-r)},tangentCubicBezier:function(t,e,r,n,i){return-3*e*(1-t)*(1-t)+3*r*(1-t)*(1-t)-6*t*r*(1-t)+6*t*n*(1-t)-3*t*t*n+3*t*t*i},tangentSpline:function(t,e,r,n,i){return 6*t*t-6*t+(3*t*t-4*t+1)+(-6*t*t+6*t)+(3*t*t-2*t)},interpolate:function(t,e,r,n,i){t=.5*(r-t),n=.5*(n-e);var o=i*i;return(2*e-2*r+t+n)*i*o+(-3*e+3*r-2*t-n)*o+t*i+e}};Wr.prototype=Object.create(Gr.prototype),Wr.prototype.constructor=Wr,Wr.prototype.isSplineCurve=!0,Wr.prototype.getPoint=function(t){var e=this.points;t*=e.length-1;var n=Math.floor(t);t-=n;var i=e[0===n?n:n-1],o=e[n],a=e[n>e.length-2?e.length-1:n+1],e=e[n>e.length-3?e.length-1:n+2],n=mi.interpolate;return new r(n(i.x,o.x,a.x,e.x,t),n(i.y,o.y,a.y,e.y,t))},qr.prototype=Object.create(Gr.prototype),qr.prototype.constructor=qr,qr.prototype.getPoint=function(t){var e=ci.b3;return new r(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},qr.prototype.getTangent=function(t){var e=mi.tangentCubicBezier;return new r(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},Xr.prototype=Object.create(Gr.prototype),Xr.prototype.constructor=Xr,Xr.prototype.getPoint=function(t){var e=ci.b2;return new r(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},Xr.prototype.getTangent=function(t){var e=mi.tangentQuadraticBezier;return new r(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var vi=Object.assign(Object.create($r.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 Vr(this.currentPoint.clone(),new r(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,i){t=new Xr(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,a){t=new qr(this.currentPoint.clone(),new r(t,e),new r(n,i),new r(o,a)),this.curves.push(t),this.currentPoint.set(o,a)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),e=new Wr(e);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,a,s){this.absellipse(t+this.currentPoint.x,e+this.currentPoint.y,r,n,i,o,a,s)},absellipse:function(t,e,r,n,i,o,a,s){t=new Hr(t,e,r,n,i,o,a,s),0<this.curves.length&&(e=t.getPoint(0),e.equals(this.currentPoint)||this.lineTo(e.x,e.y)),this.curves.push(t),t=t.getPoint(1),this.currentPoint.copy(t)}});Yr.prototype=Object.assign(Object.create(vi),{constructor:Yr,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)}}),Kr.prototype=vi,vi.constructor=Kr,Zr.prototype={moveTo:function(t,e){this.currentPath=new Kr,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 Yr;o.curves=i.curves,e.push(o)}return e}function n(t,e){for(var r=e.length,n=!1,i=r-1,o=0;o<r;i=o++){var a=e[i],s=e[o],c=s.x-a.x,u=s.y-a.y;if(Math.abs(u)>Number.EPSILON){if(0>u&&(a=e[o],c=-c,s=e[i],u=-u),!(t.y<a.y||t.y>s.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(i=u*(t.x-a.x)-c*(t.y-a.y),0===i)return!0;0>i||(n=!n)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return n}var i=ci.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return r(o);var a,s,c,u=[];if(1===o.length)return s=o[0],c=new Yr,c.curves=s.curves,u.push(c),u;var h=!i(o[0].getPoints()),h=t?!h:h;c=[];var l,p=[],f=[],d=0;p[d]=void 0,f[d]=[];for(var m=0,v=o.length;m<v;m++)s=o[m],l=s.getPoints(),a=i(l),(a=t?!a:a)?(!h&&p[d]&&d++,p[d]={s:new Yr,p:l},p[d].s.curves=s.curves,h&&d++,f[d]=[]):f[d].push({h:s,p:l[0]});if(!p[0])return r(o);if(1<p.length){for(m=!1,s=[],i=0,o=p.length;i<o;i++)c[i]=[];for(i=0,o=p.length;i<o;i++)for(a=f[i],h=0;h<a.length;h++){for(d=a[h],l=!0,v=0;v<p.length;v++)n(d.p,p[v].p)&&(i!==v&&s.push({froms:i,tos:v,hole:h}),l?(l=!1,c[v].push(d)):m=!0);l&&c[i].push(d)}0<s.length&&(m||(f=c))}for(m=0,i=p.length;m<i;m++)for(c=p[m].s,u.push(c),s=f[m],o=0,a=s.length;o<a;o++)c.holes.push(s[o].h);return u}},Object.assign(Jr.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=0;e=[];for(var a=0;a<t.length;a++){var s;s=i;var c=o,u=n.glyphs[t[a]]||n.glyphs["?"];if(u){var h,l,p,f,d,m,v,g,y=new Zr,b=[],_=ci.b2,x=ci.b3;if(u.o)for(var w=u._cachedOutline||(u._cachedOutline=u.o.split(" ")),S=0,M=w.length;S<M;)switch(w[S++]){case"m":h=w[S++]*s+c,l=w[S++]*s,y.moveTo(h,l);break;case"l":h=w[S++]*s+c,l=w[S++]*s,y.lineTo(h,l);break;case"q":if(h=w[S++]*s+c,l=w[S++]*s,d=w[S++]*s+c,m=w[S++]*s,y.quadraticCurveTo(d,m,h,l),f=b[b.length-1]){p=f.x,f=f.y;for(var E=1;E<=r;E++){var T=E/r;_(T,p,d,h),_(T,f,m,l)}}break;case"b":if(h=w[S++]*s+c,l=w[S++]*s,d=w[S++]*s+c,m=w[S++]*s,v=w[S++]*s+c,g=w[S++]*s,y.bezierCurveTo(d,m,v,g,h,l),f=b[b.length-1])for(p=f.x,f=f.y,E=1;E<=r;E++)T=E/r,x(T,p,d,v,h),x(T,f,m,g,l)}s={offset:u.ha*s,path:y}}else s=void 0;o+=s.offset,e.push(s.path)}for(r=[],n=0,t=e.length;n<t;n++)Array.prototype.push.apply(r,e[n].toShapes());return r}}),Object.assign(Qr.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 Jr(t)}});var gi;Object.assign(en.prototype,{load:function(t,e,r,n){var i=new cr(this.manager);i.setResponseType("arraybuffer"),i.load(t,function(t){tn().decodeAudioData(t,function(t){e(t)})},r,n)}}),Object.assign(rn.prototype,{update:function(){var t,e,r,n,i,o,a,s=new u,c=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||a!==u.zoom){t=this,e=u.focus,r=u.fov,n=u.aspect*this.aspect,i=u.near,o=u.far,a=u.zoom;var h,l=u.projectionMatrix.clone(),p=this.eyeSep/2,f=p*i/e,d=i*Math.tan(Wn.DEG2RAD*r*.5)/a;c.elements[12]=-p,s.elements[12]=p,p=-d*n+f,h=d*n+f,l.elements[0]=2*i/(h-p),l.elements[8]=(h+p)/(h-p),this.cameraL.projectionMatrix.copy(l),p=-d*n-f,h=d*n-f,l.elements[0]=2*i/(h-p),l.elements[8]=(h+p)/(h-p),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(u.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(u.matrixWorld).multiply(s)}}()}),nn.prototype=Object.create(it.prototype),nn.prototype.constructor=nn,on.prototype=Object.assign(Object.create(it.prototype),{constructor:on,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 s,r=new c,n=new c;return function(i){it.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.setPosition(t.x,t.y,t.z),i.setOrientation(n.x,n.y,n.z,o.x,o.y,o.z)}}()}),an.prototype=Object.assign(Object.create(it.prototype),{constructor:an,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.source.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.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}},pause:function(){return!1!==this.hasPlaybackControl?(this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this):void console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){return!1!==this.hasPlaybackControl?(this.source.stop(),this.startTime=0,this.isPlaying=!1,this):void 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){return!1!==this.hasPlaybackControl?(this.playbackRate=t,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate),this):void 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.source.loop},setLoop:function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=t},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),sn.prototype=Object.assign(Object.create(an.prototype),{constructor:sn,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){it.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(cn.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}}),un.prototype={constructor:un,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,i){s.slerpFlat(t,e,t,e,t,r,n)},_lerp:function(t,e,r,n,i){for(var o=1-n,a=0;a!==i;++a){var s=e+a;t[s]=t[s]*o+t[r+a]*n}}},hn.prototype={constructor:hn,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=hn.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("  can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error("  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("  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("  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("  trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}if(o=t[n],void 0===o)console.error("  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("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse 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):void 0!==o.length?(r=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=n;this.getValue=this.GetterByBindingType[r],this.setValue=this.SetterByBindingTypeAndVersioning[r][e]}}else console.error("  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(hn.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:hn.prototype.getValue,_setValue_unbound:hn.prototype.setValue,
-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}]]}),hn.Composite=function(t,e,r){r=r||hn.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)},hn.Composite.prototype={constructor:hn.Composite,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()}},hn.create=function(t,e,r){return t&&t.isAnimationObjectGroup?new hn.Composite(t,e,r):new hn(t,e,r)},hn.parseTrackName=function(t){var e=/^((?:\w+[\/:])*)(\w+)?(?:\.(\w+)(?:\[(.+)\])?)?\.(\w+)(?:\[(.+)\])?$/.exec(t);if(!e)throw Error("cannot parse trackName at all: "+t);if(e={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},null===e.propertyName||0===e.propertyName.length)throw Error("can not parse propertyName from trackName: "+t);return e},hn.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},ln.prototype={constructor:ln,isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,r=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,c=s.length,u=0,h=arguments.length;u!==h;++u){var l=arguments[u],p=l.uuid,f=i[p];if(void 0===f){f=r++,i[p]=f,e.push(l);for(var p=0,d=c;p!==d;++p)s[p].push(new hn(l,o[p],a[p]))}else if(f<n){var m=e[f],v=--n,d=e[v];for(i[d.uuid]=f,e[f]=d,i[p]=v,e[v]=l,p=0,d=c;p!==d;++p){var g=s[p],y=g[f];g[f]=g[v],void 0===y&&(y=new hn(l,o[p],a[p])),g[v]=y}}else e[f]!==m&&console.error("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,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],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 p=i[c],f=p[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,a=o.length,s=0,c=arguments.length;s!==c;++s){var u=arguments[s].uuid,h=i[u];if(void 0!==h)if(delete i[u],h<n){var u=--n,l=e[u],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=a;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=a;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,a=this._parsedPaths,s=this._objects,c=this.nCachedObjects_,u=Array(s.length),n=i.length;for(r[t]=n,o.push(t),a.push(e),i.push(u),r=c,n=s.length;r!==n;++r)u[r]=new hn(s[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,a=o.length-1,s=o[a];e[t[a]]=r,o[r]=s,o.pop(),i[r]=i[a],i.pop(),n[r]=n[a],n.pop()}}},pn.prototype={constructor:pn,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,a=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/a,o[1]=e/a,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){var i=this._startTime;if(null!==i){if(e=(t-i)*r,0>e||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),t=this._updateWeight(t),0<t){e=this._interpolants;for(var i=this._propertyBindings,o=0,a=e.length;o!==a;++o)e[o].evaluate(r),i[o].accumulate(n,t)}},_updateWeight:function(t){var 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){var e=0;if(!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;if(null!==r){var n=r.evaluate(t)[0],e=e*n;t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var r=this._clip.duration,n=this.loop,i=this._loopCount;if(2200===n)t:{if(-1===i&&(this.loopCount=0,this._setEndings(!0,!0,!1)),e>=r)e=r;else{if(!(0>e))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1})}else{if(n=2202===n,-1===i&&(0<=t?(i=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),e>=r||0>e){var o=Math.floor(e/r),e=e-r*o,i=i+Math.abs(o),a=this.repetitions-i;0>a?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0<t?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1})):(0===a?(t=0>t,this._setEndings(t,!t,n)):this._setEndings(!1,!1,n),this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o}))}if(n&&1===(1&i))return this.time=e,r-e}return this.time=e},_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(fn.prototype,e.prototype,{clipAction:function(t,e){var r=e||this._root,n=r.uuid,i="string"==typeof t?Dr.findByName(r,t):t,r=null!==i?i.uuid:t,o=this._actionsByClip[r],a=null;if(void 0!==o){if(a=o.actionByRoot[n],void 0!==a)return a;a=o.knownActions[0],null===i&&(i=a._clip)}return null===i?null:(i=new pn(this,i,e),this._bindAction(i,a),this._addInactiveAction(i,r,n),i)},existingAction:function(t,e){var r=e||this._root,n=r.uuid,r="string"==typeof t?Dr.findByName(r,t):t,r=this._actionsByClip[r?r.uuid:t];return void 0!==r?r.actionByRoot[n]||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,a=0;a!==r;++a){var s=e[a];s.enabled&&s._update(n,t,i,o)}for(t=this._bindings,e=this._nActiveBindings,a=0;a!==e;++a)t[a].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 n=n.knownActions,i=0,o=n.length;i!==o;++i){var a=n[i];this._deactivateAction(a);var s=a._cacheIndex,c=e[e.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,c._cacheIndex=s,e[s]=c,e.pop(),this._removeInactiveBindingsForAction(a)}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(e=this._bindingsByRootAndName[t],void 0!==e)for(var i in e)t=e[i],t.restoreOriginalState(),this._removeInactiveBinding(t)},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),Object.assign(fn.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,n=t._clip.tracks,i=n.length,o=t._propertyBindings,a=t._interpolants,s=r.uuid,c=this._bindingsByRootAndName,u=c[s];for(void 0===u&&(u={},c[s]=u),c=0;c!==i;++c){var h=n[c],l=h.name,p=u[l];if(void 0===p){if(p=o[c],void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,l));continue}p=new un(hn.create(r,l,e&&e._propertyBindings[c].binding.parsedPath),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,l)}o[c]=p,a[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(e=t._propertyBindings,r=0,n=e.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 t=t._cacheIndex,null!==t&&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=this._actions,r=e[e.length-1],n=t._cacheIndex;r._cacheIndex=n,e[n]=r,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,n=this._actionsByClip,i=n[r],o=i.knownActions,a=o[o.length-1],s=t._byClipCacheIndex;a._byClipCacheIndex=s,o[s]=a,o.pop(),t._byClipCacheIndex=null,delete i.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete n[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){t=t._propertyBindings;for(var e=0,r=t.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=t.binding,n=r.rootNode.uuid,r=r.path,i=this._bindingsByRootAndName,o=i[n],a=e[e.length-1];t=t._cacheIndex,a._cacheIndex=t,e[t]=a,e.pop(),delete o[r];t:{for(var s in o)break t;delete i[n]}},_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 Er(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)}),mn.prototype=Object.create(mt.prototype),mn.prototype.constructor=mn,mn.prototype.isInstancedBufferGeometry=!0,mn.prototype.addGroup=function(t,e,r){this.groups.push({start:t,count:e,materialIndex:r})},mn.prototype.copy=function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var r,e=t.attributes;for(r in e)this.addAttribute(r,e[r].clone());for(t=t.groups,r=0,e=t.length;r<e;r++){var n=t[r];this.addGroup(n.start,n.count,n.materialIndex)}return this},vn.prototype={constructor:vn,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},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}},gn.prototype={constructor:gn,isInterleavedBuffer:!0,set needsUpdate(t){!0===t&&this.version++},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)}},yn.prototype=Object.create(gn.prototype),yn.prototype.constructor=yn,yn.prototype.isInstancedInterleavedBuffer=!0,yn.prototype.copy=function(t){return gn.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},bn.prototype=Object.create(ut.prototype),bn.prototype.constructor=bn,bn.prototype.isInstancedBufferAttribute=!0,bn.prototype.copy=function(t){return ut.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},_n.prototype={constructor:_n,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 wn(t,this,r,e),r.sort(xn),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++)wn(t[n],this,r,e);return r.sort(xn),r}},Sn.prototype={constructor:Sn,start:function(){this.oldTime=this.startTime=(performance||Date).now(),this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=(performance||Date).now(),t=(e-this.oldTime)/1e3;this.oldTime=e,this.elapsedTime+=t}return t}},Mn.prototype={constructor:Mn,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(Wn.clamp(t.y/this.radius,-1,1))),this}},En.prototype=Object.create(vt.prototype),En.prototype.constructor=En,En.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)},En.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/i,n={},i=this.geometry,o=0,a=i.morphTargets.length;o<a;o++){var s=i.morphTargets[o].name.match(r);if(s&&1<s.length){var c=s[1];n[c]||(n[c]={start:1/0,end:-(1/0)}),s=n[c],o<s.start&&(s.start=o),o>s.end&&(s.end=o),e||(e=c)}}for(c in n)s=n[c],this.createAnimation(c,s.start,s.end,t);this.firstAnimation=e},En.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},En.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},En.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},En.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},En.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},En.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},En.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},En.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},En.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()")},En.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},En.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+Wn.clamp(Math.floor(n.time/i),0,n.length-1),a=n.weight;o!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*a,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*a,this.morphTargetInfluences[n.lastFrame]=(1-i)*a):this.morphTargetInfluences[n.currentFrame]=a}}},Tn.prototype=Object.create(it.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isImmediateRenderObject=!0,Cn.prototype=Object.create(se.prototype),Cn.prototype.constructor=Cn,Cn.prototype.update=function(){var t=new c,e=new c,r=new Z;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,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,u=a=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(s[l[n[p]]]).applyMatrix4(i),e.copy(d).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1}else if(a&&a.isBufferGeometry)for(n=a.attributes.position,s=a.attributes.normal,p=a=0,f=n.count;p<f;p++)t.set(n.getX(p),n.getY(p),n.getZ(p)).applyMatrix4(i),e.set(s.getX(p),s.getY(p),s.getZ(p)),e.applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1;return o.needsUpdate=!0,this}}(),On.prototype=Object.create(it.prototype),On.prototype.constructor=On,On.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},On.prototype.update=function(){var t=new c,e=new c;return function(){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).multiplyScalar(this.light.intensity)}}(),Pn.prototype=Object.create(se.prototype),Pn.prototype.constructor=Pn,Pn.prototype.getBoneList=function(t){var e=[];t&&t.isBone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,this.getBoneList(t.children[r]));return e},Pn.prototype.update=function(){for(var t=this.geometry,e=(new u).getInverse(this.root.matrixWorld),r=new u,n=0,i=0;i<this.bones.length;i++){var o=this.bones[i];o.parent&&o.parent.isBone&&(r.multiplyMatrices(e,o.matrixWorld),t.vertices[n].setFromMatrixPosition(r),r.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[n+1].setFromMatrixPosition(r),n+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},An.prototype=Object.create(vt.prototype),An.prototype.constructor=An,An.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},An.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},jn.prototype=Object.create(it.prototype),jn.prototype.constructor=jn,jn.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},jn.prototype.update=function(){var t=new c;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),Rn.prototype=Object.create(se.prototype),Rn.prototype.constructor=Rn,Rn.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Ln.prototype=Object.create(se.prototype),Ln.prototype.constructor=Ln,Ln.prototype.update=function(){var t=new c,e=new c,r=new Z;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,a=o.vertices,o=o.faces,s=0,c=0,u=o.length;c<u;c++){var h=o[c],l=h.normal;t.copy(a[h.a]).add(a[h.b]).add(a[h.c]).divideScalar(3).applyMatrix4(n),e.copy(l).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),i.setXYZ(s,t.x,t.y,t.z),s+=1,i.setXYZ(s,e.x,e.y,e.z),s+=1}return i.needsUpdate=!0,this}}(),Nn.prototype=Object.create(it.prototype),Nn.prototype.constructor=Nn,Nn.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},Nn.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).multiplyScalar(this.light.intensity),i.lookAt(r),i.scale.z=r.length()}}(),In.prototype=Object.create(se.prototype),In.prototype.constructor=In,In.prototype.update=function(){function t(t,o,a,s){if(n.set(o,a,s).unproject(i),t=r[t],void 0!==t)for(o=0,a=t.length;o<a;o++)e.vertices[t[o]].copy(n)}var e,r,n=new c,i=new bt;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.verticesNeedUpdate=!0}}(),Dn.prototype=Object.create(vt.prototype),Dn.prototype.constructor=Dn,Dn.prototype.update=function(){this.box.setFromObject(this.object),this.box.getSize(this.scale),this.box.getCenter(this.position)},kn.prototype=Object.create(se.prototype),kn.prototype.constructor=kn,kn.prototype.update=function(){var t=new Y;return function(e){if(e&&e.isBox3?t.copy(e):t.setFromObject(e),!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()}}}();var yi=new mt;yi.addAttribute("position",new pt([0,0,0,0,1,0],3));var bi=new He(0,.5,1,5,1);bi.translate(0,-.5,0),Fn.prototype=Object.create(it.prototype),Fn.prototype.constructor=Fn,Fn.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))}}(),Fn.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()},Fn.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},Un.prototype=Object.create(se.prototype),Un.prototype.constructor=Un;var _i=function(){function t(){}var e=new c,r=new t,n=new t,i=new t;return t.prototype.init=function(t,e,r,n){this.c0=t,this.c1=r,this.c2=-3*t+3*e-2*r-n,this.c3=2*t-2*e+r+n},t.prototype.initNonuniformCatmullRom=function(t,e,r,n,i,o,a){this.init(e,r,((e-t)/i-(r-t)/(i+o)+(r-e)/o)*o,((r-e)/o-(n-e)/(o+a)+(n-r)/a)*o)},t.prototype.initCatmullRom=function(t,e,r,n,i){this.init(e,r,i*(r-t),i*(n-e))},t.prototype.calc=function(t){var e=t*t;return this.c0+this.c1*t+this.c2*e+this.c3*e*t},Gr.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s=this.points;a=s.length,2>a&&console.log("duh, you need at least 2 points"),t*=a-(this.closed?0:1),o=Math.floor(t),t-=o,this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/s.length)+1)*s.length:0===t&&o===a-1&&(o=a-2,t=1);var u,h,l;if(this.closed||0<o?u=s[(o-1)%a]:(e.subVectors(s[0],s[1]).add(s[0]),u=e),h=s[o%a],l=s[(o+1)%a],this.closed||o+2<a?s=s[(o+2)%a]:(e.subVectors(s[a-1],s[a-2]).add(s[a-1]),s=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var p="chordal"===this.type?.5:.25;a=Math.pow(u.distanceToSquared(h),p),o=Math.pow(h.distanceToSquared(l),p),p=Math.pow(l.distanceToSquared(s),p),1e-4>o&&(o=1),1e-4>a&&(a=o),1e-4>p&&(p=o),r.initNonuniformCatmullRom(u.x,h.x,l.x,s.x,a,o,p),n.initNonuniformCatmullRom(u.y,h.y,l.y,s.y,a,o,p),i.initNonuniformCatmullRom(u.z,h.z,l.z,s.z,a,o,p)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,r.initCatmullRom(u.x,h.x,l.x,s.x,a),n.initCatmullRom(u.y,h.y,l.y,s.y,a),i.initCatmullRom(u.z,h.z,l.z,s.z,a));return new c(r.calc(t),n.calc(t),i.calc(t))})}();Bn.prototype=Object.create(_i.prototype);var xi=Gr.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0===t?[]:t},function(t){var e=this.points;t*=e.length-1;var r=Math.floor(t);t-=r;var n=e[0==r?r:r-1],i=e[r],o=e[r>e.length-2?e.length-1:r+1],e=e[r>e.length-3?e.length-1:r+2],r=mi.interpolate;return new c(r(n.x,i.x,o.x,e.x,t),r(n.y,i.y,o.y,e.y,t),r(n.z,i.z,o.z,e.z,t))}),wi=Gr.create(function(t,e,r,n){this.v0=t,this.v1=e,this.v2=r,this.v3=n},function(t){var e=ci.b3;return new c(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),Si=Gr.create(function(t,e,r){this.v0=t,this.v1=e,this.v2=r},function(t){var e=ci.b2;
-return new c(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),Mi=Gr.create(function(t,e){this.v1=t,this.v2=e},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});zn.prototype=Object.create(Hr.prototype),zn.prototype.constructor=zn,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(Y.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)}}),Object.assign(ot.prototype,{center:function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)}}),Object.assign(Z.prototype,{multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}}),Object.assign(u.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},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(t){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,e){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}),Object.assign(J.prototype,{isIntersectionLine:function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)}}),Object.assign(s.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(et.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(Yr.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ne(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ve(this,t)}}),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)}}),Object.assign(it.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(t){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(it.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(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(te.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),_t.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(dr.prototype,{onlyShadow:{set:function(t){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(t){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(t){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(ut.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.assign(mt.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(mt.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(W.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new G}}}),Object.defineProperties(nr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(t){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(q.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}}}),e.prototype=Object.assign(Object.create({constructor:e,apply:function(t){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(t,this)}}),e.prototype),Object.defineProperties(dn.prototype,{dynamic:{set:function(t){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.assign(qt.prototype,{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 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(qt.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(tt.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}}}),Object.assign(an.prototype,{load:function(t){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var e=this;return(new en).load(t,function(t){e.setBuffer(t)}),this}}),Object.assign(cn.prototype,{getData:function(t){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()}}),t.WebGLRenderTargetCube=a,t.WebGLRenderTarget=o,t.WebGLRenderer=qt,t.ShaderLib=ni,t.UniformsLib=ri,t.UniformsUtils=Qn,t.ShaderChunk=ti,t.FogExp2=Xt,t.Fog=Yt,t.Scene=Kt,t.LensFlare=Zt,t.Sprite=Qt,t.LOD=te,t.SkinnedMesh=ie,t.Skeleton=re,t.Bone=ne,t.Mesh=vt,t.LineSegments=se,t.Line=ae,t.Points=ue,t.Group=he,t.VideoTexture=le,t.DataTexture=ee,t.CompressedTexture=pe,t.CubeTexture=h,t.CanvasTexture=fe,t.DepthTexture=de,t.TextureIdCount=function(){return qn++},t.Texture=n,t.MaterialIdCount=function(){return ii++},t.CompressedTextureLoader=ur,t.BinaryTextureLoader=hr,t.DataTextureLoader=hr,t.CubeTextureLoader=pr,t.TextureLoader=fr,t.ObjectLoader=zr,t.MaterialLoader=kr,t.BufferGeometryLoader=Fr,t.DefaultLoadingManager=pi,t.LoadingManager=sr,t.JSONLoader=Br,t.ImageLoader=lr,t.FontLoader=Qr,t.XHRLoader=cr,t.Loader=Ur,t.Cache=li,t.AudioLoader=en,t.SpotLightShadow=gr,t.SpotLight=yr,t.PointLight=br,t.HemisphereLight=mr,t.DirectionalLightShadow=_r,t.DirectionalLight=xr,t.AmbientLight=wr,t.LightShadow=vr,t.Light=dr,t.StereoCamera=rn,t.PerspectiveCamera=_t,t.OrthographicCamera=xt,t.CubeCamera=nn,t.Camera=bt,t.AudioListener=on,t.PositionalAudio=sn,t.getAudioContext=tn,t.AudioAnalyser=cn,t.Audio=an,t.VectorKeyframeTrack=Or,t.StringKeyframeTrack=Rr,t.QuaternionKeyframeTrack=Ar,t.NumberKeyframeTrack=jr,t.ColorKeyframeTrack=Nr,t.BooleanKeyframeTrack=Lr,t.PropertyMixer=un,t.PropertyBinding=hn,t.KeyframeTrack=Ir,t.AnimationUtils=fi,t.AnimationObjectGroup=ln,t.AnimationMixer=fn,t.AnimationClip=Dr,t.Uniform=dn,t.InstancedBufferGeometry=mn,t.BufferGeometry=mt,t.GeometryIdCount=function(){return ai++},t.Geometry=ft,t.InterleavedBufferAttribute=vn,t.InstancedInterleavedBuffer=yn,t.InterleavedBuffer=gn,t.InstancedBufferAttribute=bn,t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new ut(t,e).setDynamic(!0)},t.Float64Attribute=function(t,e){return new ut(new Float64Array(t),e)},t.Float32Attribute=pt,t.Uint32Attribute=lt,t.Int32Attribute=function(t,e){return new ut(new Int32Array(t),e)},t.Uint16Attribute=ht,t.Int16Attribute=function(t,e){return new ut(new Int16Array(t),e)},t.Uint8ClampedAttribute=function(t,e){return new ut(new Uint8ClampedArray(t),e)},t.Uint8Attribute=function(t,e){return new ut(new Uint8Array(t),e)},t.Int8Attribute=function(t,e){return new ut(new Int8Array(t),e)},t.BufferAttribute=ut,t.Face3=st,t.Object3DIdCount=function(){return oi++},t.Object3D=it,t.Raycaster=_n,t.Layers=nt,t.EventDispatcher=e,t.Clock=Sn,t.QuaternionLinearInterpolant=Pr,t.LinearInterpolant=Er,t.DiscreteInterpolant=Tr,t.CubicInterpolant=Mr,t.Interpolant=Sr,t.Triangle=at,t.Spline=function(t){function e(t,e,r,n,i,o,a){return t=.5*(r-t),n=.5*(n-e),(2*(e-r)+t+n)*a+(-3*(e-r)-2*t-n)*o+t*i+e}this.points=t;var r,n,i,o,a,s,u,h,l,p=[],f={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return r=(this.points.length-1)*t,n=Math.floor(r),i=r-n,p[0]=0===n?n:n-1,p[1]=n,p[2]=n>this.points.length-2?this.points.length-1:n+1,p[3]=n>this.points.length-3?this.points.length-1:n+2,s=this.points[p[0]],u=this.points[p[1]],h=this.points[p[2]],l=this.points[p[3]],o=i*i,a=i*o,f.x=e(s.x,u.x,h.x,l.x,i,o,a),f.y=e(s.y,u.y,h.y,l.y,i,o,a),f.z=e(s.z,u.z,h.z,l.z,i,o,a),f},this.getControlPointsArray=function(){var t,e,r=this.points.length,n=[];for(t=0;t<r;t++)e=this.points[t],n[t]=[e.x,e.y,e.z];return n},this.getLength=function(t){var e,r,n,i=0,o=new c,a=new c,s=[],u=0;for(s[0]=0,t||(t=100),r=this.points.length*t,o.copy(this.points[0]),t=1;t<r;t++)e=t/r,n=this.getPoint(e),a.copy(n),u+=a.distanceTo(o),o.copy(n),e*=this.points.length-1,e=Math.floor(e),e!==i&&(s[e]=u,i=e);return s[s.length]=u,{chunks:s,total:u}},this.reparametrizeByArcLength=function(t){var e,r,n,i,o,a,s=[],u=new c,h=this.getLength();for(s.push(u.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(r=h.chunks[e]-h.chunks[e-1],a=Math.ceil(t*r/h.total),i=(e-1)/(this.points.length-1),o=e/(this.points.length-1),r=1;r<a-1;r++)n=i+1/a*r*(o-i),n=this.getPoint(n),s.push(u.copy(n).clone());s.push(u.copy(this.points[e]).clone())}this.points=s}},t.Math=Wn,t.Spherical=Mn,t.Plane=J,t.Frustum=Q,t.Sphere=K,t.Ray=et,t.Matrix4=u,t.Matrix3=Z,t.Box3=Y,t.Box2=V,t.Line3=ot,t.Euler=rt,t.Vector4=i,t.Vector3=c,t.Vector2=r,t.Quaternion=s,t.ColorKeywords=ei,t.Color=G,t.MorphBlendMesh=En,t.ImmediateRenderObject=Tn,t.VertexNormalsHelper=Cn,t.SpotLightHelper=On,t.SkeletonHelper=Pn,t.PointLightHelper=An,t.HemisphereLightHelper=jn,t.GridHelper=Rn,t.FaceNormalsHelper=Ln,t.DirectionalLightHelper=Nn,t.CameraHelper=In,t.BoundingBoxHelper=Dn,t.BoxHelper=kn,t.ArrowHelper=Fn,t.AxisHelper=Un,t.ClosedSplineCurve3=Bn,t.CatmullRomCurve3=_i,t.SplineCurve3=xi,t.CubicBezierCurve3=wi,t.QuadraticBezierCurve3=Si,t.LineCurve3=Mi,t.ArcCurve=zn,t.EllipseCurve=Hr,t.SplineCurve=Wr,t.CubicBezierCurve=qr,t.QuadraticBezierCurve=Xr,t.LineCurve=Vr,t.Shape=Yr,t.ShapePath=Zr,t.Path=Kr,t.Font=Jr,t.CurvePath=$r,t.Curve=Gr,t.ShapeUtils=ci,t.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new he,n=0,i=e.length;n<i;n++)r.add(new vt(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){var n=new u;n.getInverse(r.matrixWorld),t.applyMatrix(n),e.remove(t),r.add(t)}},t.CurveUtils=mi,t.WireframeGeometry=me,t.ParametricGeometry=ge;t.ParametricBufferGeometry=ve;t.TetrahedronGeometry=_e,t.TetrahedronBufferGeometry=be,t.OctahedronGeometry=we,t.OctahedronBufferGeometry=xe,t.IcosahedronGeometry=Me,t.IcosahedronBufferGeometry=Se,t.DodecahedronGeometry=Te,t.DodecahedronBufferGeometry=Ee,t.PolyhedronGeometry=Ce,t.PolyhedronBufferGeometry=ye,t.TubeGeometry=Pe,t.TubeBufferGeometry=Oe,t.TorusKnotGeometry=je,t.TorusKnotBufferGeometry=Ae,t.TorusGeometry=Le,t.TorusBufferGeometry=Re,t.TextGeometry=Ie,t.SphereBufferGeometry=De,t.SphereGeometry=ke,t.RingGeometry=Ue,t.RingBufferGeometry=Fe,t.PlaneBufferGeometry=yt,t.PlaneGeometry=Be,t.LatheGeometry=Ge,t.LatheBufferGeometry=ze,t.ShapeGeometry=Ve,t.ExtrudeGeometry=Ne,t.EdgesGeometry=$e,t.ConeGeometry=qe,t.ConeBufferGeometry=Xe,t.CylinderGeometry=We,t.CylinderBufferGeometry=He,t.CircleBufferGeometry=Ye,t.CircleGeometry=Ke,t.BoxBufferGeometry=gt,t.BoxGeometry=Ze,t.ShadowMaterial=Je,t.SpriteMaterial=Jt,t.RawShaderMaterial=Qe,t.ShaderMaterial=q,t.PointsMaterial=ce,t.MultiMaterial=tr,t.MeshPhysicalMaterial=rr,t.MeshStandardMaterial=er,t.MeshPhongMaterial=nr,t.MeshNormalMaterial=ir,t.MeshLambertMaterial=or,t.MeshDepthMaterial=X,t.MeshBasicMaterial=ct,t.LineDashedMaterial=ar,t.LineBasicMaterial=oe,t.Material=W,t.REVISION="82",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.BlendingMode=Gn,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.TextureMapping=Vn,t.RepeatWrapping=1e3,t.ClampToEdgeWrapping=1001,t.MirroredRepeatWrapping=1002,t.TextureWrapping=$n,t.NearestFilter=1003,t.NearestMipMapNearestFilter=1004,t.NearestMipMapLinearFilter=1005,t.LinearFilter=1006,t.LinearMipMapNearestFilter=1007,t.LinearMipMapLinearFilter=1008,t.TextureFilter=Hn,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=Ze,t.Face4=function(t,e,r,n,i,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new st(t,e,r,i,o,a)},t.LineStrip=0,t.LinePieces=1,t.MeshFaceMaterial=tr,t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ue(t,e)},t.Particle=Qt,t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ue(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ce(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ce(t)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ce(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.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new se(new $e(t.geometry),new oe({color:void 0!==e?e:16777215}))},t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new se(new me(t.geometry),new oe({color:void 0!==e?e:16777215}))},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 fr;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 pr;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(t,e){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});Object.defineProperty(t,"AudioContext",{get:function(){return t.getAudioContext()}})})},{}],158:[function(e,r,n){(function(){function e(t){function e(e,r,n,i,o,a){for(;o>=0&&o<a;o+=t){var s=i?i[o]:o;n=r(n,e[s],s,e)}return n}return function(r,n,i,o){n=w(n,o,4);var a=!P(r)&&x.keys(r),s=(a||r).length,c=t>0?0:s-1;return arguments.length<3&&(i=r[a?a[c]:c],c+=t),e(r,n,i,a,c,s)}}function i(t){return function(e,r,n){r=S(r,n);for(var i=O(e),o=t>0?0:i-1;o>=0&&o<i;o+=t)if(r(e[o],o,e))return o;return-1}}function o(t,e,r){return function(n,i,o){var a=0,s=O(n);if("number"==typeof o)t>0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(r&&o&&s)return o=r(n,i),n[o]===i?o:-1;if(i!==i)return o=e(f.call(n,a,s),x.isNaN),o>=0?o+a:-1;for(o=t>0?a:s-1;o>=0&&o<s;o+=t)if(n[o]===i)return o;return-1}}function a(t,e){var r=N.length,n=t.constructor,i=x.isFunction(n)&&n.prototype||h,o="constructor";for(x.has(t,o)&&!x.contains(e,o)&&e.push(o);r--;)o=N[r],o in t&&t[o]!==i[o]&&!x.contains(e,o)&&e.push(o)}var s=this,c=s._,u=Array.prototype,h=Object.prototype,l=Function.prototype,p=u.push,f=u.slice,d=h.toString,m=h.hasOwnProperty,v=Array.isArray,g=Object.keys,y=l.bind,b=Object.create,_=function(){},x=function(t){return t instanceof x?t:this instanceof x?void(this._wrapped=t):new x(t)};"undefined"!=typeof n?("undefined"!=typeof r&&r.exports&&(n=r.exports=x),n._=x):s._=x,x.VERSION="1.8.3";var w=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)}},S=function(t,e,r){return null==t?x.identity:x.isFunction(t)?w(t,e,r):x.isObject(t)?x.matcher(t):x.property(t)};x.iteratee=function(t,e){return S(t,e,1/0)};var M=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],a=t(o),s=a.length,c=0;c<s;c++){var u=a[c];e&&void 0!==r[u]||(r[u]=o[u])}return r}},E=function(t){if(!x.isObject(t))return{};if(b)return b(t);_.prototype=t;var e=new _;return _.prototype=null,e},T=function(t){return function(e){return null==e?void 0:e[t]}},C=Math.pow(2,53)-1,O=T("length"),P=function(t){var e=O(t);return"number"==typeof e&&e>=0&&e<=C};x.each=x.forEach=function(t,e,r){e=w(e,r);var n,i;if(P(t))for(n=0,i=t.length;n<i;n++)e(t[n],n,t);else{var o=x.keys(t);for(n=0,i=o.length;n<i;n++)e(t[o[n]],o[n],t)}return t},x.map=x.collect=function(t,e,r){e=S(e,r);for(var n=!P(t)&&x.keys(t),i=(n||t).length,o=Array(i),a=0;a<i;a++){var s=n?n[a]:a;o[a]=e(t[s],s,t)}return o},x.reduce=x.foldl=x.inject=e(1),x.reduceRight=x.foldr=e(-1),x.find=x.detect=function(t,e,r){var n;if(n=P(t)?x.findIndex(t,e,r):x.findKey(t,e,r),void 0!==n&&n!==-1)return t[n]},x.filter=x.select=function(t,e,r){var n=[];return e=S(e,r),x.each(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n},x.reject=function(t,e,r){return x.filter(t,x.negate(S(e)),r)},x.every=x.all=function(t,e,r){e=S(e,r);for(var n=!P(t)&&x.keys(t),i=(n||t).length,o=0;o<i;o++){var a=n?n[o]:o;if(!e(t[a],a,t))return!1}return!0},x.some=x.any=function(t,e,r){e=S(e,r);for(var n=!P(t)&&x.keys(t),i=(n||t).length,o=0;o<i;o++){var a=n?n[o]:o;if(e(t[a],a,t))return!0}return!1},x.contains=x.includes=x.include=function(t,e,r,n){return P(t)||(t=x.values(t)),("number"!=typeof r||n)&&(r=0),x.indexOf(t,e,r)>=0},x.invoke=function(t,e){var r=f.call(arguments,2),n=x.isFunction(e);return x.map(t,function(t){var i=n?e:t[e];return null==i?i:i.apply(t,r)})},x.pluck=function(t,e){return x.map(t,x.property(e))},x.where=function(t,e){return x.filter(t,x.matcher(e))},x.findWhere=function(t,e){return x.find(t,x.matcher(e))},x.max=function(t,e,r){var n,i,o=-(1/0),a=-(1/0);if(null==e&&null!=t){t=P(t)?t:x.values(t);for(var s=0,c=t.length;s<c;s++)n=t[s],n>o&&(o=n)}else e=S(e,r),x.each(t,function(t,r,n){i=e(t,r,n),(i>a||i===-(1/0)&&o===-(1/0))&&(o=t,a=i)});return o},x.min=function(t,e,r){var n,i,o=1/0,a=1/0;if(null==e&&null!=t){t=P(t)?t:x.values(t);for(var s=0,c=t.length;s<c;s++)n=t[s],n<o&&(o=n)}else e=S(e,r),x.each(t,function(t,r,n){i=e(t,r,n),(i<a||i===1/0&&o===1/0)&&(o=t,a=i)});return o},x.shuffle=function(t){for(var e,r=P(t)?t:x.values(t),n=r.length,i=Array(n),o=0;o<n;o++)e=x.random(0,o),e!==o&&(i[o]=i[e]),i[e]=r[o];return i},x.sample=function(t,e,r){return null==e||r?(P(t)||(t=x.values(t)),t[x.random(t.length-1)]):x.shuffle(t).slice(0,Math.max(0,e))},x.sortBy=function(t,e,r){return e=S(e,r),x.pluck(x.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 A=function(t){return function(e,r,n){var i={};return r=S(r,n),x.each(e,function(n,o){var a=r(n,o,e);t(i,n,a)}),i}};x.groupBy=A(function(t,e,r){x.has(t,r)?t[r].push(e):t[r]=[e]}),x.indexBy=A(function(t,e,r){t[r]=e}),x.countBy=A(function(t,e,r){x.has(t,r)?t[r]++:t[r]=1}),x.toArray=function(t){return t?x.isArray(t)?f.call(t):P(t)?x.map(t,x.identity):x.values(t):[]},x.size=function(t){return null==t?0:P(t)?t.length:x.keys(t).length},x.partition=function(t,e,r){e=S(e,r);var n=[],i=[];return x.each(t,function(t,r,o){(e(t,r,o)?n:i).push(t)}),[n,i]},x.first=x.head=x.take=function(t,e,r){if(null!=t)return null==e||r?t[0]:x.initial(t,t.length-e)},x.initial=function(t,e,r){return f.call(t,0,Math.max(0,t.length-(null==e||r?1:e)))},x.last=function(t,e,r){if(null!=t)return null==e||r?t[t.length-1]:x.rest(t,Math.max(0,t.length-e))},x.rest=x.tail=x.drop=function(t,e,r){return f.call(t,null==e||r?1:e)},x.compact=function(t){return x.filter(t,x.identity)};var j=function(t,e,r,n){for(var i=[],o=0,a=n||0,s=O(t);a<s;a++){var c=t[a];if(P(c)&&(x.isArray(c)||x.isArguments(c))){e||(c=j(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};x.flatten=function(t,e){return j(t,e,!1)},x.without=function(t){return x.difference(t,f.call(arguments,1))},x.uniq=x.unique=function(t,e,r,n){x.isBoolean(e)||(n=r,r=e,e=!1),null!=r&&(r=S(r,n));for(var i=[],o=[],a=0,s=O(t);a<s;a++){var c=t[a],u=r?r(c,a,t):c;e?(a&&o===u||i.push(c),o=u):r?x.contains(o,u)||(o.push(u),i.push(c)):x.contains(i,c)||i.push(c)}return i},x.union=function(){return x.uniq(j(arguments,!0,!0))},x.intersection=function(t){for(var e=[],r=arguments.length,n=0,i=O(t);n<i;n++){var o=t[n];if(!x.contains(e,o)){for(var a=1;a<r&&x.contains(arguments[a],o);a++);a===r&&e.push(o)}}return e},x.difference=function(t){var e=j(arguments,!0,!0,1);return x.filter(t,function(t){return!x.contains(e,t)})},x.zip=function(){return x.unzip(arguments)},x.unzip=function(t){for(var e=t&&x.max(t,O).length||0,r=Array(e),n=0;n<e;n++)r[n]=x.pluck(t,n);return r},x.object=function(t,e){for(var r={},n=0,i=O(t);n<i;n++)e?r[t[n]]=e[n]:r[t[n][0]]=t[n][1];return r},x.findIndex=i(1),x.findLastIndex=i(-1),x.sortedIndex=function(t,e,r,n){r=S(r,n,1);for(var i=r(e),o=0,a=O(t);o<a;){var s=Math.floor((o+a)/2);r(t[s])<i?o=s+1:a=s}return o},x.indexOf=o(1,x.findIndex,x.sortedIndex),x.lastIndexOf=o(-1,x.findLastIndex),x.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 R=function(t,e,r,n,i){if(!(n instanceof e))return t.apply(r,i);var o=E(t.prototype),a=t.apply(o,i);return x.isObject(a)?a:o};x.bind=function(t,e){if(y&&t.bind===y)return y.apply(t,f.call(arguments,1));if(!x.isFunction(t))throw new TypeError("Bind must be called on a function");var r=f.call(arguments,2),n=function(){return R(t,n,e,this,r.concat(f.call(arguments)))};return n},x.partial=function(t){var e=f.call(arguments,1),r=function(){for(var n=0,i=e.length,o=Array(i),a=0;a<i;a++)o[a]=e[a]===x?arguments[n++]:e[a];for(;n<arguments.length;)o.push(arguments[n++]);return R(t,r,this,this,o)};return r},x.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++)r=arguments[e],t[r]=x.bind(t[r],t);return t},x.memoize=function(t,e){var r=function(n){var i=r.cache,o=""+(e?e.apply(this,arguments):n);return x.has(i,o)||(i[o]=t.apply(this,arguments)),i[o]};return r.cache={},r},x.delay=function(t,e){var r=f.call(arguments,2);return setTimeout(function(){return t.apply(null,r)},e)},x.defer=x.partial(x.delay,x,1),x.throttle=function(t,e,r){var n,i,o,a=null,s=0;r||(r={});var c=function(){s=r.leading===!1?0:x.now(),a=null,o=t.apply(n,i),a||(n=i=null)};return function(){var u=x.now();s||r.leading!==!1||(s=u);var h=e-(u-s);return n=this,i=arguments,h<=0||h>e?(a&&(clearTimeout(a),a=null),s=u,o=t.apply(n,i),a||(n=i=null)):a||r.trailing===!1||(a=setTimeout(c,h)),o}},x.debounce=function(t,e,r){var n,i,o,a,s,c=function(){var u=x.now()-a;u<e&&u>=0?n=setTimeout(c,e-u):(n=null,r||(s=t.apply(o,i),n||(o=i=null)))};return function(){o=this,i=arguments,a=x.now();var u=r&&!n;return n||(n=setTimeout(c,e)),u&&(s=t.apply(o,i),o=i=null),s}},x.wrap=function(t,e){return x.partial(e,t)},x.negate=function(t){return function(){return!t.apply(this,arguments)}},x.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}},x.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},x.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},x.once=x.partial(x.before,2);var L=!{toString:null}.propertyIsEnumerable("toString"),N=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];x.keys=function(t){if(!x.isObject(t))return[];if(g)return g(t);var e=[];for(var r in t)x.has(t,r)&&e.push(r);return L&&a(t,e),e},x.allKeys=function(t){if(!x.isObject(t))return[];var e=[];for(var r in t)e.push(r);return L&&a(t,e),e},x.values=function(t){for(var e=x.keys(t),r=e.length,n=Array(r),i=0;i<r;i++)n[i]=t[e[i]];return n},x.mapObject=function(t,e,r){e=S(e,r);for(var n,i=x.keys(t),o=i.length,a={},s=0;s<o;s++)n=i[s],a[n]=e(t[n],n,t);return a},x.pairs=function(t){for(var e=x.keys(t),r=e.length,n=Array(r),i=0;i<r;i++)n[i]=[e[i],t[e[i]]];return n},x.invert=function(t){for(var e={},r=x.keys(t),n=0,i=r.length;n<i;n++)e[t[r[n]]]=r[n];return e},x.functions=x.methods=function(t){var e=[];for(var r in t)x.isFunction(t[r])&&e.push(r);return e.sort()},x.extend=M(x.allKeys),x.extendOwn=x.assign=M(x.keys),x.findKey=function(t,e,r){e=S(e,r);for(var n,i=x.keys(t),o=0,a=i.length;o<a;o++)if(n=i[o],e(t[n],n,t))return n},x.pick=function(t,e,r){var n,i,o={},a=t;if(null==a)return o;x.isFunction(e)?(i=x.allKeys(a),n=w(e,r)):(i=j(arguments,!1,!1,1),n=function(t,e,r){return e in r},a=Object(a));for(var s=0,c=i.length;s<c;s++){var u=i[s],h=a[u];n(h,u,a)&&(o[u]=h)}return o},x.omit=function(t,e,r){if(x.isFunction(e))e=x.negate(e);else{var n=x.map(j(arguments,!1,!1,1),String);e=function(t,e){return!x.contains(n,e)}}return x.pick(t,e,r)},x.defaults=M(x.allKeys,!0),x.create=function(t,e){var r=E(t);return e&&x.extendOwn(r,e),r},x.clone=function(t){return x.isObject(t)?x.isArray(t)?t.slice():x.extend({},t):t},x.tap=function(t,e){return e(t),t},x.isMatch=function(t,e){var r=x.keys(e),n=r.length;if(null==t)return!n;for(var i=Object(t),o=0;o<n;o++){var a=r[o];if(e[a]!==i[a]||!(a in i))return!1}return!0};var I=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 x&&(t=t._wrapped),e instanceof x&&(e=e._wrapped);var i=d.call(t);if(i!==d.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 a=t.constructor,s=e.constructor;if(a!==s&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(s)&&s instanceof s)&&"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,c!==e.length)return!1;for(;c--;)if(!I(t[c],e[c],r,n))return!1}else{var u,h=x.keys(t);if(c=h.length,x.keys(e).length!==c)return!1;for(;c--;)if(u=h[c],!x.has(e,u)||!I(t[u],e[u],r,n))return!1}return r.pop(),n.pop(),!0};x.isEqual=function(t,e){return I(t,e)},x.isEmpty=function(t){return null==t||(P(t)&&(x.isArray(t)||x.isString(t)||x.isArguments(t))?0===t.length:0===x.keys(t).length)},x.isElement=function(t){return!(!t||1!==t.nodeType)},x.isArray=v||function(t){return"[object Array]"===d.call(t)},x.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},x.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){x["is"+t]=function(e){return d.call(e)==="[object "+t+"]"}}),x.isArguments(arguments)||(x.isArguments=function(t){return x.has(t,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(x.isFunction=function(t){return"function"==typeof t||!1}),x.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},x.isNaN=function(t){return x.isNumber(t)&&t!==+t},x.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"===d.call(t)},x.isNull=function(t){return null===t},x.isUndefined=function(t){return void 0===t},x.has=function(t,e){return null!=t&&m.call(t,e)},x.noConflict=function(){return s._=c,this},x.identity=function(t){return t},x.constant=function(t){return function(){return t}},x.noop=function(){},x.property=T,x.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},x.matcher=x.matches=function(t){return t=x.extendOwn({},t),function(e){return x.isMatch(e,t)}},x.times=function(t,e,r){var n=Array(Math.max(0,t));e=w(e,r,1);for(var i=0;i<t;i++)n[i]=e(i);return n},x.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},x.now=Date.now||function(){return(new Date).getTime()};var D={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},k=x.invert(D),F=function(t){var e=function(e){return t[e]},r="(?:"+x.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}};x.escape=F(D),x.unescape=F(k),x.result=function(t,e,r){var n=null==t?void 0:t[e];return void 0===n&&(n=r),x.isFunction(n)?n.call(t):n};var U=0;x.uniqueId=function(t){var e=++U+"";return t?t+e:e},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var B=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},G=/\\|'|\r|\n|\u2028|\u2029/g,V=function(t){return"\\"+z[t]};x.template=function(t,e,r){!e&&r&&(e=r),e=x.defaults({},e,x.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,a,s){return o+=t.slice(i,s).replace(G,V),i=s+e.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\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 a=new Function(e.variable||"obj","_",o)}catch(t){throw t.source=o,t}var s=function(t){return a.call(this,t,x)},c=e.variable||"obj";return s.source="function("+c+"){\n"+o+"}",s},x.chain=function(t){var e=x(t);return e._chain=!0,e};var $=function(t,e){return t._chain?x(e).chain():e};x.mixin=function(t){x.each(x.functions(t),function(e){var r=x[e]=t[e];x.prototype[e]=function(){var t=[this._wrapped];return p.apply(t,arguments),$(this,r.apply(x,t))}})},x.mixin(x),x.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];x.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],$(this,r)}}),x.each(["concat","join","slice"],function(t){var e=u[t];x.prototype[t]=function(){return $(this,e.apply(this._wrapped,arguments))}}),x.prototype.value=function(){return this._wrapped},x.prototype.valueOf=x.prototype.toJSON=x.prototype.value,x.prototype.toString=function(){return""+this._wrapped},"function"==typeof t&&t.amd&&t("underscore",[],function(){return x})}).call(this)},{}],159:[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){"undefined"==typeof e&&(e=1e-6);var r,n,i,o,a;for(i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}if(r=0,n=1,i=t,i<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))}},{}],160:[function(t,e,r){var n=t("./vdom/create-element.js");e.exports=n},{"./vdom/create-element.js":166}],161:[function(t,e,r){var n=t("./vtree/diff.js");e.exports=n},{"./vtree/diff.js":186}],162:[function(t,e,r){var n=t("./virtual-hyperscript/index.js");e.exports=n},{"./virtual-hyperscript/index.js":173}],163:[function(t,e,r){var n=t("./diff.js"),i=t("./patch.js"),o=t("./h.js"),a=t("./create-element.js"),s=t("./vnode/vnode.js"),c=t("./vnode/vtext.js");e.exports={diff:n,patch:i,h:o,create:a,VNode:s,VText:c}},{"./create-element.js":160,"./diff.js":161,"./h.js":162,"./patch.js":164,"./vnode/vnode.js":182,"./vnode/vtext.js":184}],164:[function(t,e,r){var n=t("./vdom/patch.js");e.exports=n},{"./vdom/patch.js":169}],165:[function(t,e,r){function n(t,e,r){for(var n in e){var a=e[n];void 0===a?i(t,n,a,r):c(a)?(i(t,n,a,r),a.hook&&a.hook(t,n,r?r[n]:void 0)):s(a)?o(t,e,r,n,a):t[n]=a}}function i(t,e,r,n){if(n){var i=n[e];if(c(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 a in i)t.style[a]="";else"string"==typeof i?t[e]="":t[e]=null}}function o(t,e,r,n,i){var o=r?r[n]:void 0;if("attributes"!==n){if(o&&s(o)&&a(o)!==a(i))return void(t[n]=i);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 a(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__?t.__proto__:t.constructor?t.constructor.prototype:void 0}var s=t("is-object"),c=t("../vnode/is-vhook.js");e.exports=n},{"../vnode/is-vhook.js":177,"is-object":18}],166:[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(s(t))return r.createTextNode(t.text);if(!a(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"),a=t("../vnode/is-vnode.js"),s=t("../vnode/is-vtext.js"),c=t("../vnode/is-widget.js"),u=t("../vnode/handle-thunk.js");e.exports=n},{"../vnode/handle-thunk.js":175,"../vnode/is-vnode.js":178,"../vnode/is-vtext.js":179,"../vnode/is-widget.js":180,"./apply-properties":165,"global/document":14}],167:[function(t,e,r){function n(t,e,r,n){return r&&0!==r.length?(r.sort(a),i(t,e,r,n,0)):{}}function i(t,e,r,n,a){if(n=n||{},t){o(r,a,a)&&(n[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);o(r,a,p)&&i(u[h],l,r,n,a),a=p}}return n}function o(t,e,r){if(0===t.length)return!1;for(var n,i,o=0,a=t.length-1;o<=a;){if(n=(a+o)/2>>0,i=t[n],o===a)return i>=e&&i<=r;if(i<e)o=n+1;else{if(!(i>r))return!0;a=n-1}}return!1}function a(t,e){return t>e?1:-1}var s={};e.exports=n},{}],168:[function(t,e,r){function n(t,e,r){var n=t.type,u=t.vNode,f=t.patch;switch(n){case d.REMOVE:return i(e,u);case d.INSERT:return o(e,f,r);case d.VTEXT:return a(e,u,f,r);case d.WIDGET:return s(e,u,f,r);case d.VNODE:return c(e,u,f,r);case d.ORDER:return h(e,f),e;case d.PROPS:return p(e,f,u.properties),e;case d.THUNK:return l(e,r.patch(e,f,r));default:return e}}function i(t,e){var r=t.parentNode;return r&&r.removeChild(t),u(t,e),null}function o(t,e,r){var n=r.render(e,r);return t&&t.appendChild(n),t}function a(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=m(e,r);i=o?r.update(e,t)||t:n.render(r,n);var a=t.parentNode;return a&&i!==t&&a.replaceChild(i,t),o||u(t,e),i}function c(t,e,r,n){var i=t.parentNode,o=n.render(r,n);return i&&o!==t&&i.replaceChild(o,t),o}function u(t,e){"function"==typeof e.destroy&&f(e)&&e.destroy(t)}function h(t,e){for(var r,n,i,o=t.childNodes,a={},s=0;s<e.removes.length;s++)n=e.removes[s],r=o[n.from],n.key&&(a[n.key]=r),t.removeChild(r);for(var c=o.length,u=0;u<e.inserts.length;u++)i=e.inserts[u],r=a[i.key],t.insertBefore(r,i.to>=c++?null:o[i.to])}function l(t,e){return t&&e&&t!==e&&t.parentNode&&t.parentNode.replaceChild(e,t),e}var p=t("./apply-properties"),f=t("../vnode/is-widget.js"),d=t("../vnode/vpatch.js"),m=t("./update-widget");e.exports=n},{"../vnode/is-widget.js":180,"../vnode/vpatch.js":183,"./apply-properties":165,"./update-widget":170}],169:[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=a(e);if(0===n.length)return t;var i=h(t,e.a,n),c=t.ownerDocument;r.document||c===s||(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 a(t){var e=[];for(var r in t)"a"!==r&&e.push(Number(r));return e}var s=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":166,"./dom-index":167,"./patch-op":168,"global/document":14,"x-is-array":205}],170:[function(t,e,r){function n(t,e){return!(!i(t)||!i(e))&&("name"in t&&"name"in e?t.id===e.id:t.init===e.init)}var i=t("../vnode/is-widget.js");e.exports=n},{"../vnode/is-widget.js":180}],171:[function(t,e,r){"use strict";function n(t){return this instanceof n?void(this.value=t):new n(t)}var i=t("ev-store");e.exports=n,n.prototype.hook=function(t,e){var r=i(t),n=e.substr(3);r[n]=this.value},n.prototype.unhook=function(t,e){var r=i(t),n=e.substr(3);r[n]=void 0}},{"ev-store":7}],172:[function(t,e,r){"use strict";function n(t){return this instanceof n?void(this.value=t):new n(t)}e.exports=n,n.prototype.hook=function(t,e){t[e]!==this.value&&(t[e]=this.value)}},{}],173:[function(t,e,r){"use strict";function n(t,e,r){var n,a,c,u,h=[];return!r&&s(e)&&(r=e,a={}),a=a||e||{},n=y(t,a),a.hasOwnProperty("key")&&(c=a.key,a.key=void 0),a.hasOwnProperty("namespace")&&(u=a.namespace,a.namespace=void 0),"INPUT"!==n||u||!a.hasOwnProperty("value")||void 0===a.value||v(a.value)||(a.value=b(a.value)),o(a),void 0!==r&&null!==r&&i(r,h,n,a),new l(n,a,h,c,u)}function i(t,e,r,n){if("string"==typeof t)e.push(new p(t));else if("number"==typeof t)e.push(new p(String(t)));else if(a(t))e.push(t);else{if(!h(t)){if(null===t||void 0===t)return;throw c({foreignObject:t,parentVnode:{tagName:r,properties:n}})}for(var o=0;o<t.length;o++)i(t[o],e,r,n)}}function o(t){for(var e in t)if(t.hasOwnProperty(e)){var r=t[e];if(v(r))continue;"ev-"===e.substr(0,3)&&(t[e]=_(r))}}function a(t){return f(t)||d(t)||m(t)||g(t)}function s(t){return"string"==typeof t||h(t)||a(t)}function c(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"+u(t.foreignObject)+".\nThe parent vnode is:\n"+u(t.parentVnode),e.foreignObject=t.foreignObject,e.parentVnode=t.parentVnode,e}function u(t){try{return JSON.stringify(t,null,"    ")}catch(e){return String(t)}}var h=t("x-is-array"),l=t("../vnode/vnode.js"),p=t("../vnode/vtext.js"),f=t("../vnode/is-vnode"),d=t("../vnode/is-vtext"),m=t("../vnode/is-widget"),v=t("../vnode/is-vhook"),g=t("../vnode/is-thunk"),y=t("./parse-tag.js"),b=t("./hooks/soft-set-hook.js"),_=t("./hooks/ev-hook.js");e.exports=n},{"../vnode/is-thunk":176,"../vnode/is-vhook":177,"../vnode/is-vnode":178,"../vnode/is-vtext":179,"../vnode/is-widget":180,"../vnode/vnode.js":182,"../vnode/vtext.js":184,"./hooks/ev-hook.js":171,"./hooks/soft-set-hook.js":172,"./parse-tag.js":174,"x-is-array":205}],174:[function(t,e,r){"use strict";function n(t,e){if(!t)return"DIV";var r=!e.hasOwnProperty("id"),n=i(t,o),s=null;a.test(n[1])&&(s="DIV");var c,u,h,l;for(l=0;l<n.length;l++)u=n[l],u&&(h=u.charAt(0),s?"."===h?(c=c||[],c.push(u.substring(1,u.length))):"#"===h&&r&&(e.id=u.substring(1,u.length)):s=u);return c&&(e.className&&c.push(e.className),e.className=c.join(" ")),e.namespace?s:s.toUpperCase()}var i=t("browser-split"),o=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,a=/^\.|#/;e.exports=n},{"browser-split":3}],175:[function(t,e,r){function n(t,e){var r=t,n=e;return c(e)&&(n=i(e,t)),c(t)&&(r=i(t,null)),{a:r,b:n}}function i(t,e){var r=t.vnode;if(r||(r=t.vnode=t.render(e)),!(o(r)||a(r)||s(r)))throw new Error("thunk did not return a valid node");return r}var o=t("./is-vnode"),a=t("./is-vtext"),s=t("./is-widget"),c=t("./is-thunk");e.exports=n},{"./is-thunk":176,"./is-vnode":178,"./is-vtext":179,"./is-widget":180}],176:[function(t,e,r){function n(t){return t&&"Thunk"===t.type}e.exports=n},{}],177:[function(t,e,r){function n(t){return t&&("function"==typeof t.hook&&!t.hasOwnProperty("hook")||"function"==typeof t.unhook&&!t.hasOwnProperty("unhook"))}e.exports=n},{}],178:[function(t,e,r){function n(t){return t&&"VirtualNode"===t.type&&t.version===i}var i=t("./version");e.exports=n},{"./version":181}],179:[function(t,e,r){function n(t){return t&&"VirtualText"===t.type&&t.version===i}var i=t("./version");e.exports=n},{"./version":181}],180:[function(t,e,r){function n(t){return t&&"Widget"===t.type}e.exports=n},{}],181:[function(t,e,r){e.exports="2"},{}],182:[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&&a(_)?"function"==typeof _.destroy&&(d=!0):!m&&s(_)&&(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"),a=t("./is-widget"),s=t("./is-thunk"),c=t("./is-vhook");e.exports=n;var u={},h=[];n.prototype.version=i,n.prototype.type="VirtualNode"},{"./is-thunk":176,"./is-vhook":177,"./is-vnode":178,"./is-widget":180,"./version":181}],183:[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":181}],184:[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":181}],185:[function(t,e,r){function n(t,e){var r;for(var s in t){s in e||(r=r||{},r[s]=void 0);var c=t[s],u=e[s];if(c!==u)if(o(c)&&o(u))if(i(u)!==i(c))r=r||{},r[s]=u;else if(a(u))r=r||{},r[s]=u;else{var h=n(c,u);h&&(r=r||{},r[s]=h)}else r=r||{},r[s]=u}for(var l in e)l in t||(r=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"),a=t("../vnode/is-vhook");e.exports=n},{"../vnode/is-vhook":177,"is-object":18}],186:[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],s=!1;if(x(t)||x(e))c(t,e,r,n);else if(null==e)_(t)||(a(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)),s=!0;else i=m(i,new g(g.VNODE,t,e)),s=!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)),s=!0):_(e)&&(_(t)||(s=!0),i=m(i,new g(g.WIDGET,t,e)));i&&(r[n]=i),s&&a(t,r,n)}}function o(t,e,r,n,o){for(var a=t.children,s=p(a,e.children),c=s.children,u=a.length,h=c.length,l=u>h?u:h,f=0;f<l;f++){var d=a[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 s.moves&&(n=m(n,new g(g.ORDER,t,s.moves))),n}function a(t,e,r){h(t,e,r),s(t,e,r)}function s(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 a=n[o];r+=1,s(a,e,r),y(a)&&a.count&&(r+=a.count)}else x(t)&&c(t,null,e,r)}function c(t,e,r,i){var o=w(t,e),a=n(o.a,o.b);u(a)&&(r[i]=new g(g.THUNK,null,a))}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 a=n[o];r+=1,h(a,e,r),y(a)&&a.count&&(r+=a.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),a=o.keys,s=o.free;if(s.length===t.length)return{children:e,moves:null};for(var c=[],u=0,h=i.length,l=0,p=0;p<t.length;p++){var m,v=t[p];v.key?n.hasOwnProperty(v.key)?(m=n[v.key],c.push(e[m])):(m=p-l++,c.push(null)):u<h?(m=i[u++],c.push(e[m])):(m=p-l++,c.push(null))}for(var g=u>=i.length?e.length:i[u],y=0;y<e.length;y++){var b=e[y];b.key?a.hasOwnProperty(b.key)||c.push(b):y>=g&&c.push(b)}for(var _,x=c.slice(),w=0,S=[],M=[],E=0;E<e.length;){var T=e[E];for(_=x[w];null===_&&x.length;)S.push(f(x,w,null)),_=x[w];_&&_.key===T.key?(w++,E++):T.key?(_&&_.key&&n[_.key]!==E+1?(S.push(f(x,w,_.key)),_=x[w],_&&_.key===T.key?w++:M.push({key:T.key,to:E})):M.push({key:T.key,to:E}),E++):_&&_.key&&S.push(f(x,w,_.key))}for(;w<x.length;)_=x[w],S.push(f(x,w,_&&_.key));return S.length!==l||M.length?{children:c,moves:{removes:S,inserts:M}}:{children:c,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":175,"../vnode/is-thunk":176,"../vnode/is-vnode":178,"../vnode/is-vtext":179,"../vnode/is-widget":180,"../vnode/vpatch":183,"./diff-props":185,"x-is-array":205}],187:[function(e,r,n){!function(t){"use strict";t(function(t){var e=t("./makePromise"),r=t("./Scheduler"),n=t("./env").asap;return e({scheduler:new r(n)})})}("function"==typeof t&&t.amd?t:function(t){r.exports=t(e)})},{"./Scheduler":188,"./env":200,"./makePromise":202}],188:[function(e,r,n){!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"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],189:[function(e,r,n){!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"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],190:[function(e,r,n){!function(t){"use strict";t(function(){function t(t,r){function n(e,n,o){var a=t._defer(),s=o.length,c=new Array(s);return i({f:e,thisArg:n,args:o,params:c,i:s-1,call:r},a._handler),a}function i(e,n){if(e.i<0)return r(e.f,e.thisArg,e.params,n);var i=t._handler(e.args[e.i]);i.fold(o,e,void 0,n)}function o(t,e,r){t.params[t.i]=e,t.i-=1,i(t,r)}return arguments.length<2&&(r=e),n}function e(t,e,r,n){try{n.resolve(t.apply(e,r))}catch(t){n.reject(t)}}return t.tryCatchResolve=e,t})}("function"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],191:[function(e,r,n){!function(t){"use strict";t(function(t){var e=t("../state"),r=t("../apply");return function(t){
-function n(e){function r(t){h=null,this.resolve(t)}function n(t){this.resolved||(h.push(t),0===--u&&this.reject(h))}for(var i,o,a=t._defer(),s=a._handler,c=e.length>>>0,u=c,h=[],l=0;l<c;++l)if(o=e[l],void 0!==o||l in e){if(i=t._handler(o),i.state()>0){s.become(i),t._visitRemaining(e,l,i);break}i.visit(s,r,n)}else--u;return 0===u&&s.reject(new RangeError("any(): array must not be empty")),a}function i(e,r){function n(t){this.resolved||(h.push(t),0===--f&&(l=null,this.resolve(h)))}function i(t){this.resolved||(l.push(t),0===--o&&(h=null,this.reject(l)))}var o,a,s,c=t._defer(),u=c._handler,h=[],l=[],p=e.length>>>0,f=0;for(s=0;s<p;++s)a=e[s],(void 0!==a||s in e)&&++f;for(r=Math.max(r,0),o=f-r+1,f=Math.min(r,f),r>f?u.reject(new RangeError("some(): array must contain at least "+r+" item(s), but had "+f)):0===f&&u.resolve(h),s=0;s<p;++s)a=e[s],(void 0!==a||s in e)&&t._handler(a).visit(u,n,i,u.notify);return c}function o(e,r){return t._traverse(r,e)}function a(e,r){var n=y.call(e);return t._traverse(r,n).then(function(t){return s(n,t)})}function s(e,r){for(var n=r.length,i=new Array(n),o=0,a=0;o<n;++o)r[o]&&(i[a++]=t._handler(e[o]).value);return i.length=a,i}function c(t){return m(t.map(u))}function u(r){var n=t._handler(r);return 0===n.state()?d(r).then(e.fulfilled,e.rejected):(n._unreport(),e.inspect(n))}function h(t,e){return arguments.length>2?v.call(t,p(e),arguments[2]):v.call(t,p(e))}function l(t,e){return arguments.length>2?g.call(t,p(e),arguments[2]):g.call(t,p(e))}function p(t){return function(e,r,n){return f(t,void 0,[e,r,n])}}var f=r(t),d=t.resolve,m=t.all,v=Array.prototype.reduce,g=Array.prototype.reduceRight,y=Array.prototype.slice;return t.any=n,t.some=i,t.settle=c,t.map=o,t.filter=a,t.reduce=h,t.reduceRight=l,t.prototype.spread=function(t){return this.then(m).then(function(e){return t.apply(this,e)})},t}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t(e)})},{"../apply":190,"../state":203}],192:[function(e,r,n){!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 a(t,e,r,i){var o=t.call(e);return n(o)?s(o,r,i):r(i)}function s(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 a(t,this,i,e)},function(e){return a(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"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],193:[function(e,r,n){!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"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],194:[function(e,r,n){!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"==typeof t&&t.amd?t:function(t){r.exports=t(e)})},{"../state":203}],195:[function(e,r,n){!function(t){"use strict";t(function(){return function(t){function e(t,e,n,i){return r(function(e){return[e,t(e)]},e,n,i)}function r(t,e,i,o){function a(o,a){return n(i(o)).then(function(){return r(t,e,i,a)})}return n(o).then(function(r){return n(e(r)).then(function(e){return e?r:n(t(r)).spread(a)})})}var n=t.resolve;return t.iterate=e,t.unfold=r,t}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],196:[function(e,r,n){!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"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],197:[function(e,r,n){!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 a(t,e,r){var i="undefined"==typeof 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,s=e(a,t,n,i._handler);return this._handler.visit(o,function(t){r.clearTimer(s),this.resolve(t)},function(t){r.clearTimer(s),this.reject(t)},o.notify),i},t}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t(e)})},{"../TimeoutError":189,"../env":200}],198:[function(e,r,n){!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 a(t){var e=f.indexOf(t);e>=0&&(f.splice(e,1),l("Handled previous rejection ["+t.id+"] "+i.formatObject(t.value)))}function s(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="undefined"!=typeof u.error?function(t){u.error(t)}:function(t){u.log(t)},l="undefined"!=typeof u.info?function(t){u.info(t)}:function(t){u.log(t)}),t.onPotentiallyUnhandledRejection=function(t){s(o,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){s(a,t)},t.onFatalRejection=function(t){s(e,t.value)};var p=[],f=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t(e)})},{"../env":200,"../format":201}],199:[function(e,r,n){!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"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],200:[function(e,r,n){(function(n){!function(t){"use strict";t(function(t){function e(){return"undefined"!=typeof n&&"[object process]"===Object.prototype.toString.call(n)}function r(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function i(t){function e(){var t=r;r=void 0,t()}var r,n=document.createTextNode(""),i=new t(e);i.observe(n,{characterData:!0});var o=0;return function(t){r=t,n.data=o^=1}}var o,a="undefined"!=typeof setTimeout&&setTimeout,s=function(t,e){return setTimeout(t,e)},c=function(t){return clearTimeout(t)},u=function(t){return a(t,0)};if(e())u=function(t){return n.nextTick(t)};else if(o=r())u=i(o);else if(!a){var h=t,l=h("vertx");s=function(t,e){return l.setTimer(e,t)},c=l.cancelTimer,u=l.runOnLoop||l.runOnContext}return{setTimer:s,clearTimer:c,asap:u}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t(e)})}).call(this,e("_process"))},{_process:4}],201:[function(e,r,n){!function(t){"use strict";t(function(){function t(t){var r="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:e(t);return t instanceof Error?r:r+" (WARNING: non-Error used)"}function e(t){var e=String(t);return"[object Object]"===e&&"undefined"!=typeof JSON&&(e=r(t,e)),e}function r(t,e){try{return JSON.stringify(t)}catch(t){return e}}return{formatError:t,formatObject:e,tryStringify:r}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],202:[function(e,r,n){(function(e){!function(t){"use strict";t(function(){return function(t){function r(t,e){this._handler=t===_?e:n(t)}function n(t){function e(t){i.resolve(t)}function r(t){i.reject(t)}function n(t){i.notify(t)}var i=new w;try{t(e,r,n)}catch(t){r(t)}return i}function i(t){return I(t)?t:new r(_,new S(g(t)))}function o(t){return new r(_,new S(new T(t)))}function a(){return tt}function s(){return new r(_,new w)}function c(t,e){var r=new w(t.receiver,t.join().context);return new e(_,r)}function u(t){return l(H,null,t)}function h(t,e){return l(B,t,e)}function l(t,e,n){function i(r,i,a){a.resolved||p(n,o,r,t(e,i,r),a)}function o(t,e,r){h[t]=e,0===--u&&r.become(new E(h))}for(var a,s="function"==typeof e?i:o,c=new w,u=n.length>>>0,h=new Array(u),l=0;l<n.length&&!c.resolved;++l)a=n[l],void 0!==a||l in n?p(n,s,l,a,c):--u;return 0===u&&c.become(new E(h)),new r(_,c)}function p(t,e,r,n,i){if(D(n)){var o=y(n),a=o.state();0===a?o.fold(e,r,void 0,i):a>0?e(r,o.value,i):(i.become(o),f(t,r+1,o))}else e(r,n,i)}function f(t,e,r){for(var n=e;n<t.length;++n)d(g(t[n]),r)}function d(t,e){if(t!==e){var r=t.state();0===r?t.visit(t,void 0,t._unreport):r<0&&t._unreport()}}function m(t){return"object"!=typeof t||null===t?o(new TypeError("non-iterable passed to race()")):0===t.length?a():1===t.length?i(t[0]):v(t)}function v(t){var e,n,i,o=new w;for(e=0;e<t.length;++e)if(n=t[e],void 0!==n||e in t){if(i=g(n),0!==i.state()){o.become(i),f(t,e+1,i);break}i.visit(o,o.resolve,o.reject)}return new r(_,o)}function g(t){return I(t)?t._handler.join():D(t)?b(t):new E(t)}function y(t){return I(t)?t._handler.join():b(t)}function b(t){try{var e=t.then;return"function"==typeof e?new M(e,t):new E(t)}catch(t){return new T(t)}}function _(){}function x(){}function w(t,e){r.createContext(this,e),this.consumers=void 0,this.receiver=t,this.handler=void 0,this.resolved=!1}function S(t){this.handler=t}function M(t,e){w.call(this),X.enqueue(new R(t,e,this))}function E(t){r.createContext(this),this.value=t}function T(t){r.createContext(this),this.id=++J,this.value=t,this.handled=!1,this.reported=!1,this._report()}function C(t,e){this.rejection=t,this.context=e}function O(t){this.rejection=t}function P(){return new T(new TypeError("Promise cycle"))}function A(t,e){this.continuation=t,this.handler=e}function j(t,e){this.handler=e,this.value=t}function R(t,e,r){this._then=t,this.thenable=e,this.resolver=r}function L(t,e,r,n,i){try{t.call(e,r,n,i)}catch(t){n(t)}}function N(t,e,r,n){this.f=t,this.z=e,this.c=r,this.to=n,this.resolver=Z,this.receiver=this}function I(t){return t instanceof r}function D(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function k(t,e,n,i){return"function"!=typeof t?i.become(e):(r.enterContext(e),z(t,e.value,n,i),void r.exitContext())}function F(t,e,n,i,o){return"function"!=typeof t?o.become(n):(r.enterContext(n),G(t,e,n.value,i,o),void r.exitContext())}function U(t,e,n,i,o){return"function"!=typeof t?o.notify(e):(r.enterContext(n),V(t,e,i,o),void r.exitContext())}function B(t,e,r){try{return t(e,r)}catch(t){return o(t)}}function z(t,e,r,n){try{n.become(g(t.call(r,e)))}catch(t){n.become(new T(t))}}function G(t,e,r,n,i){try{t.call(n,e,r,i)}catch(t){i.become(new T(t))}}function V(t,e,r,n){try{n.notify(t.call(r,e))}catch(t){n.notify(t)}}function $(t,e){e.prototype=K(t.prototype),e.prototype.constructor=e}function H(t,e){return e}function W(){}function q(){return"undefined"!=typeof e&&null!==e&&"function"==typeof e.emit?function(t,r){return"unhandledRejection"===t?e.emit(t,r.value,r):e.emit(t,r)}:"undefined"!=typeof self&&"function"==typeof CustomEvent?function(t,e,r){var n=!1;try{var i=new r("unhandledRejection");n=i instanceof r}catch(t){}return n?function(t,n){var i=new r(t,{detail:{reason:n.value,key:n},bubbles:!1,cancelable:!0});return!e.dispatchEvent(i)}:t}(W,self,CustomEvent):W}var X=t.scheduler,Y=q(),K=Object.create||function(t){function e(){}return e.prototype=t,new e};r.resolve=i,r.reject=o,r.never=a,r._defer=s,r._handler=g,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(_,n);var o=this._beget(),a=o._handler;return n.chain(a,n.receiver,t,e,r),o},r.prototype.catch=function(t){return this.then(void 0,t)},r.prototype._beget=function(){return c(this._handler,this.constructor)},r.all=u,r.race=m,r._traverse=h,r._visitRemaining=f,_.prototype.when=_.prototype.become=_.prototype.notify=_.prototype.fail=_.prototype._unreport=_.prototype._report=W,_.prototype._state=0,_.prototype.state=function(){return this._state},_.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},_.prototype.chain=function(t,e,r,n,i){this.when({resolver:t,receiver:e,fulfilled:r,rejected:n,progress:i})},_.prototype.visit=function(t,e,r,n){this.chain(Z,t,e,r,n)},_.prototype.fold=function(t,e,r,n){this.when(new N(t,e,r,n))},$(_,x),x.prototype.become=function(t){t.fail()};var Z=new x;$(_,w),w.prototype._state=0,w.prototype.resolve=function(t){this.become(g(t))},w.prototype.reject=function(t){this.resolved||this.become(new T(t))},w.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=P();return t},w.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])},w.prototype.become=function(t){this.resolved||(this.resolved=!0,this.handler=t,void 0!==this.consumers&&X.enqueue(this),void 0!==this.context&&t._report(this.context))},w.prototype.when=function(t){this.resolved?X.enqueue(new A(t,this.handler)):void 0===this.consumers?this.consumers=[t]:this.consumers.push(t)},w.prototype.notify=function(t){this.resolved||X.enqueue(new j(t,this))},w.prototype.fail=function(t){var e="undefined"==typeof t?this.context:t;this.resolved&&this.handler.join().fail(e)},w.prototype._report=function(t){this.resolved&&this.handler.join()._report(t)},w.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},$(_,S),S.prototype.when=function(t){X.enqueue(new A(t,this))},S.prototype._report=function(t){this.join()._report(t)},S.prototype._unreport=function(){this.join()._unreport()},$(w,M),$(_,E),E.prototype._state=1,E.prototype.fold=function(t,e,r,n){F(t,e,this,r,n)},E.prototype.when=function(t){k(t.fulfilled,this,t.receiver,t.resolver)};var J=0;$(_,T),T.prototype._state=-1,T.prototype.fold=function(t,e,r,n){n.become(this)},T.prototype.when=function(t){"function"==typeof t.rejected&&this._unreport(),k(t.rejected,this,t.receiver,t.resolver)},T.prototype._report=function(t){X.afterQueue(new C(this,t))},T.prototype._unreport=function(){this.handled||(this.handled=!0,X.afterQueue(new O(this)))},T.prototype.fail=function(t){this.reported=!0,Y("unhandledRejection",this),r.onFatalRejection(this,void 0===t?this.context:t)},C.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,Y("unhandledRejection",this.rejection)||r.onPotentiallyUnhandledRejection(this.rejection,this.context))},O.prototype.run=function(){this.rejection.reported&&(Y("rejectionHandled",this.rejection)||r.onPotentiallyUnhandledRejectionHandled(this.rejection))},r.createContext=r.enterContext=r.exitContext=r.onPotentiallyUnhandledRejection=r.onPotentiallyUnhandledRejectionHandled=r.onFatalRejection=W;var Q=new _,tt=new r(_,Q);return A.prototype.run=function(){this.handler.join().when(this.continuation)},j.prototype.run=function(){var t=this.handler.consumers;if(void 0!==t)for(var e,r=0;r<t.length;++r)e=t[r],U(e.progress,this.value,this.handler,e.receiver,e.resolver)},R.prototype.run=function(){function t(t){n.resolve(t)}function e(t){n.reject(t)}function r(t){n.notify(t)}var n=this.resolver;L(this._then,this.thenable,t,e,r)},N.prototype.fulfilled=function(t){this.f.call(this.c,this.z,t,this.to)},N.prototype.rejected=function(t){this.to.reject(t)},N.prototype.progress=function(t){this.to.notify(t)},r}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t()})}).call(this,e("_process"))},{_process:4}],203:[function(e,r,n){!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}}function n(n){var i=n.state();return 0===i?t():i>0?r(n.value):e(n.value)}return{pending:t,fulfilled:r,rejected:e,inspect:n}})}("function"==typeof t&&t.amd?t:function(t){r.exports=t()})},{}],204:[function(e,r,n){!function(t){"use strict";t(function(t){function e(t,e,r,n){var i=S.resolve(t);return arguments.length<2?i:i.then(e,r,n)}function r(t){return new S(t)}function n(t){return function(){for(var e=0,r=arguments.length,n=new Array(r);e<r;++e)n[e]=arguments[e];return M(t,this,n)}}function i(t){for(var e=0,r=arguments.length-1,n=new Array(r);e<r;++e)n[e]=arguments[e+1];return M(t,this,n)}function o(){return new a}function a(){function t(t){n._handler.resolve(t)}function e(t){n._handler.reject(t)}function r(t){n._handler.notify(t)}var n=S._defer();this.promise=n,this.resolve=t,this.reject=e,this.notify=r,this.resolver={resolve:t,reject:e,notify:r}}function s(t){return t&&"function"==typeof t.then}function c(){return S.all(arguments)}function u(t){return e(t,S.all)}function h(t){return e(t,S.settle)}function l(t,r){return e(t,function(t){return S.map(t,r)})}function p(t,r){return e(t,function(t){return S.filter(t,r)})}var f=t("./lib/decorators/timed"),d=t("./lib/decorators/array"),m=t("./lib/decorators/flow"),v=t("./lib/decorators/fold"),g=t("./lib/decorators/inspect"),y=t("./lib/decorators/iterate"),b=t("./lib/decorators/progress"),_=t("./lib/decorators/with"),x=t("./lib/decorators/unhandledRejection"),w=t("./lib/TimeoutError"),S=[d,m,v,y,b,g,_,f,x].reduce(function(t,e){return e(t)},t("./lib/Promise")),M=t("./lib/apply")(S);return e.promise=r,e.resolve=S.resolve,e.reject=S.reject,e.lift=n,e.try=i,e.attempt=i,e.iterate=S.iterate,e.unfold=S.unfold,e.join=c,e.all=u,e.settle=h,e.any=n(S.any),e.some=n(S.some),e.race=n(S.race),e.map=l,e.filter=p,e.reduce=n(S.reduce),e.reduceRight=n(S.reduceRight),e.isPromiseLike=s,e.Promise=S,e.defer=o,e.TimeoutError=w,e})}("function"==typeof t&&t.amd?t:function(t){r.exports=t(e)})},{"./lib/Promise":187,"./lib/TimeoutError":189,"./lib/apply":190,"./lib/decorators/array":191,"./lib/decorators/flow":192,"./lib/decorators/fold":193,"./lib/decorators/inspect":194,"./lib/decorators/iterate":195,"./lib/decorators/progress":196,"./lib/decorators/timed":197,"./lib/decorators/unhandledRejection":198,"./lib/decorators/with":199}],205:[function(t,e,r){function n(t){return"[object Array]"===o.call(t)}var i=Array.isArray,o=Object.prototype.toString;e.exports=i||n},{}],206:[function(t,e,r){"use strict";var n=t("./api/APIv3");r.APIv3=n.APIv3},{"./api/APIv3":217}],207:[function(t,e,r){"use strict";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 a=t("./component/BackgroundComponent");r.BackgroundComponent=a.BackgroundComponent;var s=t("./component/BearingComponent");r.BearingComponent=s.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");r.Marker=g.Marker;var y=t("./component/marker/MarkerComponent");r.MarkerComponent=y.MarkerComponent;var b=t("./component/MouseComponent");r.MouseComponent=b.MouseComponent;var _=t("./component/NavigationComponent");r.NavigationComponent=_.NavigationComponent;var x=t("./component/RouteComponent");r.RouteComponent=x.RouteComponent;var w=t("./component/sequence/SequenceComponent");r.SequenceComponent=w.SequenceComponent;var S=t("./component/sequence/SequenceDOMRenderer");r.SequenceDOMRenderer=S.SequenceDOMRenderer;var M=t("./component/sequence/SequenceDOMInteraction");r.SequenceDOMInteraction=M.SequenceDOMInteraction;var E=t("./component/imageplane/ImagePlaneComponent");r.ImagePlaneComponent=E.ImagePlaneComponent;var T=t("./component/imageplane/ImagePlaneFactory");r.ImagePlaneFactory=T.ImagePlaneFactory;var C=t("./component/imageplane/ImagePlaneGLRenderer");r.ImagePlaneGLRenderer=C.ImagePlaneGLRenderer;var O=t("./component/imageplane/ImagePlaneScene");r.ImagePlaneScene=O.ImagePlaneScene;var P=t("./component/imageplane/ImagePlaneShaders");r.ImagePlaneShaders=P.ImagePlaneShaders;var A=t("./component/marker/SimpleMarker");r.SimpleMarker=A.SimpleMarker;var j=t("./component/imageplane/SliderComponent");r.SliderComponent=j.SliderComponent;var R=t("./component/StatsComponent");r.StatsComponent=R.StatsComponent;var L=t("./component/tag/tag/Tag");r.Tag=L.Tag;var N=t("./component/tag/tag/Alignment");r.Alignment=N.Alignment;var I=t("./component/tag/tag/OutlineTag");r.OutlineTag=I.OutlineTag;var D=t("./component/tag/tag/RenderTag");r.RenderTag=D.RenderTag;var k=t("./component/tag/tag/OutlineRenderTag");r.OutlineRenderTag=k.OutlineRenderTag;var F=t("./component/tag/tag/OutlineCreateTag");r.OutlineCreateTag=F.OutlineCreateTag;var U=t("./component/tag/tag/SpotTag");r.SpotTag=U.SpotTag;var B=t("./component/tag/tag/SpotRenderTag");r.SpotRenderTag=B.SpotRenderTag;var z=t("./component/tag/TagComponent");r.TagComponent=z.TagComponent;var G=t("./component/tag/TagCreator");r.TagCreator=G.TagCreator;var V=t("./component/tag/TagDOMRenderer");r.TagDOMRenderer=V.TagDOMRenderer;var $=t("./component/tag/TagGLRenderer");r.TagGLRenderer=$.TagGLRenderer;var H=t("./component/tag/TagOperation");r.TagOperation=H.TagOperation;var W=t("./component/tag/TagSet");r.TagSet=W.TagSet;var q=t("./component/tag/geometry/Geometry");r.Geometry=q.Geometry;var X=t("./component/tag/geometry/VertexGeometry");r.VertexGeometry=X.VertexGeometry;var Y=t("./component/tag/geometry/RectGeometry");r.RectGeometry=Y.RectGeometry;var K=t("./component/tag/geometry/PointGeometry");r.PointGeometry=K.PointGeometry;var Z=t("./component/tag/geometry/PolygonGeometry");r.PolygonGeometry=Z.PolygonGeometry;var J=t("./component/tag/error/GeometryTagError");r.GeometryTagError=J.GeometryTagError},{"./component/AttributionComponent":218,"./component/BackgroundComponent":219,"./component/BearingComponent":220,"./component/CacheComponent":221,"./component/Component":222,"./component/ComponentService":223,"./component/CoverComponent":224,"./component/DebugComponent":225,"./component/ImageComponent":226,"./component/KeyboardComponent":227,"./component/LoadingComponent":228,"./component/MouseComponent":229,"./component/NavigationComponent":230,"./component/RouteComponent":231,"./component/StatsComponent":232,"./component/direction/DirectionComponent":233,"./component/direction/DirectionDOMCalculator":234,"./component/direction/DirectionDOMRenderer":235,"./component/imageplane/ImagePlaneComponent":236,"./component/imageplane/ImagePlaneFactory":237,"./component/imageplane/ImagePlaneGLRenderer":238,"./component/imageplane/ImagePlaneScene":239,"./component/imageplane/ImagePlaneShaders":240,"./component/imageplane/SliderComponent":241,"./component/marker/Marker":242,"./component/marker/MarkerComponent":243,"./component/marker/SimpleMarker":244,"./component/sequence/SequenceComponent":245,"./component/sequence/SequenceDOMInteraction":246,"./component/sequence/SequenceDOMRenderer":247,"./component/tag/TagComponent":249,"./component/tag/TagCreator":250,"./component/tag/TagDOMRenderer":251,"./component/tag/TagGLRenderer":252,"./component/tag/TagOperation":253,"./component/tag/TagSet":254,"./component/tag/error/GeometryTagError":255,"./component/tag/geometry/Geometry":256,"./component/tag/geometry/PointGeometry":257,"./component/tag/geometry/PolygonGeometry":258,"./component/tag/geometry/RectGeometry":259,"./component/tag/geometry/VertexGeometry":260,"./component/tag/tag/Alignment":261,"./component/tag/tag/OutlineCreateTag":262,"./component/tag/tag/OutlineRenderTag":263,"./component/tag/tag/OutlineTag":264,"./component/tag/tag/RenderTag":265,"./component/tag/tag/SpotRenderTag":266,"./component/tag/tag/SpotTag":267,"./component/tag/tag/Tag":268}],208:[function(t,e,r){"use strict";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 a=t("./graph/edge/EdgeCalculatorCoefficients");r.EdgeCalculatorCoefficients=a.EdgeCalculatorCoefficients;var s=t("./graph/edge/EdgeCalculator");r.EdgeCalculator=s.EdgeCalculator},{"./graph/edge/EdgeCalculator":289,"./graph/edge/EdgeCalculatorCoefficients":290,"./graph/edge/EdgeCalculatorDirections":291,"./graph/edge/EdgeCalculatorSettings":292,"./graph/edge/EdgeDirection":293}],209:[function(t,e,r){"use strict";var n=t("./error/MapillaryError");r.MapillaryError=n.MapillaryError;var i=t("./error/ArgumentMapillaryError");r.ArgumentMapillaryError=i.ArgumentMapillaryError;var o=t("./error/GraphMapillaryError");r.GraphMapillaryError=o.GraphMapillaryError;var a=t("./error/MoveTypeMapillaryError");r.MoveTypeMapillaryError=a.MoveTypeMapillaryError;var s=t("./error/NotImplementedMapillaryError");r.NotImplementedMapillaryError=s.NotImplementedMapillaryError;var c=t("./error/ParameterMapillaryError");r.ParameterMapillaryError=c.ParameterMapillaryError;var u=t("./error/InitializationMapillaryError");r.InitializationMapillaryError=u.InitializationMapillaryError},{"./error/ArgumentMapillaryError":269,"./error/GraphMapillaryError":270,"./error/InitializationMapillaryError":271,"./error/MapillaryError":272,"./error/MoveTypeMapillaryError":273,"./error/NotImplementedMapillaryError":274,"./error/ParameterMapillaryError":275}],210:[function(t,e,r){"use strict";var n=t("./geo/Camera");r.Camera=n.Camera;var i=t("./geo/GeoCoords");r.GeoCoords=i.GeoCoords;var o=t("./geo/Spatial");r.Spatial=o.Spatial;var a=t("./geo/Transform");r.Transform=a.Transform},{"./geo/Camera":276,"./geo/GeoCoords":277,"./geo/Spatial":278,"./geo/Transform":279}],211:[function(t,e,r){"use strict";var n=t("./graph/Graph");r.Graph=n.Graph;var i=t("./graph/GraphCalculator");r.GraphCalculator=i.GraphCalculator;var o=t("./graph/GraphService");r.GraphService=o.GraphService;var a=t("./graph/ImageLoader");r.ImageLoader=a.ImageLoader;var s=t("./graph/ImageLoadingService");r.ImageLoadingService=s.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/Graph":280,"./graph/GraphCalculator":281,"./graph/GraphService":282,"./graph/ImageLoader":283,"./graph/ImageLoadingService":284,"./graph/MeshReader":285,"./graph/Node":286,"./graph/NodeCache":287,"./graph/Sequence":288}],212:[function(t,e,r){"use strict";var n=t("./Edge");r.EdgeDirection=n.EdgeDirection;var i=t("./Render");r.RenderMode=i.RenderMode;var o=t("./Viewer");r.ImageSize=o.ImageSize,r.Viewer=o.Viewer;var a=t("./component/tag/Tag");r.TagComponent=a},{"./Edge":208,"./Render":213,"./Viewer":216,"./component/tag/Tag":248}],213:[function(t,e,r){"use strict";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 a=t("./render/RenderCamera");r.RenderCamera=a.RenderCamera;var s=t("./render/RenderMode");r.RenderMode=s.RenderMode;var c=t("./render/RenderService");r.RenderService=c.RenderService},{"./render/DOMRenderer":294,"./render/GLRenderStage":295,"./render/GLRenderer":296,"./render/RenderCamera":297,"./render/RenderMode":298,"./render/RenderService":299}],214:[function(t,e,r){"use strict";var n=t("./state/FrameGenerator");r.FrameGenerator=n.FrameGenerator;var i=t("./state/StateService");r.StateService=i.StateService;var o=t("./state/StateContext");r.StateContext=o.StateContext;var a=t("./state/State");r.State=a.State;var s=t("./state/states/StateBase");r.StateBase=s.StateBase;var c=t("./state/states/TraversingState");r.TraversingState=c.TraversingState;var u=t("./state/states/WaitingState");r.WaitingState=u.WaitingState},{"./state/FrameGenerator":300,"./state/State":301,"./state/StateContext":302,"./state/StateService":303,"./state/states/StateBase":304,"./state/states/TraversingState":305,"./state/states/WaitingState":306}],215:[function(t,e,r){"use strict";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":307,"./utils/Settings":308,"./utils/Urls":309}],216:[function(t,e,r){"use strict";var n=t("./viewer/Container");r.Container=n.Container;var i=t("./viewer/EventLauncher");r.EventLauncher=i.EventLauncher;var o=t("./viewer/ImageSize");r.ImageSize=o.ImageSize;var a=t("./viewer/LoadingService");r.LoadingService=a.LoadingService;var s=t("./viewer/MouseService");r.MouseService=s.MouseService;var c=t("./viewer/Navigator");r.Navigator=c.Navigator;var u=t("./viewer/ComponentController");r.ComponentController=u.ComponentController;var h=t("./viewer/SpriteAlignment");r.SpriteAlignment=h.SpriteAlignment;var l=t("./viewer/SpriteService");r.SpriteService=l.SpriteService;var p=t("./viewer/TouchService");r.TouchService=p.TouchService,r.TouchMove=p.TouchMove;var f=t("./viewer/Viewer");r.Viewer=f.Viewer},{"./viewer/ComponentController":310,"./viewer/Container":311,"./viewer/EventLauncher":312,"./viewer/ImageSize":313,"./viewer/LoadingService":314,"./viewer/MouseService":315,"./viewer/Navigator":316,"./viewer/SpriteAlignment":317,"./viewer/SpriteService":318,"./viewer/TouchService":319,"./viewer/Viewer":320}],217:[function(t,e,r){"use strict";var n=t("falcor"),i=t("falcor-http-datasource"),o=t("rxjs/Observable");t("rxjs/add/observable/defer"),t("rxjs/add/observable/fromPromise"),t("rxjs/add/operator/catch"),t("rxjs/add/operator/map");var a=t("../Utils"),s=function(){function t(t,e){this._clientId=t,this._model=null!=e?e:new n.Model({source:new i(a.Urls.falcorModel(t),{crossDomain:!0,withCredentials:!1})}),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"],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(t){return t.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(t){
-return t.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 a=0;a<=e._pageCount;a++)r.json.imagesByH[o][a]=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.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 o.Observable.defer(function(){return o.Observable.fromPromise(t)})},t}();r.APIv3=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../Utils":215,falcor:13,"falcor-http-datasource":8,"rxjs/Observable":28,"rxjs/add/observable/defer":38,"rxjs/add/observable/fromPromise":42,"rxjs/add/operator/catch":48,"rxjs/add/operator/map":60}],218:[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("virtual-dom"),o=t("../Component"),a=function(t){function e(e,r,n){t.call(this,e,r,n)}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=a,o.ComponentService.register(a),Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Component":207,"virtual-dom":163}],219:[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("virtual-dom"),o=t("../Component"),a=function(t){function e(e,r,n){t.call(this,e,r,n)}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=a,o.ComponentService.register(a),Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Component":207,"virtual-dom":163}],220:[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("virtual-dom"),o=t("../Component"),a=function(t){function e(e,r,n){t.call(this,e,r,n)}return n(e,t),e.prototype._activate=function(){var t=this;this._renderSubscription=this._navigator.stateService.currentNode$.map(function(t){return t.fullPano}).map(function(e){return{name:t._name,vnode:e?i.h("div.BearingIndicator",{},[]):i.h("div",{},[])}}).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._renderSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="bearing",e}(o.Component);r.BearingComponent=a,o.ComponentService.register(a),Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Component":207,"virtual-dom":163}],221:[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("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/merge"),t("rxjs/add/observable/of"),t("rxjs/add/observable/zip"),t("rxjs/add/operator/distinct"),t("rxjs/add/operator/expand"),t("rxjs/add/operator/map"),t("rxjs/add/operator/mergeAll"),t("rxjs/add/operator/skip"),t("rxjs/add/operator/switchMap");var o=t("../Edge"),a=t("../Component"),s=function(t){function e(e,r,n){t.call(this,e,r,n)}return n(e,t),e.prototype.setDepth=function(t){this.configure({depth:t})},e.prototype._activate=function(){var t=this;this._cacheSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$,this._configuration$).switchMap(function(e){var r=e[0],n=e[1],a=n.depth,s=Math.max(0,Math.min(4,a.sequence)),c=Math.max(0,Math.min(2,a.pano)),u=r.pano?0:Math.max(0,Math.min(3,a.step)),h=r.pano?0:Math.max(0,Math.min(1,a.turn)),l=t._cache$(r,o.EdgeDirection.Next,s),p=t._cache$(r,o.EdgeDirection.Prev,s),f=t._cache$(r,o.EdgeDirection.Pano,c),d=t._cache$(r,o.EdgeDirection.StepForward,u),m=t._cache$(r,o.EdgeDirection.StepBackward,u),v=t._cache$(r,o.EdgeDirection.StepLeft,u),g=t._cache$(r,o.EdgeDirection.StepRight,u),y=t._cache$(r,o.EdgeDirection.TurnLeft,h),b=t._cache$(r,o.EdgeDirection.TurnRight,h),_=t._cache$(r,o.EdgeDirection.TurnU,h);return i.Observable.merge(l,p,d,m,v,g,f,y,b,_)}).subscribe(function(t){},function(t){console.error(t)})},e.prototype._deactivate=function(){this._cacheSubscription.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(this._nodeToEdges$(t,e),i.Observable.of(r)).expand(function(t){var r=t[0],o=t[1],a=[];if(o>0)for(var s=0,c=r;s<c.length;s++){var u=c[s];u.data.direction===e&&a.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(a).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}(a.Component);r.CacheComponent=s,a.ComponentService.register(s),Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../Component":207,"../Edge":208,"rxjs/Observable":28,"rxjs/add/observable/combineLatest":37,"rxjs/add/observable/merge":43,"rxjs/add/observable/of":44,"rxjs/add/observable/zip":46,"rxjs/add/operator/distinct":52,"rxjs/add/operator/expand":55,"rxjs/add/operator/map":60,"rxjs/add/operator/mergeAll":62,"rxjs/add/operator/skip":70,"rxjs/add/operator/switchMap":73}],222:[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("rxjs/BehaviorSubject"),o=t("rxjs/Subject");t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/startWith");var a=t("../Utils"),s=function(t){function e(e,r,n){t.call(this),this._activated$=new i.BehaviorSubject(!1),this._configurationSubject$=new o.Subject,this._activated=!1,this._container=r,this._name=e,this._navigator=n,this._configuration$=this._configurationSubject$.startWith(this.defaultConfiguration).scan(function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}).publishReplay(1).refCount(),this._configuration$.subscribe()}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}),e.prototype.activate=function(t){this._activated||(void 0!==t&&this._configurationSubject$.next(t),this._activate(),this._activated=!0,this._activated$.next(!0))},e.prototype.configure=function(t){this._configurationSubject$.next(t)},e.prototype.deactivate=function(){this._activated&&(this._deactivate(),this._container.domRenderer.clear(this._name),this._container.glRenderer.clear(this._name),this._activated=!1,this._activated$.next(!1))},e.prototype.resize=function(){},e.componentName="not_worthy",e}(a.EventEmitter);r.Component=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../Utils":215,"rxjs/BehaviorSubject":25,"rxjs/Subject":33,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/startWith":72}],223:[function(t,e,r){"use strict";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 a=o[i];this._components[a.componentName]={active:!1,component:new a(a.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++){var r=e[t];r.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.ParameterMapillaryError("Component does not exist: "+t)},t.registeredComponents={},t}();r.ComponentService=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../Error":209,underscore:158}],224:[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("virtual-dom");t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/withLatestFrom");var o=t("../Component"),a=function(t){function e(e,r,n){t.call(this,e,r,n)}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=null!=t.src?"url("+t.src+")":"url(https://d1cuyjsrcm0gby.cloudfront.net/"+t.key+"/thumb-640.jpg)",r={style:{backgroundImage:e}},n=[];return t.loading&&n.push(i.h("div.Spinner",{},[])),n.push(i.h("div.CoverBackgroundGradient",{},[])),i.h("div.CoverBackground",r,n)},e.componentName="cover",e}(o.Component);r.CoverComponent=a,o.ComponentService.registerCover(a),Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Component":207,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/withLatestFrom":76,"virtual-dom":163}],225:[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("underscore"),o=t("virtual-dom"),a=t("rxjs/BehaviorSubject");t("rxjs/add/operator/combineLatest");var s=t("../Component"),c=function(t){function e(e,r,n){t.call(this,e,r,n),this._open$=new a.BehaviorSubject(!1),this._displaying=!1}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,a=0,s=0,c=0,u=i.values(e);c<u.length;c++){var h=u[c];n+=h.loaded,h.loaded!==h.total?s++:a++}return r.push(o.h("p","Loaded Images: "+a)),r.push(o.h("p","Loading Images: "+s)),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}(s.Component);r.DebugComponent=c,s.ComponentService.register(c),Object.defineProperty(r,"__esModule",{value:!0}),r.default=c},{"../Component":207,"rxjs/BehaviorSubject":25,"rxjs/add/operator/combineLatest":49,underscore:158,"virtual-dom":163}],226:[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("virtual-dom");t("rxjs/add/operator/combineLatest");var o=t("../Component"),a=function(t){function e(e,r,n){t.call(this,e,r,n),this._canvasId=r.id+"-"+this._name}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){var n=document.getElementById(t._canvasId);return{canvas:n,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;var a=e.getContext("2d");a.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=a,o.ComponentService.register(a),Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Component":207,"rxjs/add/operator/combineLatest":49,"virtual-dom":163}],227:[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("rxjs/Observable");t("rxjs/add/observable/fromEvent"),t("rxjs/add/operator/withLatestFrom");var o=t("../Edge"),a=t("../Component"),s=t("../Geo"),c=function(t){function e(e,r,n){t.call(this,e,r,n),this._spatial=new s.Spatial,this._perspectiveDirections=[o.EdgeDirection.StepForward,o.EdgeDirection.StepBackward,o.EdgeDirection.StepLeft,o.EdgeDirection.StepRight,o.EdgeDirection.TurnLeft,o.EdgeDirection.TurnRight,o.EdgeDirection.TurnU]}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,a=null,s=null,c=this._rotationFromCamera(n).phi;switch(t.keyCode){case 37:if(t.shiftKey||t.altKey)break;i=Math.PI/2+c,a=o.EdgeDirection.StepLeft;break;case 38:if(t.shiftKey)break;if(t.altKey){s=o.EdgeDirection.Next;break}i=c,a=o.EdgeDirection.StepForward;break;case 39:if(t.shiftKey||t.altKey)break;i=-Math.PI/2+c,a=o.EdgeDirection.StepRight;break;case 40:if(t.shiftKey)break;if(t.altKey){s=o.EdgeDirection.Prev;break}i=Math.PI+c,a=o.EdgeDirection.StepBackward;break;default:return}if(t.preventDefault(),null!=s)return void this._moveInDir(s,e);if(null!=a&&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===a}),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)})}},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)),i=Math.atan2(n.y,n.x),o=Math.PI/2-this._spatial.angleToPlane(e.toArray(),[0,0,1]);return{phi:i,theta:o}},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}return t.preventDefault(),null!=i?void this._moveInDir(i,e):void this._moveInDir(n,r)},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}(a.Component);r.KeyboardComponent=c,a.ComponentService.register(c),Object.defineProperty(r,"__esModule",{value:!0}),r.default=c},{"../Component":207,"../Edge":208,"../Geo":210,"rxjs/Observable":28,"rxjs/add/observable/fromEvent":41,"rxjs/add/operator/withLatestFrom":76}],228:[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("underscore"),o=t("virtual-dom");t("rxjs/add/operator/combineLatest");var a=t("../Component"),s=function(t){function e(e,r,n){t.call(this,e,r,n)}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,a=0,s=i.values(r);a<s.length;a++){var c=s[a];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}(a.Component);r.LoadingComponent=s,a.ComponentService.register(s),Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../Component":207,"rxjs/add/operator/combineLatest":49,underscore:158,"virtual-dom":163}],229:[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("three"),o=t("virtual-dom"),a=t("rxjs/Observable");t("rxjs/add/observable/merge"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/withLatestFrom");var s=t("../Component"),c=t("../Geo"),u=function(t){function e(e,r,n){t.call(this,e,r,n),this._spatial=new c.Spatial}return n(e,t),e.prototype._activate=function(){var t=this,e=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).map(function(t){return!0}),r=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).map(function(t){return!1}),n=a.Observable.merge(e,r).startWith(!1).share();this._activeSubscription=n.subscribe(this._container.mouseService.activate$),this._cursorSubscription=n.map(function(e){var r=e?"MouseContainerGrabbing":"MouseContainerGrab",n=o.h("div."+r,{},[]);return{name:t._name,vnode:n}}).subscribe(this._container.domRenderer.render$);var s=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).map(function(t){return{clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY}}),c=this._container.touchService.singleTouchMove$.map(function(t){return{clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY}});this._movementSubscription=a.Observable.merge(s,c).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$,this._navigator.stateService.currentCamera$,function(t,e,r,n){return[t,e,r,n]}).map(function(e){var r=e[0],n=e[1],o=e[2],a=e[3].clone(),s=t._container.element,c=s.offsetWidth,u=s.offsetHeight,h=s.getBoundingClientRect(),l=r.clientX-h.left,p=r.clientY-h.top,f=t._unproject(l,p,c,u,n.perspective).sub(n.perspective.position),d=t._unproject(l-r.movementX,p,c,u,n.perspective).sub(n.perspective.position),m=t._unproject(l,p-r.movementY,c,u,n.perspective).sub(n.perspective.position),v=(r.movementX>0?1:-1)*d.angleTo(f),g=(r.movementY>0?-1:1)*m.angleTo(f),y=(new i.Quaternion).setFromUnitVectors(a.up,new i.Vector3(0,0,1)),b=y.clone().inverse(),_=new i.Vector3;_.copy(a.lookat).sub(a.position),_.applyQuaternion(y);var x=_.length(),w=Math.atan2(_.y,_.x);w+=v;var S=Math.atan2(Math.sqrt(_.x*_.x+_.y*_.y),_.z);S+=g,S=Math.max(.01,Math.min(Math.PI-.01,S)),_.x=Math.sin(S)*Math.cos(w),_.y=Math.sin(S)*Math.sin(w),_.z=Math.cos(S),_.applyQuaternion(b);var M=(new i.Vector3).copy(a.position).add(_.multiplyScalar(x)),E=o.projectBasic(M.toArray()),T=o.projectBasic(a.lookat.toArray()),C=E[0]-T[0],O=E[1]-T[1];return Math.abs(C)>1?C=0:C>.5?C-=1:C<-.5&&(C+=1),[C,O]}).subscribe(function(e){t._navigator.stateService.rotateBasic(e)}),this._mouseWheelSubscription=this._container.mouseService.filtered$(this._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,a=o.offsetWidth,s=o.offsetHeight,c=o.getBoundingClientRect(),u=r.clientX-c.left,h=r.clientY-c.top,l=t._unproject(u,h,a,s,n.perspective),p=i.projectBasic(l.toArray()),f=r.deltaY;1===r.deltaMode?f*=40:2===r.deltaMode&&(f*=800);var d=-3*f/s;t._navigator.stateService.zoomIn(d,p)}),this._pinchSubscription=this._container.touchService.pinch$.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,a=o.offsetWidth,s=o.offsetHeight,c=o.getBoundingClientRect(),u=t._unproject(r.centerClientX-c.left,r.centerClientY-c.top,a,s,n.perspective),h=i.projectBasic(u.toArray()),l=3*r.distanceChange/Math.min(s,a);t._navigator.stateService.zoomIn(l,h)}),this._container.mouseService.claimMouse(this._name,0)},e.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name),this._activeSubscription.unsubscribe(),this._cursorSubscription.unsubscribe(),this._movementSubscription.unsubscribe(),this._mouseWheelSubscription.unsubscribe(),this._pinchSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._unproject=function(t,e,r,n,o){var a=2*t/r-1,s=1-2*e/n;return new i.Vector3(a,s,1).unproject(o)},e.componentName="mouse",e}(s.Component);r.MouseComponent=u,s.ComponentService.register(u),Object.defineProperty(r,"__esModule",{value:!0}),r.default=u},{"../Component":207,"../Geo":210,"rxjs/Observable":28,"rxjs/add/observable/merge":43,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/withLatestFrom":76,three:157,"virtual-dom":163}],230:[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("virtual-dom"),o=t("rxjs/Observable");t("rxjs/add/operator/map"),t("rxjs/add/operator/first");var a=t("../Edge"),s=t("../Component"),c=function(t){function e(e,r,n){t.call(this,e,r,n),this._dirNames={},this._dirNames[a.EdgeDirection.StepForward]="Forward",this._dirNames[a.EdgeDirection.StepBackward]="Backward",this._dirNames[a.EdgeDirection.StepLeft]="Left",this._dirNames[a.EdgeDirection.StepRight]="Right",this._dirNames[a.EdgeDirection.TurnLeft]="Turnleft",this._dirNames[a.EdgeDirection.TurnRight]="Turnright",this._dirNames[a.EdgeDirection.TurnU]="Turnaround"}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 a=o[n],s=a.data.direction,c=t._dirNames[s];null!=c&&r.push(t._createVNode(s,c))}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}(s.Component);r.NavigationComponent=c,s.ComponentService.register(c),Object.defineProperty(r,"__esModule",{value:!0}),r.default=c},{"../Component":207,"../Edge":208,"rxjs/Observable":28,"rxjs/add/operator/first":58,"rxjs/add/operator/map":60,"virtual-dom":163}],231:[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("underscore"),o=t("virtual-dom"),a=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 s=t("../Component"),c=function(){function t(){}return t}(),u=function(){function t(){}return t}(),h=function(){function t(){this.nodeInstructions=[],this.nodeInstructionsOrdered=[]}return t}(),l=function(t){function e(e,r,n){t.call(this,e,r,n)}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 a.Observable.from(t.paths)}).distinct(function(t,e){return t.sequenceKey===e.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 a=o[i];if(a.sequenceKey===t.key){for(var s=[],c=!1,u=0,h=t.keys;u<h.length;u++){var l=h[u];if(a.startKey===l&&(c=!0),c){for(var p=null,f=0,d=a.infoKeys;f<d.length;f++){var m=d[f];m.key===l&&(p=m.description)}s.push({description:p,key:l})}a.stopKey===l&&(c=!1)}n.push({nodeInstructions:s,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;n++){var o=i[n];if(o.key===t.lastNode.key)break;r++}var s=t.routeTrack.nodeInstructions[r+1];return s?e._navigator.graphService.cacheNode$(s.key):a.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 a=o[i];if(a.key===t.key){n=a.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}(s.Component);r.RouteComponent=l,s.ComponentService.register(l),Object.defineProperty(r,"__esModule",{value:!0}),r.default=l},{"../Component":207,"rxjs/Observable":28,"rxjs/add/observable/fromPromise":42,"rxjs/add/observable/of":44,"rxjs/add/operator/combineLatest":49,"rxjs/add/operator/distinct":52,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/mergeMap":63,"rxjs/add/operator/pluck":65,"rxjs/add/operator/scan":68,underscore:158,"virtual-dom":163}],232:[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("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"),a=function(t){function e(e,r,n){t.call(this,e,r,n)}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(),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()},e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._imageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="stats",e}(o.Component);r.StatsComponent=a,o.ComponentService.register(a),Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Component":207,"rxjs/Observable":28,"rxjs/add/operator/buffer":47,"rxjs/add/operator/debounceTime":51,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/scan":68}],233:[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("virtual-dom"),o=t("rxjs/Observable"),a=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 s=t("../../Component"),c=function(t){function e(e,r,n){t.call(this,e,r,n),this._renderer=new s.DirectionDOMRenderer(this.defaultConfiguration,r.element),this._hoveredKeySubject$=new a.Subject,this._hoveredKey$=this._hoveredKeySubject$.share()}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}(s.Component);r.DirectionComponent=c,s.ComponentService.register(c),Object.defineProperty(r,"__esModule",{value:!0}),r.default=c},{"../../Component":207,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/do":54,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/share":69,"virtual-dom":163}],234:[function(t,e,r){"use strict";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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{"../../Geo":210}],235:[function(t,e,r){"use strict";var n=t("virtual-dom"),i=t("../../Component"),o=t("../../Edge"),a=t("../../Geo"),s=function(){function t(t,e){this._isEdge=!1,this._spatial=new a.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.concat(this._createPerspectiveToPanoArrows(t,e)),r=r.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.camera,r=this._directionFromCamera(e),n=this._getRotation(r,e.up);Math.abs(n.phi-this._rotation.phi)<this._epsilon||(this._rotation=n,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=n[r],a=i.data.direction;this._stepDirections.indexOf(a)>-1?this._stepEdges.push(i):this._turnDirections.indexOf(a)>-1?this._turnEdges.push(i):i.data.direction===o.EdgeDirection.Pano&&this._panoEdges.push(i)}if(this._distinguishSequence&&null!=e)for(var s=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges),c=0,u=s;c<u.length;c++)for(var i=u[c],h=i.to,l=0,p=e.keys;l<p.length;l++){var f=p[l];if(f===h){this._sequenceEdgeKeys.push(h);break}}},t.prototype._directionFromCamera=function(t){return t.lookat.clone().sub(t.position)},t.prototype._getRotation=function(t,e){var r=t.clone().dot(e),n=t.clone().sub(e.clone().multiplyScalar(r)),i=Math.atan2(n.y,n.x),o=Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1]);return{phi:i,theta:o}},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 a=0,s=this._stepEdges;a<s.length;a++){var c=s[a];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 a=Math.PI/8,s=n.phi;switch(i){case o.EdgeDirection.StepBackward:s=n.phi-Math.PI;break;case o.EdgeDirection.StepLeft:s=n.phi+Math.PI/2;break;case o.EdgeDirection.StepRight:s=n.phi-Math.PI/2}return Math.abs(this._spatial.wrapAngle(r-s))<a?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,a=this._turnNames[o];e.push(this._createVNodeByTurn(t,i.to,a,o))}return e},t.prototype._createVNodeByKey=function(t,e,r,n,i,o,a){var s=function(r){t.moveToKey$(e).subscribe(function(t){},function(t){console.error(t)})};return this._createVNode(e,r,n,i,o,"DirectionsCircle",s,a)},t.prototype._createVNodeByDirection=function(t,e,r,n,i){var o=function(e){t.moveDir$(i).subscribe(function(t){},function(t){console.error(t)})};return this._createVNode(e,r,n,this._calculator.outerRadius,"DirectionsArrowStep","DirectionsCircle",o)},t.prototype._createVNodeByTurn=function(t,e,r,i){var a=function(e){t.moveDir$(i).subscribe(function(t){},function(t){console.error(t)})},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 c={attributes:{"data-key":e},onclick:a,style:s},u="TurnCircle";this._sequenceEdgeKeys.indexOf(e)>-1&&(u+="Sequence"),this._highlightKey===e&&(u+="Highlight");var h=n.h("div."+r,{},[]);return n.h("div."+u,c,[h])},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,a,s,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=-f*p[1],m=f*p[0],v="drop-shadow("+d+"px "+m+"px 1px rgba(0,0,0,0.8))",g={style:{"-webkit-filter":v,filter:v}},y=n.h("div."+o,g,[]),b=-this._spatial.radToDeg(e-r.phi),_=c?"translate("+h+"px, "+l+"px) rotate("+b+"deg) translateZ(-0.01px)":"translate("+h+"px, "+l+"px) rotate("+b+"deg)",x={attributes:{"data-key":t},onclick:s,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:_,width:this._calculator.stepCircleSizeCss}};return this._sequenceEdgeKeys.indexOf(t)>-1&&(a+="Sequence"),this._highlightKey===t&&(a+="Highlight"),n.h("div."+a,x,[y])},t.prototype._getContainer=function(t,e,r){var i=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",o={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",{style:o},e.concat(t))},t}();r.DirectionDOMRenderer=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../../Component":207,"../../Edge":208,"../../Geo":210,"virtual-dom":163}],236:[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("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/of"),t("rxjs/add/operator/debounceTime"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap"),t("rxjs/add/operator/withLatestFrom");var a=t("../../Component"),s=t("../../Render"),c=t("../../Graph"),u=t("../../Utils"),h=function(t){function e(e,r,n){t.call(this,e,r,n),this._rendererOperation$=new o.Subject,this._rendererCreator$=new o.Subject,this._rendererDisposer$=new o.Subject,this._renderer$=this._rendererOperation$.scan(function(t,e){return e(t)},null).filter(function(t){return null!=t}).distinctUntilChanged(void 0,function(t){return t.frameId}),this._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 a.ImagePlaneGLRenderer}}).subscribe(this._rendererOperation$),this._rendererDisposer$.map(function(){return function(t){return t.dispose(),null}}).subscribe(this._rendererOperation$)}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:s.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$),this._nodeSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$,this._configuration$).debounceTime(1e3).withLatestFrom(this._navigator.stateService.currentTransform$,function(t,e){return[t[0],t[1],e]}).map(function(t){var e=t[0],r=t[1],n=t[2],i=u.Settings.maxImageSize;return e.pano&&("high"===r.maxPanoramaResolution?i=Math.max(i,Math.min(4096,Math.max(n.width,n.height))):"full"===r.maxPanoramaResolution&&(i=Math.max(i,n.width,n.height))),[e,i]}).filter(function(t){var e=t[0],r=t[1];return e.pano?r>u.Settings.basePanoramaSize:r>u.Settings.baseImageSize}).switchMap(function(t){var e=t[0],r=t[1],n=e.pano&&r>u.Settings.maxImageSize?c.ImageLoader.loadDynamic(e.key,r):c.ImageLoader.loadThumbnail(e.key,r);return n.filter(function(t){return null!=t.object}).first().map(function(t){return t.object}).zip(i.Observable.of(e),function(t,e){return[t,e]}).catch(function(t,r){return console.error("Failed to fetch high res image ("+e.key+")",t),i.Observable.empty()})}).map(function(t){return function(e){return e.updateTexture(t[0],t[1]),e}}).subscribe(this._rendererOperation$)},e.prototype._deactivate=function(){this._rendererDisposer$.next(null),this._rendererSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._nodeSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{maxPanoramaResolution:"auto"}},e.componentName="imagePlane",e}(a.Component);r.ImagePlaneComponent=h,a.ComponentService.register(h),Object.defineProperty(r,"__esModule",{value:!0}),r.default=h},{"../../Component":207,"../../Graph":211,"../../Render":213,"../../Utils":215,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/observable/of":44,"rxjs/add/operator/debounceTime":51,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/scan":68,"rxjs/add/operator/switchMap":73,"rxjs/add/operator/withLatestFrom":76}],237:[function(t,e,r){"use strict";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){var r=t.pano?this._createImageSphere(t,e):this._createImagePlane(t,e);return r},t.prototype._createImageSphere=function(t,e){var r=this._createTexture(t.image),i=this._createSphereMaterialParameters(e,r),o=new n.ShaderMaterial(i),a=this._useMesh(e,t)?new n.Mesh(this._getImageSphereGeo(e,t),o):new n.Mesh(this._getFlatImageSphereGeo(e),o);return a},t.prototype._createImagePlane=function(t,e){var r=this._createTexture(t.image),i=this._createPlaneMaterialParameters(e,r),o=new n.ShaderMaterial(i),a=this._useMesh(e,t)?this._getImagePlaneGeo(e,t):this._getFlatImagePlaneGeo(e);return new n.Mesh(a,o)},t.prototype._createSphereMaterialParameters=function(t,e){var r=t.gpano,o=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2,a=2*Math.PI*(r.CroppedAreaLeftPixels-o)/r.FullPanoWidthPixels,s=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,l={depthWrite:!1,fragmentShader:i.ImagePlaneShaders.equirectangular.fragment,side:n.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},phiLength:{type:"f",value:s},phiShift:{type:"f",value:a},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};return l},t.prototype._createPlaneMaterialParameters=function(t,e){var r={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};return r},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.scale>.01&&t.scale<50},t.prototype._getImageSphereGeo=function(t,e){for(var r=(new n.Matrix4).getInverse(t.srt),i=5*t.scale,o=this._imageSphereRadius*t.scale,a=e.mesh.vertices,s=a.length/3,c=new Float32Array(a.length),u=0;u<s;++u){var h=3*u,l=a[h+0],p=a[h+1],f=a[h+2],d=Math.sqrt(l*l+p*p+f*f),m=Math.max(i,Math.min(d,o)),v=m/d,g=new n.Vector3(l*v,p*v,f*v);g.applyMatrix4(r),c[h+0]=g.x,c[h+1]=g.y,c[h+2]=g.z}for(var y=e.mesh.faces,b=new Uint16Array(y.length),u=0;u<y.length;++u)b[u]=y[u];var _=new n.BufferGeometry;return _.addAttribute("position",new n.BufferAttribute(c,3)),_.setIndex(new n.BufferAttribute(b,1)),_},t.prototype._getImagePlaneGeo=function(t,e){for(var r=(new n.Matrix4).getInverse(t.srt),i=5*t.scale,o=this._imagePlaneDepth*t.scale,a=e.mesh.vertices,s=a.length/3,c=new Float32Array(a.length),u=0;u<s;++u){var h=3*u,l=a[h+0],p=a[h+1],f=a[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,a=Math.PI*e.CroppedAreaImageHeightPixels/e.FullPanoHeightPixels,s=new n.SphereGeometry(this._imageSphereRadius,20,40,r-Math.PI/2,i,o,a);return s.applyMatrix((new n.Matrix4).getInverse(t.rt)),s},t.prototype._getFlatImagePlaneGeo=function(t){var e=t.width,r=t.height,i=Math.max(e,r),o=e/2/i,a=r/2/i,s=[];s.push(t.unprojectSfM([-o,-a],this._imagePlaneDepth)),s.push(t.unprojectSfM([o,-a],this._imagePlaneDepth)),s.push(t.unprojectSfM([o,a],this._imagePlaneDepth)),s.push(t.unprojectSfM([-o,a],this._imagePlaneDepth));for(var c=new Float32Array(12),u=0;u<s.length;u++){var h=3*u;c[h+0]=s[u][0],c[h+1]=s[u][1],c[h+2]=s[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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../../Component":207,three:157}],238:[function(t,e,r){"use strict";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._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.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.updateTexture=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],o=i.material,a=o.uniforms.projectorTex.value;
-a.image=t,a.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++){var o=i[n];o.material.uniforms.opacity.value=r}for(var a=0,s=this._imagePlaneScene.imagePlanesOld;a<s.length;a++){var o=s[a];o.material.uniforms.opacity.value=this._alphaOld}e.render(this._imagePlaneScene.scene,t),e.render(this._imagePlaneScene.sceneOld,t);for(var c=0,u=this._imagePlaneScene.imagePlanes;c<u.length;c++){var o=u[c];o.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;if(this._previousKey=null!=t.previousNode?t.previousNode.key:null,null!=this._previousKey&&this._previousKey!==this._currentKey){var e=this._imagePlaneFactory.createMesh(t.previousNode,t.previousTransform);this._imagePlaneScene.updateImagePlanes([e])}this._currentKey=t.currentNode.key;var r=this._imagePlaneFactory.createMesh(t.currentNode,t.currentTransform);return this._imagePlaneScene.updateImagePlanes([r]),this._alphaOld=1,!0},t}();r.ImagePlaneGLRenderer=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../../Component":207,"../../Geo":210}],239:[function(t,e,r){"use strict";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++){var n=r[e];this.scene.remove(n),this.sceneOld.add(n)}for(var i=0,o=t;i<o.length;i++){var n=o[i];this.scene.add(n)}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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{three:157}],240:[function(t,e,r){"use strict";var n=(t("path"),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:21}],241:[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("virtual-dom"),o=t("rxjs/Observable"),a=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("../../Graph"),c=t("../../State"),u=t("../../Render"),h=t("../../Utils"),l=t("../../Component"),p=function(){function t(){this._imagePlaneFactory=new l.ImagePlaneFactory,this._imagePlaneScene=new l.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._motionless=!1,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._motionless||this._currentPano},enumerable:!0,configurable:!0}),t.prototype.update=function(t){this._updateFrameId(t.id);var e=this._updateImagePlanes(t.state);e=this._updateCurtain(t.state.alpha)||e,this._glNeedsRender=e||this._glNeedsRender,this._domNeedsRender=e||this._domNeedsRender},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],a=o.material,s=a.uniforms.projectorTex.value;s.image=t,s.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._motionless=t.motionless,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._motionless=t.motionless,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++){var r=e[t],n=r.material,i=n.uniforms.bbox.value;i.z=this._curtain}},t}(),f=function(t){function e(e,r,n){t.call(this,e,r,n),this._sliderStateOperation$=new a.Subject,this._sliderStateCreator$=new a.Subject,this._sliderStateDisposer$=new a.Subject,this._sliderState$=this._sliderStateOperation$.scan(function(t,e){return e(t)},null).filter(function(t){return null!=t}).distinctUntilChanged(void 0,function(t){return t.frameId}),this._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 p}}).subscribe(this._sliderStateOperation$),this._sliderStateDisposer$.map(function(){return function(t){return t.dispose(),null}}).subscribe(this._sliderStateOperation$)}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._container.mouseService.preventDefaultMouseDown$.next(!1),this._container.touchService.preventDefaultTouchMove$.next(!1),o.Observable.combineLatest(this._navigator.stateService.state$,this._configuration$).first().subscribe(function(e){if(e[0]===c.State.Traversing){t._navigator.stateService.wait();var r=e[1].initialPosition;t._navigator.stateService.moveTo(null!=r?r:1)}}),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:u.GLRenderStage.Background}};return e.clearGLNeedsRender(),r}).subscribe(this._container.glRenderer.render$),this._domRenderSubscription=this._sliderState$.filter(function(t){return t.domNeedsRender}).map(function(e){var r=i.h("input.SliderControl",{max:1e3,min:0,type:"range",value:1e3*e.curtain},[]),n=e.disabled||!e.sliderVisible?null:i.h("div.SliderWrapper",{},[r]),o={name:t._name,vnode:n};return e.clearDomNeedsRender(),o}).subscribe(this._container.domRenderer.render$),this._elementSubscription=this._container.domRenderer.element$.map(function(t){var e=t.getElementsByClassName("SliderControl"),r=e.length>0?e[0]:null;return r}).filter(function(t){return null!=t}).switchMap(function(t){return o.Observable.fromEvent(t,"input")}).map(function(t){return Number(t.target.value)/1e3}).subscribe(function(e){t._navigator.stateService.moveTo(e)}),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 o.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){if(null==e.state.currentNode||null==e.state.previousNode||e.state.currentNode.key!==e.nodes.foreground.key||e.state.previousNode.key!==e.nodes.background.key){if(e.state.currentNode.key===e.nodes.background.key)return void t._navigator.stateService.setNodes([e.nodes.foreground]);if(e.state.currentNode.key===e.nodes.foreground.key&&1===e.state.trajectory.length)return void t._navigator.stateService.prependNodes([e.nodes.background]);t._navigator.stateService.setNodes([e.nodes.background]),t._navigator.stateService.setNodes([e.nodes.foreground])}},function(t){console.log(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=o.Observable.merge(e,this._navigator.stateService.currentNode$).filter(function(t){return t.pano?h.Settings.maxImageSize>h.Settings.basePanoramaSize:h.Settings.maxImageSize>h.Settings.baseImageSize}).mergeMap(function(t){return s.ImageLoader.loadThumbnail(t.key,h.Settings.maxImageSize).filter(function(t){return null!=t.object}).first().map(function(t){return t.object}).zip(o.Observable.of(t),function(t,e){return[t,e]}).catch(function(e,r){return console.error("Failed to fetch high res slider image ("+t.key+")",e),o.Observable.empty()})}).map(function(t){return function(e){return e.updateTexture(t[0],t[1]),e}}).subscribe(this._sliderStateOperation$)},e.prototype._deactivate=function(){var t=this;this._container.mouseService.preventDefaultMouseDown$.next(!0),this._container.touchService.preventDefaultTouchMove$.next(!0),this._navigator.stateService.state$.first().subscribe(function(e){e===c.State.Waiting&&t._navigator.stateService.traverse()}),this._sliderStateDisposer$.next(null),this._setKeysSubscription.unsubscribe(),this._setSliderVisibleSubscription.unsubscribe(),this._elementSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this.configure({keys:null})},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._catchCacheNode$=function(t){return this._navigator.graphService.cacheNode$(t).catch(function(e,r){return console.log("Failed to cache slider node ("+t+")",e),o.Observable.empty()})},e.componentName="slider",e}(l.Component);r.SliderComponent=f,l.ComponentService.register(f),Object.defineProperty(r,"__esModule",{value:!0}),r.default=f},{"../../Component":207,"../../Graph":211,"../../Render":213,"../../State":214,"../../Utils":215,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/observable/fromEvent":41,"rxjs/add/observable/of":44,"rxjs/add/observable/zip":46,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/first":58,"rxjs/add/operator/map":60,"rxjs/add/operator/merge":61,"rxjs/add/operator/mergeMap":63,"rxjs/add/operator/scan":68,"rxjs/add/operator/switchMap":73,"rxjs/add/operator/withLatestFrom":76,"rxjs/add/operator/zip":77,"virtual-dom":163}],242:[function(t,e,r){"use strict";var n=function(){function t(t,e){this.visibleInKeys=[],this._id=e.id,this._latLonAlt=t,this._markerOptions=e,this._type=e.type}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"latLonAlt",{get:function(){return this._latLonAlt},enumerable:!0,configurable:!0}),t}();r.Marker=n,Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],243:[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("underscore"),o=t("three"),a=t("rbush"),s=t("rxjs/Observable"),c=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/filter"),t("rxjs/add/operator/map"),t("rxjs/add/operator/publishReplay"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/switchMap");var u=t("../../Component"),h=t("../../Render"),l=t("../../Geo"),p=function(){function t(){this._create$=new c.Subject,this._remove$=new c.Subject,this._update$=new c.Subject,this._markers$=this._update$.scan(function(t,e){return e(t)},{hash:{},spatial:a(16,[".lon",".lat",".lon",".lat"])}).map(function(t){return t.spatial}).publishReplay(1).refCount(),this._create$.map(function(t){return function(e){e.hash[t.id]&&e.spatial.remove(e.hash[t.id]);var r={id:t.id,lat:t.latLonAlt.lat,lon:t.latLonAlt.lon,marker:t};return e.spatial.insert(r),e.hash[t.id]=r,e}}).subscribe(this._update$),this._remove$.map(function(t){return function(e){var r=e.hash[t];return e.spatial.remove(r),delete e.hash[t],e}}).subscribe(this._update$)}return t.prototype.addMarker=function(t){this._create$.next(t)},t.prototype.removeMarker=function(t){this._remove$.next(t)},Object.defineProperty(t.prototype,"markers$",{get:function(){return this._markers$},enumerable:!0,configurable:!0}),t}();r.MarkerSet=p;var f=function(t){function e(e,r,n){t.call(this,e,r,n)}return n(e,t),e.prototype._activate=function(){var t=this;this._scene=new o.Scene,this._markerSet=new p,this._markerObjects={},this._disposable=s.Observable.combineLatest([this._navigator.stateService.currentState$,this._markerSet.markers$],function(t,e){return{frame:t,markers:e}}).distinctUntilChanged(void 0,function(t){return t.frame.id}).map(function(e){return t._renderHash(e)}).subscribe(this._container.glRenderer.render$)},e.prototype._deactivate=function(){this._disposeScene(),this._disposable.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype.createMarker=function(t,e){return"marker"===e.type?new u.SimpleMarker(t,e):null},e.prototype.addMarker=function(t){this._markerSet.addMarker(t)},Object.defineProperty(e.prototype,"markers$",{get:function(){return this._markerSet.markers$},enumerable:!0,configurable:!0}),e.prototype.removeMarker=function(t){this._markerSet.removeMarker(t)},e.prototype._renderHash=function(t){var e=this._updateScene(t);return{name:this._name,render:{frameId:t.frame.id,needsRender:e,render:this._render.bind(this),stage:h.GLRenderStage.Foreground}}},e.prototype._updateScene=function(t){if(!t.frame||!t.markers||!t.frame.state.currentNode)return!1;var e=!1,r=this._markerObjects,n=t.frame.state.currentNode;this._markerObjects={};for(var o=.001,a=n.latLon.lon-o/2,s=n.latLon.lat-o/2,c=n.latLon.lon+o/2,u=n.latLon.lat+o/2,h=i.map(t.markers.search({maxX:c,maxY:u,minX:a,minY:s}),function(t){return t.marker}).filter(function(t){return 0===t.visibleInKeys.length||i.contains(t.visibleInKeys,n.key)}),p=0,f=h;p<f.length;p++){var d=f[p];if(d.id in r)this._markerObjects[d.id]=r[d.id],delete r[d.id];else{var m=t.frame.state.reference,v=(new l.GeoCoords).geodeticToEnu(d.latLonAlt.lat,d.latLonAlt.lon,d.latLonAlt.alt,m.lat,m.lon,m.alt),g=d.createGeometry();g.position.set(v[0],v[1],v[2]),this._scene.add(g),this._markerObjects[d.id]=g,e=!0}}for(var y in r)r.hasOwnProperty(y)&&(this._disposeObject(r[y]),e=!0);return e},e.prototype._render=function(t,e){e.render(this._scene,t)},e.prototype._disposeObject=function(t){this._scene.remove(t);for(var e=0;e<t.children.length;++e){var r=t.children[e];r.geometry.dispose(),r.material.dispose()}},e.prototype._disposeScene=function(){for(var t in this._markerObjects)this._markerObjects.hasOwnProperty(t)&&this._disposeObject(this._markerObjects[t]);this._markerObjects={}},e.componentName="marker",e}(u.Component);r.MarkerComponent=f,u.ComponentService.register(f),Object.defineProperty(r,"__esModule",{value:!0}),r.default=f},{"../../Component":207,"../../Geo":210,"../../Render":213,rbush:24,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/switchMap":73,three:157,underscore:158}],244:[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("three"),o=t("../../Component"),a=function(t){function e(e,r){t.call(this,e,r),this._circleToRayAngle=2,this._simpleMarkerStyle=r.style}return n(e,t),e.prototype.createGeometry=function(){var t=2,e=new i.Mesh(this._markerGeometry(t,16,8),new i.MeshBasicMaterial({color:this._stringToRBG(this._simpleMarkerStyle.color),depthWrite:!1,opacity:this._simpleMarkerStyle.opacity,shading:i.SmoothShading,transparent:!0})),r=new i.Mesh(new i.SphereGeometry(t/2,16,8),new i.MeshBasicMaterial({color:this._stringToRBG(this._simpleMarkerStyle.ballColor),depthWrite:!1,opacity:this._simpleMarkerStyle.ballOpacity,shading:i.SmoothShading,transparent:!0}));r.position.z=this._markerHeight(t);var n=new i.Object3D;return n.add(r),n.add(e),n},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),a=[],s=0;s<=r;++s){for(var c=[],u=0;u<=e;++u){var h=u/e*Math.PI*2,l=s/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)}a.push(c)}for(var s=0;s<r;++s)for(var u=0;u<e;++u){var m=a[s][u+1],v=a[s][u],g=a[s+1][u],y=a[s+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.prototype._stringToRBG=function(t){for(var e=0,r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);return e},e}(o.Marker);r.SimpleMarker=a,Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../../Component":207,three:157}],245:[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("rxjs/Observable"),o=t("rxjs/Subject");t("rxjs/add/observable/combineLatest"),t("rxjs/add/observable/of"),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 a=t("../../Component"),s=t("../../Edge"),c=function(t){function e(e,r,n){t.call(this,e,r,n),this._nodesAhead=5,this._configurationOperation$=new o.Subject,this._sequenceDOMRenderer=new a.SequenceDOMRenderer(r.element),this._sequenceDOMInteraction=new a.SequenceDOMInteraction,this._containerWidth$=new o.Subject,this._hoveredKeySubject$=new o.Subject,this._hoveredKey$=this._hoveredKeySubject$.share(),this._edgeStatus$=this._navigator.stateService.currentNode$.switchMap(function(t){return t.sequenceEdges$}).publishReplay(1).refCount()}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(),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++){var o=i[n];if(o.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:s.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([s.EdgeDirection.Next,s.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.fire(e.playingchanged,!0)},e.prototype._stop=function(){this._playingSubscription.unsubscribe(),this._playingSubscription=null,this.fire(e.playingchanged,!1)},e.componentName="sequence",e.playingchanged="playingchanged",e}(a.Component);r.SequenceComponent=c,a.ComponentService.register(c),Object.defineProperty(r,"__esModule",{value:!0}),r.default=c},{"../../Component":207,"../../Edge":208,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/observable/of":44,"rxjs/add/operator/concat":50,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/finally":57,"rxjs/add/operator/first":58,"rxjs/add/operator/map":60,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/share":69,"rxjs/add/operator/switchMap":73,"rxjs/add/operator/takeUntil":75,"rxjs/add/operator/withLatestFrom":76}],246:[function(t,e,r){"use strict";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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{"rxjs/Subject":33}],247:[function(t,e,r){"use strict";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,a,s){if(e.visible===!1)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,a,s),m={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 a=(r-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth),s=(n-this._minThresholdHeight)/(this._maxThresholdHeight-this._minThresholdHeight),c=Math.max(0,Math.min(1,Math.min(a,s)));return i+c*(o-i)},t.prototype._createPlayingButton=function(t,e,r,o){var a=r.direction===i.EdgeDirection.Next&&null!=t||r.direction===i.EdgeDirection.Prev&&null!=e,s=r.playing?function(t){o.stop()}:a?function(t){o.play()}:null,c={onclick:s,style:{}},u=r.playing?"Stop":a?"Play":"PlayDisabled",h=n.h("div.SequenceComponentIcon",{className:u},[]),l=a?"SequencePlay":"SequencePlayDisabled";return n.h("div."+l,c,[h])},t.prototype._createSequenceArrows=function(t,e,r,o,a){var s={onclick:null!=t?function(t){a.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){a.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,s,[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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../../Edge":208,"virtual-dom":163}],248:[function(t,e,r){"use strict";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 a=t("./geometry/PolygonGeometry");r.PolygonGeometry=a.PolygonGeometry;var s=t("./tag/OutlineTag");r.OutlineTag=s.OutlineTag;var c=t("./tag/SpotTag");r.SpotTag=c.SpotTag;var u=t("./tag/Alignment");r.Alignment=u.Alignment;var h=t("./TagComponent");r.TagComponent=h.TagComponent},{"./TagComponent":249,"./error/GeometryTagError":255,"./geometry/PointGeometry":257,"./geometry/PolygonGeometry":258,"./geometry/RectGeometry":259,"./tag/Alignment":261,"./tag/OutlineTag":264,"./tag/SpotTag":267}],249:[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("three"),o=t("rxjs/Observable"),a=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 s=t("../../Component"),c=t("../../Render"),u=function(t){function e(r,n,i){var c=this;t.call(this,r,n,i),this._tagDomRenderer=new s.TagDOMRenderer,this._tagSet=new s.TagSet,this._tagCreator=new s.TagCreator,this._tagGlRendererOperation$=new a.Subject,this._tagGlRenderer$=this._tagGlRendererOperation$.startWith(function(t){return t}).scan(function(t,e){return e(t)},new s.TagGLRenderer),this._tags$=this._tagSet.tagData$.map(function(t){for(var e=[],r=0,n=Object.keys(t).sort();r<n.length;r++){var i=n[r];e.push(t[i])}return e}).share(),this._renderTags$=this.tags$.withLatestFrom(this._navigator.stateService.currentTransform$).map(function(t){var e=t[0],r=t[1],n=e.map(function(t){if(t instanceof s.OutlineTag)return new s.OutlineRenderTag(t,r);if(t instanceof s.SpotTag)return new s.SpotRenderTag(t,r);throw new Error("Tag type not supported")});return n}).share(),this._tagChanged$=this._tags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return o.Observable.merge(t.changed$,t.geometryChanged$)})}).share(),this._renderTagGLChanged$=this._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.glObjectsChanged$})}).share(),this._tagInterationInitiated$=this._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$.map(function(t){return t.tag.id})})}).share(),this._tagInteractionAbort$=o.Observable.merge(this._container.mouseService.mouseUp$,this._container.mouseService.mouseLeave$).map(function(t){}).share(),this._activeTag$=this._renderTags$.switchMap(function(t){return o.Observable.from(t).mergeMap(function(t){return t.interact$})}).merge(this._tagInteractionAbort$.map(function(){return{offsetX:0,offsetY:0,operation:s.TagOperation.None,tag:null}})).share(),this._createGeometryChanged$=this._tagCreator.tag$.switchMap(function(t){return null!=t?t.geometryChanged$:o.Observable.empty()}).share(),this._tagCreated$=this._tagCreator.tag$.switchMap(function(t){return null!=t?t.created$:o.Observable.empty()}).share(),this._vertexGeometryCreated$=this._tagCreated$.map(function(t){return t.geometry}).share(),this._pointGeometryCreated$=new a.Subject,this._geometryCreated$=o.Observable.merge(this._vertexGeometryCreated$,this._pointGeometryCreated$).share(),this._basicClick$=this._container.mouseService.staticClick$.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(t,e,r){return[t,e,r]}).map(function(t){var e=t[0],r=t[1],n=t[2],i=c._mouseEventToBasic(e,c._container.element,r,n);return i}).share(),this._validBasicClick$=this._basicClick$.filter(function(t){var e=t[0],r=t[1];return 0<=e&&e<=1&&0<=r&&r<=1}).share(),this._creatingConfiguration$=this._configuration$.distinctUntilChanged(function(t,e){return t.creating===e.creating&&t.createType===e.createType},function(t){return{createColor:t.createColor,createType:t.createType,creating:t.creating}}).publishReplay(1).refCount(),this._creating$=this._creatingConfiguration$.map(function(t){return t.creating}).publishReplay(1).refCount(),this._creating$.subscribe(function(t){c.fire(e.creatingchanged,t)})}return n(e,t),Object.defineProperty(e.prototype,"tags$",{get:function(){return this._tags$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometryCreated$",{get:function(){return this._geometryCreated$},enumerable:!0,configurable:!0}),e.prototype.setTags=function(t){this._tagSet.set$.next(t)},e.prototype.startCreate=function(t){this.configure({createType:t,creating:!0})},e.prototype.stopCreate=function(){this.configure({createType:null,creating:!1})},e.prototype._activate=function(){var t=this;this._geometryCreatedEventSubscription=this._geometryCreated$.subscribe(function(r){t.fire(e.geometrycreated,r)}),this._tagsChangedEventSubscription=this._tags$.subscribe(function(r){t.fire(e.tagschanged,r)});var r=this.configuration$.switchMap(function(e){return e.creating?t._navigator.stateService.currentNode$.skip(1).take(1).map(function(t){return null}):o.Observable.empty()}),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}),a=this._pointGeometryCreated$.map(function(t){return null});this._stopCreateSubscription=o.Observable.merge(r,n,i,a).subscribe(function(){t.stopCreate()}),this._creatorConfigurationSubscription=this._configuration$.subscribe(this._tagCreator.configuration$),this._createSubscription=this._creatingConfiguration$.switchMap(function(e){return e.creating&&"rect"===e.createType||"polygon"===e.createType?t._validBasicClick$.take(1):o.Observable.empty()}).subscribe(this._tagCreator.create$),this._createPointSubscription=this._creatingConfiguration$.switchMap(function(e){return e.creating&&"point"===e.createType?t._validBasicClick$.take(1):o.Observable.empty()}).map(function(t){return new s.PointGeometry(t)}).subscribe(this._pointGeometryCreated$),this._setCreateVertexSubscription=o.Observable.combineLatest(this._container.mouseService.mouseMove$,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],a=t._mouseEventToBasic(r,t._container.element,i,o);n.geometry instanceof s.RectGeometry?n.geometry.setVertex2d(3,a,o):n.geometry instanceof s.PolygonGeometry&&n.geometry.setVertex2d(n.geometry.polygon.length-2,a,o)}),this._addPointSubscription=this._creatingConfiguration$.switchMap(function(e){var r=e.createType;return!e.creating||"rect"!==r&&"polygon"!==r?o.Observable.empty():t._basicClick$.skipUntil(t._validBasicClick$).skip(1)}).withLatestFrom(this._tagCreator.tag$,function(t,e){return[t,e]}).subscribe(function(t){var e=t[0],r=t[1];r.addPoint(e)}),this._deleteCreatedSubscription=this._creating$.subscribe(function(e){t._tagCreator.delete$.next(null)}),this._setGLCreateTagSubscription=o.Observable.merge(this._tagCreator.tag$,this._createGeometryChanged$).withLatestFrom(this._navigator.stateService.currentTransform$,function(t,e){return[t,e]}).map(function(t){return function(e){var r=t[0],n=t[1];return null==r?e.removeCreateTag():e.setCreateTag(r,n),e}}).subscribe(this._tagGlRendererOperation$),this._claimMouseSubscription=this._tagInterationInitiated$.switchMap(function(e){return t._container.mouseService.mouseMove$.takeUntil(t._tagInteractionAbort$).take(1)}).subscribe(function(e){t._container.mouseService.claimMouse(t._name,1)}),this._mouseDragSubscription=this._activeTag$.withLatestFrom(this._container.mouseService.mouseMove$,function(t,e){return[t,e]}).switchMap(function(e){var r=e[0],n=e[1];if(r.operation===s.TagOperation.None)return o.Observable.empty();var i=o.Observable.of(n).concat(t._container.mouseService.filtered$(t._name,t._container.mouseService.mouseDrag$));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!==s.TagOperation.None){var a=t._mouseEventToBasic(r,t._container.element,n,o,i.offsetX,i.offsetY);if(i.operation===s.TagOperation.Centroid)i.tag.geometry.setCentroid2d(a,o);else if(i.operation===s.TagOperation.Vertex){var c=i.tag.geometry;c.setVertex2d(i.vertexIndex,a,o)}}}),this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).subscribe(function(e){t._container.mouseService.unclaimMouse(t._name)}),this._setTagsSubscription=this._renderTags$.map(function(t){return function(e){return e.setTags(t),e}}).subscribe(this._tagGlRendererOperation$),this._updateGLTagSubscription=this._renderTagGLChanged$.map(function(t){return function(e){return e.updateTag(t),e}}).subscribe(this._tagGlRendererOperation$),this._setNeedsRenderSubscription=this._tagChanged$.map(function(t){return function(t){return t.setNeedsRender(),t}}).subscribe(this._tagGlRendererOperation$),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._tagChanged$.startWith(null),this._tagCreator.tag$.merge(this._createGeometryChanged$).startWith(null),this._configuration$,function(t,e,r,n,i,o){return[e,r,t,n,i,o]}).withLatestFrom(this._navigator.stateService.currentTransform$,function(t,e){return[t[0],t[1],t[2],t[3],t[4],t[5],e]}).map(function(e){return{name:t._name,vnode:t._tagDomRenderer.render(e[2],e[4],e[1],e[0].perspective,e[6],e[5])}}).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.withLatestFrom(this._tagGlRenderer$,function(t,e){return[t,e]}).map(function(e){var r=e[0],n=e[1];return{name:t._name,render:{frameId:r.id,needsRender:n.needsRender,render:n.render.bind(n),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$)},e.prototype._deactivate=function(){this._tagGlRendererOperation$.next(function(t){return t.dispose(),t}),this._tagSet.set$.next([]),this._tagCreator.delete$.next(null),this._claimMouseSubscription.unsubscribe(),this._mouseDragSubscription.unsubscribe(),this._unclaimMouseSubscription.unsubscribe(),this._setTagsSubscription.unsubscribe(),this._updateGLTagSubscription.unsubscribe(),this._setNeedsRenderSubscription.unsubscribe(),this._stopCreateSubscription.unsubscribe(),this._creatorConfigurationSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._createPointSubscription.unsubscribe(),this._setCreateVertexSubscription.unsubscribe(),this._addPointSubscription.unsubscribe(),this._deleteCreatedSubscription.unsubscribe(),this._setGLCreateTagSubscription.unsubscribe(),this._domSubscription.unsubscribe(),this._glSubscription.unsubscribe(),this._geometryCreatedEventSubscription.unsubscribe(),this._tagsChangedEventSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{createColor:16777215,creating:!1}},e.prototype._mouseEventToBasic=function(t,e,r,n,o,a){o=null!=o?o:0,a=null!=a?a:0;var s=e.getBoundingClientRect(),c=t.clientX-s.left-o,u=t.clientY-s.top-a,h=2*c/e.offsetWidth-1,l=1-2*u/e.offsetHeight,p=new i.Vector3(h,l,1).unproject(r.perspective),f=n.projectBasic(p.toArray());return f},e.componentName="tag",e.creatingchanged="creatingchanged",e.geometrycreated="geometrycreated",e.tagschanged="tagschanged",e}(s.Component);r.TagComponent=u,s.ComponentService.register(u),Object.defineProperty(r,"__esModule",{value:!0}),r.default=u},{"../../Component":207,"../../Render":213,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/observable/empty":39,"rxjs/add/observable/from":40,"rxjs/add/observable/merge":43,"rxjs/add/observable/of":44,"rxjs/add/operator/combineLatest":49,"rxjs/add/operator/concat":50,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/do":54,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/merge":61,"rxjs/add/operator/mergeMap":63,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/share":69,"rxjs/add/operator/skip":70,"rxjs/add/operator/skipUntil":71,"rxjs/add/operator/startWith":72,"rxjs/add/operator/switchMap":73,"rxjs/add/operator/take":74,"rxjs/add/operator/takeUntil":75,"rxjs/add/operator/withLatestFrom":76,three:157}],250:[function(t,e,r){"use strict";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(){this._tagOperation$=new n.Subject,this._create$=new n.Subject,this._delete$=new n.Subject,this._configuration$=new n.Subject,this._tag$=this._tagOperation$.scan(function(t,e){return e(t)},null).share(),this._create$.withLatestFrom(this._configuration$,function(t,e){return[t,e]}).map(function(t){return function(e){var r=t[0],n=t[1];if("rect"===n.createType){var o=new i.RectGeometry([r[0],r[1],r[0],r[1]]);return new i.OutlineCreateTag(o,{color:n.createColor})}if("polygon"===n.createType){var o=new i.PolygonGeometry([[r[0],r[1]],[r[0],r[1]],[r[0],r[1]]]);return new i.OutlineCreateTag(o,{color:n.createColor})}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,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tag$",{get:function(){return this._tag$},enumerable:!0,configurable:!0}),t}();r.TagCreator=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../../Component":207,"rxjs/Subject":33,"rxjs/add/operator/map":60,"rxjs/add/operator/scan":68,"rxjs/add/operator/share":69,"rxjs/add/operator/withLatestFrom":76}],251:[function(t,e,r){"use strict";var n=t("three"),i=t("virtual-dom"),o=function(){function t(){}return t.prototype.render=function(t,e,r,o,a,s){for(var c=(new n.Matrix4).getInverse(o.matrixWorld),u=o.projectionMatrix,h=[],l=0,p=t;l<p.length;l++){var f=p[l];h=h.concat(f.getDOMObjects(r,c,u))}null!=e&&(h=h.concat(e.getDOMObjects(a,c,u)));var d={style:{"pointer-events":s.creating?"all":"none"}};return i.h("div.TagContainer",d,h)},t.prototype.clear=function(){return i.h("div",{},[])},t}();r.TagDOMRenderer=o},{three:157,"virtual-dom":163}],252:[function(t,e,r){"use strict";var n=t("three"),i=function(){function t(){this._scene=new n.Scene,this._tags={},this._createTag=null,this._needsRender=!1}return Object.defineProperty(t.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),t.prototype.render=function(t,e){e.render(this._scene,t),this._needsRender=!1},t.prototype.setCreateTag=function(t,e){this._disposeCreateTag(),this._addCreateTag(t,e),this._needsRender=!0},t.prototype.removeCreateTag=function(){this._disposeCreateTag(),this._needsRender=!0},t.prototype.setTags=function(t){this._disposeTags();for(var e=0,r=t;e<r.length;e++){var n=r[e];this._addTag(n)}this._needsRender=!0},t.prototype.updateTag=function(t){for(var e=0,r=this._tags[t.tag.id][1];e<r.length;e++){var n=r[e];this._scene.remove(n)}this._addTag(t)},t.prototype.setNeedsRender=function(){this._needsRender=!0},t.prototype.dispose=function(){this._disposeTags(),this._disposeCreateTag(),this._needsRender=!1},t.prototype._addTag=function(t){var e=t.glObjects;this._tags[t.tag.id]=[t,[]];for(var r=0,n=e;r<n.length;r++){var i=n[r];this._tags[t.tag.id][1].push(i),this._scene.add(i)}},t.prototype._addCreateTag=function(t,e){var r=t.getGLObject(e);this._createTag=r,this._scene.add(r)},t.prototype._disposeTags=function(){for(var t=0,e=Object.keys(this._tags);t<e.length;t++){for(var r=e[t],n=0,i=this._tags[r][1];n<i.length;n++){var o=i[n];this._scene.remove(o)}this._tags[r][0].dispose(),delete this._tags[r]}},t.prototype._disposeCreateTag=function(){if(null!=this._createTag){var t=this._createTag;this._scene.remove(t),t.geometry.dispose(),t.material.dispose(),this._createTag=null}},t}();r.TagGLRenderer=i},{three:157}],253:[function(t,e,r){"use strict";!function(t){t[t.None=0]="None",t[t.Centroid=1]="Centroid",t[t.Vertex=2]="Vertex"}(r.TagOperation||(r.TagOperation={}));var n=r.TagOperation;Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],254:[function(t,e,r){"use strict";var n=t("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/scan"),t("rxjs/add/operator/share");var i=function(){function t(){this._tagDataOperation$=new n.Subject,this._set$=new n.Subject,this._tagData$=this._tagDataOperation$.scan(function(t,e){return e(t)},{}).share(),this._set$.map(function(t){return function(e){for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];delete e[i]}for(var o=0,a=t;o<a.length;o++){var s=a[o];e[s.id]=s}return e}}).subscribe(this._tagDataOperation$)}return Object.defineProperty(t.prototype,"tagData$",{get:function(){return this._tagData$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"set$",{get:function(){return this._set$},enumerable:!0,configurable:!0}),t}();r.TagSet=i,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{"rxjs/Subject":33,"rxjs/add/operator/map":60,"rxjs/add/operator/scan":68,"rxjs/add/operator/share":69}],255:[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("../../../Error"),o=function(t){function e(e){t.call(this),this.name="GeometryTagError",this.message=null!=e?e:"The provided geometry value is incorrect"}return n(e,t),e}(i.MapillaryError);r.GeometryTagError=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i.MapillaryError},{"../../../Error":209}],256:[function(t,e,r){"use strict";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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{"rxjs/Subject":33}],257:[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("../../../Component"),o=function(t){function e(e){t.call(this);var r=e[0],n=e[1];if(r<0||r>1||n<0||n>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].");this._point=e.slice()}return n(e,t),Object.defineProperty(e.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),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":207}],258:[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("../../../Component"),o=function(t){function e(e,r){t.call(this);var n=e.length;if(n<3)throw new i.GeometryTagError("A polygon must have three or more positions.");if(e[0][0]!==e[n-1][0]||e[0][1]!==e[n-1][1])throw new i.GeometryTagError("First and last positions must be equivalent.");this._polygon=[];for(var o=0,a=e;o<a.length;o++){var s=a[o];if(s[0]<0||s[0]>1||s[1]<0||s[1]>1)throw new i.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");this._polygon.push(s.slice())}if(this._holes=[],null!=r)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.");this._holes.push([]);for(var l=0,p=u;l<p.length;l++){var s=p[l];if(s[0]<0||s[0]>1||s[1]<0||s[1]>1)throw new i.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");this._holes[c].push(s.slice())}}}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.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),a=Math.min.apply(Math,n),s=Math.max.apply(Math,n),c=this._getCentroid2d(),u=-i,h=1-o,l=-a,p=1-s,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.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],o=i.map(function(e){return t.unprojectBasic(e,200)});e.push(o)}return e},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._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],a=t[i][1],s=t[i+1][0],c=t[i+1][1],u=o*c-s*a;e+=u,r+=(o+s)*u,n+=(a+c)*u}return e/=2,r/=6*e,n/=6*e,[r,n]},e}(i.VertexGeometry);r.PolygonGeometry=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../../../Component":207}],259:[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("../../../Component"),o=function(t){function e(e){if(t.call(this),e[1]>e[3])throw new i.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var r=0,n=e;r<n.length;r++){var o=n[r];if(o<0||o>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}this._rect=e.slice(0,4),this._rect[0]>this._rect[2]&&(this._inverted=!0)}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 a=t<2&&i[0]>.75&&n[0]<.25||t>=2&&this._inverted&&i[0]>.75&&n[2]<.25,s=t<2&&this._inverted&&i[0]<.25&&n[0]>.75||t>=2&&i[0]<.25&&n[2]>.75;a||s?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],a=r[3],s=n+(i-n)/2,c=o+(a-o)/2,u=0;if(null!=e.gpano&&e.gpano.CroppedAreaImageWidthPixels===e.gpano.FullPanoWidthPixels)u=this._inverted?t[0]+1-s:t[0]-s;else{var h=-n,l=1-i;u=Math.max(h,Math.min(l,t[0]-s))}var p=-o,f=1-a,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.getVertex3d=function(t,e){return e.unprojectBasic(this._rectToVertices2d(this._rect)[t],200)},e.prototype.getVertices3d=function(t){return this._rectToVertices2d(this._rect).map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getCentroid3d=function(t){var e=this._rect,r=e[0],n=this._inverted?e[2]+1:e[2],i=e[1],o=e[3],a=r+(n-r)/2,s=i+(o-i)/2;return t.unprojectBasic([a,s],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=10,i=[],o=0;o<r;++o)for(var a=e[o][0],s=e[o][1],c=e[o+1][0],u=e[o+1][1],h=(c-a)/(n-1),l=(u-s)/(n-1),p=0;p<n;++p){var f=[a+p*h,s+p*l];i.push(f)}return i},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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../../../Component":207}],260:[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("earcut"),o=t("../../../Component"),a=function(t){function e(){t.call(this)}return n(e,t),e.prototype._triangulate=function(t,e,r,n){for(var o=[t.slice(0,-1)],a=0,s=null!=r?r:[];a<s.length;a++){var c=s[a];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}(o.Geometry);r.VertexGeometry=a,Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../../../Component":207,earcut:6}],261:[function(t,e,r){"use strict";!function(t){t[t.Center=0]="Center",t[t.Outer=1]="Outer"}(r.Alignment||(r.Alignment={}));var n=r.Alignment;Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],262:[function(t,e,r){"use strict";var n=t("three"),i=t("virtual-dom"),o=t("rxjs/Subject"),a=t("../../../Component"),s=function(){function t(t,e){this._geometry=t,this._options={color:null==e.color?16777215:e.color},this._created$=new o.Subject,this._aborted$=new o.Subject}return Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"created$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"aborted$",{get:function(){return this._aborted$},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.getGLObject=function(t){var e=this._geometry.getPoints3d(t),r=this._getPositions(e),i=new n.BufferGeometry;i.addAttribute("position",new n.BufferAttribute(r,3));var o=new n.LineBasicMaterial({color:this._options.color,linewidth:1});return new n.Line(i,o)},t.prototype.getDOMObjects=function(t,e,r){var n=this,o=[],s=function(t){t.stopPropagation(),n._aborted$.next(n)};if(this._geometry instanceof a.RectGeometry){var c=this._geometry.getVertex3d(1,t),u=this._convertToCameraSpace(c,e);if(u.z<0){var h=this._projectToCanvas(u,r),l=h.map(function(t){return 100*t+"%"}),p={style:{background:"#"+("000000"+this._options.color.toString(16)).substr(-6),left:l[0],position:"absolute",top:l[1]}},f={onclick:s,style:{left:l[0],position:"absolute",top:l[1]}};o.push(i.h("div.TagInteractor",f,[])),o.push(i.h("div.TagVertex",p,[]))}}else if(this._geometry instanceof a.PolygonGeometry){var d=this._geometry,m=this._geometry.getVertex3d(0,t),v=this._convertToCameraSpace(m,e);if(v.z<0){var h=this._projectToCanvas(v,r),l=h.map(function(t){return 100*t+"%"}),g=d.polygon.length>4?function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-2),n._created$.next(n)}:s,f={onclick:g,style:{left:l[0],position:"absolute",top:l[1]}},y=d.polygon.length>4?"TagCompleter":"TagInteractor";o.push(i.h("div."+y,f,[]))}if(d.polygon.length>3){var b=this._geometry.getVertex3d(d.polygon.length-3,t),_=this._convertToCameraSpace(b,e);if(_.z<0){var h=this._projectToCanvas(_,r),l=h.map(function(t){return 100*t+"%"}),x=function(t){t.stopPropagation(),d.removeVertex2d(d.polygon.length-3)},f={onclick:x,style:{left:l[0],position:"absolute",top:l[1]}};o.push(i.h("div.TagInteractor",f,[]))}}var w=this._geometry.getVertices3d(t);w.splice(-2,2);for(var S=0,M=w;S<M.length;S++){var E=M[S],T=this._convertToCameraSpace(E,e);if(T.z<0){var h=this._projectToCanvas(T,r),l=h.map(function(t){return 100*t+"%"}),p={style:{background:"#"+("000000"+this._options.color.toString(16)).substr(-6),left:l[0],position:"absolute",top:l[1]}};o.push(i.h("div.TagVertex",p,[]))}}}return o},t.prototype.addPoint=function(t){if(this._geometry instanceof a.RectGeometry){var e=this._geometry;if(!e.validate(t))return;this._created$.next(this)}else if(this._geometry instanceof a.PolygonGeometry){var r=this._geometry;r.addVertex2d(t)}},t.prototype._getPositions=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.prototype._projectToCanvas=function(t,e){var r=new n.Vector3(t.x,t.y,t.z).applyProjection(e);return[(r.x+1)/2,(-r.y+1)/2]},t.prototype._convertToCameraSpace=function(t,e){return new n.Vector3(t[0],t[1],t[2]).applyMatrix4(e)},t}();r.OutlineCreateTag=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{
-"../../../Component":207,"rxjs/Subject":33,three:157,"virtual-dom":163}],263:[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("three"),o=t("virtual-dom"),a=t("../../../Component"),s=t("../../../Viewer"),c=function(t){function e(e,r){var n=this;t.call(this,e,r),this._fill=this._tag.fillOpacity>0&&!r.gpano?this._createFill():null,this._holes=this._tag.lineWidth>=1?this._createHoles():[],this._outline=this._tag.lineWidth>=1?this._createOutline():null,this._glObjects=this._createGLObjects(),this._tag.geometry.changed$.subscribe(function(t){null!=n._fill&&n._updateFillGeometry(),n._holes.length>0&&n._updateHoleGeometries(),null!=n._outline&&n._updateOulineGeometry()}),this._tag.changed$.subscribe(function(t){var e=!1;null==n._fill?n._tag.fillOpacity>0&&!n._transform.gpano&&(n._fill=n._createFill(),e=!0):n._updateFillMaterial(),null==n._outline?n._tag.lineWidth>0&&(n._holes=n._createHoles(),n._outline=n._createOutline(),e=!0):(n._updateHoleMaterials(),n._updateOutlineMaterial()),e&&(n._glObjects=n._createGLObjects(),n._glObjectsChanged$.next(n))})}return n(e,t),e.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline()},e.prototype.getDOMObjects=function(t,e,r){var n=this,i=[];if(this._tag.geometry instanceof a.RectGeometry)if(null!=this._tag.icon){var s=this._tag.geometry.getVertex3d(this._tag.iconIndex,this._transform),c=this._convertToCameraSpace(s,e);if(c.z<0){var u=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})};if(t.loaded){var h=this._getSpriteAlignment(this._tag.iconIndex,this._tag.iconAlignment),l=t.getDOMSprite(this._tag.icon,h[0],h[1]),p=function(t){t.stopPropagation(),n._tag.click$.next(n._tag)},f=this._projectToCanvas(c,r),d=f.map(function(t){return 100*t+"%"}),m={onclick:p,onmousedown:u,style:{left:d[0],pointerEvents:"all",position:"absolute",top:d[1]}};i.push(o.h("div.TagSymbol",m,[l]))}}}else if(null!=this._tag.text){var v=this._tag.geometry.getVertex3d(3,this._transform),g=this._convertToCameraSpace(v,e);if(g.z<0){var u=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})},y=this._projectToCanvas(g,r),b=y.map(function(t){return 100*t+"%"}),m={onmousedown:u,style:{color:"#"+("000000"+this._tag.textColor.toString(16)).substr(-6),left:b[0],pointerEvents:"all",position:"absolute",top:b[1]},textContent:this._tag.text};i.push(o.h("span.TagSymbol",m,[]))}}if(!this._tag.editable)return i;var _="#"+("000000"+this._tag.lineColor.toString(16)).substr(-6);if(this._tag.geometry instanceof a.RectGeometry){var x=this._tag.geometry.getCentroid3d(this._transform),w=this._convertToCameraSpace(x,e);if(w.z<0){var u=this._interact(a.TagOperation.Centroid),S=this._projectToCanvas(w,r),M=S.map(function(t){return 100*t+"%"}),m={onmousedown:u,style:{background:_,left:M[0],position:"absolute",top:M[1]}};i.push(o.h("div.TagMover",m,[]))}}for(var E=this._tag.geometry.getVertices3d(this._transform),T=0;T<E.length-1;T++){var C=this._tag.geometry instanceof a.RectGeometry;if(!C||!(null!=this._tag.icon&&T===this._tag.iconIndex||null==this._tag.icon&&null!=this._tag.text&&3===T)){var O=this._convertToCameraSpace(E[T],e);if(!(O.z>0)){var u=this._interact(a.TagOperation.Vertex,T),P=this._projectToCanvas(O,r),A=P.map(function(t){return 100*t+"%"}),m={onmousedown:u,style:{background:_,left:A[0],position:"absolute",top:A[1]}};if(C&&(m.style.cursor=T%2===0?"nesw-resize":"nwse-resize"),i.push(o.h("div.TagResizer",m,[])),this._tag.indicateVertices){var j={style:{background:_,left:A[0],position:"absolute",top:A[1]}};i.push(o.h("div.TagVertex",j,[]))}}}}return i},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({color:this._tag.fillColor,opacity:this._tag.fillOpacity,side:i.DoubleSide,transparent:!0});return new i.Mesh(r,n)},e.prototype._createGLObjects=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._createHoles=function(){var t=[];if(this._tag.geometry instanceof a.PolygonGeometry)for(var e=this._tag.geometry,r=e.getHoleVertices3d(this._transform),n=0,i=r;n<i.length;n++){var o=i[n],s=this._createLine(o);t.push(s)}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({color:this._tag.lineColor,linewidth:this._tag.lineWidth});return new i.Line(r,n)},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._getSpriteAlignment=function(t,e){var r=s.SpriteAlignment.Center,n=s.SpriteAlignment.Center;if(e===a.Alignment.Outer)switch(t){case 0:r=s.SpriteAlignment.End,n=s.SpriteAlignment.Start;break;case 1:r=s.SpriteAlignment.End,n=s.SpriteAlignment.End;break;case 2:r=s.SpriteAlignment.Start,n=s.SpriteAlignment.End;break;case 3:r=s.SpriteAlignment.Start,n=s.SpriteAlignment.Start}return[r,n]},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(){var t=this._fill.material;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,e=t.getHoleVertices3d(this._transform);if(e.length!==this._holes.length)throw new Error("Changing the number of holes is not supported.");for(var r=0;r<this._holes.length;r++){var n=e[r],i=this._holes[r];this._updateLine(i,n)}},e.prototype._updateHoleMaterials=function(){for(var t=0,e=this._holes;t<e.length;t++){var r=e[t],n=r.material;this._updateLineBasicMaterial(n)}},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.opacity=this._tag.lineWidth>=1?1:0,t.transparent=this._tag.lineWidth<=0,t.needsUpdate=!0},e}(a.RenderTag);r.OutlineRenderTag=c},{"../../../Component":207,"../../../Viewer":216,three:157,"virtual-dom":163}],264:[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("rxjs/Subject"),o=t("../../../Component"),a=function(t){function e(r,n,a){var s=this;t.call(this,r,n),this._editable=null!=a.editable&&a.editable,this._fillColor=null==a.fillColor?16777215:a.fillColor,this._fillOpacity=null==a.fillOpacity?0:a.fillOpacity,this._icon=void 0===a.icon?null:a.icon,this._iconAlignment=null==a.iconAlignment?o.Alignment.Outer:a.iconAlignment,this._iconIndex=null==a.iconIndex?3:a.iconIndex,this._indicateVertices=null==a.indicateVertices||a.indicateVertices,this._lineColor=null==a.lineColor?16777215:a.lineColor,this._lineWidth=null==a.lineWidth?1:a.lineWidth,this._text=void 0===a.text?null:a.text,this._textColor=null==a.textColor?16777215:a.textColor,this._click$=new i.Subject,this._click$.subscribe(function(t){s.fire(e.click,s)})}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,"iconAlignment",{get:function(){return this._iconAlignment},set:function(t){this._iconAlignment=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,"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._iconAlignment=null==t.iconAlignment?this._iconAlignment:t.iconAlignment,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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../../../Component":207,"rxjs/Subject":33}],265:[function(t,e,r){"use strict";var n=t("three"),i=t("rxjs/Subject"),o=function(){function t(t,e){this._tag=t,this._transform=e,this._glObjects=[],this._glObjectsChanged$=new i.Subject,this._interact$=new i.Subject}return Object.defineProperty(t.prototype,"glObjects",{get:function(){return this._glObjects},enumerable:!0,configurable:!0}),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.prototype._projectToCanvas=function(t,e){var r=new n.Vector3(t.x,t.y,t.z).applyProjection(e);return[(r.x+1)/2,(-r.y+1)/2]},t.prototype._convertToCameraSpace=function(t,e){return new n.Vector3(t[0],t[1],t[2]).applyMatrix4(e)},t}();r.RenderTag=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"rxjs/Subject":33,three:157}],266:[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("virtual-dom"),o=t("../../../Component"),a=t("../../../Viewer"),s=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.dispose=function(){},e.prototype.getDOMObjects=function(t,e,r){var n=this,s=[],c=this._tag.geometry.getCentroid3d(this._transform),u=this._convertToCameraSpace(c,e);if(u.z<0){var h=this._projectToCanvas(u,r),l=h.map(function(t){return 100*t+"%"}),p=function(t){n._interact$.next({offsetX:0,offsetY:0,operation:o.TagOperation.None,tag:n._tag})};if(null!=this._tag.icon){if(t.loaded){var f=t.getDOMSprite(this._tag.icon,a.SpriteAlignment.Center,a.SpriteAlignment.End),d={onmousedown:p,style:{bottom:100*(1-h[1])+"%",left:l[0],pointerEvents:"all",position:"absolute",transform:"translate(0px, -8px)"}};s.push(i.h("div",d,[f]))}}else if(null!=this._tag.text){var d={onmousedown:p,style:{bottom:100*(1-h[1])+"%",color:"#"+("000000"+this._tag.textColor.toString(16)).substr(-6),left:l[0],pointerEvents:"all",position:"absolute",transform:"translate(-50%, -7px)"},textContent:this._tag.text};s.push(i.h("span.TagSymbol",d,[]))}var m=this._interact(o.TagOperation.Centroid),v="#"+("000000"+this._tag.color.toString(16)).substr(-6);if(this._tag.editable){var g={onmousedown:m,style:{background:v,left:l[0],pointerEvents:"all",position:"absolute",top:l[1]}};s.push(i.h("div.TagSpotInteractor",g,[]))}var y={style:{background:v,left:l[0],position:"absolute",top:l[1]}};s.push(i.h("div.TagVertex",y,[]))}return s},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}(o.RenderTag);r.SpotRenderTag=s},{"../../../Component":207,"../../../Viewer":216,"virtual-dom":163}],267:[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("../../../Component"),o=function(t){function e(e,r,n){t.call(this,e,r),this._color=null==n.color?16777215:n.color,this._editable=null!=n.editable&&n.editable,this._icon=void 0===n.icon?null:n.icon,this._text=void 0===n.text?null:n.text,this._textColor=null==n.textColor?16777215:n.textColor}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}(i.Tag);r.SpotTag=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../../../Component":207}],268:[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("rxjs/Subject");t("rxjs/add/operator/map"),t("rxjs/add/operator/share");var o=t("../../../Utils"),a=function(t){function e(r,n){var o=this;t.call(this),this._id=r,this._geometry=n,this._notifyChanged$=new i.Subject,this._notifyChanged$.subscribe(function(t){o.fire(e.changed,o)}),this._geometry.changed$.subscribe(function(t){o.fire(e.geometrychanged,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}(o.EventEmitter);r.Tag=a,Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../../../Utils":215,"rxjs/Subject":33,"rxjs/add/operator/map":60,"rxjs/add/operator/share":69}],269:[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("./MapillaryError"),o=function(t){function e(e){t.call(this),this.name="ArgumentMapillaryError",this.message=null!=e?e:"The argument is not valid."}return n(e,t),e}(i.MapillaryError);r.ArgumentMapillaryError=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"./MapillaryError":272}],270:[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("./MapillaryError"),o=function(t){function e(e){t.call(this),this.name="GraphMapillaryError",this.message=e}return n(e,t),e}(i.MapillaryError);r.GraphMapillaryError=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"./MapillaryError":272}],271:[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("./MapillaryError"),o=function(t){function e(){t.call(this),this.name="InitializationMapillaryError",this.message="Could not initialize"}return n(e,t),e}(i.MapillaryError);r.InitializationMapillaryError=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"./MapillaryError":272}],272:[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.call(this)}return n(e,t),e}(Error);r.MapillaryError=i,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{}],273:[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("./MapillaryError"),o=function(t){function e(){t.call(this),this.name="MoveTypeMapillaryError",this.message="The type of ui you use does not support this move"}return n(e,t),e}(i.MapillaryError);r.MoveTypeMapillaryError=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"./MapillaryError":272}],274:[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("./MapillaryError"),o=function(t){function e(){t.call(this),this.name="NotImplementedMapillaryError",this.message="This function has not yet been implemented"}return n(e,t),e}(i.MapillaryError);r.NotImplementedMapillaryError=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"./MapillaryError":272}],275:[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("./MapillaryError"),o=function(t){function e(e){t.call(this),this.name="ParameterMapillaryError",this.message=null!=e?e:"The function was not called with correct parameters"}return n(e,t),e}(i.MapillaryError);r.ParameterMapillaryError=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"./MapillaryError":272}],276:[function(t,e,r){"use strict";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){return null==t.gpano?t.focal:.5},t}();r.Camera=i},{three:157}],277:[function(t,e,r){"use strict";var n=function(){function t(){this._wgs84a=6378137,this._wgs84b=6356752.31424518}return t.prototype.geodeticToEnu=function(t,e,r,n,i,o){var a=this.geodeticToEcef(t,e,r);return this.ecefToEnu(a[0],a[1],a[2],n,i,o)},t.prototype.enuToGeodetic=function(t,e,r,n,i,o){var a=this.enuToEcef(t,e,r,n,i,o);return this.ecefToGeodetic(a[0],a[1],a[2])},t.prototype.ecefToEnu=function(t,e,r,n,i,o){var a=this.geodeticToEcef(n,i,o),s=[t-a[0],e-a[1],r-a[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),p=-l*s[0]+h*s[1],f=-u*h*s[0]-u*l*s[1]+c*s[2],d=c*h*s[0]+c*l*s[1]+u*s[2];return[p,f,d]},t.prototype.enuToEcef=function(t,e,r,n,i,o){var a=this.geodeticToEcef(n,i,o);n=n*Math.PI/180,i=i*Math.PI/180;var s=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),l=-h*t-c*u*e+s*u*r+a[0],p=u*t-c*h*e+s*h*r+a[1],f=s*e+c*r+a[2];return[l,p,f]},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),a=Math.sin(t),s=Math.cos(e),c=Math.sin(e),u=n*n,h=i*i,l=1/Math.sqrt(u*o*o+h*a*a),p=(u*l+r)*o,f=p*s,d=p*c,m=(h*l+r)*a;return[f,d,m]},t.prototype.ecefToGeodetic=function(t,e,r){var n=this._wgs84a,i=this._wgs84b,o=n*n,a=i*i,s=o-a,c=Math.sqrt(s/o),u=Math.sqrt(s/a),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=Math.cos(m),y=n/Math.sqrt(1-c*c*v*v),b=h/g-y;return[180*m/Math.PI,180*d/Math.PI,b]},t}();r.GeoCoords=n,Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],278:[function(t,e,r){"use strict";var n=t("three"),i=function(){function t(){this._epsilon=1e-9}return 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 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),o=i.elements,a=Math.acos((o[0]+o[5]+o[10]-1)/2);return a},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=6371e3,o=this.degToRad(r-t),a=this.degToRad(n-e),s=Math.sin(o/2)*Math.sin(o/2)+Math.cos(t)*Math.cos(r)*Math.sin(a/2)*Math.sin(a/2),c=2*i*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return c},t}();r.Spatial=i,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{three:157}],279:[function(t,e,r){"use strict";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._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,"focal",{get:function(){return this._focal},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,"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,i=Math.cos(r)*Math.sin(e),o=-Math.sin(r),a=Math.cos(r)*Math.cos(e);return[i,o,a]}if(this._gpano){var s=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),c=[t[0]*s+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,t[1]*s+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels],e=2*Math.PI*(c[0]/this.gpano.FullPanoWidthPixels-.5),r=-Math.PI*(c[1]/this.gpano.FullPanoHeightPixels-.5),i=Math.cos(r)*Math.sin(e),o=-Math.sin(r),a=Math.cos(r)*Math.cos(e);return[i,o,a]}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)),a=[(i/(2*Math.PI)+.5)*this.gpano.FullPanoWidthPixels,(-o/Math.PI+.5)*this.gpano.FullPanoHeightPixels],s=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels);return[(a[0]-this.gpano.CroppedAreaLeftPixels-this.gpano.CroppedAreaImageWidthPixels/2)/s,(a[1]-this.gpano.CroppedAreaTopPixels-this.gpano.CroppedAreaImageHeightPixels/2)/s]}return[t[0]*this._focal/t[2],t[1]*this._focal/t[2]]},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),a=e*n/o-n/o/2,s=r*i/o-i/o/2;return[a,s]},t.prototype._sfmToBasic=function(t){var e,r,n=this._width,i=this._height,o=Math.max(n,i),a=(t[0]+n/o/2)/n*o,s=(t[1]+i/o/2)/i*o;switch(this._orientation){case 1:e=a,r=s;break;case 3:e=1-a,r=1-s;break;case 6:e=1-s,r=a;break;case 8:e=s,r=1-a;break;default:e=a,r=s}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();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:157}],280:[function(t,e,r){"use strict";var n=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 i=t("rbush"),o=t("../Edge"),a=t("../Error"),s=t("../Graph"),c=function(){function t(t,e,r,a){this._apiV3=t,this._cachedNodes={},this._cachedNodeTiles={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._changed$=new n.Subject,this._defaultAlt=2,this._edgeCalculator=null!=a?a:new o.EdgeCalculator,this._graphCalculator=null!=r?r:new s.GraphCalculator,this._nodes={},this._nodeIndex=null!=e?e:i(16,[".lon",".lat",".lon",".lat"]),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 a.GraphMapillaryError("Cannot fill node while caching full ("+t+").");if(!this.hasNode(t))throw new a.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 a.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 a.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)){var i=e.getNode(t);i.full||e._makeFull(i,n)}else{if(null==n.sequence||null==n.sequence.key)throw new a.GraphMapillaryError("Node has no sequence ("+t+").");var i=new s.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 a.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 a.GraphMapillaryError("Sequence already cached ("+t+"), ("+e.sequenceKey+").");return this._cacheSequence$(e.sequenceKey)},t.prototype.cacheSequence$=function(t){if(t in this._sequences)throw new a.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 a.GraphMapillaryError("Sequence is not cached ("+t+"), ("+e.sequenceKey+")");var r=this._sequences[e.sequenceKey],n=this._edgeCalculator.computeSequenceEdges(e,r);e.cacheSequenceEdges(n)},t.prototype.cacheSpatialArea$=function(t){var e=this;if(!this.hasNode(t))throw new a.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+t+").");if(t in this._cachedSpatialEdges)throw new a.GraphMapillaryError("Node already spatially cached ("+t+").");if(!(t in this._requiredSpatialArea))throw new a.GraphMapillaryError("Spatial area not determined ("+t+").");var r=this._requiredSpatialArea[t];if(0===Object.keys(r.cacheNodes).length)throw new a.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=[],s=(function(n){var a=c._apiV3.imageByKeyFill$(n).do(function(n){for(var o in n)if(n.hasOwnProperty(o)){var a=r.cacheNodes[o];if(a.full)delete r.cacheNodes[o];else{var s=n[o];e._makeFull(a,s),delete r.cacheNodes[o]}}0===--i&&delete e._cachingSpatialArea$[t]}).map(function(t){return e}).catch(function(o){for(var a=0,s=n;a<s.length;a++){var c=s[a];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(a)}),c=this,u=0,h=n;u<h.length;u++){var l=h[u];s(l)}return this._cachingSpatialArea$[t]=o,o},t.prototype.cacheSpatialEdges=function(t){if(t in this._cachedSpatialEdges)throw new a.GraphMapillaryError("Spatial edges already cached ("+t+").");var e=this.getNode(t),r=this._sequences[e.sequenceKey],n=[],i=r.findNextKey(e.key),o=r.findPrevKey(e.key),s=this._requiredSpatialArea[t].all,c=[];for(var u in s)s.hasOwnProperty(u)&&c.push(s[u]);var h=this._edgeCalculator.getPotentialEdges(e,c,n),l=this._edgeCalculator.computeStepEdges(e,h,o,i);l=l.concat(this._edgeCalculator.computeTurnEdges(e,h)),l=l.concat(this._edgeCalculator.computePanoEdges(e,h)),l=l.concat(this._edgeCalculator.computePerspectiveToPanoEdges(e,h)),l=l.concat(this._edgeCalculator.computeSimilarEdges(e,h)),e.cacheSpatialEdges(l),this._cachedSpatialEdges[t]=e,delete this._requiredSpatialArea[t]},t.prototype.cacheTiles$=function(t){var e=this;if(t in this._cachedNodeTiles)throw new a.GraphMapillaryError("Tiles already cached ("+t+").");if(!(t in this._requiredNodeTiles))throw new a.GraphMapillaryError("Tiles have not been determined ("+t+").");var r=this._requiredNodeTiles[t];if(0===r.cache.length&&0===r.caching.length)throw new a.GraphMapillaryError("Tiles already cached ("+t+").");if(!this.hasNode(t))throw new a.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=(function(n){var o=null;n in c._cachingTiles$?o=c._cachingTiles$[n]:(o=c._apiV3.imagesByH$([n]).do(function(t){var r=t[n];if(!(n in e._cachedTiles)){e._cachedTiles[n]=[];var i=e._cachedTiles[n],o=e._removeFromPreStore(n);for(var a in r)if(r.hasOwnProperty(a)){var c=r[a];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),e._nodeIndex.insert({lat:u.latLon.lat,lon:u.latLon.lon,node:u})}else{var h=new s.Node(c);i.push(h),e._nodeIndex.insert({lat:h.latLon.lat,lon:h.latLon.lon,node:h}),e._setNode(h)}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(),c._cachingTiles$[n]=o),i.push(o.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())}),c=this,u=0,h=r.caching;u<h.length;u++){var l=h[u];o(l)}return i},t.prototype.initializeCache=function(t){if(t in this._cachedNodes)throw new a.GraphMapillaryError("Node already in cache ("+t+").");var e=this.getNode(t);e.initializeCache(new s.NodeCache),this._cachedNodes[t]=e},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){var e=this.getNode(t);return e.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){return t in this._nodes},t.prototype.hasNodeSequence=function(t){var e=this.getNode(t);return e.sequenceKey in this._sequences},t.prototype.hasSequence=function(t){return t in this._sequences},t.prototype.hasSpatialArea=function(t){if(!this.hasNode(t))throw new a.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=this._nodeIndex.search({maxX:r[1].lon,maxY:r[1].lat,minX:r[0].lon,minY:r[0].lat}),i={all:{},cacheKeys:[],cacheNodes:{}},o=0,s=n;o<s.length;o++){var c=s[o];i.all[c.node.key]=c.node,c.node.full||(i.cacheKeys.push(c.node.key),i.cacheNodes[c.node.key]=c.node)}return this._requiredSpatialArea[t]=i,0===i.cacheKeys.length},t.prototype.hasTiles=function(t){var e=this;if(t in this._cachedNodeTiles)return!0;if(!this.hasNode(t))throw new a.GraphMapillaryError("Node does not exist in graph ("+t+").");if(!(t in this._requiredNodeTiles)){var r=this.getNode(t),n=this._graphCalculator.encodeHs(r.latLon,this._tilePrecision,this._tileThreshold).filter(function(t){return!(t in e._cachedTiles)});this._requiredNodeTiles[t]={cache:n,caching:[]}}return 0===this._requiredNodeTiles[t].cache.length&&0===this._requiredNodeTiles[t].caching.length},t.prototype.getNode=function(t){return this._nodes[t]},t.prototype.getSequence=function(t){return this._sequences[t]},t.prototype.reset=function(){for(var t=Object.keys(this._requiredSpatialArea),e=0,r=t;e<r.length;e++){var n=r[e];delete this._requiredSpatialArea[n]}for(var i=Object.keys(this._cachedSpatialEdges),o=0,a=i;o<a.length;o++){var s=a[o],c=this._cachedSpatialEdges[s];c.resetSpatialEdges(),delete this._cachedSpatialEdges[s]}},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]=new s.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 a.GraphMapillaryError("Node already exist ("+e+").");this._nodes[e]=t},t}();r.Graph=c,Object.defineProperty(r,"__esModule",{value:!0}),r.default=c},{"../Edge":208,"../Error":209,"../Graph":211,rbush:24,"rxjs/Subject":33,"rxjs/add/observable/from":40,"rxjs/add/operator/catch":48,"rxjs/add/operator/do":54,"rxjs/add/operator/finally":57,"rxjs/add/operator/map":60,"rxjs/add/operator/publish":66}],281:[function(t,e,r){"use strict";var n=t("latlon-geohash"),i=t("three"),o=t("../Geo"),a=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}(),s=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),s=o.ne,c=o.sw,u=n.neighbours(i),h=[0,0,0],l=this._geoCoords.geodeticToEnu(s.lat,s.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],d=l[0]-p[0],m=p[1]-h[1],v=l[1]-p[1],g=f<r,y=d<r,b=m<r,_=v<r,x=[i];return _&&x.push(u[a.n]),_&&g&&x.push(u[a.nw]),g&&x.push(u[a.w]),g&&b&&x.push(u[a.sw]),b&&x.push(u[a.s]),b&&y&&x.push(u[a.se]),y&&x.push(u[a.e]),y&&_&&x.push(u[a.ne]),x},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 a=(new i.Matrix4).makeRotationZ(o),s=new i.Euler(r,n,t*Math.PI/180,"XYZ"),c=(new i.Matrix4).makeRotationFromEuler(s),u=(new i.Vector4).setAxisAngleFromRotationMatrix(c.multiply(a));return u.multiplyScalar(u.w).toArray().slice(0,3)},t}();r.GraphCalculator=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../Geo":210,"latlon-geohash":20,three:157}],282:[function(t,e,r){"use strict";var n=t("rxjs/Observable");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 i=function(){function t(t,e){this._graph$=n.Observable.of(t).concat(t.changed$).publishReplay(1).refCount(),this._graph$.subscribe(),this._imageLoadingService=e,this._spatialSubscriptions=[]}return t.prototype.cacheNode$=function(t){var e=this,r=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)}).publishReplay(1).refCount(),i=r.map(function(e){return e.getNode(t)}).mergeMap(function(t){return t.assetsCached?n.Observable.of(t):t.cacheAssets$()}).publishReplay(1).refCount();i.subscribe(function(t){e._imageLoadingService.loadnode$.next(t)},function(e){console.error("Failed to cache node ("+t+")",e)}),r.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)}).subscribe(function(t){},function(e){console.error("Failed to cache sequence edges ("+t+").",e)});var o=r.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!=o&&e._removeSpatialSubscription(o)}).subscribe(function(t){},function(e){console.error("Failed to cache spatial edges ("+t+").",e)});return o.closed||this._spatialSubscriptions.push(o),i.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.reset$=function(t){var e=this;return this._resetSpatialSubscriptions(),this._graph$.first().do(function(t){t.reset()}).mergeMap(function(r){return e.cacheNode$(t)})},t.prototype._removeSpatialSubscription=function(t){var e=this._spatialSubscriptions.indexOf(t);e>-1&&this._spatialSubscriptions.splice(e,1)},t.prototype._resetSpatialSubscriptions=function(){for(var t=0,e=this._spatialSubscriptions;t<e.length;t++){var r=e[t];r.closed||r.unsubscribe()}this._spatialSubscriptions=[]},t}();r.GraphService=i,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{"rxjs/Observable":28,"rxjs/add/operator/catch":48,"rxjs/add/operator/concat":50,"rxjs/add/operator/do":54,"rxjs/add/operator/expand":55,"rxjs/add/operator/finally":57,"rxjs/add/operator/first":58,"rxjs/add/operator/last":59,"rxjs/add/operator/map":60,"rxjs/add/operator/mergeMap":63,"rxjs/add/operator/publishReplay":67}],283:[function(t,e,r){"use strict";var n=t("rxjs/Observable"),i=t("../Utils"),o=function(){function t(){}return t.loadThumbnail=function(t,e){return this._load(t,e,i.Urls.thumbnail)},t.loadDynamic=function(t,e){return this._load(t,e,i.Urls.dynamicImage)},t._load=function(t,e,r){return n.Observable.create(function(n){var i=new Image;i.crossOrigin="Anonymous";var o=new XMLHttpRequest;o.open("GET",r(t,e),!0),o.responseType="arraybuffer",o.onload=function(e){if(200!==o.status)return void n.error(new Error("Failed to fetch image ("+t+"). Status: "+o.status+", "+o.statusText));i.onload=function(t){n.next({loaded:{loaded:e.loaded,total:e.total},object:i}),n.complete()},i.onerror=function(e){n.error(new Error("Failed to load image ("+t+")"))};var r=new Blob([o.response]);i.src=window.URL.createObjectURL(r)},o.onprogress=function(t){n.next({loaded:{loaded:t.loaded,total:t.total},object:null})},o.onerror=function(e){n.error(new Error("Failed to fetch image ("+t+")"))},o.send(null)})},t}();r.ImageLoader=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../Utils":215,"rxjs/Observable":28}],284:[function(t,e,r){"use strict";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()}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":33}],285:[function(t,e,r){"use strict";var n=t("pbf"),i=function(){function t(){}return t.read=function(e){var r=new n(e);return r.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:22}],286:[function(t,e,r){"use strict";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,"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.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.resetSpatialEdges=function(){this._cache.resetSpatialEdges()},t}();r.Node=n,Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{"rxjs/add/observable/combineLatest":37,"rxjs/add/operator/map":60}],287:[function(t,e,r){(function(e){"use strict";var n=t("rxjs/Subject"),i=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/publishReplay");var o=t("../Graph"),a=t("../Utils"),s=function(){function t(){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(),this._spatialEdgesChanged$=new n.Subject,this._spatialEdges$=this._spatialEdgesChanged$.startWith(this._spatialEdges).publishReplay(1).refCount(),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(),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;return null!=this._cachingAssets$?this._cachingAssets$:(this._cachingAssets$=i.Observable.combineLatest(this._cacheImage(t,e),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.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._image=null,this._mesh=null,this._loadStatus={loaded:0,total:0},this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype.resetSpatialEdges=function(){this._spatialEdges={cached:!1,edges:[]},this._spatialEdgesChanged$.next(this._spatialEdges)},t.prototype._cacheImage=function(t,e){var r=e?a.Settings.basePanoramaSize:a.Settings.baseImageSize;return o.ImageLoader.loadThumbnail(t,r)},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 s=new XMLHttpRequest;s.open("GET",a.Urls.protoMesh(t),!0),s.responseType="arraybuffer",s.onload=function(t){var r=200===s.status?o.MeshReader.read(new e(s.response)):{faces:[],vertices:[]};i.next({loaded:{loaded:t.loaded,total:t.total},object:r}),i.complete()},s.onprogress=function(t){i.next({loaded:{loaded:t.loaded,total:t.total},object:null})},s.onerror=function(e){console.error("Failed to cache mesh ("+t+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},s.send(null)})},t.prototype._createEmptyMeshLoadStatus=function(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}},t}();r.NodeCache=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}).call(this,t("buffer").Buffer)},{"../Graph":211,"../Utils":215,buffer:5,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/operator/publishReplay":67}],288:[function(t,e,r){"use strict";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.findNextKey=function(t){var e=n.indexOf(this._keys,t);return e+1>=this._keys.length||e===-1?null:this._keys[e+1]},t.prototype.findPrevKey=function(t){var e=n.indexOf(this._keys,t);return 0===e||e===-1?null:this._keys[e-1]},t}();r.Sequence=i,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{underscore:158}],289:[function(t,e,r){"use strict";var n=t("three"),i=t("../../Edge"),o=t("../../Error"),a=t("../../Geo"),s=function(){function t(t,e,r){this._spatial=new a.Spatial,this._geoCoords=new a.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),a=this._spatial.angleToPlane(i.toArray(),[0,0,1]),s=[],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]),b=y-a,_=this._spatial.relativeRotationAngle(t.rotation,h.rotation),x=this._spatial.angleBetweenVector2(1,0,p.x,p.y),w=null!=h.sequenceKey&&null!=t.sequenceKey&&h.sequenceKey===t.sequenceKey,S=null==h.mergeCC&&null==t.mergeCC||h.mergeCC===t.mergeCC,M=h.userKey===t.userKey,E={capturedAt:h.capturedAt,directionChange:g,distance:f,fullPano:h.fullPano,key:h.key,motionChange:d,rotation:_,sameMergeCC:S,sameSequence:w,sameUser:M,sequenceKey:h.sequenceKey,verticalDirectionChange:b,verticalMotion:m,worldMotionAzimuth:x};s.push(E)}}}return s},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 a=e.findPrevKey(t.key);return null!=a&&r.push({data:{direction:i.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:t.key,to:a}),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,a={},s=0,c=e;s<c.length;s++){var u=c[s];if(null!=u.sequenceKey&&!u.sameSequence&&u.sameMergeCC){if(n){if(!u.fullPano)continue}else if(!u.fullPano&&Math.abs(u.directionChange)>this._settings.similarMaxDirectionChange)continue;u.distance>this._settings.similarMaxDistance||u.sameUser&&Math.abs(u.capturedAt-t.capturedAt)<this._settings.similarMinTimeDifference||(null==a[u.sequenceKey]&&(a[u.sequenceKey]=[]),a[u.sequenceKey].push(u))}}var h=[],l=t.fullPano?function(t){return t.distance}:function(t){return r._coefficients.similarDistance*t.distance+r._coefficients.similarRotation*t.rotation};for(var p in a)if(a.hasOwnProperty(p)){for(var f=Number.MAX_VALUE,d=null,m=0,v=a[p];m<v.length;m++){var u=v[m],g=l(u);g<f&&(f=g,d=u)}null!=d&&h.push(d)}return h.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.fullPano)return i;for(var a in this._directions.steps)if(this._directions.steps.hasOwnProperty(a)){for(var s=this._directions.steps[a],c=Number.MAX_VALUE,u=null,h=null,l=0,p=e;l<p.length;l++){var f=p[l];if(!(f.fullPano||Math.abs(f.directionChange)>this._settings.stepMaxDirectionChange)){var d=this._spatial.angleDifference(s.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(!s.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)}}}}u=null==u?h:u,null!=u&&i.push({data:{direction:s.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.fullPano)return r;for(var n in this._directions.turns)if(this._directions.turns.hasOwnProperty(n)){for(var a=this._directions.turns[n],s=Number.MAX_VALUE,c=null,u=0,h=e;u<h.length;u++){var l=h[u];if(!(l.fullPano||l.distance>this._settings.turnMaxDistance)){var p=a.direction!==i.EdgeDirection.TurnU&&l.distance<this._settings.turnMaxRigDistance&&Math.abs(l.directionChange)>this._settings.turnMinRigDirectionChange,f=this._spatial.angleDifference(a.directionChange,l.directionChange),d=void 0;if(p&&l.directionChange*a.directionChange>0&&Math.abs(l.directionChange)<Math.abs(a.directionChange))d=-Math.PI/2+Math.abs(l.directionChange);else{if(Math.abs(f)>this._settings.turnMaxDirectionChange)continue;var m=a.motionChange?this._spatial.angleDifference(a.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<s&&(s=d,c=l)}}null!=c&&r.push({data:{direction:a.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.fullPano)return[];for(var r=Number.MAX_VALUE,n=null,a=0,s=e;a<s.length;a++){var c=s[a];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=[],a=[],s=0,c=e;s<c.length;s++){var u=c[s];if(!(u.distance>this._settings.panoMaxDistance))if(u.fullPano){if(u.distance<this._settings.panoMinDistance)continue;n.push(u)}else for(var h in this._directions.panos)if(this._directions.panos.hasOwnProperty(h)){var l=this._directions.panos[h],p=this._spatial.angleDifference(u.directionChange,u.motionChange),f=this._spatial.angleDifference(l.directionChange,p);if(!(Math.abs(f)>this._settings.panoMaxStepTurnChange)){a.push([l.direction,u]);break}}}for(var d=Math.PI/this._settings.panoMaxItems,m=[],v=[],g=0;g<this._settings.panoMaxItems;g++){for(var y=g/this._settings.panoMaxItems*2*Math.PI,b=Number.MAX_VALUE,_=null,x=0,w=n;x<w.length;x++){var u=w[x],S=this._spatial.angleDifference(y,u.motionChange);if(!(Math.abs(S)>d)){for(var M=Number.MAX_VALUE,E=0,T=m;E<T.length;E++){var C=T[E],O=Math.abs(this._spatial.angleDifference(C,u.motionChange));O<M&&(M=O)}if(!(M<=d)){var P=this._coefficients.panoPreferredDistance*Math.abs(u.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(S)/d+this._coefficients.panoSequencePenalty*(u.sameSequence?0:1)+this._coefficients.panoMergeCCPenalty*(u.sameMergeCC?0:1);P<b&&(b=P,_=u)}}}null!=_?(m.push(_.motionChange),r.push({data:{direction:i.EdgeDirection.Pano,worldMotionAzimuth:_.worldMotionAzimuth},from:t.key,to:_.key})):v.push(y)}var A={};A[i.EdgeDirection.Pano]=m,A[i.EdgeDirection.StepForward]=[],A[i.EdgeDirection.StepLeft]=[],A[i.EdgeDirection.StepBackward]=[],A[i.EdgeDirection.StepRight]=[];for(var j=0,R=v;j<R.length;j++){var L=R[j],N=[];for(var h in this._directions.panos)if(this._directions.panos.hasOwnProperty(h)){for(var l=this._directions.panos[h],I=A[i.EdgeDirection.Pano].concat(A[l.direction]).concat(A[l.prev]).concat(A[l.next]),b=Number.MAX_VALUE,_=null,D=0,k=a;D<k.length;D++){var u=k[D];if(u[0]===l.direction){var F=this._spatial.angleDifference(L,u[1].motionChange);if(!(Math.abs(F)>d)){for(var U=Number.MAX_VALUE,B=0,z=I;B<z.length;B++){var C=z[B],M=Math.abs(this._spatial.angleDifference(C,u[1].motionChange));M<U&&(U=M)}if(!(U<=d)){var P=this._coefficients.panoPreferredDistance*Math.abs(u[1].distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(F)/d+this._coefficients.panoMergeCCPenalty*(u[1].sameMergeCC?0:1);P<b&&(b=P,_=u)}}}}null!=_&&(N.push(_),r.push({data:{direction:_[0],worldMotionAzimuth:_[1].worldMotionAzimuth},from:t.key,to:_[1].key}))}for(var G=0,V=N;G<V.length;G++){var $=V[G];A[$[0]].push($[1].motionChange)}}return r},t}();r.EdgeCalculator=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../../Edge":208,"../../Error":209,"../../Geo":210,three:157}],290:[function(t,e,r){"use strict";var n=function(){function t(){this.panoPreferredDistance=2,this.panoMotion=2,this.panoSequencePenalty=1,this.panoMergeCCPenalty=4,this.stepPreferredDistance=4,this.stepMotion=3,this.stepRotation=4,this.stepSequencePenalty=2,this.stepMergeCCPenalty=6,this.similarDistance=2,this.similarRotation=3,this.turnDistance=4,this.turnMotion=2,this.turnSequencePenalty=1,this.turnMergeCCPenalty=4}return t}();r.EdgeCalculatorCoefficients=n,Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],291:[function(t,e,r){"use strict";var n=t("../../Edge"),i=function(){function t(){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}}return t}();r.EdgeCalculatorDirections=i},{"../../Edge":208}],292:[function(t,e,r){"use strict";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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],293:[function(t,e,r){"use strict";!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={}));r.EdgeDirection},{}],294:[function(t,e,r){"use strict";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 a=t("../Render"),s=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 s=i.create(i.h("div.domRenderer",[]));t.appendChild(s),this._offset$=this._adaptiveOperation$.scan(function(t,e){return e(t)},{elementHeight:t.offsetHeight,elementWidth:t.offsetWidth,imageAspect:0,renderMode:a.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===a.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",position:"absolute",right:r.right+"px",top:r.top+"px",zIndex:-1}};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)},s).publishReplay(1).refCount(),this._element$.subscribe(),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=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../Render":213,"rxjs/Subject":33,"rxjs/add/operator/combineLatest":49,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/pluck":65,"rxjs/add/operator/scan":68,underscore:158,"virtual-dom":163}],295:[function(t,e,r){"use strict";!function(t){t[t.Background=0]="Background",t[t.Foreground=1]="Foreground"}(r.GLRenderStage||(r.GLRenderStage={}));var n=r.GLRenderStage;Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],296:[function(t,e,r){"use strict";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 a=t("../Render"),s=function(){function t(t){var e=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=t,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){var i=Object.keys(e).map(function(t){return e[t]});return{camera:r,eraser:n,renderer:t,renders:i}}).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++){var s=o[i];s.stage===a.GLRenderStage.Background?r.push(s.render):s.stage===a.GLRenderStage.Foreground&&n.push(s.render)}var c=t.renderer.renderer;c.autoClear=!1,c.clear();for(var u=0,h=r;u<h.length;u++){var s=h[u];s(e,c)}c.clearDepth();for(var l=0,p=n;l<p.length;l++){var s=p[l];s(e,c)}}),this._renderFrame$.map(function(t){return function(e){return e.frameId=t.frameId,e.perspective=t.perspective,t.changed===!0&&(e.needsRender=!0),e}}).subscribe(this._renderCameraOperation$),this._renderFrameSubscribe();var r=this._render$.map(function(t){return function(e){return e[t.name]=t.render,e}}),s=this._clear$.map(function(t){return function(e){return delete e[t],e}});i.Observable.merge(r,s).subscribe(this._renderOperation$);var c=this._render$.first().map(function(e){return function(e){var r=new n.WebGLRenderer,i=t.element;return r.setSize(i.offsetWidth,i.offsetHeight),r.setClearColor(new n.Color(2105376),1),r.sortObjects=!1,r.domElement.style.width="100%",r.domElement.style.height="100%",i.appendChild(r.domElement),e.needsRender=!0,e.renderer=r,e}}),u=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)}}),h=this._clear$.map(function(t){return function(t){return null==t.renderer?t:(t.needsRender=!0,t)}});i.Observable.merge(c,u,h).subscribe(this._rendererOperation$);var l=this._renderCollection$.filter(function(t){return 0===Object.keys(t).length}).share();l.subscribe(function(t){null!=e._renderFrameSubscription&&(e._renderFrameSubscription.unsubscribe(),e._renderFrameSubscription=null,e._renderFrameSubscribe())}),l.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}),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=s,Object.defineProperty(r,"__esModule",{value:!0}),r.default=s},{"../Render":213,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/first":58,"rxjs/add/operator/map":60,"rxjs/add/operator/merge":61,"rxjs/add/operator/mergeMap":63,"rxjs/add/operator/scan":68,"rxjs/add/operator/share":69,"rxjs/add/operator/startWith":72,three:157}],297:[function(t,e,r){"use strict";var n=t("three"),i=t("../Geo"),o=t("../Render"),a=function(){function t(t,e){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=e,this._camera=new i.Camera,this._perspective=new n.PerspectiveCamera(50,t,.4,1e4)}return Object.defineProperty(t.prototype,"perspective",{get:function(){return this._perspective},enumerable:!0,configurable:!0}),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}),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._changed=!0},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),i=this.renderMode===o.RenderMode.Letterbox?t>r:t<r,a=i?n*r:n*t;return a},t}();r.RenderCamera=a,Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Geo":210,"../Render":213,three:157}],298:[function(t,e,r){"use strict";!function(t){t[t.Letterbox=0]="Letterbox",t[t.Fill=1]="Fill"}(r.RenderMode||(r.RenderMode={}));var n=r.RenderMode;Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],299:[function(t,e,r){"use strict";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("../Render"),a=function(){function t(t,e,r){var a=this;this._element=t,this._currentFrame$=e,r=null!=r?r:o.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 o.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-5){var i=e.state.currentTransform,o=null!=e.state.previousTransform?e.state.previousTransform:e.state.currentTransform,a=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=a.pano,r.alpha=e.state.alpha,r.zoom=e.state.zoom,r.camera.copy(n),r.updatePerspective(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._size$.skip(1).map(function(t){return function(e){return e.perspective.aspect=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._renderCameraHolder$.subscribe(),this._size$.subscribe(),this._renderMode$.subscribe()}return 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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"../Render":213,"rxjs/BehaviorSubject":25,"rxjs/Subject":33,"rxjs/add/observable/combineLatest":37,"rxjs/add/operator/do":54,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/skip":70,"rxjs/add/operator/startWith":72,"rxjs/add/operator/withLatestFrom":76}],300:[function(t,e,r){"use strict";var n=function(){function t(){window.requestAnimationFrame?(this._requestAnimationFrame=window.requestAnimationFrame,this._cancelAnimationFrame=window.cancelAnimationFrame):window.mozRequestAnimationFrame?(this._requestAnimationFrame=window.mozRequestAnimationFrame,this._cancelAnimationFrame=window.mozCancelAnimationFrame):window.webkitRequestAnimationFrame?(this._requestAnimationFrame=window.webkitRequestAnimationFrame,this._cancelAnimationFrame=window.webkitCancelAnimationFrame):window.msRequestAnimationFrame?(this._requestAnimationFrame=window.msRequestAnimationFrame,this._cancelAnimationFrame=window.msCancelRequestAnimationFrame):window.oRequestAnimationFrame?(this._requestAnimationFrame=window.oRequestAnimationFrame,this._cancelAnimationFrame=window.oCancelAnimationFrame):(this._requestAnimationFrame=function(t){return window.setTimeout(t,1e3/60)},this._cancelAnimationFrame=window.clearTimeout)}return t.prototype.requestAnimationFrame=function(t){return this._requestAnimationFrame.call(window,t)},t.prototype.cancelAnimationFrame=function(t){this._cancelAnimationFrame.call(window,t)},t}();r.FrameGenerator=n},{}],301:[function(t,e,r){"use strict";!function(t){t[t.Traversing=0]="Traversing",t[t.Waiting=1]="Waiting"}(r.State||(r.State={}));var n=r.State;Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],302:[function(t,e,r){"use strict";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.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.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":210,"../State":214}],303:[function(t,e,r){"use strict";var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Subject");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 o=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 o.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$.filter(function(e){return e%t._fpsSampleRate===0}).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._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._movingOperation$=new i.Subject,e.map(function(t){
-return!0}).subscribe(this._movingOperation$),this._movingOperation$.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._movingOperation$),this._moving$=this._movingOperation$.distinctUntilChanged().share(),this._state$.subscribe(),this._currentNode$.subscribe(),this._currentCamera$.subscribe(),this._currentTransform$.subscribe(),this._reference$.subscribe(),this._currentNodeExternal$.subscribe(),this._lastState$.subscribe(),this._frameId=null,this._frameGenerator=new o.FrameGenerator}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,"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,"moving$",{get:function(){return this._moving$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appendNode$",{get:function(){return this._appendNode$},enumerable:!0,configurable:!0}),t.prototype.traverse=function(){this._movingOperation$.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.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._movingOperation$.next(!0),this._invokeContextOperation(function(e){e.rotate(t)})},t.prototype.rotateBasic=function(t){this._movingOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasic(t)})},t.prototype.rotateToBasic=function(t){this._movingOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateToBasic(t)})},t.prototype.move=function(t){this._movingOperation$.next(!0),this._invokeContextOperation(function(e){e.move(t)})},t.prototype.moveTo=function(t){this._movingOperation$.next(!0),this._invokeContextOperation(function(e){e.moveTo(t)})},t.prototype.zoomIn=function(t,e){this._movingOperation$.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._movingOperation$.next(!0),this._invokeContextOperation(function(e){e.setCenter(t)})},t.prototype.setZoom=function(t){this._movingOperation$.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":214,"rxjs/BehaviorSubject":25,"rxjs/Subject":33,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/do":54,"rxjs/add/operator/filter":56,"rxjs/add/operator/first":58,"rxjs/add/operator/map":60,"rxjs/add/operator/pairwise":64,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/startWith":72,"rxjs/add/operator/switchMap":73,"rxjs/add/operator/withLatestFrom":76}],304:[function(t,e,r){"use strict";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),a=new i.Transform(n,n.image,o);this._trajectoryTransforms.push(a),this._trajectoryCameras.push(new i.Camera(a))}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();var e=this._setReference(this._currentNode);e?this._setTrajectories():this._prependToTrajectories(t),this._setCurrentCamera()},t.prototype.remove=function(t){if(t<0)throw Error("n must be a positive integer");var e=this._trajectory.length;if(e-(this._currentIndex+1)<t)throw Error("Current node can not be removed");for(var r=0;r<t;r++)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()},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();var t=this._setReference(this._currentNode);t&&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(){var t=null!=this._currentNode&&null!=this._previousNode;return t&&!(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.ParameterMapillaryError("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.ParameterMapillaryError("Assets must be cached when node is added to trajectory");var a=this._nodeToTranslation(o),s=new i.Transform(o,o.image,a);this._trajectoryTransforms.push(s),this._trajectoryCameras.push(new i.Camera(s))}},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.ParameterMapillaryError("Node must be loaded when added to trajectory");var a=this._nodeToTranslation(o),s=new i.Transform(o,o.image,a);this._trajectoryTransforms.unshift(s),this._trajectoryCameras.unshift(new i.Camera(s))}},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;if(!t||!e)return!0;var r=this._spatial.distanceFromLatLon(t.originalLatLon.lat,t.originalLatLon.lon,e.originalLatLon.lat,e.originalLatLon.lon);return r<25},t}();r.StateBase=o},{"../../Error":209,"../../Geo":210}],305:[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("three"),o=t("unitbezier"),a=t("../../State"),s=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){t.call(this,e),this._motionless=this._motionlessTransition(),this._baseAlpha=this._alpha,this._animationSpeed=.025,this._unitBezier=new o(.74,.67,.38,.96),this._useBezier=!1,this._rotationDelta=new s(0,0),this._requestedRotationDelta=null,this._basicRotation=[0,0],this._requestedBasicRotation=null,this._rotationAcceleration=.86,this._rotationIncreaseAlpha=.97,this._rotationDecreaseAlpha=.9,this._rotationThreshold=.001,this._desiredZoom=e.zoom,this._minZoom=0,this._maxZoom=3,this._lookatDepth=10,this._desiredLookat=null,this._desiredCenter=null}return n(e,t),e.prototype.traverse=function(){throw new Error("Not implemented")},e.prototype.wait=function(){return new a.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 s(t.phi,t.theta))},e.prototype.rotateBasic=function(t){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,null!=this._requestedBasicRotation?(this._requestedBasicRotation[0]+=t[0],this._requestedBasicRotation[1]+=t[1]):this._requestedBasicRotation=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],a=Math.pow(2,this._zoom),s=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-a/s*(c-n),l=u-a/s*(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)return void(this._desiredCenter=e);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)},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(){if(t.prototype._setCurrentCamera.call(this),null!=this._previousNode){var e=this._camera.lookat.clone().sub(this._camera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position)),this._currentNode.fullPano&&this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}},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(),a=Math.atan2(n.y,n.x);a+=this._rotationDelta.phi;var s=Math.atan2(Math.sqrt(n.x*n.x+n.y*n.y),n.z);s+=this._rotationDelta.theta,s=Math.max(.1,Math.min(Math.PI-.1,s)),n.x=Math.sin(s)*Math.cos(a),n.y=Math.sin(s)*Math.sin(a),n.z=Math.cos(s),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,a=i.projectBasic(r.lookat.toArray()),s=o.projectBasic(n.lookat.toArray()),c=i.gpano,u=o.gpano;t.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!=c&&i.gpano.CroppedAreaImageWidthPixels===i.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(a[1]+this._basicRotation[1],0,1)),e.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!=u&&o.gpano.CroppedAreaImageWidthPixels===o.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(a[1]+this._basicRotation[1],0,1));var h=i.unprojectBasic(a,this._lookatDepth);r.lookat.fromArray(h);var l=o.unprojectBasic(s,this._lookatDepth);n.lookat.fromArray(l)},e.prototype._updateZoom=function(t){var e=this._desiredZoom-this._zoom;0!==e&&(Math.abs(e)<1e-4?this._zoom=this._desiredZoom:this._zoom+=5*t*e)},e.prototype._updateLookat=function(t){if(null!==this._desiredLookat){var e=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(e)<1e-5?(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(),e=this._requestedRotationDelta.lengthSquared();return e>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=t*t+e*e,n=this._requestedBasicRotation[0],i=this._requestedBasicRotation[1],o=n*n+i*i;return o>r?(this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*t+this._rotationIncreaseAlpha*n,this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*e+this._rotationIncreaseAlpha*i):(this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*t+this._rotationDecreaseAlpha*n,this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*e+this._rotationDecreaseAlpha*i),void(this._requestedBasicRotation=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}(a.StateBase);r.TraversingState=c},{"../../State":214,three:157,unitbezier:159}],306:[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("../../State"),o=function(t){function e(e){t.call(this,e),this._motionless=this._motionlessTransition()}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.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.ceil(this._alpha):this._alpha},e.prototype._setCurrentCamera=function(){if(t.prototype._setCurrentCamera.call(this),null!=this._previousNode){var e=this._camera.lookat.clone().sub(this._camera.position);if(this._previousNode.pano){var r=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(r.clone().add(this._currentCamera.position))}this._currentNode.pano&&this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}},e}(i.StateBase);r.WaitingState=o},{"../../State":214}],307:[function(t,e,r){"use strict";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)return void(this._events={});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]}},t.prototype.fire=function(t,e){if(this._listens(t))for(var r=0,n=this._events[t];r<n.length;r++){var i=n[r];i.call(this,e)}},t.prototype._listens=function(t){return!(!this._events||!this._events[t])},t}();r.EventEmitter=n,Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],308:[function(t,e,r){"use strict";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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=i},{"../Viewer":216}],309:[function(t,e,r){"use strict";var n=function(){function t(){}return t.dynamicImage=function(t,e){return"https://d2qb1440i7l50o.cloudfront.net/"+t+"/full/!"+e+","+e+"/0/default.jpg?origin=mapillary.webgl"},t.thumbnail=function(t,e){return"https://d1cuyjsrcm0gby.cloudfront.net/"+t+"/thumb-"+e+".jpg?origin=mapillary.webgl"},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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],310:[function(t,e,r){"use strict";var n=t("../Component"),i=function(){function t(t,e,r,i){var o=this;this._container=t,this._navigator=e,this._options=null!=i?i:{},this._key=r,this._componentService=new n.ComponentService(this._container,this._navigator),this._coverComponent=this._componentService.getCover(),this._initializeComponents(),r?(this._initilizeCoverComponent(),this._subscribeCoverComponent()):this._navigator.movedToKey$.first().subscribe(function(t){o._key=t,o._componentService.deactivateCover(),o._coverComponent.configure({key:o._key,loading:!1,visible:!1}),o._subscribeCoverComponent(),o._navigator.stateService.start()})}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.route,"route"),this._uFalse(t.slider,"slider"),this._uFalse(t.stats,"stats"),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")},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.moveToKey$(e.key).subscribe(function(e){t._navigator.stateService.start(),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._navigator.stateService.stop(),t._componentService.activateCover())})},t.prototype._uFalse=function(t,e){return void 0===t?void this._componentService.deactivate(e):"boolean"==typeof t?void(t?this._componentService.activate(e):this._componentService.deactivate(e)):(this._componentService.configure(e,t),void this._componentService.activate(e))},t.prototype._uTrue=function(t,e){return void 0===t?void this._componentService.activate(e):"boolean"==typeof t?void(t?this._componentService.activate(e):this._componentService.deactivate(e)):(this._componentService.configure(e,t),void this._componentService.activate(e))},t}();r.ComponentController=i},{"../Component":207}],311:[function(t,e,r){"use strict";var n=t("../Render"),i=t("../Viewer"),o=function(){function t(t,e,r){this.id=t,this.element=document.getElementById(t),this.element.classList.add("mapillary-js"),this.renderService=new n.RenderService(this.element,e.currentState$,r.renderMode),this.glRenderer=new n.GLRenderer(this.renderService),this.domRenderer=new n.DOMRenderer(this.element,this.renderService,e.currentState$),this.mouseService=new i.MouseService(this.element),this.touchService=new i.TouchService(this.element),this.spriteService=new i.SpriteService(r.sprite)}return t}();r.Container=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../Render":213,"../Viewer":216}],312:[function(t,e,r){"use strict";var n=t("rxjs/Observable");t("rxjs/add/observable/combineLatest"),t("rxjs/add/operator/distinctUntilChanged"),t("rxjs/add/operator/map");var i=t("../Viewer"),o=function(){function t(t,e,r){var o=this;this._container=r,this._eventEmitter=t,this._navigator=e,this._loadingSubscription=this._navigator.loadingService.loading$.subscribe(function(t){o._eventEmitter.fire(i.Viewer.loadingchanged,t)}),this._currentNodeSubscription=this._navigator.stateService.currentNodeExternal$.subscribe(function(t){o._eventEmitter.fire(i.Viewer.nodechanged,t)}),this._sequenceEdgesSubscription=this._navigator.stateService.currentNodeExternal$.switchMap(function(t){return t.sequenceEdges$}).subscribe(function(t){
-o._eventEmitter.fire(i.Viewer.sequenceedgeschanged,t)}),this._spatialEdgesSubscription=this._navigator.stateService.currentNodeExternal$.switchMap(function(t){return t.spatialEdges$}).subscribe(function(t){o._eventEmitter.fire(i.Viewer.spatialedgeschanged,t)}),n.Observable.combineLatest(this._navigator.stateService.moving$,this._container.mouseService.active$).map(function(t){return t[0]||t[1]}).distinctUntilChanged().subscribe(function(t){t?o._eventEmitter.fire(i.Viewer.movestart,null):o._eventEmitter.fire(i.Viewer.moveend,null)})}return t.prototype.dispose=function(){this._loadingSubscription.unsubscribe(),this._currentNodeSubscription.unsubscribe()},t}();r.EventLauncher=o,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"../Viewer":216,"rxjs/Observable":28,"rxjs/add/observable/combineLatest":37,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/map":60}],313:[function(t,e,r){"use strict";!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={}));r.ImageSize},{}],314:[function(t,e,r){"use strict";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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=o},{"rxjs/Subject":33,"rxjs/add/operator/debounceTime":51,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/map":60,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/startWith":72,underscore:158}],315:[function(t,e,r){"use strict";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 a=function(){function t(t){var e=this;this._element=t,this._activeSubject$=new n.BehaviorSubject(!1),this._active$=this._activeSubject$.distinctUntilChanged().publishReplay(1).refCount(),this._preventMouseDownOperation$=new o.Subject,this._preventMouseDown$=new o.Subject,this._mouseMoveOperation$=new o.Subject,this._claimMouse$=new o.Subject,this._mouseDown$=i.Observable.fromEvent(t,"mousedown"),this._mouseLeave$=i.Observable.fromEvent(t,"mouseleave"),this._mouseUp$=i.Observable.fromEvent(t,"mouseup"),this._mouseOver$=i.Observable.fromEvent(t,"mouseover"),this._click$=i.Observable.fromEvent(t,"click"),this._mouseWheel$=i.Observable.fromEvent(t,"wheel"),this._mouseWheel$.subscribe(function(t){t.preventDefault()}),this._preventMouseDownOperation$.scan(function(t,e){return e(t)},!0).subscribe(),this._preventMouseDown$.map(function(t){return function(e){return t}}).subscribe(this._preventMouseDownOperation$),this._mouseDown$.map(function(t){return function(e){return e&&t.preventDefault(),e}}).subscribe(this._preventMouseDownOperation$),this._mouseMove$=this._mouseMoveOperation$.scan(function(t,e){return e(t)},null),i.Observable.fromEvent(t,"mousemove").map(function(t){return function(e){return null==e&&(e=t),null==t.movementX&&(t.movementX=t.clientX-e.clientX),null==t.movementY&&(t.movementY=t.clientY-e.clientY),t}}).subscribe(this._mouseMoveOperation$);var r=i.Observable.merge(this._mouseLeave$,this._mouseUp$);this._mouseDragStart$=this._mouseDown$.mergeMap(function(t){return e._mouseMove$.takeUntil(r).take(1)}),this._mouseDrag$=this._mouseDown$.mergeMap(function(t){return e._mouseMove$.skip(1).takeUntil(r)}),this._mouseDragEnd$=this._mouseDragStart$.mergeMap(function(t){return r.first()}),this._staticClick$=this._mouseDown$.switchMap(function(t){return e._click$.takeUntil(e._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()}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,"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,"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,"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}),Object.defineProperty(t.prototype,"preventDefaultMouseDown$",{get:function(){return this._preventMouseDown$},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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=a},{"rxjs/BehaviorSubject":25,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/fromEvent":41,"rxjs/add/operator/distinctUntilChanged":53,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/merge":61,"rxjs/add/operator/mergeMap":63,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/switchMap":73,"rxjs/add/operator/withLatestFrom":76}],316:[function(t,e,r){"use strict";var n=t("rxjs/BehaviorSubject"),i=t("rxjs/Observable"),o=t("rxjs/Subject");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 a=t("../API"),s=t("../Graph"),c=t("../Edge"),u=t("../State"),h=t("../Viewer"),l=function(){function t(t,e,r,i,c,l){this._apiV3=null!=e?e:new a.APIv3(t),this._imageLoadingService=null!=i?i:new s.ImageLoadingService,this._graphService=null!=r?r:new s.GraphService(new s.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._keyRequested$=new n.BehaviorSubject(null),this._movedToKey$=new o.Subject,this._dirRequested$=new n.BehaviorSubject(null),this._latLonRequested$=new n.BehaviorSubject(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,"keyRequested$",{get:function(){return this._keyRequested$},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){var e=this;return this.loadingService.startLoading(this._loadingName),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.moveDir$=function(t){var e=this;return this.loadingService.startLoading(this._loadingName),this._dirRequested$.next(t),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)})},t.prototype.moveCloseTo$=function(t,e){var r=this;return this.loadingService.startLoading(this._loadingName),this._latLonRequested$.next({lat:t,lon:e}),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)})},t}();r.Navigator=l,Object.defineProperty(r,"__esModule",{value:!0}),r.default=l},{"../API":206,"../Edge":208,"../Graph":211,"../State":214,"../Viewer":216,"rxjs/BehaviorSubject":25,"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/observable/throw":45,"rxjs/add/operator/do":54,"rxjs/add/operator/finally":57,"rxjs/add/operator/first":58,"rxjs/add/operator/map":60,"rxjs/add/operator/mergeMap":63}],317:[function(t,e,r){"use strict";!function(t){t[t.Center=0]="Center",t[t.Start=1]="Start",t[t.End=2]="End"}(r.SpriteAlignment||(r.SpriteAlignment={}));var n=r.SpriteAlignment;Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},{}],318:[function(t,e,r){"use strict";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 a=t("../Viewer"),s=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 a=new n.SpriteMaterial({map:r});return new n.Sprite(a)},t.prototype.getDOMSprite=function(t,e,r){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==e&&(e=a.SpriteAlignment.Start),null==r&&(r=a.SpriteAlignment.Start);var n=this._json[t];if(!n)return console.warn("Sprite with key"+t+"does not exist in sprite definition."),i.h("div",{},[]);var o=n.y,s=n.x+n.width,c=n.y+n.height,u=n.x,h=-n.x,l=-n.y,p=this._image.height,f=this._image.width;switch(e){case a.SpriteAlignment.Center:h-=n.width/2;break;case a.SpriteAlignment.End:h-=n.width;break;case a.SpriteAlignment.Start:}switch(r){case a.SpriteAlignment.Center:l-=n.height/2;break;case a.SpriteAlignment.End:l-=n.height;break;case a.SpriteAlignment.Start:}var d=1/n.pixelRatio;o*=d,s*=d,c*=d,u*=d,h*=d,l*=d,p*=d,f*=d;var m={src:this._image.src,style:{clip:"rect("+o+"px, "+s+"px, "+c+"px, "+u+"px)",height:p+"px",left:h+"px",position:"absolute",top:l+"px",width:f+"px"}};return i.h("img",m,[])},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 s).publishReplay(1).refCount(),this._spriteAtlas$.subscribe(),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,Object.defineProperty(r,"__esModule",{value:!0}),r.default=c},{"../Viewer":216,"rxjs/Subject":33,"rxjs/add/operator/publishReplay":67,"rxjs/add/operator/scan":68,"rxjs/add/operator/startWith":72,three:157,"virtual-dom":163}],319:[function(t,e,r){"use strict";var n=t("rxjs/Observable"),i=t("rxjs/Subject");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 o=function(){function t(t){this.movementX=0,this.movementY=0,null!=t&&(this.identifier=t.identifier,this.clientX=t.clientX,this.clientY=t.clientY,this.pageX=t.pageX,this.pageY=t.pageY,this.screenX=t.screenX,this.screenY=t.screenY,this.target=t.target)}return t}();r.TouchMove=o;var a=function(){function t(t){var e=this;this._element=t,this._touchStart$=n.Observable.fromEvent(t,"touchstart"),this._touchMove$=n.Observable.fromEvent(t,"touchmove"),this._touchEnd$=n.Observable.fromEvent(t,"touchend"),this._touchCancel$=n.Observable.fromEvent(t,"touchcancel"),this._preventTouchMoveOperation$=new i.Subject,this._preventTouchMove$=new i.Subject,this._preventTouchMoveOperation$.scan(function(t,e){return e(t)},!0).subscribe(),this._preventTouchMove$.map(function(t){return function(e){return t}}).subscribe(this._preventTouchMoveOperation$),this._touchMove$.map(function(t){return function(e){return e&&t.preventDefault(),e}}).subscribe(this._preventTouchMoveOperation$),this._singleTouchMoveOperation$=new i.Subject,this._singleTouchMove$=this._singleTouchMoveOperation$.scan(function(t,e){return e(t)},new o),this._touchMove$.filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}).map(function(t){return function(e){var r=t.touches[0],n=new o(r);return n.movementX=r.pageX-e.pageX,n.movementY=r.pageY-e.pageY,n}}).subscribe(this._singleTouchMoveOperation$);var r=n.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return 1===t.touches.length&&1===t.targetTouches.length}),a=n.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(t){return t.touches.length>=1}),s=n.Observable.merge(this._touchEnd$,this._touchCancel$).filter(function(t){return 0===t.touches.length});this._singleTouch$=r.switchMap(function(t){return e._singleTouchMove$.skip(1).takeUntil(n.Observable.merge(a,s))});var c=n.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$),u=c.filter(function(t){return 2===t.touches.length&&2===t.targetTouches.length}),h=c.filter(function(t){return 2!==t.touches.length||2!==t.targetTouches.length});this._pinchOperation$=new i.Subject,this._pinch$=this._pinchOperation$.scan(function(t,e){return e(t)},{centerClientX:0,centerClientY:0,centerPageX:0,centerPageY:0,centerScreenX:0,centerScreenY:0,changeX:0,changeY:0,distance:0,distanceChange:0,distanceX:0,distanceY: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),a=Math.min(r.clientY,n.clientY),s=Math.max(r.clientY,n.clientY),c=i+(o-i)/2,u=a+(s-a)/2,h=c+r.pageX-r.clientX,l=u+r.pageY-r.clientY,p=c+r.screenX-r.clientX,f=u+r.screenY-r.clientY,d=Math.abs(r.clientX-n.clientX),m=Math.abs(r.clientY-n.clientY),v=Math.sqrt(d*d+m*m),g=v-e.distance,y=d-e.distanceX,b=m-e.distanceY,_={centerClientX:c,centerClientY:u,centerPageX:h,centerPageY:l,centerScreenX:p,centerScreenY:f,changeX:y,changeY:b,distance:v,distanceChange:g,distanceX:d,distanceY:m,touch1:r,touch2:n};return _}}).subscribe(this._pinchOperation$),this._pinchChange$=u.switchMap(function(t){return e._pinch$.skip(1).takeUntil(h)})}return 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,"singleTouchMove$",{get:function(){return this._singleTouch$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"preventDefaultTouchMove$",{get:function(){return this._preventTouchMove$},enumerable:!0,configurable:!0}),t}();r.TouchService=a},{"rxjs/Observable":28,"rxjs/Subject":33,"rxjs/add/operator/filter":56,"rxjs/add/operator/map":60,"rxjs/add/operator/merge":61,"rxjs/add/operator/scan":68,"rxjs/add/operator/switchMap":73}],320:[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("when"),o=t("../Viewer"),a=t("../Utils"),s=function(t){function e(e,r,n,i){t.call(this),i=null!=i?i:{},a.Settings.setOptions(i),this._navigator=new o.Navigator(r),this._container=new o.Container(e,this._navigator.stateService,i),this._eventLauncher=new o.EventLauncher(this,this._navigator,this._container),this._componentController=new o.ComponentController(this._container,this._navigator,n,i.component)}return n(e,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.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.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.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},e.prototype.setRenderMode=function(t){this._container.renderService.renderMode$.next(t)},e.prototype.activateComponent=function(t){this._componentController.activate(t)},e.prototype.deactivateComponent=function(t){this._componentController.deactivate(t)},e.prototype.getComponent=function(t){return this._componentController.get(t)},e.prototype.activateCover=function(){this._componentController.activateCover()},e.prototype.deactivateCover=function(){this._componentController.deactivateCover()},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.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.setCenter=function(t){this._navigator.stateService.setCenter(t)},e.prototype.setZoom=function(t){this._navigator.stateService.setZoom(t)},e.loadingchanged="loadingchanged",e.movestart="movestart",e.moveend="moveend",e.nodechanged="nodechanged",e.sequenceedgeschanged="sequenceedgeschanged",e.spatialedgeschanged="spatialedgeschanged",e}(a.EventEmitter);r.Viewer=s},{"../Utils":215,"../Viewer":216,when:204}]},{},[212])(212)});
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Mapillary=e()}}(function(){var n;return function o(s,a,c){function u(r,e){if(!a[r]){if(!s[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(h)return h(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[r]={exports:{}};s[r][0].call(i.exports,function(e){var t=s[r][1][e];return u(t||e)},i,i.exports,o,s,a,c)}return a[r].exports}for(var h="function"==typeof require&&require,e=0;e<c.length;e++)u(c[e]);return u}({1:[function(e,t,r){"use strict";var b=e("tinyqueue");function n(e,t,r){var n,i,o,s;t=t||1;for(var a=0;a<e[0].length;a++){var c=e[0][a];(!a||c[0]<n)&&(n=c[0]),(!a||c[1]<i)&&(i=c[1]),(!a||c[0]>o)&&(o=c[0]),(!a||c[1]>s)&&(s=c[1])}var u=o-n,h=s-i,l=Math.min(u,h),p=l/2,f=new b(null,x);if(0===l)return[n,i];for(var d=n;d<o;d+=l)for(var m=i;m<s;m+=l)f.push(new w(d+p,m+p,p,e));var v=function(e){for(var t=0,r=0,n=0,i=e[0],o=0,s=i.length,a=s-1;o<s;a=o++){var c=i[o],u=i[a],h=c[0]*u[1]-u[0]*c[1];r+=(c[0]+u[0])*h,n+=(c[1]+u[1])*h,t+=3*h}return 0===t?new w(i[0][0],i[0][1],0,e):new w(r/t,n/t,0,e)}(e),g=new w(n+u/2,i+h/2,0,e);g.d>v.d&&(v=g);for(var y=f.length;f.length;){var _=f.pop();_.d>v.d&&(v=_,r&&console.log("found best %d after %d probes",Math.round(1e4*_.d)/1e4,y)),_.max-v.d<=t||(p=_.h/2,f.push(new w(_.x-p,_.y-p,p,e)),f.push(new w(_.x+p,_.y-p,p,e)),f.push(new w(_.x-p,_.y+p,p,e)),f.push(new w(_.x+p,_.y+p,p,e)),y+=4)}return r&&(console.log("num probes: "+y),console.log("best distance: "+v.d)),[v.x,v.y]}function x(e,t){return t.max-e.max}function w(e,t,r,n){this.x=e,this.y=t,this.h=r,this.d=function(e,t,r){for(var n=!1,i=1/0,o=0;o<r.length;o++)for(var s=r[o],a=0,c=s.length,u=c-1;a<c;u=a++){var h=s[a],l=s[u];h[1]>t!=l[1]>t&&e<(l[0]-h[0])*(t-h[1])/(l[1]-h[1])+h[0]&&(n=!n),i=Math.min(i,p(e,t,h,l))}return(n?1:-1)*Math.sqrt(i)}(e,t,n),this.max=this.d+this.h*Math.SQRT2}function p(e,t,r,n){var i=r[0],o=r[1],s=n[0]-i,a=n[1]-o;if(0!==s||0!==a){var c=((e-i)*s+(t-o)*a)/(s*s+a*a);1<c?(i=n[0],o=n[1]):0<c&&(i+=s*c,o+=a*c)}return(s=e-i)*s+(a=t-o)*a}t.exports=n,t.exports.default=n},{tinyqueue:226}],2:[function(e,t,r){function n(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=n,this.p2x=r,this.p2y=n}(t.exports=n).prototype.sampleCurveX=function(e){return((this.ax*e+this.bx)*e+this.cx)*e},n.prototype.sampleCurveY=function(e){return((this.ay*e+this.by)*e+this.cy)*e},n.prototype.sampleCurveDerivativeX=function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},n.prototype.solveCurveX=function(e,t){var r,n,i,o,s;for(void 0===t&&(t=1e-6),i=e,s=0;s<8;s++){if(o=this.sampleCurveX(i)-e,Math.abs(o)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=o/a}if((i=e)<(r=0))return r;if((n=1)<i)return n;for(;r<n;){if(o=this.sampleCurveX(i),Math.abs(o-e)<t)return i;o<e?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},{}],3:[function(e,t,r){"use strict";r.byteLength=function(e){return 3*e.length/4-l(e)},r.toByteArray=function(e){var t,r,n,i,o,s=e.length;i=l(e),o=new h(3*s/4-i),r=0<i?s-4:s;var a=0;for(t=0;t<r;t+=4)n=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],o[a++]=n>>16&255,o[a++]=n>>8&255,o[a++]=255&n;2===i?(n=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,o[a++]=255&n):1===i&&(n=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,o[a++]=n>>8&255,o[a++]=255&n);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",o=[],s=0,a=r-n;s<a;s+=16383)o.push(p(e,s,a<s+16383?a:s+16383));1===n?(t=e[r-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="=");return o.push(i),o.join("")};for(var c=[],u=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i<o;++i)c[i]=n[i],u[n.charCodeAt(i)]=i;function l(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function p(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(c[(i=n)>>18&63]+c[i>>12&63]+c[i>>6&63]+c[63&i]);return o.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},{}],4:[function(e,t,r){},{}],5:[function(e,t,r){var h,l,p;t.exports=(l=String.prototype.split,p=/()??/.exec("")[1]===h,function(e,t,r){if("[object RegExp]"!==Object.prototype.toString.call(t))return l.call(e,t,r);var n,i,o,s,a=[],c=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),u=0;for(t=new RegExp(t.source,c+"g"),e+="",p||(n=new RegExp("^"+t.source+"$(?!\\s)",c)),r=r===h?-1>>>0:r>>>0;(i=t.exec(e))&&!(u<(o=i.index+i[0].length)&&(a.push(e.slice(u,i.index)),!p&&1<i.length&&i[0].replace(n,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===h&&(i[e]=h)}),1<i.length&&i.index<e.length&&Array.prototype.push.apply(a,i.slice(1)),s=i[0].length,u=o,a.length>=r));)t.lastIndex===i.index&&t.lastIndex++;return u===e.length?!s&&t.test("")||a.push(""):a.push(e.slice(u)),a.length>r?a.slice(0,r):a})},{}],6:[function(e,t,r){var n,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,h=[],l=!1,p=-1;function f(){l&&u&&(l=!1,u.length?h=u.concat(h):p=-1,h.length&&d())}function d(){if(!l){var e=c(f);l=!0;for(var t=h.length;t;){for(u=h,h=[];++p<t;)u&&u[p].run();p=-1,t=h.length}u=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];h.push(new m(e,t)),1!==h.length||l||c(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],7:[function(e,t,r){"use strict";var n=e("base64-js"),o=e("ieee754");r.Buffer=l,r.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function s(e){if(i<e)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=l.prototype,t}function l(e,t,r){if("number"!=typeof e)return a(e,t,r);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(e)}function a(e,t,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return D(e)?function(e,t,r){if(t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(r||0))throw new RangeError("'length' is out of bounds");var n;n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r);return n.__proto__=l.prototype,n}(e,t,r):"string"==typeof e?function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var r=0|f(e,t),n=s(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t):function(e){if(l.isBuffer(e)){var t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}if(e){if(k(e)||"length"in e)return"number"!=typeof e.length||B(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function u(e){return c(e),s(e<0?0:0|p(e))}function h(e){for(var t=e.length<0?0:0|p(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e){if(i<=e)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(l.isBuffer(e))return e.length;if(k(e)||D(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(e).length;default:if(n)return L(e).length;t=(""+t).toLowerCase(),n=!0}}function d(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),B(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a/=s=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var h=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===c)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(a<r+c&&(r=a-c),o=r;0<=o;o--){for(var l=!0,p=0;p<c;p++)if(u(e,o+p)!==u(t,p)){l=!1;break}if(l)return o}return-1}function g(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?i<(n=Number(n))&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(B(a))return s;e[r+s]=a}return s}function y(e,t,r,n){return I(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function b(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],h=null,l=239<u?4:223<u?3:191<u?2:1;if(i+l<=r)switch(l){case 1:u<128&&(h=u);break;case 2:128==(192&(o=e[i+1]))&&127<(c=(31&u)<<6|63&o)&&(h=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&2047<(c=(15&u)<<12|(63&o)<<6|63&s)&&(c<55296||57343<c)&&(h=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&65535<(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)&&c<1114112&&(h=c)}null===h?(h=65533,l=1):65535<h&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=x));return r}(n)}r.kMaxLength=i,(l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}())||"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&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),l.poolSize=8192,l.from=function(e,t,r){return a(e,t,r)},l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,l.alloc=function(e,t,r){return i=t,o=r,c(n=e),n<=0?s(n):void 0!==i?"string"==typeof o?s(n).fill(i,o):s(n).fill(i):s(n);var n,i,o},l.allocUnsafe=function(e){return u(e)},l.allocUnsafeSlow=function(e){return u(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var r;if(void 0===t)for(r=t=0;r<e.length;++r)t+=e[r].length;var n=l.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!l.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)d(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)d(this,t,t+3),d(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)d(this,t,t+7),d(this,t+1,t+6),d(this,t+2,t+5),d(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?b(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return w(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return _(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},l.prototype.compare=function(e,t,r,n,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,i),u=e.slice(t,r),h=0;h<a;++h)if(c[h]!==u[h]){o=c[h],s=u[h];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||i<r)&&(r=i),0<e.length&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,s,a,c,u,h,l,p,f,d=!1;;)switch(n){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return p=t,f=r,I(L(e,(l=this).length-p),l,p,f);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return y(this,e,t,r);case"base64":return c=this,u=t,h=r,I(N(e),c,u,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=t,a=r,I(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,(o=this).length-s),o,s,a);default:if(d)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function w(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function S(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||n<r)&&(r=n);for(var i="",o=t;o<r;++o)i+=R(e[o]);return i}function C(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function E(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(r<e+t)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<t||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(e,t,r,n,i){return t=+t,r>>>=0,i||O(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,i){return t=+t,r>>>=0,i||O(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=l.prototype,n},l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e+--t],i=1;0<t&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return(i*=128)<=n&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||E(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0<n&&(i*=256);)o+=this[e+--n]*i;return(i*=128)<=o&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||E(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||E(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||E(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||E(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||E(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||E(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0<n&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;0<=i;--i)e[i+t]=this[i+r];else if(o<1e3)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=l.isBuffer(e)?e:new l(e,n),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var j=/[^+/0-9A-Za-z-_]/g;function R(e){return e<16?"0"+e.toString(16):e.toString(16)}function L(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if(55295<(r=e.charCodeAt(s))&&r<57344){if(!i){if(56319<r){-1<(t-=3)&&o.push(239,191,189);continue}if(s+1===n){-1<(t-=3)&&o.push(239,191,189);continue}i=r;continue}if(r<56320){-1<(t-=3)&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&-1<(t-=3)&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function N(e){return n.toByteArray(function(e){if((e=e.trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function D(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function k(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function B(e){return e!=e}},{"base64-js":3,ieee754:17}],8:[function(e,t,r){"use strict";function n(e,t,r){r=r||2;var n,i,o,s,a,c,u,h=t&&t.length,l=h?t[0]*r:e.length,p=m(e,0,l,r,!0),f=[];if(!p)return f;if(h&&(p=function(e,t,r,n){var i,o,s,a,c,u=[];for(i=0,o=t.length;i<o;i++)s=t[i]*n,a=i<o-1?t[i+1]*n:e.length,(c=m(e,s,a,n,!1))===c.next&&(c.steiner=!0),u.push(x(c));for(u.sort(y),i=0;i<u.length;i++)_(u[i],r),r=v(r,r.next);return r}(e,t,p,r)),e.length>80*r){n=o=e[0],i=s=e[1];for(var d=r;d<l;d+=r)(a=e[d])<n&&(n=a),(c=e[d+1])<i&&(i=c),o<a&&(o=a),s<c&&(s=c);u=0!==(u=Math.max(o-n,s-i))?1/u:0}return g(p,f,r,n,i,u),f}function m(e,t,r,n,i){var o,s;if(i===0<T(e,t,r,n))for(o=t;o<r;o+=n)s=c(o,e[o],e[o+1],s);else for(o=r-n;t<=o;o-=n)s=c(o,e[o],e[o+1],s);return s&&a(s,s.next)&&(E(s),s=s.next),s}function v(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!a(n,n.next)&&0!==S(n.prev,n,n.next))n=n.next;else{if(E(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function g(e,t,r,n,i,o,s){if(e){!s&&o&&function(e,t,r,n){var i=e;for(;null===i.z&&(i.z=b(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next,i!==e;);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,o,s,a,c,u=1;do{for(r=e,o=e=null,s=0;r;){for(s++,n=r,t=a=0;t<u&&(a++,n=n.nextZ);t++);for(c=u;0<a||0<c&&n;)0!==a&&(0===c||!n||r.z<=n.z)?(r=(i=r).nextZ,a--):(n=(i=n).nextZ,c--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(1<s)}(i)}(e,n,i,o);for(var a,c,u=e;e.prev!==e.next;)if(a=e.prev,c=e.next,o?l(e,n,i,o):h(e))t.push(a.i/r),t.push(e.i/r),t.push(c.i/r),E(e),e=c.next,u=c.next;else if((e=c)===u){s?1===s?g(e=p(e,t,r),t,r,n,i,o,2):2===s&&f(e,t,r,n,i,o):g(v(e),t,r,n,i,o,1);break}}}function h(e){var t=e.prev,r=e,n=e.next;if(0<=S(t,r,n))return!1;for(var i=e.next.next;i!==e.prev;){if(w(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&0<=S(i.prev,i,i.next))return!1;i=i.next}return!0}function l(e,t,r,n){var i=e.prev,o=e,s=e.next;if(0<=S(i,o,s))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=b(a,c,t,r,n),p=b(u,h,t,r,n),f=e.prevZ,d=e.nextZ;f&&f.z>=l&&d&&d.z<=p;){if(f!==e.prev&&f!==e.next&&w(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=S(f.prev,f,f.next))return!1;if(f=f.prevZ,d!==e.prev&&d!==e.next&&w(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&0<=S(d.prev,d,d.next))return!1;d=d.nextZ}for(;f&&f.z>=l;){if(f!==e.prev&&f!==e.next&&w(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=S(f.prev,f,f.next))return!1;f=f.prevZ}for(;d&&d.z<=p;){if(d!==e.prev&&d!==e.next&&w(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&0<=S(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function p(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!a(i,o)&&d(i,n,n.next,o)&&M(i,o)&&M(o,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(o.i/r),E(n),E(n.next),n=e=o),n=n.next}while(n!==e);return n}function f(e,t,r,n,i,o){var s,a,c=e;do{for(var u=c.next.next;u!==c.prev;){if(c.i!==u.i&&(a=u,(s=c).next.i!==a.i&&s.prev.i!==a.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&d(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(s,a)&&M(s,a)&&M(a,s)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next,r!==e;);return n}(s,a))){var h=C(c,u);return c=v(c,c.next),h=v(h,h.next),g(c,t,r,n,i,o),void g(h,t,r,n,i,o)}u=u.next}c=c.next}while(c!==e)}function y(e,t){return e.x-t.x}function _(e,t){if(t=function(e,t){var r,n=t,i=e.x,o=e.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&s<a){if((s=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!==t);if(!r)return null;if(i===s)return r.prev;var c,u=r,h=r.x,l=r.y,p=1/0;n=r.next;for(;n!==u;)i>=n.x&&n.x>=h&&i!==n.x&&w(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)&&M(n,e)&&(r=n,p=c),n=n.next;return r}(e,t)){var r=C(t,e);v(r,r.next)}}function b(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function x(e){for(var t=e,r=e;t.x<r.x&&(r=t),(t=t.next)!==e;);return r}function w(e,t,r,n,i,o,s,a){return 0<=(i-s)*(t-a)-(e-s)*(o-a)&&0<=(e-s)*(n-a)-(r-s)*(t-a)&&0<=(r-s)*(o-a)-(i-s)*(n-a)}function S(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function a(e,t){return e.x===t.x&&e.y===t.y}function d(e,t,r,n){return!!(a(e,t)&&a(r,n)||a(e,n)&&a(r,t))||0<S(e,t,r)!=0<S(e,t,n)&&0<S(r,n,e)!=0<S(r,n,t)}function M(e,t){return S(e.prev,e,e.next)<0?0<=S(e,t,e.next)&&0<=S(e,e.prev,t):S(e,t,e.prev)<0||S(e,e.next,t)<0}function C(e,t){var r=new s(e.i,e.x,e.y),n=new s(t.i,t.x,t.y),i=e.next,o=t.prev;return(e.next=t).prev=e,(r.next=i).prev=r,(n.next=r).prev=n,(o.next=n).prev=o,n}function c(e,t,r,n){var i=new s(e,t,r);return n?(i.next=n.next,(i.prev=n).next.prev=i,n.next=i):(i.prev=i).next=i,i}function E(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function s(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,t,r,n){for(var i=0,o=t,s=r-n;o<r;o+=n)i+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return i}t.exports=n,(t.exports.default=n).deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,s=Math.abs(T(e,0,o,r));if(i)for(var a=0,c=t.length;a<c;a++){var u=t[a]*r,h=a<c-1?t[a+1]*r:e.length;s-=Math.abs(T(e,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((e[p]-e[d])*(e[f+1]-e[p+1])-(e[p]-e[f])*(e[d+1]-e[p+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},n.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var s=0;s<t;s++)r.vertices.push(e[i][o][s]);0<i&&(n+=e[i-1].length,r.holes.push(n))}return r}},{}],9:[function(e,t,r){"use strict";e("individual/one-version")("ev-store","7");var n="__EV_STORE_KEY@7";t.exports=function(e){var t=e[n];t||(t=e[n]={});return t}},{"individual/one-version":19}],10:[function(e,t,r){"use strict";var s=e("./request"),n=e("./buildQueryObject");Array.isArray;function a(e,t){var r;for(r in t)e[r]=t[r];return e}function i(e,t){(this._jsongUrl=e,"number"==typeof t)&&(t={timeout:t});this._config=a({timeout:15e3,headers:{}},t||{})}i.prototype={constructor:i,buildQueryObject:n,get:function(e){var t=a(this.buildQueryObject(this._jsongUrl,"GET",{paths:e,method:"get"}),this._config);return s("GET",t,this)},set:function(e){var t=a(this.buildQueryObject(this._jsongUrl,"POST",{jsonGraph:e,method:"set"}),this._config);t.headers["Content-Type"]="application/x-www-form-urlencoded";return s("POST",t,this)},call:function(e,t,r,n){t=t||[],r=r||[],n=n||[];var i=[];i.push("method=call"),i.push("callPath="+encodeURIComponent(JSON.stringify(e))),i.push("arguments="+encodeURIComponent(JSON.stringify(t))),i.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),i.push("paths="+encodeURIComponent(JSON.stringify(n)));var o=a(this.buildQueryObject(this._jsongUrl,"POST",i.join("&")),this._config);o.headers["Content-Type"]="application/x-www-form-urlencoded";return s("POST",o,this)}},(i.XMLHttpSource=i).default=i,t.exports=i},{"./buildQueryObject":11,"./request":14}],11:[function(e,t,r){"use strict";t.exports=function(e,t,r){var n=[],i={url:e},o=-1!==e.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(e){var t="object"==typeof r[e]?JSON.stringify(r[e]):r[e];n.push(e+"="+encodeURIComponent(t))}),"GET"===t?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],12:[function(e,r,t){(function(t){"use strict";r.exports=function(){var e=new t.XMLHttpRequest;if("withCredentials"in e)return e;if(t.XDomainRequest)return new XDomainRequest;throw new Error("CORS is not supported by your browser")}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,r){(function(n){"use strict";t.exports=function(){var e,t,r;if(n.XMLHttpRequest)return new n.XMLHttpRequest;try{for(t=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=0;r<3;r++)try{if(e=t[r],new n.ActiveXObject(e))break}catch(e){}return new n.ActiveXObject(e)}catch(e){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(e,t,r){"use strict";var h=e("./getXMLHttpRequest"),l=e("./getCORSRequest"),p=Object.prototype.hasOwnProperty,o=function(){};function n(){}function f(e,t,r){r||(r=new Error(t)),e.onError(r)}n.create=function(i){var e=new n;return e.subscribe=function(e,t,r){var n;return"function"==typeof(n=i("function"==typeof e?{onNext:e,onError:t||o,onCompleted:r||o}:e))?{dispose:n}:n},e},t.exports=function(a,c,u){return n.create(function(t){var r,n,e,i,o,s={method:a||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(o in c)p.call(c,o)&&(s[o]=c[o]);s.crossDomain||s.headers["X-Requested-With"]||(s.headers["X-Requested-With"]="XMLHttpRequest"),null!=u.onBeforeRequest&&u.onBeforeRequest(s);try{r=s.crossDomain?l():h()}catch(e){t.onError(e)}try{for(i in s.user?r.open(s.method,s.url,s.async,s.user,s.password):r.open(s.method,s.url,s.async),r.timeout=s.timeout,r.withCredentials=!1!==s.withCredentials,e=s.headers)p.call(e,i)&&r.setRequestHeader(i,e[i]);if(s.responseType)try{r.responseType=s.responseType}catch(e){if("json"!==s.responseType)throw e}r.onreadystatechange=function(e){4===r.readyState&&(n||(n=!0,function(e,t,r){var n,i;if(t&&e){i=t.responseType,n="response"in t?t.response:t.responseText;var o=1223===t.status?204:t.status;if(200<=o&&o<=399){try{"json"!==i&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){f(e,"invalid json",r)}return e.onNext(n),e.onCompleted()}f(e,401===o||403===o||407===o?n:410===o?n:408===o||504===o?n:n||"Response code "+o)}}(t,r)))},r.ontimeout=function(e){n||(n=!0,r,f(t,"timeout error",e))},r.send(s.data)}catch(e){t.onError(e)}return function(){n||4===r.readyState||(n=!0,r.abort())}})}},{"./getCORSRequest":12,"./getXMLHttpRequest":13}],15:[function(l,t,r){(function(n){!function(e){"object"==typeof r&&void 0!==t?t.exports=e():("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).falcor=e()}(function(){return function o(s,a,c){function u(r,e){if(!a[r]){if(!s[r]){var t="function"==typeof l&&l;if(!e&&t)return t(r,!0);if(h)return h(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[r]={exports:{}};s[r][0].call(i.exports,function(e){var t=s[r][1][e];return u(t||e)},i,i.exports,o,s,a,c)}return a[r].exports}for(var h="function"==typeof l&&l,e=0;e<c.length;e++)u(c[e]);return u}({1:[function(e,t,r){var n=e(32),i=e(130);n.atom=i.atom,n.ref=i.ref,n.error=i.error,n.pathValue=i.pathValue,n.HttpDataSource=e(125),t.exports=n},{125:125,130:130,32:32}],2:[function(e,t,r){function i(e){var t=e||{};this._root=t._root||new n(t),this._path=t.path||t._path||[],this._scheduler=t.scheduler||t._scheduler||new f,this._source=t.source||t._source,this._request=t.request||t._request||new s(this,this._scheduler),this._ID=T++,"number"==typeof t.maxSize?this._maxSize=t.maxSize:this._maxSize=t._maxSize||i.prototype._maxSize,"number"==typeof t.collectRatio?this._collectRatio=t.collectRatio:this._collectRatio=t._collectRatio||i.prototype._collectRatio,(t.boxed||t.hasOwnProperty("_boxed"))&&(this._boxed=t.boxed||t._boxed),(t.materialized||t.hasOwnProperty("_materialized"))&&(this._materialized=t.materialized||t._materialized),"boolean"==typeof t.treatErrorsAsValues?this._treatErrorsAsValues=t.treatErrorsAsValues:t.hasOwnProperty("_treatErrorsAsValues")&&(this._treatErrorsAsValues=t._treatErrorsAsValues),t.cache&&this.setCache(t.cache)}var n=e(4),o=e(3),s=e(55),a=e(64),c=e(65),u=e(61),h=e(63),l=e(73),p=e(75),f=e(74),d=e(81),m=e(84),v=e(49),g=e(134),y=e(88),_=e(100),b=e(96),x=e(102),w=e(98),S=e(99),M=e(77),C=e(76),E=e(130),T=0,O=e(116),P=function(){},A=e(14),j=e(19),R={pathValue:!0,pathSyntax:!0,json:!0,jsonGraph:!0},L=e(72);(t.exports=i).ref=E.ref,i.atom=E.atom,i.error=E.error,i.pathValue=E.pathValue,(i.prototype.constructor=i).prototype._materialized=!1,i.prototype._boxed=!1,i.prototype._progressive=!1,i.prototype._treatErrorsAsValues=!1,i.prototype._maxSize=Math.pow(2,53)-1,i.prototype._collectRatio=.75,i.prototype.get=e(71),i.prototype._getWithPaths=e(70),i.prototype.set=function(){var t=O(arguments,R,"set");return!0!==t?new a(function(e){e.onError(t)}):this._set.apply(this,arguments)},i.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()})})},i.prototype._set=function(){var e,t=-1,r=arguments.length,n=arguments[r-1];for(b(n)?r-=1:n=void 0,e=new Array(r);++t<r;)e[t]=arguments[t];return c.create(this,e,n)},i.prototype.call=function(){var e,t=-1,r=arguments.length;for(e=new Array(r);++t<r;){var n=arguments[t],i=typeof(e[t]=n);if(1<t&&!Array.isArray(n)||0===t&&!Array.isArray(n)&&"string"!==i||1===t&&!Array.isArray(n)&&!x(n))return new a(function(e){e.onError(new Error("Invalid argument"))})}return u.create(this,e)},i.prototype.invalidate=function(){var e,t=-1,r=arguments.length,n=arguments[r-1];for(e=new Array(r);++t<r;)if(e[t]=g.fromPath(arguments[t]),"object"!=typeof e[t])throw new Error("Invalid argument");h.create(this,e,n).subscribe(P,function(e){throw e})},i.prototype.deref=e(5),i.prototype.getValue=e(16),i.prototype.setValue=e(79),i.prototype._getValueSync=e(24),i.prototype._setValueSync=e(80),i.prototype._derefSync=e(6),i.prototype.setCache=function(e){var t=this._root.cache;if(e!==t){var r=this._root,n=this._path;this._path=[],this._root.cache={},void 0!==t&&v(r,r.expired,y(t),0),S(e)?C(this,[e]):w(e)?M(this,[e]):_(e)&&M(this,[{json:e}]),this._path=n}else void 0===t&&(this._root.cache={});return this},i.prototype.getCache=function(){var e=m(arguments);if(0===e.length)return A(this._root.cache);var t=[{}],r=this._path;return j.getWithPathsAsJSONGraph(this,e,t),this._path=r,t[0].jsonGraph},i.prototype.getVersion=function(e){var t=e&&g.fromPath(e)||[];if(!1===Array.isArray(t))throw new Error("Model#getVersion must be called with an Array path.");return this._path.length&&(t=this._path.concat(t)),this._getVersion(this,t)},i.prototype._syncCheck=function(e){if(Boolean(this._source)&&this._root.syncRefCount<=0&&!1===this._root.unsafeMode)throw new Error("Model#"+e+" may only be called within the context of a request selector.");return!0},i.prototype._clone=function(e){var t=new i(this);for(var r in e){var n=e[r];"delete"===n?delete t[r]:t[r]=n}return t.setCache=void 0,t},i.prototype.batch=function(e){var t=e;"number"==typeof t?t=new p(Math.round(Math.abs(t))):t&&t.schedule||(t=new l);var r=this._clone();return r._request=new s(r,t),r},i.prototype.unbatch=function(){var e=this._clone();return e._request=new s(e,new f),e},i.prototype.treatErrorsAsValues=function(){return this._clone({_treatErrorsAsValues:!0})},i.prototype.asDataSource=function(){return new o(this)},i.prototype._materialize=function(){return this._clone({_materialized:!0})},i.prototype._dematerialize=function(){return this._clone({_materialized:"delete"})},i.prototype.boxValues=function(){return this._clone({_boxed:!0})},i.prototype.unboxValues=function(){return this._clone({_boxed:"delete"})},i.prototype.withoutDataSource=function(){return this._clone({_source:"delete"})},i.prototype.toJSON=function(){return{$type:"ref",value:this._path}},i.prototype.getPath=function(){return d(this._path)},i.prototype._getBoundValue=e(13),i.prototype._getVersion=e(18),i.prototype._getValueSync=e(17),i.prototype._getPathValuesAsPathMap=j.getWithPathsAsPathMap,i.prototype._getPathValuesAsJSONG=j.getWithPathsAsJSONGraph,i.prototype._setPathValuesAsJSON=e(78),i.prototype._setPathValuesAsJSONG=e(78),i.prototype._setPathValuesAsPathMap=e(78),i.prototype._setPathValuesAsValues=e(78),i.prototype._setPathMapsAsJSON=e(77),i.prototype._setPathMapsAsJSONG=e(77),i.prototype._setPathMapsAsPathMap=e(77),i.prototype._setPathMapsAsValues=e(77),i.prototype._setJSONGsAsJSON=e(76),i.prototype._setJSONGsAsJSONG=e(76),i.prototype._setJSONGsAsPathMap=e(76),i.prototype._setJSONGsAsValues=e(76),i.prototype._setCache=e(77),i.prototype._invalidatePathValuesAsJSON=e(48),i.prototype._invalidatePathMapsAsJSON=e(47)},{100:100,102:102,116:116,13:13,130:130,134:134,14:14,16:16,17:17,18:18,19:19,24:24,3:3,4:4,47:47,48:48,49:49,5:5,55:55,6:6,61:61,63:63,64:64,65:65,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,84:84,88:88,96:96,98:98,99:99}],3:[function(e,t,r){function n(e){this._model=e._materialize().treatErrorsAsValues()}n.prototype.get=function(e){return this._model.get.apply(this._model,e)._toJSONG()},n.prototype.set=function(e){return this._model.set(e)._toJSONG()},n.prototype.call=function(e,t,r,n){var i=[e,t,r].concat(n);return this._model.call.apply(this._model,i)._toJSONG()},t.exports=n},{}],4:[function(e,t,r){function n(e){var t=e||{};this.syncRefCount=0,this.expired=t.expired||[],this.unsafeMode=t.unsafeMode||!1,this.collectionScheduler=t.collectionScheduler||new s,this.cache={},i(t.comparator)&&(this.comparator=t.comparator),i(t.errorSelector)&&(this.errorSelector=t.errorSelector),i(t.onChange)&&(this.onChange=t.onChange)}var i=e(96),o=e(91),s=e(74);n.prototype.errorSelector=function(e,t){return t},n.prototype.comparator=function(e,t){return o(e,"value")&&o(t,"value")?e.value===t.value&&e.$type===t.$type&&e.$expires===t.$expires:e===t},t.exports=n},{74:74,91:91,96:96}],5:[function(e,t,r){function a(e,t){var r,n=!1;try{++e._root.syncRefCount,r=e._derefSync(t)}catch(e){r=e,n=!0}finally{--e._root.syncRefCount}return n?c.Observable.throw(r):c.Observable.return(r)}var c=e(159),u=e(134);t.exports=function(e){for(var n=this,t=-1,i=arguments.length-1,o=new Array(i),s=u.fromPath(e);++t<i;)o[t]=u.fromPath(arguments[t+1]);if(0===i)throw new Error("Model#deref requires at least one value path.");return c.Observable.defer(function(){return a(n,s)}).flatMap(function(e){if(Boolean(e)){if(0<i){var t=c.Observable.of(e);return e.get.apply(e,o).catch(c.Observable.empty()).concat(t).last().flatMap(function(){return a(n,s)}).filter(function(e){return e})}return c.Observable.return(e)}if(0<i){var r=o.map(function(e){return s.concat(e)});return n.get.apply(n,r).concat(c.Observable.defer(function(){return a(n,s)})).last().filter(function(e){return e})}return c.Observable.empty()})}},{134:134,159:159}],6:[function(e,t,r){var o=e(134),s=e(13),a=e(8),c=e(118);t.exports=function(e){var t=o.fromPath(e);if(!Array.isArray(t))throw new Error("Model#derefSync must be called with an Array path.");var r=s(this,this._path.concat(t),!1),n=r.path,i=r.value;if(r.found&&void 0!==i&&(i.$type!==c||void 0!==i.value)){if(i.$type)throw new a;return this._clone({_path:n})}}},{118:118,13:13,134:134,8:8}],7:[function(e,t,r){function n(){this.message=n.message,this.stack=(new Error).stack}(n.prototype=new Error).name="BoundJSONGraphModelError",n.message="It is not legal to use the JSON Graph format from a bound Model. JSON Graph format can only be used from a root model.",t.exports=n},{}],8:[function(e,t,r){function n(e,t){this.message=i,this.stack=(new Error).stack,this.boundPath=e,this.shortedPath=t}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,t.exports=n},{}],9:[function(e,t,r){function n(e){this.message="An exception was thrown when making a request.",this.stack=(new Error).stack,this.innerError=e}var i="InvalidSourceError";(n.prototype=new Error).name=i,n.is=function(e){return e&&e.name===i},t.exports=n},{}],10:[function(e,t,r){function n(){this.message="The allowed number of retries have been exceeded.",this.stack=(new Error).stack}var i="MaxRetryExceededError";(n.prototype=new Error).name=i,n.is=function(e){return e&&e.name===i},t.exports=n},{}],11:[function(e,t,r){var v=e(26).create,g=e(22),y=e(27),_=e(120),b=e(33),x=e(29).promote;t.exports=function(e,t,r,n,i,o,s){for(var a,c=r,u=i,h=n,l=0;;){if(!(a=0===l&&h[b]?(l=u.length,h[b]):c[u[l++]])){c=void 0;break}var p=a.$type,f=p&&a.value||a;if(l<u.length){if(p){c=a;break}c=a}else{if(c=a,p&&y(a))break;if(h[b]||v(h,a),p!==_)break;s?g(e,a,o,null,null,null,u,u.length,s):x(e,a),l=0,u=f,h=a,c=t}}if(l<u.length&&void 0!==c){for(var d=[],m=0;m<l;m++)d[m]=u[m];u=d}return[c,u]}},{120:120,22:22,26:26,27:27,29:29,33:33}],12:[function(e,t,r){var m=e(15),v=e(8),g=e(7);t.exports=function(f,d){return function(e,t,r){var n,i,o,s=r[0],a={values:r,optimizedPaths:[]},c=e._root.cache,u=e._path,h=c,l=u.length,p=[];if(l){if(d)return{criticalError:new g};if((h=m(e,u)).$type)return{criticalError:new v(u,u)};for(n=[],i=0;i<l;++i)n[i]=u[i]}else n=[],l=0;for(i=0,o=t.length;i<o;i++)f(e,c,h,t[i],0,s,a,p,n,l,d);return a}}},{15:15,7:7,8:8}],13:[function(e,t,r){var h=e(17),l=e(8);t.exports=function(e,t,r){var n,i,o,s,a,c=t,u=t;for(n=e._boxed,r=e._materialized,i=e._treatErrorsAsValues,e._boxed=!0,e._materialized=void 0===r||r,e._treatErrorsAsValues=!0,o=h(e,c.concat(null),!0),e._boxed=n,e._materialized=r,e._treatErrorsAsValues=i,c=o.optimizedPath,s=o.shorted,a=o.found,o=o.value;c.length&&null===c[c.length-1];)c.pop();if(a&&s)throw new l(u,c);return{path:c,value:o,shorted:s,found:a}}},{17:17,8:8}],14:[function(e,t,r){function c(s,a,e){Object.keys(s).filter(function(e){return!h(e)&&s[e]}).forEach(function(e){var t=s[e],r=a[e];if(r||(r=a[e]={}),t.$type){var n,i=t.value&&"object"==typeof t.value,o=!s[u];return n=i||o?function(e){var t,r,n,i={},o=Object.keys(e);for(r=0,n=o.length;r<n;r++)t=o[r],h(t)||(i[t]=e[t]);return i}(t):t.value,void(a[e]=n)}c(t,r,e)})}var u=e(37),h=e(97);t.exports=function(e){var t={};return c(e,t),t}},{37:37,97:97}],15:[function(e,t,r){t.exports=function(e,t){for(var r=e._root.cache,n=-1,i=t.length;++n<i&&r&&!r.$type;)r=r[t[n]];return r}},{}],16:[function(e,t,r){var i=e(64),s=e(134);t.exports=function(e){for(var o=s.fromPath(e),t=0,r=o.length;++t<r;)if("object"==typeof o[t])return new i(function(e){e.onError(new Error("Paths must be simple paths"))});var n=this;return new i(function(i){return n.get(o).subscribe(function(e){for(var t=e.json,r=-1,n=o.length;t&&++r<n;)t=t[o[r]];i.onNext(t)},function(e){i.onError(e)},function(){i.onCompleted()})})}},{134:134,64:64}],17:[function(e,t,r){var _=e(11),b=e(25),x=e(27),w=e(29).promote,S=e(120),M=e(118),C=e(119);t.exports=function(e,t,r){for(var n,i,o,s,a,c=e._root.cache,u=t.length,h=[],l=!1,p=!1,f=0,d=c,m=c,v=c,g=!0,y=!1;d&&f<u;){if(null!==(n=t[f++])&&(d=m[n],h[h.length]=n),!d){g=!(l=!(v=void 0));break}if((o=d.$type)===M&&void 0===d.value){v=void 0,g=!1,l=f<u;break}if(f<u){if(o===S){if(x(d)){g=!(y=!(v=void 0));break}if(!(a=(s=_(e,c,c,d,d.value))[0])){d=v=void 0,g=!1;break}o=a.$type,d=a,h=s[1].slice(0)}if(o)break}else v=d;m=d}if(f<u&&!y){for(i=f;i<u;++i)if(null!==t[f]){p=!0;break}for(v=p?void(l=!0):d,i=f;i<u;++i)null!==t[i]&&(h[h.length]=t[i])}if(v&&o&&(x(v)?v=void 0:w(e,v)),v&&o===C&&!e._treatErrorsAsValues)throw{path:f===u?t:t.slice(0,f),value:v.value};return v&&e._boxed?v=Boolean(o)&&!r?b(v):v:!v&&e._materialized?v={$type:M}:v&&(v=v.value),{value:v,shorted:l,optimizedPath:h,found:g}}},{11:11,118:118,119:119,120:120,25:25,27:27,29:29}],18:[function(e,t,r){var i=e(46);t.exports=function(e,t){var r=e._getValueSync({_boxed:!0,_root:e._root,_treatErrorsAsValues:e._treatErrorsAsValues},t,!0).value,n=r&&r[i];return null==n?-1:n}},{46:46}],19:[function(e,t,r){var n=e(12),i=e(31),o=n(i,!1),s=n(i,!0);t.exports={getValueSync:e(17),getBoundValue:e(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:s}},{12:12,13:13,17:17,31:31}],20:[function(e,t,r){var n=e(29),s=e(25),a=n.promote;t.exports=function(e,t,r,n,i){var o=t.value;i.errors||(i.errors=[]),e._boxed&&(o=s(t)),i.errors.push({path:n.slice(0,r+1),value:o}),a(e,t)}},{25:25,29:29}],21:[function(e,t,r){var d=e(30).fastCopy;t.exports=function(e,t,r,n,i,o,s){var a,c,u,h,l,p,f;n.requestedMissingPaths||(n.requestedMissingPaths=[],n.optimizedMissingPaths=[]),a=r<t.length?d(t,r):[],c=a,u=r,h=i,l=o,p=s,(f=n).requestedMissingPaths.push(h.slice(0,u).concat(c)),f.optimizedMissingPaths.push(l.slice(0,p).concat(c))}},{30:30}],22:[function(e,t,r){var n=e(29),x=e(25),w=n.promote,S=e(120),M=e(118),C=e(119),E=e(37);t.exports=function(e,t,r,n,i,o,s,a,c,u){if(r){var h,l,p,f,d,m,v,g,y=!1;if(t&&w(e,t),t&&void 0!==t.value||(y=e._materialized),y)g={$type:M};else if(e._boxed)g=x(t);else if(t.$type===S||t.$type===C)g=c?x(t):t.value;else if(c){var _=t.value&&"object"==typeof t.value,b=!t[E];g=_||b?x(t):t.value}else g=t.value;if(i&&(i.hasValue=!0),c){for((d=r.jsonGraph)||(d=r.jsonGraph={},r.paths=[]),h=0,l=a-1;h<l;h++)d[f=s[h]]||(d[f]={}),d=d[f];d[f=s[h]]=y?{$type:M}:g,o&&r.paths.push(o.slice(0,n))}else if(0===n)r.json=g;else{for((d=r.json)||(d=r.json={}),h=0;h<n-1;h++)d[p=o[h]]||(d[p]={}),d=(m=d)[v=p];null!==(p=o[h])?d[p]=g:m[v]=g}}}},{118:118,119:119,120:120,25:25,29:29,37:37}],23:[function(e,t,r){var f=e(27),n=e(26),i=e(29),d=n.remove,m=i.splice,v=e(119),g=e(20),y=e(22),_=e(21),b=e(28),x=e(35);t.exports=function(e,t,r,n,i,o,s,a,c,u,h){var l=t&&t.$type,p=t&&void 0===t.value;return t&&l?void(f(t)?(t[x]||(m(e,t),d(t)),_(e,r,n,o,s,a,c)):l===v?(h&&(s[n]=null),u||e._treatErrorsAsValues?y(e,t,i,n,o,s,a,c,u,h):g(e,t,n,s,o)):(h&&(s[n]=null),(!p||p&&e._materialized)&&y(e,t,i,n,o,s,a,c,u,h))):void(b(e)?y(e,t,i,n,o,s,a,c,u,h):_(e,r,n,o,s,a,c))}},{119:119,20:20,21:21,22:22,26:26,27:27,28:28,29:29,35:35}],24:[function(e,t,r){var n=e(134);t.exports=function(e){var t=n.fromPath(e);if(!1===Array.isArray(t))throw new Error("Model#getValueSync must be called with an Array path.");return this._path.length&&(t=this._path.concat(t)),this._syncCheck("getValueSync")&&this._getValueSync(this,t).value}},{134:134}],25:[function(e,t,r){var s=e(40);t.exports=function(e){var t,r,n,i=Object.keys(e);for(t={},r=0,n=i.length;r<n;r++){var o=i[r];o[0]!==s&&(t[o]=e[o])}return t}},{40:40}],26:[function(e,t,r){var i=e(43),o=e(33),s=e(42),a=e(44);t.exports={create:function(e,t){var r=t[a]||0;t[i+r]=e,t[a]=r+1,e[s]=r,e[o]=t},remove:function(e){var t=e[o];if(t){for(var r=e[s],n=t[a];r<n;)t[i+r]=t[i+r+1],++r;t[a]=n-1,e[o]=void 0,e[s]=void 0}}}},{33:33,42:42,43:43,44:44}],27:[function(e,t,r){var n=e(106);t.exports=function(e){var t=void 0===e.$expires?-1:e.$expires;return-1!==t&&1!==t&&(0===t||t<n())}},{106:106}],28:[function(e,t,r){t.exports=function(e){return e._materialized&&!e._source}},{}],29:[function(e,t,r){var s=e(34),o=e(45),a=e(38),c=e(41),u=e(35);t.exports={promote:function(e,t){var r=e._root,n=r[s];if(n!==t){var i=t[c],o=t[a];o&&(o[c]=i),i&&(i[a]=o),t[c]=void 0,((r[s]=t)[a]=n)[c]=t}},splice:function(e,t){var r=e._root,n=t[c],i=t[a];i&&(i[c]=n),n&&(n[a]=i),t[c]=void 0,t===r[s]&&(r[s]=void 0),t===r[o]&&(r[o]=void 0),t[u]=!0,r.expired.push(t)}}},{34:34,35:35,38:38,41:41,45:45}],30:[function(e,t,r){t.exports={fastCat:function(e,t){var r,n,i,o=[];for(r=0,n=e.length;r<n;r++)o[r]=e[r];for(i=0,n=t.length;i<n;i++)o[r++]=t[i];return o},fastCatSkipNulls:function(e,t){var r,n,i,o=[];for(r=0,n=e.length;r<n;r++)o[r]=e[r];for(i=0,n=t.length;i<n;i++)null!==t[i]&&(o[r++]=t[i]);return o},fastCopy:function(e,t){var r,n,i,o=[];for(n=0,i=t||0,r=e.length;i<r;n++,i++)o[n]=e[i];return o}}},{}],31:[function(e,t,r){var O=e(11),P=e(23),A=e(27),j=e(143).iterateKeySet,R=e(120),L=e(29).promote;t.exports=function e(t,r,n,i,o,s,a,c,u,h,l,p){var f=p,d=u;if(!n||n&&n.$type||o===i.length)P(t,n,i,o,s,a,c,d,h,l,f);else{var m,v,g=o+1,y=!1,_=m=i[o];if("object"==typeof m&&(_=j(m,y={})),void 0!==_||!y.done){var b=h+1;do{var x;f=!1,null===_?x=n:(x=n[_],d[h]=_,c[o]=_);var w=d,S=b;if(x){var M=x.$type,C=M&&x.value||x;if(g<i.length&&M&&M===R&&!A(x)){l&&P(t,x,i,g,s,a,null,d,S,l,f),L(t,x);var E=O(t,r,r,x,C,s,l);f=!0,x=E[0];var T=E[1];for(w=[],S=T.length,v=0;v<S;++v)w[v]=T[v]}}e(t,r,x,i,g,s,a,c,w,S,l,f),y&&!y.done&&(_=j(m,y))}while(y&&!y.done)}}}},{11:11,120:120,143:143,23:23,27:27,29:29}],32:[function(e,t,r){"use strict";function n(e){return new n.Model(e)}n.Promise="function"==typeof Promise?Promise:e(151),(t.exports=n).Model=e(2)},{151:151,2:2}],33:[function(e,t,r){t.exports=e(40)+"context"},{40:40}],34:[function(e,t,r){t.exports=e(40)+"head"},{40:40}],35:[function(e,t,r){t.exports=e(40)+"invalidated"},{40:40}],36:[function(e,t,r){t.exports=e(40)+"key"},{40:40}],37:[function(e,t,r){t.exports="$modelCreated"},{}],38:[function(e,t,r){t.exports=e(40)+"next"},{40:40}],39:[function(e,t,r){t.exports=e(40)+"parent"},{40:40}],40:[function(e,t,r){t.exports=String.fromCharCode(30)},{}],41:[function(e,t,r){t.exports=e(40)+"prev"},{40:40}],42:[function(e,t,r){t.exports=e(40)+"ref-index"},{40:40}],43:[function(e,t,r){t.exports=e(40)+"ref"},{40:40}],44:[function(e,t,r){t.exports=e(40)+"refs-length"},{40:40}],45:[function(e,t,r){t.exports=e(40)+"tail"},{40:40}],46:[function(e,t,r){t.exports=e(40)+"version"},{40:40}],47:[function(e,t,r){function g(e,t,r,n,i,o,s,a,c,u){if(!L(e)&&!e.$type)for(var h in e)if(h[0]!==_&&"$"!==h[0]&&P(e,h)){var l=e[h],p=A(l)&&!l.$type,f=v(r,n,i,h,l,p,!1,o,s,a,c,u),d=f[0],m=f[1];d&&(p?g(l,t+1,r,m,d,o,s,a,c,u):k(d,m,h,a)&&D(m,O(d),a,o))}}function d(e,t,r,n,i,o,s,a){if(j(r))return N(r,i,o),[void 0,t];T(o,r);var c=r,u=r.value,h=t;if(null!=(r=r[x]))h=r[b]||t;else{var l=0,p=u.length-1;h=r=t;do{var f=v(t,h,r,u[l],e,l<p,!0,n,i,o,s,a);if(r=f[0],L(r))return f;h=f[1]}while(l++<p);if(c[x]!==r){var d=r[M]||0;r[M]=d+1,(r[y+d]=c)[x]=r,c[S]=d}}return[r,h]}function v(e,t,r,n,i,o,s,a,c,u,h,l){for(var p=r.$type;p===C;){var f=d(i,e,r,a,c,u,h,l);if(r=f[0],L(r))return f;t=f[1],p=r&&r.$type}if(void 0!==p)return[r,t];if(null==n){if(o)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[m])}else r=(t=r)[n];return[r,t]}var m=e(36),y=e(43),_=e(40),b=e(39),x=e(33),w=e(46),S=e(42),M=e(44),C=e(120),E=e(13),T=e(50),O=e(88),P=e(91),A=e(100),j=e(95),R=e(96),L=e(102),N=e(86),I=e(92),D=e(115),k=e(109);t.exports=function(e,t){for(var r=e._root,n=r,i=r.expired,o=I(),s=r._comparator,a=r._errorSelector,c=e._path,u=r.cache,h=c.length?E(e,c).value:u,l=h[b]||u,p=u[w],f=-1,d=t.length;++f<d;){g(t[f].json,0,u,l,h,o,i,n,s,a)}var m=u[w],v=r.onChange;R(v)&&p!==m&&v()}},{100:100,102:102,109:109,115:115,120:120,13:13,33:33,36:36,39:39,40:40,42:42,43:43,44:44,46:46,50:50,86:86,88:88,91:91,92:92,95:95,96:96}],48:[function(e,t,r){function m(e,t,r,n,i,o,s,a){var c={},u=t<e.length-1,h=e[t],l=P(h,c);do{var p=v(r,n,i,l,u,!1,o,s,a),f=p[0],d=p[1];f&&(u?m(e,t+1,r,d,f,o,s,a):R(f,d,l,a)&&j(d,M(f),a,o)),l=P(h,c)}while(!c.done)}function l(e,t,r,n,i){if(C(t))return O(t,n,i),[void 0,e];S(i,t);var o=t,s=t.value,a=e;if(null!=(t=t[d]))a=t[g]||e;else{var c=0,u=s.length-1;a=t=e;do{var h=v(e,a,t,s[c],c<u,!0,r,n,i);if(t=h[0],T(t))return h;a=h[1]}while(c++<u);if(o[d]!==t){var l=t[b]||0;t[b]=l+1,(t[f+l]=o)[d]=t,o[_]=l}}return[t,a]}function v(e,t,r,n,i,o,s,a,c){for(var u=r.$type;u===x;){var h=l(e,r,s,a,c);if(r=h[0],T(r))return h;t=h[1],u=r.$type}if(void 0!==u)return[r,t];if(null==n){if(i)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[p])}else r=(t=r)[n];return[r,t]}var p=e(36),f=e(43),g=e(39),d=e(33),y=e(46),_=e(42),b=e(44),x=e(120),w=e(13),S=e(50),M=e(88),C=e(95),E=e(96),T=e(102),O=e(86),P=e(143).iterateKeySet,A=e(92),j=e(115),R=e(109);t.exports=function(e,t){for(var r=e._root,n=r,i=r.expired,o=A(),s=e._path,a=r.cache,c=s.length?w(e,s).value:a,u=c[g]||a,h=a[y],l=-1,p=t.length;++l<p;){m(t[l],0,a,u,c,o,i,n)}var f=a[y],d=r.onChange;E(d)&&h!==f&&d()}},{102:102,109:109,115:115,120:120,13:13,143:143,33:33,36:36,39:39,42:42,43:43,44:44,46:46,50:50,86:86,88:88,92:92,95:95,96:96}],49:[function(e,t,r){var d=e(36),m=e(39),v=e(34),g=e(45),y=e(38),_=e(41),b=e(108),x=e(115);t.exports=function(e,t,r,n,i,o){var s=r,a=i;"number"!=typeof a&&(a=.75);var c,u,h,l="number"==typeof o,p=n*a;for(u=t.pop();u;)s-=h=u.$size||0,!0===l?x(u,h,e,o):(c=u[m])&&b(u,c,u[d],e),u=t.pop();if(n<=s){var f=e[g];for(u=f;p<=s&&u;)f=f[_],s-=h=u.$size||0,!0===l&&x(u,h,e,o),u=f;e[g]=e[_]=u,null==u?e[v]=e[y]=void 0:u[y]=void 0}}},{108:108,115:115,34:34,36:36,38:38,39:39,41:41,45:45}],50:[function(e,t,r){var s=e(121),a=e(34),c=e(45),u=e(38),h=e(41),l=e(100);t.exports=function(e,t){if(l(t)&&t.$expires!==s){var r=e[a],n=e[c],i=t[u],o=t[h];t!==r&&(null!=i&&"object"==typeof i&&(i[h]=o),null!=o&&"object"==typeof o&&(o[u]=i),null!=(i=r)&&"object"==typeof r&&(r[h]=t),e[a]=e[u]=r=t,r[u]=i,r[h]=void 0),null!=n&&t!==n||(e[c]=e[h]=n=o||t)}return t}},{100:100,121:121,34:34,38:38,41:41,45:45}],51:[function(e,t,r){var s=e(34),a=e(45),c=e(38),u=e(41);t.exports=function(e,t){var r=e[s],n=e[a],i=t[c],o=t[u];null!=i&&"object"==typeof i&&(i[u]=o),null!=o&&"object"==typeof o&&(o[c]=i),t===r&&(e[s]=e[c]=i),t===n&&(e[a]=e[u]=o),t[c]=t[u]=void 0,r=n=i=o=void 0}},{34:34,38:38,41:41,45:45}],52:[function(e,t,r){function h(e,t){var r=!1;return function(){r||e._disposed||(r=!0,e._callbacks[t]=null,e._optimizedPaths[t]=[],e._requestedPaths[t]=[],0!==--e._count||e.sent||(e._disposable.dispose(),e.requestQueue.removeRequest(e)))}}var l=e(59),c=e(60),n=0,i=e(57).GetRequest,p=e(76),f=e(78),d=e(119),m=[],o=function(e,t){this.sent=!1,this.scheduled=!1,this.requestQueue=t,this.id=++n,this.type=i,this._scheduler=e,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};o.prototype={batch:function(e,t,r){var o=this,n=o._optimizedPaths,s=o._requestedPaths,a=o._callbacks,i=n.length;return n[i]=t,s[i]=e,a[i]=r,++o._count,o.scheduled||(o.scheduled=!0,o._disposable=o._scheduler.schedule(function(){c(o,n,function(e,t){if(o.requestQueue.removeRequest(o),o._disposed=!0,o._count){o._merge(s,e,t);for(var r=0,n=a.length;r<n;++r){var i=a[r];i&&i(e,t)}}})})),h(o,i)},add:function(e,t,r){var n,i,o=this,s=l(e,t,o._pathMap),a=!1,c=!1;if((n=s?(i=s[2],s[1]):(i=e,t)).length<t.length){a=!0;var u=o._callbacks.length;o._callbacks[u]=r,o._requestedPaths[u]=s[0],o._optimizedPaths[u]=[],++o._count,c=h(o,u)}return[a,i,n,c]},_merge:function(e,t,r){var n=this.requestQueue.model,i=n._root,o=i.errorSelector,s=i.comparator,a=n._path;n._path=m;var c=function(e){for(var t=[],r=-1,n=0,i=e.length;n<i;++n)for(var o=e[n],s=0,a=o.length;s<a;++s)t[++r]=o[s];return t}(e);if(t){var u=t;u instanceof Error&&(u={message:u.message}),u.$type||(u={$type:d,value:u});var h=c.map(function(e){return{path:e,value:u}});f(n,h,null,o,s)}else p(n,[{paths:c,jsonGraph:r.jsonGraph}],null,o,s);n._path=a}},t.exports=o},{119:119,57:57,59:59,60:60,76:76,78:78}],53:[function(e,t,r){function n(){this.length=0,this.pending=!1,this.pathmaps=[],s.call(this,this._subscribe)}var i=e(159),o=i.Observer,s=i.Observable,a=i.Disposable,c=i.SerialDisposable,u=i.CompositeDisposable,h=e(9),f=e(143).iterateKeySet;n.create=function(e,t,r){var n=new this;return n.queue=e,n.model=t,n.index=r,n},((n.prototype=Object.create(s.prototype)).constructor=n).prototype.insertPath=function(e,t,r,n,i){var o=n||0,s=i||e.length-1,a=r||this.pathmaps[s+1]||(this.pathmaps[s+1]=Object.create(null));if(null==a)return!1;var c,u,h=e[o],l={};c=f(h,l);do{if(u=a[c],o<s){if(null==u){if(t)return!1;u=a[c]=Object.create(null)}if(!1===this.insertPath(e,t,u,o+1,s))return!1}else a[c]=(u||0)+1,this.length+=1;l.done||(c=f(h,l))}while(!l.done);return!0},n.prototype.removePath=function(e,t,r,n){var i=r||0,o=n||e.length-1,s=t||this.pathmaps[o+1];if(null==s)return!0;var a,c,u=0,h=e[i],l={};a=f(h,l);do{if(null!=(c=s[a])){if(i<o){u+=this.removePath(e,c,i+1,o);var p=void 0;for(p in c)break;void 0===p&&delete s[a]}else 0===(c=s[a]=(c||1)-1)&&delete s[a],u+=1,this.length-=1;l.done||(a=f(h,l))}}while(!l.done);return u},n.prototype.getSourceObserver=function(t){var r=this;return o.create(function(e){e.jsonGraph=e.jsonGraph||e.jsong||e.values||e.value,e.index=r.index,t.onNext(e)},function(e){t.onError(e)},function(){t.onCompleted()})},n.prototype._subscribe=function(e){var t=this,r=this.queue,n=!(t.pending=!0),i=new c,o=a.create(function(){n||(n=!0,r&&r._remove(t))}),s=new u(i,o);try{i.setDisposable(this.model._source[this.method](this.getSourceArgs()).subscribe(this.getSourceObserver(e)))}catch(e){throw new h(e)}return s},t.exports=n},{143:143,159:159,9:9}],54:[function(e,t,r){function n(e,t){this.total=0,this.model=e,this.requests=[],this.scheduler=t}var i=e(58),v=e(40),g=e(90),y=e(100),o=e(143);n.prototype.set=function(e){return e.paths=o.collapse(e.paths),i.create(this.model,e)},n.prototype._remove=function(e){var t=this.requests,r=t.indexOf(e);-1!==r&&t.splice(r,1)},n.prototype.distributePaths=function(e,t,r){var n,i,o=this.model,s=-1,a=e.length,c=-1,u=t.length,h=[];e:for(;++s<a;){var l=e[s];for(c=-1;++c<u;)if((i=t[c]).insertPath(l,i.pending)){h[c]=i;continue e}n||(n=r.create(this,o,this.total++),t[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(e,t){var r=0,n=[],i=[],o=[],s=e.index,a=t.index;e.index=Math.max(s,a),n[-1]=e.jsonGraph||{},i[-1]=t.jsonGraph||{};e:for(;-1<r;){for(var c=n[r-1],u=i[r-1],h=o[r-1]||(o[r-1]=Object.keys(u));0<h.length;){var l=h.pop();if(l[0]!==v)if(c.hasOwnProperty(l)){var p=c[l],f=g(p),d=u[l],m=g(d);if(y(p)&&y(d)&&!f&&!m){n[r]=p,i[r]=d,r+=1;continue e}s<a&&(c[l]=d)}else c[l]=u[l]}r-=1}return e},t.exports=n},{100:100,143:143,40:40,58:58,90:90}],55:[function(e,t,r){function n(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var i=e(54),o=e(56);n.prototype.get=o.prototype.get,n.prototype.removeRequest=o.prototype.removeRequest,n.prototype.set=i.prototype.set,n.prototype.call=i.prototype.call,t.exports=n},{54:54,56:56}],56:[function(e,t,r){function n(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var m=e(57),v=e(52);n.prototype={setScheduler:function(e){this.scheduler=e},get:function(e,t,r){function n(){p||0===--c&&r()}var i,o,s,a=[],c=0,u=this._requests,h=t,l=e,p=!1;for(i=0,o=u.length;i<o;++i)if((s=u[i]).type===m.GetRequest){if(s.sent){var f=s.add(l,h,n);f[0]&&(l=f[1],h=f[2],a[a.length]=f[3],++c)}else s.batch(l,h,n),h=[],l=[],++c;if(!h.length)break}if(h.length){s=new v(this.scheduler,this),u[u.length]=s,++c;var d=s.batch(l,h,n);a[a.length]=d}return function(){if(!p&&0!==c){p=!0;for(var e=a.length,t=0;t<e;++t)a[t]()}}},removeRequest:function(e){for(var t=this._requests,r=t.length;0<=--r;)if(t[r].id===e.id){t.splice(r,1);break}}},t.exports=n},{52:52,57:57}],57:[function(e,t,r){t.exports={GetRequest:"GET"}},{}],58:[function(e,t,r){function n(){u.call(this)}var c=e(159).Observer,u=e(53),h=e(83),l=e(76),p=e(78),f=new Array(0);n.create=function(e,t){var r=new n;return r.model=e,r.jsonGraphEnvelope=t,r},((n.prototype=Object.create(u.prototype)).constructor=n).prototype.method="set",n.prototype.insertPath=function(){return!1},n.prototype.removePath=function(){return 0},n.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},n.prototype.getSourceObserver=function(r){var n=this.model,i=n._path,o=this.jsonGraphEnvelope.paths,e=n._root,s=e.errorSelector,a=e.comparator;return u.prototype.getSourceObserver.call(this,c.create(function(e){n._path=f;var t=l(n,[{paths:o,jsonGraph:e.jsonGraph}],null,s,a);e.paths=t[1],n._path=i,r.onNext(e)},function(t){n._path=f,p(n,h(o,function(e){return{path:e,value:t}}),null,s,a),n._path=i,r.onError(t)},function(){r.onCompleted()}))},t.exports=n},{159:159,53:53,76:76,78:78,83:83}],59:[function(e,t,r){var f=e(143).hasIntersection,d=e(84);t.exports=function(e,t,r){for(var n=[],i=[],o=[],s=-1,a=-1,c=!1,u=0,h=t.length;u<h;++u){var l=t[u],p=r[l.length];p&&f(p,l,0)?(!c&&0<u&&(i=d(e,0,u),n=d(t,0,u)),o[++s]=e[u],c=!0):c&&(n[++a]=l,i[a]=e[u])}return c?[o,n,i]:null}},{143:143,84:84}],60:[function(e,t,r){var n=e(143),y=n.toTree,_=n.toPaths;t.exports=function(e,t,r){if(0!==e._count){e.sent=!0,e.scheduled=!1;for(var n=e._pathMap,i=0,o=Object.keys(t).length;i<o;++i)for(var s=t[i],a=0,c=s.length;a<c;++a){var u=s[a],h=u.length;if(n[h]){var l=n[h];l[l.length]=u}else n[h]=[u]}for(var p=Object.keys(n),f=0,d=p.length;f<d;++f){var m=p[f];n[m]=y(n[m])}var v,g=e._collasped=_(n);e.requestQueue.model._source.get(g).subscribe(function(e){v=e},function(e){r(e,v)},function(){r(null,v)})}else e.requestQueue.removeRequest(e)}},{143:143}],61:[function(e,t,r){function n(e){y.call(this,e||i)}function v(e){return g.Observable.defer(function(){return e})}function i(i){function p(e){return h.concat(e)}var e,t=this.args,o=this.model,s=x.fromPath(t[0]),a=t[1]||[],c=(t[2]||[]).map(x.fromPath),f=(t[3]||[]).map(x.fromPath),d=o._clone({_path:[]}),u=d.withoutDataSource(),r=o._path,n=r.concat(s),h=n.slice(0,-1),l=v(o.withoutDataSource().get(s)).map(function(e){for(var t=e.json,r=-1,n=s.length;t&&++r<n;)t=t[s[r]];return{model:d._derefSync(h).boxValues(),localFn:t}}).flatMap(function(e){function h(e,t){var r=t.path;return e.push.apply(e,c.map(function(e){return r.concat(e)})),e}function l(e){return e.path}var t=e&&e.localFn;if("function"!=typeof t)return y.empty();var r=e.model,n=r._path,i=t.apply(r,a).reduce(function(e,t){if(Boolean(t.invalidated))e.invalidations.push(e.localThisPath.concat(t.path));else{var r=t.path,n=t.value;Boolean(n)&&"object"==typeof n&&n.$type===w?e.references.push({path:p(r),value:t.value}):e.values.push({path:p(r),value:t.value})}return e},{values:[],references:[],invalidations:[],localThisPath:n}).flatMap(function(t){var e=t.values.concat(t.references);return 0<e.length?v(u.set.apply(u,e)._toJSONG()).map(function(e){return{results:t,envelope:e}}):y.return({results:t,envelope:{jsonGraph:{},paths:[]}})}).flatMap(function(e){var t=e.envelope,r=e.results,n=r.values,i=r.references,o=r.invalidations,s=n.map(l).map(p),a=i.reduce(h,[]),c=f.map(p),u=a.concat(c);return(0<u.length?v(d.get.apply(d,s.concat(u))._toJSONG()):y.return(t)).doAction(function(e){e.invalidated=o})});return y.return(i)}).defaultIfEmpty((e=o._source,e&&"object"==typeof e?g.Observable.defer(function(){var t;try{t=e.call(n,a,c,f)}catch(e){t=y.throw(new b(e))}return t}).map(function(e){var t=e.invalidated;return t&&t.length&&d.invalidate.apply(d,t),e}):y.empty())).mergeAll().flatMap(function(e){return v(u.set(e)).reduce(function(e){return e},null).map(function(){return{invalidated:e.invalidated,paths:e.paths.map(function(e){return e.slice(r.length)})}})}),m=new _;return m.add(l.subscribe(function(e){var t=e.paths,r=e.invalidated,n=o.get.apply(o,t);"AsJSONG"===i.outputFormat&&(n=v(n._toJSONG()).doAction(function(e){e.invalidated=r})),m.add(n.subscribe(i))},function(e){i.onError(e)})),m}var g=e(159)&&e(158),y=g.Observable,_=g.CompositeDisposable,o=e(64),b=e(9),x=e(134),w=e(120);n.create=o.create,((n.prototype=Object.create(y.prototype)).constructor=n).prototype.invokeSourceRequest=function(e){return this},n.prototype.ensureCollect=function(e){return this},n.prototype.initialize=function(){return this},t.exports=n},{120:120,134:134,158:158,159:159,64:64,9:9}],62:[function(e,t,r){function n(e){i.call(this,e)}var i=e(159).Observable,o=e(64),p=e(134),s=e(88),a=e(49),f=e(81),c=e(46),d=Array.isArray,m=e(101),v=e(98),g=e(99);n.create=o.create,((n.prototype=Object.create(i.prototype)).constructor=n).prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var e,t,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],s=[],a=this.args,c=-1,u=a.length;++c<u;){var h,l=a[c];d(l)||"string"==typeof l?(l=p.fromPath(l),h="PathValues"):m(l)?(l.path=p.fromPath(l.path),h="PathValues"):g(l)?h="JSONGs":v(l)&&(h="PathMaps"),t!==h&&(e={inputType:t=h,arguments:[]},s.push(e),e.values=o),e.arguments.push(l)}return this.boundPath=f(r._path),this.groups=s,this.outputFormat=n,this.isProgressive=i,this.isCompleted=!1,this.isMaster=null==r._source,this.values=o,this},n.prototype.invokeSourceRequest=function(e){return this},n.prototype.ensureCollect=function(r){var t=this.finally(function(){var e=r._root,t=e.cache;e.collectionScheduler.schedule(function(){a(e,e.expired,s(t),r._maxSize,r._collectRatio,t[c])})});return new this.constructor(function(e){return t.subscribe(e)})},t.exports=n},{101:101,134:134,159:159,46:46,49:49,64:64,81:81,88:88,98:98,99:99}],63:[function(e,t,r){function n(e){o.call(this,e||i)}function i(e){for(var t=this.model,r=this.method,n=this.groups,i=-1,o=n.length;++i<o;){var s=n[i],a=s.inputType,c=s.arguments;if(0<c.length)(0,t["_"+r+a+"AsJSON"])(t,c)}return e.onCompleted(),u.empty}var u=e(159).Disposable,o=e(62);n.create=o.create,(n.prototype=Object.create(o.prototype)).method="invalidate",n.prototype.constructor=n,t.exports=n},{159:159,62:62}],64:[function(e,t,r){function n(e){this._subscribe=e}function i(e){var t=this.model,r=new this.type;return r.model=t,r.args=this.args,r.outputFormat=e.outputFormat||"AsPathMap",r.isProgressive=e.isProgressive||!1,r.subscribeCount=0,r.subscribeLimit=e.retryLimit||10,r.initialize().invokeSourceRequest(t).ensureCollect(t).subscribe(e)}var o=e(32),s=(e(159)&&e(158)).Observable,a=e(84),c=e(105),u={outputFormat:{value:"AsJSONG"}},h={isProgressive:{value:!0}};n.create=function(e,t){var r=new n(i);return r.args=t,r.type=this,r.model=e,r},((n.prototype=Object.create(s.prototype)).constructor=n).prototype._mixin=function(){var t=this,r=a(arguments);return new t.constructor(function(e){return t.subscribe(r.reduce(function(e,t){return Object.create(e,t)},e))})},n.prototype._toJSONG=function(){return this._mixin(u)},n.prototype.progressively=function(){return this._mixin(h)},n.prototype.subscribe=function(e,t,r){var n=e;n&&"object"==typeof n||(n={onNext:e||c,onError:t||c,onCompleted:r||c});var i=this._subscribe(n);switch(typeof i){case"function":return{dispose:i};case"object":return i||{dispose:c};default:return{dispose:c}}},n.prototype.then=function(e,t){var i=this;return new o.Promise(function(e,t){var r,n=!1;i.toArray().subscribe(function(e){r=e.length<=1?e[0]:e},function(e){n=!0,t(e)},function(){!1===n&&e(r)})}).then(e,t)},t.exports=n},{105:105,158:158,159:159,32:32,84:84}],65:[function(e,t,r){function n(e){a.call(this,e||i)}function i(e){return this.isCompleted?y.call(this,e):function(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),x.empty;for(var t=[],r=[],n=this.model,i=this.isMaster,o=n._root,s=this.outputFormat,a=o.errorSelector,c=this.method,u=this.groups,h=-1,l=u.length;++h<l;){var p=u[h],f=p.inputType,d=p.arguments;if(0<d.length){var m="_"+c+f+s,v=n[m],g=v(n,d,null,a);r.push.apply(r,g[1]),"PathValues"===f?t.push.apply(t,d.map(_)):"JSONGs"===f?t.push.apply(t,w(d,b)):t.push.apply(t,g[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,y.call(this,e)):void e.onError({method:c,optimizedPaths:r,invokeSourceRequest:!0})}.call(this,e)}function y(e){var t=new s(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(t=t._toJSONG()),this.isProgressive&&(t=t.progressively()),t.subscribe(e)}function _(e){return e.path}function b(e){return e.paths}var o=e(159),c=o.Observable,x=o.Disposable,s=e(67),a=e(62),u=e(9),w=e(82),h=new Array(0);n.create=a.create,(n.prototype=Object.create(a.prototype)).method="set",(n.prototype.constructor=n).prototype.invokeSourceRequest=function(o){var s=this,a=this.catch(function(e){var t;if(e&&!0===e.invokeSourceRequest){var r={},n=o._path,i=e.optimizedPaths;o._path=h,o._getPathValuesAsJSONG(o._materialize().withoutDataSource(),i,[r]),o._path=n,t=o._request.set(r).do(function(e){s.isCompleted=i.length===e.paths.length},function(){s.isCompleted=!0}).materialize().flatMap(function(e){if("C"===e.kind)return c.empty();if("E"===e.kind){var t=e.exception;if(u.is(t))return c.throw(e.exception)}return a})}else t=c.throw(e);return t});return new this.constructor(function(e){return a.subscribe(e)})},t.exports=n},{159:159,62:62,67:67,82:82,9:9}],66:[function(e,t,r){var n=function(e){this.disposed=!1,this.currentDisposable=e};n.prototype={dispose:function(){if(!this.disposed&&this.currentDisposable){this.disposed=!0;var e=this.currentDisposable;e.dispose?e.dispose():e()}}},t.exports=n},{}],67:[function(e,t,r){var n=e(64),s=e(68),a=e(69),c={dispose:function(){}},i=e(159).Observable,o=t.exports=function(e,t,r,n){this.model=e,this.currentRemainingPaths=t,this.isJSONGraph=r||!1,this.isProgressive=n||!1};o.prototype=Object.create(i.prototype),o.prototype.subscribe=n.prototype.subscribe,o.prototype.then=n.prototype.then,o.prototype._toJSONG=function(){return new o(this.model,this.currentRemainingPaths,!0,this.isProgressive)},o.prototype.progressively=function(){return new o(this.model,this.currentRemainingPaths,this.isJSONGraph,!0)},o.prototype._subscribe=function(e){var t=[{}],r=[],n=e.isJSONG=this.isJSONGraph,i=this.isProgressive,o=s(this.model,this.currentRemainingPaths,e,i,n,t,r);return o?a(this,this.model,o,e,t,r,1):c}},{159:159,64:64,68:68,69:69}],68:[function(e,t,r){var n=e(19),m=n.getWithPathsAsJSONGraph,v=n.getWithPathsAsPathMap;t.exports=function(e,t,r,n,i,o,s){var a;if((a=i?m(e,t,o):v(e,t,o)).criticalError)return r.onError(a.criticalError),null;var c=a.hasValue,u=!a.requestedMissingPaths||!e._source,h=o[0].json||o[0].jsonGraph;if(a.errors)for(var l=a.errors,p=s.length,f=0,d=l.length;f<d;++f,++p)s[p]=l[f];if(c&&n||h&&u)try{++e._root.syncRefCount,r.onNext(o[0])}catch(e){throw e}finally{--e._root.syncRefCount}return u?(s.length?r.onError(s):r.onCompleted(),null):a}},{19:19}],69:[function(e,t,r){var g=e(68),y=e(10),_=e(30).fastCat,b=e(49),x=e(88),w=e(66),S=e(46);t.exports=function i(o,s,e,a,c,u,h){if(10===h)throw new y;var t=s._request,l=e.requestedMissingPaths,r=e.optimizedMissingPaths,p=new w,n=[],f=s._path;if(f.length)for(var d=0,m=l.length;d<m;++d)n[d]=_(f,l[d]);else n=l;var v=t.get(n,r,function(){var e=g(s,l,a,o.isProgressive,o.isJSONGraph,c,u);if(e)p.currentDisposable=i(o,s,e,a,c,u,h+1);else{var t=s._root,r=t.cache,n=r[S];b(t,t.expired,x(r),s._maxSize,s._collectRatio,n)}});return p.currentDisposable=v,p}},{10:10,30:30,46:46,49:49,66:66,68:68,88:88}],70:[function(e,t,r){var n=e(67);t.exports=function(e){return new n(this,e)}},{67:67}],71:[function(e,t,r){var n=e(134),i=e(64),o=e(72),s=e(116),a=e(67);t.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(e,t,r){t.exports={path:!0,pathSyntax:!0}},{}],73:[function(e,t,r){function n(){}var i=e(123),o=e(159).Disposable;n.prototype.schedule=function(e){return i(e),o.empty},n.prototype.scheduleWithState=function(e,t){var r=this;return i(function(){t(r,e)}),o.empty},t.exports=n},{123:123,159:159}],74:[function(e,t,r){function n(){}var i=e(159).Disposable;n.prototype.schedule=function(e){return e(),i.empty},n.prototype.scheduleWithState=function(e,t){return t(this,e),i.empty},t.exports=n},{159:159}],75:[function(e,t,r){function n(e){this.delay=e}var i=e(159).Disposable;n.prototype.schedule=function(e){var t=setTimeout(e,this.delay);return i.create(function(){void 0!==t&&(clearTimeout(t),t=void 0)})},n.prototype.scheduleWithState=function(e,t){var r=this,n=setTimeout(function(){t(r,e)},this.delay);return i.create(function(){void 0!==n&&(clearTimeout(n),n=void 0)})},t.exports=n},{159:159}],76:[function(e,t,r){function C(e,t,r,n,i,o,s,a,c,u,h,l,p,f,d,m,v){for(var g={},y=t<e.length-1,_=e[t],b=L(_,g),x=l.index;;){h.depth=t;var w=E(r,n,i,o,s,a,b,y,!1,h,l,p,f,d,m,v);h[t]=b,h.index=t,l[l.index++]=b;var S=w[0],M=w[1];if(S&&(y?C(e,t+1,r,M,S,o,w[3],w[2],c,u,h,l,p,f,d,m,v):(O(d,S),c.push(h.slice(0,h.index+1)),u.push(l.slice(0,l.index)))),b=L(_,g),g.done)break;l.index=x}}function y(e,t,r,n,i,o,s,a,c,u,h){var l=t.value;if(o.splice(0,o.length),o.push.apply(o,l),P(t))return o.index=l.length,R(t,a,c),[void 0,e,n,r];O(c,t);var p=0,f=t,d=l.length-1,m=t=e,v=n=r;do{var g=E(e,m,t,r,v,n,l[p],p<d,!0,i,o,s,a,c,u,h);if(t=g[0],j(t))return o.index=p,g;m=g[1],n=g[2],v=g[3]}while(p++<d);if(o.index=p,f[x]!==t){var y=t[S]||0;t[S]=y+1,(t[b+y]=f)[x]=t,f[w]=y}return[t,m,n,v]}function E(e,t,r,n,i,o,s,a,c,u,h,l,p,f,d,m){for(var v=r.$type;v===T;){var g=y(e,r,n,o,u,h,l,p,f,d,m);if(r=g[0],j(r))return g;t=g[1],o=g[2],i=g[3],v=r.$type}if(void 0!==v)return[r,t,o,i];if(null==s){if(a)throw new Error("`null` is not allowed in branch key positions.");r&&(s=r[_])}else i=o,r=(t=r)[s],o=i&&i[s];return[r=I(t,r,o,s,u,h,l,p,f,d,m),t,o,i]}var _=e(36),b=e(43),x=e(33),M=e(46),w=e(42),S=e(44),T=e(120),O=e(50),P=e(94),A=e(96),j=e(102),R=e(86),L=e(143).iterateKeySet,N=e(92),I=e(103);t.exports=function(e,t,r,n,i){for(var o=e._root,s=o,a=o.expired,c=N(),u=o.cache,h=u[M],l=[],p=[],f=[],d=[],m=-1,v=t.length;++m<v;)for(var g=t[m],y=g.paths,_=g.jsonGraph,b=-1,x=y.length;++b<x;){C(y[b],p.index=0,u,u,u,_,_,_,f,d,l,p,c,a,s,i,n)}var w=u[M],S=o.onChange;return A(S)&&h!==w&&S(),[f,d]}},{102:102,103:103,120:120,143:143,33:33,36:36,42:42,43:43,44:44,46:46,50:50,86:86,92:92,94:94,96:96}],77:[function(e,t,r){function M(e,t,r,n,i,o,s,a,c,u,h,l,p,f){var d=function(e){if(L(e)&&!e.$type){var t=[],r=0;for(var n in A(e)&&(t[r++]="length"),e)n[0]!==E&&"$"!==n[0]&&R(e,n)&&(t[r++]=n);return t}}(e);if(d&&d.length)for(var m=0,v=d.length,g=c.index;;){var y=d[m],_=e[y],b=L(_)&&!_.$type;a.depth=t;var x=C(r,n,i,y,_,b,!1,a,c,u,h,l,p,f);a[t]=y,a.index=t,c[c.index++]=y;var w=x[0],S=x[1];if(w&&(b?M(_,t+1,r,S,w,o,s,a,c,u,h,l,p,f):(j(l,w),o.push(a.slice(0,a.index+1)),s.push(c.slice(0,c.index)))),++m>=v)break;c.index=g}}function v(e,t,r,n,i,o,s,a,c,u){var h=r.value;if(i.splice(0,i.length),i.push.apply(i,h),S(r))return i.index=h.length,D(r,s,a),[void 0,t];j(a,r);var l=r,p=t;if(null!=(r=r[_]))p=r[T]||t,i.index=h.length;else{var f=0,d=h.length-1;p=r=t;do{var m=C(t,p,r,h[f],e,f<d,!0,n,i,o,s,a,c,u);if(r=m[0],I(r))return i.index=f,m;p=m[1]}while(f++<d);if(i.index=f,l[_]!==r){var v=r[x]||0;r[x]=v+1,(r[y+v]=l)[_]=r,l[b]=v}}return[r,p]}function C(e,t,r,n,i,o,s,a,c,u,h,l,p,f){for(var d=r.$type;d===w;){var m=v(i,e,r,a,c,u,h,l,p,f);if(r=m[0],I(r))return m;t=m[1],d=r&&r.$type}if(void 0!==d)return[r,t];if(null==n){if(o)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[g])}else r=(t=r)[n];return[r=B(t,r,n,i,o,s,a,c,u,h,l,p,f),t]}var g=e(36),y=e(43),E=e(40),T=e(39),_=e(33),O=e(46),b=e(42),x=e(44),w=e(120),P=e(13),A=Array.isArray,j=e(50),R=e(91),L=e(100),S=e(95),N=e(96),I=e(102),D=e(86),k=e(92),B=e(104);t.exports=function(e,t,r,n,i){for(var o=e._root,s=o,a=o.expired,c=k(),u=e._path,h=o.cache,l=u.length?P(e,u).value:h,p=l[T]||h,f=h[O],d=[],m=[],v=[],g=u.length,y=-1,_=t.length;++y<_;){var b=t[y],x=u.slice(0);x.index=g,M(b.json,0,h,p,l,m,v,d,x,c,a,s,i,n)}var w=h[O],S=o.onChange;return N(S)&&f!==w&&S(),[m,v]}},{100:100,102:102,104:104,120:120,13:13,33:33,36:36,39:39,40:40,42:42,43:43,44:44,46:46,50:50,86:86,91:91,92:92,95:95,96:96}],78:[function(e,t,r){function E(e,t,r,n,i,o,s,a,c,u,h,l,p,f,d){for(var m={},v=r<t.length-1,g=t[r],y=L(g,m),_=u.index;;){c.depth=r;var b=S(n,i,o,y,e,v,!1,c,u,h,l,p,f,d);c[r]=y,c.index=r,u[u.index++]=y;var x=b[0],w=b[1];if(x&&(v?E(e,t,r+1,n,w,x,s,a,c,u,h,l,p,f,d):(M(p,x),s.push(c.slice(0,c.index+1)),a.push(u.slice(0,u.index)))),y=L(g,m),m.done)break;u.index=_}}function v(e,t,r,n,i,o,s,a,c,u){var h=r.value;if(i.splice(0,i.length),i.push.apply(i,h),C(r))return i.index=h.length,R(r,s,a),[void 0,t];M(a,r);var l=r,p=t;if(null!=(r=r[_]))p=r[T]||t,i.index=h.length;else{var f=0,d=h.length-1;p=r=t;do{var m=S(t,p,r,h[f],e,f<d,!0,n,i,o,s,a,c,u);if(r=m[0],j(r))return i.index=f,m;p=m[1]}while(f++<d);if(i.index=f,l[_]!==r){var v=r[x]||0;r[x]=v+1,(r[y+v]=l)[_]=r,l[b]=v}}return[r,p]}function S(e,t,r,n,i,o,s,a,c,u,h,l,p,f){for(var d=r.$type;d===w;){var m=v(i,e,r,a,c,u,h,l,p,f);if(r=m[0],j(r))return m;t=m[1],d=r.$type}if(void 0!==d)return[r,t];if(null==n){if(o)throw new Error("`null` is not allowed in branch key positions.");r&&(n=r[g])}else r=(t=r)[n];return[r=I(t,r,n,i,o,s,a,c,u,h,l,p,f),t]}var g=e(36),y=e(43),T=e(39),_=e(33),O=e(46),b=e(42),x=e(44),w=e(120),P=e(13),M=e(50),C=e(95),A=e(96),j=e(102),R=e(86),L=e(143).iterateKeySet,N=e(92),I=e(104);t.exports=function(e,t,r,n,i){for(var o=e._root,s=o,a=o.expired,c=N(),u=e._path,h=o.cache,l=u.length?P(e,u).value:h,p=l[T]||h,f=h[O],d=[],m=[],v=[],g=u.length,y=-1,_=t.length;++y<_;){var b=t[y],x=b.path,w=b.value,S=u.slice(0);S.index=g,E(w,x,0,h,p,l,m,v,d,S,c,a,s,i,n)}var M=h[O],C=o.onChange;return A(C)&&f!==M&&C(),[m,v]}},{102:102,104:104,120:120,13:13,143:143,33:33,36:36,39:39,42:42,43:43,44:44,46:46,50:50,86:86,92:92,95:95,96:96}],79:[function(e,t,r){var a=e(130),c=e(64),u=e(101);t.exports=function(e,t){for(var r=u(e)?e:a.pathValue(e,t),n=0,o=r.path,i=o.length;++n<i;)if("object"==typeof o[n])return new c(function(e){e.onError(new Error("Paths must be simple paths"))});var s=this;return new c(function(i){return s._set(r).subscribe(function(e){for(var t=e.json,r=-1,n=o.length;t&&++r<n;)t=t[o[r]];i.onNext(t)},function(e){i.onError(e)},function(){i.onCompleted()})})}},{101:101,130:130,64:64}],80:[function(e,t,r){var c=e(134),u=e(101),h=e(78);t.exports=function(e,t,r,n){var i=c.fromPath(e),o=t,s=r,a=n;if(o=u(i)?(a=s,s=o,i):{path:i,value:o},!1===u(o))throw new Error("Model#setValueSync must be called with an Array path.");return"function"!=typeof s&&(s=this._root._errorSelector),"function"!=typeof a&&(a=this._root._comparator),this._syncCheck("setValueSync")?(h(this,[o]),this._getValueSync(this,o.path).value):void 0}},{101:101,134:134,78:78}],81:[function(e,t,r){t.exports=function(e){if(!e)return e;for(var t=-1,r=e.length,n=[];++t<r;)n[t]=e[t];return n}},{}],82:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=-1,i=e.length,o=[];++n<i;)for(var s=t(e[n],n,e),a=-1,c=s.length;++a<c;)o[++r]=s[a];return o}},{}],83:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=e.length,i=new Array(n);++r<n;)i[r]=t(e[r],r,e);return i}},{}],84:[function(e,t,r){t.exports=function(e,t,r){var n=t||0,i=-1,o=e.length-n;o<0&&(o=0),0<r&&r<o&&(o=r);for(var s=new Array(o);++i<o;)s[i]=e[i+n];return s}},{}],85:[function(e,t,r){var i=e(40),o=e(91),s=Array.isArray,a=e(100);t.exports=function(e){var t=e;if(a(t)){t=s(e)?[]:{};var r=e;for(var n in r)n[0]!==i&&o(r,n)&&(t[n]=r[n])}return t}},{100:100,40:40,91:91}],86:[function(e,t,r){var n=e(51),i=e(35);t.exports=function(e,t,r){return e[i]||(e[i]=!0,t.push(e),n(r,e)),e}},{35:35,51:51}],87:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&e.$expires||void 0}},{100:100}],88:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&e.$size||0}},{100:100}],89:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&e.$timestamp||void 0}},{100:100}],90:[function(e,t,r){var n=e(100);t.exports=function(e,t){var r=n(e)&&e.$type||void 0;return t&&r?"branch":r}},{100:100}],91:[function(e,t,r){var n=e(100),i=Object.prototype.hasOwnProperty;t.exports=function(e,t){return n(e)&&i.call(e,t)}},{100:100}],92:[function(e,t,r){var n=1;t.exports=function(){return n++}},{}],93:[function(e,t,r){var i=e(36),o=e(39),s=e(46);t.exports=function(e,t,r,n){return e[i]=r,e[o]=t,e[s]=n,t[r]=e}},{36:36,39:39,46:46}],94:[function(e,t,r){var n=e(106),i=e(122),o=e(121);t.exports=function(e){var t=e.$expires;return null!=t&&t!==o&&t!==i&&t<n()}},{106:106,121:121,122:122}],95:[function(e,t,r){var n=e(106),i=e(122),o=e(121);t.exports=function(e){var t=e.$expires;return null!=t&&t!==o&&(t===i||t<n())}},{106:106,121:121,122:122}],96:[function(e,t,r){t.exports=function(e){return Boolean(e)&&"function"==typeof e}},{}],97:[function(e,t,r){var n=e(40);t.exports=function(e){return"$size"===e||e&&e.charAt(0)===n}},{40:40}],98:[function(e,t,r){var n=e(100);t.exports=function(e){return n(e)&&"json"in e}},{100:100}],99:[function(e,t,r){var n=Array.isArray,i=e(100);t.exports=function(e){return i(e)&&n(e.paths)&&(i(e.jsonGraph)||i(e.jsong)||i(e.json)||i(e.values)||i(e.value))}},{100:100}],100:[function(e,t,r){t.exports=function(e){return null!==e&&"object"==typeof e}},{}],101:[function(e,t,r){var n=Array.isArray,i=e(100);t.exports=function(e){return i(e)&&(n(e.path)||"string"==typeof e.path)}},{100:100}],102:[function(e,t,r){t.exports=function(e){return null==e||"object"!=typeof e}},{}],103:[function(e,t,r){var _=e(36),b=e(39),x=e(120),w=e(119),S=e(88),M=e(89),C=e(100),E=e(95),T=e(96),O=e(50),P=e(117),A=e(93),j=e(86),R=e(110),L=e(115),N=e(107);t.exports=function(e,t,r,n,i,o,s,a,c,u,h){var l,p,f,d,m,v,g;if(t===r){if(null===r)return t=P(r,void 0,r),e=L(e,-t.$size,c,s),t=A(t,e,n),O(c,t),t;if(void 0===r)return r;if((d=C(t))&&null==(p=t.$type))return null==t[b]&&(t[_]=n,t[b]=e),t}else(d=C(t))&&(p=t.$type);if(p!==x){if((m=C(r))&&(f=r.$type),d&&!p&&(null==r||m&&!f))return t}else{if(null==r)return E(t)?void j(t,a,c):t;if((m=C(r))&&(f=r.$type)===x)if(t===r){if(null!=t[b])return t}else if(v=t.$timestamp,g=r.$timestamp,!E(t)&&!E(r)&&g<v)return}if(p&&m&&!f)return A(R(t,r,e,n,c),e,n);if(f||!m){if(f===w&&T(h)&&(r=h(N(i,n),r)),f&&t===r)null==t[b]&&(t=P(t,p,t.value),e=L(e,-t.$size,c,s),t=A(t,e,n,s));else{var y=!0;!p&&d||(y=M(r)<M(t)==0,(p||f)&&T(u)&&(y=!u(t,r,o.slice(0,o.index)))),y&&(r=P(r,f,f?r.value:r),l=S(t)-S(r),t=R(t,r,e,n,c),e=L(e,l,c,s),t=A(t,e,n,s))}E(t)?j(t,a,c):O(c,t)}else null==t&&(t=A(r,e,n));return t}},{100:100,107:107,110:110,115:115,117:117,119:119,120:120,36:36,39:39,50:50,86:86,88:88,89:89,93:93,95:95,96:96}],104:[function(e,t,r){var y=e(120),_=e(119),b=e(90),x=e(88),w=e(89),S=e(95),M=e(102),C=e(96),E=e(117),T=e(86),O=e(93),P=e(110),A=e(115),j=e(114),R=e(107);t.exports=function(e,t,r,n,i,o,s,a,c,u,h,l,p){var f=b(t,o);if(i||o)f&&S(t)&&(f="expired",T(t,u,h)),(f&&f!==y||M(t))&&(t=P(t,{},e,r,h),t=O(t,e,r,c),t=j(t,c));else{var d=n,m=b(d),v=w(d)<w(t)==0;if((f||m)&&C(l)&&(v=!l(t,d,a.slice(0,a.index))),v){m===_&&C(p)&&(d=p(R(s,r),d)),d=E(d,m,m?d.value:d);var g=x(t)-x(d);t=P(t,d,e,r,h),e=A(e,g,h,c),t=O(t,e,r,c)}}return t}},{102:102,107:107,110:110,114:114,115:115,117:117,119:119,120:120,86:86,88:88,89:89,90:90,93:93,95:95,96:96}],105:[function(e,t,r){t.exports=function(){}},{}],106:[function(e,t,r){t.exports=Date.now},{}],107:[function(e,t,r){t.exports=function(e,t){var r=e.slice(0,e.depth);return r[r.length]=t,r}},{}],108:[function(e,t,r){var o=e(120),s=e(39),a=e(51),c=e(100),u=e(112),h=e(113);t.exports=function(e,t,r,n){if(c(e)){var i=e.$type;return Boolean(i)&&(i===o&&h(e),a(n,e)),u(e),t[r]=e[s]=void 0,!0}return!1}},{100:100,112:112,113:113,120:120,39:39,51:51}],109:[function(e,t,r){var s=e(91),a=e(40),c=e(108);t.exports=function e(t,r,n,i){if(c(t,r,n,i)){if(null==t.$type)for(var o in t)o[0]!==a&&"$"!==o[0]&&s(t,o)&&e(t[o],t,o,i);return!0}return!1}},{108:108,40:40,91:91}],110:[function(e,t,r){var o=e(100),s=e(111),a=e(109);t.exports=function(e,t,r,n,i){return e===t?e:(o(e)&&(s(e,t),a(e,r,n,i)),r[n]=t)}},{100:100,109:109,111:111}],111:[function(e,t,r){var s=e(43),a=e(33),c=e(44);t.exports=function(e,t){for(var r=e[c]||0,n=t[c]||0,i=-1;++i<r;){var o=e[s+i];void 0!==o&&((o[a]=t)[s+(n+i)]=o,e[s+i]=void 0)}return t[c]=r+n,e[c]=void 0,t}},{33:33,43:43,44:44}],112:[function(e,t,r){var i=e(43),o=e(33),s=e(42),a=e(44);t.exports=function(e){for(var t=-1,r=e[a]||0;++t<r;){var n=e[i+t];null!=n&&(n[o]=n[s]=e[i+t]=void 0)}return e[a]=void 0,e}},{33:33,42:42,43:43,44:44}],113:[function(e,t,r){var i=e(43),o=e(33),s=e(42),a=e(44);t.exports=function(e){var t=e[o];if(t){for(var r=(e[s]||0)-1,n=(t[a]||0)-1;++r<=n;)t[i+r]=t[i+(r+1)];t[a]=n,e[s]=e[o]=t=void 0}return e}},{33:33,42:42,43:43,44:44}],114:[function(e,t,r){var a=e(43),c=e(39),u=e(46),h=e(44);t.exports=function(e,t){var r=[e],n=0;do{var i=r[n--];if(i&&i[u]!==t){i[u]=t,r[n++]=i[c];for(var o=-1,s=i[h]||0;++o<s;)r[n++]=i[a+o]}}while(-1<n);return e}},{39:39,43:43,44:44,46:46}],115:[function(e,t,r){var s=e(36),a=e(46),c=e(39),u=e(108),h=e(114);t.exports=function(e,t,r,n){var i=e;do{var o=i[c];(i.$size=(i.$size||0)-t)<=0&&null!=o?u(i,o,i[s],r):i[a]!==n&&h(i,n),i=o}while(i);return e}},{108:108,114:114,36:36,39:39,46:46}],116:[function(e,t,r){var a=Array.isArray,c=e(101),u=e(99),h=e(98),l=e(134);t.exports=function(e,t,r){for(var n=0,i=e.length;n<i;++n){var o=e[n],s=!1;if(a(o)&&t.path?s=!0:"string"==typeof o&&t.pathSyntax?s=!0:c(o)&&t.pathValue?(o.path=l.fromPath(o.path),s=!0):u(o)&&t.jsonGraph?s=!0:h(o)&&t.json?s=!0:"function"==typeof o&&n+1===i&&t.selector&&(s=!0),!s)return new Error("Unrecognized argument "+typeof o+" ["+String(o)+"] to Model#"+r)}return!0}},{101:101,134:134,98:98,99:99}],117:[function(e,t,r){var a=e(130).atom,c=e(106),u=e(122),h=e(37),l=e(85),p=Array.isArray,f=e(88),d=e(87);t.exports=function(e,t,r){var n=0,i=e,o=t;if(o?(i=l(i),n=f(i),i.$type=o):(o=(i=a(r)).$type,i[h]=!0),null==r)n=51;else if(null==n||n<=0)switch(typeof r){case"object":n=p(r)?50+r.length:51;break;case"string":n=50+r.length;break;default:n=51}var s=d(i);return"number"==typeof s&&s<u&&(i.$expires=c()+-1*s),i.$size=n,i}},{106:106,122:122,130:130,37:37,85:85,87:87,88:88}],118:[function(e,t,r){t.exports="atom"},{}],119:[function(e,t,r){t.exports="error"},{}],120:[function(e,t,r){t.exports="ref"},{}],121:[function(e,t,r){t.exports=1},{}],122:[function(e,t,r){t.exports=0},{}],123:[function(e,t,r){"use strict";function n(e){var t;(t=s.length?s.pop():new i).task=e,o(t)}function i(){this.task=null}var o=e(124),s=[],a=[],c=o.makeRequestCallFromTimer(function(){if(a.length)throw a.shift()});t.exports=n,i.prototype.call=function(){try{this.task.call()}catch(e){n.onerror?n.onerror(e):(a.push(e),c())}finally{this.task=null,s[s.length]=this}}},{124:124}],124:[function(e,l,t){(function(e){"use strict";function t(e){c.length||(i(),!0),c[c.length]=e}function r(){for(;u<c.length;){var e=u;if(u+=1,c[e].call(),1024<u){for(var t=0,r=c.length-u;t<r;t++)c[t]=c[t+u];c.length-=u,u=0}}c.length=0,u=0,!1}function n(n){return function(){function e(){clearTimeout(t),clearInterval(r),n()}var t=setTimeout(e,0),r=setInterval(e,50)}}l.exports=t;var i,o,s,a,c=[],u=0,h=e.MutationObserver||e.WebKitMutationObserver;i="function"==typeof h?(o=1,s=new h(r),a=document.createTextNode(""),s.observe(a,{characterData:!0}),function(){o=-o,a.data=o}):n(r),t.requestFlush=i,t.makeRequestCallFromTimer=n}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(e,t,r){"use strict";function s(e,t){var r;for(r in t)e[r]=t[r];return e}function n(e,t){(this._jsongUrl=e,"number"==typeof t)&&(t={timeout:t});this._config=s({timeout:15e3,headers:{}},t||{})}var a=e(129),i=e(126);Array.isArray,n.prototype={constructor:n,buildQueryObject:i,get:function(e){var t=s(this.buildQueryObject(this._jsongUrl,"GET",{paths:e,method:"get"}),this._config);return a("GET",t,this)},set:function(e){var t=s(this.buildQueryObject(this._jsongUrl,"POST",{jsonGraph:e,method:"set"}),this._config);t.headers["Content-Type"]="application/x-www-form-urlencoded";return a("POST",t,this)},call:function(e,t,r,n){t=t||[],r=r||[],n=n||[];var i=[];i.push("method=call"),i.push("callPath="+encodeURIComponent(JSON.stringify(e))),i.push("arguments="+encodeURIComponent(JSON.stringify(t))),i.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),i.push("paths="+encodeURIComponent(JSON.stringify(n)));var o=s(this.buildQueryObject(this._jsongUrl,"POST",i.join("&")),this._config);o.headers["Content-Type"]="application/x-www-form-urlencoded";return a("POST",o,this)}},(n.XMLHttpSource=n).default=n,t.exports=n},{126:126,129:129}],126:[function(e,t,r){"use strict";t.exports=function(e,t,r){var n=[],i={url:e},o=-1!==e.indexOf("?")?"&":"?";return"string"==typeof r?n.push(r):Object.keys(r).forEach(function(e){var t="object"==typeof r[e]?JSON.stringify(r[e]):r[e];n.push(e+"="+encodeURIComponent(t))}),"GET"===t?i.url+=o+n.join("&"):i.data=n.join("&"),i}},{}],127:[function(e,r,t){(function(t){"use strict";r.exports=function(){var e=new t.XMLHttpRequest;if("withCredentials"in e)return e;if(t.XDomainRequest)return new XDomainRequest;throw new Error("CORS is not supported by your browser")}}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],128:[function(e,t,r){(function(n){"use strict";t.exports=function(){var e,t,r;if(n.XMLHttpRequest)return new n.XMLHttpRequest;try{for(t=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=0;r<3;r++)try{if(e=t[r],new n.ActiveXObject(e))break}catch(e){}return new n.ActiveXObject(e)}catch(e){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(e,t,r){"use strict";function n(){}function h(e,t,r){r||(r=new Error(t)),e.onError(r)}var l=e(128),p=e(127),f=Object.prototype.hasOwnProperty,o=function(){};n.create=function(i){var e=new n;return e.subscribe=function(e,t,r){var n;return"function"==typeof(n=i("function"==typeof e?{onNext:e,onError:t||o,onCompleted:r||o}:e))?{dispose:n}:n},e},t.exports=function(a,c,u){return n.create(function(t){var r,n,e,i,o,s={method:a||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(o in c)f.call(c,o)&&(s[o]=c[o]);s.crossDomain||s.headers["X-Requested-With"]||(s.headers["X-Requested-With"]="XMLHttpRequest"),null!=u.onBeforeRequest&&u.onBeforeRequest(s);try{r=s.crossDomain?p():l()}catch(e){t.onError(e)}try{for(i in s.user?r.open(s.method,s.url,s.async,s.user,s.password):r.open(s.method,s.url,s.async),r.timeout=s.timeout,r.withCredentials=!1!==s.withCredentials,e=s.headers)f.call(e,i)&&r.setRequestHeader(i,e[i]);if(s.responseType)try{r.responseType=s.responseType}catch(e){if("json"!==s.responseType)throw e}r.onreadystatechange=function(e){4===r.readyState&&(n||(n=!0,function(e,t,r){var n,i;if(t&&e){i=t.responseType,n="response"in t?t.response:t.responseText;var o=1223===t.status?204:t.status;if(200<=o&&o<=399){try{"json"!==i&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){h(e,"invalid json",r)}return e.onNext(n),e.onCompleted()}h(e,401===o||403===o||407===o?n:410===o?n:408===o||504===o?n:n||"Response code "+o)}}(t,r)))},r.ontimeout=function(e){n||(n=!0,r,h(t,"timeout error",e))},r.send(s.data)}catch(e){t.onError(e)}return function(){n||4===r.readyState||(n=!0,r.abort())}})}},{127:127,128:128}],130:[function(e,t,r){function n(e,t,r){var n=Object.create(null);if(null==r)return{$type:e,value:t};for(var i in r)n[i]=r[i];return n.$type=e,n.value=t,n}var i=e(134);t.exports={ref:function(e,t){return n("ref",i.fromPath(e),t)},atom:function(e,t){return n("atom",e,t)},undefined:function(){return n("atom")},error:function(e,t){return n("error",e,t)},pathValue:function(e,t){return{path:i.fromPath(e),value:t}},pathInvalidation:function(e){return{path:i.fromPath(e),invalidated:!0}}}},{134:134}],131:[function(e,t,r){t.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],132:[function(e,t,r){t.exports={token:"token",dotSeparator:".",commaSeparator:",",openingBracket:"[",closingBracket:"]",openingBrace:"{",closingBrace:"}",escape:"\\",space:" ",colon:":",quote:"quote",unknown:"unknown"}},{}],133:[function(e,t,r){t.exports={indexer:{nested:"Indexers cannot be nested.",needQuotes:"unquoted indexers must be numeric.",empty:"cannot have empty indexers.",leadingDot:"Indexers cannot have leading dots.",leadingComma:"Indexers cannot have leading comma.",requiresComma:"Indexers require commas between indexer args.",routedTokens:"Only one token can be used per indexer when specifying routed tokens."},range:{precedingNaN:"ranges must be preceded by numbers.",suceedingNaN:"ranges must be suceeded by numbers."},routed:{invalid:"Invalid routed token.  only integers|ranges|keys are supported."},quote:{empty:"cannot have empty quoted keys.",illegalEscape:"Invalid escape character.  Only quotes are escapable."},unexpectedToken:"Unexpected token.",invalidIdentifier:"Invalid Identifier.",invalidPath:"Please provide a valid path.",throwError:function(e,t,r){if(r)throw e+" -- "+t.parseString+" with next token: "+r;throw e+" -- "+t.parseString}}},{}],134:[function(e,t,r){var n=e(140),i=e(135),o=e(131),s=function(e,t){return i(new n(e,t))};(t.exports=s).fromPathsOrPathValues=function(e,t){if(!e)return[];for(var r=[],n=0,i=e.length;n<i;n++)"string"==typeof e[n]?r[n]=s(e[n],t):"string"==typeof e[n].path?r[n]={path:s(e[n].path,t),value:e[n].value}:r[n]=e[n];return r},s.fromPath=function(e,t){return e?"string"==typeof e?s(e,t):e:[]},s.RoutedTokens=o},{131:131,135:135,140:140}],135:[function(e,t,r){var o=e(132),s=e(133),a=e(136);t.exports=function(e){for(var t=e.next(),r={},n=[];!t.done;){switch(t.type){case o.token:var i=+t.token[0];isNaN(i)||s.throwError(s.invalidIdentifier,e),n[n.length]=t.token;break;case o.dotSeparator:0===n.length&&s.throwError(s.unexpectedToken,e);break;case o.space:break;case o.openingBracket:a(e,t,r,n);break;default:s.throwError(s.unexpectedToken,e)}t=e.next()}return 0===n.length&&s.throwError(s.invalidPath,e),n}},{132:132,133:133,136:136}],136:[function(e,t,r){var u=e(132),h=e(133),l=h.indexer,p=e(138),f=e(137),d=e(139);t.exports=function(e,t,r,n){var i=e.next(),o=!1,s=1,a=!1;for(r.indexer=[];!i.done;){switch(i.type){case u.token:case u.quote:r.indexer.length===s&&h.throwError(l.requiresComma,e)}switch(i.type){case u.openingBrace:a=!0,d(e,i,r,n);break;case u.token:var c=+i.token;isNaN(c)&&h.throwError(l.needQuotes,e),r.indexer[r.indexer.length]=c;break;case u.dotSeparator:r.indexer.length||h.throwError(l.leadingDot,e),p(e,i,r,n);break;case u.space:break;case u.closingBracket:o=!0;break;case u.quote:f(e,i,r,n);break;case u.openingBracket:h.throwError(l.nested,e);break;case u.commaSeparator:++s;break;default:h.throwError(h.unexpectedToken,e)}if(o)break;i=e.next()}0===r.indexer.length&&h.throwError(l.empty,e),1<r.indexer.length&&a&&h.throwError(l.routedTokens,e),1===r.indexer.length&&(r.indexer=r.indexer[0]),n[n.length]=r.indexer,r.indexer=void 0}},{132:132,133:133,137:137,138:138,139:139}],137:[function(e,t,r){var u=e(132),h=e(133),l=h.quote;t.exports=function(e,t,r,n){for(var i=e.next(),o="",s=t.token,a=!1,c=!1;!i.done;){switch(i.type){case u.token:case u.space:case u.dotSeparator:case u.commaSeparator:case u.openingBracket:case u.closingBracket:case u.openingBrace:case u.closingBrace:a&&h.throwError(l.illegalEscape,e),o+=i.token;break;case u.quote:a?(o+=i.token,a=!1):i.token!==s?o+=i.token:c=!0;break;case u.escape:a=!0;break;default:h.throwError(h.unexpectedToken,e)}if(c)break;i=e.next()}0===o.length&&h.throwError(l.empty,e),r.indexer[r.indexer.length]=o}},{132:132,133:133}],138:[function(e,t,r){var l=e(140),p=e(132),f=e(133);t.exports=function(e,t,r,n){var i,o=e.peek(),s=1,a=!1,c=!0,u=r.indexer.length-1,h=l.toNumber(r.indexer[u]);for(isNaN(h)&&f.throwError(f.range.precedingNaN,e);!a&&!o.done;){switch(o.type){case p.dotSeparator:3===s&&f.throwError(f.unexpectedToken,e),3===++s&&(c=!1);break;case p.token:i=l.toNumber(e.next().token),isNaN(i)&&f.throwError(f.range.suceedingNaN,e),a=!0;break;default:a=!0}if(a)break;e.next(),o=e.peek()}r.indexer[u]={from:h,to:c?i:i-1}}},{132:132,133:133,140:140}],139:[function(e,t,r){var u=e(132),h=e(131),l=e(133),p=l.routed;t.exports=function(e,t,r,n){var i=e.next(),o=!1,s="";switch(i.token){case h.integers:case h.ranges:case h.keys:break;default:l.throwError(p.invalid,e)}var a=e.next();if(a.type===u.colon&&(o=!0,(a=e.next()).type!==u.token&&l.throwError(p.invalid,e),s=a.token,a=e.next()),a.type===u.closingBrace){var c={type:i.token,named:o,name:s};r.indexer[r.indexer.length]=c}else l.throwError(p.invalid,e)}},{131:131,132:132,133:133}],140:[function(e,t,r){function u(e,t,r){return{token:e,done:r,type:t}}function n(e,t,r){var n,i=!1,o="",s=r?"\\{}'\"[]., :":"\\'\"[]., ";do{if(n=t+1>=e.length)break;var a=e[t+1];if(void 0===a||-1!==s.indexOf(a)){if(o.length)break;var c;switch(++t,a){case".":c=h.dotSeparator;break;case",":c=h.commaSeparator;break;case"[":c=h.openingBracket;break;case"]":c=h.closingBracket;break;case"{":c=h.openingBrace;break;case"}":c=h.closingBrace;break;case" ":c=h.space;break;case'"':case"'":c=h.quote;break;case"\\":c=h.escape;break;case":":c=h.colon;break;default:c=h.unknown}i=u(a,c,!1);break}o+=a,++t}while(!n);return!i&&o.length&&(i=u(o,h.token,!1)),i||(i={done:!0}),{token:i,idx:t}}var h=e(132),i=t.exports=function(e,t){this._string=e,this._idx=-1,this._extended=t,this.parseString=""};i.prototype={next:function(){var e=this._nextToken?this._nextToken:n(this._string,this._idx,this._extended);return this._idx=e.idx,this._nextToken=!1,this.parseString+=e.token.token,e.token},peek:function(){var e=this._nextToken?this._nextToken:n(this._string,this._idx,this._extended);return(this._nextToken=e).token}},i.toNumber=function(e){return isNaN(+e)?NaN:+e}},{132:132}],141:[function(e,t,r){var n=e(147),i=e(148);t.exports=function(e){var t=e.reduce(function(e,t){var r=t.length;return e[r]||(e[r]=[]),e[r].push(t),e},{});return Object.keys(t).forEach(function(e){t[e]=i(t[e])}),n(t)}},{147:147,148:148}],142:[function(e,t,r){var l=e(144);t.exports=function e(t,r,n){for(var i=t,o=!0;o&&n<r.length;++n){var s=r[n];if(s&&"object"===typeof s){var a={},c=l(s,a),u=n+1;do{var h=i[c];(o=void 0!==h)&&(o=e(h,r,u)),c=l(s,a)}while(o&&!a.done);break}o=void 0!==(i=i[s])}return o}},{144:144}],143:[function(e,t,r){t.exports={iterateKeySet:e(144),toTree:e(148),toTreeWithUnion:e(149),pathsComplementFromTree:e(146),pathsComplementFromLengthTree:e(145),hasIntersection:e(142),toPaths:e(147),collapse:e(141)}},{141:141,142:142,144:144,145:145,146:146,147:147,148:148,149:149}],144:[function(e,t,r){function o(e,t){var r=t.from=e.from||0,n=t.to=e.to||"number"==typeof e.length&&t.from+e.length-1||0;t.rangeOffset=t.from,t.loaded=!0,n<r&&(t.empty=!0)}var s=Array.isArray;t.exports=function(e,t){if(void 0===t.isArray&&function(e,t){t.done=!1;var r=t.isObject=!(!e||"object"!=typeof e);t.isArray=r&&s(e),t.arrayOffset=0}(e,t),t.isArray){var r;do{t.loaded&&t.rangeOffset>t.to&&(++t.arrayOffset,t.loaded=!1);var n=t.arrayOffset;if(e.length<=n){t.done=!0;break}var i=e[t.arrayOffset];if("object"===typeof i){if(t.loaded||o(i,t),t.empty)continue;r=t.rangeOffset++}else++t.arrayOffset,r=i}while(void 0===r);return r}return t.isObject?(t.loaded||o(e,t),t.rangeOffset>t.to?void(t.done=!0):t.rangeOffset++):(t.done=!0,e)}},{}],145:[function(e,t,r){var a=e(142);t.exports=function(e,t){for(var r=[],n=-1,i=0,o=e.length;i<o;++i){var s=e[i];a(t[s.length],s,0)||(r[++n]=s)}return r}},{142:142}],146:[function(e,t,r){var s=e(142);t.exports=function(e,t){for(var r=[],n=-1,i=0,o=e.length;i<o;++i)s(t,e[i],0)||(r[++n]=e[i]);return r}},{142:142}],147:[function(e,t,r){function M(e,t,r){var n,i,o,s,a,c,u,h,l,p,f,d,m,v,g=E(String(t)),y=Object.create(null),_=[],b=-1,x=0,w=[],S=0;if(s=[],a=-1,t<r-1){for(c=C(e,s);++a<c;)i=y[o=(i=M(e[n=s[a]],t+1,r)).code]?y[o]:y[_[x++]=o]={keys:[],sets:i.sets},g=E(g+n+o),T(n)&&i.keys.push(parseInt(n,10))||i.keys.push(n);for(;++b<x;)if(0<(c=(s=(i=y[n=_[b]]).keys).length))for(h=-1,l=(u=i.sets).length,m=s[0];++h<l;){for(f=-1,d=(p=u[h]).length,(v=new Array(d+1))[0]=1<c&&s||m;++f<d;)v[f+1]=p[f];w[S++]=v}}else for(c=C(e,s),w[S++]=1<c?[s]:s;++a<c;)g=E(g+s[a]);return{code:g,sets:w}}function u(e){for(var t=-1,r=e.length;++t<r;){var n=e[t];o(n)&&(e[t]=i(n))}return e}function i(e){for(var t=-1,r=e.length-1,n=0<r;++t<=r;){var i=e[t];if(!T(i)){n=!1;break}e[t]=parseInt(i,10)}if(!0===n){e.sort(a);var o=e[0],s=e[r];if(s-o<=r)return{from:o,to:s}}return e}function a(e,t){return e-t}function C(e,t,r){var n=0;for(var i in e)t[n++]=i;return 1<n&&t.sort(r),n}function E(e){for(var t=5381,r=-1,n=e.length;++r<n;)t=(t<<5)+t+e.charCodeAt(r);return String(t)}function T(e){return!o(e)&&0<=e-parseFloat(e)+1}var o=Array.isArray,h="object";t.exports=function(e){var t,r,n=[],i=0;for(var o in e)if(T(o)&&(null!==(r=t=e[o])&&typeof r===h))for(var s=M(t,0,parseInt(o,10)).sets,a=-1,c=s.length;++a<c;)n[i++]=u(s[a]);return n}},{}],148:[function(e,t,r){var u=e(144);Array.isArray,t.exports=function(e){return e.reduce(function(e,t){return function e(t,r,n){var i,o=r[n],s={},a=n+1;i=u(o,s);do{var c=t[i];c||(a===r.length?t[i]=null:c=t[i]={}),a<r.length&&e(c,r,a),s.done||(i=u(o,s))}while(!s.done)}(e,t,0),e},{})}},{144:144}],149:[function(e,t,r){},{}],150:[function(e,t,r){function n(){h=!1,a.length?u=a.concat(u):l=-1,u.length&&i()}function i(){if(!h){var e=setTimeout(n);h=!0;for(var t=u.length;t;){for(a=u,u=[];++l<t;)a&&a[l].run();l=-1,t=u.length}a=null,h=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function s(){}var a,c=t.exports={},u=[],h=!1,l=-1;c.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new o(e,t)),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(e){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(e){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],151:[function(e,t,r){"use strict";t.exports=e(156)},{156:156}],152:[function(e,t,r){"use strict";function s(){}function a(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._37=0,this._12=null,this._59=[],e!==s&&h(e,this)}function c(r,n){for(;3===r._37;)r=r._12;return 0===r._37?void r._59.push(n):void l(function(){var e=1===r._37?n.onFulfilled:n.onRejected;if(null!==e){var t=function(e,t){try{return e(t)}catch(e){return p=e,f}}(e,r._12);t===f?o(n.promise,p):i(n.promise,t)}else 1===r._37?i(n.promise,r._12):o(n.promise,r._12)})}function i(e,t){if(t===e)return o(e,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var r=function(e){try{return e.then}catch(e){return p=e,f}}(t);if(r===f)return o(e,p);if(r===e.then&&t instanceof a)return e._37=3,e._12=t,void n(e);if("function"==typeof r)return void h(r.bind(t),e)}e._37=1,e._12=t,n(e)}function o(e,t){e._37=2,e._12=t,n(e)}function n(e){for(var t=0;t<e._59.length;t++)c(e,e._59[t]);e._59=null}function u(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function h(e,t){var r=!1,n=function(e,t,r){try{e(t,r)}catch(e){return p=e,f}}(e,function(e){r||(r=!0,i(t,e))},function(e){r||(r=!0,o(t,e))});r||n!==f||(r=!0,o(t,p))}var l=e(124),p=null,f={};(t.exports=a)._99=s,a.prototype.then=function(e,t){if(this.constructor!==a)return i=e,o=t,new(n=this).constructor(function(e,t){var r=new a(s);r.then(e,t),c(n,new u(i,o,r))});var n,i,o,r=new a(s);return c(this,new u(e,t,r)),r}},{124:124}],153:[function(e,t,r){"use strict";var n=e(152);(t.exports=n).prototype.done=function(e,t){(arguments.length?this.then.apply(this,arguments):this).then(null,function(e){setTimeout(function(){throw e},0)})}},{152:152}],154:[function(e,t,r){"use strict";function n(e){var t=new c(c._99);return t._37=1,t._12=e,t}var c=e(152);t.exports=c;var i=n(!0),o=n(!1),s=n(null),a=n(void 0),u=n(0),h=n("");c.resolve=function(e){if(e instanceof c)return e;if(null===e)return s;if(void 0===e)return a;if(!0===e)return i;if(!1===e)return o;if(0===e)return u;if(""===e)return h;if("object"==typeof e||"function"==typeof e)try{var t=e.then;if("function"==typeof t)return new c(t.bind(e))}catch(r){return new c(function(e,t){t(r)})}return n(e)},c.all=function(e){var a=Array.prototype.slice.call(e);return new c(function(n,i){function o(t,e){if(e&&("object"==typeof e||"function"==typeof e)){if(e instanceof c&&e.then===c.prototype.then){for(;3===e._37;)e=e._12;return 1===e._37?o(t,e._12):(2===e._37&&i(e._12),void e.then(function(e){o(t,e)},i))}var r=e.then;if("function"==typeof r)return void new c(r.bind(e)).then(function(e){o(t,e)},i)}a[t]=e,0==--s&&n(a)}if(0===a.length)return n([]);for(var s=a.length,e=0;e<a.length;e++)o(e,a[e])})},c.reject=function(r){return new c(function(e,t){t(r)})},c.race=function(e){return new c(function(t,r){e.forEach(function(e){c.resolve(e).then(t,r)})})},c.prototype.catch=function(e){return this.then(null,e)}},{152:152}],155:[function(e,t,r){"use strict";var n=e(152);(t.exports=n).prototype.finally=function(t){return this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})}},{152:152}],156:[function(e,t,r){"use strict";t.exports=e(152),e(153),e(155),e(154),e(157)},{152:152,153:153,154:154,155:155,157:157}],157:[function(e,t,r){"use strict";var s=e(152),i=e(123);(t.exports=s).denodeify=function(o,e){return e=e||1/0,function(){var t=this,i=Array.prototype.slice.call(arguments,0,0<e?e:0);return new s(function(r,n){i.push(function(e,t){e?n(e):r(t)});var e=o.apply(t,i);!e||"object"!=typeof e&&"function"!=typeof e||"function"!=typeof e.then||r(e)})}},s.nodeify=function(r){return function(){var e=Array.prototype.slice.call(arguments),t="function"==typeof e[e.length-1]?e.pop():null,n=this;try{return r.apply(this,arguments).nodeify(t,n)}catch(r){if(null==t)return new s(function(e,t){t(r)});i(function(){t.call(n,r)})}}},s.prototype.nodeify=function(t,r){return"function"!=typeof t?this:void this.then(function(e){i(function(){t.call(r,null,e)})},function(e){i(function(){t.call(r,e)})})}},{123:123,152:152}],158:[function(a,c,u){(function(s){(function(e){var t={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},r=t[typeof window]&&window||this,n=t[typeof u]&&u&&!u.nodeType&&u,i=t[typeof c]&&c&&!c.nodeType&&c,o=(i&&i.exports,t[typeof s]&&s);!o||o.global!==o&&o.window!==o||(r=o),"object"==typeof c&&c&&c.exports===n?c.exports=e(r,c.exports,a(159)):r.Rx=e(r,{},r.Rx)}).call(this,function(a,e,t,c){function r(){try{return f.apply(this,arguments)}catch(e){return I.e=e,I}}function n(e){if(!M(e))throw new TypeError("fn must be a function");return f=e,r}function i(e,a,c){return new g(function(n){var i=!1,o=null,s=[];return e.subscribe(function(e){var t,r;try{r=a(e)}catch(e){return void n.onError(e)}if(t=0,i)try{t=c(r,o)}catch(e){return void n.onError(e)}else i=!0,o=r;0<t&&(o=r,s=[]),0<=t&&s.push(e)},function(e){n.onError(e)},function(){n.onNext(s),n.onCompleted()})},e)}function o(e){if(0===e.length)throw new R;return e[0]}function s(e,n,i,o){if(n<0)throw new N;return new g(function(t){var r=n;return e.subscribe(function(e){0==r--&&(t.onNext(e),t.onCompleted())},function(e){t.onError(e)},function(){i?(t.onNext(o),t.onCompleted()):t.onError(new N)})},e)}function u(e,i,o){return new g(function(t){var r=o,n=!1;return e.subscribe(function(e){n?t.onError(new Error("Sequence contains more than one element")):(r=e,n=!0)},function(e){t.onError(e)},function(){n||i?(t.onNext(r),t.onCompleted()):t.onError(new R)})},e)}function h(e,r,n){return new g(function(t){return e.subscribe(function(e){t.onNext(e),t.onCompleted()},function(e){t.onError(e)},function(){r?(t.onNext(n),t.onCompleted()):t.onError(new R)})},e)}function l(e,i,o){return new g(function(t){var r=o,n=!1;return e.subscribe(function(e){r=e,n=!0},function(e){t.onError(e)},function(){n||i?(t.onNext(r),t.onCompleted()):t.onError(new R)})},e)}function p(i,e,t,o){var s=j(e,t,3);return new g(function(r){var n=0;return i.subscribe(function(e){var t;try{t=s(e,n,i)}catch(e){return void r.onError(e)}t?(r.onNext(o?n:e),r.onCompleted()):n++},function(e){r.onError(e)},function(){r.onNext(o?-1:c),r.onCompleted()})},i)}var f,d=t.Observable,m=d.prototype,v=t.CompositeDisposable,g=t.AnonymousObservable,y=t.Disposable.empty,_=(t.internals.isEqual,t.helpers),b=_.not,x=_.defaultComparer,w=_.identity,S=_.defaultSubComparer,M=_.isFunction,C=_.isPromise,E=_.isArrayLike,T=_.isIterable,O=t.internals.inherits,P=d.fromPromise,A=d.from,j=t.internals.bindCallback,R=t.EmptyError,L=t.ObservableBase,N=t.ArgumentOutOfRangeError,I={e:{}};m.aggregate=function(){var o,s,a=!1,e=this;return o=2===arguments.length?(a=!0,s=arguments[0],arguments[1]):arguments[0],new g(function(t){var r,n,i;return e.subscribe(function(e){!i&&(i=!0);try{r?n=o(n,e):(n=a?o(s,e):e,r=!0)}catch(e){return t.onError(e)}},function(e){t.onError(e)},function(){i&&t.onNext(n),!i&&a&&t.onNext(s),!i&&!a&&t.onError(new R),t.onCompleted()})},e)};var D=function(i){function e(e,t,r,n){this.source=e,this.acc=t,this.hasSeed=r,this.seed=n,i.call(this)}function t(e,t){this.o=e,this.acc=t.acc,this.hasSeed=t.hasSeed,this.seed=t.seed,this.hasAccumulation=!1,this.result=null,this.hasValue=!1,this.isStopped=!1}return O(e,i),e.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this))},t.prototype.onNext=function(e){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=n(this.acc)(this.result,e):(this.result=this.hasSeed?n(this.acc)(this.seed,e):e,this.hasAccumulation=!0),this.result===I&&this.o.onError(this.result.e))},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new R),this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},e}(L);return m.reduce=function(e){var t=!1;if(2===arguments.length){t=!0;var r=arguments[1]}return new D(this,e,t,r)},m.some=function(e,t){var r=this;return e?r.filter(e,t).some():new g(function(t){return r.subscribe(function(){t.onNext(!0),t.onCompleted()},function(e){t.onError(e)},function(){t.onNext(!1),t.onCompleted()})},r)},m.any=function(){return this.some.apply(this,arguments)},m.isEmpty=function(){return this.any().map(b)},m.every=function(t,e){return this.filter(function(e){return!t(e)},e).some().map(b)},m.all=function(){return this.every.apply(this,arguments)},m.includes=function(s,e){var t=this;return new g(function(n){var i=0,o=+e||0;return Math.abs(o)===1/0&&(o=0),o<0?(n.onNext(!1),n.onCompleted(),y):t.subscribe(function(e){var t,r;i++>=o&&(r=s,0===(t=e)&&0===r||t===r||isNaN(t)&&isNaN(r))&&(n.onNext(!0),n.onCompleted())},function(e){n.onError(e)},function(){n.onNext(!1),n.onCompleted()})},this)},m.contains=function(e,t){m.includes(e,t)},m.count=function(e,t){return e?this.filter(e,t).count():this.reduce(function(e){return e+1},0)},m.indexOf=function(i,e){var o=this;return new g(function(t){var r=0,n=+e||0;return Math.abs(n)===1/0&&(n=0),n<0?(t.onNext(-1),t.onCompleted(),y):o.subscribe(function(e){n<=r&&e===i&&(t.onNext(r),t.onCompleted()),r++},function(e){t.onError(e)},function(){t.onNext(-1),t.onCompleted()})},o)},m.sum=function(e,t){return e&&M(e)?this.map(e,t).sum():this.reduce(function(e,t){return e+t},0)},m.minBy=function(e,r){return r||(r=S),i(this,e,function(e,t){return-1*r(e,t)})},m.min=function(e){return this.minBy(w,e).map(function(e){return o(e)})},m.maxBy=function(e,t){return t||(t=S),i(this,e,t)},m.max=function(e){return this.maxBy(w,e).map(function(e){return o(e)})},m.average=function(e,t){return e&&M(e)?this.map(e,t).average():this.reduce(function(e,t){return{sum:e.sum+t,count:e.count+1}},{sum:0,count:0}).map(function(e){if(0===e.count)throw new R;return e.sum/e.count})},m.sequenceEqual=function(r,c){var u=this;return c||(c=x),new g(function(n){var i=!1,o=!1,s=[],a=[],e=u.subscribe(function(e){var t,r;if(0<a.length){r=a.shift();try{t=c(r,e)}catch(e){return void n.onError(e)}t||(n.onNext(!1),n.onCompleted())}else o?(n.onNext(!1),n.onCompleted()):s.push(e)},function(e){n.onError(e)},function(){i=!0,0===s.length&&(0<a.length?(n.onNext(!1),n.onCompleted()):o&&(n.onNext(!0),n.onCompleted()))});(E(r)||T(r))&&(r=A(r)),C(r)&&(r=P(r));var t=r.subscribe(function(e){var t;if(0<s.length){var r=s.shift();try{t=c(r,e)}catch(e){return void n.onError(e)}t||(n.onNext(!1),n.onCompleted())}else i?(n.onNext(!1),n.onCompleted()):a.push(e)},function(e){n.onError(e)},function(){o=!0,0===a.length&&(0<s.length?(n.onNext(!1),n.onCompleted()):i&&(n.onNext(!0),n.onCompleted()))});return new v(e,t)},u)},m.elementAt=function(e){return s(this,e,!1)},m.elementAtOrDefault=function(e,t){return s(this,e,!0,t)},m.single=function(e,t){return e&&M(e)?this.where(e,t).single():u(this,!1)},m.singleOrDefault=function(e,t,r){return e&&M(e)?this.filter(e,r).singleOrDefault(null,t):u(this,!0,t)},m.first=function(e,t){return e?this.where(e,t).first():h(this,!1)},m.firstOrDefault=function(e,t,r){return e?this.where(e).firstOrDefault(null,t):h(this,!0,t)},m.last=function(e,t){return e?this.where(e,t).last():l(this,!1)},m.lastOrDefault=function(e,t,r){return e?this.where(e,r).lastOrDefault(null,t):l(this,!0,t)},m.find=function(e,t){return p(this,e,t,!1)},m.findIndex=function(e,t){return p(this,e,t,!0)},m.toSet=function(){if(void 0===a.Set)throw new TypeError;var e=this;return new g(function(t){var r=new a.Set;return e.subscribe(function(e){r.add(e)},function(e){t.onError(e)},function(){t.onNext(r),t.onCompleted()})},e)},m.toMap=function(o,s){if(void 0===a.Map)throw new TypeError;var e=this;return new g(function(n){var i=new a.Map;return e.subscribe(function(e){var t;try{t=o(e)}catch(e){return void n.onError(e)}var r=e;if(s)try{r=s(e)}catch(e){return void n.onError(e)}i.set(t,r)},function(e){n.onError(e)},function(){n.onNext(i),n.onCompleted()})},e)},t})}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(e,xr,wr){(function(_r,br){(function(a){function i(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(e[r]);return t}function o(e,t){if(X&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(Z)){for(var r=[],n=t;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(e.stack);var i=r.join("\n"+Z+"\n");e.stack=function(e){for(var t=e.split("\n"),r=[],n=0,i=t.length;n<i;n++){var o=t[n];c(o)||(-1!==(s=o).indexOf("(module.js:")||-1!==s.indexOf("(node.js:"))||!o||r.push(o)}var s;return r.join("\n")}(i)}}function c(e){var t=u(e);if(!t)return!1;var r=t[0],n=t[1];return r===Y&&K<=n&&n<=yr}function e(){if(X)try{throw new Error}catch(e){var t=e.stack.split("\n"),r=u(0<t[0].indexOf("@")?t[1]:t[2]);if(!r)return;return Y=r[0],r[1]}}function u(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var r=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(r)return[r[1],Number(r[2])];var n=/.*@(.+):(\d+)$/.exec(e);return n?[n[1],Number(n[2])]:void 0}function r(e){var t=[];if(!Pe(e))return t;Oe.nonEnumArgs&&e.length&&Ae(e)&&(e=Le.call(e));var r=Oe.enumPrototypes&&"function"==typeof e,n=Oe.enumErrorProps&&(e===Se||e instanceof Error);for(var i in e)r&&"prototype"==i||n&&("message"==i||"name"==i)||t.push(i);if(Oe.nonEnumShadows&&e!==Me){var o=e.constructor,s=-1,a=he;if(e===(o&&o.prototype))var c=e===Ce?_e:e===Se?me:be.call(e),u=Te[c];for(;++s<a;)i=ue[s],u&&u[i]||!xe.call(e,i)||t.push(i)}return t}function v(e,t){return function(e,t,r){for(var n=-1,i=r(e),o=i.length;++n<o;){var s=i[n];if(!1===t(e[s],s,e))break}return e}(e,t,r)}function g(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}function p(e,t){for(var r=new Array(e),n=0;n<e;n++)r[n]=t();return r}function t(){try{return je.apply(this,arguments)}catch(e){return ke.e=e,ke}}function l(e){if(!W(e))throw new TypeError("fn must be a function");return je=e,t}function h(e){throw e}function n(e,t){this.id=e,this.value=t}function f(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function d(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function m(e){this._s=s}function y(e){this._s=s,this._l=s.length,this._i=0}function _(e){this._a=e}function b(e){var t,r,n;this._a=e,this._l=(t=+e.length,isNaN(t)?0:0!==t&&("number"==typeof(n=t)&&L.isFinite(n))?(t=(0===(r=+t)?r:isNaN(r)?r:r<0?-1:1)*Math.floor(Math.abs(t)))<=0?0:Dt<t?Dt:t:t),this._i=0}function x(e,t){this.observer=e,this.parent=t}function w(e,t){return et(e)||(e=it),new Bt(t,e)}function S(e,t){this.observer=e,this.parent=t}function M(e,t){this.observer=e,this.parent=t}function C(){return!1}function C(){return!1}function E(){return[]}function C(){return!1}function T(){return[]}function O(e,t){this.observer=e,this.accumulator=t.accumulator,this.hasSeed=t.hasSeed,this.seed=t.seed,this.hasAccumulation=!1,this.accumulation=null,this.hasValue=!1,this.isStopped=!1}function P(n,e,t){var i=ce(e,t,3);return n.map(function(e,t){var r=i(e,t,n);return q(r)&&(r=At(r)),(ae(r)||se(r))&&(r=kt(r)),r}).concatAll()}function A(e){this.comparer=e,this.set=[]}function j(n,e,t){var i=ce(e,t,3);return n.map(function(e,t){var r=i(e,t,n);return q(r)&&(r=At(r)),(ae(r)||se(r))&&(r=kt(r)),r}).mergeAll()}var R={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},L=R[typeof window]&&window||this,N=R[typeof wr]&&wr&&!wr.nodeType&&wr,I=R[typeof xr]&&xr&&!xr.nodeType&&xr,D=I&&I.exports===N&&N,k=R[typeof br]&&br;!k||k.global!==k&&k.window!==k||(L=k);var B,F={internals:{},config:{Promise:L.Promise},helpers:{}},$=F.helpers.noop=function(){},U=(F.helpers.notDefined=function(e){return void 0===e},F.helpers.identity=function(e){return e}),z=(F.helpers.pluck=function(t){return function(e){return e[t]}},F.helpers.just=function(e){return function(){return e}},F.helpers.defaultNow=Date.now),G=F.helpers.defaultComparer=function(e,t){return Re(e,t)},V=F.helpers.defaultSubComparer=function(e,t){return t<e?1:e<t?-1:0},H=(F.helpers.defaultKeySerializer=function(e){return e.toString()},F.helpers.defaultError=function(e){throw e}),q=F.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},W=(F.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},F.helpers.not=function(e){return!e},F.helpers.isFunction=((B=function(e){return"function"==typeof e||!1})(/x/)&&(B=function(e){return"function"==typeof e&&"[object Function]"==be.call(e)}),B)),X=F.config.longStackSupport=!1;try{throw new Error}catch(e){X=!!e.stack}var Y,K=e(),Z="From previous event:";(F.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)}).prototype=Error.prototype;var J=F.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};J.prototype=Error.prototype;var Q=F.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};Q.prototype=Error.prototype;var ee=F.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};ee.prototype=Error.prototype;var te=F.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};te.prototype=Error.prototype;var re=F.helpers.notImplemented=function(){throw new te},ne=F.helpers.notSupported=function(){throw new ee},ie="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";L.Set&&"function"==typeof(new L.Set)["@@iterator"]&&(ie="@@iterator");var oe=F.doneEnumerator={done:!0,value:a},se=F.helpers.isIterable=function(e){return e[ie]!==a},ae=F.helpers.isArrayLike=function(e){return e&&e.length!==a};F.helpers.iterator=ie;var ce=F.internals.bindCallback=function(n,i,e){if(void 0===i)return n;switch(e){case 0:return function(){return n.call(i)};case 1:return function(e){return n.call(i,e)};case 2:return function(e,t){return n.call(i,e,t)};case 3:return function(e,t,r){return n.call(i,e,t,r)}}return function(){return n.apply(i,arguments)}},ue=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],he=ue.length,le="[object Arguments]",pe="[object Array]",fe="[object Boolean]",de="[object Date]",me="[object Error]",ve="[object Number]",ge="[object Object]",ye="[object RegExp]",_e="[object String]",be=Object.prototype.toString,xe=Object.prototype.hasOwnProperty,we=be.call(arguments)==le,Se=Error.prototype,Me=Object.prototype,Ce=String.prototype,Ee=Me.propertyIsEnumerable;try{!(be.call(document)==ge&&!({toString:0}+""))}catch(e){!0}var Te={};Te[pe]=Te[de]=Te[ve]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Te[fe]=Te[_e]={constructor:!0,toString:!0,valueOf:!0},Te[me]=Te["[object Function]"]=Te[ye]={constructor:!0,toString:!0},Te[ge]={constructor:!0};var Oe={};!function(){var e=function(){this.x=1},t=[];for(var r in e.prototype={valueOf:1,y:1},new e)t.push(r);for(r in arguments);Oe.enumErrorProps=Ee.call(Se,"message")||Ee.call(Se,"name"),Oe.enumPrototypes=Ee.call(e,"prototype"),Oe.nonEnumArgs=0!=r,Oe.nonEnumShadows=!/valueOf/.test(t)}(1);var Pe=F.internals.isObject=function(e){var t=typeof e;return e&&("function"==t||"object"==t)||!1},Ae=function(e){return!(!e||"object"!=typeof e)&&be.call(e)==le};we||(Ae=function(e){return!(!e||"object"!=typeof e)&&xe.call(e,"callee")});var je,Re=F.internals.isEqual=function(e,t){return function n(i,e,o,s){if(i===e)return 0!==i||1/i==1/e;var t=typeof i,r=typeof e;if(i==i&&(null==i||null==e||"function"!=t&&"object"!=t&&"function"!=r&&"object"!=r))return!1;var a=be.call(i),c=be.call(e);if(a==le&&(a=ge),c==le&&(c=ge),a!=c)return!1;switch(a){case fe:case de:return+i==+e;case ve:return i!=+i?e!=+e:0==i?1/i==1/e:i==+e;case ye:case _e:return i==String(e)}var u=a==pe;if(!u){if(a!=ge||!Oe.nodeClass&&(g(i)||g(e)))return!1;var h=!Oe.argsObject&&Ae(i)?Object:i.constructor,l=!Oe.argsObject&&Ae(e)?Object:e.constructor;if(!(h==l||xe.call(i,"constructor")&&xe.call(e,"constructor")||W(h)&&h instanceof h&&W(l)&&l instanceof l)&&"constructor"in i&&"constructor"in e)return!1}o||(o=[]),s||(s=[]);for(var p=o.length;p--;)if(o[p]==i)return s[p]==e;var f=0,d=!0;if(o.push(i),s.push(e),u){if(p=i.length,f=e.length,d=f==p)for(;f--;){var m=e[f];if(!(d=n(i[f],m,o,s)))break}}else v(e,function(e,t,r){return xe.call(r,t)?(f++,d=xe.call(i,t)&&n(i[t],e,o,s)):void 0}),d&&v(i,function(e,t,r){return xe.call(r,t)?d=-1<--f:void 0});return o.pop(),s.pop(),d}(e,t,[],[])},Le=Array.prototype.slice,Ne=this.inherits=F.internals.inherits=function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r},Ie=F.internals.addProperties=function(e){for(var t=[],r=1,n=arguments.length;r<n;r++)t.push(arguments[r]);for(var i=0,o=t.length;i<o;i++){var s=t[i];for(var a in s)e[a]=s[a]}},De=F.internals.addRef=function(t,r){return new fr(function(e){return new $e(r.getDisposable(),t.subscribe(e))})},ke={e:{}};n.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var Be=F.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},Fe=Be.prototype;Fe.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},Fe.percolate=function(e){if(!(e>=this.length||e<0)){var t=e-1>>1;if(!(t<0||t===e)&&this.isHigherPriority(e,t)){var r=this.items[e];this.items[e]=this.items[t],this.items[t]=r,this.percolate(t)}}},Fe.heapify=function(e){if(+e||(e=0),!(e>=this.length||e<0)){var t=2*e+1,r=2*e+2,n=e;if(t<this.length&&this.isHigherPriority(t,n)&&(n=t),r<this.length&&this.isHigherPriority(r,n)&&(n=r),n!==e){var i=this.items[e];this.items[e]=this.items[n],this.items[n]=i,this.heapify(n)}}},Fe.peek=function(){return this.items[0].value},Fe.removeAt=function(e){this.items[e]=this.items[--this.length],this.items[this.length]=a,this.heapify()},Fe.dequeue=function(){var e=this.peek();return this.removeAt(0),e},Fe.enqueue=function(e){var t=this.length++;this.items[t]=new n(Be.count++,e),this.percolate(t)},Fe.remove=function(e){for(var t=0;t<this.length;t++)if(this.items[t].value===e)return this.removeAt(t),!0;return!1},Be.count=0;var $e=F.CompositeDisposable=function(){var e,t,r=[];if(Array.isArray(arguments[0]))t=(r=arguments[0]).length;else for(t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];for(e=0;e<t;e++)if(!He(r[e]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},Ue=$e.prototype;Ue.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},Ue.remove=function(e){var t=!1;if(!this.isDisposed){var r=this.disposables.indexOf(e);-1!==r&&(t=!0,this.disposables.splice(r,1),this.length--,e.dispose())}return t},Ue.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),r=0;r<e;r++)t[r]=this.disposables[r];for(this.disposables=[],r=this.length=0;r<e;r++)t[r].dispose()}};var ze=F.Disposable=function(e){this.isDisposed=!1,this.action=e||$};ze.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Ge=ze.create=function(e){return new ze(e)},Ve=ze.empty={dispose:$},He=ze.isDisposable=function(e){return e&&W(e.dispose)},qe=ze.checkDisposed=function(e){if(e.isDisposed)throw new J},We=F.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};We.prototype.getDisposable=function(){return this.current},We.prototype.setDisposable=function(e){if(this.current)throw new Error("Disposable has already been assigned");var t=this.isDisposed;!t&&(this.current=e),t&&e&&e.dispose()},We.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var Xe=F.SerialDisposable=function(){this.isDisposed=!1,this.current=null};Xe.prototype.getDisposable=function(){return this.current},Xe.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var r=this.current;this.current=e}r&&r.dispose(),t&&e&&e.dispose()},Xe.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var Ye=F.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?Ve:new e(this)},t}();f.prototype.dispose=function(){this.scheduler.scheduleWithState(this,d)};var Ke=F.internals.ScheduledItem=function(e,t,r,n,i){this.scheduler=e,this.state=t,this.action=r,this.dueTime=n,this.comparer=i||V,this.disposable=new We};Ke.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ke.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},Ke.prototype.isCancelled=function(){return this.disposable.isDisposed},Ke.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ze,Je=F.Scheduler=function(){function t(e,t,r,n){this.now=e,this._schedule=t,this._scheduleRelative=r,this._scheduleAbsolute=n}function r(e,t){return t(),Ve}t.isScheduler=function(e){return e instanceof t};var e=t.prototype;return e.schedule=function(e){return this._schedule(e,r)},e.scheduleWithState=function(e,t){return this._schedule(e,t)},e.scheduleWithRelative=function(e,t){return this._scheduleRelative(t,e,r)},e.scheduleWithRelativeAndState=function(e,t,r){return this._scheduleRelative(e,t,r)},e.scheduleWithAbsolute=function(e,t){return this._scheduleAbsolute(t,e,r)},e.scheduleWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute(e,t,r)},t.now=z,t.normalize=function(e){return e<0&&(e=0),e},t}(),Qe=Je.normalize,et=Je.isScheduler;!function(e){function r(t,e){var r=e[0],n=e[1],s=new $e;return function o(e){n(e,function(e){var r=!1,n=!1,i=t.scheduleWithState(e,function(e,t){return r?s.remove(i):n=!0,o(t),Ve});n||(s.add(i),r=!0)})}(r),s}function n(s,e,a){var t=e[0],r=e[1],c=new $e;return function o(e){r(e,function(e,t){var r=!1,n=!1,i=s[a](e,t,function(e,t){return r?c.remove(i):n=!0,o(t),Ve});n||(c.add(i),r=!0)})}(t),c}function i(t,r){t(function(e){r(t,e)})}e.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,i)},e.scheduleRecursiveWithState=function(e,t){return this.scheduleWithState([e,t],r)},e.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,i)},e.scheduleRecursiveWithRelativeAndState=function(e,t,r){return this._scheduleRelative([e,r],t,function(e,t){return n(e,t,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,i)},e.scheduleRecursiveWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute([e,r],t,function(e,t){return n(e,t,"scheduleWithAbsoluteAndState")})}}(Je.prototype),Je.prototype,Je.prototype.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,t)},Je.prototype.schedulePeriodicWithState=function(e,t,r){if(void 0===L.setInterval)throw new ee;t=Qe(t);var n=e,i=L.setInterval(function(){n=r(n)},t);return Ge(function(){L.clearInterval(i)})},(Ze=Je.prototype).catchError=Ze.catch=function(e){return new ct(this,e)};var tt,rt,nt=(F.internals.SchedulePeriodicRecursive=function(){function e(e,t,r,n){this._scheduler=e,this._state=t,this._period=r,this._action=n}return e.prototype.start=function(){var e=new We;return(this._cancel=e).setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,function(e,t){t(0,this._period);try{this._state=this._action(this._state)}catch(e){throw this._cancel.dispose(),e}}.bind(this))),e},e}(),Je.immediate=new Je(z,function(e,t){return t(this,e)},ne,ne)),it=Je.currentThread=function(){function i(){for(;0<o.length;){var e=o.dequeue();!e.isCancelled()&&e.invoke()}}var o,e=new Je(z,function(e,t){var r=new Ke(this,e,t,this.now());if(o)o.enqueue(r);else{(o=new Be(4)).enqueue(r);var n=l(i)();if(o=null,n===ke)return h(n.e)}return r.disposable},ne,ne);return e.scheduleRequired=function(){return!o},e}(),ot=function(){var e,t=$;if(L.setTimeout)e=L.setTimeout,t=L.clearTimeout;else{if(!L.WScript)throw new ee;e=function(e,t){L.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),st=ot.setTimeout,at=ot.clearTimeout;!function(){function n(e){if(s)st(function(){n(e)},0);else{var t=o[e];if(t){s=!0;var r=l(t)();if(rt(e),s=!1,r===ke)return h(r.e)}}}function e(e){"string"==typeof e.data&&e.data.substring(0,a.length)===a&&n(e.data.substring(a.length))}var i=1,o={},s=!1;rt=function(e){delete o[e]};var t=RegExp("^"+String(be).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=k&&D&&k.setImmediate)&&!t.test(r)&&r;if(W(r))tt=function(e){var t=i++;return o[t]=e,r(function(){n(t)}),t};else if(void 0!==_r&&"[object process]"==={}.toString.call(_r))tt=function(e){var t=i++;return o[t]=e,_r.nextTick(function(){n(t)}),t};else if(function(){if(!L.postMessage||L.importScripts)return!1;var e=!1,t=L.onmessage;return L.onmessage=function(){e=!0},L.postMessage("","*"),L.onmessage=t,e}()){var a="ms.rx.schedule"+Math.random();L.addEventListener?L.addEventListener("message",e,!1):L.attachEvent?L.attachEvent("onmessage",e):L.onmessage=e,tt=function(e){var t=i++;return o[t]=e,L.postMessage(a+currentId,"*"),t}}else if(L.MessageChannel){var c=new L.MessageChannel;c.port1.onmessage=function(e){n(e.data)},tt=function(e){var t=i++;return o[t]=e,c.port2.postMessage(t),t}}else tt="document"in L&&"onreadystatechange"in L.document.createElement("script")?function(e){var t=L.document.createElement("script"),r=i++;return o[r]=e,t.onreadystatechange=function(){n(r),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},L.document.documentElement.appendChild(t),r}:function(e){var t=i++;return o[t]=e,st(function(){n(t)},0),t}}();var ct=(Je.timeout=Je.default=new Je(z,function(e,t){var r=this,n=new We,i=tt(function(){!n.isDisposed&&n.setDisposable(t(r,e))});return new $e(n,Ge(function(){rt(i)}))},function(e,t,r){var n=this,i=Je.normalize(t),o=new We;if(0===i)return n.scheduleWithState(e,r);var s=st(function(){!o.isDisposed&&o.setDisposable(r(n,e))},i);return new $e(o,Ge(function(){at(s)}))},function(e,t,r){return this.scheduleWithRelativeAndState(e,t-this.now(),r)}),function(r){function n(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function i(e,t,r){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(r))}function o(e,t,r){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(r))}function t(e,t){this._scheduler=e,this._handler=t,this._recursiveOriginal=null,this._recursiveWrapper=null,r.call(this,this._scheduler.now.bind(this._scheduler),n,i,o)}return Ne(t,r),t.prototype._clone=function(e){return new t(e,this._handler)},t.prototype._wrap=function(r){var n=this;return function(e,t){try{return r(n._getRecursiveWrapper(e),t)}catch(e){if(!n._handler(e))throw e;return Ve}}},t.prototype._getRecursiveWrapper=function(e){if(this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},t.prototype.schedulePeriodicWithState=function(e,t,r){var n=this,i=!1,o=new We;return o.setDisposable(this._scheduler.schedulePeriodicWithState(e,t,function(e){if(i)return null;try{return r(e)}catch(e){if(i=!0,!n._handler(e))throw e;return o.dispose(),null}})),o},t}(Je)),ut=F.Notification=function(){function e(e,t,r,n,i,o){this.kind=e,this.value=t,this.exception=r,this._accept=n,this._acceptObservable=i,this.toString=o}return e.prototype.accept=function(e,t,r){return e&&"object"==typeof e?this._acceptObservable(e):this._accept(e,t,r)},e.prototype.toObservable=function(e){var t=this;return et(e)||(e=nt),new fr(function(r){return e.scheduleWithState(t,function(e,t){t._acceptObservable(r),"N"===t.kind&&r.onCompleted()})})},e}(),ht=ut.createOnNext=function(){function t(e){return e(this.value)}function r(e){return e.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(e){return new ut("N",e,null,t,r,n)}}(),lt=ut.createOnError=function(){function t(e,t){return t(this.exception)}function r(e){return e.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(e){return new ut("E",null,e,t,r,n)}}(),pt=ut.createOnCompleted=function(){function e(e,t,r){return r()}function t(e){return e.onCompleted()}function r(){return"OnCompleted()"}return function(){return new ut("C",null,null,e,t,r)}}(),ft=F.Observer=function(){};ft.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},ft.prototype.asObserver=function(){return new gt(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},ft.prototype.checked=function(){return new yt(this)};var dt=ft.create=function(e,t,r){return e||(e=$),t||(t=H),r||(r=$),new gt(e,t,r)};ft.fromNotifier=function(t,r){return new gt(function(e){return t.call(r,ht(e))},function(e){return t.call(r,lt(e))},function(){return t.call(r,pt())})},ft.prototype.notifyOn=function(e){return new _t(e,this)},ft.prototype.makeSafe=function(e){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,e)};var mt,vt=F.internals.AbstractObserver=function(e){function t(){this.isStopped=!1,e.call(this)}return Ne(t,e),t.prototype.next=re,t.prototype.error=re,t.prototype.completed=re,t.prototype.onNext=function(e){this.isStopped||this.next(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.error(e),!0)},t}(ft),gt=F.AnonymousObserver=function(n){function e(e,t,r){n.call(this),this._onNext=e,this._onError=t,this._onCompleted=r}return Ne(e,n),e.prototype.next=function(e){this._onNext(e)},e.prototype.error=function(e){this._onError(e)},e.prototype.completed=function(){this._onCompleted()},e}(vt),yt=function(t){function e(e){t.call(this),this._observer=e,this._state=0}Ne(e,t);var r=e.prototype;return r.onNext=function(e){this.checkAccess();var t=l(this._observer.onNext).call(this._observer,e);this._state=0,t===ke&&h(t.e)},r.onError=function(e){this.checkAccess();var t=l(this._observer.onError).call(this._observer,e);this._state=2,t===ke&&h(t.e)},r.onCompleted=function(){this.checkAccess();var e=l(this._observer.onCompleted).call(this._observer);this._state=2,e===ke&&h(e.e)},r.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},e}(ft),_t=function(n){function e(e,t,r){n.call(this,e,t),this._cancel=r}return Ne(e,n),e.prototype.next=function(e){n.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){n.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){n.prototype.completed.call(this),this.ensureActive()},e.prototype.dispose=function(){n.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},e}(F.internals.ScheduledObserver=function(r){function e(e,t){r.call(this),this.scheduler=e,this.observer=t,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Xe}return Ne(e,r),e.prototype.next=function(e){var t=this;this.queue.push(function(){t.observer.onNext(e)})},e.prototype.error=function(e){var t=this;this.queue.push(function(){t.observer.onError(e)})},e.prototype.completed=function(){var e=this;this.queue.push(function(){e.observer.onCompleted()})},e.prototype.ensureActive=function(){var e=!1,r=this;!this.hasFaulted&&0<this.queue.length&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var t;if(0<r.queue.length){t=r.queue.shift();try{t()}catch(e){throw r.queue=[],r.hasFaulted=!0,e}e()}else r.isAcquired=!1}))},e.prototype.dispose=function(){r.prototype.dispose.call(this),this.disposable.dispose()},e}(vt)),bt=F.Observable=function(){function e(r){if(F.config.longStackSupport&&X){try{throw new Error}catch(e){this.stack=e.stack.substring(e.stack.indexOf("\n")+1)}var n=this;this._subscribe=function(e){var t=e.onError.bind(e);return e.onError=function(e){o(e,n),t(e)},r.call(n,e)}}else this._subscribe=r}return(mt=e.prototype).subscribe=mt.forEach=function(e,t,r){return this._subscribe("object"==typeof e?e:dt(e,t,r))},mt.subscribeOnNext=function(t,r){return this._subscribe(dt(void 0!==r?function(e){t.call(r,e)}:t))},mt.subscribeOnError=function(t,r){return this._subscribe(dt(null,void 0!==r?function(e){t.call(r,e)}:t))},mt.subscribeOnCompleted=function(e,t){return this._subscribe(dt(null,null,void 0!==t?function(){e.call(t)}:e))},e}(),xt=F.ObservableBase=function(e){function n(e,t){var r,n=t[0],i=t[1],o=l(i.subscribeCore).call(i,n);return o!==ke||n.fail(ke.e)?void n.setDisposable((r=o)&&W(r.dispose)?r:W(r)?Ge(r):Ve):h(ke.e)}function t(e){var t=new dr(e),r=[t,this];return it.scheduleRequired()?it.scheduleWithState(r,n):n(0,r),t}function r(){e.call(this,t)}return Ne(r,e),r.prototype.subscribeCore=re,r}(bt),wt=F.internals.Enumerable=function(){},St=function(t){function e(e){this.sources=e,t.call(this)}function c(e,t,r){this.o=e,this.s=t,this.e=r,this.isStopped=!1}return Ne(e,t),e.prototype.subscribeCore=function(o){var s,a=new Xe,e=nt.scheduleRecursiveWithState(this.sources[ie](),function(e,t){if(!s){var r=l(e.next).call(e);if(r===ke)return o.onError(r.e);if(r.done)return o.onCompleted();var n=r.value;q(n)&&(n=At(n));var i=new We;a.setDisposable(i),i.setDisposable(n.subscribe(new c(o,t,e)))}});return new $e(a,e,Ge(function(){s=!0}))},c.prototype.onNext=function(e){this.isStopped||this.o.onNext(e)},c.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},e}(xt);wt.prototype.concat=function(){return new St(this)};var Mt=function(t){function e(e){this.sources=e,t.call(this)}return Ne(e,t),e.prototype.subscribeCore=function(o){var s,a=this.sources[ie](),c=new Xe,e=nt.scheduleRecursiveWithState(null,function(e,t){if(!s){var r=l(a.next).call(a);if(r===ke)return o.onError(r.e);if(r.done)return null!==e?o.onError(e):o.onCompleted();var n=r.value;q(n)&&(n=At(n));var i=new We;c.setDisposable(i),i.setDisposable(n.subscribe(function(e){o.onNext(e)},t,function(){o.onCompleted()}))}});return new $e(c,e,Ge(function(){s=!0}))},e}(xt);wt.prototype.catchError=function(){return new Mt(this)},wt.prototype.catchErrorWhen=function(r){var n=this;return new fr(function(o){var s,a=new vr,c=new vr,e=r(a).subscribe(c),u=n[ie](),h=new Xe,t=nt.scheduleRecursive(function(t){if(!s){var e=l(u.next).call(u);if(e===ke)return o.onError(e.e);if(e.done)return void o.onCompleted();var r=e.value;q(r)&&(r=At(r));var n=new We,i=new We;h.setDisposable(new $e(i,n)),n.setDisposable(r.subscribe(function(e){o.onNext(e)},function(e){i.setDisposable(c.subscribe(t,function(e){o.onError(e)},function(){o.onCompleted()})),a.onNext(e)},function(){o.onCompleted()}))}});return new $e(e,h,t,Ge(function(){s=!0}))})};var Ct=function(e){function t(e,t){this.v=e,this.c=null==t?-1:t}function r(e){this.v=e.v,this.l=e.c}return Ne(t,wt),t.prototype[ie]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?oe:(0<this.l&&this.l--,{done:!1,value:this.v})},t}(),Et=wt.repeat=function(e,t){return new Ct(e,t)},Tt=function(e){function t(e,t,r){this.s=e,this.fn=t?ce(t,r,3):null}function r(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return Ne(t,wt),t.prototype[ie]=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]}:oe},t}(),Ot=wt.of=function(e,t,r){return new Tt(e,t,r)};mt.observeOn=function(t){var r=this;return new fr(function(e){return r.subscribe(new _t(t,e))},r)},mt.subscribeOn=function(n){var i=this;return new fr(function(e){var t=new We,r=new Xe;return r.setDisposable(t),t.setDisposable(n.schedule(function(){r.setDisposable(new f(n,i.subscribe(e)))})),r},i)};var Pt=function(t){function e(e){this.p=e,t.call(this)}return Ne(e,t),e.prototype.subscribeCore=function(t){return this.p.then(function(e){t.onNext(e),t.onCompleted()},function(e){t.onError(e)}),Ve},e}(xt),At=bt.fromPromise=function(e){return new Pt(e)};mt.toPromise=function(e){if(e||(e=F.config.Promise),!e)throw new ee("Promise type not provided nor in Rx.config.Promise");var i=this;return new e(function(e,t){var r,n=!1;i.subscribe(function(e){r=e,n=!0},t,function(){n&&e(r)})})};var jt=function(t){function e(e){this.source=e,t.call(this)}function r(e){this.o=e,this.a=[],this.isStopped=!1}return Ne(e,t),e.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e))},r.prototype.onNext=function(e){this.isStopped||this.a.push(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onNext(this.a),this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},e}(xt);mt.toArray=function(){return new jt(this)},bt.create=bt.createWithDisposable=function(e,t){return new fr(e,t)};var Rt=(bt.defer=function(r){return new fr(function(t){var e;try{e=r()}catch(e){return Xt(e).subscribe(t)}return q(e)&&(e=At(e)),e.subscribe(t)})},function(t){function e(e){this.scheduler=e,t.call(this)}function r(e,t){this.observer=e,this.parent=t}function n(e,t){t.onCompleted()}return Ne(e,t),e.prototype.subscribeCore=function(e){return new r(e,this).run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState(this.observer,n)},e}(xt)),Lt=bt.empty=function(e){return et(e)||(e=nt),new Rt(e)},Nt=function(n){function e(e,t,r){this.iterable=e,this.mapper=t,this.scheduler=r,n.call(this)}return Ne(e,n),e.prototype.subscribeCore=function(e){return new It(e,this).run()},e}(xt),It=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){var i=function(e){var t=e[ie];if(!t&&"string"==typeof e)return new m(e)[ie]();if(!t&&e.length!==a)return new _(e)[ie]();if(!t)throw new TypeError("Object is not iterable");return e[ie]()}(Object(this.parent.iterable)),o=this.observer,s=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,function(e,t){try{var r=i.next()}catch(e){return o.onError(e)}if(r.done)return o.onCompleted();var n=r.value;if(s)try{n=s(n,e)}catch(e){return o.onError(e)}o.onNext(n),t(e+1)})},e}(),Dt=Math.pow(2,53)-1;m.prototype[ie]=function(){return new y(this._s)},y.prototype[ie]=function(){return this},y.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:oe},_.prototype[ie]=function(){return new b(this._a)},b.prototype[ie]=function(){return this},b.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:oe};var kt=bt.from=function(e,t,r,n){if(null==e)throw new Error("iterable cannot be null.");if(t&&!W(t))throw new Error("mapFn when provided must be a function");if(t)var i=ce(t,r,2);return et(n)||(n=it),new Nt(e,i,n)},Bt=function(r){function e(e,t){this.args=e,this.scheduler=t,r.call(this)}return Ne(e,r),e.prototype.subscribeCore=function(e){return new x(e,this).run()},e}(xt);x.prototype.run=function(){var r=this.observer,n=this.parent.args,i=n.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(e,t){e<i?(r.onNext(n[e]),t(e+1)):r.onCompleted()})};var Ft=bt.fromArray=function(e,t){return et(t)||(t=it),new Bt(e,t)};bt.generate=function(e,s,a,c,t){return et(t)||(t=it),new fr(function(i){var o=!0;return t.scheduleRecursiveWithState(e,function(e,t){var r,n;try{o?o=!1:e=a(e),(r=s(e))&&(n=c(e))}catch(e){return i.onError(e)}r?(i.onNext(n),t(e)):i.onCompleted()})})};var $t=function(e){function t(){e.call(this)}return Ne(t,e),t.prototype.subscribeCore=function(e){return Ve},t}(xt),Ut=bt.never=function(){return new $t};bt.of=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new Bt(t,it)},bt.ofWithScheduler=function(e){for(var t=arguments.length,r=new Array(t-1),n=1;n<t;n++)r[n-1]=arguments[n];return new Bt(r,e)};var zt=function(r){function e(e,t){this.obj=e,this.keys=Object.keys(e),this.scheduler=t,r.call(this)}return Ne(e,r),e.prototype.subscribeCore=function(e){return new S(e,this).run()},e}(xt);S.prototype.run=function(){var n=this.observer,i=this.parent.obj,o=this.parent.keys,s=o.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(e,t){if(e<s){var r=o[e];n.onNext([r,i[r]]),t(e+1)}else n.onCompleted()})},bt.pairs=function(e,t){return t||(t=it),new zt(e,t)};var Gt=function(n){function e(e,t,r){this.start=e,this.rangeCount=t,this.scheduler=r,n.call(this)}return Ne(e,n),e.prototype.subscribeCore=function(e){return new Vt(e,this).run()},e}(xt),Vt=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){var r=this.parent.start,n=this.parent.rangeCount,i=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,function(e,t){e<n?(i.onNext(r+e),t(e+1)):i.onCompleted()})},e}();bt.range=function(e,t,r){return et(r)||(r=it),new Gt(e,t,r)};var Ht=function(n){function e(e,t,r){this.value=e,this.repeatCount=null==t?-1:t,this.scheduler=r,n.call(this)}return Ne(e,n),e.prototype.subscribeCore=function(e){return new M(e,this).run()},e}(xt);M.prototype.run=function(){var r=this.observer,n=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,function(e,t){return(-1===e||0<e)&&(r.onNext(n),0<e&&e--),0===e?r.onCompleted():void t(e)})},bt.repeat=function(e,t,r){return et(r)||(r=it),new Ht(e,t,r)};var qt=function(r){function e(e,t){this.value=e,this.scheduler=t,r.call(this)}function t(e,t){this.observer=e,this.parent=t}function n(e,t){var r=t[0],n=t[1];n.onNext(r),n.onCompleted()}return Ne(e,r),e.prototype.subscribeCore=function(e){return new t(e,this).run()},t.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],n)},e}(xt),Wt=(bt.return=bt.just=bt.returnValue=function(e,t){return et(t)||(t=nt),new qt(e,t)},function(r){function e(e,t){this.error=e,this.scheduler=t,r.call(this)}function t(e,t){this.o=e,this.p=t}function n(e,t){var r=t[0];t[1].onError(r)}return Ne(e,r),e.prototype.subscribeCore=function(e){return new t(e,this).run()},t.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],n)},e}(xt)),Xt=bt.throw=bt.throwError=bt.throwException=function(e,t){return et(t)||(t=nt),new Wt(e,t)};bt.using=function(i,o){return new fr(function(t){var e,r,n=Ve;try{(e=i())&&(n=e),r=o(e)}catch(e){return new $e(Xt(e).subscribe(t),n)}return new $e(r.subscribe(t),n)})},mt.amb=function(s){var a=this;return new fr(function(t){function r(){i||(i="L",o.dispose())}function n(){i||(i="R",e.dispose())}var i,e=new We,o=new We;return q(s)&&(s=At(s)),e.setDisposable(a.subscribe(function(e){r(),"L"===i&&t.onNext(e)},function(e){r(),"L"===i&&t.onError(e)},function(){r(),"L"===i&&t.onCompleted()})),o.setDisposable(s.subscribe(function(e){n(),"R"===i&&t.onNext(e)},function(e){n(),"R"===i&&t.onError(e)},function(){n(),"R"===i&&t.onCompleted()})),new $e(e,o)})},bt.amb=function(){var e,t,r=Ut(),n=[];if(Array.isArray(arguments[0]))n=arguments[0];else for(var i=0,o=arguments.length;i<o;i++)n.push(arguments[i]);for(i=0,o=n.length;i<o;i++)e=r,t=n[i],r=e.amb(t);return r},mt.catch=mt.catchError=mt.catchException=function(e){return"function"==typeof e?(o=e,new fr(function(n){var e=new We,i=new Xe;return i.setDisposable(e),e.setDisposable(t.subscribe(function(e){n.onNext(e)},function(e){try{var t=o(e)}catch(e){return n.onError(e)}q(t)&&(t=At(t));var r=new We;i.setDisposable(r),r.setDisposable(t.subscribe(n))},function(e){n.onCompleted(e)})),i},t=this)):Yt([this,e]);var t,o};var Yt=bt.catchError=bt.catch=bt.catchException=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,r=arguments.length;t<r;t++)e.push(arguments[t]);return Ot(e).catchError()};mt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Kt.apply(this,t)};var Kt=bt.combineLatest=function(){for(var e=arguments.length,h=new Array(e),t=0;t<e;t++)h[t]=arguments[t];var l=h.pop();return Array.isArray(h[0])&&(h=h[0]),new fr(function(n){function i(r){if(o[r]=!0,s||(s=o.every(U))){try{var e=l.apply(null,c)}catch(e){return n.onError(e)}n.onNext(e)}else a.filter(function(e,t){return t!==r}).every(U)&&n.onCompleted()}for(var e=h.length,t=function(){return!1},o=p(e,t),s=!1,a=p(e,t),c=new Array(e),u=new Array(e),r=0;r<e;r++)!function(t){var e=h[t],r=new We;q(e)&&(e=At(e)),r.setDisposable(e.subscribe(function(e){c[t]=e,i(t)},function(e){n.onError(e)},function(){a[t]=!0,a.every(U)&&n.onCompleted()})),u[t]=r}(r);return new $e(u)},this)};mt.concat=function(){for(var e=[],t=0,r=arguments.length;t<r;t++)e.push(arguments[t]);return e.unshift(this),Jt.apply(null,e)};var Zt=function(t){function e(e){this.sources=e,t.call(this)}function r(e,t){this.sources=e,this.o=t}return Ne(e,t),e.prototype.subscribeCore=function(e){return new r(this.sources,e).run()},r.prototype.run=function(){var i,o=new Xe,s=this.sources,a=s.length,c=this.o,e=nt.scheduleRecursiveWithState(0,function(e,t){if(!i){if(e===a)return c.onCompleted();var r=s[e];q(r)&&(r=At(r));var n=new We;o.setDisposable(n),n.setDisposable(r.subscribe(function(e){c.onNext(e)},function(e){c.onError(e)},function(){t(e+1)}))}});return new $e(o,e,Ge(function(){i=!0}))},e}(xt),Jt=bt.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,r=arguments.length;t<r;t++)e[t]=arguments[t]}return new Zt(e)};mt.concatAll=mt.concatObservable=function(){return this.merge(1)};var Qt=function(r){function e(e,t){this.source=e,this.maxConcurrent=t,r.call(this)}return Ne(e,r),e.prototype.subscribeCore=function(e){var t=new $e;return t.add(this.source.subscribe(new er(e,this.maxConcurrent,t))),t},e}(xt),er=function(){function e(e,t,r){this.o=e,this.max=t,this.g=r,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function r(e,t){this.parent=e,this.sad=t,this.isStopped=!1}return e.prototype.handleSubscribe=function(e){var t=new We;this.g.add(t),q(e)&&(e=At(e)),t.setDisposable(e.subscribe(new r(this,t)))},e.prototype.onNext=function(e){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(e)):this.q.push(e))},e.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},r.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=this.parent;e.g.remove(this.sad),0<e.q.length?e.handleSubscribe(e.q.shift()):(e.activeCount--,e.done&&0===e.activeCount&&e.o.onCompleted())}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();mt.merge=function(e){return"number"!=typeof e?tr(this,e):new Qt(this,e)};var tr=bt.merge=function(){var e,t,r=[],n=arguments.length;if(arguments[0])if(et(arguments[0]))for(e=arguments[0],t=1;t<n;t++)r.push(arguments[t]);else for(e=nt,t=0;t<n;t++)r.push(arguments[t]);else for(e=nt,t=1;t<n;t++)r.push(arguments[t]);return Array.isArray(r[0])&&(r=r[0]),w(e,r).mergeAll()},rr=F.CompositeError=function(e){this.name="NotImplementedError",this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};rr.prototype=Error.prototype,bt.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var r=0;r<t;r++)e[r]=arguments[r]}var a=w(null,e);return new fr(function(r){function n(){0===s.length?r.onCompleted():1===s.length?r.onError(s[0]):r.onError(new rr(s))}var i=new $e,e=new We,o=!1,s=[];return i.add(e),e.setDisposable(a.subscribe(function(e){var t=new We;i.add(t),q(e)&&(e=At(e)),t.setDisposable(e.subscribe(function(e){r.onNext(e)},function(e){s.push(e),i.remove(t),o&&1===i.length&&n()},function(){i.remove(t),o&&1===i.length&&n()}))},function(e){s.push(e),o=!0,1===i.length&&n()},function(){o=!0,1===i.length&&n()})),i})};var nr=function(t){function e(e){this.source=e,t.call(this)}function n(e,t){this.o=e,this.g=t,this.isStopped=!1,this.done=!1}function r(e,t,r){this.parent=e,this.g=t,this.sad=r,this.isStopped=!1}return Ne(e,t),e.prototype.subscribeCore=function(e){var t=new $e,r=new We;return t.add(r),r.setDisposable(this.source.subscribe(new n(e,t))),t},n.prototype.onNext=function(e){if(!this.isStopped){var t=new We;this.g.add(t),q(e)&&(e=At(e)),t.setDisposable(e.subscribe(new r(this,this.g,t)))}},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},r.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},r.prototype.onCompleted=function(){if(!this.isStopped){var e=this.parent;this.isStopped=!0,e.g.remove(this.sad),e.done&&1===e.g.length&&e.o.onCompleted()}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(e),!0)},e}(xt);mt.mergeAll=mt.mergeObservable=function(){return new nr(this)},mt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return ir([this,e])};var ir=bt.onErrorResumeNext=function(){var s=[];if(Array.isArray(arguments[0]))s=arguments[0];else for(var e=0,t=arguments.length;e<t;e++)s.push(arguments[e]);return new fr(function(n){var i=0,o=new Xe,e=nt.scheduleRecursive(function(e){var t,r;i<s.length?(t=s[i++],q(t)&&(t=At(t)),r=new We,o.setDisposable(r),r.setDisposable(t.subscribe(n.onNext.bind(n),e,e))):n.onCompleted()});return new $e(o,e)})};mt.skipUntil=function(i){var o=this;return new fr(function(t){var r=!1,e=new $e(o.subscribe(function(e){r&&t.onNext(e)},function(e){t.onError(e)},function(){r&&t.onCompleted()}));q(i)&&(i=At(i));var n=new We;return e.add(n),n.setDisposable(i.subscribe(function(){r=!0,n.dispose()},function(e){t.onError(e)},function(){n.dispose()})),e},o)};var or=function(t){function e(e){this.source=e,t.call(this)}function n(e,t){this.o=e,this.inner=t,this.stopped=!1,this.latest=0,this.hasLatest=!1,this.isStopped=!1}function i(e,t){this.parent=e,this.id=t,this.isStopped=!1}return Ne(e,t),e.prototype.subscribeCore=function(e){var t=new Xe,r=this.source.subscribe(new n(e,t));return new $e(r,t)},n.prototype.onNext=function(e){if(!this.isStopped){var t=new We,r=++this.latest;this.hasLatest=!0,this.inner.setDisposable(t),q(e)&&(e=At(e)),t.setDisposable(e.subscribe(new i(this,r)))}},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.stopped=!0,!this.hasLatest&&this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},i.prototype.onNext=function(e){this.isStopped||this.parent.latest===this.id&&this.parent.o.onNext(e)},i.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&this.parent.o.onError(e))},i.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.isStopped&&this.parent.o.onCompleted()))},i.prototype.dispose=function(){this.isStopped=!0},i.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(e),!0)},e}(xt);mt.switch=mt.switchLatest=function(){return new or(this)};var sr=function(r){function e(e,t){this.source=e,this.other=q(t)?At(t):t,r.call(this)}function t(e){this.o=e,this.isStopped=!1}return Ne(e,r),e.prototype.subscribeCore=function(e){return new $e(this.source.subscribe(e),this.other.subscribe(new t(e)))},t.prototype.onNext=function(e){this.isStopped||this.o.onCompleted()},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){!this.isStopped&&(this.isStopped=!0)},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},e}(xt);mt.takeUntil=function(e){return new sr(this,e)},mt.withLatestFrom=function(){for(var e=arguments.length,c=new Array(e),t=0;t<e;t++)c[t]=arguments[t];var u=c.pop(),h=this;return Array.isArray(c[0])&&(c=c[0]),new fr(function(n){for(var e=c.length,i=p(e,C),o=!1,s=new Array(e),a=new Array(e+1),t=0;t<e;t++)!function(t){var e=c[t],r=new We;q(e)&&(e=At(e)),r.setDisposable(e.subscribe(function(e){s[t]=e,i[t]=!0,o=i.every(U)},function(e){n.onError(e)},$)),a[t]=r}(t);var r=new We;return r.setDisposable(h.subscribe(function(e){var t=[e].concat(s);if(o){var r=l(u).apply(null,t);return r===ke?n.onError(r.e):void n.onNext(r)}},function(e){n.onError(e)},function(){n.onCompleted()})),a[e]=r,new $e(a)},this)},mt.zip=function(){if(Array.isArray(arguments[0]))return function(s,a){var e=this;return new fr(function(n){var i=0,o=s.length;return e.subscribe(function(e){if(i<o){var t=s[i++],r=l(a)(e,t);if(r===ke)return n.onError(r.e);n.onNext(r)}else n.onCompleted()},function(e){n.onError(e)},function(){n.onCompleted()})},e)}.apply(this,arguments);for(var e=arguments.length,a=new Array(e),t=0;t<e;t++)a[t]=arguments[t];var c=this,u=a.pop();return a.unshift(c),new fr(function(i){for(var e=a.length,o=p(e,E),s=p(e,C),r=new Array(e),t=0;t<e;t++)!function(n){var e=a[n],t=new We;q(e)&&(e=At(e)),t.setDisposable(e.subscribe(function(e){if(o[n].push(e),o.every(function(e){return 0<e.length})){var t=o.map(function(e){return e.shift()}),r=l(u).apply(c,t);if(r===ke)return i.onError(r.e);i.onNext(r)}else s.filter(function(e,t){return t!==n}).every(U)&&i.onCompleted()},function(e){i.onError(e)},function(){s[n]=!0,s.every(U)&&i.onCompleted()})),r[n]=t}(t);return new $e(r)},c)},bt.zip=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.shift();return n.zip.apply(n,t)},bt.zipArray=function(){var s;if(Array.isArray(arguments[0]))s=arguments[0];else{var e=arguments.length;s=new Array(e);for(var t=0;t<e;t++)s[t]=arguments[t]}return new fr(function(n){for(var e=s.length,i=p(e,T),o=p(e,C),t=new Array(e),r=0;r<e;r++)!function(r){t[r]=new We,t[r].setDisposable(s[r].subscribe(function(e){if(i[r].push(e),i.every(function(e){return 0<e.length})){var t=i.map(function(e){return e.shift()});n.onNext(t)}else if(o.filter(function(e,t){return t!==r}).every(U))return n.onCompleted()},function(e){n.onError(e)},function(){o[r]=!0,o.every(U)&&n.onCompleted()}))}(r);return new $e(t)})},mt.asObservable=function(){var t=this;return new fr(function(e){return t.subscribe(e)},t)},mt.bufferWithCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).selectMany(function(e){return e.toArray()}).where(function(e){return 0<e.length})},mt.dematerialize=function(){var e=this;return new fr(function(t){return e.subscribe(function(e){return e.accept(t)},function(e){t.onError(e)},function(){t.onCompleted()})},this)},mt.distinctUntilChanged=function(s,a){var e=this;return a||(a=G),new fr(function(n){var i,o=!1;return e.subscribe(function(e){var t=e;if(s&&(t=l(s)(e))===ke)return n.onError(t.e);if(o){var r=l(a)(i,t);if(r===ke)return n.onError(r.e)}o&&r||(o=!0,i=t,n.onNext(e))},function(e){n.onError(e)},function(){n.onCompleted()})},this)};var ar=function(i){function e(e,t,r,n){this.source=e,this.t=!t||W(t)?dt(t||$,r||$,n||$):t,i.call(this)}function t(e,t){this.o=e,this.t=t,this.isStopped=!1}return Ne(e,i),e.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.t))},t.prototype.onNext=function(e){if(!this.isStopped){var t=l(this.t.onNext).call(this.t,e);t===ke&&this.o.onError(t.e),this.o.onNext(e)}},t.prototype.onError=function(e){if(!this.isStopped){this.isStopped=!0;var t=l(this.t.onError).call(this.t,e);if(t===ke)return this.o.onError(t.e);this.o.onError(e)}},t.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=l(this.t.onCompleted).call(this.t);if(e===ke)return this.o.onError(e.e);this.o.onCompleted()}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},e}(xt);mt.do=mt.tap=mt.doAction=function(e,t,r){return new ar(this,e,t,r)},mt.doOnNext=mt.tapOnNext=function(t,r){return this.tap(void 0!==r?function(e){t.call(r,e)}:t)},mt.doOnError=mt.tapOnError=function(t,r){return this.tap($,void 0!==r?function(e){t.call(r,e)}:t)},mt.doOnCompleted=mt.tapOnCompleted=function(e,t){return this.tap($,null,void 0!==t?function(){e.call(t)}:e)},mt.finally=mt.ensure=function(r){var n=this;return new fr(function(e){var t;try{t=n.subscribe(e)}catch(e){throw r(),e}return Ge(function(){try{t.dispose()}catch(e){throw e}finally{r()}})},this)},mt.finallyAction=function(e){return this.ensure(e)};var cr=function(t){function e(e){this.source=e,t.call(this)}function r(e){this.o=e,this.isStopped=!1}return Ne(e,t),e.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e))},r.prototype.onNext=$,r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(e),!0)},e}(xt);mt.ignoreElements=function(){return new cr(this)},mt.materialize=function(){var e=this;return new fr(function(t){return e.subscribe(function(e){t.onNext(ht(e))},function(e){t.onNext(lt(e)),t.onCompleted()},function(){t.onNext(pt()),t.onCompleted()})},e)},mt.repeat=function(e){return Et(this,e).concat()},mt.retry=function(e){return Et(this,e).catchError()},mt.retryWhen=function(e){return Et(this).catchErrorWhen(e)};var ur=function(i){function e(e,t,r,n){this.source=e,this.accumulator=t,this.hasSeed=r,this.seed=n,i.call(this)}return Ne(e,i),e.prototype.subscribeCore=function(e){return this.source.subscribe(new O(e,this))},e}(xt);O.prototype.onNext=function(e){if(!this.isStopped){!this.hasValue&&(this.hasValue=!0);try{this.hasAccumulation?this.accumulation=this.accumulator(this.accumulation,e):(this.accumulation=this.hasSeed?this.accumulator(this.seed,e):e,this.hasAccumulation=!0)}catch(e){return this.observer.onError(e)}this.observer.onNext(this.accumulation)}},O.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},O.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},O.prototype.dispose=function(){this.isStopped=!0},O.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(e),!0)},mt.scan=function(){var e,t,r=!1;return t=2===arguments.length?(r=!0,e=arguments[0],arguments[1]):arguments[0],new ur(this,t,r,e)},mt.skipLast=function(n){if(n<0)throw new Q;var e=this;return new fr(function(t){var r=[];return e.subscribe(function(e){r.push(e),r.length>n&&t.onNext(r.shift())},function(e){t.onError(e)},function(){t.onCompleted()})},e)},mt.startWith=function(){var e,t=0;arguments.length&&et(arguments[0])?(e=arguments[0],t=1):e=nt;for(var r=[],n=t,i=arguments.length;n<i;n++)r.push(arguments[n]);return Ot([Ft(r,e),this]).concat()},mt.takeLast=function(n){if(n<0)throw new Q;var e=this;return new fr(function(t){var r=[];return e.subscribe(function(e){r.push(e),r.length>n&&r.shift()},function(e){t.onError(e)},function(){for(;0<r.length;)t.onNext(r.shift());t.onCompleted()})},e)},mt.takeLastBuffer=function(n){var e=this;return new fr(function(t){var r=[];return e.subscribe(function(e){r.push(e),r.length>n&&r.shift()},function(e){t.onError(e)},function(){t.onNext(r),t.onCompleted()})},e)},mt.windowWithCount=function(a,c){var n=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),a<=0)throw new Q;if(null==c&&(c=a),+c||(c=0),Math.abs(c)===1/0&&(c=0),c<=0)throw new Q;return new fr(function(t){function i(){var e=new vr;s.push(e),t.onNext(De(e,r))}var e=new We,r=new Ye(e),o=0,s=[];return i(),e.setDisposable(n.subscribe(function(e){for(var t=0,r=s.length;t<r;t++)s[t].onNext(e);var n=o-a+1;0<=n&&n%c==0&&s.shift().onCompleted(),++o%c==0&&i()},function(e){for(;0<s.length;)s.shift().onError(e);t.onError(e)},function(){for(;0<s.length;)s.shift().onCompleted();t.onCompleted()})),r},n)},mt.selectConcat=mt.concatMap=function(t,i,e){return W(t)&&W(i)?this.concatMap(function(r,n){var e=t(r,n);return q(e)&&(e=At(e)),(ae(e)||se(e))&&(e=kt(e)),e.map(function(e,t){return i(r,e,n,t)})}):W(t)?P(this,t,e):P(this,function(){return t})},mt.concatMapObserver=mt.selectConcatObserver=function(e,t,r,n){var i=this,o=ce(e,n,2),s=ce(t,n,1),a=ce(r,n,0);return new fr(function(r){var n=0;return i.subscribe(function(e){var t;try{t=o(e,n++)}catch(e){return void r.onError(e)}q(t)&&(t=At(t)),r.onNext(t)},function(e){var t;try{t=s(e)}catch(e){return void r.onError(e)}q(t)&&(t=At(t)),r.onNext(t),r.onCompleted()},function(){var e;try{e=a()}catch(e){return void r.onError(e)}q(e)&&(e=At(e)),r.onNext(e),r.onCompleted()})},this).concatAll()},mt.defaultIfEmpty=function(e){var n=this;return e===a&&(e=null),new fr(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},function(e){t.onError(e)},function(){!r&&t.onNext(e),t.onCompleted()})},n)},A.prototype.push=function(e){var t=-1===function(e,t,r){for(var n=0,i=e.length;n<i;n++)if(r(e[n],t))return n;return-1}(this.set,e,this.comparer);return t&&this.set.push(e),t},mt.distinct=function(i,e){var t=this;return e||(e=G),new fr(function(r){var n=new A(e);return t.subscribe(function(e){var t=e;if(i)try{t=i(e)}catch(e){return void r.onError(e)}n.push(t)&&r.onNext(e)},function(e){r.onError(e)},function(){r.onCompleted()})},this)};var hr=function(n){function r(e,t,r){this.source=e,this.selector=ce(t,r,3),n.call(this)}function t(e,t,r){this.o=e,this.selector=t,this.source=r,this.i=0,this.isStopped=!1}return Ne(r,n),r.prototype.internalMap=function(e,t){return new r(this.source,(n=e,i=this,function(e,t,r){return n.call(this,i.selector(e,t,r),t,r)}),t);var n,i},r.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.selector,this))},t.prototype.onNext=function(e){if(!this.isStopped){var t=l(this.selector)(e,this.i++,this.source);return t===ke?this.o.onError(t.e):void this.o.onNext(t)}},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},r}(xt);mt.map=mt.select=function(e,t){var r="function"==typeof e?e:function(){return e};return this instanceof hr?this.internalMap(r,t):new hr(this,r,t)},mt.pluck=function(){var i=arguments,o=arguments.length;if(0===o)throw new Error("List of properties cannot be empty.");return this.map(function(e){for(var t=e,r=0;r<o;r++){var n=t[i[r]];if(void 0===n)return a;t=n}return t})},mt.flatMapObserver=mt.selectManyObserver=function(i,o,t,s){var e=this;return new fr(function(r){var n=0;return e.subscribe(function(e){var t;try{t=i.call(s,e,n++)}catch(e){return void r.onError(e)}q(t)&&(t=At(t)),r.onNext(t)},function(e){var t;try{t=o.call(s,e)}catch(e){return void r.onError(e)}q(t)&&(t=At(t)),r.onNext(t),r.onCompleted()},function(){var e;try{e=t.call(s)}catch(e){return void r.onError(e)}q(e)&&(e=At(e)),r.onNext(e),r.onCompleted()})},e).mergeAll()},mt.selectMany=mt.flatMap=function(t,i,e){return W(t)&&W(i)?this.flatMap(function(r,n){var e=t(r,n);return q(e)&&(e=At(e)),(ae(e)||se(e))&&(e=kt(e)),e.map(function(e,t){return i(r,e,n,t)})},e):W(t)?j(this,t,e):j(this,function(){return t})},mt.selectSwitch=mt.flatMapLatest=mt.switchMap=function(e,t){return this.select(e,t).switchLatest()};var lr=function(r){function e(e,t){this.source=e,this.skipCount=t,r.call(this)}function t(e,t){this.c=t,this.r=t,this.o=e,this.isStopped=!1}return Ne(e,r),e.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.skipCount))},t.prototype.onNext=function(e){this.isStopped||(this.r<=0?this.o.onNext(e):this.r--)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},e}(xt);mt.skip=function(e){if(e<0)throw new Q;return new lr(this,e)},mt.skipWhile=function(e,t){var i=this,o=ce(e,t,3);return new fr(function(t){var r=0,n=!1;return i.subscribe(function(e){if(!n)try{n=!o(e,r++,i)}catch(e){return void t.onError(e)}n&&t.onNext(e)},function(e){t.onError(e)},function(){t.onCompleted()})},i)},mt.take=function(e,t){if(e<0)throw new Q;if(0===e)return Lt(t);var n=this;return new fr(function(t){var r=e;return n.subscribe(function(e){0<r--&&(t.onNext(e),r<=0&&t.onCompleted())},function(e){t.onError(e)},function(){t.onCompleted()})},n)},mt.takeWhile=function(e,t){var i=this,o=ce(e,t,3);return new fr(function(t){var r=0,n=!0;return i.subscribe(function(e){if(n){try{n=o(e,r++,i)}catch(e){return void t.onError(e)}n?t.onNext(e):t.onCompleted()}},function(e){t.onError(e)},function(){t.onCompleted()})},i)};var pr=function(n){function r(e,t,r){this.source=e,this.predicate=ce(t,r,3),n.call(this)}function t(e,t,r){this.o=e,this.predicate=t,this.source=r,this.i=0,this.isStopped=!1}return Ne(r,n),r.prototype.subscribeCore=function(e){return this.source.subscribe(new t(e,this.predicate,this))},r.prototype.internalFilter=function(e,t){return new r(this.source,(n=e,i=this,function(e,t,r){return i.predicate(e,t,r)&&n.call(this,e,t,r)}),t);var n,i},t.prototype.onNext=function(e){if(!this.isStopped){var t=l(this.predicate)(e,this.i++,this.source);return t===ke?this.o.onError(t.e):void(t&&this.o.onNext(e))}},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},r}(xt);mt.filter=mt.where=function(e,t){return this instanceof pr?this.internalFilter(e,t):new pr(this,e,t)},mt.transduce=function(n){var i=this;return new fr(function(t){var e,r=n((e=t,{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}));return i.subscribe(function(e){try{r["@@transducer/step"](t,e)}catch(e){t.onError(e)}},function(e){t.onError(e)},function(){r["@@transducer/result"](t)})},i)};var fr=F.AnonymousObservable=function(t){function i(e,t){var r,n=t[0],i=l(t[1])(n);return i!==ke||n.fail(ke.e)?void n.setDisposable((r=i)&&W(r.dispose)?r:W(r)?Ge(r):Ve):h(ke.e)}function e(n,e){this.source=e,t.call(this,function(e){var t=new dr(e),r=[t,n];return it.scheduleRequired()?it.scheduleWithState(r,i):i(0,r),t})}return Ne(e,t),e}(bt),dr=function(t){function e(e){t.call(this),this.observer=e,this.m=new We}Ne(e,t);var r=e.prototype;return r.next=function(e){var t=l(this.observer.onNext).call(this.observer,e);t===ke&&(this.dispose(),h(t.e))},r.error=function(e){var t=l(this.observer.onError).call(this.observer,e);this.dispose(),t===ke&&h(t.e)},r.completed=function(){var e=l(this.observer.onCompleted).call(this.observer);this.dispose(),e===ke&&h(e.e)},r.setDisposable=function(e){this.m.setDisposable(e)},r.getDisposable=function(){return this.m.getDisposable()},r.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(vt),mr=function(e,t){this.subject=e,this.observer=t};mr.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var e=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(e,1),this.observer=null}};var vr=F.Subject=function(e){function t(e){return qe(this),this.isStopped?(this.hasError?e.onError(this.error):e.onCompleted(),Ve):(this.observers.push(e),new mr(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Ne(r,e),Ie(r.prototype,ft.prototype,{hasObservers:function(){return 0<this.observers.length},onCompleted:function(){if(qe(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=i(this.observers),r=t.length;e<r;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(qe(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,r=i(this.observers),n=r.length;t<n;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){if(qe(this),!this.isStopped)for(var t=0,r=i(this.observers),n=r.length;t<n;t++)r[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(e,t){return new gr(e,t)},r}(bt),gr=(F.AsyncSubject=function(e){function t(e){return qe(this),this.isStopped?(this.hasError?e.onError(this.error):(this.hasValue&&e.onNext(this.value),e.onCompleted()),Ve):(this.observers.push(e),new mr(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Ne(r,e),Ie(r.prototype,ft,{hasObservers:function(){return qe(this),0<this.observers.length},onCompleted:function(){var e;if(qe(this),!this.isStopped){this.isStopped=!0;var t=i(this.observers),r=t.length;if(this.hasValue)for(e=0;e<r;e++){var n=t[e];n.onNext(this.value),n.onCompleted()}else for(e=0;e<r;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(qe(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,r=i(this.observers),n=r.length;t<n;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){qe(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(bt),F.AnonymousSubject=function(r){function n(e){return this.observable.subscribe(e)}function e(e,t){this.observer=e,this.observable=t,r.call(this,n)}return Ne(e,r),Ie(e.prototype,ft.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),e}(bt));N&&I?D?(I.exports=F).Rx=F:N.Rx=F:L.Rx=F;var yr=e()}).call(this)}).call(this,e(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(i,o,e){(function(e){var t,r=void 0!==e?e:"undefined"!=typeof window?window:{},n=i("min-document");"undefined"!=typeof document?t=document:(t=r["__GLOBAL_DOCUMENT_CACHE@4"])||(t=r["__GLOBAL_DOCUMENT_CACHE@4"]=n),o.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":4}],17:[function(e,t,r){r.read=function(e,t,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=e[t+l];for(l+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;0<h;o=256*o+e[t+l],l+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;0<h;s=256*s+e[t+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(e,t,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=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),2<=(t+=1<=s+l?p/c:p*Math.pow(2,1-l))*c&&(s++,c/=2),h<=s+l?(a=0,s=h):1<=s+l?(a=(t*c-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));8<=i;e[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;0<u;e[r+f]=255&s,f+=d,s/=256,u-=8);e[r+f-d]|=128*m}},{}],18:[function(e,t,r){(function(e){"use strict";var r="undefined"!=typeof window?window:void 0!==e?e:{};t.exports=function(e,t){if(e in r)return r[e];return r[e]=t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,r){"use strict";var o=e("./index.js");t.exports=function(e,t,r){var n="__INDIVIDUAL_ONE_VERSION_"+e,i=o(n+"_ENFORCE_SINGLETON",t);if(i===t)return o(n,r);throw new Error("Can only have one copy of "+e+".\nYou already have version "+i+" installed.\nThis means you cannot install version "+t)}},{"./index.js":18}],20:[function(e,t,r){"use strict";t.exports=function(e){return"object"==typeof e&&null!==e}},{}],21:[function(e,t,r){"use strict";var v={base32:"0123456789bcdefghjkmnpqrstuvwxyz",encode:function(e,t,r){if(void 0===r){for(var n=1;n<=12;n++){var i=v.encode(e,t,n),o=v.decode(i);if(o.lat==e&&o.lon==t)return i}r=12}if(e=Number(e),t=Number(t),r=Number(r),isNaN(e)||isNaN(t)||isNaN(r))throw new Error("Invalid geohash");for(var s=0,a=0,c=!0,u="",h=-90,l=90,p=-180,f=180;u.length<r;){if(c){var d=(p+f)/2;d<=t?(s=2*s+1,p=d):(s*=2,f=d)}else{var m=(h+l)/2;m<=e?(s=2*s+1,h=m):(s*=2,l=m)}c=!c,5==++a&&(u+=v.base32.charAt(s),s=a=0)}return u},decode:function(e){var t=v.bounds(e),r=t.sw.lat,n=t.sw.lon,i=t.ne.lat,o=t.ne.lon,s=(r+i)/2,a=(n+o)/2;return s=s.toFixed(Math.floor(2-Math.log(i-r)/Math.LN10)),a=a.toFixed(Math.floor(2-Math.log(o-n)/Math.LN10)),{lat:Number(s),lon:Number(a)}},bounds:function(e){if(0===e.length)throw new Error("Invalid geohash");e=e.toLowerCase();for(var t=!0,r=-90,n=90,i=-180,o=180,s=0;s<e.length;s++){var a=e.charAt(s),c=v.base32.indexOf(a);if(-1==c)throw new Error("Invalid geohash");for(var u=4;0<=u;u--){var h=c>>u&1;if(t){var l=(i+o)/2;1==h?i=l:o=l}else{var p=(r+n)/2;1==h?r=p:n=p}t=!t}}return{sw:{lat:r,lon:i},ne:{lat:n,lon:o}}},adjacent:function(e,t){if(e=e.toLowerCase(),t=t.toLowerCase(),0===e.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(t))throw new Error("Invalid direction");var r=e.slice(-1),n=e.slice(0,-1),i=e.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[t][i].indexOf(r)&&""!==n&&(n=v.adjacent(n,t)),n+v.base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[t][i].indexOf(r))},neighbours:function(e){return{n:v.adjacent(e,"n"),ne:v.adjacent(v.adjacent(e,"n"),"e"),e:v.adjacent(e,"e"),se:v.adjacent(v.adjacent(e,"s"),"e"),s:v.adjacent(e,"s"),sw:v.adjacent(v.adjacent(e,"s"),"w"),w:v.adjacent(e,"w"),nw:v.adjacent(v.adjacent(e,"n"),"w")}}};void 0!==t&&t.exports&&(t.exports=v)},{}],22:[function(e,t,u){(function(i){function o(e,t){for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return t.exec(e).slice(1)};function a(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}u.resolve=function(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){var n=0<=r?arguments[r]:i.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return(t?"/":"")+(e=o(a(e.split("/"),function(e){return!!e}),!t).join("/"))||"."},u.normalize=function(e){var t=u.isAbsolute(e),r="/"===n(e,-1);return(e=o(a(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},u.isAbsolute=function(e){return"/"===e.charAt(0)},u.join=function(){var e=Array.prototype.slice.call(arguments,0);return u.normalize(a(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},u.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;0<=r&&""===e[r];r--);return r<t?[]:e.slice(t,r-t+1)}e=u.resolve(e).substr(1),t=u.resolve(t).substr(1);for(var n=r(e.split("/")),i=r(t.split("/")),o=Math.min(n.length,i.length),s=o,a=0;a<o;a++)if(n[a]!==i[a]){s=a;break}var c=[];for(a=s;a<n.length;a++)c.push("..");return(c=c.concat(i.slice(s))).join("/")},u.sep="/",u.delimiter=":",u.dirname=function(e){var t=s(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},u.basename=function(e,t){var r=s(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},u.extname=function(e){return s(e)[3]};var n="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,e("_process"))},{_process:6}],23:[function(e,t,r){"use strict";t.exports=i;var n=e("ieee754");function i(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var o=4294967296,s=1/o;function a(e){return e.type===i.Bytes?e.readVarint()+e.pos:e.pos+1}function c(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function u(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;e<=i;i--)r.buf[i+n]=r.buf[i]}function h(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function l(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function p(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function f(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function d(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function m(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function v(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function g(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function y(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function _(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function b(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function x(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}i.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=7&n,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=_(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=x(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=_(this.buf,this.pos)+_(this.buf,this.pos+4)*o;return this.pos+=8,e},readSFixed64:function(){var e=_(this.buf,this.pos)+x(this.buf,this.pos+4)*o;return this.pos+=8,e},readFloat:function(){var e=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,r,n=this.buf;return t=127&(r=n[this.pos++]),r<128?t:(t|=(127&(r=n[this.pos++]))<<7,r<128?t:(t|=(127&(r=n[this.pos++]))<<14,r<128?t:(t|=(127&(r=n[this.pos++]))<<21,r<128?t:function(e,t,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return c(e,n,t);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return c(e,n,t);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return c(e,n,t);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return c(e,n,t);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return c(e,n,t);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return c(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=n[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,r){var n="",i=t;for(;i<r;){var o,s,a,c=e[i],u=null,h=239<c?4:223<c?3:191<c?2:1;if(r<i+h)break;1===h?c<128&&(u=c):2===h?128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)<=127&&(u=null):3===h?(o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&((u=(15&c)<<12|(63&o)<<6|63&s)<=2047||55296<=u&&u<=57343)&&(u=null)):4===h&&(o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||1114112<=u)&&(u=null)),null===u?(u=65533,h=1):65535<u&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=h}return n}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=a(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===i.Varint)for(;127<this.buf[this.pos++];);else if(t===i.Bytes)this.pos=this.readVarint()+this.pos;else if(t===i.Fixed32)this.pos+=4;else{if(t!==i.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),b(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),b(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),b(this.buf,-1&e,this.pos),b(this.buf,Math.floor(e*s),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),b(this.buf,-1&e,this.pos),b(this.buf,Math.floor(e*s),this.pos+4),this.pos+=8},writeVarint:function(e){268435455<(e=+e||0)||e<0?function(e,t){var r,n;0<=e?(r=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:n=n+1|(r=0));if(0x10000000000000000<=e||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),i=r,o=t,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos++]=127&i|128,i>>>=7,o.buf[o.pos]=127&i,function(e,t){var r=(7&e)<<4;if(t.buf[t.pos++]|=r|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e}(n,t);var i,o}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(127<e?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(127<e?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(127<e?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,r){for(var n,i,o=0;o<t.length;o++){if(55295<(n=t.charCodeAt(o))&&n<57344){if(!i){56319<n||o+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=n;continue}if(n<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);e[r++]=n<128?n:(e[r++]=n<2048?n>>6|192:(e[r++]=n<65536?n>>12|224:(e[r++]=n>>18|240,n>>12&63|128),n>>6&63|128),63&n|128)}return r}(this.buf,e,this.pos);var r=this.pos-t;128<=r&&u(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),n.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),n.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;128<=n&&u(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,i.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){this.writeMessage(e,h,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,d,t)},writePackedFloat:function(e,t){this.writeMessage(e,p,t)},writePackedDouble:function(e,t){this.writeMessage(e,f,t)},writePackedFixed32:function(e,t){this.writeMessage(e,m,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,v,t)},writePackedFixed64:function(e,t){this.writeMessage(e,g,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,y,t)},writeBytesField:function(e,t){this.writeTag(e,i.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,i.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,i.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,i.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,i.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,i.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,i.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,i.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,i.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,i.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}}},{ieee754:17}],24:[function(e,t,r){var n,i;n=this,i=function(){"use strict";function v(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function o(e,t){return e<t?-1:t<e?1:0}return function(e,t,r,n,i){!function e(t,r,n,i,o){for(;n<i;){if(600<i-n){var s=i-n+1,a=r-n+1,c=Math.log(s),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(s-u)/s)*(a-s/2<0?-1:1),l=Math.max(n,Math.floor(r-a*u/s+h)),p=Math.min(i,Math.floor(r+(s-a)*u/s+h));e(t,r,l,p,o)}var f=t[r],d=n,m=i;for(v(t,n,r),0<o(t[i],f)&&v(t,n,i);d<m;){for(v(t,d,m),d++,m--;o(t[d],f)<0;)d++;for(;0<o(t[m],f);)m--}0===o(t[n],f)?v(t,n,m):v(t,++m,i),m<=r&&(n=m+1),r<=m&&(i=m-1)}}(e,t,r||0,n||e.length-1,i||o)}},"object"==typeof r&&void 0!==t?t.exports=i():n.quickselect=i()},{}],25:[function(e,t,r){"use strict";t.exports=n,t.exports.default=n;var a=e("quickselect");function n(e,t){if(!(this instanceof n))return new n(e,t);this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&this._initFormat(t),this.clear()}function h(e,t,r){if(!r)return t.indexOf(e);for(var n=0;n<t.length;n++)if(r(e,t[n]))return n;return-1}function f(e,t){g(e,0,e.children.length,t,e)}function g(e,t,r,n,i){i||(i=m(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=t;s<r;s++)o=e.children[s],l(i,e.leaf?n(o):o);return i}function l(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function o(e,t){return e.minX-t.minX}function s(e,t){return e.minY-t.minY}function y(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function p(e){return e.maxX-e.minX+(e.maxY-e.minY)}function d(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function u(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function m(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(e,t,r,n,i){for(var o,s=[t,r];s.length;)(r=s.pop())-(t=s.pop())<=n||(o=t+Math.ceil((r-t)/n/2)*n,a(e,o,t,r,i),s.push(t,o,o,r))}n.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,r=[],n=this.toBBox;if(!u(e,t))return r;for(var i,o,s,a,c=[];t;){for(i=0,o=t.children.length;i<o;i++)s=t.children[i],u(e,a=t.leaf?n(s):s)&&(t.leaf?r.push(s):d(e,a)?this._all(s,r):c.push(s));t=c.pop()}return r},collides:function(e){var t=this.data,r=this.toBBox;if(!u(e,t))return!1;for(var n,i,o,s,a=[];t;){for(n=0,i=t.children.length;n<i;n++)if(o=t.children[n],u(e,s=t.leaf?r(o):o)){if(t.leaf||d(e,s))return!0;a.push(o)}t=a.pop()}return!1},load:function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0,r=e.length;t<r;t++)this.insert(e[t]);return this}var n=this._build(e.slice(),0,e.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(e){return e&&this._insert(e,this.data.height-1),this},clear:function(){return this.data=m([]),this},remove:function(e,t){if(!e)return this;for(var r,n,i,o,s=this.data,a=this.toBBox(e),c=[],u=[];s||c.length;){if(s||(s=c.pop(),n=c[c.length-1],r=u.pop(),o=!0),s.leaf&&-1!==(i=h(e,s.children,t)))return s.children.splice(i,1),c.push(s),this._condense(c),this;o||s.leaf||!d(s,a)?n?(r++,s=n.children[r],o=!1):s=null:(c.push(s),u.push(r),r=0,s=(n=s).children[0])}return this},toBBox:function(e){return e},compareMinX:o,compareMinY:s,toJSON:function(){return this.data},fromJSON:function(e){return this.data=e,this},_all:function(e,t){for(var r=[];e;)e.leaf?t.push.apply(t,e.children):r.push.apply(r,e.children),e=r.pop();return t},_build:function(e,t,r,n){var i,o=r-t+1,s=this._maxEntries;if(o<=s)return f(i=m(e.slice(t,r+1)),this.toBBox),i;n||(n=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,n-1))),(i=m([])).leaf=!1,i.height=n;var a,c,u,h,l=Math.ceil(o/s),p=l*Math.ceil(Math.sqrt(s));for(v(e,t,r,p,this.compareMinX),a=t;a<=r;a+=p)for(v(e,a,u=Math.min(a+p-1,r),l,this.compareMinY),c=a;c<=u;c+=l)h=Math.min(c+l-1,u),i.children.push(this._build(e,c,h,n-1));return f(i,this.toBBox),i},_chooseSubtree:function(e,t,r,n){for(var i,o,s,a,c,u,h,l,p,f;n.push(t),!t.leaf&&n.length-1!==r;){for(h=l=1/0,i=0,o=t.children.length;i<o;i++)c=y(s=t.children[i]),p=e,f=s,(u=(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-c)<l?(l=u,h=c<h?c:h,a=s):u===l&&c<h&&(h=c,a=s);t=a||t.children[0]}return t},_insert:function(e,t,r){var n=this.toBBox,i=r?e:n(e),o=[],s=this._chooseSubtree(i,this.data,t,o);for(s.children.push(e),l(s,i);0<=t&&o[t].children.length>this._maxEntries;)this._split(o,t),t--;this._adjustParentBBoxes(i,o,t)},_split:function(e,t){var r=e[t],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var o=this._chooseSplitIndex(r,i,n),s=m(r.children.splice(o,r.children.length-o));s.height=r.height,s.leaf=r.leaf,f(r,this.toBBox),f(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)},_splitRoot:function(e,t){this.data=m([e,t]),this.data.height=e.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,r){var n,i,o,s,a,c,u,h,l,p,f,d,m,v;for(c=u=1/0,n=t;n<=r-t;n++)i=g(e,0,n,this.toBBox),o=g(e,n,r,this.toBBox),l=i,p=o,void 0,f=Math.max(l.minX,p.minX),d=Math.max(l.minY,p.minY),m=Math.min(l.maxX,p.maxX),v=Math.min(l.maxY,p.maxY),s=Math.max(0,m-f)*Math.max(0,v-d),a=y(i)+y(o),s<c?(c=s,h=n,u=a<u?a:u):s===c&&a<u&&(u=a,h=n);return h},_chooseSplitAxis:function(e,t,r){var n=e.leaf?this.compareMinX:o,i=e.leaf?this.compareMinY:s;this._allDistMargin(e,t,r,n)<this._allDistMargin(e,t,r,i)&&e.children.sort(n)},_allDistMargin:function(e,t,r,n){e.children.sort(n);var i,o,s=this.toBBox,a=g(e,0,t,s),c=g(e,r-t,r,s),u=p(a)+p(c);for(i=t;i<r-t;i++)o=e.children[i],l(a,e.leaf?s(o):o),u+=p(a);for(i=r-t-1;t<=i;i--)o=e.children[i],l(c,e.leaf?s(o):o),u+=p(c);return u},_adjustParentBBoxes:function(e,t,r){for(var n=r;0<=n;n--)l(t[n],e)},_condense:function(e){for(var t,r=e.length-1;0<=r;r--)0===e[r].children.length?0<r?(t=e[r-1].children).splice(t.indexOf(e[r]),1):this.clear():f(e[r],this.toBBox)},_initFormat:function(e){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this.toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}}},{quickselect:24}],26:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./internal/Observable");r.Observable=n.Observable;var i=e("./internal/observable/ConnectableObservable");r.ConnectableObservable=i.ConnectableObservable;var o=e("./internal/operators/groupBy");r.GroupedObservable=o.GroupedObservable;var s=e("./internal/symbol/observable");r.observable=s.observable;var a=e("./internal/Subject");r.Subject=a.Subject;var c=e("./internal/BehaviorSubject");r.BehaviorSubject=c.BehaviorSubject;var u=e("./internal/ReplaySubject");r.ReplaySubject=u.ReplaySubject;var h=e("./internal/AsyncSubject");r.AsyncSubject=h.AsyncSubject;var l=e("./internal/scheduler/asap");r.asapScheduler=l.asap;var p=e("./internal/scheduler/async");r.asyncScheduler=p.async;var f=e("./internal/scheduler/queue");r.queueScheduler=f.queue;var d=e("./internal/scheduler/animationFrame");r.animationFrameScheduler=d.animationFrame;var m=e("./internal/scheduler/VirtualTimeScheduler");r.VirtualTimeScheduler=m.VirtualTimeScheduler,r.VirtualAction=m.VirtualAction;var v=e("./internal/Scheduler");r.Scheduler=v.Scheduler;var g=e("./internal/Subscription");r.Subscription=g.Subscription;var y=e("./internal/Subscriber");r.Subscriber=y.Subscriber;var _=e("./internal/Notification");r.Notification=_.Notification;var b=e("./internal/util/pipe");r.pipe=b.pipe;var x=e("./internal/util/noop");r.noop=x.noop;var w=e("./internal/util/identity");r.identity=w.identity;var S=e("./internal/util/isObservable");r.isObservable=S.isObservable;var M=e("./internal/util/ArgumentOutOfRangeError");r.ArgumentOutOfRangeError=M.ArgumentOutOfRangeError;var C=e("./internal/util/EmptyError");r.EmptyError=C.EmptyError;var E=e("./internal/util/ObjectUnsubscribedError");r.ObjectUnsubscribedError=E.ObjectUnsubscribedError;var T=e("./internal/util/UnsubscriptionError");r.UnsubscriptionError=T.UnsubscriptionError;var O=e("./internal/util/TimeoutError");r.TimeoutError=O.TimeoutError;var P=e("./internal/observable/bindCallback");r.bindCallback=P.bindCallback;var A=e("./internal/observable/bindNodeCallback");r.bindNodeCallback=A.bindNodeCallback;var j=e("./internal/observable/combineLatest");r.combineLatest=j.combineLatest;var R=e("./internal/observable/concat");r.concat=R.concat;var L=e("./internal/observable/defer");r.defer=L.defer;var N=e("./internal/observable/empty");r.empty=N.empty;var I=e("./internal/observable/forkJoin");r.forkJoin=I.forkJoin;var D=e("./internal/observable/from");r.from=D.from;var k=e("./internal/observable/fromEvent");r.fromEvent=k.fromEvent;var B=e("./internal/observable/fromEventPattern");r.fromEventPattern=B.fromEventPattern;var F=e("./internal/observable/generate");r.generate=F.generate;var $=e("./internal/observable/iif");r.iif=$.iif;var U=e("./internal/observable/interval");r.interval=U.interval;var z=e("./internal/observable/merge");r.merge=z.merge;var G=e("./internal/observable/never");r.never=G.never;var V=e("./internal/observable/of");r.of=V.of;var H=e("./internal/observable/onErrorResumeNext");r.onErrorResumeNext=H.onErrorResumeNext;var q=e("./internal/observable/pairs");r.pairs=q.pairs;var W=e("./internal/observable/race");r.race=W.race;var X=e("./internal/observable/range");r.range=X.range;var Y=e("./internal/observable/throwError");r.throwError=Y.throwError;var K=e("./internal/observable/timer");r.timer=K.timer;var Z=e("./internal/observable/using");r.using=Z.using;var J=e("./internal/observable/zip");r.zip=J.zip;var Q=e("./internal/observable/empty");r.EMPTY=Q.EMPTY;var ee=e("./internal/observable/never");r.NEVER=ee.NEVER;var te=e("./internal/config");r.config=te.config},{"./internal/AsyncSubject":27,"./internal/BehaviorSubject":28,"./internal/Notification":30,"./internal/Observable":31,"./internal/ReplaySubject":34,"./internal/Scheduler":35,"./internal/Subject":36,"./internal/Subscriber":38,"./internal/Subscription":39,"./internal/config":40,"./internal/observable/ConnectableObservable":41,"./internal/observable/bindCallback":43,"./internal/observable/bindNodeCallback":44,"./internal/observable/combineLatest":45,"./internal/observable/concat":46,"./internal/observable/defer":47,"./internal/observable/empty":48,"./internal/observable/forkJoin":49,"./internal/observable/from":50,"./internal/observable/fromEvent":52,"./internal/observable/fromEventPattern":53,"./internal/observable/generate":57,"./internal/observable/iif":58,"./internal/observable/interval":59,"./internal/observable/merge":60,"./internal/observable/never":61,"./internal/observable/of":62,"./internal/observable/onErrorResumeNext":63,"./internal/observable/pairs":64,"./internal/observable/race":65,"./internal/observable/range":66,"./internal/observable/throwError":68,"./internal/observable/timer":69,"./internal/observable/using":70,"./internal/observable/zip":71,"./internal/operators/groupBy":107,"./internal/scheduler/VirtualTimeScheduler":184,"./internal/scheduler/animationFrame":185,"./internal/scheduler/asap":186,"./internal/scheduler/async":187,"./internal/scheduler/queue":188,"./internal/symbol/observable":190,"./internal/util/ArgumentOutOfRangeError":192,"./internal/util/EmptyError":193,"./internal/util/ObjectUnsubscribedError":195,"./internal/util/TimeoutError":196,"./internal/util/UnsubscriptionError":197,"./internal/util/identity":201,"./internal/util/isObservable":210,"./internal/util/noop":213,"./internal/util/pipe":215}],27:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("./Subject"),s=e("./Subscription"),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return i(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),s.Subscription.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),s.Subscription.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(o.Subject);r.AsyncSubject=a},{"./Subject":36,"./Subscription":39}],28:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("./Subject"),s=e("./util/ObjectUnsubscribedError"),a=function(r){function e(e){var t=r.call(this)||this;return t._value=e,t}return i(e,r),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var t=r.prototype._subscribe.call(this,e);return t&&!t.closed&&e.next(this._value),t},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new s.ObjectUnsubscribedError;return this._value},e.prototype.next=function(e){r.prototype.next.call(this,this._value=e)},e}(o.Subject);r.BehaviorSubject=a},{"./Subject":36,"./util/ObjectUnsubscribedError":195}],29:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=function(i){function e(e,t,r){var n=i.call(this)||this;return n.parent=e,n.outerValue=t,n.outerIndex=r,n.index=0,n}return o(e,i),e.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},e.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(e("./Subscriber").Subscriber);r.InnerSubscriber=i},{"./Subscriber":38}],30:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./observable/empty"),i=e("./observable/of"),o=e("./observable/throwError"),s=function(){function t(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return t.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},t.prototype.do=function(e,t,r){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return r&&r()}},t.prototype.accept=function(e,t,r){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,r)},t.prototype.toObservable=function(){switch(this.kind){case"N":return i.of(this.value);case"E":return o.throwError(this.error);case"C":return n.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){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=s},{"./observable/empty":48,"./observable/of":62,"./observable/throwError":68}],31:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./util/canReportError"),o=e("./util/toSubscriber"),i=e("../internal/symbol/observable"),s=e("./util/pipe"),a=e("./config"),c=function(){function r(e){this._isScalar=!1,e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,r){var n=this.operator,i=o.toSubscriber(e,t,r);if(n?n.call(i,this.source):i.add(this.source||a.config.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),a.config.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),n.canReportError(t)?t.error(e):console.warn(e)}},r.prototype.forEach=function(n,e){var i=this;return new(e=u(e))(function(e,t){var r;r=i.subscribe(function(e){try{n(e)}catch(e){t(e),r&&r.unsubscribe()}},t,e)})},r.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},r.prototype[i.observable]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:s.pipeFromArray(e)(this)},r.prototype.toPromise=function(e){var n=this;return new(e=u(e))(function(e,t){var r;n.subscribe(function(e){return r=e},function(e){return t(e)},function(){return e(r)})})},r.create=function(e){return new r(e)},r}();function u(e){if(e||(e=a.config.Promise||Promise),!e)throw new Error("no Promise impl found");return e}r.Observable=c},{"../internal/symbol/observable":190,"./config":40,"./util/canReportError":198,"./util/pipe":215,"./util/toSubscriber":222}],32:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./config"),i=e("./util/hostReportError");r.empty={closed:!0,next:function(e){},error:function(e){if(n.config.useDeprecatedSynchronousErrorHandling)throw e;i.hostReportError(e)},complete:function(){}}},{"./config":40,"./util/hostReportError":200}],33:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(e("./Subscriber").Subscriber);r.OuterSubscriber=o},{"./Subscriber":38}],34:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("./Subject"),s=e("./scheduler/queue"),a=e("./Subscription"),c=e("./operators/observeOn"),u=e("./util/ObjectUnsubscribedError"),h=e("./SubjectSubscription"),l=function(i){function e(e,t,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===t&&(t=Number.POSITIVE_INFINITY);var n=i.call(this)||this;return n.scheduler=r,n._events=[],n._infiniteTimeWindow=!1,n._bufferSize=e<1?1:e,n._windowTime=t<1?1:t,t===Number.POSITIVE_INFINITY?(n._infiniteTimeWindow=!0,n.next=n.nextInfiniteTimeWindow):n.next=n.nextTimeWindow,n}return o(e,i),e.prototype.nextInfiniteTimeWindow=function(e){var t=this._events;t.push(e),t.length>this._bufferSize&&t.shift(),i.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this._events.push(new p(this._getNow(),e)),this._trimBufferThenGetEvents(),i.prototype.next.call(this,e)},e.prototype._subscribe=function(e){var t,r=this._infiniteTimeWindow,n=r?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=n.length;if(this.closed)throw new u.ObjectUnsubscribedError;if(t=this.isStopped||this.hasError?a.Subscription.EMPTY:(this.observers.push(e),new h.SubjectSubscription(this,e)),i&&e.add(e=new c.ObserveOnSubscriber(e,i)),r)for(var s=0;s<o&&!e.closed;s++)e.next(n[s]);else for(s=0;s<o&&!e.closed;s++)e.next(n[s].value);return this.hasError?e.error(this.thrownError):this.isStopped&&e.complete(),t},e.prototype._getNow=function(){return(this.scheduler||s.queue).now()},e.prototype._trimBufferThenGetEvents=function(){for(var e=this._getNow(),t=this._bufferSize,r=this._windowTime,n=this._events,i=n.length,o=0;o<i&&!(e-n[o].time<r);)o++;return t<i&&(o=Math.max(o,i-t)),0<o&&n.splice(0,o),n},e}(i.Subject);r.ReplaySubject=l;var p=function(e,t){this.time=e,this.value=t}},{"./Subject":36,"./SubjectSubscription":37,"./Subscription":39,"./operators/observeOn":122,"./scheduler/queue":188,"./util/ObjectUnsubscribedError":195}],35:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function r(e,t){void 0===t&&(t=r.now),this.SchedulerAction=e,this.now=t}return r.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(r,t)},r.now=function(){return Date.now()},r}();r.Scheduler=n},{}],36:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("./Observable"),s=e("./Subscriber"),a=e("./Subscription"),c=e("./util/ObjectUnsubscribedError"),u=e("./SubjectSubscription"),h=e("../internal/symbol/rxSubscriber"),l=function(r){function e(e){var t=r.call(this,e)||this;return t.destination=e,t}return i(e,r),e}(s.Subscriber);r.SubjectSubscriber=l;var p=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return i(e,t),e.prototype[h.rxSubscriber]=function(){return new l(this)},e.prototype.lift=function(e){var t=new f(this,this);return t.operator=e,t},e.prototype.next=function(e){if(this.closed)throw new c.ObjectUnsubscribedError;if(!this.isStopped)for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].next(e)},e.prototype.error=function(e){if(this.closed)throw new c.ObjectUnsubscribedError;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].error(e);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new c.ObjectUnsubscribedError;this.isStopped=!0;for(var e=this.observers,t=e.length,r=e.slice(),n=0;n<t;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 c.ObjectUnsubscribedError;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(e){if(this.closed)throw new c.ObjectUnsubscribedError;return this.hasError?(e.error(this.thrownError),a.Subscription.EMPTY):this.isStopped?(e.complete(),a.Subscription.EMPTY):(this.observers.push(e),new u.SubjectSubscription(this,e))},e.prototype.asObservable=function(){var e=new o.Observable;return e.source=this,e},e.create=function(e,t){return new f(e,t)},e}(o.Observable),f=function(n){function e(e,t){var r=n.call(this)||this;return r.destination=e,r.source=t,r}return i(e,n),e.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},e.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},e.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},e.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):a.Subscription.EMPTY},e}(r.Subject=p);r.AnonymousSubject=f},{"../internal/symbol/rxSubscriber":191,"./Observable":31,"./SubjectSubscription":37,"./Subscriber":38,"./Subscription":39,"./util/ObjectUnsubscribedError":195}],37:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(n){function e(e,t){var r=n.call(this)||this;return r.subject=e,r.subscriber=t,r.closed=!1,r}return i(e,n),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var r=t.indexOf(this.subscriber);-1!==r&&t.splice(r,1)}}},e}(e("./Subscription").Subscription);r.SubjectSubscription=o},{"./Subscription":39}],38:[function(e,t,r){"use strict";var n,s=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var c=e("./util/isFunction"),u=e("./Observer"),i=e("./Subscription"),a=e("../internal/symbol/rxSubscriber"),o=e("./config"),h=e("./util/hostReportError"),l=function(i){function o(e,t,r){var n=i.call(this)||this;switch(n.syncErrorValue=null,n.syncErrorThrown=!1,n.syncErrorThrowable=!1,n.isStopped=!1,n._parentSubscription=null,arguments.length){case 0:n.destination=u.empty;break;case 1:if(!e){n.destination=u.empty;break}if("object"==typeof e){e instanceof o?(n.syncErrorThrowable=e.syncErrorThrowable,(n.destination=e).add(n)):(n.syncErrorThrowable=!0,n.destination=new p(n,e));break}default:n.syncErrorThrowable=!0,n.destination=new p(n,e,t,r)}return n}return s(o,i),o.prototype[a.rxSubscriber]=function(){return this},o.create=function(e,t,r){var n=new o(e,t,r);return n.syncErrorThrowable=!1,n},o.prototype.next=function(e){this.isStopped||this._next(e)},o.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},o.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},o.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this))},o.prototype._next=function(e){this.destination.next(e)},o.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},o.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},o.prototype._unsubscribeAndRecycle=function(){var e=this._parent,t=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=e,this._parents=t,this._parentSubscription=null,this},o}(i.Subscription),p=function(a){function e(e,t,r,n){var i,o=a.call(this)||this;o._parentSubscriber=e;var s=o;return c.isFunction(t)?i=t:t&&(i=t.next,r=t.error,n=t.complete,t!==u.empty&&(s=Object.create(t),c.isFunction(s.unsubscribe)&&o.add(s.unsubscribe.bind(s)),s.unsubscribe=o.unsubscribe.bind(o))),o._context=s,o._next=i,o._error=r,o._complete=n,o}return s(e,a),e.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;o.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},e.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,r=o.config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&t.syncErrorThrowable?this.__tryOrSetError(t,this._error,e):this.__tryOrUnsub(this._error,e),this.unsubscribe();else if(t.syncErrorThrowable)r?(t.syncErrorValue=e,t.syncErrorThrown=!0):h.hostReportError(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;h.hostReportError(e)}}},e.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};o.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,r):this.__tryOrUnsub(r),this.unsubscribe()}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),o.config.useDeprecatedSynchronousErrorHandling)throw e;h.hostReportError(e)}},e.prototype.__tryOrSetError=function(t,e,r){if(!o.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return o.config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0):(h.hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},e}(r.Subscriber=l);r.SafeSubscriber=p},{"../internal/symbol/rxSubscriber":191,"./Observer":32,"./Subscription":39,"./config":40,"./util/hostReportError":200,"./util/isFunction":205}],39:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var h=e("./util/isArray"),l=e("./util/isObject"),p=e("./util/isFunction"),f=e("./util/tryCatch"),d=e("./util/errorObject"),m=e("./util/UnsubscriptionError"),n=function(){function n(e){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,e&&(this._unsubscribe=e)}var e;return n.prototype.unsubscribe=function(){var e,t=!1;if(!this.closed){var r=this._parent,n=this._parents,i=this._unsubscribe,o=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var s=-1,a=n?n.length:0;r;)r.remove(this),r=++s<a&&n[s]||null;if(p.isFunction(i))f.tryCatch(i).call(this)===d.errorObject&&(t=!0,e=e||(d.errorObject.e instanceof m.UnsubscriptionError?v(d.errorObject.e.errors):[d.errorObject.e]));if(h.isArray(o))for(s=-1,a=o.length;++s<a;){var c=o[s];if(l.isObject(c))if(f.tryCatch(c.unsubscribe).call(c)===d.errorObject){t=!0,e=e||[];var u=d.errorObject.e;u instanceof m.UnsubscriptionError?e=e.concat(v(u.errors)):e.push(u)}}if(t)throw new m.UnsubscriptionError(e)}},n.prototype.add=function(e){if(!e||e===n.EMPTY)return n.EMPTY;if(e===this)return this;var t=e;switch(typeof e){case"function":t=new n(e);case"object":if(t.closed||"function"!=typeof t.unsubscribe)return t;if(this.closed)return t.unsubscribe(),t;if("function"!=typeof t._addParent){var r=t;(t=new n)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return(this._subscriptions||(this._subscriptions=[])).push(t),t._addParent(this),t},n.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}},n.prototype._addParent=function(e){var t=this._parent,r=this._parents;t&&t!==e?r?-1===r.indexOf(e)&&r.push(e):this._parents=[e]:this._parent=e},n.EMPTY=((e=new n).closed=!0,e),n}();function v(e){return e.reduce(function(e,t){return e.concat(t instanceof m.UnsubscriptionError?t.errors:t)},[])}r.Subscription=n},{"./util/UnsubscriptionError":197,"./util/errorObject":199,"./util/isArray":202,"./util/isFunction":205,"./util/isObject":209,"./util/tryCatch":223}],40:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1;r.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){if(e){var t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else n&&console.log("RxJS: Back to a better error behavior. Thank you. <3");n=e},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],41:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subject"),s=e("../Observable"),a=e("../Subscriber"),c=e("../Subscription"),u=e("../operators/refCount"),h=function(n){function e(e,t){var r=n.call(this)||this;return r.source=e,r.subjectFactory=t,r._refCount=0,r._isComplete=!1,r}return i(e,n),e.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},e.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new c.Subscription).add(this.source.subscribe(new p(this.getSubject(),this))),e.closed?(this._connection=null,e=c.Subscription.EMPTY):this._connection=e),e},e.prototype.refCount=function(){return u.refCount()(this)},e}(s.Observable),l=(r.ConnectableObservable=h).prototype;r.connectableObservableDescriptor={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:l._subscribe},_isComplete:{value:l._isComplete,writable:!0},getSubject:{value:l.getSubject},connect:{value:l.connect},refCount:{value:l.refCount}};var p=function(n){function e(e,t){var r=n.call(this,e)||this;return r.connectable=t,r}return i(e,n),e.prototype._error=function(e){this._unsubscribe(),n.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),n.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._connection;e._refCount=0,e._subject=null,e._connection=null,t&&t.unsubscribe()}},e}(o.SubjectSubscriber),f=(function(){function e(e){this.connectable=e}e.prototype.call=function(e,t){var r=this.connectable;r._refCount++;var n=new f(e,r),i=t.subscribe(n);return n.closed||(n.connection=r.connect()),i}}(),function(n){function e(e,t){var r=n.call(this,e)||this;return r.connectable=t,r}return i(e,n),e.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,1<t)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},e}(a.Subscriber))},{"../Observable":31,"../Subject":36,"../Subscriber":38,"../Subscription":39,"../operators/refCount":133}],42:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Observable"),s=e("../scheduler/asap"),a=e("../util/isNumeric"),c=function(i){function n(e,t,r){void 0===t&&(t=0),void 0===r&&(r=s.asap);var n=i.call(this)||this;return n.source=e,n.delayTime=t,n.scheduler=r,(!a.isNumeric(t)||t<0)&&(n.delayTime=0),r&&"function"==typeof r.schedule||(n.scheduler=s.asap),n}return o(n,i),n.create=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=s.asap),new n(e,t,r)},n.dispatch=function(e){var t=e.source,r=e.subscriber;return this.add(t.subscribe(r))},n.prototype._subscribe=function(e){var t=this.delayTime,r=this.source;return this.scheduler.schedule(n.dispatch,t,{source:r,subscriber:e})},n}(i.Observable);r.SubscribeOnObservable=c},{"../Observable":31,"../scheduler/asap":186,"../util/isNumeric":208}],43:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var c=e("../Observable"),u=e("../AsyncSubject"),i=e("../operators/map"),h=e("../util/canReportError"),o=e("../util/isArray"),l=e("../util/isScheduler");function p(e){var n=this,t=e.args,r=e.subscriber,i=e.params,o=i.callbackFunc,s=i.context,a=i.scheduler,c=i.subject;if(!c){c=i.subject=new u.AsyncSubject;try{o.apply(s,t.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length<=1?e[0]:e;n.add(a.schedule(f,0,{value:r,subject:c}))}]))}catch(e){c.error(e)}}this.add(c.subscribe(r))}function f(e){var t=e.value,r=e.subject;r.next(t),r.complete()}r.bindCallback=function r(s,n,a){if(n){if(!l.isScheduler(n))return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r(s,a).apply(void 0,e).pipe(i.map(function(e){return o.isArray(e)?n.apply(void 0,e):n(e)}))};a=n}return function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var n,i=this,o={context:i,subject:n,callbackFunc:s,scheduler:a};return new c.Observable(function(e){if(a){var t={args:r,subscriber:e,params:o};return a.schedule(p,0,t)}if(!n){n=new u.AsyncSubject;try{s.apply(i,r.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n.next(e.length<=1?e[0]:e),n.complete()}]))}catch(e){h.canReportError(n)?n.error(e):console.warn(e)}}return n.subscribe(e)})}}},{"../AsyncSubject":27,"../Observable":31,"../operators/map":111,"../util/canReportError":198,"../util/isArray":202,"../util/isScheduler":212}],44:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("../Observable"),u=e("../AsyncSubject"),i=e("../operators/map"),c=e("../util/canReportError"),h=e("../util/isScheduler"),l=e("../util/isArray");function p(e){var i=this,t=e.params,r=e.subscriber,n=e.context,o=t.callbackFunc,s=t.args,a=t.scheduler,c=t.subject;if(!c){c=t.subject=new u.AsyncSubject;try{o.apply(n,s.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.shift();if(r)i.add(a.schedule(d,0,{err:r,subject:c}));else{var n=e.length<=1?e[0]:e;i.add(a.schedule(f,0,{value:n,subject:c}))}}]))}catch(e){this.add(a.schedule(d,0,{err:e,subject:c}))}}this.add(c.subscribe(r))}function f(e){var t=e.value,r=e.subject;r.next(t),r.complete()}function d(e){var t=e.err;e.subject.error(t)}r.bindNodeCallback=function r(o,n,s){if(n){if(!h.isScheduler(n))return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r(o,s).apply(void 0,e).pipe(i.map(function(e){return l.isArray(e)?n.apply(void 0,e):n(e)}))};s=n}return function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var i={subject:void 0,args:r,callbackFunc:o,scheduler:s,context:this};return new a.Observable(function(e){var t=i.context,n=i.subject;if(s)return s.schedule(p,0,{params:i,subscriber:e,context:t});if(!n){n=i.subject=new u.AsyncSubject;try{o.apply(t,r.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.shift();r?n.error(r):(n.next(e.length<=1?e[0]:e),n.complete())}]))}catch(e){c.canReportError(n)?n.error(e):console.warn(e)}}return n.subscribe(e)})}}},{"../AsyncSubject":27,"../Observable":31,"../operators/map":111,"../util/canReportError":198,"../util/isArray":202,"../util/isScheduler":212}],45:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../util/isScheduler"),s=e("../util/isArray"),a=e("../OuterSubscriber"),c=e("../util/subscribeToResult"),u=e("./fromArray"),h={};r.combineLatest=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=null,n=null;return o.isScheduler(e[e.length-1])&&(n=e.pop()),"function"==typeof e[e.length-1]&&(r=e.pop()),1===e.length&&s.isArray(e[0])&&(e=e[0]),u.fromArray(e,n).lift(new l(r))};var l=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new p(e,this.resultSelector))},e}();r.CombineLatestOperator=l;var p=function(n){function e(e,t){var r=n.call(this,e)||this;return r.resultSelector=t,r.active=0,r.values=[],r.observables=[],r}return i(e,n),e.prototype._next=function(e){this.values.push(h),this.observables.push(e)},e.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var r=0;r<t;r++){var n=e[r];this.add(c.subscribeToResult(this,n,n,r))}}},e.prototype.notifyComplete=function(e){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(e,t,r,n,i){var o=this.values,s=o[r],a=this.toRespond?s===h?--this.toRespond:this.toRespond:0;o[r]=t,0===a&&(this.resultSelector?this._tryResultSelector(o):this.destination.next(o.slice()))},e.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},e}(a.OuterSubscriber);r.CombineLatestSubscriber=p},{"../OuterSubscriber":33,"../util/isArray":202,"../util/isScheduler":212,"../util/subscribeToResult":221,"./fromArray":51}],46:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../util/isScheduler"),i=e("./of"),o=e("./from"),s=e("../operators/concatAll");r.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===e.length||2===e.length&&n.isScheduler(e[1])?o.from(e[0]):s.concatAll()(i.of.apply(void 0,e))}},{"../operators/concatAll":83,"../util/isScheduler":212,"./from":50,"./of":62}],47:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),i=e("./from"),o=e("./empty");r.defer=function(r){return new n.Observable(function(t){var e;try{e=r()}catch(e){return void t.error(e)}return(e?i.from(e):o.empty()).subscribe(t)})}},{"../Observable":31,"./empty":48,"./from":50}],48:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable");function i(t){return new n.Observable(function(e){return t.schedule(function(){return e.complete()})})}r.EMPTY=new n.Observable(function(e){return e.complete()}),r.empty=function(e){return e?i(e):r.EMPTY},r.emptyScheduled=i},{"../Observable":31}],49:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../util/isArray"),a=e("./empty"),c=e("../util/subscribeToResult"),u=e("../OuterSubscriber"),h=e("../operators/map");r.forkJoin=function e(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return"function"==typeof r[r.length-1]&&(t=r.pop()),1===r.length&&s.isArray(r[0])&&(r=r[0]),0===r.length?a.EMPTY:t?e(r).pipe(h.map(function(e){return t.apply(void 0,e)})):new o.Observable(function(e){return new l(e,r)})};var l=function(a){function e(e,t){var r=a.call(this,e)||this;r.sources=t,r.completed=0,r.haveValues=0;var n=t.length;r.values=new Array(n);for(var i=0;i<n;i++){var o=t[i],s=c.subscribeToResult(r,o,null,i);s&&r.add(s)}return r}return i(e,a),e.prototype.notifyNext=function(e,t,r,n,i){this.values[r]=t,i._hasValue||(i._hasValue=!0,this.haveValues++)},e.prototype.notifyComplete=function(e){var t=this.destination,r=this.haveValues,n=this.values,i=n.length;e._hasValue?(this.completed++,this.completed===i&&(r===i&&t.next(n),t.complete())):t.complete()},e}(u.OuterSubscriber)},{"../Observable":31,"../OuterSubscriber":33,"../operators/map":111,"../util/isArray":202,"../util/subscribeToResult":221,"./empty":48}],50:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),i=e("../util/isPromise"),o=e("../util/isArrayLike"),s=e("../util/isInteropObservable"),a=e("../util/isIterable"),c=e("./fromArray"),u=e("./fromPromise"),h=e("./fromIterable"),l=e("./fromObservable"),p=e("../util/subscribeTo");r.from=function(e,t){if(!t)return e instanceof n.Observable?e:new n.Observable(p.subscribeTo(e));if(null!=e){if(s.isInteropObservable(e))return l.fromObservable(e,t);if(i.isPromise(e))return u.fromPromise(e,t);if(o.isArrayLike(e))return c.fromArray(e,t);if(a.isIterable(e)||"string"==typeof e)return h.fromIterable(e,t)}throw new TypeError((null!==e&&typeof e||e)+" is not observable")}},{"../Observable":31,"../util/isArrayLike":203,"../util/isInteropObservable":206,"../util/isIterable":207,"../util/isPromise":211,"../util/subscribeTo":216,"./fromArray":51,"./fromIterable":54,"./fromObservable":55,"./fromPromise":56}],51:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../Subscription"),a=e("../util/subscribeToArray");r.fromArray=function(n,i){return i?new o.Observable(function(e){var t=new s.Subscription,r=0;return t.add(i.schedule(function(){r!==n.length?(e.next(n[r++]),e.closed||t.add(this.schedule())):e.complete()})),t}):new o.Observable(a.subscribeToArray(n))}},{"../Observable":31,"../Subscription":39,"../util/subscribeToArray":217}],52:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../util/isArray"),a=e("../util/isFunction"),c=e("../operators/map");Object.prototype.toString;r.fromEvent=function e(r,n,i,t){return a.isFunction(i)&&(t=i,i=void 0),t?e(r,n,i).pipe(c.map(function(e){return s.isArray(e)?t.apply(void 0,e):t(e)})):new o.Observable(function(t){!function e(t,r,n,i,o){var s,a,c,u;if((u=t)&&"function"==typeof u.addEventListener&&"function"==typeof u.removeEventListener){var h=t;t.addEventListener(r,n,o),s=function(){return h.removeEventListener(r,n,o)}}else if((c=t)&&"function"==typeof c.on&&"function"==typeof c.off){var l=t;t.on(r,n),s=function(){return l.off(r,n)}}else if((a=t)&&"function"==typeof a.addListener&&"function"==typeof a.removeListener){var p=t;t.addListener(r,n),s=function(){return p.removeListener(r,n)}}else{if(!t||!t.length)throw new TypeError("Invalid event target");for(var f=0,d=t.length;f<d;f++)e(t[f],r,n,i,o)}i.add(s)}(r,n,function(e){1<arguments.length?t.next(Array.prototype.slice.call(arguments)):t.next(e)},t,i)})}},{"../Observable":31,"../operators/map":111,"../util/isArray":202,"../util/isFunction":205}],53:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../util/isArray"),a=e("../util/isFunction"),c=e("../operators/map");r.fromEventPattern=function e(n,i,t){return t?e(n,i).pipe(c.map(function(e){return s.isArray(e)?t.apply(void 0,e):t(e)})):new o.Observable(function(r){var e,t=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.next(1===e.length?e[0]:e)};try{e=n(t)}catch(e){return void r.error(e)}if(a.isFunction(i))return function(){return i(t,e)}})}},{"../Observable":31,"../operators/map":111,"../util/isArray":202,"../util/isFunction":205}],54:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),o=e("../Subscription"),s=e("../symbol/iterator"),i=e("../util/subscribeToIterable");r.fromIterable=function(t,r){if(!t)throw new Error("Iterable cannot be null");return r?new n.Observable(function(n){var i,e=new o.Subscription;return e.add(function(){i&&"function"==typeof i.return&&i.return()}),e.add(r.schedule(function(){i=t[s.iterator](),e.add(r.schedule(function(){if(!n.closed){var e,t;try{var r=i.next();e=r.value,t=r.done}catch(e){return void n.error(e)}t?n.complete():(n.next(e),this.schedule())}}))})),e}):new n.Observable(i.subscribeToIterable(t))}},{"../Observable":31,"../Subscription":39,"../symbol/iterator":189,"../util/subscribeToIterable":218}],55:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../Subscription"),a=e("../symbol/observable"),c=e("../util/subscribeToObservable");r.fromObservable=function(n,i){return i?new o.Observable(function(t){var r=new s.Subscription;return r.add(i.schedule(function(){var e=n[a.observable]();r.add(e.subscribe({next:function(e){r.add(i.schedule(function(){return t.next(e)}))},error:function(e){r.add(i.schedule(function(){return t.error(e)}))},complete:function(){r.add(i.schedule(function(){return t.complete()}))}}))})),r}):new o.Observable(c.subscribeToObservable(n))}},{"../Observable":31,"../Subscription":39,"../symbol/observable":190,"../util/subscribeToObservable":219}],56:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Observable"),o=e("../Subscription"),s=e("../util/subscribeToPromise");r.fromPromise=function(e,n){return n?new i.Observable(function(t){var r=new o.Subscription;return r.add(n.schedule(function(){return e.then(function(e){r.add(n.schedule(function(){t.next(e),r.add(n.schedule(function(){return t.complete()}))}))},function(e){r.add(n.schedule(function(){return t.error(e)}))})})),r}):new i.Observable(s.subscribeToPromise(e))}},{"../Observable":31,"../Subscription":39,"../util/subscribeToPromise":220}],57:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),u=e("../util/identity"),h=e("../util/isScheduler");function l(e){var t=e.subscriber,r=e.condition;if(!t.closed){if(e.needIterate)try{e.state=e.iterate(e.state)}catch(e){return void t.error(e)}else e.needIterate=!0;if(r){var n=void 0;try{n=r(e.state)}catch(e){return void t.error(e)}if(!n)return void t.complete();if(t.closed)return}var i;try{i=e.resultSelector(e.state)}catch(e){return void t.error(e)}if(!t.closed&&(t.next(i),!t.closed))return this.schedule(e)}}r.generate=function(e,i,o,t,s){var a,c;if(1==arguments.length){var r=e;c=r.initialState,i=r.condition,o=r.iterate,a=r.resultSelector||u.identity,s=r.scheduler}else void 0===t||h.isScheduler(t)?(c=e,a=u.identity,s=t):(c=e,a=t);return new n.Observable(function(t){var e=c;if(s)return s.schedule(l,0,{subscriber:t,iterate:o,condition:i,resultSelector:a,state:e});for(;;){if(i){var r=void 0;try{r=i(e)}catch(e){return void t.error(e)}if(!r){t.complete();break}}var n=void 0;try{n=a(e)}catch(e){return void t.error(e)}if(t.next(n),t.closed)break;try{e=o(e)}catch(e){return void t.error(e)}}})}},{"../Observable":31,"../util/identity":201,"../util/isScheduler":212}],58:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./defer"),i=e("./empty");r.iif=function(e,t,r){return void 0===t&&(t=i.EMPTY),void 0===r&&(r=i.EMPTY),n.defer(function(){return e()?t:r})}},{"./defer":47,"./empty":48}],59:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),i=e("../scheduler/async"),o=e("../util/isNumeric");function s(e){var t=e.subscriber,r=e.counter,n=e.period;t.next(r),this.schedule({subscriber:t,counter:r+1,period:n},n)}r.interval=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=i.async),(!o.isNumeric(t)||t<0)&&(t=0),r&&"function"==typeof r.schedule||(r=i.async),new n.Observable(function(e){return e.add(r.schedule(s,t,{subscriber:e,counter:0,period:t})),e})}},{"../Observable":31,"../scheduler/async":187,"../util/isNumeric":208}],60:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../util/isScheduler"),a=e("../operators/mergeAll"),c=e("./fromArray");r.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Number.POSITIVE_INFINITY,n=null,i=e[e.length-1];return s.isScheduler(i)?(n=e.pop(),1<e.length&&"number"==typeof e[e.length-1]&&(r=e.pop())):"number"==typeof i&&(r=e.pop()),null===n&&1===e.length&&e[0]instanceof o.Observable?e[0]:a.mergeAll(r)(c.fromArray(e,n))}},{"../Observable":31,"../operators/mergeAll":116,"../util/isScheduler":212,"./fromArray":51}],61:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),i=e("../util/noop");r.NEVER=new n.Observable(i.noop),r.never=function(){return r.NEVER}},{"../Observable":31,"../util/noop":213}],62:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../util/isScheduler"),i=e("./fromArray"),o=e("./empty"),s=e("./scalar");r.of=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[e.length-1];switch(n.isScheduler(r)?e.pop():r=void 0,e.length){case 0:return o.empty(r);case 1:return r?i.fromArray(e,r):s.scalar(e[0]);default:return i.fromArray(e,r)}}},{"../util/isScheduler":212,"./empty":48,"./fromArray":51,"./scalar":67}],63:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("./from"),a=e("../util/isArray"),c=e("./empty");r.onErrorResumeNext=function r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)return c.EMPTY;var n=e[0],i=e.slice(1);return 1===e.length&&a.isArray(n)?r.apply(void 0,n):new o.Observable(function(t){var e=function(){return t.add(r.apply(void 0,i).subscribe(t))};return s.from(n).subscribe({next:function(e){t.next(e)},error:e,complete:e})})}},{"../Observable":31,"../util/isArray":202,"./empty":48,"./from":50}],64:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../Subscription");function a(e){var t=e.keys,r=e.index,n=e.subscriber,i=e.subscription,o=e.obj;if(!n.closed)if(r<t.length){var s=t[r];n.next([s,o[s]]),i.add(this.schedule({keys:t,index:r+1,subscriber:n,subscription:i,obj:o}))}else n.complete()}r.pairs=function(i,n){return n?new o.Observable(function(e){var t=Object.keys(i),r=new s.Subscription;return r.add(n.schedule(a,0,{keys:t,index:0,subscriber:e,subscription:r,obj:i})),r}):new o.Observable(function(e){for(var t=Object.keys(i),r=0;r<t.length&&!e.closed;r++){var n=t[r];i.hasOwnProperty(n)&&e.next([n,i[n]])}e.complete()})},r.dispatch=a},{"../Observable":31,"../Subscription":39}],65:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../util/isArray"),s=e("./fromArray"),a=e("../OuterSubscriber"),c=e("../util/subscribeToResult");r.race=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){if(!o.isArray(e[0]))return e[0];e=e[0]}return s.fromArray(e,void 0).lift(new u)};var u=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new h(e))},e}();r.RaceOperator=u;var h=function(r){function e(e){var t=r.call(this,e)||this;return t.hasFirst=!1,t.observables=[],t.subscriptions=[],t}return i(e,r),e.prototype._next=function(e){this.observables.push(e)},e.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{for(var r=0;r<t&&!this.hasFirst;r++){var n=e[r],i=c.subscribeToResult(this,n,n,r);this.subscriptions&&this.subscriptions.push(i),this.add(i)}this.observables=null}},e.prototype.notifyNext=function(e,t,r,n,i){if(!this.hasFirst){this.hasFirst=!0;for(var o=0;o<this.subscriptions.length;o++)if(o!==r){var s=this.subscriptions[o];s.unsubscribe(),this.remove(s)}this.subscriptions=null}this.destination.next(t)},e}(a.OuterSubscriber);r.RaceSubscriber=h},{"../OuterSubscriber":33,"../util/isArray":202,"../util/subscribeToResult":221,"./fromArray":51}],66:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s=e("../Observable");function a(e){var t=e.start,r=e.index,n=e.count,i=e.subscriber;n<=r?i.complete():(i.next(t),i.closed||(e.index=r+1,e.start=t+1,this.schedule(e)))}r.range=function(n,i,o){return void 0===n&&(n=0),void 0===i&&(i=0),new s.Observable(function(e){var t=0,r=n;if(o)return o.schedule(a,0,{index:t,count:i,start:n,subscriber:e});for(;;){if(t++>=i){e.complete();break}if(e.next(r++),e.closed)break}})},r.dispatch=a},{"../Observable":31}],67:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable");r.scalar=function(t){var e=new n.Observable(function(e){e.next(t),e.complete()});return e._isScalar=!0,e.value=t,e}},{"../Observable":31}],68:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable");function i(e){var t=e.error;e.subscriber.error(t)}r.throwError=function(t,r){return r?new n.Observable(function(e){return r.schedule(i,0,{error:t,subscriber:e})}):new n.Observable(function(e){return e.error(t)})}},{"../Observable":31}],69:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Observable"),s=e("../scheduler/async"),a=e("../util/isNumeric"),c=e("../util/isScheduler");function u(e){var t=e.index,r=e.period,n=e.subscriber;if(n.next(t),!n.closed){if(-1===r)return n.complete();e.index=t+1,this.schedule(e,r)}}r.timer=function(r,e,n){void 0===r&&(r=0);var i=-1;return a.isNumeric(e)?i=Number(e)<1?1:Number(e):c.isScheduler(e)&&(n=e),c.isScheduler(n)||(n=s.async),new o.Observable(function(e){var t=a.isNumeric(r)?r:+r-n.now();return n.schedule(u,t,{index:0,period:i,subscriber:e})})}},{"../Observable":31,"../scheduler/async":187,"../util/isNumeric":208,"../util/isScheduler":212}],70:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),s=e("./from"),a=e("./empty");r.using=function(i,o){return new n.Observable(function(t){var e,r;try{e=i()}catch(e){return void t.error(e)}try{r=o(e)}catch(e){return void t.error(e)}var n=(r?s.from(r):a.EMPTY).subscribe(t);return function(){n.unsubscribe(),e&&e.unsubscribe()}})}},{"../Observable":31,"./empty":48,"./from":50}],71:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("./fromArray"),s=e("../util/isArray"),a=e("../Subscriber"),c=e("../OuterSubscriber"),u=e("../util/subscribeToResult"),h=e("../../internal/symbol/iterator");r.zip=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[e.length-1];return"function"==typeof r&&e.pop(),i.fromArray(e,void 0).lift(new l(r))};var l=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new p(e,this.resultSelector))},e}();r.ZipOperator=l;var p=function(i){function e(e,t,r){void 0===r&&(r=Object.create(null));var n=i.call(this,e)||this;return n.iterators=[],n.active=0,n.resultSelector="function"==typeof t?t:null,n.values=r,n}return o(e,i),e.prototype._next=function(e){var t=this.iterators;s.isArray(e)?t.push(new d(e)):"function"==typeof e[h.iterator]?t.push(new f(e[h.iterator]())):t.push(new m(this.destination,this,e))},e.prototype._complete=function(){var e=this.iterators,t=e.length;if(this.unsubscribe(),0!==t){this.active=t;for(var r=0;r<t;r++){var n=e[r];if(n.stillUnsubscribed)this.destination.add(n.subscribe(n,r));else this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var e=this.iterators,t=e.length,r=this.destination,n=0;n<t;n++){if("function"==typeof(s=e[n]).hasValue&&!s.hasValue())return}var i=!1,o=[];for(n=0;n<t;n++){var s,a=(s=e[n]).next();if(s.hasCompleted()&&(i=!0),a.done)return void r.complete();o.push(a.value)}this.resultSelector?this._tryresultSelector(o):r.next(o),i&&r.complete()},e.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},e}(a.Subscriber);r.ZipSubscriber=p;var f=function(){function e(e){this.iterator=e,this.nextResult=e.next()}return e.prototype.hasValue=function(){return!0},e.prototype.next=function(){var e=this.nextResult;return this.nextResult=this.iterator.next(),e},e.prototype.hasCompleted=function(){var e=this.nextResult;return e&&e.done},e}(),d=function(){function e(e){this.array=e,this.index=0,this.length=0,this.length=e.length}return e.prototype[h.iterator]=function(){return this},e.prototype.next=function(e){var t=this.index++,r=this.array;return t<this.length?{value:r[t],done:!1}:{value:null,done:!0}},e.prototype.hasValue=function(){return this.array.length>this.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),m=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.parent=t,n.observable=r,n.stillUnsubscribed=!0,n.buffer=[],n.isComplete=!1,n}return o(e,i),e.prototype[h.iterator]=function(){return this},e.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},e.prototype.hasValue=function(){return 0<this.buffer.length},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){0<this.buffer.length?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(e,t,r,n,i){this.buffer.push(t),this.parent.checkIterators()},e.prototype.subscribe=function(e,t){return u.subscribeToResult(this,this.observable,this,t)},e}(c.OuterSubscriber)},{"../../internal/symbol/iterator":189,"../OuterSubscriber":33,"../Subscriber":38,"../util/isArray":202,"../util/subscribeToResult":221,"./fromArray":51}],72:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../util/tryCatch"),s=e("../util/errorObject"),a=e("../OuterSubscriber"),c=e("../util/subscribeToResult");r.audit=function(t){return function(e){return e.lift(new u(t))}};var u=function(){function e(e){this.durationSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.durationSelector))},e}(),h=function(n){function e(e,t){var r=n.call(this,e)||this;return r.durationSelector=t,r.hasValue=!1,r}return i(e,n),e.prototype._next=function(e){if(this.value=e,this.hasValue=!0,!this.throttled){var t=o.tryCatch(this.durationSelector)(e);if(t===s.errorObject)this.destination.error(s.errorObject.e);else{var r=c.subscribeToResult(this,t);!r||r.closed?this.clearThrottle():this.add(this.throttled=r)}}},e.prototype.clearThrottle=function(){var e=this.value,t=this.hasValue,r=this.throttled;r&&(this.remove(r),this.throttled=null,r.unsubscribe()),t&&(this.value=null,this.hasValue=!1,this.destination.next(e))},e.prototype.notifyNext=function(e,t,r,n){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(a.OuterSubscriber)},{"../OuterSubscriber":33,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],73:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../scheduler/async"),i=e("./audit"),o=e("../observable/timer");r.auditTime=function(e,t){return void 0===t&&(t=n.async),i.audit(function(){return o.timer(e,t)})}},{"../observable/timer":69,"../scheduler/async":187,"./audit":72}],74:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.buffer=function(t){return function(e){return e.lift(new a(t))}};var a=function(){function e(e){this.closingNotifier=e}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.closingNotifier))},e}(),c=function(n){function e(e,t){var r=n.call(this,e)||this;return r.buffer=[],r.add(s.subscribeToResult(r,t)),r}return i(e,n),e.prototype._next=function(e){this.buffer.push(e)},e.prototype.notifyNext=function(e,t,r,n,i){var o=this.buffer;this.buffer=[],this.destination.next(o)},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],75:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.bufferCount=function(t,r){return void 0===r&&(r=null),function(e){return e.lift(new s(t,r))}};var s=function(){function e(e,t){this.bufferSize=e,this.startBufferEvery=t,this.subscriberClass=t&&e!==t?c:a}return e.prototype.call=function(e,t){return t.subscribe(new this.subscriberClass(e,this.bufferSize,this.startBufferEvery))},e}(),a=function(n){function e(e,t){var r=n.call(this,e)||this;return r.bufferSize=t,r.buffer=[],r}return o(e,n),e.prototype._next=function(e){var t=this.buffer;t.push(e),t.length==this.bufferSize&&(this.destination.next(t),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;0<e.length&&this.destination.next(e),n.prototype._complete.call(this)},e}(i.Subscriber),c=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.bufferSize=t,n.startBufferEvery=r,n.buffers=[],n.count=0,n}return o(e,i),e.prototype._next=function(e){var t=this.bufferSize,r=this.startBufferEvery,n=this.buffers,i=this.count;this.count++,i%r==0&&n.push([]);for(var o=n.length;o--;){var s=n[o];s.push(e),s.length===t&&(n.splice(o,1),this.destination.next(s))}},e.prototype._complete=function(){for(var e=this.buffers,t=this.destination;0<e.length;){var r=e.shift();0<r.length&&t.next(r)}i.prototype._complete.call(this)},e}(i.Subscriber)},{"../Subscriber":38}],76:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../scheduler/async"),s=e("../Subscriber"),a=e("../util/isScheduler");r.bufferTime=function(t){var e=arguments.length,r=o.async;a.isScheduler(arguments[arguments.length-1])&&(r=arguments[arguments.length-1],e--);var n=null;2<=e&&(n=arguments[1]);var i=Number.POSITIVE_INFINITY;return 3<=e&&(i=arguments[2]),function(e){return e.lift(new c(t,n,i,r))}};var c=function(){function e(e,t,r,n){this.bufferTimeSpan=e,this.bufferCreationInterval=t,this.maxBufferSize=r,this.scheduler=n}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},e}(),u=function(){this.buffer=[]},h=function(h){function e(e,t,r,n,i){var o=h.call(this,e)||this;o.bufferTimeSpan=t,o.bufferCreationInterval=r,o.maxBufferSize=n,o.scheduler=i,o.contexts=[];var s=o.openContext();if(o.timespanOnly=null==r||r<0,o.timespanOnly){var a={subscriber:o,context:s,bufferTimeSpan:t};o.add(s.closeAction=i.schedule(l,t,a))}else{var c={subscriber:o,context:s},u={bufferTimeSpan:t,bufferCreationInterval:r,subscriber:o,scheduler:i};o.add(s.closeAction=i.schedule(f,t,c)),o.add(i.schedule(p,r,u))}return o}return i(e,h),e.prototype._next=function(e){for(var t,r=this.contexts,n=r.length,i=0;i<n;i++){var o=r[i],s=o.buffer;s.push(e),s.length==this.maxBufferSize&&(t=o)}t&&this.onBufferFull(t)},e.prototype._error=function(e){this.contexts.length=0,h.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,t=this.destination;0<e.length;){var r=e.shift();t.next(r.buffer)}h.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(e){this.closeContext(e);var t=e.closeAction;if(t.unsubscribe(),this.remove(t),!this.closed&&this.timespanOnly){e=this.openContext();var r=this.bufferTimeSpan,n={subscriber:this,context:e,bufferTimeSpan:r};this.add(e.closeAction=this.scheduler.schedule(l,r,n))}},e.prototype.openContext=function(){var e=new u;return this.contexts.push(e),e},e.prototype.closeContext=function(e){this.destination.next(e.buffer);var t=this.contexts;0<=(t?t.indexOf(e):-1)&&t.splice(t.indexOf(e),1)},e}(s.Subscriber);function l(e){var t=e.subscriber,r=e.context;r&&t.closeContext(r),t.closed||(e.context=t.openContext(),e.context.closeAction=this.schedule(e,e.bufferTimeSpan))}function p(e){var t=e.bufferCreationInterval,r=e.bufferTimeSpan,n=e.subscriber,i=e.scheduler,o=n.openContext();n.closed||(n.add(o.closeAction=i.schedule(f,r,{subscriber:n,context:o})),this.schedule(e,t))}function f(e){var t=e.subscriber,r=e.context;t.closeContext(r)}},{"../Subscriber":38,"../scheduler/async":187,"../util/isScheduler":212}],77:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../Subscription"),a=e("../util/subscribeToResult"),i=e("../OuterSubscriber");r.bufferToggle=function(t,r){return function(e){return e.lift(new c(t,r))}};var c=function(){function e(e,t){this.openings=e,this.closingSelector=t}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.openings,this.closingSelector))},e}(),u=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.openings=t,n.closingSelector=r,n.contexts=[],n.add(a.subscribeToResult(n,t)),n}return o(e,i),e.prototype._next=function(e){for(var t=this.contexts,r=t.length,n=0;n<r;n++)t[n].buffer.push(e)},e.prototype._error=function(e){for(var t=this.contexts;0<t.length;){var r=t.shift();r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,i.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts;0<e.length;){var t=e.shift();this.destination.next(t.buffer),t.subscription.unsubscribe(),t.buffer=null,t.subscription=null}this.contexts=null,i.prototype._complete.call(this)},e.prototype.notifyNext=function(e,t,r,n,i){e?this.closeBuffer(e):this.openBuffer(t)},e.prototype.notifyComplete=function(e){this.closeBuffer(e.context)},e.prototype.openBuffer=function(e){try{var t=this.closingSelector.call(this,e);t&&this.trySubscribe(t)}catch(e){this._error(e)}},e.prototype.closeBuffer=function(e){var t=this.contexts;if(t&&e){var r=e.buffer,n=e.subscription;this.destination.next(r),t.splice(t.indexOf(e),1),this.remove(n),n.unsubscribe()}},e.prototype.trySubscribe=function(e){var t=this.contexts,r=new s.Subscription,n={buffer:[],subscription:r};t.push(n);var i=a.subscribeToResult(this,e,n);!i||i.closed?this.closeBuffer(n):(i.context=n,this.add(i),r.add(i))},e}(i.OuterSubscriber)},{"../OuterSubscriber":33,"../Subscription":39,"../util/subscribeToResult":221}],78:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscription"),s=e("../util/tryCatch"),a=e("../util/errorObject"),c=e("../OuterSubscriber"),u=e("../util/subscribeToResult");r.bufferWhen=function(t){return function(e){return e.lift(new h(t))}};var h=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.closingSelector))},e}(),l=function(n){function e(e,t){var r=n.call(this,e)||this;return r.closingSelector=t,r.subscribing=!1,r.openBuffer(),r}return i(e,n),e.prototype._next=function(e){this.buffer.push(e)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),n.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},e.prototype.notifyNext=function(e,t,r,n,i){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var e=this.closingSubscription;e&&(this.remove(e),e.unsubscribe());var t=this.buffer;this.buffer&&this.destination.next(t),this.buffer=[];var r=s.tryCatch(this.closingSelector)();r===a.errorObject?this.error(a.errorObject.e):(e=new o.Subscription,this.closingSubscription=e,this.add(e),this.subscribing=!0,e.add(u.subscribeToResult(this,r)),this.subscribing=!1)},e}(c.OuterSubscriber)},{"../OuterSubscriber":33,"../Subscription":39,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],79:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../OuterSubscriber"),s=e("../InnerSubscriber"),a=e("../util/subscribeToResult");r.catchError=function(n){return function(e){var t=new c(n),r=e.lift(t);return t.caught=r}};var c=function(){function e(e){this.selector=e}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.selector,this.caught))},e}(),u=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.selector=t,n.caught=r,n}return o(e,i),e.prototype.error=function(e){if(!this.isStopped){var t=void 0;try{t=this.selector(e,this.caught)}catch(e){return void i.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var r=new s.InnerSubscriber(this,void 0,void 0);this.add(r),a.subscribeToResult(this,t,void 0,void 0,r)}},e}(i.OuterSubscriber)},{"../InnerSubscriber":29,"../OuterSubscriber":33,"../util/subscribeToResult":221}],80:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../observable/combineLatest");r.combineAll=function(t){return function(e){return e.lift(new n.CombineLatestOperator(t))}}},{"../observable/combineLatest":45}],81:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../util/isArray"),i=e("../observable/combineLatest"),o=e("../observable/from");r.combineLatest=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=null;return"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&n.isArray(t[0])&&(t=t[0].slice()),function(e){return e.lift.call(o.from([e].concat(t)),new i.CombineLatestOperator(r))}}},{"../observable/combineLatest":45,"../observable/from":50,"../util/isArray":202}],82:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../observable/concat");r.concat=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(n.concat.apply(void 0,[e].concat(t)))}}},{"../observable/concat":46}],83:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./mergeAll");r.concatAll=function(){return n.mergeAll(1)}},{"./mergeAll":116}],84:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./mergeMap");r.concatMap=function(e,t){return n.mergeMap(e,t,1)}},{"./mergeMap":117}],85:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./concatMap");r.concatMapTo=function(e,t){return n.concatMap(function(){return e},t)}},{"./concatMap":84}],86:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.count=function(t){return function(e){return e.lift(new s(t,e))}};var s=function(){function e(e,t){this.predicate=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate,this.source))},e}(),a=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.predicate=t,n.source=r,n.count=0,n.index=0,n}return o(e,i),e.prototype._next=function(e){this.predicate?this._tryPredicate(e):this.count++},e.prototype._tryPredicate=function(e){var t;try{t=this.predicate(e,this.index++,this.source)}catch(e){return void this.destination.error(e)}t&&this.count++},e.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},e}(i.Subscriber)},{"../Subscriber":38}],87:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.debounce=function(t){return function(e){return e.lift(new a(t))}};var a=function(){function e(e){this.durationSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.durationSelector))},e}(),c=function(n){function e(e,t){var r=n.call(this,e)||this;return r.durationSelector=t,r.hasValue=!1,r.durationSubscription=null,r}return i(e,n),e.prototype._next=function(e){try{var t=this.durationSelector.call(this,e);t&&this._tryNext(e,t)}catch(e){this.destination.error(e)}},e.prototype._complete=function(){this.emitValue(),this.destination.complete()},e.prototype._tryNext=function(e,t){var r=this.durationSubscription;this.value=e,this.hasValue=!0,r&&(r.unsubscribe(),this.remove(r)),(r=s.subscribeToResult(this,t))&&!r.closed&&this.add(this.durationSubscription=r)},e.prototype.notifyNext=function(e,t,r,n,i){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){if(this.hasValue){var e=this.value,t=this.durationSubscription;t&&(this.durationSubscription=null,t.unsubscribe(),this.remove(t)),this.value=null,this.hasValue=!1,n.prototype._next.call(this,e)}},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],88:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../scheduler/async");r.debounceTime=function(t,r){return void 0===r&&(r=s.async),function(e){return e.lift(new a(t,r))}};var a=function(){function e(e,t){this.dueTime=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.dueTime,this.scheduler))},e}(),c=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.dueTime=t,n.scheduler=r,n.debouncedSubscription=null,n.lastValue=null,n.hasValue=!1,n}return o(e,i),e.prototype._next=function(e){this.clearDebounce(),this.lastValue=e,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(u,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var e=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(e)}},e.prototype.clearDebounce=function(){var e=this.debouncedSubscription;null!==e&&(this.remove(e),e.unsubscribe(),this.debouncedSubscription=null)},e}(i.Subscriber);function u(e){e.debouncedNext()}},{"../Subscriber":38,"../scheduler/async":187}],89:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.defaultIfEmpty=function(t){return void 0===t&&(t=null),function(e){return e.lift(new s(t))}};var s=function(){function e(e){this.defaultValue=e}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.defaultValue))},e}(),a=function(n){function e(e,t){var r=n.call(this,e)||this;return r.defaultValue=t,r.isEmpty=!0,r}return i(e,n),e.prototype._next=function(e){this.isEmpty=!1,this.destination.next(e)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(o.Subscriber)},{"../Subscriber":38}],90:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../scheduler/async"),s=e("../util/isDate"),a=e("../Subscriber"),c=e("../Notification");r.delay=function(e,t){void 0===t&&(t=i.async);var r=s.isDate(e)?+e-t.now():Math.abs(e);return function(e){return e.lift(new u(r,t))}};var u=function(){function e(e,t){this.delay=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.delay,this.scheduler))},e}(),h=function(i){function t(e,t,r){var n=i.call(this,e)||this;return n.delay=t,n.scheduler=r,n.queue=[],n.active=!1,n.errored=!1,n}return o(t,i),t.dispatch=function(e){for(var t=e.source,r=t.queue,n=e.scheduler,i=e.destination;0<r.length&&r[0].time-n.now()<=0;)r.shift().notification.observe(i);if(0<r.length){var o=Math.max(0,r[0].time-n.now());this.schedule(e,o)}else this.unsubscribe(),t.active=!1},t.prototype._schedule=function(e){this.active=!0,this.destination.add(e.schedule(t.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))},t.prototype.scheduleNotification=function(e){if(!0!==this.errored){var t=this.scheduler,r=new l(t.now()+this.delay,e);this.queue.push(r),!1===this.active&&this._schedule(t)}},t.prototype._next=function(e){this.scheduleNotification(c.Notification.createNext(e))},t.prototype._error=function(e){this.errored=!0,this.queue=[],this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.scheduleNotification(c.Notification.createComplete()),this.unsubscribe()},t}(a.Subscriber),l=function(e,t){this.time=e,this.notification=t}},{"../Notification":30,"../Subscriber":38,"../scheduler/async":187,"../util/isDate":204}],91:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../Observable"),a=e("../OuterSubscriber"),c=e("../util/subscribeToResult");r.delayWhen=function(t,r){return r?function(e){return new l(e,r).lift(new u(t))}:function(e){return e.lift(new u(t))}};var u=function(){function e(e){this.delayDurationSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.delayDurationSelector))},e}(),h=function(n){function e(e,t){var r=n.call(this,e)||this;return r.delayDurationSelector=t,r.completed=!1,r.delayNotifierSubscriptions=[],r.index=0,r}return i(e,n),e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(e),this.removeSubscription(i),this.tryComplete()},e.prototype.notifyError=function(e,t){this._error(e)},e.prototype.notifyComplete=function(e){var t=this.removeSubscription(e);t&&this.destination.next(t),this.tryComplete()},e.prototype._next=function(e){var t=this.index++;try{var r=this.delayDurationSelector(e,t);r&&this.tryDelay(r,e)}catch(e){this.destination.error(e)}},e.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},e.prototype.removeSubscription=function(e){e.unsubscribe();var t=this.delayNotifierSubscriptions.indexOf(e);return-1!==t&&this.delayNotifierSubscriptions.splice(t,1),e.outerValue},e.prototype.tryDelay=function(e,t){var r=c.subscribeToResult(this,e,t);r&&!r.closed&&(this.destination.add(r),this.delayNotifierSubscriptions.push(r))},e.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},e}(a.OuterSubscriber),l=function(n){function e(e,t){var r=n.call(this)||this;return r.source=e,r.subscriptionDelay=t,r}return i(e,n),e.prototype._subscribe=function(e){this.subscriptionDelay.subscribe(new p(e,this.source))},e}(s.Observable),p=function(n){function e(e,t){var r=n.call(this)||this;return r.parent=e,r.source=t,r.sourceSubscribed=!1,r}return i(e,n),e.prototype._next=function(e){this.subscribeToSource()},e.prototype._error=function(e){this.unsubscribe(),this.parent.error(e)},e.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},e.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},e}(o.Subscriber)},{"../Observable":31,"../OuterSubscriber":33,"../Subscriber":38,"../util/subscribeToResult":221}],92:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.dematerialize=function(){return function(e){return e.lift(new s)}};var s=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new a(e))},e}(),a=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype._next=function(e){e.observe(this.destination)},e}(o.Subscriber)},{"../Subscriber":38}],93:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.distinct=function(t,r){return function(e){return e.lift(new a(t,r))}};var a=function(){function e(e,t){this.keySelector=e,this.flushes=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.keySelector,this.flushes))},e}(),c=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.keySelector=t,n.values=new Set,r&&n.add(s.subscribeToResult(n,r)),n}return o(e,i),e.prototype.notifyNext=function(e,t,r,n,i){this.values.clear()},e.prototype.notifyError=function(e,t){this._error(e)},e.prototype._next=function(e){this.keySelector?this._useKeySelector(e):this._finalizeNext(e,e)},e.prototype._useKeySelector=function(e){var t,r=this.destination;try{t=this.keySelector(e)}catch(e){return void r.error(e)}this._finalizeNext(t,e)},e.prototype._finalizeNext=function(e,t){var r=this.values;r.has(e)||(r.add(e),this.destination.next(t))},e}(i.OuterSubscriber);r.DistinctSubscriber=c},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],94:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../util/tryCatch"),a=e("../util/errorObject");r.distinctUntilChanged=function(t,r){return function(e){return e.lift(new c(t,r))}};var c=function(){function e(e,t){this.compare=e,this.keySelector=t}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.compare,this.keySelector))},e}(),u=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.keySelector=r,n.hasKey=!1,"function"==typeof t&&(n.compare=t),n}return o(e,i),e.prototype.compare=function(e,t){return e===t},e.prototype._next=function(e){var t=e;if(this.keySelector&&(t=s.tryCatch(this.keySelector)(e))===a.errorObject)return this.destination.error(a.errorObject.e);var r=!1;if(this.hasKey){if((r=s.tryCatch(this.compare)(this.key,t))===a.errorObject)return this.destination.error(a.errorObject.e)}else this.hasKey=!0;!1===Boolean(r)&&(this.key=t,this.destination.next(e))},e}(i.Subscriber)},{"../Subscriber":38,"../util/errorObject":199,"../util/tryCatch":223}],95:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./distinctUntilChanged");r.distinctUntilKeyChanged=function(r,n){return i.distinctUntilChanged(function(e,t){return n?n(e[r],t[r]):e[r]===t[r]})}},{"./distinctUntilChanged":94}],96:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../util/ArgumentOutOfRangeError"),o=e("./filter"),s=e("./throwIfEmpty"),a=e("./defaultIfEmpty"),c=e("./take");r.elementAt=function(r,t){if(r<0)throw new i.ArgumentOutOfRangeError;var n=2<=arguments.length;return function(e){return e.pipe(o.filter(function(e,t){return t===r}),c.take(1),n?a.defaultIfEmpty(t):s.throwIfEmpty(function(){return new i.ArgumentOutOfRangeError}))}}},{"../util/ArgumentOutOfRangeError":192,"./defaultIfEmpty":89,"./filter":102,"./take":154,"./throwIfEmpty":161}],97:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../observable/fromArray"),o=e("../observable/scalar"),s=e("../observable/empty"),a=e("../observable/concat"),c=e("../util/isScheduler");r.endWith=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return function(e){var t=n[n.length-1];c.isScheduler(t)?n.pop():t=null;var r=n.length;return 1!==r||t?0<r?a.concat(e,i.fromArray(n,t)):a.concat(e,s.empty(t)):a.concat(e,o.scalar(n[0]))}}},{"../observable/concat":46,"../observable/empty":48,"../observable/fromArray":51,"../observable/scalar":67,"../util/isScheduler":212}],98:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.every=function(t,r){return function(e){return e.lift(new s(t,r,e))}};var s=function(){function e(e,t,r){this.predicate=e,this.thisArg=t,this.source=r}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate,this.thisArg,this.source))},e}(),a=function(o){function e(e,t,r,n){var i=o.call(this,e)||this;return i.predicate=t,i.thisArg=r,i.source=n,i.index=0,i.thisArg=r||i,i}return i(e,o),e.prototype.notifyComplete=function(e){this.destination.next(e),this.destination.complete()},e.prototype._next=function(e){var t=!1;try{t=this.predicate.call(this.thisArg,e,this.index++,this.source)}catch(e){return void this.destination.error(e)}t||this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(o.Subscriber)},{"../Subscriber":38}],99:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.exhaust=function(){return function(e){return e.lift(new a)}};var a=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new c(e))},e}(),c=function(r){function e(e){var t=r.call(this,e)||this;return t.hasCompleted=!1,t.hasSubscription=!1,t}return i(e,r),e.prototype._next=function(e){this.hasSubscription||(this.hasSubscription=!0,this.add(s.subscribeToResult(this,e)))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},e.prototype.notifyComplete=function(e){this.remove(e),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],100:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../InnerSubscriber"),a=e("../util/subscribeToResult"),c=e("./map"),u=e("../observable/from");r.exhaustMap=function t(i,o){return o?function(e){return e.pipe(t(function(r,n){return u.from(i(r,n)).pipe(c.map(function(e,t){return o(r,e,n,t)}))}))}:function(e){return e.lift(new h(i))}};var h=function(){function e(e){this.project=e}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.project))},e}(),l=function(n){function e(e,t){var r=n.call(this,e)||this;return r.project=t,r.hasSubscription=!1,r.hasCompleted=!1,r.index=0,r}return i(e,n),e.prototype._next=function(e){this.hasSubscription||this.tryNext(e)},e.prototype.tryNext=function(e){var t,r=this.index++;try{t=this.project(e,r)}catch(e){return void this.destination.error(e)}this.hasSubscription=!0,this._innerSub(t,e,r)},e.prototype._innerSub=function(e,t,r){var n=new s.InnerSubscriber(this,void 0,void 0);this.destination.add(n),a.subscribeToResult(this,e,t,r,n)},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)},e.prototype.notifyError=function(e){this.destination.error(e)},e.prototype.notifyComplete=function(e){this.destination.remove(e),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(o.OuterSubscriber)},{"../InnerSubscriber":29,"../OuterSubscriber":33,"../observable/from":50,"../util/subscribeToResult":221,"./map":111}],101:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var a=e("../util/tryCatch"),c=e("../util/errorObject"),o=e("../OuterSubscriber"),u=e("../util/subscribeToResult");r.expand=function(t,r,n){return void 0===r&&(r=Number.POSITIVE_INFINITY),void 0===n&&(n=void 0),r=(r||0)<1?Number.POSITIVE_INFINITY:r,function(e){return e.lift(new s(t,r,n))}};var s=function(){function e(e,t,r){this.project=e,this.concurrent=t,this.scheduler=r}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.project,this.concurrent,this.scheduler))},e}();r.ExpandOperator=s;var h=function(o){function s(e,t,r,n){var i=o.call(this,e)||this;return i.project=t,i.concurrent=r,i.scheduler=n,i.index=0,i.active=0,i.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(i.buffer=[]),i}return i(s,o),s.dispatch=function(e){var t=e.subscriber,r=e.result,n=e.value,i=e.index;t.subscribeToProjection(r,n,i)},s.prototype._next=function(e){var t=this.destination;if(t.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){t.next(e);var n=a.tryCatch(this.project)(e,r);if(n===c.errorObject)t.error(c.errorObject.e);else if(this.scheduler){var i={subscriber:this,result:n,value:e,index:r};this.destination.add(this.scheduler.schedule(s.dispatch,0,i))}else this.subscribeToProjection(n,e,r)}else this.buffer.push(e)}},s.prototype.subscribeToProjection=function(e,t,r){this.active++,this.destination.add(u.subscribeToResult(this,e,t,r))},s.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},s.prototype.notifyNext=function(e,t,r,n,i){this._next(t)},s.prototype.notifyComplete=function(e){var t=this.buffer;this.destination.remove(e),this.active--,t&&0<t.length&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},s}(o.OuterSubscriber);r.ExpandSubscriber=h},{"../OuterSubscriber":33,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],102:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.filter=function(t,r){return function(e){return e.lift(new s(t,r))}};var s=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate,this.thisArg))},e}(),a=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.predicate=t,n.thisArg=r,n.count=0,n}return o(e,i),e.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":38}],103:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../Subscription");r.finalize=function(t){return function(e){return e.lift(new a(t))}};var a=function(){function e(e){this.callback=e}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.callback))},e}(),c=function(n){function e(e,t){var r=n.call(this,e)||this;return r.add(new s.Subscription(t)),r}return i(e,n),e}(o.Subscriber)},{"../Subscriber":38,"../Subscription":39}],104:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.find=function(t,r){if("function"!=typeof t)throw new TypeError("predicate is not a function");return function(e){return e.lift(new s(t,e,!1,r))}};var s=function(){function e(e,t,r,n){this.predicate=e,this.source=t,this.yieldIndex=r,this.thisArg=n}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate,this.source,this.yieldIndex,this.thisArg))},e}();r.FindValueOperator=s;var a=function(s){function e(e,t,r,n,i){var o=s.call(this,e)||this;return o.predicate=t,o.source=r,o.yieldIndex=n,o.thisArg=i,o.index=0,o}return i(e,s),e.prototype.notifyComplete=function(e){var t=this.destination;t.next(e),t.complete(),this.unsubscribe()},e.prototype._next=function(e){var t=this.predicate,r=this.thisArg,n=this.index++;try{t.call(r||this,e,n,this.source)&&this.notifyComplete(this.yieldIndex?n:e)}catch(e){this.destination.error(e)}},e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},e}(o.Subscriber);r.FindValueSubscriber=a},{"../Subscriber":38}],105:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../operators/find");r.findIndex=function(t,r){return function(e){return e.lift(new n.FindValueOperator(t,e,!0,r))}}},{"../operators/find":104}],106:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../util/EmptyError"),o=e("./filter"),s=e("./take"),a=e("./defaultIfEmpty"),c=e("./throwIfEmpty"),u=e("../util/identity");r.first=function(n,e){var t=2<=arguments.length;return function(r){return r.pipe(n?o.filter(function(e,t){return n(e,t,r)}):u.identity,s.take(1),t?a.defaultIfEmpty(e):c.throwIfEmpty(function(){return new i.EmptyError}))}}},{"../util/EmptyError":193,"../util/identity":201,"./defaultIfEmpty":89,"./filter":102,"./take":154,"./throwIfEmpty":161}],107:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../Subscription"),a=e("../Observable"),c=e("../Subject");r.groupBy=function(t,r,n,i){return function(e){return e.lift(new u(t,r,n,i))}};var u=function(){function e(e,t,r,n){this.keySelector=e,this.elementSelector=t,this.durationSelector=r,this.subjectSelector=n}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},e}(),h=function(s){function e(e,t,r,n,i){var o=s.call(this,e)||this;return o.keySelector=t,o.elementSelector=r,o.durationSelector=n,o.subjectSelector=i,o.groups=null,o.attemptedToUnsubscribe=!1,o.count=0,o}return o(e,s),e.prototype._next=function(e){var t;try{t=this.keySelector(e)}catch(e){return void this.error(e)}this._group(e,t)},e.prototype._group=function(e,t){var r=this.groups;r||(r=this.groups=new Map);var n,i=r.get(t);if(this.elementSelector)try{n=this.elementSelector(e)}catch(e){this.error(e)}else n=e;if(!i){i=this.subjectSelector?this.subjectSelector():new c.Subject,r.set(t,i);var o=new p(t,i,this);if(this.destination.next(o),this.durationSelector){var s=void 0;try{s=this.durationSelector(new p(t,i))}catch(e){return void this.error(e)}this.add(s.subscribe(new l(t,i,this)))}}i.closed||i.next(n)},e.prototype._error=function(r){var e=this.groups;e&&(e.forEach(function(e,t){e.error(r)}),e.clear()),this.destination.error(r)},e.prototype._complete=function(){var e=this.groups;e&&(e.forEach(function(e,t){e.complete()}),e.clear()),this.destination.complete()},e.prototype.removeGroup=function(e){this.groups.delete(e)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&s.prototype.unsubscribe.call(this))},e}(i.Subscriber),l=function(i){function e(e,t,r){var n=i.call(this,t)||this;return n.key=e,n.group=t,n.parent=r,n}return o(e,i),e.prototype._next=function(e){this.complete()},e.prototype._unsubscribe=function(){var e=this.parent,t=this.key;this.key=this.parent=null,e&&e.removeGroup(t)},e}(i.Subscriber),p=function(i){function e(e,t,r){var n=i.call(this)||this;return n.key=e,n.groupSubject=t,n.refCountSubscription=r,n}return o(e,i),e.prototype._subscribe=function(e){var t=new s.Subscription,r=this.refCountSubscription,n=this.groupSubject;return r&&!r.closed&&t.add(new f(r)),t.add(n.subscribe(e)),t},e}(a.Observable);r.GroupedObservable=p;var f=function(r){function e(e){var t=r.call(this)||this;return(t.parent=e).count++,t}return o(e,r),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(r.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(s.Subscription)},{"../Observable":31,"../Subject":36,"../Subscriber":38,"../Subscription":39}],108:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.ignoreElements=function(){return function(e){return e.lift(new s)}};var s=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new a(e))},e}(),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._next=function(e){},t}(o.Subscriber)},{"../Subscriber":38}],109:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.isEmpty=function(){return function(e){return e.lift(new s)}};var s=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new a(e))},e}(),a=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.notifyComplete=function(e){var t=this.destination;t.next(e),t.complete()},e.prototype._next=function(e){this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(o.Subscriber)},{"../Subscriber":38}],110:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../util/EmptyError"),o=e("./filter"),s=e("./takeLast"),a=e("./throwIfEmpty"),c=e("./defaultIfEmpty"),u=e("../util/identity");r.last=function(n,e){var t=2<=arguments.length;return function(r){return r.pipe(n?o.filter(function(e,t){return n(e,t,r)}):u.identity,s.takeLast(1),t?c.defaultIfEmpty(e):a.throwIfEmpty(function(){return new i.EmptyError}))}}},{"../util/EmptyError":193,"../util/identity":201,"./defaultIfEmpty":89,"./filter":102,"./takeLast":155,"./throwIfEmpty":161}],111:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.map=function(t,r){return function(e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return e.lift(new s(t,r))}};var s=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.project,this.thisArg))},e}();r.MapOperator=s;var a=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.project=t,n.count=0,n.thisArg=r||n,n}return o(e,i),e.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":38}],112:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.mapTo=function(t){return function(e){return e.lift(new s(t))}};var s=function(){function e(e){this.value=e}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.value))},e}(),a=function(n){function e(e,t){var r=n.call(this,e)||this;return r.value=t,r}return i(e,n),e.prototype._next=function(e){this.destination.next(this.value)},e}(o.Subscriber)},{"../Subscriber":38}],113:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../Notification");r.materialize=function(){return function(e){return e.lift(new a)}};var a=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new c(e))},e}(),c=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype._next=function(e){this.destination.next(s.Notification.createNext(e))},e.prototype._error=function(e){var t=this.destination;t.next(s.Notification.createError(e)),t.complete()},e.prototype._complete=function(){var e=this.destination;e.next(s.Notification.createComplete()),e.complete()},e}(o.Subscriber)},{"../Notification":30,"../Subscriber":38}],114:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./reduce");r.max=function(r){var e="function"==typeof r?function(e,t){return 0<r(e,t)?e:t}:function(e,t){return t<e?e:t};return n.reduce(e)}},{"./reduce":132}],115:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../observable/merge");r.merge=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(n.merge.apply(void 0,[e].concat(t)))}}},{"../observable/merge":60}],116:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./mergeMap"),i=e("../util/identity");r.mergeAll=function(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),n.mergeMap(i.identity,e)}},{"../util/identity":201,"./mergeMap":117}],117:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../util/subscribeToResult"),i=e("../OuterSubscriber"),a=e("../InnerSubscriber"),c=e("./map"),u=e("../observable/from");r.mergeMap=function t(i,o,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof o?function(e){return e.pipe(t(function(r,n){return u.from(i(r,n)).pipe(c.map(function(e,t){return o(r,e,n,t)}))},r))}:("number"==typeof o&&(r=o),function(e){return e.lift(new h(i,r))})};var h=function(){function e(e,t){void 0===t&&(t=Number.POSITIVE_INFINITY),this.project=e,this.concurrent=t}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.project,this.concurrent))},e}();r.MergeMapOperator=h;var l=function(i){function e(e,t,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var n=i.call(this,e)||this;return n.project=t,n.concurrent=r,n.hasCompleted=!1,n.buffer=[],n.active=0,n.index=0,n}return o(e,i),e.prototype._next=function(e){this.active<this.concurrent?this._tryNext(e):this.buffer.push(e)},e.prototype._tryNext=function(e){var t,r=this.index++;try{t=this.project(e,r)}catch(e){return void this.destination.error(e)}this.active++,this._innerSub(t,e,r)},e.prototype._innerSub=function(e,t,r){var n=new a.InnerSubscriber(this,void 0,void 0);this.destination.add(n),s.subscribeToResult(this,e,t,r,n)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)},e.prototype.notifyComplete=function(e){var t=this.buffer;this.remove(e),this.active--,0<t.length?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(i.OuterSubscriber);r.MergeMapSubscriber=l},{"../InnerSubscriber":29,"../OuterSubscriber":33,"../observable/from":50,"../util/subscribeToResult":221,"./map":111}],118:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./mergeMap");r.mergeMapTo=function(e,t,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof t?n.mergeMap(function(){return e},t,r):("number"==typeof t&&(r=t),n.mergeMap(function(){return e},r))}},{"./mergeMap":117}],119:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../util/tryCatch"),a=e("../util/errorObject"),c=e("../util/subscribeToResult"),o=e("../OuterSubscriber"),u=e("../InnerSubscriber");r.mergeScan=function(t,r,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),function(e){return e.lift(new h(t,r,n))}};var h=function(){function e(e,t,r){this.accumulator=e,this.seed=t,this.concurrent=r}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.accumulator,this.seed,this.concurrent))},e}();r.MergeScanOperator=h;var l=function(o){function e(e,t,r,n){var i=o.call(this,e)||this;return i.accumulator=t,i.acc=r,i.concurrent=n,i.hasValue=!1,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return i(e,o),e.prototype._next=function(e){if(this.active<this.concurrent){var t=this.index++,r=s.tryCatch(this.accumulator)(this.acc,e),n=this.destination;r===a.errorObject?n.error(a.errorObject.e):(this.active++,this._innerSub(r,e,t))}else this.buffer.push(e)},e.prototype._innerSub=function(e,t,r){var n=new u.InnerSubscriber(this,void 0,void 0);this.destination.add(n),c.subscribeToResult(this,e,t,r,n)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},e.prototype.notifyNext=function(e,t,r,n,i){var o=this.destination;this.acc=t,this.hasValue=!0,o.next(t)},e.prototype.notifyComplete=function(e){var t=this.buffer;this.destination.remove(e),this.active--,0<t.length?this._next(t.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},e}(o.OuterSubscriber);r.MergeScanSubscriber=l},{"../InnerSubscriber":29,"../OuterSubscriber":33,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],120:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./reduce");r.min=function(r){var e="function"==typeof r?function(e,t){return r(e,t)<0?e:t}:function(e,t){return e<t?e:t};return n.reduce(e)}},{"./reduce":132}],121:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../observable/ConnectableObservable");r.multicast=function(n,i){return function(e){var t;if(t="function"==typeof n?n:function(){return n},"function"==typeof i)return e.lift(new s(t,i));var r=Object.create(e,o.connectableObservableDescriptor);return r.source=e,r.subjectFactory=t,r}};var s=function(){function e(e,t){this.subjectFactory=e,this.selector=t}return e.prototype.call=function(e,t){var r=this.selector,n=this.subjectFactory(),i=r(n).subscribe(e);return i.add(t.subscribe(n)),i},e}();r.MulticastOperator=s},{"../observable/ConnectableObservable":41}],122:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../Notification");r.observeOn=function(t,r){return void 0===r&&(r=0),function(e){return e.lift(new a(t,r))}};var a=function(){function e(e,t){void 0===t&&(t=0),this.scheduler=e,this.delay=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.scheduler,this.delay))},e}();r.ObserveOnOperator=a;var c=function(i){function t(e,t,r){void 0===r&&(r=0);var n=i.call(this,e)||this;return n.scheduler=t,n.delay=r,n}return o(t,i),t.dispatch=function(e){var t=e.notification,r=e.destination;t.observe(r),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.destination.add(this.scheduler.schedule(t.dispatch,this.delay,new u(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage(s.Notification.createNext(e))},t.prototype._error=function(e){this.scheduleMessage(s.Notification.createError(e)),this.unsubscribe()},t.prototype._complete=function(){this.scheduleMessage(s.Notification.createComplete()),this.unsubscribe()},t}(i.Subscriber);r.ObserveOnSubscriber=c;var u=function(e,t){this.notification=e,this.destination=t};r.ObserveOnMessage=u},{"../Notification":30,"../Subscriber":38}],123:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../observable/from"),s=e("../util/isArray"),a=e("../OuterSubscriber"),c=e("../InnerSubscriber"),u=e("../util/subscribeToResult");r.onErrorResumeNext=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&s.isArray(t[0])&&(t=t[0]),function(e){return e.lift(new h(t))}},r.onErrorResumeNextStatic=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r;return 1===e.length&&s.isArray(e[0])&&(e=e[0]),r=e.shift(),o.from(r,null).lift(new h(e))};var h=function(){function e(e){this.nextSources=e}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.nextSources))},e}(),l=function(n){function e(e,t){var r=n.call(this,e)||this;return r.destination=e,r.nextSources=t,r}return i(e,n),e.prototype.notifyError=function(e,t){this.subscribeToNextSource()},e.prototype.notifyComplete=function(e){this.subscribeToNextSource()},e.prototype._error=function(e){this.subscribeToNextSource(),this.unsubscribe()},e.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},e.prototype.subscribeToNextSource=function(){var e=this.nextSources.shift();if(e){var t=new c.InnerSubscriber(this,void 0,void 0);this.destination.add(t),u.subscribeToResult(this,e,void 0,void 0,t)}else this.destination.complete()},e}(a.OuterSubscriber)},{"../InnerSubscriber":29,"../OuterSubscriber":33,"../observable/from":50,"../util/isArray":202,"../util/subscribeToResult":221}],124:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.pairwise=function(){return function(e){return e.lift(new s)}};var s=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new a(e))},e}(),a=function(r){function e(e){var t=r.call(this,e)||this;return t.hasPrev=!1,t}return i(e,r),e.prototype._next=function(e){this.hasPrev?this.destination.next([this.prev,e]):this.hasPrev=!0,this.prev=e},e}(o.Subscriber)},{"../Subscriber":38}],125:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../util/not"),i=e("./filter");r.partition=function(t,r){return function(e){return[i.filter(t,r)(e),i.filter(n.not(t,r))(e)]}}},{"../util/not":214,"./filter":102}],126:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./map");r.pluck=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.length;if(0===r)throw new Error("list of properties cannot be empty.");return function(e){return n.map((i=t,o=r,function(e){for(var t=e,r=0;r<o;r++){var n=t[i[r]];if(void 0===n)return;t=n}return t}))(e);var i,o}}},{"./map":111}],127:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Subject"),i=e("./multicast");r.publish=function(e){return e?i.multicast(function(){return new n.Subject},e):i.multicast(new n.Subject)}},{"../Subject":36,"./multicast":121}],128:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../BehaviorSubject"),i=e("./multicast");r.publishBehavior=function(t){return function(e){return i.multicast(new n.BehaviorSubject(t))(e)}}},{"../BehaviorSubject":28,"./multicast":121}],129:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../AsyncSubject"),i=e("./multicast");r.publishLast=function(){return function(e){return i.multicast(new n.AsyncSubject)(e)}}},{"../AsyncSubject":27,"./multicast":121}],130:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s=e("../ReplaySubject"),a=e("./multicast");r.publishReplay=function(e,t,r,n){r&&"function"!=typeof r&&(n=r);var i="function"==typeof r?r:void 0,o=new s.ReplaySubject(e,t,n);return function(e){return a.multicast(function(){return o},i)(e)}}},{"../ReplaySubject":34,"./multicast":121}],131:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../util/isArray"),i=e("../observable/race");r.race=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return 1===t.length&&n.isArray(t[0])&&(t=t[0]),e.lift.call(i.race.apply(void 0,[e].concat(t)))}}},{"../observable/race":65,"../util/isArray":202}],132:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("./scan"),o=e("./takeLast"),s=e("./defaultIfEmpty"),a=e("../util/pipe");r.reduce=function(n,t){return 2<=arguments.length?function(e){return a.pipe(i.scan(n,t),o.takeLast(1),s.defaultIfEmpty(t))(e)}:function(e){return a.pipe(i.scan(function(e,t,r){return n(e,t,r+1)}),o.takeLast(1))(e)}}},{"../util/pipe":215,"./defaultIfEmpty":89,"./scan":140,"./takeLast":155}],133:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.refCount=function(){return function(e){return e.lift(new s(e))}};var s=function(){function e(e){this.connectable=e}return e.prototype.call=function(e,t){var r=this.connectable;r._refCount++;var n=new a(e,r),i=t.subscribe(n);return n.closed||(n.connection=r.connect()),i},e}(),a=function(n){function e(e,t){var r=n.call(this,e)||this;return r.connectable=t,r}return i(e,n),e.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,1<t)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},e}(o.Subscriber)},{"../Subscriber":38}],134:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../observable/empty");r.repeat=function(t){return void 0===t&&(t=-1),function(e){return 0===t?s.empty():t<0?e.lift(new a(-1,e)):e.lift(new a(t-1,e))}};var a=function(){function e(e,t){this.count=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.count,this.source))},e}(),c=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.count=t,n.source=r,n}return o(e,i),e.prototype.complete=function(){if(!this.isStopped){var e=this.source,t=this.count;if(0===t)return i.prototype.complete.call(this);-1<t&&(this.count=t-1),e.subscribe(this._unsubscribeAndRecycle())}},e}(i.Subscriber)},{"../Subscriber":38,"../observable/empty":48}],135:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../Subject"),a=e("../util/tryCatch"),c=e("../util/errorObject"),i=e("../OuterSubscriber"),u=e("../util/subscribeToResult");r.repeatWhen=function(t){return function(e){return e.lift(new h(t))}};var h=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.notifier,t))},e}(),l=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.notifier=t,n.source=r,n.sourceIsBeingSubscribedTo=!0,n}return o(e,i),e.prototype.notifyNext=function(e,t,r,n,i){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},e.prototype.notifyComplete=function(e){if(!1===this.sourceIsBeingSubscribedTo)return i.prototype.complete.call(this)},e.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return i.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next()}},e.prototype._unsubscribe=function(){var e=this.notifications,t=this.retriesSubscription;e&&(e.unsubscribe(),this.notifications=null),t&&(t.unsubscribe(),this.retriesSubscription=null),this.retries=null},e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,i.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},e.prototype.subscribeToRetries=function(){this.notifications=new s.Subject;var e=a.tryCatch(this.notifier)(this.notifications);if(e===c.errorObject)return i.prototype.complete.call(this);this.retries=e,this.retriesSubscription=u.subscribeToResult(this,e)},e}(i.OuterSubscriber)},{"../OuterSubscriber":33,"../Subject":36,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],136:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.retry=function(t){return void 0===t&&(t=-1),function(e){return e.lift(new s(t,e))}};var s=function(){function e(e,t){this.count=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.count,this.source))},e}(),a=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.count=t,n.source=r,n}return o(e,i),e.prototype.error=function(e){if(!this.isStopped){var t=this.source,r=this.count;if(0===r)return i.prototype.error.call(this,e);-1<r&&(this.count=r-1),t.subscribe(this._unsubscribeAndRecycle())}},e}(i.Subscriber)},{"../Subscriber":38}],137:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../Subject"),a=e("../util/tryCatch"),c=e("../util/errorObject"),i=e("../OuterSubscriber"),u=e("../util/subscribeToResult");r.retryWhen=function(t){return function(e){return e.lift(new h(t,e))}};var h=function(){function e(e,t){this.notifier=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.notifier,this.source))},e}(),l=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.notifier=t,n.source=r,n}return o(e,i),e.prototype.error=function(e){if(!this.isStopped){var t=this.errors,r=this.retries,n=this.retriesSubscription;if(r)this.errors=null,this.retriesSubscription=null;else{if(t=new s.Subject,(r=a.tryCatch(this.notifier)(t))===c.errorObject)return i.prototype.error.call(this,c.errorObject.e);n=u.subscribeToResult(this,r)}this._unsubscribeAndRecycle(),this.errors=t,this.retries=r,this.retriesSubscription=n,t.next(e)}},e.prototype._unsubscribe=function(){var e=this.errors,t=this.retriesSubscription;e&&(e.unsubscribe(),this.errors=null),t&&(t.unsubscribe(),this.retriesSubscription=null),this.retries=null},e.prototype.notifyNext=function(e,t,r,n,i){var o=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=o,this.source.subscribe(this)},e}(i.OuterSubscriber)},{"../OuterSubscriber":33,"../Subject":36,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],138:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.sample=function(t){return function(e){return e.lift(new a(t))}};var a=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var r=new c(e),n=t.subscribe(r);return n.add(s.subscribeToResult(r,this.notifier)),n},e}(),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return i(e,t),e.prototype._next=function(e){this.value=e,this.hasValue=!0},e.prototype.notifyNext=function(e,t,r,n,i){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],139:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../scheduler/async");r.sampleTime=function(t,r){return void 0===r&&(r=s.async),function(e){return e.lift(new a(t,r))}};var a=function(){function e(e,t){this.period=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.period,this.scheduler))},e}(),c=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.period=t,n.scheduler=r,n.hasValue=!1,n.add(r.schedule(u,t,{subscriber:n,period:t})),n}return o(e,i),e.prototype._next=function(e){this.lastValue=e,this.hasValue=!0},e.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},e}(i.Subscriber);function u(e){var t=e.subscriber,r=e.period;t.notifyNext(),this.schedule(e,r)}},{"../Subscriber":38,"../scheduler/async":187}],140:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.scan=function(t,r){var n=!1;return 2<=arguments.length&&(n=!0),function(e){return e.lift(new s(t,r,n))}};var s=function(){function e(e,t,r){void 0===r&&(r=!1),this.accumulator=e,this.seed=t,this.hasSeed=r}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.accumulator,this.seed,this.hasSeed))},e}(),a=function(o){function e(e,t,r,n){var i=o.call(this,e)||this;return i.accumulator=t,i._seed=r,i.hasSeed=n,i.index=0,i}return i(e,o),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=!0,this._seed=e},enumerable:!0,configurable:!0}),e.prototype._next=function(e){if(this.hasSeed)return this._tryNext(e);this.seed=e,this.destination.next(e)},e.prototype._tryNext=function(e){var t,r=this.index++;try{t=this.accumulator(this.seed,e,r)}catch(e){this.destination.error(e)}this.seed=t,this.destination.next(t)},e}(o.Subscriber)},{"../Subscriber":38}],141:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../util/tryCatch"),a=e("../util/errorObject");r.sequenceEqual=function(t,r){return function(e){return e.lift(new c(t,r))}};var c=function(){function e(e,t){this.compareTo=e,this.comparor=t}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.compareTo,this.comparor))},e}();r.SequenceEqualOperator=c;var u=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.compareTo=t,n.comparor=r,n._a=[],n._b=[],n._oneComplete=!1,n.destination.add(t.subscribe(new h(e,n))),n}return o(e,i),e.prototype._next=function(e){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(e),this.checkValues())},e.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},e.prototype.checkValues=function(){for(var e=this._a,t=this._b,r=this.comparor;0<e.length&&0<t.length;){var n=e.shift(),i=t.shift(),o=!1;r?(o=s.tryCatch(r)(n,i))===a.errorObject&&this.destination.error(a.errorObject.e):o=n===i,o||this.emit(!1)}},e.prototype.emit=function(e){var t=this.destination;t.next(e),t.complete()},e.prototype.nextB=function(e){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(e),this.checkValues())},e.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},e}(i.Subscriber);r.SequenceEqualSubscriber=u;var h=function(n){function e(e,t){var r=n.call(this,e)||this;return r.parent=t,r}return o(e,n),e.prototype._next=function(e){this.parent.nextB(e)},e.prototype._error=function(e){this.parent.error(e),this.unsubscribe()},e.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},e}(i.Subscriber)},{"../Subscriber":38,"../util/errorObject":199,"../util/tryCatch":223}],142:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./multicast"),i=e("./refCount"),o=e("../Subject");function s(){return new o.Subject}r.share=function(){return function(e){return i.refCount()(n.multicast(s)(e))}}},{"../Subject":36,"./multicast":121,"./refCount":133}],143:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var p=e("../ReplaySubject");r.shareReplay=function(t,h,l){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===h&&(h=Number.POSITIVE_INFINITY),function(e){return e.lift((r=t,n=h,i=l,a=0,u=c=!1,function(e){a++,o&&!c||(c=!1,o=new p.ReplaySubject(r,n,i),s=e.subscribe({next:function(e){o.next(e)},error:function(e){c=!0,o.error(e)},complete:function(){u=!0,o.complete()}}));var t=o.subscribe(this);return function(){a--,t.unsubscribe(),s&&0===a&&u&&s.unsubscribe()}}));var r,n,i,o,s,a,c,u}}},{"../ReplaySubject":34}],144:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),s=e("../util/EmptyError");r.single=function(t){return function(e){return e.lift(new a(t,e))}};var a=function(){function e(e,t){this.predicate=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.predicate,this.source))},e}(),c=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.predicate=t,n.source=r,n.seenValue=!1,n.index=0,n}return o(e,i),e.prototype.applySingleValue=function(e){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=e)},e.prototype._next=function(e){var t=this.index++;this.predicate?this.tryNext(e,t):this.applySingleValue(e)},e.prototype.tryNext=function(e,t){try{this.predicate(e,t,this.source)&&this.applySingleValue(e)}catch(e){this.destination.error(e)}},e.prototype._complete=function(){var e=this.destination;0<this.index?(e.next(this.seenValue?this.singleValue:void 0),e.complete()):e.error(new s.EmptyError)},e}(i.Subscriber)},{"../Subscriber":38,"../util/EmptyError":193}],145:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.skip=function(t){return function(e){return e.lift(new s(t))}};var s=function(){function e(e){this.total=e}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.total))},e}(),a=function(n){function e(e,t){var r=n.call(this,e)||this;return r.total=t,r.count=0,r}return i(e,n),e.prototype._next=function(e){++this.count>this.total&&this.destination.next(e)},e}(o.Subscriber)},{"../Subscriber":38}],146:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../util/ArgumentOutOfRangeError");r.skipLast=function(t){return function(e){return e.lift(new a(t))}};var a=function(){function e(e){if(this._skipCount=e,this._skipCount<0)throw new s.ArgumentOutOfRangeError}return e.prototype.call=function(e,t){return 0===this._skipCount?t.subscribe(new o.Subscriber(e)):t.subscribe(new c(e,this._skipCount))},e}(),c=function(n){function e(e,t){var r=n.call(this,e)||this;return r._skipCount=t,r._count=0,r._ring=new Array(t),r}return i(e,n),e.prototype._next=function(e){var t=this._skipCount,r=this._count++;if(r<t)this._ring[r]=e;else{var n=r%t,i=this._ring,o=i[n];i[n]=e,this.destination.next(o)}},e}(o.Subscriber)},{"../Subscriber":38,"../util/ArgumentOutOfRangeError":192}],147:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../OuterSubscriber"),s=e("../InnerSubscriber"),a=e("../util/subscribeToResult");r.skipUntil=function(t){return function(e){return e.lift(new c(t))}};var c=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.notifier))},e}(),u=function(i){function e(e,t){var r=i.call(this,e)||this;r.hasValue=!1;var n=new s.InnerSubscriber(r,void 0,void 0);return r.add(n),r.innerSubscription=n,a.subscribeToResult(r,t,void 0,void 0,n),r}return o(e,i),e.prototype._next=function(e){this.hasValue&&i.prototype._next.call(this,e)},e.prototype.notifyNext=function(e,t,r,n,i){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},e.prototype.notifyComplete=function(){},e}(i.OuterSubscriber)},{"../InnerSubscriber":29,"../OuterSubscriber":33,"../util/subscribeToResult":221}],148:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.skipWhile=function(t){return function(e){return e.lift(new s(t))}};var s=function(){function e(e){this.predicate=e}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate))},e}(),a=function(n){function e(e,t){var r=n.call(this,e)||this;return r.predicate=t,r.skipping=!0,r.index=0,r}return i(e,n),e.prototype._next=function(e){var t=this.destination;this.skipping&&this.tryCallPredicate(e),this.skipping||t.next(e)},e.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}},e}(o.Subscriber)},{"../Subscriber":38}],149:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../observable/fromArray"),o=e("../observable/scalar"),s=e("../observable/empty"),a=e("../observable/concat"),c=e("../util/isScheduler");r.startWith=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return function(e){var t=n[n.length-1];c.isScheduler(t)?n.pop():t=null;var r=n.length;return 1!==r||t?0<r?a.concat(i.fromArray(n,t),e):a.concat(s.empty(t),e):a.concat(o.scalar(n[0]),e)}}},{"../observable/concat":46,"../observable/empty":48,"../observable/fromArray":51,"../observable/scalar":67,"../util/isScheduler":212}],150:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../observable/SubscribeOnObservable");r.subscribeOn=function(t,r){return void 0===r&&(r=0),function(e){return e.lift(new i(t,r))}};var i=function(){function e(e,t){this.scheduler=e,this.delay=t}return e.prototype.call=function(e,t){return new n.SubscribeOnObservable(t,this.delay,this.scheduler).subscribe(e)},e}()},{"../observable/SubscribeOnObservable":42}],151:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./switchMap"),i=e("../util/identity");r.switchAll=function(){return n.switchMap(i.identity)}},{"../util/identity":201,"./switchMap":152}],152:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../InnerSubscriber"),a=e("../util/subscribeToResult"),c=e("./map"),u=e("../observable/from");r.switchMap=function t(i,o){return"function"==typeof o?function(e){return e.pipe(t(function(r,n){return u.from(i(r,n)).pipe(c.map(function(e,t){return o(r,e,n,t)}))}))}:function(e){return e.lift(new h(i))}};var h=function(){function e(e){this.project=e}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.project))},e}(),l=function(n){function e(e,t){var r=n.call(this,e)||this;return r.project=t,r.index=0,r}return i(e,n),e.prototype._next=function(e){var t,r=this.index++;try{t=this.project(e,r)}catch(e){return void this.destination.error(e)}this._innerSub(t,e,r)},e.prototype._innerSub=function(e,t,r){var n=this.innerSubscription;n&&n.unsubscribe();var i=new s.InnerSubscriber(this,void 0,void 0);this.destination.add(i),this.innerSubscription=a.subscribeToResult(this,e,t,r,i)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||n.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=null},e.prototype.notifyComplete=function(e){this.destination.remove(e),this.innerSubscription=null,this.isStopped&&n.prototype._complete.call(this)},e.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)},e}(o.OuterSubscriber)},{"../InnerSubscriber":29,"../OuterSubscriber":33,"../observable/from":50,"../util/subscribeToResult":221,"./map":111}],153:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./switchMap");r.switchMapTo=function(e,t){return t?n.switchMap(function(){return e},t):n.switchMap(function(){return e})}},{"./switchMap":152}],154:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../util/ArgumentOutOfRangeError"),a=e("../observable/empty");r.take=function(t){return function(e){return 0===t?a.empty():e.lift(new c(t))}};var c=function(){function e(e){if(this.total=e,this.total<0)throw new s.ArgumentOutOfRangeError}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.total))},e}(),u=function(n){function e(e,t){var r=n.call(this,e)||this;return r.total=t,r.count=0,r}return i(e,n),e.prototype._next=function(e){var t=this.total,r=++this.count;r<=t&&(this.destination.next(e),r===t&&(this.destination.complete(),this.unsubscribe()))},e}(o.Subscriber)},{"../Subscriber":38,"../observable/empty":48,"../util/ArgumentOutOfRangeError":192}],155:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../util/ArgumentOutOfRangeError"),a=e("../observable/empty");r.takeLast=function(t){return function(e){return 0===t?a.empty():e.lift(new c(t))}};var c=function(){function e(e){if(this.total=e,this.total<0)throw new s.ArgumentOutOfRangeError}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.total))},e}(),u=function(n){function e(e,t){var r=n.call(this,e)||this;return r.total=t,r.ring=new Array,r.count=0,r}return i(e,n),e.prototype._next=function(e){var t=this.ring,r=this.total,n=this.count++;t.length<r?t.push(e):t[n%r]=e},e.prototype._complete=function(){var e=this.destination,t=this.count;if(0<t)for(var r=this.count>=this.total?this.total:this.count,n=this.ring,i=0;i<r;i++){var o=t++%r;e.next(n[o])}e.complete()},e}(o.Subscriber)},{"../Subscriber":38,"../observable/empty":48,"../util/ArgumentOutOfRangeError":192}],156:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.takeUntil=function(t){return function(e){return e.lift(new a(t))}};var a=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var r=new c(e),n=s.subscribeToResult(r,this.notifier);return n&&!r.seenValue?(r.add(n),t.subscribe(r)):r},e}(),c=function(r){function e(e){var t=r.call(this,e)||this;return t.seenValue=!1,t}return i(e,r),e.prototype.notifyNext=function(e,t,r,n,i){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],157:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.takeWhile=function(t){return function(e){return e.lift(new s(t))}};var s=function(){function e(e){this.predicate=e}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate))},e}(),a=function(n){function e(e,t){var r=n.call(this,e)||this;return r.predicate=t,r.index=0,r}return i(e,n),e.prototype._next=function(e){var t,r=this.destination;try{t=this.predicate(e,this.index++)}catch(e){return void r.error(e)}this.nextOrComplete(e,t)},e.prototype.nextOrComplete=function(e,t){var r=this.destination;Boolean(t)?r.next(e):r.complete()},e}(o.Subscriber)},{"../Subscriber":38}],158:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../util/noop"),a=e("../util/isFunction");r.tap=function(t,r,n){return function(e){return e.lift(new c(t,r,n))}};var c=function(){function e(e,t,r){this.nextOrObserver=e,this.error=t,this.complete=r}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.nextOrObserver,this.error,this.complete))},e}(),u=function(o){function e(e,t,r,n){var i=o.call(this,e)||this;return i._tapNext=s.noop,i._tapError=s.noop,i._tapComplete=s.noop,i._tapError=r||s.noop,i._tapComplete=n||s.noop,a.isFunction(t)?(i._context=i)._tapNext=t:t&&(i._context=t,i._tapNext=t.next||s.noop,i._tapError=t.error||s.noop,i._tapComplete=t.complete||s.noop),i}return i(e,o),e.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},e.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},e}(o.Subscriber)},{"../Subscriber":38,"../util/isFunction":205,"../util/noop":213}],159:[function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(n,"__esModule",{value:!0});var o=e("../OuterSubscriber"),s=e("../util/subscribeToResult");n.defaultThrottleConfig={leading:!0,trailing:!1},n.throttle=function(t,r){return void 0===r&&(r=n.defaultThrottleConfig),function(e){return e.lift(new a(t,r.leading,r.trailing))}};var a=function(){function e(e,t,r){this.durationSelector=e,this.leading=t,this.trailing=r}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.durationSelector,this.leading,this.trailing))},e}(),c=function(o){function e(e,t,r,n){var i=o.call(this,e)||this;return i.destination=e,i.durationSelector=t,i._leading=r,i._trailing=n,i._hasValue=!1,i}return r(e,o),e.prototype._next=function(e){this._hasValue=!0,this._sendValue=e,this._throttled||(this._leading?this.send():this.throttle(e))},e.prototype.send=function(){var e=this._hasValue,t=this._sendValue;e&&(this.destination.next(t),this.throttle(t)),this._hasValue=!1,this._sendValue=null},e.prototype.throttle=function(e){var t=this.tryDurationSelector(e);t&&this.add(this._throttled=s.subscribeToResult(this,t))},e.prototype.tryDurationSelector=function(e){try{return this.durationSelector(e)}catch(e){return this.destination.error(e),null}},e.prototype.throttlingDone=function(){var e=this._throttled,t=this._trailing;e&&e.unsubscribe(),this._throttled=null,t&&this.send()},e.prototype.notifyNext=function(e,t,r,n,i){this.throttlingDone()},e.prototype.notifyComplete=function(){this.throttlingDone()},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],160:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber"),s=e("../scheduler/async"),a=e("./throttle");r.throttleTime=function(t,r,n){return void 0===r&&(r=s.async),void 0===n&&(n=a.defaultThrottleConfig),function(e){return e.lift(new c(t,r,n.leading,n.trailing))}};var c=function(){function e(e,t,r,n){this.duration=e,this.scheduler=t,this.leading=r,this.trailing=n}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),u=function(s){function e(e,t,r,n,i){var o=s.call(this,e)||this;return o.duration=t,o.scheduler=r,o.leading=n,o.trailing=i,o._hasTrailingValue=!1,o._trailingValue=null,o}return i(e,s),e.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(h,this.duration,{subscriber:this})),this.leading&&this.destination.next(e))},e.prototype._complete=function(){this._hasTrailingValue&&this.destination.next(this._trailingValue),this.destination.complete()},e.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},e}(o.Subscriber);function h(e){e.subscriber.clearThrottle()}},{"../Subscriber":38,"../scheduler/async":187,"./throttle":159}],161:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./tap"),i=e("../util/EmptyError");function o(){return new i.EmptyError}r.throwIfEmpty=function(e){return void 0===e&&(e=o),n.tap({hasValue:!1,next:function(){this.hasValue=!0},complete:function(){if(!this.hasValue)throw e()}})}},{"../util/EmptyError":193,"./tap":158}],162:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../scheduler/async"),o=e("./scan"),s=e("../observable/defer"),a=e("./map");r.timeInterval=function(n){return void 0===n&&(n=i.async),function(e){return s.defer(function(){return e.pipe(o.scan(function(e,t){var r=e.current;return{value:t,current:n.now(),last:r}},{current:n.now(),value:void 0,last:void 0}),a.map(function(e){var t=e.current,r=e.last,n=e.value;return new c(n,t-r)}))})}};var c=function(e,t){this.value=e,this.interval=t};r.TimeInterval=c},{"../observable/defer":47,"../scheduler/async":187,"./map":111,"./scan":140}],163:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../scheduler/async"),i=e("../util/TimeoutError"),o=e("./timeoutWith"),s=e("../observable/throwError");r.timeout=function(e,t){return void 0===t&&(t=n.async),o.timeoutWith(e,s.throwError(new i.TimeoutError),t)}},{"../observable/throwError":68,"../scheduler/async":187,"../util/TimeoutError":196,"./timeoutWith":164}],164:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../scheduler/async"),a=e("../util/isDate"),o=e("../OuterSubscriber"),c=e("../util/subscribeToResult");r.timeoutWith=function(n,i,o){return void 0===o&&(o=s.async),function(e){var t=a.isDate(n),r=t?+n-o.now():Math.abs(n);return e.lift(new u(r,t,i,o))}};var u=function(){function e(e,t,r,n){this.waitFor=e,this.absoluteTimeout=t,this.withObservable=r,this.scheduler=n}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},e}(),h=function(s){function t(e,t,r,n,i){var o=s.call(this,e)||this;return o.absoluteTimeout=t,o.waitFor=r,o.withObservable=n,o.scheduler=i,o.action=null,o.scheduleTimeout(),o}return i(t,s),t.dispatchTimeout=function(e){var t=e.withObservable;e._unsubscribeAndRecycle(),e.add(c.subscribeToResult(e,t))},t.prototype.scheduleTimeout=function(){var e=this.action;e?this.action=e.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(t.dispatchTimeout,this.waitFor,this))},t.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),s.prototype._next.call(this,e)},t.prototype._unsubscribe=function(){this.action=null,this.scheduler=null,this.withObservable=null},t}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../scheduler/async":187,"../util/isDate":204,"../util/subscribeToResult":221}],165:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../scheduler/async"),i=e("./map");r.timestamp=function(t){return void 0===t&&(t=n.async),i.map(function(e){return new o(e,t.now())})};var o=function(e,t){this.value=e,this.timestamp=t};r.Timestamp=o},{"../scheduler/async":187,"./map":111}],166:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./reduce");function i(e,t,r){return 0===r?[t]:(e.push(t),e)}r.toArray=function(){return n.reduce(i,[])}},{"./reduce":132}],167:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subject"),s=e("../OuterSubscriber"),a=e("../util/subscribeToResult");r.window=function(t){return function(e){return e.lift(new c(t))}};var c=function(){function e(e){this.windowBoundaries=e}return e.prototype.call=function(e,t){var r=new u(e),n=t.subscribe(r);return n.closed||r.add(a.subscribeToResult(r,this.windowBoundaries)),n},e}(),u=function(r){function e(e){var t=r.call(this,e)||this;return t.window=new o.Subject,e.next(t.window),t}return i(e,r),e.prototype.notifyNext=function(e,t,r,n,i){this.openWindow()},e.prototype.notifyError=function(e,t){this._error(e)},e.prototype.notifyComplete=function(e){this._complete()},e.prototype._next=function(e){this.window.next(e)},e.prototype._error=function(e){this.window.error(e),this.destination.error(e)},e.prototype._complete=function(){this.window.complete(),this.destination.complete()},e.prototype._unsubscribe=function(){this.window=null},e.prototype.openWindow=function(){var e=this.window;e&&e.complete();var t=this.destination,r=this.window=new o.Subject;t.next(r)},e}(s.OuterSubscriber)},{"../OuterSubscriber":33,"../Subject":36,"../util/subscribeToResult":221}],168:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber"),u=e("../Subject");r.windowCount=function(t,r){return void 0===r&&(r=0),function(e){return e.lift(new s(t,r))}};var s=function(){function e(e,t){this.windowSize=e,this.startWindowEvery=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.windowSize,this.startWindowEvery))},e}(),a=function(i){function e(e,t,r){var n=i.call(this,e)||this;return n.destination=e,n.windowSize=t,n.startWindowEvery=r,n.windows=[new u.Subject],n.count=0,e.next(n.windows[0]),n}return o(e,i),e.prototype._next=function(e){for(var t=0<this.startWindowEvery?this.startWindowEvery:this.windowSize,r=this.destination,n=this.windowSize,i=this.windows,o=i.length,s=0;s<o&&!this.closed;s++)i[s].next(e);var a=this.count-n+1;if(0<=a&&a%t==0&&!this.closed&&i.shift().complete(),++this.count%t==0&&!this.closed){var c=new u.Subject;i.push(c),r.next(c)}},e.prototype._error=function(e){var t=this.windows;if(t)for(;0<t.length&&!this.closed;)t.shift().error(e);this.destination.error(e)},e.prototype._complete=function(){var e=this.windows;if(e)for(;0<e.length&&!this.closed;)e.shift().complete();this.destination.complete()},e.prototype._unsubscribe=function(){this.count=0,this.windows=null},e}(i.Subscriber)},{"../Subject":36,"../Subscriber":38}],169:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subject"),s=e("../scheduler/async"),a=e("../Subscriber"),c=e("../util/isNumeric"),u=e("../util/isScheduler");r.windowTime=function(t){var r=s.async,n=null,i=Number.POSITIVE_INFINITY;return u.isScheduler(arguments[3])&&(r=arguments[3]),u.isScheduler(arguments[2])?r=arguments[2]:c.isNumeric(arguments[2])&&(i=arguments[2]),u.isScheduler(arguments[1])?r=arguments[1]:c.isNumeric(arguments[1])&&(n=arguments[1]),function(e){return e.lift(new h(t,n,i,r))}};var h=function(){function e(e,t,r,n){this.windowTimeSpan=e,this.windowCreationInterval=t,this.maxWindowSize=r,this.scheduler=n}return e.prototype.call=function(e,t){return t.subscribe(new p(e,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},e}(),l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}return i(e,t),e.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),e}(o.Subject),p=function(h){function e(e,t,r,n,i){var o=h.call(this,e)||this;o.destination=e,o.windowTimeSpan=t,o.windowCreationInterval=r,o.maxWindowSize=n,o.scheduler=i,o.windows=[];var s=o.openWindow();if(null!==r&&0<=r){var a={subscriber:o,window:s,context:null},c={windowTimeSpan:t,windowCreationInterval:r,subscriber:o,scheduler:i};o.add(i.schedule(m,t,a)),o.add(i.schedule(d,r,c))}else{var u={subscriber:o,window:s,windowTimeSpan:t};o.add(i.schedule(f,t,u))}return o}return i(e,h),e.prototype._next=function(e){for(var t=this.windows,r=t.length,n=0;n<r;n++){var i=t[n];i.closed||(i.next(e),i.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(i))}},e.prototype._error=function(e){for(var t=this.windows;0<t.length;)t.shift().error(e);this.destination.error(e)},e.prototype._complete=function(){for(var e=this.windows;0<e.length;){var t=e.shift();t.closed||t.complete()}this.destination.complete()},e.prototype.openWindow=function(){var e=new l;return this.windows.push(e),this.destination.next(e),e},e.prototype.closeWindow=function(e){e.complete();var t=this.windows;t.splice(t.indexOf(e),1)},e}(a.Subscriber);function f(e){var t=e.subscriber,r=e.windowTimeSpan,n=e.window;n&&t.closeWindow(n),e.window=t.openWindow(),this.schedule(e,r)}function d(e){var t=e.windowTimeSpan,r=e.subscriber,n=e.scheduler,i=e.windowCreationInterval,o=r.openWindow(),s={action:this,subscription:null},a={subscriber:r,window:o,context:s};s.subscription=n.schedule(m,t,a),this.add(s.subscription),this.schedule(e,i)}function m(e){var t=e.subscriber,r=e.window,n=e.context;n&&n.action&&n.subscription&&n.action.remove(n.subscription),t.closeWindow(r)}},{"../Subject":36,"../Subscriber":38,"../scheduler/async":187,"../util/isNumeric":208,"../util/isScheduler":212}],170:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var l=e("../Subject"),p=e("../Subscription"),f=e("../util/tryCatch"),d=e("../util/errorObject"),o=e("../OuterSubscriber"),m=e("../util/subscribeToResult");r.windowToggle=function(t,r){return function(e){return e.lift(new s(t,r))}};var s=function(){function e(e,t){this.openings=e,this.closingSelector=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.openings,this.closingSelector))},e}(),a=function(o){function e(e,t,r){var n=o.call(this,e)||this;return n.openings=t,n.closingSelector=r,n.contexts=[],n.add(n.openSubscription=m.subscribeToResult(n,t,t)),n}return i(e,o),e.prototype._next=function(e){var t=this.contexts;if(t)for(var r=t.length,n=0;n<r;n++)t[n].window.next(e)},e.prototype._error=function(e){var t=this.contexts;if(this.contexts=null,t)for(var r=t.length,n=-1;++n<r;){var i=t[n];i.window.error(e),i.subscription.unsubscribe()}o.prototype._error.call(this,e)},e.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var t=e.length,r=-1;++r<t;){var n=e[r];n.window.complete(),n.subscription.unsubscribe()}o.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var e=this.contexts;if(this.contexts=null,e)for(var t=e.length,r=-1;++r<t;){var n=e[r];n.window.unsubscribe(),n.subscription.unsubscribe()}},e.prototype.notifyNext=function(e,t,r,n,i){if(e===this.openings){var o=this.closingSelector,s=f.tryCatch(o)(t);if(s===d.errorObject)return this.error(d.errorObject.e);var a=new l.Subject,c=new p.Subscription,u={window:a,subscription:c};this.contexts.push(u);var h=m.subscribeToResult(this,s,u);h.closed?this.closeWindow(this.contexts.length-1):(h.context=u,c.add(h)),this.destination.next(a)}else this.closeWindow(this.contexts.indexOf(e))},e.prototype.notifyError=function(e){this.error(e)},e.prototype.notifyComplete=function(e){e!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(e.context))},e.prototype.closeWindow=function(e){if(-1!==e){var t=this.contexts,r=t[e],n=r.window,i=r.subscription;t.splice(e,1),n.complete(),i.unsubscribe()}},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../Subject":36,"../Subscription":39,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],171:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subject"),s=e("../util/tryCatch"),a=e("../util/errorObject"),c=e("../OuterSubscriber"),u=e("../util/subscribeToResult");r.windowWhen=function(t){return function(e){return e.lift(new h(t))}};var h=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.closingSelector))},e}(),l=function(n){function e(e,t){var r=n.call(this,e)||this;return r.destination=e,r.closingSelector=t,r.openWindow(),r}return i(e,n),e.prototype.notifyNext=function(e,t,r,n,i){this.openWindow(i)},e.prototype.notifyError=function(e,t){this._error(e)},e.prototype.notifyComplete=function(e){this.openWindow(e)},e.prototype._next=function(e){this.window.next(e)},e.prototype._error=function(e){this.window.error(e),this.destination.error(e),this.unsubscribeClosingNotification()},e.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},e.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},e.prototype.openWindow=function(e){void 0===e&&(e=null),e&&(this.remove(e),e.unsubscribe());var t=this.window;t&&t.complete();var r=this.window=new o.Subject;this.destination.next(r);var n=s.tryCatch(this.closingSelector)();if(n===a.errorObject){var i=a.errorObject.e;this.destination.error(i),this.window.error(i)}else this.add(this.closingNotification=u.subscribeToResult(this,n))},e}(c.OuterSubscriber)},{"../OuterSubscriber":33,"../Subject":36,"../util/errorObject":199,"../util/subscribeToResult":221,"../util/tryCatch":223}],172:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../OuterSubscriber"),c=e("../util/subscribeToResult");r.withLatestFrom=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return function(e){var t;"function"==typeof n[n.length-1]&&(t=n.pop());var r=n;return e.lift(new s(r,t))}};var s=function(){function e(e,t){this.observables=e,this.project=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.observables,this.project))},e}(),a=function(a){function e(e,t,r){var n=a.call(this,e)||this;n.observables=t,n.project=r,n.toRespond=[];var i=t.length;n.values=new Array(i);for(var o=0;o<i;o++)n.toRespond.push(o);for(o=0;o<i;o++){var s=t[o];n.add(c.subscribeToResult(n,s,s,o))}return n}return i(e,a),e.prototype.notifyNext=function(e,t,r,n,i){this.values[r]=t;var o=this.toRespond;if(0<o.length){var s=o.indexOf(r);-1!==s&&o.splice(s,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(e){if(0===this.toRespond.length){var t=[e].concat(this.values);this.project?this._tryProject(t):this.destination.next(t)}},e.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},e}(o.OuterSubscriber)},{"../OuterSubscriber":33,"../util/subscribeToResult":221}],173:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../observable/zip");r.zip=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(n.zip.apply(void 0,[e].concat(t)))}}},{"../observable/zip":71}],174:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../observable/zip");r.zipAll=function(t){return function(e){return e.lift(new n.ZipOperator(t))}}},{"../observable/zip":71}],175:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(r){function e(e,t){return r.call(this)||this}return i(e,r),e.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},e}(e("../Subscription").Subscription);r.Action=o},{"../Subscription":39}],176:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.scheduler=e,r.work=t,r}return i(e,n),e.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),null!==r&&0<r?n.prototype.requestAsyncId.call(this,e,t,r):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame(function(){return e.flush(null)})))},e.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!==r&&0<r||null===r&&0<this.delay)return n.prototype.recycleAsyncId.call(this,e,t,r);0===e.actions.length&&(cancelAnimationFrame(t),e.scheduled=void 0)},e}(e("./AsyncAction").AsyncAction);r.AnimationFrameAction=o},{"./AsyncAction":180}],177:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,r=this.actions,n=-1,i=r.length;e=e||r.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<i&&(e=r.shift()));if(this.active=!1,t){for(;++n<i&&(e=r.shift());)e.unsubscribe();throw t}},t}(e("./AsyncScheduler").AsyncScheduler);r.AnimationFrameScheduler=o},{"./AsyncScheduler":181}],178:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../util/Immediate"),s=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.scheduler=e,r.work=t,r}return i(e,n),e.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),null!==r&&0<r?n.prototype.requestAsyncId.call(this,e,t,r):(e.actions.push(this),e.scheduled||(e.scheduled=o.Immediate.setImmediate(e.flush.bind(e,null))))},e.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!==r&&0<r||null===r&&0<this.delay)return n.prototype.recycleAsyncId.call(this,e,t,r);0===e.actions.length&&(o.Immediate.clearImmediate(t),e.scheduled=void 0)},e}(e("./AsyncAction").AsyncAction);r.AsapAction=s},{"../util/Immediate":194,"./AsyncAction":180}],179:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,r=this.actions,n=-1,i=r.length;e=e||r.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<i&&(e=r.shift()));if(this.active=!1,t){for(;++n<i&&(e=r.shift());)e.unsubscribe();throw t}},t}(e("./AsyncScheduler").AsyncScheduler);r.AsapScheduler=o},{"./AsyncScheduler":181}],180:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.scheduler=e,r.work=t,r.pending=!1,r}return i(e,n),e.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(n,this.id,t),this},e.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),setInterval(e.flush.bind(e,this),r)},e.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending)return t;clearInterval(t)},e.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(e,t){var r=!1,n=void 0;try{this.work(e)}catch(e){r=!0,n=!!e&&e||new Error(e)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,r=t.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},e}(e("./Action").Action);r.AsyncAction=o},{"./Action":175}],181:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../Scheduler"),i=function(n){function i(e,t){void 0===t&&(t=s.Scheduler.now);var r=n.call(this,e,function(){return i.delegate&&i.delegate!==r?i.delegate.now():t()})||this;return r.actions=[],r.active=!1,r.scheduled=void 0,r}return o(i,n),i.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),i.delegate&&i.delegate!==this?i.delegate.schedule(e,t,r):n.prototype.schedule.call(this,e,t,r)},i.prototype.flush=function(e){var t=this.actions;if(this.active)t.push(e);else{var r;this.active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this.active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},i}(s.Scheduler);r.AsyncScheduler=i},{"../Scheduler":35}],182:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.scheduler=e,r.work=t,r}return i(e,n),e.prototype.schedule=function(e,t){return void 0===t&&(t=0),0<t?n.prototype.schedule.call(this,e,t):(this.delay=t,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,t){return 0<t||this.closed?n.prototype.execute.call(this,e,t):this._execute(e,t)},e.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),null!==r&&0<r||null===r&&0<this.delay?n.prototype.requestAsyncId.call(this,e,t,r):e.flush(this)},e}(e("./AsyncAction").AsyncAction);r.QueueAction=o},{"./AsyncAction":180}],183:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(e("./AsyncScheduler").AsyncScheduler);r.QueueScheduler=o},{"./AsyncScheduler":181}],184:[function(e,t,r){"use strict";var n,s=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("./AsyncAction"),o=function(n){function e(e,t){void 0===e&&(e=a),void 0===t&&(t=Number.POSITIVE_INFINITY);var r=n.call(this,e,function(){return r.frame})||this;return r.maxFrames=t,r.frame=0,r.index=-1,r}return s(e,n),e.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r.shift())&&(this.frame=t.delay)<=n&&!(e=t.execute(t.state,t.delay)););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},e.frameTimeFactor=10,e}(e("./AsyncScheduler").AsyncScheduler);r.VirtualTimeScheduler=o;var a=function(i){function o(e,t,r){void 0===r&&(r=e.index+=1);var n=i.call(this,e,t)||this;return n.scheduler=e,n.work=t,n.index=r,n.active=!0,n.index=e.index=r,n}return s(o,i),o.prototype.schedule=function(e,t){if(void 0===t&&(t=0),!this.id)return i.prototype.schedule.call(this,e,t);this.active=!1;var r=new o(this.scheduler,this.work);return this.add(r),r.schedule(e,t)},o.prototype.requestAsyncId=function(e,t,r){void 0===r&&(r=0),this.delay=e.frame+r;var n=e.actions;return n.push(this),n.sort(o.sortActions),!0},o.prototype.recycleAsyncId=function(e,t,r){void 0===r&&(r=0)},o.prototype._execute=function(e,t){if(!0===this.active)return i.prototype._execute.call(this,e,t)},o.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},o}(i.AsyncAction);r.VirtualAction=a},{"./AsyncAction":180,"./AsyncScheduler":181}],185:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./AnimationFrameAction"),i=e("./AnimationFrameScheduler");r.animationFrame=new i.AnimationFrameScheduler(n.AnimationFrameAction)},{"./AnimationFrameAction":176,"./AnimationFrameScheduler":177}],186:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./AsapAction"),i=e("./AsapScheduler");r.asap=new i.AsapScheduler(n.AsapAction)},{"./AsapAction":178,"./AsapScheduler":179}],187:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./AsyncAction"),i=e("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":180,"./AsyncScheduler":181}],188:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./QueueAction"),i=e("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":182,"./QueueScheduler":183}],189:[function(e,t,r){"use strict";function n(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}Object.defineProperty(r,"__esModule",{value:!0}),r.getSymbolIterator=n,r.iterator=n(),r.$$iterator=r.iterator},{}],190:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],191:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),r.$$rxSubscriber=r.rxSubscriber},{}],192:[function(e,t,r){"use strict";function n(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype=Object.create(Error.prototype),r.ArgumentOutOfRangeError=n},{}],193:[function(e,t,r){"use strict";function n(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype=Object.create(Error.prototype),r.EmptyError=n},{}],194:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=1,i={};r.Immediate={setImmediate:function(e){var t=n++;return i[t]=e,Promise.resolve().then(function(){var e;(e=i[t])&&e()}),t},clearImmediate:function(e){delete i[e]}}},{}],195:[function(e,t,r){"use strict";function n(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype=Object.create(Error.prototype),r.ObjectUnsubscribedError=n},{}],196:[function(e,t,r){"use strict";function n(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype=Object.create(Error.prototype),r.TimeoutError=n},{}],197:[function(e,t,r){"use strict";function n(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(e,t){return t+1+") "+e.toString()}).join("\n  "):"",this.name="UnsubscriptionError",this.errors=e,this}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype=Object.create(Error.prototype),r.UnsubscriptionError=n},{}],198:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../Subscriber");r.canReportError=function(e){for(;e;){var t=e,r=t.closed,n=t.destination,i=t.isStopped;if(r||i)return!1;e=n&&n instanceof o.Subscriber?n:null}return!0}},{"../Subscriber":38}],199:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.errorObject={e:{}}},{}],200:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hostReportError=function(e){setTimeout(function(){throw e})}},{}],201:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(e){return e}},{}],202:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArray=Array.isArray||function(e){return e&&"number"==typeof e.length}},{}],203:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},{}],204:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isDate=function(e){return e instanceof Date&&!isNaN(+e)}},{}],205:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFunction=function(e){return"function"==typeof e}},{}],206:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../symbol/observable");r.isInteropObservable=function(e){return e&&"function"==typeof e[n.observable]}},{"../symbol/observable":190}],207:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../symbol/iterator");r.isIterable=function(e){return e&&"function"==typeof e[n.iterator]}},{"../symbol/iterator":189}],208:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./isArray");r.isNumeric=function(e){return!n.isArray(e)&&0<=e-parseFloat(e)+1}},{"./isArray":202}],209:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isObject=function(e){return null!=e&&"object"==typeof e}},{}],210:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable");r.isObservable=function(e){return!!e&&(e instanceof n.Observable||"function"==typeof e.lift&&"function"==typeof e.subscribe)}},{"../Observable":31}],211:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isPromise=function(e){return e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}},{}],212:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isScheduler=function(e){return e&&"function"==typeof e.schedule}},{}],213:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.noop=function(){}},{}],214:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.not=function(e,t){function r(){return!r.pred.apply(r.thisArg,arguments)}return r.pred=e,r.thisArg=t,r}},{}],215:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./noop");function i(t){return t?1===t.length?t[0]:function(e){return t.reduce(function(e,t){return t(e)},e)}:n.noop}r.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(e)},r.pipeFromArray=i},{"./noop":213}],216:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Observable"),i=e("./subscribeToArray"),o=e("./subscribeToPromise"),s=e("./subscribeToIterable"),a=e("./subscribeToObservable"),c=e("./isArrayLike"),u=e("./isPromise"),h=e("./isObject"),l=e("../symbol/iterator"),p=e("../symbol/observable");r.subscribeTo=function(t){if(t instanceof n.Observable)return function(e){return t._isScalar?(e.next(t.value),void e.complete()):t.subscribe(e)};if(t&&"function"==typeof t[p.observable])return a.subscribeToObservable(t);if(c.isArrayLike(t))return i.subscribeToArray(t);if(u.isPromise(t))return o.subscribeToPromise(t);if(t&&"function"==typeof t[l.iterator])return s.subscribeToIterable(t);var e=h.isObject(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},{"../Observable":31,"../symbol/iterator":189,"../symbol/observable":190,"./isArrayLike":203,"./isObject":209,"./isPromise":211,"./subscribeToArray":217,"./subscribeToIterable":218,"./subscribeToObservable":219,"./subscribeToPromise":220}],217:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.subscribeToArray=function(n){return function(e){for(var t=0,r=n.length;t<r&&!e.closed;t++)e.next(n[t]);e.closed||e.complete()}}},{}],218:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../symbol/iterator");r.subscribeToIterable=function(n){return function(e){for(var t=n[i.iterator]();;){var r=t.next();if(r.done){e.complete();break}if(e.next(r.value),e.closed)break}return"function"==typeof t.return&&e.add(function(){t.return&&t.return()}),e}}},{"../symbol/iterator":189}],219:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../symbol/observable");r.subscribeToObservable=function(r){return function(e){var t=r[n.observable]();if("function"!=typeof t.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return t.subscribe(e)}}},{"../symbol/observable":190}],220:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./hostReportError");r.subscribeToPromise=function(e){return function(t){return e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,n.hostReportError),t}}},{"./hostReportError":200}],221:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("../InnerSubscriber"),s=e("./subscribeTo");r.subscribeToResult=function(e,t,r,n,i){if(void 0===i&&(i=new o.InnerSubscriber(e,r,n)),!i.closed)return s.subscribeTo(t)(i)}},{"../InnerSubscriber":29,"./subscribeTo":216}],222:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Subscriber"),i=e("../symbol/rxSubscriber"),o=e("../Observer");r.toSubscriber=function(e,t,r){if(e){if(e instanceof n.Subscriber)return e;if(e[i.rxSubscriber])return e[i.rxSubscriber]()}return e||t||r?new n.Subscriber(e,t,r):new n.Subscriber(o.empty)}},{"../Observer":32,"../Subscriber":38,"../symbol/rxSubscriber":191}],223:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("./errorObject");function o(){try{return n.apply(this,arguments)}catch(e){return i.errorObject.e=e,i.errorObject}}r.tryCatch=function(e){return n=e,o}},{"./errorObject":199}],224:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../internal/operators/audit");r.audit=n.audit;var i=e("../internal/operators/auditTime");r.auditTime=i.auditTime;var o=e("../internal/operators/buffer");r.buffer=o.buffer;var s=e("../internal/operators/bufferCount");r.bufferCount=s.bufferCount;var a=e("../internal/operators/bufferTime");r.bufferTime=a.bufferTime;var c=e("../internal/operators/bufferToggle");r.bufferToggle=c.bufferToggle;var u=e("../internal/operators/bufferWhen");r.bufferWhen=u.bufferWhen;var h=e("../internal/operators/catchError");r.catchError=h.catchError;var l=e("../internal/operators/combineAll");r.combineAll=l.combineAll;var p=e("../internal/operators/combineLatest");r.combineLatest=p.combineLatest;var f=e("../internal/operators/concat");r.concat=f.concat;var d=e("../internal/operators/concatAll");r.concatAll=d.concatAll;var m=e("../internal/operators/concatMap");r.concatMap=m.concatMap;var v=e("../internal/operators/concatMapTo");r.concatMapTo=v.concatMapTo;var g=e("../internal/operators/count");r.count=g.count;var y=e("../internal/operators/debounce");r.debounce=y.debounce;var _=e("../internal/operators/debounceTime");r.debounceTime=_.debounceTime;var b=e("../internal/operators/defaultIfEmpty");r.defaultIfEmpty=b.defaultIfEmpty;var x=e("../internal/operators/delay");r.delay=x.delay;var w=e("../internal/operators/delayWhen");r.delayWhen=w.delayWhen;var S=e("../internal/operators/dematerialize");r.dematerialize=S.dematerialize;var M=e("../internal/operators/distinct");r.distinct=M.distinct;var C=e("../internal/operators/distinctUntilChanged");r.distinctUntilChanged=C.distinctUntilChanged;var E=e("../internal/operators/distinctUntilKeyChanged");r.distinctUntilKeyChanged=E.distinctUntilKeyChanged;var T=e("../internal/operators/elementAt");r.elementAt=T.elementAt;var O=e("../internal/operators/endWith");r.endWith=O.endWith;var P=e("../internal/operators/every");r.every=P.every;var A=e("../internal/operators/exhaust");r.exhaust=A.exhaust;var j=e("../internal/operators/exhaustMap");r.exhaustMap=j.exhaustMap;var R=e("../internal/operators/expand");r.expand=R.expand;var L=e("../internal/operators/filter");r.filter=L.filter;var N=e("../internal/operators/finalize");r.finalize=N.finalize;var I=e("../internal/operators/find");r.find=I.find;var D=e("../internal/operators/findIndex");r.findIndex=D.findIndex;var k=e("../internal/operators/first");r.first=k.first;var B=e("../internal/operators/groupBy");r.groupBy=B.groupBy;var F=e("../internal/operators/ignoreElements");r.ignoreElements=F.ignoreElements;var $=e("../internal/operators/isEmpty");r.isEmpty=$.isEmpty;var U=e("../internal/operators/last");r.last=U.last;var z=e("../internal/operators/map");r.map=z.map;var G=e("../internal/operators/mapTo");r.mapTo=G.mapTo;var V=e("../internal/operators/materialize");r.materialize=V.materialize;var H=e("../internal/operators/max");r.max=H.max;var q=e("../internal/operators/merge");r.merge=q.merge;var W=e("../internal/operators/mergeAll");r.mergeAll=W.mergeAll;var X=e("../internal/operators/mergeMap");r.mergeMap=X.mergeMap;var Y=e("../internal/operators/mergeMap");r.flatMap=Y.mergeMap;var K=e("../internal/operators/mergeMapTo");r.mergeMapTo=K.mergeMapTo;var Z=e("../internal/operators/mergeScan");r.mergeScan=Z.mergeScan;var J=e("../internal/operators/min");r.min=J.min;var Q=e("../internal/operators/multicast");r.multicast=Q.multicast;var ee=e("../internal/operators/observeOn");r.observeOn=ee.observeOn;var te=e("../internal/operators/onErrorResumeNext");r.onErrorResumeNext=te.onErrorResumeNext;var re=e("../internal/operators/pairwise");r.pairwise=re.pairwise;var ne=e("../internal/operators/partition");r.partition=ne.partition;var ie=e("../internal/operators/pluck");r.pluck=ie.pluck;var oe=e("../internal/operators/publish");r.publish=oe.publish;var se=e("../internal/operators/publishBehavior");r.publishBehavior=se.publishBehavior;var ae=e("../internal/operators/publishLast");r.publishLast=ae.publishLast;var ce=e("../internal/operators/publishReplay");r.publishReplay=ce.publishReplay;var ue=e("../internal/operators/race");r.race=ue.race;var he=e("../internal/operators/reduce");r.reduce=he.reduce;var le=e("../internal/operators/repeat");r.repeat=le.repeat;var pe=e("../internal/operators/repeatWhen");r.repeatWhen=pe.repeatWhen;var fe=e("../internal/operators/retry");r.retry=fe.retry;var de=e("../internal/operators/retryWhen");r.retryWhen=de.retryWhen;var me=e("../internal/operators/refCount");r.refCount=me.refCount;var ve=e("../internal/operators/sample");r.sample=ve.sample;var ge=e("../internal/operators/sampleTime");r.sampleTime=ge.sampleTime;var ye=e("../internal/operators/scan");r.scan=ye.scan;var _e=e("../internal/operators/sequenceEqual");r.sequenceEqual=_e.sequenceEqual;var be=e("../internal/operators/share");r.share=be.share;var xe=e("../internal/operators/shareReplay");r.shareReplay=xe.shareReplay;var we=e("../internal/operators/single");r.single=we.single;var Se=e("../internal/operators/skip");r.skip=Se.skip;var Me=e("../internal/operators/skipLast");r.skipLast=Me.skipLast;var Ce=e("../internal/operators/skipUntil");r.skipUntil=Ce.skipUntil;var Ee=e("../internal/operators/skipWhile");r.skipWhile=Ee.skipWhile;var Te=e("../internal/operators/startWith");r.startWith=Te.startWith;var Oe=e("../internal/operators/subscribeOn");r.subscribeOn=Oe.subscribeOn;var Pe=e("../internal/operators/switchAll");r.switchAll=Pe.switchAll;var Ae=e("../internal/operators/switchMap");r.switchMap=Ae.switchMap;var je=e("../internal/operators/switchMapTo");r.switchMapTo=je.switchMapTo;var Re=e("../internal/operators/take");r.take=Re.take;var Le=e("../internal/operators/takeLast");r.takeLast=Le.takeLast;var Ne=e("../internal/operators/takeUntil");r.takeUntil=Ne.takeUntil;var Ie=e("../internal/operators/takeWhile");r.takeWhile=Ie.takeWhile;var De=e("../internal/operators/tap");r.tap=De.tap;var ke=e("../internal/operators/throttle");r.throttle=ke.throttle;var Be=e("../internal/operators/throttleTime");r.throttleTime=Be.throttleTime;var Fe=e("../internal/operators/throwIfEmpty");r.throwIfEmpty=Fe.throwIfEmpty;var $e=e("../internal/operators/timeInterval");r.timeInterval=$e.timeInterval;var Ue=e("../internal/operators/timeout");r.timeout=Ue.timeout;var ze=e("../internal/operators/timeoutWith");r.timeoutWith=ze.timeoutWith;var Ge=e("../internal/operators/timestamp");r.timestamp=Ge.timestamp;var Ve=e("../internal/operators/toArray");r.toArray=Ve.toArray;var He=e("../internal/operators/window");r.window=He.window;var qe=e("../internal/operators/windowCount");r.windowCount=qe.windowCount;var We=e("../internal/operators/windowTime");r.windowTime=We.windowTime;var Xe=e("../internal/operators/windowToggle");r.windowToggle=Xe.windowToggle;var Ye=e("../internal/operators/windowWhen");r.windowWhen=Ye.windowWhen;var Ke=e("../internal/operators/withLatestFrom");r.withLatestFrom=Ke.withLatestFrom;var Ze=e("../internal/operators/zip");r.zip=Ze.zip;var Je=e("../internal/operators/zipAll");r.zipAll=Je.zipAll},{"../internal/operators/audit":72,"../internal/operators/auditTime":73,"../internal/operators/buffer":74,"../internal/operators/bufferCount":75,"../internal/operators/bufferTime":76,"../internal/operators/bufferToggle":77,"../internal/operators/bufferWhen":78,"../internal/operators/catchError":79,"../internal/operators/combineAll":80,"../internal/operators/combineLatest":81,"../internal/operators/concat":82,"../internal/operators/concatAll":83,"../internal/operators/concatMap":84,"../internal/operators/concatMapTo":85,"../internal/operators/count":86,"../internal/operators/debounce":87,"../internal/operators/debounceTime":88,"../internal/operators/defaultIfEmpty":89,"../internal/operators/delay":90,"../internal/operators/delayWhen":91,"../internal/operators/dematerialize":92,"../internal/operators/distinct":93,"../internal/operators/distinctUntilChanged":94,"../internal/operators/distinctUntilKeyChanged":95,"../internal/operators/elementAt":96,"../internal/operators/endWith":97,"../internal/operators/every":98,"../internal/operators/exhaust":99,"../internal/operators/exhaustMap":100,"../internal/operators/expand":101,"../internal/operators/filter":102,"../internal/operators/finalize":103,"../internal/operators/find":104,"../internal/operators/findIndex":105,"../internal/operators/first":106,"../internal/operators/groupBy":107,"../internal/operators/ignoreElements":108,"../internal/operators/isEmpty":109,"../internal/operators/last":110,"../internal/operators/map":111,"../internal/operators/mapTo":112,"../internal/operators/materialize":113,"../internal/operators/max":114,"../internal/operators/merge":115,"../internal/operators/mergeAll":116,"../internal/operators/mergeMap":117,"../internal/operators/mergeMapTo":118,"../internal/operators/mergeScan":119,"../internal/operators/min":120,"../internal/operators/multicast":121,"../internal/operators/observeOn":122,"../internal/operators/onErrorResumeNext":123,"../internal/operators/pairwise":124,"../internal/operators/partition":125,"../internal/operators/pluck":126,"../internal/operators/publish":127,"../internal/operators/publishBehavior":128,"../internal/operators/publishLast":129,"../internal/operators/publishReplay":130,"../internal/operators/race":131,"../internal/operators/reduce":132,"../internal/operators/refCount":133,"../internal/operators/repeat":134,"../internal/operators/repeatWhen":135,"../internal/operators/retry":136,"../internal/operators/retryWhen":137,"../internal/operators/sample":138,"../internal/operators/sampleTime":139,"../internal/operators/scan":140,"../internal/operators/sequenceEqual":141,"../internal/operators/share":142,"../internal/operators/shareReplay":143,"../internal/operators/single":144,"../internal/operators/skip":145,"../internal/operators/skipLast":146,"../internal/operators/skipUntil":147,"../internal/operators/skipWhile":148,"../internal/operators/startWith":149,"../internal/operators/subscribeOn":150,"../internal/operators/switchAll":151,"../internal/operators/switchMap":152,"../internal/operators/switchMapTo":153,"../internal/operators/take":154,"../internal/operators/takeLast":155,"../internal/operators/takeUntil":156,"../internal/operators/takeWhile":157,"../internal/operators/tap":158,"../internal/operators/throttle":159,"../internal/operators/throttleTime":160,"../internal/operators/throwIfEmpty":161,"../internal/operators/timeInterval":162,"../internal/operators/timeout":163,"../internal/operators/timeoutWith":164,"../internal/operators/timestamp":165,"../internal/operators/toArray":166,"../internal/operators/window":167,"../internal/operators/windowCount":168,"../internal/operators/windowTime":169,"../internal/operators/windowToggle":170,"../internal/operators/windowWhen":171,"../internal/operators/withLatestFrom":172,"../internal/operators/zip":173,"../internal/operators/zipAll":174}],225:[function(e,t,r){var n;n=this,function(e){function t(){}function H(e,t){this.x=e||0,this.y=t||0}function we(){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 a(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==n?n:1}function Se(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0}function v(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function p(e,t,r,n,i,o,s,a,c,u){Object.defineProperty(this,"id",{value:Ao++}),this.uuid=po.generateUUID(),this.name="",this.image=void 0!==e?e:p.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:p.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:1001,this.wrapT=void 0!==n?n:1001,this.magFilter=void 0!==i?i:1006,this.minFilter=void 0!==o?o:1008,this.anisotropy=void 0!==c?c:1,this.format=void 0!==s?s:1023,this.type=void 0!==a?a:1009,this.offset=new H(0,0),this.repeat=new H(1,1),this.center=new H(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new v,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:3e3,this.version=0,this.onUpdate=null}function Me(e,t,r,n){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==n?n:1}function T(e,t,r){this.width=e,this.height=t,this.scissor=new Me(0,0,e,t),this.scissorTest=!1,this.viewport=new Me(0,0,e,t),void 0===(r=r||{}).minFilter&&(r.minFilter=1006),this.texture=new p(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.generateMipmaps=void 0===r.generateMipmaps||r.generateMipmaps,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 n(e,t,r){T.call(this,e,t,r),this.activeMipMapLevel=this.activeCubeFace=0}function Ce(e,t,r,n,i,o,s,a,c,u,h,l){p.call(this,null,o,s,a,c,u,n,i,h,l),this.image={data:e,width:t,height:r},this.magFilter=void 0!==c?c:1003,this.minFilter=void 0!==u?u:1003,this.flipY=this.generateMipmaps=!1,this.unpackAlignment=1}function r(e,t){this.min=void 0!==e?e:new Se(1/0,1/0,1/0),this.max=void 0!==t?t:new Se(-1/0,-1/0,-1/0)}function s(e,t){this.center=void 0!==e?e:new Se,this.radius=void 0!==t?t:0}function g(e,t){this.normal=void 0!==e?e:new Se(1,0,0),this.constant=void 0!==t?t:0}function Ee(e,t,r,n,i,o){this.planes=[void 0!==e?e:new g,void 0!==t?t:new g,void 0!==r?r:new g,void 0!==n?n:new g,void 0!==i?i:new g,void 0!==o?o:new g]}function w(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)}function Te(){function r(e,t){!1!==i&&(o(e,t),n.requestAnimationFrame(r))}var n=null,i=!1,o=null;return{start:function(){!0!==i&&null!==o&&(n.requestAnimationFrame(r),i=!0)},stop:function(){i=!1},setAnimationLoop:function(e){o=e},setContext:function(e){n=e}}}function Oe(l){var p=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),p.get(e)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var t=p.get(e);t&&(l.deleteBuffer(t.buffer),p.delete(e))},update:function(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var r,n,i,o,s,a=p.get(e);if(void 0===a)p.set(e,(n=t,i=(r=e).array,o=r.dynamic?l.DYNAMIC_DRAW:l.STATIC_DRAW,s=l.createBuffer(),l.bindBuffer(n,s),l.bufferData(n,i,o),r.onUploadCallback(),n=l.FLOAT,i instanceof Float32Array?n=l.FLOAT:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?n=l.UNSIGNED_SHORT:i instanceof Int16Array?n=l.SHORT:i instanceof Uint32Array?n=l.UNSIGNED_INT:i instanceof Int32Array?n=l.INT:i instanceof Int8Array?n=l.BYTE:i instanceof Uint8Array&&(n=l.UNSIGNED_BYTE),{buffer:s,type:n,bytesPerElement:i.BYTES_PER_ELEMENT,version:r.version}));else if(a.version<e.version){var c=e,u=c.array,h=c.updateRange;l.bindBuffer(t,a.buffer),!1===c.dynamic?l.bufferData(t,u,l.STATIC_DRAW):-1===h.count?l.bufferSubData(t,0,u):0===h.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."):(l.bufferSubData(t,h.offset*u.BYTES_PER_ELEMENT,u.subarray(h.offset,h.offset+h.count)),h.count=-1),a.version=e.version}}}}function i(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||i.DefaultOrder}function o(){this.mask=1}function h(){Object.defineProperty(this,"id",{value:ns++}),this.uuid=po.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=h.DefaultUp.clone();var e=new Se,t=new i,r=new a,n=new Se(1,1,1);t.onChange(function(){r.setFromEuler(t,!1)}),r.onChange(function(){t.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:n},modelViewMatrix:{value:new we},normalMatrix:{value:new v}}),this.matrix=new we,this.matrixWorld=new we,this.matrixAutoUpdate=h.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new o,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function c(){h.call(this),this.type="Camera",this.matrixWorldInverse=new we,this.projectionMatrix=new we}function f(e,t,r,n,i,o){c.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=n,this.near=void 0!==i?i:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function k(e,t,r,n,i,o){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new Se,this.vertexNormals=Array.isArray(n)?n:[],this.color=i&&i.isColor?i:new w,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0}function S(){Object.defineProperty(this,"id",{value:ls+=2}),this.uuid=po.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 y(e,t,r){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===r,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function u(e,t,r){y.call(this,new Int8Array(e),t,r)}function l(e,t,r){y.call(this,new Uint8Array(e),t,r)}function d(e,t,r){y.call(this,new Uint8ClampedArray(e),t,r)}function m(e,t,r){y.call(this,new Int16Array(e),t,r)}function _(e,t,r){y.call(this,new Uint16Array(e),t,r)}function b(e,t,r){y.call(this,new Int32Array(e),t,r)}function x(e,t,r){y.call(this,new Uint32Array(e),t,r)}function P(e,t,r){y.call(this,new Float32Array(e),t,r)}function M(e,t,r){y.call(this,new Float64Array(e),t,r)}function C(){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 E(e){if(0===e.length)return-1/0;for(var t=e[0],r=1,n=e.length;r<n;++r)e[r]>t&&(t=e[r]);return t}function A(){Object.defineProperty(this,"id",{value:ws+=2}),this.uuid=po.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},this.userData={}}function O(e,t,r,n,i,o){S.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new j(e,t,r,n,i,o)),this.mergeVertices()}function j(e,t,r,n,i,o){function s(e,t,r,n,i,o,s,a,c,u,h){var l=o/c,p=s/u,f=o/2,d=s/2,m=a/2;s=c+1;var v,g,y=u+1,_=o=0,b=new Se;for(g=0;g<y;g++){var x=g*p-d;for(v=0;v<s;v++)b[e]=(v*l-f)*n,b[t]=x*i,b[r]=m,M.push(b.x,b.y,b.z),b[e]=0,b[t]=0,b[r]=0<a?1:-1,C.push(b.x,b.y,b.z),E.push(v/c),E.push(1-g/u),o+=1}for(g=0;g<u;g++)for(v=0;v<c;v++)e=T+v+s*(g+1),t=T+(v+1)+s*(g+1),r=T+(v+1)+s*g,S.push(T+v+s*g,e,r),S.push(e,t,r),_+=6;w.addGroup(O,_,h),O+=_,T+=o}A.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:o};var w=this;e=e||1,t=t||1,r=r||1,n=Math.floor(n)||1,i=Math.floor(i)||1,o=Math.floor(o)||1;var S=[],M=[],C=[],E=[],T=0,O=0;s("z","y","x",-1,-1,r,t,e,o,i,0),s("z","y","x",1,-1,r,t,-e,o,i,1),s("x","z","y",1,1,e,r,t,n,o,2),s("x","z","y",1,-1,e,r,-t,n,o,3),s("x","y","z",1,-1,e,t,r,n,i,4),s("x","y","z",-1,-1,e,t,-r,n,i,5),this.setIndex(S),this.addAttribute("position",new P(M,3)),this.addAttribute("normal",new P(C,3)),this.addAttribute("uv",new P(E,2))}function R(e,t,r,n){S.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new L(e,t,r,n)),this.mergeVertices()}function L(e,t,r,n){A.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};var i=(e=e||1)/2,o=(t=t||1)/2,s=(r=Math.floor(r)||1)+1,a=(n=Math.floor(n)||1)+1,c=e/r,u=t/n,h=[],l=[],p=[],f=[];for(e=0;e<a;e++){var d=e*u-o;for(t=0;t<s;t++)l.push(t*c-i,-d,0),p.push(0,0,1),f.push(t/r),f.push(1-e/n)}for(e=0;e<n;e++)for(t=0;t<r;t++)i=t+s*(e+1),o=t+1+s*(e+1),a=t+1+s*e,h.push(t+s*e,i,a),h.push(i,o,a);this.setIndex(h),this.addAttribute("position",new P(l,3)),this.addAttribute("normal",new P(p,3)),this.addAttribute("uv",new P(f,2))}function N(){Object.defineProperty(this,"id",{value:Ws++}),this.uuid=po.generateUUID(),this.name="",this.type="Material",this.lights=this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,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.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function I(e){N.call(this),this.type="MeshBasicMaterial",this.color=new w(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(e)}function D(e){N.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function B(e,t){this.origin=void 0!==e?e:new Se,this.direction=void 0!==t?t:new Se}function F(e,t,r){this.a=void 0!==e?e:new Se,this.b=void 0!==t?t:new Se,this.c=void 0!==r?r:new Se}function $(e,t){h.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new A,this.material=void 0!==t?t:new I({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function Pe(i,r,o,n){function s(e,t){r.buffers.color.setClear(e.r,e.g,e.b,t,n)}var a,c,u,h=new w(0),l=0;return{getClearColor:function(){return h},setClearColor:function(e,t){h.set(e),s(h,l=void 0!==t?t:1)},getClearAlpha:function(){return l},setClearAlpha:function(e){s(h,l=e)},render:function(e,t,r,n){null===(t=t.background)?s(h,l):t&&t.isColor&&(s(t,1),n=!0),(i.autoClear||n)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),t&&t.isCubeTexture?(void 0===u&&((u=new $(new j(1,1,1),new D({uniforms:Bo.cube.uniforms,vertexShader:Bo.cube.vertexShader,fragmentShader:Bo.cube.fragmentShader,side:1,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),u.geometry.removeAttribute("uv"),u.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},o.update(u)),u.material.uniforms.tCube.value=t,e.push(u,u.geometry,u.material,0,null)):t&&t.isTexture&&(void 0===a&&(a=new f(-1,1,1,-1,0,1),c=new $(new L(2,2),new I({depthTest:!1,depthWrite:!1,fog:!1})),o.update(c)),c.material.map=t,i.renderBufferDirect(a,null,c.geometry,c.material,c,null))}}}function Ae(i,o,s,a){var c;this.setMode=function(e){c=e},this.render=function(e,t){i.drawArrays(c,e,t),s.update(t,c)},this.renderInstances=function(e,t,r){if(a.isWebGL2)var n=i;else if(null===(n=o.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");n[a.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](c,t,r,e.maxInstancedCount),s.update(r,c,e.maxInstancedCount)}}function je(t,r,e){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="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,s=void 0!==e.precision?e.precision:"highp",a=n(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a),e=!0===e.logarithmicDepthBuffer,a=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);var c=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),h=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),l=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),f=t.getParameter(t.MAX_VARYING_VECTORS),d=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),m=0<c,v=o||!!r.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==i)return i;var e=r.get("EXT_texture_filter_anisotropic");return i=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:s,logarithmicDepthBuffer:e,maxTextures:a,maxVertexTextures:c,maxTextureSize:u,maxCubemapSize:h,maxAttributes:l,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:d,vertexTextures:m,floatFragmentTextures:v,floatVertexTextures:m&&v}}function Re(){function c(){m.value!==h&&(m.value=h,m.needsUpdate=0<l),s.numPlanes=l,s.numIntersection=0}function u(e,t,r,n){var i=null!==e?e.length:0,o=null;if(0!==i){if(o=m.value,!0!==n||null===o)for(n=r+4*i,t=t.matrixWorldInverse,d.getNormalMatrix(t),(null===o||o.length<n)&&(o=new Float32Array(n)),n=0;n!==i;++n,r+=4)a.copy(e[n]).applyMatrix4(t,d),a.normal.toArray(o,r),o[r+3]=a.constant;m.value=o,m.needsUpdate=!0}return s.numPlanes=i,o}var s=this,h=null,l=0,p=!1,f=!1,a=new g,d=new v,m={value:null,needsUpdate:!1};this.uniform=m,this.numIntersection=this.numPlanes=0,this.init=function(e,t,r){var n=0!==e.length||t||0!==l||p;return p=t,h=u(e,r,0),l=e.length,n},this.beginShadows=function(){f=!0,u(null)},this.endShadows=function(){f=!1,c()},this.setState=function(e,t,r,n,i,o){if(!p||null===e||0===e.length||f&&!r)f?u(null):c();else{var s=4*(r=f?0:l),a=i.clippingState||null;for(m.value=a,a=u(e,n,s,o),e=0;e!==s;++e)a[e]=h[e];i.clippingState=a,this.numIntersection=t?this.numPlanes:0,this.numPlanes+=r}}}function Le(r){var n={};return{get:function(e){if(void 0!==n[e])return n[e];switch(e){case"WEBGL_depth_texture":var t=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:t=r.getExtension(e)}return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),n[e]=t}}}function Ne(c,u,n){function i(e){var t=e.target;for(var r in null!==(e=o[t.id]).index&&u.remove(e.index),e.attributes)u.remove(e.attributes[r]);t.removeEventListener("dispose",i),delete o[t.id],(r=h[e.id])&&(u.remove(r),delete h[e.id]),n.memory.geometries--}var o={},h={};return{get:function(e,t){var r=o[t.id];return r||(t.addEventListener("dispose",i),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new A).setFromObject(e)),r=t._bufferGeometry),o[t.id]=r,n.memory.geometries++,r)},update:function(e){var t=e.index,r=e.attributes;for(var n in null!==t&&u.update(t,c.ELEMENT_ARRAY_BUFFER),r)u.update(r[n],c.ARRAY_BUFFER);for(n in e=e.morphAttributes){r=0;for(var i=(t=e[n]).length;r<i;r++)u.update(t[r],c.ARRAY_BUFFER)}},getWireframeAttribute:function(e){var t=h[e.id];if(t)return t;t=[];var r=e.index,n=e.attributes;if(null!==r){n=0;for(var i=(r=r.array).length;n<i;n+=3){var o=r[n+0],s=r[n+1],a=r[n+2];t.push(o,s,s,a,a,o)}}else for(r=n.position.array,n=0,i=r.length/3-1;n<i;n+=3)o=n+0,s=n+1,a=n+2,t.push(o,s,s,a,a,o);return t=new(65535<E(t)?x:_)(t,1),u.update(t,c.ELEMENT_ARRAY_BUFFER),h[e.id]=t}}}function Ie(i,o,s,a){var c,u,h;this.setMode=function(e){c=e},this.setIndex=function(e){u=e.type,h=e.bytesPerElement},this.render=function(e,t){i.drawElements(c,t,u,e*h),s.update(t,c)},this.renderInstances=function(e,t,r){if(a.isWebGL2)var n=i;else if(null===(n=o.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");n[a.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](c,r,u,t*h,e.maxInstancedCount),s.update(r,c,e.maxInstancedCount)}}function De(n){var i={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:i,programs:null,autoReset:!0,reset:function(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0},update:function(e,t,r){switch(r=r||1,i.calls++,t){case n.TRIANGLES:i.triangles+=e/3*r;break;case n.TRIANGLE_STRIP:case n.TRIANGLE_FAN:i.triangles+=r*(e-2);break;case n.LINES:i.lines+=e/2*r;break;case n.LINE_STRIP:i.lines+=r*(e-1);break;case n.LINE_LOOP:i.lines+=r*e;break;case n.POINTS:i.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",t)}}}}function U(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ke(u){var h={},l=new Float32Array(8);return{update:function(e,t,r,n){var i=e.morphTargetInfluences,o=i.length;if(void 0===(e=h[t.id])){e=[];for(var s=0;s<o;s++)e[s]=[s,0];h[t.id]=e}var a=r.morphTargets&&t.morphAttributes.position;for(r=r.morphNormals&&t.morphAttributes.normal,s=0;s<o;s++){var c=e[s];0!==c[1]&&(a&&t.removeAttribute("morphTarget"+s),r&&t.removeAttribute("morphNormal"+s))}for(s=0;s<o;s++)(c=e[s])[0]=s,c[1]=i[s];for(e.sort(U),s=0;s<8;s++)(c=e[s])&&(i=c[0],o=c[1])?(a&&t.addAttribute("morphTarget"+s,a[i]),r&&t.addAttribute("morphNormal"+s,r[i]),l[s]=o):l[s]=0;n.getUniforms().setValue(u,"morphTargetInfluences",l)}}}function Be(i,o){var s={};return{update:function(e){var t=o.render.frame,r=e.geometry,n=i.get(e,r);return s[n.id]!==t&&(r.isGeometry&&n.updateFromObject(e),i.update(n),s[n.id]=t),n},dispose:function(){s={}}}}function z(e,t,r,n,i,o,s,a,c,u){p.call(this,e=void 0!==e?e:[],void 0!==t?t:301,r,n,i,o,s,a,c,u),this.flipY=!1}function G(e,t,r){var n=e[0];if(n<=0||0<n)return e;var i=t*r,o=Ks[i];if(void 0===o&&(o=new Float32Array(i),Ks[i]=o),0!==t)for(n.toArray(o,0),n=1,i=0;n!==t;++n)i+=r,e[n].toArray(o,i);return o}function V(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function q(e,t){for(var r=0,n=t.length;r<n;r++)e[r]=t[r]}function W(e,t){var r=Zs[t];void 0===r&&(r=new Int32Array(t),Zs[t]=r);for(var n=0;n!==t;++n)r[n]=e.allocTextureUnit();return r}function X(e,t){var r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function Y(e,t){var r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function K(e,t){var r=this.cache;void 0!==t.x?r[0]===t.x&&r[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y):V(r,t)||(e.uniform2fv(this.addr,t),q(r,t))}function Z(e,t){var r=this.cache;void 0!==t.x?r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z):void 0!==t.r?r[0]===t.r&&r[1]===t.g&&r[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b):V(r,t)||(e.uniform3fv(this.addr,t),q(r,t))}function J(e,t){var r=this.cache;void 0!==t.x?r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w):V(r,t)||(e.uniform4fv(this.addr,t),q(r,t))}function Q(e,t){var r=this.cache,n=t.elements;void 0===n?V(r,t)||(e.uniformMatrix2fv(this.addr,!1,t),q(r,t)):V(r,n)||(ea.set(n),e.uniformMatrix2fv(this.addr,!1,ea),q(r,n))}function ee(e,t){var r=this.cache,n=t.elements;void 0===n?V(r,t)||(e.uniformMatrix3fv(this.addr,!1,t),q(r,t)):V(r,n)||(Qs.set(n),e.uniformMatrix3fv(this.addr,!1,Qs),q(r,n))}function te(e,t){var r=this.cache,n=t.elements;void 0===n?V(r,t)||(e.uniformMatrix4fv(this.addr,!1,t),q(r,t)):V(r,n)||(Js.set(n),e.uniformMatrix4fv(this.addr,!1,Js),q(r,n))}function re(e,t,r){var n=this.cache,i=r.allocTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture2D(t||Xs,i)}function ne(e,t,r){var n=this.cache,i=r.allocTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTextureCube(t||Ys,i)}function ie(e,t){var r=this.cache;V(r,t)||(e.uniform2iv(this.addr,t),q(r,t))}function oe(e,t){var r=this.cache;V(r,t)||(e.uniform3iv(this.addr,t),q(r,t))}function se(e,t){var r=this.cache;V(r,t)||(e.uniform4iv(this.addr,t),q(r,t))}function ae(e,t){var r=this.cache;V(r,t)||(e.uniform1fv(this.addr,t),q(r,t))}function ce(e,t){var r=this.cache;V(r,t)||(e.uniform1iv(this.addr,t),q(r,t))}function ue(e,t){V(this.cache,t=G(t,this.size,2))||(e.uniform2fv(this.addr,t),this.updateCache(t))}function he(e,t){V(this.cache,t=G(t,this.size,3))||(e.uniform3fv(this.addr,t),this.updateCache(t))}function le(e,t){V(this.cache,t=G(t,this.size,4))||(e.uniform4fv(this.addr,t),this.updateCache(t))}function pe(e,t){V(this.cache,t=G(t,this.size,4))||(e.uniformMatrix2fv(this.addr,!1,t),this.updateCache(t))}function fe(e,t){V(this.cache,t=G(t,this.size,9))||(e.uniformMatrix3fv(this.addr,!1,t),this.updateCache(t))}function de(e,t){V(this.cache,t=G(t,this.size,16))||(e.uniformMatrix4fv(this.addr,!1,t),this.updateCache(t))}function me(e,t,r){var n=this.cache,i=t.length,o=W(r,i);for(!1===V(n,o)&&(e.uniform1iv(this.addr,o),q(n,o)),e=0;e!==i;++e)r.setTexture2D(t[e]||Xs,o[e])}function ve(e,t,r){var n=this.cache,i=t.length,o=W(r,i);for(!1===V(n,o)&&(e.uniform1iv(this.addr,o),q(n,o)),e=0;e!==i;++e)r.setTextureCube(t[e]||Ys,o[e])}function ge(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=function(e){switch(e){case 5126:return X;case 35664:return K;case 35665:return Z;case 35666:return J;case 35674:return Q;case 35675:return ee;case 35676:return te;case 35678:case 36198:return re;case 35680:return ne;case 5124:case 35670:return Y;case 35667:case 35671:return ie;case 35668:case 35672:return oe;case 35669:case 35673:return se}}(t.type)}function ye(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return ae;case 35664:return ue;case 35665:return he;case 35666:return le;case 35674:return pe;case 35675:return fe;case 35676:return de;case 35678:return me;case 35680:return ve;case 5124:case 35670:return ce;case 35667:case 35671:return ie;case 35668:case 35672:return oe;case 35669:case 35673:return se}}(t.type)}function _e(e){this.id=e,this.seq=[],this.map={}}function Fe(e,t,r){this.seq=[],this.map={},this.renderer=r,r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(var n=0;n<r;++n){var i=e.getActiveUniform(t,n),o=e.getUniformLocation(t,i.name),s=this,a=i.name,c=a.length;for(ta.lastIndex=0;;){var u=ta.exec(a),h=ta.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 ge(l,i,o):new ye(l,i,o),a.seq.push(i),a.map[i.id]=i;break}void 0===(p=s.map[l])&&(p=new _e(l),l=s,s=p,l.seq.push(s),l.map[s.id]=s),s=p}}}function be(e,t,r){var n=e.createShader(t);return e.shaderSource(n,r),e.compileShader(n),!1===e.getShaderParameter(n,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(n),function(e){e=e.split("\n");for(var t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(r)),n}function xe(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+e)}}function $e(e,t){return"vec4 "+e+"( vec4 value ) { return "+(t=xe(t))[0]+"ToLinear"+t[1]+"; }"}function Ue(e){return""!==e}function ze(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function Ge(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function Ve(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(e,t){if(void 0===(e=Ro[t]))throw Error("Can not resolve #include <"+t+">");return Ve(e)})}function He(e){return e.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,r,n){for(e="",t=parseInt(t);t<parseInt(r);t++)e+=n.replace(/\[ i \]/g,"[ "+t+" ]");return e})}function qe(e,t,r,n,i,o,s){var a=e.context,c=n.defines,u=i.vertexShader,h=i.fragmentShader,l="SHADOWMAP_TYPE_BASIC";1===o.shadowMapType?l="SHADOWMAP_TYPE_PCF":2===o.shadowMapType&&(l="SHADOWMAP_TYPE_PCF_SOFT");var p="ENVMAP_TYPE_CUBE",f="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(o.envMap){switch(n.envMap.mapping){case 301:case 302:p="ENVMAP_TYPE_CUBE";break;case 306:case 307:p="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:p="ENVMAP_TYPE_EQUIREC";break;case 305:p="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case 302:case 304:f="ENVMAP_MODE_REFRACTION"}switch(n.combine){case 0:d="ENVMAP_BLENDING_MULTIPLY";break;case 1:d="ENVMAP_BLENDING_MIX";break;case 2:d="ENVMAP_BLENDING_ADD"}}var m,v,g,y,_,b,x,w=0<e.gammaFactor?e.gammaFactor:1,S=s.isWebGL2?"":(m=n.extensions,v=o,g=t,[(m=m||{}).derivatives||v.envMapCubeUV||v.bumpMap||v.normalMap&&!v.objectSpaceNormalMap||v.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(m.fragDepth||v.logarithmicDepthBuffer)&&g.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",m.drawBuffers&&g.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(m.shaderTextureLOD||v.envMap)&&g.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ue).join("\n")),M=function(e){var t,r=[];for(t in e){var n=e[t];!1!==n&&r.push("#define "+t+" "+n)}return r.join("\n")}(c),C=a.createProgram();return n.isRawShaderMaterial?(0<(c=[M].filter(Ue).join("\n")).length&&(c+="\n"),0<(t=[S,M].filter(Ue).join("\n")).length&&(t+="\n")):(c=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+i.name,M,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+f:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(s.isWebGL2||t.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(Ue).join("\n"),t=[S,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+i.name,M,o.alphaTest?"#define ALPHATEST "+o.alphaTest+(o.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+w,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+p:"",o.envMap?"#define "+f:"",o.envMap?"#define "+d:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(s.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&(s.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==o.toneMapping?"#define TONE_MAPPING":"",0!==o.toneMapping?Ro.tonemapping_pars_fragment:"",0!==o.toneMapping?function(e,t){switch(t){case 1:t="Linear";break;case 2:t="Reinhard";break;case 3:t="Uncharted2";break;case 4:t="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.envMapEncoding||o.emissiveMapEncoding?Ro.encodings_pars_fragment:"",o.mapEncoding?$e("mapTexelToLinear",o.mapEncoding):"",o.envMapEncoding?$e("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?$e("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?(y="linearToOutputTexel",_=o.outputEncoding,"vec4 "+y+"( vec4 value ) { return LinearTo"+(_=xe(_))[0]+_[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ue).join("\n")),u=Ge(u=ze(u=Ve(u),o),o),h=Ge(h=ze(h=Ve(h),o),o),u=He(u),h=He(h),s.isWebGL2&&!n.isRawShaderMaterial&&(s=!1,l=/^\s*#version\s+300\s+es\s*\n/,n.isShaderMaterial&&null!==u.match(l)&&null!==h.match(l)&&(s=!0,u=u.replace(l,""),h=h.replace(l,"")),c="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+c,t=["#version 300 es\n\n#define varying in",s?"":"out highp vec4 pc_fragColor;",s?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+t),h=t+h,u=be(a,a.VERTEX_SHADER,c+u),h=be(a,a.FRAGMENT_SHADER,h),a.attachShader(C,u),a.attachShader(C,h),void 0!==n.index0AttributeName?a.bindAttribLocation(C,0,n.index0AttributeName):!0===o.morphTargets&&a.bindAttribLocation(C,0,"position"),a.linkProgram(C),o=a.getProgramInfoLog(C).trim(),s=a.getShaderInfoLog(u).trim(),l=a.getShaderInfoLog(h).trim(),f=p=!0,!1===a.getProgramParameter(C,a.LINK_STATUS)?(p=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(C,a.VALIDATE_STATUS),"gl.getProgramInfoLog",o,s,l)):""!==o?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",o):""!==s&&""!==l||(f=!1),f&&(this.diagnostics={runnable:p,material:n,programLog:o,vertexShader:{log:s,prefix:c},fragmentShader:{log:l,prefix:t}}),a.deleteShader(u),a.deleteShader(h),this.getUniforms=function(){return void 0===b&&(b=new Fe(a,C,e)),b},this.getAttributes=function(){if(void 0===x){for(var e={},t=a.getProgramParameter(C,a.ACTIVE_ATTRIBUTES),r=0;r<t;r++){var n=a.getActiveAttrib(C,r).name;e[n]=a.getAttribLocation(C,n)}x=e}return x},this.destroy=function(){a.deleteProgram(C),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.name=i.name,this.id=ya++,this.code=r,this.usedTimes=1,this.program=C,this.vertexShader=u,this.fragmentShader=h,this}function We(l,c,p){function f(e,t){if(e)e.isTexture?r=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),r=e.texture.encoding);else var r=3e3;return 3e3===r&&t&&(r=3007),r}var u=[],d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},i="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap objectSpaceNormalMap 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(e,t,r,n,i,o,s){var a=d[e.type];if(s.isSkinnedMesh){var c=s.skeleton.bones;if(p.floatVertexTextures)c=1024;else{var u=Math.min(Math.floor((p.maxVertexUniforms-20)/4),c.length);c=u<c.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+c.length+" bones. This GPU supports "+u+"."),0):u}}else c=0;u=p.precision,null!==e.precision&&((u=p.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",u,"instead."));var h=l.getRenderTarget();return{shaderID:a,precision:u,supportsVertexTextures:p.vertexTextures,outputEncoding:f(h?h.texture:null,l.gammaOutput),map:!!e.map,mapEncoding:f(e.map,l.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:f(e.envMap,l.gammaInput),envMapCubeUV:!!e.envMap&&(306===e.envMap.mapping||307===e.envMap.mapping),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:f(e.emissiveMap,l.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:1===e.normalMapType,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexColors:e.vertexColors,fog:!!n,useFog:e.fog,fogExp:n&&n.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:p.logarithmicDepthBuffer,skinning:e.skinning&&0<c,maxBones:c,useVertexTexture:p.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:l.maxMorphTargets,maxMorphNormals:l.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numClippingPlanes:i,numClipIntersection:o,dithering:e.dithering,shadowMapEnabled:l.shadowMap.enabled&&s.receiveShadow&&0<r.length,shadowMapType:l.shadowMap.type,toneMapping:l.toneMapping,physicallyCorrectLights:l.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:2===e.side,flipSided:1===e.side,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)r.push(n),r.push(e.defines[n]);for(n=0;n<i.length;n++)r.push(t[i[n]]);return r.push(e.onBeforeCompile.toString()),r.push(l.gammaOutput),r.join()},this.acquireProgram=function(e,t,r,n){for(var i,o=0,s=u.length;o<s;o++){var a=u[o];if(a.code===n){++(i=a).usedTimes;break}}return void 0===i&&(i=new qe(l,c,n,e,t,r,p),u.push(i)),i},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},this.programs=u}function Xe(){var n=new WeakMap;return{get:function(e){var t=n.get(e);return void 0===t&&(t={},n.set(e,t)),t},remove:function(e){n.delete(e)},update:function(e,t,r){n.get(e)[t]=r},dispose:function(){n=new WeakMap}}}function Ye(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program&&t.program&&e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Ke(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Ze(){var s=[],a=0,c=[],u=[];return{opaque:c,transparent:u,init:function(){a=0,c.length=0,u.length=0},push:function(e,t,r,n,i){var o=s[a];void 0===o?(o={id:e.id,object:e,geometry:t,material:r,program:r.program,renderOrder:e.renderOrder,z:n,group:i},s[a]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.program=r.program,o.renderOrder=e.renderOrder,o.z=n,o.group=i),(!0===r.transparent?u:c).push(o),a++},sort:function(){1<c.length&&c.sort(Ye),1<u.length&&u.sort(Ke)}}}function Je(){var r={};return{get:function(e,t){return e=e.id+","+t.id,void 0===(t=r[e])&&(t=new Ze,r[e]=t),t},dispose:function(){r={}}}}function Qe(){var r={};return{get:function(e){if(void 0!==r[e.id])return r[e.id];switch(e.type){case"DirectionalLight":var t={direction:new Se,color:new w,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new H};break;case"SpotLight":t={position:new Se,direction:new Se,color:new w,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new H};break;case"PointLight":t={position:new Se,color:new w,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new H,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":t={direction:new Se,skyColor:new w,groundColor:new w};break;case"RectAreaLight":t={color:new w,position:new Se,halfWidth:new Se,halfHeight:new Se}}return r[e.id]=t}}}function et(){var _=new Qe,b={id:_a++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},x=new Se,w=new we,S=new we;return{setup:function(e,t,r){var n=0,i=0,o=0,s=0,a=0,c=0,u=0,h=0;r=r.matrixWorldInverse;for(var l=0,p=e.length;l<p;l++){var f=e[l],d=f.color,m=f.intensity,v=f.distance,g=f.shadow&&f.shadow.map?f.shadow.map.texture:null;if(f.isAmbientLight)n+=d.r*m,i+=d.g*m,o+=d.b*m;else if(f.isDirectionalLight){var y=_.get(f);y.color.copy(f.color).multiplyScalar(f.intensity),y.direction.setFromMatrixPosition(f.matrixWorld),x.setFromMatrixPosition(f.target.matrixWorld),y.direction.sub(x),y.direction.transformDirection(r),(y.shadow=f.castShadow)&&(d=f.shadow,y.shadowBias=d.bias,y.shadowRadius=d.radius,y.shadowMapSize=d.mapSize),b.directionalShadowMap[s]=g,b.directionalShadowMatrix[s]=f.shadow.matrix,b.directional[s]=y,s++}else f.isSpotLight?((y=_.get(f)).position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(r),y.color.copy(d).multiplyScalar(m),y.distance=v,y.direction.setFromMatrixPosition(f.matrixWorld),x.setFromMatrixPosition(f.target.matrixWorld),y.direction.sub(x),y.direction.transformDirection(r),y.coneCos=Math.cos(f.angle),y.penumbraCos=Math.cos(f.angle*(1-f.penumbra)),y.decay=0===f.distance?0:f.decay,(y.shadow=f.castShadow)&&(d=f.shadow,y.shadowBias=d.bias,y.shadowRadius=d.radius,y.shadowMapSize=d.mapSize),b.spotShadowMap[c]=g,b.spotShadowMatrix[c]=f.shadow.matrix,b.spot[c]=y,c++):f.isRectAreaLight?((y=_.get(f)).color.copy(d).multiplyScalar(m),y.position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(r),S.identity(),w.copy(f.matrixWorld),w.premultiply(r),S.extractRotation(w),y.halfWidth.set(.5*f.width,0,0),y.halfHeight.set(0,.5*f.height,0),y.halfWidth.applyMatrix4(S),y.halfHeight.applyMatrix4(S),b.rectArea[u]=y,u++):f.isPointLight?((y=_.get(f)).position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(r),y.color.copy(f.color).multiplyScalar(f.intensity),y.distance=f.distance,y.decay=0===f.distance?0:f.decay,(y.shadow=f.castShadow)&&(d=f.shadow,y.shadowBias=d.bias,y.shadowRadius=d.radius,y.shadowMapSize=d.mapSize,y.shadowCameraNear=d.camera.near,y.shadowCameraFar=d.camera.far),b.pointShadowMap[a]=g,b.pointShadowMatrix[a]=f.shadow.matrix,b.point[a]=y,a++):f.isHemisphereLight&&((y=_.get(f)).direction.setFromMatrixPosition(f.matrixWorld),y.direction.transformDirection(r),y.direction.normalize(),y.skyColor.copy(f.color).multiplyScalar(m),y.groundColor.copy(f.groundColor).multiplyScalar(m),b.hemi[h]=y,h++)}b.ambient[0]=n,b.ambient[1]=i,b.ambient[2]=o,b.directional.length=s,b.spot.length=c,b.rectArea.length=u,b.point.length=a,b.hemi.length=h,b.hash.stateID=b.id,b.hash.directionalLength=s,b.hash.pointLength=a,b.hash.spotLength=c,b.hash.rectAreaLength=u,b.hash.hemiLength=h,b.hash.shadowsLength=t.length},state:b}}function tt(){var t=new et,r=[],n=[];return{init:function(){r.length=0,n.length=0},state:{lightsArray:r,shadowsArray:n,lights:t},setupLights:function(e){t.setup(r,n,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){n.push(e)}}}function rt(){var n={};return{get:function(e,t){if(void 0===n[e.id]){var r=new tt;n[e.id]={},n[e.id][t.id]=r}else void 0===n[e.id][t.id]?(r=new tt,n[e.id][t.id]=r):r=n[e.id][t.id];return r},dispose:function(){n={}}}}function nt(e){N.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(e)}function it(e){N.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Se,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=this.skinning=!1,this.displacementMap=this.alphaMap=this.map=null,this.displacementScale=1,this.displacementBias=0,this.lights=this.fog=!1,this.setValues(e)}function ot(p,l,e){function f(e,t,r,n,i,o){var s=e.geometry,a=u,c=e.customDepthMaterial;return r&&(a=h,c=e.customDistanceMaterial),a=c||(c=!1,t.morphTargets&&(s&&s.isBufferGeometry?c=s.morphAttributes&&s.morphAttributes.position&&0<s.morphAttributes.position.length:s&&s.isGeometry&&(c=s.morphTargets&&0<s.morphTargets.length)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e),s=0,c&&(s|=1),(e=e.isSkinnedMesh&&t.skinning)&&(s|=2),a[s]),p.localClippingEnabled&&!0===t.clipShadows&&0!==t.clippingPlanes.length&&(s=a.uuid,c=t.uuid,void 0===(e=x[s])&&(e={},x[s]=e),void 0===(s=e[c])&&(s=a.clone(),e[c]=s),a=s),a.visible=t.visible,a.wireframe=t.wireframe,a.side=null!=t.shadowSide?t.shadowSide:w[t.side],a.clipShadows=t.clipShadows,a.clippingPlanes=t.clippingPlanes,a.clipIntersection=t.clipIntersection,a.wireframeLinewidth=t.wireframeLinewidth,a.linewidth=t.linewidth,r&&a.isMeshDistanceMaterial&&(a.referencePosition.copy(n),a.nearDistance=i,a.farDistance=o),a}function d(e,t,r,n){if(!1!==e.visible){if(e.layers.test(t.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||m.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld);var i=l.update(e),o=e.material;if(Array.isArray(o))for(var s=i.groups,a=0,c=s.length;a<c;a++){var u=s[a],h=o[u.materialIndex];h&&h.visible&&(h=f(e,h,n,b,r.near,r.far),p.renderBufferDirect(r,null,i,h,e,u))}else o.visible&&(h=f(e,o,n,b,r.near,r.far),p.renderBufferDirect(r,null,i,h,e,null))}for(i=0,o=(e=e.children).length;i<o;i++)d(e[i],t,r,n)}}var m=new Ee,v=new we,g=new H,y=new H(e,e),_=new Se,b=new Se,u=Array(4),h=Array(4),x={},w={0:1,1:0,2:2},S=[new Se(1,0,0),new Se(-1,0,0),new Se(0,0,1),new Se(0,0,-1),new Se(0,1,0),new Se(0,-1,0)],M=[new Se(0,1,0),new Se(0,1,0),new Se(0,1,0),new Se(0,1,0),new Se(0,0,1),new Se(0,0,-1)],C=[new Me,new Me,new Me,new Me,new Me,new Me];for(e=0;4!==e;++e){var t=0!=(1&e),r=0!=(2&e),n=new nt({depthPacking:3201,morphTargets:t,skinning:r});u[e]=n,t=new it({morphTargets:t,skinning:r}),h[e]=t}var E=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,t,r){if(!1!==E.enabled&&(!1!==E.autoUpdate||!1!==E.needsUpdate)&&0!==e.length){var n=p.state;n.disable(p.context.BLEND),n.buffers.color.setClear(1,1,1,1),n.buffers.depth.setTest(!0),n.setScissorTest(!1);for(var i,o=0,s=e.length;o<s;o++){var a=e[o];i=a.shadow;var c=a&&a.isPointLight;if(void 0===i)console.warn("THREE.WebGLShadowMap:",a,"has no shadow.");else{var u=i.camera;if(g.copy(i.mapSize),g.min(y),c){var h=g.x,l=g.y;C[0].set(2*h,l,h,l),C[1].set(0,l,h,l),C[2].set(3*h,l,h,l),C[3].set(h,l,h,l),C[4].set(3*h,0,h,l),C[5].set(h,0,h,l),g.x*=4,g.y*=2}for(null===i.map&&(i.map=new T(g.x,g.y,{minFilter:1003,magFilter:1003,format:1023}),i.map.texture.name=a.name+".shadowMap",u.updateProjectionMatrix()),i.isSpotLightShadow&&i.update(a),h=i.map,l=i.matrix,b.setFromMatrixPosition(a.matrixWorld),u.position.copy(b),c?(i=6,l.makeTranslation(-b.x,-b.y,-b.z)):(i=1,_.setFromMatrixPosition(a.target.matrixWorld),u.lookAt(_),u.updateMatrixWorld(),l.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),l.multiply(u.projectionMatrix),l.multiply(u.matrixWorldInverse)),p.setRenderTarget(h),p.clear(),a=0;a<i;a++)c&&(_.copy(u.position),_.add(S[a]),u.up.copy(M[a]),u.lookAt(_),u.updateMatrixWorld(),n.viewport(C[a])),v.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),m.setFromMatrix(v),d(t,r,u,c)}}E.needsUpdate=!1}}}function st(h,r,c,n){function e(e,t,r){var n=new Uint8Array(4),i=h.createTexture();for(h.bindTexture(e,i),h.texParameteri(e,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(e,h.TEXTURE_MAG_FILTER,h.NEAREST),e=0;e<r;e++)h.texImage2D(t+e,0,h.RGBA,1,1,0,h.RGBA,h.UNSIGNED_BYTE,n);return i}function t(e,t){g[e]=1,0===y[e]&&(h.enableVertexAttribArray(e),y[e]=1),_[e]!==t&&((n.isWebGL2?h:r.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](e,t),_[e]=t)}function l(e){!0!==b[e]&&(h.enable(e),b[e]=!0)}function p(e){!1!==b[e]&&(h.disable(e),b[e]=!1)}function i(e,t,r,n,i,o,s,a){if(0!==e?l(h.BLEND):p(h.BLEND),5!==e){if(e!==S||a!==A)switch(e){case 2:a?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ONE,h.ONE,h.ONE,h.ONE)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.SRC_ALPHA,h.ONE));break;case 3:a?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ZERO,h.ZERO,h.ONE_MINUS_SRC_COLOR,h.ONE_MINUS_SRC_ALPHA)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR));break;case 4:a?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ZERO,h.SRC_COLOR,h.ZERO,h.SRC_ALPHA)):(h.blendEquation(h.FUNC_ADD),h.blendFunc(h.ZERO,h.SRC_COLOR));break;default:a?(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.ONE,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)):(h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA))}P=O=T=E=C=M=null}else i=i||t,o=o||r,s=s||n,t===M&&i===T||(h.blendEquationSeparate(c.convert(t),c.convert(i)),M=t,T=i),r===C&&n===E&&o===O&&s===P||(h.blendFuncSeparate(c.convert(r),c.convert(n),c.convert(o),c.convert(s)),C=r,E=n,O=o,P=s);S=e,A=a}function o(e){j!==e&&(e?h.frontFace(h.CW):h.frontFace(h.CCW),j=e)}function s(e){0!==e?(l(h.CULL_FACE),e!==R&&(1===e?h.cullFace(h.BACK):2===e?h.cullFace(h.FRONT):h.cullFace(h.FRONT_AND_BACK))):p(h.CULL_FACE),R=e}function a(e,t,r){e?(l(h.POLYGON_OFFSET_FILL),(N!==t||I!==r)&&(h.polygonOffset(t,r),N=t,I=r)):p(h.POLYGON_OFFSET_FILL)}function u(e){void 0===e&&(e=h.TEXTURE0+D-1),B!==e&&(h.activeTexture(e),B=e)}var f=new function(){var t=!1,o=new Me,r=null,s=new Me(0,0,0,0);return{setMask:function(e){r===e||t||(h.colorMask(e,e,e,e),r=e)},setLocked:function(e){t=e},setClear:function(e,t,r,n,i){!0===i&&(e*=n,t*=n,r*=n),o.set(e,t,r,n),!1===s.equals(o)&&(h.clearColor(e,t,r,n),s.copy(o))},reset:function(){t=!1,r=null,s.set(-1,0,0,0)}}},d=new function(){var t=!1,r=null,n=null,i=null;return{setTest:function(e){e?l(h.DEPTH_TEST):p(h.DEPTH_TEST)},setMask:function(e){r===e||t||(h.depthMask(e),r=e)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:h.depthFunc(h.NEVER);break;case 1:h.depthFunc(h.ALWAYS);break;case 2:h.depthFunc(h.LESS);break;case 3:h.depthFunc(h.LEQUAL);break;case 4:h.depthFunc(h.EQUAL);break;case 5:h.depthFunc(h.GEQUAL);break;case 6:h.depthFunc(h.GREATER);break;case 7:h.depthFunc(h.NOTEQUAL);break;default:h.depthFunc(h.LEQUAL)}else h.depthFunc(h.LEQUAL);n=e}},setLocked:function(e){t=e},setClear:function(e){i!==e&&(h.clearDepth(e),i=e)},reset:function(){t=!1,i=n=r=null}}},m=new function(){var t=!1,r=null,n=null,i=null,o=null,s=null,a=null,c=null,u=null;return{setTest:function(e){e?l(h.STENCIL_TEST):p(h.STENCIL_TEST)},setMask:function(e){r===e||t||(h.stencilMask(e),r=e)},setFunc:function(e,t,r){n===e&&i===t&&o===r||(h.stencilFunc(e,t,r),n=e,i=t,o=r)},setOp:function(e,t,r){s===e&&a===t&&c===r||(h.stencilOp(e,t,r),s=e,a=t,c=r)},setLocked:function(e){t=e},setClear:function(e){u!==e&&(h.clearStencil(e),u=e)},reset:function(){t=!1,u=c=a=s=o=i=n=r=null}}},v=h.getParameter(h.MAX_VERTEX_ATTRIBS),g=new Uint8Array(v),y=new Uint8Array(v),_=new Uint8Array(v),b={},x=null,w=null,S=null,M=null,C=null,E=null,T=null,O=null,P=null,A=!1,j=null,R=null,L=null,N=null,I=null,D=h.getParameter(h.MAX_COMBINED_TEXTURE_IMAGE_UNITS),k=!1;v=0,-1!==(v=h.getParameter(h.VERSION)).indexOf("WebGL")?(v=parseFloat(/^WebGL ([0-9])/.exec(v)[1]),k=1<=v):-1!==v.indexOf("OpenGL ES")&&(v=parseFloat(/^OpenGL ES ([0-9])/.exec(v)[1]),k=2<=v);var B=null,F={},$=new Me,U=new Me,z={};return z[h.TEXTURE_2D]=e(h.TEXTURE_2D,h.TEXTURE_2D,1),z[h.TEXTURE_CUBE_MAP]=e(h.TEXTURE_CUBE_MAP,h.TEXTURE_CUBE_MAP_POSITIVE_X,6),f.setClear(0,0,0,1),d.setClear(1),m.setClear(0),l(h.DEPTH_TEST),d.setFunc(3),o(!1),s(1),l(h.CULL_FACE),l(h.BLEND),i(1),{buffers:{color:f,depth:d,stencil:m},initAttributes:function(){for(var e=0,t=g.length;e<t;e++)g[e]=0},enableAttribute:function(e){t(e,0)},enableAttributeAndDivisor:t,disableUnusedAttributes:function(){for(var e=0,t=y.length;e!==t;++e)y[e]!==g[e]&&(h.disableVertexAttribArray(e),y[e]=0)},enable:l,disable:p,getCompressedTextureFormats:function(){if(null===x&&(x=[],r.get("WEBGL_compressed_texture_pvrtc")||r.get("WEBGL_compressed_texture_s3tc")||r.get("WEBGL_compressed_texture_etc1")||r.get("WEBGL_compressed_texture_astc")))for(var e=h.getParameter(h.COMPRESSED_TEXTURE_FORMATS),t=0;t<e.length;t++)x.push(e[t]);return x},useProgram:function(e){return w!==e&&(h.useProgram(e),w=e,!0)},setBlending:i,setMaterial:function(e,t){2===e.side?p(h.CULL_FACE):l(h.CULL_FACE);var r=1===e.side;t&&(r=!r),o(r),1===e.blending&&!1===e.transparent?i(0):i(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),d.setFunc(e.depthFunc),d.setTest(e.depthTest),d.setMask(e.depthWrite),f.setMask(e.colorWrite),a(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:o,setCullFace:s,setLineWidth:function(e){e!==L&&(k&&h.lineWidth(e),L=e)},setPolygonOffset:a,setScissorTest:function(e){e?l(h.SCISSOR_TEST):p(h.SCISSOR_TEST)},activeTexture:u,bindTexture:function(e,t){null===B&&u();var r=F[B];void 0===r&&(r={type:void 0,texture:void 0},F[B]=r),r.type===e&&r.texture===t||(h.bindTexture(e,t||z[e]),r.type=e,r.texture=t)},compressedTexImage2D:function(){try{h.compressedTexImage2D.apply(h,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{h.texImage2D.apply(h,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===$.equals(e)&&(h.scissor(e.x,e.y,e.z,e.w),$.copy(e))},viewport:function(e){!1===U.equals(e)&&(h.viewport(e.x,e.y,e.z,e.w),U.copy(e))},reset:function(){for(var e=0;e<y.length;e++)1===y[e]&&(h.disableVertexAttribArray(e),y[e]=0);b={},B=x=null,F={},R=j=S=w=null,f.reset(),d.reset(),m.reset()}}}function at(m,n,v,g,y,_,b){function x(e,t){if(e.width>t||e.height>t){if("data"in e)return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+e.width+"x"+e.height+").");t/=Math.max(e.width,e.height);var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.width=Math.floor(e.width*t),r.height=Math.floor(e.height*t),r.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height),r}return e}function w(e){return po.isPowerOfTwo(e.width)&&po.isPowerOfTwo(e.height)}function S(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function M(e,t,r,n){m.generateMipmap(e),g.get(t).__maxMipLevel=Math.log(Math.max(r,n))*Math.LOG2E}function C(e,t){if(!y.isWebGL2)return e;if(e===m.RGB){if(t===m.FLOAT)return m.RGB32F;if(t===m.HALF_FLOAT)return m.RGB16F;if(t===m.UNSIGNED_BYTE)return m.RGB8}if(e===m.RGBA){if(t===m.FLOAT)return m.RGBA32F;if(t===m.HALF_FLOAT)return m.RGBA16F;if(t===m.UNSIGNED_BYTE)return m.RGBA8}return e}function i(e){return 1003===e||1004===e||1005===e?m.NEAREST:m.LINEAR}function E(e){(e=e.target).removeEventListener("dispose",E);e:{var t=g.get(e);if(e.image&&t.__image__webglTextureCube)m.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)break e;m.deleteTexture(t.__webglTexture)}g.remove(e)}e.isVideoTexture&&delete p[e.id],b.memory.textures--}function s(e){(e=e.target).removeEventListener("dispose",s);var t=g.get(e),r=g.get(e.texture);if(e){if(void 0!==r.__webglTexture&&m.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(r=0;r<6;r++)m.deleteFramebuffer(t.__webglFramebuffer[r]),t.__webglDepthbuffer&&m.deleteRenderbuffer(t.__webglDepthbuffer[r]);else m.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&m.deleteRenderbuffer(t.__webglDepthbuffer);g.remove(e.texture),g.remove(e)}b.memory.textures--}function a(e,t){var r=g.get(e);if(e.isVideoTexture){var n=e.id,i=b.render.frame;p[n]!==i&&(p[n]=i,e.update())}if(0<e.version&&r.__version!==e.version)if(void 0===(n=e.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete){void 0===r.__webglInit&&(r.__webglInit=!0,e.addEventListener("dispose",E),r.__webglTexture=m.createTexture(),b.memory.textures++),v.activeTexture(m.TEXTURE0+t),v.bindTexture(m.TEXTURE_2D,r.__webglTexture),m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,e.flipY),m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),m.pixelStorei(m.UNPACK_ALIGNMENT,e.unpackAlignment),t=x(e.image,y.maxTextureSize),!y.isWebGL2&&(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)&&!1===w(t)&&(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageBitmap)&&(void 0===l&&(l=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),l.width=po.floorPowerOfTwo(t.width),l.height=po.floorPowerOfTwo(t.height),l.getContext("2d").drawImage(t,0,0,l.width,l.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+l.width+"x"+l.height),t=l),n=w(t),i=_.convert(e.format);var o=_.convert(e.type),s=C(i,o);T(m.TEXTURE_2D,e,n);var a=e.mipmaps;if(e.isDepthTexture){if(s=m.DEPTH_COMPONENT,1015===e.type){if(!y.isWebGL2)throw Error("Float Depth Texture only supported in WebGL2.0");s=m.DEPTH_COMPONENT32F}else y.isWebGL2&&(s=m.DEPTH_COMPONENT16);1026===e.format&&s===m.DEPTH_COMPONENT&&1012!==e.type&&1014!==e.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),e.type=1012,o=_.convert(e.type)),1027===e.format&&(s=m.DEPTH_STENCIL,1020!==e.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),e.type=1020,o=_.convert(e.type))),v.texImage2D(m.TEXTURE_2D,0,s,t.width,t.height,0,i,o,null)}else if(e.isDataTexture)if(0<a.length&&n){for(var c=0,u=a.length;c<u;c++){var h=a[c];v.texImage2D(m.TEXTURE_2D,c,s,h.width,h.height,0,i,o,h.data)}e.generateMipmaps=!1,r.__maxMipLevel=a.length-1}else v.texImage2D(m.TEXTURE_2D,0,s,t.width,t.height,0,i,o,t.data),r.__maxMipLevel=0;else if(e.isCompressedTexture){for(c=0,u=a.length;c<u;c++)h=a[c],1023!==e.format&&1022!==e.format?-1<v.getCompressedTextureFormats().indexOf(i)?v.compressedTexImage2D(m.TEXTURE_2D,c,s,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v.texImage2D(m.TEXTURE_2D,c,s,h.width,h.height,0,i,o,h.data);r.__maxMipLevel=a.length-1}else if(0<a.length&&n){for(c=0,u=a.length;c<u;c++)h=a[c],v.texImage2D(m.TEXTURE_2D,c,s,i,o,h);e.generateMipmaps=!1,r.__maxMipLevel=a.length-1}else v.texImage2D(m.TEXTURE_2D,0,s,i,o,t),r.__maxMipLevel=0;return S(e,n)&&M(m.TEXTURE_2D,e,t.width,t.height),r.__version=e.version,void(e.onUpdate&&e.onUpdate(e))}console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}v.activeTexture(m.TEXTURE0+t),v.bindTexture(m.TEXTURE_2D,r.__webglTexture)}function T(e,t,r){r?(m.texParameteri(e,m.TEXTURE_WRAP_S,_.convert(t.wrapS)),m.texParameteri(e,m.TEXTURE_WRAP_T,_.convert(t.wrapT)),m.texParameteri(e,m.TEXTURE_MAG_FILTER,_.convert(t.magFilter)),m.texParameteri(e,m.TEXTURE_MIN_FILTER,_.convert(t.minFilter))):(m.texParameteri(e,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(e,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),1001===t.wrapS&&1001===t.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),m.texParameteri(e,m.TEXTURE_MAG_FILTER,i(t.magFilter)),m.texParameteri(e,m.TEXTURE_MIN_FILTER,i(t.minFilter)),1003!==t.minFilter&&1006!==t.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!(r=n.get("EXT_texture_filter_anisotropic"))||1015===t.type&&null===n.get("OES_texture_float_linear")||1016===t.type&&null===(y.isWebGL2||n.get("OES_texture_half_float_linear"))||!(1<t.anisotropy||g.get(t).__currentAnisotropy)||(m.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,y.getMaxAnisotropy())),g.get(t).__currentAnisotropy=t.anisotropy)}function c(e,t,r,n){var i=_.convert(t.texture.format),o=_.convert(t.texture.type),s=C(i,o);v.texImage2D(n,0,s,t.width,t.height,0,i,o,null),m.bindFramebuffer(m.FRAMEBUFFER,e),m.framebufferTexture2D(m.FRAMEBUFFER,r,n,g.get(t.texture).__webglTexture,0),m.bindFramebuffer(m.FRAMEBUFFER,null)}function u(e,t){m.bindRenderbuffer(m.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,t.width,t.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,t.width,t.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,e)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,t.width,t.height),m.bindRenderbuffer(m.RENDERBUFFER,null)}var l,p={};this.setTexture2D=a,this.setTextureCube=function(e,t){var r=g.get(e);if(6===e.image.length)if(0<e.version&&r.__version!==e.version){r.__image__webglTextureCube||(e.addEventListener("dispose",E),r.__image__webglTextureCube=m.createTexture(),b.memory.textures++),v.activeTexture(m.TEXTURE0+t),v.bindTexture(m.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,e.flipY),t=e&&e.isCompressedTexture;for(var n=e.image[0]&&e.image[0].isDataTexture,i=[],o=0;o<6;o++)i[o]=t||n?n?e.image[o].image:e.image[o]:x(e.image[o],y.maxCubemapSize);var s=i[0],a=w(s),c=_.convert(e.format),u=_.convert(e.type),h=C(c,u);for(T(m.TEXTURE_CUBE_MAP,e,a),o=0;o<6;o++)if(t)for(var l,p=i[o].mipmaps,f=0,d=p.length;f<d;f++)l=p[f],1023!==e.format&&1022!==e.format?-1<v.getCompressedTextureFormats().indexOf(c)?v.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,h,l.width,l.height,0,l.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):v.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,h,l.width,l.height,0,c,u,l.data);else n?v.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,h,i[o].width,i[o].height,0,c,u,i[o].data):v.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,h,c,u,i[o]);r.__maxMipLevel=t?p.length-1:0,S(e,a)&&M(m.TEXTURE_CUBE_MAP,e,s.width,s.height),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else v.activeTexture(m.TEXTURE0+t),v.bindTexture(m.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,t){v.activeTexture(m.TEXTURE0+t),v.bindTexture(m.TEXTURE_CUBE_MAP,g.get(e).__webglTexture)},this.setupRenderTarget=function(e){var t=g.get(e),r=g.get(e.texture);e.addEventListener("dispose",s),r.__webglTexture=m.createTexture(),b.memory.textures++;var n=!0===e.isWebGLRenderTargetCube,i=w(e);if(n){t.__webglFramebuffer=[];for(var o=0;o<6;o++)t.__webglFramebuffer[o]=m.createFramebuffer()}else t.__webglFramebuffer=m.createFramebuffer();if(n){for(v.bindTexture(m.TEXTURE_CUBE_MAP,r.__webglTexture),T(m.TEXTURE_CUBE_MAP,e.texture,i),o=0;o<6;o++)c(t.__webglFramebuffer[o],e,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+o);S(e.texture,i)&&M(m.TEXTURE_CUBE_MAP,e.texture,e.width,e.height),v.bindTexture(m.TEXTURE_CUBE_MAP,null)}else v.bindTexture(m.TEXTURE_2D,r.__webglTexture),T(m.TEXTURE_2D,e.texture,i),c(t.__webglFramebuffer,e,m.COLOR_ATTACHMENT0,m.TEXTURE_2D),S(e.texture,i)&&M(m.TEXTURE_2D,e.texture,e.width,e.height),v.bindTexture(m.TEXTURE_2D,null);if(e.depthBuffer){if(t=g.get(e),r=!0===e.isWebGLRenderTargetCube,e.depthTexture){if(r)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(m.bindFramebuffer(m.FRAMEBUFFER,t.__webglFramebuffer),!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(g.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),a(e.depthTexture,0),t=g.get(e.depthTexture).__webglTexture,1026===e.depthTexture.format)m.framebufferTexture2D(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.TEXTURE_2D,t,0);else{if(1027!==e.depthTexture.format)throw Error("Unknown depthTexture format");m.framebufferTexture2D(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.TEXTURE_2D,t,0)}}else if(r)for(t.__webglDepthbuffer=[],r=0;r<6;r++)m.bindFramebuffer(m.FRAMEBUFFER,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=m.createRenderbuffer(),u(t.__webglDepthbuffer[r],e);else m.bindFramebuffer(m.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=m.createRenderbuffer(),u(t.__webglDepthbuffer,e);m.bindFramebuffer(m.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var t=e.texture,r=w(e);if(S(t,r)){r=e.isWebGLRenderTargetCube?m.TEXTURE_CUBE_MAP:m.TEXTURE_2D;var n=g.get(t).__webglTexture;v.bindTexture(r,n),M(r,t,e.width,e.height),v.bindTexture(r,null)}}}function ct(r,n,i){return{convert:function(e){if(1e3===e)return r.REPEAT;if(1001===e)return r.CLAMP_TO_EDGE;if(1002===e)return r.MIRRORED_REPEAT;if(1003===e)return r.NEAREST;if(1004===e)return r.NEAREST_MIPMAP_NEAREST;if(1005===e)return r.NEAREST_MIPMAP_LINEAR;if(1006===e)return r.LINEAR;if(1007===e)return r.LINEAR_MIPMAP_NEAREST;if(1008===e)return r.LINEAR_MIPMAP_LINEAR;if(1009===e)return r.UNSIGNED_BYTE;if(1017===e)return r.UNSIGNED_SHORT_4_4_4_4;if(1018===e)return r.UNSIGNED_SHORT_5_5_5_1;if(1019===e)return r.UNSIGNED_SHORT_5_6_5;if(1010===e)return r.BYTE;if(1011===e)return r.SHORT;if(1012===e)return r.UNSIGNED_SHORT;if(1013===e)return r.INT;if(1014===e)return r.UNSIGNED_INT;if(1015===e)return r.FLOAT;if(1016===e){if(i.isWebGL2)return r.HALF_FLOAT;var t=n.get("OES_texture_half_float");if(null!==t)return t.HALF_FLOAT_OES}if(1021===e)return r.ALPHA;if(1022===e)return r.RGB;if(1023===e)return r.RGBA;if(1024===e)return r.LUMINANCE;if(1025===e)return r.LUMINANCE_ALPHA;if(1026===e)return r.DEPTH_COMPONENT;if(1027===e)return r.DEPTH_STENCIL;if(100===e)return r.FUNC_ADD;if(101===e)return r.FUNC_SUBTRACT;if(102===e)return r.FUNC_REVERSE_SUBTRACT;if(200===e)return r.ZERO;if(201===e)return r.ONE;if(202===e)return r.SRC_COLOR;if(203===e)return r.ONE_MINUS_SRC_COLOR;if(204===e)return r.SRC_ALPHA;if(205===e)return r.ONE_MINUS_SRC_ALPHA;if(206===e)return r.DST_ALPHA;if(207===e)return r.ONE_MINUS_DST_ALPHA;if(208===e)return r.DST_COLOR;if(209===e)return r.ONE_MINUS_DST_COLOR;if(210===e)return r.SRC_ALPHA_SATURATE;if((33776===e||33777===e||33778===e||33779===e)&&null!==(t=n.get("WEBGL_compressed_texture_s3tc"))){if(33776===e)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((35840===e||35841===e||35842===e||35843===e)&&null!==(t=n.get("WEBGL_compressed_texture_pvrtc"))){if(35840===e)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e&&null!==(t=n.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e)&&null!==(t=n.get("WEBGL_compressed_texture_astc")))return e;if(103===e||104===e){if(i.isWebGL2){if(103===e)return r.MIN;if(104===e)return r.MAX}if(null!==(t=n.get("EXT_blend_minmax"))){if(103===e)return t.MIN_EXT;if(104===e)return t.MAX_EXT}}if(1020===e){if(i.isWebGL2)return r.UNSIGNED_INT_24_8;if(null!==(t=n.get("WEBGL_depth_texture")))return t.UNSIGNED_INT_24_8_WEBGL}return 0}}}function ut(){h.call(this),this.type="Group"}function ht(e,t,r,n){c.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function lt(e){ht.call(this),this.cameras=e||[]}function pt(r){function n(){return null!==u&&!0===u.isPresenting}function e(){if(n()){var e=u.getEyeParameters("left"),t=e.renderWidth;e=e.renderHeight,o=r.getPixelRatio(),i=r.getSize(),r.setDrawingBufferSize(2*t,e,1),s.start()}else c.enabled&&(r.setDrawingBufferSize(i.width,i.height,o),s.stop())}var c=this,u=null,h=null,l=null,p=[],f=new we,d=new we;"undefined"!=typeof window&&"VRFrameData"in window&&(h=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",e,!1));var m=new we,v=new a,g=new Se,y=new ht;y.bounds=new Me(0,0,.5,1),y.layers.enable(1);var _=new ht;_.bounds=new Me(.5,0,.5,1),_.layers.enable(2);var b=new lt([y,_]);b.layers.enable(1),b.layers.enable(2);var i,o,x=[];this.enabled=!1,this.userHeight=1.6,this.getController=function(e){var t=p[e];return void 0===t&&((t=new ut).matrixAutoUpdate=!1,t.visible=!1,p[e]=t),t},this.getDevice=function(){return u},this.setDevice=function(e){void 0!==e&&(u=e),s.setContext(e)},this.setPoseTarget=function(e){void 0!==e&&(l=e)},this.getCamera=function(e){if(null===u)return e.position.set(0,c.userHeight,0),e;u.depthNear=e.near,u.depthFar=e.far,u.getFrameData(h);var t=u.stageParameters;t?f.fromArray(t.sittingToStandingTransform):f.makeTranslation(0,c.userHeight,0),t=h.pose;var r=null!==l?l:e;if(r.matrix.copy(f),r.matrix.decompose(r.position,r.quaternion,r.scale),null!==t.orientation&&(v.fromArray(t.orientation),r.quaternion.multiply(v)),null!==t.position&&(v.setFromRotationMatrix(f),g.fromArray(t.position),g.applyQuaternion(v),r.position.add(g)),r.updateMatrixWorld(),!1===u.isPresenting)return e;y.near=e.near,_.near=e.near,y.far=e.far,_.far=e.far,b.matrixWorld.copy(e.matrixWorld),b.matrixWorldInverse.copy(e.matrixWorldInverse),y.matrixWorldInverse.fromArray(h.leftViewMatrix),_.matrixWorldInverse.fromArray(h.rightViewMatrix),d.getInverse(f),y.matrixWorldInverse.multiply(d),_.matrixWorldInverse.multiply(d),null!==(e=r.parent)&&(m.getInverse(e.matrixWorld),y.matrixWorldInverse.multiply(m),_.matrixWorldInverse.multiply(m)),y.matrixWorld.getInverse(y.matrixWorldInverse),_.matrixWorld.getInverse(_.matrixWorldInverse),y.projectionMatrix.fromArray(h.leftProjectionMatrix),_.projectionMatrix.fromArray(h.rightProjectionMatrix),b.projectionMatrix.copy(y.projectionMatrix),(e=u.getLayers()).length&&(null!==(e=e[0]).leftBounds&&4===e.leftBounds.length&&y.bounds.fromArray(e.leftBounds),null!==e.rightBounds&&4===e.rightBounds.length&&_.bounds.fromArray(e.rightBounds));e:for(e=0;e<p.length;e++){t=p[e];t:{r=e;for(var n=navigator.getGamepads&&navigator.getGamepads(),i=0,o=0,s=n.length;i<s;i++){var a=n[i];if(a&&("Daydream Controller"===a.id||"Gear VR Controller"===a.id||"Oculus Go Controller"===a.id||"OpenVR Gamepad"===a.id||a.id.startsWith("Oculus Touch")||a.id.startsWith("Spatial Controller"))){if(o===r){r=a;break t}o++}}r=void 0}if(void 0!==r&&void 0!==r.pose){if(null===r.pose)break e;!1===(n=r.pose).hasPosition&&t.position.set(.2,-.6,-.05),null!==n.position&&t.position.fromArray(n.position),null!==n.orientation&&t.quaternion.fromArray(n.orientation),t.matrix.compose(t.position,t.quaternion,t.scale),t.matrix.premultiply(f),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0,t.visible=!0,n="Daydream Controller"===r.id?0:1,x[e]!==r.buttons[n].pressed&&(x[e]=r.buttons[n].pressed,!0===x[e]?t.dispatchEvent({type:"selectstart"}):(t.dispatchEvent({type:"selectend"}),t.dispatchEvent({type:"select"})))}else t.visible=!1}return b},this.getStandingMatrix=function(){return f},this.isPresenting=n;var s=new Te;this.setAnimationLoop=function(e){s.setAnimationLoop(e)},this.submitFrame=function(){n()&&u.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function ft(r){function i(){return null!==u&&null!==h}function n(e){var t=p[f.indexOf(e.inputSource)];t&&t.dispatchEvent({type:e.type})}function o(){r.setFramebuffer(null),v.stop()}function s(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}var a=r.context,t=null,u=null,h=null,l=null,p=[],f=[],e=new ht;e.layers.enable(1),e.viewport=new Me;var c=new ht;c.layers.enable(2),c.viewport=new Me;var d=new lt([e,c]);d.layers.enable(1),d.layers.enable(2),this.enabled=!1,this.getController=function(e){var t=p[e];return void 0===t&&((t=new ut).matrixAutoUpdate=!1,t.visible=!1,p[e]=t),t},this.getDevice=function(){return t},this.setDevice=function(e){void 0!==e&&(t=e),e instanceof XRDevice&&a.setCompatibleXRDevice(e)},this.setSession=function(e,t){null!==(u=e)&&(u.addEventListener("select",n),u.addEventListener("selectstart",n),u.addEventListener("selectend",n),u.addEventListener("end",o),u.baseLayer=new XRWebGLLayer(u,a),u.requestFrameOfReference(t.frameOfReferenceType).then(function(e){h=e,r.setFramebuffer(u.baseLayer.framebuffer),v.setContext(u),v.start()}),f=u.getInputSources(),u.addEventListener("inputsourceschange",function(){f=u.getInputSources(),console.log(f)}))},this.getCamera=function(e){if(i()){var t=e.parent,r=d.cameras;s(d,t);for(var n=0;n<r.length;n++)s(r[n],t);for(e.matrixWorld.copy(d.matrixWorld),n=0,t=(e=e.children).length;n<t;n++)e[n].updateMatrixWorld(!0);return d}return e},this.isPresenting=i;var m=null,v=new Te;v.setAnimationLoop(function(e,t){if(null!==(l=t.getDevicePose(h)))for(var r=u.baseLayer,n=t.views,i=0;i<n.length;i++){var o=n[i],s=r.getViewport(o),a=l.getViewMatrix(o),c=d.cameras[i];c.matrix.fromArray(a).getInverse(c.matrix),c.projectionMatrix.fromArray(o.projectionMatrix),c.viewport.set(s.x,s.y,s.width,s.height),0===i&&(d.matrix.copy(c.matrix),d.projectionMatrix.copy(c.projectionMatrix))}for(i=0;i<p.length;i++)r=p[i],(n=f[i])&&null!==(n=t.getInputPose(n,h))?(r.matrix.elements=n.pointerMatrix,r.matrix.decompose(r.position,r.rotation,r.scale),r.visible=!0):r.visible=!1;m&&m(e)}),this.setAnimationLoop=function(e){m=e},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new THREE.Matrix4},this.submitFrame=function(){}}function dt(e){var w;function t(){C=new Le(de),(E=new je(de,C,e)).isWebGL2||(C.get("WEBGL_depth_texture"),C.get("OES_texture_float"),C.get("OES_texture_half_float"),C.get("OES_texture_half_float_linear"),C.get("OES_standard_derivatives"),C.get("OES_element_index_uint"),C.get("ANGLE_instanced_arrays")),C.get("OES_texture_float_linear"),U=new ct(de,C,E),(T=new st(de,C,U,E)).scissor(Q.copy(se).multiplyScalar(ie)),T.viewport(J.copy(oe).multiplyScalar(ie)),O=new De(de),P=new Xe,A=new at(de,C,T,P,E,U,O),j=new Oe(de),R=new Ne(de,j,O),L=new Be(R,O),B=new ke(de),N=new We(z,C,E),I=new Je,D=new rt,k=new Pe(z,T,L,y),F=new Ae(de,C,O,E),$=new Ie(de,C,O,E),O.programs=N.programs,z.context=de,z.capabilities=E,z.extensions=C,z.properties=P,z.renderLists=I,z.state=T,z.info=O}function r(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),G=!0}function n(){console.log("THREE.WebGLRenderer: Context Restored."),G=!1,t()}function h(e){(e=e.target).removeEventListener("dispose",h),l(e),P.remove(e)}function l(e){var t=P.get(e).program;(e.program=void 0)!==t&&N.releaseProgram(t)}function s(e,t,r,n){for(var i=0,o=e.length;i<o;i++){var s=e[i],a=s.object,c=s.geometry,u=void 0===n?s.material:n;if(s=s.group,r.isArrayCamera)for(var h=(Z=r).cameras,l=0,p=h.length;l<p;l++){var f=h[l];if(a.layers.test(f.layers)){if("viewport"in f)T.viewport(J.copy(f.viewport));else{var d=f.bounds;T.viewport(J.set(d.x*re,d.y*ne,d.z*re,d.w*ne).multiplyScalar(ie))}m(a,t,f,c,u,s)}}else Z=null,m(a,t,r,c,u,s)}}function m(e,t,r,n,i,o){if(e.onBeforeRender(z,t,r,n,i,o),M=D.get(t,Z||r),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){T.setMaterial(i);var s=S(r,t.fog,i,e);X=w=null,Y=!1,a=s,e.render(function(e){z.renderBufferImmediate(e,a)})}else z.renderBufferDirect(r,t.fog,n,i,e,o);var a;e.onAfterRender(z,t,r,n,i,o),M=D.get(t,Z||r)}function f(e,t,r){var n=P.get(e),i=M.state.lights,o=n.lightsHash,s=i.state.hash;r=N.getParameters(e,i.state,M.state.shadowsArray,t,ue.numPlanes,ue.numIntersection,r);var a=N.getProgramCode(e,r),c=n.program,u=!0;if(void 0===c)e.addEventListener("dispose",h);else if(c.code!==a)l(e);else{if(o.stateID!==s.stateID||o.directionalLength!==s.directionalLength||o.pointLength!==s.pointLength||o.spotLength!==s.spotLength||o.rectAreaLength!==s.rectAreaLength||o.hemiLength!==s.hemiLength||o.shadowsLength!==s.shadowsLength)o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength;else if(void 0!==r.shaderID)return;u=!1}if(u&&(r.shaderID?(a=Bo[r.shaderID],n.shader={name:e.type,uniforms:Lo.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}):n.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader},e.onBeforeCompile(n.shader,z),a=N.getProgramCode(e,r),c=N.acquireProgram(e,n.shader,r,a),n.program=c,e.program=c),r=c.getAttributes(),e.morphTargets)for(a=e.numSupportedMorphTargets=0;a<z.maxMorphTargets;a++)0<=r["morphTarget"+a]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(a=e.numSupportedMorphNormals=0;a<z.maxMorphNormals;a++)0<=r["morphNormal"+a]&&e.numSupportedMorphNormals++;r=n.shader.uniforms,(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(n.numClippingPlanes=ue.numPlanes,n.numIntersection=ue.numIntersection,r.clippingPlanes=ue.uniform),n.fog=t,void 0===o&&(n.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,e.lights&&(r.ambientLightColor.value=i.state.ambient,r.directionalLights.value=i.state.directional,r.spotLights.value=i.state.spot,r.rectAreaLights.value=i.state.rectArea,r.pointLights.value=i.state.point,r.hemisphereLights.value=i.state.hemi,r.directionalShadowMap.value=i.state.directionalShadowMap,r.directionalShadowMatrix.value=i.state.directionalShadowMatrix,r.spotShadowMap.value=i.state.spotShadowMap,r.spotShadowMatrix.value=i.state.spotShadowMatrix,r.pointShadowMap.value=i.state.pointShadowMap,r.pointShadowMatrix.value=i.state.pointShadowMatrix),e=n.program.getUniforms(),e=Fe.seqWithValue(e.seq,r),n.uniformsList=e}function S(e,t,r,n){te=0;var i=P.get(r),o=i.lightsHash,s=M.state.lights.state.hash;he&&(le||e!==K)&&ue.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,e,i,e===K&&r.id===W),!1===r.needsUpdate&&(void 0===i.program?r.needsUpdate=!0:r.fog&&i.fog!==t?r.needsUpdate=!0:(!r.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===i.numClippingPlanes||i.numClippingPlanes===ue.numPlanes&&i.numIntersection===ue.numIntersection)||(r.needsUpdate=!0)),r.needsUpdate&&(f(r,t,n),r.needsUpdate=!1);var a=!1,c=!1,u=!1;s=(o=i.program).getUniforms();var h=i.shader.uniforms;if(T.useProgram(o.program)&&(u=c=a=!0),r.id!==W&&(W=r.id,c=!0),(a||e!==K)&&(s.setValue(de,"projectionMatrix",e.projectionMatrix),E.logarithmicDepthBuffer&&s.setValue(de,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),K!==(Z||e)&&(K=Z||e,u=c=!0),(r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.envMap)&&(void 0!==(a=s.map.cameraPosition)&&a.setValue(de,fe.setFromMatrixPosition(e.matrixWorld))),(r.isMeshPhongMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&s.setValue(de,"viewMatrix",e.matrixWorldInverse)),r.skinning&&(s.setOptional(de,n,"bindMatrix"),s.setOptional(de,n,"bindMatrixInverse"),e=n.skeleton))if(a=e.bones,E.floatVertexTextures){if(void 0===e.boneTexture){a=Math.sqrt(4*a.length),a=po.ceilPowerOfTwo(a),a=Math.max(a,4);var l=new Float32Array(a*a*4);l.set(e.boneMatrices);var p=new Ce(l,a,a,1023,1015);p.needsUpdate=!0,e.boneMatrices=l,e.boneTexture=p,e.boneTextureSize=a}s.setValue(de,"boneTexture",e.boneTexture),s.setValue(de,"boneTextureSize",e.boneTextureSize)}else s.setOptional(de,e,"boneMatrices");return c&&(s.setValue(de,"toneMappingExposure",z.toneMappingExposure),s.setValue(de,"toneMappingWhitePoint",z.toneMappingWhitePoint),r.lights&&(c=u,h.ambientLightColor.needsUpdate=c,h.directionalLights.needsUpdate=c,h.pointLights.needsUpdate=c,h.spotLights.needsUpdate=c,h.rectAreaLights.needsUpdate=c,h.hemisphereLights.needsUpdate=c),t&&r.fog&&(h.fogColor.value=t.color,t.isFog?(h.fogNear.value=t.near,h.fogFar.value=t.far):t.isFogExp2&&(h.fogDensity.value=t.density)),r.isMeshBasicMaterial?d(h,r):r.isMeshLambertMaterial?(d(h,r),r.emissiveMap&&(h.emissiveMap.value=r.emissiveMap)):r.isMeshPhongMaterial?(d(h,r),r.isMeshToonMaterial?(v(h,r),r.gradientMap&&(h.gradientMap.value=r.gradientMap)):v(h,r)):r.isMeshStandardMaterial?(d(h,r),r.isMeshPhysicalMaterial?(g(h,r),h.reflectivity.value=r.reflectivity,h.clearCoat.value=r.clearCoat,h.clearCoatRoughness.value=r.clearCoatRoughness):g(h,r)):r.isMeshDepthMaterial?(d(h,r),r.displacementMap&&(h.displacementMap.value=r.displacementMap,h.displacementScale.value=r.displacementScale,h.displacementBias.value=r.displacementBias)):r.isMeshDistanceMaterial?(d(h,r),r.displacementMap&&(h.displacementMap.value=r.displacementMap,h.displacementScale.value=r.displacementScale,h.displacementBias.value=r.displacementBias),h.referencePosition.value.copy(r.referencePosition),h.nearDistance.value=r.nearDistance,h.farDistance.value=r.farDistance):r.isMeshNormalMaterial?(d(h,r),r.bumpMap&&(h.bumpMap.value=r.bumpMap,h.bumpScale.value=r.bumpScale,1===r.side&&(h.bumpScale.value*=-1)),r.normalMap&&(h.normalMap.value=r.normalMap,h.normalScale.value.copy(r.normalScale),1===r.side&&h.normalScale.value.negate()),r.displacementMap&&(h.displacementMap.value=r.displacementMap,h.displacementScale.value=r.displacementScale,h.displacementBias.value=r.displacementBias)):r.isLineBasicMaterial?(h.diffuse.value=r.color,h.opacity.value=r.opacity,r.isLineDashedMaterial&&(h.dashSize.value=r.dashSize,h.totalSize.value=r.dashSize+r.gapSize,h.scale.value=r.scale)):r.isPointsMaterial?(h.diffuse.value=r.color,h.opacity.value=r.opacity,h.size.value=r.size*ie,h.scale.value=.5*ne,h.map.value=r.map,null!==r.map&&(!0===r.map.matrixAutoUpdate&&r.map.updateMatrix(),h.uvTransform.value.copy(r.map.matrix))):r.isSpriteMaterial?(h.diffuse.value=r.color,h.opacity.value=r.opacity,h.rotation.value=r.rotation,h.map.value=r.map,null!==r.map&&(!0===r.map.matrixAutoUpdate&&r.map.updateMatrix(),h.uvTransform.value.copy(r.map.matrix))):r.isShadowMaterial&&(h.color.value=r.color,h.opacity.value=r.opacity),void 0!==h.ltc_1&&(h.ltc_1.value=ko.LTC_1),void 0!==h.ltc_2&&(h.ltc_2.value=ko.LTC_2),Fe.upload(de,i.uniformsList,h,z)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Fe.upload(de,i.uniformsList,h,z),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&s.setValue(de,"center",n.center),s.setValue(de,"modelViewMatrix",n.modelViewMatrix),s.setValue(de,"normalMatrix",n.normalMatrix),s.setValue(de,"modelMatrix",n.matrixWorld),o}function d(e,t){if(e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=P.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map)var r=t.map;else t.specularMap?r=t.specularMap:t.displacementMap?r=t.displacementMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.roughnessMap?r=t.roughnessMap:t.metalnessMap?r=t.metalnessMap:t.alphaMap?r=t.alphaMap:t.emissiveMap&&(r=t.emissiveMap);void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}function v(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function g(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}console.log("THREE.WebGLRenderer","95");var i=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),o=void 0!==e.context?e.context:null,a=void 0!==e.alpha&&e.alpha,c=void 0===e.depth||e.depth,u=void 0===e.stencil||e.stencil,p=void 0!==e.antialias&&e.antialias,y=void 0===e.premultipliedAlpha||e.premultipliedAlpha,_=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,b=void 0!==e.powerPreference?e.powerPreference:"default",x=null,M=null;this.domElement=i,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 C,E,T,O,P,A,j,R,L,N,I,D,k,B,F,$,U,z=this,G=!1,V=null,H=null,q=null,W=-1,X=w=null,Y=!1,K=null,Z=null,J=new Me,Q=new Me,ee=null,te=0,re=i.width,ne=i.height,ie=1,oe=new Me(0,0,re,ne),se=new Me(0,0,re,ne),ae=!1,ce=new Ee,ue=new Re,he=!1,le=!1,pe=new we,fe=new Se;try{a={alpha:a,depth:c,stencil:u,antialias:p,premultipliedAlpha:y,preserveDrawingBuffer:_,powerPreference:b},i.addEventListener("webglcontextlost",r,!1),i.addEventListener("webglcontextrestored",n,!1);var de=o||i.getContext("webgl",a)||i.getContext("experimental-webgl",a);if(null===de){if(null!==i.getContext("webgl"))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}void 0===de.getShaderPrecisionFormat&&(de.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){console.error("THREE.WebGLRenderer: "+e.message)}t();var me="xr"in navigator?new ft(z):new pt(z);this.vr=me;var ve=new ot(z,L,E.maxTextureSize);this.shadowMap=ve,this.getContext=function(){return de},this.getContextAttributes=function(){return de.getContextAttributes()},this.forceContextLoss=function(){var e=C.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=C.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ie},this.setPixelRatio=function(e){void 0!==e&&(ie=e,this.setSize(re,ne,!1))},this.getSize=function(){return{width:re,height:ne}},this.setSize=function(e,t,r){me.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(re=e,ne=t,i.width=e*ie,i.height=t*ie,!1!==r&&(i.style.width=e+"px",i.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(){return{width:re*ie,height:ne*ie}},this.setDrawingBufferSize=function(e,t,r){re=e,ne=t,ie=r,i.width=e*r,i.height=t*r,this.setViewport(0,0,e,t)},this.getCurrentViewport=function(){return J},this.setViewport=function(e,t,r,n){oe.set(e,ne-t-n,r,n),T.viewport(J.copy(oe).multiplyScalar(ie))},this.setScissor=function(e,t,r,n){se.set(e,ne-t-n,r,n),T.scissor(Q.copy(se).multiplyScalar(ie))},this.setScissorTest=function(e){T.setScissorTest(ae=e)},this.getClearColor=function(){return k.getClearColor()},this.setClearColor=function(){k.setClearColor.apply(k,arguments)},this.getClearAlpha=function(){return k.getClearAlpha()},this.setClearAlpha=function(){k.setClearAlpha.apply(k,arguments)},this.clear=function(e,t,r){var n=0;(void 0===e||e)&&(n|=de.COLOR_BUFFER_BIT),(void 0===t||t)&&(n|=de.DEPTH_BUFFER_BIT),(void 0===r||r)&&(n|=de.STENCIL_BUFFER_BIT),de.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(e,t,r,n){this.setRenderTarget(e),this.clear(t,r,n)},this.dispose=function(){i.removeEventListener("webglcontextlost",r,!1),i.removeEventListener("webglcontextrestored",n,!1),I.dispose(),D.dispose(),P.dispose(),L.dispose(),me.dispose(),xe.stop()},this.renderBufferImmediate=function(e,t){T.initAttributes();var r=P.get(e);e.hasPositions&&!r.position&&(r.position=de.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=de.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=de.createBuffer()),e.hasColors&&!r.color&&(r.color=de.createBuffer()),t=t.getAttributes(),e.hasPositions&&(de.bindBuffer(de.ARRAY_BUFFER,r.position),de.bufferData(de.ARRAY_BUFFER,e.positionArray,de.DYNAMIC_DRAW),T.enableAttribute(t.position),de.vertexAttribPointer(t.position,3,de.FLOAT,!1,0,0)),e.hasNormals&&(de.bindBuffer(de.ARRAY_BUFFER,r.normal),de.bufferData(de.ARRAY_BUFFER,e.normalArray,de.DYNAMIC_DRAW),T.enableAttribute(t.normal),de.vertexAttribPointer(t.normal,3,de.FLOAT,!1,0,0)),e.hasUvs&&(de.bindBuffer(de.ARRAY_BUFFER,r.uv),de.bufferData(de.ARRAY_BUFFER,e.uvArray,de.DYNAMIC_DRAW),T.enableAttribute(t.uv),de.vertexAttribPointer(t.uv,2,de.FLOAT,!1,0,0)),e.hasColors&&(de.bindBuffer(de.ARRAY_BUFFER,r.color),de.bufferData(de.ARRAY_BUFFER,e.colorArray,de.DYNAMIC_DRAW),T.enableAttribute(t.color),de.vertexAttribPointer(t.color,3,de.FLOAT,!1,0,0)),T.disableUnusedAttributes(),de.drawArrays(de.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,r,n,i,o){var s=i.isMesh&&i.normalMatrix.determinant()<0;T.setMaterial(n,s);var a=S(e,t,n,i),c=!1;w===r.id&&X===a.id&&Y===(!0===n.wireframe)||(w=r.id,X=a.id,Y=!0===n.wireframe,c=!0),i.morphTargetInfluences&&(B.update(i,r,n,a),c=!0),s=r.index;var u=r.attributes.position;if(t=1,!0===n.wireframe&&(s=R.getWireframeAttribute(r),t=2),e=F,null!==s){var h=j.get(s);(e=$).setIndex(h)}if(c){if(r&&r.isInstancedBufferGeometry&!E.isWebGL2&&null===C.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{T.initAttributes(),c=r.attributes,a=a.getAttributes();var l=n.defaultAttributeValues;for(x in a){var p=a[x];if(0<=p){var f=c[x];if(void 0!==f){var d=f.normalized,m=f.itemSize,v=j.get(f);if(void 0!==v){var g=v.buffer,y=v.type;if(v=v.bytesPerElement,f.isInterleavedBufferAttribute){var _=f.data,b=_.stride;f=f.offset,_&&_.isInstancedInterleavedBuffer?(T.enableAttributeAndDivisor(p,_.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=_.meshPerAttribute*_.count)):T.enableAttribute(p),de.bindBuffer(de.ARRAY_BUFFER,g),de.vertexAttribPointer(p,m,y,d,b*v,f*v)}else f.isInstancedBufferAttribute?(T.enableAttributeAndDivisor(p,f.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=f.meshPerAttribute*f.count)):T.enableAttribute(p),de.bindBuffer(de.ARRAY_BUFFER,g),de.vertexAttribPointer(p,m,y,d,0,0)}}else if(void 0!==l&&void 0!==(d=l[x]))switch(d.length){case 2:de.vertexAttrib2fv(p,d);break;case 3:de.vertexAttrib3fv(p,d);break;case 4:de.vertexAttrib4fv(p,d);break;default:de.vertexAttrib1fv(p,d)}}}T.disableUnusedAttributes()}null!==s&&de.bindBuffer(de.ELEMENT_ARRAY_BUFFER,h.buffer)}h=1/0,null!==s?h=s.count:void 0!==u&&(h=u.count),s=r.drawRange.start*t,u=null!==o?o.start*t:0;var x=Math.max(s,u);if(0!==(o=Math.max(0,Math.min(h,s+r.drawRange.count*t,u+(null!==o?o.count*t:1/0))-1-x+1))){if(i.isMesh)if(!0===n.wireframe)T.setLineWidth(n.wireframeLinewidth*(null===H?ie:1)),e.setMode(de.LINES);else switch(i.drawMode){case 0:e.setMode(de.TRIANGLES);break;case 1:e.setMode(de.TRIANGLE_STRIP);break;case 2:e.setMode(de.TRIANGLE_FAN)}else i.isLine?(void 0===(n=n.linewidth)&&(n=1),T.setLineWidth(n*(null===H?ie:1)),i.isLineSegments?e.setMode(de.LINES):i.isLineLoop?e.setMode(de.LINE_LOOP):e.setMode(de.LINE_STRIP)):i.isPoints?e.setMode(de.POINTS):i.isSprite&&e.setMode(de.TRIANGLES);r&&r.isInstancedBufferGeometry?0<r.maxInstancedCount&&e.renderInstances(r,x,o):e.render(x,o)}},this.compile=function(r,e){(M=D.get(r,e)).init(),r.traverse(function(e){e.isLight&&(M.pushLight(e),e.castShadow&&M.pushShadow(e))}),M.setupLights(e),r.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var t=0;t<e.material.length;t++)f(e.material[t],r.fog,e);else f(e.material,r.fog,e)})};var ge,ye,_e,be=null,xe=new Te;xe.setAnimationLoop(function(e){me.isPresenting()||be&&be(e)}),"undefined"!=typeof window&&xe.setContext(window),this.setAnimationLoop=function(e){be=e,me.setAnimationLoop(e),xe.start()},this.render=function(e,t,r,n){if(t&&t.isCamera){if(!G){X=w=null,Y=!1,W=-1,!(K=null)===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),me.enabled&&(t=me.getCamera(t)),(M=D.get(e,t)).init(),e.onBeforeRender(z,e,t,r),pe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ce.setFromMatrix(pe),le=this.localClippingEnabled,he=ue.init(this.clippingPlanes,le,t),(x=I.get(e,t)).init(),function e(t,r,n){if(!1!==t.visible){if(t.layers.test(r.layers))if(t.isLight)M.pushLight(t),t.castShadow&&M.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||ce.intersectsSprite(t)){n&&fe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(pe);var i=L.update(t),o=t.material;x.push(t,i,o,fe.z,null)}}else if(t.isImmediateRenderObject)n&&fe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(pe),x.push(t,null,t.material,fe.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||ce.intersectsObject(t)))if(n&&fe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(pe),i=L.update(t),o=t.material,Array.isArray(o))for(var s=i.groups,a=0,c=s.length;a<c;a++){var u=s[a],h=o[u.materialIndex];h&&h.visible&&x.push(t,i,h,fe.z,u)}else o.visible&&x.push(t,i,o,fe.z,null);for(a=0,c=(t=t.children).length;a<c;a++)e(t[a],r,n)}}(e,t,z.sortObjects),!0===z.sortObjects&&x.sort(),he&&ue.beginShadows(),ve.render(M.state.shadowsArray,e,t),M.setupLights(t),he&&ue.endShadows(),this.info.autoReset&&this.info.reset(),void 0===r&&(r=null),this.setRenderTarget(r),k.render(x,e,t,n),n=x.opaque;var i=x.transparent;if(e.overrideMaterial){var o=e.overrideMaterial;n.length&&s(n,e,t,o),i.length&&s(i,e,t,o)}else n.length&&s(n,e,t),i.length&&s(i,e,t);r&&A.updateRenderTargetMipmap(r),T.buffers.depth.setTest(!0),T.buffers.depth.setMask(!0),T.buffers.color.setMask(!0),T.setPolygonOffset(!1),e.onAfterRender(z,e,t),me.enabled&&me.submitFrame(),M=x=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.allocTextureUnit=function(){var e=te;return e>=E.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+E.maxTextures),te+=1,e},this.setTexture2D=(ge=!1,function(e,t){e&&e.isWebGLRenderTarget&&(ge||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),ge=!0),e=e.texture),A.setTexture2D(e,t)}),this.setTexture=(ye=!1,function(e,t){ye||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),ye=!0),A.setTexture2D(e,t)}),this.setTextureCube=(_e=!1,function(e,t){e&&e.isWebGLRenderTargetCube&&(_e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),_e=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?A.setTextureCube(e,t):A.setTextureCubeDynamic(e,t)}),this.setFramebuffer=function(e){V=e},this.getRenderTarget=function(){return H},this.setRenderTarget=function(e){(H=e)&&void 0===P.get(e).__webglFramebuffer&&A.setupRenderTarget(e);var t=V,r=!1;ee=e?(t=P.get(e).__webglFramebuffer,e.isWebGLRenderTargetCube&&(t=t[e.activeCubeFace],r=!0),J.copy(e.viewport),Q.copy(e.scissor),e.scissorTest):(J.copy(oe).multiplyScalar(ie),Q.copy(se).multiplyScalar(ie),ae),q!==t&&(de.bindFramebuffer(de.FRAMEBUFFER,t),q=t),T.viewport(J),T.scissor(Q),T.setScissorTest(ee),r&&(r=P.get(e.texture),de.framebufferTexture2D(de.FRAMEBUFFER,de.COLOR_ATTACHMENT0,de.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,r.__webglTexture,e.activeMipMapLevel))},this.readRenderTargetPixels=function(e,t,r,n,i,o){if(e&&e.isWebGLRenderTarget){var s=P.get(e).__webglFramebuffer;if(s){var a=!1;s!==q&&(de.bindFramebuffer(de.FRAMEBUFFER,s),a=!0);try{var c=e.texture,u=c.format,h=c.type;1023!==u&&U.convert(u)!==de.getParameter(de.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||U.convert(h)===de.getParameter(de.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(E.isWebGL2||C.get("OES_texture_float")||C.get("WEBGL_color_buffer_float"))||1016===h&&(E.isWebGL2?C.get("EXT_color_buffer_float"):C.get("EXT_color_buffer_half_float"))?de.checkFramebufferStatus(de.FRAMEBUFFER)===de.FRAMEBUFFER_COMPLETE?0<=t&&t<=e.width-n&&0<=r&&r<=e.height-i&&de.readPixels(t,r,n,i,U.convert(u),U.convert(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&&de.bindFramebuffer(de.FRAMEBUFFER,q)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,r){var n=t.image.width,i=t.image.height,o=U.convert(t.format);this.setTexture2D(t,0),de.copyTexImage2D(de.TEXTURE_2D,r||0,o,e.x,e.y,n,i,0)},this.copyTextureToTexture=function(e,t,r,n){var i=t.image.width,o=t.image.height,s=U.convert(r.format),a=U.convert(r.type);this.setTexture2D(r,0),t.isDataTexture?de.texSubImage2D(de.TEXTURE_2D,n||0,e.x,e.y,i,o,s,a,t.image.data):de.texSubImage2D(de.TEXTURE_2D,n||0,e.x,e.y,s,a,t.image)}}function mt(e,t){this.name="",this.color=new w(e),this.density=void 0!==t?t:25e-5}function vt(e,t,r){this.name="",this.color=new w(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3}function gt(){h.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function yt(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function _t(e,t,r,n){this.data=e,this.itemSize=t,this.offset=r,this.normalized=!0===n}function bt(e){N.call(this),this.type="SpriteMaterial",this.color=new w(16777215),this.map=null,this.rotation=0,this.lights=!1,this.transparent=!0,this.setValues(e)}function xt(e){if(h.call(this),this.type="Sprite",void 0===ra){ra=new A;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);t=new yt(t,5),ra.setIndex([0,1,2,0,2,3]),ra.addAttribute("position",new _t(t,3,0,!1)),ra.addAttribute("uv",new _t(t,2,3,!1))}this.geometry=ra,this.material=void 0!==e?e:new bt,this.center=new H(.5,.5)}function wt(){h.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function St(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new we)}function Mt(){h.call(this),this.type="Bone"}function Ct(e,t){$.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new we,this.bindMatrixInverse=new we,e=new St(e=this.initBones()),this.bind(e,this.matrixWorld),this.normalizeSkinWeights()}function Et(e){N.call(this),this.type="LineBasicMaterial",this.color=new w(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.lights=!1,this.setValues(e)}function Tt(e,t,r){1===r&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),h.call(this),this.type="Line",this.geometry=void 0!==e?e:new A,this.material=void 0!==t?t:new Et({color:16777215*Math.random()})}function Ot(e,t){Tt.call(this,e,t),this.type="LineSegments"}function Pt(e,t){Tt.call(this,e,t),this.type="LineLoop"}function At(e){N.call(this),this.type="PointsMaterial",this.color=new w(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=this.morphTargets=!1,this.setValues(e)}function jt(e,t){h.call(this),this.type="Points",this.geometry=void 0!==e?e:new A,this.material=void 0!==t?t:new At({color:16777215*Math.random()})}function Rt(e,t,r,n,i,o,s,a,c){p.call(this,e,t,r,n,i,o,s,a,c),this.generateMipmaps=!1}function Lt(e,t,r,n,i,o,s,a,c,u,h,l){p.call(this,null,o,s,a,c,u,n,i,h,l),this.image={width:t,height:r},this.mipmaps=e,this.generateMipmaps=this.flipY=!1}function Nt(e,t,r,n,i,o,s,a,c){p.call(this,e,t,r,n,i,o,s,a,c),this.needsUpdate=!0}function It(e,t,r,n,i,o,s,a,c,u){if(1026!==(u=void 0!==u?u:1026)&&1027!==u)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===u&&(r=1012),void 0===r&&1027===u&&(r=1020),p.call(this,null,n,i,o,s,a,u,r,c),this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==a?a:1003,this.generateMipmaps=this.flipY=!1}function Dt(e){A.call(this),this.type="WireframeGeometry";var t,r,n,i=[],o=[0,0],s={},a=["a","b","c"];if(e&&e.isGeometry){var c=e.faces,u=0;for(r=c.length;u<r;u++){var h=c[u];for(t=0;t<3;t++){var l=h[a[t]],p=h[a[(t+1)%3]];o[0]=Math.min(l,p),o[1]=Math.max(l,p),void 0===s[l=o[0]+","+o[1]]&&(s[l]={index1:o[0],index2:o[1]})}}for(l in s)u=s[l],a=e.vertices[u.index1],i.push(a.x,a.y,a.z),a=e.vertices[u.index2],i.push(a.x,a.y,a.z)}else if(e&&e.isBufferGeometry)if(a=new Se,null!==e.index){c=e.attributes.position,h=e.index;var f=e.groups;for(0===f.length&&(f=[{start:0,count:h.count,materialIndex:0}]),e=0,n=f.length;e<n;++e)for(t=(u=f[e]).start,r=u.count,r=(u=t)+r;u<r;u+=3)for(t=0;t<3;t++)l=h.getX(u+t),p=h.getX(u+(t+1)%3),o[0]=Math.min(l,p),o[1]=Math.max(l,p),void 0===s[l=o[0]+","+o[1]]&&(s[l]={index1:o[0],index2:o[1]});for(l in s)u=s[l],a.fromBufferAttribute(c,u.index1),i.push(a.x,a.y,a.z),a.fromBufferAttribute(c,u.index2),i.push(a.x,a.y,a.z)}else for(u=0,r=(c=e.attributes.position).count/3;u<r;u++)for(t=0;t<3;t++)s=3*u+t,a.fromBufferAttribute(c,s),i.push(a.x,a.y,a.z),s=3*u+(t+1)%3,a.fromBufferAttribute(c,s),i.push(a.x,a.y,a.z);this.addAttribute("position",new P(i,3))}function kt(e,t,r){S.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r},this.fromBufferGeometry(new Bt(e,t,r)),this.mergeVertices()}function Bt(e,t,r){A.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:r};var n,i,o=[],s=[],a=[],c=[],u=new Se,h=new Se,l=new Se,p=new Se,f=new Se;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var d=t+1;for(n=0;n<=r;n++){var m=n/r;for(i=0;i<=t;i++){var v=i/t;e(v,m,h),s.push(h.x,h.y,h.z),0<=v-1e-5?(e(v-1e-5,m,l),p.subVectors(h,l)):(e(v+1e-5,m,l),p.subVectors(l,h)),0<=m-1e-5?(e(v,m-1e-5,l),f.subVectors(h,l)):(e(v,m+1e-5,l),f.subVectors(l,h)),u.crossVectors(p,f).normalize(),a.push(u.x,u.y,u.z),c.push(v,m)}}for(n=0;n<r;n++)for(i=0;i<t;i++)e=n*d+i+1,u=(n+1)*d+i+1,h=(n+1)*d+i,o.push(n*d+i,e,h),o.push(e,u,h);this.setIndex(o),this.addAttribute("position",new P(s,3)),this.addAttribute("normal",new P(a,3)),this.addAttribute("uv",new P(c,2))}function Ft(e,t,r,n){S.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n},this.fromBufferGeometry(new $t(e,t,r,n)),this.mergeVertices()}function $t(r,m,e,t){function v(e){l.push(e.x,e.y,e.z)}function g(e,t){e*=3,t.x=r[e+0],t.y=r[e+1],t.z=r[e+2]}function h(e,t,r,n){n<0&&1===e.x&&(p[t]=e.x-1),0===r.x&&0===r.z&&(p[t]=n/2/Math.PI+.5)}A.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:r,indices:m,radius:e,detail:t},e=e||1;var l=[],p=[];!function(e){for(var t=new Se,r=new Se,n=new Se,i=0;i<m.length;i+=3){g(m[i+0],t),g(m[i+1],r),g(m[i+2],n);var o,s,a=t,c=r,u=n,h=Math.pow(2,e),l=[];for(s=0;s<=h;s++){l[s]=[];var p=a.clone().lerp(u,s/h),f=c.clone().lerp(u,s/h),d=h-s;for(o=0;o<=d;o++)l[s][o]=0===o&&s===h?p:p.clone().lerp(f,o/d)}for(s=0;s<h;s++)for(o=0;o<2*(h-s)-1;o++)a=Math.floor(o/2),0==o%2?(v(l[s][a+1]),v(l[s+1][a]),v(l[s][a])):(v(l[s][a+1]),v(l[s+1][a+1]),v(l[s+1][a]))}}(t=t||0),function(e){for(var t=new Se,r=0;r<l.length;r+=3)t.x=l[r+0],t.y=l[r+1],t.z=l[r+2],t.normalize().multiplyScalar(e),l[r+0]=t.x,l[r+1]=t.y,l[r+2]=t.z}(e),function(){for(var e=new Se,t=0;t<l.length;t+=3)e.x=l[t+0],e.y=l[t+1],e.z=l[t+2],p.push(Math.atan2(e.z,-e.x)/2/Math.PI+.5,1-(Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5));e=new Se,t=new Se;for(var r=new Se,n=new Se,i=new H,o=new H,s=new H,a=0,c=0;a<l.length;a+=9,c+=6){e.set(l[a+0],l[a+1],l[a+2]),t.set(l[a+3],l[a+4],l[a+5]),r.set(l[a+6],l[a+7],l[a+8]),i.set(p[c+0],p[c+1]),o.set(p[c+2],p[c+3]),s.set(p[c+4],p[c+5]),n.copy(e).add(t).add(r).divideScalar(3);var u=Math.atan2(n.z,-n.x);h(i,c+0,e,u),h(o,c+2,t,u),h(s,c+4,r,u)}for(e=0;e<p.length;e+=6)t=p[e+0],r=p[e+2],n=p[e+4],i=Math.min(t,r,n),.9<Math.max(t,r,n)&&i<.1&&(t<.2&&(p[e+0]+=1),r<.2&&(p[e+2]+=1),n<.2&&(p[e+4]+=1))}(),this.addAttribute("position",new P(l,3)),this.addAttribute("normal",new P(l.slice(),3)),this.addAttribute("uv",new P(p,2)),0===t?this.computeVertexNormals():this.normalizeNormals()}function Ut(e,t){S.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new zt(e,t)),this.mergeVertices()}function zt(e,t){$t.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Gt(e,t){S.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Vt(e,t)),this.mergeVertices()}function Vt(e,t){$t.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ht(e,t){S.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new qt(e,t)),this.mergeVertices()}function qt(e,t){var r=(1+Math.sqrt(5))/2;$t.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Wt(e,t){S.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Xt(e,t)),this.mergeVertices()}function Xt(e,t){var r=(1+Math.sqrt(5))/2,n=1/r;$t.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Yt(e,t,r,n,i,o){S.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:n,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed."),e=new Kt(e,t,r,n,i),this.tangents=e.tangents,this.normals=e.normals,this.binormals=e.binormals,this.fromBufferGeometry(e),this.mergeVertices()}function Kt(i,o,s,a,e){function t(e){p=i.getPointAt(e/o,p);var t=c.normals[e];for(e=c.binormals[e],u=0;u<=a;u++){var r=u/a*Math.PI*2,n=Math.sin(r);r=-Math.cos(r),l.x=r*t.x+n*e.x,l.y=r*t.y+n*e.y,l.z=r*t.z+n*e.z,l.normalize(),d.push(l.x,l.y,l.z),h.x=p.x+s*l.x,h.y=p.y+s*l.y,h.z=p.z+s*l.z,f.push(h.x,h.y,h.z)}}A.call(this),this.type="TubeBufferGeometry",this.parameters={path:i,tubularSegments:o,radius:s,radialSegments:a,closed:e},o=o||64,s=s||1,a=a||8,e=e||!1;var c=i.computeFrenetFrames(o,e);this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals;var n,u,h=new Se,l=new Se,r=new H,p=new Se,f=[],d=[],m=[],v=[];for(n=0;n<o;n++)t(n);for(t(!1===e?o:0),n=0;n<=o;n++)for(u=0;u<=a;u++)r.x=n/o,r.y=u/a,m.push(r.x,r.y);!function(){for(u=1;u<=o;u++)for(n=1;n<=a;n++){var e=(a+1)*u+(n-1),t=(a+1)*u+n,r=(a+1)*(u-1)+n;v.push((a+1)*(u-1)+(n-1),e,r),v.push(e,t,r)}}(),this.setIndex(v),this.addAttribute("position",new P(f,3)),this.addAttribute("normal",new P(d,3)),this.addAttribute("uv",new P(m,2))}function Zt(e,t,r,n,i,o,s){S.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,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 Jt(e,t,r,n,i,o)),this.mergeVertices()}function Jt(e,t,r,n,i,o){function s(e,t,r,n,i){var o=Math.sin(e);t=r/t*e,r=Math.cos(t),i.x=n*(2+r)*.5*Math.cos(e),i.y=n*(2+r)*o*.5,i.z=n*Math.sin(t)*.5}A.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:o},e=e||1,t=t||.4,r=Math.floor(r)||64,n=Math.floor(n)||8,i=i||2,o=o||3;var a,c=[],u=[],h=[],l=[],p=new Se,f=new Se,d=new Se,m=new Se,v=new Se,g=new Se,y=new Se;for(a=0;a<=r;++a){var _=a/r*i*Math.PI*2;for(s(_,i,o,e,d),s(_+.01,i,o,e,m),g.subVectors(m,d),y.addVectors(m,d),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),_=0;_<=n;++_){var b=_/n*Math.PI*2,x=-t*Math.cos(b);b=t*Math.sin(b),p.x=d.x+(x*y.x+b*v.x),p.y=d.y+(x*y.y+b*v.y),p.z=d.z+(x*y.z+b*v.z),u.push(p.x,p.y,p.z),f.subVectors(p,d).normalize(),h.push(f.x,f.y,f.z),l.push(a/r),l.push(_/n)}}for(_=1;_<=r;_++)for(a=1;a<=n;a++)e=(n+1)*_+(a-1),t=(n+1)*_+a,i=(n+1)*(_-1)+a,c.push((n+1)*(_-1)+(a-1),e,i),c.push(e,t,i);this.setIndex(c),this.addAttribute("position",new P(u,3)),this.addAttribute("normal",new P(h,3)),this.addAttribute("uv",new P(l,2))}function Qt(e,t,r,n,i){S.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i},this.fromBufferGeometry(new er(e,t,r,n,i)),this.mergeVertices()}function er(e,t,r,n,i){A.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i},e=e||1,t=t||.4,r=Math.floor(r)||8,n=Math.floor(n)||6,i=i||2*Math.PI;var o,s,a=[],c=[],u=[],h=[],l=new Se,p=new Se,f=new Se;for(o=0;o<=r;o++)for(s=0;s<=n;s++){var d=s/n*i,m=o/r*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(d),p.y=(e+t*Math.cos(m))*Math.sin(d),p.z=t*Math.sin(m),c.push(p.x,p.y,p.z),l.x=e*Math.cos(d),l.y=e*Math.sin(d),f.subVectors(p,l).normalize(),u.push(f.x,f.y,f.z),h.push(s/n),h.push(o/r)}for(o=1;o<=r;o++)for(s=1;s<=n;s++)e=(n+1)*(o-1)+s-1,t=(n+1)*(o-1)+s,i=(n+1)*o+s,a.push((n+1)*o+s-1,e,i),a.push(e,t,i);this.setIndex(a),this.addAttribute("position",new P(c,3)),this.addAttribute("normal",new P(u,3)),this.addAttribute("uv",new P(h,2))}function tr(e,t,r,n,i){for(var o,s=0,a=t,c=r-n;a<r;a+=n)s+=(e[c]-e[a])*(e[a+1]+e[c+1]),c=a;if(i===0<s)for(i=t;i<r;i+=n)o=fr(i,e[i],e[i+1],o);else for(i=r-n;t<=i;i-=n)o=fr(i,e[i],e[i+1],o);return o&&ur(o,o.next)&&(dr(o),o=o.next),o}function rr(e,t){if(!e)return e;t||(t=e);do{var r=!1;if(e.steiner||!ur(e,e.next)&&0!==cr(e.prev,e,e.next))e=e.next;else{if(dr(e),(e=t=e.prev)===e.next)break;r=!0}}while(r||e!==t);return t}function nr(e,t){return e.x-t.x}function ir(e,t){var r=t,n=e.x,i=e.y,o=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&o<s){if((o=s)===n){if(i===r.y)return r;if(i===r.next.y)return r.next}var a=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!a)return null;if(n===o)return a.prev;s=(t=a).x;var c=a.y,u=1/0;for(r=a.next;r!==t;){if(n>=r.x&&r.x>=s&&n!==r.x&&ar(i<c?n:o,i,s,c,i<c?o:n,i,r.x,r.y)){var h=Math.abs(i-r.y)/(n-r.x);(h<u||h===u&&r.x>a.x)&&lr(r,e)&&(a=r,u=h)}r=r.next}return a}function or(e,t,r,n,i){return 1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1)|(1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function sr(e){for(var t=e,r=e;t.x<r.x&&(r=t),(t=t.next)!==e;);return r}function ar(e,t,r,n,i,o,s,a){return 0<=(i-s)*(t-a)-(e-s)*(o-a)&&0<=(e-s)*(n-a)-(r-s)*(t-a)&&0<=(r-s)*(o-a)-(i-s)*(n-a)}function cr(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function ur(e,t){return e.x===t.x&&e.y===t.y}function hr(e,t,r,n){return!!(ur(e,t)&&ur(r,n)||ur(e,n)&&ur(r,t))||0<cr(e,t,r)!=0<cr(e,t,n)&&0<cr(r,n,e)!=0<cr(r,n,t)}function lr(e,t){return cr(e.prev,e,e.next)<0?0<=cr(e,t,e.next)&&0<=cr(e,e.prev,t):cr(e,t,e.prev)<0||cr(e,e.next,t)<0}function pr(e,t){var r=new mr(e.i,e.x,e.y),n=new mr(t.i,t.x,t.y),i=e.next,o=t.prev;return(e.next=t).prev=e,(r.next=i).prev=r,(n.next=r).prev=n,(o.next=n).prev=o,n}function fr(e,t,r,n){return e=new mr(e,t,r),n?(e.next=n.next,(e.prev=n).next.prev=e,n.next=e):(e.prev=e).next=e,e}function dr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function mr(e,t,r){this.i=e,this.x=t,this.y=r,this.nextZ=this.prevZ=this.z=this.next=this.prev=null,this.steiner=!1}function vr(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function gr(e,t){for(var r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}function yr(e,t){S.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new _r(e,t)),this.mergeVertices()}function _r(e,U){function t(e){function t(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function r(e,t,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y,a=n*n+i*i;if(Math.abs(n*s-i*o)>Number.EPSILON){var c=Math.sqrt(a),u=Math.sqrt(o*o+s*s);if(a=t.x-i/c,t=t.y+n/c,(i=(o=a+n*(s=((r.x-s/u-a)*s-(r.y+o/u-t)*o)/(n*s-i*o))-e.x)*o+(n=t+i*s-e.y)*n)<=2)return new H(o,n);i=Math.sqrt(i/2)}else e=!1,n>Number.EPSILON?o>Number.EPSILON&&(e=!0):n<-Number.EPSILON?o<-Number.EPSILON&&(e=!0):Math.sign(i)===Math.sign(s)&&(e=!0),i=e?(o=-i,Math.sqrt(a)):(o=n,n=i,Math.sqrt(a/2));return new H(o/i,n/i)}function n(e,t){for(N=e.length;0<=--N;){var r=N,n=N-1;n<0&&(n=e.length-1);var i,o=p+2*m;for(i=0;i<o;i++){var s=R*i,a=R*(i+1),c=t+n+s,u=t+n+a;a=t+r+a,h(t+r+s),h(c),h(a),h(c),h(u),h(a),s=G.length/3,l((s=g.generateSideWallUV(z,G,s-6,s-3,s-2,s-1))[0]),l(s[1]),l(s[3]),l(s[1]),l(s[2]),l(s[3])}}}function i(e,t,r){s.push(e),s.push(t),s.push(r)}function o(e,t,r){h(e),h(t),h(r),e=G.length/3,l((e=g.generateTopUV(z,G,e-3,e-2,e-1))[0]),l(e[1]),l(e[2])}function h(e){G.push(s[3*e]),G.push(s[3*e+1]),G.push(s[3*e+2])}function l(e){V.push(e.x),V.push(e.y)}var s=[],a=void 0!==U.curveSegments?U.curveSegments:12,p=void 0!==U.steps?U.steps:1,c=void 0!==U.depth?U.depth:100,u=void 0===U.bevelEnabled||U.bevelEnabled,f=void 0!==U.bevelThickness?U.bevelThickness:6,d=void 0!==U.bevelSize?U.bevelSize:f-2,m=void 0!==U.bevelSegments?U.bevelSegments:3,v=U.extrudePath,g=void 0!==U.UVGenerator?U.UVGenerator:wa;void 0!==U.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=U.amount);var y,_=!1;if(v){var b=v.getSpacedPoints(p);u=!(_=!0);var x=v.computeFrenetFrames(p,!1),w=new Se,S=new Se,M=new Se}u||(d=f=m=0),e=(a=e.extractPoints(a)).shape;var C=a.holes;if(!xa.isClockWise(e)){e=e.reverse();var E=0;for(y=C.length;E<y;E++){var T=C[E];xa.isClockWise(T)&&(C[E]=T.reverse())}}var O=xa.triangulateShape(e,C),P=e;for(E=0,y=C.length;E<y;E++)T=C[E],e=e.concat(T);var A,j,R=e.length,L=O.length;a=[];var N=0,I=P.length,D=I-1;for(A=N+1;N<I;N++,D++,A++)D===I&&(D=0),A===I&&(A=0),a[N]=r(P[N],P[D],P[A]);v=[];var k=a.concat();for(E=0,y=C.length;E<y;E++){T=C[E];var B=[];for(N=0,D=(I=T.length)-1,A=N+1;N<I;N++,D++,A++)D===I&&(D=0),A===I&&(A=0),B[N]=r(T[N],T[D],T[A]);v.push(B),k=k.concat(B)}for(D=0;D<m;D++){I=D/m;var F=f*Math.cos(I*Math.PI/2);for(A=d*Math.sin(I*Math.PI/2),N=0,I=P.length;N<I;N++){var $=t(P[N],a[N],A);i($.x,$.y,-F)}for(E=0,y=C.length;E<y;E++)for(T=C[E],B=v[E],N=0,I=T.length;N<I;N++)i(($=t(T[N],B[N],A)).x,$.y,-F)}for(A=d,N=0;N<R;N++)$=u?t(e[N],k[N],A):e[N],_?(S.copy(x.normals[0]).multiplyScalar($.x),w.copy(x.binormals[0]).multiplyScalar($.y),M.copy(b[0]).add(S).add(w),i(M.x,M.y,M.z)):i($.x,$.y,0);for(I=1;I<=p;I++)for(N=0;N<R;N++)$=u?t(e[N],k[N],A):e[N],_?(S.copy(x.normals[I]).multiplyScalar($.x),w.copy(x.binormals[I]).multiplyScalar($.y),M.copy(b[I]).add(S).add(w),i(M.x,M.y,M.z)):i($.x,$.y,c/p*I);for(D=m-1;0<=D;D--){for(I=D/m,F=f*Math.cos(I*Math.PI/2),A=d*Math.sin(I*Math.PI/2),N=0,I=P.length;N<I;N++)i(($=t(P[N],a[N],A)).x,$.y,c+F);for(E=0,y=C.length;E<y;E++)for(T=C[E],B=v[E],N=0,I=T.length;N<I;N++)$=t(T[N],B[N],A),_?i($.x,$.y+b[p-1].y,b[p-1].x+F):i($.x,$.y,c+F)}!function(){var e=G.length/3;if(u){var t=0*R;for(N=0;N<L;N++)o((j=O[N])[2]+t,j[1]+t,j[0]+t);for(t=R*(p+2*m),N=0;N<L;N++)o((j=O[N])[0]+t,j[1]+t,j[2]+t)}else{for(N=0;N<L;N++)o((j=O[N])[2],j[1],j[0]);for(N=0;N<L;N++)o((j=O[N])[0]+R*p,j[1]+R*p,j[2]+R*p)}z.addGroup(e,G.length/3-e,0)}(),function(){var e=G.length/3,t=0;for(n(P,t),t+=P.length,E=0,y=C.length;E<y;E++)n(T=C[E],t),t+=T.length;z.addGroup(e,G.length/3-e,1)}()}A.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:U},e=Array.isArray(e)?e:[e];for(var z=this,G=[],V=[],r=0,n=e.length;r<n;r++)t(e[r]);this.addAttribute("position",new P(G,3)),this.addAttribute("uv",new P(V,2)),this.computeVertexNormals()}function br(e,t,r){if(r.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++)r.shapes.push(e[n].uuid);else r.shapes.push(e.uuid);return void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}function xr(e,t){S.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new wr(e,t)),this.mergeVertices()}function wr(e,t){var r=(t=t||{}).font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new S;e=r.generateShapes(e,t.size),t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),_r.call(this,e,t),this.type="TextBufferGeometry"}function Sr(e,t,r,n,i,o,s){S.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Mr(e,t,r,n,i,o,s)),this.mergeVertices()}function Mr(e,t,r,n,i,o,s){A.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:o,thetaLength:s},e=e||1,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var a,c,u=(o=void 0!==o?o:0)+(s=void 0!==s?s:Math.PI),h=0,l=[],p=new Se,f=new Se,d=[],m=[],v=[],g=[];for(c=0;c<=r;c++){var y=[],_=c/r;for(a=0;a<=t;a++){var b=a/t;p.x=-e*Math.cos(n+b*i)*Math.sin(o+_*s),p.y=e*Math.cos(o+_*s),p.z=e*Math.sin(n+b*i)*Math.sin(o+_*s),m.push(p.x,p.y,p.z),f.set(p.x,p.y,p.z).normalize(),v.push(f.x,f.y,f.z),g.push(b,1-_),y.push(h++)}l.push(y)}for(c=0;c<r;c++)for(a=0;a<t;a++)e=l[c][a+1],n=l[c][a],i=l[c+1][a],s=l[c+1][a+1],(0!==c||0<o)&&d.push(e,n,s),(c!==r-1||u<Math.PI)&&d.push(n,i,s);this.setIndex(d),this.addAttribute("position",new P(m,3)),this.addAttribute("normal",new P(v,3)),this.addAttribute("uv",new P(g,2))}function Cr(e,t,r,n,i,o){S.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new Er(e,t,r,n,i,o)),this.mergeVertices()}function Er(e,t,r,n,i,o){A.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:o},e=e||.5,t=t||1,i=void 0!==i?i:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var s,a,c=[],u=[],h=[],l=[],p=e,f=(t-e)/(n=void 0!==n?Math.max(1,n):1),d=new Se,m=new H;for(s=0;s<=n;s++){for(a=0;a<=r;a++)e=i+a/r*o,d.x=p*Math.cos(e),d.y=p*Math.sin(e),u.push(d.x,d.y,d.z),h.push(0,0,1),m.x=(d.x/t+1)/2,m.y=(d.y/t+1)/2,l.push(m.x,m.y);p+=f}for(s=0;s<n;s++)for(t=s*(r+1),a=0;a<r;a++)i=(e=a+t)+r+1,o=e+r+2,p=e+1,c.push(e,i,p),c.push(i,o,p);this.setIndex(c),this.addAttribute("position",new P(u,3)),this.addAttribute("normal",new P(h,3)),this.addAttribute("uv",new P(l,2))}function Tr(e,t,r,n){S.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},this.fromBufferGeometry(new Or(e,t,r,n)),this.mergeVertices()}function Or(e,t,r,n){A.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t)||12,r=r||0,n=n||2*Math.PI,n=po.clamp(n,0,2*Math.PI);var i,o=[],s=[],a=[],c=1/t,u=new Se,h=new H;for(i=0;i<=t;i++){var l=r+i*c*n,p=Math.sin(l),f=Math.cos(l);for(l=0;l<=e.length-1;l++)u.x=e[l].x*p,u.y=e[l].y,u.z=e[l].x*f,s.push(u.x,u.y,u.z),h.x=i/t,h.y=l/(e.length-1),a.push(h.x,h.y)}for(i=0;i<t;i++)for(l=0;l<e.length-1;l++)c=(r=l+i*e.length)+e.length,u=r+e.length+1,h=r+1,o.push(r,c,h),o.push(c,u,h);if(this.setIndex(o),this.addAttribute("position",new P(s,3)),this.addAttribute("uv",new P(a,2)),this.computeVertexNormals(),n===2*Math.PI)for(n=this.attributes.normal.array,o=new Se,s=new Se,a=new Se,r=t*e.length*3,l=i=0;i<e.length;i++,l+=3)o.x=n[l+0],o.y=n[l+1],o.z=n[l+2],s.x=n[r+l+0],s.y=n[r+l+1],s.z=n[r+l+2],a.addVectors(o,s).normalize(),n[l+0]=n[r+l+0]=a.x,n[l+1]=n[r+l+1]=a.y,n[l+2]=n[r+l+2]=a.z}function Pr(e,t){S.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Ar(e,t)),this.mergeVertices()}function Ar(e,a){function t(e){var t,r=u.length/3,n=(e=e.extractPoints(a)).shape,i=e.holes;if(!1===xa.isClockWise(n))for(n=n.reverse(),e=0,t=i.length;e<t;e++){var o=i[e];!0===xa.isClockWise(o)&&(i[e]=o.reverse())}var s=xa.triangulateShape(n,i);for(e=0,t=i.length;e<t;e++)o=i[e],n=n.concat(o);for(e=0,t=n.length;e<t;e++)o=n[e],u.push(o.x,o.y,0),h.push(0,0,1),l.push(o.x,o.y);for(e=0,t=s.length;e<t;e++)n=s[e],c.push(n[0]+r,n[1]+r,n[2]+r),p+=3}A.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:a},a=a||12;var c=[],u=[],h=[],l=[],r=0,p=0;if(!1===Array.isArray(e))t(e);else for(var n=0;n<e.length;n++)t(e[n]),this.addGroup(r,p,n),r+=p,p=0;this.setIndex(c),this.addAttribute("position",new P(u,3)),this.addAttribute("normal",new P(h,3)),this.addAttribute("uv",new P(l,2))}function jr(e,t){if(t.shapes=[],Array.isArray(e))for(var r=0,n=e.length;r<n;r++)t.shapes.push(e[r].uuid);else t.shapes.push(e.uuid);return t}function Rr(e,t){A.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t};var r=[];t=Math.cos(po.DEG2RAD*(void 0!==t?t:1));var n=[0,0],i={},o=["a","b","c"];if(e.isBufferGeometry){var s=new S;s.fromBufferGeometry(e)}else s=e.clone();s.mergeVertices(),s.computeFaceNormals(),e=s.vertices;for(var a=0,c=(s=s.faces).length;a<c;a++)for(var u=s[a],h=0;h<3;h++){var l=u[o[h]],p=u[o[(h+1)%3]];n[0]=Math.min(l,p),n[1]=Math.max(l,p),void 0===i[l=n[0]+","+n[1]]?i[l]={index1:n[0],index2:n[1],face1:a,face2:void 0}:i[l].face2=a}for(l in i)(void 0===(n=i[l]).face2||s[n.face1].normal.dot(s[n.face2].normal)<=t)&&(o=e[n.index1],r.push(o.x,o.y,o.z),o=e[n.index2],r.push(o.x,o.y,o.z));this.addAttribute("position",new P(r,3))}function Lr(e,t,r,n,i,o,s,a){S.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new Nr(e,t,r,n,i,o,s,a)),this.mergeVertices()}function Nr(p,f,d,m,v,e,g,y){function t(e){var t,r=new H,n=new Se,i=0,o=!0===e?p:f,s=!0===e?1:-1,a=M;for(t=1;t<=m;t++)x.push(0,E*s,0),w.push(0,s,0),S.push(.5,.5),M++;var c=M;for(t=0;t<=m;t++){var u=t/m*y+g,h=Math.cos(u);u=Math.sin(u),n.x=o*u,n.y=E*s,n.z=o*h,x.push(n.x,n.y,n.z),w.push(0,s,0),r.x=.5*h+.5,r.y=.5*u*s+.5,S.push(r.x,r.y),M++}for(t=0;t<m;t++)r=a+t,n=c+t,!0===e?b.push(n,n+1,r):b.push(n+1,n,r),i+=3;_.addGroup(T,i,!0===e?1:2),T+=i}A.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:p,radiusBottom:f,height:d,radialSegments:m,heightSegments:v,openEnded:e,thetaStart:g,thetaLength:y};var _=this;p=void 0!==p?p:1,f=void 0!==f?f:1,d=d||1,m=Math.floor(m)||8,v=Math.floor(v)||1,e=void 0!==e&&e,g=void 0!==g?g:0,y=void 0!==y?y:2*Math.PI;var b=[],x=[],w=[],S=[],M=0,C=[],E=d/2,T=0;!function(){var e,t,r=new Se,n=new Se,i=0,o=(f-p)/d;for(t=0;t<=v;t++){var s=[],a=t/v,c=a*(f-p)+p;for(e=0;e<=m;e++){var u=e/m,h=u*y+g,l=Math.sin(h);h=Math.cos(h),n.x=c*l,n.y=-a*d+E,n.z=c*h,x.push(n.x,n.y,n.z),r.set(l,o,h).normalize(),w.push(r.x,r.y,r.z),S.push(u,1-a),s.push(M++)}C.push(s)}for(e=0;e<m;e++)for(t=0;t<v;t++)r=C[t+1][e],n=C[t+1][e+1],o=C[t][e+1],b.push(C[t][e],r,o),b.push(r,n,o),i+=6;_.addGroup(T,i,0),T+=i}(),!1===e&&(0<p&&t(!0),0<f&&t(!1)),this.setIndex(b),this.addAttribute("position",new P(x,3)),this.addAttribute("normal",new P(w,3)),this.addAttribute("uv",new P(S,2))}function Ir(e,t,r,n,i,o,s){Lr.call(this,0,e,t,r,n,i,o,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:s}}function Dr(e,t,r,n,i,o,s){Nr.call(this,0,e,t,r,n,i,o,s),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:o,thetaLength:s}}function kr(e,t,r,n){S.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new Br(e,t,r,n)),this.mergeVertices()}function Br(e,t,r,n){A.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},e=e||1,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var i,o=[],s=[],a=[],c=[],u=new Se,h=new H;s.push(0,0,0),a.push(0,0,1),c.push(.5,.5);var l=0;for(i=3;l<=t;l++,i+=3){var p=r+l/t*n;u.x=e*Math.cos(p),u.y=e*Math.sin(p),s.push(u.x,u.y,u.z),a.push(0,0,1),h.x=(s[i]/e+1)/2,h.y=(s[i+1]/e+1)/2,c.push(h.x,h.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.addAttribute("position",new P(s,3)),this.addAttribute("normal",new P(a,3)),this.addAttribute("uv",new P(c,2))}function Fr(e){N.call(this),this.type="ShadowMaterial",this.color=new w(0),this.transparent=!0,this.setValues(e)}function $r(e){D.call(this,e),this.type="RawShaderMaterial"}function Ur(e){N.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new w(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new w(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(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(e)}function zr(e){Ur.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoatRoughness=this.clearCoat=0,this.setValues(e)}function Gr(e){N.call(this),this.type="MeshPhongMaterial",this.color=new w(16777215),this.specular=new w(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new w(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)}function Vr(e){Gr.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function Hr(e){N.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(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(e)}function qr(e){N.call(this),this.type="MeshLambertMaterial",this.color=new w(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new w(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)}function Wr(e){Et.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function Xr(e,t,r){var n=this,i=!1,o=0,s=0,a=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){s++,!1===i&&void 0!==n.onStart&&n.onStart(e,o,s),i=!0},this.itemEnd=function(e){o++,void 0!==n.onProgress&&n.onProgress(e,o,s),o===s&&(i=!1,void 0!==n.onLoad)&&n.onLoad()},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return a?a(e):e},this.setURLModifier=function(e){return a=e,this}}function Yr(e){this.manager=void 0!==e?e:Ea}function Kr(e){this.manager=void 0!==e?e:Ea,this._parser=null}function Zr(e){this.manager=void 0!==e?e:Ea,this._parser=null}function Jr(e){this.manager=void 0!==e?e:Ea}function Qr(e){this.manager=void 0!==e?e:Ea}function en(e){this.manager=void 0!==e?e:Ea}function tn(){this.type="Curve",this.arcLengthDivisions=200}function rn(e,t,r,n,i,o,s,a){tn.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=r||1,this.yRadius=n||1,this.aStartAngle=i||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=s||!1,this.aRotation=a||0}function nn(e,t,r,n,i,o){rn.call(this,e,t,r,r,n,i,o),this.type="ArcCurve"}function on(){var a=0,c=0,u=0,h=0;return{initCatmullRom:function(e,t,r,n,i){u=-3*(a=t)+3*r-2*(c=e=i*(r-e))-(n=i*(n-t)),h=2*t-2*r+e+n},initNonuniformCatmullRom:function(e,t,r,n,i,o,s){u=-3*(a=t)+3*r-2*(c=e=((t-e)/i-(r-e)/(i+o)+(r-t)/o)*o)-(n=((r-t)/o-(n-t)/(o+s)+(n-r)/s)*o),h=2*t-2*r+e+n},calc:function(e){var t=e*e;return a+c*e+u*t+h*t*e}}}function sn(e,t,r,n){tn.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=r||"centripetal",this.tension=n||.5}function an(e,t,r,n,i){var o=e*e;return(2*r-2*n+(t=.5*(n-t))+(i=.5*(i-r)))*e*o+(-3*r+3*n-2*t-i)*o+t*e+r}function cn(e,t,r,n){var i=1-e;return i*i*t+2*(1-e)*e*r+e*e*n}function un(e,t,r,n,i){var o=1-e,s=1-e;return o*o*o*t+3*s*s*e*r+3*(1-e)*e*e*n+e*e*e*i}function hn(e,t,r,n){tn.call(this),this.type="CubicBezierCurve",this.v0=e||new H,this.v1=t||new H,this.v2=r||new H,this.v3=n||new H}function ln(e,t,r,n){tn.call(this),this.type="CubicBezierCurve3",this.v0=e||new Se,this.v1=t||new Se,this.v2=r||new Se,this.v3=n||new Se}function pn(e,t){tn.call(this),this.type="LineCurve",this.v1=e||new H,this.v2=t||new H}function fn(e,t){tn.call(this),this.type="LineCurve3",this.v1=e||new Se,this.v2=t||new Se}function dn(e,t,r){tn.call(this),this.type="QuadraticBezierCurve",this.v0=e||new H,this.v1=t||new H,this.v2=r||new H}function mn(e,t,r){tn.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Se,this.v1=t||new Se,this.v2=r||new Se}function vn(e){tn.call(this),this.type="SplineCurve",this.points=e||[]}function gn(){tn.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function yn(e){gn.call(this),this.type="Path",this.currentPoint=new H,e&&this.setFromPoints(e)}function _n(e){yn.call(this,e),this.uuid=po.generateUUID(),this.type="Shape",this.holes=[]}function bn(e,t){h.call(this),this.type="Light",this.color=new w(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function xn(e,t,r){bn.call(this,e,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(h.DefaultUp),this.updateMatrix(),this.groundColor=new w(t)}function wn(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new H(512,512),this.map=null,this.matrix=new we}function Sn(){wn.call(this,new ht(50,1,.5,500))}function Mn(e,t,r,n,i,o){bn.call(this,e,t),this.type="SpotLight",this.position.copy(h.DefaultUp),this.updateMatrix(),this.target=new h,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Sn}function Cn(e,t,r,n){bn.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new wn(new ht(90,1,.5,500))}function En(){wn.call(this,new f(-5,5,5,-5,.5,500))}function Tn(e,t){bn.call(this,e,t),this.type="DirectionalLight",this.position.copy(h.DefaultUp),this.updateMatrix(),this.target=new h,this.shadow=new En}function On(e,t){bn.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Pn(e,t,r,n){bn.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==r?r:10,this.height=void 0!==n?n:10}function An(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r}function jn(e,t,r,n){An.call(this,e,t,r,n),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function Rn(e,t,r,n){An.call(this,e,t,r,n)}function Ln(e,t,r,n){An.call(this,e,t,r,n)}function Nn(e,t,r,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=La.convertArray(t,this.TimeBufferType),this.values=La.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function In(e,t,r){Nn.call(this,e,t,r)}function Dn(e,t,r,n){Nn.call(this,e,t,r,n)}function kn(e,t,r,n){Nn.call(this,e,t,r,n)}function Bn(e,t,r,n){An.call(this,e,t,r,n)}function Fn(e,t,r,n){Nn.call(this,e,t,r,n)}function $n(e,t,r,n){Nn.call(this,e,t,r,n)}function Un(e,t,r,n){Nn.call(this,e,t,r,n)}function zn(e,t,r){this.name=e,this.tracks=r,this.duration=void 0!==t?t:-1,this.uuid=po.generateUUID(),this.duration<0&&this.resetDuration()}function Gn(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return kn;case"vector":case"vector2":case"vector3":case"vector4":return Un;case"color":return Dn;case"quaternion":return Fn;case"bool":case"boolean":return In;case"string":return $n}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var r=[],n=[];La.flattenJSON(e.keys,r,n,"value"),e.times=r,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function Vn(e){this.manager=void 0!==e?e:Ea,this.textures={}}function Hn(e){this.manager=void 0!==e?e:Ea}function qn(){}function Wn(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Ea,this.withCredentials=!1}function Xn(e){this.manager=void 0!==e?e:Ea,this.texturePath=""}function Yn(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:Ea,this.options=void 0}function Kn(){this.type="ShapePath",this.color=new w,this.subPaths=[],this.currentPath=null}function Zn(e){this.type="Font",this.data=e}function Jn(e){this.manager=void 0!==e?e:Ea}function Qn(e){this.manager=void 0!==e?e:Ea}function ei(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ht,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ht,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function ti(e,t,r){h.call(this),this.type="CubeCamera";var i=new ht(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new Se(1,0,0)),this.add(i);var o=new ht(90,1,e,t);o.up.set(0,-1,0),o.lookAt(new Se(-1,0,0)),this.add(o);var s=new ht(90,1,e,t);s.up.set(0,0,1),s.lookAt(new Se(0,1,0)),this.add(s);var a=new ht(90,1,e,t);a.up.set(0,0,-1),a.lookAt(new Se(0,-1,0)),this.add(a);var c=new ht(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new Se(0,0,1)),this.add(c);var u=new ht(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new Se(0,0,-1)),this.add(u),this.renderTarget=new n(r,r,{format:1022,magFilter:1006,minFilter:1006}),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,n=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,i,r),r.activeCubeFace=1,e.render(t,o,r),r.activeCubeFace=2,e.render(t,s,r),r.activeCubeFace=3,e.render(t,a,r),r.activeCubeFace=4,e.render(t,c,r),r.texture.generateMipmaps=n,r.activeCubeFace=5,e.render(t,u,r),e.setRenderTarget(null)},this.clear=function(e,t,r,n){for(var i=this.renderTarget,o=0;o<6;o++)i.activeCubeFace=o,e.setRenderTarget(i),e.clear(t,r,n);e.setRenderTarget(null)}}function ri(){h.call(this),this.type="AudioListener",this.context=Dc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function ni(e){h.call(this),this.type="Audio",this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.offset=this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function ii(e){ni.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function oi(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function si(e,t,r){switch(this.binding=e,this.valueSize=r,e=Float64Array,t){case"quaternion":t=this._slerp;break;case"string":case"bool":e=Array,t=this._select;break;default:t=this._lerp}this.buffer=new e(4*r),this._mixBufferRegion=t,this.referenceCount=this.useCount=this.cumulativeWeight=0}function ai(e,t,r){r=r||ci.parseTrackName(t),this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function ci(e,t,r){this.path=t,this.parsedPath=r||ci.parseTrackName(t),this.node=ci.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function ui(){this.uuid=po.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function hi(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null,t=(e=t.tracks).length,r=Array(t);for(var n={endingStart:2400,endingEnd:2400},i=0;i!==t;++i){var o=e[i].createInterpolant(null);(r[i]=o).settings=n}this._interpolantSettings=n,this._interpolants=r,this._propertyBindings=Array(t),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function li(e){this._root=e,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function pi(e,t){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=t),this.value=e}function fi(){A.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function di(e,t,r){yt.call(this,e,t),this.meshPerAttribute=r||1}function mi(e,t,r){y.call(this,e,t),this.meshPerAttribute=r||1}function vi(e,t,r,n){this.ray=new B(e,t),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 gi(e,t){return e.distance-t.distance}function yi(e,t,r,n){if(!1!==e.visible&&(e.raycast(t,r),!0===n)){n=0;for(var i=(e=e.children).length;n<i;n++)yi(e[n],t,r,!0)}}function _i(e){this.autoStart=void 0===e||e,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1}function bi(e,t,r){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==r?r:0,this}function xi(e,t,r){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==r?r:0,this}function wi(e,t){this.min=void 0!==e?e:new H(1/0,1/0),this.max=void 0!==t?t:new H(-1/0,-1/0)}function Si(e,t){this.start=void 0!==e?e:new Se,this.end=void 0!==t?t:new Se}function Mi(e){h.call(this),this.material=e,this.render=function(){}}function Ci(e,t,r,n){this.object=e,this.size=void 0!==t?t:1,e=void 0!==r?r:16711680,n=void 0!==n?n:1,t=0,(r=this.object.geometry)&&r.isGeometry?t=3*r.faces.length:r&&r.isBufferGeometry&&(t=r.attributes.normal.count),r=new A,t=new P(6*t,3),r.addAttribute("position",t),Ot.call(this,r,new Et({color:e,linewidth:n})),this.matrixAutoUpdate=!1,this.update()}function Ei(e,t){h.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,e=new A,t=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(var r=0,n=1;r<32;r++,n++){var i=r/32*Math.PI*2,o=n/32*Math.PI*2;t.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}e.addAttribute("position",new P(t,3)),t=new Et({fog:!1}),this.cone=new Ot(e,t),this.add(this.cone),this.update()}function Ti(e){for(var t=function e(t){var r=[];t&&t.isBone&&r.push(t);for(var n=0;n<t.children.length;n++)r.push.apply(r,e(t.children[n]));return r}(e),r=new A,n=[],i=[],o=new w(0,0,1),s=new w(0,1,0),a=0;a<t.length;a++){var c=t[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 P(n,3)),r.addAttribute("color",new P(i,3)),n=new Et({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0}),Ot.call(this,r,n),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Oi(e,t,r){this.light=e,this.light.updateMatrixWorld(),this.color=r,e=new Mr(t,4,2),t=new I({wireframe:!0,fog:!1}),$.call(this,e,t),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Pi(e,t){h.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,e=new Et({fog:!1}),(t=new A).addAttribute("position",new y(new Float32Array(15),3)),this.line=new Tt(t,e),this.add(this.line),this.update()}function Ai(e,t,r){h.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,(e=new Vt(t)).rotateY(.5*Math.PI),this.material=new I({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=2),t=e.getAttribute("position"),t=new Float32Array(3*t.count),e.addAttribute("color",new y(t,3)),this.add(new $(e,this.material)),this.update()}function ji(e,t,r,n){e=e||10,t=t||10,r=new w(void 0!==r?r:4473924),n=new w(void 0!==n?n:8947848);var i=t/2,o=e/t,s=e/2;e=[];for(var a=[],c=0,u=0,h=-s;c<=t;c++,h+=o){e.push(-s,0,h,s,0,h),e.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}(t=new A).addAttribute("position",new P(e,3)),t.addAttribute("color",new P(a,3)),r=new Et({vertexColors:2}),Ot.call(this,t,r)}function Ri(e,t,r,n,i,o){e=e||10,t=t||16,r=r||8,n=n||64,i=new w(void 0!==i?i:4473924),o=new w(void 0!==o?o:8947848);var s,a=[],c=[];for(s=0;s<=t;s++){var u=s/t*2*Math.PI,h=Math.sin(u)*e;u=Math.cos(u)*e,a.push(0,0,0),a.push(h,0,u);var l=1&s?i:o;c.push(l.r,l.g,l.b),c.push(l.r,l.g,l.b)}for(s=0;s<=r;s++){l=1&s?i:o;var p=e-e/r*s;for(t=0;t<n;t++)u=t/n*2*Math.PI,h=Math.sin(u)*p,u=Math.cos(u)*p,a.push(h,0,u),c.push(l.r,l.g,l.b),u=(t+1)/n*2*Math.PI,h=Math.sin(u)*p,u=Math.cos(u)*p,a.push(h,0,u),c.push(l.r,l.g,l.b)}(e=new A).addAttribute("position",new P(a,3)),e.addAttribute("color",new P(c,3)),a=new Et({vertexColors:2}),Ot.call(this,e,a)}function Li(e,t,r,n){this.object=e,this.size=void 0!==t?t:1,e=void 0!==r?r:16776960,n=void 0!==n?n:1,t=0,(r=this.object.geometry)&&r.isGeometry?t=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new A,t=new P(6*t,3),r.addAttribute("position",t),Ot.call(this,r,new Et({color:e,linewidth:n})),this.matrixAutoUpdate=!1,this.update()}function Ni(e,t,r){h.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,void 0===t&&(t=1),(e=new A).addAttribute("position",new P([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3)),t=new Et({fog:!1}),this.lightPlane=new Tt(e,t),this.add(this.lightPlane),(e=new A).addAttribute("position",new P([0,0,0,0,0,1],3)),this.targetLine=new Tt(e,t),this.add(this.targetLine),this.update()}function Ii(e){function t(e,t,r){n(e,r),n(t,r)}function n(e,t){o.push(0,0,0),s.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(o.length/3-1)}var r=new A,i=new Et({color:16777215,vertexColors:1}),o=[],s=[],a={},c=new w(16755200),u=new w(16711680),h=new w(43775),l=new w(16777215),p=new w(3355443);t("n1","n2",c),t("n2","n4",c),t("n4","n3",c),t("n3","n1",c),t("f1","f2",c),t("f2","f4",c),t("f4","f3",c),t("f3","f1",c),t("n1","f1",c),t("n2","f2",c),t("n3","f3",c),t("n4","f4",c),t("p","n1",u),t("p","n2",u),t("p","n3",u),t("p","n4",u),t("u1","u2",h),t("u2","u3",h),t("u3","u1",h),t("c","t",l),t("p","c",p),t("cn1","cn2",p),t("cn3","cn4",p),t("cf1","cf2",p),t("cf3","cf4",p),r.addAttribute("position",new P(o,3)),r.addAttribute("color",new P(s,3)),Ot.call(this,r,i),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Di(e,t){this.object=e,void 0===t&&(t=16776960),e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);var r=new Float32Array(24),n=new A;n.setIndex(new y(e,1)),n.addAttribute("position",new y(r,3)),Ot.call(this,n,new Et({color:t})),this.matrixAutoUpdate=!1,this.update()}function ki(e,t){this.type="Box3Helper",this.box=e,e=void 0!==t?t:16776960,t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);var r=new A;r.setIndex(new y(t,1)),r.addAttribute("position",new P([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),Ot.call(this,r,new Et({color:e})),this.geometry.computeBoundingSphere()}function Bi(e,t,r){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t,e=void 0!==r?r:16776960,(t=new A).addAttribute("position",new P([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),t.computeBoundingSphere(),Tt.call(this,t,new Et({color:e})),(t=new A).addAttribute("position",new P([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),t.computeBoundingSphere(),this.add(new $(t,new I({color:e,opacity:.2,transparent:!0,depthWrite:!1})))}function Fi(e,t,r,n,i,o){h.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===jc&&((jc=new A).addAttribute("position",new P([0,0,0,0,1,0],3)),(Rc=new Nr(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Tt(jc,new Et({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new $(Rc,new I({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,i,o)}function $i(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e];(e=new A).addAttribute("position",new P(t,3)),e.addAttribute("color",new P([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),t=new Et({vertexColors:2}),Ot.call(this,e,t)}function Ui(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),sn.call(this,e),this.type="catmullrom",this.closed=!0}function zi(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),sn.call(this,e),this.type="catmullrom"}function Gi(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),sn.call(this,e),this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:0<e?1:+e}),!1=="name"in Function.prototype&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}),Object.assign(t.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)},removeEventListener:function(e,t){void 0!==this._listeners&&(void 0!==(e=this._listeners[e])&&(-1!==(t=e.indexOf(t))&&e.splice(t,1)))},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var r=0,n=(t=t.slice(0)).length;r<n;r++)t[r].call(this,e)}}}});var Vi,Hi,qi,Wi,Xi,Yi,Ki,Zi,Ji,Qi,eo,to,ro,no,io,oo,so,ao,co,uo,ho,lo,po={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var i=[],e=0;e<256;e++)i[e]=(e<16?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(i[255&e]+i[e>>8&255]+i[e>>16&255]+i[e>>24&255]+"-"+i[255&t]+i[t>>8&255]+"-"+i[t>>16&15|64]+i[t>>24&255]+"-"+i[63&r|128]+i[r>>8&255]+"-"+i[r>>16&255]+i[r>>24&255]+i[255&n]+i[n>>8&255]+i[n>>16&255]+i[n>>24&255]).toUpperCase()}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},lerp:function(e,t,r){return(1-r)*e+r*t},smoothstep:function(e,t,r){return e<=t?0:r<=e?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:r<=e?1:(e=(e-t)/(r-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*po.DEG2RAD},radToDeg:function(e){return e*po.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};Object.defineProperties(H.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(H.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,r=this.y;return e=e.elements,this.x=e[0]*t+e[3]*r+e[6],this.y=e[1]*t+e[4]*r+e[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(Vi=new H,Hi=new H,function(e,t){return Vi.set(e,e),Hi.set(t,t),this.clamp(Vi,Hi)}),clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;return t*t+(e=this.y-e.y)*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var r=Math.cos(t);t=Math.sin(t);var n=this.x-e.x,i=this.y-e.y;return this.x=n*r-i*t+e.x,this.y=n*t+i*r+e.y,this}}),Object.assign(we.prototype,{isMatrix4:!0,set:function(e,t,r,n,i,o,s,a,c,u,h,l,p,f,d,m){var v=this.elements;return v[0]=e,v[4]=t,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 we).fromArray(this.elements)},copy:function(e){var t=this.elements;return e=e.elements,t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],this},copyPosition:function(e){var t=this.elements;return e=e.elements,t[12]=e[12],t[13]=e[13],t[14]=e[14],this},extractBasis:function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:(eo=new Se,function(e){var t=this.elements,r=e.elements,n=1/eo.setFromMatrixColumn(e,0).length(),i=1/eo.setFromMatrixColumn(e,1).length();return e=1/eo.setFromMatrixColumn(e,2).length(),t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=0,t[8]=r[8]*e,t[9]=r[9]*e,t[10]=r[10]*e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,n=e.y,i=e.z,o=Math.cos(r);r=Math.sin(r);var s=Math.cos(n);n=Math.sin(n);var a=Math.cos(i);if(i=Math.sin(i),"XYZ"===e.order){e=o*a;var c=o*i,u=r*a,h=r*i;t[0]=s*a,t[4]=-s*i,t[8]=n,t[1]=c+u*n,t[5]=e-h*n,t[9]=-r*s,t[2]=h-e*n,t[6]=u+c*n,t[10]=o*s}else"YXZ"===e.order?(e=s*a,c=s*i,u=n*a,h=n*i,t[0]=e+h*r,t[4]=u*r-c,t[8]=o*n,t[1]=o*i,t[5]=o*a,t[9]=-r,t[2]=c*r-u,t[6]=h+e*r,t[10]=o*s):"ZXY"===e.order?(e=s*a,c=s*i,u=n*a,h=n*i,t[0]=e-h*r,t[4]=-o*i,t[8]=u+c*r,t[1]=c+u*r,t[5]=o*a,t[9]=h-e*r,t[2]=-o*n,t[6]=r,t[10]=o*s):"ZYX"===e.order?(e=o*a,c=o*i,u=r*a,h=r*i,t[0]=s*a,t[4]=u*n-c,t[8]=e*n+h,t[1]=s*i,t[5]=h*n+e,t[9]=c*n-u,t[2]=-n,t[6]=r*s,t[10]=o*s):"YZX"===e.order?(e=o*s,c=o*n,u=r*s,h=r*n,t[0]=s*a,t[4]=h-e*i,t[8]=u*i+c,t[1]=i,t[5]=o*a,t[9]=-r*a,t[2]=-n*a,t[6]=c*i+u,t[10]=e-h*i):"XZY"===e.order&&(e=o*s,c=o*n,u=r*s,h=r*n,t[0]=s*a,t[4]=-i,t[8]=n*a,t[1]=e*i+h,t[5]=o*a,t[9]=c*i-u,t[2]=u*i-c,t[6]=r*a,t[10]=h*i+e);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:(Ji=new Se(0,0,0),Qi=new Se(1,1,1),function(e){return this.compose(Ji,e,Qi)}),lookAt:(Yi=new Se,Ki=new Se,Zi=new Se,function(e,t,r){var n=this.elements;return Zi.subVectors(e,t),0===Zi.lengthSq()&&(Zi.z=1),Zi.normalize(),Yi.crossVectors(r,Zi),0===Yi.lengthSq()&&(1===Math.abs(r.z)?Zi.x+=1e-4:Zi.z+=1e-4,Zi.normalize(),Yi.crossVectors(r,Zi)),Yi.normalize(),Ki.crossVectors(Zi,Yi),n[0]=Yi.x,n[4]=Ki.x,n[8]=Zi.x,n[1]=Yi.y,n[5]=Ki.y,n[9]=Zi.y,n[2]=Yi.z,n[6]=Ki.z,n[10]=Zi.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements;t=this.elements,e=r[0];var i=r[4],o=r[8],s=r[12],a=r[1],c=r[5],u=r[9],h=r[13],l=r[2],p=r[6],f=r[10],d=r[14],m=r[3],v=r[7],g=r[11];r=r[15];var y=n[0],_=n[4],b=n[8],x=n[12],w=n[1],S=n[5],M=n[9],C=n[13],E=n[2],T=n[6],O=n[10],P=n[14],A=n[3],j=n[7],R=n[11];return n=n[15],t[0]=e*y+i*w+o*E+s*A,t[4]=e*_+i*S+o*T+s*j,t[8]=e*b+i*M+o*O+s*R,t[12]=e*x+i*C+o*P+s*n,t[1]=a*y+c*w+u*E+h*A,t[5]=a*_+c*S+u*T+h*j,t[9]=a*b+c*M+u*O+h*R,t[13]=a*x+c*C+u*P+h*n,t[2]=l*y+p*w+f*E+d*A,t[6]=l*_+p*S+f*T+d*j,t[10]=l*b+p*M+f*O+d*R,t[14]=l*x+p*C+f*P+d*n,t[3]=m*y+v*w+g*E+r*A,t[7]=m*_+v*S+g*T+r*j,t[11]=m*b+v*M+g*O+r*R,t[15]=m*x+v*C+g*P+r*n,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:(Xi=new Se,function(e){for(var t=0,r=e.count;t<r;t++)Xi.x=e.getX(t),Xi.y=e.getY(t),Xi.z=e.getZ(t),Xi.applyMatrix4(this),e.setXYZ(t,Xi.x,Xi.y,Xi.z);return e}),determinant:function(){var e=this.elements,t=e[0],r=e[4],n=e[8],i=e[12],o=e[1],s=e[5],a=e[9],c=e[13],u=e[2],h=e[6],l=e[10],p=e[14];return e[3]*(+i*a*h-n*c*h-i*s*l+r*c*l+n*s*p-r*a*p)+e[7]*(+t*a*p-t*c*l+i*o*l-n*o*p+n*c*u-i*a*u)+e[11]*(+t*c*h-t*s*p-i*o*h+r*o*p+i*s*u-r*c*u)+e[15]*(-n*s*u-t*a*h+t*s*l+n*o*h-r*o*l+r*a*u)},transpose:function(){var e=this.elements,t=e[1];return 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(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,n=e.elements;e=n[0];var i=n[1],o=n[2],s=n[3],a=n[4],c=n[5],u=n[6],h=n[7],l=n[8],p=n[9],f=n[10],d=n[11],m=n[12],v=n[13],g=n[14],y=p*g*h-v*f*h+v*u*d-c*g*d-p*u*(n=n[15])+c*f*n,_=m*f*h-l*g*h-m*u*d+a*g*d+l*u*n-a*f*n,b=l*v*h-m*p*h+m*c*d-a*v*d-l*c*n+a*p*n,x=m*p*u-l*v*u-m*c*f+a*v*f+l*c*g-a*p*g,w=e*y+i*_+o*b+s*x;if(0!==w)return t=1/w,r[0]=y*t,r[1]=(v*f*s-p*g*s-v*o*d+i*g*d+p*o*n-i*f*n)*t,r[2]=(c*g*s-v*u*s+v*o*h-i*g*h-c*o*n+i*u*n)*t,r[3]=(p*u*s-c*f*s-p*o*h+i*f*h+c*o*d-i*u*d)*t,r[4]=_*t,r[5]=(l*g*s-m*f*s+m*o*d-e*g*d-l*o*n+e*f*n)*t,r[6]=(m*u*s-a*g*s-m*o*h+e*g*h+a*o*n-e*u*n)*t,r[7]=(a*f*s-l*u*s+l*o*h-e*f*h-a*o*d+e*u*d)*t,r[8]=b*t,r[9]=(m*p*s-l*v*s-m*i*d+e*v*d+l*i*n-e*p*n)*t,r[10]=(a*v*s-m*c*s+m*i*h-e*v*h-a*i*n+e*c*n)*t,r[11]=(l*c*s-a*p*s-l*i*h+e*p*h+a*i*d-e*c*d)*t,r[12]=x*t,r[13]=(l*v*o-m*p*o+m*i*f-e*v*f-l*i*g+e*p*g)*t,r[14]=(m*c*o-a*v*o-m*i*u+e*v*u+a*i*g-e*c*g)*t,r[15]=(a*p*o-l*c*o+l*i*u-e*p*u-a*i*f+e*c*f)*t,this;if(!0===t)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()},scale:function(e){var t=this.elements,r=e.x,n=e.y;return e=e.z,t[0]*=r,t[4]*=n,t[8]*=e,t[1]*=r,t[5]*=n,t[9]*=e,t[2]*=r,t[6]*=n,t[10]*=e,t[3]*=r,t[7]*=n,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t);t=Math.sin(t);var n=1-r,i=e.x,o=e.y;e=e.z;var s=n*i,a=n*o;return this.set(s*i+r,s*o-t*e,s*e+t*o,0,s*o+t*e,a*o+r,a*e-t*i,0,s*e-t*o,a*e+t*i,n*e*e+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(e,t,r){return this.set(1,t,r,0,e,1,r,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,r){var n=this.elements,i=t._x,o=t._y,s=t._z,a=t._w,c=i+i,u=o+o,h=s+s;t=i*c;var l=i*u;i*=h;var p=o*u;o*=h,s*=h,c*=a,u*=a,a*=h,h=r.x;var f=r.y;return r=r.z,n[0]=(1-(p+s))*h,n[1]=(l+a)*h,n[2]=(i-u)*h,n[3]=0,n[4]=(l-a)*f,n[5]=(1-(t+s))*f,n[6]=(o+c)*f,n[7]=0,n[8]=(i+u)*r,n[9]=(o-c)*r,n[10]=(1-(t+p))*r,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this},decompose:(qi=new Se,Wi=new we,function(e,t,r){var n=this.elements,i=qi.set(n[0],n[1],n[2]).length(),o=qi.set(n[4],n[5],n[6]).length(),s=qi.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),e.x=n[12],e.y=n[13],e.z=n[14],Wi.copy(this),e=1/i,n=1/o;var a=1/s;return Wi.elements[0]*=e,Wi.elements[1]*=e,Wi.elements[2]*=e,Wi.elements[4]*=n,Wi.elements[5]*=n,Wi.elements[6]*=n,Wi.elements[8]*=a,Wi.elements[9]*=a,Wi.elements[10]*=a,t.setFromRotationMatrix(Wi),r.x=i,r.y=o,r.z=s,this}),makePerspective:function(e,t,r,n,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var s=this.elements;return s[0]=2*i/(t-e),s[4]=0,s[8]=(t+e)/(t-e),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(e,t,r,n,i,o){var s=this.elements,a=1/(t-e),c=1/(r-n),u=1/(o-i);return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-(t+e)*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(e){var t=this.elements;e=e.elements;for(var r=0;r<16;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;r<16;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}),Object.assign(a,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,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(r!==(i=i[o+3])||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&&(a*=s=1/Math.sqrt(a*a+c*c+u*u+r*r),c*=s,u*=s,r*=s)}e[t]=a,e[t+1]=c,e[t+2]=u,e[t+3]=r}}),Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(a.prototype,{set:function(e,t,r,n){return this._x=e,this._y=t,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(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=e._x,n=e._y,i=e._z;e=e.order;var o=Math.cos,s=Math.sin,a=o(r/2),c=o(n/2);return o=o(i/2),r=s(r/2),n=s(n/2),i=s(i/2),"XYZ"===e?(this._x=r*c*o+a*n*i,this._y=a*n*o-r*c*i,this._z=a*c*i+r*n*o,this._w=a*c*o-r*n*i):"YXZ"===e?(this._x=r*c*o+a*n*i,this._y=a*n*o-r*c*i,this._z=a*c*i-r*n*o,this._w=a*c*o+r*n*i):"ZXY"===e?(this._x=r*c*o-a*n*i,this._y=a*n*o+r*c*i,this._z=a*c*i+r*n*o,this._w=a*c*o-r*n*i):"ZYX"===e?(this._x=r*c*o-a*n*i,this._y=a*n*o+r*c*i,this._z=a*c*i-r*n*o,this._w=a*c*o+r*n*i):"YZX"===e?(this._x=r*c*o+a*n*i,this._y=a*n*o+r*c*i,this._z=a*c*i-r*n*o,this._w=a*c*o-r*n*i):"XZY"===e&&(this._x=r*c*o-a*n*i,this._y=a*n*o-r*c*i,this._z=a*c*i+r*n*o,this._w=a*c*o+r*n*i),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){t/=2;var r=Math.sin(t);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(t),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,r=t[0];e=t[4];var n=t[8],i=t[1],o=t[5],s=t[9],a=t[2],c=t[6],u=r+o+(t=t[10]);return this._z=0<u?(r=.5/Math.sqrt(u+1),this._w=.25/r,this._x=(c-s)*r,this._y=(n-a)*r,(i-e)*r):o<r&&t<r?(r=2*Math.sqrt(1+r-o-t),this._w=(c-s)/r,this._x=.25*r,this._y=(e+i)/r,(n+a)/r):t<o?(r=2*Math.sqrt(1+o-r-t),this._w=(n-a)/r,this._x=(e+i)/r,this._y=.25*r,(s+c)/r):(r=2*Math.sqrt(1+t-r-o),this._w=(i-e)/r,this._x=(n+a)/r,this._y=(s+c)/r,.25*r),this.onChangeCallback(),this},setFromUnitVectors:(ro=new Se,function(e,t){return void 0===ro&&(ro=new Se),(to=e.dot(t)+1)<1e-6?(to=0,Math.abs(e.x)>Math.abs(e.z)?ro.set(-e.y,e.x,0):ro.set(0,-e.z,e.y)):ro.crossVectors(e,t),this._x=ro.x,this._y=ro.y,this._z=ro.z,this._w=to,this.normalize()}),angleTo:function(e){return 2*Math.acos(Math.abs(po.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var r=this.angleTo(e);return 0===r||this.slerp(e,Math.min(1,t/r)),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z;e=e._w;var o=t._x,s=t._y,a=t._z;return t=t._w,this._x=r*t+e*o+n*a-i*s,this._y=n*t+e*s+i*o-r*a,this._z=i*t+e*a+r*s-n*o,this._w=e*t-r*o-n*s-i*a,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,i=this._z,o=this._w,s=o*e._w+r*e._x+n*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s)return this._w=o,this._x=r,this._y=n,this._z=i,this;if((e=1-s*s)<=Number.EPSILON)return s=1-t,this._w=s*o+t*this._w,this._x=s*r+t*this._x,this._y=s*n+t*this._y,this._z=s*i+t*this._z,this.normalize();e=Math.sqrt(e);var a=Math.atan2(e,s);return s=Math.sin((1-t)*a)/e,t=Math.sin(t*a)/e,this._w=o*s+this._w*t,this._x=r*s+this._x*t,this._y=n*s+this._y*t,this._z=i*s+this._z*t,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Se.prototype,{isVector3:!0,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(ho=new a,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(ho.setFromEuler(e))}),applyAxisAngle:(uo=new a,function(e,t){return this.applyQuaternion(uo.setFromAxisAngle(e,t))}),applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z;return e=e.elements,this.x=e[0]*t+e[3]*r+e[6]*n,this.y=e[1]*t+e[4]*r+e[7]*n,this.z=e[2]*t+e[5]*r+e[8]*n,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=1/((e=e.elements)[3]*t+e[7]*r+e[11]*n+e[15]);return this.x=(e[0]*t+e[4]*r+e[8]*n+e[12])*i,this.y=(e[1]*t+e[5]*r+e[9]*n+e[13])*i,this.z=(e[2]*t+e[6]*r+e[10]*n+e[14])*i,this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,o=e.y,s=e.z,a=(e=e.w)*t+o*n-s*r,c=e*r+s*t-i*n,u=e*n+i*r-o*t;return t=-i*t-o*r-s*n,this.x=a*e+t*-i+c*-s-u*-o,this.y=c*e+t*-o+u*-i-a*-s,this.z=u*e+t*-s+a*-o-c*-i,this},project:(co=new we,function(e){return co.multiplyMatrices(e.projectionMatrix,co.getInverse(e.matrixWorld)),this.applyMatrix4(co)}),unproject:(ao=new we,function(e){return ao.multiplyMatrices(e.matrixWorld,ao.getInverse(e.projectionMatrix)),this.applyMatrix4(ao)}),transformDirection:function(e){var t=this.x,r=this.y,n=this.z;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*n,this.y=e[1]*t+e[5]*r+e[9]*n,this.z=e[2]*t+e[6]*r+e[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:(oo=new Se,so=new Se,function(e,t){return oo.set(e,e,e),so.set(t,t,t),this.clamp(oo,so)}),clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var r=e.x,n=e.y;e=e.z;var i=t.x,o=t.y;return t=t.z,this.x=n*t-e*o,this.y=e*i-r*t,this.z=r*o-n*i,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(io=new Se,function(e){return io.copy(this).projectOnVector(e),this.sub(io)}),reflect:(no=new Se,function(e){return this.sub(no.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(e){return e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq()),Math.acos(po.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r+(e=this.z-e.z)*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return e=e.elements,this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length();return e=this.setFromMatrixColumn(e,2).length(),this.x=t,this.y=r,this.z=e,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(v.prototype,{isMatrix3:!0,set:function(e,t,r,n,i,o,s,a,c){var u=this.elements;return u[0]=e,u[1]=n,u[2]=s,u[3]=t,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(e){var t=this.elements;return e=e.elements,t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],this},setFromMatrix4:function(e){return e=e.elements,this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:(lo=new Se,function(e){for(var t=0,r=e.count;t<r;t++)lo.x=e.getX(t),lo.y=e.getY(t),lo.z=e.getZ(t),lo.applyMatrix3(this),e.setXYZ(t,lo.x,lo.y,lo.z);return e}),multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements;t=this.elements,e=r[0];var i=r[3],o=r[6],s=r[1],a=r[4],c=r[7],u=r[2],h=r[5];r=r[8];var l=n[0],p=n[3],f=n[6],d=n[1],m=n[4],v=n[7],g=n[2],y=n[5];return n=n[8],t[0]=e*l+i*d+o*g,t[3]=e*p+i*m+o*y,t[6]=e*f+i*v+o*n,t[1]=s*l+a*d+c*g,t[4]=s*p+a*m+c*y,t[7]=s*f+a*v+c*n,t[2]=u*l+h*d+r*g,t[5]=u*p+h*m+r*y,t[8]=u*f+h*v+r*n,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7];return t*o*(e=e[8])-t*s*c-r*i*e+r*s*a+n*i*c-n*o*a},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var r=e.elements;e=this.elements;var n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],c=r[5],u=r[6],h=r[7],l=(r=r[8])*a-c*h,p=c*u-r*s,f=h*s-a*u,d=n*l+i*p+o*f;if(0!==d)return t=1/d,e[0]=l*t,e[1]=(o*h-r*i)*t,e[2]=(c*i-o*a)*t,e[3]=p*t,e[4]=(r*n-o*u)*t,e[5]=(o*s-c*n)*t,e[6]=f*t,e[7]=(i*u-h*n)*t,e[8]=(a*n-i*s)*t,this;if(!0===t)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()},transpose:function(){var e=this.elements,t=e[1];return 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(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,r,n,i,o,s){var a=Math.cos(i);i=Math.sin(i),this.set(r*a,r*i,-r*(a*o+i*s)+o+e,-n*i,n*a,-n*(-i*o+a*s)+s+t,0,0,1)},scale:function(e,t){var r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this},rotate:function(e){var t=Math.cos(e);e=Math.sin(e);var r=this.elements,n=r[0],i=r[3],o=r[6],s=r[1],a=r[4],c=r[7];return r[0]=t*n+e*s,r[3]=t*i+e*a,r[6]=t*o+e*c,r[1]=-e*n+t*s,r[4]=-e*i+t*a,r[7]=-e*o+t*c,this},translate:function(e,t){var r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this},equals:function(e){var t=this.elements;e=e.elements;for(var r=0;r<9;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;r<9;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}});var fo,mo,vo,go,yo,_o,bo,xo,wo,So,Mo,Co,Eo,To,Oo,Po={getDataURL:function(e){if(e instanceof HTMLCanvasElement)var t=e;else{"undefined"!=typeof OffscreenCanvas?t=new OffscreenCanvas(e.width,e.height):((t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=e.width,t.height=e.height);var r=t.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height)}return 2048<t.width||2048<t.height?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Ao=0;p.DEFAULT_IMAGE=void 0,p.DEFAULT_MAPPING=300,p.prototype=Object.assign(Object.create(t.prototype),{constructor:p,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=po.generateUUID()),!t&&void 0===e.images[n.uuid]){if(Array.isArray(n))for(var i=[],o=0,s=n.length;o<s;o++)i.push(Po.getDataURL(n[o]));else i=Po.getDataURL(n);e.images[n.uuid]={uuid:n.uuid,url:i}}r.image=n.uuid}return t||(e.textures[this.uuid]=r),r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.applyMatrix3(this.matrix),e.x<0||1<e.x)switch(this.wrapS){case 1e3:e.x-=Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(e.y<0||1<e.y)switch(this.wrapT){case 1e3:e.y-=Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}}),Object.defineProperty(p.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Me.prototype,{isVector4:!0,set:function(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this},setScalar:function(e){return this.w=this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=this.w;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*n+e[12]*i,this.y=e[1]*t+e[5]*r+e[9]*n+e[13]*i,this.z=e[2]*t+e[6]*r+e[10]*n+e[14]*i,this.w=e[3]*t+e[7]*r+e[11]*n+e[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return this.z=t<1e-4?(this.x=1,this.y=0):(this.x=e.x/t,this.y=e.y/t,e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t=(e=e.elements)[0],r=e[4],n=e[8],i=e[1],o=e[5],s=e[9],a=e[2],c=e[6],u=e[10];return Math.abs(r-i)<.01&&Math.abs(n-a)<.01&&Math.abs(s-c)<.01?Math.abs(r+i)<.1&&Math.abs(n+a)<.1&&Math.abs(s+c)<.1&&Math.abs(t+o+u-3)<.1?this.set(1,0,0,0):(e=Math.PI,u=(u+1)/2,r=(r+i)/4,n=(n+a)/4,s=(s+c)/4,(o=(o+1)/2)<(t=(t+1)/2)&&u<t?r=t<.01?(c=0,a=.707106781):(a=r/(c=Math.sqrt(t)),n/c):u<o?r=o<.01?(a=0,c=.707106781):(c=r/(a=Math.sqrt(o)),s/a):u<.01?(a=c=.707106781,r=0):(c=n/(r=Math.sqrt(u)),a=s/r),this.set(c,a,r,e)):(e=Math.sqrt((c-s)*(c-s)+(n-a)*(n-a)+(i-r)*(i-r)),Math.abs(e)<.001&&(e=1),this.x=(c-s)/e,this.y=(n-a)/e,this.z=(i-r)/e,this.w=Math.acos((t+o+u-1)/2)),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===fo&&(fo=new Me,mo=new Me),fo.set(e,e,e,e),mo.set(t,t,t,t),this.clamp(fo,mo)},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),T.prototype=Object.assign(Object.create(t.prototype),{constructor:T,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((n.prototype=Object.create(T.prototype)).constructor=n).prototype.isWebGLRenderTargetCube=!0,((Ce.prototype=Object.create(p.prototype)).constructor=Ce).prototype.isDataTexture=!0,Object.assign(r.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-1/0,a=0,c=e.length;a<c;a+=3){var u=e[a],h=e[a+1],l=e[a+2];u<t&&(t=u),h<r&&(r=h),l<n&&(n=l),i<u&&(i=u),o<h&&(o=h),s<l&&(s=l)}return this.min.set(t,r,n),this.max.set(i,o,s),this},setFromBufferAttribute:function(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-1/0,a=0,c=e.count;a<c;a++){var u=e.getX(a),h=e.getY(a),l=e.getZ(a);u<t&&(t=u),h<r&&(r=h),l<n&&(n=l),i<u&&(i=u),o<h&&(o=h),s<l&&(s=l)}return this.min.set(t,r,n),this.max.set(i,o,s),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(_o=new Se,function(e,t){return t=_o.copy(t).multiplyScalar(.5),this.min.copy(e).sub(t),this.max.copy(e).add(t),this}),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new Se),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new Se),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(){function t(e){var t=e.geometry;if(void 0!==t)if(t.isGeometry)for(t=t.vertices,n=0,i=t.length;n<i;n++)o.copy(t[n]),o.applyMatrix4(e.matrixWorld),r.expandByPoint(o);else if(t.isBufferGeometry&&void 0!==(t=t.attributes.position))for(n=0,i=t.count;n<i;n++)o.fromBufferAttribute(t,n).applyMatrix4(e.matrixWorld),r.expandByPoint(o)}var r,n,i,o=new Se;return function(e){return r=this,e.updateMatrixWorld(!0),e.traverse(t),this}}(),containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Se),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:(yo=new Se,function(e){return this.clampPoint(e.center,yo),yo.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){if(0<e.normal.x)var t=e.normal.x*this.min.x,r=e.normal.x*this.max.x;else t=e.normal.x*this.max.x,r=e.normal.x*this.min.x;return 0<e.normal.y?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=e.constant&&r>=e.constant},intersectsTriangle:function(){function t(e){var t,r=0;for(t=e.length-3;r<=t;r+=3){h.fromArray(e,r);var n=l.x*Math.abs(h.x)+l.y*Math.abs(h.y)+l.z*Math.abs(h.z),i=a.dot(h),o=c.dot(h),s=u.dot(h);if(Math.max(-Math.max(i,o,s),Math.min(i,o,s))>n)return!1}return!0}var a=new Se,c=new Se,u=new Se,r=new Se,n=new Se,i=new Se,h=new Se,o=new Se,l=new Se,s=new Se;return function(e){return!this.isEmpty()&&(this.getCenter(o),l.subVectors(this.max,o),a.subVectors(e.a,o),c.subVectors(e.b,o),u.subVectors(e.c,o),r.subVectors(c,a),n.subVectors(u,c),i.subVectors(a,u),!!t(e=[0,-r.z,r.y,0,-n.z,n.y,0,-i.z,i.y,r.z,0,-r.x,n.z,0,-n.x,i.z,0,-i.x,-r.y,r.x,0,-n.y,n.x,0,-i.y,i.x,0])&&(!!t(e=[1,0,0,0,1,0,0,0,1])&&(s.crossVectors(r,n),t(e=[s.x,s.y,s.z]))))}}(),clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Se),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(go=new Se,function(e){return go.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(vo=new Se,function(e){return void 0===e&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),e=new s),this.getCenter(e.center),e.radius=.5*this.getSize(vo).length(),e}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){if(this.isEmpty())return this;var t=(e=e.elements)[0]*this.min.x,r=e[1]*this.min.x,n=e[2]*this.min.x,i=e[0]*this.max.x,o=e[1]*this.max.x,s=e[2]*this.max.x,a=e[4]*this.min.y,c=e[5]*this.min.y,u=e[6]*this.min.y,h=e[4]*this.max.y,l=e[5]*this.max.y,p=e[6]*this.max.y,f=e[8]*this.min.z,d=e[9]*this.min.z,m=e[10]*this.min.z,v=e[8]*this.max.z,g=e[9]*this.max.z,y=e[10]*this.max.z;return this.min.x=Math.min(t,i)+Math.min(a,h)+Math.min(f,v)+e[12],this.min.y=Math.min(r,o)+Math.min(c,l)+Math.min(d,g)+e[13],this.min.z=Math.min(n,s)+Math.min(u,p)+Math.min(m,y)+e[14],this.max.x=Math.max(t,i)+Math.max(a,h)+Math.max(f,v)+e[12],this.max.y=Math.max(r,o)+Math.max(c,l)+Math.max(d,g)+e[13],this.max.z=Math.max(n,s)+Math.max(u,p)+Math.max(m,y)+e[14],this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(s.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(bo=new r,function(e,t){var r=this.center;void 0!==t?r.copy(t):bo.setFromPoints(e).getCenter(r);for(var n=t=0,i=e.length;n<i;n++)t=Math.max(t,r.distanceToSquared(e[n]));return this.radius=Math.sqrt(t),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new Se),t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new r),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(g.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,n){return this.normal.set(e,t,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(Mo=new Se,Co=new Se,function(e,t,r){return t=Mo.subVectors(r,t).cross(Co.subVectors(e,t)).normalize(),this.setFromNormalAndCoplanarPoint(t,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new Se),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:(So=new Se,function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new Se);var r=e.delta(So),n=this.normal.dot(r);if(0===n){if(0===this.distanceToPoint(e.start))return t.copy(e.start)}else if(!((n=-(e.start.dot(this.normal)+this.constant)/n)<0||1<n))return t.copy(r).multiplyScalar(n).add(e.start)}),intersectsLine:function(e){var t=this.distanceToPoint(e.start);return e=this.distanceToPoint(e.end),t<0&&0<e||e<0&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Se),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(xo=new Se,wo=new v,function(e,t){return t=t||wo.getNormalMatrix(e),e=this.coplanarPoint(xo).applyMatrix4(e),t=this.normal.applyMatrix3(t).normalize(),this.constant=-e.dot(t),this}),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(Ee.prototype,{set:function(e,t,r,n,i,o){var s=this.planes;return s[0].copy(e),s[1].copy(t),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(e){for(var t=this.planes,r=0;r<6;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements;e=r[0];var n=r[1],i=r[2],o=r[3],s=r[4],a=r[5],c=r[6],u=r[7],h=r[8],l=r[9],p=r[10],f=r[11],d=r[12],m=r[13],v=r[14];return r=r[15],t[0].setComponents(o-e,u-s,f-h,r-d).normalize(),t[1].setComponents(o+e,u+s,f+h,r+d).normalize(),t[2].setComponents(o+n,u+a,f+l,r+m).normalize(),t[3].setComponents(o-n,u-a,f-l,r-m).normalize(),t[4].setComponents(o-i,u-c,f-p,r-v).normalize(),t[5].setComponents(o+i,u+c,f+p,r+v).normalize(),this},intersectsObject:(Oo=new s,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Oo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Oo)}),intersectsSprite:(To=new s,function(e){return To.center.set(0,0,0),To.radius=.7071067811865476,To.applyMatrix4(e.matrixWorld),this.intersectsSphere(To)}),intersectsSphere:function(e){var t=this.planes,r=e.center;e=-e.radius;for(var n=0;n<6;n++)if(t[n].distanceToPoint(r)<e)return!1;return!0},intersectsBox:(Eo=new Se,function(e){for(var t=this.planes,r=0;r<6;r++){var n=t[r];if(Eo.x=0<n.normal.x?e.max.x:e.min.x,Eo.y=0<n.normal.y?e.max.y:e.min.y,Eo.z=0<n.normal.z?e.max.z:e.min.z,n.distanceToPoint(Eo)<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}});var jo,Ro={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 dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in 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\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\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 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\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( sampler2D envMap, 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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\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\tuniform int maxMipLevel;\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_physical_pars_fragment:"#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( envMap, 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( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 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",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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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_begin:"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\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\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 ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\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\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#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_fragment_begin:"\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\t#pragma unroll_loop\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 ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\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 defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, 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\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= 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\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\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_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t#endif\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\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\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 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\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, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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 ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 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:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\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 mat3 uvTransform;\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 = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || 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;\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\tgl_Position.z = gl_Position.w;\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( 1.0 - 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:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 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 <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_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\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 <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_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\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_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\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 <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\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 ) && ! defined( OBJECTSPACE_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_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_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 ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <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 <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\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 <fog_vertex>\n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}\n",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tvec4 mvPosition;\n\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n"},Lo={merge:function(e){for(var t={},r=0;r<e.length;r++){var n,i=this.clone(e[r]);for(n in i)t[n]=i[n]}return t},clone:function(e){var t,r={};for(t in e)for(var n in r[t]={},e[t]){var i=e[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?r[t][n]=i.clone():Array.isArray(i)?r[t][n]=i.slice():r[t][n]=i}return r}},No={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(w.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.b=this.g=this.r=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function n(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+6*(t-e)*(2/3-r):e}return function(e,t,r){return e=po.euclideanModulo(e,1),t=po.clamp(t,0,1),r=po.clamp(r,0,1),0===t?this.r=this.g=this.b=r:(r=2*r-(t=r<=.5?r*(1+t):r+t-r*t),this.r=n(r,t,e+1/3),this.g=n(r,t,e),this.b=n(r,t,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n=r[2];switch(r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n)){n=parseFloat(r[1])/360;var i=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(n,i,o)}}}else if(r=/^#([A-Fa-f0-9]+)$/.exec(t)){if(3===(n=(r=r[1]).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=No[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(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){return void 0===t&&(t=2),t=0<t?1/t:1,this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(){function t(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),copyLinearToSRGB:function(){function t(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,r=this.r,n=this.g,i=this.b,o=Math.max(r,n,i),s=Math.min(r,n,i),a=(s+o)/2;if(s===o)s=t=0;else{var c=o-s;switch(s=a<=.5?c/(o+s):c/(2-o-s),o){case r:t=(n-i)/c+(n<i?6:0);break;case n:t=(i-r)/c+2;break;case i:t=(r-n)/c+4}t/=6}return e.h=t,e.s=s,e.l=a,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(jo={},function(e,t,r){return this.getHSL(jo),jo.h+=e,jo.s+=t,jo.l+=r,this.setHSL(jo.h,jo.s,jo.l),this}),add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}});var Io,Do,ko={common:{diffuse:{value:new w(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new v},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new H(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 w(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:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new w(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new v}},sprite:{diffuse:{value:new w(15658734)},opacity:{value:1},center:{value:new H(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new v}}},Bo={basic:{uniforms:Lo.merge([ko.common,ko.specularmap,ko.envmap,ko.aomap,ko.lightmap,ko.fog]),vertexShader:Ro.meshbasic_vert,fragmentShader:Ro.meshbasic_frag},lambert:{uniforms:Lo.merge([ko.common,ko.specularmap,ko.envmap,ko.aomap,ko.lightmap,ko.emissivemap,ko.fog,ko.lights,{emissive:{value:new w(0)}}]),vertexShader:Ro.meshlambert_vert,fragmentShader:Ro.meshlambert_frag},phong:{uniforms:Lo.merge([ko.common,ko.specularmap,ko.envmap,ko.aomap,ko.lightmap,ko.emissivemap,ko.bumpmap,ko.normalmap,ko.displacementmap,ko.gradientmap,ko.fog,ko.lights,{emissive:{value:new w(0)},specular:{value:new w(1118481)},shininess:{value:30}}]),vertexShader:Ro.meshphong_vert,fragmentShader:Ro.meshphong_frag},standard:{uniforms:Lo.merge([ko.common,ko.envmap,ko.aomap,ko.lightmap,ko.emissivemap,ko.bumpmap,ko.normalmap,ko.displacementmap,ko.roughnessmap,ko.metalnessmap,ko.fog,ko.lights,{emissive:{value:new w(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Ro.meshphysical_vert,fragmentShader:Ro.meshphysical_frag},points:{uniforms:Lo.merge([ko.points,ko.fog]),vertexShader:Ro.points_vert,fragmentShader:Ro.points_frag},dashed:{uniforms:Lo.merge([ko.common,ko.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ro.linedashed_vert,fragmentShader:Ro.linedashed_frag},depth:{uniforms:Lo.merge([ko.common,ko.displacementmap]),vertexShader:Ro.depth_vert,fragmentShader:Ro.depth_frag},normal:{uniforms:Lo.merge([ko.common,ko.bumpmap,ko.normalmap,ko.displacementmap,{opacity:{value:1}}]),vertexShader:Ro.normal_vert,fragmentShader:Ro.normal_frag},sprite:{uniforms:Lo.merge([ko.sprite,ko.fog]),vertexShader:Ro.sprite_vert,fragmentShader:Ro.sprite_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ro.cube_vert,fragmentShader:Ro.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ro.equirect_vert,fragmentShader:Ro.equirect_frag},distanceRGBA:{uniforms:Lo.merge([ko.common,ko.displacementmap,{referencePosition:{value:new Se},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ro.distanceRGBA_vert,fragmentShader:Ro.distanceRGBA_frag},shadow:{uniforms:Lo.merge([ko.lights,ko.fog,{color:{value:new w(0)},opacity:{value:1}}]),vertexShader:Ro.shadow_vert,fragmentShader:Ro.shadow_frag}};Bo.physical={uniforms:Lo.merge([Bo.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Ro.meshphysical_vert,fragmentShader:Ro.meshphysical_frag},i.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),i.DefaultOrder="XYZ",Object.defineProperties(i.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(i.prototype,{isEuler:!0,set:function(e,t,r,n){return this._x=e,this._y=t,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(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var n=po.clamp,i=e.elements;e=i[0];var o=i[4],s=i[8],a=i[1],c=i[5],u=i[9],h=i[2],l=i[6];return i=i[10],"XYZ"===(t=t||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,i),this._z=Math.atan2(-o,e)):(this._x=Math.atan2(l,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,i),this._z=Math.atan2(a,c)):(this._y=Math.atan2(-h,e),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(-h,i),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(a,e))):"ZYX"===t?(this._y=Math.asin(-n(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(l,i),this._z=Math.atan2(a,e)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===t?(this._z=Math.asin(n(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,e)):(this._x=0,this._y=Math.atan2(s,i))):"XZY"===t?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(l,c),this._y=Math.atan2(s,e)):(this._x=Math.atan2(-u,i),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:(Do=new we,function(e,t,r){return Do.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Do,t,r)}),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Io=new a,function(e){return Io.setFromEuler(this),this.setFromQuaternion(Io,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Se(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(o.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask=this.mask|1<<e|0},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},test:function(e){return 0!=(this.mask&e.mask)}});var Fo,$o,Uo,zo,Go,Vo,Ho,qo,Wo,Xo,Yo,Ko,Zo,Jo,Qo,es,ts,rs,ns=0;h.DefaultUp=new Se(0,1,0),h.DefaultMatrixAutoUpdate=!0,h.prototype=Object.assign(Object.create(t.prototype),{constructor:h,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(ts=new a,function(e,t){return ts.setFromAxisAngle(e,t),this.quaternion.multiply(ts),this}),rotateOnWorldAxis:(es=new a,function(e,t){return es.setFromAxisAngle(e,t),this.quaternion.premultiply(es),this}),rotateX:(Qo=new Se(1,0,0),function(e){return this.rotateOnAxis(Qo,e)}),rotateY:(Jo=new Se(0,1,0),function(e){return this.rotateOnAxis(Jo,e)}),rotateZ:(Zo=new Se(0,0,1),function(e){return this.rotateOnAxis(Zo,e)}),translateOnAxis:(Ko=new Se,function(e,t){return Ko.copy(e).applyQuaternion(this.quaternion),this.position.add(Ko.multiplyScalar(t)),this}),translateX:(Yo=new Se(1,0,0),function(e){return this.translateOnAxis(Yo,e)}),translateY:(Xo=new Se(0,1,0),function(e){return this.translateOnAxis(Xo,e)}),translateZ:(Wo=new Se(0,0,1),function(e){return this.translateOnAxis(Wo,e)}),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(qo=new we,function(e){return e.applyMatrix4(qo.getInverse(this.matrixWorld))}),lookAt:(Vo=new we,Ho=new Se,function(e,t,r){e.isVector3?Ho.copy(e):Ho.set(e,t,r),this.isCamera?Vo.lookAt(this.position,Ho,this.up):Vo.lookAt(Ho,this.position,this.up),this.quaternion.setFromRotationMatrix(Vo)}),add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this},remove:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}return-1!==(t=this.children.indexOf(e))&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(t,1)),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new Se),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(zo=new Se,Go=new Se,function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new a),this.updateMatrixWorld(!0),this.matrixWorld.decompose(zo,e,Go),e}),getWorldScale:($o=new Se,Uo=new a,function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new Se),this.updateMatrixWorld(!0),this.matrixWorld.decompose($o,Uo,e),e}),getWorldDirection:(Fo=new a,function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new Se),this.getWorldQuaternion(Fo),e.set(0,0,1).applyQuaternion(Fo)}),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].updateMatrixWorld(e)},toJSON:function(r){function e(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(r)),t.uuid}function t(e){var t,r=[];for(t in e){var n=e[t];delete n.metadata,r.push(n)}return r}var n=void 0===r||"string"==typeof r,i={};n&&(r={geometries:{},materials:{},textures:{},images:{},shapes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var o={};if(o.uuid=this.uuid,o.type=this.type,""!==this.name&&(o.name=this.name),!0===this.castShadow&&(o.castShadow=!0),!0===this.receiveShadow&&(o.receiveShadow=!0),!1===this.visible&&(o.visible=!1),!1===this.frustumCulled&&(o.frustumCulled=!1),0!==this.renderOrder&&(o.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(o.userData=this.userData),o.layers=this.layers.mask,o.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(o.matrixAutoUpdate=!1),this.isMesh||this.isLine||this.isPoints){o.geometry=e(r.geometries,this.geometry);var s=this.geometry.parameters;if(void 0!==s&&void 0!==s.shapes)if(s=s.shapes,Array.isArray(s))for(var a=0,c=s.length;a<c;a++)e(r.shapes,s[a]);else e(r.shapes,s)}if(void 0!==this.material)if(Array.isArray(this.material)){for(s=[],a=0,c=this.material.length;a<c;a++)s.push(e(r.materials,this.material[a]));o.material=s}else o.material=e(r.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(r).object);if(n){n=t(r.geometries),a=t(r.materials),c=t(r.textures);var u=t(r.images);s=t(r.shapes),0<n.length&&(i.geometries=n),0<a.length&&(i.materials=a),0<c.length&&(i.textures=c),0<u.length&&(i.images=u),0<s.length&&(i.shapes=s)}return i.object=o,i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(t=0;t<e.children.length;t++)this.add(e.children[t].clone());return this}}),c.prototype=Object.assign(Object.create(h.prototype),{constructor:c,isCamera:!0,copy:function(e,t){return h.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},getWorldDirection:(rs=new a,function(e){return void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Se),this.getWorldQuaternion(rs),e.set(0,0,-1).applyQuaternion(rs)}),updateMatrixWorld:function(e){h.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),f.prototype=Object.assign(Object.create(c.prototype),{constructor:f,isOrthographicCamera:!0,copy:function(e,t){return c.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,r,n,i,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=n,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,i=r-e;if(r+=e,e=n+t,t=n-t,null!==this.view&&this.view.enabled){r=this.zoom/(this.view.width/this.view.fullWidth),t=this.zoom/(this.view.height/this.view.fullHeight);var o=(this.right-this.left)/this.view.width;n=(this.top-this.bottom)/this.view.height,r=(i+=this.view.offsetX/r*o)+this.view.width/r*o,t=(e-=this.view.offsetY/t*n)-this.view.height/t*n}this.projectionMatrix.makeOrthographic(i,r,e,t,this.near,this.far)},toJSON:function(e){return(e=h.prototype.toJSON.call(this,e)).object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Object.assign(k.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var is,os,ss,as,cs,us,hs,ls=0;S.prototype=Object.assign(Object.create(t.prototype),{constructor:S,isGeometry:!0,applyMatrix:function(e){for(var t=(new v).getNormalMatrix(e),r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(r=0,n=this.faces.length;r<n;r++){(e=this.faces[r]).normal.applyMatrix3(t).normalize();for(var i=0,o=e.vertexNormals.length;i<o;i++)e.vertexNormals[i].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:(hs=new we,function(e){return hs.makeRotationX(e),this.applyMatrix(hs),this}),rotateY:(us=new we,function(e){return us.makeRotationY(e),this.applyMatrix(us),this}),rotateZ:(cs=new we,function(e){return cs.makeRotationZ(e),this.applyMatrix(cs),this}),translate:(as=new we,function(e,t,r){return as.makeTranslation(e,t,r),this.applyMatrix(as),this}),scale:(ss=new we,function(e,t,r){return ss.makeScale(e,t,r),this.applyMatrix(ss),this}),lookAt:(os=new h,function(e){os.lookAt(e),os.updateMatrix(),this.applyMatrix(os.matrix)}),fromBufferGeometry:function(e){function t(e,t,r,n){n=new k(e,t,r,void 0!==s?[h[e].clone(),h[t].clone(),h[r].clone()]:[],void 0!==a?[i.colors[e].clone(),i.colors[t].clone(),i.colors[r].clone()]:[],n),i.faces.push(n),void 0!==c&&i.faceVertexUvs[0].push([l[e].clone(),l[t].clone(),l[r].clone()]),void 0!==u&&i.faceVertexUvs[1].push([p[e].clone(),p[t].clone(),p[r].clone()])}var i=this,r=null!==e.index?e.index.array:void 0,n=e.attributes,o=n.position.array,s=void 0!==n.normal?n.normal.array:void 0,a=void 0!==n.color?n.color.array:void 0,c=void 0!==n.uv?n.uv.array:void 0,u=void 0!==n.uv2?n.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var h=[],l=[],p=[],f=n=0;n<o.length;n+=3,f+=2)i.vertices.push(new Se(o[n],o[n+1],o[n+2])),void 0!==s&&h.push(new Se(s[n],s[n+1],s[n+2])),void 0!==a&&i.colors.push(new w(a[n],a[n+1],a[n+2])),void 0!==c&&l.push(new H(c[f],c[f+1])),void 0!==u&&p.push(new H(u[f],u[f+1]));var d=e.groups;if(0<d.length)for(n=0;n<d.length;n++){var m=(o=d[n]).start;for(f=m,m+=o.count;f<m;f+=3)void 0!==r?t(r[f],r[f+1],r[f+2],o.materialIndex):t(f,f+1,f+2,o.materialIndex)}else if(void 0!==r)for(n=0;n<r.length;n+=3)t(r[n],r[n+1],r[n+2]);else for(n=0;n<o.length/3;n+=3)t(n,n+1,n+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:(is=new Se,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(is).negate(),this.translate(is.x,is.y,is.z),this}),normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius;t=0===t?1:1/t;var r=new we;return r.set(t,0,0,-t*e.x,0,t,0,-t*e.y,0,0,t,-t*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new Se,t=new Se,r=0,n=this.faces.length;r<n;r++){var i=this.faces[r],o=this.vertices[i.a],s=this.vertices[i.b];e.subVectors(this.vertices[i.c],s),t.subVectors(o,s),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t;void 0===e&&(e=!0);var r=Array(this.vertices.length),n=0;for(t=this.vertices.length;n<t;n++)r[n]=new Se;if(e){var i=new Se,o=new Se;for(e=0,n=this.faces.length;e<n;e++){t=this.faces[e];var s=this.vertices[t.a],a=this.vertices[t.b],c=this.vertices[t.c];i.subVectors(c,a),o.subVectors(s,a),i.cross(o),r[t.a].add(i),r[t.b].add(i),r[t.c].add(i)}}else for(this.computeFaceNormals(),e=0,n=this.faces.length;e<n;e++)r[(t=this.faces[e]).a].add(t.normal),r[t.b].add(t.normal),r[t.c].add(t.normal);for(n=0,t=this.vertices.length;n<t;n++)r[n].normalize();for(e=0,n=this.faces.length;e<n;e++)3===(s=(t=this.faces[e]).vertexNormals).length?(s[0].copy(r[t.a]),s[1].copy(r[t.b]),s[2].copy(r[t.c])):(s[0]=r[t.a].clone(),s[1]=r[t.b].clone(),s[2]=r[t.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e;this.computeFaceNormals();var t=0;for(e=this.faces.length;t<e;t++){var r=this.faces[t],n=r.vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,r=0;for(t=this.faces.length;r<t;r++){var n=this.faces[r];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);var i=0;for(e=n.vertexNormals.length;i<e;i++)n.__originalVertexNormals[i]?n.__originalVertexNormals[i].copy(n.vertexNormals[i]):n.__originalVertexNormals[i]=n.vertexNormals[i].clone()}var o=new S;for(o.faces=this.faces,i=0,e=this.morphTargets.length;i<e;i++){if(!this.morphNormals[i]){this.morphNormals[i]={},this.morphNormals[i].faceNormals=[],this.morphNormals[i].vertexNormals=[],n=this.morphNormals[i].faceNormals;var s=this.morphNormals[i].vertexNormals;for(r=0,t=this.faces.length;r<t;r++){var a=new Se,c={a:new Se,b:new Se,c:new Se};n.push(a),s.push(c)}}for(s=this.morphNormals[i],o.vertices=this.morphTargets[i].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,t=this.faces.length;r<t;r++)n=this.faces[r],a=s.faceNormals[r],c=s.vertexNormals[r],a.copy(n.normal),c.a.copy(n.vertexNormals[0]),c.b.copy(n.vertexNormals[1]),c.c.copy(n.vertexNormals[2])}for(r=0,t=this.faces.length;r<t;r++)(n=this.faces[r]).normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new r),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new s),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e&&e.isGeometry){var n,i=this.vertices.length,o=this.vertices,s=e.vertices,a=this.faces,c=e.faces,u=this.faceVertexUvs[0],h=e.faceVertexUvs[0],l=this.colors,p=e.colors;void 0===r&&(r=0),void 0!==t&&(n=(new v).getNormalMatrix(t)),e=0;for(var f=s.length;e<f;e++){var d=s[e].clone();void 0!==t&&d.applyMatrix4(t),o.push(d)}for(e=0,f=p.length;e<f;e++)l.push(p[e].clone());for(e=0,f=c.length;e<f;e++){var m=(s=c[e]).vertexNormals;for(p=s.vertexColors,(l=new k(s.a+i,s.b+i,s.c+i)).normal.copy(s.normal),void 0!==n&&l.normal.applyMatrix3(n).normalize(),t=0,o=m.length;t<o;t++)d=m[t].clone(),void 0!==n&&d.applyMatrix3(n).normalize(),l.vertexNormals.push(d);for(l.color.copy(s.color),t=0,o=p.length;t<o;t++)d=p[t],l.vertexColors.push(d.clone());l.materialIndex=s.materialIndex+r,a.push(l)}for(e=0,f=h.length;e<f;e++)if(n=[],void 0!==(r=h[e])){for(t=0,o=r.length;t<o;t++)n.push(r[t].clone());u.push(n)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t={},r=[],n=[],i=Math.pow(10,4),o=0;for(e=this.vertices.length;o<e;o++){var s=this.vertices[o];void 0===t[s=Math.round(s.x*i)+"_"+Math.round(s.y*i)+"_"+Math.round(s.z*i)]?(t[s]=o,r.push(this.vertices[o]),n[o]=r.length-1):n[o]=n[t[s]]}for(t=[],o=0,e=this.faces.length;o<e;o++)for((i=this.faces[o]).a=n[i.a],i.b=n[i.b],i.c=n[i.c],i=[i.a,i.b,i.c],s=0;s<3;s++)if(i[s]===i[(s+1)%3]){t.push(o);break}for(o=t.length-1;0<=o;o--)for(i=t[o],this.faces.splice(i,1),n=0,e=this.faceVertexUvs.length;n<e;n++)this.faceVertexUvs[n].splice(i,1);return o=this.vertices.length-r.length,this.vertices=r,o},setFromPoints:function(e){this.vertices=[];for(var t=0,r=e.length;t<r;t++){var n=e[t];this.vertices.push(new Se(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;r<t;r++)e[r]._id=r;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var n,i,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];for(o&&o.length===t&&(n=[]),s&&s.length===t&&(i=[]),r=0;r<t;r++){var a=e[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 e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==u[t]||(u[t]=c.length/3,c.push(e.x,e.y,e.z)),u[t]}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==l[t]||(l[t]=h.length,h.push(e.getHex())),l[t]}function n(e){var t=e.x.toString()+e.y.toString();return void 0!==f[t]||(f[t]=p.length/2,p.push(e.x,e.y)),f[t]}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++){var a=this.vertices[o];s.push(a.x,a.y,a.z)}a=[];var 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,_=0<d.vertexColors.length,b=0;b=e(b=e(b=e(b=e(b=e(b=e(b=e(b=e(b,0,0),1,!0),2,!1),3,m),4,v),5,g),6,y),7,_),a.push(b),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(t(d.normal)),g&&(v=d.vertexNormals,a.push(t(v[0]),t(v[1]),t(v[2]))),y&&a.push(r(d.color)),_&&(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 S).copy(this)},copy:function(e){var t,r,n;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.name=e.name;var i=e.vertices,o=0;for(t=i.length;o<t;o++)this.vertices.push(i[o].clone());for(o=0,t=(i=e.colors).length;o<t;o++)this.colors.push(i[o].clone());for(o=0,t=(i=e.faces).length;o<t;o++)this.faces.push(i[o].clone());for(o=0,t=e.faceVertexUvs.length;o<t;o++){var s=e.faceVertexUvs[o];for(void 0===this.faceVertexUvs[o]&&(this.faceVertexUvs[o]=[]),i=0,r=s.length;i<r;i++){var a=s[i],c=[],u=0;for(n=a.length;u<n;u++)c.push(a[u].clone());this.faceVertexUvs[o].push(c)}}for(o=0,t=(u=e.morphTargets).length;o<t;o++){if((n={}).name=u[o].name,void 0!==u[o].vertices)for(n.vertices=[],i=0,r=u[o].vertices.length;i<r;i++)n.vertices.push(u[o].vertices[i].clone());if(void 0!==u[o].normals)for(n.normals=[],i=0,r=u[o].normals.length;i<r;i++)n.normals.push(u[o].normals[i].clone());this.morphTargets.push(n)}for(o=0,t=(u=e.morphNormals).length;o<t;o++){if(n={},void 0!==u[o].vertexNormals)for(n.vertexNormals=[],i=0,r=u[o].vertexNormals.length;i<r;i++)s=u[o].vertexNormals[i],(a={}).a=s.a.clone(),a.b=s.b.clone(),a.c=s.c.clone(),n.vertexNormals.push(a);if(void 0!==u[o].faceNormals)for(n.faceNormals=[],i=0,r=u[o].faceNormals.length;i<r;i++)n.faceNormals.push(u[o].faceNormals[i].clone());this.morphNormals.push(n)}for(o=0,t=(i=e.skinWeights).length;o<t;o++)this.skinWeights.push(i[o].clone());for(o=0,t=(i=e.skinIndices).length;o<t;o++)this.skinIndices.push(i[o].clone());for(o=0,t=(i=e.lineDistances).length;o<t;o++)this.lineDistances.push(i[o]);return null!==(o=e.boundingBox)&&(this.boundingBox=o.clone()),null!==(o=e.boundingSphere)&&(this.boundingSphere=o.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(y.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(y.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.itemSize:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var n=0,i=this.itemSize;n<i;n++)this.array[e+n]=t.array[r+n];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),o=new w),t[r++]=o.r,t[r++]=o.g,t[r++]=o.b}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),o=new H),t[r++]=o.x,t[r++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),o=new Se),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new Me),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z,t[r++]=o.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(u.prototype=Object.create(y.prototype)).constructor=u,(l.prototype=Object.create(y.prototype)).constructor=l,(d.prototype=Object.create(y.prototype)).constructor=d,(m.prototype=Object.create(y.prototype)).constructor=m,(_.prototype=Object.create(y.prototype)).constructor=_,(b.prototype=Object.create(y.prototype)).constructor=b,(x.prototype=Object.create(y.prototype)).constructor=x,(P.prototype=Object.create(y.prototype)).constructor=P,(M.prototype=Object.create(y.prototype)).constructor=M,Object.assign(C.prototype,{computeGroups:function(e){var t=[],r=void 0;e=e.faces;for(var n=0;n<e.length;n++){var i=e[n];if(i.materialIndex!==r){r=i.materialIndex,void 0!==o&&(o.count=3*n-o.start,t.push(o));var o={start:3*n,materialIndex:r}}}void 0!==o&&(o.count=3*n-o.start,t.push(o)),this.groups=t},fromGeometry:function(e){var t=e.faces,r=e.vertices,n=e.faceVertexUvs,i=n[0]&&0<n[0].length,o=n[1]&&0<n[1].length,s=e.morphTargets,a=s.length;if(0<a){for(var c=[],u=0;u<a;u++)c[u]=[];this.morphTargets.position=c}var h=e.morphNormals,l=h.length;if(0<l){var p=[];for(u=0;u<l;u++)p[u]=[];this.morphTargets.normal=p}var f=e.skinIndices,d=e.skinWeights,m=f.length===r.length,v=d.length===r.length;for(0<r.length&&0===t.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported."),u=0;u<t.length;u++){var g=t[u];this.vertices.push(r[g.a],r[g.b],r[g.c]);var y=g.vertexNormals;for(3===y.length?this.normals.push(y[0],y[1],y[2]):(y=g.normal,this.normals.push(y,y,y)),3===(y=g.vertexColors).length?this.colors.push(y[0],y[1],y[2]):(y=g.color,this.colors.push(y,y,y)),!0===i&&(void 0!==(y=n[0][u])?this.uvs.push(y[0],y[1],y[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",u),this.uvs.push(new H,new H,new H))),!0===o&&(void 0!==(y=n[1][u])?this.uvs2.push(y[0],y[1],y[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",u),this.uvs2.push(new H,new H,new H))),y=0;y<a;y++){var _=s[y].vertices;c[y].push(_[g.a],_[g.b],_[g.c])}for(y=0;y<l;y++)_=h[y].vertexNormals[u],p[y].push(_.a,_.b,_.c);m&&this.skinIndices.push(f[g.a],f[g.b],f[g.c]),v&&this.skinWeights.push(d[g.a],d[g.b],d[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}});var ps,fs,ds,ms,vs,gs,ys,_s,bs,xs,ws=1;A.prototype=Object.assign(Object.create(t.prototype),{constructor:A,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(65535<E(e)?x:_)(e,1):this.index=e},addAttribute:function(e,t,r){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?("index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)):this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new y(t,r)))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;return void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0),void 0!==(t=this.attributes.normal)&&((new v).getNormalMatrix(e).applyToBufferAttribute(t),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(xs=new we,function(e){return xs.makeRotationX(e),this.applyMatrix(xs),this}),rotateY:(bs=new we,function(e){return bs.makeRotationY(e),this.applyMatrix(bs),this}),rotateZ:(_s=new we,function(e){return _s.makeRotationZ(e),this.applyMatrix(_s),this}),translate:(ys=new we,function(e,t,r){return ys.makeTranslation(e,t,r),this.applyMatrix(ys),this}),scale:(gs=new we,function(e,t,r){return gs.makeScale(e,t,r),this.applyMatrix(gs),this}),lookAt:(vs=new h,function(e){vs.lookAt(e),vs.updateMatrix(),this.applyMatrix(vs.matrix)}),center:(ms=new Se,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ms).negate(),this.translate(ms.x,ms.y,ms.z),this}),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){e=new P(3*t.vertices.length,3);var r=new P(3*t.colors.length,3);this.addAttribute("position",e.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length&&(e=new P(t.lineDistances.length,1),this.addAttribute("lineDistance",e.copyArray(t.lineDistances))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];t.push(i.x,i.y,i.z||0)}return this.addAttribute("position",new P(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var r=t.__directGeometry;if(!0===t.elementsNeedUpdate&&(r=void 0,t.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}return!0===t.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),!0===t.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),!0===t.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new C).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);for(var r in this.addAttribute("position",new y(t,3).copyVector3sArray(e.vertices)),0<e.normals.length&&(t=new Float32Array(3*e.normals.length),this.addAttribute("normal",new y(t,3).copyVector3sArray(e.normals))),0<e.colors.length&&(t=new Float32Array(3*e.colors.length),this.addAttribute("color",new y(t,3).copyColorsArray(e.colors))),0<e.uvs.length&&(t=new Float32Array(2*e.uvs.length),this.addAttribute("uv",new y(t,2).copyVector2sArray(e.uvs))),0<e.uvs2.length&&(t=new Float32Array(2*e.uvs2.length),this.addAttribute("uv2",new y(t,2).copyVector2sArray(e.uvs2))),this.groups=e.groups,e.morphTargets){t=[];for(var n=e.morphTargets[r],i=0,o=n.length;i<o;i++){var s=n[i],a=new P(3*s.length,3);t.push(a.copyVector3sArray(s))}this.morphAttributes[r]=t}return 0<e.skinIndices.length&&(r=new P(4*e.skinIndices.length,4),this.addAttribute("skinIndex",r.copyVector4sArray(e.skinIndices))),0<e.skinWeights.length&&(r=new P(4*e.skinWeights.length,4),this.addAttribute("skinWeight",r.copyVector4sArray(e.skinWeights))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new r);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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:(fs=new r,ds=new Se,function(){null===this.boundingSphere&&(this.boundingSphere=new s);var e=this.attributes.position;if(e){var t=this.boundingSphere.center;fs.setFromBufferAttribute(e),fs.getCenter(t);for(var r=0,n=0,i=e.count;n<i;n++)ds.x=e.getX(n),ds.y=e.getY(n),ds.z=e.getZ(n),r=Math.max(r,t.distanceToSquared(ds));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,r=this.groups;if(t.position){var n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new y(new Float32Array(n.length),3));else for(var i=t.normal.array,o=0,s=i.length;o<s;o++)i[o]=0;i=t.normal.array;var a=new Se,c=new Se,u=new Se,h=new Se,l=new Se;if(e){e=e.array,0===r.length&&this.addGroup(0,e.length);for(var p=0,f=r.length;p<f;++p){s=(o=r[p]).start;var d=o.count;for(o=s,s+=d;o<s;o+=3){d=3*e[o+0];var m=3*e[o+1],v=3*e[o+2];a.fromArray(n,d),c.fromArray(n,m),u.fromArray(n,v),h.subVectors(u,c),l.subVectors(a,c),h.cross(l),i[d]+=h.x,i[d+1]+=h.y,i[d+2]+=h.z,i[m]+=h.x,i[m+1]+=h.y,i[m+2]+=h.z,i[v]+=h.x,i[v+1]+=h.y,i[v+2]+=h.z}}}else for(o=0,s=n.length;o<s;o+=9)a.fromArray(n,o),c.fromArray(n,o+3),u.fromArray(n,o+6),h.subVectors(u,c),l.subVectors(a,c),h.cross(l),i[o]=h.x,i[o+1]=h.y,i[o+2]=h.z,i[o+3]=h.x,i[o+4]=h.y,i[o+5]=h.z,i[o+6]=h.x,i[o+7]=h.y,i[o+8]=h.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var r,n=this.attributes;for(r in n)if(void 0!==e.attributes[r]){var i=n[r].array,o=e.attributes[r],s=o.array,a=0;for(o=o.itemSize*t;a<s.length;a++,o++)i[o]=s[a]}return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:(ps=new Se,function(){for(var e=this.attributes.normal,t=0,r=e.count;t<r;t++)ps.x=e.getX(t),ps.y=e.getY(t),ps.z=e.getZ(t),ps.normalize(),e.setXYZ(t,ps.x,ps.y,ps.z)}),toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e,t=new A,r=this.index.array,n=this.attributes;for(e in n){var i=n[e],o=i.array,s=i.itemSize,a=new o.constructor(r.length*s),c=0;i=0;for(var u=r.length;i<u;i++)for(var h=r[i]*s,l=0;l<s;l++)a[c++]=o[h++];t.addAttribute(e,new y(a,s))}for(i=0,u=(r=this.groups).length;i<u;i++)n=r[i],t.addGroup(n.start,n.count,n.materialIndex);return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};var r=this.index;for(i in null!==r&&(t=Array.prototype.slice.call(r.array),e.data.index={type:r.array.constructor.name,array:t}),r=this.attributes){var n=r[i];t=Array.prototype.slice.call(n.array),e.data.attributes[i]={itemSize:n.itemSize,type:n.array.constructor.name,array:t,normalized:n.normalized}}var i=this.groups;return 0<i.length&&(e.data.groups=JSON.parse(JSON.stringify(i))),null!==(i=this.boundingSphere)&&(e.data.boundingSphere={center:i.center.toArray(),radius:i.radius}),e},clone:function(){return(new A).copy(this)},copy:function(e){var t;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.name=e.name;var r=e.index;for(s in null!==r&&this.setIndex(r.clone()),r=e.attributes)this.addAttribute(s,r[s].clone());var n=e.morphAttributes;for(s in n){var i=[],o=n[s];for(r=0,t=o.length;r<t;r++)i.push(o[r].clone());this.morphAttributes[s]=i}var s=e.groups;for(r=0,t=s.length;r<t;r++)n=s[r],this.addGroup(n.start,n.count,n.materialIndex);return null!==(s=e.boundingBox)&&(this.boundingBox=s.clone()),null!==(s=e.boundingSphere)&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(O.prototype=Object.create(S.prototype)).constructor=O,(j.prototype=Object.create(A.prototype)).constructor=j,(R.prototype=Object.create(S.prototype)).constructor=R,(L.prototype=Object.create(A.prototype)).constructor=L;var Ss,Ms,Cs,Es,Ts,Os,Ps,As,js,Rs,Ls,Ns,Is,Ds,ks,Bs,Fs,$s,Us,zs,Gs,Vs,Hs,qs,Ws=0;N.prototype=Object.assign(Object.create(t.prototype),{constructor:N,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0===r)console.warn("THREE.Material: '"+t+"' parameter is undefined.");else if("shading"===t)console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===r;else{var n=this[t];void 0===n?console.warn("THREE."+this.type+": '"+t+"' is not a property of this material."):n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]="overdraw"===t?Number(r):r}}},toJSON:function(e){function t(e){var t,r=[];for(t in e){var n=e[t];delete n.metadata,r.push(n)}return r}var r=void 0===e||"string"==typeof e;r&&(e={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()),1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),0!==this.vertexColors&&(n.vertexColors=this.vertexColors),this.opacity<1&&(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.rotation&&(n.rotation=this.rotation),1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),0<this.alphaTest&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),1<this.wireframeLinewidth&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),r&&(r=t(e.textures),e=t(e.images),0<r.length&&(n.textures=r),0<e.length&&(n.images=e)),n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,r=null;if(null!==t){var n=t.length;r=Array(n);for(var i=0;i!==n;++i)r[i]=t[i].clone()}return this.clippingPlanes=r,this.shadowSide=e.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((I.prototype=Object.create(N.prototype)).constructor=I).prototype.isMeshBasicMaterial=!0,I.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},((D.prototype=Object.create(N.prototype)).constructor=D).prototype.isShaderMaterial=!0,D.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Lo.clone(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},D.prototype.toJSON=function(e){return(e=N.prototype.toJSON.call(this,e)).uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},Object.assign(B.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Se),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:(Ls=new Se,function(e){return this.origin.copy(this.at(e,Ls)),this}),closestPointToPoint:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Se),t.subVectors(e,this.origin),(e=t.dot(this.direction))<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:(Rs=new Se,function(e){var t=Rs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Rs.copy(this.direction).multiplyScalar(t).add(this.origin),Rs.distanceToSquared(e))}),distanceSqToSegment:(Ps=new Se,As=new Se,js=new Se,function(e,t,r,n){Ps.copy(e).add(t).multiplyScalar(.5),As.copy(t).sub(e).normalize(),js.copy(this.origin).sub(Ps);var i=.5*e.distanceTo(t),o=-this.direction.dot(As),s=js.dot(this.direction),a=-js.dot(As),c=js.lengthSq(),u=Math.abs(1-o*o);if(0<u){t=o*s-a;var h=i*u;o=0<=(e=o*a-s)?-h<=t?t<=h?(e*=i=1/u)*(e+o*(t*=i)+2*s)+t*(o*e+t+2*a)+c:(t=i,-(e=Math.max(0,-(o*t+s)))*e+t*(t+2*a)+c):(t=-i,-(e=Math.max(0,-(o*t+s)))*e+t*(t+2*a)+c):t<=-h?-(e=Math.max(0,-(-o*i+s)))*e+(t=0<e?-i:Math.min(Math.max(-i,-a),i))*(t+2*a)+c:t<=h?(e=0,(t=Math.min(Math.max(-i,-a),i))*(t+2*a)+c):-(e=Math.max(0,-(o*i+s)))*e+(t=0<e?i:Math.min(Math.max(-i,-a),i))*(t+2*a)+c}else t=0<o?-i:i,o=-(e=Math.max(0,-(o*t+s)))*e+t*(t+2*a)+c;return r&&r.copy(this.direction).multiplyScalar(e).add(this.origin),n&&n.copy(As).multiplyScalar(t).add(Ps),o}),intersectSphere:(Os=new Se,function(e,t){Os.subVectors(e.center,this.origin);var r=Os.dot(this.direction),n=Os.dot(Os)-r*r;return(e=e.radius*e.radius)<n?null:(n=r-(e=Math.sqrt(e-n)),r+=e,n<0&&r<0?null:n<0?this.at(r,t):this.at(n,t))}),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);return 0===t?0===e.distanceToPoint(this.origin)?0:null:0<=(e=-(this.origin.dot(e.normal)+e.constant)/t)?e:null},intersectPlane:function(e,t){return null===(e=this.distanceToPlane(e))?null:this.at(e,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var r=1/this.direction.x,n=1/this.direction.y,i=1/this.direction.z,o=this.origin;if(0<=r){var s=(e.min.x-o.x)*r;r*=e.max.x-o.x}else s=(e.max.x-o.x)*r,r*=e.min.x-o.x;if(0<=n){var a=(e.min.y-o.y)*n;n*=e.max.y-o.y}else a=(e.max.y-o.y)*n,n*=e.min.y-o.y;return n<s||r<a?null:((s<a||s!=s)&&(s=a),(n<r||r!=r)&&(r=n),(e=0<=i?(a=(e.min.z-o.z)*i,(e.max.z-o.z)*i):(a=(e.max.z-o.z)*i,(e.min.z-o.z)*i))<s||r<a?null:((s<a||s!=s)&&(s=a),(e<r||r!=r)&&(r=e),r<0?null:this.at(0<=s?s:r,t)))},intersectsBox:(Ts=new Se,function(e){return null!==this.intersectBox(e,Ts)}),intersectTriangle:(Ss=new Se,Ms=new Se,Cs=new Se,Es=new Se,function(e,t,r,n,i){if(Ms.subVectors(t,e),Cs.subVectors(r,e),Es.crossVectors(Ms,Cs),0<(t=this.direction.dot(Es))){if(n)return null;n=1}else{if(!(t<0))return null;n=-1,t=-t}return Ss.subVectors(this.origin,e),(e=n*this.direction.dot(Cs.crossVectors(Ss,Cs)))<0?null:(r=n*this.direction.dot(Ms.cross(Ss)))<0||t<e+r?null:(e=-n*Ss.dot(Es))<0?null:this.at(e/t,i)}),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(F,{getNormal:(Bs=new Se,function(e,t,r,n){return void 0===n&&(console.warn("THREE.Triangle: .getNormal() target is now required"),n=new Se),n.subVectors(r,t),Bs.subVectors(e,t),n.cross(Bs),0<(e=n.lengthSq())?n.multiplyScalar(1/Math.sqrt(e)):n.set(0,0,0)}),getBarycoord:(Is=new Se,Ds=new Se,ks=new Se,function(e,t,r,n,i){Is.subVectors(n,t),Ds.subVectors(r,t),ks.subVectors(e,t),e=Is.dot(Is),t=Is.dot(Ds),r=Is.dot(ks);var o=Ds.dot(Ds);n=Ds.dot(ks);var s=e*o-t*t;return void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Se),0===s?i.set(-2,-1,-1):(o=(o*r-t*n)*(s=1/s),e=(e*n-t*r)*s,i.set(1-o-e,e,o))}),containsPoint:(Ns=new Se,function(e,t,r,n){return F.getBarycoord(e,t,r,n,Ns),0<=Ns.x&&0<=Ns.y&&Ns.x+Ns.y<=1})}),Object.assign(F.prototype,{set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:(Hs=new Se,qs=new Se,function(){return Hs.subVectors(this.c,this.b),qs.subVectors(this.a,this.b),.5*Hs.cross(qs).length()}),getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Se),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return F.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Se),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return F.getBarycoord(e,this.a,this.b,this.c,t)},containsPoint:function(e){return F.containsPoint(e,this.a,this.b,this.c)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:(Fs=new Se,$s=new Se,Us=new Se,zs=new Se,Gs=new Se,Vs=new Se,function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Se);var r=this.a,n=this.b,i=this.c;Fs.subVectors(n,r),$s.subVectors(i,r),zs.subVectors(e,r);var o=Fs.dot(zs),s=$s.dot(zs);if(o<=0&&s<=0)return t.copy(r);Gs.subVectors(e,n);var a=Fs.dot(Gs),c=$s.dot(Gs);if(0<=a&&c<=a)return t.copy(n);var u=o*c-a*s;if(u<=0&&0<=o&&a<=0)return n=o/(o-a),t.copy(r).addScaledVector(Fs,n);Vs.subVectors(e,i),e=Fs.dot(Vs);var h=$s.dot(Vs);return 0<=h&&e<=h?t.copy(i):(o=e*s-o*h)<=0&&0<=s&&h<=0?(u=s/(s-h),t.copy(r).addScaledVector($s,u)):(s=a*h-e*c)<=0&&0<=c-a&&0<=e-h?(Us.subVectors(i,n),u=(c-a)/(c-a+(e-h)),t.copy(n).addScaledVector(Us,u)):(n=o*(i=1/(s+o+u)),u*=i,t.copy(r).addScaledVector(Fs,n).addScaledVector($s,u))}),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),$.prototype=Object.assign(Object.create(h.prototype),{constructor:$,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return h.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){e=e.morphAttributes;var t=Object.keys(e);if(0<t.length){var r=e[t[0]];if(void 0!==r)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=r.length;e<t;e++){var n=r[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}else if(void 0!==(r=e.morphTargets)&&0<r.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=r.length;e<t;e++)n=r[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e},raycast:function(){function x(e,t,r,n,i,o,s){return F.getBarycoord(e,t,r,n,a),i.multiplyScalar(a.x),o.multiplyScalar(a.y),s.multiplyScalar(a.z),i.add(o).add(s),i.clone()}function w(e,t,r,n,i,o,s,a){return null===(1===t.side?n.intersectTriangle(s,o,i,!0,a):n.intersectTriangle(i,o,s,2!==t.side,a))?null:(c.copy(a),c.applyMatrix4(e.matrixWorld),(t=r.ray.origin.distanceTo(c))<r.near||t>r.far?null:{distance:t,point:c.clone(),object:e})}function S(e,t,r,n,i,o,s,a,c){return T.fromBufferAttribute(i,s),O.fromBufferAttribute(i,a),P.fromBufferAttribute(i,c),(e=w(e,t,r,n,T,O,P,D))&&(o&&(L.fromBufferAttribute(o,s),N.fromBufferAttribute(o,a),I.fromBufferAttribute(o,c),e.uv=x(D,T,O,P,L,N,I)),o=new k(s,a,c),F.getNormal(T,O,P,o.normal),e.face=o),e}var M=new we,C=new B,E=new s,T=new Se,O=new Se,P=new Se,A=new Se,j=new Se,R=new Se,L=new H,N=new H,I=new H,a=new Se,D=new Se,c=new Se;return function(e,t){var r=this.geometry,n=this.material,i=this.matrixWorld;if(void 0!==n&&(null===r.boundingSphere&&r.computeBoundingSphere(),E.copy(r.boundingSphere),E.applyMatrix4(i),!1!==e.ray.intersectsSphere(E)&&(M.getInverse(i),C.copy(e.ray).applyMatrix4(M),null===r.boundingBox||!1!==C.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o,s=r.index,a=r.attributes.position,c=r.attributes.uv,u=r.groups;if(r=r.drawRange,null!==s)if(Array.isArray(n)){var h=0;for(o=u.length;h<o;h++){var l=u[h],p=n[l.materialIndex];i=Math.max(l.start,r.start);var f=Math.min(l.start+l.count,r.start+r.count);for(l=i;l<f;l+=3){i=s.getX(l);var d=s.getX(l+1),m=s.getX(l+2);(i=S(this,p,e,C,a,c,i,d,m))&&(i.faceIndex=Math.floor(l/3),t.push(i))}}}else for(h=i=Math.max(0,r.start),o=f=Math.min(s.count,r.start+r.count);h<o;h+=3)i=s.getX(h),d=s.getX(h+1),m=s.getX(h+2),(i=S(this,n,e,C,a,c,i,d,m))&&(i.faceIndex=Math.floor(h/3),t.push(i));else if(void 0!==a)if(Array.isArray(n))for(h=0,o=u.length;h<o;h++)for(p=n[(l=u[h]).materialIndex],i=Math.max(l.start,r.start),f=Math.min(l.start+l.count,r.start+r.count),l=i;l<f;l+=3)(i=S(this,p,e,C,a,c,i=l,d=l+1,m=l+2))&&(i.faceIndex=Math.floor(l/3),t.push(i));else for(h=i=Math.max(0,r.start),o=f=Math.min(a.count,r.start+r.count);h<o;h+=3)(i=S(this,n,e,C,a,c,i=h,d=h+1,m=h+2))&&(i.faceIndex=Math.floor(h/3),t.push(i))}else if(r.isGeometry)for(a=Array.isArray(n),c=r.vertices,u=r.faces,0<(i=r.faceVertexUvs[0]).length&&(s=i),l=0,f=u.length;l<f;l++)if(d=u[l],void 0!==(i=a?n[d.materialIndex]:n)){if(h=c[d.a],o=c[d.b],p=c[d.c],!0===i.morphTargets){m=r.morphTargets;var v=this.morphTargetInfluences;T.set(0,0,0),O.set(0,0,0),P.set(0,0,0);for(var g=0,y=m.length;g<y;g++){var _=v[g];if(0!==_){var b=m[g].vertices;T.addScaledVector(A.subVectors(b[d.a],h),_),O.addScaledVector(j.subVectors(b[d.b],o),_),P.addScaledVector(R.subVectors(b[d.c],p),_)}}T.add(h),O.add(o),P.add(p),h=T,o=O,p=P}(i=w(this,i,e,C,h,o,p,D))&&(s&&s[l]&&(m=s[l],L.copy(m[0]),N.copy(m[1]),I.copy(m[2]),i.uv=x(D,h,o,p,L,N,I)),i.face=d,i.faceIndex=l,t.push(i))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((z.prototype=Object.create(p.prototype)).constructor=z).prototype.isCubeTexture=!0,Object.defineProperty(z.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var Xs=new p,Ys=new z,Ks=[],Zs=[],Js=new Float32Array(16),Qs=new Float32Array(9),ea=new Float32Array(4);ye.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),q(t,e)},_e.prototype.setValue=function(e,t,r){for(var n=this.seq,i=0,o=n.length;i!==o;++i){var s=n[i];s.setValue(e,t[s.id],r)}};var ta=/([\w\d_]+)(\])?(\[|\.)?/g;Fe.prototype.setValue=function(e,t,r){void 0!==(t=this.map[t])&&t.setValue(e,r,this.renderer)},Fe.prototype.setOptional=function(e,t,r){void 0!==(t=t[r])&&this.setValue(e,r,t)},Fe.upload=function(e,t,r,n){for(var i=0,o=t.length;i!==o;++i){var s=t[i],a=r[s.id];!1!==a.needsUpdate&&s.setValue(e,a.value,n)}},Fe.seqWithValue=function(e,t){for(var r=[],n=0,i=e.length;n!==i;++n){var o=e[n];o.id in t&&r.push(o)}return r};var ra,na,ia,oa,sa,aa,ca,ua,ha,la,pa,fa,da,ma,va,ga,ya=0,_a=0;((nt.prototype=Object.create(N.prototype)).constructor=nt).prototype.isMeshDepthMaterial=!0,nt.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},((it.prototype=Object.create(N.prototype)).constructor=it).prototype.isMeshDistanceMaterial=!0,it.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},ut.prototype=Object.assign(Object.create(h.prototype),{constructor:ut,isGroup:!0}),ht.prototype=Object.assign(Object.create(c.prototype),{constructor:ht,isPerspectiveCamera:!0,copy:function(e,t){return c.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){e=.5*this.getFilmHeight()/e,this.fov=2*po.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*po.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*po.RAD2DEG*Math.atan(Math.tan(.5*po.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,r,n,i,o){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=n,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*po.DEG2RAD*this.fov)/this.zoom,r=2*t,n=this.aspect*r,i=-.5*n,o=this.view;if(null!==this.view&&this.view.enabled){var s=o.fullWidth,a=o.fullHeight;i+=o.offsetX*n/s,t-=o.offsetY*r/a,n*=o.width/s,r*=o.height/a}0!==(o=this.filmOffset)&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+n,t,t-r,e,this.far)},toJSON:function(e){return(e=h.prototype.toJSON.call(this,e)).object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),lt.prototype=Object.assign(Object.create(ht.prototype),{constructor:lt,isArrayCamera:!0}),mt.prototype.isFogExp2=!0,mt.prototype.clone=function(){return new mt(this.color,this.density)},mt.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},vt.prototype.isFog=!0,vt.prototype.clone=function(){return new vt(this.color,this.near,this.far)},vt.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},gt.prototype=Object.assign(Object.create(h.prototype),{constructor:gt,copy:function(e,t){return h.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=h.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}),Object.defineProperty(yt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(yt.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.stride:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var n=0,i=this.stride;n<i;n++)this.array[e+n]=t.array[r+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Object.defineProperties(_t.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(_t.prototype,{isInterleavedBufferAttribute:!0,setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this.data.array[e+3]=i,this}}),((bt.prototype=Object.create(N.prototype)).constructor=bt).prototype.isSpriteMaterial=!0,bt.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this},xt.prototype=Object.assign(Object.create(h.prototype),{constructor:xt,isSprite:!0,raycast:function(){function s(e,t,r,n,i,o){h.subVectors(e,r).addScalar(.5).multiply(n),void 0!==i?(l.x=o*h.x-i*h.y,l.y=i*h.x+o*h.y):l.copy(h),e.copy(t),e.x+=l.x,e.y+=l.y,e.applyMatrix4(p)}var a=new Se,c=new Se,u=new Se,h=new H,l=new H,p=new we,f=new Se,d=new Se,m=new Se;return function(e,t){c.setFromMatrixScale(this.matrixWorld),p.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),u.setFromMatrixPosition(this.modelViewMatrix);var r=this.material.rotation;if(0!==r)var n=Math.cos(r),i=Math.sin(r);r=this.center,s(f.set(-.5,-.5,0),u,r,c,i,n),s(d.set(.5,-.5,0),u,r,c,i,n),s(m.set(.5,.5,0),u,r,c,i,n);var o=e.ray.intersectTriangle(f,d,m,!1,a);null===o&&(s(d.set(-.5,.5,0),u,r,c,i,n),null===(o=e.ray.intersectTriangle(f,m,d,!1,a)))||(i=e.ray.origin.distanceTo(a))<e.near||i>e.far||t.push({distance:i,point:a.clone(),face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return h.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),wt.prototype=Object.assign(Object.create(h.prototype),{constructor:wt,copy:function(e){h.prototype.copy.call(this,e,!1);for(var t=0,r=(e=e.levels).length;t<r;t++){var n=e[t];this.addLevel(n.object.clone(),n.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,n=0;n<r.length&&!(t<r[n].distance);n++);r.splice(n,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,r=1,n=t.length;r<n&&!(e<t[r].distance);r++);return t[r-1].object},raycast:(oa=new Se,function(e,t){oa.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(oa);this.getObjectForDistance(r).raycast(e,t)}),update:(na=new Se,ia=new Se,function(e){var t=this.levels;if(1<t.length){na.setFromMatrixPosition(e.matrixWorld),ia.setFromMatrixPosition(this.matrixWorld),e=na.distanceTo(ia),t[0].object.visible=!0;for(var r=1,n=t.length;r<n&&e>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(;r<n;r++)t[r].object.visible=!1}}),toJSON:function(e){(e=h.prototype.toJSON.call(this,e)).object.levels=[];for(var t=this.levels,r=0,n=t.length;r<n;r++){var i=t[r];e.object.levels.push({object:i.object.uuid,distance:i.distance})}return e}}),Object.assign(St.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var r=new we;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},pose:function(){var e,t,r=0;for(t=this.bones.length;r<t;r++)(e=this.bones[r])&&e.matrixWorld.getInverse(this.boneInverses[r]);for(r=0,t=this.bones.length;r<t;r++)(e=this.bones[r])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:(sa=new we,aa=new we,function(){for(var e=this.bones,t=this.boneInverses,r=this.boneMatrices,n=this.boneTexture,i=0,o=e.length;i<o;i++)sa.multiplyMatrices(e[i]?e[i].matrixWorld:aa,t[i]),sa.toArray(r,16*i);void 0!==n&&(n.needsUpdate=!0)}),clone:function(){return new St(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,r=this.bones.length;t<r;t++){var n=this.bones[t];if(n.name===e)return n}}}),Mt.prototype=Object.assign(Object.create(h.prototype),{constructor:Mt,isBone:!0}),Ct.prototype=Object.assign(Object.create($.prototype),{constructor:Ct,isSkinnedMesh:!0,initBones:function(){var e,t=[];if(this.geometry&&void 0!==this.geometry.bones){var r=0;for(e=this.geometry.bones.length;r<e;r++){var n=this.geometry.bones[r],i=new Mt;t.push(i),i.name=n.name,i.position.fromArray(n.pos),i.quaternion.fromArray(n.rotq),void 0!==n.scl&&i.scale.fromArray(n.scl)}for(r=0,e=this.geometry.bones.length;r<e;r++)-1!==(n=this.geometry.bones[r]).parent&&null!==n.parent&&void 0!==t[n.parent]?t[n.parent].add(t[r]):this.add(t[r])}return this.updateMatrixWorld(!0),t},bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],r=1/t.manhattanLength();1/0!==r?t.multiplyScalar(r):t.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){t=new Me;var n=this.geometry.attributes.skinWeight;for(e=0;e<n.count;e++)t.x=n.getX(e),t.y=n.getY(e),t.z=n.getZ(e),t.w=n.getW(e),1/0!==(r=1/t.manhattanLength())?t.multiplyScalar(r):t.set(1,0,0,0),n.setXYZW(e,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(e){$.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((Et.prototype=Object.create(N.prototype)).constructor=Et).prototype.isLineBasicMaterial=!0,Et.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},Tt.prototype=Object.assign(Object.create(h.prototype),{constructor:Tt,isLine:!0,computeLineDistances:(la=new Se,pa=new Se,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],n=1,i=t.count;n<i;n++)la.fromBufferAttribute(t,n-1),pa.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=la.distanceTo(pa);e.addAttribute("lineDistance",new P(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(t=e.vertices,(r=e.lineDistances)[0]=0,n=1,i=t.length;n<i;n++)r[n]=r[n-1],r[n]+=t[n-1].distanceTo(t[n]);return this}),raycast:(ca=new we,ua=new B,ha=new s,function(e,t){var r=e.linePrecision;r*=r;var n=this.geometry,i=this.matrixWorld;if(null===n.boundingSphere&&n.computeBoundingSphere(),ha.copy(n.boundingSphere),ha.applyMatrix4(i),!1!==e.ray.intersectsSphere(ha)){ca.getInverse(i),ua.copy(e.ray).applyMatrix4(ca);var o=new Se,s=new Se;i=new Se;var a=new Se,c=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var u=n.index,h=n.attributes.position.array;if(null!==u){n=0;for(var l=(u=u.array).length-1;n<l;n+=c){var p=u[n+1];o.fromArray(h,3*u[n]),s.fromArray(h,3*p),r<(p=ua.distanceSqToSegment(o,s,a,i))||(a.applyMatrix4(this.matrixWorld),(p=e.ray.origin.distanceTo(a))<e.near||p>e.far||t.push({distance:p,point:i.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this}))}}else for(n=0,l=h.length/3-1;n<l;n+=c)o.fromArray(h,3*n),s.fromArray(h,3*n+3),r<(p=ua.distanceSqToSegment(o,s,a,i))||(a.applyMatrix4(this.matrixWorld),(p=e.ray.origin.distanceTo(a))<e.near||p>e.far||t.push({distance:p,point:i.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this}))}else if(n.isGeometry)for(s=(o=n.vertices).length,n=0;n<s-1;n+=c)r<(p=ua.distanceSqToSegment(o[n],o[n+1],a,i))||(a.applyMatrix4(this.matrixWorld),(p=e.ray.origin.distanceTo(a))<e.near||p>e.far||t.push({distance:p,point:i.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this}))}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ot.prototype=Object.assign(Object.create(Tt.prototype),{constructor:Ot,isLineSegments:!0,computeLineDistances:(fa=new Se,da=new Se,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],n=0,i=t.count;n<i;n+=2)fa.fromBufferAttribute(t,n),da.fromBufferAttribute(t,n+1),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+fa.distanceTo(da);e.addAttribute("lineDistance",new P(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(t=e.vertices,r=e.lineDistances,n=0,i=t.length;n<i;n+=2)fa.copy(t[n]),da.copy(t[n+1]),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+fa.distanceTo(da);return this})}),Pt.prototype=Object.assign(Object.create(Tt.prototype),{constructor:Pt,isLineLoop:!0}),((At.prototype=Object.create(N.prototype)).constructor=At).prototype.isPointsMaterial=!0,At.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},jt.prototype=Object.assign(Object.create(h.prototype),{constructor:jt,isPoints:!0,raycast:(ma=new we,va=new B,ga=new s,function(n,i){function e(e,t){var r=va.distanceSqToPoint(e);r<a&&(va.closestPointToPoint(e,c),c.applyMatrix4(s),(e=n.ray.origin.distanceTo(c))<n.near||e>n.far||i.push({distance:e,distanceToRay:Math.sqrt(r),point:c.clone(),index:t,face:null,object:o}))}var o=this,t=this.geometry,s=this.matrixWorld,r=n.params.Points.threshold;if(null===t.boundingSphere&&t.computeBoundingSphere(),ga.copy(t.boundingSphere),ga.applyMatrix4(s),ga.radius+=r,!1!==n.ray.intersectsSphere(ga)){ma.getInverse(s),va.copy(n.ray).applyMatrix4(ma);var a=(r/=(this.scale.x+this.scale.y+this.scale.z)/3)*r;r=new Se;var c=new Se;if(t.isBufferGeometry){var u=t.index;if(t=t.attributes.position.array,null!==u){var h=u.array;u=0;for(var l=h.length;u<l;u++){var p=h[u];r.fromArray(t,3*p),e(r,p)}}else for(u=0,h=t.length/3;u<h;u++)r.fromArray(t,3*u),e(r,u)}else for(u=0,h=(r=t.vertices).length;u<h;u++)e(r[u],u)}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Rt.prototype=Object.assign(Object.create(p.prototype),{constructor:Rt,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((Lt.prototype=Object.create(p.prototype)).constructor=Lt).prototype.isCompressedTexture=!0,((Nt.prototype=Object.create(p.prototype)).constructor=Nt).prototype.isCanvasTexture=!0,((It.prototype=Object.create(p.prototype)).constructor=It).prototype.isDepthTexture=!0,(Dt.prototype=Object.create(A.prototype)).constructor=Dt,(kt.prototype=Object.create(S.prototype)).constructor=kt,(Bt.prototype=Object.create(A.prototype)).constructor=Bt,(Ft.prototype=Object.create(S.prototype)).constructor=Ft,($t.prototype=Object.create(A.prototype)).constructor=$t,(Ut.prototype=Object.create(S.prototype)).constructor=Ut,(zt.prototype=Object.create($t.prototype)).constructor=zt,(Gt.prototype=Object.create(S.prototype)).constructor=Gt,(Vt.prototype=Object.create($t.prototype)).constructor=Vt,(Ht.prototype=Object.create(S.prototype)).constructor=Ht,(qt.prototype=Object.create($t.prototype)).constructor=qt,(Wt.prototype=Object.create(S.prototype)).constructor=Wt,(Xt.prototype=Object.create($t.prototype)).constructor=Xt,(Yt.prototype=Object.create(S.prototype)).constructor=Yt,(Kt.prototype=Object.create(A.prototype)).constructor=Kt,(Zt.prototype=Object.create(S.prototype)).constructor=Zt,(Jt.prototype=Object.create(A.prototype)).constructor=Jt,(Qt.prototype=Object.create(S.prototype)).constructor=Qt,(er.prototype=Object.create(A.prototype)).constructor=er;var ba=function(e,t,r){r=r||2;var n,i=t&&t.length,o=i?t[0]*r:e.length,s=tr(e,0,o,r,!0),a=[];if(!s)return a;if(i){var c,u=r;i=[];var h=0;for(c=t.length;h<c;h++){var l=t[h]*u;(l=tr(e,l,h<c-1?t[h+1]*u:e.length,u,!1))===l.next&&(l.steiner=!0),i.push(sr(l))}for(i.sort(nr),h=0;h<i.length;h++)(u=ir(t=i[h],u=s))&&rr(t=pr(u,t),t.next),s=rr(s,s.next)}if(e.length>80*r){var p=n=e[0],f=i=e[1];for(u=r;u<o;u+=r)(h=e[u])<p&&(p=h),(t=e[u+1])<f&&(f=t),n<h&&(n=h),i<t&&(i=t);n=0!==(n=Math.max(n-p,i-f))?1/n:0}return function e(t,r,n,i,o,s,a){if(t){if(!a&&s){for(var c=t,u=c;null===u.z&&(u.z=or(u.x,u.y,i,o,s)),u.prevZ=u.prev,(u=u.nextZ=u.next)!==c;);u.prevZ.nextZ=null,u.prevZ=null,c=u;var h,l,p,f,d=1;do{u=c;var m=c=null;for(l=0;u;){l++;var v=u;for(h=p=0;h<d&&(p++,v=v.nextZ);h++);for(f=d;0<p||0<f&&v;)0!==p&&(0===f||!v||u.z<=v.z)?(u=(h=u).nextZ,p--):(v=(h=v).nextZ,f--),m?m.nextZ=h:c=h,h.prevZ=m,m=h;u=v}m.nextZ=null,d*=2}while(1<l)}for(c=t;t.prev!==t.next;){if(u=t.prev,v=t.next,s)e:{f=i;var g=o,y=s;if(0<=cr(l=(m=t).prev,p=m,d=m.next))m=!1;else{var _=l.x>p.x?l.x>d.x?l.x:d.x:p.x>d.x?p.x:d.x,b=l.y>p.y?l.y>d.y?l.y:d.y:p.y>d.y?p.y:d.y;for(h=or(l.x<p.x?l.x<d.x?l.x:d.x:p.x<d.x?p.x:d.x,l.y<p.y?l.y<d.y?l.y:d.y:p.y<d.y?p.y:d.y,f,g,y),f=or(_,b,f,g,y),g=m.nextZ;g&&g.z<=f;){if(g!==m.prev&&g!==m.next&&ar(l.x,l.y,p.x,p.y,d.x,d.y,g.x,g.y)&&0<=cr(g.prev,g,g.next)){m=!1;break e}g=g.nextZ}for(g=m.prevZ;g&&g.z>=h;){if(g!==m.prev&&g!==m.next&&ar(l.x,l.y,p.x,p.y,d.x,d.y,g.x,g.y)&&0<=cr(g.prev,g,g.next)){m=!1;break e}g=g.prevZ}m=!0}}else e:if(m=t,l=m.prev,p=m,d=m.next,0<=cr(l,p,d))m=!1;else{for(h=m.next.next;h!==m.prev;){if(ar(l.x,l.y,p.x,p.y,d.x,d.y,h.x,h.y)&&0<=cr(h.prev,h,h.next)){m=!1;break e}h=h.next}m=!0}if(m)r.push(u.i/n),r.push(t.i/n),r.push(v.i/n),dr(t),c=t=v.next;else if((t=v)===c){if(a){if(1===a){for(a=r,c=n,u=t;!ur(v=u.prev,m=u.next.next)&&hr(v,u,u.next,m)&&lr(v,m)&&lr(m,v)&&(a.push(v.i/c),a.push(u.i/c),a.push(m.i/c),dr(u),dr(u.next),u=t=m),(u=u.next)!==t;);e(t=u,r,n,i,o,s,2)}else if(2===a)e:{a=t;do{for(c=a.next.next;c!==a.prev;){if(u=a.i!==c.i){if(v=c,m=(u=a).next.i!==v.i&&u.prev.i!==v.i){t:{m=u;do{if(m.i!==u.i&&m.next.i!==u.i&&m.i!==v.i&&m.next.i!==v.i&&hr(m,m.next,u,v)){m=!0;break t}m=m.next}while(m!==u);m=!1}m=!m}if(m=m&&lr(u,v)&&lr(v,u)){for(l=!1,p=((m=u).x+v.x)/2,v=(u.y+v.y)/2;m.y>v!=m.next.y>v&&m.next.y!==m.y&&p<(m.next.x-m.x)*(v-m.y)/(m.next.y-m.y)+m.x&&(l=!l),(m=m.next)!==u;);m=l}u=m}if(u){t=pr(a,c),a=rr(a,a.next),t=rr(t,t.next),e(a,r,n,i,o,s),e(t,r,n,i,o,s);break e}c=c.next}a=a.next}while(a!==t)}}else e(rr(t),r,n,i,o,s,1);break}}}}(s,a,r,p,f,n),a},xa={area:function(e){for(var t=e.length,r=0,n=t-1,i=0;i<t;n=i++)r+=e[n].x*e[i].y-e[i].x*e[n].y;return.5*r},isClockWise:function(e){return xa.area(e)<0},triangulateShape:function(e,t){var r=[],n=[],i=[];vr(e),gr(r,e);var o=e.length;for(t.forEach(vr),e=0;e<t.length;e++)n.push(o),o+=t[e].length,gr(r,t[e]);for(t=ba(r,n),e=0;e<t.length;e+=3)i.push(t.slice(e,e+3));return i}};((yr.prototype=Object.create(S.prototype)).constructor=yr).prototype.toJSON=function(){var e=S.prototype.toJSON.call(this);return br(this.parameters.shapes,this.parameters.options,e)},((_r.prototype=Object.create(A.prototype)).constructor=_r).prototype.toJSON=function(){var e=A.prototype.toJSON.call(this);return br(this.parameters.shapes,this.parameters.options,e)};var wa={generateTopUV:function(e,t,r,n,i){e=t[3*n],n=t[3*n+1];var o=t[3*i];return i=t[3*i+1],[new H(t[3*r],t[3*r+1]),new H(e,n),new H(o,i)]},generateSideWallUV:function(e,t,r,n,i,o){e=t[3*r];var s=t[3*r+1];r=t[3*r+2];var a=t[3*n],c=t[3*n+1];n=t[3*n+2];var u=t[3*i],h=t[3*i+1];i=t[3*i+2];var l=t[3*o],p=t[3*o+1];return t=t[3*o+2],Math.abs(s-c)<.01?[new H(e,1-r),new H(a,1-n),new H(u,1-i),new H(l,1-t)]:[new H(s,1-r),new H(c,1-n),new H(h,1-i),new H(p,1-t)]}};(xr.prototype=Object.create(S.prototype)).constructor=xr,(wr.prototype=Object.create(_r.prototype)).constructor=wr,(Sr.prototype=Object.create(S.prototype)).constructor=Sr,(Mr.prototype=Object.create(A.prototype)).constructor=Mr,(Cr.prototype=Object.create(S.prototype)).constructor=Cr,(Er.prototype=Object.create(A.prototype)).constructor=Er,(Tr.prototype=Object.create(S.prototype)).constructor=Tr,(Or.prototype=Object.create(A.prototype)).constructor=Or,((Pr.prototype=Object.create(S.prototype)).constructor=Pr).prototype.toJSON=function(){var e=S.prototype.toJSON.call(this);return jr(this.parameters.shapes,e)},((Ar.prototype=Object.create(A.prototype)).constructor=Ar).prototype.toJSON=function(){var e=A.prototype.toJSON.call(this);return jr(this.parameters.shapes,e)},(Rr.prototype=Object.create(A.prototype)).constructor=Rr,(Lr.prototype=Object.create(S.prototype)).constructor=Lr,(Nr.prototype=Object.create(A.prototype)).constructor=Nr,(Ir.prototype=Object.create(Lr.prototype)).constructor=Ir,(Dr.prototype=Object.create(Nr.prototype)).constructor=Dr,(kr.prototype=Object.create(S.prototype)).constructor=kr,(Br.prototype=Object.create(A.prototype)).constructor=Br;var Sa=Object.freeze({WireframeGeometry:Dt,ParametricGeometry:kt,ParametricBufferGeometry:Bt,TetrahedronGeometry:Ut,TetrahedronBufferGeometry:zt,OctahedronGeometry:Gt,OctahedronBufferGeometry:Vt,IcosahedronGeometry:Ht,IcosahedronBufferGeometry:qt,DodecahedronGeometry:Wt,DodecahedronBufferGeometry:Xt,PolyhedronGeometry:Ft,PolyhedronBufferGeometry:$t,TubeGeometry:Yt,TubeBufferGeometry:Kt,TorusKnotGeometry:Zt,TorusKnotBufferGeometry:Jt,TorusGeometry:Qt,TorusBufferGeometry:er,TextGeometry:xr,TextBufferGeometry:wr,SphereGeometry:Sr,SphereBufferGeometry:Mr,RingGeometry:Cr,RingBufferGeometry:Er,PlaneGeometry:R,PlaneBufferGeometry:L,LatheGeometry:Tr,LatheBufferGeometry:Or,ShapeGeometry:Pr,ShapeBufferGeometry:Ar,ExtrudeGeometry:yr,ExtrudeBufferGeometry:_r,EdgesGeometry:Rr,ConeGeometry:Ir,ConeBufferGeometry:Dr,CylinderGeometry:Lr,CylinderBufferGeometry:Nr,CircleGeometry:kr,CircleBufferGeometry:Br,BoxGeometry:O,BoxBufferGeometry:j});((Fr.prototype=Object.create(N.prototype)).constructor=Fr).prototype.isShadowMaterial=!0,Fr.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.color.copy(e.color),this},(($r.prototype=Object.create(D.prototype)).constructor=$r).prototype.isRawShaderMaterial=!0,((Ur.prototype=Object.create(N.prototype)).constructor=Ur).prototype.isMeshStandardMaterial=!0,Ur.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((zr.prototype=Object.create(Ur.prototype)).constructor=zr).prototype.isMeshPhysicalMaterial=!0,zr.prototype.copy=function(e){return Ur.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},((Gr.prototype=Object.create(N.prototype)).constructor=Gr).prototype.isMeshPhongMaterial=!0,Gr.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Vr.prototype=Object.create(Gr.prototype)).constructor=Vr).prototype.isMeshToonMaterial=!0,Vr.prototype.copy=function(e){return Gr.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},((Hr.prototype=Object.create(N.prototype)).constructor=Hr).prototype.isMeshNormalMaterial=!0,Hr.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((qr.prototype=Object.create(N.prototype)).constructor=qr).prototype.isMeshLambertMaterial=!0,qr.prototype.copy=function(e){return N.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Wr.prototype=Object.create(Et.prototype)).constructor=Wr).prototype.isLineDashedMaterial=!0,Wr.prototype.copy=function(e){return Et.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Ma=Object.freeze({ShadowMaterial:Fr,SpriteMaterial:bt,RawShaderMaterial:$r,ShaderMaterial:D,PointsMaterial:At,MeshPhysicalMaterial:zr,MeshStandardMaterial:Ur,MeshPhongMaterial:Gr,MeshToonMaterial:Vr,MeshNormalMaterial:Hr,MeshLambertMaterial:qr,MeshDepthMaterial:nt,MeshDistanceMaterial:it,MeshBasicMaterial:I,LineDashedMaterial:Wr,LineBasicMaterial:Et,Material:N}),Ca={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Ea=new Xr,Ta={};Object.assign(Yr.prototype,{load:function(s,e,t,r){void 0===s&&(s=""),void 0!==this.path&&(s=this.path+s),s=this.manager.resolveURL(s);var a=this,n=Ca.get(s);if(void 0!==n)return a.manager.itemStart(s),setTimeout(function(){e&&e(n),a.manager.itemEnd(s)},0),n;if(void 0===Ta[s]){var i=s.match(/^data:(.*?)(;base64)?,(.*)$/);if(i){t=i[1];var o=!!i[2];i=i[3],i=window.decodeURIComponent(i),o&&(i=window.atob(i));try{var c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":var u=new Uint8Array(i.length);for(o=0;o<i.length;o++)u[o]=i.charCodeAt(o);var h="blob"===c?new Blob([u.buffer],{type:t}):u.buffer;break;case"document":h=(new DOMParser).parseFromString(i,t);break;case"json":h=JSON.parse(i);break;default:h=i}window.setTimeout(function(){e&&e(h),a.manager.itemEnd(s)},0)}catch(e){window.setTimeout(function(){r&&r(e),a.manager.itemEnd(s),a.manager.itemError(s)},0)}}else{Ta[s]=[],Ta[s].push({onLoad:e,onProgress:t,onError:r});var l=new XMLHttpRequest;for(o in l.open("GET",s,!0),l.addEventListener("load",function(e){var t=this.response;Ca.add(s,t);var r=Ta[s];if(delete Ta[s],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var n=0,i=r.length;n<i;n++){var o=r[n];o.onLoad&&o.onLoad(t)}a.manager.itemEnd(s)}else{for(n=0,i=r.length;n<i;n++)(o=r[n]).onError&&o.onError(e);a.manager.itemEnd(s),a.manager.itemError(s)}},!1),l.addEventListener("progress",function(e){for(var t=Ta[s],r=0,n=t.length;r<n;r++){var i=t[r];i.onProgress&&i.onProgress(e)}},!1),l.addEventListener("error",function(e){var t=Ta[s];delete Ta[s];for(var r=0,n=t.length;r<n;r++){var i=t[r];i.onError&&i.onError(e)}a.manager.itemEnd(s),a.manager.itemError(s)},!1),void 0!==this.responseType&&(l.responseType=this.responseType),void 0!==this.withCredentials&&(l.withCredentials=this.withCredentials),l.overrideMimeType&&l.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)l.setRequestHeader(o,this.requestHeader[o]);l.send(null)}return a.manager.itemStart(s),l}Ta[s].push({onLoad:e,onProgress:t,onError:r})},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Object.assign(Kr.prototype,{load:function(e,i,r,n){function t(t){c.load(e[t],function(e){e=o._parser(e,!0),s[t]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(u+=1)&&(1===e.mipmapCount&&(a.minFilter=1006),a.format=e.format,a.needsUpdate=!0,i&&i(a))},r,n)}var o=this,s=[],a=new Lt;a.image=s;var c=new Yr(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(e))for(var u=0,h=0,l=e.length;h<l;++h)t(h);else c.load(e,function(e){if((e=o._parser(e,!0)).isCubemap)for(var t=e.mipmaps.length/e.mipmapCount,r=0;r<t;r++){s[r]={mipmaps:[]};for(var n=0;n<e.mipmapCount;n++)s[r].mipmaps.push(e.mipmaps[r*e.mipmapCount+n]),s[r].format=e.format,s[r].width=e.width,s[r].height=e.height}else a.image.width=e.width,a.image.height=e.height,a.mipmaps=e.mipmaps;1===e.mipmapCount&&(a.minFilter=1006),a.format=e.format,a.needsUpdate=!0,i&&i(a)},r,n);return a},setPath:function(e){return this.path=e,this}}),Object.assign(Zr.prototype,{load:function(e,t,r,n){var i=this,o=new Ce,s=new Yr(this.manager);return s.setResponseType("arraybuffer"),s.load(e,function(e){(e=i._parser(e))&&(void 0!==e.image?o.image=e.image:void 0!==e.data&&(o.image.width=e.width,o.image.height=e.height,o.image.data=e.data),o.wrapS=void 0!==e.wrapS?e.wrapS:1001,o.wrapT=void 0!==e.wrapT?e.wrapT:1001,o.magFilter=void 0!==e.magFilter?e.magFilter:1006,o.minFilter=void 0!==e.minFilter?e.minFilter:1008,o.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(o.format=e.format),void 0!==e.type&&(o.type=e.type),void 0!==e.mipmaps&&(o.mipmaps=e.mipmaps),1===e.mipmapCount&&(o.minFilter=1006),o.needsUpdate=!0,t&&t(o,e))},r,n),o}}),Object.assign(Jr.prototype,{crossOrigin:"anonymous",load:function(t,e,r,n){function i(){c.removeEventListener("load",i,!1),c.removeEventListener("error",o,!1),Ca.add(t,this),e&&e(this),s.manager.itemEnd(t)}function o(e){c.removeEventListener("load",i,!1),c.removeEventListener("error",o,!1),n&&n(e),s.manager.itemEnd(t),s.manager.itemError(t)}void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var s=this,a=Ca.get(t);if(void 0!==a)return s.manager.itemStart(t),setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0),a;var c=document.createElementNS("http://www.w3.org/1999/xhtml","img");return c.addEventListener("load",i,!1),c.addEventListener("error",o,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(c.crossOrigin=this.crossOrigin),s.manager.itemStart(t),c.src=t,c},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Qr.prototype,{crossOrigin:"anonymous",load:function(e,r,t,n){function i(t){s.load(e[t],function(e){o.images[t]=e,6===++a&&(o.needsUpdate=!0,r&&r(o))},void 0,n)}var o=new z,s=new Jr(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);var a=0;for(t=0;t<e.length;++t)i(t);return o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(en.prototype,{crossOrigin:"anonymous",load:function(t,r,e,n){var i=new p,o=new Jr(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(e){i.image=e,e=0<t.search(/\.(jpg|jpeg)$/)||0===t.search(/^data:image\/jpeg/),i.format=e?1022:1023,i.needsUpdate=!0,void 0!==r&&r(i)},e,n),i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(tn.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){return e=this.getUtoTmapping(e),this.getPoint(e,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r=[],n=this.getPoint(0),i=0;for(r.push(0),t=1;t<=e;t++){var o=this.getPoint(t/e);i+=o.distanceTo(n),r.push(i),n=o}return this.cacheArcLengths=r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r=this.getLengths(),n=r.length;t=t||e*r[n-1];for(var i,o=0,s=n-1;o<=s;)if((i=r[e=Math.floor(o+(s-o)/2)]-t)<0)o=e+1;else{if(!(0<i)){s=e;break}s=e-1}return r[e=s]===t?e/(n-1):(e+(t-(o=r[e]))/(r[e+1]-o))/(n-1)},getTangent:function(e){var t=e-1e-4;return t<0&&(t=0),1<(e+=1e-4)&&(e=1),t=this.getPoint(t),this.getPoint(e).clone().sub(t).normalize()},getTangentAt:function(e){return e=this.getUtoTmapping(e),this.getTangent(e)},computeFrenetFrames:function(e,t){var r,n=new Se,i=[],o=[],s=[],a=new Se,c=new we;for(r=0;r<=e;r++){var u=r/e;i[r]=this.getTangentAt(u),i[r].normalize()}o[0]=new Se,s[0]=new Se,r=Number.MAX_VALUE,u=Math.abs(i[0].x);var h=Math.abs(i[0].y),l=Math.abs(i[0].z);for(u<=r&&(r=u,n.set(1,0,0)),h<=r&&(r=h,n.set(0,1,0)),l<=r&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],a),s[0].crossVectors(i[0],o[0]),r=1;r<=e;r++)o[r]=o[r-1].clone(),s[r]=s[r-1].clone(),a.crossVectors(i[r-1],i[r]),a.length()>Number.EPSILON&&(a.normalize(),n=Math.acos(po.clamp(i[r-1].dot(i[r]),-1,1)),o[r].applyMatrix4(c.makeRotationAxis(a,n))),s[r].crossVectors(i[r],o[r]);if(!0===t)for(n=Math.acos(po.clamp(o[0].dot(o[e]),-1,1)),n/=e,0<i[0].dot(a.crossVectors(o[0],o[e]))&&(n=-n),r=1;r<=e;r++)o[r].applyMatrix4(c.makeRotationAxis(i[r],n*r)),s[r].crossVectors(i[r],o[r]);return{tangents:i,normals:o,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),((rn.prototype=Object.create(tn.prototype)).constructor=rn).prototype.isEllipseCurve=!0,rn.prototype.getPoint=function(e,t){t=t||new H;for(var r=2*Math.PI,n=this.aEndAngle-this.aStartAngle,i=Math.abs(n)<Number.EPSILON;n<0;)n+=r;for(;r<n;)n-=r;n<Number.EPSILON&&(n=i?0:r),!0!==this.aClockwise||i||(n=n===r?-r:n-r),r=this.aStartAngle+e*n,e=this.aX+this.xRadius*Math.cos(r);var o=this.aY+this.yRadius*Math.sin(r);return 0!==this.aRotation&&(r=Math.cos(this.aRotation),n=Math.sin(this.aRotation),e=(i=e-this.aX)*r-(o-=this.aY)*n+this.aX,o=i*n+o*r+this.aY),t.set(e,o)},rn.prototype.copy=function(e){return tn.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},rn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},rn.prototype.fromJSON=function(e){return tn.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},((nn.prototype=Object.create(rn.prototype)).constructor=nn).prototype.isArcCurve=!0;var Oa=new Se,Pa=new on,Aa=new on,ja=new on;((sn.prototype=Object.create(tn.prototype)).constructor=sn).prototype.isCatmullRomCurve3=!0,sn.prototype.getPoint=function(e,t){t=t||new Se;var r=this.points,n=r.length;e*=n-(this.closed?0:1);var i=Math.floor(e);if(e-=i,this.closed?i+=0<i?0:(Math.floor(Math.abs(i)/n)+1)*n:0===e&&i===n-1&&(i=n-2,e=1),this.closed||0<i)var o=r[(i-1)%n];else Oa.subVectors(r[0],r[1]).add(r[0]),o=Oa;var s=r[i%n],a=r[(i+1)%n];if(r=this.closed||i+2<n?r[(i+2)%n]:(Oa.subVectors(r[n-1],r[n-2]).add(r[n-1]),Oa),"centripetal"===this.curveType||"chordal"===this.curveType){var c="chordal"===this.curveType?.5:.25;n=Math.pow(o.distanceToSquared(s),c),(i=Math.pow(s.distanceToSquared(a),c))<1e-4&&(i=1),n<1e-4&&(n=i),(c=Math.pow(a.distanceToSquared(r),c))<1e-4&&(c=i),Pa.initNonuniformCatmullRom(o.x,s.x,a.x,r.x,n,i,c),Aa.initNonuniformCatmullRom(o.y,s.y,a.y,r.y,n,i,c),ja.initNonuniformCatmullRom(o.z,s.z,a.z,r.z,n,i,c)}else"catmullrom"===this.curveType&&(Pa.initCatmullRom(o.x,s.x,a.x,r.x,this.tension),Aa.initCatmullRom(o.y,s.y,a.y,r.y,this.tension),ja.initCatmullRom(o.z,s.z,a.z,r.z,this.tension));return t.set(Pa.calc(e),Aa.calc(e),ja.calc(e)),t},sn.prototype.copy=function(e){tn.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++)this.points.push(e.points[t].clone());return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},sn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++)e.points.push(this.points[t].toArray());return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},sn.prototype.fromJSON=function(e){tn.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new Se).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},((hn.prototype=Object.create(tn.prototype)).constructor=hn).prototype.isCubicBezierCurve=!0,hn.prototype.getPoint=function(e,t){t=t||new H;var r=this.v0,n=this.v1,i=this.v2,o=this.v3;return t.set(un(e,r.x,n.x,i.x,o.x),un(e,r.y,n.y,i.y,o.y)),t},hn.prototype.copy=function(e){return tn.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},hn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},hn.prototype.fromJSON=function(e){return tn.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((ln.prototype=Object.create(tn.prototype)).constructor=ln).prototype.isCubicBezierCurve3=!0,ln.prototype.getPoint=function(e,t){t=t||new Se;var r=this.v0,n=this.v1,i=this.v2,o=this.v3;return t.set(un(e,r.x,n.x,i.x,o.x),un(e,r.y,n.y,i.y,o.y),un(e,r.z,n.z,i.z,o.z)),t},ln.prototype.copy=function(e){return tn.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},ln.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},ln.prototype.fromJSON=function(e){return tn.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((pn.prototype=Object.create(tn.prototype)).constructor=pn).prototype.isLineCurve=!0,pn.prototype.getPoint=function(e,t){return t=t||new H,1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t},pn.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},pn.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},pn.prototype.copy=function(e){return tn.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},pn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},pn.prototype.fromJSON=function(e){return tn.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((fn.prototype=Object.create(tn.prototype)).constructor=fn).prototype.isLineCurve3=!0,fn.prototype.getPoint=function(e,t){return t=t||new Se,1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t},fn.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},fn.prototype.copy=function(e){return tn.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},fn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},fn.prototype.fromJSON=function(e){return tn.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((dn.prototype=Object.create(tn.prototype)).constructor=dn).prototype.isQuadraticBezierCurve=!0,dn.prototype.getPoint=function(e,t){t=t||new H;var r=this.v0,n=this.v1,i=this.v2;return t.set(cn(e,r.x,n.x,i.x),cn(e,r.y,n.y,i.y)),t},dn.prototype.copy=function(e){return tn.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},dn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},dn.prototype.fromJSON=function(e){return tn.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((mn.prototype=Object.create(tn.prototype)).constructor=mn).prototype.isQuadraticBezierCurve3=!0,mn.prototype.getPoint=function(e,t){t=t||new Se;var r=this.v0,n=this.v1,i=this.v2;return t.set(cn(e,r.x,n.x,i.x),cn(e,r.y,n.y,i.y),cn(e,r.z,n.z,i.z)),t},mn.prototype.copy=function(e){return tn.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},mn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},mn.prototype.fromJSON=function(e){return tn.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((vn.prototype=Object.create(tn.prototype)).constructor=vn).prototype.isSplineCurve=!0,vn.prototype.getPoint=function(e,t){t=t||new H;var r=this.points,n=(r.length-1)*e;n-=e=Math.floor(n);var i=r[0===e?e:e-1],o=r[e],s=r[e>r.length-2?r.length-1:e+1];return r=r[e>r.length-3?r.length-1:e+2],t.set(an(n,i.x,o.x,s.x,r.x),an(n,i.y,o.y,s.y,r.y)),t},vn.prototype.copy=function(e){tn.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++)this.points.push(e.points[t].clone());return this},vn.prototype.toJSON=function(){var e=tn.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++)e.points.push(this.points[t].toArray());return e},vn.prototype.fromJSON=function(e){tn.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new H).fromArray(n))}return this};var Ra=Object.freeze({ArcCurve:nn,CatmullRomCurve3:sn,CubicBezierCurve:hn,CubicBezierCurve3:ln,EllipseCurve:rn,LineCurve:pn,LineCurve3:fn,QuadraticBezierCurve:dn,QuadraticBezierCurve3:mn,SplineCurve:vn});gn.prototype=Object.assign(Object.create(tn.prototype),{constructor:gn,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new pn(t,e))},getPoint:function(e){var t=e*this.getLength(),r=this.getCurveLengths();for(e=0;e<r.length;){if(r[e]>=t)return t=r[e]-t,r=(e=this.curves[e]).getLength(),e.getPointAt(0===r?0:1-t/r);e++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,r=[],n=0,i=this.curves;n<i.length;n++){var o=i[n];o=o.getPoints(o&&o.isEllipseCurve?2*e:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e);for(var s=0;s<o.length;s++){var a=o[s];t&&t.equals(a)||(r.push(a),t=a)}}return this.autoClose&&1<r.length&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r},copy:function(e){tn.prototype.copy.call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++)this.curves.push(e.curves[t].clone());return this.autoClose=e.autoClose,this},toJSON:function(){var e=tn.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++)e.curves.push(this.curves[t].toJSON());return e},fromJSON:function(e){tn.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var n=e.curves[t];this.curves.push((new Ra[n.type]).fromJSON(n))}return this}}),yn.prototype=Object.assign(Object.create(gn.prototype),{constructor:yn,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var r=new pn(this.currentPoint.clone(),new H(e,t));this.curves.push(r),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,r,n){e=new dn(this.currentPoint.clone(),new H(e,t),new H(r,n)),this.curves.push(e),this.currentPoint.set(r,n)},bezierCurveTo:function(e,t,r,n,i,o){e=new hn(this.currentPoint.clone(),new H(e,t),new H(r,n),new H(i,o)),this.curves.push(e),this.currentPoint.set(i,o)},splineThru:function(e){var t=[this.currentPoint.clone()].concat(e);t=new vn(t),this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,r,n,i,o){this.absarc(e+this.currentPoint.x,t+this.currentPoint.y,r,n,i,o)},absarc:function(e,t,r,n,i,o){this.absellipse(e,t,r,r,n,i,o)},ellipse:function(e,t,r,n,i,o,s,a){this.absellipse(e+this.currentPoint.x,t+this.currentPoint.y,r,n,i,o,s,a)},absellipse:function(e,t,r,n,i,o,s,a){e=new rn(e,t,r,n,i,o,s,a),0<this.curves.length&&((t=e.getPoint(0)).equals(this.currentPoint)||this.lineTo(t.x,t.y)),this.curves.push(e),e=e.getPoint(1),this.currentPoint.copy(e)},copy:function(e){return gn.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=gn.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return gn.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),_n.prototype=Object.assign(Object.create(yn.prototype),{constructor:_n,getPointsHoles:function(e){for(var t=[],r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){yn.prototype.copy.call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++)this.holes.push(e.holes[t].clone());return this},toJSON:function(){var e=yn.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++)e.holes.push(this.holes[t].toJSON());return e},fromJSON:function(e){yn.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var n=e.holes[t];this.holes.push((new yn).fromJSON(n))}return this}}),bn.prototype=Object.assign(Object.create(h.prototype),{constructor:bn,isLight:!0,copy:function(e){return h.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){return(e=h.prototype.toJSON.call(this,e)).object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),xn.prototype=Object.assign(Object.create(bn.prototype),{constructor:xn,isHemisphereLight:!0,copy:function(e){return bn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(wn.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Sn.prototype=Object.assign(Object.create(wn.prototype),{constructor:Sn,isSpotLightShadow:!0,update:function(e){var t=this.camera,r=2*po.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height;e=e.distance||t.far,r===t.fov&&n===t.aspect&&e===t.far||(t.fov=r,t.aspect=n,t.far=e,t.updateProjectionMatrix())}}),Mn.prototype=Object.assign(Object.create(bn.prototype),{constructor:Mn,isSpotLight:!0,copy:function(e){return bn.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Cn.prototype=Object.assign(Object.create(bn.prototype),{constructor:Cn,isPointLight:!0,copy:function(e){return bn.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),En.prototype=Object.assign(Object.create(wn.prototype),{constructor:En}),Tn.prototype=Object.assign(Object.create(bn.prototype),{constructor:Tn,isDirectionalLight:!0,copy:function(e){return bn.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),On.prototype=Object.assign(Object.create(bn.prototype),{constructor:On,isAmbientLight:!0}),Pn.prototype=Object.assign(Object.create(bn.prototype),{constructor:Pn,isRectAreaLight:!0,copy:function(e){return bn.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){return(e=bn.prototype.toJSON.call(this,e)).object.width=this.width,e.object.height=this.height,e}});var La={arraySlice:function(e,t,r){return La.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==r?r:e.length)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(r){for(var e=r.length,t=Array(e),n=0;n!==e;++n)t[n]=n;return t.sort(function(e,t){return r[e]-r[t]}),t},sortedArray:function(e,t,r){for(var n=e.length,i=new e.constructor(n),o=0,s=0;s!==n;++o)for(var a=r[o]*t,c=0;c!==t;++c)i[s++]=e[a+c];return i},flattenJSON:function(e,t,r,n){for(var i=1,o=e[0];void 0!==o&&void 0===o[n];)o=e[i++];if(void 0!==o){var s=o[n];if(void 0!==s)if(Array.isArray(s))for(;void 0!==(s=o[n])&&(t.push(o.time),r.push.apply(r,s)),void 0!==(o=e[i++]););else if(void 0!==s.toArray)for(;void 0!==(s=o[n])&&(t.push(o.time),s.toArray(r,r.length)),void 0!==(o=e[i++]););else for(;void 0!==(s=o[n])&&(t.push(o.time),r.push(s)),void 0!==(o=e[i++]););}}};Object.assign(An.prototype,{evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,n=t[r],i=t[r-1];e:{t:{r:{n:if(!(e<n)){for(var o=r+2;;){if(void 0===n){if(e<i)break n;return this._cachedIndex=r=t.length,this.afterEnd_(r-1,e,i)}if(r===o)break;if(i=n,e<(n=t[++r]))break t}n=t.length;break r}if(i<=e)break e;for(e<(o=t[1])&&(r=2,i=o),o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===o)break;if(n=i,(i=t[--r-1])<=e)break t}n=r,r=0}for(;r<n;)e<t[i=r+n>>>1]?n=i:r=i+1;if(n=t[r],void 0===(i=t[r-1]))return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return this._cachedIndex=r=t.length,this.afterEnd_(r-1,i,e)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize;e*=n;for(var i=0;i!==n;++i)t[i]=r[e+i];return t},interpolate_:function(){throw Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(An.prototype,{beforeStart_:An.prototype.copySampleValue_,afterEnd_:An.prototype.copySampleValue_}),jn.prototype=Object.assign(Object.create(An.prototype),{constructor:jn,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,r){var n=this.parameterPositions,i=e-2,o=e+1,s=n[i],a=n[o];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:i=e,s=2*t-r;break;case 2402:s=t+n[i=n.length-2]-n[i+1];break;default:i=e,s=r}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:o=e,a=2*r-t;break;case 2402:a=r+n[o=1]-n[0];break;default:o=e-1,a=t}e=.5*(r-t),n=this.valueSize,this._weightPrev=e/(t-s),this._weightNext=e/(a-r),this._offsetPrev=i*n,this._offsetNext=o*n},interpolate_:function(e,t,r,n){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(e*=s)-s,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,l=this._weightNext,p=(r-t)/(n-t);for(t=-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]=t*o[c+r]+h*o[a+r]+p*o[e+r]+l*o[u+r];return i}}),Rn.prototype=Object.assign(Object.create(An.prototype),{constructor:Rn,interpolate_:function(e,t,r,n){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(e*=s)-s;for(r=1-(t=(r-t)/(n-t)),n=0;n!==s;++n)i[n]=o[a+n]*r+o[e+n]*t;return i}}),Ln.prototype=Object.assign(Object.create(An.prototype),{constructor:Ln,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Nn,{toJSON:function(e){var t=e.constructor;if(void 0!==t.toJSON)t=t.toJSON(e);else{t={name:e.name,times:La.convertArray(e.times,Array),values:La.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(Nn.prototype,{constructor:Nn,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new Ln(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Rn(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new jn(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){switch(e){case 2300:var t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)return this.createInterpolant=t,this;if(t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,n=r.length,i=0,o=n-1;i!==n&&r[i]<e;)++i;for(;-1!==o&&r[o]>t;)--o;return++o,0===i&&o===n||(o<=i&&(i=(o=Math.max(o,1))-1),e=this.getValueSize(),this.times=La.arraySlice(r,i,o),this.values=La.arraySlice(this.values,i*e,o*e)),this},validate:function(){var e=!0,t=this.getValueSize();0!=t-Math.floor(t)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var r=this.times;t=this.values;var n=r.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var i=null,o=0;o!==n;o++){var s=r[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==i&&s<i){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,i),e=!1;break}i=s}if(void 0!==t&&La.isTypedArray(t))for(o=0,r=t.length;o!==r;++o)if(n=t[o],isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,n),e=!1;break}return e},optimize:function(){for(var e=this.times,t=this.values,r=this.getValueSize(),n=2302===this.getInterpolation(),i=1,o=e.length-1,s=1;s<o;++s){var a=!1,c=e[s];if(c!==e[s+1]&&(1!==s||c!==c[0]))if(n)a=!0;else{var u=s*r,h=u-r,l=u+r;for(c=0;c!==r;++c){var p=t[u+c];if(p!==t[h+c]||p!==t[l+c]){a=!0;break}}}if(a){if(s!==i)for(e[i]=e[s],a=s*r,u=i*r,c=0;c!==r;++c)t[u+c]=t[a+c];++i}}if(0<o){for(e[i]=e[o],a=o*r,u=i*r,c=0;c!==r;++c)t[u+c]=t[a+c];++i}return i!==e.length&&(this.times=La.arraySlice(e,0,i),this.values=La.arraySlice(t,0,i*r)),this}}),In.prototype=Object.assign(Object.create(Nn.prototype),{constructor:In,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Dn.prototype=Object.assign(Object.create(Nn.prototype),{constructor:Dn,ValueTypeName:"color"}),kn.prototype=Object.assign(Object.create(Nn.prototype),{constructor:kn,ValueTypeName:"number"}),Bn.prototype=Object.assign(Object.create(An.prototype),{constructor:Bn,interpolate_:function(e,t,r,n){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize;for(t=(r-t)/(n-t),r=(e*=s)+s;e!==r;e+=4)a.slerpFlat(i,0,o,e-s,o,e,t);return i}}),Fn.prototype=Object.assign(Object.create(Nn.prototype),{constructor:Fn,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Bn(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),$n.prototype=Object.assign(Object.create(Nn.prototype),{constructor:$n,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Un.prototype=Object.assign(Object.create(Nn.prototype),{constructor:Un,ValueTypeName:"vector"}),Object.assign(zn,{parse:function(e){for(var t=[],r=e.tracks,n=1/(e.fps||1),i=0,o=r.length;i!==o;++i)t.push(Gn(r[i]).scale(n));return new zn(e.name,e.duration,t)},toJSON:function(e){var t=[],r=e.tracks;e={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid};for(var n=0,i=r.length;n!==i;++n)t.push(Nn.toJSON(r[n]));return e},CreateFromMorphTargetSequence:function(e,t,r,n){for(var i=t.length,o=[],s=0;s<i;s++){var a=[],c=[];a.push((s+i-1)%i,s,(s+1)%i),c.push(0,1,0);var u=La.getKeyframeOrder(a);a=La.sortedArray(a,1,u),c=La.sortedArray(c,1,u),n||0!==a[0]||(a.push(i),c.push(c[0])),o.push(new kn(".morphTargetInfluences["+t[s].name+"]",a,c).scale(1/r))}return new zn(e,-1,o)},findByName:function(e,t){var r=e;for(Array.isArray(e)||(r=e.geometry&&e.geometry.animations||e.animations),e=0;e<r.length;e++)if(r[e].name===t)return r[e];return null},CreateClipsFromMorphTargetSequences:function(e,t,r){for(var n={},i=/^([\w-]*?)([\d]+)$/,o=0,s=e.length;o<s;o++){var a=e[o],c=a.name.match(i);if(c&&1<c.length){var u=c[1];(c=n[u])||(n[u]=c=[]),c.push(a)}}for(u in e=[],n)e.push(zn.CreateFromMorphTargetSequence(u,n[u],t,r));return e},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;var r=function(e,t,r,n,i){if(0!==r.length){var o=[],s=[];La.flattenJSON(r,o,s,n),0!==o.length&&i.push(new e(t,o,s))}},n=[],i=e.name||"default",o=e.length||-1,s=e.fps||30;e=e.hierarchy||[];for(var a=0;a<e.length;a++){var c=e[a].keys;if(c&&0!==c.length)if(c[0].morphTargets){o={};for(var u=0;u<c.length;u++)if(c[u].morphTargets)for(var h=0;h<c[u].morphTargets.length;h++)o[c[u].morphTargets[h]]=-1;for(var l in o){var p=[],f=[];for(h=0;h!==c[u].morphTargets.length;++h){var d=c[u];p.push(d.time),f.push(d.morphTarget===l?1:0)}n.push(new kn(".morphTargetInfluence["+l+"]",p,f))}o=o.length*(s||1)}else r(Un,(u=".bones["+t[a].name+"]")+".position",c,"pos",n),r(Fn,u+".quaternion",c,"rot",n),r(Un,u+".scale",c,"scl",n)}return 0===n.length?null:new zn(i,o,n)}}),Object.assign(zn.prototype,{resetDuration:function(){for(var e=0,t=0,r=this.tracks.length;t!==r;++t){var n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}}),Object.assign(Vn.prototype,{load:function(e,t,r,n){var i=this;new Yr(i.manager).load(e,function(e){t(i.parse(JSON.parse(e)))},r,n)},setTextures:function(e){this.textures=e},parse:function(e){function t(e){return void 0===r[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),r[e]}var r=this.textures,n=new Ma[e.type];if(void 0!==e.uuid&&(n.uuid=e.uuid),void 0!==e.name&&(n.name=e.name),void 0!==e.color&&n.color.setHex(e.color),void 0!==e.roughness&&(n.roughness=e.roughness),void 0!==e.metalness&&(n.metalness=e.metalness),void 0!==e.emissive&&n.emissive.setHex(e.emissive),void 0!==e.specular&&n.specular.setHex(e.specular),void 0!==e.shininess&&(n.shininess=e.shininess),void 0!==e.clearCoat&&(n.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(n.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.uniforms&&(n.uniforms=e.uniforms),void 0!==e.vertexShader&&(n.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(n.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(n.vertexColors=e.vertexColors),void 0!==e.fog&&(n.fog=e.fog),void 0!==e.flatShading&&(n.flatShading=e.flatShading),void 0!==e.blending&&(n.blending=e.blending),void 0!==e.side&&(n.side=e.side),void 0!==e.opacity&&(n.opacity=e.opacity),void 0!==e.transparent&&(n.transparent=e.transparent),void 0!==e.alphaTest&&(n.alphaTest=e.alphaTest),void 0!==e.depthTest&&(n.depthTest=e.depthTest),void 0!==e.depthWrite&&(n.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(n.colorWrite=e.colorWrite),void 0!==e.wireframe&&(n.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(n.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(n.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(n.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(n.rotation=e.rotation),1!==e.linewidth&&(n.linewidth=e.linewidth),void 0!==e.dashSize&&(n.dashSize=e.dashSize),void 0!==e.gapSize&&(n.gapSize=e.gapSize),void 0!==e.scale&&(n.scale=e.scale),void 0!==e.polygonOffset&&(n.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(n.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(n.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(n.skinning=e.skinning),void 0!==e.morphTargets&&(n.morphTargets=e.morphTargets),void 0!==e.dithering&&(n.dithering=e.dithering),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.shading&&(n.flatShading=1===e.shading),void 0!==e.size&&(n.size=e.size),void 0!==e.sizeAttenuation&&(n.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(n.map=t(e.map)),void 0!==e.alphaMap&&(n.alphaMap=t(e.alphaMap),n.transparent=!0),void 0!==e.bumpMap&&(n.bumpMap=t(e.bumpMap)),void 0!==e.bumpScale&&(n.bumpScale=e.bumpScale),void 0!==e.normalMap&&(n.normalMap=t(e.normalMap)),void 0!==e.normalMapType&&(n.normalMapType=e.normalMapType),void 0!==e.normalScale){var i=e.normalScale;!1===Array.isArray(i)&&(i=[i,i]),n.normalScale=(new H).fromArray(i)}return void 0!==e.displacementMap&&(n.displacementMap=t(e.displacementMap)),void 0!==e.displacementScale&&(n.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(n.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(n.roughnessMap=t(e.roughnessMap)),void 0!==e.metalnessMap&&(n.metalnessMap=t(e.metalnessMap)),void 0!==e.emissiveMap&&(n.emissiveMap=t(e.emissiveMap)),void 0!==e.emissiveIntensity&&(n.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(n.specularMap=t(e.specularMap)),void 0!==e.envMap&&(n.envMap=t(e.envMap)),void 0!==e.reflectivity&&(n.reflectivity=e.reflectivity),void 0!==e.lightMap&&(n.lightMap=t(e.lightMap)),void 0!==e.lightMapIntensity&&(n.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(n.aoMap=t(e.aoMap)),void 0!==e.aoMapIntensity&&(n.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(n.gradientMap=t(e.gradientMap)),n}}),Object.assign(Hn.prototype,{load:function(e,t,r,n){var i=this;new Yr(i.manager).load(e,function(e){t(i.parse(JSON.parse(e)))},r,n)},parse:function(e){var t=new A,r=e.data.index;void 0!==r&&(r=new Ba[r.type](r.array),t.setIndex(new y(r,1)));var n=e.data.attributes;for(o in n){var i=n[o];r=new Ba[i.type](i.array),t.addAttribute(o,new y(r,i.itemSize,i.normalized))}var o=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==o)for(r=0,n=o.length;r!==n;++r)i=o[r],t.addGroup(i.start,i.count,i.materialIndex);return void 0!==(e=e.data.boundingSphere)&&(o=new Se,void 0!==e.center&&o.fromArray(e.center),t.boundingSphere=new s(o,e.radius)),t}});var Na,Ia,Da,ka,Ba={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};qn.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,n=t.length;r<n;r+=2){var i=t[r+1];if(t[r].test(e))return i}return null}},Object.assign(qn.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,r){for(var n=[],i=0;i<e.length;++i)n[i]=this.createMaterial(e[i],t,r);return n},createMaterial:(Na={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},Ia=new w,Da=new en,ka=new Vn,function(e,s,a){function t(e,t,r,n,i){e=s+e;var o=qn.Handlers.get(e);return e=null!==o?o.load(e):(Da.setCrossOrigin(a),Da.load(e)),void 0!==t&&(e.repeat.fromArray(t),1!==t[0]&&(e.wrapS=1e3),1!==t[1]&&(e.wrapT=1e3)),void 0!==r&&e.offset.fromArray(r),void 0!==n&&("repeat"===n[0]&&(e.wrapS=1e3),"mirror"===n[0]&&(e.wrapS=1002),"repeat"===n[1]&&(e.wrapT=1e3),"mirror"===n[1]&&(e.wrapT=1002)),void 0!==i&&(e.anisotropy=i),t=po.generateUUID(),c[t]=e,t}var r,c={},n={uuid:po.generateUUID(),type:"MeshLambertMaterial"};for(r in e){var i=e[r];switch(r){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":n.name=i;break;case"blending":n.blending=Na[i];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",r,"is no longer supported.");break;case"colorDiffuse":n.color=Ia.fromArray(i).getHex();break;case"colorSpecular":n.specular=Ia.fromArray(i).getHex();break;case"colorEmissive":n.emissive=Ia.fromArray(i).getHex();break;case"specularCoef":n.shininess=i;break;case"shading":"basic"===i.toLowerCase()&&(n.type="MeshBasicMaterial"),"phong"===i.toLowerCase()&&(n.type="MeshPhongMaterial"),"standard"===i.toLowerCase()&&(n.type="MeshStandardMaterial");break;case"mapDiffuse":n.map=t(i,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":n.emissiveMap=t(i,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":n.lightMap=t(i,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":n.aoMap=t(i,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":n.bumpMap=t(i,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":n.bumpScale=i;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":n.normalMap=t(i,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":n.normalScale=i;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":n.specularMap=t(i,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":n.metalnessMap=t(i,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":n.roughnessMap=t(i,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":n.alphaMap=t(i,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":n.side=1;break;case"doubleSided":n.side=2;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),n.opacity=i;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":n[r]=i;break;case"vertexColors":!0===i&&(n.vertexColors=2),"face"===i&&(n.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",r,i)}}return"MeshBasicMaterial"===n.type&&delete n.emissive,"MeshPhongMaterial"!==n.type&&delete n.specular,n.opacity<1&&(n.transparent=!0),ka.setTextures(c),ka.parse(n)})});var Fa={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);return decodeURIComponent(escape(t))},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};Object.assign(Wn.prototype,{crossOrigin:"anonymous",load:function(r,n,e,t){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Fa.extractUrlBase(r),s=new Yr(this.manager);s.setWithCredentials(this.withCredentials),s.load(r,function(e){var t=(e=JSON.parse(e)).metadata;void 0===t||(void 0===(t=t.type)||"object"!==t.toLowerCase())?(e=i.parse(e,o),n(e.geometry,e.materials)):console.error("THREE.JSONLoader: "+r+" should be loaded with THREE.ObjectLoader instead.")},e,t)},setCrossOrigin:function(e){return this.crossOrigin=e,this},setTexturePath:function(e){return this.texturePath=e,this},parse:function(e,t){void 0!==e.data&&(e=e.data),e.scale=void 0!==e.scale?1/e.scale:1;var r,n,i,o=new S,s=e,a=s.faces,c=s.vertices,u=s.normals,h=s.colors,l=s.scale,p=0;if(void 0!==s.uvs){for(r=0;r<s.uvs.length;r++)s.uvs[r].length&&p++;for(r=0;r<p;r++)o.faceVertexUvs[r]=[]}var f=0;for(i=c.length;f<i;)(r=new Se).x=c[f++]*l,r.y=c[f++]*l,r.z=c[f++]*l,o.vertices.push(r);for(f=0,i=a.length;f<i;){var d=1&(c=a[f++]),m=2&c;r=8&c;var v=16&c,g=32&c;if(l=64&c,c&=128,d){(d=new k).a=a[f],d.b=a[f+1],d.c=a[f+3];var y=new k;if(y.a=a[f+1],y.b=a[f+2],y.c=a[f+3],f+=4,m&&(m=a[f++],d.materialIndex=m,y.materialIndex=m),m=o.faces.length,r)for(r=0;r<p;r++){var _=s.uvs[r];for(o.faceVertexUvs[r][m]=[],o.faceVertexUvs[r][m+1]=[],n=0;n<4;n++){var b=a[f++],x=_[2*b];x=new H(x,b=_[2*b+1]),2!==n&&o.faceVertexUvs[r][m].push(x),0!==n&&o.faceVertexUvs[r][m+1].push(x)}}if(v&&(v=3*a[f++],d.normal.set(u[v++],u[v++],u[v]),y.normal.copy(d.normal)),g)for(r=0;r<4;r++)v=3*a[f++],g=new Se(u[v++],u[v++],u[v]),2!==r&&d.vertexNormals.push(g),0!==r&&y.vertexNormals.push(g);if(l&&(l=h[l=a[f++]],d.color.setHex(l),y.color.setHex(l)),c)for(r=0;r<4;r++)l=h[l=a[f++]],2!==r&&d.vertexColors.push(new w(l)),0!==r&&y.vertexColors.push(new w(l));o.faces.push(d),o.faces.push(y)}else{if((d=new k).a=a[f++],d.b=a[f++],d.c=a[f++],m&&(m=a[f++],d.materialIndex=m),m=o.faces.length,r)for(r=0;r<p;r++)for(_=s.uvs[r],o.faceVertexUvs[r][m]=[],n=0;n<3;n++)x=new H(x=_[2*(b=a[f++])],b=_[2*b+1]),o.faceVertexUvs[r][m].push(x);if(v&&(v=3*a[f++],d.normal.set(u[v++],u[v++],u[v])),g)for(r=0;r<3;r++)v=3*a[f++],g=new Se(u[v++],u[v++],u[v]),d.vertexNormals.push(g);if(l&&(l=a[f++],d.color.setHex(h[l])),c)for(r=0;r<3;r++)l=a[f++],d.vertexColors.push(new w(h[l]));o.faces.push(d)}}if(f=void 0!==(s=e).influencesPerVertex?s.influencesPerVertex:2,s.skinWeights)for(i=0,a=s.skinWeights.length;i<a;i+=f)o.skinWeights.push(new Me(s.skinWeights[i],1<f?s.skinWeights[i+1]:0,2<f?s.skinWeights[i+2]:0,3<f?s.skinWeights[i+3]:0));if(s.skinIndices)for(i=0,a=s.skinIndices.length;i<a;i+=f)o.skinIndices.push(new Me(s.skinIndices[i],1<f?s.skinIndices[i+1]:0,2<f?s.skinIndices[i+2]:0,3<f?s.skinIndices[i+3]:0));if(o.bones=s.bones,o.bones&&0<o.bones.length&&(o.skinWeights.length!==o.skinIndices.length||o.skinIndices.length!==o.vertices.length)&&console.warn("When skinning, number of vertices ("+o.vertices.length+"), skinIndices ("+o.skinIndices.length+"), and skinWeights ("+o.skinWeights.length+") should match."),a=(i=e).scale,void 0!==i.morphTargets)for(s=0,f=i.morphTargets.length;s<f;s++)for(o.morphTargets[s]={},o.morphTargets[s].name=i.morphTargets[s].name,o.morphTargets[s].vertices=[],u=o.morphTargets[s].vertices,p=0,c=(h=i.morphTargets[s].vertices).length;p<c;p+=3)(l=new Se).x=h[p]*a,l.y=h[p+1]*a,l.z=h[p+2]*a,u.push(l);if(void 0!==i.morphColors&&0<i.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),a=o.faces,i=i.morphColors[0].colors,s=0,f=a.length;s<f;s++)a[s].color.fromArray(i,3*s);for(s=[],f=[],void 0!==(i=e).animation&&f.push(i.animation),void 0!==i.animations&&(i.animations.length?f=f.concat(i.animations):f.push(i.animations)),i=0;i<f.length;i++)(a=zn.parseAnimation(f[i],o.bones))&&s.push(a);return o.morphTargets&&(f=zn.CreateClipsFromMorphTargetSequences(o.morphTargets,10),s=s.concat(f)),0<s.length&&(o.animations=s),o.computeFaceNormals(),o.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:o}:{geometry:o,materials:e=qn.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}),Object.assign(Xn.prototype,{crossOrigin:"anonymous",load:function(r,n,e,i){""===this.texturePath&&(this.texturePath=r.substring(0,r.lastIndexOf("/")+1));var o=this;new Yr(o.manager).load(r,function(e){var t=null;try{t=JSON.parse(e)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+r+".",e.message)}void 0===(e=t.metadata)||void 0===e.type||"geometry"===e.type.toLowerCase()?console.error("THREE.ObjectLoader: Can't load "+r+". Use THREE.JSONLoader instead."):o.parse(t,n)},e,i)},setTexturePath:function(e){return this.texturePath=e,this},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){var r=this.parseShape(e.shapes);r=this.parseGeometries(e.geometries,r);var n=this.parseImages(e.images,function(){void 0!==t&&t(i)});n=this.parseTextures(e.textures,n),n=this.parseMaterials(e.materials,n);var i=this.parseObject(e.object,r,n);return e.animations&&(i.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0===t||t(i),i},parseShape:function(e){var t={};if(void 0!==e)for(var r=0,n=e.length;r<n;r++){var i=(new _n).fromJSON(e[r]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var r={};if(void 0!==e)for(var n=new Wn,i=new Hn,o=0,s=e.length;o<s;o++){var a=e[o];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":var c=new Sa[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":c=new Sa[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":c=new Sa[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":c=new Sa[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":c=new Sa[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":c=new Sa[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":c=new Sa[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":c=new Sa[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":c=new Sa[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":c=new Sa[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"LatheGeometry":case"LatheBufferGeometry":c=new Sa[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":c=new Sa[a.type](a.vertices,a.indices,a.radius,a.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":c=[];for(var u=0,h=a.shapes.length;u<h;u++){var l=t[a.shapes[u]];c.push(l)}c=new Sa[a.type](c,a.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],u=0,h=a.shapes.length;u<h;u++)l=t[a.shapes[u]],c.push(l);void 0!==(u=a.options.extrudePath)&&(a.options.extrudePath=(new Ra[u.type]).fromJSON(u)),c=new Sa[a.type](c,a.options);break;case"BufferGeometry":c=i.parse(a);break;case"Geometry":c=n.parse(a,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+a.type+'"');continue}c.uuid=a.uuid,void 0!==a.name&&(c.name=a.name),!0===c.isBufferGeometry&&void 0!==a.userData&&(c.userData=a.userData),r[a.uuid]=c}return r},parseMaterials:function(e,t){var r={};if(void 0!==e){var n=new Vn;n.setTextures(t),t=0;for(var i=e.length;t<i;t++){var o=e[t];if("MultiMaterial"===o.type){for(var s=[],a=0;a<o.materials.length;a++)s.push(n.parse(o.materials[a]));r[o.uuid]=s}else r[o.uuid]=n.parse(o)}}return r},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],i=zn.parse(n);void 0!==n.uuid&&(i.uuid=n.uuid),t.push(i)}return t},parseImages:function(e,t){function r(e){return n.manager.itemStart(e),o.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemEnd(e),n.manager.itemError(e)})}var n=this,i={};if(void 0!==e&&0<e.length){var o=new Jr(t=new Xr(t));o.setCrossOrigin(this.crossOrigin),t=0;for(var s=e.length;t<s;t++){var a=e[t],c=a.url;if(Array.isArray(c)){i[a.uuid]=[];for(var u=0,h=c.length;u<h;u++){var l=c[u];l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:n.texturePath+l,i[a.uuid].push(r(l))}}else l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a.url)?a.url:n.texturePath+a.url,i[a.uuid]=r(l)}}return i},parseTextures:function(e,t){function r(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var n={};if(void 0!==e)for(var i=0,o=e.length;i<o;i++){var s=e[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var a=Array.isArray(t[s.image])?new z(t[s.image]):new p(t[s.image]);a.needsUpdate=!0,a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.mapping&&(a.mapping=r(s.mapping,$a)),void 0!==s.offset&&a.offset.fromArray(s.offset),void 0!==s.repeat&&a.repeat.fromArray(s.repeat),void 0!==s.center&&a.center.fromArray(s.center),void 0!==s.rotation&&(a.rotation=s.rotation),void 0!==s.wrap&&(a.wrapS=r(s.wrap[0],Ua),a.wrapT=r(s.wrap[1],Ua)),void 0!==s.format&&(a.format=s.format),void 0!==s.minFilter&&(a.minFilter=r(s.minFilter,za)),void 0!==s.magFilter&&(a.magFilter=r(s.magFilter,za)),void 0!==s.anisotropy&&(a.anisotropy=s.anisotropy),void 0!==s.flipY&&(a.flipY=s.flipY),n[s.uuid]=a}return n},parseObject:function(e,t,o){function r(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function n(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];void 0===o[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),t.push(o[i])}return t}return void 0===o[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),o[e]}}switch(e.type){case"Scene":var i=new gt;void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new w(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new vt(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new mt(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new ht(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new f(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new On(e.color,e.intensity);break;case"DirectionalLight":i=new Tn(e.color,e.intensity);break;case"PointLight":i=new Cn(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new Pn(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new Mn(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new xn(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":i=r(e.geometry);var s=n(e.material);i=i.bones&&0<i.bones.length?new Ct(i,s):new $(i,s);break;case"LOD":i=new wt;break;case"Line":i=new Tt(r(e.geometry),n(e.material),e.mode);break;case"LineLoop":i=new Pt(r(e.geometry),n(e.material));break;case"LineSegments":i=new Ot(r(e.geometry),n(e.material));break;case"PointCloud":case"Points":i=new jt(r(e.geometry),n(e.material));break;case"Sprite":i=new xt(n(e.material));break;case"Group":i=new ut;break;default:i=new h}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children){s=e.children;for(var a=0;a<s.length;a++)i.add(this.parseObject(s[a],t,o))}if("LOD"===e.type)for(e=e.levels,s=0;s<e.length;s++){a=e[s];var c=i.getObjectByProperty("uuid",a.object);void 0!==c&&i.addLevel(c,a.distance)}return i}});var $a={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Ua={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},za={NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008};Yn.prototype={constructor:Yn,setOptions:function(e){return this.options=e,this},load:function(t,r,e,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,o=Ca.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){r&&r(o),i.manager.itemEnd(t)},0),o;fetch(t).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,i.options)}).then(function(e){Ca.add(t,e),r&&r(e),i.manager.itemEnd(t)}).catch(function(e){n&&n(e),i.manager.itemEnd(t),i.manager.itemError(t)})},setCrossOrigin:function(){return this},setPath:function(e){return this.path=e,this}},Object.assign(Kn.prototype,{moveTo:function(e,t){this.currentPath=new yn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,r,n){this.currentPath.quadraticCurveTo(e,t,r,n)},bezierCurveTo:function(e,t,r,n,i,o){this.currentPath.bezierCurveTo(e,t,r,n,i,o)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function r(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r],o=new _n;o.curves=i.curves,t.push(o)}return t}function n(e,t){for(var r=t.length,n=!1,i=r-1,o=0;o<r;i=o++){var s=t[i],a=t[o],c=a.x-s.x,u=a.y-s.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(s=t[o],c=-c,a=t[i],u=-u),!(e.y<s.y||e.y>a.y))if(e.y===s.y){if(e.x===s.x)return!0}else{if(0===(i=u*(e.x-s.x)-c*(e.y-s.y)))return!0;i<0||(n=!n)}}else if(e.y===s.y&&(a.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=a.x))return!0}return n}var i=xa.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return r(o);if(t=[],1===o.length){var s=o[0],a=new _n;return a.curves=s.curves,t.push(a),t}var c=!i(o[0].getPoints());c=e?!c:c,a=[];var u=[],h=[],l=0;u[l]=void 0,h[l]=[];for(var p=0,f=o.length;p<f;p++){var d=(s=o[p]).getPoints(),m=i(d);(m=e?!m:m)?(!c&&u[l]&&l++,u[l]={s:new _n,p:d},u[l].s.curves=s.curves,c&&l++,h[l]=[]):h[l].push({h:s,p:d[0]})}if(!u[0])return r(o);if(1<u.length){for(p=!1,e=[],i=0,o=u.length;i<o;i++)a[i]=[];for(i=0,o=u.length;i<o;i++)for(s=h[i],m=0;m<s.length;m++){for(c=s[m],l=!0,d=0;d<u.length;d++)n(c.p,u[d].p)&&(i!==d&&e.push({froms:i,tos:d,hole:m}),l?(l=!1,a[d].push(c)):p=!0);l&&a[i].push(c)}0<e.length&&(p||(h=a))}for(p=0,i=u.length;p<i;p++)for(a=u[p].s,t.push(a),o=0,s=(e=h[p]).length;o<s;o++)a.holes.push(e[o].h);return t}}),Object.assign(Zn.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);var r=[],n=t;t=this.data;var i=Array.from?Array.from(e):String(e).split("");n/=t.resolution;var o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n;e=[];for(var s=0,a=0,c=0;c<i.length;c++){var u=i[c];if("\n"===u)s=0,a-=o;else{var h=n,l=s,p=a;if(u=t.glyphs[u]||t.glyphs["?"]){var f=new Kn;if(u.o)for(var d=u._cachedOutline||(u._cachedOutline=u.o.split(" ")),m=0,v=d.length;m<v;)switch(d[m++]){case"m":var g=d[m++]*h+l,y=d[m++]*h+p;f.moveTo(g,y);break;case"l":g=d[m++]*h+l,y=d[m++]*h+p,f.lineTo(g,y);break;case"q":var _=d[m++]*h+l,b=d[m++]*h+p,x=d[m++]*h+l,w=d[m++]*h+p;f.quadraticCurveTo(x,w,_,b);break;case"b":_=d[m++]*h+l,b=d[m++]*h+p,x=d[m++]*h+l,w=d[m++]*h+p,g=d[m++]*h+l,y=d[m++]*h+p,f.bezierCurveTo(x,w,g,y,_,b)}h={offsetX:u.ha*h,path:f}}else h=void 0;s+=h.offsetX,e.push(h.path)}}for(t=0,i=e.length;t<i;t++)Array.prototype.push.apply(r,e[t].toShapes());return r}}),Object.assign(Jn.prototype,{load:function(e,n,t,r){var i=this,o=new Yr(this.manager);o.setPath(this.path),o.load(e,function(t){try{var r=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(t.substring(65,t.length-2))}t=i.parse(r),n&&n(t)},t,r)},parse:function(e){return new Zn(e)},setPath:function(e){return this.path=e,this}});var Ga,Va,Ha,qa,Wa,Xa,Ya,Ka,Za,Ja,Qa,ec,tc,rc,nc,ic,oc,sc,ac,cc,uc,hc,lc,pc,fc,dc,mc,vc,gc,yc,_c,bc,xc,wc,Sc,Mc,Cc,Ec,Tc,Oc,Pc,Ac,jc,Rc,Lc,Nc,Ic,Dc={getContext:function(){return void 0===Ga&&(Ga=new(window.AudioContext||window.webkitAudioContext)),Ga},setContext:function(e){Ga=e}};Object.assign(Qn.prototype,{load:function(e,t,r,n){var i=new Yr(this.manager);i.setResponseType("arraybuffer"),i.load(e,function(e){e=e.slice(0),Dc.getContext().decodeAudioData(e,function(e){t(e)})},r,n)}}),Object.assign(ei.prototype,{update:(Ja=new we,Qa=new we,function(e){if(Va!==this||Ha!==e.focus||qa!==e.fov||Wa!==e.aspect*this.aspect||Xa!==e.near||Ya!==e.far||Ka!==e.zoom||Za!==this.eyeSep){Va=this,Ha=e.focus,qa=e.fov,Wa=e.aspect*this.aspect,Xa=e.near,Ya=e.far,Ka=e.zoom;var t=e.projectionMatrix.clone(),r=(Za=this.eyeSep/2)*Xa/Ha,n=Xa*Math.tan(po.DEG2RAD*qa*.5)/Ka;Qa.elements[12]=-Za,Ja.elements[12]=Za;var i=-n*Wa+r,o=n*Wa+r;t.elements[0]=2*Xa/(o-i),t.elements[8]=(o+i)/(o-i),this.cameraL.projectionMatrix.copy(t),i=-n*Wa-r,o=n*Wa-r,t.elements[0]=2*Xa/(o-i),t.elements[8]=(o+i)/(o-i),this.cameraR.projectionMatrix.copy(t)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Qa),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ja)})}),(ti.prototype=Object.create(h.prototype)).constructor=ti,ri.prototype=Object.assign(Object.create(h.prototype),{constructor:ri,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:(ec=new Se,tc=new a,rc=new Se,nc=new Se,function(e){h.prototype.updateMatrixWorld.call(this,e),e=this.context.listener;var t=this.up;this.matrixWorld.decompose(ec,tc,rc),nc.set(0,0,-1).applyQuaternion(tc),e.positionX?(e.positionX.setValueAtTime(ec.x,this.context.currentTime),e.positionY.setValueAtTime(ec.y,this.context.currentTime),e.positionZ.setValueAtTime(ec.z,this.context.currentTime),e.forwardX.setValueAtTime(nc.x,this.context.currentTime),e.forwardY.setValueAtTime(nc.y,this.context.currentTime),e.forwardZ.setValueAtTime(nc.z,this.context.currentTime),e.upX.setValueAtTime(t.x,this.context.currentTime),e.upY.setValueAtTime(t.y,this.context.currentTime),e.upZ.setValueAtTime(t.z,this.context.currentTime)):(e.setPosition(ec.x,ec.y,ec.z),e.setOrientation(nc.x,nc.y,nc.z,t.x,t.y,t.z))})}),ni.prototype=Object.assign(Object.create(h.prototype),{constructor:ni,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,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 e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),e.playbackRate.setValueAtTime(this.playbackRate,this.startTime),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,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.source.onended=null,this.offset=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 e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!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(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!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(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),ii.prototype=Object.assign(Object.create(ni.prototype),{constructor:ii,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this},updateMatrixWorld:(ic=new Se,oc=new a,sc=new Se,ac=new Se,function(e){h.prototype.updateMatrixWorld.call(this,e),e=this.panner,this.matrixWorld.decompose(ic,oc,sc),ac.set(0,0,1).applyQuaternion(oc),e.setPosition(ic.x,ic.y,ic.z),e.setOrientation(ac.x,ac.y,ac.z)})}),Object.assign(oi.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),r=0;r<t.length;r++)e+=t[r];return e/t.length}}),Object.assign(si.prototype,{accumulate:function(e,t){var r=this.buffer,n=this.valueSize;e=e*n+n;var i=this.cumulativeWeight;if(0===i){for(i=0;i!==n;++i)r[e+i]=r[i];i=t}else i+=t,this._mixBufferRegion(r,e,0,t/i,n);this.cumulativeWeight=i},apply:function(e){var t=this.valueSize,r=this.buffer;e=e*t+t;var n=this.cumulativeWeight,i=this.binding;this.cumulativeWeight=0,n<1&&this._mixBufferRegion(r,e,3*t,1-n,t);for(var o=(n=t)+t;n!==o;++n)if(r[n]!==r[n+t]){i.setValue(r,e);break}},saveOriginalState:function(){var e=this.buffer,t=this.valueSize,r=3*t;this.binding.getValue(e,r);for(var n=t;n!==r;++n)e[n]=e[r+n%t];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(e,t,r,n,i){if(.5<=n)for(n=0;n!==i;++n)e[t+n]=e[r+n]},_slerp:function(e,t,r,n){a.slerpFlat(e,t,e,t,e,r,n)},_lerp:function(e,t,r,n,i){for(var o=1-n,s=0;s!==i;++s){var a=t+s;e[a]=e[a]*o+e[r+s]*n}}}),Object.assign(ai.prototype,{getValue:function(e,t){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}),Object.assign(ci,{Composite:ai,create:function(e,t,r){return e&&e.isAnimationObjectGroup?new ci.Composite(e,t,r):new ci(e,t,r)},sanitizeNodeName:(cc=/[\[\]\.:\/]/g,function(e){return e.replace(/\s/g,"_").replace(cc,"")}),parseTrackName:function(){var e="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",t=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]");e=/(WCOD+)?/.source.replace("WCOD",e);var r=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),n=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),i=new RegExp("^"+t+e+r+n+"$"),o=["material","materials","bones"];return function(e){var t=i.exec(e);if(!t)throw Error("PropertyBinding: Cannot parse trackName: "+e);var r=(t={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]}).nodeName&&t.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var n=t.nodeName.substring(r+1);-1!==o.indexOf(n)&&(t.nodeName=t.nodeName.substring(0,r),t.objectName=n)}if(null===t.propertyName||0===t.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return t}}(),findNode:function(e,n){if(!n||""===n||"root"===n||"."===n||-1===n||n===e.name||n===e.uuid)return e;if(e.skeleton){var t=e.skeleton.getBoneByName(n);if(void 0!==t)return t}if(e.children){var i=function(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.name===n||r.uuid===n||(r=i(r.children)))return r}return null};if(e=i(e.children))return e}return null}}),Object.assign(ci.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)e[t++]=r[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,i=t.propertyIndex;if(e||(this.node=e=ci.findNode(this.rootNode,t.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var o=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);for(e=e.skeleton.bones,r=0;r<e.length;r++)if(e[r].name===o){o=r;break}break;default:if(void 0===e[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[r]}if(void 0!==o){if(void 0===e[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[o]}}if(void 0===(o=e[n]))console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+n+" but it wasn't found.",e);else{if(t=this.Versioning.None,void 0!==e.needsUpdate?(t=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(t=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e),r=this.BindingType.Direct,void 0!==i){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.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(e.geometry.morphAttributes.position[r].name===i){i=r;break}}else{if(!e.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(e.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][t]}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(ci.prototype,{_getValue_unbound:ci.prototype.getValue,_setValue_unbound:ci.prototype.setValue}),Object.assign(ui.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._paths,o=this._parsedPaths,s=this._bindings,a=s.length,c=void 0,u=0,h=arguments.length;u!==h;++u){var l=arguments[u],p=l.uuid,f=n[p];if(void 0===f){f=t++,n[p]=f,e.push(l),p=0;for(var d=a;p!==d;++p)s[p].push(new ci(l,i[p],o[p]))}else if(f<r){c=e[f];var m=--r;for(e[n[(d=e[m]).uuid]=f]=d,e[n[p]=m]=l,p=0,d=a;p!==d;++p){var v=s[p],g=v[f];v[f]=v[m],void 0===g&&(g=new ci(l,i[p],o[p])),v[m]=g}}else e[f]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=r},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,i=n.length,o=0,s=arguments.length;o!==s;++o){var a=arguments[o],c=a.uuid,u=r[c];if(void 0!==u&&t<=u){var h=t++,l=e[h];for(e[r[l.uuid]=u]=l,e[r[c]=h]=a,a=0,c=i;a!==c;++a){var p=(l=n[a])[u];l[u]=l[h],l[h]=p}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,o=i.length,s=0,a=arguments.length;s!==a;++s){var c=arguments[s].uuid,u=n[c];if(void 0!==u)if(delete n[c],u<r){var h=e[c=--r],l=--t,p=e[l];for(e[n[h.uuid]=u]=h,e[n[p.uuid]=c]=p,e.pop(),h=0,p=o;h!==p;++h){var f=i[h],d=f[l];f[u]=f[c],f[c]=d,f.pop()}}else for(e[n[(p=e[l=--t]).uuid]=u]=p,e.pop(),h=0,p=o;h!==p;++h)(f=i[h])[u]=f[l],f.pop()}this.nCachedObjects_=r},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,n=r[e],i=this._bindings;if(void 0!==n)return i[n];var o=this._paths,s=this._parsedPaths,a=this._objects,c=this.nCachedObjects_,u=Array(a.length);for(n=i.length,r[e]=n,o.push(e),s.push(t),i.push(u),r=c,n=a.length;r!==n;++r)u[r]=new ci(a[r],e,t);return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var n=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];o[t[e[s]]=r]=a,o.pop(),i[r]=i[s],i.pop(),n[r]=n[s],n.pop()}}}),Object.assign(hi.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(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){r=this._clip.duration;var n=e._clip.duration,i=r/n;e.warp(1,n/r,t),this.warp(i,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,r){var n=this._mixer,i=n.time,o=this._timeScaleInterpolant,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]=e/s,o[1]=t/s,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,n){if(this.enabled){var i=this._startTime;if(null!==i){if((t=(e-i)*r)<0||0===r)return;this._startTime=null,t*=r}if(t*=this._updateTimeScale(e),r=this._updateTime(t),0<(e=this._updateWeight(e))){t=this._interpolants,i=this._propertyBindings;for(var o=0,s=t.length;o!==s;++o)t[o].evaluate(r),i[o].accumulate(n,e)}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r)t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e,r=this._clip.duration,n=this.loop,i=this._loopCount,o=2202===n;if(0===e)return-1===i?t:o&&1==(1&i)?r-t:t;if(2200===n)e:{if(-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1)),r<=t)t=r;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}else{if(-1===i&&(0<=e?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r<=t||t<0){t-=r*(n=Math.floor(t/r)),i+=Math.abs(n);var s=this.repetitions-i;s<=0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=0<e?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1})):(1===s?(e=e<0,this._setEndings(e,!e,o)):this._setEndings(!1,!1,o),this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n}))}if(o&&1==(1&i))return r-(this.time=t)}return this.time=t},_setEndings:function(e,t,r){var n=this._interpolantSettings;n.endingEnd=r?n.endingStart=2401:(n.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,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]=t,n[1]=i+e,o[1]=r,this}}),li.prototype=Object.assign(Object.create(t.prototype),{constructor:li,_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,i=n.length,o=e._propertyBindings;e=e._interpolants;var s=r.uuid,a=this._bindingsByRootAndName,c=a[s];for(void 0===c&&(c={},a[s]=c),a=0;a!==i;++a){var u=n[a],h=u.name,l=c[h];if(void 0===l){if(void 0!==(l=o[a])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,s,h));continue}++(l=new si(ci.create(r,h,t&&t._propertyBindings[a].binding.parsedPath),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(l,s,h)}o[a]=l,e[a].resultBuffer=l.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,n=this._actionsByClip[r];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,r,t)}for(r=0,n=(t=e._propertyBindings).length;r!==n;++r){var i=t[r];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){return null!==(e=e._cacheIndex)&&e<this._nActiveActions},_addInactiveAction:function(e,t,r){var n=this._actions,i=this._actionsByClip,o=i[t];void 0===o?(o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o):(t=o.knownActions,e._byClipCacheIndex=t.length,t.push(e)),e._cacheIndex=n.length,n.push(e),o.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],n=e._cacheIndex;t[r._cacheIndex=n]=r,t.pop(),e._cacheIndex=null,t=e._clip.uuid;var i=(n=(r=this._actionsByClip)[t]).knownActions,o=i[i.length-1],s=e._byClipCacheIndex;i[o._byClipCacheIndex=s]=o,i.pop(),e._byClipCacheIndex=null,delete n.actionByRoot[(e._localRoot||this._root).uuid],0===i.length&&delete r[t],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=0,r=(e=e._propertyBindings).length;t!==r;++t){var n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,i=t[n];t[e._cacheIndex=n]=e,t[i._cacheIndex=r]=i},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,i=t[n];t[e._cacheIndex=n]=e,t[i._cacheIndex=r]=i},_addInactiveBinding:function(e,t,r){var n=this._bindingsByRootAndName,i=n[t],o=this._bindings;void 0===i&&(i={},n[t]=i),(i[r]=e)._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,n=r.rootNode.uuid;r=r.path;var i=this._bindingsByRootAndName,o=i[n],s=t[t.length-1];e=e._cacheIndex,t[s._cacheIndex=e]=s,t.pop(),delete o[r];e:{for(var a in o)break e;delete i[n]}},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,i=t[n];t[e._cacheIndex=n]=e,t[i._cacheIndex=r]=i},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,i=t[n];t[e._cacheIndex=n]=e,t[i._cacheIndex=r]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&(e[(r=new Rn(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,i=t[n];t[e.__cacheIndex=n]=e,t[i.__cacheIndex=r]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var r=t||this._root,n=r.uuid;e=null!==(r="string"==typeof e?zn.findByName(r,e):e)?r.uuid:e;var i=this._actionsByClip[e],o=null;if(void 0!==i){if(void 0!==(o=i.actionByRoot[n]))return o;o=i.knownActions[0],null===r&&(r=o._clip)}return null===r?null:(t=new hi(this,r,t),this._bindAction(t,o),this._addInactiveAction(t,e,n),t)},existingAction:function(e,t){var r=t||this._root;return t=r.uuid,r="string"==typeof e?zn.findByName(r,e):e,void 0!==(e=this._actionsByClip[r?r.uuid:e])&&e.actionByRoot[t]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions,r=this._bindings,n=this._nActiveBindings,i=this._nActiveBindings=this._nActiveActions=0;i!==t;++i)e[i].reset();for(i=0;i!==n;++i)r[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,n=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1,s=0;s!==r;++s)t[s]._update(n,e,i,o);for(e=this._bindings,t=this._nActiveBindings,s=0;s!==t;++s)e[s].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions;e=e.uuid;var r=this._actionsByClip,n=r[e];if(void 0!==n){for(var i=0,o=(n=n.knownActions).length;i!==o;++i){var s=n[i];this._deactivateAction(s);var a=s._cacheIndex,c=t[t.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,t[c._cacheIndex=a]=c,t.pop(),this._removeInactiveBindingsForAction(s)}delete r[e]}},uncacheRoot:function(e){e=e.uuid;var t=this._actionsByClip;for(n in t){var r=t[n].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var n=this._bindingsByRootAndName[e];if(void 0!==n)for(var i in n)(e=n[i]).restoreOriginalState(),this._removeInactiveBinding(e)},uncacheAction:function(e,t){null!==(e=this.existingAction(e,t))&&(this._deactivateAction(e),this._removeInactiveAction(e))}}),pi.prototype.clone=function(){return new pi(void 0===this.value.clone?this.value:this.value.clone())},fi.prototype=Object.assign(Object.create(A.prototype),{constructor:fi,isInstancedBufferGeometry:!0,copy:function(e){return A.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),di.prototype=Object.assign(Object.create(yt.prototype),{constructor:di,isInstancedInterleavedBuffer:!0,copy:function(e){return yt.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),mi.prototype=Object.assign(Object.create(y.prototype),{constructor:mi,isInstancedBufferAttribute:!0,copy:function(e){return y.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(vi.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,r){return yi(e,this,r=r||[],t),r.sort(gi),r},intersectObjects:function(e,t,r){if(r=r||[],!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var n=0,i=e.length;n<i;n++)yi(e[n],this,r,t);return r.sort(gi),r}}),Object.assign(_i.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(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),Object.assign(bi.prototype,{set:function(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(po.clamp(e.y/this.radius,-1,1))),this}}),Object.assign(xi.prototype,{set:function(e,t,r){return this.radius=e,this.theta=t,this.y=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.radius=Math.sqrt(e.x*e.x+e.z*e.z),this.theta=Math.atan2(e.x,e.z),this.y=e.y,this}}),Object.assign(wi.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(hc=new H,function(e,t){return t=hc.copy(t).multiplyScalar(.5),this.min.copy(e).sub(t),this.max.copy(e).add(t),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new H),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new H),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new H),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new H),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(uc=new H,function(e){return uc.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(Si.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Se),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Se),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Se),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(lc=new Se,pc=new Se,function(e,t){return lc.subVectors(e,this.start),pc.subVectors(this.end,this.start),e=pc.dot(pc),e=pc.dot(lc)/e,t&&(e=po.clamp(e,0,1)),e}),closestPointToPoint:function(e,t,r){return e=this.closestPointToPointParameter(e,t),void 0===r&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),r=new Se),this.delta(r).multiplyScalar(e).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),((Mi.prototype=Object.create(h.prototype)).constructor=Mi).prototype.isImmediateRenderObject=!0,((Ci.prototype=Object.create(Ot.prototype)).constructor=Ci).prototype.update=(fc=new Se,dc=new Se,mc=new v,function(){var e=["a","b","c"];this.object.updateMatrixWorld(!0),mc.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,r=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)for(var i=n.vertices,o=n.faces,s=n=0,a=o.length;s<a;s++)for(var c=o[s],u=0,h=c.vertexNormals.length;u<h;u++){var l=c.vertexNormals[u];fc.copy(i[c[e[u]]]).applyMatrix4(t),dc.copy(l).applyMatrix3(mc).normalize().multiplyScalar(this.size).add(fc),r.setXYZ(n,fc.x,fc.y,fc.z),n+=1,r.setXYZ(n,dc.x,dc.y,dc.z),n+=1}else if(n&&n.isBufferGeometry)for(e=n.attributes.position,i=n.attributes.normal,u=n=0,h=e.count;u<h;u++)fc.set(e.getX(u),e.getY(u),e.getZ(u)).applyMatrix4(t),dc.set(i.getX(u),i.getY(u),i.getZ(u)),dc.applyMatrix3(mc).normalize().multiplyScalar(this.size).add(fc),r.setXYZ(n,fc.x,fc.y,fc.z),n+=1,r.setXYZ(n,dc.x,dc.y,dc.z),n+=1;r.needsUpdate=!0}),((Ei.prototype=Object.create(h.prototype)).constructor=Ei).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Ei.prototype.update=(vc=new Se,gc=new Se,function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),vc.setFromMatrixPosition(this.light.matrixWorld),gc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(gc.sub(vc)),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}),((Ti.prototype=Object.create(Ot.prototype)).constructor=Ti).prototype.updateMatrixWorld=(yc=new Se,_c=new we,bc=new we,function(e){var t=this.bones,r=this.geometry,n=r.getAttribute("position");bc.getInverse(this.root.matrixWorld);for(var i=0,o=0;i<t.length;i++){var s=t[i];s.parent&&s.parent.isBone&&(_c.multiplyMatrices(bc,s.matrixWorld),yc.setFromMatrixPosition(_c),n.setXYZ(o,yc.x,yc.y,yc.z),_c.multiplyMatrices(bc,s.parent.matrixWorld),yc.setFromMatrixPosition(_c),n.setXYZ(o+1,yc.x,yc.y,yc.z),o+=2)}r.getAttribute("position").needsUpdate=!0,h.prototype.updateMatrixWorld.call(this,e)}),((Oi.prototype=Object.create($.prototype)).constructor=Oi).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Oi.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},((Pi.prototype=Object.create(h.prototype)).constructor=Pi).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Pi.prototype.update=function(){var e=.5*this.light.width,t=.5*this.light.height,r=this.line.geometry.attributes.position,n=r.array;n[0]=e,n[1]=-t,n[2]=0,n[3]=e,n[4]=t,n[5]=0,n[6]=-e,n[7]=t,n[8]=0,n[9]=-e,n[10]=-t,n[11]=0,n[12]=e,n[13]=-t,n[14]=0,r.needsUpdate=!0,void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)},((Ai.prototype=Object.create(h.prototype)).constructor=Ai).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Ai.prototype.update=(xc=new Se,wc=new w,Sc=new w,function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");wc.copy(this.light.color),Sc.copy(this.light.groundColor);for(var r=0,n=t.count;r<n;r++){var i=r<n/2?wc:Sc;t.setXYZ(r,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(xc.setFromMatrixPosition(this.light.matrixWorld).negate())}),(ji.prototype=Object.create(Ot.prototype)).constructor=ji,(Ri.prototype=Object.create(Ot.prototype)).constructor=Ri,((Li.prototype=Object.create(Ot.prototype)).constructor=Li).prototype.update=(Mc=new Se,Cc=new Se,Ec=new v,function(){this.object.updateMatrixWorld(!0),Ec.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,t=this.geometry.attributes.position,r=this.object.geometry,n=r.vertices,i=0,o=0,s=(r=r.faces).length;o<s;o++){var a=r[o],c=a.normal;Mc.copy(n[a.a]).add(n[a.b]).add(n[a.c]).divideScalar(3).applyMatrix4(e),Cc.copy(c).applyMatrix3(Ec).normalize().multiplyScalar(this.size).add(Mc),t.setXYZ(i,Mc.x,Mc.y,Mc.z),i+=1,t.setXYZ(i,Cc.x,Cc.y,Cc.z),i+=1}t.needsUpdate=!0}),((Ni.prototype=Object.create(h.prototype)).constructor=Ni).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Ni.prototype.update=(Tc=new Se,Oc=new Se,Pc=new Se,function(){Tc.setFromMatrixPosition(this.light.matrixWorld),Oc.setFromMatrixPosition(this.light.target.matrixWorld),Pc.subVectors(Oc,Tc),this.lightPlane.lookAt(Pc),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Pc),this.targetLine.scale.z=Pc.length()}),((Ii.prototype=Object.create(Ot.prototype)).constructor=Ii).prototype.update=function(){function e(e,t,r,n){if(s.set(t,r,n).unproject(a),void 0!==(e=o[e]))for(t=i.getAttribute("position"),r=0,n=e.length;r<n;r++)t.setXYZ(e[r],s.x,s.y,s.z)}var i,o,s=new Se,a=new c;return function(){i=this.geometry,o=this.pointMap,a.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-1,-1,-1),e("n2",1,-1,-1),e("n3",-1,1,-1),e("n4",1,1,-1),e("f1",-1,-1,1),e("f2",1,-1,1),e("f3",-1,1,1),e("f4",1,1,1),e("u1",.7,1.1,-1),e("u2",-.7,1.1,-1),e("u3",0,2,-1),e("cf1",-1,0,1),e("cf2",1,0,1),e("cf3",0,-1,1),e("cf4",0,1,1),e("cn1",-1,0,-1),e("cn2",1,0,-1),e("cn3",0,-1,-1),e("cn4",0,1,-1),i.getAttribute("position").needsUpdate=!0}}(),((Di.prototype=Object.create(Ot.prototype)).constructor=Di).prototype.update=(Ac=new r,function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Ac.setFromObject(this.object),!Ac.isEmpty()){e=Ac.min;var t=Ac.max,r=this.geometry.attributes.position,n=r.array;n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=e.x,n[4]=t.y,n[5]=t.z,n[6]=e.x,n[7]=e.y,n[8]=t.z,n[9]=t.x,n[10]=e.y,n[11]=t.z,n[12]=t.x,n[13]=t.y,n[14]=e.z,n[15]=e.x,n[16]=t.y,n[17]=e.z,n[18]=e.x,n[19]=e.y,n[20]=e.z,n[21]=t.x,n[22]=e.y,n[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}),Di.prototype.setFromObject=function(e){return this.object=e,this.update(),this},((ki.prototype=Object.create(Ot.prototype)).constructor=ki).prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),h.prototype.updateMatrixWorld.call(this,e))},((Bi.prototype=Object.create(Tt.prototype)).constructor=Bi).prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),h.prototype.updateMatrixWorld.call(this,e)},((Fi.prototype=Object.create(h.prototype)).constructor=Fi).prototype.setDirection=(Nc=new Se,function(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Nc.set(e.z,0,-e.x).normalize(),Lc=Math.acos(e.y),this.quaternion.setFromAxisAngle(Nc,Lc))}),Fi.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},Fi.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},($i.prototype=Object.create(Ot.prototype)).constructor=$i,tn.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(tn.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(gn.prototype,{createPointsGeometry:function(e){return console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."),e=this.getPoints(e),this.createGeometry(e)},createSpacedPointsGeometry:function(e){return console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."),e=this.getSpacedPoints(e),this.createGeometry(e)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new S,r=0,n=e.length;r<n;r++){var i=e[r];t.vertices.push(new Se(i.x,i.y,i.z||0))}return t}}),Object.assign(yn.prototype,{fromPoints:function(e){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Ui.prototype=Object.create(sn.prototype),zi.prototype=Object.create(sn.prototype),Gi.prototype=Object.create(sn.prototype),Object.assign(Gi.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),ji.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(qn.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Fa.extractUrlBase(e)}}),Object.assign(wi.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(r.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Si.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(po,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),po.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),po.ceilPowerOfTwo(e)}}),Object.assign(v.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(we.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return void 0===Ic&&(Ic=new Se),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),Ic.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,r,n,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,n,r,i,o)}}),g.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},a.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(B.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(F.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(F,{barycoordFromPoint:function(e,t,r,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),F.getBarycoord(e,t,r,n,i)},normal:function(e,t,r,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),F.getNormal(e,t,r,n)}}),Object.assign(_n.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new yr(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Pr(this,e)}}),Object.assign(H.prototype,{fromAttribute:function(e,t,r){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Se.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,r){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Me.prototype,{fromAttribute:function(e,t,r){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(S.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}}),Object.assign(h.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties(h.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(wt.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(St.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(tn.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),ht.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(bn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(y.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}}),Object.assign(A.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(A.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.assign(_r.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(pi.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(N.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 w}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}}}),Object.defineProperties(Gr.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(D.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(dt.prototype,{animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},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(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")}}),Object.defineProperties(dt.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(ot.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(T.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(pt.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}}}),ni.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Qn).load(e,function(e){t.setBuffer(e)}),this},oi.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ti.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Po.crossOrigin=void 0,Po.loadTexture=function(e,t,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new en;return i.setCrossOrigin(this.crossOrigin),e=i.load(e,r,void 0,n),t&&(e.mapping=t),e},Po.loadTextureCube=function(e,t,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Qr;return i.setCrossOrigin(this.crossOrigin),e=i.load(e,r,void 0,n),t&&(e.mapping=t),e},Po.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Po.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},e.WebGLRenderTargetCube=n,e.WebGLRenderTarget=T,e.WebGLRenderer=dt,e.ShaderLib=Bo,e.UniformsLib=ko,e.UniformsUtils=Lo,e.ShaderChunk=Ro,e.FogExp2=mt,e.Fog=vt,e.Scene=gt,e.Sprite=xt,e.LOD=wt,e.SkinnedMesh=Ct,e.Skeleton=St,e.Bone=Mt,e.Mesh=$,e.LineSegments=Ot,e.LineLoop=Pt,e.Line=Tt,e.Points=jt,e.Group=ut,e.VideoTexture=Rt,e.DataTexture=Ce,e.CompressedTexture=Lt,e.CubeTexture=z,e.CanvasTexture=Nt,e.DepthTexture=It,e.Texture=p,e.CompressedTextureLoader=Kr,e.DataTextureLoader=Zr,e.CubeTextureLoader=Qr,e.TextureLoader=en,e.ObjectLoader=Xn,e.MaterialLoader=Vn,e.BufferGeometryLoader=Hn,e.DefaultLoadingManager=Ea,e.LoadingManager=Xr,e.JSONLoader=Wn,e.ImageLoader=Jr,e.ImageBitmapLoader=Yn,e.FontLoader=Jn,e.FileLoader=Yr,e.Loader=qn,e.LoaderUtils=Fa,e.Cache=Ca,e.AudioLoader=Qn,e.SpotLightShadow=Sn,e.SpotLight=Mn,e.PointLight=Cn,e.RectAreaLight=Pn,e.HemisphereLight=xn,e.DirectionalLightShadow=En,e.DirectionalLight=Tn,e.AmbientLight=On,e.LightShadow=wn,e.Light=bn,e.StereoCamera=ei,e.PerspectiveCamera=ht,e.OrthographicCamera=f,e.CubeCamera=ti,e.ArrayCamera=lt,e.Camera=c,e.AudioListener=ri,e.PositionalAudio=ii,e.AudioContext=Dc,e.AudioAnalyser=oi,e.Audio=ni,e.VectorKeyframeTrack=Un,e.StringKeyframeTrack=$n,e.QuaternionKeyframeTrack=Fn,e.NumberKeyframeTrack=kn,e.ColorKeyframeTrack=Dn,e.BooleanKeyframeTrack=In,e.PropertyMixer=si,e.PropertyBinding=ci,e.KeyframeTrack=Nn,e.AnimationUtils=La,e.AnimationObjectGroup=ui,e.AnimationMixer=li,e.AnimationClip=zn,e.Uniform=pi,e.InstancedBufferGeometry=fi,e.BufferGeometry=A,e.Geometry=S,e.InterleavedBufferAttribute=_t,e.InstancedInterleavedBuffer=di,e.InterleavedBuffer=yt,e.InstancedBufferAttribute=mi,e.Face3=k,e.Object3D=h,e.Raycaster=vi,e.Layers=o,e.EventDispatcher=t,e.Clock=_i,e.QuaternionLinearInterpolant=Bn,e.LinearInterpolant=Rn,e.DiscreteInterpolant=Ln,e.CubicInterpolant=jn,e.Interpolant=An,e.Triangle=F,e.Math=po,e.Spherical=bi,e.Cylindrical=xi,e.Plane=g,e.Frustum=Ee,e.Sphere=s,e.Ray=B,e.Matrix4=we,e.Matrix3=v,e.Box3=r,e.Box2=wi,e.Line3=Si,e.Euler=i,e.Vector4=Me,e.Vector3=Se,e.Vector2=H,e.Quaternion=a,e.Color=w,e.ImmediateRenderObject=Mi,e.VertexNormalsHelper=Ci,e.SpotLightHelper=Ei,e.SkeletonHelper=Ti,e.PointLightHelper=Oi,e.RectAreaLightHelper=Pi,e.HemisphereLightHelper=Ai,e.GridHelper=ji,e.PolarGridHelper=Ri,e.FaceNormalsHelper=Li,e.DirectionalLightHelper=Ni,e.CameraHelper=Ii,e.BoxHelper=Di,e.Box3Helper=ki,e.PlaneHelper=Bi,e.ArrowHelper=Fi,e.AxesHelper=$i,e.Shape=_n,e.Path=yn,e.ShapePath=Kn,e.Font=Zn,e.CurvePath=gn,e.Curve=tn,e.ImageUtils=Po,e.ShapeUtils=xa,e.WebGLUtils=ct,e.WireframeGeometry=Dt,e.ParametricGeometry=kt,e.ParametricBufferGeometry=Bt,e.TetrahedronGeometry=Ut,e.TetrahedronBufferGeometry=zt,e.OctahedronGeometry=Gt,e.OctahedronBufferGeometry=Vt,e.IcosahedronGeometry=Ht,e.IcosahedronBufferGeometry=qt,e.DodecahedronGeometry=Wt,e.DodecahedronBufferGeometry=Xt,e.PolyhedronGeometry=Ft,e.PolyhedronBufferGeometry=$t,e.TubeGeometry=Yt,e.TubeBufferGeometry=Kt,e.TorusKnotGeometry=Zt,e.TorusKnotBufferGeometry=Jt,e.TorusGeometry=Qt,e.TorusBufferGeometry=er,e.TextGeometry=xr,e.TextBufferGeometry=wr,e.SphereGeometry=Sr,e.SphereBufferGeometry=Mr,e.RingGeometry=Cr,e.RingBufferGeometry=Er,e.PlaneGeometry=R,e.PlaneBufferGeometry=L,e.LatheGeometry=Tr,e.LatheBufferGeometry=Or,e.ShapeGeometry=Pr,e.ShapeBufferGeometry=Ar,e.ExtrudeGeometry=yr,e.ExtrudeBufferGeometry=_r,e.EdgesGeometry=Rr,e.ConeGeometry=Ir,e.ConeBufferGeometry=Dr,e.CylinderGeometry=Lr,e.CylinderBufferGeometry=Nr,e.CircleGeometry=kr,e.CircleBufferGeometry=Br,e.BoxGeometry=O,e.BoxBufferGeometry=j,e.ShadowMaterial=Fr,e.SpriteMaterial=bt,e.RawShaderMaterial=$r,e.ShaderMaterial=D,e.PointsMaterial=At,e.MeshPhysicalMaterial=zr,e.MeshStandardMaterial=Ur,e.MeshPhongMaterial=Gr,e.MeshToonMaterial=Vr,e.MeshNormalMaterial=Hr,e.MeshLambertMaterial=qr,e.MeshDepthMaterial=nt,e.MeshDistanceMaterial=it,e.MeshBasicMaterial=I,e.LineDashedMaterial=Wr,e.LineBasicMaterial=Et,e.Material=N,e.Float64BufferAttribute=M,e.Float32BufferAttribute=P,e.Uint32BufferAttribute=x,e.Int32BufferAttribute=b,e.Uint16BufferAttribute=_,e.Int16BufferAttribute=m,e.Uint8ClampedBufferAttribute=d,e.Uint8BufferAttribute=l,e.Int8BufferAttribute=u,e.BufferAttribute=y,e.ArcCurve=nn,e.CatmullRomCurve3=sn,e.CubicBezierCurve=hn,e.CubicBezierCurve3=ln,e.EllipseCurve=rn,e.LineCurve=pn,e.LineCurve3=fn,e.QuadraticBezierCurve=dn,e.QuadraticBezierCurve3=mn,e.SplineCurve=vn,e.REVISION="95",e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=0,e.CullFaceBack=1,e.CullFaceFront=2,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=1,e.PCFSoftShadowMap=2,e.FrontSide=0,e.BackSide=1,e.DoubleSide=2,e.FlatShading=1,e.SmoothShading=2,e.NoColors=0,e.FaceColors=1,e.VertexColors=2,e.NoBlending=0,e.NormalBlending=1,e.AdditiveBlending=2,e.SubtractiveBlending=3,e.MultiplyBlending=4,e.CustomBlending=5,e.AddEquation=100,e.SubtractEquation=101,e.ReverseSubtractEquation=102,e.MinEquation=103,e.MaxEquation=104,e.ZeroFactor=200,e.OneFactor=201,e.SrcColorFactor=202,e.OneMinusSrcColorFactor=203,e.SrcAlphaFactor=204,e.OneMinusSrcAlphaFactor=205,e.DstAlphaFactor=206,e.OneMinusDstAlphaFactor=207,e.DstColorFactor=208,e.OneMinusDstColorFactor=209,e.SrcAlphaSaturateFactor=210,e.NeverDepth=0,e.AlwaysDepth=1,e.LessDepth=2,e.LessEqualDepth=3,e.EqualDepth=4,e.GreaterEqualDepth=5,e.GreaterDepth=6,e.NotEqualDepth=7,e.MultiplyOperation=0,e.MixOperation=1,e.AddOperation=2,e.NoToneMapping=0,e.LinearToneMapping=1,e.ReinhardToneMapping=2,e.Uncharted2ToneMapping=3,e.CineonToneMapping=4,e.UVMapping=300,e.CubeReflectionMapping=301,e.CubeRefractionMapping=302,e.EquirectangularReflectionMapping=303,e.EquirectangularRefractionMapping=304,e.SphericalReflectionMapping=305,e.CubeUVReflectionMapping=306,e.CubeUVRefractionMapping=307,e.RepeatWrapping=1e3,e.ClampToEdgeWrapping=1001,e.MirroredRepeatWrapping=1002,e.NearestFilter=1003,e.NearestMipMapNearestFilter=1004,e.NearestMipMapLinearFilter=1005,e.LinearFilter=1006,e.LinearMipMapNearestFilter=1007,e.LinearMipMapLinearFilter=1008,e.UnsignedByteType=1009,e.ByteType=1010,e.ShortType=1011,e.UnsignedShortType=1012,e.IntType=1013,e.UnsignedIntType=1014,e.FloatType=1015,e.HalfFloatType=1016,e.UnsignedShort4444Type=1017,e.UnsignedShort5551Type=1018,e.UnsignedShort565Type=1019,e.UnsignedInt248Type=1020,e.AlphaFormat=1021,e.RGBFormat=1022,e.RGBAFormat=1023,e.LuminanceFormat=1024,e.LuminanceAlphaFormat=1025,e.RGBEFormat=1023,e.DepthFormat=1026,e.DepthStencilFormat=1027,e.RGB_S3TC_DXT1_Format=33776,e.RGBA_S3TC_DXT1_Format=33777,e.RGBA_S3TC_DXT3_Format=33778,e.RGBA_S3TC_DXT5_Format=33779,e.RGB_PVRTC_4BPPV1_Format=35840,e.RGB_PVRTC_2BPPV1_Format=35841,e.RGBA_PVRTC_4BPPV1_Format=35842,e.RGBA_PVRTC_2BPPV1_Format=35843,e.RGB_ETC1_Format=36196,e.RGBA_ASTC_4x4_Format=37808,e.RGBA_ASTC_5x4_Format=37809,e.RGBA_ASTC_5x5_Format=37810,e.RGBA_ASTC_6x5_Format=37811,e.RGBA_ASTC_6x6_Format=37812,e.RGBA_ASTC_8x5_Format=37813,e.RGBA_ASTC_8x6_Format=37814,e.RGBA_ASTC_8x8_Format=37815,e.RGBA_ASTC_10x5_Format=37816,e.RGBA_ASTC_10x6_Format=37817,e.RGBA_ASTC_10x8_Format=37818,e.RGBA_ASTC_10x10_Format=37819,e.RGBA_ASTC_12x10_Format=37820,e.RGBA_ASTC_12x12_Format=37821,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=2300,e.InterpolateLinear=2301,e.InterpolateSmooth=2302,e.ZeroCurvatureEnding=2400,e.ZeroSlopeEnding=2401,e.WrapAroundEnding=2402,e.TrianglesDrawMode=0,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=3e3,e.sRGBEncoding=3001,e.GammaEncoding=3007,e.RGBEEncoding=3002,e.LogLuvEncoding=3003,e.RGBM7Encoding=3004,e.RGBM16Encoding=3005,e.RGBDEncoding=3006,e.BasicDepthPacking=3200,e.RGBADepthPacking=3201,e.TangentSpaceNormalMap=0,e.ObjectSpaceNormalMap=1,e.CubeGeometry=O,e.Face4=function(e,t,r,n,i,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new k(e,t,r,i,o,s)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,(e.materials=e).clone=function(){return e.slice()},e},e.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new jt(e,t)},e.Particle=function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new xt(e)},e.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new jt(e,t)},e.PointCloudMaterial=function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new At(e)},e.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new At(e)},e.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new At(e)},e.Vertex=function(e,t,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Se(e,t,r)},e.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new y(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new u(e,t)},e.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new l(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new d(e,t)},e.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new m(e,t)},e.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new _(e,t)},e.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new b(e,t)},e.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new x(e,t)},e.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new P(e,t)},e.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new M(e,t)},e.ClosedSplineCurve3=Ui,e.SplineCurve3=zi,e.Spline=Gi,e.AxisHelper=function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new $i(e)},e.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Di(e,t)},e.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Ot(new Rr(e.geometry),new Et({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Ot(new Dt(e.geometry),new Et({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Yr(e)},e.BinaryTextureLoader=function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Zr(e)},e.GeometryUtils={merge:function(e,t,r){if(console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh){t.matrixAutoUpdate&&t.updateMatrix();var n=t.matrix;t=t.geometry}e.merge(t,n,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},e.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},e.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(){}},e.SceneUtils={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}},e.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")},Object.defineProperty(e,"__esModule",{value:!0})}("object"==typeof r&&void 0!==t?r:n.THREE={})},{}],226:[function(e,t,r){"use strict";function n(e,t){if(!(this instanceof n))return new n(e,t);if(this.data=e||[],this.length=this.data.length,this.compare=t||i,0<this.length)for(var r=this.length>>1;0<=r;r--)this._down(r)}function i(e,t){return e<t?-1:t<e?1:0}(t.exports=n).prototype={push:function(e){this.data.push(e),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var e=this.data[0];return this.length--,0<this.length&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),e}},peek:function(){return this.data[0]},_up:function(e){for(var t=this.data,r=this.compare,n=t[e];0<e;){var i=e-1>>1,o=t[i];if(0<=r(n,o))break;t[e]=o,e=i}t[e]=n},_down:function(e){for(var t=this.data,r=this.compare,n=this.length,i=n>>1,o=t[e];e<i;){var s=1+(e<<1),a=s+1,c=t[s];if(a<n&&r(t[a],c)<0&&(c=t[s=a]),0<=r(c,o))break;t[e]=c,e=s}t[e]=o}}},{}],227:[function(e,t,r){var n=e("./vdom/create-element.js");t.exports=n},{"./vdom/create-element.js":233}],228:[function(e,t,r){var n=e("./vtree/diff.js");t.exports=n},{"./vtree/diff.js":253}],229:[function(e,t,r){var n=e("./virtual-hyperscript/index.js");t.exports=n},{"./virtual-hyperscript/index.js":240}],230:[function(e,t,r){var n=e("./diff.js"),i=e("./patch.js"),o=e("./h.js"),s=e("./create-element.js"),a=e("./vnode/vnode.js"),c=e("./vnode/vtext.js");t.exports={diff:n,patch:i,h:o,create:s,VNode:a,VText:c}},{"./create-element.js":227,"./diff.js":228,"./h.js":229,"./patch.js":231,"./vnode/vnode.js":249,"./vnode/vtext.js":251}],231:[function(e,t,r){var n=e("./vdom/patch.js");t.exports=n},{"./vdom/patch.js":236}],232:[function(e,t,r){var l=e("is-object"),a=e("../vnode/is-vhook.js");function o(e,t,r,n){if(n){var i=n[t];if(a(i))i.unhook&&i.unhook(e,t,r);else if("attributes"===t)for(var o in i)e.removeAttribute(o);else if("style"===t)for(var s in i)e.style[s]="";else e[t]="string"==typeof i?"":null}}function s(e,t,r,n,i){var o=r?r[n]:void 0;if("attributes"!==n)if(o&&l(o)&&p(o)!==p(i))e[n]=i;else{l(e[n])||(e[n]={});var s="style"===n?"":void 0;for(var a in i){var c=i[a];e[n][a]=void 0===c?s:c}}else for(var u in i){var h=i[u];void 0===h?e.removeAttribute(u):e.setAttribute(u,h)}}function p(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}t.exports=function(e,t,r){for(var n in t){var i=t[n];void 0===i?o(e,n,i,r):a(i)?(o(e,n,i,r),i.hook&&i.hook(e,n,r?r[n]:void 0)):l(i)?s(e,t,r,n,i):e[n]=i}}},{"../vnode/is-vhook.js":244,"is-object":20}],233:[function(e,t,r){var h=e("global/document"),l=e("./apply-properties"),p=e("../vnode/is-vnode.js"),f=e("../vnode/is-vtext.js"),d=e("../vnode/is-widget.js"),m=e("../vnode/handle-thunk.js");t.exports=function e(t,r){var n=r&&r.document||h;var i=r?r.warn:null;t=m(t).a;{if(d(t))return t.init();if(f(t))return n.createTextNode(t.text);if(!p(t))return i&&i("Item is not a valid virtual dom node",t),null}var o=null===t.namespace?n.createElement(t.tagName):n.createElementNS(t.namespace,t.tagName);var s=t.properties;l(o,s);var a=t.children;for(var c=0;c<a.length;c++){var u=e(a[c],r);u&&o.appendChild(u)}return o}},{"../vnode/handle-thunk.js":242,"../vnode/is-vnode.js":245,"../vnode/is-vtext.js":246,"../vnode/is-widget.js":247,"./apply-properties":232,"global/document":16}],234:[function(e,t,r){var l={};function p(e,t,r){if(0===e.length)return!1;for(var n,i,o=0,s=e.length-1;o<=s;){if(i=e[n=(s+o)/2>>0],o===s)return t<=i&&i<=r;if(i<t)o=n+1;else{if(!(r<i))return!0;s=n-1}}return!1}function i(e,t){return t<e?1:-1}t.exports=function(e,t,r,n){return r&&0!==r.length?(r.sort(i),function e(t,r,n,i,o){i=i||{};if(t){p(n,o,o)&&(i[o]=t);var s=r.children;if(s)for(var a=t.childNodes,c=0;c<r.children.length;c++){o+=1;var u=s[c]||l,h=o+(u.count||0);p(n,o,h)&&e(a[c],u,n,i,o),o=h}}return i}(e,t,r,n,0)):{}}},{}],235:[function(e,t,r){var s=e("./apply-properties"),n=e("../vnode/is-widget.js"),a=e("../vnode/vpatch.js"),c=e("./update-widget");function u(e,t){"function"==typeof t.destroy&&n(t)&&t.destroy(e)}t.exports=function(e,t,r){var n=e.type,i=e.vNode,o=e.patch;switch(n){case a.REMOVE:return function(e,t){var r=e.parentNode;r&&r.removeChild(e);return u(e,t),null}(t,i);case a.INSERT:return function(e,t,r){var n=r.render(t,r);e&&e.appendChild(n);return e}(t,o,r);case a.VTEXT:return function(e,t,r,n){var i;if(3===e.nodeType)e.replaceData(0,e.length,r.text),i=e;else{var o=e.parentNode;i=n.render(r,n),o&&i!==e&&o.replaceChild(i,e)}return i}(t,0,o,r);case a.WIDGET:return function(e,t,r,n){var i,o=c(t,r);i=o?r.update(t,e)||e:n.render(r,n);var s=e.parentNode;s&&i!==e&&s.replaceChild(i,e);o||u(e,t);return i}(t,i,o,r);case a.VNODE:return function(e,t,r,n){var i=e.parentNode,o=n.render(r,n);i&&o!==e&&i.replaceChild(o,e);return o}(t,0,o,r);case a.ORDER:return function(e,t){for(var r,n,i,o=e.childNodes,s={},a=0;a<t.removes.length;a++)n=t.removes[a],r=o[n.from],n.key&&(s[n.key]=r),e.removeChild(r);for(var c=o.length,u=0;u<t.inserts.length;u++)i=t.inserts[u],r=s[i.key],e.insertBefore(r,i.to>=c++?null:o[i.to])}(t,o),t;case a.PROPS:return s(t,o,i.properties),t;case a.THUNK:return function(e,t){e&&t&&e!==t&&e.parentNode&&e.parentNode.replaceChild(t,e);return t}(t,r.patch(t,o,r));default:return t}}},{"../vnode/is-widget.js":247,"../vnode/vpatch.js":250,"./apply-properties":232,"./update-widget":237}],236:[function(e,t,r){var c=e("global/document"),s=e("x-is-array"),i=e("./create-element"),u=e("./dom-index"),a=e("./patch-op");function o(e,t,r){var n=function(e){var t=[];for(var r in e)"a"!==r&&t.push(Number(r));return t}(t);if(0===n.length)return e;var i=u(e,t.a,n),o=e.ownerDocument;r.document||o===c||(r.document=o);for(var s=0;s<n.length;s++){var a=n[s];e=h(e,i[a],t[a],r)}return e}function h(e,t,r,n){if(!t)return e;var i;if(s(r))for(var o=0;o<r.length;o++)i=a(r[o],t,n),t===e&&(e=i);else i=a(r,t,n),t===e&&(e=i);return e}t.exports=function e(t,r,n){n=n||{};n.patch=n.patch&&n.patch!==e?n.patch:o;n.render=n.render||i;return n.patch(t,r,n)}},{"./create-element":233,"./dom-index":234,"./patch-op":235,"global/document":16,"x-is-array":272}],237:[function(e,t,r){var n=e("../vnode/is-widget.js");t.exports=function(e,t){if(n(e)&&n(t))return"name"in e&&"name"in t?e.id===t.id:e.init===t.init;return!1}},{"../vnode/is-widget.js":247}],238:[function(e,t,r){"use strict";var n=e("ev-store");function i(e){if(!(this instanceof i))return new i(e);this.value=e}(t.exports=i).prototype.hook=function(e,t){n(e)[t.substr(3)]=this.value},i.prototype.unhook=function(e,t){n(e)[t.substr(3)]=void 0}},{"ev-store":9}],239:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);this.value=e}(t.exports=n).prototype.hook=function(e,t){e[t]!==this.value&&(e[t]=this.value)}},{}],240:[function(e,t,r){"use strict";var u=e("x-is-array"),h=e("../vnode/vnode.js"),l=e("../vnode/vtext.js"),n=e("../vnode/is-vnode"),i=e("../vnode/is-vtext"),o=e("../vnode/is-widget"),p=e("../vnode/is-vhook"),s=e("../vnode/is-thunk"),f=e("./parse-tag.js"),d=e("./hooks/soft-set-hook.js"),m=e("./hooks/ev-hook.js");function v(e){return n(e)||i(e)||o(e)||s(e)}function g(e){var t=new Error;return t.type="virtual-hyperscript.unexpected.virtual-element",t.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+a(e.foreignObject)+".\nThe parent vnode is:\n"+a(e.parentVnode),t.foreignObject=e.foreignObject,t.parentVnode=e.parentVnode,t}function a(t){try{return JSON.stringify(t,null,"    ")}catch(e){return String(t)}}t.exports=function(e,t,r){var n,i,o,s,a=[];!r&&(c=t,"string"==typeof c||u(c)||v(c))&&(r=t,i={});var c;n=f(e,i=i||t||{}),i.hasOwnProperty("key")&&(o=i.key,i.key=void 0);i.hasOwnProperty("namespace")&&(s=i.namespace,i.namespace=void 0);"INPUT"!==n||s||!i.hasOwnProperty("value")||void 0===i.value||p(i.value)||(i.value=d(i.value));(function(e){for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];if(p(r))continue;"ev-"===t.substr(0,3)&&(e[t]=m(r))}})(i),null!=r&&function e(t,r,n,i){if("string"==typeof t)r.push(new l(t));else if("number"==typeof t)r.push(new l(String(t)));else if(v(t))r.push(t);else{if(!u(t)){if(null==t)return;throw g({foreignObject:t,parentVnode:{tagName:n,properties:i}})}for(var o=0;o<t.length;o++)e(t[o],r,n,i)}}(r,a,n,i);return new h(n,i,a,o,s)}},{"../vnode/is-thunk":243,"../vnode/is-vhook":244,"../vnode/is-vnode":245,"../vnode/is-vtext":246,"../vnode/is-widget":247,"../vnode/vnode.js":249,"../vnode/vtext.js":251,"./hooks/ev-hook.js":238,"./hooks/soft-set-hook.js":239,"./parse-tag.js":241,"x-is-array":272}],241:[function(e,t,r){"use strict";var u=e("browser-split"),h=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,l=/^\.|#/;t.exports=function(e,t){if(!e)return"DIV";var r,n,i,o,s=!t.hasOwnProperty("id"),a=u(e,h),c=null;l.test(a[1])&&(c="DIV");for(o=0;o<a.length;o++)(n=a[o])&&(i=n.charAt(0),c?"."===i?(r=r||[]).push(n.substring(1,n.length)):"#"===i&&s&&(t.id=n.substring(1,n.length)):c=n);r&&(t.className&&r.push(t.className),t.className=r.join(" "));return t.namespace?c:c.toUpperCase()}},{"browser-split":5}],242:[function(e,t,r){var n=e("./is-vnode"),i=e("./is-vtext"),o=e("./is-widget"),s=e("./is-thunk");function a(e,t){var r=e.vnode;if(r||(r=e.vnode=e.render(t)),!(n(r)||i(r)||o(r)))throw new Error("thunk did not return a valid node");return r}t.exports=function(e,t){var r=e,n=t;s(t)&&(n=a(t,e));s(e)&&(r=a(e,null));return{a:r,b:n}}},{"./is-thunk":243,"./is-vnode":245,"./is-vtext":246,"./is-widget":247}],243:[function(e,t,r){t.exports=function(e){return e&&"Thunk"===e.type}},{}],244:[function(e,t,r){t.exports=function(e){return e&&("function"==typeof e.hook&&!e.hasOwnProperty("hook")||"function"==typeof e.unhook&&!e.hasOwnProperty("unhook"))}},{}],245:[function(e,t,r){var n=e("./version");t.exports=function(e){return e&&"VirtualNode"===e.type&&e.version===n}},{"./version":248}],246:[function(e,t,r){var n=e("./version");t.exports=function(e){return e&&"VirtualText"===e.type&&e.version===n}},{"./version":248}],247:[function(e,t,r){t.exports=function(e){return e&&"Widget"===e.type}},{}],248:[function(e,t,r){t.exports="2"},{}],249:[function(e,t,r){var n=e("./version"),m=e("./is-vnode"),v=e("./is-widget"),g=e("./is-thunk"),y=e("./is-vhook");t.exports=i;var _={},b=[];function i(e,t,r,n,i){this.tagName=e,this.properties=t||_,this.children=r||b,this.key=null!=n?String(n):void 0,this.namespace="string"==typeof i?i:null;var o,s=r&&r.length||0,a=0,c=!1,u=!1,h=!1;for(var l in t)if(t.hasOwnProperty(l)){var p=t[l];y(p)&&p.unhook&&(o||(o={}),o[l]=p)}for(var f=0;f<s;f++){var d=r[f];m(d)?(a+=d.count||0,!c&&d.hasWidgets&&(c=!0),!u&&d.hasThunks&&(u=!0),h||!d.hooks&&!d.descendantHooks||(h=!0)):!c&&v(d)?"function"==typeof d.destroy&&(c=!0):!u&&g(d)&&(u=!0)}this.count=s+a,this.hasWidgets=c,this.hasThunks=u,this.hooks=o,this.descendantHooks=h}i.prototype.version=n,i.prototype.type="VirtualNode"},{"./is-thunk":243,"./is-vhook":244,"./is-vnode":245,"./is-widget":247,"./version":248}],250:[function(e,t,r){var n=e("./version");function i(e,t,r){this.type=Number(e),this.vNode=t,this.patch=r}i.NONE=0,i.VTEXT=1,i.VNODE=2,i.WIDGET=3,i.PROPS=4,i.ORDER=5,i.INSERT=6,i.REMOVE=7,i.THUNK=8,(t.exports=i).prototype.version=n,i.prototype.type="VirtualPatch"},{"./version":248}],251:[function(e,t,r){var n=e("./version");function i(e){this.text=String(e)}(t.exports=i).prototype.version=n,i.prototype.type="VirtualText"},{"./version":248}],252:[function(e,t,r){var u=e("is-object"),h=e("../vnode/is-vhook");function l(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}t.exports=function e(t,r){var n;for(var i in t){i in r||((n=n||{})[i]=void 0);var o=t[i],s=r[i];if(o!==s)if(u(o)&&u(s))if(l(s)!==l(o))(n=n||{})[i]=s;else if(h(s))(n=n||{})[i]=s;else{var a=e(o,s);a&&((n=n||{})[i]=a)}else(n=n||{})[i]=s}for(var c in r)c in t||((n=n||{})[c]=r[c]);return n}},{"../vnode/is-vhook":244,"is-object":20}],253:[function(e,t,r){var n=e("x-is-array"),d=e("../vnode/vpatch"),m=e("../vnode/is-vnode"),a=e("../vnode/is-vtext"),c=e("../vnode/is-widget"),u=e("../vnode/is-thunk"),s=e("../vnode/handle-thunk"),h=e("./diff-props");function l(e,t){var r={a:e};return v(e,t,r,0),r}function v(e,t,r,n){if(e!==t){var i=r[n],o=!1;if(u(e)||u(t))f(e,t,r,n);else if(null==t)c(e)||(p(e,r,n),i=r[n]),i=y(i,new d(d.REMOVE,e,t));else if(m(t))if(m(e))if(e.tagName===t.tagName&&e.namespace===t.namespace&&e.key===t.key){var s=h(e.properties,t.properties);s&&(i=y(i,new d(d.PROPS,e,s))),i=function(e,t,r,n,i){for(var o=e.children,s=function(e,t){var r=C(t),n=r.keys,i=r.free;if(i.length===t.length)return{children:t,moves:null};var o=C(e),s=o.keys;if(o.free.length===e.length)return{children:t,moves:null};for(var a=[],c=0,u=i.length,h=0,l=0;l<e.length;l++){var p,f=e[l];f.key?n.hasOwnProperty(f.key)?(p=n[f.key],a.push(t[p])):(p=l-h++,a.push(null)):c<u?(p=i[c++],a.push(t[p])):(p=l-h++,a.push(null))}for(var d=c>=i.length?t.length:i[c],m=0;m<t.length;m++){var v=t[m];v.key?s.hasOwnProperty(v.key)||a.push(v):d<=m&&a.push(v)}for(var g,y=a.slice(),_=0,b=[],x=[],w=0;w<t.length;){var S=t[w];for(g=y[_];null===g&&y.length;)b.push(M(y,_,null)),g=y[_];g&&g.key===S.key?(_++,w++):S.key?(g&&g.key&&n[g.key]!==w+1?(b.push(M(y,_,g.key)),(g=y[_])&&g.key===S.key?_++:x.push({key:S.key,to:w})):x.push({key:S.key,to:w}),w++):g&&g.key&&b.push(M(y,_,g.key))}for(;_<y.length;)g=y[_],b.push(M(y,_,g&&g.key));return b.length!==h||x.length?{children:a,moves:{removes:b,inserts:x}}:{children:a,moves:null}}(o,t.children),a=s.children,c=o.length,u=a.length,h=u<c?c:u,l=0;l<h;l++){var p=o[l],f=a[l];i+=1,p?v(p,f,r,i):f&&(n=y(n,new d(d.INSERT,null,f))),m(p)&&p.count&&(i+=p.count)}s.moves&&(n=y(n,new d(d.ORDER,e,s.moves)));return n}(e,t,r,i,n)}else i=y(i,new d(d.VNODE,e,t)),o=!0;else i=y(i,new d(d.VNODE,e,t)),o=!0;else a(t)?a(e)?e.text!==t.text&&(i=y(i,new d(d.VTEXT,e,t))):(i=y(i,new d(d.VTEXT,e,t)),o=!0):c(t)&&(c(e)||(o=!0),i=y(i,new d(d.WIDGET,e,t)));i&&(r[n]=i),o&&p(e,r,n)}}function p(e,t,r){!function e(t,r,n){if(m(t)){if(t.hooks&&(r[n]=y(r[n],new d(d.PROPS,t,g(t.hooks)))),t.descendantHooks||t.hasThunks)for(var i=t.children,o=i.length,s=0;s<o;s++){var a=i[s];e(a,r,n+=1),m(a)&&a.count&&(n+=a.count)}}else u(t)&&f(t,null,r,n)}(e,t,r),function e(t,r,n){if(c(t))"function"==typeof t.destroy&&(r[n]=y(r[n],new d(d.REMOVE,t,null)));else if(m(t)&&(t.hasWidgets||t.hasThunks))for(var i=t.children,o=i.length,s=0;s<o;s++){var a=i[s];e(a,r,n+=1),m(a)&&a.count&&(n+=a.count)}else u(t)&&f(t,null,r,n)}(e,t,r)}function f(e,t,r,n){var i=s(e,t),o=l(i.a,i.b);(function(e){for(var t in e)if("a"!==t)return!0;return!1})(o)&&(r[n]=new d(d.THUNK,null,o))}function g(e){var t={};for(var r in e)t[r]=void 0;return t}function M(e,t,r){return e.splice(t,1),{from:t,key:r}}function C(e){for(var t={},r=[],n=e.length,i=0;i<n;i++){var o=e[i];o.key?t[o.key]=i:r.push(i)}return{keys:t,free:r}}function y(e,t){return e?(n(e)?e.push(t):e=[e,t],e):t}t.exports=l},{"../vnode/handle-thunk":242,"../vnode/is-thunk":243,"../vnode/is-vnode":245,"../vnode/is-vtext":246,"../vnode/is-widget":247,"../vnode/vpatch":250,"./diff-props":252,"x-is-array":272}],254:[function(t,r,e){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){r.exports=e(t)})(function(e){return e("./makePromise")({scheduler:new(e("./Scheduler"))(e("./env").asap)})})}()},{"./Scheduler":255,"./env":267,"./makePromise":269}],255:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){function e(e){this._async=e,this._running=!1,(this._queue=this)._queueLen=0,this._afterQueue={},this._afterQueueLen=0;var t=this;this.drain=function(){t._drain()}}return e.prototype.enqueue=function(e){this._queue[this._queueLen++]=e,this.run()},e.prototype.afterQueue=function(e){this._afterQueue[this._afterQueueLen++]=e,this.run()},e.prototype.run=function(){this._running||(this._running=!0,this._async(this.drain))},e.prototype._drain=function(){for(var e=0;e<this._queueLen;++e)this._queue[e].run(),this._queue[e]=void 0;for(this._queueLen=0,this._running=!1,e=0;e<this._afterQueueLen;++e)this._afterQueue[e].run(),this._afterQueue[e]=void 0;this._afterQueueLen=0},e})}()},{}],256:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(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)).constructor=t})}()},{}],257:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return e.tryCatchResolve=t,e;function e(s,a){return arguments.length<2&&(a=t),function(e,t,r){var n=s._defer(),i=r.length,o=new Array(i);return c({f:e,thisArg:t,args:r,params:o,i:i-1,call:a},n._handler),n};function c(e,t){if(e.i<0)return a(e.f,e.thisArg,e.params,t);s._handler(e.args[e.i]).fold(r,e,void 0,t)}function r(e,t,r){e.params[e.i]=t,e.i-=1,c(e,r)}}function t(e,t,r,n){try{n.resolve(e.apply(t,r))}catch(e){n.reject(e)}}})}()},{}],258:[function(t,r,e){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){r.exports=e(t)})(function(e){var u=e("../state"),h=e("../apply");return function(f){var i=h(f),r=f.resolve,n=f.all,o=Array.prototype.reduce,s=Array.prototype.reduceRight,a=Array.prototype.slice;return f.any=function(e){for(var t,r,n=f._defer(),i=n._handler,o=e.length>>>0,s=o,a=[],c=0;c<o;++c)if(void 0!==(r=e[c])||c in e){if(0<(t=f._handler(r)).state()){i.become(t),f._visitRemaining(e,c,t);break}t.visit(i,u,h)}else--s;0===s&&i.reject(new RangeError("any(): array must not be empty"));return n;function u(e){a=null,this.resolve(e)}function h(e){this.resolved||(a.push(e),0==--s&&this.reject(a))}},f.some=function(e,t){var r,n,i,o=f._defer(),s=o._handler,a=[],c=[],u=e.length>>>0,h=0;for(i=0;i<u;++i)(void 0!==(n=e[i])||i in e)&&++h;t=Math.max(t,0),r=h-t+1,(h=Math.min(t,h))<t?s.reject(new RangeError("some(): array must contain at least "+t+" item(s), but had "+h)):0===h&&s.resolve(a);for(i=0;i<u;++i)(void 0!==(n=e[i])||i in e)&&f._handler(n).visit(s,l,p,s.notify);return o;function l(e){this.resolved||(a.push(e),0==--h&&(c=null,this.resolve(a)))}function p(e){this.resolved||(c.push(e),0==--r&&(a=null,this.reject(c)))}},f.settle=function(e){return n(e.map(t))},f.map=function(e,t){return f._traverse(t,e)},f.filter=function(e,t){var r=a.call(e);return f._traverse(t,r).then(function(e){return function(e,t){for(var r=t.length,n=new Array(r),i=0,o=0;i<r;++i)t[i]&&(n[o++]=f._handler(e[i]).value);return n.length=o,n}(r,e)})},f.reduce=function(e,t){return 2<arguments.length?o.call(e,c(t),arguments[2]):o.call(e,c(t))},f.reduceRight=function(e,t){return 2<arguments.length?s.call(e,c(t),arguments[2]):s.call(e,c(t))},f.prototype.spread=function(t){return this.then(n).then(function(e){return t.apply(this,e)})},f;function t(e){var t;return e instanceof f&&(t=e._handler.join()),t&&0===t.state()||!t?r(e).then(u.fulfilled,u.rejected):(t._unreport(),u.inspect(t))}function c(n){return function(e,t,r){return i(n,void 0,[e,t,r])}}}})}()},{"../apply":257,"../state":270}],259:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return function(e){var c=e.resolve,s=e.reject,t=e.prototype.catch;function r(e,t,r,n){var i,o,s,a=e.call(t);return"object"!=typeof(s=a)&&"function"!=typeof s||null===s?r(n):(i=r,o=n,c(a).then(function(){return i(o)}))}return e.prototype.done=function(e,t){this._handler.visit(this._handler.receiver,e,t)},e.prototype.catch=e.prototype.otherwise=function(e){return arguments.length<2?t.call(this,e):"function"!=typeof e?this.ensure(n):t.call(this,(i=arguments[1],o=e,function(e){return t=e,((n=r=o)===Error||null!=n&&n.prototype instanceof Error?t instanceof r:r(t))?i.call(this,e):s(e);var t,r,n}));var i,o},e.prototype.finally=e.prototype.ensure=function(t){return"function"!=typeof t?this:this.then(function(e){return r(t,this,i,e)},function(e){return r(t,this,s,e)})},e.prototype.else=e.prototype.orElse=function(e){return this.then(void 0,function(){return e})},e.prototype.yield=function(e){return this.then(function(){return e})},e.prototype.tap=function(e){return this.then(e).yield(this)},e};function n(){throw new TypeError("catch predicate must be a function")}function i(e){return e}})}()},{}],260:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return function(i){return i.prototype.fold=function(n,e){var t=this._beget();return this._handler.fold(function(e,t,r){i._handler(e).fold(function(e,t,r){r.resolve(n.call(this,t,e))},t,this,r)},e,t._handler.receiver,t._handler),t},i}})}()},{}],261:[function(t,r,e){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){r.exports=e(t)})(function(e){var t=e("../state").inspect;return function(e){return e.prototype.inspect=function(){return t(e._handler(this))},e}})}()},{"../state":270}],262:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return function(e){var s=e.resolve;return e.iterate=function(t,e,r,n){return a(function(e){return[e,t(e)]},e,r,n)},e.unfold=a,e;function a(r,n,i,e){return s(e).then(function(t){return s(n(t)).then(function(e){return e?t:s(r(t)).spread(o)})});function o(e,t){return s(i(e)).then(function(){return a(r,n,i,t)})}}}})}()},{}],263:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return function(e){return e.prototype.progress=function(e){return this.then(void 0,void 0,e)},e}})}()},{}],264:[function(t,r,e){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){r.exports=e(t)})(function(e){var s=e("../env"),i=e("../TimeoutError");function a(e,t,r,n){return s.setTimer(function(){e(r,n,t)},t)}return function(e){function r(e,t,r){a(n,e,t,r)}function n(e,t){t.resolve(e)}function o(e,t,r){var n=void 0===e?new i("timed out after "+r+"ms"):e;t.reject(n)}return e.prototype.delay=function(e){var t=this._beget();return this._handler.fold(r,e,void 0,t._handler),t},e.prototype.timeout=function(e,t){var r=this._beget(),n=r._handler,i=a(o,e,t,r._handler);return this._handler.visit(n,function(e){s.clearTimer(i),this.resolve(e)},function(e){s.clearTimer(i),this.reject(e)},n.notify),r},e}})}()},{"../TimeoutError":256,"../env":267}],265:[function(t,r,e){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){r.exports=e(t)})(function(e){var l=e("../env").setTimer,p=e("../format");return function(e){var t,r=d,n=d;"undefined"!=typeof console&&(t=console,r=void 0!==t.error?function(e){t.error(e)}:function(e){t.log(e)},n=void 0!==t.info?function(e){t.info(e)}:function(e){t.log(e)}),e.onPotentiallyUnhandledRejection=function(e){u(a,e)},e.onPotentiallyUnhandledRejectionHandled=function(e){u(c,e)},e.onFatalRejection=function(e){u(f,e.value)};var i=[],o=[],s=null;function a(e){e.handled||(o.push(e),r("Potentially unhandled rejection ["+e.id+"] "+p.formatError(e.value)))}function c(e){var t=o.indexOf(e);0<=t&&(o.splice(t,1),n("Handled previous rejection ["+e.id+"] "+p.formatObject(e.value)))}function u(e,t){i.push(e,t),null===s&&(s=l(h,0))}function h(){for(s=null;0<i.length;)i.shift()(i.shift())}return e};function f(e){throw e}function d(){}})}()},{"../env":267,"../format":268}],266:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return function(e){return e.prototype.with=e.prototype.withThis=function(e){var t=this._beget(),r=t._handler;return r.receiver=e,this._handler.chain(r,e),t},e}})}()},{}],267:[function(t,r,e){(function(a){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){r.exports=e(t)})(function(e){var t,r="undefined"!=typeof setTimeout&&setTimeout,n=function(e,t){return setTimeout(e,t)},i=function(e){return clearTimeout(e)},o=function(e){return r(e,0)};if(void 0!==a&&"[object process]"===Object.prototype.toString.call(a))o=function(e){return a.nextTick(e)};else if(t="undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver)o=function(e){var t,r=document.createTextNode("");new e(function(){var e=t;t=void 0,e()}).observe(r,{characterData:!0});var n=0;return function(e){t=e,r.data=n^=1}}(t);else if(!r){var s=e("vertx");n=function(e,t){return s.setTimer(t,e)},i=s.cancelTimer,o=s.runOnLoop||s.runOnContext}return{setTimer:n,clearTimer:i,asap:o}})}()}).call(this,t("_process"))},{_process:6}],268:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return{formatError:function(e){var t="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:r(e);return e instanceof Error?t:t+" (WARNING: non-Error used)"},formatObject:r,tryStringify:n};function r(e){var t=String(e);return"[object Object]"===t&&"undefined"!=typeof JSON&&(t=n(e,t)),t}function n(e,t){try{return JSON.stringify(e)}catch(e){return t}}})}()},{}],269:[function(e,t,r){(function(B){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return function(e){var r=e.scheduler,t=function(){{if(null!=B&&"function"==typeof B.emit)return function(e,t){return"unhandledRejection"===e?B.emit(e,t.value,t):B.emit(e,t)};if("undefined"!=typeof self&&function(){if("function"==typeof CustomEvent)try{var e=new CustomEvent("unhandledRejection");return e instanceof CustomEvent}catch(e){}return!1}())return o=self,s=CustomEvent,function(e,t){var r=new s(e,{detail:{reason:t.value,key:t},bubbles:!1,cancelable:!0});return!o.dispatchEvent(r)};if("undefined"!=typeof self&&function(){if("undefined"!=typeof document&&"function"==typeof document.createEvent)try{var e=document.createEvent("CustomEvent");return e.initCustomEvent("eventType",!1,!0,{}),!0}catch(e){}return!1}())return n=self,i=document,function(e,t){var r=i.createEvent("CustomEvent");return r.initCustomEvent(e,!1,!0,{reason:t.value,key:t}),!n.dispatchEvent(r)}}var n,i;var o,s;return k}(),n=Object.create||function(e){function t(){}return t.prototype=e,new t};function h(e,t){this._handler=e===d?t:function(e){var t=new g;try{e(function(e){t.resolve(e)},r,function(e){t.notify(e)})}catch(e){r(e)}return t;function r(e){t.reject(e)}}(e)}function i(e){return A(e)?e:new h(d,new y(p(e)))}function o(e){return new h(d,new y(new w(e)))}function s(){return C}function a(n,i,o){for(var e,t="function"==typeof i?function(e,t,r){r.resolved||l(o,u,e,n(i,t,e),r)}:u,r=new g,s=o.length>>>0,a=new Array(s),c=0;c<o.length&&!r.resolved;++c)void 0!==(e=o[c])||c in o?l(o,t,c,e,r):--s;return 0===s&&r.become(new b(a)),new h(d,r);function u(e,t,r){a[e]=t,0==--s&&r.become(new b(a))}}function l(e,t,r,n,i){if(j(n)){var o=A(a=n)?a._handler.join():f(a),s=o.state();0===s?o.fold(t,r,void 0,i):0<s?t(r,o.value,i):(i.become(o),c(e,r+1,o))}else t(r,n,i);var a}function c(e,t,r){for(var n=t;n<e.length;++n)u(p(e[n]),r)}function u(e,t){if(e!==t){var r=e.state();0===r?e.visit(e,void 0,e._unreport):r<0&&e._unreport()}}function p(e){return A(e)?e._handler.join():j(e)?f(e):new b(e)}function f(e){try{var t=e.then;return"function"==typeof t?new _(t,e):new b(e)}catch(e){return new w(e)}}function d(){}function m(){}h.resolve=i,h.reject=o,h.never=s,h._defer=function(){return new h(d,new g)},h._handler=p,h.prototype.then=function(e,t,r){var n=this._handler,i=n.join().state();if("function"!=typeof e&&0<i||"function"!=typeof t&&i<0)return new this.constructor(d,n);var o=this._beget(),s=o._handler;return n.chain(s,n.receiver,e,t,r),o},h.prototype.catch=function(e){return this.then(void 0,e)},h.prototype._beget=function(){return e=this._handler,t=this.constructor,r=new g(e.receiver,e.join().context),new t(d,r);var e,t,r},h.all=function(e){return a(D,null,e)},h.race=function(e){return"object"==typeof e&&null!==e?0===e.length?s():1===e.length?i(e[0]):function(e){var t,r,n,i=new g;for(t=0;t<e.length;++t)if(void 0!==(r=e[t])||t in e){if(0!==(n=p(r)).state()){i.become(n),c(e,t+1,n);break}n.visit(i,i.resolve,i.reject)}return new h(d,i)}(e):o(new TypeError("non-iterable passed to race()"))},h._traverse=function(e,t){return a(N,e,t)},h._visitRemaining=c,d.prototype.when=d.prototype.become=d.prototype.notify=d.prototype.fail=d.prototype._unreport=d.prototype._report=k,d.prototype._state=0,d.prototype.state=function(){return this._state},d.prototype.join=function(){for(var e=this;void 0!==e.handler;)e=e.handler;return e},d.prototype.chain=function(e,t,r,n,i){this.when({resolver:e,receiver:t,fulfilled:r,rejected:n,progress:i})},d.prototype.visit=function(e,t,r,n){this.chain(v,e,t,r,n)},d.prototype.fold=function(e,t,r,n){this.when(new P(e,t,r,n))},I(d,m),m.prototype.become=function(e){e.fail()};var v=new m;function g(e,t){h.createContext(this,t),this.consumers=void 0,this.receiver=e,this.handler=void 0,this.resolved=!1}function y(e){this.handler=e}function _(e,t){g.call(this),r.enqueue(new O(e,t,this))}function b(e){h.createContext(this),this.value=e}I(d,g),g.prototype._state=0,g.prototype.resolve=function(e){this.become(p(e))},g.prototype.reject=function(e){this.resolved||this.become(new w(e))},g.prototype.join=function(){if(!this.resolved)return this;for(var e=this;void 0!==e.handler;)if((e=e.handler)===this)return this.handler=new w(new TypeError("Promise cycle"));return e},g.prototype.run=function(){var e=this.consumers,t=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var r=0;r<e.length;++r)t.when(e[r])},g.prototype.become=function(e){this.resolved||(this.resolved=!0,this.handler=e,void 0!==this.consumers&&r.enqueue(this),void 0!==this.context&&e._report(this.context))},g.prototype.when=function(e){this.resolved?r.enqueue(new E(e,this.handler)):void 0===this.consumers?this.consumers=[e]:this.consumers.push(e)},g.prototype.notify=function(e){this.resolved||r.enqueue(new T(e,this))},g.prototype.fail=function(e){var t=void 0===e?this.context:e;this.resolved&&this.handler.join().fail(t)},g.prototype._report=function(e){this.resolved&&this.handler.join()._report(e)},g.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},I(d,y),y.prototype.when=function(e){r.enqueue(new E(e,this))},y.prototype._report=function(e){this.join()._report(e)},y.prototype._unreport=function(){this.join()._unreport()},I(g,_),I(d,b),b.prototype._state=1,b.prototype.fold=function(e,t,r,n){!function(e,t,r,n,i){if("function"!=typeof e)return i.become(r);h.enterContext(r),function(e,t,r,n,i){try{e.call(n,t,r,i)}catch(e){i.become(new w(e))}}(e,t,r.value,n,i),h.exitContext()}(e,t,this,r,n)},b.prototype.when=function(e){R(e.fulfilled,this,e.receiver,e.resolver)};var x=0;function w(e){h.createContext(this),this.id=++x,this.value=e,this.handled=!1,this.reported=!1,this._report()}function S(e,t){this.rejection=e,this.context=t}function M(e){this.rejection=e}I(d,w),w.prototype._state=-1,w.prototype.fold=function(e,t,r,n){n.become(this)},w.prototype.when=function(e){"function"==typeof e.rejected&&this._unreport(),R(e.rejected,this,e.receiver,e.resolver)},w.prototype._report=function(e){r.afterQueue(new S(this,e))},w.prototype._unreport=function(){this.handled||(this.handled=!0,r.afterQueue(new M(this)))},w.prototype.fail=function(e){this.reported=!0,t("unhandledRejection",this),h.onFatalRejection(this,void 0===e?this.context:e)},S.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,t("unhandledRejection",this.rejection)||h.onPotentiallyUnhandledRejection(this.rejection,this.context))},M.prototype.run=function(){this.rejection.reported&&(t("rejectionHandled",this.rejection)||h.onPotentiallyUnhandledRejectionHandled(this.rejection))},h.createContext=h.enterContext=h.exitContext=h.onPotentiallyUnhandledRejection=h.onPotentiallyUnhandledRejectionHandled=h.onFatalRejection=k;var C=new h(d,new d);function E(e,t){this.continuation=e,this.handler=t}function T(e,t){this.handler=t,this.value=e}function O(e,t,r){this._then=e,this.thenable=t,this.resolver=r}function P(e,t,r,n){this.f=e,this.z=t,this.c=r,this.to=n,this.resolver=v,this.receiver=this}function A(e){return e instanceof h}function j(e){return("object"==typeof e||"function"==typeof e)&&null!==e}function R(e,t,r,n){if("function"!=typeof e)return n.become(t);h.enterContext(t),function(e,t,r,n){try{n.become(p(e.call(r,t)))}catch(e){n.become(new w(e))}}(e,t.value,r,n),h.exitContext()}function L(e,t,r,n,i){if("function"!=typeof e)return i.notify(t);h.enterContext(r),function(e,t,r,n){try{n.notify(e.call(r,t))}catch(e){n.notify(e)}}(e,t,n,i),h.exitContext()}function N(e,t,r){try{return e(t,r)}catch(e){return o(e)}}function I(e,t){t.prototype=n(e.prototype),t.prototype.constructor=t}function D(e,t){return t}function k(){}return E.prototype.run=function(){this.handler.join().when(this.continuation)},T.prototype.run=function(){var e=this.handler.consumers;if(void 0!==e)for(var t,r=0;r<e.length;++r)L((t=e[r]).progress,this.value,this.handler,t.receiver,t.resolver)},O.prototype.run=function(){var t=this.resolver;!function(e,t,r,n,i){try{e.call(t,r,n,i)}catch(e){n(e)}}(this._then,this.thenable,function(e){t.resolve(e)},function(e){t.reject(e)},function(e){t.notify(e)})},P.prototype.fulfilled=function(e){this.f.call(this.c,this.z,e,this.to)},P.prototype.rejected=function(e){this.to.reject(e)},P.prototype.progress=function(e){this.to.notify(e)},h}})}()}).call(this,e("_process"))},{_process:6}],270:[function(e,t,r){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){t.exports=e()})(function(){return{pending:e,fulfilled:n,rejected:r,inspect:function(e){var t=e.state();return 0===t?{state:"pending"}:0<t?n(e.value):r(e.value)}};function e(){return{state:"pending"}}function r(e){return{state:"rejected",reason:e}}function n(e){return{state:"fulfilled",value:e}}})}()},{}],271:[function(t,r,e){!function(e){"use strict";(typeof n==="function"&&n.amd?n:function(e){r.exports=e(t)})(function(e){var t=e("./lib/decorators/timed"),r=e("./lib/decorators/array"),n=e("./lib/decorators/flow"),i=e("./lib/decorators/fold"),o=e("./lib/decorators/inspect"),s=e("./lib/decorators/iterate"),a=e("./lib/decorators/progress"),c=e("./lib/decorators/with"),u=e("./lib/decorators/unhandledRejection"),h=e("./lib/TimeoutError"),l=[r,n,i,s,a,o,c,t,u].reduce(function(e,t){return t(e)},e("./lib/Promise")),p=e("./lib/apply")(l);function f(e,t,r,n){var i=l.resolve(e);return arguments.length<2?i:i.then(t,r,n)}function d(n){return function(){for(var e=0,t=arguments.length,r=new Array(t);e<t;++e)r[e]=arguments[e];return p(n,this,r)}}function m(e){for(var t=0,r=arguments.length-1,n=new Array(r);t<r;++t)n[t]=arguments[t+1];return p(e,this,n)}function v(){var t=l._defer();function e(e){t._handler.resolve(e)}function r(e){t._handler.reject(e)}function n(e){t._handler.notify(e)}this.promise=t,this.resolve=e,this.reject=r,this.notify=n,this.resolver={resolve:e,reject:r,notify:n}}return f.promise=function(e){return new l(e)},f.resolve=l.resolve,f.reject=l.reject,f.lift=d,f.try=m,f.attempt=m,f.iterate=l.iterate,f.unfold=l.unfold,f.join=function(){return l.all(arguments)},f.all=function(e){return f(e,l.all)},f.settle=function(e){return f(e,l.settle)},f.any=d(l.any),f.some=d(l.some),f.race=d(l.race),f.map=function(e,t){return f(e,function(e){return l.map(e,t)})},f.filter=function(e,t){return f(e,function(e){return l.filter(e,t)})},f.reduce=d(l.reduce),f.reduceRight=d(l.reduceRight),f.isPromiseLike=function(e){return e&&"function"==typeof e.then},f.Promise=l,f.defer=function(){return new v},f.TimeoutError=h,f})}()},{"./lib/Promise":254,"./lib/TimeoutError":256,"./lib/apply":257,"./lib/decorators/array":258,"./lib/decorators/flow":259,"./lib/decorators/fold":260,"./lib/decorators/inspect":261,"./lib/decorators/iterate":262,"./lib/decorators/progress":263,"./lib/decorators/timed":264,"./lib/decorators/unhandledRejection":265,"./lib/decorators/with":266}],272:[function(e,t,r){var n=Array.isArray,i=Object.prototype.toString;t.exports=n||function(e){return"[object Array]"===i.call(e)}},{}],273:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./api/APIv3");r.APIv3=n.APIv3;var i=e("./api/ModelCreator");r.ModelCreator=i.ModelCreator},{"./api/APIv3":286,"./api/ModelCreator":287}],274:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./component/Component");r.Component=n.Component;var i=e("./component/ComponentService");r.ComponentService=i.ComponentService;var o=e("./component/utils/HandlerBase");r.HandlerBase=o.HandlerBase;var s=e("./component/utils/MeshFactory");r.MeshFactory=s.MeshFactory;var a=e("./component/utils/MeshScene");r.MeshScene=a.MeshScene;var c=e("./component/utils/MouseOperator");r.MouseOperator=c.MouseOperator;var u=e("./component/AttributionComponent");r.AttributionComponent=u.AttributionComponent;var h=e("./component/BackgroundComponent");r.BackgroundComponent=h.BackgroundComponent;var l=e("./component/BearingComponent");r.BearingComponent=l.BearingComponent;var p=e("./component/CacheComponent");r.CacheComponent=p.CacheComponent;var f=e("./component/CoverComponent");r.CoverComponent=f.CoverComponent;var d=e("./component/DebugComponent");r.DebugComponent=d.DebugComponent;var m=e("./component/direction/DirectionComponent");r.DirectionComponent=m.DirectionComponent;var v=e("./component/direction/DirectionDOMCalculator");r.DirectionDOMCalculator=v.DirectionDOMCalculator;var g=e("./component/direction/DirectionDOMRenderer");r.DirectionDOMRenderer=g.DirectionDOMRenderer;var y=e("./component/ImageComponent");r.ImageComponent=y.ImageComponent;var _=e("./component/keyboard/KeyboardComponent");r.KeyboardComponent=_.KeyboardComponent;var b=e("./component/keyboard/KeyPlayHandler");r.KeyPlayHandler=b.KeyPlayHandler;var x=e("./component/keyboard/KeyZoomHandler");r.KeyZoomHandler=x.KeyZoomHandler;var w=e("./component/keyboard/KeySequenceNavigationHandler");r.KeySequenceNavigationHandler=w.KeySequenceNavigationHandler;var S=e("./component/keyboard/KeySpatialNavigationHandler");r.KeySpatialNavigationHandler=S.KeySpatialNavigationHandler;var M=e("./component/LoadingComponent");r.LoadingComponent=M.LoadingComponent;var C=e("./component/marker/marker/Marker");r.Marker=C.Marker;var E=e("./component/marker/MarkerComponent");r.MarkerComponent=E.MarkerComponent;var T=e("./component/marker/MarkerScene");r.MarkerScene=T.MarkerScene;var O=e("./component/marker/MarkerSet");r.MarkerSet=O.MarkerSet;var P=e("./component/mouse/MouseComponent");r.MouseComponent=P.MouseComponent;var A=e("./component/mouse/BounceHandler");r.BounceHandler=A.BounceHandler;var j=e("./component/mouse/DragPanHandler");r.DragPanHandler=j.DragPanHandler;var R=e("./component/mouse/DoubleClickZoomHandler");r.DoubleClickZoomHandler=R.DoubleClickZoomHandler;var L=e("./component/mouse/EarthControlHandler");r.EarthControlHandler=L.EarthControlHandler;var N=e("./component/mouse/ScrollZoomHandler");r.ScrollZoomHandler=N.ScrollZoomHandler;var I=e("./component/mouse/TouchZoomHandler");r.TouchZoomHandler=I.TouchZoomHandler;var D=e("./component/mouse/ImageBoundary");r.ImageBoundary=D;var k=e("./component/popup/popup/Popup");r.Popup=k.Popup;var B=e("./component/popup/PopupComponent");r.PopupComponent=B.PopupComponent;var F=e("./component/NavigationComponent");r.NavigationComponent=F.NavigationComponent;var $=e("./component/RouteComponent");r.RouteComponent=$.RouteComponent;var U=e("./component/sequence/SequenceComponent");r.SequenceComponent=U.SequenceComponent;var z=e("./component/sequence/SequenceDOMRenderer");r.SequenceDOMRenderer=z.SequenceDOMRenderer;var G=e("./component/sequence/SequenceMode");r.SequenceMode=G.SequenceMode;var V=e("./component/spatialdata/SpatialDataCache");r.SpatialDataCache=V.SpatialDataCache;var H=e("./component/spatialdata/SpatialDataComponent");r.SpatialDataComponent=H.SpatialDataComponent;var q=e("./component/spatialdata/SpatialDataScene");r.SpatialDataScene=q.SpatialDataScene;var W=e("./component/imageplane/ImagePlaneComponent");r.ImagePlaneComponent=W.ImagePlaneComponent;var X=e("./component/imageplane/ImagePlaneGLRenderer");r.ImagePlaneGLRenderer=X.ImagePlaneGLRenderer;var Y=e("./component/shaders/Shaders");r.Shaders=Y.Shaders;var K=e("./component/marker/marker/SimpleMarker");r.SimpleMarker=K.SimpleMarker;var Z=e("./component/marker/marker/CircleMarker");r.CircleMarker=Z.CircleMarker;var J=e("./component/slider/SliderComponent");r.SliderComponent=J.SliderComponent;var Q=e("./component/slider/SliderDOMRenderer");r.SliderDOMRenderer=Q.SliderDOMRenderer;var ee=e("./component/slider/SliderGLRenderer");r.SliderGLRenderer=ee.SliderGLRenderer;var te=e("./component/StatsComponent");r.StatsComponent=te.StatsComponent;var re=e("./component/tag/handlers/TagHandlerBase");r.TagHandlerBase=re.TagHandlerBase;var ne=e("./component/tag/handlers/CreateHandlerBase");r.CreateHandlerBase=ne.CreateHandlerBase;var ie=e("./component/tag/handlers/CreatePointHandler");r.CreatePointHandler=ie.CreatePointHandler;var oe=e("./component/tag/handlers/CreateVertexHandler");r.CreateVertexHandler=oe.CreateVertexHandler;var se=e("./component/tag/handlers/CreatePolygonHandler");r.CreatePolygonHandler=se.CreatePolygonHandler;var ae=e("./component/tag/handlers/CreateRectHandler");r.CreateRectHandler=ae.CreateRectHandler;var ce=e("./component/tag/handlers/CreateRectDragHandler");r.CreateRectDragHandler=ce.CreateRectDragHandler;var ue=e("./component/tag/handlers/EditVertexHandler");r.EditVertexHandler=ue.EditVertexHandler;var he=e("./component/tag/tag/Tag");r.Tag=he.Tag;var le=e("./component/tag/tag/OutlineTag");r.OutlineTag=le.OutlineTag;var pe=e("./component/tag/tag/RenderTag");r.RenderTag=pe.RenderTag;var fe=e("./component/tag/tag/OutlineRenderTag");r.OutlineRenderTag=fe.OutlineRenderTag;var de=e("./component/tag/tag/OutlineCreateTag");r.OutlineCreateTag=de.OutlineCreateTag;var me=e("./component/tag/tag/SpotTag");r.SpotTag=me.SpotTag;var ve=e("./component/tag/tag/SpotRenderTag");r.SpotRenderTag=ve.SpotRenderTag;var ge=e("./component/tag/tag/TagDomain");r.TagDomain=ge.TagDomain;var ye=e("./component/tag/TagComponent");r.TagComponent=ye.TagComponent;var _e=e("./component/tag/TagCreator");r.TagCreator=_e.TagCreator;var be=e("./component/tag/TagDOMRenderer");r.TagDOMRenderer=be.TagDOMRenderer;var xe=e("./component/tag/TagMode");r.TagMode=xe.TagMode;var we=e("./component/tag/TagOperation");r.TagOperation=we.TagOperation;var Se=e("./component/tag/TagScene");r.TagScene=Se.TagScene;var Me=e("./component/tag/TagSet");r.TagSet=Me.TagSet;var Ce=e("./component/tag/geometry/Geometry");r.Geometry=Ce.Geometry;var Ee=e("./component/tag/geometry/VertexGeometry");r.VertexGeometry=Ee.VertexGeometry;var Te=e("./component/tag/geometry/RectGeometry");r.RectGeometry=Te.RectGeometry;var Oe=e("./component/tag/geometry/PointGeometry");r.PointGeometry=Oe.PointGeometry;var Pe=e("./component/tag/geometry/PolygonGeometry");r.PolygonGeometry=Pe.PolygonGeometry;var Ae=e("./component/tag/error/GeometryTagError");r.GeometryTagError=Ae.GeometryTagError;var je=e("./component/zoom/ZoomComponent");r.ZoomComponent=je.ZoomComponent,function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("./component/interfaces/interfaces"))},{"./component/AttributionComponent":288,"./component/BackgroundComponent":289,"./component/BearingComponent":290,"./component/CacheComponent":291,"./component/Component":292,"./component/ComponentService":293,"./component/CoverComponent":294,"./component/DebugComponent":295,"./component/ImageComponent":296,"./component/LoadingComponent":297,"./component/NavigationComponent":298,"./component/RouteComponent":299,"./component/StatsComponent":300,"./component/direction/DirectionComponent":301,"./component/direction/DirectionDOMCalculator":302,"./component/direction/DirectionDOMRenderer":303,"./component/imageplane/ImagePlaneComponent":304,"./component/imageplane/ImagePlaneGLRenderer":305,"./component/interfaces/interfaces":308,"./component/keyboard/KeyPlayHandler":309,"./component/keyboard/KeySequenceNavigationHandler":310,"./component/keyboard/KeySpatialNavigationHandler":311,"./component/keyboard/KeyZoomHandler":312,"./component/keyboard/KeyboardComponent":313,"./component/marker/MarkerComponent":315,"./component/marker/MarkerScene":316,"./component/marker/MarkerSet":317,"./component/marker/marker/CircleMarker":318,"./component/marker/marker/Marker":319,"./component/marker/marker/SimpleMarker":320,"./component/mouse/BounceHandler":321,"./component/mouse/DoubleClickZoomHandler":322,"./component/mouse/DragPanHandler":323,"./component/mouse/EarthControlHandler":324,"./component/mouse/ImageBoundary":325,"./component/mouse/MouseComponent":326,"./component/mouse/ScrollZoomHandler":327,"./component/mouse/TouchZoomHandler":328,"./component/popup/PopupComponent":330,"./component/popup/popup/Popup":331,"./component/sequence/SequenceComponent":332,"./component/sequence/SequenceDOMRenderer":333,"./component/sequence/SequenceMode":334,"./component/shaders/Shaders":335,"./component/slider/SliderComponent":336,"./component/slider/SliderDOMRenderer":337,"./component/slider/SliderGLRenderer":338,"./component/spatialdata/SpatialDataCache":339,"./component/spatialdata/SpatialDataComponent":340,"./component/spatialdata/SpatialDataScene":341,"./component/tag/TagComponent":343,"./component/tag/TagCreator":344,"./component/tag/TagDOMRenderer":345,"./component/tag/TagMode":346,"./component/tag/TagOperation":347,"./component/tag/TagScene":348,"./component/tag/TagSet":349,"./component/tag/error/GeometryTagError":350,"./component/tag/geometry/Geometry":351,"./component/tag/geometry/PointGeometry":352,"./component/tag/geometry/PolygonGeometry":353,"./component/tag/geometry/RectGeometry":354,"./component/tag/geometry/VertexGeometry":355,"./component/tag/handlers/CreateHandlerBase":356,"./component/tag/handlers/CreatePointHandler":357,"./component/tag/handlers/CreatePolygonHandler":358,"./component/tag/handlers/CreateRectDragHandler":359,"./component/tag/handlers/CreateRectHandler":360,"./component/tag/handlers/CreateVertexHandler":361,"./component/tag/handlers/EditVertexHandler":362,"./component/tag/handlers/TagHandlerBase":363,"./component/tag/tag/OutlineCreateTag":364,"./component/tag/tag/OutlineRenderTag":365,"./component/tag/tag/OutlineTag":366,"./component/tag/tag/RenderTag":367,"./component/tag/tag/SpotRenderTag":368,"./component/tag/tag/SpotTag":369,"./component/tag/tag/Tag":370,"./component/tag/tag/TagDomain":371,"./component/utils/HandlerBase":372,"./component/utils/MeshFactory":373,"./component/utils/MeshScene":374,"./component/utils/MouseOperator":375,"./component/zoom/ZoomComponent":376}],275:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./graph/edge/EdgeDirection");r.EdgeDirection=n.EdgeDirection;var i=e("./graph/edge/EdgeCalculatorSettings");r.EdgeCalculatorSettings=i.EdgeCalculatorSettings;var o=e("./graph/edge/EdgeCalculatorDirections");r.EdgeCalculatorDirections=o.EdgeCalculatorDirections;var s=e("./graph/edge/EdgeCalculatorCoefficients");r.EdgeCalculatorCoefficients=s.EdgeCalculatorCoefficients;var a=e("./graph/edge/EdgeCalculator");r.EdgeCalculator=a.EdgeCalculator},{"./graph/edge/EdgeCalculator":398,"./graph/edge/EdgeCalculatorCoefficients":399,"./graph/edge/EdgeCalculatorDirections":400,"./graph/edge/EdgeCalculatorSettings":401,"./graph/edge/EdgeDirection":402}],276:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./error/AbortMapillaryError");r.AbortMapillaryError=n.AbortMapillaryError;var i=e("./error/ArgumentMapillaryError");r.ArgumentMapillaryError=i.ArgumentMapillaryError;var o=e("./error/GraphMapillaryError");r.GraphMapillaryError=o.GraphMapillaryError;var s=e("./error/MapillaryError");r.MapillaryError=s.MapillaryError},{"./error/AbortMapillaryError":377,"./error/ArgumentMapillaryError":378,"./error/GraphMapillaryError":379,"./error/MapillaryError":380}],277:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./geo/Camera");r.Camera=n.Camera;var i=e("./geo/GeoCoords");r.GeoCoords=i.GeoCoords;var o=e("./geo/ViewportCoords");r.ViewportCoords=o.ViewportCoords;var s=e("./geo/Spatial");r.Spatial=s.Spatial;var a=e("./geo/Transform");r.Transform=a.Transform;var c=e("./geo/Geo");r.Geo=c;var u=e("./geo/Lines");r.Lines=u},{"./geo/Camera":381,"./geo/Geo":382,"./geo/GeoCoords":383,"./geo/Lines":384,"./geo/Spatial":385,"./geo/Transform":386,"./geo/ViewportCoords":387}],278:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./graph/FilterCreator");r.FilterCreator=n.FilterCreator;var i=e("./graph/Graph");r.Graph=i.Graph;var o=e("./graph/GraphCalculator");r.GraphCalculator=o.GraphCalculator;var s=e("./graph/GraphMode");r.GraphMode=s.GraphMode;var a=e("./graph/GraphService");r.GraphService=a.GraphService;var c=e("./graph/ImageLoadingService");r.ImageLoadingService=c.ImageLoadingService;var u=e("./graph/MeshReader");r.MeshReader=u.MeshReader;var h=e("./graph/Node");r.Node=h.Node;var l=e("./graph/NodeCache");r.NodeCache=l.NodeCache;var p=e("./graph/Sequence");r.Sequence=p.Sequence},{"./graph/FilterCreator":388,"./graph/Graph":389,"./graph/GraphCalculator":390,"./graph/GraphMode":391,"./graph/GraphService":392,"./graph/ImageLoadingService":393,"./graph/MeshReader":394,"./graph/Node":395,"./graph/NodeCache":396,"./graph/Sequence":397}],279:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("./Support"));var n=e("./Edge");r.EdgeDirection=n.EdgeDirection;var i=e("./Error");r.AbortMapillaryError=i.AbortMapillaryError;var o=e("./Render");r.RenderMode=o.RenderMode;var s=e("./State");r.TransitionMode=s.TransitionMode;var a=e("./Viewer");r.Alignment=a.Alignment,r.ImageSize=a.ImageSize,r.Viewer=a.Viewer;var c=e("./Component");r.SliderMode=c.SliderMode;var u=e("./component/tag/Tag");r.TagComponent=u;var h=e("./component/marker/Marker");r.MarkerComponent=h;var l=e("./component/popup/Popup");r.PopupComponent=l},{"./Component":274,"./Edge":275,"./Error":276,"./Render":280,"./State":281,"./Support":282,"./Viewer":285,"./component/marker/Marker":314,"./component/popup/Popup":329,"./component/tag/Tag":342}],280:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./render/DOMRenderer");r.DOMRenderer=n.DOMRenderer;var i=e("./render/GLRenderer");r.GLRenderer=i.GLRenderer;var o=e("./render/GLRenderStage");r.GLRenderStage=o.GLRenderStage;var s=e("./render/RenderCamera");r.RenderCamera=s.RenderCamera;var a=e("./render/RenderMode");r.RenderMode=a.RenderMode;var c=e("./render/RenderService");r.RenderService=c.RenderService},{"./render/DOMRenderer":403,"./render/GLRenderStage":404,"./render/GLRenderer":405,"./render/RenderCamera":406,"./render/RenderMode":407,"./render/RenderService":408}],281:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./state/FrameGenerator");r.FrameGenerator=n.FrameGenerator;var i=e("./state/RotationDelta");r.RotationDelta=i.RotationDelta;var o=e("./state/State");r.State=o.State;var s=e("./state/states/StateBase");r.StateBase=s.StateBase;var a=e("./state/StateContext");r.StateContext=a.StateContext;var c=e("./state/StateService");r.StateService=c.StateService;var u=e("./state/TransitionMode");r.TransitionMode=u.TransitionMode;var h=e("./state/states/EarthState");r.EarthState=h.EarthState;var l=e("./state/states/InteractiveStateBase");r.InteractiveStateBase=l.InteractiveStateBase;var p=e("./state/states/InteractiveWaitingState");r.InteractiveWaitingState=p.InteractiveWaitingState;var f=e("./state/states/TraversingState");r.TraversingState=f.TraversingState;var d=e("./state/states/WaitingState");r.WaitingState=d.WaitingState},{"./state/FrameGenerator":409,"./state/RotationDelta":410,"./state/State":411,"./state/StateContext":412,"./state/StateService":413,"./state/TransitionMode":414,"./state/states/EarthState":415,"./state/states/InteractiveStateBase":416,"./state/states/InteractiveWaitingState":417,"./state/states/StateBase":418,"./state/states/TraversingState":419,"./state/states/WaitingState":420}],282:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./utils/Support");function i(){return n.isBrowser()&&n.isBlobSupported()&&n.isArraySupported()&&n.isFunctionSupported()&&n.isJSONSupported()&&n.isObjectSupported()}r.isSupported=function(){return i()&&n.isWebGLSupportedCached()},r.isFallbackSupported=i},{"./utils/Support":428}],283:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./tiles/ImageTileLoader");r.ImageTileLoader=n.ImageTileLoader;var i=e("./tiles/ImageTileStore");r.ImageTileStore=i.ImageTileStore;var o=e("./tiles/TextureProvider");r.TextureProvider=o.TextureProvider;var s=e("./tiles/RegionOfInterestCalculator");r.RegionOfInterestCalculator=s.RegionOfInterestCalculator},{"./tiles/ImageTileLoader":421,"./tiles/ImageTileStore":422,"./tiles/RegionOfInterestCalculator":423,"./tiles/TextureProvider":424}],284:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./utils/DOM");r.DOM=n.DOM;var i=e("./utils/EventEmitter");r.EventEmitter=i.EventEmitter;var o=e("./utils/Settings");r.Settings=o.Settings,function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("./utils/Support"));var s=e("./utils/Urls");r.Urls=s.Urls},{"./utils/DOM":425,"./utils/EventEmitter":426,"./utils/Settings":427,"./utils/Support":428,"./utils/Urls":429}],285:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./viewer/Alignment");r.Alignment=n.Alignment;var i=e("./viewer/CacheService");r.CacheService=i.CacheService;var o=e("./viewer/ComponentController");r.ComponentController=o.ComponentController;var s=e("./viewer/Container");r.Container=s.Container;var a=e("./viewer/Observer");r.Observer=a.Observer;var c=e("./viewer/ImageSize");r.ImageSize=c.ImageSize;var u=e("./viewer/KeyboardService");r.KeyboardService=u.KeyboardService;var h=e("./viewer/LoadingService");r.LoadingService=h.LoadingService;var l=e("./viewer/MouseService");r.MouseService=l.MouseService;var p=e("./viewer/Navigator");r.Navigator=p.Navigator;var f=e("./viewer/PlayService");r.PlayService=f.PlayService;var d=e("./viewer/Projection");r.Projection=d.Projection;var m=e("./viewer/SpriteService");r.SpriteService=m.SpriteService;var v=e("./viewer/TouchService");r.TouchService=v.TouchService;var g=e("./viewer/Viewer");r.Viewer=g.Viewer},{"./viewer/Alignment":430,"./viewer/CacheService":431,"./viewer/ComponentController":432,"./viewer/Container":433,"./viewer/ImageSize":434,"./viewer/KeyboardService":435,"./viewer/LoadingService":436,"./viewer/MouseService":437,"./viewer/Navigator":438,"./viewer/Observer":439,"./viewer/PlayService":440,"./viewer/Projection":441,"./viewer/SpriteService":442,"./viewer/TouchService":443,"./viewer/Viewer":444}],286:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("rxjs/operators"),n=e("rxjs"),i=e("../API"),o=function(){function e(e,t,r){this._clientId=e,this._modelCreator=null!=r?r:new i.ModelCreator,this._model=this._modelCreator.createModel(e,t),this._pageCount=999,this._pathImageByKey="imageByKey",this._pathImageCloseTo="imageCloseTo",this._pathImagesByH="imagesByH",this._pathImageViewAdd="imageViewAdd",this._pathSequenceByKey="sequenceByKey",this._pathSequenceViewAdd="sequenceViewAdd",this._propertiesCore=["cl","l","sequence_key"],this._propertiesFill=["captured_at","captured_with_camera_uuid","user","organization_key","private","project"],this._propertiesKey=["key"],this._propertiesSequence=["keys"],this._propertiesSpatial=["atomic_scale","ca","calt","cca","cfocal","ck1","ck2","gpano","height","merge_cc","merge_version","c_rotation","orientation","width"],this._propertiesUser=["username"]}return e.prototype.imageByKeyFill$=function(t){return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImageByKey,t,this._propertiesKey.concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).pipe(a.map(function(e){if(!e)throw new Error("Images ("+t.join(", ")+") could not be found.");return e.json.imageByKey})),this._pathImageByKey,t)},e.prototype.imageByKeyFull$=function(t){return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImageByKey,t,this._propertiesKey.concat(this._propertiesCore).concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).pipe(a.map(function(e){if(!e)throw new Error("Images ("+t.join(", ")+") could not be found.");return e.json.imageByKey})),this._pathImageByKey,t)},e.prototype.imageCloseTo$=function(e,t){var r=t+":"+e;return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImageCloseTo,[r],this._propertiesKey.concat(this._propertiesCore).concat(this._propertiesFill).concat(this._propertiesSpatial),this._propertiesKey.concat(this._propertiesUser)])).pipe(a.map(function(e){return null!=e?e.json.imageCloseTo[r]:null})),this._pathImageCloseTo,[r])},e.prototype.imagesByH$=function(o){var s=this;return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathImagesByH,o,{from:0,to:this._pageCount},this._propertiesKey.concat(this._propertiesCore)])).pipe(a.map(function(e){if(!e){e={json:{imagesByH:{}}};for(var t=0,r=o;t<r.length;t++){var n=r[t];e.json.imagesByH[n]={};for(var i=0;i<=s._pageCount;i++)e.json.imagesByH[n][i]=null}}return e.json.imagesByH})),this._pathImagesByH,o)},e.prototype.imageViewAdd$=function(e){return this._catchInvalidateCall$(this._wrapCallModelResponse$(this._model.call([this._pathImageViewAdd],[e])),this._pathImageViewAdd,e)},e.prototype.invalidateImageByKey=function(e){this._invalidateGet(this._pathImageByKey,e)},e.prototype.invalidateImagesByH=function(e){this._invalidateGet(this._pathImagesByH,e)},e.prototype.invalidateSequenceByKey=function(e){this._invalidateGet(this._pathSequenceByKey,e)},e.prototype.setToken=function(e){this._model.invalidate([]),this._model=null,this._model=this._modelCreator.createModel(this._clientId,e)},e.prototype.sequenceByKey$=function(i){return this._catchInvalidateGet$(this._wrapModelResponse$(this._model.get([this._pathSequenceByKey,i,this._propertiesKey.concat(this._propertiesSequence)])).pipe(a.map(function(e){e||(e={json:{sequenceByKey:{}}});for(var t=0,r=i;t<r.length;t++){var n=r[t];n in e.json.sequenceByKey||(console.warn("Sequence data missing ("+n+")"),e.json.sequenceByKey[n]={key:n,keys:[]})}return e.json.sequenceByKey})),this._pathSequenceByKey,i)},e.prototype.sequenceViewAdd$=function(e){return this._catchInvalidateCall$(this._wrapCallModelResponse$(this._model.call([this._pathSequenceViewAdd],[e])),this._pathSequenceViewAdd,e)},Object.defineProperty(e.prototype,"clientId",{get:function(){return this._clientId},enumerable:!0,configurable:!0}),e.prototype._catchInvalidateGet$=function(e,t,r){var n=this;return e.pipe(a.catchError(function(e){throw n._invalidateGet(t,r),e}))},e.prototype._catchInvalidateCall$=function(e,t,r){var n=this;return e.pipe(a.catchError(function(e){throw n._invalidateCall(t,r),e}))},e.prototype._invalidateGet=function(e,t){this._model.invalidate([e,t])},e.prototype._invalidateCall=function(e,t){this._model.invalidate([e],[t])},e.prototype._wrapModelResponse$=function(e){return n.Observable.create(function(t){e.then(function(e){t.next(e),t.complete()},function(e){t.error(e)})})},e.prototype._wrapCallModelResponse$=function(e){return this._wrapModelResponse$(e).pipe(a.map(function(e){}))},e}();r.APIv3=o,r.default=o},{"../API":273,rxjs:26,"rxjs/operators":224}],287:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("falcor"),i=e("falcor-http-datasource"),o=e("../Utils"),s=function(){function e(){}return e.prototype.createModel=function(e,t){var r={crossDomain:!0,withCredentials:!1};return null!=t&&(r.headers={Authorization:"Bearer "+t}),new n.Model({maxSize:16777216,source:new i.default(o.Urls.falcorModel(e),r)})},e}();r.ModelCreator=s,r.default=s},{"../Utils":284,falcor:15,"falcor-http-datasource":10}],288:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),s=e("rxjs/operators"),d=e("virtual-dom"),a=e("../Component"),m=e("../Utils"),c=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return i(e,n),e.prototype._activate=function(){var n=this;this._disposable=o.combineLatest(this._navigator.stateService.currentNode$,this._container.renderService.size$).pipe(s.map(function(e){var t=e[0],r=e[1];return{name:n._name,vnode:n._getAttributionNode(t.username,t.key,t.capturedAt,r.width)}})).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getAttributionNode=function(e,t,r,n){var i=n<=640,o=d.h("div.AttributionMapillaryLogo",[]),s=d.h("a.AttributionIconContainer",{href:m.Urls.explore,target:"_blank"},[o]),a=i?""+e:"image by "+e,c=d.h("div.AttributionUsername",{textContent:a},[]),u=new Date(r).toDateString().split(" "),h=(3<u.length?i?[u[3]]:[u[1],u[2]+",",u[3]]:u).join(" "),l=d.h("div.AttributionDate",{textContent:h},[]),p=d.h("a.AttributionImageContainer",{href:m.Urls.exporeImage(t),target:"_blank"},[c,l]),f=i?".AttributionCompact":"";return d.h("div.AttributionContainer"+f,{},[s,p])},e.componentName="attribution",e}(a.Component);r.AttributionComponent=c,a.ComponentService.register(c),r.default=c},{"../Component":274,"../Utils":284,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],289:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("virtual-dom"),s=e("../Component"),a=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return i(e,n),e.prototype._activate=function(){this._container.domRenderer.render$.next({name:this._name,vnode:this._getBackgroundNode("The viewer can't display the given image.")})},e.prototype._deactivate=function(){},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getBackgroundNode=function(e){return o.h("div.BackgroundWrapper",{},[o.h("p",{textContent:e},[])])},e.componentName="background",e}(s.Component);r.BackgroundComponent=a,s.ComponentService.register(a),r.default=a},{"../Component":274,"virtual-dom":230}],290:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs/operators"),u=e("virtual-dom"),i=e("../Component"),a=e("../Geo"),c=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n._spatial=new a.Spatial,n._svgNamespace="http://www.w3.org/2000/svg",n._distinctThreshold=Math.PI/360,n}return o(e,i),e.prototype._activate=function(){var a=this,e=this._container.renderService.renderCamera$.pipe(s.map(function(e){var t=a._spatial.degToRad(e.perspective.fov),r=e.perspective.aspect===Number.POSITIVE_INFINITY?Math.PI:2*Math.atan(e.perspective.aspect*Math.tan(.5*t));return[a._spatial.azimuthalToBearing(e.rotation.phi),r]}),s.distinctUntilChanged(function(e,t){return Math.abs(t[0]-e[0])<a._distinctThreshold&&Math.abs(t[1]-e[1])<a._distinctThreshold}));this._renderSubscription=e.pipe(s.map(function(e){var t=e[0],r=e[1],n=u.h("div.BearingIndicatorBackground",{},[]),i=u.h("div.BearingIndicatorBackgroundCircle",{},[]),o=a._createNorth(t),s=a._createCircleSectorCompass(a._createCircleSector(Math.max(Math.PI/20,r),"#FFF"));return{name:a._name,vnode:u.h("div.BearingIndicatorContainer",{oncontextmenu:function(e){e.preventDefault()}},[n,i,o,s])}})).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._renderSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._createCircleSectorCompass=function(e){var t=u.h("g",{attributes:{transform:"translate(1,1)"},namespace:this._svgNamespace},[e]);return u.h("svg",{attributes:{viewBox:"0 0 2 2"},namespace:this._svgNamespace,style:{height:"30px",left:"4px",position:"absolute",top:"4px",width:"30px"}},[t])},e.prototype._createCircleSector=function(e,t){if(e>2*Math.PI-Math.PI/90)return u.h("circle",{attributes:{cx:"0",cy:"0",fill:t,r:"1"},namespace:this._svgNamespace},[]);var r=-Math.PI/2-e/2,n=r+e,i=Math.cos(r),o=Math.sin(r),s=Math.cos(n),a=Math.sin(n),c="M 0 0 "+i+" "+o+" A 1 1 0 "+(e>=Math.PI?1:0)+" 1 "+s+" "+a;return u.h("path",{attributes:{d:c,fill:t},namespace:this._svgNamespace},[])},e.prototype._createNorth=function(e){var t=u.h("div.BearingNorth",[]);return u.h("div.BearingNorthContainer",{style:{transform:"rotateZ("+180*-e/Math.PI+"deg)"}},[t])},e.componentName="bearing",e}(i.Component);r.BearingComponent=c,i.ComponentService.register(c),r.default=c},{"../Component":274,"../Geo":277,"rxjs/operators":224,"virtual-dom":230}],291:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var _=e("rxjs"),b=e("rxjs/operators"),x=e("../Edge"),o=e("../Component"),s=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return i(e,n),e.prototype.setDepth=function(e){this.configure({depth:e})},e.prototype._activate=function(){var y=this;this._sequenceSubscription=_.combineLatest(this._navigator.stateService.currentNode$.pipe(b.switchMap(function(e){return e.sequenceEdges$}),b.filter(function(e){return e.cached})),this._configuration$).pipe(b.switchMap(function(e){var t=e[0],r=e[1],n=Math.max(0,Math.min(4,r.depth.sequence)),i=y._cache$(t.edges,x.EdgeDirection.Next,n),o=y._cache$(t.edges,x.EdgeDirection.Prev,n);return _.merge(i,o).pipe(b.catchError(function(e,t){return console.error("Failed to cache sequence edges.",e),_.empty()}))})).subscribe(function(){}),this._spatialSubscription=_.combineLatest(this._navigator.stateService.currentNode$.pipe(b.switchMap(function(e){return _.combineLatest(_.of(e),e.spatialEdges$.pipe(b.filter(function(e){return e.cached})))})),this._configuration$).pipe(b.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=n.edges,s=i.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=y._cache$(o,x.EdgeDirection.Pano,a),l=y._cache$(o,x.EdgeDirection.StepForward,c),p=y._cache$(o,x.EdgeDirection.StepBackward,c),f=y._cache$(o,x.EdgeDirection.StepLeft,c),d=y._cache$(o,x.EdgeDirection.StepRight,c),m=y._cache$(o,x.EdgeDirection.TurnLeft,u),v=y._cache$(o,x.EdgeDirection.TurnRight,u),g=y._cache$(o,x.EdgeDirection.TurnU,u);return _.merge(l,p,f,d,h,m,v,g).pipe(b.catchError(function(e,t){return console.error("Failed to cache spatial edges.",e),_.empty()}))})).subscribe(function(){})},e.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._spatialSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}},e.prototype._cache$=function(e,a,t){var c=this;return _.zip(_.of(e),_.of(t)).pipe(b.expand(function(e){var t=e[0],r=e[1],n=[];if(0<r)for(var i=0,o=t;i<o.length;i++){var s=o[i];s.data.direction===a&&n.push(_.zip(c._navigator.graphService.cacheNode$(s.to).pipe(b.mergeMap(function(e){return c._nodeToEdges$(e,a)})),_.of(r-1)))}return _.from(n).pipe(b.mergeAll())}),b.skip(1))},e.prototype._nodeToEdges$=function(e,t){return(-1<[x.EdgeDirection.Next,x.EdgeDirection.Prev].indexOf(t)?e.sequenceEdges$:e.spatialEdges$).pipe(b.first(function(e){return e.cached}),b.map(function(e){return e.edges}))},e.componentName="cache",e}(o.Component);r.CacheComponent=s,o.ComponentService.register(s),r.default=s},{"../Component":274,"../Edge":275,rxjs:26,"rxjs/operators":224}],292:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs/operators"),a=e("rxjs"),i=function(i){function e(e,t,r){var n=i.call(this)||this;return n._activated$=new a.BehaviorSubject(!1),n._configurationSubject$=new a.Subject,n._activated=!1,n._container=t,n._name=e,n._navigator=r,n._configuration$=n._configurationSubject$.pipe(s.startWith(n.defaultConfiguration),s.scan(function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}),s.publishReplay(1),s.refCount()),n._configuration$.subscribe(function(){}),n}return o(e,i),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(e){this._activated||(void 0!==e&&this._configurationSubject$.next(e),this._activated=!0,this._activate(),this._activated$.next(!0))},e.prototype.configure=function(e){this._configurationSubject$.next(e)},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}(e("../Utils").EventEmitter);r.Component=i,r.default=i},{"../Utils":284,rxjs:26,"rxjs/operators":224}],293:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Error"),i=function(){function i(e,t){for(var r in this._components={},i.registeredComponents)if(i.registeredComponents.hasOwnProperty(r)){var n=i.registeredComponents[r];this._components[r]={active:!1,component:new n(r,e,t)}}this._coverComponent=new i.registeredCoverComponent("cover",e,t),this._coverComponent.activate(),this._coverActivated=!0}return i.register=function(e){void 0===i.registeredComponents[e.componentName]&&(i.registeredComponents[e.componentName]=e)},i.registerCover=function(e){i.registeredCoverComponent=e},Object.defineProperty(i.prototype,"coverActivated",{get:function(){return this._coverActivated},enumerable:!0,configurable:!0}),i.prototype.activateCover=function(){if(!this._coverActivated)for(var e in this._coverActivated=!0,this._components)if(this._components.hasOwnProperty(e)){var t=this._components[e];t.active&&t.component.deactivate()}},i.prototype.deactivateCover=function(){if(this._coverActivated)for(var e in this._coverActivated=!1,this._components)if(this._components.hasOwnProperty(e)){var t=this._components[e];t.active&&t.component.activate()}},i.prototype.activate=function(e){this._checkName(e),this._components[e].active=!0,this._coverActivated||this.get(e).activate()},i.prototype.configure=function(e,t){this._checkName(e),this.get(e).configure(t)},i.prototype.deactivate=function(e){this._checkName(e),this._components[e].active=!1,this._coverActivated||this.get(e).deactivate()},i.prototype.resize=function(){for(var e in this._components){if(this._components.hasOwnProperty(e))this._components[e].component.resize()}},i.prototype.get=function(e){return this._components[e].component},i.prototype.getCover=function(){return this._coverComponent},i.prototype._checkName=function(e){if(!(e in this._components))throw new n.ArgumentMapillaryError("Component does not exist: "+e)},i.registeredComponents={},i}();r.ComponentService=i,r.default=i},{"../Error":276}],294:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),a=e("rxjs/operators"),c=e("virtual-dom"),u=e("../Component"),s=e("../Utils"),h=e("../Viewer"),l=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return i(e,n),e.prototype._activate=function(){var s=this;this._configuration$.pipe(a.distinctUntilChanged(void 0,function(e){return e.state}),a.switchMap(function(e){return o.combineLatest(o.of(e.state),s._navigator.stateService.currentNode$)}),a.switchMap(function(e){var t=e[0],r=e[1],n=o.combineLatest(o.of(r.key),r.image$.pipe(a.filter(function(e){return!!e}),a.map(function(e){return e.src})));return t===u.CoverState.Visible?n.pipe(a.first()):n}),a.distinctUntilChanged(function(e,t){var r=e[0],n=e[1],i=t[0],o=t[1];return r===i&&n===o}),a.map(function(e){return{key:e[0],src:e[1]}})).subscribe(this._configurationSubject$),this._renderSubscription=o.combineLatest(this._configuration$,this._container.renderService.size$).pipe(a.map(function(e){var t=e[0],r=e[1];if(!t.key)return{name:s._name,vnode:c.h("div",[])};var n=r.width<=640||r.height<=480?".CoverCompact":"";if(t.state===u.CoverState.Hidden){var i=c.h("div.CoverContainer.CoverDone"+n,[s._getCoverBackgroundVNode(t)]);return{name:s._name,vnode:i}}var o=c.h("div.CoverContainer"+n,[s._getCoverButtonVNode(t)]);return{name:s._name,vnode:o}})).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._renderSubscription.unsubscribe(),this._keySubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{state:u.CoverState.Visible}},e.prototype._getCoverButtonVNode=function(e){var t=this,r=e.state===u.CoverState.Loading?"div.Cover.CoverLoading":"div.Cover",n=c.h("div.CoverButton",{onclick:function(){t.configure({state:u.CoverState.Loading})}},[c.h("div.CoverButtonIcon",[])]),i=c.h("a.CoverLogo",{href:s.Urls.explore,target:"_blank"},[]);return c.h(r,[this._getCoverBackgroundVNode(e),n,i])},e.prototype._getCoverBackgroundVNode=function(e){var t={style:{backgroundImage:"url("+(null!=e.src?e.src:s.Urls.thumbnail(e.key,h.ImageSize.Size640))+")"}},r=[];return e.state===u.CoverState.Loading&&r.push(c.h("div.Spinner",{},[])),c.h("div.CoverBackground",t,r)},e.componentName="cover",e}(u.Component);r.CoverComponent=l,u.ComponentService.registerCover(l),r.default=l},{"../Component":274,"../Utils":284,"../Viewer":285,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],295:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),s=e("rxjs/operators"),c=e("virtual-dom"),a=e("../Component"),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._open$=new o.BehaviorSubject(!1),e}return i(e,t),e.prototype._activate=function(){var i=this;this._disposable=o.combineLatest(this._navigator.stateService.currentState$,this._open$,this._navigator.imageLoadingService.loadstatus$).pipe(s.map(function(e){var t=e[0],r=e[1],n=e[2];return{name:i._name,vnode:i._getDebugVNode(r,i._getDebugInfo(t,n))}})).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._disposable.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getDebugInfo=function(e,t){var r=[];r.push(c.h("h2","Node")),e.state.currentNode&&r.push(c.h("p","currentNode: "+e.state.currentNode.key)),e.state.previousNode&&r.push(c.h("p","previousNode: "+e.state.previousNode.key)),r.push(c.h("h2","Loading"));var n=0,i=0,o=0;for(var s in t)if(t.hasOwnProperty(s)){var a=t[s];n+=a.loaded,a.loaded!==a.total?o++:i++}return r.push(c.h("p","Loaded Images: "+i)),r.push(c.h("p","Loading Images: "+o)),r.push(c.h("p","Total bytes loaded: "+n)),r.push(c.h("h2","Camera")),r.push(c.h("p","camera.position.x: "+e.state.camera.position.x)),r.push(c.h("p","camera.position.y: "+e.state.camera.position.y)),r.push(c.h("p","camera.position.z: "+e.state.camera.position.z)),r.push(c.h("p","camera.lookat.x: "+e.state.camera.lookat.x)),r.push(c.h("p","camera.lookat.y: "+e.state.camera.lookat.y)),r.push(c.h("p","camera.lookat.z: "+e.state.camera.lookat.z)),r.push(c.h("p","camera.up.x: "+e.state.camera.up.x)),r.push(c.h("p","camera.up.y: "+e.state.camera.up.y)),r.push(c.h("p","camera.up.z: "+e.state.camera.up.z)),r},e.prototype._getDebugVNode=function(e,t){return e?c.h("div.Debug",{},[c.h("h2",{},["Debug"]),this._getDebugVNodeButton(e),c.h("pre",{},t)]):this._getDebugVNodeButton(e)},e.prototype._getDebugVNodeButton=function(e){var t=e?"Disable Debug":"D",r=e?"":".DebugButtonFixed";return e?c.h("button.DebugButton"+r,{onclick:this._closeDebugElement.bind(this)},[t]):c.h("button.DebugButton"+r,{onclick:this._openDebugElement.bind(this)},[t])},e.prototype._closeDebugElement=function(e){this._open$.next(!1)},e.prototype._openDebugElement=function(){this._open$.next(!0)},e.componentName="debug",e}(a.Component);r.DebugComponent=u,a.ComponentService.register(u),r.default=u},{"../Component":274,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],296:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),c=e("virtual-dom"),o=e("../Component"),u=e("../Utils"),h=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._canvasId=t.id+"-"+i._name,i._dom=n||new u.DOM,i}return i(e,o),e.prototype._activate=function(){var t=this,e=this._container.domRenderer.element$.pipe(a.map(function(e){return t._dom.document.getElementById(t._canvasId)}),a.filter(function(e){return!!e}),a.map(function(e){var t=e.parentElement,r=t.offsetWidth;return[e,{height:t.offsetHeight,width:r}]}),a.distinctUntilChanged(function(e,t){return e.height===t.height&&e.width===t.width},function(e){e[0];return e[1]}));this.drawSubscription=s.combineLatest(e,this._navigator.stateService.currentNode$).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];r.width=n.width,r.height=n.height,r.getContext("2d").drawImage(i.image,0,0,n.width,n.height)}),this._container.domRenderer.renderAdaptive$.next({name:this._name,vnode:c.h("canvas#"+this._canvasId,[])})},e.prototype._deactivate=function(){this.drawSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="image",e}(o.Component);r.ImageComponent=h,o.ComponentService.register(h),r.default=h},{"../Component":274,"../Utils":284,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],297:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),a=e("rxjs/operators"),s=e("virtual-dom"),c=e("../Component"),u=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return i(e,n),e.prototype._activate=function(){var s=this;this._loadingSubscription=this._navigator.loadingService.loading$.pipe(a.switchMap(function(e){return e?s._navigator.imageLoadingService.loadstatus$:o.of({})}),a.map(function(e){var t=0,r=0;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];i.loaded!==i.total&&(r+=i.loaded,t+=i.total)}var o=100;return 0!==t&&(o=r/t*100),{name:s._name,vnode:s._getBarVNode(o)}})).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._loadingSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._getBarVNode=function(e){var t={};return t.opacity=100!==e?(t.width=e.toFixed(0)+"%","1"):(t.width="100%","0"),s.h("div.Loading",{style:{}},[s.h("div.LoadingBar",{style:t},[])])},e.componentName="loading",e}(c.Component);r.LoadingComponent=u,c.ComponentService.register(u),r.default=u},{"../Component":274,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],298:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),u=e("virtual-dom"),c=e("../Edge"),h=e("../Error"),i=e("../Component"),l=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n._seqNames={},n._seqNames[c.EdgeDirection[c.EdgeDirection.Prev]]="Prev",n._seqNames[c.EdgeDirection[c.EdgeDirection.Next]]="Next",n._spaTopNames={},n._spaTopNames[c.EdgeDirection[c.EdgeDirection.TurnLeft]]="Turnleft",n._spaTopNames[c.EdgeDirection[c.EdgeDirection.StepLeft]]="Left",n._spaTopNames[c.EdgeDirection[c.EdgeDirection.StepForward]]="Forward",n._spaTopNames[c.EdgeDirection[c.EdgeDirection.StepRight]]="Right",n._spaTopNames[c.EdgeDirection[c.EdgeDirection.TurnRight]]="Turnright",n._spaBottomNames={},n._spaBottomNames[c.EdgeDirection[c.EdgeDirection.TurnU]]="Turnaround",n._spaBottomNames[c.EdgeDirection[c.EdgeDirection.StepBackward]]="Backward",n}return o(e,i),e.prototype._activate=function(){var c=this;this._renderSubscription=s.combineLatest(this._navigator.stateService.currentNode$,this._configuration$).pipe(a.switchMap(function(e){var t=e[0],r=e[1],n=r.sequence?t.sequenceEdges$.pipe(a.map(function(e){return e.edges.map(function(e){return e.data.direction})})):s.of([]),i=!t.pano&&r.spatial?t.spatialEdges$.pipe(a.map(function(e){return e.edges.map(function(e){return e.data.direction})})):s.of([]);return s.combineLatest(n,i).pipe(a.map(function(e){var t=e[0],r=e[1];return t.concat(r)}))}),a.map(function(e){var t=c._createArrowRow(c._seqNames,e),r=c._createArrowRow(c._spaTopNames,e),n=c._createArrowRow(c._spaBottomNames,e),i=u.h("div.NavigationSequence",t),o=u.h("div.NavigationSpatialTop",r),s=u.h("div.NavigationSpatialBottom",n),a=u.h("div.NavigationSpatial",[o,s]);return{name:c._name,vnode:u.h("div.NavigationContainer",[i,a])}})).subscribe(this._container.domRenderer.render$)},e.prototype._deactivate=function(){this._renderSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{sequence:!0,spatial:!0}},e.prototype._createArrowRow=function(e,t){var r=[];for(var n in e)if(e.hasOwnProperty(n)){var i=c.EdgeDirection[n];-1!==t.indexOf(i)?r.push(this._createVNode(i,e[n],"visible")):r.push(this._createVNode(i,e[n],"hidden"))}return r},e.prototype._createVNode=function(t,e,r){var n=this;return u.h("span.Direction.Direction"+e,{onclick:function(e){n._navigator.moveDir$(t).subscribe(void 0,function(e){e instanceof h.AbortMapillaryError||console.error(e)})},style:{visibility:r}},[])},e.componentName="navigation",e}(i.Component);r.NavigationComponent=l,i.ComponentService.register(l),r.default=l},{"../Component":274,"../Edge":275,"../Error":276,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],299:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),c=e("virtual-dom"),o=e("../Component"),u=function(){},h=function(){},l=function(){this.nodeInstructions=[],this.nodeInstructionsOrdered=[]},p=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return i(e,n),e.prototype._activate=function(){var o=this,e=this._navigator.stateService.currentState$.pipe(a.filter(function(e){return e.id%2==0}),a.filter(function(e){return e.state.nodesAhead<15}),a.distinctUntilChanged(void 0,function(e){return e.state.lastNode.key})),t=s.combineLatest(this.configuration$.pipe(a.mergeMap(function(e){return s.from(e.paths)}),a.distinct(function(e){return e.sequenceKey}),a.mergeMap(function(t){return o._navigator.apiV3.sequenceByKey$([t.sequenceKey]).pipe(a.map(function(e){return e[t.sequenceKey]}))})),this.configuration$).pipe(a.map(function(e){for(var t=e[0],r=0,n=[],i=0,o=e[1].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}),a.scan(function(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];e.nodeInstructionsOrdered[i.place]=i.nodeInstructions}for(var o in e.nodeInstructionsOrdered)if(e.nodeInstructionsOrdered.hasOwnProperty(o))for(var s=0,a=e.nodeInstructionsOrdered[o];s<a.length;s++){var c=a[s];e.nodeInstructions.push(c)}return e},new l)),r=s.combineLatest(e,t,this.configuration$).pipe(a.map(function(e){var t=e[0],r=e[1];return{conf:e[2],frame:t,routeTrack:r}}),a.scan(function(e,t){return void 0===t.conf.playing||t.conf.playing?(e.routeTrack=t.routeTrack,e.currentNode=t.frame.state.currentNode,e.lastNode=t.frame.state.lastNode,e.playing=!0):(o._navigator.stateService.cutNodes(),e.playing=!1),e},new h),a.filter(function(e){return e.playing}),a.filter(function(e){for(var t=0,r=e.routeTrack.nodeInstructions;t<r.length;t++){var n=r[t];if(n&&n.key===e.lastNode.key)return!0}return!1}),a.distinctUntilChanged(void 0,function(e){return e.lastNode.key}),a.mergeMap(function(e){for(var t=0,r=0,n=e.routeTrack.nodeInstructions;r<n.length;r++){if(n[r].key===e.lastNode.key)break;t++}var i=e.routeTrack.nodeInstructions[t+1];return i?o._navigator.graphService.cacheNode$(i.key):s.of(null)}));this._disposable=s.combineLatest(r,this.configuration$).pipe(a.map(function(e){var t=e[0];return{conf:e[1],node:t}}),a.filter(function(e){return null!==e.node&&e.conf.playing}),a.pluck("node")).subscribe(this._navigator.stateService.appendNode$),this._disposableDescription=s.combineLatest(this._navigator.stateService.currentNode$,t,this.configuration$).pipe(a.map(function(e){var t=e[0],r=e[1],n=e[2];if(void 0!==n.playing&&!n.playing)return"quit";for(var i=null,o=0,s=r.nodeInstructions;o<s.length;o++){var a=s[o];if(a.key===t.key){i=a.description;break}}return i}),a.scan(function(e,t){return t!==e.description&&null!==t?(e.description=t,e.showsLeft=6):e.showsLeft--,"quit"===t&&(e.description=null),e},new u),a.map(function(e){return 0<e.showsLeft&&e.description?{name:o._name,vnode:o._getRouteAnnotationNode(e.description)}:{name:o._name,vnode:c.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(e){return c.h("div.RouteFrame",{},[c.h("p",{textContent:e},[])])},e.componentName="route",e}(o.Component);r.RouteComponent=p,o.ComponentService.register(p),r.default=p},{"../Component":274,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],300:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),o=e("../Component"),c=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._scheduler=n,i}return i(e,o),e.prototype._activate=function(){var e=this;this._sequenceSubscription=this._navigator.stateService.currentNode$.pipe(a.scan(function(e,t){var r=t.sequenceKey;return e.report=[],r in e.reported||(e.report=[r],e.reported[r]=!0),e},{report:[],reported:{}}),a.filter(function(e){return 0<e.report.length}),a.mergeMap(function(r){return e._navigator.apiV3.sequenceViewAdd$(r.report).pipe(a.catchError(function(e,t){return console.error("Failed to report sequence stats ("+r.report+")",e),s.empty()}))})).subscribe(function(){}),this._imageSubscription=this._navigator.stateService.currentNode$.pipe(a.map(function(e){return e.key})).pipe(a.buffer(this._navigator.stateService.currentNode$.pipe(a.debounceTime(5e3,this._scheduler))),a.scan(function(e,t){e.report=[];for(var r=0,n=t;r<n.length;r++){var i=n[r];i in e.reported||(e.report.push(i),e.reported[i]=!0)}return e},{report:[],reported:{}}),a.filter(function(e){return 0<e.report.length}),a.mergeMap(function(r){return e._navigator.apiV3.imageViewAdd$(r.report).pipe(a.catchError(function(e,t){return console.error("Failed to report image stats ("+r.report+")",e),s.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=c,o.ComponentService.register(c),r.default=c},{"../Component":274,rxjs:26,"rxjs/operators":224}],301:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),c=e("virtual-dom"),u=e("../../Component"),o=function(o){function t(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._renderer=n||new u.DirectionDOMRenderer(i.defaultConfiguration,t.element),i._hoveredKeySubject$=new s.Subject,i._hoveredKey$=i._hoveredKeySubject$.pipe(a.share()),i}return i(t,o),Object.defineProperty(t.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),t.prototype.setHighlightKey=function(e){this.configure({highlightKey:e})},t.prototype.setMinWidth=function(e){this.configure({minWidth:e})},t.prototype.setMaxWidth=function(e){this.configure({maxWidth:e})},t.prototype.resize=function(){this._renderer.resize(this._container.element)},t.prototype._activate=function(){var n=this;this._configurationSubscription=this._configuration$.subscribe(function(e){n._renderer.setConfiguration(e)}),this._nodeSubscription=this._navigator.stateService.currentNode$.pipe(a.tap(function(e){n._container.domRenderer.render$.next({name:n._name,vnode:c.h("div",{},[])}),n._renderer.setNode(e)}),a.withLatestFrom(this._configuration$),a.switchMap(function(e){var r=e[0],t=e[1];return s.combineLatest(r.spatialEdges$,t.distinguishSequence?n._navigator.graphService.cacheSequence$(r.sequenceKey).pipe(a.catchError(function(e,t){return console.error("Failed to cache sequence ("+r.sequenceKey+")",e),s.of(null)})):s.of(null))})).subscribe(function(e){var t=e[0],r=e[1];n._renderer.setEdges(t,r)}),this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.pipe(a.tap(function(e){n._renderer.setRenderCamera(e)}),a.map(function(){return n._renderer}),a.filter(function(e){return e.needsRender}),a.map(function(e){return{name:n._name,vnode:e.render(n._navigator)}})).subscribe(this._container.domRenderer.render$),this._hoveredKeySubscription=s.combineLatest(this._container.domRenderer.element$,this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$.pipe(a.startWith(null)),this._container.mouseService.mouseUp$.pipe(a.startWith(null))).pipe(a.map(function(e){for(var t=e[0].getElementsByClassName("DirectionsPerspective"),r=0;r<t.length;r++){var n=t.item(r).querySelector(":hover");if(null!=n&&n.hasAttribute("data-key"))return n.getAttribute("data-key")}return null}),a.distinctUntilChanged()).subscribe(this._hoveredKeySubject$),this._emitHoveredKeySubscription=this._hoveredKey$.subscribe(function(e){n.fire(t.hoveredkeychanged,e)})},t.prototype._deactivate=function(){this._configurationSubscription.unsubscribe(),this._emitHoveredKeySubscription.unsubscribe(),this._hoveredKeySubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this._renderCameraSubscription.unsubscribe()},t.prototype._getDefaultConfiguration=function(){return{distinguishSequence:!1,maxWidth:460,minWidth:260}},t.componentName="direction",t.hoveredkeychanged="hoveredkeychanged",t}(u.Component);r.DirectionComponent=o,u.ComponentService.register(o),r.default=o},{"../../Component":274,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],302:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../../Geo"),i=function(){function e(e,t){this._spatial=new n.Spatial,this._minThresholdWidth=320,this._maxThresholdWidth=1480,this._minThresholdHeight=240,this._maxThresholdHeight=820,this._configure(e),this._resize(t),this._reset()}return Object.defineProperty(e.prototype,"minWidth",{get:function(){return this._minWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerWidth",{get:function(){return this._containerWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerWidthCss",{get:function(){return this._containerWidthCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerMarginCss",{get:function(){return this._containerMarginCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerLeftCss",{get:function(){return this._containerLeftCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerHeight",{get:function(){return this._containerHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerHeightCss",{get:function(){return this._containerHeightCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerBottomCss",{get:function(){return this._containerBottomCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stepCircleSize",{get:function(){return this._stepCircleSize},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stepCircleSizeCss",{get:function(){return this._stepCircleSizeCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stepCircleMarginCss",{get:function(){return this._stepCircleMarginCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"turnCircleSize",{get:function(){return this._turnCircleSize},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"turnCircleSizeCss",{get:function(){return this._turnCircleSizeCss},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outerRadius",{get:function(){return this._outerRadius},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"innerRadius",{get:function(){return this._innerRadius},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowOffset",{get:function(){return this._shadowOffset},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){this._configure(e),this._reset()},e.prototype.resize=function(e){this._resize(e),this._reset()},e.prototype.angleToCoordinates=function(e){return[Math.cos(e),Math.sin(e)]},e.prototype.relativeAngleToCoordiantes=function(e,t){var r=this._spatial.wrapAngle(e-t);return this.angleToCoordinates(r)},e.prototype._configure=function(e){this._minWidth=e.minWidth,this._maxWidth=this._getMaxWidth(e.minWidth,e.maxWidth)},e.prototype._resize=function(e){this._elementWidth=e.offsetWidth,this._elementHeight=e.offsetHeight},e.prototype._reset=function(){this._containerWidth=this._getContainerWidth(this._elementWidth,this._elementHeight),this._containerHeight=this._getContainerHeight(this.containerWidth),this._stepCircleSize=this._getStepCircleDiameter(this._containerHeight),this._turnCircleSize=this._getTurnCircleDiameter(this.containerHeight),this._outerRadius=this._getOuterRadius(this._containerHeight),this._innerRadius=this._getInnerRadius(this._containerHeight),this._shadowOffset=3,this._containerWidthCss=this._numberToCssPixels(this._containerWidth),this._containerMarginCss=this._numberToCssPixels(-.5*this._containerWidth),this._containerLeftCss=this._numberToCssPixels(Math.floor(.5*this._elementWidth)),this._containerHeightCss=this._numberToCssPixels(this._containerHeight),this._containerBottomCss=this._numberToCssPixels(Math.floor(-.08*this._containerHeight)),this._stepCircleSizeCss=this._numberToCssPixels(this._stepCircleSize),this._stepCircleMarginCss=this._numberToCssPixels(-.5*this._stepCircleSize),this._turnCircleSizeCss=this._numberToCssPixels(this._turnCircleSize)},e.prototype._getContainerWidth=function(e,t){var r=(e-this._minThresholdWidth)/(this._maxThresholdWidth-this._minThresholdWidth),n=(t-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)},e.prototype._getContainerHeight=function(e){return.77*e},e.prototype._getStepCircleDiameter=function(e){return.34*e},e.prototype._getTurnCircleDiameter=function(e){return.3*e},e.prototype._getOuterRadius=function(e){return.31*e},e.prototype._getInnerRadius=function(e){return.125*e},e.prototype._numberToCssPixels=function(e){return e+"px"},e.prototype._getMaxWidth=function(e,t){return t<e?e:t},e}();r.DirectionDOMCalculator=i,r.default=i},{"../../Geo":277}],303:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var _=e("virtual-dom"),n=e("../../Component"),l=e("../../Edge"),c=e("../../Error"),i=e("../../Geo"),o=function(){function e(e,t){this._isEdge=!1,this._spatial=new i.Spatial,this._calculator=new n.DirectionDOMCalculator(e,t),this._node=null,this._rotation={phi:0,theta:0},this._epsilon=.5*Math.PI/180,this._highlightKey=null,this._distinguishSequence=!1,this._needsRender=!1,this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[],this._stepDirections=[l.EdgeDirection.StepForward,l.EdgeDirection.StepBackward,l.EdgeDirection.StepLeft,l.EdgeDirection.StepRight],this._turnDirections=[l.EdgeDirection.TurnLeft,l.EdgeDirection.TurnRight,l.EdgeDirection.TurnU],this._turnNames={},this._turnNames[l.EdgeDirection.TurnLeft]="TurnLeft",this._turnNames[l.EdgeDirection.TurnRight]="TurnRight",this._turnNames[l.EdgeDirection.TurnU]="TurnAround";var r=!!document.documentMode;this._isEdge=!r&&!!window.StyleMedia}return Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.render=function(e){this._needsRender=!1;var t=this._rotation,r=[],n=[];return this._node.pano?r=r.concat(this._createPanoArrows(e,t)):(r=(r=r.concat(this._createPerspectiveToPanoArrows(e,t))).concat(this._createStepArrows(e,t)),n=n.concat(this._createTurnArrows(e))),this._getContainer(r,n,t)},e.prototype.setEdges=function(e,t){this._setEdges(e,t),this._setNeedsRender()},e.prototype.setNode=function(e){this._node=e,this._clearEdges(),this._setNeedsRender()},e.prototype.setRenderCamera=function(e){var t=e.rotation;Math.abs(t.phi-this._rotation.phi)<this._epsilon||(this._rotation=t,this._setNeedsRender())},e.prototype.setConfiguration=function(e){var t=!1;this._highlightKey===e.highlightKey&&this._distinguishSequence===e.distinguishSequence||(this._highlightKey=e.highlightKey,this._distinguishSequence=e.distinguishSequence,t=!0),this._calculator.minWidth===e.minWidth&&this._calculator.maxWidth===e.maxWidth||(this._calculator.configure(e),t=!0),t&&this._setNeedsRender()},e.prototype.resize=function(e){this._calculator.resize(e),this._setNeedsRender()},e.prototype._setNeedsRender=function(){null!=this._node&&(this._needsRender=!0)},e.prototype._clearEdges=function(){this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[]},e.prototype._setEdges=function(e,t){this._stepEdges=[],this._turnEdges=[],this._panoEdges=[],this._sequenceEdgeKeys=[];for(var r=0,n=e.edges;r<n.length;r++){var i=(a=n[r]).data.direction;-1<this._stepDirections.indexOf(i)?this._stepEdges.push(a):-1<this._turnDirections.indexOf(i)?this._turnEdges.push(a):a.data.direction===l.EdgeDirection.Pano&&this._panoEdges.push(a)}if(this._distinguishSequence&&null!=t)for(var o=0,s=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);o<s.length;o++)for(var a,c=(a=s[o]).to,u=0,h=t.keys;u<h.length;u++){if(h[u]===c){this._sequenceEdgeKeys.push(c);break}}},e.prototype._createPanoArrows=function(e,t){for(var r=[],n=0,i=this._panoEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByKey(e,o.to,o.data.worldMotionAzimuth,t,this._calculator.outerRadius,"DirectionsArrowPano"))}for(var s=0,a=this._stepEdges;s<a.length;s++){var c=a[s];r.push(this._createPanoToPerspectiveArrow(e,c.to,c.data.worldMotionAzimuth,t,c.data.direction))}return r},e.prototype._createPanoToPerspectiveArrow=function(e,t,r,n,i){var o=Math.PI/8,s=n.phi;switch(i){case l.EdgeDirection.StepBackward:s=n.phi-Math.PI;break;case l.EdgeDirection.StepLeft:s=n.phi+Math.PI/2;break;case l.EdgeDirection.StepRight:s=n.phi-Math.PI/2}return Math.abs(this._spatial.wrapAngle(r-s))<o?this._createVNodeByKey(e,t,r,n,this._calculator.outerRadius,"DirectionsArrowStep"):this._createVNodeDisabled(t,r,n)},e.prototype._createPerspectiveToPanoArrows=function(e,t){for(var r=[],n=0,i=this._panoEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByKey(e,o.to,o.data.worldMotionAzimuth,t,this._calculator.innerRadius,"DirectionsArrowPano",!0))}return r},e.prototype._createStepArrows=function(e,t){for(var r=[],n=0,i=this._stepEdges;n<i.length;n++){var o=i[n];r.push(this._createVNodeByDirection(e,o.to,o.data.worldMotionAzimuth,t,o.data.direction))}return r},e.prototype._createTurnArrows=function(e){for(var t=[],r=0,n=this._turnEdges;r<n.length;r++){var i=n[r],o=i.data.direction,s=this._turnNames[o];t.push(this._createVNodeByTurn(e,i.to,s,o))}return t},e.prototype._createVNodeByKey=function(t,r,e,n,i,o,s){return this._createVNode(r,e,n,i,o,"DirectionsCircle",function(e){t.moveToKey$(r).subscribe(void 0,function(e){e instanceof c.AbortMapillaryError||console.error(e)})},s)},e.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(void 0,function(e){e instanceof c.AbortMapillaryError||console.error(e)})})},e.prototype._createVNodeByTurn=function(t,e,r,n){var i={height:this._calculator.turnCircleSizeCss,transform:"rotate(0)",width:this._calculator.turnCircleSizeCss};switch(n){case l.EdgeDirection.TurnLeft:i.left="5px",i.top="5px";break;case l.EdgeDirection.TurnRight:i.right="5px",i.top="5px";break;case l.EdgeDirection.TurnU:i.left="5px",i.bottom="5px"}var o={attributes:{"data-key":e},onclick:function(e){t.moveDir$(n).subscribe(void 0,function(e){e instanceof c.AbortMapillaryError||console.error(e)})},style:i},s="TurnCircle";-1<this._sequenceEdgeKeys.indexOf(e)&&(s+="Sequence"),this._highlightKey===e&&(s+="Highlight");var a=_.h("div."+r,{},[]);return _.h("div."+s,o,[a])},e.prototype._createVNodeDisabled=function(e,t,r){return this._createVNode(e,t,r,this._calculator.outerRadius,"DirectionsArrowDisabled","DirectionsCircleDisabled")},e.prototype._createVNode=function(e,t,r,n,i,o,s,a){var c=this._calculator.angleToCoordinates(t-r.phi),u=Math.round(-n*c[1]+.5*this._calculator.containerWidth),h=Math.round(-n*c[0]+.5*this._calculator.containerHeight),l=this._calculator.relativeAngleToCoordiantes(t,r.phi),p=this._calculator.shadowOffset,f="drop-shadow("+-p*l[1]+"px "+p*l[0]+"px 1px rgba(0,0,0,0.8))",d={style:{"-webkit-filter":f,filter:f}},m=_.h("div."+i,d,[]),v=-this._spatial.radToDeg(t-r.phi),g=a?"translate("+u+"px, "+h+"px) rotate("+v+"deg) translateZ(-0.01px)":"translate("+u+"px, "+h+"px) rotate("+v+"deg)",y={attributes:{"data-key":e},onclick:s,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:g,width:this._calculator.stepCircleSizeCss}};return-1<this._sequenceEdgeKeys.indexOf(e)&&(o+="Sequence"),this._highlightKey===e&&(o+="Highlight"),_.h("div."+o,y,[m])},e.prototype._getContainer=function(e,t,r){var n=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",i={oncontextmenu:function(e){e.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:n,width:this._calculator.containerWidthCss}};return _.h("div.DirectionsPerspective",i,t.concat(e))},e}();r.DirectionDOMRenderer=o,r.default=o},{"../../Component":274,"../../Edge":275,"../../Error":276,"../../Geo":277,"virtual-dom":230}],304:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),c=e("../../Component"),h=e("../../Render"),l=e("../../Tiles"),p=e("../../Utils"),i=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n._imageTileLoader=new l.ImageTileLoader(p.Urls.tileScheme,p.Urls.tileDomain,p.Urls.origin),n._roiCalculator=new l.RegionOfInterestCalculator,n._rendererOperation$=new s.Subject,n._rendererCreator$=new s.Subject,n._rendererDisposer$=new s.Subject,n._renderer$=n._rendererOperation$.pipe(a.scan(function(e,t){return t(e)},null),a.filter(function(e){return null!=e}),a.distinctUntilChanged(void 0,function(e){return e.frameId})),n._rendererCreator$.pipe(a.map(function(){return function(e){if(null!=e)throw new Error("Multiple image plane states can not be created at the same time");return new c.ImagePlaneGLRenderer}})).subscribe(n._rendererOperation$),n._rendererDisposer$.pipe(a.map(function(){return function(e){return e.dispose(),null}})).subscribe(n._rendererOperation$),n}return o(e,i),e.prototype._activate=function(){var u=this;this._rendererSubscription=this._renderer$.pipe(a.map(function(e){var t={name:u._name,render:{frameId:e.frameId,needsRender:e.needsRender,render:e.render.bind(e),stage:h.GLRenderStage.Background}};return e.clearNeedsRender(),t})).subscribe(this._container.glRenderer.render$),this._rendererCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.pipe(a.map(function(t){return function(e){return e.updateFrame(t),e}})).subscribe(this._rendererOperation$);var t=this._navigator.stateService.currentState$.pipe(a.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}),a.withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$),a.map(function(e){var t=e[0],r=e[1],n=e[2],i=t.state,o=Math.max(n.width,n.height),s=i.currentNode,a=i.currentTransform,c=2048<o?2048:1024<o?1024:512;return new l.TextureProvider(s.key,a.basicWidth,a.basicHeight,c,s.image,u._imageTileLoader,new l.ImageTileStore,r)}),a.publishReplay(1),a.refCount());this._textureProviderSubscription=t.subscribe(function(){}),this._setTextureProviderSubscription=t.pipe(a.map(function(t){return function(e){return e.setTextureProvider(t.key,t),e}})).subscribe(this._rendererOperation$),this._setTileSizeSubscription=this._container.renderService.size$.pipe(a.switchMap(function(e){return s.combineLatest(t,s.of(e)).pipe(a.first())})).subscribe(function(e){var t=e[0],r=e[1],n=Math.max(r.width,r.height),i=2048<n?2048:1024<n?1024:512;t.setTileSize(i)}),this._abortTextureProviderSubscription=t.pipe(a.pairwise()).subscribe(function(e){e[0].abort()});var e=s.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.pipe(a.debounceTime(250))).pipe(a.map(function(e){var t=e[0],r=e[1];return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf(),r.height.valueOf(),r.width.valueOf()]}),a.pairwise(),a.skipWhile(function(e){return e[1][2]-e[0][2]<0||0===e[1][2]}),a.map(function(e){var t=e[0][0].equals(e[1][0]),r=e[0][1].equals(e[1][1]),n=e[0][2]===e[1][2],i=e[0][3]===e[1][3],o=e[0][4]===e[1][4];return t&&r&&n&&i&&o}),a.distinctUntilChanged(),a.filter(function(e){return e}),a.switchMap(function(e){return u._container.renderService.renderCameraFrame$.pipe(a.first())}),a.withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$));this._setRegionOfInterestSubscription=t.pipe(a.switchMap(function(i){return e.pipe(a.map(function(e){var t=e[0],r=e[1],n=e[2];return[u._roiCalculator.computeRegionOfInterest(t,r,n),i]}))}),a.filter(function(e){return!e[1].disposed})).subscribe(function(e){var t=e[0];e[1].setRegionOfInterest(t)});var n=t.pipe(a.switchMap(function(e){return e.hasTexture$}),a.startWith(!1),a.publishReplay(1),a.refCount());this._hasTextureSubscription=n.subscribe(function(){});var r=this._navigator.stateService.currentState$.pipe(a.filter(function(e){return 0===e.state.nodesAhead}),a.map(function(e){return e.state.currentNode}),a.distinctUntilChanged(void 0,function(e){return e.key}),a.debounceTime(1e3),a.withLatestFrom(n),a.filter(function(e){return!e[1]}),a.map(function(e){return e[0]}),a.filter(function(e){return e.pano?p.Settings.maxImageSize>p.Settings.basePanoramaSize:p.Settings.maxImageSize>p.Settings.baseImageSize}),a.switchMap(function(r){var e=r.pano?p.Settings.basePanoramaSize:p.Settings.baseImageSize;return Math.max(r.image.width,r.image.height)>e?s.empty():r.cacheImage$(p.Settings.maxImageSize).pipe(a.map(function(e){return[e.image,e]})).pipe(a.takeUntil(n.pipe(a.filter(function(e){return e}))),a.catchError(function(e,t){return console.error("Failed to fetch high res image ("+r.key+")",e),s.empty()}))})).pipe(a.publish(),a.refCount());this._updateBackgroundSubscription=r.pipe(a.withLatestFrom(t)).subscribe(function(e){e[0][1].key!==e[1].key||e[1].disposed||e[1].updateBackground(e[0][0])}),this._updateTextureImageSubscription=r.pipe(a.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._setTileSizeSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._textureProviderSubscription.unsubscribe(),this._updateBackgroundSubscription.unsubscribe(),this._updateTextureImageSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="imagePlane",e}(c.Component);r.ImagePlaneComponent=i,c.ComponentService.register(i),r.default=i},{"../../Component":274,"../../Render":280,"../../Tiles":283,"../../Utils":284,rxjs:26,"rxjs/operators":224}],305:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../../Component"),i=function(){function e(){this._factory=new n.MeshFactory,this._scene=new n.MeshScene,this._alpha=0,this._alphaOld=0,this._fadeOutSpeed=.05,this._currentKey=null,this._previousKey=null,this._providerDisposers={},this._frameId=0,this._needsRender=!1}return Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.indicateNeedsRender=function(){this._needsRender=!0},e.prototype.updateFrame=function(e){this._updateFrameId(e.id),this._needsRender=this._updateAlpha(e.state.alpha)||this._needsRender,this._needsRender=this._updateAlphaOld(e.state.alpha)||this._needsRender,this._needsRender=this._updateImagePlanes(e.state)||this._needsRender},e.prototype.setTextureProvider=function(e,t){var r=this;if(e===this._currentKey){var n=t.textureCreated$.subscribe(function(e){r._updateTexture(e)}),i=t.textureUpdated$.subscribe(function(e){r._needsRender=!0});if(e in this._providerDisposers)(0,this._providerDisposers[e])(),delete this._providerDisposers[e];this._providerDisposers[e]=function(){n.unsubscribe(),i.unsubscribe(),t.dispose()}}},e.prototype._updateTexture=function(e){this._needsRender=!0;for(var t=0,r=this._scene.imagePlanes;t<r.length;t++){var n=r[t].material,i=n.uniforms.projectorTex.value;n.uniforms.projectorTex.value=null,i.dispose(),n.uniforms.projectorTex.value=e}},e.prototype.updateTextureImage=function(e,t){if(this._currentKey===t.key){this._needsRender=!0;for(var r=0,n=this._scene.imagePlanes;r<n.length;r++){var i=n[r].material.uniforms.projectorTex.value;i.image=e,i.needsUpdate=!0}}},e.prototype.render=function(e,t){for(var r=this._scene.imagePlanesOld.length?1:this._alpha,n=0,i=this._scene.imagePlanes;n<i.length;n++){i[n].material.uniforms.opacity.value=r}for(var o=0,s=this._scene.imagePlanesOld;o<s.length;o++){s[o].material.uniforms.opacity.value=this._alphaOld}t.render(this._scene.scene,e),t.render(this._scene.sceneOld,e);for(var a=0,c=this._scene.imagePlanes;a<c.length;a++){c[a].material.uniforms.opacity.value=this._alpha}t.render(this._scene.scene,e)},e.prototype.clearNeedsRender=function(){this._needsRender=!1},e.prototype.dispose=function(){this._scene.clear()},e.prototype._updateFrameId=function(e){this._frameId=e},e.prototype._updateAlpha=function(e){return e!==this._alpha&&(this._alpha=e,!0)},e.prototype._updateAlphaOld=function(e){return!(e<1||0===this._alphaOld)&&(this._alphaOld=Math.max(0,this._alphaOld-this._fadeOutSpeed),!0)},e.prototype._updateImagePlanes=function(e){if(null==e.currentNode||e.currentNode.key===this._currentKey)return!1;var t=null!=e.previousNode?e.previousNode.key:null,r=e.currentNode.key;this._previousKey!==t&&this._previousKey!==r&&this._previousKey in this._providerDisposers&&((0,this._providerDisposers[this._previousKey])(),delete this._providerDisposers[this._previousKey]);if(null!=t){if(t!==this._currentKey&&t!==this._previousKey){var n=this._factory.createMesh(e.previousNode,e.previousTransform);this._scene.updateImagePlanes([n])}this._previousKey=t}this._currentKey=r;var i=this._factory.createMesh(e.currentNode,e.currentTransform);return this._scene.updateImagePlanes([i]),this._alphaOld=1,!0},e}();r.ImagePlaneGLRenderer=i,r.default=i},{"../../Component":274}],306:[function(e,t,r){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0}),(n=r.CoverState||(r.CoverState={}))[n.Hidden=0]="Hidden",n[n.Loading=1]="Loading",n[n.Visible=2]="Visible"},{}],307:[function(e,t,r){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0}),(n=r.SliderMode||(r.SliderMode={}))[n.Motion=0]="Motion",n[n.Stationary=1]="Stationary"},{}],308:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./ICoverConfiguration");r.CoverState=n.CoverState;var i=e("./ISliderConfiguration");r.SliderMode=i.SliderMode},{"./ICoverConfiguration":306,"./ISliderConfiguration":307}],309:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs/operators"),s=e("../../Component"),h=e("../../Edge"),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._enable=function(){var u=this;this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(o.withLatestFrom(this._navigator.playService.playing$,this._navigator.playService.direction$,this._navigator.playService.speed$,this._navigator.stateService.currentNode$.pipe(o.switchMap(function(e){return e.sequenceEdges$})))).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4];if(!(t.altKey||t.ctrlKey||t.metaKey)){switch(t.key){case"D":if(!t.shiftKey)return;var s=r?null:n===h.EdgeDirection.Next?h.EdgeDirection.Prev:n===h.EdgeDirection.Prev?h.EdgeDirection.Next:null;null!=s&&u._navigator.playService.setDirection(s);break;case" ":if(t.shiftKey)return;if(r)u._navigator.playService.stop();else for(var a=0,c=o.edges;a<c.length;a++){c[a].data.direction===n&&u._navigator.playService.play()}break;case"<":u._navigator.playService.setSpeed(i-.05);break;case">":u._navigator.playService.setSpeed(i+.05);break;default:return}t.preventDefault()}})},t.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{keyZoom:e}},t}(s.HandlerBase);r.KeyPlayHandler=a,r.default=a},{"../../Component":274,"../../Edge":275,"rxjs/operators":224}],310:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs/operators"),s=e("../../Component"),c=e("../../Edge"),u=e("../../Error"),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._enable=function(){var a=this,e=this._navigator.stateService.currentNode$.pipe(o.switchMap(function(e){return e.sequenceEdges$}));this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(o.withLatestFrom(e)).subscribe(function(e){var t=e[0],r=e[1],n=null;switch(t.keyCode){case 38:n=c.EdgeDirection.Next;break;case 40:n=c.EdgeDirection.Prev;break;default:return}if(t.preventDefault(),t.altKey&&!t.shiftKey&&r.cached)for(var i=0,o=r.edges;i<o.length;i++){var s=o[i];if(s.data.direction===n)return void a._navigator.moveToKey$(s.to).subscribe(void 0,function(e){e instanceof u.AbortMapillaryError||console.error(e)})}})},t.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{keySequenceNavigation:e}},t}(s.HandlerBase);r.KeySequenceNavigationHandler=a,r.default=a},{"../../Component":274,"../../Edge":275,"../../Error":276,"rxjs/operators":224}],311:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs/operators"),o=e("../../Component"),y=e("../../Edge"),a=e("../../Error"),c=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._spatial=n,i}return i(e,o),e.prototype._enable=function(){var g=this,e=this._navigator.stateService.currentNode$.pipe(s.switchMap(function(e){return e.spatialEdges$}));this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(s.withLatestFrom(e,this._navigator.stateService.currentState$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=n.state.currentNode.pano,o=null;switch(t.keyCode){case 37:o=t.shiftKey&&!i?y.EdgeDirection.TurnLeft:y.EdgeDirection.StepLeft;break;case 38:o=t.shiftKey&&!i?y.EdgeDirection.Pano:y.EdgeDirection.StepForward;break;case 39:o=t.shiftKey&&!i?y.EdgeDirection.TurnRight:y.EdgeDirection.StepRight;break;case 40:o=t.shiftKey&&!i?y.EdgeDirection.TurnU:y.EdgeDirection.StepBackward;break;default:return}if(t.preventDefault(),!(t.altKey||!r.cached||t.shiftKey&&i))if(i){var s={};s[y.EdgeDirection.StepBackward]=Math.PI,s[y.EdgeDirection.StepForward]=0,s[y.EdgeDirection.StepLeft]=Math.PI/2,s[y.EdgeDirection.StepRight]=-Math.PI/2;for(var a=g._rotationFromCamera(n.state.camera).phi,c=g._spatial.wrapAngle(a+s[o]),u=Math.PI/4,h=r.edges.filter(function(e){return e.data.direction===y.EdgeDirection.Pano||e.data.direction===o}),l=Number.MAX_VALUE,p=null,f=0,d=h;f<d.length;f++){var m=d[f],v=Math.abs(g._spatial.wrapAngle(m.data.worldMotionAzimuth-c));v<Math.min(l,u)&&(l=v,p=m.to)}if(null==p)return;g._moveToKey(p)}else g._moveDir(o,r)})},e.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},e.prototype._getConfiguration=function(e){return{keySpatialNavigation:e}},e.prototype._moveDir=function(e,t){for(var r=0,n=t.edges;r<n.length;r++){var i=n[r];if(i.data.direction===e)return void this._moveToKey(i.to)}},e.prototype._moveToKey=function(e){this._navigator.moveToKey$(e).subscribe(void 0,function(e){e instanceof a.AbortMapillaryError||console.error(e)})},e.prototype._rotationFromCamera=function(e){var t=e.lookat.clone().sub(e.position),r=t.clone().dot(e.up),n=t.clone().sub(e.up.clone().multiplyScalar(r));return{phi:Math.atan2(n.y,n.x),theta:Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1])}},e}(o.HandlerBase);r.KeySpatialNavigationHandler=c,r.default=c},{"../../Component":274,"../../Edge":275,"../../Error":276,"rxjs/operators":224}],312:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs/operators"),o=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._viewportCoords=n,i}return i(e,o),e.prototype._enable=function(){var a=this;this._keyDownSubscription=this._container.keyboardService.keyDown$.pipe(s.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2];if(!(t.altKey||t.shiftKey||t.ctrlKey||t.metaKey)){var i=0;switch(t.key){case"+":i=1;break;case"-":i=-1;break;default:return}t.preventDefault();var o=a._viewportCoords.unprojectFromViewport(0,0,r.perspective),s=n.projectBasic(o.toArray());a._navigator.stateService.zoomIn(i,s)}})},e.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},e.prototype._getConfiguration=function(e){return{keyZoom:e}},e}(e("../../Component").HandlerBase);r.KeyZoomHandler=o,r.default=o},{"../../Component":274,"rxjs/operators":224}],313:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../../Component"),a=e("../../Geo"),i=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n._keyPlayHandler=new s.KeyPlayHandler(n,t,r),n._keySequenceNavigationHandler=new s.KeySequenceNavigationHandler(n,t,r),n._keySpatialNavigationHandler=new s.KeySpatialNavigationHandler(n,t,r,new a.Spatial),n._keyZoomHandler=new s.KeyZoomHandler(n,t,r,new a.ViewportCoords),n}return o(e,i),Object.defineProperty(e.prototype,"keyPlay",{get:function(){return this._keyPlayHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keySequenceNavigation",{get:function(){return this._keySequenceNavigationHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keySpatialNavigation",{get:function(){return this._keySpatialNavigationHandler},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keyZoom",{get:function(){return this._keyZoomHandler},enumerable:!0,configurable:!0}),e.prototype._activate=function(){var t=this;this._configurationSubscription=this._configuration$.subscribe(function(e){e.keyPlay?t._keyPlayHandler.enable():t._keyPlayHandler.disable(),e.keySequenceNavigation?t._keySequenceNavigationHandler.enable():t._keySequenceNavigationHandler.disable(),e.keySpatialNavigation?t._keySpatialNavigationHandler.enable():t._keySpatialNavigationHandler.disable(),e.keyZoom?t._keyZoomHandler.enable():t._keyZoomHandler.disable()})},e.prototype._deactivate=function(){this._configurationSubscription.unsubscribe(),this._keyPlayHandler.disable(),this._keySequenceNavigationHandler.disable(),this._keySpatialNavigationHandler.disable(),this._keyZoomHandler.disable()},e.prototype._getDefaultConfiguration=function(){return{keyPlay:!0,keySequenceNavigation:!0,keySpatialNavigation:!0,keyZoom:!0}},e.componentName="keyboard",e}(s.Component);r.KeyboardComponent=i,s.ComponentService.register(i),r.default=i},{"../../Component":274,"../../Geo":277}],314:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./MarkerComponent");r.MarkerComponent=n.MarkerComponent;var i=e("./marker/SimpleMarker");r.SimpleMarker=i.SimpleMarker;var o=e("./marker/CircleMarker");r.CircleMarker=o.CircleMarker},{"./MarkerComponent":315,"./marker/CircleMarker":318,"./marker/SimpleMarker":320}],315:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var p=e("rxjs"),f=e("rxjs/operators"),E=e("three"),s=e("when"),a=e("../../Component"),d=e("../../Render"),c=e("../../Graph"),u=e("../../Geo"),i=function(i){function C(e,t,r){var n=i.call(this,e,t,r)||this;return n._relativeGroundAltitude=-2,n._geoCoords=new u.GeoCoords,n._graphCalculator=new c.GraphCalculator,n._markerScene=new a.MarkerScene,n._markerSet=new a.MarkerSet,n._viewportCoords=new u.ViewportCoords,n}return o(C,i),C.prototype.add=function(e){this._markerSet.add(e)},C.prototype.get=function(e){return this._markerSet.get(e)},C.prototype.getAll=function(){return this._markerSet.getAll()},C.prototype.getMarkerIdAt=function(n){var i=this;return s.promise(function(t,r){i._container.renderService.renderCamera$.pipe(f.first(),f.map(function(e){var t=i._viewportCoords.canvasToViewport(n[0],n[1],i._container.element);return i._markerScene.intersectObjects(t,e.perspective)})).subscribe(function(e){t(e)},function(e){r(e)})})},C.prototype.has=function(e){return this._markerSet.has(e)},C.prototype.remove=function(e){this._markerSet.remove(e)},C.prototype.removeAll=function(){this._markerSet.removeAll()},C.prototype._activate=function(){var M=this,e=this._navigator.stateService.currentState$.pipe(f.map(function(e){return e.state.camera.position.z+M._relativeGroundAltitude}),f.distinctUntilChanged(function(e,t){return Math.abs(e-t)<.01}),f.publishReplay(1),f.refCount()),t=p.combineLatest(e,this._navigator.stateService.reference$).pipe(f.first(),f.map(function(){}),f.publishReplay(1),f.refCount()),r=this._configuration$.pipe(f.map(function(e){return{visibleBBoxSize:Math.max(1,Math.min(200,e.visibleBBoxSize))}})),n=this._navigator.stateService.currentNode$.pipe(f.map(function(e){return e.latLon}),f.publishReplay(1),f.refCount()),i=p.combineLatest(r,n).pipe(f.map(function(e){var t=e[0],r=e[1];return M._graphCalculator.boundingBoxCorners(r,t.visibleBBoxSize/2)}),f.publishReplay(1),f.refCount()),o=p.combineLatest(p.concat(p.of(this._markerSet),this._markerSet.changed$),i).pipe(f.map(function(e){var t=e[0],r=e[1];return t.search(r)}));this._setChangedSubscription=t.pipe(f.switchMap(function(){return o.pipe(f.withLatestFrom(M._navigator.stateService.reference$,e))})).subscribe(function(e){for(var t=e[0],r=e[1],n=e[2],i=M._geoCoords,o=M._markerScene,s=o.markers,a=Object.assign({},s),c=0,u=t;c<u.length;c++){var h=u[c];if(h.id in s)delete a[h.id];else{var l=i.geodeticToEnu(h.latLon.lat,h.latLon.lon,r.alt+n,r.lat,r.lon,r.alt);o.add(h,l)}}for(var p in a)a.hasOwnProperty(p)&&o.remove(p)}),this._markersUpdatedSubscription=t.pipe(f.switchMap(function(){return M._markerSet.updated$.pipe(f.withLatestFrom(i,M._navigator.stateService.reference$,e))})).subscribe(function(e){for(var t=e[0],r=e[1],n=r[0],i=r[1],o=e[2],s=e[3],a=M._geoCoords,c=M._markerScene,u=0,h=t;u<h.length;u++){var l=h[u],p=c.has(l.id),f=l.latLon.lat>n.lat&&l.latLon.lat<i.lat&&l.latLon.lon>n.lon&&l.latLon.lon<i.lon;if(f){var d=a.geodeticToEnu(l.latLon.lat,l.latLon.lon,o.alt+s,o.lat,o.lon,o.alt);c.add(l,d)}else!f&&p&&c.remove(l.id)}}),this._referenceSubscription=this._navigator.stateService.reference$.pipe(f.skip(1),f.withLatestFrom(e)).subscribe(function(e){for(var t=e[0],r=e[1],n=M._geoCoords,i=M._markerScene,o=0,s=i.getAll();o<s.length;o++){var a=s[o],c=n.geodeticToEnu(a.latLon.lat,a.latLon.lon,t.alt+r,t.lat,t.lon,t.alt);i.update(a.id,c)}}),this._adjustHeightSubscription=e.pipe(f.skip(1),f.withLatestFrom(this._navigator.stateService.reference$,n)).subscribe(function(e){for(var t=e[0],r=e[1],n=e[2],i=M._geoCoords,o=M._markerScene,s=i.geodeticToEnu(n.lat,n.lon,r.alt+t,r.lat,r.lon,r.alt),a=0,c=o.getAll();a<c.length;a++){var u=c[a],h=i.geodeticToEnu(u.latLon.lat,u.latLon.lon,r.alt+t,r.lat,r.lon,r.alt),l=h[0]-s[0],p=h[1]-s[1],f=Math.sqrt(l*l+p*p);50<f||o.lerpAltitude(u.id,t,Math.min(1,Math.max(0,1.2-1.2*f/50)))}}),this._renderSubscription=this._navigator.stateService.currentState$.pipe(f.map(function(e){var t=M._markerScene;return{name:M._name,render:{frameId:e.id,needsRender:t.needsRender,render:t.render.bind(t),stage:d.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$);var s=p.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).pipe(f.map(function(e){var t=e[0],r=e[1],n=M._container.element,i=M._viewportCoords.canvasPosition(r,n),o=i[0],s=i[1],a=M._viewportCoords.canvasToViewport(o,s,n);return M._markerScene.intersectObjects(a,t.perspective)}),f.publishReplay(1),f.refCount()),a=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).pipe(f.map(function(e){return!0})),c=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).pipe(f.map(function(e){return!1})),u=p.merge(a,c).pipe(f.startWith(!1));this._dragEventSubscription=p.merge(a.pipe(f.withLatestFrom(s)),p.combineLatest(c,p.of(null))).pipe(f.startWith([!1,null]),f.pairwise()).subscribe(function(e){var t=e[0],r=e[1],n=r[0],i=n?C.dragstart:C.dragend,o=n?r[1]:t[1],s={marker:M._markerScene.get(o),target:M,type:i};M.fire(i,s)});var h=p.merge(this._container.mouseService.mouseDown$.pipe(f.map(function(e){return!0})),this._container.mouseService.documentMouseUp$.pipe(f.map(function(e){return!1}))).pipe(f.startWith(!1));this._mouseClaimSubscription=p.combineLatest(this._container.mouseService.active$,s.pipe(f.distinctUntilChanged()),h,u).pipe(f.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return!t&&null!=r&&n||i}),f.distinctUntilChanged()).subscribe(function(e){e?(M._container.mouseService.claimMouse(M._name,1),M._container.mouseService.claimWheel(M._name,1)):(M._container.mouseService.unclaimMouse(M._name),M._container.mouseService.unclaimWheel(M._name))});var l=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).pipe(f.withLatestFrom(s,this._container.renderService.renderCamera$),f.map(function(e){var t=e[0],r=e[1],n=e[2],i=M._markerScene.get(r),o=M._container.element,s=M._viewportCoords.projectToCanvas(i.geometry.position.toArray(),o,n.perspective),a=s[0],c=s[1],u=M._viewportCoords.canvasPosition(t,o);return[i,[u[0]-a,u[1]-c],n]}),f.publishReplay(1),f.refCount());this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).pipe(f.withLatestFrom(l,this._navigator.stateService.reference$,r)).subscribe(function(e){var t=e[0],r=e[1],n=r[0],i=r[1],o=r[2],s=e[2],a=e[3];if(M._markerScene.has(n.id)){var c=M._container.element,u=M._viewportCoords.canvasPosition(t,c),h=u[0],l=u[1],p=h-i[0],f=l-i[1],d=M._viewportCoords.canvasToViewport(p,f,c),m=d[0],v=d[1],g=new E.Vector3(m,v,1).unproject(o.perspective).sub(o.perspective.position).normalize(),y=Math.min(M._relativeGroundAltitude/g.z,a.visibleBBoxSize/2-.1);if(!(y<0)){var _=g.clone().multiplyScalar(y).add(o.perspective.position);_.z=o.perspective.position.z+M._relativeGroundAltitude;var b=M._geoCoords.enuToGeodetic(_.x,_.y,_.z,s.lat,s.lon,s.alt),x=b[0],w=b[1];M._markerScene.update(n.id,_.toArray(),{lat:x,lon:w}),M._markerSet.update(n);var S={marker:n,target:M,type:C.changed};M.fire(C.changed,S)}}})},C.prototype._deactivate=function(){this._adjustHeightSubscription.unsubscribe(),this._dragEventSubscription.unsubscribe(),this._markersUpdatedSubscription.unsubscribe(),this._mouseClaimSubscription.unsubscribe(),this._referenceSubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._setChangedSubscription.unsubscribe(),this._updateMarkerSubscription.unsubscribe(),this._markerScene.clear()},C.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}},C.componentName="marker",C.changed="changed",C.dragstart="dragstart",C.dragend="dragend",C}(a.Component);r.MarkerComponent=i,a.ComponentService.register(i),r.default=i},{"../../Component":274,"../../Geo":277,"../../Graph":278,"../../Render":280,rxjs:26,"rxjs/operators":224,three:225,when:271}],316:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("three"),n=function(){function e(e,t){this._needsRender=!1,this._interactiveObjects=[],this._markers={},this._objectMarkers={},this._raycaster=t||new a.Raycaster,this._scene=e||new a.Scene}return Object.defineProperty(e.prototype,"markers",{get:function(){return this._markers},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t){e.id in this._markers&&this._dispose(e.id),e.createGeometry(t),this._scene.add(e.geometry);for(var r=0,n=(this._markers[e.id]=e).getInteractiveObjects();r<n.length;r++){var i=n[r];this._interactiveObjects.push(i),this._objectMarkers[i.uuid]=e.id}this._needsRender=!0},e.prototype.clear=function(){for(var e in this._markers)this._markers.hasOwnProperty&&this._dispose(e);this._needsRender=!0},e.prototype.get=function(e){return this._markers[e]},e.prototype.getAll=function(){var t=this;return Object.keys(this._markers).map(function(e){return t._markers[e]})},e.prototype.has=function(e){return e in this._markers},e.prototype.intersectObjects=function(e,t){var r=e[0],n=e[1];this._raycaster.setFromCamera(new a.Vector2(r,n),t);for(var i=0,o=this._raycaster.intersectObjects(this._interactiveObjects);i<o.length;i++){var s=o[i];if(s.object.uuid in this._objectMarkers)return this._objectMarkers[s.object.uuid]}return null},e.prototype.lerpAltitude=function(e,t,r){e in this._markers&&(this._markers[e].lerpAltitude(t,r),this._needsRender=!0)},e.prototype.remove=function(e){e in this._markers&&(this._dispose(e),this._needsRender=!0)},e.prototype.render=function(e,t){t.render(this._scene,e),this._needsRender=!1},e.prototype.update=function(e,t,r){e in this._markers&&(this._markers[e].updatePosition(t,r),this._needsRender=!0)},e.prototype._dispose=function(e){var t=this._markers[e];this._scene.remove(t.geometry);for(var r=0,n=t.getInteractiveObjects();r<n.length;r++){var i=n[r],o=this._interactiveObjects.indexOf(i);-1!==o?this._interactiveObjects.splice(o,1):console.warn("Object does not exist ("+i.id+") for "+e),delete this._objectMarkers[i.uuid]}t.disposeGeometry(),delete this._markers[e]},e}();r.MarkerScene=n,r.default=n},{three:225}],317:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rbush"),i=e("rxjs"),o=function(){function e(){this._hash={},this._index=n(16,[".lon",".lat",".lon",".lat"]),this._indexChanged$=new i.Subject,this._updated$=new i.Subject}return Object.defineProperty(e.prototype,"changed$",{get:function(){return this._indexChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),e.prototype.add=function(e){for(var t=[],r=this._hash,n=this._index,i=0,o=e;i<o.length;i++){var s=o[i],a=s.id;a in r&&(n.remove(r[a]),t.push(s));var c={lat:s.latLon.lat,lon:s.latLon.lon,marker:s};r[a]=c,n.insert(c)}0<t.length&&this._updated$.next(t),e.length>t.length&&this._indexChanged$.next(this)},e.prototype.has=function(e){return e in this._hash},e.prototype.get=function(e){return this.has(e)?this._hash[e].marker:void 0},e.prototype.getAll=function(){return this._index.all().map(function(e){return e.marker})},e.prototype.remove=function(e){for(var t=this._hash,r=this._index,n=!1,i=0,o=e;i<o.length;i++){var s=o[i];if(s in t){var a=t[s];r.remove(a),delete t[s],n=!0}}n&&this._indexChanged$.next(this)},e.prototype.removeAll=function(){this._hash={},this._index.clear(),this._indexChanged$.next(this)},e.prototype.search=function(e){var t=e[0],r=e[1];return this._index.search({maxX:r.lon,maxY:r.lat,minX:t.lon,minY:t.lat}).map(function(e){return e.marker})},e.prototype.update=function(e){var t=this._hash,r=this._index,n=e.id;if(n in t){r.remove(t[n]);var i={lat:e.latLon.lat,lon:e.latLon.lon,marker:e};t[n]=i,r.insert(i)}},e}();r.MarkerSet=o,r.default=o},{rbush:25,rxjs:26}],318:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("three"),i=function(i){function e(e,t,r){var n=i.call(this,e,t)||this;return r=r||{},n._color=null!=r.color?r.color:16777215,n._opacity=null!=r.opacity?r.opacity:.4,n._radius=null!=r.radius?r.radius:1,n}return o(e,i),e.prototype._createGeometry=function(e){var t=new s.Mesh(new s.CircleGeometry(this._radius,16),new s.MeshBasicMaterial({color:this._color,opacity:this._opacity,transparent:!0}));t.up.fromArray([0,0,1]),t.renderOrder=-1;var r=new s.Object3D;r.add(t),r.position.fromArray(e),this._geometry=r},e.prototype._disposeGeometry=function(){for(var e=0,t=this._geometry.children;e<t.length;e++){var r=t[e];r.geometry.dispose(),r.material.dispose()}},e.prototype._getInteractiveObjects=function(){return[]},e}(e("../../../Component").Marker);r.CircleMarker=i,r.default=i},{"../../../Component":274,three:225}],319:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){this._id=e,this._latLon=t}return 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,"latLon",{get:function(){return this._latLon},enumerable:!0,configurable:!0}),e.prototype.createGeometry=function(e){this._geometry||(this._createGeometry(e),this._geometry.updateMatrixWorld(!0))},e.prototype.disposeGeometry=function(){this._geometry&&(this._disposeGeometry(),this._geometry=void 0)},e.prototype.getInteractiveObjects=function(){return this._geometry?this._getInteractiveObjects():[]},e.prototype.lerpAltitude=function(e,t){this._geometry&&(this._geometry.position.z=(1-t)*this._geometry.position.z+t*e)},e.prototype.updatePosition=function(e,t){t&&(this._latLon.lat=t.lat,this._latLon.lon=t.lon),this._geometry&&(this._geometry.position.fromArray(e),this._geometry.updateMatrixWorld(!0))},e}();r.Marker=n,r.default=n},{}],320:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var w=e("three"),i=function(i){function e(e,t,r){var n=i.call(this,e,t)||this;return r=r||{},n._ballColor=null!=r.ballColor?r.ballColor:16711680,n._ballOpacity=null!=r.ballOpacity?r.ballOpacity:.8,n._circleToRayAngle=2,n._color=null!=r.color?r.color:16711680,n._interactive=!!r.interactive,n._opacity=null!=r.opacity?r.opacity:.4,n._radius=null!=r.radius?r.radius:1,n}return o(e,i),e.prototype._createGeometry=function(e){var t=this._radius,r=new w.Mesh(this._markerGeometry(t,8,8),new w.MeshBasicMaterial({color:this._color,opacity:this._opacity,transparent:!0}));r.renderOrder=1;var n=new w.Mesh(new w.SphereGeometry(t/2,8,8),new w.MeshBasicMaterial({color:this._ballColor,opacity:this._ballOpacity,transparent:!0}));n.position.z=this._markerHeight(t);var i=new w.Object3D;i.add(n),i.add(r),i.position.fromArray(e),this._geometry=i},e.prototype._disposeGeometry=function(){for(var e=0,t=this._geometry.children;e<t.length;e++){var r=t[e];r.geometry.dispose(),r.material.dispose()}},e.prototype._getInteractiveObjects=function(){return this._interactive?[this._geometry.children[0]]:[]},e.prototype._markerHeight=function(e){var t=Math.tan(Math.PI-this._circleToRayAngle);return e*Math.sqrt(1+t*t)},e.prototype._markerGeometry=function(e,t,r){var n=new w.Geometry;t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6);for(var i=this._markerHeight(e),o=[],s=0;s<=r;++s){for(var a=[],c=0;c<=t;++c){var u=c/t*Math.PI*2,h=s/r*Math.PI,l=void 0;if(h<this._circleToRayAngle)l=e;else{var p=Math.tan(h-this._circleToRayAngle);l=e*Math.sqrt(1+p*p)}var f=new w.Vector3;f.x=l*Math.cos(u)*Math.sin(h),f.y=l*Math.sin(u)*Math.sin(h),f.z=l*Math.cos(h)+i,n.vertices.push(f),a.push(n.vertices.length-1)}o.push(a)}for(s=0;s<r;++s)for(c=0;c<t;++c){var d=o[s][c+1],m=o[s][c],v=o[s+1][c],g=o[s+1][c+1],y=n.vertices[d].clone().normalize(),_=n.vertices[m].clone().normalize(),b=n.vertices[v].clone().normalize(),x=n.vertices[g].clone().normalize();n.faces.push(new w.Face3(d,m,g,[y,_,x])),n.faces.push(new w.Face3(m,v,g,[_.clone(),b,x.clone()]))}return n.computeFaceNormals(),n.boundingSphere=new w.Sphere(new w.Vector3,e+i),n},e}(e("../../../Component").Marker);r.SimpleMarker=i,r.default=i},{"../../../Component":274,three:225}],321:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),a=e("rxjs/operators"),f=e("../../Component"),s=function(s){function e(e,t,r,n,i){var o=s.call(this,e,t,r)||this;return o._spatial=i,o._viewportCoords=n,o}return i(e,s),e.prototype._enable=function(){var p=this,e=this._navigator.stateService.currentState$.pipe(a.map(function(e){return e.state.alpha<1}));this._bounceSubscription=o.combineLatest(e,this._navigator.stateService.inTranslation$,this._container.mouseService.active$,this._container.touchService.active$).pipe(a.map(function(e){return e[0]||e[1]||e[2]||e[3]}),a.distinctUntilChanged(),a.switchMap(function(e){return e?o.empty():o.combineLatest(p._container.renderService.renderCamera$,p._navigator.stateService.currentTransform$.pipe(a.first()))})).subscribe(function(e){var t=e[0],r=e[1];if((r.hasValidScale||!(t.camera.focal<.1))&&0!==t.perspective.aspect&&t.perspective.aspect!==Number.POSITIVE_INFINITY){var n=f.ImageBoundary.viewportDistances(r,t.perspective,p._viewportCoords);if(!(Math.max.apply(Math,n)<.01)){var i=n[1]-n[3],o=n[0]-n[2],s=p._viewportCoords.unprojectFromViewport(0,0,t.perspective).sub(t.perspective.position),a=p._viewportCoords.unprojectFromViewport(i,0,t.perspective).sub(t.perspective.position),c=p._viewportCoords.unprojectFromViewport(0,o,t.perspective).sub(t.perspective.position),u=(0<i?1:-1)*a.angleTo(s),h=(0<o?1:-1)*c.angleTo(s),l=Math.PI/60;u=p._spatial.clamp(.1*u,-l,l),h=p._spatial.clamp(.1*h,-l,l),p._navigator.stateService.rotateUnbounded({phi:u,theta:h})}}})},e.prototype._disable=function(){this._bounceSubscription.unsubscribe()},e.prototype._getConfiguration=function(){return{}},e}(f.HandlerBase);r.BounceHandler=s,r.default=s},{"../../Component":274,rxjs:26,"rxjs/operators":224}],322:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),o=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._viewportCoords=n,i}return i(e,o),e.prototype._enable=function(){var l=this;this._zoomSubscription=s.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.pipe(a.map(function(e){var t=e.touches[0];return{clientX:t.clientX,clientY:t.clientY,shiftKey:e.shiftKey}}))).pipe(a.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=l._container.element,o=l._viewportCoords.canvasPosition(t,i),s=o[0],a=o[1],c=l._viewportCoords.unprojectFromCanvas(s,a,i,r.perspective),u=n.projectBasic(c.toArray()),h=t.shiftKey?-1:1;l._navigator.stateService.zoomIn(h,u)})},e.prototype._disable=function(){this._zoomSubscription.unsubscribe()},e.prototype._getConfiguration=function(e){return{doubleClickZoom:e}},e}(e("../../Component").HandlerBase);r.DoubleClickZoomHandler=o,r.default=o},{"../../Component":274,rxjs:26,"rxjs/operators":224}],323:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var a=e("rxjs"),c=e("rxjs/operators"),_=e("../../Component"),o=function(s){function e(e,t,r,n,i){var o=s.call(this,e,t,r)||this;return o._spatial=i,o._viewportCoords=n,o}return i(e,s),e.prototype._enable=function(){var y=this,e=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).pipe(c.map(function(){return!0}),c.share()),t=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).pipe(c.map(function(){return!1}),c.share());this._activeMouseSubscription=a.merge(e,t).subscribe(this._container.mouseService.activate$);var r=a.merge(e,t).pipe(c.switchMap(function(e){return e?y._container.mouseService.documentMouseMove$:a.empty()}));this._preventDefaultSubscription=a.merge(r,this._container.touchService.touchMove$).subscribe(function(e){e.preventDefault()});var n=this._container.touchService.singleTouchDragStart$.pipe(c.map(function(){return!0})),i=this._container.touchService.singleTouchDragEnd$.pipe(c.map(function(){return!1}));this._activeTouchSubscription=a.merge(n,i).subscribe(this._container.touchService.activate$);var o=this._navigator.stateService.currentState$.pipe(c.map(function(e){return e.state.currentNode.fullPano||e.state.nodesAhead<1}),c.distinctUntilChanged(),c.switchMap(function(e){if(!e)return a.empty();var t=_.MouseOperator.filteredPairwiseMouseDrag$(y._component.name,y._container.mouseService),r=a.merge(y._container.touchService.singleTouchDragStart$,y._container.touchService.singleTouchDrag$,y._container.touchService.singleTouchDragEnd$.pipe(c.map(function(){return null}))).pipe(c.map(function(e){return null!=e&&0<e.touches.length?e.touches[0]:null}),c.pairwise(),c.filter(function(e){return null!=e[0]&&null!=e[1]}));return a.merge(t,r)}),c.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$),c.map(function(e){var t=e[0],r=e[1],n=e[2],i=t[0],o=t[1],s=o.clientX-i.clientX,a=o.clientY-i.clientY,c=y._container.element,u=y._viewportCoords.canvasPosition(o,c),h=u[0],l=u[1],p=y._viewportCoords.unprojectFromCanvas(h,l,c,r.perspective).sub(r.perspective.position),f=y._viewportCoords.unprojectFromCanvas(h-s,l,c,r.perspective).sub(r.perspective.position),d=y._viewportCoords.unprojectFromCanvas(h,l-a,c,r.perspective).sub(r.perspective.position),m=(0<s?1:-1)*f.angleTo(p),v=(0<a?-1:1)*d.angleTo(p),g=_.ImageBoundary.viewportDistances(n,r.perspective,y._viewportCoords);return 0<g[0]&&v<0&&(v/=Math.max(1,200*g[0])),0<g[2]&&0<v&&(v/=Math.max(1,200*g[2])),0<g[1]&&m<0&&(m/=Math.max(1,200*g[1])),0<g[3]&&0<m&&(m/=Math.max(1,200*g[3])),{phi:m,theta:v}}),c.share());this._rotateWithoutInertiaSubscription=o.subscribe(function(e){y._navigator.stateService.rotateWithoutInertia(e)}),this._rotateSubscription=o.pipe(c.scan(function(e,t){return y._drainBuffer(e),e.push([Date.now(),t]),e},[]),c.sample(a.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$),this._container.touchService.singleTouchDragEnd$)),c.map(function(e){for(var t=y._drainBuffer(e.slice()),r={phi:0,theta:0},n=0,i=t;n<i.length;n++){var o=i[n];r.phi+=o[1].phi,r.theta+=o[1].theta}var s=t.length;0<s&&(r.phi/=s,r.theta/=s);var a=Math.PI/18;return r.phi=y._spatial.clamp(r.phi,-a,a),r.theta=y._spatial.clamp(r.theta,-a,a),r})).subscribe(function(e){y._navigator.stateService.rotate(e)})},e.prototype._disable=function(){this._activeMouseSubscription.unsubscribe(),this._activeTouchSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._rotateSubscription.unsubscribe(),this._rotateWithoutInertiaSubscription.unsubscribe(),this._activeMouseSubscription=null,this._activeTouchSubscription=null,this._preventDefaultSubscription=null,this._rotateSubscription=null},e.prototype._getConfiguration=function(e){return{dragPan:e}},e.prototype._drainBuffer=function(e){for(var t=Date.now();0<e.length&&50<t-e[0][0];)e.shift();return e},e}(_.HandlerBase);r.DragPanHandler=o,r.default=o},{"../../Component":274,rxjs:26,"rxjs/operators":224}],324:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var d=e("three"),o=e("rxjs"),a=e("rxjs/operators"),c=e("../../Component"),h=e("../../State"),s=function(s){function e(e,t,r,n,i){var o=s.call(this,e,t,r)||this;return o._spatial=i,o._viewportCoords=n,o}return i(e,s),e.prototype._enable=function(){var u=this,e=this._navigator.stateService.state$.pipe(a.map(function(e){return e===h.State.Earth}),a.share());this._preventDefaultSubscription=e.pipe(a.switchMap(function(e){return e?u._container.mouseService.mouseWheel$:o.empty()})).subscribe(function(e){e.preventDefault()}),this._truckSubscription=e.pipe(a.switchMap(function(e){return e?c.MouseOperator.filteredPairwiseMouseDrag$(u._component.name,u._container.mouseService).pipe(a.filter(function(e){var t=e[0],r=e[1];return!(t.ctrlKey&&r.ctrlKey)})):o.empty()}),a.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$),a.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=[0,0,1],s=e[2].unprojectBasic([.5,.5],0);s[2]-=2;var a=u._planeIntersection(n,o,s,i.perspective,u._container.element),c=u._planeIntersection(r,o,s,i.perspective,u._container.element);return a&&c?(new d.Vector3).subVectors(a,c).multiplyScalar(-1).toArray():null}),a.filter(function(e){return!!e})).subscribe(function(e){u._navigator.stateService.truck(e)}),this._orbitSubscription=e.pipe(a.switchMap(function(e){return e?c.MouseOperator.filteredPairwiseMouseDrag$(u._component.name,u._container.mouseService).pipe(a.filter(function(e){var t=e[0],r=e[1];return t.ctrlKey&&r.ctrlKey})):o.empty()}),a.map(function(e){var t=e[0],r=e[1],n=u._eventToViewport(r,u._container.element),i=n[0],o=n[1],s=u._eventToViewport(t,u._container.element),a=s[0],c=s[1];return{phi:(a-i)*Math.PI,theta:(o-c)*Math.PI/2}})).subscribe(function(e){u._navigator.stateService.orbit(e)}),this._dollySubscription=e.pipe(a.switchMap(function(e){return e?u._container.mouseService.filteredWheel$(u._component.name,u._container.mouseService.mouseWheel$):o.empty()}),a.map(function(e){var t=e.deltaY;return 1===e.deltaMode?t*=40:2===e.deltaMode&&(t*=800),-t/u._viewportCoords.containerToCanvas(u._container.element)[1]})).subscribe(function(e){u._navigator.stateService.dolly(e)})},e.prototype._disable=function(){this._dollySubscription.unsubscribe(),this._orbitSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._truckSubscription.unsubscribe()},e.prototype._getConfiguration=function(){return{}},e.prototype._eventToViewport=function(e,t){var r=this._viewportCoords.canvasPosition(e,t);return this._viewportCoords.canvasToViewport(r[0],r[1],t)},e.prototype._planeIntersection=function(e,t,r,n,i){var o=this._viewportCoords.canvasPosition(e,i),s=o[0],a=o[1],c=this._viewportCoords.unprojectFromCanvas(s,a,i,n).sub(n.position).normalize();if(Math.abs(this._spatial.angleToPlane(c.toArray(),t))<Math.PI/90)return null;var u=n.position.clone(),h=(new d.Vector3).fromArray(t),l=(new d.Vector3).fromArray(r),p=(new d.Vector3).subVectors(l,u).dot(h)/c.clone().dot(h),f=(new d.Vector3).addVectors(u,c.multiplyScalar(p));return 0<this._viewportCoords.worldToCamera(f.toArray(),n)[2]?null:f},e}(c.HandlerBase);r.EarthControlHandler=s,r.default=s},{"../../Component":274,"../../State":281,rxjs:26,"rxjs/operators":224,three:225}],325:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var B=e("../../../src/Geo");function F(e,t){return-1<=e&&e<=1&&-1<=t&&t<=1}function $(e,t){return 0<=e&&e<=1&&0<=t&&t<=1}r.viewportDistances=function(t,r,n){for(var e=function(e){for(var t=[],r=[[0,0],[1,0],[1,1],[0,1]],n=[[1,0],[0,1],[-1,0],[0,-1]],i=0;i<4;++i)for(var o=r[i],s=n[i],a=0;a<e;++a)t.push([o[0]+s[0]*a/e,o[1]+s[1]*a/e]);return t}(100).map(function(e){return n.basicToViewportSafe(e[0],e[1],t,r)}),i=[],o=[{x:-1,y:1},{x:1,y:1},{x:1,y:-1},{x:-1,y:-1}],s=[!1,!1,!1,!1],a=0;a<e.length;a++){var c=e[a],u=e[(a+1)%e.length];if(null!==c)if(null!==u){var h=c[0],l=c[1],p=u[0],f=u[1];if(F(h,l))if(F(p,f))i.push(c);else for(var d=0;d<4;d++){var m={p1:{x:h,y:l},p2:{x:p,y:f}},v={p1:o[d],p2:o[(d+1)%4]};if(B.Lines.segmentsIntersect(m,v)){var g=B.Lines.segmentIntersection(m,v);i.push(c,[g.x,g.y]),s[d]=!0}}}else F(c[0],c[1])&&i.push(c)}var y=n.viewportToBasic(-1,1,t,r),_=y[0],b=y[1],x=n.viewportToBasic(1,1,t,r),w=x[0],S=x[1],M=n.viewportToBasic(1,-1,t,r),C=M[0],E=M[1],T=n.viewportToBasic(-1,-1,t,r),O=T[0],P=T[1];$(_,b)&&(s[3]=s[0]=!0),$(w,S)&&(s[0]=s[1]=!0),$(C,E)&&(s[1]=s[2]=!0),$(O,P)&&(s[2]=s[3]=!0);for(var A=[-1,-1,1,1],j=0,R=i;j<R.length;j++){var L=R[j],N=L[0],I=L[1];N>A[1]&&(A[1]=N),N<A[3]&&(A[3]=N),I>A[0]&&(A[0]=I),I<A[2]&&(A[2]=I)}var D=[1,1,-1,-1],k=[];for(d=0;d<4;d++)s[d]?k.push(0):k.push(Math.abs(D[d]-A[d]));return k}},{"../../../src/Geo":277}],326:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var a=e("../../Component"),c=e("../../Geo"),o=function(s){function e(e,t,r){var n=s.call(this,e,t,r)||this,i=new c.Spatial,o=new c.ViewportCoords;return n._bounceHandler=new a.BounceHandler(n,t,r,o,i),n._doubleClickZoomHandler=new a.DoubleClickZoomHandler(n,t,r,o),n._dragPanHandler=new a.DragPanHandler(n,t,r,o,i),n._earthControlHandler=new a.EarthControlHandler(n,t,r,o,i),n._scrollZoomHandler=new a.ScrollZoomHandler(n,t,r,o),n._touchZoomHandler=new a.TouchZoomHandler(n,t,r,o),n}return i(e,s),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._earthControlHandler.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._earthControlHandler.disable(),this._scrollZoomHandler.disable(),this._touchZoomHandler.disable()},e.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:!1,dragPan:!0,scrollZoom:!0,touchZoom:!0}},e.componentName="mouse",e}(a.Component);r.MouseComponent=o,a.ComponentService.register(o),r.default=o},{"../../Component":274,"../../Geo":277}],327:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs/operators"),o=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._viewportCoords=n,i}return i(e,o),e.prototype._enable=function(){var p=this;this._container.mouseService.claimWheel(this._component.name,0),this._preventDefaultSubscription=this._container.mouseService.mouseWheel$.subscribe(function(e){e.preventDefault()}),this._zoomSubscription=this._container.mouseService.filteredWheel$(this._component.name,this._container.mouseService.mouseWheel$).pipe(s.withLatestFrom(this._navigator.stateService.currentState$,function(e,t){return[e,t]}),s.filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}),s.map(function(e){return e[0]}),s.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,r){return[e,t,r]})).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=p._container.element,o=p._viewportCoords.canvasPosition(t,i),s=o[0],a=o[1],c=p._viewportCoords.unprojectFromCanvas(s,a,i,r.perspective),u=n.projectBasic(c.toArray()),h=t.deltaY;1===t.deltaMode?h*=40:2===t.deltaMode&&(h*=800);var l=-3*h/p._viewportCoords.containerToCanvas(i)[1];p._navigator.stateService.zoomIn(l,u)})},e.prototype._disable=function(){this._container.mouseService.unclaimWheel(this._component.name),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(e){return{scrollZoom:e}},e}(e("../../Component").HandlerBase);r.ScrollZoomHandler=o,r.default=o},{"../../Component":274,"rxjs/operators":224}],328:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),o=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._viewportCoords=n,i}return i(e,o),e.prototype._enable=function(){var d=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(e){e.originalEvent.preventDefault()});var e=this._container.touchService.pinchStart$.pipe(a.map(function(e){return!0})),t=this._container.touchService.pinchEnd$.pipe(a.map(function(e){return!1}));this._activeSubscription=s.merge(e,t).subscribe(this._container.touchService.activate$),this._zoomSubscription=this._container.touchService.pinch$.pipe(a.withLatestFrom(this._navigator.stateService.currentState$),a.filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}),a.map(function(e){return e[0]}),a.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=d._container.element,o=d._viewportCoords.canvasPosition(t,i),s=o[0],a=o[1],c=d._viewportCoords.unprojectFromCanvas(s,a,i,r.perspective),u=n.projectBasic(c.toArray()),h=d._viewportCoords.containerToCanvas(i),l=h[0],p=h[1],f=3*t.distanceChange/Math.min(l,p);d._navigator.stateService.zoomIn(f,u)})},e.prototype._disable=function(){this._activeSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},e.prototype._getConfiguration=function(e){return{touchZoom:e}},e}(e("../../Component").HandlerBase);r.TouchZoomHandler=o,r.default=o},{"../../Component":274,rxjs:26,"rxjs/operators":224}],329:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./popup/Popup");r.Popup=n.Popup;var i=e("./PopupComponent");r.PopupComponent=i.PopupComponent},{"./PopupComponent":330,"./popup/Popup":331}],330:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var a=e("rxjs"),c=e("rxjs/operators"),o=e("../../Component"),s=e("../../Utils"),u=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._dom=n||new s.DOM,i._popups=[],i._added$=new a.Subject,i._popups$=new a.Subject,i}return i(e,o),e.prototype.add=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];-1===this._popups.indexOf(n)&&(this._popups.push(n),this._activated&&n.setParentContainer(this._popupContainer))}this._added$.next(e),this._popups$.next(this._popups)},e.prototype.getAll=function(){return this._popups.slice()},e.prototype.remove=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];this._remove(n)}this._popups$.next(this._popups)},e.prototype.removeAll=function(){for(var e=0,t=this._popups.slice();e<t.length;e++){var r=t[e];this._remove(r)}this._popups$.next(this._popups)},e.prototype._activate=function(){var s=this;this._popupContainer=this._dom.createElement("div","mapillary-js-popup-container",this._container.element);for(var e=0,t=this._popups;e<t.length;e++){t[e].setParentContainer(this._popupContainer)}this._updateAllSubscription=a.combineLatest(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$).subscribe(function(e){for(var t=e[0],r=e[1],n=e[2],i=0,o=s._popups;i<o.length;i++){o[i].update(t,r,n)}});var r=this._popups$.pipe(c.startWith(this._popups),c.switchMap(function(e){return a.from(e).pipe(c.mergeMap(function(e){return e.changed$}))}),c.map(function(e){return[e]}));this._updateAddedChangedSubscription=a.merge(this._added$,r).pipe(c.withLatestFrom(this._container.renderService.renderCamera$,this._container.renderService.size$,this._navigator.stateService.currentTransform$)).subscribe(function(e){for(var t=e[0],r=e[1],n=e[2],i=e[3],o=0,s=t;o<s.length;o++){s[o].update(r,n,i)}})},e.prototype._deactivate=function(){this._updateAllSubscription.unsubscribe(),this._updateAddedChangedSubscription.unsubscribe();for(var e=0,t=this._popups;e<t.length;e++){t[e].remove()}this._container.element.removeChild(this._popupContainer),delete this._popupContainer},e.prototype._getDefaultConfiguration=function(){return{}},e.prototype._remove=function(e){var t=this._popups.indexOf(e);if(-1!==t){var r=this._popups.splice(t,1)[0];this._activated&&r.remove()}},e.componentName="popup",e}(o.Component);r.PopupComponent=u,o.ComponentService.register(u),r.default=u},{"../../Component":274,"../../Utils":284,rxjs:26,"rxjs/operators":224}],331:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=e("../../../Geo"),o=e("../../../Utils"),_=e("../../../Viewer"),s=function(){function e(e,t,r){this._options={},e=e||{},this._options.capturePointer=!1!==e.capturePointer||e.capturePointer,this._options.clean=e.clean,this._options.float=e.float,this._options.offset=e.offset,this._options.opacity=e.opacity,this._options.position=e.position,this._dom=r||new o.DOM,this._viewportCoords=t||new i.ViewportCoords,this._notifyChanged$=new n.Subject}return Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),e.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},e.prototype.setBasicPoint=function(e){this._point=e.slice(),this._rect=null,this._notifyChanged$.next(this)},e.prototype.setBasicRect=function(e){this._rect=e.slice(),this._point=null,this._notifyChanged$.next(this)},e.prototype.setDOMContent=function(e){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content);var t="mapillaryjs-popup-content"+(!0===this._options.clean?"-clean":"")+(!0===this._options.capturePointer?" mapillaryjs-popup-capture-pointer":"");this._content=this._dom.createElement("div",t,this._container),this._content.appendChild(e),this._notifyChanged$.next(this)},e.prototype.setHTML=function(e){var t,r=this._dom.document.createDocumentFragment(),n=this._dom.createElement("body");for(n.innerHTML=e;t=n.firstChild;)r.appendChild(t);this.setDOMContent(r)},e.prototype.setText=function(e){this.setDOMContent(this._dom.document.createTextNode(e))},e.prototype.setParentContainer=function(e){this._parentContainer=e},e.prototype.update=function(e,t,r){var n;if(this._parentContainer&&this._content&&(this._point||this._rect)){if(!this._container){if(this._container=this._dom.createElement("div","mapillaryjs-popup",this._parentContainer),!0!==this._options.clean&&this._options.float!==_.Alignment.Center){var i="mapillaryjs-popup-tip"+(!0===this._options.capturePointer?" mapillaryjs-popup-capture-pointer":"");this._tip=this._dom.createElement("div",i,this._container),this._dom.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 o=null,s=this._alignmentToPopupAligment(this._options.position),a=this._alignmentToPopupAligment(this._options.float),c=this._container.classList;if(null!=this._point)o=this._viewportCoords.basicToCanvasSafe(this._point[0],this._point[1],{offsetHeight:t.height,offsetWidth:t.width},r,e.perspective);else{for(var u=null,h=0,l=["center","top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];h<l.length;h++){var p=l[h];if(c.contains("mapillaryjs-popup-float-"+p)){u=p;break}}o=(n=this._rectToPixel(this._rect,s,u,e,t,r))[0],s=n[1],a||(a=s)}if(null!=o){if(this._container.style.visibility="visible",!a){var f=this._container.offsetWidth,d=this._container.offsetHeight,m=this._pixelToFloats(o,t,f,d);a=0===m.length?"top":m.join("-")}var v=this._normalizeOffset(this._options.offset);o=[o[0]+v[a][0],o[1]+v[a][1]],o=[Math.round(o[0]),Math.round(o[1])];var g={bottom:"translate(-50%,0)","bottom-left":"translate(-100%,0)","bottom-right":"translate(0,0)",center:"translate(-50%,-50%)",left:"translate(-100%,-50%)",right:"translate(0,-50%)",top:"translate(-50%,-100%)","top-left":"translate(-100%,-100%)","top-right":"translate(0,-100%)"};for(var y in g)g.hasOwnProperty(y)&&c.remove("mapillaryjs-popup-float-"+y);c.add("mapillaryjs-popup-float-"+a),this._container.style.transform=g[a]+" translate("+o[0]+"px,"+o[1]+"px)"}else this._container.style.visibility="hidden"}},e.prototype._rectToPixel=function(e,t,r,n,i,o){if(!t){for(var s=this._container.offsetWidth,a=this._container.offsetHeight,c={bottom:[0,a/2],"bottom-left":[-s/2,a/2],"bottom-right":[s/2,a/2],left:[-s/2,0],right:[s/2,0],top:[0,-a/2],"top-left":[-s/2,-a/2],"top-right":[s/2,-a/2]},u=[0,null,null],h=0,l=["top","bottom","left","right"];h<l.length;h++){var p=l[h],f=this._pointFromRectPosition(e,p),d=this._viewportCoords.basicToCanvasSafe(f[0],f[1],{offsetHeight:i.height,offsetWidth:i.width},o,n.perspective);if(null!=d){var m=c[p],v=[d[0]+m[0],d[1]+m[1]],g=null!=r&&r===p?1:.7;if(0===this._pixelToFloats(v,i,s/g,a/(2*g)).length&&0<d[0]&&d[0]<i.width&&0<d[1]&&d[1]<i.height)return[d,p];var y=Math.max(v[0]-s/2,0),_=Math.min(v[0]+s/2,i.width),b=Math.max(v[1]-a/2,0),x=Math.min(v[1]+a/2,i.height),w=g*Math.max(0,_-y)*Math.max(0,x-b);w>u[0]&&(u[0]=w,u[1]=d,u[2]=p)}}if(0<u[0])return[u[1],u[2]]}var S=this._pointFromRectPosition(e,t);return[this._viewportCoords.basicToCanvasSafe(S[0],S[1],{offsetHeight:i.height,offsetWidth:i.width},o,n.perspective),null!=t?t:"top"]},e.prototype._alignmentToPopupAligment=function(e){switch(e){case _.Alignment.Bottom:return"bottom";case _.Alignment.BottomLeft:return"bottom-left";case _.Alignment.BottomRight:return"bottom-right";case _.Alignment.Center:return"center";case _.Alignment.Left:return"left";case _.Alignment.Right:return"right";case _.Alignment.Top:return"top";case _.Alignment.TopLeft:return"top-left";case _.Alignment.TopRight:return"top-right";default:return null}},e.prototype._normalizeOffset=function(e){if(null==e)return this._normalizeOffset(0);if("number"!=typeof e)return{bottom:e.bottom||[0,0],"bottom-left":e.bottomLeft||[0,0],"bottom-right":e.bottomRight||[0,0],center:e.center||[0,0],left:e.left||[0,0],right:e.right||[0,0],top:e.top||[0,0],"top-left":e.topLeft||[0,0],"top-right":e.topRight||[0,0]};var t=e,r=(0<=t?1:-1)*Math.round(Math.sqrt(.5*Math.pow(t,2)));return{bottom:[0,t],"bottom-left":[-r,r],"bottom-right":[r,r],center:[0,0],left:[-t,0],right:[t,0],top:[0,-t],"top-left":[-r,-r],"top-right":[r,-r]}},e.prototype._pixelToFloats=function(e,t,r,n){var i=[];return e[1]<n?i.push("bottom"):e[1]>t.height-n&&i.push("top"),e[0]<r/2?i.push("right"):e[0]>t.width-r/2&&i.push("left"),i},e.prototype._pointFromRectPosition=function(e,t){var r=e[0],n=e[0]<e[2]?e[2]:e[2]+1,i=e[1],o=e[3];switch(t){case"bottom":return[(r+n)/2,o];case"bottom-left":return[r,o];case"bottom-right":return[n,o];case"center":return[(r+n)/2,(i+o)/2];case"left":return[r,(i+o)/2];case"right":return[n,(i+o)/2];case"top":return[(r+n)/2,i];case"top-left":return[r,i];case"top-right":return[n,i];default:return[(r+n)/2,o]}},e}();r.Popup=s,r.default=s},{"../../../Geo":277,"../../../Utils":284,"../../../Viewer":285,rxjs:26}],332:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var u=e("rxjs"),h=e("rxjs/operators"),a=e("../../Component"),o=e("../../Edge"),l=e("../../Graph"),s=function(s){function c(e,t,r,n,i){var o=s.call(this,e,t,r)||this;return o._sequenceDOMRenderer=n||new a.SequenceDOMRenderer(t),o._scheduler=i,o._containerWidth$=new u.Subject,o._hoveredKeySubject$=new u.Subject,o._hoveredKey$=o._hoveredKeySubject$.pipe(h.share()),o._navigator.playService.playing$.pipe(h.skip(1),h.withLatestFrom(o._configuration$)).subscribe(function(e){var t=e[0],r=e[1];o.fire(c.playingchanged,t),t!==r.playing&&(t?o.play():o.stop())}),o._navigator.playService.direction$.pipe(h.skip(1),h.withLatestFrom(o._configuration$)).subscribe(function(e){var t=e[0];t!==e[1].direction&&o.setDirection(t)}),o}return i(c,s),Object.defineProperty(c.prototype,"hoveredKey$",{get:function(){return this._hoveredKey$},enumerable:!0,configurable:!0}),c.prototype.play=function(){this.configure({playing:!0})},c.prototype.stop=function(){this.configure({playing:!1})},c.prototype.setDirection=function(e){this.configure({direction:e})},c.prototype.setHighlightKey=function(e){this.configure({highlightKey:e})},c.prototype.setMaxWidth=function(e){this.configure({maxWidth:e})},c.prototype.setMinWidth=function(e){this.configure({minWidth:e})},c.prototype.setVisible=function(e){this.configure({visible:e})},c.prototype.resize=function(){var t=this;this._configuration$.pipe(h.first(),h.map(function(e){return t._sequenceDOMRenderer.getContainerWidth(t._container.element,e)})).subscribe(function(e){t._containerWidth$.next(e)})},c.prototype._activate=function(){var a=this;this._sequenceDOMRenderer.activate();var t=this._navigator.stateService.currentNode$.pipe(h.switchMap(function(e){return e.sequenceEdges$}),h.publishReplay(1),h.refCount()),e=this._navigator.stateService.currentNode$.pipe(h.distinctUntilChanged(void 0,function(e){return e.sequenceKey}),h.switchMap(function(e){return u.concat(u.of(null),a._navigator.graphService.cacheSequence$(e.sequenceKey).pipe(h.retry(3),h.catchError(function(e){return console.error("Failed to cache sequence",e),u.of(null)})))}),h.startWith(null),h.publishReplay(1),h.refCount());this._sequenceSubscription=e.subscribe();var i=this._sequenceDOMRenderer.index$.pipe(h.withLatestFrom(e),h.map(function(e){var t=e[0],r=e[1];return null!=r?r.keys[t]:null}),h.filter(function(e){return!!e}),h.distinctUntilChanged(),h.publish(),h.refCount());this._moveSubscription=u.merge(i.pipe(h.debounceTime(100,this._scheduler)),i.pipe(h.auditTime(400,this._scheduler))).pipe(h.distinctUntilChanged(),h.switchMap(function(e){return a._navigator.moveToKey$(e).pipe(h.catchError(function(e){return u.empty()}))})).subscribe(),this._setSequenceGraphModeSubscription=this._sequenceDOMRenderer.changingPositionChanged$.pipe(h.filter(function(e){return e})).subscribe(function(){a._navigator.graphService.setGraphMode(l.GraphMode.Sequence)}),this._setSpatialGraphModeSubscription=this._sequenceDOMRenderer.changingPositionChanged$.pipe(h.filter(function(e){return!e})).subscribe(function(){a._navigator.graphService.setGraphMode(l.GraphMode.Spatial)}),this._navigator.graphService.graphMode$.pipe(h.switchMap(function(e){return e===l.GraphMode.Spatial?a._navigator.stateService.currentNode$.pipe(h.take(2)):u.empty()}),h.filter(function(e){return!e.spatialEdges.cached}),h.switchMap(function(e){return a._navigator.graphService.cacheNode$(e.key).pipe(h.catchError(function(e){return u.empty()}))})).subscribe(),this._stopSubscription=this._sequenceDOMRenderer.changingPositionChanged$.pipe(h.filter(function(e){return e})).subscribe(function(){a._navigator.playService.stop()}),this._cacheSequenceNodesSubscription=u.combineLatest(this._navigator.graphService.graphMode$,this._sequenceDOMRenderer.changingPositionChanged$.pipe(h.startWith(!1),h.distinctUntilChanged())).pipe(h.withLatestFrom(this._navigator.stateService.currentNode$),h.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return n&&r===l.GraphMode.Sequence?a._navigator.graphService.cacheSequenceNodes$(i.sequenceKey,i.key).pipe(h.retry(3),h.catchError(function(e){return console.error("Failed to cache sequence nodes.",e),u.empty()})):u.empty()})).subscribe();var r=e.pipe(h.switchMap(function(r){if(!r)return u.of({index:null,max:null});var n=!0;return a._sequenceDOMRenderer.changingPositionChanged$.pipe(h.startWith(!1),h.distinctUntilChanged(),h.switchMap(function(e){var t=!e&&n?0:1;return n=!1,e?i:a._navigator.stateService.currentNode$.pipe(h.map(function(e){return e.key}),h.distinctUntilChanged(),h.skip(t))}),h.map(function(e){var t=r.keys.indexOf(e);return-1===t?{index:null,max:null}:{index:t,max:r.keys.length-1}}))}));this._renderSubscription=u.combineLatest(t,this._configuration$,this._containerWidth$,this._sequenceDOMRenderer.changed$.pipe(h.startWith(this._sequenceDOMRenderer)),this._navigator.playService.speed$,r).pipe(h.map(function(e){var t=e[0],r=e[1],n=e[2],i=(e[3],e[4]),o=e[5],s=a._sequenceDOMRenderer.render(t,r,n,i,o.index,o.max,a,a._navigator);return{name:a._name,vnode:s}})).subscribe(this._container.domRenderer.render$),this._setSpeedSubscription=this._sequenceDOMRenderer.speed$.subscribe(function(e){a._navigator.playService.setSpeed(e)}),this._setDirectionSubscription=this._configuration$.pipe(h.map(function(e){return e.direction}),h.distinctUntilChanged()).subscribe(function(e){a._navigator.playService.setDirection(e)}),this._containerWidthSubscription=this._configuration$.pipe(h.distinctUntilChanged(function(e,t){return e[0]===t[0]&&e[1]===t[1]},function(e){return[e.minWidth,e.maxWidth]}),h.map(function(e){return a._sequenceDOMRenderer.getContainerWidth(a._container.element,e)})).subscribe(this._containerWidth$),this._playingSubscription=this._configuration$.pipe(h.map(function(e){return e.playing}),h.distinctUntilChanged()).subscribe(function(e){e?a._navigator.playService.play():a._navigator.playService.stop()}),this._hoveredKeySubscription=this._sequenceDOMRenderer.mouseEnterDirection$.pipe(h.switchMap(function(i){var e=t.pipe(h.map(function(e){for(var t=0,r=e.edges;t<r.length;t++){var n=r[t];if(n.data.direction===i)return n.to}return null}),h.takeUntil(a._sequenceDOMRenderer.mouseLeaveDirection$));return u.concat(e,u.of(null))}),h.distinctUntilChanged()).subscribe(this._hoveredKeySubject$),this._emitHoveredKeySubscription=this._hoveredKey$.subscribe(function(e){a.fire(c.hoveredkeychanged,e)})},c.prototype._deactivate=function(){this._emitHoveredKeySubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._playingSubscription.unsubscribe(),this._containerWidthSubscription.unsubscribe(),this._hoveredKeySubscription.unsubscribe(),this._setSpeedSubscription.unsubscribe(),this._setDirectionSubscription.unsubscribe(),this._setSequenceGraphModeSubscription.unsubscribe(),this._setSpatialGraphModeSubscription.unsubscribe(),this._sequenceSubscription.unsubscribe(),this._moveSubscription.unsubscribe(),this._cacheSequenceNodesSubscription.unsubscribe(),this._stopSubscription.unsubscribe(),this._sequenceDOMRenderer.deactivate()},c.prototype._getDefaultConfiguration=function(){return{direction:o.EdgeDirection.Next,maxWidth:108,minWidth:70,playing:!1,visible:!0}},c.componentName="sequence",c.playingchanged="playingchanged",c.hoveredkeychanged="hoveredkeychanged",c}(a.Component);r.SequenceComponent=s,a.ComponentService.register(s),r.default=s},{"../../Component":274,"../../Edge":275,"../../Graph":278,rxjs:26,"rxjs/operators":224}],333:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=e("rxjs/operators"),b=e("virtual-dom"),x=e("../../Component"),w=e("../../Edge"),f=e("../../Error"),o=function(){function e(e){this._container=e,this._minThresholdWidth=320,this._maxThresholdWidth=1480,this._minThresholdHeight=240,this._maxThresholdHeight=820,this._stepperDefaultWidth=108,this._controlsDefaultWidth=88,this._defaultHeight=30,this._expandControls=!1,this._mode=x.SequenceMode.Default,this._speed=.5,this._changingSpeed=!1,this._index=null,this._changingPosition=!1,this._mouseEnterDirection$=new n.Subject,this._mouseLeaveDirection$=new n.Subject,this._notifyChanged$=new n.Subject,this._notifyChangingPositionChanged$=new n.Subject,this._notifySpeedChanged$=new n.Subject,this._notifyIndexChanged$=new n.Subject}return Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changingPositionChanged$",{get:function(){return this._notifyChangingPositionChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"speed$",{get:function(){return this._notifySpeedChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"index$",{get:function(){return this._notifyIndexChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseEnterDirection$",{get:function(){return this._mouseEnterDirection$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseLeaveDirection$",{get:function(){return this._mouseLeaveDirection$},enumerable:!0,configurable:!0}),e.prototype.activate=function(){var t=this;this._changingSubscription||(this._changingSubscription=n.merge(this._container.mouseService.documentMouseUp$,this._container.touchService.touchEnd$.pipe(i.filter(function(e){return 0===e.touches.length}))).subscribe(function(e){t._changingSpeed&&(t._changingSpeed=!1),t._changingPosition&&t._setChangingPosition(!1)}))},e.prototype.deactivate=function(){this._changingSubscription&&(this._changingSpeed=!1,this._changingPosition=!1,this._expandControls=!1,this._mode=x.SequenceMode.Default,this._changingSubscription.unsubscribe(),this._changingSubscription=null)},e.prototype.render=function(e,t,r,n,i,o,s,a){if(!1===t.visible)return b.h("div.SequenceContainer",{},[]);var c=this._createStepper(e,t,r,s,a),u=this._createSequenceControls(r),h=this._createPlaybackControls(r,n,s,t),l=this._createTimelineControls(r,i,o);return b.h("div.SequenceContainer",[c,u,h,l])},e.prototype.getContainerWidth=function(e,t){var r=e.offsetWidth,n=e.offsetHeight,i=t.minWidth,o=t.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)},e.prototype._createPositionInput=function(e,t){var r=this;this._index=e;var n=function(e){r._index=Number(e.target.value),r._notifyIndexChanged$.next(r._index)},i=this._container.domContainer.getBoundingClientRect(),o=function(e){e.stopPropagation(),r._setChangingPosition(!0)},s=function(e){!0===r._changingPosition&&e.stopPropagation()},a={max:null!=t?t:1,min:0,onchange:n,oninput:n,onkeydown:function(e){"ArrowDown"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"ArrowUp"!==e.key||e.preventDefault()},onmousedown:o,onmousemove:s,ontouchmove:s,ontouchstart:o,style:{width:Math.max(276,Math.min(410,5+.8*i.width))-65+"px"},type:"range",value:null!=e?e:0},c=null==e||null==t||t<=1;c&&(a.disabled="true");var u=b.h("input.SequencePosition",a,[]),h=c?".SequencePositionContainerDisabled":".SequencePositionContainer";return b.h("div"+h,[u])},e.prototype._createSpeedInput=function(e){var t=this;this._speed=e;var r=function(e){t._speed=Number(e.target.value)/1e3,t._notifySpeedChanged$.next(t._speed)},n=this._container.domContainer.getBoundingClientRect(),i=Math.max(276,Math.min(410,5+.8*n.width))-160,o=function(e){t._changingSpeed=!0,e.stopPropagation()},s=function(e){!0===t._changingSpeed&&e.stopPropagation()},a=b.h("input.SequenceSpeed",{max:1e3,min:0,onchange:r,oninput:r,onkeydown:function(e){"ArrowDown"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"ArrowUp"!==e.key||e.preventDefault()},onmousedown:o,onmousemove:s,ontouchmove:s,ontouchstart:o,style:{width:i+"px"},type:"range",value:1e3*e},[]);return b.h("div.SequenceSpeedContainer",[a])},e.prototype._createPlaybackControls=function(e,t,r,n){var i=this;if(this._mode!==x.SequenceMode.Playback)return b.h("div.SequencePlayback",[]);var o=b.h("div.SequenceSwitchIcon.SequenceIconVisible",[]),s=n.direction===w.EdgeDirection.Next?w.EdgeDirection.Prev:w.EdgeDirection.Next,a=n.playing,c={onclick:function(){a||r.setDirection(s)}},u=n.playing?".SequenceSwitchButtonDisabled":".SequenceSwitchButton",h=b.h("div"+u,c,[o]),l=b.h("div.SequenceSlowIcon.SequenceIconVisible",[]),p=b.h("div.SequenceSlowContainer",[l]),f=b.h("div.SequenceFastIcon.SequenceIconVisible",[]),d=b.h("div.SequenceFastContainer",[f]),m=b.h("div.SequenceCloseIcon.SequenceIconVisible",[]),v={onclick:function(){i._mode=x.SequenceMode.Default,i._notifyChanged$.next(i)}},g=b.h("div.SequenceCloseButton",v,[m]),y=[h,p,this._createSpeedInput(t),d,g],_={style:{top:Math.round(e/this._stepperDefaultWidth*this._defaultHeight+10)+"px"}};return b.h("div.SequencePlayback",_,y)},e.prototype._createPlayingButton=function(e,t,r,n){var i=r.direction===w.EdgeDirection.Next&&null!=e||r.direction===w.EdgeDirection.Prev&&null!=t,o={onclick:r.playing?function(e){n.stop()}:i?function(e){n.play()}:null},s={className:r.playing?"Stop":i?"Play":"PlayDisabled"};r.direction===w.EdgeDirection.Prev&&(s.style={transform:"rotate(180deg) translate(50%, 50%)"});var a=b.h("div.SequenceComponentIcon",s,[]),c=i?"SequencePlay":"SequencePlayDisabled";return b.h("div."+c,o,[a])},e.prototype._createSequenceControls=function(e){var t=this,r=Math.round(8/this._stepperDefaultWidth*e),n={onclick:function(){t._expandControls=!t._expandControls,t._mode=x.SequenceMode.Default,t._notifyChanged$.next(t)},style:{"border-bottom-right-radius":r+"px","border-top-right-radius":r+"px"}},i=b.h("div.SequenceExpanderBar",[]),o=b.h("div.SequenceExpanderButton",n,[i]),s=this._mode===x.SequenceMode.Playback?".SequenceFastIconGrey.SequenceIconVisible":".SequenceFastIcon",a=b.h("div"+s,[]),c={onclick:function(){t._mode=t._mode===x.SequenceMode.Playback?x.SequenceMode.Default:x.SequenceMode.Playback,t._notifyChanged$.next(t)}},u=b.h("div.SequencePlaybackButton",c,[a]),h=this._mode===x.SequenceMode.Timeline?".SequenceTimelineIconGrey.SequenceIconVisible":".SequenceTimelineIcon",l=b.h("div"+h,[]),p={onclick:function(){t._mode=t._mode===x.SequenceMode.Timeline?x.SequenceMode.Default:x.SequenceMode.Timeline,t._notifyChanged$.next(t)}},f=b.h("div.SequenceTimelineButton",p,[l]),d={style:{height:this._defaultHeight/this._stepperDefaultWidth*e+"px",transform:"translate("+(e/2+2)+"px, 0)",width:this._controlsDefaultWidth/this._stepperDefaultWidth*e+"px"}},m=".SequenceControls"+(this._expandControls?".SequenceControlsExpanded":"");return b.h("div"+m,d,[u,f,o])},e.prototype._createSequenceArrows=function(e,t,r,n,i){var o=this,s={onclick:null!=e?function(e){i.moveDir$(w.EdgeDirection.Next).subscribe(void 0,function(e){e instanceof f.AbortMapillaryError||console.error(e)})}:null,onmouseenter:function(e){o._mouseEnterDirection$.next(w.EdgeDirection.Next)},onmouseleave:function(e){o._mouseLeaveDirection$.next(w.EdgeDirection.Next)}},a=Math.round(8/this._stepperDefaultWidth*r),c={onclick:null!=t?function(e){i.moveDir$(w.EdgeDirection.Prev).subscribe(void 0,function(e){e instanceof f.AbortMapillaryError||console.error(e)})}:null,onmouseenter:function(e){o._mouseEnterDirection$.next(w.EdgeDirection.Prev)},onmouseleave:function(e){o._mouseLeaveDirection$.next(w.EdgeDirection.Prev)},style:{"border-bottom-left-radius":a+"px","border-top-left-radius":a+"px"}},u=this._getStepClassName(w.EdgeDirection.Next,e,n.highlightKey),h=this._getStepClassName(w.EdgeDirection.Prev,t,n.highlightKey),l=b.h("div.SequenceComponentIcon",[]),p=b.h("div.SequenceComponentIcon",[]);return[b.h("div."+h,c,[p]),b.h("div."+u,s,[l])]},e.prototype._createStepper=function(e,t,r,n,i){for(var o=null,s=null,a=0,c=e.edges;a<c.length;a++){var u=c[a];u.data.direction===w.EdgeDirection.Next&&(o=u.to),u.data.direction===w.EdgeDirection.Prev&&(s=u.to)}var h=this._createPlayingButton(o,s,t,n),l=this._createSequenceArrows(o,s,r,t,i);l.splice(1,0,h);var p={oncontextmenu:function(e){e.preventDefault()},style:{height:this._defaultHeight/this._stepperDefaultWidth*r+"px",width:r+"px"}};return b.h("div.SequenceStepper",p,l)},e.prototype._createTimelineControls=function(e,t,r){var n=this;if(this._mode!==x.SequenceMode.Timeline)return b.h("div.SequenceTimeline",[]);var i=this._createPositionInput(t,r),o=b.h("div.SequenceCloseIcon.SequenceIconVisible",[]),s={onclick:function(){n._mode=x.SequenceMode.Default,n._notifyChanged$.next(n)}},a=b.h("div.SequenceCloseButton",s,[o]),c={style:{top:Math.round(e/this._stepperDefaultWidth*this._defaultHeight+10)+"px"}};return b.h("div.SequenceTimeline",c,[i,a])},e.prototype._getStepClassName=function(e,t,r){var n=e===w.EdgeDirection.Next?"SequenceStepNext":"SequenceStepPrev";return null==t?n+="Disabled":r===t&&(n+="Highlight"),n},e.prototype._setChangingPosition=function(e){this._changingPosition=e,this._notifyChangingPositionChanged$.next(e)},e}();r.SequenceDOMRenderer=o,r.default=o},{"../../Component":274,"../../Edge":275,"../../Error":276,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],334:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.SequenceMode||(r.SequenceMode={}))[i.Default=0]="Default",i[i.Playback=1]="Playback",i[i.Timeline=2]="Timeline",r.default=n},{}],335:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});e("path");var n=function(){function e(){}return e.equirectangular={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float phiLength;\nuniform float phiShift;\nuniform float thetaLength;\nuniform float thetaShift;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vec3 b = normalize(vRstq.xyz);\n    float lat = -asin(b.y);\n    float lon = atan(b.x, b.z);\n    float x = (lon - phiShift) / phiLength + 0.5;\n    float y = (lat - thetaShift) / thetaLength + 0.5;\n    vec4 baseColor = texture2D(projectorTex, vec2(x, y));\n    baseColor.a = opacity;\n    gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},e.equirectangularCurtain={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float curtain;\nuniform float opacity;\nuniform float phiLength;\nuniform float phiShift;\nuniform float thetaLength;\nuniform float thetaShift;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vec3 b = normalize(vRstq.xyz);\n    float lat = -asin(b.y);\n    float lon = atan(b.x, b.z);\n    float x = (lon - phiShift) / phiLength + 0.5;\n    float y = (lat - thetaShift) / thetaLength + 0.5;\n\n    bool inverted = curtain < 0.5;\n\n    float curtainMin = inverted ? curtain + 0.5 : curtain - 0.5;\n    float curtainMax = curtain;\n\n    bool insideCurtain = inverted ?\n        x > curtainMin || x < curtainMax :\n        x > curtainMin && x < curtainMax;\n\n    vec4 baseColor;\n    if (insideCurtain) {\n        baseColor = texture2D(projectorTex, vec2(x, y));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},e.perspective={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float x = vRstq.x / vRstq.z;\n    float y = vRstq.y / vRstq.z;\n    float r2 = x * x + y * y;\n\n    if (radial_peak > 0. && r2 > radial_peak * sqrt(r2)) {\n        r2 = radial_peak * radial_peak;\n    }\n\n    float d = 1.0 + k1 * r2 + k2 * r2 * r2;\n    float u = scale_x * focal * d * x + 0.5;\n    float v = - scale_y * focal * d * y + 0.5;\n\n    vec4 baseColor;\n    if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},e.perspectiveCurtain={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float x = vRstq.x / vRstq.z;\n    float y = vRstq.y / vRstq.z;\n    float r2 = x * x + y * y;\n\n    if (radial_peak > 0. && r2 > radial_peak * sqrt(r2)) {\n        r2 = radial_peak * radial_peak;\n    }\n\n    float d = 1.0 + k1 * r2 + k2 * r2 * r2;\n    float u = scale_x * focal * d * x + 0.5;\n    float v = - scale_y * focal * d * y + 0.5;\n\n    vec4 baseColor;\n    if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},e.perspectiveDistorted={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float u = vRstq.x / vRstq.w;\n    float v = vRstq.y / vRstq.w;\n\n    vec4 baseColor;\n    if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n"},e.perspectiveDistortedCurtain={fragment:"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    float u = vRstq.x / vRstq.w;\n    float v = vRstq.y / vRstq.w;\n\n    vec4 baseColor;\n    if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n        baseColor = texture2D(projectorTex, vec2(u, v));\n        baseColor.a = opacity;\n    } else {\n        baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n\n    gl_FragColor = baseColor;\n}\n",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n    vRstq = projectorMat * vec4(position, 1.0);\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n"},e}();r.Shaders=n},{path:22}],336:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var f=e("rxjs"),d=e("rxjs/operators"),m=e("../../Component"),s=e("../../Geo"),v=e("../../State"),g=e("../../Render"),y=e("../../Tiles"),_=e("../../Utils"),o=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._viewportCoords=n||new s.ViewportCoords,i._domRenderer=new m.SliderDOMRenderer(t),i._imageTileLoader=new y.ImageTileLoader(_.Urls.tileScheme,_.Urls.tileDomain,_.Urls.origin),i._roiCalculator=new y.RegionOfInterestCalculator,i._spatial=new s.Spatial,i._glRendererOperation$=new f.Subject,i._glRendererCreator$=new f.Subject,i._glRendererDisposer$=new f.Subject,i._glRenderer$=i._glRendererOperation$.pipe(d.scan(function(e,t){return t(e)},null),d.filter(function(e){return null!=e}),d.distinctUntilChanged(void 0,function(e){return e.frameId})),i._glRendererCreator$.pipe(d.map(function(){return function(e){if(null!=e)throw new Error("Multiple slider states can not be created at the same time");return new m.SliderGLRenderer}})).subscribe(i._glRendererOperation$),i._glRendererDisposer$.pipe(d.map(function(){return function(e){return e.dispose(),null}})).subscribe(i._glRendererOperation$),i}return i(e,o),e.prototype.setInitialPosition=function(e){this.configure({initialPosition:e})},e.prototype.setKeys=function(e){this.configure({keys:e})},e.prototype.setSliderMode=function(e){this.configure({mode:e})},e.prototype.setSliderVisible=function(e){this.configure({sliderVisible:e})},e.prototype._activate=function(){var D=this;this._modeSubcription=this._domRenderer.mode$.subscribe(function(e){D.setSliderMode(e)}),this._glRenderSubscription=this._glRenderer$.pipe(d.map(function(e){return{name:D._name,render:{frameId:e.frameId,needsRender:e.needsRender,render:e.render.bind(e),stage:g.GLRenderStage.Background}}})).subscribe(this._container.glRenderer.render$);var e=f.concat(this.configuration$.pipe(d.map(function(e){return null!=e.initialPosition?e.initialPosition:1}),d.first()),this._domRenderer.position$),t=this.configuration$.pipe(d.map(function(e){return e.mode}),d.distinctUntilChanged()),r=this._navigator.stateService.currentState$.pipe(d.map(function(e){return e.state.motionless}),d.distinctUntilChanged()),n=this._navigator.stateService.currentState$.pipe(d.map(function(e){return e.state.currentNode.fullPano}),d.distinctUntilChanged()),i=f.combineLatest(this._configuration$.pipe(d.map(function(e){return e.sliderVisible})),this._navigator.stateService.currentState$.pipe(d.map(function(e){return!(null==e.state.currentNode||null==e.state.previousNode||e.state.currentNode.pano&&!e.state.currentNode.fullPano||e.state.previousNode.pano&&!e.state.previousNode.fullPano||e.state.currentNode.fullPano&&!e.state.previousNode.fullPano)}),d.distinctUntilChanged())).pipe(d.map(function(e){var t=e[0],r=e[1];return t&&r}),d.distinctUntilChanged());this._waitSubscription=f.combineLatest(t,r,n,i).pipe(d.withLatestFrom(this._navigator.stateService.state$)).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=t[2],o=t[3],s=e[1],a=o&&(n||r===m.SliderMode.Stationary||i);a&&s!==v.State.WaitingInteractively?D._navigator.stateService.waitInteractively():a||s===v.State.Waiting||D._navigator.stateService.wait()}),this._moveSubscription=f.combineLatest(e,t,r,n,i).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];e[4];n||r===m.SliderMode.Stationary||i?D._navigator.stateService.moveTo(1):D._navigator.stateService.moveTo(t)}),this._domRenderSubscription=f.combineLatest(e,t,r,n,i,this._container.renderService.size$).pipe(d.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4];e[5];return{name:D._name,vnode:D._domRenderer.render(t,r,n,i,o)}})).subscribe(this._container.domRenderer.render$),this._glRendererCreator$.next(null),this._updateCurtainSubscription=f.combineLatest(e,n,i,this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(d.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4];if(!r)return n?t:1;var s=D._viewportCoords.viewportToBasic(-1.15,0,o,i.perspective),a=D._viewportCoords.viewportToBasic(1.15,0,o,i.perspective),c=a[0]<s[0]?a[0]+1:a[0],u=s[0]+t*(c-s[0]);return 1<u?u-1:u}),d.map(function(t){return function(e){return e.updateCurtain(t),e}})).subscribe(this._glRendererOperation$),this._stateSubscription=f.combineLatest(this._navigator.stateService.currentState$,t).pipe(d.map(function(e){var t=e[0],r=e[1];return function(e){return e.update(t,r),e}})).subscribe(this._glRendererOperation$),this._setKeysSubscription=this._configuration$.pipe(d.filter(function(e){return null!=e.keys}),d.switchMap(function(e){return f.zip(f.zip(D._catchCacheNode$(e.keys.background),D._catchCacheNode$(e.keys.foreground)).pipe(d.map(function(e){return{background:e[0],foreground:e[1]}})),D._navigator.stateService.currentState$.pipe(d.first())).pipe(d.map(function(e){return{nodes:e[0],state:e[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?(D._navigator.stateService.setNodes([e.nodes.background]),D._navigator.stateService.setNodes([e.nodes.foreground])):D._navigator.stateService.prependNodes([e.nodes.background]):D._navigator.stateService.setNodes([e.nodes.foreground]))},function(e){console.error(e)});this._navigator.stateService.currentState$.pipe(d.map(function(e){return e.state.previousNode}),d.filter(function(e){return null!=e}),d.distinctUntilChanged(void 0,function(e){return e.key}));var o=this._navigator.stateService.currentState$.pipe(d.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}),d.withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$),d.map(function(e){var t=e[0],r=e[1],n=e[2],i=t.state,o=Math.max(n.width,n.height),s=i.currentNode,a=i.currentTransform,c=2048<o?2048:1024<o?1024:512;return new y.TextureProvider(s.key,a.basicWidth,a.basicHeight,c,s.image,D._imageTileLoader,new y.ImageTileStore,r)}),d.publishReplay(1),d.refCount());this._textureProviderSubscription=o.subscribe(function(){}),this._setTextureProviderSubscription=o.pipe(d.map(function(t){return function(e){return e.setTextureProvider(t.key,t),e}})).subscribe(this._glRendererOperation$),this._setTileSizeSubscription=this._container.renderService.size$.pipe(d.switchMap(function(e){return f.combineLatest(o,f.of(e)).pipe(d.first())})).subscribe(function(e){var t=e[0],r=e[1],n=Math.max(r.width,r.height),i=2048<n?2048:1024<n?1024:512;t.setTileSize(i)}),this._abortTextureProviderSubscription=o.pipe(d.pairwise()).subscribe(function(e){e[0].abort()});var s=f.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.pipe(d.debounceTime(250))).pipe(d.map(function(e){var t=e[0],r=e[1];return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf(),r.height.valueOf(),r.width.valueOf()]}),d.pairwise(),d.skipWhile(function(e){return e[1][2]-e[0][2]<0||0===e[1][2]}),d.map(function(e){var t=e[0][0].equals(e[1][0]),r=e[0][1].equals(e[1][1]),n=e[0][2]===e[1][2],i=e[0][3]===e[1][3],o=e[0][4]===e[1][4];return t&&r&&n&&i&&o}),d.distinctUntilChanged(),d.filter(function(e){return e}),d.switchMap(function(e){return D._container.renderService.renderCameraFrame$.pipe(d.first())}),d.withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$));this._setRegionOfInterestSubscription=o.pipe(d.switchMap(function(i){return s.pipe(d.map(function(e){var t=e[0],r=e[1],n=e[2];return[D._roiCalculator.computeRegionOfInterest(t,r,n),i]}))}),d.filter(function(e){return!e[1].disposed})).subscribe(function(e){var t=e[0];e[1].setRegionOfInterest(t)});var a=o.pipe(d.switchMap(function(e){return e.hasTexture$}),d.startWith(!1),d.publishReplay(1),d.refCount());this._hasTextureSubscription=a.subscribe(function(){});var c=this._navigator.stateService.currentState$.pipe(d.filter(function(e){return 0===e.state.nodesAhead}),d.map(function(e){return e.state.currentNode}),d.distinctUntilChanged(void 0,function(e){return e.key}),d.debounceTime(1e3),d.withLatestFrom(a),d.filter(function(e){return!e[1]}),d.map(function(e){return e[0]}),d.filter(function(e){return e.pano?_.Settings.maxImageSize>_.Settings.basePanoramaSize:_.Settings.maxImageSize>_.Settings.baseImageSize}),d.switchMap(function(r){var e=r.pano?_.Settings.basePanoramaSize:_.Settings.baseImageSize;return Math.max(r.image.width,r.image.height)>e?f.empty():r.cacheImage$(_.Settings.maxImageSize).pipe(d.map(function(e){return[e.image,e]})).pipe(d.takeUntil(a.pipe(d.filter(function(e){return e}))),d.catchError(function(e,t){return console.error("Failed to fetch high res image ("+r.key+")",e),f.empty()}))})).pipe(d.publish(),d.refCount());this._updateBackgroundSubscription=c.pipe(d.withLatestFrom(o)).subscribe(function(e){e[0][1].key!==e[1].key||e[1].disposed||e[1].updateBackground(e[0][0])}),this._updateTextureImageSubscription=c.pipe(d.map(function(t){return function(e){return e.updateTextureImage(t[0],t[1]),e}})).subscribe(this._glRendererOperation$);var u=this._navigator.stateService.currentState$.pipe(d.filter(function(e){return!!e.state.previousNode}),d.distinctUntilChanged(void 0,function(e){return e.state.previousNode.key}),d.withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$),d.map(function(e){var t=e[0],r=e[1],n=e[2],i=t.state,o=Math.max(n.width,n.height),s=i.previousNode,a=i.previousTransform,c=2048<o?2048:1024<o?1024:512;return new y.TextureProvider(s.key,a.basicWidth,a.basicHeight,c,s.image,D._imageTileLoader,new y.ImageTileStore,r)}),d.publishReplay(1),d.refCount());this._textureProviderSubscriptionPrev=u.subscribe(function(){}),this._setTextureProviderSubscriptionPrev=u.pipe(d.map(function(t){return function(e){return e.setTextureProviderPrev(t.key,t),e}})).subscribe(this._glRendererOperation$),this._setTileSizeSubscriptionPrev=this._container.renderService.size$.pipe(d.switchMap(function(e){return f.combineLatest(u,f.of(e)).pipe(d.first())})).subscribe(function(e){var t=e[0],r=e[1],n=Math.max(r.width,r.height),i=2048<n?2048:1024<n?1024:512;t.setTileSize(i)}),this._abortTextureProviderSubscriptionPrev=u.pipe(d.pairwise()).subscribe(function(e){e[0].abort()});var h=f.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.pipe(d.debounceTime(250))).pipe(d.map(function(e){var t=e[0],r=e[1];return[t.camera.position.clone(),t.camera.lookat.clone(),t.zoom.valueOf(),r.height.valueOf(),r.width.valueOf()]}),d.pairwise(),d.skipWhile(function(e){return e[1][2]-e[0][2]<0||0===e[1][2]}),d.map(function(e){var t=e[0][0].equals(e[1][0]),r=e[0][1].equals(e[1][1]),n=e[0][2]===e[1][2],i=e[0][3]===e[1][3],o=e[0][4]===e[1][4];return t&&r&&n&&i&&o}),d.distinctUntilChanged(),d.filter(function(e){return e}),d.switchMap(function(e){return D._container.renderService.renderCameraFrame$.pipe(d.first())}),d.withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$));this._setRegionOfInterestSubscriptionPrev=u.pipe(d.switchMap(function(i){return h.pipe(d.map(function(e){var t=e[0],r=e[1],n=e[2];return[D._roiCalculator.computeRegionOfInterest(t,r,n),i]}))}),d.filter(function(e){return!e[1].disposed}),d.withLatestFrom(this._navigator.stateService.currentState$)).subscribe(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=null;if(i.state.previousNode.fullPano)if(i.state.currentNode.fullPano){var s=D._spatial.viewingDirection(i.state.currentNode.rotation),a=D._spatial.viewingDirection(i.state.previousNode.rotation),c=D._spatial.angleBetweenVector2(s.x,s.y,a.x,a.y)/(2*Math.PI);o={bbox:I={maxX:D._spatial.wrap(r.bbox.maxX+c,0,1),maxY:r.bbox.maxY,minX:D._spatial.wrap(r.bbox.minX+c,0,1),minY:r.bbox.minY},pixelHeight:r.pixelHeight,pixelWidth:r.pixelWidth}}else{s=D._spatial.viewingDirection(i.state.currentNode.rotation),a=D._spatial.viewingDirection(i.state.previousNode.rotation);var u=D._spatial.angleBetweenVector2(s.x,s.y,a.x,a.y)/(2*Math.PI),h=D._spatial.angleToPlane(s.toArray(),[0,0,1]),l=(D._spatial.angleToPlane(a.toArray(),[0,0,1])-h)/(2*Math.PI),p=i.state.currentTransform,f=Math.max(p.basicWidth,p.basicHeight),d=0<f?2*Math.atan(.5*p.basicWidth/(f*p.focal)):Math.PI/3,m=0<f?2*Math.atan(.5*p.basicHeight/(f*p.focal)):Math.PI/3,v=d/(2*Math.PI),g=m/Math.PI,y=(r.bbox.maxX-r.bbox.minX)*v,_=(r.bbox.maxY-r.bbox.minY)*g,b=r.pixelWidth*v,x=r.pixelHeight*g,w=(r.bbox.minX+r.bbox.maxX)/2-.5,S=(r.bbox.minY+r.bbox.maxY)/2-.5,M=.5+u+v*w-y/2,C=.5+u+v*w+y/2,E=.5+l+g*S-_/2,T=.5+l+g*S+_/2;o={bbox:I={maxX:D._spatial.wrap(C,0,1),maxY:T,minX:D._spatial.wrap(M,0,1),minY:E},pixelHeight:x,pixelWidth:b}}else{var O=i.state.currentTransform.basicAspect,P=i.state.previousTransform.basicAspect,A=D._getBasicCorners(O,P),j=A[0],R=j[0],L=j[1],N=A[1],I=(y=N[0]-R,_=N[1]-L,b=r.pixelWidth/y,x=r.pixelHeight/_,M=(y-1)/(2*y)+r.bbox.minX/y,C=(y-1)/(2*y)+r.bbox.maxX/y,E=(_-1)/(2*_)+r.bbox.minY/_,{maxX:C,maxY:T=(_-1)/(2*_)+r.bbox.maxY/_,minX:M,minY:E});D._clipBoundingBox(I),o={bbox:I,pixelHeight:x,pixelWidth:b}}n.setRegionOfInterest(o)});var l=u.pipe(d.switchMap(function(e){return e.hasTexture$}),d.startWith(!1),d.publishReplay(1),d.refCount());this._hasTextureSubscriptionPrev=l.subscribe(function(){});var p=this._navigator.stateService.currentState$.pipe(d.filter(function(e){return 0===e.state.nodesAhead&&!!e.state.previousNode}),d.map(function(e){return e.state.previousNode}),d.distinctUntilChanged(void 0,function(e){return e.key}),d.debounceTime(1e3),d.withLatestFrom(l),d.filter(function(e){return!e[1]}),d.map(function(e){return e[0]}),d.filter(function(e){return e.pano?_.Settings.maxImageSize>_.Settings.basePanoramaSize:_.Settings.maxImageSize>_.Settings.baseImageSize}),d.switchMap(function(r){var e=r.pano?_.Settings.basePanoramaSize:_.Settings.baseImageSize;return Math.max(r.image.width,r.image.height)>e?f.empty():r.cacheImage$(_.Settings.maxImageSize).pipe(d.map(function(e){return[e.image,e]})).pipe(d.takeUntil(l.pipe(d.filter(function(e){return e}))),d.catchError(function(e,t){return console.error("Failed to fetch high res image ("+r.key+")",e),f.empty()}))})).pipe(d.publish(),d.refCount());this._updateBackgroundSubscriptionPrev=p.pipe(d.withLatestFrom(u)).subscribe(function(e){e[0][1].key!==e[1].key||e[1].disposed||e[1].updateBackground(e[0][0])}),this._updateTextureImageSubscriptionPrev=p.pipe(d.map(function(t){return function(e){return e.updateTextureImage(t[0],t[1]),e}})).subscribe(this._glRendererOperation$)},e.prototype._deactivate=function(){var t=this;this._waitSubscription.unsubscribe(),this._navigator.stateService.state$.pipe(d.first()).subscribe(function(e){e!==v.State.Traversing&&t._navigator.stateService.traverse()}),this._glRendererDisposer$.next(null),this._domRenderer.deactivate(),this._modeSubcription.unsubscribe(),this._setKeysSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._moveSubscription.unsubscribe(),this._updateCurtainSubscription.unsubscribe(),this._textureProviderSubscription.unsubscribe(),this._setTextureProviderSubscription.unsubscribe(),this._setTileSizeSubscription.unsubscribe(),this._abortTextureProviderSubscription.unsubscribe(),this._setRegionOfInterestSubscription.unsubscribe(),this._hasTextureSubscription.unsubscribe(),this._updateBackgroundSubscription.unsubscribe(),this._updateTextureImageSubscription.unsubscribe(),this._textureProviderSubscriptionPrev.unsubscribe(),this._setTextureProviderSubscriptionPrev.unsubscribe(),this._setTileSizeSubscriptionPrev.unsubscribe(),this._abortTextureProviderSubscriptionPrev.unsubscribe(),this._setRegionOfInterestSubscriptionPrev.unsubscribe(),this._hasTextureSubscriptionPrev.unsubscribe(),this._updateBackgroundSubscriptionPrev.unsubscribe(),this._updateTextureImageSubscriptionPrev.unsubscribe(),this.configure({keys:null})},e.prototype._getDefaultConfiguration=function(){return{initialPosition:1,mode:m.SliderMode.Motion,sliderVisible:!0}},e.prototype._catchCacheNode$=function(r){return this._navigator.graphService.cacheNode$(r).pipe(d.catchError(function(e,t){return console.error("Failed to cache slider node ("+r+")",e),f.empty()}))},e.prototype._getBasicCorners=function(e,t){var r,n;return n=t<e?(r=.5)*e/t:(r=.5*t/e,.5),[[.5-r,.5-n],[.5+r,.5+n]]},e.prototype._clipBoundingBox=function(e){e.minX=Math.max(0,Math.min(1,e.minX)),e.maxX=Math.max(0,Math.min(1,e.maxX)),e.minY=Math.max(0,Math.min(1,e.minY)),e.maxY=Math.max(0,Math.min(1,e.maxY))},e.componentName="slider",e}(m.Component);r.SliderComponent=o,m.ComponentService.register(o),r.default=o},{"../../Component":274,"../../Geo":277,"../../Render":280,"../../State":281,"../../Tiles":283,"../../Utils":284,rxjs:26,"rxjs/operators":224}],337:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=e("rxjs/operators"),u=e("virtual-dom"),o=e("../../Component"),s=function(){function e(e){this._container=e,this._interacting=!1,this._notifyModeChanged$=new n.Subject,this._notifyPositionChanged$=new n.Subject,this._stopInteractionSubscription=null}return Object.defineProperty(e.prototype,"mode$",{get:function(){return this._notifyModeChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"position$",{get:function(){return this._notifyPositionChanged$},enumerable:!0,configurable:!0}),e.prototype.activate=function(){var t=this;this._stopInteractionSubscription||(this._stopInteractionSubscription=n.merge(this._container.mouseService.documentMouseUp$,this._container.touchService.touchEnd$.pipe(i.filter(function(e){return 0===e.touches.length}))).subscribe(function(e){t._interacting&&(t._interacting=!1)}))},e.prototype.deactivate=function(){this._stopInteractionSubscription&&(this._interacting=!1,this._stopInteractionSubscription.unsubscribe(),this._stopInteractionSubscription=null)},e.prototype.render=function(e,t,r,n,i){var o=[];if(i){o.push(u.h("div.SliderBorder",[]));var s=!(r||n);s&&o.push(this._createModeButton(t)),o.push(this._createPositionInput(e,s))}var a=this._container.domContainer.getBoundingClientRect(),c=Math.max(215,Math.min(400,a.width-100));return u.h("div.SliderContainer",{style:{width:c+"px"}},o)},e.prototype._createModeButton=function(e){var t=this,r={onclick:function(){t._notifyModeChanged$.next(e===o.SliderMode.Motion?o.SliderMode.Stationary:o.SliderMode.Motion)}},n=e===o.SliderMode.Stationary?"SliderModeButtonPressed":"SliderModeButton";return u.h("div."+n,r,[u.h("div.SliderModeIcon",[])])},e.prototype._createPositionInput=function(e,t){var r=this,n=function(e){r._notifyPositionChanged$.next(Number(e.target.value)/1e3)},i=function(e){r._interacting=!0,e.stopPropagation()},o=function(e){r._interacting&&e.stopPropagation()},s=this._container.domContainer.getBoundingClientRect(),a=Math.max(215,Math.min(400,s.width-105))-68+(t?0:36),c=u.h("input.SliderPosition",{max:1e3,min:0,onchange:n,oninput:n,onkeydown:function(e){"ArrowDown"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"ArrowUp"!==e.key||e.preventDefault()},onmousedown:i,onmousemove:o,ontouchmove:o,ontouchstart:i,style:{width:a+"px"},type:"range",value:1e3*e},[]);return u.h("div.SliderPositionContainer",[c])},e}();r.SliderDOMRenderer=s,r.default=s},{"../../Component":274,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],338:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var C=e("../../Component"),E=e("../../Geo"),n=function(){function e(){this._factory=new C.MeshFactory,this._scene=new C.MeshScene,this._spatial=new E.Spatial,this._currentKey=null,this._previousKey=null,this._disabled=!1,this._curtain=1,this._frameId=0,this._needsRender=!1,this._mode=null,this._currentProviderDisposers={},this._previousProviderDisposers={}}return Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.setTextureProvider=function(e,t){this._setTextureProvider(e,this._currentKey,t,this._currentProviderDisposers,this._updateTexture.bind(this))},e.prototype.setTextureProviderPrev=function(e,t){this._setTextureProvider(e,this._previousKey,t,this._previousProviderDisposers,this._updateTexturePrev.bind(this))},e.prototype.update=function(e,t){this._updateFrameId(e.id),this._updateImagePlanes(e.state,t)},e.prototype.updateCurtain=function(e){this._curtain!==e&&(this._curtain=e,this._updateCurtain(),this._needsRender=!0)},e.prototype.updateTexture=function(e,t){var r=t.key===this._currentKey?this._scene.imagePlanes:t.key===this._previousKey?this._scene.imagePlanesOld:[];if(0!==r.length){this._needsRender=!0;for(var n=0,i=r;n<i.length;n++){var o=i[n].material.uniforms.projectorTex.value;o.image=e,o.needsUpdate=!0}}},e.prototype.updateTextureImage=function(e,t){if(this._currentKey===t.key){this._needsRender=!0;for(var r=0,n=this._scene.imagePlanes;r<n.length;r++){var i=n[r].material.uniforms.projectorTex.value;i.image=e,i.needsUpdate=!0}}},e.prototype.render=function(e,t){this.disabled||t.render(this._scene.sceneOld,e),t.render(this._scene.scene,e),this._needsRender=!1},e.prototype.dispose=function(){for(var e in this._scene.clear(),this._currentProviderDisposers)this._currentProviderDisposers.hasOwnProperty(e)&&this._currentProviderDisposers[e]();for(var e in this._previousProviderDisposers)this._previousProviderDisposers.hasOwnProperty(e)&&this._previousProviderDisposers[e]();this._currentProviderDisposers={},this._previousProviderDisposers={}},e.prototype._getBasicCorners=function(e,t){var r,n;return n=t<e?(r=.5)*e/t:(r=.5*t/e,.5),[[.5-r,.5-n],[.5+r,.5+n]]},e.prototype._setDisabled=function(e){this._disabled=null==e.currentNode||null==e.previousNode||e.currentNode.pano&&!e.currentNode.fullPano||e.previousNode.pano&&!e.previousNode.fullPano||e.currentNode.fullPano&&!e.previousNode.fullPano},e.prototype._setTextureProvider=function(e,t,r,n,i){var o=this;if(e===t){var s=r.textureCreated$.subscribe(i),a=r.textureUpdated$.subscribe(function(e){o._needsRender=!0});if(e in n)(0,n[e])(),delete n[e];n[e]=function(){s.unsubscribe(),a.unsubscribe(),r.dispose()}}},e.prototype._updateCurtain=function(){for(var e=0,t=this._scene.imagePlanes;e<t.length;e++){var r=t[e].material;r.uniforms.curtain&&(r.uniforms.curtain.value=this._curtain)}},e.prototype._updateFrameId=function(e){this._frameId=e},e.prototype._updateImagePlanes=function(e,t){var r=null!=e.currentNode&&this._currentKey!==e.currentNode.key,n=null!=e.previousNode&&this._previousKey!==e.previousNode.key,i=this._mode!==t;if(r||n||i){this._setDisabled(e),this._needsRender=!0,this._mode=t;var o=e.motionless||t===C.SliderMode.Stationary||e.currentNode.pano;if((this.disabled||n)&&this._previousKey in this._previousProviderDisposers&&(this._previousProviderDisposers[this._previousKey](),delete this._previousProviderDisposers[this._previousKey]),this.disabled)this._scene.setImagePlanesOld([]);else if(n||i){var s=e.previousNode;this._previousKey=s.key;var a=e.currentTransform.rt.elements,c=[a[12],a[13],a[14]],u=e.currentTransform.basicAspect,h=e.previousTransform.basicAspect,l=h<u?[1,h/u]:[u/h,1],p=e.currentNode.rotation,f=e.currentNode.width,d=e.currentNode.height;s.fullPano&&(p=e.previousNode.rotation,c=this._spatial.rotate(this._spatial.opticalCenter(e.currentNode.rotation,c).toArray(),p).multiplyScalar(-1).toArray(),f=e.previousNode.width,d=e.previousNode.height);var m=new E.Transform(e.currentNode.orientation,f,d,e.currentNode.focal,e.currentNode.scale,s.gpano,p,c,s.image,l),v=void 0;if(s.fullPano)v=this._factory.createMesh(s,o||e.currentNode.fullPano?m:e.previousTransform);else if(o){var g=this._getBasicCorners(u,h),y=g[0],_=y[0],b=y[1],x=g[1],w=x[0],S=x[1];v=this._factory.createFlatMesh(e.previousNode,m,_,w,b,S)}else v=this._factory.createMesh(e.previousNode,e.previousTransform);this._scene.setImagePlanesOld([v])}if(r||i){this._currentKey in this._currentProviderDisposers&&(this._currentProviderDisposers[this._currentKey](),delete this._currentProviderDisposers[this._currentKey]),this._currentKey=e.currentNode.key;var M=[];e.currentNode.fullPano?M.push(this._factory.createCurtainMesh(e.currentNode,e.currentTransform)):e.currentNode.pano&&!e.currentNode.fullPano?M.push(this._factory.createMesh(e.currentNode,e.currentTransform)):o?M.push(this._factory.createDistortedCurtainMesh(e.currentNode,e.currentTransform)):M.push(this._factory.createCurtainMesh(e.currentNode,e.currentTransform)),this._scene.setImagePlanes(M),this._updateCurtain()}}},e.prototype._updateTexture=function(e){this._needsRender=!0;for(var t=0,r=this._scene.imagePlanes;t<r.length;t++){var n=r[t].material,i=n.uniforms.projectorTex.value;n.uniforms.projectorTex.value=null,i.dispose(),n.uniforms.projectorTex.value=e}},e.prototype._updateTexturePrev=function(e){this._needsRender=!0;for(var t=0,r=this._scene.imagePlanesOld;t<r.length;t++){var n=r[t].material,i=n.uniforms.projectorTex.value;n.uniforms.projectorTex.value=null,i.dispose(),n.uniforms.projectorTex.value=e}},e}();r.SliderGLRenderer=n,r.default=n},{"../../Component":274,"../../Geo":277}],339:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("latlon-geohash"),a=e("rxjs"),c=e("rxjs/operators"),u=e("../../Error"),i=e("../../Utils"),n=function(){function e(e){this._graphService=e,this._tiles={},this._cacheRequests={},this._reconstructions={},this._cachingReconstructions$={},this._cachingTiles$={}}return e.prototype.cacheReconstructions$=function(r){var n=this;if(!(r in this._tiles))throw new Error("Cannot cache reconstructions of a non-existing tile.");if(this.hasReconstructions(r))throw new Error("Cannot cache reconstructions that already exists.");if(r in this._cachingReconstructions$)return this._cachingReconstructions$[r];var e=[];if(r in this._reconstructions)for(var t=this.getReconstructions(r).map(function(e){return e.data.key}),i=0,o=this.getTile(r);i<o.length;i++){var s=o[i];-1===t.indexOf(s.key)&&e.push(s)}else e.push.apply(e,this.getTile(r)),this._reconstructions[r]=[];return this._cacheRequests[r]=[],this._cachingReconstructions$[r]=a.from(e).pipe(c.mergeMap(function(t){return n._cacheRequests[r]?a.zip(a.of(t),n._getAtomicReconstruction(t.key,n._cacheRequests[r])).pipe(c.catchError(function(e){return e instanceof u.AbortMapillaryError?a.empty():(console.error(e),a.of([t,null]))})):a.empty()},6),c.map(function(e){return{data:e[0],reconstruction:e[1]}}),c.filter(function(){return r in n._reconstructions}),c.tap(function(e){n._reconstructions[r].push(e)}),c.filter(function(e){return!!e.reconstruction}),c.finalize(function(){r in n._cachingReconstructions$&&delete n._cachingReconstructions$[r],r in n._cacheRequests&&delete n._cacheRequests[r]}),c.publish(),c.refCount()),this._cachingReconstructions$[r]},e.prototype.cacheTile$=function(r){var n=this;if(8!==r.length)throw new Error("Hash needs to be level 8.");if(this.hasTile(r))throw new Error("Cannot cache tile that already exists.");if(r in this._cachingTiles$)return this._cachingTiles$[r];var e=o.bounds(r),t={lat:e.sw.lat,lon:e.sw.lon},i={lat:e.ne.lat,lon:e.ne.lon};return this._tiles[r]=[],this._cachingTiles$[r]=this._graphService.cacheBoundingBox$(t,i).pipe(c.catchError(function(){return delete n._tiles[r],a.empty()}),c.map(function(e){return e.map(function(e){return n._createNodeData(e)})}),c.filter(function(){return r in n._tiles}),c.tap(function(e){var t;(t=n._tiles[r]).push.apply(t,e),delete n._cachingTiles$[r]}),c.finalize(function(){r in n._cachingTiles$&&delete n._cachingTiles$[r]}),c.publish(),c.refCount()),this._cachingTiles$[r]},e.prototype.isCachingReconstructions=function(e){return e in this._cachingReconstructions$},e.prototype.isCachingTile=function(e){return e in this._cachingTiles$},e.prototype.hasReconstructions=function(e){return!(e in this._cachingReconstructions$)&&e in this._reconstructions&&this._reconstructions[e].length===this._tiles[e].length},e.prototype.hasTile=function(e){return!(e in this._cachingTiles$)&&e in this._tiles},e.prototype.getReconstructions=function(e){return e in this._reconstructions?this._reconstructions[e].filter(function(e){return!!e.reconstruction}):[]},e.prototype.getTile=function(e){return e in this._tiles?this._tiles[e]:[]},e.prototype.uncache=function(e){for(var t=0,r=Object.keys(this._cacheRequests);t<r.length;t++){var n=r[t];if(!e||-1===e.indexOf(n)){for(var i=0,o=this._cacheRequests[n];i<o.length;i++){o[i].abort()}delete this._cacheRequests[n]}}for(var s=0,a=Object.keys(this._reconstructions);s<a.length;s++){n=a[s];e&&-1!==e.indexOf(n)||delete this._reconstructions[n]}for(var c=0,u=Object.keys(this._tiles);c<u.length;c++){n=u[c];e&&-1!==e.indexOf(n)||delete this._tiles[n]}},e.prototype._createNodeData=function(e){return{alt:e.alt,focal:e.focal,gpano:e.gpano,height:e.height,k1:e.ck1,k2:e.ck2,key:e.key,lat:e.latLon.lat,lon:e.latLon.lon,mergeCC:e.mergeCC,orientation:e.orientation,originalLat:e.originalLatLon.lat,originalLon:e.originalLatLon.lon,rotation:[e.rotation[0],e.rotation[1],e.rotation[2]],scale:e.scale,width:e.width}},e.prototype._getAtomicReconstruction=function(r,n){return a.Observable.create(function(e){var t=new XMLHttpRequest;t.open("GET",i.Urls.atomicReconstruction(r),!0),t.responseType="json",t.timeout=15e3,t.onload=function(){t.response?(e.next(t.response),e.complete()):e.error(new Error("Atomic reconstruction does not exist ("+r+")"))},t.onerror=function(){e.error(new Error("Failed to get atomic reconstruction ("+r+")"))},t.ontimeout=function(){e.error(new Error("Atomic reconstruction request timed out ("+r+")"))},t.onabort=function(){e.error(new u.AbortMapillaryError("Atomic reconstruction request was aborted ("+r+")"))},n.push(t),t.send(null)})},e}();r.SpatialDataCache=n,r.default=n},{"../../Error":276,"../../Utils":284,"latlon-geohash":21,rxjs:26,"rxjs/operators":224}],340:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var d=e("latlon-geohash"),h=e("rxjs"),l=e("rxjs/operators"),s=e("../../Component"),a=e("../../Geo"),c=e("../../Render"),p=e("../../viewer/PlayService"),f=e("../../state/State"),i=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n._cache=new s.SpatialDataCache(r.graphService),n._scene=new s.SpatialDataScene(n._getDefaultConfiguration()),n._viewportCoords=new a.ViewportCoords,n._geoCoords=new a.GeoCoords,n}return o(e,i),e.prototype._activate=function(){var u=this,t=this._container.renderService.bearing$.pipe(l.map(function(e){var t="";return(292.5<e||e<=67.5)&&(t+="n"),112.5<e&&e<=247.5&&(t+="s"),22.5<e&&e<=157.5&&(t+="e"),202.5<e&&e<=337.5&&(t+="w"),t}),l.distinctUntilChanged(),l.publishReplay(1),l.refCount()),r=this._navigator.stateService.reference$.pipe(l.tap(function(){u._scene.uncache()}),l.switchMap(function(){return u._navigator.stateService.currentNode$.pipe(l.map(function(e){return d.encode(e.latLon.lat,e.latLon.lon,8)}),l.distinctUntilChanged())}),l.publishReplay(1),l.refCount()),n=h.combineLatest(this._navigator.playService.playing$,this._navigator.playService.speed$).pipe(l.map(function(e){var t=e[0],r=e[1];return t&&r>p.default.sequenceSpeed}),l.distinctUntilChanged(),l.publishReplay(1),l.refCount());this._addSubscription=this._navigator.stateService.state$.pipe(l.map(function(e){return e===f.default.Earth}),l.distinctUntilChanged(),l.switchMap(function(e){return e?h.combineLatest(r,n).pipe(l.mergeMap(function(e){var t=e[0];return e[1]?h.of([t]):h.of(u._adjacentComponent(t,4))})):h.combineLatest(r,n,t).pipe(l.mergeMap(function(e){var t=e[0],r=e[1],n=e[2];return r?h.of([t,d.neighbours(t)[n]]):h.of(u._computeTiles(t,n))}))}),l.switchMap(function(e){return h.from(e).pipe(l.mergeMap(function(e){var t;return t=u._cache.hasTile(e)?h.of(u._cache.getTile(e)):u._cache.isCachingTile(e)?u._cache.cacheTile$(e).pipe(l.last(null,{}),l.switchMap(function(){return h.of(u._cache.getTile(e))})):u._cache.cacheTile$(e),h.combineLatest(h.of(e),t)},1),l.map(function(e){return e[0]}))}),l.concatMap(function(e){var t;return t=u._cache.hasReconstructions(e)?h.from(u._cache.getReconstructions(e)):u._cache.isCachingReconstructions(e)?u._cache.cacheReconstructions$(e).pipe(l.last(null,{}),l.switchMap(function(){return h.from(u._cache.getReconstructions(e))})):u._cache.hasTile(e)?u._cache.cacheReconstructions$(e):h.empty(),h.combineLatest(h.of(e),t)}),l.withLatestFrom(this._navigator.stateService.reference$),l.tap(function(e){var t=e[0][0],r=e[1];u._scene.hasTile(t)||u._scene.addTile(u._computeTileBBox(t,r),t)}),l.filter(function(e){var t=e[0],r=t[0],n=t[1];return!u._scene.hasReconstruction(n.reconstruction.main_shot,r)}),l.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return[n,u._createTransform(n.data,i),u._computeOriginalPosition(n.data,i),r]})).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];u._scene.addReconstruction(t.reconstruction,r,n,t.data.mergeCC?t.data.mergeCC.toString():"",i)}),this._cameraVisibilitySubscription=this._configuration$.pipe(l.map(function(e){return e.camerasVisible}),l.distinctUntilChanged()).subscribe(function(e){u._scene.setCameraVisibility(e)}),this._pointVisibilitySubscription=this._configuration$.pipe(l.map(function(e){return e.pointsVisible}),l.distinctUntilChanged()).subscribe(function(e){u._scene.setPointVisibility(e)}),this._positionVisibilitySubscription=this._configuration$.pipe(l.map(function(e){return e.positionsVisible}),l.distinctUntilChanged()).subscribe(function(e){u._scene.setPositionVisibility(e)}),this._tileVisibilitySubscription=this._configuration$.pipe(l.map(function(e){return e.tilesVisible}),l.distinctUntilChanged()).subscribe(function(e){u._scene.setTileVisibility(e)}),this._visualizeConnectedComponentSubscription=this._configuration$.pipe(l.map(function(e){return e.connectedComponents}),l.distinctUntilChanged()).subscribe(function(e){u._scene.setConnectedComponentVisualization(e)}),this._uncacheSubscription=r.subscribe(function(e){var t=u._adjacentComponent(e,4);u._scene.uncache(t),u._cache.uncache(t)}),this._moveSubscription=this._navigator.playService.playing$.pipe(l.switchMap(function(e){return e?h.empty():u._container.mouseService.dblClick$}),l.withLatestFrom(this._container.renderService.renderCamera$),l.switchMap(function(e){var t=e[0],r=e[1],n=u._container.element,i=u._viewportCoords.canvasPosition(t,n),o=i[0],s=i[1],a=u._viewportCoords.canvasToViewport(o,s,n),c=u._scene.intersectObjects(a,r.perspective);return c?u._navigator.moveToKey$(c).pipe(l.catchError(function(){return h.empty()})):h.empty()})).subscribe(),this._renderSubscription=this._navigator.stateService.currentState$.pipe(l.map(function(e){var t=u._scene;return{name:u._name,render:{frameId:e.id,needsRender:t.needsRender,render:t.render.bind(t),stage:c.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$),this._earthControlsSubscription=this._configuration$.pipe(l.map(function(e){return e.earthControls}),l.distinctUntilChanged(),l.withLatestFrom(this._navigator.stateService.state$)).subscribe(function(e){var t=e[0],r=e[1];t&&r!==f.default.Earth?u._navigator.stateService.earth():t||r!==f.default.Earth||u._navigator.stateService.traverse()})},e.prototype._deactivate=function(){var t=this;this._navigator.stateService.state$.pipe(l.first()).subscribe(function(e){e===f.default.Earth&&t._navigator.stateService.traverse()}),this._cache.uncache(),this._scene.uncache(),this._addSubscription.unsubscribe(),this._cameraVisibilitySubscription.unsubscribe(),this._earthControlsSubscription.unsubscribe(),this._moveSubscription.unsubscribe(),this._pointVisibilitySubscription.unsubscribe(),this._positionVisibilitySubscription.unsubscribe(),this._renderSubscription.unsubscribe(),this._tileVisibilitySubscription.unsubscribe(),this._uncacheSubscription.unsubscribe(),this._visualizeConnectedComponentSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{camerasVisible:!1,pointsVisible:!0,positionsVisible:!1,tilesVisible:!1}},e.prototype._adjacentComponent=function(e,t){var r=new Set;return r.add(e),this._adjacentComponentRecursive(r,[e],0,t),this._setToArray(r)},e.prototype._adjacentComponentRecursive=function(e,t,r,n){if(r!==n){for(var i=[],o=0,s=t;o<s.length;o++){var a=s[o],c=d.neighbours(a);for(var u in c)c.hasOwnProperty(u)&&i.push(c[u])}for(var h=[],l=0,p=i;l<p.length;l++){var f=p[l];e.has(f)||(e.add(f),h.push(f))}this._adjacentComponentRecursive(e,h,r+1,n)}},e.prototype._computeOriginalPosition=function(e,t){return this._geoCoords.geodeticToEnu(e.originalLat,e.originalLon,e.alt,t.lat,t.lon,t.alt)},e.prototype._computeTileBBox=function(e,t){var r=d.bounds(e);return[this._geoCoords.geodeticToEnu(r.sw.lat,r.sw.lon,0,t.lat,t.lon,t.alt),this._geoCoords.geodeticToEnu(r.ne.lat,r.ne.lon,0,t.lat,t.lon,t.alt)]},e.prototype._createTransform=function(e,t){var r=a.Geo.computeTranslation({alt:e.alt,lat:e.lat,lon:e.lon},e.rotation,t);return new a.Transform(e.orientation,e.width,e.height,e.focal,e.scale,e.gpano,e.rotation,r,void 0,void 0,e.k1,e.k2)},e.prototype._computeTiles=function(e,t){var r=new Set;return this._computeTilesRecursive(r,e,t,["n","ne","e","se","s","sw","w","nw"],0,2),this._setToArray(r)},e.prototype._computeTilesRecursive=function(e,t,r,n,i,o){if(e.add(t),i!==o)for(var s=d.neighbours(t),a=n.indexOf(r),c=n.length,u=0,h=[s[n[this._modulo(a-1,c)]],s[r],s[n[this._modulo(a+1,c)]]];u<h.length;u++){var l=h[u];this._computeTilesRecursive(e,l,r,n,i+1,o)}},e.prototype._modulo=function(e,t){return(e%t+t)%t},e.prototype._setToArray=function(e){var t=[];return e.forEach(function(e){t.push(e)}),t},e.componentName="spatialData",e}(s.Component);r.SpatialDataComponent=i,s.ComponentService.register(i),r.default=i},{"../../Component":274,"../../Geo":277,"../../Render":280,"../../state/State":411,"../../viewer/PlayService":440,"latlon-geohash":21,rxjs:26,"rxjs/operators":224}],341:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var d=e("three"),n=function(){function e(e,t,r){this._scene=t||new d.Scene,this._raycaster=r||new d.Raycaster(void 0,void 0,.8),this._connectedComponentColors={},this._needsRender=!1,this._interactiveObjects=[],this._reconstructions={},this._tiles={},this._camerasVisible=e.camerasVisible,this._pointsVisible=e.pointsVisible,this._positionsVisible=e.positionsVisible,this._tilesVisible=e.tilesVisible,this._visualizeConnectedComponents=e.connectedComponents}return Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.addReconstruction=function(e,t,r,n,i){i in this._reconstructions||(this._reconstructions[i]={cameraKeys:{},cameras:new d.Object3D,connectedComponents:{},keys:[],points:new d.Object3D,positions:new d.Object3D},this._reconstructions[i].cameras.visible=this._camerasVisible,this._reconstructions[i].points.visible=this._pointsVisible,this._reconstructions[i].positions.visible=this._positionsVisible,this._scene.add(this._reconstructions[i].cameras,this._reconstructions[i].points,this._reconstructions[i].positions)),n in this._reconstructions[i].connectedComponents||(this._reconstructions[i].connectedComponents[n]=[]),t.hasValidScale&&this._reconstructions[i].points.add(this._createPoints(e,t));var o=this._createCamera(t);this._reconstructions[i].cameras.add(o);for(var s=0,a=o.children;s<a.length;s++){var c=a[s];this._reconstructions[i].cameraKeys[c.uuid]=e.main_shot,this._interactiveObjects.push(c)}this._reconstructions[i].connectedComponents[n].push(o);var u=this._getColor(n,this._visualizeConnectedComponents);this._setCameraColor(u,o),this._reconstructions[i].positions.add(this._createPosition(t,r)),this._reconstructions[i].keys.push(e.main_shot),this._needsRender=!0},e.prototype.addTile=function(e,t){if(!this.hasTile(t)){var r=e[0],n=e[1],i=new d.Geometry;i.vertices.push((new d.Vector3).fromArray(r),new d.Vector3(r[0],n[1],(r[2]+n[2])/2),(new d.Vector3).fromArray(n),new d.Vector3(n[0],r[1],(r[2]+n[2])/2),(new d.Vector3).fromArray(r));var o=new d.Line(i,new d.LineBasicMaterial);this._tiles[t]=new d.Object3D,this._tiles[t].visible=this._tilesVisible,this._tiles[t].add(o),this._scene.add(this._tiles[t]),this._needsRender=!0}},e.prototype.uncache=function(e){for(var t=0,r=Object.keys(this._reconstructions);t<r.length;t++){var n=r[t];e&&-1!==e.indexOf(n)||this._disposeReconstruction(n)}for(var i=0,o=Object.keys(this._tiles);i<o.length;i++){n=o[i];e&&-1!==e.indexOf(n)||this._disposeTile(n)}this._needsRender=!0},e.prototype.hasReconstruction=function(e,t){return t in this._reconstructions&&-1!==this._reconstructions[t].keys.indexOf(e)},e.prototype.hasTile=function(e){return e in this._tiles},e.prototype.intersectObjects=function(e,t){var r=e[0],n=e[1];if(!this._camerasVisible)return null;this._raycaster.setFromCamera(new d.Vector2(r,n),t);for(var i=0,o=this._raycaster.intersectObjects(this._interactiveObjects);i<o.length;i++){var s=o[i];for(var a in this._reconstructions)if(this._reconstructions.hasOwnProperty(a)&&s.object.uuid in this._reconstructions[a].cameraKeys)return this._reconstructions[a].cameraKeys[s.object.uuid]}return null},e.prototype.setCameraVisibility=function(e){if(e!==this._camerasVisible){for(var t in this._reconstructions)this._reconstructions.hasOwnProperty(t)&&(this._reconstructions[t].cameras.visible=e);this._camerasVisible=e,this._needsRender=!0}},e.prototype.setPointVisibility=function(e){if(e!==this._pointsVisible){for(var t in this._reconstructions)this._reconstructions.hasOwnProperty(t)&&(this._reconstructions[t].points.visible=e);this._pointsVisible=e,this._needsRender=!0}},e.prototype.setPositionVisibility=function(e){if(e!==this._positionsVisible){for(var t in this._reconstructions)this._reconstructions.hasOwnProperty(t)&&(this._reconstructions[t].positions.visible=e);this._positionsVisible=e,this._needsRender=!0}},e.prototype.setTileVisibility=function(e){if(e!==this._tilesVisible){for(var t in this._tiles)this._tiles.hasOwnProperty(t)&&(this._tiles[t].visible=e);this._tilesVisible=e,this._needsRender=!0}},e.prototype.setConnectedComponentVisualization=function(e){if(e!==this._visualizeConnectedComponents){for(var t in this._reconstructions)if(this._reconstructions.hasOwnProperty(t)){var r=this._reconstructions[t].connectedComponents;for(var n in r)if(r.hasOwnProperty(n))for(var i=this._getColor(n,e),o=0,s=r[n];o<s.length;o++){var a=s[o];this._setCameraColor(i,a)}}this._visualizeConnectedComponents=e,this._needsRender=!0}},e.prototype.render=function(e,t){t.render(this._scene,e),this._needsRender=!1},e.prototype._arrayToFloatArray=function(e,t){for(var r=e.length,n=new Float32Array(r*t),i=0;i<r;i++){var o=e[i],s=3*i;n[s+0]=o[0],n[s+1]=o[1],n[s+2]=o[2]}return n},e.prototype._createAxis=function(e){var t=e.unprojectBasic([.5,0],.22),r=e.unprojectBasic([.5,1],.16),n=new d.BufferGeometry;return n.addAttribute("position",new d.BufferAttribute(this._arrayToFloatArray([t,r],3),3)),new d.Line(n,new d.LineBasicMaterial)},e.prototype._createCamera=function(e){return e.gpano?this._createPanoCamera(e):this._createPrespectiveCamera(e)},e.prototype._createDiagonals=function(e,t){var r=e.unprojectBasic([0,0],0,!0),n=[r,e.unprojectBasic([0,0],t,!0),r,e.unprojectBasic([1,0],t,!0),r,e.unprojectBasic([1,1],t,!0),r,e.unprojectBasic([0,1],t,!0)],i=new d.BufferGeometry;return i.addAttribute("position",new d.BufferAttribute(this._arrayToFloatArray(n,3),3)),new d.LineSegments(i,new d.LineBasicMaterial)},e.prototype._createFrame=function(t,r){var e=[];e.push.apply(e,this._subsample([0,1],[0,0],20)),e.push.apply(e,this._subsample([0,0],[1,0],20)),e.push.apply(e,this._subsample([1,0],[1,1],20));var n=e.map(function(e){return t.unprojectBasic(e,r,!0)}),i=new d.BufferGeometry;return i.addAttribute("position",new d.BufferAttribute(this._arrayToFloatArray(n,3),3)),new d.Line(i,new d.LineBasicMaterial)},e.prototype._createLatitude=function(e,t,r){for(var n=new Float32Array(3*(t+1)),i=0;i<=t;i++){var o=r.unprojectBasic([i/t,e],.16),s=3*i;n[s+0]=o[0],n[s+1]=o[1],n[s+2]=o[2]}var a=new d.BufferGeometry;return a.addAttribute("position",new d.BufferAttribute(n,3)),new d.Line(a,new d.LineBasicMaterial)},e.prototype._createLongitude=function(e,t,r){for(var n=new Float32Array(3*(t+1)),i=0;i<=t;i++){var o=r.unprojectBasic([e,i/t],.16),s=3*i;n[s+0]=o[0],n[s+1]=o[1],n[s+2]=o[2]}var a=new d.BufferGeometry;return a.addAttribute("position",new d.BufferAttribute(n,3)),new d.Line(a,new d.LineBasicMaterial)},e.prototype._createPanoCamera=function(e){var t=new d.Object3D;return t.children.push(this._createAxis(e)),t.children.push(this._createLatitude(.5,10,e)),t.children.push(this._createLongitude(0,6,e)),t.children.push(this._createLongitude(.25,6,e)),t.children.push(this._createLongitude(.5,6,e)),t.children.push(this._createLongitude(.75,6,e)),t},e.prototype._createPoints=function(t,e){for(var r=(new d.Matrix4).getInverse(e.srt),n=Object.keys(t.points).map(function(e){return t.points[e]}),i=n.length,o=new Float32Array(3*i),s=new Float32Array(3*i),a=0;a<i;a++){var c=3*a,u=n[a].coordinates,h=new d.Vector3(u[0],u[1],u[2]).applyMatrix4(r);o[c+0]=h.x,o[c+1]=h.y,o[c+2]=h.z;var l=n[a].color;s[c+0]=l[0]/255,s[c+1]=l[1]/255,s[c+2]=l[2]/255}var p=new d.BufferGeometry;p.addAttribute("position",new d.BufferAttribute(o,3)),p.addAttribute("color",new d.BufferAttribute(s,3));var f=new d.PointsMaterial({size:.1,vertexColors:d.VertexColors});return new d.Points(p,f)},e.prototype._createPosition=function(e,t){var r=[t,e.unprojectBasic([0,0],0)],n=new d.BufferGeometry;return n.addAttribute("position",new d.BufferAttribute(this._arrayToFloatArray(r,3),3)),new d.Line(n,new d.LineBasicMaterial({color:new d.Color(1,0,0)}))},e.prototype._createPrespectiveCamera=function(e){var t=new d.Object3D;return t.children.push(this._createDiagonals(e,.2)),t.children.push(this._createFrame(e,.2)),t},e.prototype._disposeCameras=function(e){for(var t=this._reconstructions[e].cameras,r=0,n=t.children.slice();r<n.length;r++){for(var i=n[r],o=0,s=i.children;o<s.length;o++){var a=s[o];a.geometry.dispose(),a.material.dispose();var c=this._interactiveObjects.indexOf(a);-1!==c?this._interactiveObjects.splice(c,1):console.warn("Object does not exist ("+a.id+") for "+e)}t.remove(i)}this._scene.remove(t)},e.prototype._disposePoints=function(e){for(var t=this._reconstructions[e].points,r=0,n=t.children.slice();r<n.length;r++){var i=n[r];i.geometry.dispose(),i.material.dispose(),t.remove(i)}this._scene.remove(t)},e.prototype._disposePositions=function(e){for(var t=this._reconstructions[e].positions,r=0,n=t.children.slice();r<n.length;r++){var i=n[r];i.geometry.dispose(),i.material.dispose(),t.remove(i)}this._scene.remove(t)},e.prototype._disposeReconstruction=function(e){this._disposeCameras(e),this._disposePoints(e),this._disposePositions(e),delete this._reconstructions[e]},e.prototype._disposeTile=function(e){for(var t=this._tiles[e],r=0,n=t.children.slice();r<n.length;r++){var i=n[r];i.geometry.dispose(),i.material.dispose(),t.remove(i)}this._scene.remove(t),delete this._tiles[e]},e.prototype._getColor=function(e,t){return t?this._getConnectedComponentColor(e):"#FFFFFF"},e.prototype._getConnectedComponentColor=function(e){return e in this._connectedComponentColors||(this._connectedComponentColors[e]=this._randomColor()),this._connectedComponentColors[e]},e.prototype._interpolate=function(e,t,r){return e+r*(t-e)},e.prototype._randomColor=function(){return"hsl("+Math.floor(360*Math.random())+", 100%, 65%)"},e.prototype._setCameraColor=function(e,t){for(var r=0,n=t.children;r<n.length;r++){n[r].material.color=new d.Color(e)}},e.prototype._subsample=function(e,t,r){if(r<1)return[e,t];for(var n=[],i=0;i<=r+1;i++){for(var o=[],s=0;s<3;s++)o.push(this._interpolate(e[s],t[s],i/(r+1)));n.push(o)}return n},e}();r.SpatialDataScene=n,r.default=n},{three:225}],342:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./error/GeometryTagError");r.GeometryTagError=n.GeometryTagError;var i=e("./geometry/PointGeometry");r.PointGeometry=i.PointGeometry;var o=e("./geometry/RectGeometry");r.RectGeometry=o.RectGeometry;var s=e("./geometry/PolygonGeometry");r.PolygonGeometry=s.PolygonGeometry;var a=e("./tag/OutlineTag");r.OutlineTag=a.OutlineTag;var c=e("./tag/SpotTag");r.SpotTag=c.SpotTag;var u=e("./tag/TagDomain");r.TagDomain=u.TagDomain;var h=e("./TagComponent");r.TagComponent=h.TagComponent;var l=e("./TagMode");r.TagMode=l.TagMode},{"./TagComponent":343,"./TagMode":346,"./error/GeometryTagError":350,"./geometry/PointGeometry":352,"./geometry/PolygonGeometry":353,"./geometry/RectGeometry":354,"./tag/OutlineTag":366,"./tag/SpotTag":369,"./tag/TagDomain":371}],343:[function(e,t,r){"use strict";var n,s=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var a=e("rxjs"),c=e("rxjs/operators"),u=e("when"),h=e("../../Component"),l=e("../../Geo"),p=e("../../Render"),i=function(i){function o(e,t,r){var n=i.call(this,e,t,r)||this;return n._tagDomRenderer=new h.TagDOMRenderer,n._tagScene=new h.TagScene,n._tagSet=new h.TagSet,n._tagCreator=new h.TagCreator(n,r),n._viewportCoords=new l.ViewportCoords,n._createHandlers={CreatePoint:new h.CreatePointHandler(n,t,r,n._viewportCoords,n._tagCreator),CreatePolygon:new h.CreatePolygonHandler(n,t,r,n._viewportCoords,n._tagCreator),CreateRect:new h.CreateRectHandler(n,t,r,n._viewportCoords,n._tagCreator),CreateRectDrag:new h.CreateRectDragHandler(n,t,r,n._viewportCoords,n._tagCreator),Default:void 0},n._editVertexHandler=new h.EditVertexHandler(n,t,r,n._viewportCoords,n._tagSet),n._renderTags$=n._tagSet.changed$.pipe(c.map(function(e){var t=e.getAll();return t.sort(function(e,t){var r=e.tag.id,n=t.tag.id;return r<n?-1:n<r?1:0}),t}),c.share()),n._tagChanged$=n._renderTags$.pipe(c.switchMap(function(e){return a.from(e).pipe(c.mergeMap(function(e){return a.merge(e.tag.changed$,e.tag.geometryChanged$)}))}),c.share()),n._renderTagGLChanged$=n._renderTags$.pipe(c.switchMap(function(e){return a.from(e).pipe(c.mergeMap(function(e){return e.glObjectsChanged$}))}),c.share()),n._createGeometryChanged$=n._tagCreator.tag$.pipe(c.switchMap(function(e){return null!=e?e.geometryChanged$:a.empty()}),c.share()),n._createGLObjectsChanged$=n._tagCreator.tag$.pipe(c.switchMap(function(e){return null!=e?e.glObjectsChanged$:a.empty()}),c.share()),n._creatingConfiguration$=n._configuration$.pipe(c.distinctUntilChanged(function(e,t){return e.mode===t.mode},function(e){return{createColor:e.createColor,mode:e.mode}}),c.publishReplay(1),c.refCount()),n._creatingConfiguration$.subscribe(function(e){n.fire(o.modechanged,e.mode)}),n}return s(o,i),o.prototype.add=function(r){var n=this;this._activated?this._navigator.stateService.currentTransform$.pipe(c.first()).subscribe(function(e){n._tagSet.add(r,e);var t=r.map(function(e){return n._tagSet.get(e.id)});n._tagScene.add(t)}):this._tagSet.addDeactivated(r)},o.prototype.changeMode=function(e){this.configure({mode:e})},o.prototype.get=function(e){if(this._activated){var t=this._tagSet.get(e);return void 0!==t?t.tag:void 0}return this._tagSet.getDeactivated(e)},o.prototype.getAll=function(){return this.activated?this._tagSet.getAll().map(function(e){return e.tag}):this._tagSet.getAllDeactivated()},o.prototype.getTagIdsAt=function(n){var i=this;return u.promise(function(t,r){i._container.renderService.renderCamera$.pipe(c.first(),c.map(function(e){var t=i._viewportCoords.canvasToViewport(n[0],n[1],i._container.element);return i._tagScene.intersectObjects(t,e.perspective)})).subscribe(function(e){t(e)},function(e){r(e)})})},o.prototype.has=function(e){return this._activated?this._tagSet.has(e):this._tagSet.hasDeactivated(e)},o.prototype.remove=function(e){this._activated?(this._tagSet.remove(e),this._tagScene.remove(e)):this._tagSet.removeDeactivated(e)},o.prototype.removeAll=function(){this._activated?(this._tagSet.removeAll(),this._tagScene.removeAll()):this._tagSet.removeAllDeactivated()},o.prototype._activate=function(){var s=this;this._editVertexHandler.enable();var e=a.from(Object.keys(this._createHandlers)).pipe(c.map(function(e){return s._createHandlers[e]}),c.filter(function(e){return!!e}),c.mergeMap(function(e){return e.geometryCreated$}),c.share());this._fireGeometryCreatedSubscription=e.subscribe(function(e){s.fire(o.geometrycreated,e)}),this._fireCreateGeometryEventSubscription=this._tagCreator.tag$.pipe(c.skipWhile(function(e){return null==e}),c.distinctUntilChanged()).subscribe(function(e){var t=null!=e?o.creategeometrystart:o.creategeometryend;s.fire(t,s)}),this._handlerStopCreateSubscription=e.subscribe(function(){s.changeMode(h.TagMode.Default)}),this._handlerEnablerSubscription=this._creatingConfiguration$.subscribe(function(e){s._disableCreateHandlers();var t=h.TagMode[e.mode],r=s._createHandlers[t];r&&r.enable()}),this._fireTagsChangedSubscription=this._renderTags$.subscribe(function(e){s.fire(o.tagschanged,s)}),this._stopCreateSubscription=this._tagCreator.tag$.pipe(c.switchMap(function(e){return null!=e?e.aborted$.pipe(c.map(function(e){return null})):a.empty()})).subscribe(function(){s.changeMode(h.TagMode.Default)}),this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(e){s._tagScene.hasCreateTag()&&s._tagScene.removeCreateTag(),null!=e&&s._tagScene.addCreateTag(e)}),this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(e){s._tagScene.updateCreateTagObjects(e)}),this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(e){s._tagScene.updateObjects(e)}),this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(e){s._tagScene.update()}),this._domSubscription=a.combineLatest(this._renderTags$.pipe(c.startWith([]),c.tap(function(e){s._container.domRenderer.render$.next({name:s._name,vnode:s._tagDomRenderer.clear()})})),this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.pipe(c.startWith(null)),a.merge(this._tagCreator.tag$,this._createGeometryChanged$).pipe(c.startWith(null))).pipe(c.map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=(e[4],e[5]);return{name:s._name,vnode:s._tagDomRenderer.render(t,o,n,r.perspective,i)}})).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.pipe(c.map(function(e){var t=s._tagScene;return{name:s._name,render:{frameId:e.id,needsRender:t.needsRender,render:t.render.bind(t),stage:p.GLRenderStage.Foreground}}})).subscribe(this._container.glRenderer.render$),this._navigator.stateService.currentTransform$.pipe(c.first()).subscribe(function(e){s._tagSet.activate(e),s._tagScene.add(s._tagSet.getAll())})},o.prototype._deactivate=function(){this._editVertexHandler.disable(),this._disableCreateHandlers(),this._tagScene.clear(),this._tagSet.deactivate(),this._tagCreator.delete$.next(null),this._updateGLObjectsSubscription.unsubscribe(),this._updateTagSceneSubscription.unsubscribe(),this._stopCreateSubscription.unsubscribe(),this._setGLCreateTagSubscription.unsubscribe(),this._createGLObjectsChangedSubscription.unsubscribe(),this._domSubscription.unsubscribe(),this._glSubscription.unsubscribe(),this._fireCreateGeometryEventSubscription.unsubscribe(),this._fireGeometryCreatedSubscription.unsubscribe(),this._fireTagsChangedSubscription.unsubscribe(),this._handlerStopCreateSubscription.unsubscribe(),this._handlerEnablerSubscription.unsubscribe(),this._container.element.classList.remove("component-tag-create")},o.prototype._getDefaultConfiguration=function(){return{createColor:16777215,mode:h.TagMode.Default}},o.prototype._disableCreateHandlers=function(){var e=this._createHandlers;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];r&&r.disable()}},o.componentName="tag",o.creategeometryend="creategeometryend",o.creategeometrystart="creategeometrystart",o.modechanged="modechanged",o.geometrycreated="geometrycreated",o.tagschanged="tagschanged",o}(h.Component);r.TagComponent=i,h.ComponentService.register(i),r.default=i},{"../../Component":274,"../../Geo":277,"../../Render":280,rxjs:26,"rxjs/operators":224,when:271}],344:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/operators"),i=e("rxjs"),o=e("../../Component"),s=function(){function e(e,t){this._component=e,this._navigator=t,this._tagOperation$=new i.Subject,this._createPolygon$=new i.Subject,this._createRect$=new i.Subject,this._delete$=new i.Subject,this._tag$=this._tagOperation$.pipe(n.scan(function(e,t){return t(e)},null),n.share()),this._createRect$.pipe(n.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$),n.map(function(e){var r=e[0],n=e[1],i=e[2];return function(e){var t=new o.RectGeometry([r[0],r[1],r[0],r[1]]);return new o.OutlineCreateTag(t,{color:n.createColor},i)}})).subscribe(this._tagOperation$),this._createPolygon$.pipe(n.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$),n.map(function(e){var r=e[0],n=e[1],i=e[2];return function(e){var t=new o.PolygonGeometry([[r[0],r[1]],[r[0],r[1]],[r[0],r[1]]]);return new o.OutlineCreateTag(t,{color:n.createColor},i)}})).subscribe(this._tagOperation$),this._delete$.pipe(n.map(function(){return function(e){return null}})).subscribe(this._tagOperation$)}return Object.defineProperty(e.prototype,"createRect$",{get:function(){return this._createRect$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"createPolygon$",{get:function(){return this._createPolygon$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delete$",{get:function(){return this._delete$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tag$",{get:function(){return this._tag$},enumerable:!0,configurable:!0}),e}();r.TagCreator=s,r.default=s},{"../../Component":274,rxjs:26,"rxjs/operators":224}],345:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var u=e("virtual-dom"),n=function(){function e(){}return e.prototype.render=function(e,t,r,n,i){for(var o=[],s=0,a=e;s<a.length;s++){var c=a[s];o=o.concat(c.getDOMObjects(r,n,i))}return null!=t&&(o=o.concat(t.getDOMObjects(n,i))),u.h("div.TagContainer",{},o)},e.prototype.clear=function(){return u.h("div",{},[])},e}();r.TagDOMRenderer=n},{"virtual-dom":230}],346:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.TagMode||(r.TagMode={}))[i.Default=0]="Default",i[i.CreatePoint=1]="CreatePoint",i[i.CreatePolygon=2]="CreatePolygon",i[i.CreateRect=3]="CreateRect",i[i.CreateRectDrag=4]="CreateRectDrag",r.default=n},{}],347:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.TagOperation||(r.TagOperation={}))[i.None=0]="None",i[i.Centroid=1]="Centroid",i[i.Vertex=2]="Vertex",r.default=n},{}],348:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var c=e("three"),n=function(){function e(e,t){this._createTag=null,this._needsRender=!1,this._raycaster=t||new c.Raycaster,this._scene=e||new c.Scene,this._objectTags={},this._retrievableObjects=[],this._tags={}}return Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.add=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];n.tag.id in this._tags&&this._remove(n.tag.id),this._add(n)}this._needsRender=!0},e.prototype.addCreateTag=function(e){for(var t=0,r=e.glObjects;t<r.length;t++){var n=r[t];this._scene.add(n)}this._createTag={tag:e,objects:e.glObjects},this._needsRender=!0},e.prototype.clear=function(){for(var e=0,t=Object.keys(this._tags);e<t.length;e++){var r=t[e];this._remove(r)}this._needsRender=!1},e.prototype.get=function(e){return this.has(e)?this._tags[e].tag:void 0},e.prototype.has=function(e){return e in this._tags},e.prototype.hasCreateTag=function(){return null!=this._createTag},e.prototype.intersectObjects=function(e,t){var r=e[0],n=e[1];this._raycaster.setFromCamera(new c.Vector2(r,n),t);for(var i=[],o=0,s=this._raycaster.intersectObjects(this._retrievableObjects);o<s.length;o++){var a=s[o];a.object.uuid in this._objectTags&&i.push(this._objectTags[a.object.uuid])}return i},e.prototype.remove=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];this._remove(n)}this._needsRender=!0},e.prototype.removeAll=function(){for(var e=0,t=Object.keys(this._tags);e<t.length;e++){var r=t[e];this._remove(r)}this._needsRender=!0},e.prototype.removeCreateTag=function(){if(null!=this._createTag){for(var e=0,t=this._createTag.objects;e<t.length;e++){var r=t[e];this._scene.remove(r)}this._createTag.tag.dispose(),this._createTag=null,this._needsRender=!0}},e.prototype.render=function(e,t){t.render(this._scene,e),this._needsRender=!1},e.prototype.update=function(){this._needsRender=!0},e.prototype.updateCreateTagObjects=function(e){if(this._createTag.tag!==e)throw new Error("Create tags do not have the same reference.");for(var t=0,r=this._createTag.objects;t<r.length;t++){var n=r[t];this._scene.remove(n)}for(var i=0,o=e.glObjects;i<o.length;i++){n=o[i];this._scene.add(n)}this._createTag.objects=e.glObjects,this._needsRender=!0},e.prototype.updateObjects=function(e){var t=e.tag.id;if(this._tags[t].tag!==e)throw new Error("Tags do not have the same reference.");var r=this._tags[t];this._removeObjects(r),delete this._tags[t],this._add(e),this._needsRender=!0},e.prototype._add=function(e){var t=e.tag.id,r={tag:e,objects:[],retrievableObjects:[]};this._tags[t]=r;for(var n=0,i=e.getGLObjects();n<i.length;n++){var o=i[n];r.objects.push(o),this._scene.add(o)}for(var s=0,a=e.getRetrievableObjects();s<a.length;s++){var c=a[s];r.retrievableObjects.push(c),this._retrievableObjects.push(c),this._objectTags[c.uuid]=e.tag.id}},e.prototype._remove=function(e){var t=this._tags[e];this._removeObjects(t),t.tag.dispose(),delete this._tags[e]},e.prototype._removeObjects=function(e){for(var t=0,r=e.objects;t<r.length;t++){var n=r[t];this._scene.remove(n)}for(var i=0,o=e.retrievableObjects;i<o.length;i++){var s=o[i],a=this._retrievableObjects.indexOf(s);-1!==a&&this._retrievableObjects.splice(a,1)}},e}();r.TagScene=n,r.default=n},{three:225}],349:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=e("../../Component"),o=function(){function e(){this._active=!1,this._hash={},this._hashDeactivated={},this._notifyChanged$=new n.Subject}return Object.defineProperty(e.prototype,"active",{get:function(){return this._active},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),e.prototype.activate=function(e){if(!this._active){for(var t in this._hashDeactivated)if(this._hashDeactivated.hasOwnProperty(t)){var r=this._hashDeactivated[t];this._add(r,e)}this._hashDeactivated={},this._active=!0,this._notifyChanged$.next(this)}},e.prototype.deactivate=function(){if(this._active){for(var e in this._hash)this._hash.hasOwnProperty(e)&&(this._hashDeactivated[e]=this._hash[e].tag);this._hash={},this._active=!1}},e.prototype.add=function(e,t){this._assertActivationState(!0);for(var r=0,n=e;r<n.length;r++){var i=n[r];this._add(i,t)}this._notifyChanged$.next(this)},e.prototype.addDeactivated=function(e){this._assertActivationState(!1);for(var t=0,r=e;t<r.length;t++){var n=r[t];if(!(n instanceof i.OutlineTag||n instanceof i.SpotTag))throw new Error("Tag type not supported");this._hashDeactivated[n.id]=n}},e.prototype.get=function(e){return this.has(e)?this._hash[e]:void 0},e.prototype.getAll=function(){var t=this._hash;return Object.keys(t).map(function(e){return t[e]})},e.prototype.getAllDeactivated=function(){var t=this._hashDeactivated;return Object.keys(t).map(function(e){return t[e]})},e.prototype.getDeactivated=function(e){return this.hasDeactivated(e)?this._hashDeactivated[e]:void 0},e.prototype.has=function(e){return e in this._hash},e.prototype.hasDeactivated=function(e){return e in this._hashDeactivated},e.prototype.remove=function(e){this._assertActivationState(!0);for(var t=this._hash,r=0,n=e;r<n.length;r++){var i=n[r];i in t&&delete t[i]}this._notifyChanged$.next(this)},e.prototype.removeAll=function(){this._assertActivationState(!0),this._hash={},this._notifyChanged$.next(this)},e.prototype.removeAllDeactivated=function(){this._assertActivationState(!1),this._hashDeactivated={}},e.prototype.removeDeactivated=function(e){this._assertActivationState(!1);for(var t=this._hashDeactivated,r=0,n=e;r<n.length;r++){var i=n[r];i in t&&delete t[i]}},e.prototype._add=function(e,t){if(e instanceof i.OutlineTag)this._hash[e.id]=new i.OutlineRenderTag(e,t);else{if(!(e instanceof i.SpotTag))throw new Error("Tag type not supported");this._hash[e.id]=new i.SpotRenderTag(e,t)}},e.prototype._assertActivationState=function(e){if(e!==this._active)throw new Error("Tag set not in correct state for operation.")},e}();r.TagSet=o,r.default=o},{"../../Component":274,rxjs:26}],350:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../../../Error"),s=function(r){function e(e){var t=r.call(this,null!=e?e:"The provided geometry value is incorrect")||this;return t.name="GeometryTagError",t}return i(e,r),e}(o.MapillaryError);r.GeometryTagError=s,r.default=o.MapillaryError},{"../../../Error":276}],351:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=function(){function e(){this._notifyChanged$=new n.Subject}return Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),e}();r.Geometry=i,r.default=i},{rxjs:26}],352:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../../../Component"),i=function(i){function e(e){var t=i.call(this)||this,r=e[0],n=e[1];if(r<0||1<r||n<0||1<n)throw new s.GeometryTagError("Basic coordinates must be on the interval [0, 1].");return t._point=e.slice(),t}return o(e,i),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(e){return e.unprojectBasic(this._point,200)},e.prototype.setCentroid2d=function(e,t){var r=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];this._point[0]=r[0],this._point[1]=r[1],this._notifyChanged$.next(this)},e}(s.Geometry);r.PointGeometry=i},{"../../../Component":274}],353:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var f=e("../../../Component"),o=function(p){function e(e,t){var r=p.call(this)||this;r._subsampleThreshold=.01;var n=e.length;if(n<3)throw new f.GeometryTagError("A polygon must have three or more positions.");if(e[0][0]!==e[n-1][0]||e[0][1]!==e[n-1][1])throw new f.GeometryTagError("First and last positions must be equivalent.");r._polygon=[];for(var i=0,o=e;i<o.length;i++){if((l=o[i])[0]<0||1<l[0]||l[1]<0||1<l[1])throw new f.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");r._polygon.push(l.slice())}if(r._holes=[],null==t)return r;for(var s=0;s<t.length;s++){var a=t[s],c=a.length;if(c<3)throw new f.GeometryTagError("A polygon hole must have three or more positions.");if(a[0][0]!==a[c-1][0]||a[0][1]!==a[c-1][1])throw new f.GeometryTagError("First and last positions of hole must be equivalent.");r._holes.push([]);for(var u=0,h=a;u<h.length;u++){var l;if((l=h[u])[0]<0||1<l[0]||l[1]<0||1<l[1])throw new f.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");r._holes[s].push(l.slice())}}return r}return i(e,p),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(e){var t=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];this._polygon.splice(this._polygon.length-1,0,t),this._notifyChanged$.next(this)},e.prototype.getVertex2d=function(e){return this._polygon[e].slice()},e.prototype.removeVertex2d=function(e){if(e<0||e>=this._polygon.length||this._polygon.length<4)throw new f.GeometryTagError("Index for removed vertex must be valid.");if(0<e&&e<this._polygon.length-1)this._polygon.splice(e,1);else{this._polygon.splice(0,1),this._polygon.pop();var t=this._polygon[0].slice();this._polygon.push(t)}this._notifyChanged$.next(this)},e.prototype.setVertex2d=function(e,t,r){var n=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))];0===e||e===this._polygon.length-1?(this._polygon[0]=n.slice(),this._polygon[this._polygon.length-1]=n.slice()):this._polygon[e]=n.slice(),this._notifyChanged$.next(this)},e.prototype.setCentroid2d=function(e,t){for(var r=this._polygon.map(function(e){return e[0]}),n=this._polygon.map(function(e){return e[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,e[0]-c[0])),d=Math.max(l,Math.min(p,e[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(e){return this._getPoints3d(this._subsample(this._polygon,this._subsampleThreshold),e)},e.prototype.getVertex3d=function(e,t){return t.unprojectBasic(this._polygon[e],200)},e.prototype.getVertices2d=function(){return this._polygon.slice()},e.prototype.getVertices3d=function(e){return this._getPoints3d(this._polygon,e)},e.prototype.getHolePoints3d=function(t){var r=this;return this._holes.map(function(e){return r._getPoints3d(r._subsample(e,r._subsampleThreshold),t)})},e.prototype.getHoleVertices3d=function(t){var r=this;return this._holes.map(function(e){return r._getPoints3d(e,t)})},e.prototype.getCentroid2d=function(){for(var e=this._polygon,t=0,r=0,n=0,i=0;i<e.length-1;i++){var o=e[i][0],s=e[i][1],a=e[i+1][0],c=e[i+1][1],u=o*c-a*s;t+=u,r+=(o+a)*u,n+=(s+c)*u}return[r/=6*(t/=2),n/=6*t]},e.prototype.getCentroid3d=function(e){var t=this.getCentroid2d();return e.unprojectBasic(t,200)},e.prototype.get3dDomainTriangles3d=function(t){var r=this;return this._triangulate(this._project(this._polygon,t),this.getVertices3d(t),this._holes.map(function(e){return r._project(e,t)}),this.getHoleVertices3d(t))},e.prototype.getTriangles3d=function(t){var r=this,n=this._subsampleThreshold,e=this._project(this._subsample(this._polygon,n),t),i=this.getPoints3d(t),o=this._holes.map(function(e){return r._project(r._subsample(e,n),t)}),s=this.getHolePoints3d(t);return this._triangulate(e,i,o,s)},e.prototype.getPoleOfInaccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._polygon.slice())},e.prototype.getPoleOfInaccessibility3d=function(e){var t=this._getPoleOfInaccessibility2d(this._polygon.slice());return e.unprojectBasic(t,200)},e.prototype._getPoints3d=function(e,t){return e.map(function(e){return t.unprojectBasic(e,200)})},e.prototype._subsample=function(e,t){for(var r=[],n=e.length,i=0;i<n;i++){var o=e[i],s=e[(i+1)%n];r.push(o);for(var a=Math.sqrt(Math.pow(s[0]-o[0],2)+Math.pow(s[1]-o[1],2)),c=Math.floor(a/t),u=1/(c+1),h=1;h<=c;h++){var l=h*u,p=[(1-l)*o[0]+l*s[0],(1-l)*o[1]+l*s[1]];r.push(p)}}return r},e}(f.VertexGeometry);r.PolygonGeometry=o,r.default=o},{"../../../Component":274}],354:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("../../../Component"),o=function(o){function e(e){var t=o.call(this)||this;if(e[1]>e[3])throw new s.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i<0||1<i)throw new s.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}return t._anchorIndex=void 0,t._rect=e.slice(0,4),t._inverted=t._rect[0]>t._rect[2],t}return i(e,o),Object.defineProperty(e.prototype,"anchorIndex",{get:function(){return this._anchorIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inverted",{get:function(){return this._inverted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),e.prototype.initializeAnchorIndexing=function(e){if(void 0!==this._anchorIndex)throw new Error("Anchor indexing is already initialized.");if(e<0||3<e)throw new Error("Invalid anchor index: "+e+".");this._anchorIndex=void 0===e?0:e},e.prototype.terminateAnchorIndexing=function(){this._anchorIndex=void 0},e.prototype.setOppositeVertex2d=function(e,t){if(void 0===this._anchorIndex)throw new Error("Anchor indexing needs to be initialized.");var r=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))],n=this._rect.slice(),i=0===this._anchorIndex?[n[0],n[3]]:1===this._anchorIndex?[n[0],n[1]]:2===this._anchorIndex?[n[2],n[1]]:[n[2],n[3]];if(t.fullPano){var o=this._anchorIndex<2?r[0]-n[2]:r[0]-n[0];!this._inverted&&this._anchorIndex<2&&r[0]<.25&&.75<n[2]&&o<-.5?(this._inverted=!0,this._anchorIndex=r[1]<i[1]?0:1):!this._inverted&&2<=this._anchorIndex&&r[0]<.25&&.75<n[2]&&o<-.5?(this._inverted=!0,this._anchorIndex=r[1]<i[1]?0:1):this._inverted&&2<=this._anchorIndex&&r[0]<.25&&.75<n[0]&&o<-.5?(this._inverted=!1,this._anchorIndex=r[0]<i[0]?r[1]<i[1]?3:2:r[1]<i[1]?0:1):!this._inverted&&2<=this._anchorIndex&&.75<r[0]&&n[0]<.25&&.5<o?(this._inverted=!0,this._anchorIndex=r[1]<i[1]?3:2):!this._inverted&&this._anchorIndex<2&&.75<r[0]&&n[0]<.25&&.5<o?(this._inverted=!0,this._anchorIndex=r[1]<i[1]?3:2):this._inverted&&this._anchorIndex<2&&.75<r[0]&&n[2]<.25&&.5<o?(this._inverted=!1,this._anchorIndex=r[0]<i[0]?r[1]<i[1]?3:2:r[1]<i[1]?0:1):this._inverted&&this._anchorIndex<2&&r[0]>n[0]?(this._inverted=!1,this._anchorIndex=r[1]<i[1]?0:1):this._inverted&&2<=this._anchorIndex&&r[0]<n[2]?(this._inverted=!1,this._anchorIndex=r[1]<i[1]?3:2):this._inverted?this._anchorIndex<2?this._anchorIndex=r[1]<i[1]?0:1:this._anchorIndex=r[1]<i[1]?3:2:this._anchorIndex=i[0]<=r[0]&&r[1]<i[1]?0:i[0]<=r[0]&&i[1]<=r[1]?1:r[0]<i[0]&&i[1]<=r[1]?2:3;var s=[];0===this._anchorIndex?(s[0]=i[0],s[1]=r[1],s[2]=r[0],s[3]=i[1]):1===this._anchorIndex?(s[0]=i[0],s[1]=i[1],s[2]=r[0],s[3]=r[1]):2===this._anchorIndex?(s[0]=r[0],s[1]=i[1],s[2]=i[0],s[3]=r[1]):(s[0]=r[0],s[1]=r[1],s[2]=i[0],s[3]=i[1]),(!this._inverted&&s[0]>s[2]||this._inverted&&s[0]<s[2])&&(s[0]=n[0],s[2]=n[2]),s[1]>s[3]&&(s[1]=n[1],s[3]=n[3]),this._rect[0]=s[0],this._rect[1]=s[1],this._rect[2]=s[2],this._rect[3]=s[3]}else{this._anchorIndex=i[0]<=r[0]&&r[1]<i[1]?0:i[0]<=r[0]&&i[1]<=r[1]?1:r[0]<i[0]&&i[1]<=r[1]?2:3;s=[];0===this._anchorIndex?(s[0]=i[0],s[1]=r[1],s[2]=r[0],s[3]=i[1]):1===this._anchorIndex?(s[0]=i[0],s[1]=i[1],s[2]=r[0],s[3]=r[1]):2===this._anchorIndex?(s[0]=r[0],s[1]=i[1],s[2]=i[0],s[3]=r[1]):(s[0]=r[0],s[1]=r[1],s[2]=i[0],s[3]=i[1]),s[0]>s[2]&&(s[0]=n[0],s[2]=n[2]),s[1]>s[3]&&(s[1]=n[1],s[3]=n[3]),this._rect[0]=s[0],this._rect[1]=s[1],this._rect[2]=s[2],this._rect[3]=s[3]}this._notifyChanged$.next(this)},e.prototype.setVertex2d=function(e,t,r){var n=this._rect.slice(),i=[Math.max(0,Math.min(1,t[0])),Math.max(0,Math.min(1,t[1]))],o=[];if(0===e?(o[0]=i[0],o[1]=n[1],o[2]=n[2],o[3]=i[1]):1===e?(o[0]=i[0],o[1]=i[1],o[2]=n[2],o[3]=n[3]):2===e?(o[0]=n[0],o[1]=i[1],o[2]=i[0],o[3]=n[3]):3===e&&(o[0]=n[0],o[1]=n[1],o[2]=i[0],o[3]=i[1]),r.fullPano){var s=e<2&&.75<i[0]&&n[0]<.25||2<=e&&this._inverted&&.75<i[0]&&n[2]<.25,a=e<2&&this._inverted&&i[0]<.25&&.75<n[0]||2<=e&&i[0]<.25&&.75<n[2];s||a?this._inverted=!this._inverted:(o[0]-n[0]<-.25&&(o[0]=n[0]),.25<o[2]-n[2]&&(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(e,t){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!=t.gpano&&t.gpano.CroppedAreaImageWidthPixels===t.gpano.FullPanoWidthPixels)u=this._inverted?e[0]+1-a:e[0]-a;else{var h=-n,l=1-i;u=Math.max(h,Math.min(l,e[0]-a))}var p=-o,f=1-s,d=Math.max(p,Math.min(f,e[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):1<this._rect[0]&&(this._rect[0]-=1,this._inverted=!this._inverted),this._rect[2]<0?(this._rect[2]+=1,this._inverted=!this._inverted):1<this._rect[2]&&(this._rect[2]-=1,this._inverted=!this._inverted),this._notifyChanged$.next(this)},e.prototype.getPoints3d=function(t){return this._getPoints2d().map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getVertex2d=function(e){return this._rectToVertices2d(this._rect)[e]},e.prototype.getNonAdjustedVertex2d=function(e){return this._rectToNonAdjustedVertices2d(this._rect)[e]},e.prototype.getVertex3d=function(e,t){return t.unprojectBasic(this._rectToVertices2d(this._rect)[e],200)},e.prototype.getVertices2d=function(){return this._rectToVertices2d(this._rect)},e.prototype.getVertices3d=function(t){return this._rectToVertices2d(this._rect).map(function(e){return t.unprojectBasic(e,200)})},e.prototype.getCentroid2d=function(){var e=this._rect;return[(e[0]+(this._inverted?e[2]+1:e[2]))/2,(e[1]+e[3])/2]},e.prototype.getCentroid3d=function(e){var t=this.getCentroid2d();return e.unprojectBasic(t,200)},e.prototype.getPoleOfInaccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))},e.prototype.getPoleOfInaccessibility3d=function(e){var t=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return e.unprojectBasic(t,200)},e.prototype.getTriangles3d=function(e){return this._triangulate(this._project(this._getPoints2d(),e),this.getPoints3d(e))},e.prototype.validate=function(e){var t=this._rect;return!(!this._inverted&&e[0]<t[0]||.25<e[0]-t[2]||e[1]<t[1])},e.prototype._getPoints2d=function(){for(var e=this._rectToVertices2d(this._rect),t=e.length-1,r=[],n=0;n<t;++n)for(var i=e[n][0],o=e[n][1],s=(e[n+1][0]-i)/9,a=(e[n+1][1]-o)/9,c=0;c<10;++c){var u=[i+c*s,o+c*a];r.push(u)}return r},e.prototype._rectToVertices2d=function(e){return[[e[0],e[3]],[e[0],e[1]],[this._inverted?e[2]+1:e[2],e[1]],[this._inverted?e[2]+1:e[2],e[3]],[e[0],e[3]]]},e.prototype._rectToNonAdjustedVertices2d=function(e){return[[e[0],e[3]],[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]]},e}(s.VertexGeometry);r.RectGeometry=o,r.default=o},{"../../../Component":274}],355:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var g=e("earcut"),o=e("@mapbox/polylabel"),s=e("three"),a=function(e){function t(){return e.call(this)||this}return i(t,e),t.prototype._getPoleOfInaccessibility2d=function(e){return o([e],.03)},t.prototype._triangulate=function(e,t,r,n){for(var i=[e.slice(0,-1)],o=0,s=null!=r?r:[];o<s.length;o++){var a=s[o];i.push(a.slice(0,-1))}for(var c=t.slice(0,-1),u=0,h=null!=n?n:[];u<h.length;u++){var l=h[u];c=c.concat(l.slice(0,-1))}for(var p=g.default.flatten(i),f=g.default(p.vertices,p.holes,p.dimensions),d=[],m=0;m<f.length;++m){var v=c[f[m]];d.push(v[0]),d.push(v[1]),d.push(v[2])}return d},t.prototype._project=function(e,n){var i=new s.Camera;return i.up.copy(n.upVector()),i.position.copy((new s.Vector3).fromArray(n.unprojectSfM([0,0],0))),i.lookAt((new s.Vector3).fromArray(n.unprojectSfM([0,0],10))),i.updateMatrix(),i.updateMatrixWorld(!0),e.map(function(e){var t=n.unprojectBasic(e,1e4),r=new s.Vector3(t[0],t[1],t[2]).applyMatrix4(i.matrixWorldInverse);return[r.x/r.z,r.y/r.z]})},t}(e("../../../Component").Geometry);r.VertexGeometry=a,r.default=a},{"../../../Component":274,"@mapbox/polylabel":1,earcut:8,three:225}],356:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs/operators"),a=e("rxjs"),s=function(s){function e(e,t,r,n,i){var o=s.call(this,e,t,r,n)||this;return o._tagCreator=i,o._geometryCreated$=new a.Subject,o}return i(e,s),Object.defineProperty(e.prototype,"geometryCreated$",{get:function(){return this._geometryCreated$},enumerable:!0,configurable:!0}),e.prototype._enable=function(){this._enableCreate(),this._container.element.classList.add("component-tag-create")},e.prototype._disable=function(){this._container.element.classList.remove("component-tag-create"),this._disableCreate()},e.prototype._validateBasic=function(e){var t=e[0],r=e[1];return 0<=t&&t<=1&&0<=r&&r<=1},e.prototype._mouseEventToBasic$=function(e){var i=this;return e.pipe(o.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$),o.map(function(e){var t=e[0],r=e[1],n=e[2];return i._mouseEventToBasic(t,i._container.element,r,n)}))},e}(e("../../../Component").TagHandlerBase);r.CreateHandlerBase=s,r.default=s},{"../../../Component":274,rxjs:26,"rxjs/operators":224}],357:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs/operators"),s=e("../../../Component"),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._enableCreate=function(){this._container.mouseService.deferPixels(this._name,4),this._geometryCreatedSubscription=this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(o.filter(this._validateBasic),o.map(function(e){return new s.PointGeometry(e)})).subscribe(this._geometryCreated$)},t.prototype._disableCreate=function(){this._container.mouseService.undeferPixels(this._name),this._geometryCreatedSubscription.unsubscribe()},t.prototype._getNameExtension=function(){return"create-point"},t}(s.CreateHandlerBase);r.CreatePointHandler=a,r.default=a},{"../../../Component":274,"rxjs/operators":224}],358:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._addPoint=function(e,t){e.addPoint(t)},Object.defineProperty(t.prototype,"_create$",{get:function(){return this._tagCreator.createPolygon$},enumerable:!0,configurable:!0}),t.prototype._getNameExtension=function(){return"create-polygon"},t.prototype._setVertex2d=function(e,t,r){e.geometry.setVertex2d(e.geometry.polygon.length-2,t,r)},t}(e("../../../Component").CreateVertexHandler);r.CreatePolygonHandler=o,r.default=o},{"../../../Component":274}],359:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._enableCreate=function(){var o=this;this._container.mouseService.claimMouse(this._name,2),this._deleteSubscription=this._navigator.stateService.currentTransform$.pipe(a.map(function(e){return null}),a.skip(1)).subscribe(this._tagCreator.delete$),this._createSubscription=this._mouseEventToBasic$(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$)).pipe(a.filter(this._validateBasic)).subscribe(this._tagCreator.createRect$),this._initializeAnchorIndexingSubscription=this._tagCreator.tag$.pipe(a.filter(function(e){return!!e})).subscribe(function(e){e.geometry.initializeAnchorIndexing()});var t=s.combineLatest(s.merge(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseMove$),this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseMove$)),this._container.renderService.renderCamera$).pipe(a.withLatestFrom(this._navigator.stateService.currentTransform$),a.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return o._mouseEventToBasic(r,o._container.element,n,i)}));this._setVertexSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return e?s.combineLatest(s.of(e),t,o._navigator.stateService.currentTransform$):s.empty()})).subscribe(function(e){var t=e[0],r=e[1],n=e[2];t.geometry.setOppositeVertex2d(r,n)});var r=this._container.mouseService.mouseDragEnd$.pipe(a.withLatestFrom(this._mouseEventToBasic$(this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$)).pipe(a.filter(this._validateBasic)),function(e,t){return t}),a.share());this._addPointSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return e?s.combineLatest(s.of(e),r):s.empty()})).subscribe(function(e){var t=e[0],r=e[1],n=t.geometry;n.validate(r)||(r=n.getNonAdjustedVertex2d(3)),t.addPoint(r)}),this._geometryCreatedSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return e?e.created$.pipe(a.map(function(e){return e.geometry})):s.empty()})).subscribe(this._geometryCreated$)},t.prototype._disableCreate=function(){this._container.mouseService.unclaimMouse(this._name),this._tagCreator.delete$.next(null),this._addPointSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._deleteSubscription.unsubscribe(),this._geometryCreatedSubscription.unsubscribe(),this._initializeAnchorIndexingSubscription.unsubscribe(),this._setVertexSubscription.unsubscribe()},t.prototype._getNameExtension=function(){return"create-rect-drag"},t}(e("../../../Component").CreateHandlerBase);r.CreateRectDragHandler=o,r.default=o},{"../../../Component":274,rxjs:26,"rxjs/operators":224}],360:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs/operators"),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),Object.defineProperty(t.prototype,"_create$",{get:function(){return this._tagCreator.createRect$},enumerable:!0,configurable:!0}),t.prototype._addPoint=function(e,t){var r=e.geometry;r.validate(t)||(t=r.getNonAdjustedVertex2d(3)),e.addPoint(t)},t.prototype._enable=function(){e.prototype._enable.call(this),this._initializeAnchorIndexingSubscription=this._tagCreator.tag$.pipe(o.filter(function(e){return!!e})).subscribe(function(e){e.geometry.initializeAnchorIndexing()})},t.prototype._disable=function(){e.prototype._disable.call(this),this._initializeAnchorIndexingSubscription.unsubscribe()},t.prototype._getNameExtension=function(){return"create-rect"},t.prototype._setVertex2d=function(e,t,r){e.geometry.setOppositeVertex2d(t,r)},t}(e("../../../Component").CreateVertexHandler);r.CreateRectHandler=s,r.default=s},{"../../../Component":274,"rxjs/operators":224}],361:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),a=e("rxjs/operators"),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._enableCreate=function(){var s=this;this._container.mouseService.deferPixels(this._name,4);var e=this._navigator.stateService.currentTransform$.pipe(a.map(function(e){}),a.publishReplay(1),a.refCount());this._deleteSubscription=e.pipe(a.skip(1)).subscribe(this._tagCreator.delete$);var t=this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(a.share());this._createSubscription=e.pipe(a.switchMap(function(){return t.pipe(a.filter(s._validateBasic),a.take(1))})).subscribe(this._create$),this._setVertexSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return e?o.combineLatest(o.of(e),o.merge(s._container.mouseService.mouseMove$,s._container.mouseService.domMouseMove$),s._container.renderService.renderCamera$,s._navigator.stateService.currentTransform$):o.empty()})).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=s._mouseEventToBasic(r,s._container.element,n,i);s._setVertex2d(t,o,i)}),this._addPointSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return e?o.combineLatest(o.of(e),t):o.empty()})).subscribe(function(e){var t=e[0],r=e[1];s._addPoint(t,r)}),this._geometryCreateSubscription=this._tagCreator.tag$.pipe(a.switchMap(function(e){return e?e.created$.pipe(a.map(function(e){return e.geometry})):o.empty()})).subscribe(this._geometryCreated$)},t.prototype._disableCreate=function(){this._container.mouseService.undeferPixels(this._name),this._tagCreator.delete$.next(null),this._addPointSubscription.unsubscribe(),this._createSubscription.unsubscribe(),this._deleteSubscription.unsubscribe(),this._geometryCreateSubscription.unsubscribe(),this._setVertexSubscription.unsubscribe()},t}(e("../../../Component").CreateHandlerBase);r.CreateVertexHandler=s,r.default=s},{"../../../Component":274,rxjs:26,"rxjs/operators":224}],362:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),c=e("rxjs/operators"),u=e("../../../Component"),s=function(s){function e(e,t,r,n,i){var o=s.call(this,e,t,r,n)||this;return o._tagSet=i,o}return i(e,s),e.prototype._enable=function(){var a=this,e=this._tagSet.changed$.pipe(c.map(function(e){return e.getAll()}),c.switchMap(function(e){return o.from(e).pipe(c.mergeMap(function(e){return e.interact$}))}),c.switchMap(function(e){return o.concat(o.of(e),a._container.mouseService.documentMouseUp$.pipe(c.map(function(){return{offsetX:0,offsetY:0,operation:u.TagOperation.None,tag:null}}),c.first()))}),c.share());o.merge(this._container.mouseService.mouseMove$,this._container.mouseService.domMouseMove$).pipe(c.share());this._claimMouseSubscription=e.pipe(c.switchMap(function(e){return e.tag?a._container.mouseService.domMouseDragStart$:o.empty()})).subscribe(function(){a._container.mouseService.claimMouse(a._name,3)}),this._cursorSubscription=e.pipe(c.map(function(e){return e.cursor}),c.distinctUntilChanged()).subscribe(function(e){for(var t=0,r=["crosshair","move","nesw-resize","nwse-resize"];t<r.length;t++){var n=r[t];a._container.element.classList.remove("component-tag-edit-"+n)}e&&a._container.element.classList.add("component-tag-edit-"+e)}),this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.domMouseDragEnd$).subscribe(function(e){a._container.mouseService.unclaimMouse(a._name)}),this._preventDefaultSubscription=e.pipe(c.switchMap(function(e){return e.tag?a._container.mouseService.documentMouseMove$:o.empty()})).subscribe(function(e){e.preventDefault()}),this._updateGeometrySubscription=e.pipe(c.switchMap(function(e){if(e.operation===u.TagOperation.None||!e.tag)return o.empty();var t=a._container.mouseService.filtered$(a._name,a._container.mouseService.domMouseDrag$).pipe(c.filter(function(e){return a._viewportCoords.insideElement(e,a._container.element)}));return o.combineLatest(t,a._container.renderService.renderCamera$).pipe(c.withLatestFrom(o.of(e),a._navigator.stateService.currentTransform$,function(e,t,r){return[e[0],e[1],t,r]}))})).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=a._mouseEventToBasic(t,a._container.element,r,i,n.offsetX,n.offsetY),s=n.tag.geometry;n.operation===u.TagOperation.Centroid?s.setCentroid2d(o,i):n.operation===u.TagOperation.Vertex&&s.setVertex2d(n.vertexIndex,o,i)})},e.prototype._disable=function(){this._claimMouseSubscription.unsubscribe(),this._cursorSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._unclaimMouseSubscription.unsubscribe(),this._updateGeometrySubscription.unsubscribe()},e.prototype._getNameExtension=function(){return"edit-vertex"},e}(u.TagHandlerBase);r.EditVertexHandler=s,r.default=s},{"../../../Component":274,rxjs:26,"rxjs/operators":224}],363:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(o){function e(e,t,r,n){var i=o.call(this,e,t,r)||this;return i._name=i._component.name+"-"+i._getNameExtension(),i._viewportCoords=n,i}return i(e,o),e.prototype._getConfiguration=function(e){return{}},e.prototype._mouseEventToBasic=function(e,t,r,n,i,o){i=null!=i?i:0,o=null!=o?o:0;var s=this._viewportCoords.canvasPosition(e,t),a=s[0],c=s[1];return this._viewportCoords.canvasToBasic(a-i,c-o,t,n,r.perspective)},e}(e("../../../Component").HandlerBase);r.TagHandlerBase=o,r.default=o},{"../../../Component":274}],364:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/operators"),i=e("three"),A=e("virtual-dom"),o=e("rxjs"),j=e("../../../Component"),s=e("../../../Geo"),a=function(){function e(e,t,r,n){var i=this;this._geometry=e,this._options={color:null==t.color?16777215:t.color},this._transform=r,this._viewportCoords=n||new s.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(e){i._disposeOutline(),i._outline=i._createOutine(),i._glObjects=[i._outline],i._glObjectsChanged$.next(i)})}return Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"glObjects",{get:function(){return this._glObjects},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aborted$",{get:function(){return this._aborted$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"created$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometryChanged$",{get:function(){var t=this;return this._geometry.changed$.pipe(n.map(function(e){return t}))},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._disposeOutline(),this._geometryChangedSubscription.unsubscribe()},e.prototype.getDOMObjects=function(e,t){var r=this,n=[],i={offsetHeight:t.height,offsetWidth:t.width},o=function(e){e.stopPropagation(),r._aborted$.next(r)};if(this._geometry instanceof j.RectGeometry){var s=this._geometry.anchorIndex,a=void 0===s?1:s,c=this._geometry.getVertex2d(a),u=c[0],h=c[1],l=this._viewportCoords.basicToCanvasSafe(u,h,i,this._transform,e);if(null!=l){var p={style:{background:this._colorToBackground(this._options.color),transform:P=this._canvasToTransform(l)}},f={onclick:o,style:{transform:P}};n.push(A.h("div.TagInteractor",f,[])),n.push(A.h("div.TagVertex",p,[]))}}else if(this._geometry instanceof j.PolygonGeometry){var d=this._geometry,m=d.getVertex2d(0),v=m[0],g=m[1],y=this._viewportCoords.basicToCanvasSafe(v,g,i,this._transform,e);if(null!=y){f={onclick:4<d.polygon.length?function(e){e.stopPropagation(),d.removeVertex2d(d.polygon.length-2),r._created$.next(r)}:o,style:{transform:P=this._canvasToTransform(y)}};var _=4<d.polygon.length?"TagCompleter":"TagInteractor";n.push(A.h("div."+_,f,[]))}if(3<d.polygon.length){var b=d.getVertex2d(d.polygon.length-3),x=b[0],w=b[1],S=this._viewportCoords.basicToCanvasSafe(x,w,i,this._transform,e);if(null!=S){f={onclick:function(e){e.stopPropagation(),d.removeVertex2d(d.polygon.length-3)},style:{transform:P=this._canvasToTransform(S)}};n.push(A.h("div.TagInteractor",f,[]))}}var M=d.polygon.slice();M.splice(-2,2);for(var C=0,E=M;C<E.length;C++){var T=E[C],O=this._viewportCoords.basicToCanvasSafe(T[0],T[1],i,this._transform,e);if(null!=O){var P;p={style:{background:this._colorToBackground(this._options.color),transform:P=this._canvasToTransform(O)}};n.push(A.h("div.TagVertex",p,[]))}}}return n},e.prototype.addPoint=function(e){if(this._geometry instanceof j.RectGeometry){if(!this._geometry.validate(e))return;this._created$.next(this)}else if(this._geometry instanceof j.PolygonGeometry){this._geometry.addVertex2d(e)}},e.prototype._canvasToTransform=function(e){return"translate(-50%,-50%) translate("+Math.round(e[0])+"px,"+Math.round(e[1])+"px)"},e.prototype._colorToBackground=function(e){return"#"+("000000"+e.toString(16)).substr(-6)},e.prototype._createOutine=function(){var e=this._geometry instanceof j.RectGeometry?this._geometry.getPoints3d(this._transform):this._geometry.getVertices3d(this._transform),t=this._getLinePositions(e),r=new i.BufferGeometry;r.addAttribute("position",new i.BufferAttribute(t,3));var n=new i.LineBasicMaterial({color:this._options.color,linewidth:1});return new i.Line(r,n)},e.prototype._disposeOutline=function(){if(null!=this._outline){var e=this._outline;e.geometry.dispose(),e.material.dispose(),this._outline=null,this._glObjects=[]}},e.prototype._getLinePositions=function(e){for(var t=e.length,r=new Float32Array(3*t),n=0;n<t;++n){var i=3*n,o=e[n];r[i]=o[0],r[i+1]=o[1],r[i+2]=o[2]}return r},e}();r.OutlineCreateTag=a,r.default=a},{"../../../Component":274,"../../../Geo":277,rxjs:26,"rxjs/operators":224,three:225,"virtual-dom":230}],365:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("three"),I=e("virtual-dom"),D=e("../../../Component"),s=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r._fill=t.gpano?null:r._createFill(),r._holes=1<=r._tag.lineWidth?r._createHoles():[],r._outline=1<=r._tag.lineWidth?r._createOutline():null,r._geometryChangedSubscription=r._tag.geometry.changed$.subscribe(function(e){null!=r._fill&&r._updateFillGeometry(),0<r._holes.length&&r._updateHoleGeometries(),null!=r._outline&&r._updateOulineGeometry()}),r._changedSubscription=r._tag.changed$.subscribe(function(e){var t=!1;null!=r._fill&&r._updateFillMaterial(r._fill.material),null==r._outline?1<=r._tag.lineWidth&&(r._holes=r._createHoles(),r._outline=r._createOutline(),t=!0):(r._updateHoleMaterials(),r._updateOutlineMaterial()),t&&r._glObjectsChanged$.next(r)}),r}return i(e,n),e.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline(),this._changedSubscription.unsubscribe(),this._geometryChangedSubscription.unsubscribe()},e.prototype.getDOMObjects=function(e,t,r){var n=this,i=[],o=this._tag.geometry instanceof D.RectGeometry,s=!this._transform.gpano,a={offsetHeight:r.height,offsetWidth:r.width};if(null!=this._tag.icon&&(o||s)){var c=this._tag.geometry instanceof D.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfInaccessibility2d(),u=c[0],h=c[1],l=this._viewportCoords.basicToCanvasSafe(u,h,a,this._transform,t);if(null!=l){var p=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:D.TagOperation.None,tag:n._tag})};if(e.loaded){var f=e.getDOMSprite(this._tag.icon,this._tag.iconFloat),d={onclick:function(e){e.stopPropagation(),n._tag.click$.next(n._tag)},onmousedown:p,style:{transform:x="translate("+Math.round(l[0])+"px,"+Math.round(l[1])+"px)"}};i.push(I.h("div.TagSymbol",d,[f]))}}}else if(null!=this._tag.text&&(o||s)){var m=this._tag.geometry instanceof D.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfInaccessibility2d(),v=m[0],g=m[1],y=this._viewportCoords.basicToCanvasSafe(v,g,a,this._transform,t);if(null!=y){var _=Math.round(y[0]),b=Math.round(y[1]),x=this._tag.geometry instanceof D.RectGeometry?"translate("+_+"px,"+b+"px)":"translate(-50%, -50%) translate("+_+"px,"+b+"px)";d={onmousedown:p=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:D.TagOperation.None,tag:n._tag})},style:{color:this._colorToCss(this._tag.textColor),transform:x},textContent:this._tag.text};i.push(I.h("span.TagSymbol",d,[]))}}if(!this._tag.editable)return i;var w=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof D.RectGeometry){var S=this._tag.geometry.getCentroid2d(),M=S[0],C=S[1],E=this._viewportCoords.basicToCanvasSafe(M,C,a,this._transform,t);if(null!=E){d={onmousedown:p=this._interact(D.TagOperation.Centroid,"move"),style:{background:w,transform:x="translate(-50%, -50%) translate("+Math.round(E[0])+"px,"+Math.round(E[1])+"px)"}};i.push(I.h("div.TagMover",d,[]))}}for(var T=this._tag.geometry.getVertices2d(),O=0;O<T.length-1;O++)if(!o||!(null!=this._tag.icon&&O===this._tag.iconIndex||null==this._tag.icon&&null!=this._tag.text&&3===O)){var P=T[O],A=P[0],j=P[1],R=this._viewportCoords.basicToCanvasSafe(A,j,a,this._transform,t);if(null!=R){var L=o?O%2==0?"nesw-resize":"nwse-resize":"crosshair";d={onmousedown:p=this._interact(D.TagOperation.Vertex,L,O),style:{background:w,transform:x="translate(-50%, -50%) translate("+Math.round(R[0])+"px,"+Math.round(R[1])+"px)",cursor:L}};if(i.push(I.h("div.TagResizer",d,[])),this._tag.indicateVertices){var N={style:{background:w,transform:x}};i.push(I.h("div.TagVertex",N,[]))}}}return i},e.prototype.getGLObjects=function(){var e=[];null!=this._fill&&e.push(this._fill);for(var t=0,r=this._holes;t<r.length;t++){var n=r[t];e.push(n)}return null!=this._outline&&e.push(this._outline),e},e.prototype.getRetrievableObjects=function(){return null!=this._fill?[this._fill]:[]},e.prototype._colorToCss=function(e){return"#"+("000000"+e.toString(16)).substr(-6)},e.prototype._createFill=function(){var e=this._getTriangles(),t=new Float32Array(e),r=new o.BufferGeometry;r.addAttribute("position",new o.BufferAttribute(t,3)),r.computeBoundingSphere();var n=new o.MeshBasicMaterial({side:o.DoubleSide,transparent:!0});return this._updateFillMaterial(n),new o.Mesh(r,n)},e.prototype._createHoles=function(){var e=[];if(this._tag.geometry instanceof D.PolygonGeometry)for(var t=0,r=this._getHoles3d();t<r.length;t++){var n=r[t],i=this._createLine(n);e.push(i)}return e},e.prototype._createLine=function(e){var t=this._getLinePositions(e),r=new o.BufferGeometry;r.addAttribute("position",new o.BufferAttribute(t,3)),r.computeBoundingSphere();var n=new o.LineBasicMaterial;this._updateLineBasicMaterial(n);var i=new o.Line(r,n);return i.renderOrder=1,i},e.prototype._createOutline=function(){return this._createLine(this._getPoints3d())},e.prototype._disposeFill=function(){null!=this._fill&&(this._fill.geometry.dispose(),this._fill.material.dispose(),this._fill=null)},e.prototype._disposeHoles=function(){for(var e=0,t=this._holes;e<t.length;e++){var r=t[e];r.geometry.dispose(),r.material.dispose()}this._holes=[]},e.prototype._disposeOutline=function(){null!=this._outline&&(this._outline.geometry.dispose(),this._outline.material.dispose(),this._outline=null)},e.prototype._getLinePositions=function(e){for(var t=e.length,r=new Float32Array(3*t),n=0;n<t;++n){var i=3*n,o=e[n];r[i+0]=o[0],r[i+1]=o[1],r[i+2]=o[2]}return r},e.prototype._getHoles3d=function(){var e=this._tag.geometry;return this._in3dDomain()?e.getHoleVertices3d(this._transform):e.getHolePoints3d(this._transform)},e.prototype._getPoints3d=function(){return this._in3dDomain()?this._tag.geometry.getVertices3d(this._transform):this._tag.geometry.getPoints3d(this._transform)},e.prototype._getTriangles=function(){return this._in3dDomain()?this._tag.geometry.get3dDomainTriangles3d(this._transform):this._tag.geometry.getTriangles3d(this._transform)},e.prototype._in3dDomain=function(){return this._tag.geometry instanceof D.PolygonGeometry&&this._tag.domain===D.TagDomain.ThreeDimensional},e.prototype._interact=function(n,i,o){var s=this;return function(e){var t=e.offsetX-e.target.offsetWidth/2,r=e.offsetY-e.target.offsetHeight/2;s._interact$.next({cursor:i,offsetX:t,offsetY:r,operation:n,tag:s._tag,vertexIndex:o})}},e.prototype._updateFillGeometry=function(){var e=this._getTriangles(),t=new Float32Array(e),r=this._fill.geometry,n=r.getAttribute("position");n.array.length===t.length?(n.set(t),n.needsUpdate=!0):(r.removeAttribute("position"),r.addAttribute("position",new o.BufferAttribute(t,3))),r.computeBoundingSphere()},e.prototype._updateFillMaterial=function(e){e.color=new o.Color(this._tag.fillColor),e.opacity=this._tag.fillOpacity,e.needsUpdate=!0},e.prototype._updateHoleGeometries=function(){var e=this._getHoles3d();if(e.length!==this._holes.length)throw new Error("Changing the number of holes is not supported.");for(var t=0;t<this._holes.length;t++){var r=e[t],n=this._holes[t];this._updateLine(n,r)}},e.prototype._updateHoleMaterials=function(){for(var e=0,t=this._holes;e<t.length;e++){var r=t[e].material;this._updateLineBasicMaterial(r)}},e.prototype._updateLine=function(e,t){var r=this._getLinePositions(t),n=e.geometry,i=n.getAttribute("position");i.set(r),i.needsUpdate=!0,n.computeBoundingSphere()},e.prototype._updateOulineGeometry=function(){this._updateLine(this._outline,this._getPoints3d())},e.prototype._updateOutlineMaterial=function(){var e=this._outline.material;this._updateLineBasicMaterial(e)},e.prototype._updateLineBasicMaterial=function(e){e.color=new o.Color(this._tag.lineColor),e.linewidth=Math.max(this._tag.lineWidth,1),e.visible=1<=this._tag.lineWidth&&0<this._tag.lineOpacity,e.opacity=this._tag.lineOpacity,e.transparent=this._tag.lineOpacity<1,e.needsUpdate=!0},e}(D.RenderTag);r.OutlineRenderTag=s},{"../../../Component":274,three:225,"virtual-dom":230}],366:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var c=e("rxjs"),u=e("../../../Component"),h=e("../../../Viewer"),o=function(s){function a(e,t,r){var n=s.call(this,e,t)||this,i=null!=(r=r||{}).domain&&t instanceof u.PolygonGeometry?r.domain:u.TagDomain.TwoDimensional,o=n._twoDimensionalPolygon(i,t);return n._domain=i,n._editable=null!=r.editable&&!o&&r.editable,n._fillColor=null==r.fillColor?16777215:r.fillColor,n._fillOpacity=null==r.fillOpacity?0:r.fillOpacity,n._icon=void 0===r.icon?null:r.icon,n._iconFloat=null==r.iconFloat?h.Alignment.Center:r.iconFloat,n._iconIndex=null==r.iconIndex?3:r.iconIndex,n._indicateVertices=null==r.indicateVertices||r.indicateVertices,n._lineColor=null==r.lineColor?16777215:r.lineColor,n._lineOpacity=null==r.lineOpacity?1:r.lineOpacity,n._lineWidth=null==r.lineWidth?1:r.lineWidth,n._text=void 0===r.text?null:r.text,n._textColor=null==r.textColor?16777215:r.textColor,n._click$=new c.Subject,n._click$.subscribe(function(e){n.fire(a.click,n)}),n}return i(a,s),Object.defineProperty(a.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"domain",{get:function(){return this._domain},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"editable",{get:function(){return this._editable},set:function(e){this._twoDimensionalPolygon(this._domain,this._geometry)||(this._editable=e,this._notifyChanged$.next(this))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"fillColor",{get:function(){return this._fillColor},set:function(e){this._fillColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(e){this._fillOpacity=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(e){this._iconFloat=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(e){this._iconIndex=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(e){this._indicateVertices=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"lineColor",{get:function(){return this._lineColor},set:function(e){this._lineColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(e){this._lineOpacity=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),a.prototype.setOptions=function(e){var t=this._twoDimensionalPolygon(this._domain,this._geometry);this._editable=t||null==e.editable?this._editable:e.editable,this._icon=void 0===e.icon?this._icon:e.icon,this._iconFloat=null==e.iconFloat?this._iconFloat:e.iconFloat,this._iconIndex=null==e.iconIndex?this._iconIndex:e.iconIndex,this._indicateVertices=null==e.indicateVertices?this._indicateVertices:e.indicateVertices,this._lineColor=null==e.lineColor?this._lineColor:e.lineColor,this._lineWidth=null==e.lineWidth?this._lineWidth:e.lineWidth,this._fillColor=null==e.fillColor?this._fillColor:e.fillColor,this._fillOpacity=null==e.fillOpacity?this._fillOpacity:e.fillOpacity,this._text=void 0===e.text?this._text:e.text,this._textColor=null==e.textColor?this._textColor:e.textColor,this._notifyChanged$.next(this)},a.prototype._twoDimensionalPolygon=function(e,t){return e!==u.TagDomain.ThreeDimensional&&t instanceof u.PolygonGeometry},a.click="click",a}(u.Tag);r.OutlineTag=o,r.default=o},{"../../../Component":274,"../../../Viewer":285,rxjs:26}],367:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=e("../../../Geo"),o=function(){function e(e,t,r){this._tag=e,this._transform=t,this._viewportCoords=r||new i.ViewportCoords,this._glObjectsChanged$=new n.Subject,this._interact$=new n.Subject}return Object.defineProperty(e.prototype,"glObjectsChanged$",{get:function(){return this._glObjectsChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interact$",{get:function(){return this._interact$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tag",{get:function(){return this._tag},enumerable:!0,configurable:!0}),e}();r.RenderTag=o,r.default=o},{"../../../Geo":277,rxjs:26}],368:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var w=e("virtual-dom"),S=e("../../../Component"),M=e("../../../Viewer"),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.dispose=function(){},t.prototype.getDOMObjects=function(e,t,r){var n=this,i=this._tag,o={offsetHeight:r.height,offsetWidth:r.width},s=[],a=i.geometry.getCentroid2d(),c=a[0],u=a[1],h=this._viewportCoords.basicToCanvasSafe(c,u,o,this._transform,t);if(null!=h){var l=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:S.TagOperation.None,tag:i})},p=Math.round(h[0]),f=Math.round(h[1]);if(null!=i.icon){if(e.loaded){var d=e.getDOMSprite(i.icon,M.Alignment.Bottom),m={onmousedown:l,style:{pointerEvents:"all",transform:"translate("+p+"px,"+(f+8)+"px)"}};s.push(w.h("div",m,[d]))}}else if(null!=i.text){var v="translate(-50%,0%) translate("+p+"px,"+(f+8)+"px)";m={onmousedown:l,style:{color:this._colorToCss(i.textColor),transform:v},textContent:i.text};s.push(w.h("span.TagSymbol",m,[]))}var g=this._interact(S.TagOperation.Centroid,i,"move"),y=this._colorToCss(i.color),_="translate(-50%,-50%) translate("+p+"px,"+f+"px)";if(i.editable){var b={onmousedown:g,style:{background:y,transform:_}};s.push(w.h("div.TagSpotInteractor",b,[]))}var x={style:{background:y,transform:_}};s.push(w.h("div.TagVertex",x,[]))}return s},t.prototype.getGLObjects=function(){return[]},t.prototype.getRetrievableObjects=function(){return[]},t.prototype._colorToCss=function(e){return"#"+("000000"+e.toString(16)).substr(-6)},t.prototype._interact=function(n,i,o,s){var a=this;return function(e){var t=e.offsetX-e.target.offsetWidth/2,r=e.offsetY-e.target.offsetHeight/2;a._interact$.next({cursor:o,offsetX:t,offsetY:r,operation:n,tag:i,vertexIndex:s})}},t}(S.RenderTag);r.SpotRenderTag=o},{"../../../Component":274,"../../../Viewer":285,"virtual-dom":230}],369:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=function(i){function e(e,t,r){var n=i.call(this,e,t)||this;return r=r||{},n._color=null==r.color?16777215:r.color,n._editable=null!=r.editable&&r.editable,n._icon=void 0===r.icon?null:r.icon,n._text=void 0===r.text?null:r.text,n._textColor=null==r.textColor?16777215:r.textColor,n}return o(e,i),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(e){this._color=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),e.prototype.setOptions=function(e){this._color=null==e.color?this._color:e.color,this._editable=null==e.editable?this._editable:e.editable,this._icon=void 0===e.icon?this._icon:e.icon,this._text=void 0===e.text?this._text:e.text,this._textColor=null==e.textColor?this._textColor:e.textColor,this._notifyChanged$.next(this)},e}(e("../../../Component").Tag);r.SpotTag=i,r.default=i},{"../../../Component":274}],370:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs/operators"),a=e("rxjs"),i=function(n){function i(e,t){var r=n.call(this)||this;return r._id=e,r._geometry=t,r._notifyChanged$=new a.Subject,r._notifyChanged$.subscribe(function(e){r.fire(i.changed,r)}),r._geometry.changed$.subscribe(function(e){r.fire(i.geometrychanged,r)}),r}return o(i,n),Object.defineProperty(i.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"geometryChanged$",{get:function(){var t=this;return this._geometry.changed$.pipe(s.map(function(e){return t}),s.share())},enumerable:!0,configurable:!0}),i.changed="changed",i.geometrychanged="geometrychanged",i}(e("../../../Utils").EventEmitter);r.Tag=i,r.default=i},{"../../../Utils":284,rxjs:26,"rxjs/operators":224}],371:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.TagDomain||(r.TagDomain={}))[i.TwoDimensional=0]="TwoDimensional",i[i.ThreeDimensional=1]="ThreeDimensional",r.default=n},{}],372:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t,r){this._component=e,this._container=t,this._navigator=r,this._enabled=!1}return Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),e.prototype.enable=function(){!this._enabled&&this._component.activated&&(this._enable(),this._enabled=!0,this._component.configure(this._getConfiguration(!0)))},e.prototype.disable=function(){this._enabled&&(this._disable(),this._enabled=!1,this._component.activated&&this._component.configure(this._getConfiguration(!1)))},e}();r.HandlerBase=n,r.default=n},{}],373:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var _=e("three"),u=e("../../Component"),n=function(){function e(e,t){this._imagePlaneDepth=null!=e?e:200,this._imageSphereRadius=null!=t?t:200}return e.prototype.createMesh=function(e,t){return e.pano?this._createImageSphere(e,t):this._createImagePlane(e,t)},e.prototype.createFlatMesh=function(e,t,r,n,i,o){var s=this._createTexture(e.image),a=this._createDistortedPlaneMaterialParameters(t,s),c=new _.ShaderMaterial(a),u=this._getFlatImagePlaneGeoFromBasic(t,r,n,i,o);return new _.Mesh(u,c)},e.prototype.createCurtainMesh=function(e,t){if(e.pano&&!e.fullPano)throw new Error("Cropped panoramas cannot have curtain.");return e.pano?this._createSphereCurtainMesh(e,t):this._createCurtainMesh(e,t)},e.prototype.createDistortedCurtainMesh=function(e,t){if(e.pano)throw new Error("Cropped panoramas cannot have curtain.");return this._createDistortedCurtainMesh(e,t)},e.prototype._createCurtainMesh=function(e,t){var r=this._createTexture(e.image),n=this._createCurtainPlaneMaterialParameters(t,r),i=new _.ShaderMaterial(n),o=this._useMesh(t,e)?this._getImagePlaneGeo(t,e):this._getRegularFlatImagePlaneGeo(t);return new _.Mesh(o,i)},e.prototype._createDistortedCurtainMesh=function(e,t){var r=this._createTexture(e.image),n=this._createDistortedCurtainPlaneMaterialParameters(t,r),i=new _.ShaderMaterial(n),o=this._getRegularFlatImagePlaneGeo(t);return new _.Mesh(o,i)},e.prototype._createSphereCurtainMesh=function(e,t){var r=this._createTexture(e.image),n=this._createCurtainSphereMaterialParameters(t,r),i=new _.ShaderMaterial(n);return this._useMesh(t,e)?new _.Mesh(this._getImageSphereGeo(t,e),i):new _.Mesh(this._getFlatImageSphereGeo(t),i)},e.prototype._createImageSphere=function(e,t){var r=this._createTexture(e.image),n=this._createSphereMaterialParameters(t,r),i=new _.ShaderMaterial(n);return this._useMesh(t,e)?new _.Mesh(this._getImageSphereGeo(t,e),i):new _.Mesh(this._getFlatImageSphereGeo(t),i)},e.prototype._createImagePlane=function(e,t){var r=this._createTexture(e.image),n=this._createPlaneMaterialParameters(t,r),i=new _.ShaderMaterial(n),o=this._useMesh(t,e)?this._getImagePlaneGeo(t,e):this._getRegularFlatImagePlaneGeo(t);return new _.Mesh(o,i)},e.prototype._createSphereMaterialParameters=function(e,t){var r=e.gpano,n=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2,i=2*Math.PI*(r.CroppedAreaLeftPixels-n)/r.FullPanoWidthPixels,o=2*Math.PI*r.CroppedAreaImageWidthPixels/r.FullPanoWidthPixels,s=(r.FullPanoHeightPixels-r.CroppedAreaImageHeightPixels)/2,a=Math.PI*(s-r.CroppedAreaTopPixels)/r.FullPanoHeightPixels,c=Math.PI*r.CroppedAreaImageHeightPixels/r.FullPanoHeightPixels;return{depthWrite:!1,fragmentShader:u.Shaders.equirectangular.fragment,side:_.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},phiLength:{type:"f",value:o},phiShift:{type:"f",value:i},projectorMat:{type:"m4",value:e.rt},projectorTex:{type:"t",value:t},thetaLength:{type:"f",value:c},thetaShift:{type:"f",value:a}},vertexShader:u.Shaders.equirectangular.vertex}},e.prototype._createCurtainSphereMaterialParameters=function(e,t){var r=e.gpano,n=(r.FullPanoWidthPixels-r.CroppedAreaImageWidthPixels)/2,i=2*Math.PI*(r.CroppedAreaLeftPixels-n)/r.FullPanoWidthPixels,o=2*Math.PI*r.CroppedAreaImageWidthPixels/r.FullPanoWidthPixels,s=(r.FullPanoHeightPixels-r.CroppedAreaImageHeightPixels)/2,a=Math.PI*(s-r.CroppedAreaTopPixels)/r.FullPanoHeightPixels,c=Math.PI*r.CroppedAreaImageHeightPixels/r.FullPanoHeightPixels;return{depthWrite:!1,fragmentShader:u.Shaders.equirectangularCurtain.fragment,side:_.DoubleSide,transparent:!0,uniforms:{curtain:{type:"f",value:1},opacity:{type:"f",value:1},phiLength:{type:"f",value:o},phiShift:{type:"f",value:i},projectorMat:{type:"m4",value:e.rt},projectorTex:{type:"t",value:t},thetaLength:{type:"f",value:c},thetaShift:{type:"f",value:a}},vertexShader:u.Shaders.equirectangularCurtain.vertex}},e.prototype._createPlaneMaterialParameters=function(e,t){return{depthWrite:!1,fragmentShader:u.Shaders.perspective.fragment,side:_.DoubleSide,transparent:!0,uniforms:{focal:{type:"f",value:e.focal},k1:{type:"f",value:e.ck1},k2:{type:"f",value:e.ck2},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:e.basicRt},projectorTex:{type:"t",value:t},radial_peak:{type:"f",value:e.radialPeak?e.radialPeak:0},scale_x:{type:"f",value:Math.max(e.basicHeight,e.basicWidth)/e.basicWidth},scale_y:{type:"f",value:Math.max(e.basicWidth,e.basicHeight)/e.basicHeight}},vertexShader:u.Shaders.perspective.vertex}},e.prototype._createCurtainPlaneMaterialParameters=function(e,t){return{depthWrite:!1,fragmentShader:u.Shaders.perspectiveCurtain.fragment,side:_.DoubleSide,transparent:!0,uniforms:{curtain:{type:"f",value:1},focal:{type:"f",value:e.focal},k1:{type:"f",value:e.ck1},k2:{type:"f",value:e.ck2},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:e.basicRt},projectorTex:{type:"t",value:t},radial_peak:{type:"f",value:e.radialPeak?e.radialPeak:0},scale_x:{type:"f",value:Math.max(e.basicHeight,e.basicWidth)/e.basicWidth},scale_y:{type:"f",value:Math.max(e.basicWidth,e.basicHeight)/e.basicHeight}},vertexShader:u.Shaders.perspectiveCurtain.vertex}},e.prototype._createDistortedCurtainPlaneMaterialParameters=function(e,t){return{depthWrite:!1,fragmentShader:u.Shaders.perspectiveDistortedCurtain.fragment,side:_.DoubleSide,transparent:!0,uniforms:{curtain:{type:"f",value:1},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:e.projectorMatrix()},projectorTex:{type:"t",value:t}},vertexShader:u.Shaders.perspectiveDistortedCurtain.vertex}},e.prototype._createDistortedPlaneMaterialParameters=function(e,t){return{depthWrite:!1,fragmentShader:u.Shaders.perspectiveDistorted.fragment,side:_.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},projectorMat:{type:"m4",value:e.projectorMatrix()},projectorTex:{type:"t",value:t}},vertexShader:u.Shaders.perspectiveDistorted.vertex}},e.prototype._createTexture=function(e){var t=new _.Texture(e);return t.minFilter=_.LinearFilter,t.needsUpdate=!0,t},e.prototype._useMesh=function(e,t){return t.mesh.vertices.length&&e.hasValidScale},e.prototype._getImageSphereGeo=function(e,t){for(var r=(new _.Matrix4).getInverse(e.srt),n=5*e.scale,i=this._imageSphereRadius*e.scale,o=t.mesh.vertices,s=o.length/3,a=new Float32Array(o.length),c=0;c<s;++c){var u=3*c,h=o[u+0],l=o[u+1],p=o[u+2],f=Math.sqrt(h*h+l*l+p*p),d=Math.max(n,Math.min(f,i))/f,m=new _.Vector3(h*d,l*d,p*d);m.applyMatrix4(r),a[u+0]=m.x,a[u+1]=m.y,a[u+2]=m.z}var v=t.mesh.faces,g=new Uint16Array(v.length);for(c=0;c<v.length;++c)g[c]=v[c];var y=new _.BufferGeometry;return y.addAttribute("position",new _.BufferAttribute(a,3)),y.setIndex(new _.BufferAttribute(g,1)),y},e.prototype._getImagePlaneGeo=function(e,t){for(var r=(new _.Matrix4).getInverse(e.srt),n=5*e.scale,i=this._imagePlaneDepth*e.scale,o=t.mesh.vertices,s=o.length/3,a=new Float32Array(o.length),c=0;c<s;++c){var u=3*c,h=o[u+0],l=o[u+1],p=o[u+2];c<4&&(h*=3,l*=3);var f=Math.max(n,Math.min(p,i)),d=f/p,m=new _.Vector3(h*d,l*d,f);m.applyMatrix4(r),a[u+0]=m.x,a[u+1]=m.y,a[u+2]=m.z}var v=t.mesh.faces,g=new Uint16Array(v.length);for(c=0;c<v.length;++c)g[c]=v[c];var y=new _.BufferGeometry;return y.addAttribute("position",new _.BufferAttribute(a,3)),y.setIndex(new _.BufferAttribute(g,1)),y},e.prototype._getFlatImageSphereGeo=function(e){var t=e.gpano,r=2*Math.PI*t.CroppedAreaLeftPixels/t.FullPanoWidthPixels,n=2*Math.PI*t.CroppedAreaImageWidthPixels/t.FullPanoWidthPixels,i=Math.PI*(t.FullPanoHeightPixels-t.CroppedAreaImageHeightPixels-t.CroppedAreaTopPixels)/t.FullPanoHeightPixels,o=Math.PI*t.CroppedAreaImageHeightPixels/t.FullPanoHeightPixels,s=new _.SphereGeometry(this._imageSphereRadius,20,40,r-Math.PI/2,n,i,o);return s.applyMatrix((new _.Matrix4).getInverse(e.rt)),s},e.prototype._getRegularFlatImagePlaneGeo=function(e){var t=e.width,r=e.height,n=Math.max(t,r),i=t/2/n,o=r/2/n;return this._getFlatImagePlaneGeo(e,i,o)},e.prototype._getFlatImagePlaneGeo=function(e,t,r){var n=[];return n.push(e.unprojectSfM([-t,-r],this._imagePlaneDepth)),n.push(e.unprojectSfM([t,-r],this._imagePlaneDepth)),n.push(e.unprojectSfM([t,r],this._imagePlaneDepth)),n.push(e.unprojectSfM([-t,r],this._imagePlaneDepth)),this._createFlatGeometry(n)},e.prototype._getFlatImagePlaneGeoFromBasic=function(e,t,r,n,i){var o=[];return o.push(e.unprojectBasic([t,n],this._imagePlaneDepth)),o.push(e.unprojectBasic([r,n],this._imagePlaneDepth)),o.push(e.unprojectBasic([r,i],this._imagePlaneDepth)),o.push(e.unprojectBasic([t,i],this._imagePlaneDepth)),this._createFlatGeometry(o)},e.prototype._createFlatGeometry=function(e){for(var t=new Float32Array(12),r=0;r<e.length;r++){var n=3*r;t[n+0]=e[r][0],t[n+1]=e[r][1],t[n+2]=e[r][2]}var i=new Uint16Array(6);i[0]=0,i[1]=1,i[2]=3,i[3]=1,i[4]=2,i[5]=3;var o=new _.BufferGeometry;return o.addAttribute("position",new _.BufferAttribute(t,3)),o.setIndex(new _.BufferAttribute(i,1)),o},e}();r.MeshFactory=n,r.default=n},{"../../Component":274,three:225}],374:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=function(){function e(){this.scene=new n.Scene,this.sceneOld=new n.Scene,this.imagePlanes=[],this.imagePlanesOld=[]}return e.prototype.updateImagePlanes=function(e){this._dispose(this.imagePlanesOld,this.sceneOld);for(var t=0,r=this.imagePlanes;t<r.length;t++){var n=r[t];this.scene.remove(n),this.sceneOld.add(n)}for(var i=0,o=e;i<o.length;i++){n=o[i];this.scene.add(n)}this.imagePlanesOld=this.imagePlanes,this.imagePlanes=e},e.prototype.addImagePlanes=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];this.scene.add(n),this.imagePlanes.push(n)}},e.prototype.addImagePlanesOld=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];this.sceneOld.add(n),this.imagePlanesOld.push(n)}},e.prototype.setImagePlanes=function(e){this._clear(),this.addImagePlanes(e)},e.prototype.setImagePlanesOld=function(e){this._clearOld(),this.addImagePlanesOld(e)},e.prototype.clear=function(){this._clear(),this._clearOld()},e.prototype._clear=function(){this._dispose(this.imagePlanes,this.scene),this.imagePlanes.length=0},e.prototype._clearOld=function(){this._dispose(this.imagePlanesOld,this.sceneOld),this.imagePlanesOld.length=0},e.prototype._dispose=function(e,t){for(var r=0,n=e;r<n.length;r++){var i=n[r];t.remove(i),i.geometry.dispose(),i.material.dispose();var o=i.material.uniforms.projectorTex.value;null!=o&&o.dispose()}},e}();r.MeshScene=i,r.default=i},{three:225}],375:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),s=e("rxjs/operators"),n=function(){function e(){}return e.filteredPairwiseMouseDrag$=function(n,i){return i.filtered$(n,i.mouseDragStart$).pipe(s.switchMap(function(e){var t=o.concat(o.of(e),i.filtered$(n,i.mouseDrag$)),r=i.filtered$(n,i.mouseDragEnd$).pipe(s.map(function(){return null}));return o.merge(t,r).pipe(s.takeWhile(function(e){return!!e}),s.startWith(null))}),s.pairwise(),s.filter(function(e){return null!=e[0]&&null!=e[1]}))},e}();r.MouseOperator=n,r.default=n},{rxjs:26,"rxjs/operators":224}],376:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),c=e("rxjs/operators"),u=e("virtual-dom"),i=e("../../Component"),a=e("../../Geo"),h=e("../../State"),l=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n._viewportCoords=new a.ViewportCoords,n._zoomDelta$=new s.Subject,n}return o(e,i),e.prototype._activate=function(){var a=this;this._renderSubscription=s.combineLatest(this._navigator.stateService.currentState$,this._navigator.stateService.state$).pipe(c.map(function(e){var t=e[0],r=e[1];return[t.state.zoom,r]}),c.map(function(e){var t=e[0],r=e[1],n=u.h("div.ZoomInIcon",[]),i=3<=t||r===h.State.Waiting?u.h("div.ZoomInButtonDisabled",[n]):u.h("div.ZoomInButton",{onclick:function(){a._zoomDelta$.next(1)}},[n]),o=u.h("div.ZoomOutIcon",[]),s=t<=0||r===h.State.Waiting?u.h("div.ZoomOutButtonDisabled",[o]):u.h("div.ZoomOutButton",{onclick:function(){a._zoomDelta$.next(-1)}},[o]);return{name:a._name,vnode:u.h("div.ZoomContainer",{oncontextmenu:function(e){e.preventDefault()}},[i,s])}})).subscribe(this._container.domRenderer.render$),this._zoomSubscription=this._zoomDelta$.pipe(c.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$)).subscribe(function(e){var t=e[0],r=e[1],n=e[2],i=a._viewportCoords.unprojectFromViewport(0,0,r.perspective),o=n.projectBasic(i.toArray());a._navigator.stateService.zoomIn(t,o)})},e.prototype._deactivate=function(){this._renderSubscription.unsubscribe(),this._zoomSubscription.unsubscribe()},e.prototype._getDefaultConfiguration=function(){return{}},e.componentName="zoom",e}(i.Component);r.ZoomComponent=l,i.ComponentService.register(l),r.default=l},{"../../Component":274,"../../Geo":277,"../../State":281,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],377:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(r){function n(e){var t=r.call(this,null!=e?e:"The request was aborted.")||this;return Object.setPrototypeOf(t,n.prototype),t.name="AbortMapillaryError",t}return i(n,r),n}(e("./MapillaryError").MapillaryError);r.AbortMapillaryError=o,r.default=o},{"./MapillaryError":380}],378:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(r){function n(e){var t=r.call(this,null!=e?e:"The argument is not valid.")||this;return Object.setPrototypeOf(t,n.prototype),t.name="ArgumentMapillaryError",t}return i(n,r),n}(e("./MapillaryError").MapillaryError);r.ArgumentMapillaryError=o,r.default=o},{"./MapillaryError":380}],379:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(r){function n(e){var t=r.call(this,e)||this;return Object.setPrototypeOf(t,n.prototype),t.name="GraphMapillaryError",t}return i(n,r),n}(e("./MapillaryError").MapillaryError);r.GraphMapillaryError=o,r.default=o},{"./MapillaryError":380}],380:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(r){function n(e){var t=r.call(this,e)||this;return Object.setPrototypeOf(t,n.prototype),t.name="MapillaryError",t}return i(n,r),n}(Error);r.MapillaryError=o,r.default=o},{}],381:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=function(){function t(e){this._focal=null!=e?(this._position=(new n.Vector3).fromArray(e.unprojectSfM([0,0],0)),this._lookat=(new n.Vector3).fromArray(e.unprojectSfM([0,0],10)),this._up=e.upVector(),this._getFocal(e)):(this._position=new n.Vector3(0,0,0),this._lookat=new n.Vector3(0,0,1),this._up=new n.Vector3(0,-1,0),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(e){this._focal=e},enumerable:!0,configurable:!0}),t.prototype.lerpCameras=function(e,t,r){this._position.subVectors(t.position,e.position).multiplyScalar(r).add(e.position),this._lookat.subVectors(t.lookat,e.lookat).multiplyScalar(r).add(e.lookat),this._up.subVectors(t.up,e.up).multiplyScalar(r).add(e.up),this._focal=(1-r)*e.focal+r*t.focal},t.prototype.copy=function(e){this._position.copy(e.position),this._lookat.copy(e.lookat),this._up.copy(e.up),this._focal=e.focal},t.prototype.clone=function(){var e=new t;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(e){var t=this._position.distanceToSquared(e.position),r=this._lookat.distanceToSquared(e.lookat),n=this._up.distanceToSquared(e.up),i=100*Math.abs(this._focal-e.focal);return Math.max(t,r,n,i)},t.prototype._getFocal=function(e){if(null==e.gpano)return e.focal;var t=Math.PI*e.gpano.CroppedAreaImageHeightPixels/e.gpano.FullPanoHeightPixels,r=.5/Math.tan(t/2);return Math.min(1/(2*(Math.sqrt(2)-1)),Math.max(.5,r))},t}();r.Camera=i},{three:225}],382:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Geo"),o=new n.GeoCoords,s=new n.Spatial;r.computeTranslation=function(e,t,r){var n=o.geodeticToEnu(e.lat,e.lon,e.alt,r.lat,r.lon,r.alt),i=s.rotate(n,t);return[-i.x,-i.y,-i.z]}},{"../Geo":277}],383:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(){this._wgs84a=6378137,this._wgs84b=6356752.31424518}return e.prototype.geodeticToEnu=function(e,t,r,n,i,o){var s=this.geodeticToEcef(e,t,r);return this.ecefToEnu(s[0],s[1],s[2],n,i,o)},e.prototype.enuToGeodetic=function(e,t,r,n,i,o){var s=this.enuToEcef(e,t,r,n,i,o);return this.ecefToGeodetic(s[0],s[1],s[2])},e.prototype.ecefToEnu=function(e,t,r,n,i,o){var s=this.geodeticToEcef(n,i,o),a=[e-s[0],t-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]]},e.prototype.enuToEcef=function(e,t,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*e-c*u*t+a*u*r+s[0],u*e-c*h*t+a*h*r+s[1],a*t+c*r+s[2]]},e.prototype.geodeticToEcef=function(e,t,r){var n=this._wgs84a,i=this._wgs84b;e=e*Math.PI/180,t=t*Math.PI/180;var o=Math.cos(e),s=Math.sin(e),a=Math.cos(t),c=Math.sin(t),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]},e.prototype.ecefToGeodetic=function(e,t,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(e*e+t*t),l=Math.atan2(r*n,h*i),p=Math.sin(l),f=Math.cos(l),d=Math.atan2(t,e),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]},e}();r.GeoCoords=n,r.default=n},{}],384:[function(e,t,r){"use strict";function s(e,t){return e.x<=Math.max(t.p1.x,t.p2.x)&&e.x>=Math.min(t.p1.x,t.p2.x)&&e.y>=Math.max(t.p1.y,t.p2.y)&&e.y>=Math.min(t.p1.y,t.p2.y)}function l(e,t){var r=e.p2.x-e.p1.x,n=e.p2.y-e.p1.y,i=t.p2.x-t.p1.x,o=t.p2.y-t.p1.y,s=r*o-n*i;return s*s<1e-10*(r*r+n*n)*(i*i+o*o)}function a(e,t,r){var n,i=(t.y-e.y)*(r.x-t.x)-(r.y-t.y)*(t.x-e.x);return 0<(n=i)?1:n<0?-1:0}Object.defineProperty(r,"__esModule",{value:!0}),r.segmentsIntersect=function(e,t){if(l(e,t))return!1;var r=a(e.p1,e.p2,t.p1),n=a(e.p1,e.p2,t.p2),i=a(t.p1,t.p2,e.p1),o=a(t.p1,t.p2,e.p2);return r!==n&&i!==o||!(0!==r||!s(t.p1,e))||!(0!==n||!s(t.p2,e))||!(0!==i||!s(e.p1,t))||!(0!==o||!s(e.p2,t))},r.segmentIntersection=function(e,t){if(!l(e,t)){var r=e.p1.x,n=e.p2.x,i=e.p1.y,o=e.p2.y,s=t.p1.x,a=t.p2.x,c=t.p1.y,u=t.p2.y,h=(r-n)*(c-u)-(i-o)*(s-a);return{x:((r*o-i*n)*(s-a)-(r-n)*(s*u-c*a))/h,y:((r*o-i*n)*(c-u)-(i-o)*(s*u-c*a))/h}}}},{}],385:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("three"),n=function(){function e(){this._epsilon=1e-9}return e.prototype.azimuthalToBearing=function(e){return-e+Math.PI/2},e.prototype.degToRad=function(e){return Math.PI*e/180},e.prototype.radToDeg=function(e){return 180*e/Math.PI},e.prototype.rotationMatrix=function(e){var t=new o.Vector3(e[0],e[1],e[2]),r=t.length();return 0<r&&t.normalize(),(new o.Matrix4).makeRotationAxis(t,r)},e.prototype.rotate=function(e,t){var r=new o.Vector3(e[0],e[1],e[2]),n=this.rotationMatrix(t);return r.applyMatrix4(n),r},e.prototype.opticalCenter=function(e,t){var r=[-e[0],-e[1],-e[2]],n=[-t[0],-t[1],-t[2]];return this.rotate(n,r)},e.prototype.viewingDirection=function(e){var t=[-e[0],-e[1],-e[2]];return this.rotate([0,0,1],t)},e.prototype.wrap=function(e,t,r){if(r<t)throw new Error("Invalid arguments: max must be larger than min.");for(var n=r-t;r<e||e<t;)r<e?e-=n:e<t&&(e+=n);return e},e.prototype.wrapAngle=function(e){return this.wrap(e,-Math.PI,Math.PI)},e.prototype.clamp=function(e,t,r){return e<t?t:r<e?r:e},e.prototype.angleBetweenVector2=function(e,t,r,n){var i=Math.atan2(n,r)-Math.atan2(t,e);return this.wrapAngle(i)},e.prototype.angleDifference=function(e,t){var r=t-e;return this.wrapAngle(r)},e.prototype.relativeRotationAngle=function(e,t){var r=this.rotationMatrix([-e[0],-e[1],-e[2]]),n=this.rotationMatrix(t),i=r.multiply(n).elements,o=i[0]+i[5]+i[10];return Math.acos(Math.max(Math.min((o-1)/2,1),-1))},e.prototype.angleToPlane=function(e,t){var r=(new o.Vector3).fromArray(e),n=r.length();if(n<this._epsilon)return 0;var i=r.dot((new o.Vector3).fromArray(t));return Math.asin(i/n)},e.prototype.distanceFromLatLon=function(e,t,r,n){var i=this.degToRad(r-e),o=this.degToRad(n-t),s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(this.degToRad(e))*Math.cos(this.degToRad(r))*Math.sin(o/2)*Math.sin(o/2);return 12742e3*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))},e}();r.Spatial=n,r.default=n},{three:225}],386:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var v=e("three"),n=function(){function e(e,t,r,n,i,o,s,a,c,u,h,l){this._orientation=this._getValue(e,1);var p=null!=c?c.width:4,f=null!=c?c.height:3,d=this._orientation<5;this._width=this._getValue(t,d?p:f),this._height=this._getValue(r,d?f:p),this._basicAspect=d?this._width/this._height:this._height/this._width,this._basicWidth=d?t:r,this._basicHeight=d?r:t,this._focal=this._getValue(n,1),this._scale=this._getValue(i,0),this._gpano=null!=o?o:null,this._rt=this._getRt(s,a),this._srt=this._getSrt(this._rt,this._scale),this._basicRt=this._getBasicRt(this._rt,e),this._textureScale=u||[1,1],this._ck1=h||0,this._ck2=l||0,this._radialPeak=this._getRadialPeak(this._ck1,this._ck2)}return Object.defineProperty(e.prototype,"ck1",{get:function(){return this._ck1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ck2",{get:function(){return this._ck2},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"basicAspect",{get:function(){return this._basicAspect},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"basicHeight",{get:function(){return this._basicHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"basicRt",{get:function(){return this._basicRt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"basicWidth",{get:function(){return this._basicWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focal",{get:function(){return this._focal},enumerable:!0,configurable:!0}),Object.defineProperty(e.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(e.prototype,"gpano",{get:function(){return this._gpano},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rt",{get:function(){return this._rt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srt",{get:function(){return this._srt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this._scale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasValidScale",{get:function(){return.01<this._scale&&this._scale<50},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"radialPeak",{get:function(){return this._radialPeak},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),e.prototype.upVector=function(){var e=this._rt.elements;switch(this._orientation){case 1:return new v.Vector3(-e[1],-e[5],-e[9]);case 3:return new v.Vector3(e[1],e[5],e[9]);case 6:return new v.Vector3(-e[0],-e[4],-e[8]);case 8:return new v.Vector3(e[0],e[4],e[8]);default:return new v.Vector3(-e[1],-e[5],-e[9])}},e.prototype.projectorMatrix=function(){var e=this._normalizedToTextureMatrix(),t=this._focal,r=(new v.Matrix4).set(t,0,0,0,0,t,0,0,0,0,0,0,0,0,1,0);return e.multiply(r),e.multiply(this._rt),e},e.prototype.projectBasic=function(e){var t=this.projectSfM(e);return this._sfmToBasic(t)},e.prototype.unprojectBasic=function(e,t,r){var n=this._basicToSfm(e);return this.unprojectSfM(n,t,r)},e.prototype.projectSfM=function(e){var t=new v.Vector4(e[0],e[1],e[2],1);return t.applyMatrix4(this._rt),this._bearingToSfm([t.x,t.y,t.z])},e.prototype.unprojectSfM=function(e,t,r){var n=this._sfmToBearing(e),i=r&&!this.gpano?new v.Vector4(t*n[0]/n[2],t*n[1]/n[2],t,1):new v.Vector4(t*n[0],t*n[1],t*n[2],1);return i.applyMatrix4((new v.Matrix4).getInverse(this._rt)),[i.x/i.w,i.y/i.w,i.z/i.w]},e.prototype._sfmToBearing=function(e){if(this._fullPano()){var t=2*e[0]*Math.PI,r=2*-e[1]*Math.PI;return[Math.cos(r)*Math.sin(t),-Math.sin(r),Math.cos(r)*Math.cos(t)]}if(this._gpano){var n=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),i=[e[0]*n+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,e[1]*n+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels];t=2*Math.PI*(i[0]/this.gpano.FullPanoWidthPixels-.5),r=-Math.PI*(i[1]/this.gpano.FullPanoHeightPixels-.5);return[Math.cos(r)*Math.sin(t),-Math.sin(r),Math.cos(r)*Math.cos(t)]}for(var o=[e[0]/this._focal,e[1]/this._focal],s=o[0],a=o[1],c=this._radialPeak,u=Math.sqrt(s*s+a*a),h=1,l=0;l<10;l++){var p=u/h;c<p&&(p=c),h=1+this._ck1*Math.pow(p,2)+this._ck2*Math.pow(p,4)}var f=s/h,d=a/h,m=new v.Vector3(f,d,1);return m.normalize(),[m.x,m.y,m.z]},e.prototype._bearingToSfm=function(e){if(this._fullPano()){var t=e[0],r=e[1],n=e[2],i=Math.atan2(t,n),o=Math.atan2(-r,Math.sqrt(t*t+n*n));return[i/(2*Math.PI),-o/(2*Math.PI)]}if(this._gpano){t=e[0],r=e[1],n=e[2],i=Math.atan2(t,n),o=Math.atan2(-r,Math.sqrt(t*t+n*n));var 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]}if(0<e[2]){var c=[e[0]/e[2],e[1]/e[2]],u=c[0],h=c[1],l=u*u+h*h,p=Math.pow(this._radialPeak,2);p<l&&(l=p);var f=1+this._ck1*l+this._ck2*Math.pow(l,2);return[this._focal*f*u,this._focal*f*h]}return[e[0]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,e[1]<0?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY]},e.prototype._basicToSfm=function(e){var t,r;switch(this._orientation){case 1:t=e[0],r=e[1];break;case 3:t=1-e[0],r=1-e[1];break;case 6:t=e[1],r=1-e[0];break;case 8:t=1-e[1],r=e[0];break;default:t=e[0],r=e[1]}var n=this._width,i=this._height,o=Math.max(n,i);return[t*n/o-n/o/2,r*i/o-i/o/2]},e.prototype._sfmToBasic=function(e){var t,r,n=this._width,i=this._height,o=Math.max(n,i),s=(e[0]+n/o/2)/n*o,a=(e[1]+i/o/2)/i*o;switch(this._orientation){case 1:t=s,r=a;break;case 3:t=1-s,r=1-a;break;case 6:t=1-a,r=s;break;case 8:t=a,r=1-s;break;default:t=s,r=a}return[t,r]},e.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},e.prototype._getValue=function(e,t){return null!=e&&0<e?e:t},e.prototype._getRt=function(e,t){var r=new v.Vector3(e[0],e[1],e[2]),n=r.length();0<n&&r.normalize();var i=new v.Matrix4;return i.makeRotationAxis(r,n),i.setPosition(new v.Vector3(t[0],t[1],t[2])),i},e.prototype._getSrt=function(e,t){var r=e.clone(),n=r.elements;return n[12]=t*n[12],n[13]=t*n[13],n[14]=t*n[14],r.scale(new v.Vector3(t,t,t)),r},e.prototype._getBasicRt=function(e,t){var r=new v.Vector3(0,0,1),n=0;switch(t){case 3:n=Math.PI;break;case 6:n=Math.PI/2;break;case 8:n=3*Math.PI/2}return(new v.Matrix4).makeRotationAxis(r,n).multiply(e)},e.prototype._getRadialPeak=function(e,t){var r=5*t,n=3*e,i=Math.pow(n,2)-4*r*1;if(!(i<0)){var o=(-n-Math.sqrt(i))/2/r,s=(-n+Math.sqrt(i))/2/r,a=Math.min(o,s),c=Math.max(o,s);return 0<a?Math.sqrt(a):0<c?Math.sqrt(c):void 0}},e.prototype._normalizedToTextureMatrix=function(){var e=Math.max(this._width,this._height),t=this._orientation<5?this._textureScale[0]:this._textureScale[1],r=this._orientation<5?this._textureScale[1]:this._textureScale[0],n=e/this._width*t,i=e/this._height*r;switch(this._orientation){case 1:return(new v.Matrix4).set(n,0,0,.5,0,-i,0,.5,0,0,1,0,0,0,0,1);case 3:return(new v.Matrix4).set(-n,0,0,.5,0,i,0,.5,0,0,1,0,0,0,0,1);case 6:return(new v.Matrix4).set(0,-i,0,.5,-n,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new v.Matrix4).set(0,i,0,.5,n,0,0,.5,0,0,1,0,0,0,0,1);default:return(new v.Matrix4).set(n,0,0,.5,0,-i,0,.5,0,0,1,0,0,0,0,1)}},e}();r.Transform=n},{three:225}],387:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("three"),n=function(){function e(){this._unprojectDepth=200}return e.prototype.basicToCanvas=function(e,t,r,n,i){var o=n.unprojectBasic([e,t],this._unprojectDepth);return this.projectToCanvas(o,r,i)},e.prototype.basicToCanvasSafe=function(e,t,r,n,i){var o=this.basicToViewportSafe(e,t,n,i);return null===o?null:this.viewportToCanvas(o[0],o[1],r)},e.prototype.basicToViewport=function(e,t,r,n){var i=r.unprojectBasic([e,t],this._unprojectDepth);return this.projectToViewport(i,n)},e.prototype.basicToViewportSafe=function(e,t,r,n){var i=r.unprojectBasic([e,t],this._unprojectDepth);return 0<this.worldToCamera(i,n)[2]?null:this.projectToViewport(i,n)},e.prototype.cameraToViewport=function(e,t){var r=(new o.Vector3).fromArray(e).applyMatrix4(t.projectionMatrix);return[r.x,r.y]},e.prototype.canvasPosition=function(e,t){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]},e.prototype.canvasToBasic=function(e,t,r,n,i){var o=this.unprojectFromCanvas(e,t,r,i).toArray();return n.projectBasic(o)},e.prototype.canvasToViewport=function(e,t,r){var n=this.containerToCanvas(r);return[2*e/n[0]-1,1-2*t/n[1]]},e.prototype.containerToCanvas=function(e){return[e.offsetWidth,e.offsetHeight]},e.prototype.getBasicDistances=function(e,t){var r=this.viewportToBasic(-1,1,e,t),n=this.viewportToBasic(1,1,e,t),i=this.viewportToBasic(1,-1,e,t),o=this.viewportToBasic(-1,-1,e,t),s=0,a=0,c=0,u=0;return r[1]<0&&n[1]<0&&(s=r[1]>n[1]?-r[1]:-n[1]),1<n[0]&&1<i[0]&&(a=n[0]<i[0]?n[0]-1:i[0]-1),1<i[1]&&1<o[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]},e.prototype.getPixelDistances=function(e,t,r){var n=this.viewportToBasic(-1,1,t,r),i=this.viewportToBasic(1,1,t,r),o=this.viewportToBasic(1,-1,t,r),s=this.viewportToBasic(-1,-1,t,r),a=0,c=0,u=0,h=0,l=this.containerToCanvas(e),p=l[0],f=l[1];if(n[1]<0&&i[1]<0){var d=n[1]>i[1]?n[0]:i[0];a=0<(v=this.basicToCanvas(d,0,e,t,r))[1]?v[1]:0}if(1<i[0]&&1<o[0]){var m=i[0]<o[0]?i[1]:o[1];c=(v=this.basicToCanvas(1,m,e,t,r))[0]<p?p-v[0]:0}if(1<o[1]&&1<s[1]){d=o[1]<s[1]?o[0]:s[0];u=(v=this.basicToCanvas(d,1,e,t,r))[1]<f?f-v[1]:0}if(s[0]<0&&n[0]<0){var v;m=s[0]>n[0]?s[1]:n[1];h=0<(v=this.basicToCanvas(0,m,e,t,r))[0]?v[0]:0}return[a,c,u,h]},e.prototype.insideElement=function(e,t){var r=t.getBoundingClientRect(),n=r.left+t.clientLeft,i=n+t.clientWidth,o=r.top+t.clientTop,s=o+t.clientHeight;return e.clientX>n&&e.clientX<i&&e.clientY>o&&e.clientY<s},e.prototype.projectToCanvas=function(e,t,r){var n=this.projectToViewport(e,r);return this.viewportToCanvas(n[0],n[1],t)},e.prototype.projectToViewport=function(e,t){var r=new o.Vector3(e[0],e[1],e[2]).project(t);return[r.x,r.y]},e.prototype.unprojectFromCanvas=function(e,t,r,n){var i=this.canvasToViewport(e,t,r);return this.unprojectFromViewport(i[0],i[1],n)},e.prototype.unprojectFromViewport=function(e,t,r){return new o.Vector3(e,t,1).unproject(r)},e.prototype.viewportToBasic=function(e,t,r,n){var i=new o.Vector3(e,t,1).unproject(n).toArray();return r.projectBasic(i)},e.prototype.viewportToCanvas=function(e,t,r){var n=this.containerToCanvas(r);return[n[0]*(e+1)/2,-n[1]*(t-1)/2]},e.prototype.worldToCamera=function(e,t){return new o.Vector3(e[0],e[1],e[2]).applyMatrix4(t.matrixWorldInverse).toArray()},e}();r.ViewportCoords=n,r.default=n},{three:225}],388:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.createFilter=function(e){return new Function("node","return "+this._compile(e)+";")},e.prototype._compile=function(e){if(null==e||e.length<=1)return"true";var t=e[0];return"("+("=="===t?this._compileComparisonOp("===",e[1],e[2],!1):"!="===t?this._compileComparisonOp("!==",e[1],e[2],!1):">"===t||">="===t||"<"===t||"<="===t?this._compileComparisonOp(t,e[1],e[2],!0):"in"===t?this._compileInOp(e[1],e.slice(2)):"!in"===t?this._compileNegation(this._compileInOp(e[1],e.slice(2))):"all"===t?this._compileLogicalOp(e.slice(1),"&&"):"true")+")"},e.prototype._compare=function(e,t){return e<t?-1:t<e?1:0},e.prototype._compileComparisonOp=function(e,t,r,n){var i=this._compilePropertyReference(t),o=JSON.stringify(r);return(n?"typeof "+i+"===typeof "+o+"&&":"")+i+e+o},e.prototype._compileInOp=function(e,t){var r=this._compare;return JSON.stringify(t.sort(r))+".indexOf("+this._compilePropertyReference(e)+")!==-1"},e.prototype._compileLogicalOp=function(e,t){var r=this._compile.bind(this);return e.map(r).join(t)},e.prototype._compileNegation=function(e){return"!("+e+")"},e.prototype._compilePropertyReference=function(e){return"node["+JSON.stringify(e)+"]"},e}();r.FilterCreator=n,r.default=n},{}],389:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var p=e("rxjs"),f=e("rxjs/operators"),s=e("rbush"),a=e("../Edge"),d=e("../Error"),m=e("../Graph"),n=function(){function e(e,t,r,n,i,o){this._apiV3=e,this._cachedNodes={},this._cachedNodeTiles={},this._cachedSequenceNodes={},this._cachedSpatialEdges={},this._cachedTiles={},this._cachingFill$={},this._cachingFull$={},this._cachingSequenceNodes$={},this._cachingSequences$={},this._cachingSpatialArea$={},this._cachingTiles$={},this._changed$=new p.Subject,this._defaultAlt=2,this._edgeCalculator=null!=n?n:new a.EdgeCalculator,this._filterCreator=null!=i?i:new m.FilterCreator,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=r?r:new m.GraphCalculator,this._configuration=null!=o?o:{maxSequences:50,maxUnusedNodes:100,maxUnusedPreStoredNodes:30,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=t?t:s(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(e.prototype,"changed$",{get:function(){return this._changed$},enumerable:!0,configurable:!0}),e.prototype.cacheBoundingBox$=function(u,h){var l=this,e=this._graphCalculator.encodeHsFromBoundingBox(u,h).filter(function(e){return!(e in l._cachedTiles)}).map(function(e){return e in l._cachingTiles$?l._cachingTiles$[e]:l._cacheTile$(e)});return 0===e.length&&e.push(p.of(this)),p.from(e).pipe(f.mergeAll(),f.last(),f.mergeMap(function(e){for(var t=[],r=[],n=0,i=l._nodeIndex.search({maxX:h.lat,maxY:h.lon,minX:u.lat,minY:u.lon}).map(function(e){return e.node});n<i.length;n++){var o=i[n];o.full?t.push(o):r.push(o.key)}for(var s=[];0<r.length;)s.push(r.splice(0,200));var a=p.of(t),c=s.map(function(e){return l._apiV3.imageByKeyFill$(e).pipe(f.map(function(e){var t=[];for(var r in e)if(e.hasOwnProperty(r)&&l.hasNode(r)){var n=l.getNode(r);n.full||l._makeFull(n,e[r]),t.push(n)}return t}))});return p.merge(a,p.from(c).pipe(f.mergeAll()))}),f.reduce(function(e,t){return e.concat(t)}))},e.prototype.cacheFill$=function(t){var r=this;if(t in this._cachingFull$)throw new d.GraphMapillaryError("Cannot fill node while caching full ("+t+").");if(!this.hasNode(t))throw new d.GraphMapillaryError("Cannot fill node that does not exist in graph ("+t+").");if(t in this._cachingFill$)return this._cachingFill$[t];var n=this.getNode(t);if(n.full)throw new d.GraphMapillaryError("Cannot fill node that is already full ("+t+").");return this._cachingFill$[t]=this._apiV3.imageByKeyFill$([t]).pipe(f.tap(function(e){n.full||r._makeFull(n,e[t]),delete r._cachingFill$[t]}),f.map(function(e){return r}),f.finalize(function(){t in r._cachingFill$&&delete r._cachingFill$[t],r._changed$.next(r)}),f.publish(),f.refCount()),this._cachingFill$[t]},e.prototype.cacheFull$=function(i){var o=this;if(i in this._cachingFull$)return this._cachingFull$[i];if(this.hasNode(i))throw new d.GraphMapillaryError("Cannot cache full node that already exist in graph ("+i+").");return this._cachingFull$[i]=this._apiV3.imageByKeyFull$([i]).pipe(f.tap(function(e){var t=e[i];if(o.hasNode(i)){(r=o.getNode(i)).full||o._makeFull(r,t)}else{if(null==t.sequence_key)throw new d.GraphMapillaryError("Node has no sequence key ("+i+").");var r=new m.Node(t);o._makeFull(r,t);var n=o._graphCalculator.encodeH(r.originalLatLon,o._tilePrecision);o._preStore(n,r),o._setNode(r),delete o._cachingFull$[i]}}),f.map(function(e){return o}),f.finalize(function(){i in o._cachingFull$&&delete o._cachingFull$[i],o._changed$.next(o)}),f.publish(),f.refCount()),this._cachingFull$[i]},e.prototype.cacheNodeSequence$=function(e){if(!this.hasNode(e))throw new d.GraphMapillaryError("Cannot cache sequence edges of node that does not exist in graph ("+e+").");var t=this.getNode(e);if(t.sequenceKey in this._sequences)throw new d.GraphMapillaryError("Sequence already cached ("+e+"), ("+t.sequenceKey+").");return this._cacheSequence$(t.sequenceKey)},e.prototype.cacheSequence$=function(e){if(e in this._sequences)throw new d.GraphMapillaryError("Sequence already cached ("+e+")");return this._cacheSequence$(e)},e.prototype.cacheSequenceEdges=function(e){var t=this.getNode(e);if(!(t.sequenceKey in this._sequences))throw new d.GraphMapillaryError("Sequence is not cached ("+e+"), ("+t.sequenceKey+")");var r=this._sequences[t.sequenceKey].sequence,n=this._edgeCalculator.computeSequenceEdges(t,r);t.cacheSequenceEdges(n)},e.prototype.cacheSequenceNodes$=function(e,t){var o=this;if(!this.hasSequence(e))throw new d.GraphMapillaryError("Cannot cache sequence nodes of sequence that does not exist in graph ("+e+").");if(this.hasSequenceNodes(e))throw new d.GraphMapillaryError("Sequence nodes already cached ("+e+").");var r=this.getSequence(e);if(r.key in this._cachingSequenceNodes$)return this._cachingSequenceNodes$[r.key];var n=[],i=r.keys.slice();if(t&&50<i.length){var s=i.indexOf(t),a=Math.max(0,Math.min(s-25,i.length-50));n.push(i.splice(a,50))}for(;0<i.length;)n.push(i.splice(0,200));var c=n.length,u=p.from(n).pipe(f.mergeMap(function(e){return o._apiV3.imageByKeyFull$(e).pipe(f.tap(function(e){for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];if(o.hasNode(t)){(n=o.getNode(r.key)).full||o._makeFull(n,r)}else{null==r.sequence_key&&console.warn("Sequence missing, discarding node ("+r.key+")");var n=new m.Node(r);o._makeFull(n,r);var i=o._graphCalculator.encodeH(n.originalLatLon,o._tilePrecision);o._preStore(i,n),o._setNode(n)}}c--}),f.map(function(e){return o}))},6),f.last(),f.finalize(function(){delete o._cachingSequenceNodes$[r.key],0===c&&(o._cachedSequenceNodes[r.key]=!0)}),f.publish(),f.refCount());return this._cachingSequenceNodes$[r.key]=u},e.prototype.cacheSpatialArea$=function(o){var s=this;if(!this.hasNode(o))throw new d.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+o+").");if(o in this._cachedSpatialEdges)throw new d.GraphMapillaryError("Node already spatially cached ("+o+").");if(!(o in this._requiredSpatialArea))throw new d.GraphMapillaryError("Spatial area not determined ("+o+").");var a=this._requiredSpatialArea[o];if(0===Object.keys(a.cacheNodes).length)throw new d.GraphMapillaryError("Spatial nodes already cached ("+o+").");if(o in this._cachingSpatialArea$)return this._cachingSpatialArea$[o];for(var e=[];0<a.cacheKeys.length;)e.push(a.cacheKeys.splice(0,200));for(var c=e.length,t=[],r=function(i){var e=n._apiV3.imageByKeyFill$(i).pipe(f.tap(function(e){for(var t in e)if(e.hasOwnProperty(t)){var r=a.cacheNodes[t];if(r.full)delete a.cacheNodes[t];else{var n=e[t];s._makeFull(r,n),delete a.cacheNodes[t]}}0==--c&&delete s._cachingSpatialArea$[o]}),f.map(function(e){return s}),f.catchError(function(e){for(var t=0,r=i;t<r.length;t++){var n=r[t];n in a.all&&delete a.all[n],n in a.cacheNodes&&delete a.cacheNodes[n]}throw 0==--c&&delete s._cachingSpatialArea$[o],e}),f.finalize(function(){0===Object.keys(a.cacheNodes).length&&s._changed$.next(s)}),f.publish(),f.refCount());t.push(e)},n=this,i=0,u=e;i<u.length;i++){r(u[i])}return this._cachingSpatialArea$[o]=t},e.prototype.cacheSpatialEdges=function(e){if(e in this._cachedSpatialEdges)throw new d.GraphMapillaryError("Spatial edges already cached ("+e+").");var t=this.getNode(e),r=this._sequences[t.sequenceKey].sequence,n=[],i=r.findPrevKey(t.key);null!=i&&n.push(i);var o=r.findNextKey(t.key);null!=o&&n.push(o);var s=this._requiredSpatialArea[e].all,a=[],c=this._filter;for(var u in s)if(s.hasOwnProperty(u)){var h=s[u];c(h)&&a.push(h)}var l=this._edgeCalculator.getPotentialEdges(t,a,n),p=this._edgeCalculator.computeStepEdges(t,l,i,o);p=(p=(p=(p=p.concat(this._edgeCalculator.computeTurnEdges(t,l))).concat(this._edgeCalculator.computePanoEdges(t,l))).concat(this._edgeCalculator.computePerspectiveToPanoEdges(t,l))).concat(this._edgeCalculator.computeSimilarEdges(t,l)),t.cacheSpatialEdges(p),this._cachedSpatialEdges[e]=t,delete this._requiredSpatialArea[e],delete this._cachedNodeTiles[e]},e.prototype.cacheTiles$=function(n){var i=this;if(n in this._cachedNodeTiles)throw new d.GraphMapillaryError("Tiles already cached ("+n+").");if(n in this._cachedSpatialEdges)throw new d.GraphMapillaryError("Spatial edges already cached so tiles considered cached ("+n+").");if(!(n in this._requiredNodeTiles))throw new d.GraphMapillaryError("Tiles have not been determined ("+n+").");var o=this._requiredNodeTiles[n];if(0===o.cache.length&&0===o.caching.length)throw new d.GraphMapillaryError("Tiles already cached ("+n+").");if(!this.hasNode(n))throw new d.GraphMapillaryError("Cannot cache tiles of node that does not exist in graph ("+n+").");var e=o.cache.slice();o.caching=this._requiredNodeTiles[n].caching.concat(e),o.cache=[];for(var t=[],r=function(r){var e=r in s._cachingTiles$?s._cachingTiles$[r]:s._cacheTile$(r);t.push(e.pipe(f.tap(function(e){var t=o.caching.indexOf(r);-1<t&&o.caching.splice(t,1),0===o.caching.length&&0===o.cache.length&&(delete i._requiredNodeTiles[n],i._cachedNodeTiles[n]=!0)}),f.catchError(function(e){var t=o.caching.indexOf(r);throw-1<t&&o.caching.splice(t,1),0===o.caching.length&&0===o.cache.length&&(delete i._requiredNodeTiles[n],i._cachedNodeTiles[n]=!0),e}),f.finalize(function(){i._changed$.next(i)}),f.publish(),f.refCount()))},s=this,a=0,c=o.caching;a<c.length;a++){r(c[a])}return t},e.prototype.initializeCache=function(e){if(e in this._cachedNodes)throw new d.GraphMapillaryError("Node already in cache ("+e+").");var t=this.getNode(e);t.initializeCache(new m.NodeCache);var r=(new Date).getTime();this._cachedNodes[e]={accessed:r,node:t},this._updateCachedTileAccess(e,r)},e.prototype.isCachingFill=function(e){return e in this._cachingFill$},e.prototype.isCachingFull=function(e){return e in this._cachingFull$},e.prototype.isCachingNodeSequence=function(e){return this.getNode(e).sequenceKey in this._cachingSequences$},e.prototype.isCachingSequence=function(e){return e in this._cachingSequences$},e.prototype.isCachingSequenceNodes=function(e){return e in this._cachingSequenceNodes$},e.prototype.isCachingTiles=function(e){return e in this._requiredNodeTiles&&0===this._requiredNodeTiles[e].cache.length&&0<this._requiredNodeTiles[e].caching.length},e.prototype.hasInitializedCache=function(e){return e in this._cachedNodes},e.prototype.hasNode=function(e){var t=(new Date).getTime();return this._updateCachedNodeAccess(e,t),this._updateCachedTileAccess(e,t),e in this._nodes},e.prototype.hasNodeSequence=function(e){var t=this.getNode(e).sequenceKey,r=t in this._sequences;return r&&(this._sequences[t].accessed=(new Date).getTime()),r},e.prototype.hasSequence=function(e){var t=e in this._sequences;return t&&(this._sequences[e].accessed=(new Date).getTime()),t},e.prototype.hasSequenceNodes=function(e){return e in this._cachedSequenceNodes},e.prototype.hasSpatialArea=function(e){if(!this.hasNode(e))throw new d.GraphMapillaryError("Spatial area nodes cannot be determined if node not in graph ("+e+").");if(e in this._cachedSpatialEdges)return!0;if(e in this._requiredSpatialArea)return 0===Object.keys(this._requiredSpatialArea[e].cacheNodes).length;for(var t=this.getNode(e),r=this._graphCalculator.boundingBoxCorners(t.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 s=o[i];n.all[s.node.key]=s.node,s.node.full||(n.cacheKeys.push(s.node.key),n.cacheNodes[s.node.key]=s.node)}return 0===(this._requiredSpatialArea[e]=n).cacheKeys.length},e.prototype.hasTiles=function(e){var t=this;if(e in this._cachedNodeTiles)return!0;if(e in this._cachedSpatialEdges)return!0;if(!this.hasNode(e))throw new d.GraphMapillaryError("Node does not exist in graph ("+e+").");var r={cache:[],caching:[]};if(e in this._requiredNodeTiles)r=this._requiredNodeTiles[e];else{var n=this.getNode(e);r.cache=this._graphCalculator.encodeHs(n.latLon,this._tilePrecision,this._tileThreshold).filter(function(e){return!(e in t._cachedTiles)}),0<r.cache.length&&(this._requiredNodeTiles[e]=r)}return 0===r.cache.length&&0===r.caching.length},e.prototype.getNode=function(e){var t=(new Date).getTime();return this._updateCachedNodeAccess(e,t),this._updateCachedTileAccess(e,t),this._nodes[e]},e.prototype.getSequence=function(e){var t=this._sequences[e];return t.accessed=(new Date).getTime(),t.sequence},e.prototype.resetSpatialEdges=function(){for(var e=0,t=Object.keys(this._cachedSpatialEdges);e<t.length;e++){var r=t[e];this._cachedSpatialEdges[r].resetSpatialEdges(),delete this._cachedSpatialEdges[r]}},e.prototype.reset=function(e){for(var t=[],r=0,n=e;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(),t.push(h)}for(var o=0,s=Object.keys(this._cachedNodes);o<s.length;o++){var a=s[o];-1===e.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=t;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()},e.prototype.setFilter=function(e){this._filter=this._filterCreator.createFilter(e)},e.prototype.uncache=function(e,t){var r={};this._addNewKeys(r,this._cachingFull$),this._addNewKeys(r,this._cachingFill$),this._addNewKeys(r,this._cachingSpatialArea$),this._addNewKeys(r,this._requiredNodeTiles),this._addNewKeys(r,this._requiredSpatialArea);for(var n=0,i=e;n<i.length;n++){(s=i[n])in r||(r[s]=!0)}var o={};for(var s in r)if(r.hasOwnProperty(s))for(var a=this._nodes[s],c=0,u=this._graphCalculator.encodeHs(a.latLon);c<u.length;c++){var h=u[c];h in o||(o[h]=!0)}var l=[];for(var p in this._cachedTiles)!this._cachedTiles.hasOwnProperty(p)||p in o||l.push([p,this._cachedTiles[p]]);for(var f=0,d=l.sort(function(e,t){return t[1].accessed-e[1].accessed}).slice(this._configuration.maxUnusedTiles).map(function(e){return e[0]});f<d.length;f++){var m=d[f];this._uncacheTile(m,t)}var v=[],g=[];for(var p in this._preStored)if(this._preStored.hasOwnProperty(p)&&!(p in this._cachingTiles$)){var y=this._preStored[p];for(var s in y)!y.hasOwnProperty(s)||s in r||y[s].sequenceKey!==t&&(s in this._cachedNodes?v.push([this._cachedNodes[s],p]):g.push([s,p]))}var _=v.sort(function(e,t){var r=e[0],n=(e[1],t[0]);t[1];return n.accessed-r.accessed}).slice(this._configuration.maxUnusedPreStoredNodes).map(function(e){var t=e[0],r=e[1];return[t.node.key,r]});this._uncachePreStored(g),this._uncachePreStored(_);var b=[];for(var s in this._cachedNodes)!this._cachedNodes.hasOwnProperty(s)||s in r||b.push(this._cachedNodes[s]);for(var x=0,w=b.sort(function(e,t){return t.accessed-e.accessed}).slice(this._configuration.maxUnusedNodes);x<w.length;x++){var S=w[x];S.node.uncache();s=S.node.key;delete this._cachedNodes[s],s in this._cachedNodeTiles&&delete this._cachedNodeTiles[s],s in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[s]}var M=[];for(var C in this._sequences)!this._sequences.hasOwnProperty(C)||C in this._cachingSequences$||C===t||M.push(this._sequences[C]);for(var E=0,T=M.sort(function(e,t){return t.accessed-e.accessed}).slice(this._configuration.maxSequences);E<T.length;E++){var O=T[E];C=O.sequence.key;delete this._sequences[C],C in this._cachedSequenceNodes&&delete this._cachedSequenceNodes[C],O.sequence.dispose()}},e.prototype._addNewKeys=function(e,t){for(var r in t)t.hasOwnProperty(r)&&this.hasNode(r)&&(r in e||(e[r]=!0))},e.prototype._cacheSequence$=function(t){var r=this;return t in this._cachingSequences$||(this._cachingSequences$[t]=this._apiV3.sequenceByKey$([t]).pipe(f.tap(function(e){t in r._sequences||(r._sequences[t]={accessed:(new Date).getTime(),sequence:new m.Sequence(e[t])}),delete r._cachingSequences$[t]}),f.map(function(e){return r}),f.finalize(function(){t in r._cachingSequences$&&delete r._cachingSequences$[t],r._changed$.next(r)}),f.publish(),f.refCount())),this._cachingSequences$[t]},e.prototype._cacheTile$=function(h){var l=this;return this._cachingTiles$[h]=this._apiV3.imagesByH$([h]).pipe(f.tap(function(e){var t=e[h];if(!(h in l._cachedTiles)){l._nodeIndexTiles[h]=[],l._cachedTiles[h]={accessed:(new Date).getTime(),nodes:[]};var r=l._cachedTiles[h].nodes,n=l._removeFromPreStore(h);for(var i in t)if(t.hasOwnProperty(i)){var o=t[i];if(null==o)break;if(null!=o.sequence_key)if(null!=n&&o.key in n){var s=n[o.key];delete n[o.key],r.push(s);var a={lat:s.latLon.lat,lon:s.latLon.lon,node:s};l._nodeIndex.insert(a),l._nodeIndexTiles[h].push(a),l._nodeToTile[s.key]=h}else{var c=new m.Node(o);r.push(c);var u={lat:c.latLon.lat,lon:c.latLon.lon,node:c};l._nodeIndex.insert(u),l._nodeIndexTiles[h].push(u),l._nodeToTile[c.key]=h,l._setNode(c)}else console.warn("Sequence missing, discarding node ("+o.key+")")}delete l._cachingTiles$[h]}}),f.map(function(e){return l}),f.catchError(function(e){throw delete l._cachingTiles$[h],e}),f.publish(),f.refCount()),this._cachingTiles$[h]},e.prototype._makeFull=function(e,t){null==t.calt&&(t.calt=this._defaultAlt),null==t.c_rotation&&(t.c_rotation=this._graphCalculator.rotationFromCompass(t.ca,t.orientation)),e.makeFull(t)},e.prototype._preStore=function(e,t){e in this._preStored||(this._preStored[e]={}),this._preStored[e][t.key]=t},e.prototype._removeFromPreStore=function(e){var t=null;return e in this._preStored&&(t=this._preStored[e],delete this._preStored[e]),t},e.prototype._setNode=function(e){var t=e.key;if(this.hasNode(t))throw new d.GraphMapillaryError("Node already exist ("+t+").");this._nodes[t]=e},e.prototype._uncacheTile=function(e,t){for(var r=0,n=this._cachedTiles[e].nodes;r<n.length;r++){var i=n[r],o=i.key;delete this._nodeToTile[o],o in this._cachedNodes&&delete this._cachedNodes[o],o in this._cachedNodeTiles&&delete this._cachedNodeTiles[o],o in this._cachedSpatialEdges&&delete this._cachedSpatialEdges[o],i.sequenceKey===t?(this._preStore(e,i),i.uncache()):(delete this._nodes[o],i.sequenceKey in this._cachedSequenceNodes&&delete this._cachedSequenceNodes[i.sequenceKey],i.dispose())}for(var s=0,a=this._nodeIndexTiles[e];s<a.length;s++){var c=a[s];this._nodeIndex.remove(c)}delete this._nodeIndexTiles[e],delete this._cachedTiles[e]},e.prototype._uncachePreStored=function(e){for(var t={},r=0,n=e;r<n.length;r++){var i=n[r],o=i[0],s=i[1];o in this._nodes&&delete this._nodes[o],o in this._cachedNodes&&delete this._cachedNodes[o];var a=this._preStored[s][o];a.sequenceKey in this._cachedSequenceNodes&&delete this._cachedSequenceNodes[a.sequenceKey],delete this._preStored[s][o],a.dispose(),t[s]=!0}for(var s in t)t.hasOwnProperty(s)&&0===Object.keys(this._preStored[s]).length&&delete this._preStored[s]},e.prototype._updateCachedTileAccess=function(e,t){e in this._nodeToTile&&(this._cachedTiles[this._nodeToTile[e]].accessed=t)},e.prototype._updateCachedNodeAccess=function(e,t){e in this._cachedNodes&&(this._cachedNodes[e].accessed=t)},e}();r.Graph=n,r.default=n},{"../Edge":275,"../Error":276,"../Graph":278,rbush:25,rxjs:26,"rxjs/operators":224}],390:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var v=e("latlon-geohash"),u=e("three"),a=e("../Error"),n=e("../Geo"),i=function(){function e(e){this._geoCoords=null!=e?e:new n.GeoCoords}return e.prototype.encodeH=function(e,t){return void 0===t&&(t=7),v.encode(e.lat,e.lon,t)},e.prototype.encodeHs=function(e,t,r){void 0===t&&(t=7),void 0===r&&(r=20);var n=v.encode(e.lat,e.lon,t),i=v.bounds(n),o=i.ne,s=i.sw,a=v.neighbours(n),c=[0,0,0],u=this._geoCoords.geodeticToEnu(o.lat,o.lon,0,s.lat,s.lon,0),h=this._geoCoords.geodeticToEnu(e.lat,e.lon,0,s.lat,s.lon,0),l=h[0]-c[0]<r,p=u[0]-h[0]<r,f=h[1]-c[1]<r,d=u[1]-h[1]<r,m=[n];return d&&m.push(a.n),d&&l&&m.push(a.nw),l&&m.push(a.w),l&&f&&m.push(a.sw),f&&m.push(a.s),f&&p&&m.push(a.se),p&&m.push(a.e),p&&d&&m.push(a.ne),m},e.prototype.encodeHsFromBoundingBox=function(e,t,r){if(void 0===r&&(r=7),t.lat<=e.lat||t.lon<=e.lon)throw new a.GraphMapillaryError("North east needs to be top right of south west");var n=(e.lat+t.lat)/2,i=(e.lon+t.lon)/2,o=this._geoCoords.geodeticToEnu(t.lat,t.lon,0,n,i,0),s=Math.max(o[0],o[1]);return this.encodeHs({lat:n,lon:i},r,s)},e.prototype.boundingBoxCorners=function(e,t){var r=this._geoCoords.enuToGeodetic(-t,-t,0,e.lat,e.lon,0),n=this._geoCoords.enuToGeodetic(t,t,0,e.lat,e.lon,0);return[{lat:r[0],lon:r[1]},{lat:n[0],lon:n[1]}]},e.prototype.rotationFromCompass=function(e,t){var r=0,n=0,i=0;switch(t){case 1:r=Math.PI/2;break;case 3:r=-Math.PI/2,i=Math.PI;break;case 6:n=-Math.PI/2,i=-Math.PI/2;break;case 8:n=Math.PI/2,i=Math.PI/2}var o=(new u.Matrix4).makeRotationZ(i),s=new u.Euler(r,n,e*Math.PI/180,"XYZ"),a=(new u.Matrix4).makeRotationFromEuler(s),c=(new u.Vector4).setAxisAngleFromRotationMatrix(a.multiply(o));return c.multiplyScalar(c.w).toArray().slice(0,3)},e}();r.GraphCalculator=i,r.default=i},{"../Error":276,"../Geo":277,"latlon-geohash":21,three:225}],391:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.GraphMode||(r.GraphMode={}))[i.Sequence=0]="Sequence",i[i.Spatial=1]="Spatial",r.default=n},{}],392:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var c=e("rxjs"),u=e("rxjs/operators"),h=e("../Graph"),n=function(){function e(e,t){this._graph$=c.concat(c.of(e),e.changed$).pipe(u.publishReplay(1),u.refCount()),this._graph$.subscribe(function(){}),this._graphMode=h.GraphMode.Spatial,this._graphModeSubject$=new c.Subject,this._graphMode$=this._graphModeSubject$.pipe(u.startWith(this._graphMode),u.publishReplay(1),u.refCount()),this._graphMode$.subscribe(function(){}),this._imageLoadingService=t,this._firstGraphSubjects$=[],this._initializeCacheSubscriptions=[],this._sequenceSubscriptions=[],this._spatialSubscriptions=[]}return Object.defineProperty(e.prototype,"graphMode$",{get:function(){return this._graphMode$},enumerable:!0,configurable:!0}),e.prototype.cacheBoundingBox$=function(t,r){return this._graph$.pipe(u.first(),u.mergeMap(function(e){return e.cacheBoundingBox$(t,r)}))},e.prototype.cacheNode$=function(r){var t=this,n=new c.Subject;this._firstGraphSubjects$.push(n);var e=n.pipe(u.publishReplay(1),u.refCount()),i=e.pipe(u.map(function(e){return e.getNode(r)}),u.mergeMap(function(e){return e.assetsCached?c.of(e):e.cacheAssets$()}),u.publishReplay(1),u.refCount());i.subscribe(function(e){t._imageLoadingService.loadnode$.next(e)},function(e){console.error("Failed to cache node ("+r+")",e)});var o=this._graph$.pipe(u.first(),u.mergeMap(function(e){return e.isCachingFull(r)||!e.hasNode(r)?e.cacheFull$(r):e.isCachingFill(r)||!e.getNode(r).full?e.cacheFill$(r):c.of(e)}),u.tap(function(e){e.hasInitializedCache(r)||e.initializeCache(r)}),u.finalize(function(){null!=o&&(t._removeFromArray(o,t._initializeCacheSubscriptions),t._removeFromArray(n,t._firstGraphSubjects$))})).subscribe(function(e){n.next(e),n.complete()},function(e){n.error(e)});o.closed||this._initializeCacheSubscriptions.push(o);var s=e.pipe(u.mergeMap(function(e){return e.isCachingNodeSequence(r)||!e.hasNodeSequence(r)?e.cacheNodeSequence$(r):c.of(e)}),u.publishReplay(1),u.refCount()).pipe(u.tap(function(e){e.getNode(r).sequenceEdges.cached||e.cacheSequenceEdges(r)}),u.finalize(function(){null!=s&&t._removeFromArray(s,t._sequenceSubscriptions)})).subscribe(function(e){},function(e){console.error("Failed to cache sequence edges ("+r+").",e)});if(s.closed||this._sequenceSubscriptions.push(s),this._graphMode===h.GraphMode.Spatial){var a=e.pipe(u.expand(function(e){return e.hasTiles(r)?c.empty():c.from(e.cacheTiles$(r)).pipe(u.mergeMap(function(e){return e.pipe(u.mergeMap(function(e){return e.isCachingTiles(r)?c.empty():c.of(e)}),u.catchError(function(e,t){return console.error("Failed to cache tile data ("+r+").",e),c.empty()}))}))}),u.last(),u.mergeMap(function(e){return e.hasSpatialArea(r)?c.of(e):c.from(e.cacheSpatialArea$(r)).pipe(u.mergeMap(function(e){return e.pipe(u.catchError(function(e,t){return console.error("Failed to cache spatial nodes ("+r+").",e),c.empty()}))}))}),u.last(),u.mergeMap(function(e){return e.hasNodeSequence(r)?c.of(e):e.cacheNodeSequence$(r)}),u.tap(function(e){e.getNode(r).spatialEdges.cached||e.cacheSpatialEdges(r)}),u.finalize(function(){null!=a&&t._removeFromArray(a,t._spatialSubscriptions)})).subscribe(function(e){},function(e){console.error("Failed to cache spatial edges ("+r+").",e)});a.closed||this._spatialSubscriptions.push(a)}return i.pipe(u.first(function(e){return e.assetsCached}))},e.prototype.cacheSequence$=function(t){return this._graph$.pipe(u.first(),u.mergeMap(function(e){return e.isCachingSequence(t)||!e.hasSequence(t)?e.cacheSequence$(t):c.of(e)}),u.map(function(e){return e.getSequence(t)}))},e.prototype.cacheSequenceNodes$=function(t,r){return this._graph$.pipe(u.first(),u.mergeMap(function(e){return e.isCachingSequence(t)||!e.hasSequence(t)?e.cacheSequence$(t):c.of(e)}),u.mergeMap(function(e){return e.isCachingSequenceNodes(t)||!e.hasSequenceNodes(t)?e.cacheSequenceNodes$(t,r):c.of(e)}),u.map(function(e){return e.getSequence(t)}))},e.prototype.setFilter$=function(t){return this._resetSubscriptions(this._spatialSubscriptions),this._graph$.pipe(u.first(),u.tap(function(e){e.resetSpatialEdges(),e.setFilter(t)}),u.map(function(e){}))},e.prototype.setGraphMode=function(e){this._graphMode!==e&&(e===h.GraphMode.Sequence&&this._resetSubscriptions(this._spatialSubscriptions),this._graphMode=e,this._graphModeSubject$.next(this._graphMode))},e.prototype.reset$=function(t){return this._abortSubjects(this._firstGraphSubjects$),this._resetSubscriptions(this._initializeCacheSubscriptions),this._resetSubscriptions(this._sequenceSubscriptions),this._resetSubscriptions(this._spatialSubscriptions),this._graph$.pipe(u.first(),u.tap(function(e){e.reset(t)}),u.map(function(e){}))},e.prototype.uncache$=function(t,r){return this._graph$.pipe(u.first(),u.tap(function(e){e.uncache(t,r)}),u.map(function(e){}))},e.prototype._abortSubjects=function(e){for(var t=0,r=e.slice();t<r.length;t++){var n=r[t];this._removeFromArray(n,e),n.error(new Error("Cache node request was aborted."))}},e.prototype._removeFromArray=function(e,t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)},e.prototype._resetSubscriptions=function(e){for(var t=0,r=e.slice();t<r.length;t++){var n=r[t];this._removeFromArray(n,e),n.closed||n.unsubscribe()}},e}();r.GraphService=n,r.default=n},{"../Graph":278,rxjs:26,"rxjs/operators":224}],393:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/operators"),i=e("rxjs"),o=function(){function e(){this._loadnode$=new i.Subject,this._loadstatus$=this._loadnode$.pipe(n.scan(function(e,t){var r=e[0],n=!1;return 0===t.loadStatus.total||t.loadStatus.loaded===t.loadStatus.total?t.key in r&&(delete r[t.key],n=!0):(r[t.key]=t.loadStatus,n=!0),[r,n]},[{},!1]),n.filter(function(e){e[0];return e[1]}),n.map(function(e){return e[0]}),n.publishReplay(1),n.refCount()),this._loadstatus$.subscribe(function(){})}return Object.defineProperty(e.prototype,"loadnode$",{get:function(){return this._loadnode$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loadstatus$",{get:function(){return this._loadstatus$},enumerable:!0,configurable:!0}),e}();r.ImageLoadingService=o},{rxjs:26,"rxjs/operators":224}],394:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("pbf"),i=function(){function t(){}return t.read=function(e){return new n(e).readFields(t._readMeshField,{faces:[],vertices:[]})},t._readMeshField=function(e,t,r){1===e?t.vertices.push(r.readFloat()):2===e&&t.faces.push(r.readVarint())},t}();r.MeshReader=i},{pbf:23}],395:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/operators"),i=function(){function e(e){this._cache=null,this._core=e,this._fill=null}return Object.defineProperty(e.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(e.prototype,"alt",{get:function(){return this._fill.calt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ca",{get:function(){return null!=this._fill.cca?this._fill.cca:this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"capturedAt",{get:function(){return this._fill.captured_at},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cameraUuid",{get:function(){return this._fill.captured_with_camera_uuid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ck1",{get:function(){return this._fill.ck1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ck2",{get:function(){return this._fill.ck2},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computedCA",{get:function(){return this._fill.cca},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computedLatLon",{get:function(){return this._core.cl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focal",{get:function(){return this._fill.cfocal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return null!=this._fill},enumerable:!0,configurable:!0}),Object.defineProperty(e.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(e.prototype,"gpano",{get:function(){return this._fill.gpano},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._fill.height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"image",{get:function(){return this._cache.image},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"image$",{get:function(){return this._cache.image$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this._core.key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"latLon",{get:function(){return null!=this._core.cl?this._core.cl:this._core.l},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loadStatus",{get:function(){return this._cache.loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"merged",{get:function(){return null!=this._fill&&null!=this._fill.merge_version&&0<this._fill.merge_version},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mergeCC",{get:function(){return this._fill.merge_cc},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mergeVersion",{get:function(){return this._fill.merge_version},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._cache.mesh},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"organizationKey",{get:function(){return this._fill.organization_key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._fill.orientation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"originalCA",{get:function(){return this._fill.ca},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"originalLatLon",{get:function(){return this._core.l},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pano",{get:function(){return null!=this._fill.gpano&&null!=this._fill.gpano.FullPanoWidthPixels},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"private",{get:function(){return this._fill.private},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"projectKey",{get:function(){return null!=this._fill.project?this._fill.project.key:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this._fill.c_rotation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this._fill.atomic_scale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sequenceKey",{get:function(){return this._core.sequence_key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sequenceEdges",{get:function(){return this._cache.sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sequenceEdges$",{get:function(){return this._cache.sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spatialEdges",{get:function(){return this._cache.spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spatialEdges$",{get:function(){return this._cache.spatialEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"userKey",{get:function(){return this._fill.user.key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"username",{get:function(){return this._fill.user.username},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._fill.width},enumerable:!0,configurable:!0}),e.prototype.cacheAssets$=function(){var e=this;return this._cache.cacheAssets$(this.key,this.pano,this.merged).pipe(n.map(function(){return e}))},e.prototype.cacheImage$=function(e){var t=this;return this._cache.cacheImage$(this.key,e).pipe(n.map(function(){return t}))},e.prototype.cacheSequenceEdges=function(e){this._cache.cacheSequenceEdges(e)},e.prototype.cacheSpatialEdges=function(e){this._cache.cacheSpatialEdges(e)},e.prototype.dispose=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null),this._core=null,this._fill=null},e.prototype.initializeCache=function(e){if(null!=this._cache)throw new Error("Node cache already initialized ("+this.key+").");this._cache=e},e.prototype.makeFull=function(e){if(null==e)throw new Error("Fill can not be null.");this._fill=e},e.prototype.resetSequenceEdges=function(){this._cache.resetSequenceEdges()},e.prototype.resetSpatialEdges=function(){this._cache.resetSpatialEdges()},e.prototype.uncache=function(){null!=this._cache&&(this._cache.dispose(),this._cache=null)},e}();r.Node=i,r.default=i},{"rxjs/operators":224}],396:[function(t,e,r){(function(o){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=t("rxjs"),s=t("rxjs/operators"),c=t("../Graph"),u=t("../Utils"),e=function(){function e(){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._imageChanged$=new a.Subject,this._image$=this._imageChanged$.pipe(s.startWith(null),s.publishReplay(1),s.refCount()),this._iamgeSubscription=this._image$.subscribe(),this._sequenceEdgesChanged$=new a.Subject,this._sequenceEdges$=this._sequenceEdgesChanged$.pipe(s.startWith(this._sequenceEdges),s.publishReplay(1),s.refCount()),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){}),this._spatialEdgesChanged$=new a.Subject,this._spatialEdges$=this._spatialEdgesChanged$.pipe(s.startWith(this._spatialEdges),s.publishReplay(1),s.refCount()),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){}),this._cachingAssets$=null}return Object.defineProperty(e.prototype,"image",{get:function(){return this._image},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"image$",{get:function(){return this._image$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loadStatus",{get:function(){return this._loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sequenceEdges",{get:function(){return this._sequenceEdges},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sequenceEdges$",{get:function(){return this._sequenceEdges$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spatialEdges",{get:function(){return this._spatialEdges},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spatialEdges$",{get:function(){return this._spatialEdges$},enumerable:!0,configurable:!0}),e.prototype.cacheAssets$=function(e,t,r){var n=this;if(null!=this._cachingAssets$)return this._cachingAssets$;var i=t?u.Settings.basePanoramaSize:u.Settings.baseImageSize;return this._cachingAssets$=a.combineLatest(this._cacheImage$(e,i),this._cacheMesh$(e,r)).pipe(s.map(function(e){var t=e[0],r=e[1];return n._loadStatus.loaded=0,n._loadStatus.total=0,r&&(n._mesh=r.object,n._loadStatus.loaded+=r.loaded.loaded,n._loadStatus.total+=r.loaded.total),t&&(n._image=t.object,n._loadStatus.loaded+=t.loaded.loaded,n._loadStatus.total+=t.loaded.total),n}),s.finalize(function(){n._cachingAssets$=null}),s.publishReplay(1),s.refCount()),this._cachingAssets$.pipe(s.first(function(e){return!!e._image})).subscribe(function(e){n._imageChanged$.next(n._image)},function(e){}),this._cachingAssets$},e.prototype.cacheImage$=function(e,t){var r=this;if(null!=this._image&&t<=Math.max(this._image.width,this._image.height))return a.of(this);var n=this._cacheImage$(e,t).pipe(s.first(function(e){return null!=e.object}),s.tap(function(e){r._disposeImage(),r._image=e.object}),s.map(function(e){return r}),s.publishReplay(1),s.refCount());return n.subscribe(function(e){r._imageChanged$.next(r._image)},function(e){}),n},e.prototype.cacheSequenceEdges=function(e){this._sequenceEdges={cached:!0,edges:e},this._sequenceEdgesChanged$.next(this._sequenceEdges)},e.prototype.cacheSpatialEdges=function(e){this._spatialEdges={cached:!0,edges:e},this._spatialEdgesChanged$.next(this._spatialEdges)},e.prototype.dispose=function(){this._iamgeSubscription.unsubscribe(),this._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._imageChanged$.next(null),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()},e.prototype.resetSequenceEdges=function(){this._sequenceEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges)},e.prototype.resetSpatialEdges=function(){this._spatialEdges={cached:!1,edges:[]},this._spatialEdgesChanged$.next(this._spatialEdges)},e.prototype._cacheImage$=function(o,e){var s=this;return a.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",u.Urls.thumbnail(o,e,u.Urls.origin),!0),i.responseType="arraybuffer",i.timeout=15e3,i.onload=function(t){if(200!==i.status)return s._imageRequest=null,void n.error(new Error("Failed to fetch image ("+o+"). Status: "+i.status+", "+i.statusText));var r=new Image;r.crossOrigin="Anonymous",r.onload=function(e){if(s._imageRequest=null,s._disposed)return window.URL.revokeObjectURL(r.src),void n.error(new Error("Image load was aborted ("+o+")"));n.next({loaded:{loaded:t.loaded,total:t.total},object:r}),n.complete()},r.onerror=function(e){s._imageRequest=null,n.error(new Error("Failed to load image ("+o+")"))};var e=new Blob([i.response]);r.src=window.URL.createObjectURL(e)},i.onprogress=function(e){s._disposed||n.next({loaded:{loaded:e.loaded,total:e.total},object:null})},i.onerror=function(e){s._imageRequest=null,n.error(new Error("Failed to fetch image ("+o+")"))},i.ontimeout=function(e){s._imageRequest=null,n.error(new Error("Image request timed out ("+o+")"))},i.onabort=function(e){s._imageRequest=null,n.error(new Error("Image request was aborted ("+o+")"))},(s._imageRequest=i).send(null)})},e.prototype._cacheMesh$=function(t,e){var i=this;return a.Observable.create(function(r){if(!e)return r.next(i._createEmptyMeshLoadStatus()),void r.complete();var n=new XMLHttpRequest;n.open("GET",u.Urls.protoMesh(t),!0),n.responseType="arraybuffer",n.timeout=15e3,n.onload=function(e){if(i._meshRequest=null,!i._disposed){var t=200===n.status?c.MeshReader.read(new o(n.response)):{faces:[],vertices:[]};r.next({loaded:{loaded:e.loaded,total:e.total},object:t}),r.complete()}},n.onprogress=function(e){i._disposed||r.next({loaded:{loaded:e.loaded,total:e.total},object:null})},n.onerror=function(e){i._meshRequest=null,console.error("Failed to cache mesh ("+t+")"),r.next(i._createEmptyMeshLoadStatus()),r.complete()},n.ontimeout=function(e){i._meshRequest=null,console.error("Mesh request timed out ("+t+")"),r.next(i._createEmptyMeshLoadStatus()),r.complete()},n.onabort=function(e){i._meshRequest=null,r.error(new Error("Mesh request was aborted ("+t+")"))},(i._meshRequest=n).send(null)})},e.prototype._createEmptyMeshLoadStatus=function(){return{loaded:{loaded:0,total:0},object:{faces:[],vertices:[]}}},e.prototype._disposeImage=function(){null!=this._image&&window.URL.revokeObjectURL(this._image.src),this._image=null},e}();r.NodeCache=e,r.default=e}).call(this,t("buffer").Buffer)},{"../Graph":278,"../Utils":284,buffer:7,rxjs:26,"rxjs/operators":224}],397:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e){this._key=e.key,this._keys=e.keys}return Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keys",{get:function(){return this._keys},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._key=null,this._keys=null},e.prototype.findNextKey=function(e){var t=this._keys.indexOf(e);return t+1>=this._keys.length||-1===t?null:this._keys[t+1]},e.prototype.findPrevKey=function(e){var t=this._keys.indexOf(e);return 0===t||-1===t?null:this._keys[t-1]},e}();r.Sequence=n,r.default=n},{}],398:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var S=e("three"),G=e("../../Edge"),V=e("../../Error"),n=e("../../Geo"),i=function(){function e(e,t,r){this._spatial=new n.Spatial,this._geoCoords=new n.GeoCoords,this._settings=null!=e?e:new G.EdgeCalculatorSettings,this._directions=null!=t?t:new G.EdgeCalculatorDirections,this._coefficients=null!=r?r:new G.EdgeCalculatorCoefficients}return e.prototype.getPotentialEdges=function(e,t,r){if(!e.full)throw new V.ArgumentMapillaryError("Node has to be full.");if(!e.merged)return[];for(var n=this._spatial.viewingDirection(e.rotation),i=this._spatial.angleToPlane(n.toArray(),[0,0,1]),o=[],s=0,a=t;s<a.length;s++){var c=a[s];if(c.merged&&c.key!==e.key){var u=this._geoCoords.geodeticToEnu(c.latLon.lat,c.latLon.lon,c.alt,e.latLon.lat,e.latLon.lon,e.alt),h=new S.Vector3(u[0],u[1],u[2]),l=h.length();if(!(l>this._settings.maxDistance&&r.indexOf(c.key)<0)){var p=this._spatial.angleBetweenVector2(n.x,n.y,h.x,h.y),f=this._spatial.angleToPlane(h.toArray(),[0,0,1]),d=this._spatial.viewingDirection(c.rotation),m=this._spatial.angleBetweenVector2(n.x,n.y,d.x,d.y),v=this._spatial.angleToPlane(d.toArray(),[0,0,1])-i,g=this._spatial.relativeRotationAngle(e.rotation,c.rotation),y=this._spatial.angleBetweenVector2(1,0,h.x,h.y),_=null!=c.sequenceKey&&null!=e.sequenceKey&&c.sequenceKey===e.sequenceKey,b=null==c.mergeCC&&null==e.mergeCC||c.mergeCC===e.mergeCC,x=c.userKey===e.userKey,w={capturedAt:c.capturedAt,croppedPano:c.pano&&!c.fullPano,directionChange:m,distance:l,fullPano:c.fullPano,key:c.key,motionChange:p,rotation:g,sameMergeCC:b,sameSequence:_,sameUser:x,sequenceKey:c.sequenceKey,verticalDirectionChange:v,verticalMotion:f,worldMotionAzimuth:y};o.push(w)}}}return o},e.prototype.computeSequenceEdges=function(e,t){if(!e.full)throw new V.ArgumentMapillaryError("Node has to be full.");if(e.sequenceKey!==t.key)throw new V.ArgumentMapillaryError("Node and sequence does not correspond.");var r=[],n=t.findNextKey(e.key);null!=n&&r.push({data:{direction:G.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:e.key,to:n});var i=t.findPrevKey(e.key);return null!=i&&r.push({data:{direction:G.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:e.key,to:i}),r},e.prototype.computeSimilarEdges=function(t,e){var r=this;if(!t.full)throw new V.ArgumentMapillaryError("Node has to be full.");for(var n=t.fullPano,i={},o=0,s=e;o<s.length;o++){if(null!=(d=s[o]).sequenceKey&&!d.sameSequence){if(n){if(!d.fullPano)continue}else if(!d.fullPano&&Math.abs(d.directionChange)>this._settings.similarMaxDirectionChange)continue;d.distance>this._settings.similarMaxDistance||d.sameUser&&Math.abs(d.capturedAt-t.capturedAt)<this._settings.similarMinTimeDifference||(null==i[d.sequenceKey]&&(i[d.sequenceKey]=[]),i[d.sequenceKey].push(d))}}var a=[],c=t.fullPano?function(e){return e.distance}:function(e){return r._coefficients.similarDistance*e.distance+r._coefficients.similarRotation*e.rotation};for(var u in i)if(i.hasOwnProperty(u)){for(var h=Number.MAX_VALUE,l=null,p=0,f=i[u];p<f.length;p++){var d,m=c(d=f[p]);m<h&&(h=m,l=d)}null!=l&&a.push(l)}return a.map(function(e){return{data:{direction:G.EdgeDirection.Similar,worldMotionAzimuth:e.worldMotionAzimuth},from:t.key,to:e.key}})},e.prototype.computeStepEdges=function(e,t,r,n){if(!e.full)throw new V.ArgumentMapillaryError("Node has to be full.");var i=[];if(e.pano)return i;for(var o in this._directions.steps)if(this._directions.steps.hasOwnProperty(o)){for(var s=this._directions.steps[o],a=Number.MAX_VALUE,c=null,u=null,h=0,l=t;h<l.length;h++){var p=l[h];if(!p.croppedPano&&!p.fullPano&&!(Math.abs(p.directionChange)>this._settings.stepMaxDirectionChange)){var f=this._spatial.angleDifference(s.motionChange,p.motionChange),d=this._spatial.angleDifference(p.directionChange,f),m=Math.max(Math.abs(f),Math.abs(d));if(!(Math.abs(m)>this._settings.stepMaxDrift)){var v=p.key;if(!s.useFallback||v!==r&&v!==n||(u=p),!(p.distance>this._settings.stepMaxDistance)){f=Math.sqrt(f*f+p.verticalMotion*p.verticalMotion);var g=this._coefficients.stepPreferredDistance*Math.abs(p.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*f/this._settings.stepMaxDrift+this._coefficients.stepRotation*p.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(p.sameSequence?0:1)+this._coefficients.stepMergeCCPenalty*(p.sameMergeCC?0:1);g<a&&(a=g,c=p)}}}}null!=(c=null==c?u:c)&&i.push({data:{direction:s.direction,worldMotionAzimuth:c.worldMotionAzimuth},from:e.key,to:c.key})}return i},e.prototype.computeTurnEdges=function(e,t){if(!e.full)throw new V.ArgumentMapillaryError("Node has to be full.");var r=[];if(e.pano)return r;for(var n in this._directions.turns)if(this._directions.turns.hasOwnProperty(n)){for(var i=this._directions.turns[n],o=Number.MAX_VALUE,s=null,a=0,c=t;a<c.length;a++){var u=c[a];if(!u.croppedPano&&!u.fullPano&&!(u.distance>this._settings.turnMaxDistance)){var h=i.direction!==G.EdgeDirection.TurnU&&u.distance<this._settings.turnMaxRigDistance&&Math.abs(u.directionChange)>this._settings.turnMinRigDirectionChange,l=this._spatial.angleDifference(i.directionChange,u.directionChange),p=void 0;if(h&&0<u.directionChange*i.directionChange&&Math.abs(u.directionChange)<Math.abs(i.directionChange))p=-Math.PI/2+Math.abs(u.directionChange);else{if(Math.abs(l)>this._settings.turnMaxDirectionChange)continue;var f=i.motionChange?this._spatial.angleDifference(i.motionChange,u.motionChange):0;f=Math.sqrt(f*f+u.verticalMotion*u.verticalMotion),p=this._coefficients.turnDistance*u.distance/this._settings.turnMaxDistance+this._coefficients.turnMotion*f/Math.PI+this._coefficients.turnSequencePenalty*(u.sameSequence?0:1)+this._coefficients.turnMergeCCPenalty*(u.sameMergeCC?0:1)}p<o&&(o=p,s=u)}}null!=s&&r.push({data:{direction:i.direction,worldMotionAzimuth:s.worldMotionAzimuth},from:e.key,to:s.key})}return r},e.prototype.computePerspectiveToPanoEdges=function(e,t){if(!e.full)throw new V.ArgumentMapillaryError("Node has to be full.");if(e.pano)return[];for(var r=Number.MAX_VALUE,n=null,i=0,o=t;i<o.length;i++){var s=o[i];if(s.fullPano){var a=this._coefficients.panoPreferredDistance*Math.abs(s.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(s.motionChange)/Math.PI+this._coefficients.panoMergeCCPenalty*(s.sameMergeCC?0:1);a<r&&(r=a,n=s)}}return null==n?[]:[{data:{direction:G.EdgeDirection.Pano,worldMotionAzimuth:n.worldMotionAzimuth},from:e.key,to:n.key}]},e.prototype.computePanoEdges=function(e,t){if(!e.full)throw new V.ArgumentMapillaryError("Node has to be full.");if(!e.fullPano)return[];for(var r=[],n=[],i=[],o=0,s=t;o<s.length;o++){if(!((b=s[o]).distance>this._settings.panoMaxDistance))if(b.fullPano){if(b.distance<this._settings.panoMinDistance)continue;n.push(b)}else{if(b.croppedPano)continue;for(var a in this._directions.panos)if(this._directions.panos.hasOwnProperty(a)){var c=this._directions.panos[a],u=this._spatial.angleDifference(b.directionChange,b.motionChange),h=this._spatial.angleDifference(c.directionChange,u);if(!(Math.abs(h)>this._settings.panoMaxStepTurnChange)){i.push([c.direction,b]);break}}}}for(var l=Math.PI/this._settings.panoMaxItems,p=[],f=[],d=0;d<this._settings.panoMaxItems;d++){for(var m=d/this._settings.panoMaxItems*2*Math.PI,v=Number.MAX_VALUE,g=null,y=0,_=n;y<_.length;y++){var b=_[y],x=this._spatial.angleDifference(m,b.motionChange);if(!(Math.abs(x)>l)){for(var w=Number.MAX_VALUE,S=0,M=p;S<M.length;S++){var C=M[S],E=Math.abs(this._spatial.angleDifference(C,b.motionChange));E<w&&(w=E)}if(!(w<=l))(D=this._coefficients.panoPreferredDistance*Math.abs(b.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(x)/l+this._coefficients.panoSequencePenalty*(b.sameSequence?0:1)+this._coefficients.panoMergeCCPenalty*(b.sameMergeCC?0:1))<v&&(v=D,g=b)}}null!=g?(p.push(g.motionChange),r.push({data:{direction:G.EdgeDirection.Pano,worldMotionAzimuth:g.worldMotionAzimuth},from:e.key,to:g.key})):f.push(m)}var T={};T[G.EdgeDirection.Pano]=p,T[G.EdgeDirection.StepForward]=[],T[G.EdgeDirection.StepLeft]=[],T[G.EdgeDirection.StepBackward]=[],T[G.EdgeDirection.StepRight]=[];for(var O=0,P=f;O<P.length;O++){var A=P[O],j=[];for(var a in this._directions.panos)if(this._directions.panos.hasOwnProperty(a)){c=this._directions.panos[a];for(var R=T[G.EdgeDirection.Pano].concat(T[c.direction]).concat(T[c.prev]).concat(T[c.next]),L=(v=Number.MAX_VALUE,g=null,0),N=i;L<N.length;L++){if((b=N[L])[0]===c.direction){var I=this._spatial.angleDifference(A,b[1].motionChange);if(!(Math.abs(I)>l)){for(var D,k=Number.MAX_VALUE,B=0,F=R;B<F.length;B++){C=F[B];(w=Math.abs(this._spatial.angleDifference(C,b[1].motionChange)))<k&&(k=w)}if(!(k<=l))(D=this._coefficients.panoPreferredDistance*Math.abs(b[1].distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(I)/l+this._coefficients.panoMergeCCPenalty*(b[1].sameMergeCC?0:1))<v&&(v=D,g=b)}}}null!=g&&(j.push(g),r.push({data:{direction:g[0],worldMotionAzimuth:g[1].worldMotionAzimuth},from:e.key,to:g[1].key}))}for(var $=0,U=j;$<U.length;$++){var z=U[$];T[z[0]].push(z[1].motionChange)}}return r},e}();r.EdgeCalculator=i,r.default=i},{"../../Edge":275,"../../Error":276,"../../Geo":277,three:225}],399:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=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},{}],400:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../../Edge"),i=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":275}],401:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(){this.panoMinDistance=.1,this.panoMaxDistance=20,this.panoPreferredDistance=5,this.panoMaxItems=4,this.panoMaxStepTurnChange=Math.PI/8,this.rotationMaxDistance=this.turnMaxRigDistance,this.rotationMaxDirectionChange=Math.PI/6,this.rotationMaxVerticalDirectionChange=Math.PI/8,this.similarMaxDirectionChange=Math.PI/8,this.similarMaxDistance=12,this.similarMinTimeDifference=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(e.prototype,"maxDistance",{get:function(){return Math.max(this.panoMaxDistance,this.similarMaxDistance,this.stepMaxDistance,this.turnMaxDistance)},enumerable:!0,configurable:!0}),e}();r.EdgeCalculatorSettings=n,r.default=n},{}],402:[function(e,t,r){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0}),(n=r.EdgeDirection||(r.EdgeDirection={}))[n.Next=0]="Next",n[n.Prev=1]="Prev",n[n.StepLeft=2]="StepLeft",n[n.StepRight=3]="StepRight",n[n.StepForward=4]="StepForward",n[n.StepBackward=5]="StepBackward",n[n.TurnLeft=6]="TurnLeft",n[n.TurnRight=7]="TurnRight",n[n.TurnU=8]="TurnU",n[n.Pano=9]="Pano",n[n.Similar=10]="Similar"},{}],403:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs"),o=e("rxjs/operators"),s=e("virtual-dom"),a=e("rxjs"),c=e("../Render"),n=function(){function e(e,t,r){this._adaptiveOperation$=new a.Subject,this._render$=new a.Subject,this._renderAdaptive$=new a.Subject,this._renderService=t,this._currentFrame$=r;var n=s.create(s.h("div.domRenderer",[]));e.appendChild(n),this._offset$=this._adaptiveOperation$.pipe(o.scan(function(e,t){return t(e)},{elementHeight:e.offsetHeight,elementWidth:e.offsetWidth,imageAspect:0,renderMode:c.RenderMode.Fill}),o.filter(function(e){return 0<e.imageAspect&&0<e.elementWidth&&0<e.elementHeight}),o.map(function(e){var t=e.elementWidth/e.elementHeight,r=e.imageAspect/t,n=0,i=0;return e.renderMode===c.RenderMode.Letterbox?e.imageAspect>t?n=e.elementHeight*(1-1/r)/2:i=e.elementWidth*(1-r)/2:e.imageAspect>t?i=-e.elementWidth*(r-1)/2:n=-e.elementHeight*(1/r-1)/2,{bottom:n,left:i,right:i,top:n}})),this._currentFrame$.pipe(o.filter(function(e){return null!=e.state.currentNode}),o.distinctUntilChanged(function(e,t){return e===t},function(e){return e.state.currentNode.key}),o.map(function(e){return e.state.currentTransform.basicAspect}),o.map(function(t){return function(e){return e.imageAspect=t,e}})).subscribe(this._adaptiveOperation$),i.combineLatest(this._renderAdaptive$.pipe(o.scan(function(e,t){return null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e},{})),this._offset$).pipe(o.map(function(e){var t=[],r=e[0];for(var n in r)r.hasOwnProperty(n)&&t.push(r[n]);var i=e[1],o={style:{bottom:i.bottom+"px",left:i.left+"px","pointer-events":"none",position:"absolute",right:i.right+"px",top:i.top+"px"}};return{name:"adaptiveDomRenderer",vnode:s.h("div.adaptiveDomRenderer",o,t)}})).subscribe(this._render$),this._vNode$=this._render$.pipe(o.scan(function(e,t){return null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e},{}),o.map(function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return s.h("div.domRenderer",t)})),this._vPatch$=this._vNode$.pipe(o.scan(function(e,t){return e.vpatch=s.diff(e.vnode,t),e.vnode=t,e},{vnode:s.h("div.domRenderer",[]),vpatch:null}),o.pluck("vpatch")),this._element$=this._vPatch$.pipe(o.scan(function(e,t){return s.patch(e,t)},n),o.publishReplay(1),o.refCount()),this._element$.subscribe(function(){}),this._renderService.size$.pipe(o.map(function(t){return function(e){return e.elementWidth=t.width,e.elementHeight=t.height,e}})).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.pipe(o.map(function(t){return function(e){return e.renderMode=t,e}})).subscribe(this._adaptiveOperation$)}return Object.defineProperty(e.prototype,"element$",{get:function(){return this._element$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderAdaptive$",{get:function(){return this._renderAdaptive$},enumerable:!0,configurable:!0}),e.prototype.clear=function(e){this._renderAdaptive$.next({name:e,vnode:null}),this._render$.next({name:e,vnode:null})},e}();r.DOMRenderer=n,r.default=n},{"../Render":280,rxjs:26,"rxjs/operators":224,"virtual-dom":230}],404:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.GLRenderStage||(r.GLRenderStage={}))[i.Background=0]="Background",i[i.Foreground=1]="Foreground",r.default=n},{}],405:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var h=e("rxjs"),l=e("rxjs/operators"),p=e("three"),f=e("../Render"),d=e("../Utils"),n=function(){function e(i,o,e){var s=this;this._renderFrame$=new h.Subject,this._renderCameraOperation$=new h.Subject,this._render$=new h.Subject,this._clear$=new h.Subject,this._renderOperation$=new h.Subject,this._rendererOperation$=new h.Subject,this._eraserOperation$=new h.Subject,this._renderService=o,this._dom=e||new d.DOM,this._renderer$=this._rendererOperation$.pipe(l.scan(function(e,t){return t(e)},{needsRender:!1,renderer:null}),l.filter(function(e){return!!e.renderer})),this._renderCollection$=this._renderOperation$.pipe(l.scan(function(e,t){return t(e)},{}),l.share()),this._renderCamera$=this._renderCameraOperation$.pipe(l.scan(function(e,t){return t(e)},{frameId:-1,needsRender:!1,perspective:null})),this._eraser$=this._eraserOperation$.pipe(l.startWith(function(e){return e}),l.scan(function(e,t){return t(e)},{needsRender:!1})),h.combineLatest(this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$).pipe(l.map(function(e){var t=e[0],r=e[1];return{camera:e[2],eraser:e[3],renderer:t,renders:Object.keys(r).map(function(e){return r[e]})}}),l.filter(function(e){for(var t=e.renderer.needsRender||e.camera.needsRender||e.eraser.needsRender,r=e.camera.frameId,n=0,i=e.renders;n<i.length;n++){var o=i[n];if(o.frameId!==r)return!1;t=t||o.needsRender}return t}),l.distinctUntilChanged(function(e,t){return e===t},function(e){return e.eraser.needsRender?-1:e.camera.frameId})).subscribe(function(e){e.renderer.needsRender=!1,e.camera.needsRender=!1,e.eraser.needsRender=!1;for(var t=e.camera.perspective,r=[],n=[],i=0,o=e.renders;i<o.length;i++){(l=o[i]).stage===f.GLRenderStage.Background?r.push(l.render):l.stage===f.GLRenderStage.Foreground&&n.push(l.render)}var s=e.renderer.renderer;s.clear();for(var a=0,c=r;a<c.length;a++){(l=c[a])(t,s)}s.clearDepth();for(var u=0,h=n;u<h.length;u++){var l;(l=h[u])(t,s)}}),this._renderFrame$.pipe(l.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 t=this._render$.pipe(l.map(function(t){return function(e){return e[t.name]=t.render,e}})),r=this._clear$.pipe(l.map(function(t){return function(e){return delete e[t],e}}));h.merge(t,r).subscribe(this._renderOperation$),this._webGLRenderer$=this._render$.pipe(l.first(),l.map(function(e){var t=s._dom.createElement("canvas","mapillary-js-canvas");t.style.position="absolute",t.setAttribute("tabindex","0"),i.appendChild(t);var r=o.element,n=new p.WebGLRenderer({canvas:t});return n.setPixelRatio(window.devicePixelRatio),n.setSize(r.offsetWidth,r.offsetHeight),n.setClearColor(new p.Color(2105376),1),n.autoClear=!1,n}),l.publishReplay(1),l.refCount()),this._webGLRenderer$.subscribe(function(){});var n=this._webGLRenderer$.pipe(l.first(),l.map(function(t){return function(e){return e.needsRender=!0,e.renderer=t,e}})),a=this._renderService.size$.pipe(l.map(function(t){return function(e){return null==e.renderer||(e.renderer.setSize(t.width,t.height),e.needsRender=!0),e}})),c=this._clear$.pipe(l.map(function(e){return function(e){return null==e.renderer||(e.needsRender=!0),e}}));h.merge(n,a,c).subscribe(this._rendererOperation$);var u=this._renderCollection$.pipe(l.filter(function(e){return 0===Object.keys(e).length}),l.share());u.subscribe(function(e){null!=s._renderFrameSubscription&&(s._renderFrameSubscription.unsubscribe(),s._renderFrameSubscription=null,s._renderFrameSubscribe())}),u.pipe(l.map(function(e){return function(e){return e.needsRender=!0,e}})).subscribe(this._eraserOperation$)}return Object.defineProperty(e.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"webGLRenderer$",{get:function(){return this._webGLRenderer$},enumerable:!0,configurable:!0}),e.prototype.clear=function(e){this._clear$.next(e)},e.prototype._renderFrameSubscribe=function(){var t=this;this._render$.pipe(l.first(),l.map(function(e){return function(e){return e.needsRender=!0,e}})).subscribe(function(e){t._renderCameraOperation$.next(e)}),this._renderFrameSubscription=this._render$.pipe(l.first(),l.mergeMap(function(e){return t._renderService.renderCameraFrame$})).subscribe(this._renderFrame$)},e}();r.GLRenderer=n,r.default=n},{"../Render":280,"../Utils":284,rxjs:26,"rxjs/operators":224,three:225}],406:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var h=e("three"),n=e("../Geo"),s=e("../Render"),a=e("../State"),i=function(){function e(e,t,r){this._spatial=new n.Spatial,this._viewportCoords=new n.ViewportCoords,this._initialFov=50,this._alpha=-1,this._renderMode=r,this._zoom=0,this._frameId=-1,this._changed=!1,this._changedForFrame=-1,this._currentNodeId=null,this._previousNodeId=null,this._currentPano=!1,this._previousPano=!1,this._state=null,this._currentProjectedPoints=[],this._previousProjectedPoints=[],this._currentFov=this._initialFov,this._previousFov=this._initialFov,this._camera=new n.Camera,this._perspective=new h.PerspectiveCamera(this._initialFov,this._computeAspect(e,t),.16,1e4),this._perspective.matrixAutoUpdate=!1,this._rotation={phi:0,theta:0}}return Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed",{get:function(){return this._frameId===this._changedForFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"perspective",{get:function(){return this._perspective},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderMode",{get:function(){return this._renderMode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this._rotation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zoom",{get:function(){return this._zoom},enumerable:!0,configurable:!0}),e.prototype.setFrame=function(e){var t=e.state;t.state!==this._state&&(this._state=t.state,this._changed=!0);var r=t.currentNode.key,n=t.previousNode?t.previousNode.key:null;r!==this._currentNodeId&&(this._currentNodeId=r,this._currentPano=!!t.currentTransform.gpano,this._currentProjectedPoints=this._computeProjectedPoints(t.currentTransform),this._changed=!0),n!==this._previousNodeId&&(this._previousNodeId=n,this._previousPano=!!t.previousTransform.gpano,this._previousProjectedPoints=this._computeProjectedPoints(t.previousTransform),this._changed=!0);var i=t.zoom;i!==this._zoom&&(this._zoom=i,this._changed=!0),this._changed&&(this._currentFov=this._computeCurrentFov(),this._previousFov=this._computePreviousFov());var o=t.alpha;(this._changed||o!==this._alpha)&&(this._alpha=o,this._perspective.fov=this._state===a.State.Earth?60:this._interpolateFov(this._currentFov,this._previousFov,this._alpha),this._changed=!0);var s=t.camera;1e-9<this._camera.diff(s)&&(this._camera.copy(s),this._rotation=this._computeRotation(s),this._perspective.up.copy(s.up),this._perspective.position.copy(s.position),this._perspective.lookAt(s.lookat),this._perspective.updateMatrix(),this._perspective.updateMatrixWorld(!1),this._changed=!0),this._changed&&this._perspective.updateProjectionMatrix(),this._setFrameId(e.id)},e.prototype.setRenderMode=function(e){this._renderMode=e,this._perspective.fov=this._computeFov(),this._perspective.updateProjectionMatrix(),this._changed=!0},e.prototype.setSize=function(e){this._perspective.aspect=this._computeAspect(e.width,e.height),this._perspective.fov=this._computeFov(),this._perspective.updateProjectionMatrix(),this._changed=!0},e.prototype._computeAspect=function(e,t){return 0===e?0:e/t},e.prototype._computeCurrentFov=function(){return this._currentNodeId?this._currentPano?this._yToFov(1,this._zoom):this._computeVerticalFov(this._currentProjectedPoints,this._renderMode,this._zoom,this.perspective.aspect):this._initialFov},e.prototype._computeFov=function(){return this._currentFov=this._computeCurrentFov(),this._previousFov=this._computePreviousFov(),this._interpolateFov(this._currentFov,this._previousFov,this._alpha)},e.prototype._computePreviousFov=function(){return this._currentNodeId?this._previousNodeId?this._previousPano?this._yToFov(1,this._zoom):this._computeVerticalFov(this._previousProjectedPoints,this._renderMode,this._zoom,this.perspective.aspect):this._currentFov:this._initialFov},e.prototype._computeProjectedPoints=function(n){for(var i=this,e=[[.5,0],[1,0]],t=[[.5,0],[0,.5]],r=[],o=0;o<e.length;++o)for(var s=e[o],a=t[o],c=0;c<=100;++c)r.push([s[0]+a[0]*c/100,s[1]+a[1]*c/100]);var u=new h.Camera;return u.up.copy(n.upVector()),u.position.copy((new h.Vector3).fromArray(n.unprojectSfM([0,0],0))),u.lookAt((new h.Vector3).fromArray(n.unprojectSfM([0,0],10))),u.updateMatrix(),u.updateMatrixWorld(!0),r.map(function(e){var t=n.unprojectBasic(e,1e4),r=i._viewportCoords.worldToCamera(t,u);return[Math.abs(r[0]/r[2]),Math.abs(r[1]/r[2])]})},e.prototype._computeRequiredVerticalFov=function(e,t,r){var n=Math.max(e[0]/r,e[1]);return this._yToFov(n,t)},e.prototype._computeRotation=function(e){var t=e.lookat.clone().sub(e.position),r=e.up.clone(),n=t.clone().dot(r),i=t.clone().sub(r.clone().multiplyScalar(n));return{phi:Math.atan2(i.y,i.x),theta:Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1])}},e.prototype._computeVerticalFov=function(e,t,r,n){var i=this,o=e.map(function(e){return i._computeRequiredVerticalFov(e,r,n)});return t===s.RenderMode.Fill?.995*Math.min.apply(Math,o):Math.max.apply(Math,o)},e.prototype._yToFov=function(e,t){return 2*Math.atan(e/Math.pow(2,t))*180/Math.PI},e.prototype._interpolateFov=function(e,t,r){return r*e+(1-r)*t},e.prototype._setFrameId=function(e){this._frameId=e,this._changed&&(this._changed=!1,this._changedForFrame=e)},e}();r.RenderCamera=i,r.default=i},{"../Geo":277,"../Render":280,"../State":281,three:225}],407:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.RenderMode||(r.RenderMode={}))[i.Letterbox=0]="Letterbox",i[i.Fill=1]="Fill",r.default=n},{}],408:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs/operators"),s=e("rxjs"),a=e("../Geo"),c=e("../Render"),n=function(){function e(e,t,r,n){var i=this;this._element=e,this._currentFrame$=t,this._spatial=new a.Spatial,r=null!=r?r:c.RenderMode.Fill,this._resize$=new s.Subject,this._renderCameraOperation$=new s.Subject,this._size$=new s.BehaviorSubject({height:this._element.offsetHeight,width:this._element.offsetWidth}),this._resize$.pipe(o.map(function(){return{height:i._element.offsetHeight,width:i._element.offsetWidth}})).subscribe(this._size$),this._renderMode$=new s.BehaviorSubject(r),this._renderCameraHolder$=this._renderCameraOperation$.pipe(o.startWith(function(e){return e}),o.scan(function(e,t){return t(e)},n||new c.RenderCamera(this._element.offsetWidth,this._element.offsetHeight,r)),o.publishReplay(1),o.refCount()),this._renderCameraFrame$=this._currentFrame$.pipe(o.withLatestFrom(this._renderCameraHolder$),o.tap(function(e){var t=e[0];e[1].setFrame(t)}),o.map(function(e){return e[1]}),o.publishReplay(1),o.refCount()),this._renderCamera$=this._renderCameraFrame$.pipe(o.filter(function(e){return e.changed}),o.publishReplay(1),o.refCount()),this._bearing$=this._renderCamera$.pipe(o.map(function(e){var t=i._spatial.radToDeg(i._spatial.azimuthalToBearing(e.rotation.phi));return i._spatial.wrap(t,0,360)}),o.publishReplay(1),o.refCount()),this._size$.pipe(o.skip(1),o.map(function(t){return function(e){return e.setSize(t),e}})).subscribe(this._renderCameraOperation$),this._renderMode$.pipe(o.skip(1),o.map(function(t){return function(e){return e.setRenderMode(t),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(e.prototype,"bearing$",{get:function(){return this._bearing$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this._element},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"resize$",{get:function(){return this._resize$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size$",{get:function(){return this._size$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderMode$",{get:function(){return this._renderMode$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderCameraFrame$",{get:function(){return this._renderCameraFrame$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderCamera$",{get:function(){return this._renderCamera$},enumerable:!0,configurable:!0}),e}();r.RenderService=n,r.default=n},{"../Geo":277,"../Render":280,rxjs:26,"rxjs/operators":224}],409:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(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)})}return Object.defineProperty(e.prototype,"cancelAnimationFrame",{get:function(){return this._cancelAnimationFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requestAnimationFrame",{get:function(){return this._requestAnimationFrame},enumerable:!0,configurable:!0}),e}();r.FrameGenerator=n,r.default=n},{}],410:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){this._phi=e,this._theta=t}return Object.defineProperty(e.prototype,"phi",{get:function(){return this._phi},set:function(e){this._phi=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"theta",{get:function(){return this._theta},set:function(e){this._theta=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isZero",{get:function(){return 0===this._phi&&0===this._theta},enumerable:!0,configurable:!0}),e.prototype.copy=function(e){this._phi=e.phi,this._theta=e.theta},e.prototype.lerp=function(e,t){this._phi=(1-t)*this._phi+t*e.phi,this._theta=(1-t)*this._theta+t*e.theta},e.prototype.multiply=function(e){this._phi*=e,this._theta*=e},e.prototype.threshold=function(e){this._phi=Math.abs(this._phi)>e?this._phi:0,this._theta=Math.abs(this._theta)>e?this._theta:0},e.prototype.lengthSquared=function(){return this._phi*this._phi+this._theta*this._theta},e.prototype.reset=function(){this._phi=0,this._theta=0},e}();r.RotationDelta=n,r.default=n},{}],411:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.State||(r.State={}))[i.Earth=0]="Earth",i[i.Traversing=1]="Traversing",i[i.Waiting=2]="Waiting",i[i.WaitingInteractively=3]="WaitingInteractively",r.default=n},{}],412:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../State"),i=e("../Geo"),o=function(){function e(e){this._state=new n.TraversingState({alpha:1,camera:new i.Camera,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],transitionMode:null==e?n.TransitionMode.Default:e,zoom:0})}return e.prototype.earth=function(){this._state=this._state.earth()},e.prototype.traverse=function(){this._state=this._state.traverse()},e.prototype.wait=function(){this._state=this._state.wait()},e.prototype.waitInteractively=function(){this._state=this._state.waitInteractively()},Object.defineProperty(e.prototype,"state",{get:function(){if(this._state instanceof n.EarthState)return n.State.Earth;if(this._state instanceof n.TraversingState)return n.State.Traversing;if(this._state instanceof n.WaitingState)return n.State.Waiting;if(this._state instanceof n.InteractiveWaitingState)return n.State.WaitingInteractively;throw new Error("Invalid state")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reference",{get:function(){return this._state.reference},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._state.alpha},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._state.camera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zoom",{get:function(){return this._state.zoom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentNode",{get:function(){return this._state.currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousNode",{get:function(){return this._state.previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentCamera",{get:function(){return this._state.currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTransform",{get:function(){return this._state.currentTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousTransform",{get:function(){return this._state.previousTransform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trajectory",{get:function(){return this._state.trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastNode",{get:function(){return this._state.trajectory[this._state.trajectory.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nodesAhead",{get:function(){return this._state.trajectory.length-1-this._state.currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"motionless",{get:function(){return this._state.motionless},enumerable:!0,configurable:!0}),e.prototype.getCenter=function(){return this._state.getCenter()},e.prototype.setCenter=function(e){this._state.setCenter(e)},e.prototype.setZoom=function(e){this._state.setZoom(e)},e.prototype.update=function(e){this._state.update(e)},e.prototype.append=function(e){this._state.append(e)},e.prototype.prepend=function(e){this._state.prepend(e)},e.prototype.remove=function(e){this._state.remove(e)},e.prototype.clear=function(){this._state.clear()},e.prototype.clearPrior=function(){this._state.clearPrior()},e.prototype.cut=function(){this._state.cut()},e.prototype.set=function(e){this._state.set(e)},e.prototype.rotate=function(e){this._state.rotate(e)},e.prototype.rotateUnbounded=function(e){this._state.rotateUnbounded(e)},e.prototype.rotateWithoutInertia=function(e){this._state.rotateWithoutInertia(e)},e.prototype.rotateBasic=function(e){this._state.rotateBasic(e)},e.prototype.rotateBasicUnbounded=function(e){this._state.rotateBasicUnbounded(e)},e.prototype.rotateBasicWithoutInertia=function(e){this._state.rotateBasicWithoutInertia(e)},e.prototype.rotateToBasic=function(e){this._state.rotateToBasic(e)},e.prototype.move=function(e){this._state.move(e)},e.prototype.moveTo=function(e){this._state.moveTo(e)},e.prototype.zoomIn=function(e,t){this._state.zoomIn(e,t)},e.prototype.setSpeed=function(e){this._state.setSpeed(e)},e.prototype.setTransitionMode=function(e){this._state.setTransitionMode(e)},e.prototype.dolly=function(e){this._state.dolly(e)},e.prototype.orbit=function(e){this._state.orbit(e)},e.prototype.truck=function(e){this._state.truck(e)},e}();r.StateContext=o},{"../Geo":277,"../State":281}],413:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs"),o=e("rxjs/operators"),s=e("../State"),n=function(){function e(e){var t=this;this._appendNode$=new i.Subject,this._start$=new i.Subject,this._frame$=new i.Subject,this._fpsSampleRate=30,this._contextOperation$=new i.BehaviorSubject(function(e){return e}),this._context$=this._contextOperation$.pipe(o.scan(function(e,t){return t(e)},new s.StateContext(e)),o.publishReplay(1),o.refCount()),this._state$=this._context$.pipe(o.map(function(e){return e.state}),o.distinctUntilChanged(),o.publishReplay(1),o.refCount()),this._fps$=this._start$.pipe(o.switchMap(function(){return t._frame$.pipe(o.bufferCount(1,t._fpsSampleRate),o.map(function(e){return(new Date).getTime()}),o.pairwise(),o.map(function(e){return Math.max(20,1e3*t._fpsSampleRate/(e[1]-e[0]))}),o.startWith(60))}),o.share()),this._currentState$=this._frame$.pipe(o.withLatestFrom(this._fps$,this._context$,function(e,t,r){return[e,t,r]}),o.filter(function(e){return null!=e[2].currentNode}),o.tap(function(e){e[2].update(e[1])}),o.map(function(e){return{fps:e[1],id:e[0],state:e[2]}}),o.share()),this._lastState$=this._currentState$.pipe(o.publishReplay(1),o.refCount());var r=this._currentState$.pipe(o.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}),o.publishReplay(1),o.refCount()),n=new i.Subject;r.subscribe(n),this._currentKey$=new i.BehaviorSubject(null),n.pipe(o.map(function(e){return e.state.currentNode.key})).subscribe(this._currentKey$),this._currentNode$=n.pipe(o.map(function(e){return e.state.currentNode}),o.publishReplay(1),o.refCount()),this._currentCamera$=n.pipe(o.map(function(e){return e.state.currentCamera}),o.publishReplay(1),o.refCount()),this._currentTransform$=n.pipe(o.map(function(e){return e.state.currentTransform}),o.publishReplay(1),o.refCount()),this._reference$=n.pipe(o.map(function(e){return e.state.reference}),o.distinctUntilChanged(function(e,t){return e.lat===t.lat&&e.lon===t.lon},function(e){return{lat:e.lat,lon:e.lon}}),o.publishReplay(1),o.refCount()),this._currentNodeExternal$=r.pipe(o.map(function(e){return e.state.currentNode}),o.publishReplay(1),o.refCount()),this._appendNode$.pipe(o.map(function(t){return function(e){return e.append([t]),e}})).subscribe(this._contextOperation$),this._inMotionOperation$=new i.Subject,r.pipe(o.map(function(e){return!0})).subscribe(this._inMotionOperation$),this._inMotionOperation$.pipe(o.distinctUntilChanged(),o.filter(function(e){return e}),o.switchMap(function(e){return t._currentState$.pipe(o.filter(function(e){return 0===e.state.nodesAhead}),o.map(function(e){return[e.state.camera.clone(),e.state.zoom]}),o.pairwise(),o.map(function(e){var t=e[0][0],r=e[1][0],n=e[0][1],i=e[1][1];return 1e-5<t.diff(r)||1e-5<Math.abs(n-i)}),o.first(function(e){return!e}))})).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.pipe(o.distinctUntilChanged(),o.publishReplay(1),o.refCount()),this._inTranslationOperation$=new i.Subject,r.pipe(o.map(function(e){return!0})).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.pipe(o.distinctUntilChanged(),o.filter(function(e){return e}),o.switchMap(function(e){return t._currentState$.pipe(o.filter(function(e){return 0===e.state.nodesAhead}),o.map(function(e){return e.state.camera.position.clone()}),o.pairwise(),o.map(function(e){return 0!==e[0].distanceToSquared(e[1])}),o.first(function(e){return!e}))})).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.pipe(o.distinctUntilChanged(),o.publishReplay(1),o.refCount()),this._state$.subscribe(function(){}),this._currentNode$.subscribe(function(){}),this._currentCamera$.subscribe(function(){}),this._currentTransform$.subscribe(function(){}),this._reference$.subscribe(function(){}),this._currentNodeExternal$.subscribe(function(){}),this._lastState$.subscribe(function(){}),this._inMotion$.subscribe(function(){}),this._inTranslation$.subscribe(function(){}),this._frameId=null,this._frameGenerator=new s.FrameGenerator(window)}return Object.defineProperty(e.prototype,"currentState$",{get:function(){return this._currentState$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentNode$",{get:function(){return this._currentNode$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentKey$",{get:function(){return this._currentKey$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentNodeExternal$",{get:function(){return this._currentNodeExternal$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentCamera$",{get:function(){return this._currentCamera$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTransform$",{get:function(){return this._currentTransform$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state$",{get:function(){return this._state$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reference$",{get:function(){return this._reference$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inMotion$",{get:function(){return this._inMotion$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inTranslation$",{get:function(){return this._inTranslation$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"appendNode$",{get:function(){return this._appendNode$},enumerable:!0,configurable:!0}),e.prototype.earth=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.earth()})},e.prototype.traverse=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.traverse()})},e.prototype.wait=function(){this._invokeContextOperation(function(e){e.wait()})},e.prototype.waitInteractively=function(){this._invokeContextOperation(function(e){e.waitInteractively()})},e.prototype.appendNodes=function(t){this._invokeContextOperation(function(e){e.append(t)})},e.prototype.prependNodes=function(t){this._invokeContextOperation(function(e){e.prepend(t)})},e.prototype.removeNodes=function(t){this._invokeContextOperation(function(e){e.remove(t)})},e.prototype.clearNodes=function(){this._invokeContextOperation(function(e){e.clear()})},e.prototype.clearPriorNodes=function(){this._invokeContextOperation(function(e){e.clearPrior()})},e.prototype.cutNodes=function(){this._invokeContextOperation(function(e){e.cut()})},e.prototype.setNodes=function(t){this._invokeContextOperation(function(e){e.set(t)})},e.prototype.rotate=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotate(t)})},e.prototype.rotateUnbounded=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateUnbounded(t)})},e.prototype.rotateWithoutInertia=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateWithoutInertia(t)})},e.prototype.rotateBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasic(t)})},e.prototype.rotateBasicUnbounded=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasicUnbounded(t)})},e.prototype.rotateBasicWithoutInertia=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateBasicWithoutInertia(t)})},e.prototype.rotateToBasic=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.rotateToBasic(t)})},e.prototype.move=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.move(t)})},e.prototype.moveTo=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.moveTo(t)})},e.prototype.dolly=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.dolly(t)})},e.prototype.orbit=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.orbit(t)})},e.prototype.truck=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.truck(t)})},e.prototype.zoomIn=function(t,r){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.zoomIn(t,r)})},e.prototype.getCenter=function(){return this._lastState$.pipe(o.first(),o.map(function(e){return e.state.getCenter()}))},e.prototype.getZoom=function(){return this._lastState$.pipe(o.first(),o.map(function(e){return e.state.zoom}))},e.prototype.setCenter=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setCenter(t)})},e.prototype.setSpeed=function(t){this._invokeContextOperation(function(e){e.setSpeed(t)})},e.prototype.setTransitionMode=function(t){this._invokeContextOperation(function(e){e.setTransitionMode(t)})},e.prototype.setZoom=function(t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.setZoom(t)})},e.prototype.start=function(){null==this._frameId&&(this._start$.next(null),this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId))},e.prototype.stop=function(){null!=this._frameId&&(this._frameGenerator.cancelAnimationFrame(this._frameId),this._frameId=null)},e.prototype._invokeContextOperation=function(t){this._contextOperation$.next(function(e){return t(e),e})},e.prototype._frame=function(e){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)},e}();r.StateService=n},{"../State":281,rxjs:26,"rxjs/operators":224}],414:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.TransitionMode||(r.TransitionMode={}))[i.Default=0]="Default",i[i.Instantaneous=1]="Instantaneous",r.default=n},{}],415:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var c=e("three"),o=e("../../State"),s=function(n){function e(e){var t=n.call(this,e)||this,r=t._camera.lookat.clone().sub(t._camera.position).normalize();return t._camera.lookat.copy(t._camera.position),t._camera.position.z=e.camera.position.z+20,t._camera.position.x=e.camera.position.x-16*r.x,t._camera.position.y=e.camera.position.y-16*r.y,t._camera.up.set(0,0,1),t}return i(e,n),e.prototype.traverse=function(){return new o.TraversingState(this)},e.prototype.wait=function(){return new o.WaitingState(this)},e.prototype.waitInteractively=function(){return new o.InteractiveWaitingState(this)},e.prototype.dolly=function(e){var t=this._camera,r=(new c.Vector3).copy(t.position).sub(t.lookat),n=r.length()*Math.pow(2,-e),i=Math.max(1,Math.min(n,1e3));r.normalize(),r.multiplyScalar(i),t.position.copy(t.lookat).add(r)},e.prototype.orbit=function(e){var t=this._camera,r=(new c.Quaternion).setFromUnitVectors(t.up,new c.Vector3(0,0,1)),n=r.clone().inverse(),i=new c.Vector3;i.copy(t.position).sub(t.lookat),i.applyQuaternion(r);var o=i.length(),s=Math.atan2(i.y,i.x);s+=e.phi;var a=Math.atan2(Math.sqrt(i.x*i.x+i.y*i.y),i.z);a+=e.theta,a=Math.max(.1,Math.min(Math.PI-.1,a)),i.x=Math.sin(a)*Math.cos(s),i.y=Math.sin(a)*Math.sin(s),i.z=Math.cos(a),i.applyQuaternion(n),t.position.copy(t.lookat).add(i.multiplyScalar(o))},e.prototype.truck=function(e){this._camera.position.add((new c.Vector3).fromArray(e)),this._camera.lookat.add((new c.Vector3).fromArray(e))},e.prototype.update=function(){},e}(o.StateBase);r.EarthState=s,r.default=s},{"../../State":281,three:225}],416:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var p=e("three"),o=e("../../State"),s=function(r){function e(e){var t=r.call(this,e)||this;return t._animationSpeed=.025,t._rotationDelta=new o.RotationDelta(0,0),t._requestedRotationDelta=null,t._basicRotation=[0,0],t._requestedBasicRotation=null,t._requestedBasicRotationUnbounded=null,t._rotationAcceleration=.86,t._rotationIncreaseAlpha=.97,t._rotationDecreaseAlpha=.9,t._rotationThreshold=.001,t._unboundedRotationAlpha=.8,t._desiredZoom=e.zoom,t._minZoom=0,t._maxZoom=3,t._lookatDepth=10,t._desiredLookat=null,t._desiredCenter=null,t}return i(e,r),e.prototype.rotate=function(e){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,(this._requestedBasicRotation=null)!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+e.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+e.theta):this._requestedRotationDelta=new o.RotationDelta(e.phi,e.theta))},e.prototype.rotateUnbounded=function(e){if(null!=this._currentNode&&(this._requestedBasicRotation=null,this._requestedRotationDelta=null,this._applyRotation(e,this._currentCamera),this._applyRotation(e,this._previousCamera),this._desiredLookat)){var t=(new p.Quaternion).setFromUnitVectors(this._currentCamera.up,new p.Vector3(0,0,1)),r=t.clone().inverse(),n=(new p.Vector3).copy(this._desiredLookat).sub(this._camera.position).applyQuaternion(t),i=n.length(),o=Math.atan2(n.y,n.x);o+=e.phi;var s=Math.atan2(Math.sqrt(n.x*n.x+n.y*n.y),n.z);s+=e.theta,s=Math.max(.1,Math.min(Math.PI-.1,s)),n.x=Math.sin(s)*Math.cos(o),n.y=Math.sin(s)*Math.sin(o),n.z=Math.cos(s),n.applyQuaternion(r),this._desiredLookat.copy(this._camera.position).add(n.multiplyScalar(i))}},e.prototype.rotateWithoutInertia=function(e){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedBasicRotation=null,this._requestedRotationDelta=null;var t=Math.PI/(10*Math.pow(2,this._zoom)),r={phi:this._spatial.clamp(e.phi,-t,t),theta:this._spatial.clamp(e.theta,-t,t)};this._applyRotation(r,this._currentCamera),this._applyRotation(r,this._previousCamera)}},e.prototype.rotateBasic=function(e){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,(this._requestedRotationDelta=null)!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=e[0],this._requestedBasicRotation[1]+=e[1];var t=.05/Math.pow(2,this._zoom);this._requestedBasicRotation[0]=this._spatial.clamp(this._requestedBasicRotation[0],-t,t),this._requestedBasicRotation[1]=this._spatial.clamp(this._requestedBasicRotation[1],-t,t)}else this._requestedBasicRotation=e.slice()},e.prototype.rotateBasicUnbounded=function(e){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=e[0],this._requestedBasicRotationUnbounded[1]+=e[1]):this._requestedBasicRotationUnbounded=e.slice())},e.prototype.rotateBasicWithoutInertia=function(e){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null;var t=.05/Math.pow(2,this._zoom),r=e.slice();r[0]=this._spatial.clamp(r[0],-t,t),r[1]=this._spatial.clamp(r[1],-t,t),this._applyRotationBasic(r)}},e.prototype.rotateToBasic=function(e){if(null!=this._currentNode){this._desiredZoom=this._zoom,this._desiredLookat=null,e[0]=this._spatial.clamp(e[0],0,1),e[1]=this._spatial.clamp(e[1],0,1);var t=this.currentTransform.unprojectBasic(e,this._lookatDepth);this._currentCamera.lookat.fromArray(t)}},e.prototype.zoomIn=function(e,t){if(null!=this._currentNode){this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+e));var r=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray()),n=r[0],i=r[1],o=Math.pow(2,this._zoom),s=Math.pow(2,this._desiredZoom),a=t[0],c=t[1];null!=this.currentTransform.gpano&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels&&(.5<a-n?a-=1:.5<n-a&&(a=1+a));var u=a-o/s*(a-n),h=c-o/s*(c-i),l=this.currentTransform.gpano;h=this._currentNode.fullPano?(u=this._spatial.wrap(u+this._basicRotation[0],0,1),this._spatial.clamp(h+this._basicRotation[1],.05,.95)):null!=l&&this.currentTransform.gpano.CroppedAreaImageWidthPixels===this.currentTransform.gpano.FullPanoWidthPixels?(u=this._spatial.wrap(u+this._basicRotation[0],0,1),this._spatial.clamp(h+this._basicRotation[1],0,1)):(u=this._spatial.clamp(u,0,1),this._spatial.clamp(h,0,1)),this._desiredLookat=(new p.Vector3).fromArray(this.currentTransform.unprojectBasic([u,h],this._lookatDepth))}},e.prototype.setCenter=function(e){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._desiredZoom=this._zoom;var t=[this._spatial.clamp(e[0],0,1),this._spatial.clamp(e[1],0,1)];if(null!=this._currentNode){this._desiredCenter=null;var r=(new p.Vector3).fromArray(this.currentTransform.unprojectBasic(t,this._lookatDepth)),n=null!=this.previousTransform?this.previousTransform:this.currentTransform,i=(new p.Vector3).fromArray(n.unprojectBasic(t,this._lookatDepth));this._currentCamera.lookat.copy(r),this._previousCamera.lookat.copy(i)}else this._desiredCenter=t},e.prototype.setZoom=function(e){this._desiredLookat=null,this._requestedRotationDelta=null,this._requestedBasicRotation=null,this._zoom=this._spatial.clamp(e,this._minZoom,this._maxZoom),this._desiredZoom=this._zoom},e.prototype._applyRotation=function(e,t){if(null!=t){var r=(new p.Quaternion).setFromUnitVectors(t.up,new p.Vector3(0,0,1)),n=r.clone().inverse(),i=new p.Vector3;i.copy(t.lookat).sub(t.position),i.applyQuaternion(r);var o=i.length(),s=Math.atan2(i.y,i.x);s+=e.phi;var a=Math.atan2(Math.sqrt(i.x*i.x+i.y*i.y),i.z);a+=e.theta,a=Math.max(.1,Math.min(Math.PI-.1,a)),i.x=Math.sin(a)*Math.cos(s),i.y=Math.sin(a)*Math.sin(s),i.z=Math.cos(a),i.applyQuaternion(n),t.lookat.copy(t.position).add(i.multiplyScalar(o))}},e.prototype._applyRotationBasic=function(e){var t=this._currentNode,r=null!=this._previousNode?this.previousNode:this.currentNode,n=this._currentCamera,i=this._previousCamera,o=this.currentTransform,s=null!=this.previousTransform?this.previousTransform:this.currentTransform,a=o.projectBasic(n.lookat.toArray()),c=s.projectBasic(i.lookat.toArray()),u=o.gpano,h=s.gpano;t.fullPano?(a[0]=this._spatial.wrap(a[0]+e[0],0,1),a[1]=this._spatial.clamp(a[1]+e[1],.05,.95)):(null!=u&&o.gpano.CroppedAreaImageWidthPixels===o.gpano.FullPanoWidthPixels?a[0]=this._spatial.wrap(a[0]+e[0],0,1):a[0]=this._spatial.clamp(a[0]+e[0],0,1),a[1]=this._spatial.clamp(a[1]+e[1],0,1)),r.fullPano?(c[0]=this._spatial.wrap(c[0]+e[0],0,1),c[1]=this._spatial.clamp(c[1]+e[1],.05,.95)):null!=h&&s.gpano.CroppedAreaImageWidthPixels===s.gpano.FullPanoWidthPixels?(c[0]=this._spatial.wrap(c[0]+e[0],0,1),c[1]=this._spatial.clamp(c[1]+e[1],0,1)):(c[0]=this._spatial.clamp(c[0]+e[0],0,1),c[1]=this._spatial.clamp(a[1]+e[1],0,1));var l=o.unprojectBasic(a,this._lookatDepth);n.lookat.fromArray(l);var p=s.unprojectBasic(c,this._lookatDepth);i.lookat.fromArray(p)},e.prototype._updateZoom=function(e){var t=this._desiredZoom-this._zoom,r=0<t?1:t<0?-1:0;0!==t&&(Math.abs(t)<.002?(this._zoom=this._desiredZoom,null!=this._desiredLookat&&(this._desiredLookat=null)):this._zoom+=r*Math.max(Math.abs(5*e*t),.002))},e.prototype._updateLookat=function(e){if(null!==this._desiredLookat){var t=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(t)<1e-6?(this._currentCamera.lookat.copy(this._desiredLookat),this._desiredLookat=null):this._currentCamera.lookat.lerp(this._desiredLookat,5*e)}},e.prototype._updateRotation=function(){if(null!=this._requestedRotationDelta)return this._rotationDelta.lengthSquared()<this._requestedRotationDelta.lengthSquared()?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 e=this._basicRotation[0],t=this._basicRotation[1],r=this._requestedBasicRotation[0],n=this._requestedBasicRotation[1];return Math.abs(r)>Math.abs(e)?this._basicRotation[0]=(1-this._rotationIncreaseAlpha)*e+this._rotationIncreaseAlpha*r:this._basicRotation[0]=(1-this._rotationDecreaseAlpha)*e+this._rotationDecreaseAlpha*r,Math.abs(n)>Math.abs(t)?this._basicRotation[1]=(1-this._rotationIncreaseAlpha)*t+this._rotationIncreaseAlpha*n:this._basicRotation[1]=(1-this._rotationDecreaseAlpha)*t+this._rotationDecreaseAlpha*n,void(this._requestedBasicRotation=null)}if(null!=this._requestedBasicRotationUnbounded){r=this._requestedBasicRotationUnbounded[0],n=this._requestedBasicRotationUnbounded[1];if(0<Math.abs(r)&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*r),0<Math.abs(n)&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*n),null!=this._desiredLookat){var i=this.currentTransform.projectBasic(this._desiredLookat.toArray());i[0]+=r,i[1]+=n,this._desiredLookat=(new p.Vector3).fromArray(this.currentTransform.unprojectBasic(i,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}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),(0<this._basicRotation[0]||0<this._basicRotation[1])&&(this._basicRotation=[0,0]))},e.prototype._setDesiredCenter=function(){if(null!=this._desiredCenter){var e=(new p.Vector3).fromArray(this.currentTransform.unprojectBasic(this._desiredCenter,this._lookatDepth)).sub(this._currentCamera.position);this._currentCamera.lookat.copy(this._currentCamera.position.clone().add(e)),this._previousCamera.lookat.copy(this._previousCamera.position.clone().add(e)),this._desiredCenter=null}},e.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0},e}(o.StateBase);r.InteractiveStateBase=s,r.default=s},{"../../State":281,three:225}],417:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../../State"),s=function(r){function e(e){var t=r.call(this,e)||this;return t._adjustCameras(),t._motionless=t._motionlessTransition(),t}return i(e,r),e.prototype.traverse=function(){return new o.TraversingState(this)},e.prototype.wait=function(){return new o.WaitingState(this)},e.prototype.prepend=function(e){r.prototype.prepend.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.set=function(e){r.prototype.set.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.move=function(e){this._alpha=Math.max(0,Math.min(1,this._alpha+e))},e.prototype.moveTo=function(e){this._alpha=Math.max(0,Math.min(1,e))},e.prototype.update=function(e){this._updateRotation(),this._rotationDelta.isZero||(this._applyRotation(this._rotationDelta,this._previousCamera),this._applyRotation(this._rotationDelta,this._currentCamera)),this._updateRotationBasic(),0===this._basicRotation[0]&&0===this._basicRotation[1]||this._applyRotationBasic(this._basicRotation);var t=this._animationSpeed*(60/e);this._updateZoom(t),this._updateLookat(t),this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},e.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},e.prototype._setCurrentCamera=function(){r.prototype._setCurrentCamera.call(this),this._adjustCameras()},e.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){var e=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){e=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position))}}},e}(o.InteractiveStateBase);r.InteractiveWaitingState=s,r.default=s},{"../../State":281}],418:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s=e("../../Error"),a=e("../../Geo"),n=e("../../State"),i=function(){function e(e){this._spatial=new a.Spatial,this._geoCoords=new a.GeoCoords,this._referenceThreshold=.01,this._transitionMode=e.transitionMode,this._reference=e.reference,this._alpha=e.alpha,this._camera=e.camera.clone(),this._zoom=e.zoom,this._currentIndex=e.currentIndex,this._trajectory=e.trajectory.slice(),this._trajectoryTransforms=[],this._trajectoryCameras=[];for(var t=0,r=this._trajectory;t<r.length;t++){var n=r[t],i=this._nodeToTranslation(n,this._reference),o=new a.Transform(n.orientation,n.width,n.height,n.focal,n.scale,n.gpano,n.rotation,i,n.image,void 0,n.ck1,n.ck2);this._trajectoryTransforms.push(o),this._trajectoryCameras.push(new a.Camera(o))}this._currentNode=0<this._trajectory.length?this._trajectory[this._currentIndex]:null,this._previousNode=1<this._trajectory.length&&0<this.currentIndex?this._trajectory[this._currentIndex-1]:null,this._currentCamera=0<this._trajectoryCameras.length?this._trajectoryCameras[this._currentIndex].clone():new a.Camera,this._previousCamera=1<this._trajectoryCameras.length&&0<this.currentIndex?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}return Object.defineProperty(e.prototype,"reference",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._getAlpha()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zoom",{get:function(){return this._zoom},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trajectory",{get:function(){return this._trajectory},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this._currentIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentNode",{get:function(){return this._currentNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousNode",{get:function(){return this._previousNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentCamera",{get:function(){return this._currentCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTransform",{get:function(){return 0<this._trajectoryTransforms.length?this._trajectoryTransforms[this.currentIndex]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousTransform",{get:function(){return 1<this._trajectoryTransforms.length&&0<this.currentIndex?this._trajectoryTransforms[this.currentIndex-1]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"motionless",{get:function(){return this._motionless},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"transitionMode",{get:function(){return this._transitionMode},enumerable:!0,configurable:!0}),e.prototype.earth=function(){throw new Error("Not implemented")},e.prototype.traverse=function(){throw new Error("Not implemented")},e.prototype.wait=function(){throw new Error("Not implemented")},e.prototype.waitInteractively=function(){throw new Error("Not implemented")},e.prototype.move=function(e){},e.prototype.moveTo=function(e){},e.prototype.rotate=function(e){},e.prototype.rotateUnbounded=function(e){},e.prototype.rotateWithoutInertia=function(e){},e.prototype.rotateBasic=function(e){},e.prototype.rotateBasicUnbounded=function(e){},e.prototype.rotateBasicWithoutInertia=function(e){},e.prototype.rotateToBasic=function(e){},e.prototype.setSpeed=function(e){},e.prototype.zoomIn=function(e,t){},e.prototype.update=function(e){},e.prototype.setCenter=function(e){},e.prototype.setZoom=function(e){},e.prototype.dolly=function(e){},e.prototype.orbit=function(e){},e.prototype.truck=function(e){},e.prototype.append=function(e){if(e.length<1)throw Error("Trajectory can not be empty");this._currentIndex<0?this.set(e):(this._trajectory=this._trajectory.concat(e),this._appendToTrajectories(e))},e.prototype.prepend=function(e){if(e.length<1)throw Error("Trajectory can not be empty");this._trajectory=e.slice().concat(this._trajectory),this._currentIndex+=e.length,this._setCurrentNode(),this._setReference(this._currentNode)?this._setTrajectories():this._prependToTrajectories(e),this._setCurrentCamera()},e.prototype.remove=function(e){if(e<0)throw Error("n must be a positive integer");if(this._currentIndex-1<e)throw Error("Current and previous nodes can not be removed");for(var t=0;t<e;t++)this._trajectory.shift(),this._trajectoryTransforms.shift(),this._trajectoryCameras.shift(),this._currentIndex--;this._setCurrentNode()},e.prototype.clearPrior=function(){0<this._currentIndex&&this.remove(this._currentIndex-1)},e.prototype.clear=function(){this.cut(),0<this._currentIndex&&this.remove(this._currentIndex-1)},e.prototype.cut=function(){for(;this._trajectory.length-1>this._currentIndex;)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()},e.prototype.set=function(e){this._setTrajectory(e),this._setCurrentNode(),this._setReference(this._currentNode),this._setTrajectories(),this._setCurrentCamera()},e.prototype.getCenter=function(){return null!=this._currentNode?this.currentTransform.projectBasic(this._camera.lookat.toArray()):[.5,.5]},e.prototype.setTransitionMode=function(e){this._transitionMode=e},e.prototype._getAlpha=function(){return 1},e.prototype._setCurrent=function(){this._setCurrentNode(),this._setReference(this._currentNode)&&this._setTrajectories(),this._setCurrentCamera()},e.prototype._setCurrentCamera=function(){this._currentCamera=this._trajectoryCameras[this._currentIndex].clone(),this._previousCamera=0<this._currentIndex?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()},e.prototype._motionlessTransition=function(){return null!=this._currentNode&&null!=this._previousNode&&(this._transitionMode===n.TransitionMode.Instantaneous||!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent()))},e.prototype._setReference=function(e){return!(Math.abs(e.latLon.lat-this.reference.lat)<this._referenceThreshold&&Math.abs(e.latLon.lon-this.reference.lon)<this._referenceThreshold)&&(!(null!=this._previousNode&&!this._motionlessTransition())&&(this._reference.lat=e.latLon.lat,this._reference.lon=e.latLon.lon,this._reference.alt=e.alt,!0))},e.prototype._setCurrentNode=function(){this._currentNode=0<this._trajectory.length?this._trajectory[this._currentIndex]:null,this._previousNode=0<this._currentIndex?this._trajectory[this._currentIndex-1]:null},e.prototype._setTrajectory=function(e){if(e.length<1)throw new s.ArgumentMapillaryError("Trajectory can not be empty");null!=this._currentNode?(this._trajectory=[this._currentNode].concat(e),this._currentIndex=1):(this._trajectory=e.slice(),this._currentIndex=0)},e.prototype._setTrajectories=function(){this._trajectoryTransforms.length=0,this._trajectoryCameras.length=0,this._appendToTrajectories(this._trajectory)},e.prototype._appendToTrajectories=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];if(!n.assetsCached)throw new s.ArgumentMapillaryError("Assets must be cached when node is added to trajectory");var i=this._nodeToTranslation(n,this.reference),o=new a.Transform(n.orientation,n.width,n.height,n.focal,n.scale,n.gpano,n.rotation,i,n.image,void 0,n.ck1,n.ck2);this._trajectoryTransforms.push(o),this._trajectoryCameras.push(new a.Camera(o))}},e.prototype._prependToTrajectories=function(e){for(var t=0,r=e.reverse();t<r.length;t++){var n=r[t];if(!n.assetsCached)throw new s.ArgumentMapillaryError("Assets must be cached when added to trajectory");var i=this._nodeToTranslation(n,this.reference),o=new a.Transform(n.orientation,n.width,n.height,n.focal,n.scale,n.gpano,n.rotation,i,n.image,void 0,n.ck1,n.ck2);this._trajectoryTransforms.unshift(o),this._trajectoryCameras.unshift(new a.Camera(o))}},e.prototype._nodeToTranslation=function(e,t){return a.Geo.computeTranslation({alt:e.alt,lat:e.latLon.lat,lon:e.latLon.lon},e.rotation,t)},e.prototype._sameConnectedComponent=function(){var e=this._currentNode,t=this._previousNode;return!!e&&!!t&&e.mergeCC===t.mergeCC},e.prototype._withinOriginalDistance=function(){var e=this._currentNode,t=this._previousNode;return!e||!t||this._spatial.distanceFromLatLon(e.originalLatLon.lat,e.originalLatLon.lon,t.originalLatLon.lat,t.originalLatLon.lon)<25},e}();r.StateBase=i},{"../../Error":276,"../../Geo":277,"../../State":281}],419:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("@mapbox/unitbezier"),s=e("../../State"),a=function(r){function e(e){var t=r.call(this,e)||this;return t._adjustCameras(),t._motionless=t._motionlessTransition(),t._baseAlpha=t._alpha,t._speedCoefficient=1,t._unitBezier=new o(.74,.67,.38,.96),t._useBezier=!1,t}return i(e,r),e.prototype.earth=function(){return new s.EarthState(this)},e.prototype.wait=function(){return new s.WaitingState(this)},e.prototype.waitInteractively=function(){return new s.InteractiveWaitingState(this)},e.prototype.append=function(e){var t=0===this._trajectory.length;t&&this._resetTransition(),r.prototype.append.call(this,e),t&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.prepend=function(e){var t=0===this._trajectory.length;t&&this._resetTransition(),r.prototype.prepend.call(this,e),t&&(this._setDesiredCenter(),this._setDesiredZoom())},e.prototype.set=function(e){r.prototype.set.call(this,e),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)},e.prototype.setSpeed=function(e){this._speedCoefficient=this._spatial.clamp(e,0,10)},e.prototype.update=function(e){1===this._alpha&&this._currentIndex+this._alpha<this._trajectory.length&&(this._currentIndex+=1,this._useBezier=this._trajectory.length<3&&this._currentIndex+1===this._trajectory.length,this._setCurrent(),this._resetTransition(),this._clearRotation(),this._desiredZoom=this._currentNode.fullPano?this._zoom:0,this._desiredLookat=null);var t=this._animationSpeed*(60/e);this._baseAlpha=Math.min(1,this._baseAlpha+this._speedCoefficient*t),this._useBezier?this._alpha=this._unitBezier.solve(this._baseAlpha):this._alpha=this._baseAlpha,this._updateRotation(),this._rotationDelta.isZero||(this._applyRotation(this._rotationDelta,this._previousCamera),this._applyRotation(this._rotationDelta,this._currentCamera)),this._updateRotationBasic(),0===this._basicRotation[0]&&0===this._basicRotation[1]||this._applyRotationBasic(this._basicRotation),this._updateZoom(t),this._updateLookat(t),this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},e.prototype._getAlpha=function(){return this._motionless?Math.ceil(this._alpha):this._alpha},e.prototype._setCurrentCamera=function(){r.prototype._setCurrentCamera.call(this),this._adjustCameras()},e.prototype._adjustCameras=function(){if(null!=this._previousNode){var e=this._camera.lookat.clone().sub(this._camera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position)),this._currentNode.fullPano&&this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}},e.prototype._resetTransition=function(){this._alpha=0,this._baseAlpha=0,this._motionless=this._motionlessTransition()},e}(s.InteractiveStateBase);r.TraversingState=a,r.default=a},{"../../State":281,"@mapbox/unitbezier":2}],420:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("../../State"),s=function(r){function e(e){var t=r.call(this,e)||this;return t._zoom=0,t._adjustCameras(),t._motionless=t._motionlessTransition(),t}return i(e,r),e.prototype.traverse=function(){return new o.TraversingState(this)},e.prototype.waitInteractively=function(){return new o.InteractiveWaitingState(this)},e.prototype.prepend=function(e){r.prototype.prepend.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.set=function(e){r.prototype.set.call(this,e),this._motionless=this._motionlessTransition()},e.prototype.move=function(e){this._alpha=Math.max(0,Math.min(1,this._alpha+e))},e.prototype.moveTo=function(e){this._alpha=Math.max(0,Math.min(1,e))},e.prototype.update=function(e){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},e.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},e.prototype._setCurrentCamera=function(){r.prototype._setCurrentCamera.call(this),this._adjustCameras()},e.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){var e=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){e=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position))}}},e}(o.StateBase);r.WaitingState=s,r.default=s},{"../../State":281}],421:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=function(){function e(e,t,r){this._scheme=e,this._host=t,this._origin=null!=r?"?origin="+r:""}return e.prototype.getTile=function(i,o,s,a,c,e,t){var r="/"+i+"/"+o+","+s+","+a+","+c+"/"+e+","+t+"/0/default.jpg",u=this._scheme+"://"+this._host+r+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(e){if(200===h.status){var t=new Image;t.crossOrigin="Anonymous",t.onload=function(e){n.next(t),n.complete()},t.onerror=function(e){n.error(new Error("Failed to load tile image ("+i+": "+o+","+s+","+a+","+c+")"))};var r=new Blob([h.response]);t.src=window.URL.createObjectURL(r)}else n.error(new Error("Failed to fetch tile ("+i+": "+o+","+s+","+a+","+c+"). Status: "+h.status+", "+h.statusText))},h.onerror=function(e){n.error(new Error("Failed to fetch tile ("+i+": "+o+","+s+","+a+","+c+")"))},h.ontimeout=function(e){n.error(new Error("Tile request timed out ("+i+": "+o+","+s+","+a+","+c+")"))},h.onabort=function(e){n.error(new Error("Tile request was aborted ("+i+": "+o+","+s+","+a+","+c+")"))},h.send(null)}),function(){null!=h&&h.abort()}]},e}();r.ImageTileLoader=i,r.default=i},{rxjs:26}],422:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(){this._images={}}return e.prototype.addImage=function(e,t,r){r in this._images||(this._images[r]={}),this._images[r][t]=e},e.prototype.dispose=function(){for(var e=0,t=Object.keys(this._images);e<t.length;e++){for(var r=t[e],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]}},e.prototype.getImage=function(e,t){return this._images[t][e]},e.prototype.hasImage=function(e,t){return t in this._images&&e in this._images[t]},e}();r.ImageTileStore=n,r.default=n},{}],423:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Geo"),i=function(){function e(){this._viewportCoords=new n.ViewportCoords}return e.prototype.computeRegionOfInterest=function(e,t,r){var n=this._viewportBoundaryPoints(4),i=this._viewportPointsBoundingBox(n,e,r);this._clipBoundingBox(i);var o=2/t.width,s=2/t.height,a=[[-.5*o,.5*s],[.5*o,.5*s],[.5*o,-.5*s],[-.5*o,-.5*s]],c=this._viewportPointsBoundingBox(a,e,r);return{bbox:i,pixelHeight:c.maxY-c.minY,pixelWidth:c.maxX-c.minX+(c.minX<c.maxX?0:1)}},e.prototype._viewportBoundaryPoints=function(e){for(var t=[],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<e;++a)t.push([o[0]+s[0]*a/e,o[1]+s[1]*a/e]);return t},e.prototype._viewportPointsBoundingBox=function(e,t,r){var n=this,i=e.map(function(e){return n._viewportCoords.viewportToBasic(e[0],e[1],r,t.perspective)});return null!=r.gpano?this._boundingBoxPano(i):this._boundingBox(i)},e.prototype._boundingBox=function(e){for(var t={maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY},r=0;r<e.length;++r)t.minX=Math.min(t.minX,e[r][0]),t.maxX=Math.max(t.maxX,e[r][0]),t.minY=Math.min(t.minY,e[r][1]),t.maxY=Math.max(t.maxY,e[r][1]);return t},e.prototype._boundingBoxPano=function(e){for(var r=this,t=[],n=[],i=0;i<e.length;++i)t.push(e[i][0]),n.push(e[i][1]);t.sort(function(e,t){return r._sign(e-t)}),n.sort(function(e,t){return r._sign(e-t)});var o=this._intervalPano(t);return{maxX:o[1],maxY:n[n.length-1],minX:o[0],minY:n[0]}},e.prototype._intervalPano=function(e){for(var t=0,r=-1,n=0;n<e.length-1;++n){var i=e[n+1]-e[n];t<i&&(t=i,r=n)}return t<e[0]+1-e[e.length-1]?[e[0],e[e.length-1]]:[e[r+1],e[r]]},e.prototype._clipBoundingBox=function(e){e.minX=Math.max(0,Math.min(1,e.minX)),e.maxX=Math.max(0,Math.min(1,e.maxX)),e.minY=Math.max(0,Math.min(1,e.minY)),e.maxY=Math.max(0,Math.min(1,e.maxY))},e.prototype._sign=function(e){return 0<e?1:e<0?-1:0},e}();r.RegionOfInterestCalculator=i,r.default=i},{"../Geo":277}],424:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var c=e("rxjs/operators"),g=e("three"),u=e("rxjs"),n=function(){function e(e,t,r,n,i,o,s,a){this._disposed=!1,this._key=e,(t<=0||r<=0)&&console.warn("Original image size ("+t+", "+r+") is invalid ("+e+"). Tiles will not be loaded."),this._width=t,this._height=r,this._maxLevel=Math.ceil(Math.log(Math.max(r,t))/Math.log(2)),this._currentLevel=-1,this._tileSize=n,this._updated$=new u.Subject,this._createdSubject$=new u.Subject,this._created$=this._createdSubject$.pipe(c.publishReplay(1),c.refCount()),this._createdSubscription=this._created$.subscribe(function(){}),this._hasSubject$=new u.Subject,this._has$=this._hasSubject$.pipe(c.startWith(!1),c.publishReplay(1),c.refCount()),this._hasSubscription=this._has$.subscribe(function(){}),this._abortFunctions=[],this._tileSubscriptions={},this._renderedCurrentLevelTiles={},this._renderedTiles={},this._background=i,this._camera=null,this._imageTileLoader=o,this._imageTileStore=s,this._renderer=a,this._renderTarget=null,this._roi=null}return Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasTexture$",{get:function(){return this._has$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textureUpdated$",{get:function(){return this._updated$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textureCreated$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),e.prototype.abort=function(){for(var e in this._tileSubscriptions)this._tileSubscriptions.hasOwnProperty(e)&&this._tileSubscriptions[e].unsubscribe();this._tileSubscriptions={};for(var t=0,r=this._abortFunctions;t<r.length;t++){(0,r[t])()}this._abortFunctions=[]},e.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)},e.prototype.setRegionOfInterest=function(e){if(!(this._width<=0||this._height<=0)){this._roi=e;var t=1/this._roi.pixelWidth,r=1/this._roi.pixelHeight,n=Math.max(r,t),i=Math.max(0,Math.min(this._maxLevel,Math.ceil(Math.log(n)/Math.log(2))));if(i!==this._currentLevel){this.abort(),this._currentLevel=i,this._currentLevel in this._renderedTiles||(this._renderedTiles[this._currentLevel]=[]),this._renderedCurrentLevelTiles={};for(var o=0,s=this._renderedTiles[this._currentLevel];o<s.length;o++){var a=s[o];this._renderedCurrentLevelTiles[this._tileKey(this._tileSize,a)]=!0}}var c=this._getTileCoords([this._roi.bbox.minX,this._roi.bbox.minY]),u=this._getTileCoords([this._roi.bbox.maxX,this._roi.bbox.maxY]),h=this._getTiles(c,u);if(null==this._camera){this._camera=new g.OrthographicCamera(-this._width/2,this._width/2,this._height/2,-this._height/2,-1,1),this._camera.position.z=1;var l=this._renderer.getContext(),p=l.getParameter(l.MAX_TEXTURE_SIZE),f=Math.max(this._width,this._height),d=f<p?1:p/f,m=Math.floor(d*this._width),v=Math.floor(d*this._height);this._renderTarget=new g.WebGLRenderTarget(m,v,{depthBuffer:!1,format:g.RGBFormat,magFilter:g.LinearFilter,minFilter:g.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(h)}},e.prototype.setTileSize=function(e){this._tileSize=e},e.prototype.updateBackground=function(e){this._background=e},e.prototype._fetchTile=function(t,r,n,i,o,s,e,a){var c=this,u=this._imageTileLoader.getTile(this._key,n,i,o,s,e,a),h=u[0],l=u[1];this._abortFunctions.push(l);var p=this._tileKey(this._tileSize,t),f=h.subscribe(function(e){c._renderToTarget(n,i,o,s,e),c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),c._setTileRendered(t,c._currentLevel),c._imageTileStore.addImage(e,p,r),c._updated$.next(!0)},function(e){c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),console.error(e)});f.closed||(this._tileSubscriptions[p]=f)},e.prototype._fetchTiles=function(e){for(var t=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=0,n=e;r<n.length;r++){var i=n[r],o=this._tileKey(this._tileSize,i);if(!(o in this._renderedCurrentLevelTiles||o in this._tileSubscriptions)){var s=t*i[0],a=t*i[1],c=s+t>this._width?this._width-s:t,u=a+t>this._height?this._height-a:t;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/t*this._tileSize),l=Math.floor(u/t*this._tileSize);this._fetchTile(i,this._currentLevel,s,a,c,u,h,l)}}}},e.prototype._getTileCoords=function(e){var t=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=Math.ceil(this._width/t)-1,n=Math.ceil(this._height/t)-1;return[Math.min(Math.floor(this._width*e[0]/t),r),Math.min(Math.floor(this._height*e[1]/t),n)]},e.prototype._getTiles=function(e,t){var r=[];if(e[0]>t[0]){for(var n=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),i=Math.ceil(this._width/n)-1,o=e[0];o<=i;o++)r.push(o);for(o=0;o<=t[0];o++)r.push(o)}else for(o=e[0];o<=t[0];o++)r.push(o);for(var s=[],a=0,c=r;a<c.length;a++){o=c[a];for(var u=e[1];u<=t[1];u++)s.push([o,u])}return s},e.prototype._removeFromArray=function(e,t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)},e.prototype._removeFromDictionary=function(e,t){e in t&&delete t[e]},e.prototype._renderToTarget=function(e,t,r,n,i){var o=new g.Texture(i);o.minFilter=g.LinearFilter,o.needsUpdate=!0;var s=new g.PlaneGeometry(r,n),a=new g.MeshBasicMaterial({map:o,side:g.FrontSide}),c=new g.Mesh(s,a);c.position.x=-this._width/2+e+r/2,c.position.y=this._height/2-t-n/2;var u=new g.Scene;u.add(c),this._renderer.render(u,this._camera,this._renderTarget),this._renderer.setRenderTarget(void 0),u.remove(c),s.dispose(),a.dispose(),o.dispose()},e.prototype._setTileRendered=function(e,t){for(var r=0,n=Object.keys(this._renderedTiles).map(function(e){return parseInt(e,10)}).filter(function(e){return e!==t});r<n.length;r++){var i=n[r],o=Math.pow(2,i-t);if(i<t)for(var s=Math.floor(o*e[0]),a=Math.floor(o*e[1]),c=0,u=this._renderedTiles[i].slice();c<u.length;c++){if((g=u[c])[0]===s&&g[1]===a){var h=this._renderedTiles[i].indexOf(g);this._renderedTiles[i].splice(h,1)}}else for(var l=o*e[0],p=l+o-1,f=o*e[1],d=f+o-1,m=0,v=this._renderedTiles[i].slice();m<v.length;m++){var g;if((g=v[m])[0]>=l&&g[0]<=p&&g[1]>=f&&g[1]<=d){h=this._renderedTiles[i].indexOf(g);this._renderedTiles[i].splice(h,1)}}0===this._renderedTiles[i].length&&delete this._renderedTiles[i]}this._renderedTiles[t].push(e),this._renderedCurrentLevelTiles[this._tileKey(this._tileSize,e)]=!0},e.prototype._tileKey=function(e,t){return e+"-"+t[0]+"-"+t[1]},e}();r.TextureProvider=n,r.default=n},{rxjs:26,"rxjs/operators":224,three:225}],425:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e){this._document=e||document}return Object.defineProperty(e.prototype,"document",{get:function(){return this._document},enumerable:!0,configurable:!0}),e.prototype.createElement=function(e,t,r){var n=this._document.createElement(e);return t&&(n.className=t),r&&r.appendChild(n),n},e}();r.DOM=n,r.default=n},{}],426:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(){this._events={}}return e.prototype.on=function(e,t){this._events[e]=this._events[e]||[],this._events[e].push(t)},e.prototype.off=function(e,t){if(e)if(this._listens(e))delete this._events[e];else{var r=this._events[e].indexOf(t);0<=r&&this._events[e].splice(r,1),this._events[e].length&&delete this._events[e]}else this._events={}},e.prototype.fire=function(e,t){if(this._listens(e))for(var r=0,n=this._events[e];r<n.length;r++){n[r].call(this,t)}},e.prototype._listens=function(e){return!(!this._events||!this._events[e])},e}();r.EventEmitter=n,r.default=n},{}],427:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../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":285}],428:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isBrowser=function(){return"undefined"!=typeof window&&"undefined"!=typeof document},r.isArraySupported=function(){return!!(Array.prototype&&Array.prototype.filter&&Array.prototype.indexOf&&Array.prototype.map&&Array.prototype.reverse)},r.isFunctionSupported=function(){return!(!Function.prototype||!Function.prototype.bind)},r.isJSONSupported=function(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON},r.isObjectSupported=function(){return!(!Object.keys||!Object.assign)},r.isBlobSupported=function(){return"Blob"in window&&"URL"in window};var n=void 0;function i(){var e={alpha:!1,antialias:!1,depth:!0,failIfMajorPerformanceCaveat:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,stencil:!0},t=document.createElement("canvas"),r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e);if(!r)return!1;for(var n=r.getSupportedExtensions(),i=0,o=["OES_standard_derivatives"];i<o.length;i++){var s=o[i];if(-1===n.indexOf(s))return!1}return!0}r.isWebGLSupportedCached=function(){return void 0===n&&(n=i()),n},r.isWebGLSupported=i},{}],429:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function n(){}return Object.defineProperty(n,"explore",{get:function(){return n._scheme+"://"+n._exploreHost},enumerable:!0,configurable:!0}),Object.defineProperty(n,"origin",{get:function(){return n._origin},enumerable:!0,configurable:!0}),Object.defineProperty(n,"tileScheme",{get:function(){return n._scheme},enumerable:!0,configurable:!0}),Object.defineProperty(n,"tileDomain",{get:function(){return n._imageTileHost},enumerable:!0,configurable:!0}),n.atomicReconstruction=function(e){return n._scheme+"://"+n._atomicReconstructionHost+"/"+e+"/sfm/v1.0/atomic_reconstruction.json"},n.exporeImage=function(e){return n._scheme+"://"+n._exploreHost+"/app/?pKey="+e+"&focus=photo"},n.exporeUser=function(e){return n._scheme+"://"+n._exploreHost+"/app/user/"+e},n.falcorModel=function(e){return n._scheme+"://"+n._apiHost+"/v3/model.json?client_id="+e},n.protoMesh=function(e){return n._scheme+"://"+n._meshHost+"/v2/mesh/"+e},n.thumbnail=function(e,t,r){return n._scheme+"://"+n._imageHost+"/"+e+"/thumb-"+t+".jpg"+(r?"?origin="+r:"")},n.setOptions=function(e){e&&(e.apiHost&&(n._apiHost=e.apiHost),e.atomicReconstructionHost&&(n._atomicReconstructionHost=e.atomicReconstructionHost),e.exploreHost&&(n._exploreHost=e.exploreHost),e.imageHost&&(n._imageHost=e.imageHost),e.imageTileHost&&(n._imageTileHost=e.imageTileHost),e.meshHost&&(n._meshHost=e.meshHost),e.scheme&&(n._scheme=e.scheme))},n._apiHost="a.mapillary.com",n._atomicReconstructionHost="d3necqxnn15whe.cloudfront.net",n._exploreHost="www.mapillary.com",n._imageHost="d1cuyjsrcm0gby.cloudfront.net",n._imageTileHost="d2qb1440i7l50o.cloudfront.net",n._meshHost="d1brzeo354iq2l.cloudfront.net",n._origin="mapillary.webgl",n._scheme="https",n}();r.Urls=n,r.default=n},{}],430:[function(e,t,r){"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),(i=n=r.Alignment||(r.Alignment={}))[i.Bottom=0]="Bottom",i[i.BottomLeft=1]="BottomLeft",i[i.BottomRight=2]="BottomRight",i[i.Center=3]="Center",i[i.Left=4]="Left",i[i.Right=5]="Right",i[i.Top=6]="Top",i[i.TopLeft=7]="TopLeft",i[i.TopRight=8]="TopRight",r.default=n},{}],431:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=e("rxjs/operators"),s=e("../Graph"),o=function(){function e(e,t){this._graphService=e,this._stateService=t,this._started=!1}return Object.defineProperty(e.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),e.prototype.start=function(){var o=this;this._started||(this._uncacheSubscription=this._stateService.currentState$.pipe(i.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}),i.map(function(e){var t=e.state.trajectory;return[t.map(function(e){return e.key}),t[t.length-1].sequenceKey]}),i.bufferCount(1,5),i.withLatestFrom(this._graphService.graphMode$),i.switchMap(function(e){var t=e[0],r=e[1],n=t[0][0],i=r===s.GraphMode.Sequence?t[0][1]:void 0;return o._graphService.uncache$(n,i)})).subscribe(function(){}),this._cacheNodeSubscription=this._graphService.graphMode$.pipe(i.skip(1),i.withLatestFrom(this._stateService.currentState$),i.switchMap(function(e){var t=e[0],r=e[1];return t===s.GraphMode.Sequence?o._keyToEdges(r.state.currentNode.key,function(e){return e.sequenceEdges$}):n.from(r.state.trajectory.map(function(e){return e.key}).slice(r.state.currentIndex)).pipe(i.mergeMap(function(e){return o._keyToEdges(e,function(e){return e.spatialEdges$})},6))})).subscribe(function(){}),this._started=!0)},e.prototype.stop=function(){this._started&&(this._uncacheSubscription.unsubscribe(),this._uncacheSubscription=null,this._cacheNodeSubscription.unsubscribe(),this._cacheNodeSubscription=null,this._started=!1)},e.prototype._keyToEdges=function(t,e){return this._graphService.cacheNode$(t).pipe(i.switchMap(e),i.first(function(e){return e.cached}),i.timeout(15e3),i.catchError(function(e){return console.error("Failed to cache edges ("+t+").",e),n.empty()}))},e}();r.CacheService=o,r.default=o},{"../Graph":278,rxjs:26,"rxjs/operators":224}],432:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("rxjs/operators"),c=e("../Component"),n=function(){function e(e,t,r,n,i,o){var s=this;this._container=e,this._observer=r,this._navigator=t,this._options=null!=i?i:{},this._key=n,this._navigable=null==n,this._componentService=o||new c.ComponentService(this._container,this._navigator),this._coverComponent=this._componentService.getCover(),this._initializeComponents(),n?(this._initilizeCoverComponent(),this._subscribeCoverComponent()):this._navigator.movedToKey$.pipe(a.first(function(e){return null!=e})).subscribe(function(e){s._key=e,s._componentService.deactivateCover(),s._coverComponent.configure({key:s._key,state:c.CoverState.Hidden}),s._subscribeCoverComponent(),s._navigator.stateService.start(),s._navigator.cacheService.start(),s._observer.startEmit()})}return Object.defineProperty(e.prototype,"navigable",{get:function(){return this._navigable},enumerable:!0,configurable:!0}),e.prototype.get=function(e){return this._componentService.get(e)},e.prototype.activate=function(e){this._componentService.activate(e)},e.prototype.activateCover=function(){this._coverComponent.configure({state:c.CoverState.Visible})},e.prototype.deactivate=function(e){this._componentService.deactivate(e)},e.prototype.deactivateCover=function(){this._coverComponent.configure({state:c.CoverState.Loading})},e.prototype.resize=function(){this._componentService.resize()},e.prototype._initializeComponents=function(){var e=this._options;this._uFalse(e.background,"background"),this._uFalse(e.debug,"debug"),this._uFalse(e.image,"image"),this._uFalse(e.marker,"marker"),this._uFalse(e.navigation,"navigation"),this._uFalse(e.popup,"popup"),this._uFalse(e.route,"route"),this._uFalse(e.slider,"slider"),this._uFalse(e.spatialData,"spatialData"),this._uFalse(e.tag,"tag"),this._uTrue(e.attribution,"attribution"),this._uTrue(e.bearing,"bearing"),this._uTrue(e.cache,"cache"),this._uTrue(e.direction,"direction"),this._uTrue(e.imagePlane,"imagePlane"),this._uTrue(e.keyboard,"keyboard"),this._uTrue(e.loading,"loading"),this._uTrue(e.mouse,"mouse"),this._uTrue(e.sequence,"sequence"),this._uTrue(e.stats,"stats"),this._uTrue(e.zoom,"zoom")},e.prototype._initilizeCoverComponent=function(){var e=this._options;this._coverComponent.configure({key:this._key}),void 0===e.cover||e.cover?this.activateCover():this.deactivateCover()},e.prototype._setNavigable=function(e){this._navigable!==e&&(this._navigable=e,this._observer.navigable$.next(e))},e.prototype._subscribeCoverComponent=function(){var n=this;this._coverComponent.configuration$.pipe(a.distinctUntilChanged(void 0,function(e){return e.state})).subscribe(function(r){r.state===c.CoverState.Loading?n._navigator.stateService.currentKey$.pipe(a.first(),a.switchMap(function(e){var t=null==e||e!==r.key;return t&&n._setNavigable(!1),t?n._navigator.moveToKey$(r.key):n._navigator.stateService.currentNode$.pipe(a.first())})).subscribe(function(){n._navigator.stateService.start(),n._navigator.cacheService.start(),n._observer.startEmit(),n._coverComponent.configure({state:c.CoverState.Hidden}),n._componentService.deactivateCover(),n._setNavigable(!0)},function(e){console.error("Failed to deactivate cover.",e),n._coverComponent.configure({state:c.CoverState.Visible})}):r.state===c.CoverState.Visible&&(n._observer.stopEmit(),n._navigator.stateService.stop(),n._navigator.cacheService.stop(),n._navigator.playService.stop(),n._componentService.activateCover(),n._setNavigable(null==r.key))})},e.prototype._uFalse=function(e,t){void 0!==e?"boolean"!=typeof e?(this._componentService.configure(t,e),this._componentService.activate(t)):e?this._componentService.activate(t):this._componentService.deactivate(t):this._componentService.deactivate(t)},e.prototype._uTrue=function(e,t){void 0!==e?"boolean"!=typeof e?(this._componentService.configure(t,e),this._componentService.activate(t)):e?this._componentService.activate(t):this._componentService.deactivate(t):this._componentService.activate(t)},e}();r.ComponentController=n},{"../Component":274,"rxjs/operators":224}],433:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Render"),o=e("../Utils"),s=e("../Viewer"),n=function(){function e(e,t,r,n){if(this.id=e,this._dom=n||new o.DOM,this._container=this._dom.document.getElementById(e),!this._container)throw new Error("Container '"+e+"' not found.");this._container.classList.add("mapillary-js"),this._canvasContainer=this._dom.createElement("div","mapillary-js-interactive",this._container),this._domContainer=this._dom.createElement("div","mapillary-js-dom",this._container),this.renderService=new i.RenderService(this._container,t.currentState$,r.renderMode),this.glRenderer=new i.GLRenderer(this._canvasContainer,this.renderService,this._dom),this.domRenderer=new i.DOMRenderer(this._domContainer,this.renderService,t.currentState$),this.keyboardService=new s.KeyboardService(this._canvasContainer),this.mouseService=new s.MouseService(this._container,this._canvasContainer,this._domContainer,document),this.touchService=new s.TouchService(this._canvasContainer,this._domContainer),this.spriteService=new s.SpriteService(r.sprite)}return Object.defineProperty(e.prototype,"element",{get:function(){return this._container},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canvasContainer",{get:function(){return this._canvasContainer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domContainer",{get:function(){return this._domContainer},enumerable:!0,configurable:!0}),e}();r.Container=n,r.default=n},{"../Render":280,"../Utils":284,"../Viewer":285}],434:[function(e,t,r){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0}),(n=r.ImageSize||(r.ImageSize={}))[n.Size320=320]="Size320",n[n.Size640=640]="Size640",n[n.Size1024=1024]="Size1024",n[n.Size2048=2048]="Size2048"},{}],435:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs"),i=function(){function e(e){this._keyDown$=n.fromEvent(e,"keydown"),this._keyUp$=n.fromEvent(e,"keyup")}return Object.defineProperty(e.prototype,"keyDown$",{get:function(){return this._keyDown$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keyUp$",{get:function(){return this._keyUp$},enumerable:!0,configurable:!0}),e}();r.KeyboardService=i,r.default=i},{rxjs:26}],436:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/operators"),i=e("rxjs"),o=function(){function e(){this._loadersSubject$=new i.Subject,this._loaders$=this._loadersSubject$.pipe(n.scan(function(e,t){return void 0!==t.task&&(e[t.task]=t.loading),e},{}),n.startWith({}),n.publishReplay(1),n.refCount())}return Object.defineProperty(e.prototype,"loading$",{get:function(){return this._loaders$.pipe(n.map(function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!0;return!1}),n.debounceTime(100),n.distinctUntilChanged())},enumerable:!0,configurable:!0}),e.prototype.taskLoading$=function(t){return this._loaders$.pipe(n.map(function(e){return!!e[t]}),n.debounceTime(100),n.distinctUntilChanged())},e.prototype.startLoading=function(e){this._loadersSubject$.next({loading:!0,task:e})},e.prototype.stopLoading=function(e){this._loadersSubject$.next({loading:!1,task:e})},e}();r.LoadingService=o,r.default=o},{rxjs:26,"rxjs/operators":224}],437:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var u=e("rxjs"),h=e("rxjs/operators"),l=e("../Geo"),n=function(){function e(e,i,t,r,n){var o=this;n=null!=n?n:new l.ViewportCoords,this._activeSubject$=new u.BehaviorSubject(!1),this._active$=this._activeSubject$.pipe(h.distinctUntilChanged(),h.publishReplay(1),h.refCount()),this._claimMouse$=new u.Subject,this._claimWheel$=new u.Subject,this._deferPixelClaims$=new u.Subject,this._deferPixels$=this._deferPixelClaims$.pipe(h.scan(function(e,t){return null==t.deferPixels?delete e[t.name]:e[t.name]=t.deferPixels,e},{}),h.map(function(e){var t=-1;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];t<n&&(t=n)}return t}),h.startWith(-1),h.publishReplay(1),h.refCount()),this._deferPixels$.subscribe(function(){}),this._documentMouseMove$=u.fromEvent(r,"mousemove"),this._documentMouseUp$=u.fromEvent(r,"mouseup"),this._mouseDown$=u.fromEvent(i,"mousedown"),this._mouseLeave$=u.fromEvent(i,"mouseleave"),this._mouseMove$=u.fromEvent(i,"mousemove"),this._mouseUp$=u.fromEvent(i,"mouseup"),this._mouseOut$=u.fromEvent(i,"mouseout"),this._mouseOver$=u.fromEvent(i,"mouseover"),this._domMouseDown$=u.fromEvent(t,"mousedown"),this._domMouseMove$=u.fromEvent(t,"mousemove"),this._click$=u.fromEvent(i,"click"),this._contextMenu$=u.fromEvent(i,"contextmenu"),this._dblClick$=u.merge(u.fromEvent(e,"click"),u.fromEvent(i,"dblclick")).pipe(h.bufferCount(3,1),h.filter(function(e){var t=e[0],r=e[1],n=e[2];return"click"===t.type&&"click"===r.type&&"dblclick"===n.type&&t.target.parentNode===i&&r.target.parentNode===i}),h.map(function(e){return e[2]}),h.share()),u.merge(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(function(e){e.preventDefault()}),this._mouseWheel$=u.merge(u.fromEvent(i,"wheel"),u.fromEvent(t,"wheel")).pipe(h.share()),this._consistentContextMenu$=u.merge(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).pipe(h.bufferCount(3,1),h.filter(function(e){return"mousedown"===e[0].type&&"contextmenu"===e[1].type&&"mouseup"===e[2].type}),h.map(function(e){return e[1]}),h.share());var s=u.merge(u.fromEvent(window,"blur"),this._documentMouseUp$.pipe(h.filter(function(e){return 0===e.button}))).pipe(h.share()),a=this._createMouseDragInitiate$(this._mouseDown$,s,!0).pipe(h.share());this._mouseDragStart$=this._createMouseDragStart$(a).pipe(h.share()),this._mouseDrag$=this._createMouseDrag$(a,s).pipe(h.share()),this._mouseDragEnd$=this._createMouseDragEnd$(this._mouseDragStart$,s).pipe(h.share());var c=this._createMouseDragInitiate$(this._domMouseDown$,s,!1).pipe(h.share());this._domMouseDragStart$=this._createMouseDragStart$(c).pipe(h.share()),this._domMouseDrag$=this._createMouseDrag$(c,s).pipe(h.share()),this._domMouseDragEnd$=this._createMouseDragEnd$(this._domMouseDragStart$,s).pipe(h.share()),this._proximateClick$=this._mouseDown$.pipe(h.switchMap(function(e){return o._click$.pipe(h.takeUntil(o._createDeferredMouseMove$(e,o._documentMouseMove$)),h.take(1))}),h.share()),this._staticClick$=this._mouseDown$.pipe(h.switchMap(function(e){return o._click$.pipe(h.takeUntil(o._documentMouseMove$),h.take(1))}),h.share()),this._mouseDragStart$.subscribe(),this._mouseDrag$.subscribe(),this._mouseDragEnd$.subscribe(),this._domMouseDragStart$.subscribe(),this._domMouseDrag$.subscribe(),this._domMouseDragEnd$.subscribe(),this._staticClick$.subscribe(),this._mouseOwner$=this._createOwner$(this._claimMouse$).pipe(h.publishReplay(1),h.refCount()),this._wheelOwner$=this._createOwner$(this._claimWheel$).pipe(h.publishReplay(1),h.refCount()),this._mouseOwner$.subscribe(function(){}),this._wheelOwner$.subscribe(function(){})}return Object.defineProperty(e.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"documentMouseMove$",{get:function(){return this._documentMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"documentMouseUp$",{get:function(){return this._documentMouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domMouseDragStart$",{get:function(){return this._domMouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domMouseDrag$",{get:function(){return this._domMouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domMouseDragEnd$",{get:function(){return this._domMouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domMouseDown$",{get:function(){return this._domMouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domMouseMove$",{get:function(){return this._domMouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseOwner$",{get:function(){return this._mouseOwner$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseDown$",{get:function(){return this._mouseDown$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseMove$",{get:function(){return this._mouseMove$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseLeave$",{get:function(){return this._mouseLeave$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseOut$",{get:function(){return this._mouseOut$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseOver$",{get:function(){return this._mouseOver$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseUp$",{get:function(){return this._mouseUp$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dblClick$",{get:function(){return this._dblClick$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contextMenu$",{get:function(){return this._consistentContextMenu$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseWheel$",{get:function(){return this._mouseWheel$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseDragStart$",{get:function(){return this._mouseDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseDrag$",{get:function(){return this._mouseDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseDragEnd$",{get:function(){return this._mouseDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"proximateClick$",{get:function(){return this._proximateClick$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"staticClick$",{get:function(){return this._staticClick$},enumerable:!0,configurable:!0}),e.prototype.claimMouse=function(e,t){this._claimMouse$.next({name:e,zindex:t})},e.prototype.unclaimMouse=function(e){this._claimMouse$.next({name:e,zindex:null})},e.prototype.deferPixels=function(e,t){this._deferPixelClaims$.next({name:e,deferPixels:t})},e.prototype.undeferPixels=function(e){this._deferPixelClaims$.next({name:e,deferPixels:null})},e.prototype.claimWheel=function(e,t){this._claimWheel$.next({name:e,zindex:t})},e.prototype.unclaimWheel=function(e){this._claimWheel$.next({name:e,zindex:null})},e.prototype.filtered$=function(e,t){return this._filtered(e,t,this._mouseOwner$)},e.prototype.filteredWheel$=function(e,t){return this._filtered(e,t,this._wheelOwner$)},e.prototype._createDeferredMouseMove$=function(n,e){return e.pipe(h.map(function(e){var t=e.clientX-n.clientX,r=e.clientY-n.clientY;return[e,Math.sqrt(t*t+r*r)]}),h.withLatestFrom(this._deferPixels$),h.filter(function(e){var t=e[0],r=(t[0],t[1]);return e[1]<r}),h.map(function(e){var t=e[0],r=t[0];t[1],e[1];return r}))},e.prototype._createMouseDrag$=function(e,t){var r=this;return e.pipe(h.map(function(e){e[0];return e[1]}),h.switchMap(function(e){return u.concat(u.of(e),r._documentMouseMove$).pipe(h.takeUntil(t))}))},e.prototype._createMouseDragEnd$=function(e,t){return e.pipe(h.switchMap(function(e){return t.pipe(h.first())}))},e.prototype._createMouseDragStart$=function(e){return e.pipe(h.map(function(e){var t=e[0];e[1];return t}))},e.prototype._createMouseDragInitiate$=function(e,t,r){var n=this;return e.pipe(h.filter(function(e){return 0===e.button}),h.switchMap(function(e){return u.combineLatest(u.of(e),r?n._createDeferredMouseMove$(e,n._documentMouseMove$):n._documentMouseMove$).pipe(h.takeUntil(t),h.take(1))}))},e.prototype._createOwner$=function(e){return e.pipe(h.scan(function(e,t){return null==t.zindex?delete e[t.name]:e[t.name]=t.zindex,e},{}),h.map(function(e){var t=null,r=-1;for(var n in e)e.hasOwnProperty(n)&&e[n]>r&&(r=e[n],t=n);return t}),h.startWith(null))},e.prototype._filtered=function(t,e,r){return e.pipe(h.withLatestFrom(r),h.filter(function(e){e[0];return e[1]===t}),h.map(function(e){var t=e[0];e[1];return t}))},e}();r.MouseService=n,r.default=n},{"../Geo":277,rxjs:26,"rxjs/operators":224}],438:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var h=e("rxjs"),o=e("rxjs/operators"),l=e("../API"),p=e("../Graph"),n=e("../Edge"),i=e("../Error"),f=e("../State"),d=e("../Viewer"),s=function(){function e(e,t,r,n,i,o,s,a,c,u){this._apiV3=null!=n?n:new l.APIv3(e,r),this._imageLoadingService=null!=o?o:new p.ImageLoadingService,this._graphService=null!=i?i:new p.GraphService(new p.Graph(this.apiV3),this._imageLoadingService),this._loadingService=null!=s?s:new d.LoadingService,this._loadingName="navigator",this._stateService=null!=a?a:new f.StateService(t.transitionMode),this._cacheService=null!=c?c:new d.CacheService(this._graphService,this._stateService),this._playService=null!=u?u:new d.PlayService(this._graphService,this._stateService),this._keyRequested$=new h.BehaviorSubject(null),this._movedToKey$=new h.BehaviorSubject(null),this._request$=null,this._requestSubscription=null,this._nodeRequestSubscription=null}return Object.defineProperty(e.prototype,"apiV3",{get:function(){return this._apiV3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheService",{get:function(){return this._cacheService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"graphService",{get:function(){return this._graphService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageLoadingService",{get:function(){return this._imageLoadingService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loadingService",{get:function(){return this._loadingService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"movedToKey$",{get:function(){return this._movedToKey$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"playService",{get:function(){return this._playService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stateService",{get:function(){return this._stateService},enumerable:!0,configurable:!0}),e.prototype.moveToKey$=function(e){this._abortRequest("to key "+e),this._loadingService.startLoading(this._loadingName);var t=this._moveToKey$(e);return this._makeRequest$(t)},e.prototype.moveDir$=function(i){var t=this;this._abortRequest("in dir "+n.EdgeDirection[i]),this._loadingService.startLoading(this._loadingName);var e=this.stateService.currentNode$.pipe(o.first(),o.mergeMap(function(e){return(-1<[n.EdgeDirection.Next,n.EdgeDirection.Prev].indexOf(i)?e.sequenceEdges$:e.spatialEdges$).pipe(o.first(),o.map(function(e){for(var t=0,r=e.edges;t<r.length;t++){var n=r[t];if(n.data.direction===i)return n.to}return null}))}),o.mergeMap(function(e){return null==e?(t._loadingService.stopLoading(t._loadingName),h.throwError(new Error("Direction ("+i+") does not exist for current node."))):t._moveToKey$(e)}));return this._makeRequest$(e)},e.prototype.moveCloseTo$=function(t,r){var n=this;this._abortRequest("to lat "+t+", lon "+r),this._loadingService.startLoading(this._loadingName);var e=this.apiV3.imageCloseTo$(t,r).pipe(o.mergeMap(function(e){return null==e?(n._loadingService.stopLoading(n._loadingName),h.throwError(new Error("No image found close to lat "+t+", lon "+r+"."))):n._moveToKey$(e.key)}));return this._makeRequest$(e)},e.prototype.setFilter$=function(t){var r=this;return this._stateService.clearNodes(),this._movedToKey$.pipe(o.first(),o.mergeMap(function(e){return null!=e?r._trajectoryKeys$().pipe(o.mergeMap(function(e){return r._graphService.setFilter$(t).pipe(o.mergeMap(function(){return r._cacheKeys$(e)}))}),o.last()):r._keyRequested$.pipe(o.first(),o.mergeMap(function(e){return null!=e?r._graphService.setFilter$(t).pipe(o.mergeMap(function(){return r._graphService.cacheNode$(e)})):r._graphService.setFilter$(t).pipe(o.map(function(){}))}))}),o.map(function(e){}))},e.prototype.setToken$=function(t){var r=this;return this._abortRequest("to set token"),this._stateService.clearNodes(),this._movedToKey$.pipe(o.first(),o.tap(function(e){r._apiV3.setToken(t)}),o.mergeMap(function(e){return null==e?r._graphService.reset$([]):r._trajectoryKeys$().pipe(o.mergeMap(function(e){return r._graphService.reset$(e).pipe(o.mergeMap(function(){return r._cacheKeys$(e)}))}),o.last(),o.map(function(e){}))}))},e.prototype._cacheKeys$=function(e){var t=this,r=e.map(function(e){return t._graphService.cacheNode$(e)});return h.from(r).pipe(o.mergeAll())},e.prototype._abortRequest=function(e){null!=this._requestSubscription&&(this._requestSubscription.unsubscribe(),this._requestSubscription=null),null!=this._nodeRequestSubscription&&(this._nodeRequestSubscription.unsubscribe(),this._nodeRequestSubscription=null),null!=this._request$&&(this._request$.isStopped||this._request$.hasError||this._request$.error(new i.AbortMapillaryError("Request aborted by a subsequent request "+e+".")),this._request$=null)},e.prototype._makeRequest$=function(e){var t=this,r=new h.ReplaySubject(1);return this._requestSubscription=r.subscribe(void 0,function(){}),this._request$=r,this._nodeRequestSubscription=e.subscribe(function(e){t._request$=null,r.next(e),r.complete()},function(e){t._request$=null,r.error(e)}),r},e.prototype._moveToKey$=function(e){var t=this;return this._keyRequested$.next(e),this._graphService.cacheNode$(e).pipe(o.tap(function(e){t._stateService.setNodes([e]),t._movedToKey$.next(e.key)}),o.finalize(function(){t._loadingService.stopLoading(t._loadingName)}))},e.prototype._trajectoryKeys$=function(){return this._stateService.currentState$.pipe(o.first(),o.map(function(e){return e.state.trajectory.map(function(e){return e.key})}))},e}();r.Navigator=s,r.default=s},{"../API":273,"../Edge":275,"../Error":276,"../Graph":278,"../State":281,"../Viewer":285,rxjs:26,"rxjs/operators":224}],439:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s=e("rxjs"),a=e("rxjs/operators"),i=e("../Viewer"),n=function(){function e(e,t,r){var n=this;this._container=r,this._eventEmitter=e,this._navigator=t,this._projection=new i.Projection,this._started=!1,this._navigable$=new s.Subject,this._navigable$.subscribe(function(e){n._eventEmitter.fire(i.Viewer.navigablechanged,e)}),this._navigator.loadingService.loading$.subscribe(function(e){n._eventEmitter.fire(i.Viewer.loadingchanged,e)})}return Object.defineProperty(e.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"navigable$",{get:function(){return this._navigable$},enumerable:!0,configurable:!0}),e.prototype.projectBasic$=function(i){var o=this;return s.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(a.first(),a.map(function(e){var t=e[0],r=e[1],n=o._projection.basicToCanvas(i,o._container.element,t,r);return[Math.round(n[0]),Math.round(n[1])]}))},e.prototype.startEmit=function(){var c=this;if(!this._started){this._started=!0,this._currentNodeSubscription=this._navigator.stateService.currentNodeExternal$.subscribe(function(e){c._eventEmitter.fire(i.Viewer.nodechanged,e)}),this._sequenceEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(a.switchMap(function(e){return e.sequenceEdges$})).subscribe(function(e){c._eventEmitter.fire(i.Viewer.sequenceedgeschanged,e)}),this._spatialEdgesSubscription=this._navigator.stateService.currentNodeExternal$.pipe(a.switchMap(function(e){return e.spatialEdges$})).subscribe(function(e){c._eventEmitter.fire(i.Viewer.spatialedgeschanged,e)}),this._moveSubscription=s.combineLatest(this._navigator.stateService.inMotion$,this._container.mouseService.active$,this._container.touchService.active$).pipe(a.map(function(e){return e[0]||e[1]||e[2]}),a.distinctUntilChanged()).subscribe(function(e){e?c._eventEmitter.fire(i.Viewer.movestart,null):c._eventEmitter.fire(i.Viewer.moveend,null)}),this._bearingSubscription=this._container.renderService.bearing$.pipe(a.auditTime(100),a.distinctUntilChanged(function(e,t){return Math.abs(t-e)<1})).subscribe(function(e){c._eventEmitter.fire(i.Viewer.bearingchanged,e)});var e=this._container.mouseService.active$.pipe(a.switchMap(function(e){return e?s.empty():c._container.mouseService.mouseMove$}));this._viewerMouseEventSubscription=s.merge(this._mapMouseEvent$(i.Viewer.click,this._container.mouseService.staticClick$),this._mapMouseEvent$(i.Viewer.contextmenu,this._container.mouseService.contextMenu$),this._mapMouseEvent$(i.Viewer.dblclick,this._container.mouseService.dblClick$),this._mapMouseEvent$(i.Viewer.mousedown,this._container.mouseService.mouseDown$),this._mapMouseEvent$(i.Viewer.mousemove,e),this._mapMouseEvent$(i.Viewer.mouseout,this._container.mouseService.mouseOut$),this._mapMouseEvent$(i.Viewer.mouseover,this._container.mouseService.mouseOver$),this._mapMouseEvent$(i.Viewer.mouseup,this._container.mouseService.mouseUp$)).pipe(a.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$),a.map(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=e[2],s=e[3],a=c._projection.eventToUnprojection(n,c._container.element,i,o,s);return{basicPoint:a.basicPoint,latLon:a.latLon,originalEvent:n,pixelPoint:a.pixelPoint,target:c._eventEmitter,type:r}})).subscribe(function(e){c._eventEmitter.fire(e.type,e)})}},e.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)},e.prototype.unproject$=function(i){var o=this;return s.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.reference$,this._navigator.stateService.currentTransform$).pipe(a.first(),a.map(function(e){var t=e[0],r=e[1],n=e[2];return o._projection.canvasToUnprojection(i,o._container.element,t,r,n).latLon}))},e.prototype.unprojectBasic$=function(n){var i=this;return s.combineLatest(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).pipe(a.first(),a.map(function(e){var t=e[0],r=e[1];return i._projection.canvasToBasic(n,i._container.element,t,r)}))},e.prototype._mapMouseEvent$=function(t,e){return e.pipe(a.map(function(e){return[t,e]}))},e}();r.Observer=n,r.default=n},{"../Viewer":285,rxjs:26,"rxjs/operators":224}],440:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var l=e("rxjs"),p=e("rxjs/operators"),a=e("../Edge"),c=e("../Graph"),n=function(){function r(e,t,r){this._graphService=e,this._stateService=t,this._graphCalculator=r||new c.GraphCalculator,this._directionSubject$=new l.Subject,this._direction$=this._directionSubject$.pipe(p.startWith(a.EdgeDirection.Next),p.publishReplay(1),p.refCount()),this._direction$.subscribe(),this._playing=!1,this._playingSubject$=new l.Subject,this._playing$=this._playingSubject$.pipe(p.startWith(this._playing),p.publishReplay(1),p.refCount()),this._playing$.subscribe(),this._speed=.5,this._speedSubject$=new l.Subject,this._speed$=this._speedSubject$.pipe(p.startWith(this._speed),p.publishReplay(1),p.refCount()),this._speed$.subscribe(),this._nodesAhead=this._mapNodesAhead(this._mapSpeed(this._speed)),this._bridging$=null}return Object.defineProperty(r.prototype,"playing",{get:function(){return this._playing},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"direction$",{get:function(){return this._direction$},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"playing$",{get:function(){return this._playing$},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"speed$",{get:function(){return this._speed$},enumerable:!0,configurable:!0}),r.prototype.play=function(){var h=this;if(!this._playing){this._stateService.cutNodes();var e=this._setSpeed(this._speed);this._stateService.setSpeed(e),this._graphModeSubscription=this._speed$.pipe(p.map(function(e){return r.sequenceSpeed<e?c.GraphMode.Sequence:c.GraphMode.Spatial}),p.distinctUntilChanged()).subscribe(function(e){h._graphService.setGraphMode(e)}),this._cacheSubscription=l.combineLatest(this._stateService.currentNode$.pipe(p.map(function(e){return[e.sequenceKey,e.key]}),p.distinctUntilChanged(void 0,function(e){var t=e[0];e[1];return t})),this._graphService.graphMode$,this._direction$).pipe(p.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1],o=e[2];if(o!==a.EdgeDirection.Next&&o!==a.EdgeDirection.Prev)return l.of([void 0,o]);var s=(i===c.GraphMode.Sequence?h._graphService.cacheSequenceNodes$(r,n):h._graphService.cacheSequence$(r)).pipe(p.retry(3),p.catchError(function(e){return console.error(e),l.of(void 0)}));return l.combineLatest(s,l.of(o))}),p.switchMap(function(e){var t=e[0],r=e[1];if(void 0===t)return l.empty();var u=t.keys.slice();return r===a.EdgeDirection.Prev&&u.reverse(),h._stateService.currentState$.pipe(p.map(function(e){return[e.state.trajectory[e.state.trajectory.length-1].key,e.state.nodesAhead]}),p.scan(function(e,t){var r=e[0],n=(e[1],t[0]),i=t[1];void 0===r&&(r=n);var o=u.length-1;if(i>=h._nodesAhead||u[o]===r)return[r,[]];var s=u.indexOf(n),a=u.indexOf(r)+1,c=Math.min(o,s+h._nodesAhead-i)+1;return c<=a?[r,[]]:[u[c-1],u.slice(a,c)]},[void 0,[]]),p.mergeMap(function(e){e[0];var t=e[1];return l.from(t)}))}),p.mergeMap(function(e){return h._graphService.cacheNode$(e).pipe(p.catchError(function(){return l.empty()}))},6)).subscribe(),this._playingSubscription=this._stateService.currentState$.pipe(p.filter(function(e){return e.state.nodesAhead<h._nodesAhead}),p.distinctUntilChanged(void 0,function(e){return e.state.lastNode.key}),p.map(function(e){for(var t=e.state.lastNode,r=e.state.trajectory,n=void 0,i=r.length-2;0<=i;i--){var o=r[i];if(o.sequenceKey!==t.sequenceKey)break;if(o.capturedAt!==t.capturedAt){n=o.capturedAt<t.capturedAt;break}}return[e.state.lastNode,n]}),p.withLatestFrom(this._direction$),p.switchMap(function(e){var t=e[0],r=t[0],n=t[1],i=e[1];return l.zip((-1<[a.EdgeDirection.Next,a.EdgeDirection.Prev].indexOf(i)?r.sequenceEdges$:r.spatialEdges$).pipe(p.first(function(e){return e.cached}),p.timeout(15e3)),l.of(i)).pipe(p.map(function(e){for(var t=e[0],r=e[1],n=0,i=t.edges;n<i.length;n++){var o=i[n];if(o.data.direction===r)return o.to}return null}),p.switchMap(function(e){return null!=e?h._graphService.cacheNode$(e):h._bridge$(r,n).pipe(p.filter(function(e){return!!e}))}))})).subscribe(function(e){h._stateService.appendNodes([e])},function(e){console.error(e),h.stop()}),this._clearSubscription=this._stateService.currentNode$.pipe(p.bufferCount(1,10)).subscribe(function(e){h._stateService.clearPriorNodes()}),this._setPlaying(!0);var t=this._stateService.currentState$.pipe(p.map(function(e){return e.state}),p.distinctUntilChanged(function(e,t){var r=e[0],n=e[1],i=t[0],o=t[1];return r===i&&n===o},function(e){return[e.currentNode.key,e.lastNode.key]}),p.filter(function(e){return e.currentNode.key===e.lastNode.key&&e.currentIndex===e.trajectory.length-1}),p.map(function(e){return e.currentNode}));this._stopSubscription=l.combineLatest(t,this._direction$).pipe(p.switchMap(function(e){var t=e[0],r=e[1],n=(-1<[a.EdgeDirection.Next,a.EdgeDirection.Prev].indexOf(r)?t.sequenceEdges$:t.spatialEdges$).pipe(p.first(function(e){return e.cached}),p.timeout(15e3),p.catchError(function(e){return console.error(e),l.of({cached:!1,edges:[]})}));return l.combineLatest(l.of(r),n).pipe(p.map(function(e){for(var t=e[0],r=0,n=e[1].edges;r<n.length;r++){if(n[r].data.direction===t)return!0}return!1}))}),p.mergeMap(function(e){return e||!h._bridging$?l.of(e):h._bridging$.pipe(p.map(function(e){return null!=e}),p.catchError(function(e){return console.error(e),l.of(!1)}))}),p.first(function(e){return!e})).subscribe(void 0,void 0,function(){h.stop()}),this._stopSubscription.closed&&(this._stopSubscription=null)}},r.prototype.setDirection=function(e){this._directionSubject$.next(e)},r.prototype.setSpeed=function(e){if((e=Math.max(0,Math.min(1,e)))!==this._speed){var t=this._setSpeed(e);this._playing&&this._stateService.setSpeed(t),this._speedSubject$.next(this._speed)}},r.prototype.stop=function(){this._playing&&(this._stopSubscription&&(this._stopSubscription.closed||this._stopSubscription.unsubscribe(),this._stopSubscription=null),this._graphModeSubscription.unsubscribe(),this._graphModeSubscription=null,this._cacheSubscription.unsubscribe(),this._cacheSubscription=null,this._playingSubscription.unsubscribe(),this._playingSubscription=null,this._clearSubscription.unsubscribe(),this._clearSubscription=null,this._stateService.setSpeed(1),this._stateService.cutNodes(),this._graphService.setGraphMode(c.GraphMode.Spatial),this._setPlaying(!1))},r.prototype._bridge$=function(s,a){var c=this;if(void 0===a)return l.of(null);var e=this._graphCalculator.boundingBoxCorners(s.latLon,25);return this._bridging$=this._graphService.cacheBoundingBox$(e[0],e[1]).pipe(p.mergeMap(function(e){for(var t=null,r=0,n=e;r<n.length;r++){var i=n[r];if(i.sequenceKey!==s.sequenceKey&&i.cameraUuid&&i.cameraUuid===s.cameraUuid&&i.capturedAt!==s.capturedAt&&i.capturedAt>s.capturedAt===a){var o=Math.abs(i.capturedAt-s.capturedAt);15e3<o||(!t||o<Math.abs(t.capturedAt-s.capturedAt))&&(t=i)}}return t?c._graphService.cacheNode$(t.key):l.of(null)}),p.finalize(function(){c._bridging$=null}),p.publish(),p.refCount()),this._bridging$},r.prototype._mapSpeed=function(e){var t=2*e-1;return Math.pow(10,t)-.2*t},r.prototype._mapNodesAhead=function(e){return Math.round(Math.max(10,Math.min(50,8+6*e)))},r.prototype._setPlaying=function(e){this._playing=e,this._playingSubject$.next(e)},r.prototype._setSpeed=function(e){this._speed=e;var t=this._mapSpeed(this._speed);return this._nodesAhead=this._mapNodesAhead(t),t},r.sequenceSpeed=.54,r}();r.PlayService=n,r.default=n},{"../Edge":275,"../Graph":278,rxjs:26,"rxjs/operators":224}],441:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var g=e("three"),n=e("../Geo"),i=function(){function e(e,t){this._geoCoords=e||new n.GeoCoords,this._viewportCoords=t||new n.ViewportCoords}return e.prototype.basicToCanvas=function(e,t,r,n){return this._viewportCoords.basicToCanvas(e[0],e[1],t,n,r.perspective)},e.prototype.canvasToBasic=function(e,t,r,n){var i=this._viewportCoords.canvasToBasic(e[0],e[1],t,n,r.perspective);return(i[0]<0||1<i[0]||i[1]<0||1<i[1])&&(i=null),i},e.prototype.eventToUnprojection=function(e,t,r,n,i){var o=this._viewportCoords.canvasPosition(e,t);return this.canvasToUnprojection(o,t,r,n,i)},e.prototype.canvasToUnprojection=function(e,t,r,n,i){var o=e[0],s=e[1],a=this._viewportCoords.canvasToViewport(o,s,t),c=a[0],u=a[1],h=new g.Vector3(c,u,1).unproject(r.perspective),l=i.projectBasic(h.toArray());(l[0]<0||1<l[0]||l[1]<0||1<l[1])&&(l=null);var p=h.clone().sub(r.camera.position).normalize(),f=-2/p.z,d=null;if(0<f&&f<100&&l){var m=p.clone().multiplyScalar(f).add(r.camera.position),v=this._geoCoords.enuToGeodetic(m.x,m.y,m.z,n.lat,n.lon,n.alt).slice(0,2);d={lat:v[0],lon:v[1]}}return{basicPoint:l,latLon:d,pixelPoint:[o,s]}},e}();r.Projection=i,r.default=i},{"../Geo":277,three:225}],442:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs/operators"),s=e("three"),f=e("virtual-dom"),a=e("rxjs"),d=e("../Viewer"),c=function(){function e(){}return Object.defineProperty(e.prototype,"json",{set:function(e){this._json=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"image",{set:function(e){this._image=e,this._texture=new s.Texture(this._image),this._texture.minFilter=s.NearestFilter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loaded",{get:function(){return!(!this._image||!this._json)},enumerable:!0,configurable:!0}),e.prototype.getGLSprite=function(e){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");var t=this._json[e];if(!t)return console.warn("Sprite with key"+e+"does not exist in sprite definition."),new s.Object3D;var r=this._texture.clone();r.needsUpdate=!0;var n=this._image.width,i=this._image.height;r.offset.x=t.x/n,r.offset.y=(i-t.y-t.height)/i,r.repeat.x=t.width/n,r.repeat.y=t.height/i;var o=new s.SpriteMaterial({map:r});return new s.Sprite(o)},e.prototype.getDOMSprite=function(e,t){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==t&&(t=d.Alignment.Center);var r=this._json[e];if(!r)return console.warn("Sprite with key"+e+"does not exist in sprite definition."),f.h("div",{},[]);var n=r.y,i=r.x+r.width,o=r.y+r.height,s=r.x,a=-r.x,c=-r.y,u=this._image.height,h=this._image.width;switch(t){case d.Alignment.Bottom:case d.Alignment.Center:case d.Alignment.Top:a-=r.width/2;break;case d.Alignment.BottomLeft:case d.Alignment.Left:case d.Alignment.TopLeft:a-=r.width;break;case d.Alignment.BottomRight:case d.Alignment.Right:case d.Alignment.TopRight:}switch(t){case d.Alignment.Center:case d.Alignment.Left:case d.Alignment.Right:c-=r.height/2;break;case d.Alignment.Top:case d.Alignment.TopLeft:case d.Alignment.TopRight:c-=r.height;break;case d.Alignment.Bottom:case d.Alignment.BottomLeft:case d.Alignment.BottomRight:}var l=1/r.pixelRatio;n*=l,i*=l,o*=l,s*=l,a*=l,c*=l,u*=l,h*=l;var p={src:this._image.src,style:{clip:"rect("+n+"px, "+i+"px, "+o+"px, "+s+"px)",height:u+"px",left:a+"px",position:"absolute",top:c+"px",width:h+"px"}};return f.h("img",p,[])},e}(),n=function(){function e(t){var r=this;if(this._retina=1<window.devicePixelRatio,this._spriteAtlasOperation$=new a.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.pipe(o.startWith(function(e){return e}),o.scan(function(e,t){return t(e)},new c),o.publishReplay(1),o.refCount()),this._spriteAtlas$.subscribe(function(){}),null!=t){var n=this._retina?"@2x":"",i=new XMLHttpRequest;i.open("GET",t+n+".png",!0),i.responseType="arraybuffer",i.onload=function(){var t=new Image;t.onload=function(){r._spriteAtlasOperation$.next(function(e){return e.image=t,e})};var e=new Blob([i.response]);t.src=window.URL.createObjectURL(e)},i.onerror=function(e){console.error(new Error("Failed to fetch sprite sheet ("+t+n+".png)"))},i.send();var e=new XMLHttpRequest;e.open("GET",t+n+".json",!0),e.responseType="text",e.onload=function(){var t=JSON.parse(e.response);r._spriteAtlasOperation$.next(function(e){return e.json=t,e})},e.onerror=function(e){console.error(new Error("Failed to fetch sheet ("+t+n+".json)"))},e.send()}}return Object.defineProperty(e.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),e}();r.SpriteService=n,r.default=n},{"../Viewer":285,rxjs:26,"rxjs/operators":224,three:225,"virtual-dom":230}],443:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var c=e("rxjs"),u=e("rxjs/operators"),n=function(){function e(e,t){var r=this;this._activeSubject$=new c.BehaviorSubject(!1),this._active$=this._activeSubject$.pipe(u.distinctUntilChanged(),u.publishReplay(1),u.refCount()),c.fromEvent(t,"touchmove").subscribe(function(e){e.preventDefault()}),this._touchStart$=c.fromEvent(e,"touchstart"),this._touchMove$=c.fromEvent(e,"touchmove"),this._touchEnd$=c.fromEvent(e,"touchend"),this._touchCancel$=c.fromEvent(e,"touchcancel");var n=this._touchStart$.pipe(u.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}),u.share());this._doubleTap$=n.pipe(u.bufferWhen(function(){return n.pipe(u.first(),u.switchMap(function(e){return c.merge(c.timer(300),n).pipe(u.take(1))}))}),u.filter(function(e){return 2===e.length}),u.map(function(e){return e[e.length-1]}),u.share()),this._doubleTap$.subscribe(function(e){e.preventDefault()}),this._singleTouchMove$=this._touchMove$.pipe(u.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}),u.share());var i=c.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(u.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length})),o=c.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).pipe(u.filter(function(e){return 1<=e.touches.length})),s=c.merge(this._touchEnd$,this._touchCancel$).pipe(u.filter(function(e){return 0===e.touches.length}));this._singleTouchDragStart$=i.pipe(u.mergeMap(function(e){return r._singleTouchMove$.pipe(u.takeUntil(c.merge(s,o)),u.take(1))})),this._singleTouchDragEnd$=i.pipe(u.mergeMap(function(e){return c.merge(s,o).pipe(u.first())})),this._singleTouchDrag$=i.pipe(u.switchMap(function(e){return r._singleTouchMove$.pipe(u.skip(1),u.takeUntil(c.merge(o,s)))}));var a=c.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=a.pipe(u.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length})),this._pinchEnd$=a.pipe(u.filter(function(e){return 2!==e.touches.length||2!==e.targetTouches.length})),this._pinchOperation$=new c.Subject,this._pinch$=this._pinchOperation$.pipe(u.scan(function(e,t){return t(e)},{changeX:0,changeY:0,clientX:0,clientY:0,distance:0,distanceChange:0,distanceX:0,distanceY:0,originalEvent:null,pageX:0,pageY:0,screenX:0,screenY:0,touch1:null,touch2:null})),this._touchMove$.pipe(u.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length}),u.map(function(v){return function(e){var t=v.touches[0],r=v.touches[1],n=Math.min(t.clientX,r.clientX),i=Math.max(t.clientX,r.clientX),o=Math.min(t.clientY,r.clientY),s=n+(i-n)/2,a=o+(Math.max(t.clientY,r.clientY)-o)/2,c=s+t.pageX-t.clientX,u=a+t.pageY-t.clientY,h=s+t.screenX-t.clientX,l=a+t.screenY-t.clientY,p=Math.abs(t.clientX-r.clientX),f=Math.abs(t.clientY-r.clientY),d=Math.sqrt(p*p+f*f),m=d-e.distance;return{changeX:p-e.distanceX,changeY:f-e.distanceY,clientX:s,clientY:a,distance:d,distanceChange:m,distanceX:p,distanceY:f,originalEvent:v,pageX:c,pageY:u,screenX:h,screenY:l,touch1:t,touch2:r}}})).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.pipe(u.switchMap(function(e){return r._pinch$.pipe(u.skip(1),u.takeUntil(r._pinchEnd$))}))}return Object.defineProperty(e.prototype,"active$",{get:function(){return this._active$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activate$",{get:function(){return this._activeSubject$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"doubleTap$",{get:function(){return this._doubleTap$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchStart$",{get:function(){return this._touchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchMove$",{get:function(){return this._touchMove$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchEnd$",{get:function(){return this._touchEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchCancel$",{get:function(){return this._touchCancel$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"singleTouchDragStart$",{get:function(){return this._singleTouchDragStart$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"singleTouchDrag$",{get:function(){return this._singleTouchDrag$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"singleTouchDragEnd$",{get:function(){return this._singleTouchDragEnd$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pinchStart$",{get:function(){return this._pinchStart$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pinchEnd$",{get:function(){return this._pinchEnd$},enumerable:!0,configurable:!0}),e}();r.TouchService=n},{rxjs:26,"rxjs/operators":224}],444:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("rxjs"),a=e("rxjs/operators"),c=e("when"),u=e("../Viewer"),h=e("../Utils"),s=function(s){function e(e,t,r,n,i){var o=s.call(this)||this;return n=null!=n?n:{},h.Settings.setOptions(n),h.Urls.setOptions(n.url),o._navigator=new u.Navigator(t,n,i),o._container=new u.Container(e,o._navigator.stateService,n),o._observer=new u.Observer(o,o._navigator,o._container),o._componentController=new u.ComponentController(o._container,o._navigator,o._observer,r,n.component),o}return i(e,s),Object.defineProperty(e.prototype,"isNavigable",{get:function(){return this._componentController.navigable},enumerable:!0,configurable:!0}),e.prototype.activateComponent=function(e){this._componentController.activate(e)},e.prototype.activateCover=function(){this._componentController.activateCover()},e.prototype.deactivateComponent=function(e){this._componentController.deactivate(e)},e.prototype.deactivateCover=function(){this._componentController.deactivateCover()},e.prototype.getBearing=function(){var e=this;return c.promise(function(t,r){e._container.renderService.bearing$.pipe(a.first()).subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.getCenter=function(){var e=this;return c.promise(function(t,r){e._navigator.stateService.getCenter().subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.getComponent=function(e){return this._componentController.get(e)},e.prototype.getContainer=function(){return this._container.element},e.prototype.getZoom=function(){var e=this;return c.promise(function(t,r){e._navigator.stateService.getZoom().subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.moveCloseTo=function(e,t){var n=this.isNavigable?this._navigator.moveCloseTo$(e,t):o.throwError(new Error("Calling moveCloseTo is not supported when viewer is not navigable."));return c.promise(function(t,r){n.subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.moveDir=function(e){var n=this.isNavigable?this._navigator.moveDir$(e):o.throwError(new Error("Calling moveDir is not supported when viewer is not navigable."));return c.promise(function(t,r){n.subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.moveToKey=function(e){var n=this.isNavigable?this._navigator.moveToKey$(e):o.throwError(new Error("Calling moveToKey is not supported when viewer is not navigable."));return c.promise(function(t,r){n.subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.projectFromBasic=function(e){var n=this;return c.promise(function(t,r){n._observer.projectBasic$(e).subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},e.prototype.setAuthToken=function(e){var r=this.isNavigable?this._navigator.setToken$(e):o.throwError(new Error("Calling setAuthToken is not supported when viewer is not navigable."));return c.promise(function(e,t){r.subscribe(function(){e(void 0)},function(e){t(e)})})},e.prototype.setCenter=function(e){this._navigator.stateService.setCenter(e)},e.prototype.setFilter=function(r){var n=this;return c.promise(function(e,t){n._navigator.setFilter$(r).subscribe(function(){e(void 0)},function(e){t(e)})})},e.prototype.setRenderMode=function(e){this._container.renderService.renderMode$.next(e)},e.prototype.setTransitionMode=function(e){this._navigator.stateService.setTransitionMode(e)},e.prototype.setZoom=function(e){this._navigator.stateService.setZoom(e)},e.prototype.unproject=function(e){var n=this;return c.promise(function(t,r){n._observer.unproject$(e).subscribe(function(e){t(e)},function(e){r(e)})})},e.prototype.unprojectToBasic=function(e){var n=this;return c.promise(function(t,r){n._observer.unprojectBasic$(e).subscribe(function(e){t(e)},function(e){r(e)})})},e.bearingchanged="bearingchanged",e.click="click",e.contextmenu="contextmenu",e.dblclick="dblclick",e.loadingchanged="loadingchanged",e.mousedown="mousedown",e.mousemove="mousemove",e.mouseout="mouseout",e.mouseover="mouseover",e.mouseup="mouseup",e.moveend="moveend",e.movestart="movestart",e.navigablechanged="navigablechanged",e.nodechanged="nodechanged",e.sequenceedgeschanged="sequenceedgeschanged",e.spatialedgeschanged="spatialedgeschanged",e}(h.EventEmitter);r.Viewer=s},{"../Utils":284,"../Viewer":285,rxjs:26,"rxjs/operators":224,when:271}]},{},[279])(279)});