X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2b5c4c69e779a0d38ecb62029d234846b4934cdc..e019a1f0314207ffbb928f95138890dad1569f98:/vendor/assets/iD/iD/mapillary-js/mapillary.min.js diff --git a/vendor/assets/iD/iD/mapillary-js/mapillary.min.js b/vendor/assets/iD/iD/mapillary-js/mapillary.min.js index c62395aa2..744702c31 100644 --- a/vendor/assets/iD/iD/mapillary-js/mapillary.min.js +++ b/vendor/assets/iD/iD/mapillary-js/mapillary.min.js @@ -1 +1 @@ -!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(){return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[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:{}};t[a][0].call(h.exports,function(e){var r=t[a][1][e];return i(r||e)},h,h.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;ac)&&(c=l[0]),(!h||l[1]>u)&&(u=l[1])}var p=c-n,f=u-s,d=Math.min(p,f),m=d/2,v=new a(null,i);if(0===d)return[n,s];for(var g=n;gb.d&&(b=_);for(var x=v.length;v.length;){var w=v.pop();w.d>b.d&&(b=w,r&&console.log("found best %d after %d probes",Math.round(1e4*w.d)/1e4,x)),w.max-b.d<=t||(m=w.h/2,v.push(new o(w.x-m,w.y-m,m,e)),v.push(new o(w.x+m,w.y-m,m,e)),v.push(new o(w.x-m,w.y+m,m,e)),v.push(new o(w.x+m,w.y+m,m,e)),x+=4)}return r&&(console.log("num probes: "+x),console.log("best distance: "+b.d)),[b.x,b.y]}function i(e,t){return t.max-e.max}function o(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;ot!=l[1]>t&&e<(l[0]-h[0])*(t-h[1])/(l[1]-h[1])+h[0]&&(n=!n),i=Math.min(i,function(e,t,r,n){var i=r[0],o=r[1],a=n[0]-i,s=n[1]-o;if(0!==a||0!==s){var c=((e-i)*a+(t-o)*s)/(a*a+s*s);c>1?(i=n[0],o=n[1]):c>0&&(i+=a*c,o+=s*c)}return a=e-i,s=t-o,a*a+s*s}(e,t,h,l))}return(n?1:-1)*Math.sqrt(i)}(e,t,n),this.max=this.d+this.h*Math.SQRT2}var a=e("tinyqueue");t.exports=n,t.exports.default=n},{tinyqueue:232}],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,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){void 0===t&&(t=1e-6);var r,n,i,o,a;for(i=e,a=0;a<8;a++){if(o=this.sampleCurveX(i)-e,Math.abs(o)n)return n;for(;ro?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";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function o(e,t,r){for(var n,o=[],a=t;a0?u-4:u;var h=0;for(t=0;t>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=s[e.charCodeAt(t)]<<2|s[e.charCodeAt(t+1)]>>4,a[h++]=255&i):1===o&&(i=s[e.charCodeAt(t)]<<10|s[e.charCodeAt(t+1)]<<4|s[e.charCodeAt(t+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",s=[],c=0,u=r-n;cu?u:c+16383));return 1===n?(t=e[r-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),s.push(i),s.join("")};for(var a=[],s=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,l=u.length;h>>0:o>>>0;(s=i.exec(n))&&!((c=s.index+s[0].length)>p&&(h.push(n.slice(p,s.index)),!r&&s.length>1&&s[0].replace(a,function(){for(var t=1;t1&&s.index=o));)i.lastIndex===s.index&&i.lastIndex++;return p===n.length?!u&&i.test("")||h.push(""):h.push(n.slice(p)),h.length>o?h.slice(0,o):h}}()},{}],6:[function(e,t,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(h===setTimeout)return setTimeout(e,0);if((h===n||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function a(){m&&f&&(m=!1,f.length?d=f.concat(d):v=-1,d.length&&s())}function s(){if(!m){var e=o(a);m=!0;for(var t=d.length;t;){for(f=d,d=[];++v1)for(var r=1;rI)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return s(e)}return o(e,t,r)}function o(e,t,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return j(e)?function(e,t,r){if(t<0||e.byteLength=I)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+I.toString(16)+" bytes");return 0|e}function h(e,t){if(i.isBuffer(e))return e.length;if(A(e)||j(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 T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return O(e).length;default:if(n)return T(e).length;t=(""+t).toLowerCase(),n=!0}}function l(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,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0);(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,R(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):d(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=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=2,s/=2,c/=2,r/=2}var u;if(i){var h=-1;for(u=r;us&&(r=s-c),u=r;u>=0;u--){for(var l=!0,p=0;pi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?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:128==(192&(c=e[i+1]))&&(l=(31&o)<<6|63&c)>127&&(a=l);break;case 3:c=e[i+1],u=e[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:c=e[i+1],u=e[i+2],h=e[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)>65535&&l<1114112&&(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 function(e){var t=e.length;if(t<=D)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nr)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,r,n,o,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function E(e,t,r,n,i){return t=+t,r>>>=0,i||M(e,0,r,4),N.write(e,t,r,n,23,4),r+4}function C(e,t,r,n,i){return t=+t,r>>>=0,i||M(e,0,r,8),N.write(e,t,r,n,52,8),r+8}function T(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&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 O(e){return L.toByteArray(function(e){if((e=e.trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function P(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function j(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function A(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function R(e){return e!=e}var L=e("base64-js"),N=e("ieee754");r.Buffer=i,r.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},r.INSPECT_MAX_BYTES=50;var I=2147483647;r.kMaxLength=I,(i.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&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,r){return o(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}(e,t,r)},i.allocUnsafe=function(e){return s(e)},i.allocUnsafeSlow=function(e){return s(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,a=Math.min(r,n);o0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,o){if(!i.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===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;for(var a=o-n,s=r-t,c=Math.min(a,s),u=this.slice(n,o),h=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return g(this,e,t,r);case"latin1":case"binary":return y(this,e,t,r);case"base64":return b(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var D=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},i.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o=i&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},i.prototype.readInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),N.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),N.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),N.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),N.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){S(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){S(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},i.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),n>0&&n=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=0;--i)e[i+t]=this[i+r];else if(o<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a=n.next.y&&n.next.y!==n.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.x&&n.x>=l&&i!==n.x&&u(or.x)&&f(n,e)&&(r=n,d=c),n=n.next;return r}(e,t)){var r=d(t,e);o(r,r.next)}}(m[a],r),r=o(r,r.next);return r}(e,t,h,r)),e.length>80*r){p=v=e[0],m=g=e[1];for(var x=r;xv&&(v=y),b>g&&(g=b);_=0!==(_=Math.max(v-p,g-m))?1/_:0}return a(h,l,r,p,m,_),l}function i(e,t,r,n,i){var o,a;if(i===y(e,t,r,n)>0)for(o=t;o=t;o-=n)a=m(o,e[o],e[o+1],a);return a&&l(a,a.next)&&(v(a),a=a.next),a}function o(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!l(n,n.next)&&0!==h(n.prev,n,n.next))n=n.next;else{if(v(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function a(e,t,r,n,i,s,m){if(e){!m&&s&&function(e,t,r,n){var i=e;do{null===i.z&&(i.z=c(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,o,a,s,c,u=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t0||c>0&&n;)0!==s&&(0===c||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,c--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1)}(i)}(e,n,i,s);for(var g,y,b=e;e.prev!==e.next;)if(g=e.prev,y=e.next,s?function(e,t,r,n){var i=e.prev,o=e,a=e.next;if(h(i,o,a)>=0)return!1;var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,f=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,d=c(s,l,t,r,n),m=c(p,f,t,r,n),v=e.nextZ;for(;v&&v.z<=m;){if(v!==e.prev&&v!==e.next&&u(i.x,i.y,o.x,o.y,a.x,a.y,v.x,v.y)&&h(v.prev,v,v.next)>=0)return!1;v=v.nextZ}v=e.prevZ;for(;v&&v.z>=d;){if(v!==e.prev&&v!==e.next&&u(i.x,i.y,o.x,o.y,a.x,a.y,v.x,v.y)&&h(v.prev,v,v.next)>=0)return!1;v=v.prevZ}return!0}(e,n,i,s):function(e){var t=e.prev,r=e,n=e.next;if(h(t,r,n)>=0)return!1;var i=e.next.next;for(;i!==e.prev;){if(u(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&h(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(e))t.push(g.i/r),t.push(e.i/r),t.push(y.i/r),v(e),e=y.next,b=y.next;else if((e=y)===b){m?1===m?a(e=function(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!l(i,o)&&p(i,n,n.next,o)&&f(i,o)&&f(o,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(o.i/r),v(n),v(n.next),n=e=o),n=n.next}while(n!==e);return n}(e,t,r),t,r,n,i,s,2):2===m&&function(e,t,r,n,i,s){var c=e;do{for(var u=c.next.next;u!==c.prev;){if(c.i!==u.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.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&&p(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&f(e,t)&&f(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)}(c,u)){var h=d(c,u);return c=o(c,c.next),h=o(h,h.next),a(c,t,r,n,i,s),void a(h,t,r,n,i,s)}u=u.next}c=c.next}while(c!==e)}(e,t,r,n,i,s):a(o(e),t,r,n,i,s,1);break}}}function s(e,t){return e.x-t.x}function c(e,t,r,n,i){return e=32767*(e-r)*i,t=32767*(t-n)*i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function u(e,t,r,n,i,o,a,s){return(i-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(n-s)-(r-a)*(t-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function h(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function l(e,t){return e.x===t.x&&e.y===t.y}function p(e,t,r,n){return!!(l(e,t)&&l(r,n)||l(e,n)&&l(r,t))||h(e,t,r)>0!=h(e,t,n)>0&&h(r,n,e)>0!=h(r,n,t)>0}function f(e,t){return h(e.prev,e,e.next)<0?h(e,t,e.next)>=0&&h(e,e.prev,t)>=0:h(e,t,e.prev)<0||h(e,e.next,t)<0}function d(e,t){var r=new g(e.i,e.x,e.y),n=new g(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function m(e,t,r,n){var i=new g(e,t,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 v(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 g(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 y(e,t,r,n){for(var i=0,o=t,a=r-n;o0&&(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];return t||(t=e[n]={}),t}},{"individual/one-version":19}],10:[function(e,t,r){"use strict";function n(e,t){var r;for(r in t)e[r]=t[r];return e}function i(e,t){if(this._jsongUrl=e,"number"==typeof t){t={timeout:t}}this._config=n({timeout:15e3,headers:{}},t||{})}var o=e("./request"),a=e("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:a,get:function(e){var t=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:e,method:"get"}),this._config);return o("GET",t,this)},set:function(e){var t=n(this.buildQueryObject(this._jsongUrl,"POST",{jsonGraph:e,method:"set"}),this._config);t.headers["Content-Type"]="application/x-www-form-urlencoded";return o("POST",t,this)},call:function(e,t,r,i){t=t||[],r=r||[],i=i||[];var a=[];a.push("method=call"),a.push("callPath="+encodeURIComponent(JSON.stringify(e))),a.push("arguments="+encodeURIComponent(JSON.stringify(t))),a.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),a.push("paths="+encodeURIComponent(JSON.stringify(i)));var s=n(this.buildQueryObject(this._jsongUrl,"POST",a.join("&")),this._config);s.headers["Content-Type"]="application/x-www-form-urlencoded";return o("POST",s,this)}},i.XMLHttpSource=i,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,t,r){(function(e){"use strict";t.exports=function(){var t=new e.XMLHttpRequest;if("withCredentials"in t)return t;if(e.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(e){"use strict";t.exports=function(){var t,r,n;if(e.XMLHttpRequest)return new e.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;n<3;n++)try{if(t=r[n],new e.ActiveXObject(t))break}catch(e){}return new e.ActiveXObject(t)}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";function n(){}function i(e,t,r){return n.create(function(n){var i,u,h,l,p,f={method:e||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(p in t)c.call(t,p)&&(f[p]=t[p]);f.crossDomain||f.headers["X-Requested-With"]||(f.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(f);try{i=f.crossDomain?s():a()}catch(e){n.onError(e)}try{f.user?i.open(f.method,f.url,f.async,f.user,f.password):i.open(f.method,f.url,f.async),i.timeout=f.timeout,i.withCredentials=!1!==f.withCredentials,h=f.headers;for(l in h)c.call(h,l)&&i.setRequestHeader(l,h[l]);if(f.responseType)try{i.responseType=f.responseType}catch(e){if("json"!==f.responseType)throw e}i.onreadystatechange=function(e){4===i.readyState&&(u||(u=!0,function(e,t,r){var n,i;if(t&&e){i=t.responseType,n="response"in t?t.response:t.responseText;var a=1223===t.status?204:t.status;if(a>=200&&a<=399){try{"json"!==i&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){o(e,"invalid json",r)}return e.onNext(n),void e.onCompleted()}401===a||403===a||407===a?o(e,n):410===a?o(e,n):408===a||504===a?o(e,n):o(e,n||"Response code "+a)}}(n,i)))},i.ontimeout=function(e){u||(u=!0,function(e,t,r,n){o(e,"timeout error"||t.statusText||"request error",n)}(n,i,0,e))},i.send(f.data)}catch(e){n.onError(e)}return function(){u||4===i.readyState||(u=!0,i.abort())}})}function o(e,t,r){r||(r=new Error(t)),e.onError(r)}var a=e("./getXMLHttpRequest"),s=e("./getCORSRequest"),c=Object.prototype.hasOwnProperty,u=function(){};n.create=function(e){var t=new n;return t.subscribe=function(t,r,n){var i,o;return i="function"==typeof t?{onNext:t,onError:r||u,onCompleted:n||u}:t,"function"==typeof(o=e(i))?{dispose:o}:o},t},t.exports=i},{"./getCORSRequest":12,"./getXMLHttpRequest":13}],15:[function(e,t,r){(function(n){!function(e){if("object"==typeof r&&void 0!==t)t.exports=e();else{("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).falcor=e()}}(function(){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(e){var t=r[s][1][e];return o(t||e)},l,l.exports,t,r,n,i)}return n[s].exports}for(var a="function"==typeof e&&e,s=0;s1&&!Array.isArray(n)||0===t&&!Array.isArray(n)&&"string"!==i||1===t&&!Array.isArray(n)&&!x(n))return new s(function(e){e.onError(new Error("Invalid argument"))})}return u.create(this,e)},n.prototype.invalidate=function(){var e,t=-1,r=arguments.length,n=arguments[r-1];for(e=new Array(r);++t0){var r=i.Observable.of(e);return e.get.apply(e,s).catch(i.Observable.empty()).concat(r).last().flatMap(function(){return n(t,c)}).filter(function(e){return e})}return i.Observable.return(e)}if(a>0){var o=s.map(function(e){return c.concat(e)});return t.get.apply(t,o).concat(i.Observable.defer(function(){return n(t,c)})).last().filter(function(e){return e})}return i.Observable.empty()})}},{134:134,159:159}],6:[function(e,t,r){var n=e(134),i=e(13),o=e(8),a=e(118);t.exports=function(e){var t=n.fromPath(e);if(!Array.isArray(t))throw new Error("Model#derefSync must be called with an Array path.");var r=i(this,this._path.concat(t),!1),s=r.path,c=r.value;if(r.found&&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(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 n=e(26).create,i=e(22),o=e(27),a=e(120),s=e(33),c=e(29).promote;t.exports=function(e,t,r,u,h,l,p){for(var f,d,m=r,v=h,g=u,y=0;;){if(0===y&&g[s]?(y=v.length,d=g[s]):(f=v[y++],d=m[f]),d){var b=d.$type,_=b&&d.value||d;if(yw;w++)x[w]=v[w];v=x}return[m,v]}},{120:120,22:22,26:26,27:27,29:29,33:33}],12:[function(e,t,r){var n=e(15),i=e(8),o=e(7);t.exports=function(e,t){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(t)return{criticalError:new o};if((m=n(r,d)).$type)return{criticalError:new i(d,d)};for(c=[],u=0;v>u;++u)c[u]=d[u]}else c=[],v=0;for(u=0,h=a.length;h>u;u++)e(r,f,m,a[u],0,l,p,g,c,v,t);return p}}},{15:15,7:7,8:8}],13:[function(e,t,r){var n=e(17),i=e(8);t.exports=function(e,t,r){var o,a,s,c,u,h=t,l=t;for(o=e._boxed,r=e._materialized,a=e._treatErrorsAsValues,e._boxed=!0,e._materialized=void 0===r||r,e._treatErrorsAsValues=!0,s=n(e,h.concat(null),!0),e._boxed=o,e._materialized=r,e._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(e,t,r){function n(e){var t,r,n,i={},o=Object.keys(e);for(r=0,n=o.length;n>r;r++)t=o[r],a(t)||(i[t]=e[t]);return i}function i(e,t,r){Object.keys(e).filter(function(t){return!a(t)&&e[t]}).forEach(function(r){var a=e[r],s=t[r];if(s||(s=t[r]={}),a.$type){var c,u=a.value&&"object"==typeof a.value,h=!e[o];return c=u||h?n(a):a.value,void(t[r]=c)}i(a,s,r)})}var o=e(37),a=e(97);t.exports=function(e){var t={};return i(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_;){if(null!==(h=t[_++])&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if((p=x.$type)===c&&void 0===x.value){S=void 0,M=!1,y=v>_;break}if(v>_){if(p===s){if(o(x)){E=!0,S=void 0,M=!1;break}if(f=n(e,m,m,x,x.value),!(d=f[0])){S=void 0,x=void 0,M=!1;break}p=d.$type,x=d,g=f[1].slice(0)}if(p)break}else S=x;w=x}if(v>_&&!E){for(l=_;v>l;++l)if(null!==t[_]){b=!0;break}for(b?(y=!0,S=void 0):S=x,l=_;v>l;++l)null!==t[l]&&(g[g.length]=t[l])}if(S&&p&&(o(S)?S=void 0:a(e,S)),S&&p===u&&!e._treatErrorsAsValues)throw{path:_===v?t:t.slice(0,_),value:S.value};return S&&e._boxed?S=Boolean(p)&&!r?i(S):S:!S&&e._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(e,t,r){var n=e(46);t.exports=function(e,t){var r=e._getValueSync({_boxed:!0,_root:e._root,_treatErrorsAsValues:e._treatErrorsAsValues},t,!0).value,i=r&&r[n];return null==i?-1:i}},{46:46}],19:[function(e,t,r){var n=e(12),i=e(31),o=n(i,!1),a=n(i,!0);t.exports={getValueSync:e(17),getBoundValue:e(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:a}},{12:12,13:13,17:17,31:31}],20:[function(e,t,r){var n=e(29),i=e(25),o=n.promote;t.exports=function(e,t,r,n,a){var s=t.value;a.errors||(a.errors=[]),e._boxed&&(s=i(t)),a.errors.push({path:n.slice(0,r+1),value:s}),o(e,t)}},{25:25,29:29}],21:[function(e,t,r){var n=e(30).fastCopy;t.exports=function(e,t,r,i,o,a,s){i.requestedMissingPaths||(i.requestedMissingPaths=[],i.optimizedMissingPaths=[]),function(e,t,r,n,i,o,a){a.requestedMissingPaths.push(n.slice(0,r).concat(t)),a.optimizedMissingPaths.push(i.slice(0,o).concat(t))}(0,rv;v++)b=p[v],_[b]||(_[b]={}),_=_[b];_[b=p[v]]=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];null!==(y=l[v])?_[y]=S:x[w]=S}}}},{118:118,119:119,120:120,25:25,29:29,37:37}],23:[function(e,t,r){var n=e(27),i=e(26),o=e(29),a=i.remove,s=o.splice,c=e(119),u=e(20),h=e(22),l=e(21),p=e(28),f=e(35);t.exports=function(e,t,r,i,o,d,m,v,g,y,b){var _=t&&t.$type,x=t&&void 0===t.value;return t&&_?void(n(t)?(t[f]||(s(e,t),a(t)),l(e,r,i,d,m,v,g)):_===c?(b&&(m[i]=null),y||e._treatErrorsAsValues?h(e,t,o,i,d,m,v,g,y,b):u(e,t,i,m,d)):(b&&(m[i]=null),(!x||x&&e._materialized)&&h(e,t,o,i,d,m,v,g,y,b))):void(p(e)?h(e,t,o,i,d,m,v,g,y,b):l(e,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(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 n=e(40);t.exports=function(e){var t,r,i,o=Object.keys(e);for(t={},r=0,i=o.length;i>r;r++){var a=o[r];a[0]!==n&&(t[a]=e[a])}return t}},{40:40}],26:[function(e,t,r){var n=e(43),i=e(33),o=e(42),a=e(44);t.exports={create:function(e,t){var r=t[a]||0;t[n+r]=e,t[a]=r+1,e[o]=r,e[i]=t},remove:function(e){var t=e[i];if(t){for(var r=e[o],s=t[a];s>r;)t[n+r]=t[n+r+1],++r;t[a]=s-1,e[i]=void 0,e[o]=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||tr;r++)o[r]=e[r];for(i=0,n=t.length;n>i;i++)o[r++]=t[i];return o},fastCatSkipNulls:function(e,t){var r,n,i,o=[];for(r=0,n=e.length;n>r;r++)o[r]=e[r];for(i=0,n=t.length;n>i;i++)null!==t[i]&&(o[r++]=t[i]);return o},fastCopy:function(e,t){var r,n,i,o=[];for(n=0,i=t||0,r=e.length;r>i;n++,i++)o[n]=e[i];return o}}},{}],31:[function(e,t,r){var n=e(11),i=e(23),o=e(27),a=e(143).iterateKeySet,s=e(120),c=e(29).promote;t.exports=function e(t,r,u,h,l,p,f,d,m,v,g,y){var b=y,_=m;if(!u||u&&u.$type||l===h.length)i(t,u,h,l,p,f,d,_,v,g,b);else{var x,w,S=l+1,M=!1,E=x=h[l];if("object"==typeof x&&(M={},E=a(x,M)),void 0!==E||!M.done){var C=v+1;do{b=!1;var T;null===E?T=u:(T=u[E],_[v]=E,d[l]=E);var O=_,P=C;if(T){var j=T.$type,A=j&&T.value||T;if(Sw;++w)O[w]=L[w]}}e(t,r,T,h,S,p,f,d,O,P,g,b),M&&!M.done&&(E=a(x,M))}while(M&&!M.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,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 n(e,t,r,i,a,s,u,h,l,p){if(!w(e)&&!e.$type)for(var f in e)if(f[0]!==c&&"$"!==f[0]&&y(e,f)){var d=e[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,t+1,r,x,_,s,u,h,l,p):C(_,x,f,h)&&E(x,g(_),h,s))}}function i(e,t,r,n,i,a,c,l){if(_(r))return S(r,i,a),[void 0,t];v(a,r);var d=r,m=r.value,g=t;if(null!=(r=r[h]))g=r[u]||t;else{var y=0,b=m.length-1;g=r=t;do{var x=o(t,g,r,m[y],e,b>y,!0,n,i,a,c,l);if(r=x[0],w(r))return x;g=x[1]}while(y++d,!0,r,n,i);if(t=y[0],b(t))return y;f=y[1]}while(d++=l){var x=e[a];for(g=x;d>=_&&g;)x=x[c],y=g.$size||0,d-=y,!0===b&&h(g,y,e,f),g=x;e[a]=e[c]=g,null==g?e[o]=e[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(e,t,r){var n=e(121),i=e(34),o=e(45),a=e(38),s=e(41),c=e(100);t.exports=function(e,t){if(c(t)&&t.$expires!==n){var r=e[i],u=e[o],h=t[a],l=t[s];t!==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]=t),e[i]=e[a]=r=t,r[a]=h,r[s]=void 0),null!=u&&t!==u||(e[o]=e[s]=u=l||t)}return t}},{100:100,121:121,34:34,38:38,41:41,45:45}],51:[function(e,t,r){var n=e(34),i=e(45),o=e(38),a=e(41);t.exports=function(e,t){var r=e[n],s=e[i],c=t[o],u=t[a];null!=c&&"object"==typeof c&&(c[a]=u),null!=u&&"object"==typeof u&&(u[o]=c),t===r&&(e[n]=e[o]=c),t===s&&(e[i]=e[a]=u),t[o]=t[a]=void 0,r=s=c=u=void 0}},{34:34,38:38,41:41,45:45}],52:[function(e,t,r){function n(e,t){var r=!1;return function(){if(!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 i=e(59),o=e(60),a=0,s=e(57).GetRequest,c=e(76),u=e(78),h=e(119),l=[],p=function(e,t){this.sent=!1,this.scheduled=!1,this.requestQueue=t,this.id=++a,this.type=s,this._scheduler=e,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};p.prototype={batch:function(e,t,r){var i=this,a=i._optimizedPaths,s=i._requestedPaths,c=i._callbacks,u=a.length;return a[u]=t,s[u]=e,c[u]=r,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){o(i,a,function(e,t){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(s,e,t);for(var r=0,n=c.length;n>r;++r){var o=c[r];o&&o(e,t)}}})})),n(i,u)},add:function(e,t,r){var o,a,s=this,c=i(e,t,s._pathMap);c?(a=c[2],o=c[1]):(a=e,o=t);var u=!1,h=!1;if(o.lengthn;++n)for(var o=e[n],a=0,s=o.length;s>a;++a)t[++r]=o[a];return t}(e);if(t){var f=t;f instanceof Error&&(f={message:f.message}),f.$type||(f={$type:h,value:f});var d=p.map(function(e){return{path:e,value:f}});u(n,d,null,o,a)}else c(n,[{paths:p,jsonGraph:r.jsonGraph}],null,o,a);n._path=s}},t.exports=p},{119:119,57:57,59:59,60:60,76:76,78:78}],53:[function(e,t,r){function n(){this.length=0,this.pending=!1,this.pathmaps=[],a.call(this,this._subscribe)}var i=e(159),o=i.Observer,a=i.Observable,s=i.Disposable,c=i.SerialDisposable,u=i.CompositeDisposable,h=e(9),l=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(a.prototype)).constructor=n,n.prototype.insertPath=function(e,t,r,n,i){var o=n||0,a=i||e.length-1,s=r||this.pathmaps[a+1]||(this.pathmaps[a+1]=Object.create(null));if(void 0===s||null===s)return!1;var c,u,h=e[o],p={};c=l(h,p);do{if(u=s[c],a>o){if(null==u){if(t)return!1;u=s[c]=Object.create(null)}if(!1===this.insertPath(e,t,u,o+1,a))return!1}else s[c]=(u||0)+1,this.length+=1;p.done||(c=l(h,p))}while(!p.done);return!0},n.prototype.removePath=function(e,t,r,n){var i=r||0,o=n||e.length-1,a=t||this.pathmaps[o+1];if(void 0===a||null===a)return!0;var s,c,u=0,h=e[i],p={};s=l(h,p);do{if(void 0!==(c=a[s])&&null!==c){if(o>i){u+=this.removePath(e,c,i+1,o);var f=void 0;for(f in c)break;void 0===f&&delete a[s]}else 0===(c=a[s]=(c||1)-1)&&delete a[s],u+=1,this.length-=1;p.done||(s=l(h,p))}}while(!p.done);return u},n.prototype.getSourceObserver=function(e){var t=this;return o.create(function(r){r.jsonGraph=r.jsonGraph||r.jsong||r.values||r.value,r.index=t.index,e.onNext(r)},function(t){e.onError(t)},function(){e.onCompleted()})},n.prototype._subscribe=function(e){var t=this,r=this.queue;t.pending=!0;var n=!1,i=new c,o=s.create(function(){n||(n=!0,r&&r._remove(t))}),a=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 a},t.exports=n},{143:143,159:159,9:9}],54:[function(e,t,r){function n(e,t){this.total=0,this.model=e,this.requests=[],this.scheduler=t}var i=e(58),o=e(40),a=e(90),s=e(100),c=e(143);n.prototype.set=function(e){return e.paths=c.collapse(e.paths),i.create(this.model,e)},n.prototype._remove=function(e){var t=this.requests,r=t.indexOf(e);-1!==r&&t.splice(r,1)},n.prototype.distributePaths=function(e,t,r){var n,i,o=this.model,a=-1,s=e.length,c=-1,u=t.length,h=[];e:for(;++a-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 e}h>u&&(l[d]=g)}else l[d]=p[d]}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 i=e(57),o=e(52);n.prototype={setScheduler:function(e){this.scheduler=e},get:function(e,t,r){function n(){m||0==--l&&r()}var a,s,c,u=this,h=[],l=0,p=u._requests,f=t,d=e,m=!1;for(a=0,s=p.length;s>a;++a)if((c=p[a]).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 e=h.length,t=0;e>t;++t)h[t]()}}},removeRequest:function(e){for(var t=this._requests,r=t.length;--r>=0;)if(t[r].id===e.id){t.splice(r,1);break}}},t.exports=n},{52:52,57:57}],57:[function(e,t,r){t.exports={GetRequest:"GET"}},{}],58:[function(e,t,r){function n(){o.call(this)}var i=e(159).Observer,o=e(53),a=e(83),s=e(76),c=e(78),u=new Array(0);n.create=function(e,t){var r=new n;return r.model=e,r.jsonGraphEnvelope=t,r},(n.prototype=Object.create(o.prototype)).constructor=n,n.prototype.method="set",n.prototype.insertPath=function(){return!1},n.prototype.removePath=function(){return 0},n.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},n.prototype.getSourceObserver=function(e){var t=this.model,r=t._path,n=this.jsonGraphEnvelope.paths,h=t._root,l=h.errorSelector,p=h.comparator;return o.prototype.getSourceObserver.call(this,i.create(function(i){t._path=u;var o=s(t,[{paths:n,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],t._path=r,e.onNext(i)},function(i){t._path=u,c(t,a(n,function(e){return{path:e,value:i}}),null,l,p),t._path=r,e.onError(i)},function(){e.onCompleted()}))},t.exports=n},{159:159,53:53,76:76,78:78,83:83}],59:[function(e,t,r){var n=e(143).hasIntersection,i=e(84);t.exports=function(e,t,r){for(var o=[],a=[],s=[],c=-1,u=-1,h=!1,l=0,p=t.length;p>l;++l){var f=t[l],d=r[f.length];d&&n(d,f,0)?(!h&&l>0&&(a=i(e,0,l),o=i(t,0,l)),s[++c]=e[l],h=!0):h&&(o[++u]=f,a[u]=e[l])}return h?[s,o,a]:null}},{143:143,84:84}],60:[function(e,t,r){var n=e(143),i=n.toTree,o=n.toPaths;t.exports=function(e,t,r){if(0!==e._count){e.sent=!0,e.scheduled=!1;for(var n=e._pathMap,a=0,s=Object.keys(t).length;s>a;++a)for(var c=t[a],u=0,h=c.length;h>u;++u){var l=c[u],p=l.length;if(n[p]){var f=n[p];f[f.length]=l}else n[p]=[l]}for(var d=Object.keys(n),m=0,v=d.length;v>m;++m){var g=d[m];n[g]=i(n[g])}var y,b=e._collasped=o(n);e.requestQueue.model._source.get(b).subscribe(function(e){y=e},function(e){r(e,y)},function(){r(null,y)})}else e.requestQueue.removeRequest(e)}},{143:143}],61:[function(e,t,r){function n(e){a.call(this,e||function(e){function t(e){return b.concat(e)}var r=this.args,n=this.model,c=h.fromPath(r[0]),p=r[1]||[],f=(r[2]||[]).map(h.fromPath),d=(r[3]||[]).map(h.fromPath),m=n._clone({_path:[]}),v=m.withoutDataSource(),g=n._path,y=g.concat(c),b=y.slice(0,-1),_=i(n.withoutDataSource().get(c)).map(function(e){for(var t=e.json,r=-1,n=c.length;t&&++r0?i(v.set.apply(v,t)._toJSONG()).map(function(t){return{results:e,envelope:t}}):a.return({results:e,envelope:{jsonGraph:{},paths:[]}})}).flatMap(function(e){var o,s=e.envelope,c=e.results,u=c.values,h=c.references,l=c.invalidations,p=u.map(n).map(t),f=h.reduce(r,[]),v=d.map(t),g=f.concat(v);return(o=g.length>0?i(m.get.apply(m,p.concat(g))._toJSONG()):a.return(s)).doAction(function(e){e.invalidated=l})});return a.return(u)}return a.empty()}).defaultIfEmpty(function(e){return e&&"object"==typeof e?o.Observable.defer(function(){var t;try{t=e.call(y,p,f,d)}catch(e){t=a.throw(new u(e))}return t}).map(function(e){var t=e.invalidated;return t&&t.length&&m.invalidate.apply(m,t),e}):a.empty()}(n._source)).mergeAll().flatMap(function(e){return i(v.set(e)).reduce(function(e){return e},null).map(function(){return{invalidated:e.invalidated,paths:e.paths.map(function(e){return e.slice(g.length)})}})}),x=new s;return x.add(_.subscribe(function(t){var r=t.paths,o=t.invalidated,a=n.get.apply(n,r);"AsJSONG"===e.outputFormat&&(a=i(a._toJSONG()).doAction(function(e){e.invalidated=o})),x.add(a.subscribe(e))},function(t){e.onError(t)})),x})}function i(e){return o.Observable.defer(function(){return e})}var o=e(159)&&e(158),a=o.Observable,s=o.CompositeDisposable,c=e(64),u=e(9),h=e(134),l=e(120);n.create=c.create,(n.prototype=Object.create(a.prototype)).constructor=n,n.prototype.invokeSourceRequest=function(e){return this},n.prototype.ensureCollect=function(e){return this},n.prototype.initialize=function(){return this},t.exports=n},{120:120,134:134,158:158,159:159,64:64,9:9}],62:[function(e,t,r){function n(e){i.call(this,e)}var i=e(159).Observable,o=e(64),a=e(134),s=e(88),c=e(49),u=e(81),h=e(46),l=Array.isArray,p=e(101),f=e(98),d=e(99);n.create=o.create,(n.prototype=Object.create(i.prototype)).constructor=n,n.prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var e,t,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],s=[],c=this.args,h=-1,m=c.length;++h0){(0,t["_"+r+c+"AsJSON"])(t,u)}}return e.onCompleted(),i.empty})}var i=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),a=(e(159)&&e(158)).Observable,s=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(a.prototype)).constructor=n,n.prototype._mixin=function(){var e=this,t=s(arguments);return new e.constructor(function(r){return e.subscribe(t.reduce(function(e,t){return Object.create(e,t)},r))})},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 r=this;return new o.Promise(function(e,t){var n,i=!1;r.toArray().subscribe(function(e){n=e.length<=1?e[0]:e},function(e){i=!0,t(e)},function(){!1===i&&e(n)})}).then(e,t)},t.exports=n},{105:105,158:158,159:159,32:32,84:84}],65:[function(e,t,r){function n(e){p.call(this,e||function(e){return this.isCompleted?o.call(this,e):function(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),h.empty;for(var t=[],r=[],n=this.model,i=this.isMaster,c=n._root,u=this.outputFormat,l=c.errorSelector,p=this.method,f=this.groups,m=-1,v=f.length;++m0){var _=(0,n["_"+p+y+u])(n,b,null,l);r.push.apply(r,_[1]),"PathValues"===y?t.push.apply(t,b.map(a)):"JSONGs"===y?t.push.apply(t,d(b,s)):t.push.apply(t,_[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,o.call(this,e)):void e.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}.call(this,e)})}function i(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),h.empty;for(var t=[],r=[],n=this.model,i=this.isMaster,c=n._root,u=this.outputFormat,l=c.errorSelector,p=this.method,f=this.groups,m=-1,v=f.length;++m0){var _=(0,n["_"+p+y+u])(n,b,null,l);r.push.apply(r,_[1]),"PathValues"===y?t.push.apply(t,b.map(a)):"JSONGs"===y?t.push.apply(t,d(b,s)):t.push.apply(t,_[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,o.call(this,e)):void e.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}function o(e){var t=new l(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(t=t._toJSONG()),this.isProgressive&&(t=t.progressively()),t.subscribe(e)}function a(e){return e.path}function s(e){return e.paths}var c=e(159),u=c.Observable,h=c.Disposable,l=e(67),p=e(62),f=e(9),d=e(82),m=new Array(0);n.create=p.create,(n.prototype=Object.create(p.prototype)).method="set",n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(e){var t=this,r=this.catch(function(n){var i;if(n&&!0===n.invokeSourceRequest){var o={},a=e._path,s=n.optimizedPaths;e._path=m,e._getPathValuesAsJSONG(e._materialize().withoutDataSource(),s,[o]),e._path=a,i=e._request.set(o).do(function(e){t.isCompleted=s.length===e.paths.length},function(){t.isCompleted=!0}).materialize().flatMap(function(e){if("C"===e.kind)return u.empty();if("E"===e.kind){var t=e.exception;if(f.is(t))return u.throw(e.exception)}return r})}else i=u.throw(n);return i});return new this.constructor(function(e){return r.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),i=e(68),o=e(69),a={dispose:function(){}},s=e(159).Observable,c=t.exports=function(e,t,r,n){this.model=e,this.currentRemainingPaths=t,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(e){var t=[{}],r=[],n=e.isJSONG=this.isJSONGraph,s=this.isProgressive,c=i(this.model,this.currentRemainingPaths,e,s,n,t,r);return c?o(this,this.model,c,e,t,r,1):a}},{159:159,64:64,68:68,69:69}],68:[function(e,t,r){var n=e(19),i=n.getWithPathsAsJSONGraph,o=n.getWithPathsAsPathMap;t.exports=function(e,t,r,n,a,s,c){var u;if((u=a?i(e,t,s):o(e,t,s)).criticalError)return r.onError(u.criticalError),null;var h=u.hasValue,l=!u.requestedMissingPaths||!e._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{++e._root.syncRefCount,r.onNext(s[0])}catch(e){throw e}finally{--e._root.syncRefCount}return l?(c.length?r.onError(c):r.onCompleted(),null):u}},{19:19}],69:[function(e,t,r){var n=e(68),i=e(10),o=e(30).fastCat,a=e(49),s=e(88),c=e(66),u=e(46);t.exports=function e(t,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,t.isProgressive,t.isJSONGraph,p,f);if(i)y.currentDisposable=e(t,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(e,t,r){var n=e(67);t.exports=function(e){return new n(this,e)}},{67:67}],71:[function(e,t,r){var n=e(134),i=e(64),o=e(72),a=e(116),s=e(67);t.exports=function(){var e=a(arguments,o,"get");if(!0!==e)return new i(function(t){t.onError(e)});var t=n.fromPathsOrPathValues(arguments);return new s(this,t)}},{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 n(e,t,r,i,a,s,c,u,h,l,p,d,m,v,g,b,_){for(var x={},w=tx,!0,i,a,u,p,m,y,b);if(t=C[0],v(t))return a.index=x,C;M=C[1],n=C[2],E=C[3]}while(x++=x)break;l.index=w}}function i(e,t,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,t];y(u,r);var g=r,b=t;if(null!=(r=r[l]))b=r[h]||t,i.index=v.length;else{var _=0,w=v.length-1;b=r=t;do{var E=o(t,b,r,v[_],e,w>_,!0,n,i,a,s,u,p,m);if(r=E[0],S(r))return i.index=_,E;b=E[1]}while(_++S,!0,n,i,a,h,f,d,g);if(r=E[0],y(r))return i.index=S,E;w=E[1]}while(S++o&&(o=0),r>0&&o>r&&(o=r);for(var a=new Array(o);++iL)return}if(O&&A&&!P)return d(v(t,r,e,b,M),e,b);if(P||!A){if(P===a&&l(C)&&(r=C(y(_,b),r)),P&&t===r)null==t[i]&&(t=f(t,O,t.value),e=g(e,-t.$size,M,w),t=d(t,e,b,w));else{var N=!0;!O&&j||(N=c(r)-1);return e}},{39:39,43:43,44:44,46:46}],115:[function(e,t,r){var n=e(36),i=e(46),o=e(39),a=e(108),s=e(114);t.exports=function(e,t,r,c){var u=e;do{var h=u[o];0>=(u.$size=(u.$size||0)-t)&&null!=h?a(u,h,u[n],r):u[i]!==c&&s(u,c),u=h}while(u);return e}},{108:108,114:114,36:36,39:39,46:46}],116:[function(e,t,r){var n=Array.isArray,i=e(101),o=e(99),a=e(98),s=e(134);t.exports=function(e,t,r){for(var c=0,u=e.length;u>c;++c){var h=e[c],l=!1;if(n(h)&&t.path?l=!0:"string"==typeof h&&t.pathSyntax?l=!0:i(h)&&t.pathValue?(h.path=s.fromPath(h.path),l=!0):o(h)&&t.jsonGraph?l=!0:a(h)&&t.json?l=!0:"function"==typeof h&&c+1===u&&t.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(e,t,r){var n=e(130).atom,i=e(106),o=e(122),a=e(37),s=e(85),c=Array.isArray,u=e(88),h=e(87);t.exports=function(e,t,r){var l=0,p=e,f=t;if(f?(p=s(p),l=u(p),p.$type=f):(p=n(r),f=p.$type,p[a]=!0),null==r)l=51;else if(null==l||0>=l)switch(typeof r){case"object":l=c(r)?50+r.length:51;break;case"string":l=50+r.length;break;default:l=51}var d=h(p);return"number"==typeof d&&o>d&&(p.$expires=i()+-1*d),p.$size=l,p}},{106:106,122:122,130:130,37:37,85:85,87:87,88:88}],118:[function(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=a.length?a.pop():new i).task=e,o(t)}function i(){this.task=null}var o=e(124),a=[],s=[],c=o.makeRequestCallFromTimer(function(){if(s.length)throw s.shift()});t.exports=n,i.prototype.call=function(){try{this.task.call()}catch(e){n.onerror?n.onerror(e):(s.push(e),c())}finally{this.task=null,a[a.length]=this}}},{124:124}],124:[function(e,t,r){(function(e){"use strict";function r(e){a.length||(o(),s=!0),a[a.length]=e}function n(){for(;cu){for(var t=0,r=a.length-c;r>t;t++)a[t]=a[t+c];a.length-=c,c=0}}a.length=0,c=0,s=!1}function i(e){return function(){function t(){clearTimeout(r),clearInterval(n),e()}var r=setTimeout(t,0),n=setInterval(t,50)}}t.exports=r;var o,a=[],s=!1,c=0,u=1024,h=e.MutationObserver||e.WebKitMutationObserver;o="function"==typeof h?function(e){var t=1,r=new h(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}(n):i(n),r.requestFlush=o,r.makeRequestCallFromTimer=i}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(e,t,r){"use strict";function n(e,t){var r;for(r in t)e[r]=t[r];return e}function i(e,t){if(this._jsongUrl=e,"number"==typeof t){t={timeout:t}}this._config=n({timeout:15e3,headers:{}},t||{})}var o=e(129),a=e(126);Array.isArray,i.prototype={constructor:i,buildQueryObject:a,get:function(e){var t=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:e,method:"get"}),this._config);return o("GET",t,this)},set:function(e){var t="POST",r=n(this.buildQueryObject(this._jsongUrl,t,{jsonGraph:e,method:"set"}),this._config);r.headers["Content-Type"]="application/x-www-form-urlencoded";return o(t,r,this)},call:function(e,t,r,i){t=t||[],r=r||[],i=i||[];var a="POST",s=[];s.push("method=call"),s.push("callPath="+encodeURIComponent(JSON.stringify(e))),s.push("arguments="+encodeURIComponent(JSON.stringify(t))),s.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),s.push("paths="+encodeURIComponent(JSON.stringify(i)));var c=n(this.buildQueryObject(this._jsongUrl,a,s.join("&")),this._config);c.headers["Content-Type"]="application/x-www-form-urlencoded";return o(a,c,this)}},i.XMLHttpSource=i,i.default=i,t.exports=i},{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,t,r){(function(e){"use strict";t.exports=function(){var t=new e.XMLHttpRequest;if("withCredentials"in t)return t;if(e.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(e){"use strict";t.exports=function(){var t,r,n;if(e.XMLHttpRequest)return new e.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;3>n;n++)try{if(t=r[n],new e.ActiveXObject(t))break}catch(e){}return new e.ActiveXObject(t)}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 i(e,t,r){r||(r=new Error(t)),e.onError(r)}function o(e,t,r){var n,o;if(t&&e){o=t.responseType,n="response"in t?t.response:t.responseText;var a=1223===t.status?204:t.status;if(a>=200&&399>=a){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(e,"invalid json",r)}return e.onNext(n),void e.onCompleted()}return 401===a||403===a||407===a?i(e,n):410===a?i(e,n):408===a||504===a?i(e,n):i(e,n||"Response code "+a)}}function a(e,t,r,n){i(e,r||t.statusText||"request error",n)}var s=e(128),c=e(127),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(e){var t=new n;return t.subscribe=function(t,r,n){var i,o;return i="function"==typeof t?{onNext:t,onError:r||h,onCompleted:n||h}:t,"function"==typeof(o=e(i))?{dispose:o}:o},t},t.exports=function(e,t,r){return n.create(function(n){var i,h,l,p,f,d={method:e||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in t)u.call(t,f)&&(d[f]=t[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?c():s()}catch(e){n.onError(e)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,l=d.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(e){if("json"!==d.responseType)throw e}i.onreadystatechange=function(e){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(e){h||(h=!0,a(n,i,"timeout error",e))},i.send(d.data)}catch(e){n.onError(e)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{127:127,128:128}],130:[function(e,t,r){function n(e,t,r){var n=Object.create(null);if(null!=r){for(var i in r)n[i]=r[i];return n.$type=e,n.value=t,n}return{$type:e,value:t}}var i=e(134);t.exports={ref:function(e,t){return n("ref",i.fromPath(e),t)},atom:function(e,t){return n("atom",e,t)},undefined:function(){return n("atom")},error:function(e,t){return n("error",e,t)},pathValue:function(e,t){return{path:i.fromPath(e),value:t}},pathInvalidation:function(e){return{path:i.fromPath(e),invalidated:!0}}}},{134:134}],131:[function(e,t,r){t.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],132:[function(e,t,r){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),a=function(e,t){return i(new n(e,t))};t.exports=a,a.fromPathsOrPathValues=function(e,t){if(!e)return[];for(var r=[],n=0,i=e.length;i>n;n++)"string"==typeof e[n]?r[n]=a(e[n],t):"string"==typeof e[n].path?r[n]={path:a(e[n].path,t),value:e[n].value}:r[n]=e[n];return r},a.fromPath=function(e,t){return e?"string"==typeof e?a(e,t):e:[]},a.RoutedTokens=o},{131:131,135:135,140:140}],135:[function(e,t,r){var n=e(132),i=e(133),o=e(136);t.exports=function(e){for(var t=e.next(),r={},a=[];!t.done;){switch(t.type){case n.token:var s=+t.token[0];isNaN(s)||i.throwError(i.invalidIdentifier,e),a[a.length]=t.token;break;case n.dotSeparator:0===a.length&&i.throwError(i.unexpectedToken,e);break;case n.space:break;case n.openingBracket:o(e,t,r,a);break;default:i.throwError(i.unexpectedToken,e)}t=e.next()}return 0===a.length&&i.throwError(i.invalidPath,e),a}},{132:132,133:133,136:136}],136:[function(e,t,r){var n=e(132),i=e(133),o=i.indexer,a=e(138),s=e(137),c=e(139);t.exports=function(e,t,r,u){var h=e.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,e)}switch(h.type){case n.openingBrace:f=!0,c(e,h,r,u);break;case n.token:var d=+h.token;isNaN(d)&&i.throwError(o.needQuotes,e),r.indexer[r.indexer.length]=d;break;case n.dotSeparator:r.indexer.length||i.throwError(o.leadingDot,e),a(e,h,r,u);break;case n.space:break;case n.closingBracket:l=!0;break;case n.quote:s(e,h,r,u);break;case n.openingBracket:i.throwError(o.nested,e);break;case n.commaSeparator:++p;break;default:i.throwError(i.unexpectedToken,e)}if(l)break;h=e.next()}0===r.indexer.length&&i.throwError(o.empty,e),r.indexer.length>1&&f&&i.throwError(o.routedTokens,e),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(e,t,r){var n=e(132),i=e(133),o=i.quote;t.exports=function(e,t,r,a){for(var s=e.next(),c="",u=t.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,e),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,e)}if(l)break;s=e.next()}0===c.length&&i.throwError(o.empty,e),r.indexer[r.indexer.length]=c}},{132:132,133:133}],138:[function(e,t,r){var n=e(140),i=e(132),o=e(133);t.exports=function(e,t,r,a){var s,c=e.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,e);!h&&!c.done;){switch(c.type){case i.dotSeparator:3===u&&o.throwError(o.unexpectedToken,e),3===++u&&(l=!1);break;case i.token:s=n.toNumber(e.next().token),isNaN(s)&&o.throwError(o.range.suceedingNaN,e),h=!0;break;default:h=!0}if(h)break;e.next(),c=e.peek()}r.indexer[p]={from:f,to:l?s:s-1}}},{132:132,133:133,140:140}],139:[function(e,t,r){var n=e(132),i=e(131),o=e(133),a=o.routed;t.exports=function(e,t,r,s){var c=e.next(),u=!1,h="";switch(c.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(a.invalid,e)}var l=e.next();if(l.type===n.colon&&(u=!0,(l=e.next()).type!==n.token&&o.throwError(a.invalid,e),h=l.token,l=e.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,e)}},{131:131,132:132,133:133}],140:[function(e,t,r){function n(e,t,r){return{token:e,done:r,type:t}}function i(e,t,r){var i,b=!1,_="",x=r?y:g;do{if(i=t+1>=e.length)break;var w=e[t+1];if(void 0===w||-1!==x.indexOf(w)){if(_.length)break;++t;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,++t}while(!i);return!b&&_.length&&(b=n(_,o.token,!1)),b||(b={done:!0}),{token:b,idx:t}}var o=e(132),a=".",s=",",c="[",u="]",h="{",l="}",p=":",f="\\",d='"',m="'",v=" ",g="\\'\"[]., ",y="\\{}'\"[]., :",b=t.exports=function(e,t){this._string=e,this._idx=-1,this._extended=t,this.parseString=""};b.prototype={next:function(){var e=this._nextToken?this._nextToken:i(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:i(this._string,this._idx,this._extended);return this._nextToken=e,e.token}},b.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 n=e(144);t.exports=function e(t,r,i){for(var o=t,a=!0;a&&in&&(t.empty=!0)}function i(e,t){t.done=!1;var r=t.isObject=!(!e||"object"!=typeof e);t.isArray=r&&o(e),t.arrayOffset=0}var o=Array.isArray;t.exports=function(e,t){if(void 0===t.isArray&&i(e,t),t.isArray){var r;do{t.loaded&&t.rangeOffset>t.to&&(++t.arrayOffset,t.loaded=!1);if(t.arrayOffset>=e.length){t.done=!0;break}var o=e[t.arrayOffset];if("object"===typeof o){if(t.loaded||n(o,t),t.empty)continue;r=t.rangeOffset++}else++t.arrayOffset,r=o}while(void 0===r);return r}return t.isObject?(t.loaded||n(e,t),t.rangeOffset>t.to?void(t.done=!0):t.rangeOffset++):(t.done=!0,e)}},{}],145:[function(e,t,r){var n=e(142);t.exports=function(e,t){for(var r=[],i=-1,o=0,a=e.length;a>o;++o){var s=e[o];n(t[s.length],s,0)||(r[++i]=s)}return r}},{142:142}],146:[function(e,t,r){var n=e(142);t.exports=function(e,t){for(var r=[],i=-1,o=0,a=e.length;a>o;++o)n(t,e[o],0)||(r[++i]=e[o]);return r}},{142:142}],147:[function(e,t,r){function n(e){return null!==e&&typeof e===l}function i(e,t,r){var n,o,a,h,l,p,f,d,m,v,g,y,b,_,x=c(String(t)),w=Object.create(null),S=[],M=-1,E=0,C=[],T=0;if(h=[],l=-1,r-1>t){for(p=s(e,h);++l0)for(f=o.sets,d=-1,m=f.length,b=h[0];++d1&&h||b;++g1?[h]:h;++l0;++t<=r;){var i=e[t];if(!u(i)){n=!1;break}e[t]=parseInt(i,10)}if(!0===n){e.sort(a);var o=e[0],s=e[r];if(r>=s-o)return{from:o,to:s}}return e}(n))}return e}function a(e,t){return e-t}function s(e,t,r){var n=0;for(var i in e)t[n++]=i;return n>1&&t.sort(r),n}function c(e){for(var t=5381,r=-1,n=e.length;++r=0}var h=Array.isArray,l="object";t.exports=function(e){var t,r=[],a=0;for(var s in e)if(u(s)&&n(t=e[s]))for(var c=i(t,0,parseInt(s,10)).sets,h=-1,l=c.length;++h1)for(var r=1;r0?t:0);return new n(function(t,n){i.push(function(e,r){e?n(e):t(r)});var o=e.apply(r,i);!o||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then||t(o)})}},n.nodeify=function(e){return function(){var t=Array.prototype.slice.call(arguments),r="function"==typeof t[t.length-1]?t.pop():null,o=this;try{return e.apply(this,arguments).nodeify(r,o)}catch(e){if(null===r||void 0===r)return new n(function(t,r){r(e)});i(function(){r.call(o,e)})}}},n.prototype.nodeify=function(e,t){return"function"!=typeof e?this:void this.then(function(r){i(function(){e.call(t,null,r)})},function(r){i(function(){e.call(t,r)})})}},{123:123,152:152}],158:[function(e,t,r){(function(n){(function(i){var o={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},a=o[typeof window]&&window||this,s=o[typeof r]&&r&&!r.nodeType&&r,c=o[typeof t]&&t&&!t.nodeType&&t,u=(c&&c.exports,o[typeof n]&&n);!u||u.global!==u&&u.window!==u||(a=u),"object"==typeof t&&t&&t.exports===s?t.exports=i(a,t.exports,e(159)):a.Rx=i(a,{},a.Rx)}).call(this,function(e,t,r,n){function i(e){if(!S(e))throw new TypeError("fn must be a function");return p=e,function(){try{return p.apply(this,arguments)}catch(e){return N.e=e,N}}}function o(e,t,r){return new v(function(n){var i=!1,o=null,a=[];return e.subscribe(function(e){var s,c;try{c=t(e)}catch(e){return void n.onError(e)}if(s=0,i)try{s=r(c,o)}catch(e){return void n.onError(e)}else i=!0,o=c;s>0&&(o=c,a=[]),s>=0&&a.push(e)},function(e){n.onError(e)},function(){n.onNext(a),n.onCompleted()})},e)}function a(e){if(0===e.length)throw new A;return e[0]}function s(e,t,r,n){if(0>t)throw new L;return new v(function(i){var o=t;return e.subscribe(function(e){0==o--&&(i.onNext(e),i.onCompleted())},function(e){i.onError(e)},function(){r?(i.onNext(n),i.onCompleted()):i.onError(new L)})},e)}function c(e,t,r){return new v(function(n){var i=r,o=!1;return e.subscribe(function(e){o?n.onError(new Error("Sequence contains more than one element")):(i=e,o=!0)},function(e){n.onError(e)},function(){o||t?(n.onNext(i),n.onCompleted()):n.onError(new A)})},e)}function u(e,t,r){return new v(function(n){return e.subscribe(function(e){n.onNext(e),n.onCompleted()},function(e){n.onError(e)},function(){t?(n.onNext(r),n.onCompleted()):n.onError(new A)})},e)}function h(e,t,r){return new v(function(n){var i=r,o=!1;return e.subscribe(function(e){i=e,o=!0},function(e){n.onError(e)},function(){o||t?(n.onNext(i),n.onCompleted()):n.onError(new A)})},e)}function l(e,t,r,i){var o=j(t,r,3);return new v(function(t){var r=0;return e.subscribe(function(n){var a;try{a=o(n,r,e)}catch(e){return void t.onError(e)}a?(t.onNext(i?r:n),t.onCompleted()):r++},function(e){t.onError(e)},function(){t.onNext(i?-1:n),t.onCompleted()})},e)}var p,f=r.Observable,d=f.prototype,m=r.CompositeDisposable,v=r.AnonymousObservable,g=r.Disposable.empty,y=(r.internals.isEqual,r.helpers),b=y.not,_=y.defaultComparer,x=y.identity,w=y.defaultSubComparer,S=y.isFunction,M=y.isPromise,E=y.isArrayLike,C=y.isIterable,T=r.internals.inherits,O=f.fromPromise,P=f.from,j=r.internals.bindCallback,A=r.EmptyError,R=r.ObservableBase,L=r.ArgumentOutOfRangeError,N={e:{}};d.aggregate=function(){var e,t,r=!1,n=this;return 2===arguments.length?(r=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new v(function(i){var o,a,s;return n.subscribe(function(n){!s&&(s=!0);try{o?a=e(a,n):(a=r?e(t,n):n,o=!0)}catch(e){return i.onError(e)}},function(e){i.onError(e)},function(){s&&i.onNext(a),!s&&r&&i.onNext(t),!s&&!r&&i.onError(new A),i.onCompleted()})},n)};var I=function(e){function t(t,r,n,i){this.source=t,this.acc=r,this.hasSeed=n,this.seed=i,e.call(this)}function r(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 T(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this))},r.prototype.onNext=function(e){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=i(this.acc)(this.result,e):(this.result=this.hasSeed?i(this.acc)(this.seed,e):e,this.hasAccumulation=!0),this.result===N&&this.o.onError(this.result.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.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new 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)},t}(R);return d.reduce=function(e){var t=!1;if(2===arguments.length){t=!0;var r=arguments[1]}return new I(this,e,t,r)},d.some=function(e,t){var r=this;return e?r.filter(e,t).some():new v(function(e){return r.subscribe(function(){e.onNext(!0),e.onCompleted()},function(t){e.onError(t)},function(){e.onNext(!1),e.onCompleted()})},r)},d.any=function(){return this.some.apply(this,arguments)},d.isEmpty=function(){return this.any().map(b)},d.every=function(e,t){return this.filter(function(t){return!e(t)},t).some().map(b)},d.all=function(){return this.every.apply(this,arguments)},d.includes=function(e,t){var r=this;return new v(function(n){var i=0,o=+t||0;return Math.abs(o)===1/0&&(o=0),0>o?(n.onNext(!1),n.onCompleted(),g):r.subscribe(function(t){i++>=o&&function(e,t){return 0===e&&0===t||e===t||isNaN(e)&&isNaN(t)}(t,e)&&(n.onNext(!0),n.onCompleted())},function(e){n.onError(e)},function(){n.onNext(!1),n.onCompleted()})},this)},d.contains=function(e,t){d.includes(e,t)},d.count=function(e,t){return e?this.filter(e,t).count():this.reduce(function(e){return e+1},0)},d.indexOf=function(e,t){var r=this;return new v(function(n){var i=0,o=+t||0;return Math.abs(o)===1/0&&(o=0),0>o?(n.onNext(-1),n.onCompleted(),g):r.subscribe(function(t){i>=o&&t===e&&(n.onNext(i),n.onCompleted()),i++},function(e){n.onError(e)},function(){n.onNext(-1),n.onCompleted()})},r)},d.sum=function(e,t){return e&&S(e)?this.map(e,t).sum():this.reduce(function(e,t){return e+t},0)},d.minBy=function(e,t){return t||(t=w),o(this,e,function(e,r){return-1*t(e,r)})},d.min=function(e){return this.minBy(x,e).map(function(e){return a(e)})},d.maxBy=function(e,t){return t||(t=w),o(this,e,t)},d.max=function(e){return this.maxBy(x,e).map(function(e){return a(e)})},d.average=function(e,t){return e&&S(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 A;return e.sum/e.count})},d.sequenceEqual=function(e,t){var r=this;return t||(t=_),new v(function(n){var i=!1,o=!1,a=[],s=[],c=r.subscribe(function(e){var r,i;if(s.length>0){i=s.shift();try{r=t(i,e)}catch(e){return void n.onError(e)}r||(n.onNext(!1),n.onCompleted())}else o?(n.onNext(!1),n.onCompleted()):a.push(e)},function(e){n.onError(e)},function(){i=!0,0===a.length&&(s.length>0?(n.onNext(!1),n.onCompleted()):o&&(n.onNext(!0),n.onCompleted()))});(E(e)||C(e))&&(e=P(e)),M(e)&&(e=O(e));var u=e.subscribe(function(e){var r;if(a.length>0){var o=a.shift();try{r=t(o,e)}catch(e){return void n.onError(e)}r||(n.onNext(!1),n.onCompleted())}else i?(n.onNext(!1),n.onCompleted()):s.push(e)},function(e){n.onError(e)},function(){o=!0,0===s.length&&(a.length>0?(n.onNext(!1),n.onCompleted()):i&&(n.onNext(!0),n.onCompleted()))});return new m(c,u)},r)},d.elementAt=function(e){return s(this,e,!1)},d.elementAtOrDefault=function(e,t){return s(this,e,!0,t)},d.single=function(e,t){return e&&S(e)?this.where(e,t).single():c(this,!1)},d.singleOrDefault=function(e,t,r){return e&&S(e)?this.filter(e,r).singleOrDefault(null,t):c(this,!0,t)},d.first=function(e,t){return e?this.where(e,t).first():u(this,!1)},d.firstOrDefault=function(e,t,r){return e?this.where(e).firstOrDefault(null,t):u(this,!0,t)},d.last=function(e,t){return e?this.where(e,t).last():h(this,!1)},d.lastOrDefault=function(e,t,r){return e?this.where(e,r).lastOrDefault(null,t):h(this,!0,t)},d.find=function(e,t){return l(this,e,t,!1)},d.findIndex=function(e,t){return l(this,e,t,!0)},d.toSet=function(){if(void 0===e.Set)throw new TypeError;var t=this;return new v(function(r){var n=new e.Set;return t.subscribe(function(e){n.add(e)},function(e){r.onError(e)},function(){r.onNext(n),r.onCompleted()})},t)},d.toMap=function(t,r){if(void 0===e.Map)throw new TypeError;var n=this;return new v(function(i){var o=new e.Map;return n.subscribe(function(e){var n;try{n=t(e)}catch(e){return void i.onError(e)}var a=e;if(r)try{a=r(e)}catch(e){return void i.onError(e)}o.set(n,a)},function(e){i.onError(e)},function(){i.onNext(o),i.onCompleted()})},n)},r})}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(e,t,r){(function(e,n){(function(i){function o(e){for(var t=[],r=0,n=e.length;n>r;r++)t.push(e[r]);return t}function a(e,t){if(K&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(Q)){for(var r=[],n=t;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(e.stack);var i=r.join("\n"+Q+"\n");e.stack=function(e){for(var t=e.split("\n"),r=[],n=0,i=t.length;i>n;n++){var o=t[n];(function(e){var t=u(e);if(!t)return!1;var r=t[0],n=t[1];return r===Z&&n>=J&&br>=n})(o)||function(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}(o)||!o||r.push(o)}return r.join("\n")}(i)}}function c(){if(K)try{throw new Error}catch(r){var e=r.stack.split("\n"),t=u(e[0].indexOf("@")>0?e[1]:e[2]);if(!t)return;return Z=t[0],t[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 h(e){var t=[];if(!Ae(e))return t;je.nonEnumArgs&&e.length&&Re(e)&&(e=Ie.call(e));var r=je.enumPrototypes&&"function"==typeof e,n=je.enumErrorProps&&(e===Ee||e instanceof Error);for(var i in e)r&&"prototype"==i||n&&("message"==i||"name"==i)||t.push(i);if(je.nonEnumShadows&&e!==Ce){var o=e.constructor,a=-1,s=pe;if(e===(o&&o.prototype))var c=e===Te?xe:e===Ee?ge:we.call(e),u=Pe[c];for(;++a-1:void 0});return r.pop(),n.pop(),v}function d(e,t){for(var r=new Array(e),n=0;e>n;n++)r[n]=t();return r}function m(e){if(!Y(e))throw new TypeError("fn must be a function");return Le=e,function(){try{return Le.apply(this,arguments)}catch(e){return Be.e=e,Be}}}function v(e){throw e}function g(e,t){this.id=e,this.value=t}function y(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function b(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function _(e){this._s=s}function x(e){this._s=s,this._l=s.length,this._i=0}function w(e){this._a=e}function S(e){this._a=e,this._l=function(e){var t=+e.length;return isNaN(t)?0:0!==t&&function(e){return"number"==typeof e&&D.isFinite(e)}(t)?0>=(t=function(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}(t)*Math.floor(Math.abs(t)))?0:t>kt?kt:t:t}(e),this._i=0}function M(e,t){this.observer=e,this.parent=t}function E(e,t){return tt(e)||(e=ot),new Bt(t,e)}function C(e,t){this.observer=e,this.parent=t}function T(e,t){this.observer=e,this.parent=t}function O(){return!1}function O(){return!1}function P(){return[]}function O(){return!1}function j(){return[]}function A(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 R(e,t,r){var n=he(t,r,3);return e.map(function(t,r){var i=n(t,r,e);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Ft(i)),i}).concatAll()}function L(e){this.comparer=e,this.set=[]}function N(e,t,r){var n=he(t,r,3);return e.map(function(t,r){var i=n(t,r,e);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Ft(i)),i}).mergeAll()}var I={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},D=I[typeof window]&&window||this,k=I[typeof r]&&r&&!r.nodeType&&r,F=I[typeof t]&&t&&!t.nodeType&&t,B=F&&F.exports===k&&k,U=I[typeof n]&&n;!U||U.global!==U&&U.window!==U||(D=U);var z={internals:{},config:{Promise:D.Promise},helpers:{}},$=z.helpers.noop=function(){},G=(z.helpers.notDefined=function(e){return void 0===e},z.helpers.identity=function(e){return e}),V=(z.helpers.pluck=function(e){return function(t){return t[e]}},z.helpers.just=function(e){return function(){return e}},z.helpers.defaultNow=Date.now),H=z.helpers.defaultComparer=function(e,t){return Ne(e,t)},q=z.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},W=(z.helpers.defaultKeySerializer=function(e){return e.toString()},z.helpers.defaultError=function(e){throw e}),X=z.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},Y=(z.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},z.helpers.not=function(e){return!e},z.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==we.call(e)}),e}());z.config.longStackSupport=!1;var K=!1;try{throw new Error}catch(e){K=!!e.stack}var Z,J=c(),Q="From previous event:";(z.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)}).prototype=Error.prototype;var ee=z.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};ee.prototype=Error.prototype;var te=z.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};te.prototype=Error.prototype;var re=z.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};re.prototype=Error.prototype;var ne=z.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};ne.prototype=Error.prototype;var ie=z.helpers.notImplemented=function(){throw new ne},oe=z.helpers.notSupported=function(){throw new re},ae="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";D.Set&&"function"==typeof(new D.Set)["@@iterator"]&&(ae="@@iterator");var se=z.doneEnumerator={done:!0,value:i},ce=z.helpers.isIterable=function(e){return e[ae]!==i},ue=z.helpers.isArrayLike=function(e){return e&&e.length!==i};z.helpers.iterator=ae;var he=z.internals.bindCallback=function(e,t,r){if(void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}},le=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],pe=le.length,fe="[object Arguments]",de="[object Array]",me="[object Boolean]",ve="[object Date]",ge="[object Error]",ye="[object Number]",be="[object Object]",_e="[object RegExp]",xe="[object String]",we=Object.prototype.toString,Se=Object.prototype.hasOwnProperty,Me=we.call(arguments)==fe,Ee=Error.prototype,Ce=Object.prototype,Te=String.prototype,Oe=Ce.propertyIsEnumerable;try{!(we.call(document)==be&&!({toString:0}+""))}catch(e){!0}var Pe={};Pe[de]=Pe[ve]=Pe[ye]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Pe[me]=Pe[xe]={constructor:!0,toString:!0,valueOf:!0},Pe[ge]=Pe["[object Function]"]=Pe[_e]={constructor:!0,toString:!0},Pe[be]={constructor:!0};var je={};!function(){var e=function(){this.x=1},t=[];e.prototype={valueOf:1,y:1};for(var r in new e)t.push(r);for(r in arguments);je.enumErrorProps=Oe.call(Ee,"message")||Oe.call(Ee,"name"),je.enumPrototypes=Oe.call(e,"prototype"),je.nonEnumArgs=0!=r,je.nonEnumShadows=!/valueOf/.test(t)}(1);var Ae=z.internals.isObject=function(e){var t=typeof e;return e&&("function"==t||"object"==t)||!1},Re=function(e){return!(!e||"object"!=typeof e)&&we.call(e)==fe};Me||(Re=function(e){return!(!e||"object"!=typeof e)&&Se.call(e,"callee")});var Le,Ne=z.internals.isEqual=function(e,t){return f(e,t,[],[])},Ie=Array.prototype.slice,De=this.inherits=z.internals.inherits=function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r},ke=z.internals.addProperties=function(e){for(var t=[],r=1,n=arguments.length;n>r;r++)t.push(arguments[r]);for(var i=0,o=t.length;o>i;i++){var a=t[i];for(var s in a)e[s]=a[s]}},Fe=z.internals.addRef=function(e,t){return new dr(function(r){return new $e(t.getDisposable(),e.subscribe(r))})},Be={e:{}};g.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var Ue=z.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},ze=Ue.prototype;ze.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},ze.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var r=this.items[e];this.items[e]=this.items[t],this.items[t]=r,this.percolate(t)}}},ze.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,r=2*e+2,n=e;if(te;e++)r[e]=arguments[e];for(e=0;t>e;e++)if(!We(r[e]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},Ge=$e.prototype;Ge.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},Ge.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},Ge.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),r=0;e>r;r++)t[r]=this.disposables[r];for(this.disposables=[],this.length=0,r=0;e>r;r++)t[r].dispose()}};var Ve=z.Disposable=function(e){this.isDisposed=!1,this.action=e||$};Ve.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var He=Ve.create=function(e){return new Ve(e)},qe=Ve.empty={dispose:$},We=Ve.isDisposable=function(e){return e&&Y(e.dispose)},Xe=Ve.checkDisposed=function(e){if(e.isDisposed)throw new ee},Ye=z.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};Ye.prototype.getDisposable=function(){return this.current},Ye.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()},Ye.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var Ke=z.SerialDisposable=function(){this.isDisposed=!1,this.current=null};Ke.prototype.getDisposable=function(){return this.current},Ke.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var r=this.current;this.current=e}r&&r.dispose(),t&&e&&e.dispose()},Ke.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var Ze=z.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?qe:new e(this)},t}();y.prototype.dispose=function(){this.scheduler.scheduleWithState(this,b)};var Je=z.internals.ScheduledItem=function(e,t,r,n,i){this.scheduler=e,this.state=t,this.action=r,this.dueTime=n,this.comparer=i||q,this.disposable=new Ye};Je.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Je.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},Je.prototype.isCancelled=function(){return this.disposable.isDisposed},Je.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Qe=z.Scheduler=function(){function e(e,t,r,n){this.now=e,this._schedule=t,this._scheduleRelative=r,this._scheduleAbsolute=n}function t(e,t){return t(),qe}e.isScheduler=function(t){return t instanceof e};var r=e.prototype;return r.schedule=function(e){return this._schedule(e,t)},r.scheduleWithState=function(e,t){return this._schedule(e,t)},r.scheduleWithRelative=function(e,r){return this._scheduleRelative(r,e,t)},r.scheduleWithRelativeAndState=function(e,t,r){return this._scheduleRelative(e,t,r)},r.scheduleWithAbsolute=function(e,r){return this._scheduleAbsolute(r,e,t)},r.scheduleWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute(e,t,r)},e.now=V,e.normalize=function(e){return 0>e&&(e=0),e},e}(),et=Qe.normalize,tt=Qe.isScheduler;!function(e){function t(e,t){function r(t){i(t,function(t){var n=!1,i=!1,a=e.scheduleWithState(t,function(e,t){return n?o.remove(a):i=!0,r(t),qe});i||(o.add(a),n=!0)})}var n=t[0],i=t[1],o=new $e;return r(n),o}function r(e,t,r){function n(t){o(t,function(t,i){var o=!1,s=!1,c=e[r](t,i,function(e,t){return o?a.remove(c):s=!0,n(t),qe});s||(a.add(c),o=!0)})}var i=t[0],o=t[1],a=new $e;return n(i),a}function n(e,t){e(function(r){t(e,r)})}e.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,n)},e.scheduleRecursiveWithState=function(e,r){return this.scheduleWithState([e,r],t)},e.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,n)},e.scheduleRecursiveWithRelativeAndState=function(e,t,n){return this._scheduleRelative([e,n],t,function(e,t){return r(e,t,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,n)},e.scheduleRecursiveWithAbsoluteAndState=function(e,t,n){return this._scheduleAbsolute([e,n],t,function(e,t){return r(e,t,"scheduleWithAbsoluteAndState")})}}(Qe.prototype),Qe.prototype,Qe.prototype.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,t)},Qe.prototype.schedulePeriodicWithState=function(e,t,r){if(void 0===D.setInterval)throw new re;t=et(t);var n=e,i=D.setInterval(function(){n=r(n)},t);return He(function(){D.clearInterval(i)})},function(e){e.catchError=e.catch=function(e){return new ut(this,e)}}(Qe.prototype);var rt,nt,it=(z.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 Ye;return this._cancel=e,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}(),Qe.immediate=function(){return new Qe(V,function(e,t){return t(this,e)},oe,oe)}()),ot=Qe.currentThread=function(){function e(){for(;t.length>0;){var e=t.dequeue();!e.isCancelled()&&e.invoke()}}var t,r=new Qe(V,function(r,n){var i=new Je(this,r,n,this.now());if(t)t.enqueue(i);else{(t=new Ue(4)).enqueue(i);var o=m(e)();if(t=null,o===Be)return v(o.e)}return i.disposable},oe,oe);return r.scheduleRequired=function(){return!t},r}(),at=function(){var e,t=$;if(D.setTimeout)e=D.setTimeout,t=D.clearTimeout;else{if(!D.WScript)throw new re;e=function(e,t){D.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),st=at.setTimeout,ct=at.clearTimeout;!function(){function t(e){if(o)st(function(){t(e)},0);else{var r=i[e];if(r){o=!0;var n=m(r)();if(nt(e),o=!1,n===Be)return v(n.e)}}}function r(e){"string"==typeof e.data&&e.data.substring(0,c.length)===c&&t(e.data.substring(c.length))}var n=1,i={},o=!1;nt=function(e){delete i[e]};var a=RegExp("^"+String(we).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),s="function"==typeof(s=U&&B&&U.setImmediate)&&!a.test(s)&&s;if(Y(s))rt=function(e){var r=n++;return i[r]=e,s(function(){t(r)}),r};else if(void 0!==e&&"[object process]"==={}.toString.call(e))rt=function(r){var o=n++;return i[o]=r,e.nextTick(function(){t(o)}),o};else if(function(){if(!D.postMessage||D.importScripts)return!1;var e=!1,t=D.onmessage;return D.onmessage=function(){e=!0},D.postMessage("","*"),D.onmessage=t,e}()){var c="ms.rx.schedule"+Math.random();D.addEventListener?D.addEventListener("message",r,!1):D.attachEvent?D.attachEvent("onmessage",r):D.onmessage=r,rt=function(e){var t=n++;return i[t]=e,D.postMessage(c+currentId,"*"),t}}else if(D.MessageChannel){var u=new D.MessageChannel;u.port1.onmessage=function(e){t(e.data)},rt=function(e){var t=n++;return i[t]=e,u.port2.postMessage(t),t}}else rt="document"in D&&"onreadystatechange"in D.document.createElement("script")?function(e){var r=D.document.createElement("script"),o=n++;return i[o]=e,r.onreadystatechange=function(){t(o),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},D.document.documentElement.appendChild(r),o}:function(e){var r=n++;return i[r]=e,st(function(){t(r)},0),r}}();var ut=(Qe.timeout=Qe.default=function(){return new Qe(V,function(e,t){var r=this,n=new Ye,i=rt(function(){!n.isDisposed&&n.setDisposable(t(r,e))});return new $e(n,He(function(){nt(i)}))},function(e,t,r){var n=this,i=Qe.normalize(t),o=new Ye;if(0===i)return n.scheduleWithState(e,r);var a=st(function(){!o.isDisposed&&o.setDisposable(r(n,e))},i);return new $e(o,He(function(){ct(a)}))},function(e,t,r){return this.scheduleWithRelativeAndState(e,t-this.now(),r)})}(),function(e){function t(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function r(e,t,r){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(r))}function n(e,t,r){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(r))}function i(i,o){this._scheduler=i,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,e.call(this,this._scheduler.now.bind(this._scheduler),t,r,n)}return De(i,e),i.prototype._clone=function(e){return new i(e,this._handler)},i.prototype._wrap=function(e){var t=this;return function(r,n){try{return e(t._getRecursiveWrapper(r),n)}catch(e){if(!t._handler(e))throw e;return qe}}},i.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},i.prototype.schedulePeriodicWithState=function(e,t,r){var n=this,i=!1,o=new Ye;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},i}(Qe)),ht=z.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 tt(e)||(e=it),new dr(function(r){return e.scheduleWithState(t,function(e,t){t._acceptObservable(r),"N"===t.kind&&r.onCompleted()})})},e}(),lt=ht.createOnNext=function(){function e(e){return e(this.value)}function t(e){return e.onNext(this.value)}function r(){return"OnNext("+this.value+")"}return function(n){return new ht("N",n,null,e,t,r)}}(),pt=ht.createOnError=function(){function e(e,t){return t(this.exception)}function t(e){return e.onError(this.exception)}function r(){return"OnError("+this.exception+")"}return function(n){return new ht("E",null,n,e,t,r)}}(),ft=ht.createOnCompleted=function(){function e(e,t,r){return r()}function t(e){return e.onCompleted()}function r(){return"OnCompleted()"}return function(){return new ht("C",null,null,e,t,r)}}(),dt=z.Observer=function(){};dt.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},dt.prototype.asObserver=function(){return new yt(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},dt.prototype.checked=function(){return new bt(this)};var mt=dt.create=function(e,t,r){return e||(e=$),t||(t=W),r||(r=$),new yt(e,t,r)};dt.fromNotifier=function(e,t){return new yt(function(r){return e.call(t,lt(r))},function(r){return e.call(t,pt(r))},function(){return e.call(t,ft())})},dt.prototype.notifyOn=function(e){return new _t(e,this)},dt.prototype.makeSafe=function(e){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,e)};var vt,gt=z.internals.AbstractObserver=function(e){function t(){this.isStopped=!1,e.call(this)}return De(t,e),t.prototype.next=ie,t.prototype.error=ie,t.prototype.completed=ie,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}(dt),yt=z.AnonymousObserver=function(e){function t(t,r,n){e.call(this),this._onNext=t,this._onError=r,this._onCompleted=n}return De(t,e),t.prototype.next=function(e){this._onNext(e)},t.prototype.error=function(e){this._onError(e)},t.prototype.completed=function(){this._onCompleted()},t}(gt),bt=function(e){function t(t){e.call(this),this._observer=t,this._state=0}De(t,e);var r=t.prototype;return r.onNext=function(e){this.checkAccess();var t=m(this._observer.onNext).call(this._observer,e);this._state=0,t===Be&&v(t.e)},r.onError=function(e){this.checkAccess();var t=m(this._observer.onError).call(this._observer,e);this._state=2,t===Be&&v(t.e)},r.onCompleted=function(){this.checkAccess();var e=m(this._observer.onCompleted).call(this._observer);this._state=2,e===Be&&v(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)},t}(dt),_t=function(e){function t(t,r,n){e.call(this,t,r),this._cancel=n}return De(t,e),t.prototype.next=function(t){e.prototype.next.call(this,t),this.ensureActive()},t.prototype.error=function(t){e.prototype.error.call(this,t),this.ensureActive()},t.prototype.completed=function(){e.prototype.completed.call(this),this.ensureActive()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},t}(z.internals.ScheduledObserver=function(e){function t(t,r){e.call(this),this.scheduler=t,this.observer=r,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Ke}return De(t,e),t.prototype.next=function(e){var t=this;this.queue.push(function(){t.observer.onNext(e)})},t.prototype.error=function(e){var t=this;this.queue.push(function(){t.observer.onError(e)})},t.prototype.completed=function(){var e=this;this.queue.push(function(){e.observer.onCompleted()})},t.prototype.ensureActive=function(){var e=!1,t=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(t.queue.length>0){r=t.queue.shift();try{r()}catch(e){throw t.queue=[],t.hasFaulted=!0,e}e()}else t.isAcquired=!1}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}(gt)),xt=z.Observable=function(){function e(e){if(z.config.longStackSupport&&K){try{throw new Error}catch(e){this.stack=e.stack.substring(e.stack.indexOf("\n")+1)}var t=this;this._subscribe=function(r){var n=r.onError.bind(r);return r.onError=function(e){a(e,t),n(e)},e.call(t,r)}}else this._subscribe=e}return vt=e.prototype,vt.subscribe=vt.forEach=function(e,t,r){return this._subscribe("object"==typeof e?e:mt(e,t,r))},vt.subscribeOnNext=function(e,t){return this._subscribe(mt(void 0!==t?function(r){e.call(t,r)}:e))},vt.subscribeOnError=function(e,t){return this._subscribe(mt(null,void 0!==t?function(r){e.call(t,r)}:e))},vt.subscribeOnCompleted=function(e,t){return this._subscribe(mt(null,null,void 0!==t?function(){e.call(t)}:e))},e}(),wt=z.ObservableBase=function(e){function t(e,t){var r=t[0],n=t[1],i=m(n.subscribeCore).call(n,r);return i!==Be||r.fail(Be.e)?void r.setDisposable(function(e){return e&&Y(e.dispose)?e:Y(e)?He(e):qe}(i)):v(Be.e)}function r(e){var r=new mr(e),n=[r,this];return ot.scheduleRequired()?ot.scheduleWithState(n,t):t(0,n),r}function n(){e.call(this,r)}return De(n,e),n.prototype.subscribeCore=ie,n}(xt),St=z.internals.Enumerable=function(){},Mt=function(e){function t(t){this.sources=t,e.call(this)}function r(e,t,r){this.o=e,this.s=t,this.e=r,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){var t,n=new Ke,i=it.scheduleRecursiveWithState(this.sources[ae](),function(i,o){if(!t){var a=m(i.next).call(i);if(a===Be)return e.onError(a.e);if(a.done)return e.onCompleted();var s=a.value;X(s)&&(s=At(s));var c=new Ye;n.setDisposable(c),c.setDisposable(s.subscribe(new r(e,o,i)))}});return new $e(n,i,He(function(){t=!0}))},r.prototype.onNext=function(e){this.isStopped||this.o.onNext(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.s(this.e))},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},t}(wt);St.prototype.concat=function(){return new Mt(this)};var Et=function(e){function t(t){this.sources=t,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){var t,r=this.sources[ae](),n=new Ke,i=it.scheduleRecursiveWithState(null,function(i,o){if(!t){var a=m(r.next).call(r);if(a===Be)return e.onError(a.e);if(a.done)return null!==i?e.onError(i):e.onCompleted();var s=a.value;X(s)&&(s=At(s));var c=new Ye;n.setDisposable(c),c.setDisposable(s.subscribe(function(t){e.onNext(t)},o,function(){e.onCompleted()}))}});return new $e(n,i,He(function(){t=!0}))},t}(wt);St.prototype.catchError=function(){return new Et(this)},St.prototype.catchErrorWhen=function(e){var t=this;return new dr(function(r){var n,i=new gr,o=new gr,a=e(i).subscribe(o),s=t[ae](),c=new Ke,u=it.scheduleRecursive(function(e){if(!n){var t=m(s.next).call(s);if(t===Be)return r.onError(t.e);if(t.done)return void r.onCompleted();var a=t.value;X(a)&&(a=At(a));var u=new Ye,h=new Ye;c.setDisposable(new $e(h,u)),u.setDisposable(a.subscribe(function(e){r.onNext(e)},function(t){h.setDisposable(o.subscribe(e,function(e){r.onError(e)},function(){r.onCompleted()})),i.onNext(t)},function(){r.onCompleted()}))}});return new $e(a,c,u,He(function(){n=!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 De(t,St),t.prototype[ae]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?se:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(),Tt=St.repeat=function(e,t){return new Ct(e,t)},Ot=function(e){function t(e,t,r){this.s=e,this.fn=t?he(t,r,3):null}function r(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return De(t,St),t.prototype[ae]=function(){return new r(this)},r.prototype.next=function(){return++this.in?(e.onNext(t[n]),i(n+1)):e.onCompleted()})};var Ut=xt.fromArray=function(e,t){return tt(t)||(t=ot),new Bt(e,t)};xt.generate=function(e,t,r,n,i){return tt(i)||(i=ot),new dr(function(o){var a=!0;return i.scheduleRecursiveWithState(e,function(e,i){var s,c;try{a?a=!1:e=r(e),(s=t(e))&&(c=n(e))}catch(e){return o.onError(e)}s?(o.onNext(c),i(e)):o.onCompleted()})})};var zt=function(e){function t(){e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return qe},t}(wt),$t=xt.never=function(){return new zt};xt.of=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return new Bt(t,ot)},xt.ofWithScheduler=function(e){for(var t=arguments.length,r=new Array(t-1),n=1;t>n;n++)r[n-1]=arguments[n];return new Bt(r,e)};var Gt=function(e){function t(t,r){this.obj=t,this.keys=Object.keys(t),this.scheduler=r,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return new C(e,this).run()},t}(wt);C.prototype.run=function(){var e=this.observer,t=this.parent.obj,r=this.parent.keys,n=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(i,o){if(n>i){var a=r[i];e.onNext([a,t[a]]),o(i+1)}else e.onCompleted()})},xt.pairs=function(e,t){return t||(t=ot),new Gt(e,t)};var Vt=function(e){function t(t,r,n){this.start=t,this.rangeCount=r,this.scheduler=n,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return new Ht(e,this).run()},t}(wt),Ht=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){var e=this.parent.start,t=this.parent.rangeCount,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,function(n,i){t>n?(r.onNext(e+n),i(n+1)):r.onCompleted()})},e}();xt.range=function(e,t,r){return tt(r)||(r=ot),new Vt(e,t,r)};var qt=function(e){function t(t,r,n){this.value=t,this.repeatCount=null==r?-1:r,this.scheduler=n,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return new T(e,this).run()},t}(wt);T.prototype.run=function(){var e=this.observer,t=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,function(r,n){return(-1===r||r>0)&&(e.onNext(t),r>0&&r--),0===r?e.onCompleted():void n(r)})},xt.repeat=function(e,t,r){return tt(r)||(r=ot),new qt(e,t,r)};var Wt=function(e){function t(t,r){this.value=t,this.scheduler=r,e.call(this)}function r(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 De(t,e),t.prototype.subscribeCore=function(e){return new r(e,this).run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],n)},t}(wt),Xt=(xt.return=xt.just=xt.returnValue=function(e,t){return tt(t)||(t=it),new Wt(e,t)},function(e){function t(t,r){this.error=t,this.scheduler=r,e.call(this)}function r(e,t){this.o=e,this.p=t}function n(e,t){var r=t[0];t[1].onError(r)}return De(t,e),t.prototype.subscribeCore=function(e){return new r(e,this).run()},r.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],n)},t}(wt)),Yt=xt.throw=xt.throwError=xt.throwException=function(e,t){return tt(t)||(t=it),new Xt(e,t)};xt.using=function(e,t){return new dr(function(r){var n,i,o=qe;try{(n=e())&&(o=n),i=t(n)}catch(e){return new $e(Yt(e).subscribe(r),o)}return new $e(i.subscribe(r),o)})},vt.amb=function(e){var t=this;return new dr(function(r){function n(){o||(o=a,u.dispose())}function i(){o||(o=s,c.dispose())}var o,a="L",s="R",c=new Ye,u=new Ye;return X(e)&&(e=At(e)),c.setDisposable(t.subscribe(function(e){n(),o===a&&r.onNext(e)},function(e){n(),o===a&&r.onError(e)},function(){n(),o===a&&r.onCompleted()})),u.setDisposable(e.subscribe(function(e){i(),o===s&&r.onNext(e)},function(e){i(),o===s&&r.onError(e)},function(){i(),o===s&&r.onCompleted()})),new $e(c,u)})},xt.amb=function(){function e(e,t){return e.amb(t)}var t=$t(),r=[];if(Array.isArray(arguments[0]))r=arguments[0];else for(var n=0,i=arguments.length;i>n;n++)r.push(arguments[n]);for(var n=0,i=r.length;i>n;n++)t=e(t,r[n]);return t},vt.catch=vt.catchError=vt.catchException=function(e){return"function"==typeof e?function(e,t){return new dr(function(r){var n=new Ye,i=new Ke;return i.setDisposable(n),n.setDisposable(e.subscribe(function(e){r.onNext(e)},function(e){try{var n=t(e)}catch(e){return r.onError(e)}X(n)&&(n=At(n));var o=new Ye;i.setDisposable(o),o.setDisposable(n.subscribe(r))},function(e){r.onCompleted(e)})),i},e)}(this,e):Kt([this,e])};var Kt=xt.catchError=xt.catch=xt.catchException=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return Pt(e).catchError()};vt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Zt.apply(this,t)};var Zt=xt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new dr(function(e){function r(t){if(s[t]=!0,c||(c=s.every(G))){try{var r=n.apply(null,h)}catch(t){return e.onError(t)}e.onNext(r)}else u.filter(function(e,r){return r!==t}).every(G)&&e.onCompleted()}function i(t){u[t]=!0,u.every(G)&&e.onCompleted()}for(var o=t.length,a=function(){return!1},s=d(o,a),c=!1,u=d(o,a),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(n){var o=t[n],a=new Ye;X(o)&&(o=At(o)),a.setDisposable(o.subscribe(function(e){h[n]=e,r(n)},function(t){e.onError(t)},function(){i(n)})),l[n]=a}(p);return new $e(l)},this)};vt.concat=function(){for(var e=[],t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return e.unshift(this),Qt.apply(null,e)};var Jt=function(e){function t(t){this.sources=t,e.call(this)}function r(e,t){this.sources=e,this.o=t}return De(t,e),t.prototype.subscribeCore=function(e){return new r(this.sources,e).run()},r.prototype.run=function(){var e,t=new Ke,r=this.sources,n=r.length,i=this.o,o=it.scheduleRecursiveWithState(0,function(o,a){if(!e){if(o===n)return i.onCompleted();var s=r[o];X(s)&&(s=At(s));var c=new Ye;t.setDisposable(c),c.setDisposable(s.subscribe(function(e){i.onNext(e)},function(e){i.onError(e)},function(){a(o+1)}))}});return new $e(t,o,He(function(){e=!0}))},t}(wt),Qt=xt.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,r=arguments.length;r>t;t++)e[t]=arguments[t]}return new Jt(e)};vt.concatAll=vt.concatObservable=function(){return this.merge(1)};var er=function(e){function t(t,r){this.source=t,this.maxConcurrent=r,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){var t=new $e;return t.add(this.source.subscribe(new tr(e,this.maxConcurrent,t))),t},t}(wt),tr=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 t(e,t){this.parent=e,this.sad=t,this.isStopped=!1}return e.prototype.handleSubscribe=function(e){var r=new Ye;this.g.add(r),X(e)&&(e=At(e)),r.setDisposable(e.subscribe(new t(this,r)))},e.prototype.onNext=function(e){this.isStopped||(this.activeCount0?e.handleSubscribe(e.q.shift()):(e.activeCount--,e.done&&0===e.activeCount&&e.o.onCompleted())}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();vt.merge=function(e){return"number"!=typeof e?rr(this,e):new er(this,e)};var rr=xt.merge=function(){var e,t,r=[],n=arguments.length;if(arguments[0])if(tt(arguments[0]))for(e=arguments[0],t=1;n>t;t++)r.push(arguments[t]);else for(e=it,t=0;n>t;t++)r.push(arguments[t]);else for(e=it,t=1;n>t;t++)r.push(arguments[t]);return Array.isArray(r[0])&&(r=r[0]),E(e,r).mergeAll()},nr=z.CompositeError=function(e){this.name="NotImplementedError",this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};nr.prototype=Error.prototype,xt.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var r=0;t>r;r++)e[r]=arguments[r]}var n=E(null,e);return new dr(function(e){function t(){0===a.length?e.onCompleted():1===a.length?e.onError(a[0]):e.onError(new nr(a))}var r=new $e,i=new Ye,o=!1,a=[];return r.add(i),i.setDisposable(n.subscribe(function(n){var i=new Ye;r.add(i),X(n)&&(n=At(n)),i.setDisposable(n.subscribe(function(t){e.onNext(t)},function(e){a.push(e),r.remove(i),o&&1===r.length&&t()},function(){r.remove(i),o&&1===r.length&&t()}))},function(e){a.push(e),o=!0,1===r.length&&t()},function(){o=!0,1===r.length&&t()})),r})};var ir=function(e){function t(t){this.source=t,e.call(this)}function r(e,t){this.o=e,this.g=t,this.isStopped=!1,this.done=!1}function n(e,t,r){this.parent=e,this.g=t,this.sad=r,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){var t=new $e,n=new Ye;return t.add(n),n.setDisposable(this.source.subscribe(new r(e,t))),t},r.prototype.onNext=function(e){if(!this.isStopped){var t=new Ye;this.g.add(t),X(e)&&(e=At(e)),t.setDisposable(e.subscribe(new n(this,this.g,t)))}},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},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(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},n.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},n.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()}},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(e),!0)},t}(wt);vt.mergeAll=vt.mergeObservable=function(){return new ir(this)},vt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return or([this,e])};var or=xt.onErrorResumeNext=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return new dr(function(t){var r=0,n=new Ke,i=it.scheduleRecursive(function(i){var o,a;rr;r++)t[r]=arguments[r];var n=t.pop(),i=this;return Array.isArray(t[0])&&(t=t[0]),new dr(function(e){for(var r=t.length,o=d(r,O),a=!1,s=new Array(r),c=new Array(r+1),u=0;r>u;u++)!function(r){var n=t[r],i=new Ye;X(n)&&(n=At(n)),i.setDisposable(n.subscribe(function(e){s[r]=e,o[r]=!0,a=o.every(G)},function(t){e.onError(t)},$)),c[r]=i}(u);var h=new Ye;return h.setDisposable(i.subscribe(function(t){var r=[t].concat(s);if(a){var i=m(n).apply(null,r);return i===Be?e.onError(i.e):void e.onNext(i)}},function(t){e.onError(t)},function(){e.onCompleted()})),c[r]=h,new $e(c)},this)},vt.zip=function(){if(Array.isArray(arguments[0]))return function(e,t){var r=this;return new dr(function(n){var i=0,o=e.length;return r.subscribe(function(r){if(o>i){var a=e[i++],s=m(t)(r,a);if(s===Be)return n.onError(s.e);n.onNext(s)}else n.onCompleted()},function(e){n.onError(e)},function(){n.onCompleted()})},r)}.apply(this,arguments);for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=this,i=t.pop();return t.unshift(n),new dr(function(e){for(var r=t.length,o=d(r,P),a=d(r,O),s=new Array(r),c=0;r>c;c++)!function(r){var c=t[r],u=new Ye;X(c)&&(c=At(c)),u.setDisposable(c.subscribe(function(t){if(o[r].push(t),o.every(function(e){return e.length>0})){var s=o.map(function(e){return e.shift()}),c=m(i).apply(n,s);if(c===Be)return e.onError(c.e);e.onNext(c)}else a.filter(function(e,t){return t!==r}).every(G)&&e.onCompleted()},function(t){e.onError(t)},function(){a[r]=!0,a.every(G)&&e.onCompleted()})),s[r]=u}(c);return new $e(s)},n)},xt.zip=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=t.shift();return n.zip.apply(n,t)},xt.zipArray=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var r=0;t>r;r++)e[r]=arguments[r]}return new dr(function(t){for(var r=e.length,n=d(r,j),i=d(r,O),o=new Array(r),a=0;r>a;a++)!function(r){o[r]=new Ye,o[r].setDisposable(e[r].subscribe(function(e){if(n[r].push(e),n.every(function(e){return e.length>0})){var o=n.map(function(e){return e.shift()});t.onNext(o)}else if(i.filter(function(e,t){return t!==r}).every(G))return t.onCompleted()},function(e){t.onError(e)},function(){i[r]=!0,i.every(G)&&t.onCompleted()}))}(a);return new $e(o)})},vt.asObservable=function(){var e=this;return new dr(function(t){return e.subscribe(t)},e)},vt.bufferWithCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).selectMany(function(e){return e.toArray()}).where(function(e){return e.length>0})},vt.dematerialize=function(){var e=this;return new dr(function(t){return e.subscribe(function(e){return e.accept(t)},function(e){t.onError(e)},function(){t.onCompleted()})},this)},vt.distinctUntilChanged=function(e,t){var r=this;return t||(t=H),new dr(function(n){var i,o=!1;return r.subscribe(function(r){var a=r;if(e&&(a=m(e)(r))===Be)return n.onError(a.e);if(o){var s=m(t)(i,a);if(s===Be)return n.onError(s.e)}o&&s||(o=!0,i=a,n.onNext(r))},function(e){n.onError(e)},function(){n.onCompleted()})},this)};var cr=function(e){function t(t,r,n,i){this.source=t,this.t=!r||Y(r)?mt(r||$,n||$,i||$):r,e.call(this)}function r(e,t){this.o=e,this.t=t,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.t))},r.prototype.onNext=function(e){if(!this.isStopped){var t=m(this.t.onNext).call(this.t,e);t===Be&&this.o.onError(t.e),this.o.onNext(e)}},r.prototype.onError=function(e){if(!this.isStopped){this.isStopped=!0;var t=m(this.t.onError).call(this.t,e);if(t===Be)return this.o.onError(t.e);this.o.onError(e)}},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=m(this.t.onCompleted).call(this.t);if(e===Be)return this.o.onError(e.e);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)},t}(wt);vt.do=vt.tap=vt.doAction=function(e,t,r){return new cr(this,e,t,r)},vt.doOnNext=vt.tapOnNext=function(e,t){return this.tap(void 0!==t?function(r){e.call(t,r)}:e)},vt.doOnError=vt.tapOnError=function(e,t){return this.tap($,void 0!==t?function(r){e.call(t,r)}:e)},vt.doOnCompleted=vt.tapOnCompleted=function(e,t){return this.tap($,null,void 0!==t?function(){e.call(t)}:e)},vt.finally=vt.ensure=function(e){var t=this;return new dr(function(r){var n;try{n=t.subscribe(r)}catch(t){throw e(),t}return He(function(){try{n.dispose()}catch(e){throw e}finally{e()}})},this)},vt.finallyAction=function(e){return this.ensure(e)};var ur=function(e){function t(t){this.source=t,e.call(this)}function r(e){this.o=e,this.isStopped=!1}return De(t,e),t.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)},t}(wt);vt.ignoreElements=function(){return new ur(this)},vt.materialize=function(){var e=this;return new dr(function(t){return e.subscribe(function(e){t.onNext(lt(e))},function(e){t.onNext(pt(e)),t.onCompleted()},function(){t.onNext(ft()),t.onCompleted()})},e)},vt.repeat=function(e){return Tt(this,e).concat()},vt.retry=function(e){return Tt(this,e).catchError()},vt.retryWhen=function(e){return Tt(this).catchErrorWhen(e)};var hr=function(e){function t(t,r,n,i){this.source=t,this.accumulator=r,this.hasSeed=n,this.seed=i,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new A(e,this))},t}(wt);A.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)}},A.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},A.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},A.prototype.dispose=function(){this.isStopped=!0},A.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(e),!0)},vt.scan=function(){var e,t,r=!1;return 2===arguments.length?(r=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new hr(this,t,r,e)},vt.skipLast=function(e){if(0>e)throw new te;var t=this;return new dr(function(r){var n=[];return t.subscribe(function(t){n.push(t),n.length>e&&r.onNext(n.shift())},function(e){r.onError(e)},function(){r.onCompleted()})},t)},vt.startWith=function(){var e,t=0;arguments.length&&tt(arguments[0])?(e=arguments[0],t=1):e=it;for(var r=[],n=t,i=arguments.length;i>n;n++)r.push(arguments[n]);return Pt([Ut(r,e),this]).concat()},vt.takeLast=function(e){if(0>e)throw new te;var t=this;return new dr(function(r){var n=[];return t.subscribe(function(t){n.push(t),n.length>e&&n.shift()},function(e){r.onError(e)},function(){for(;n.length>0;)r.onNext(n.shift());r.onCompleted()})},t)},vt.takeLastBuffer=function(e){var t=this;return new dr(function(r){var n=[];return t.subscribe(function(t){n.push(t),n.length>e&&n.shift()},function(e){r.onError(e)},function(){r.onNext(n),r.onCompleted()})},t)},vt.windowWithCount=function(e,t){var r=this;if(+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new te;if(null==t&&(t=e),+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new te;return new dr(function(n){function i(){var e=new gr;c.push(e),n.onNext(Fe(e,a))}var o=new Ye,a=new Ze(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-e+1;a>=0&&a%t==0&&c.shift().onCompleted(),++s%t==0&&i()},function(e){for(;c.length>0;)c.shift().onError(e);n.onError(e)},function(){for(;c.length>0;)c.shift().onCompleted();n.onCompleted()})),a},r)},vt.selectConcat=vt.concatMap=function(e,t,r){return Y(e)&&Y(t)?this.concatMap(function(r,n){var i=e(r,n);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Ft(i)),i.map(function(e,i){return t(r,e,n,i)})}):Y(e)?R(this,e,r):R(this,function(){return e})},vt.concatMapObserver=vt.selectConcatObserver=function(e,t,r,n){var i=this,o=he(e,n,2),a=he(t,n,1),s=he(r,n,0);return new dr(function(e){var t=0;return i.subscribe(function(r){var n;try{n=o(r,t++)}catch(t){return void e.onError(t)}X(n)&&(n=At(n)),e.onNext(n)},function(t){var r;try{r=a(t)}catch(t){return void e.onError(t)}X(r)&&(r=At(r)),e.onNext(r),e.onCompleted()},function(){var t;try{t=s()}catch(t){return void e.onError(t)}X(t)&&(t=At(t)),e.onNext(t),e.onCompleted()})},this).concatAll()},vt.defaultIfEmpty=function(e){var t=this;return e===i&&(e=null),new dr(function(r){var n=!1;return t.subscribe(function(e){n=!0,r.onNext(e)},function(e){r.onError(e)},function(){!n&&r.onNext(e),r.onCompleted()})},t)},L.prototype.push=function(e){var t=-1===function(e,t,r){for(var n=0,i=e.length;i>n;n++)if(r(e[n],t))return n;return-1}(this.set,e,this.comparer);return t&&this.set.push(e),t},vt.distinct=function(e,t){var r=this;return t||(t=H),new dr(function(n){var i=new L(t);return r.subscribe(function(t){var r=t;if(e)try{r=e(t)}catch(e){return void n.onError(e)}i.push(r)&&n.onNext(t)},function(e){n.onError(e)},function(){n.onCompleted()})},this)};var lr=function(e){function t(t,r,n){this.source=t,this.selector=he(r,n,3),e.call(this)}function r(e,t,r){this.o=e,this.selector=t,this.source=r,this.i=0,this.isStopped=!1}return De(t,e),t.prototype.internalMap=function(e,r){return new t(this.source,function(e,t){return function(r,n,i){return e.call(this,t.selector(r,n,i),n,i)}}(e,this),r)},t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.selector,this))},r.prototype.onNext=function(e){if(!this.isStopped){var t=m(this.selector)(e,this.i++,this.source);return t===Be?this.o.onError(t.e):void this.o.onNext(t)}},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.o.onError(e),!0)},t}(wt);vt.map=vt.select=function(e,t){var r="function"==typeof e?e:function(){return e};return this instanceof lr?this.internalMap(r,t):new lr(this,r,t)},vt.pluck=function(){var e=arguments,t=arguments.length;if(0===t)throw new Error("List of properties cannot be empty.");return this.map(function(r){for(var n=r,o=0;t>o;o++){var a=n[e[o]];if(void 0===a)return i;n=a}return n})},vt.flatMapObserver=vt.selectManyObserver=function(e,t,r,n){var i=this;return new dr(function(o){var a=0;return i.subscribe(function(t){var r;try{r=e.call(n,t,a++)}catch(e){return void o.onError(e)}X(r)&&(r=At(r)),o.onNext(r)},function(e){var r;try{r=t.call(n,e)}catch(e){return void o.onError(e)}X(r)&&(r=At(r)),o.onNext(r),o.onCompleted()},function(){var e;try{e=r.call(n)}catch(e){return void o.onError(e)}X(e)&&(e=At(e)),o.onNext(e),o.onCompleted()})},i).mergeAll()},vt.selectMany=vt.flatMap=function(e,t,r){return Y(e)&&Y(t)?this.flatMap(function(r,n){var i=e(r,n);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Ft(i)),i.map(function(e,i){return t(r,e,n,i)})},r):Y(e)?N(this,e,r):N(this,function(){return e})},vt.selectSwitch=vt.flatMapLatest=vt.switchMap=function(e,t){return this.select(e,t).switchLatest()};var pr=function(e){function t(t,r){this.source=t,this.skipCount=r,e.call(this)}function r(e,t){this.c=t,this.r=t,this.o=e,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.skipCount))},r.prototype.onNext=function(e){this.isStopped||(this.r<=0?this.o.onNext(e):this.r--)},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.o.onError(e),!0)},t}(wt);vt.skip=function(e){if(0>e)throw new te;return new pr(this,e)},vt.skipWhile=function(e,t){var r=this,n=he(e,t,3);return new dr(function(e){var t=0,i=!1;return r.subscribe(function(o){if(!i)try{i=!n(o,t++,r)}catch(t){return void e.onError(t)}i&&e.onNext(o)},function(t){e.onError(t)},function(){e.onCompleted()})},r)},vt.take=function(e,t){if(0>e)throw new te;if(0===e)return Nt(t);var r=this;return new dr(function(t){var n=e;return r.subscribe(function(e){n-- >0&&(t.onNext(e),0>=n&&t.onCompleted())},function(e){t.onError(e)},function(){t.onCompleted()})},r)},vt.takeWhile=function(e,t){var r=this,n=he(e,t,3);return new dr(function(e){var t=0,i=!0;return r.subscribe(function(o){if(i){try{i=n(o,t++,r)}catch(t){return void e.onError(t)}i?e.onNext(o):e.onCompleted()}},function(t){e.onError(t)},function(){e.onCompleted()})},r)};var fr=function(e){function t(t,r,n){this.source=t,this.predicate=he(r,n,3),e.call(this)}function r(e,t,r){this.o=e,this.predicate=t,this.source=r,this.i=0,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.predicate,this))},t.prototype.internalFilter=function(e,r){return new t(this.source,function(e,t){return function(r,n,i){return t.predicate(r,n,i)&&e.call(this,r,n,i)}}(e,this),r)},r.prototype.onNext=function(e){if(!this.isStopped){var t=m(this.predicate)(e,this.i++,this.source);return t===Be?this.o.onError(t.e):void(t&&this.o.onNext(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.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},t}(wt);vt.filter=vt.where=function(e,t){return this instanceof fr?this.internalFilter(e,t):new fr(this,e,t)},vt.transduce=function(e){var t=this;return new dr(function(r){var n=e(function(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}(r));return t.subscribe(function(e){try{n["@@transducer/step"](r,e)}catch(e){r.onError(e)}},function(e){r.onError(e)},function(){n["@@transducer/result"](r)})},t)};var dr=z.AnonymousObservable=function(e){function t(e,t){var r=t[0],n=m(t[1])(r);return n!==Be||r.fail(Be.e)?void r.setDisposable(function(e){return e&&Y(e.dispose)?e:Y(e)?He(e):qe}(n)):v(Be.e)}function r(r,n){this.source=n,e.call(this,function(e){var n=new mr(e),i=[n,r];return ot.scheduleRequired()?ot.scheduleWithState(i,t):t(0,i),n})}return De(r,e),r}(xt),mr=function(e){function t(t){e.call(this),this.observer=t,this.m=new Ye}De(t,e);var r=t.prototype;return r.next=function(e){var t=m(this.observer.onNext).call(this.observer,e);t===Be&&(this.dispose(),v(t.e))},r.error=function(e){var t=m(this.observer.onError).call(this.observer,e);this.dispose(),t===Be&&v(t.e)},r.completed=function(){var e=m(this.observer.onCompleted).call(this.observer);this.dispose(),e===Be&&v(e.e)},r.setDisposable=function(e){this.m.setDisposable(e)},r.getDisposable=function(){return this.m.getDisposable()},r.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}(gt),vr=function(e,t){this.subject=e,this.observer=t};vr.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 gr=z.Subject=function(e){function t(e){return Xe(this),this.isStopped?this.hasError?(e.onError(this.error),qe):(e.onCompleted(),qe):(this.observers.push(e),new vr(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return De(r,e),ke(r.prototype,dt.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(Xe(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=o(this.observers),r=t.length;r>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(Xe(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,r=o(this.observers),n=r.length;n>t;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){if(Xe(this),!this.isStopped)for(var t=0,r=o(this.observers),n=r.length;n>t;t++)r[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(e,t){return new yr(e,t)},r}(xt),yr=(z.AsyncSubject=function(e){function t(e){return Xe(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),qe):(this.observers.push(e),new vr(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return De(r,e),ke(r.prototype,dt,{hasObservers:function(){return Xe(this),this.observers.length>0},onCompleted:function(){var e;if(Xe(this),!this.isStopped){this.isStopped=!0;var t=o(this.observers),r=t.length;if(this.hasValue)for(e=0;r>e;e++){var n=t[e];n.onNext(this.value),n.onCompleted()}else for(e=0;r>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(Xe(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,r=o(this.observers),n=r.length;n>t;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){Xe(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(xt),z.AnonymousSubject=function(e){function t(e){return this.observable.subscribe(e)}function r(r,n){this.observer=r,this.observable=n,e.call(this,t)}return De(r,e),ke(r.prototype,dt.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),r}(xt));k&&F?B?(F.exports=z).Rx=z:k.Rx=z:D.Rx=z;var br=c()}).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(e,t,r){(function(r){var n,i=void 0!==r?r:"undefined"!=typeof window?window:{},o=e("min-document");"undefined"!=typeof document?n=document:(n=i["__GLOBAL_DOCUMENT_CACHE@4"])||(n=i["__GLOBAL_DOCUMENT_CACHE@4"]=o),t.exports=n}).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,a,s=8*i-n-1,c=(1<>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+=s;h>0;o=256*o+e[t+l],l+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+e[t+l],l+=p,h-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,h=(1<>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?(s=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(t*c-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;e[r+f]=255&a,f+=d,a/=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){return e in r?r[e]:(r[e]=t,t)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,r){"use strict";var n=e("./index.js");t.exports=function(e,t,r){var i="__INDIVIDUAL_ONE_VERSION_"+e,o=n(i+"_ENFORCE_SINGLETON",t);if(o!==t)throw new Error("Can only have one copy of "+e+".\nYou already have version "+o+" installed.\nThis means you cannot install version "+t);return n(i,r)}},{"./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 n={};n.base32="0123456789bcdefghjkmnpqrstuvwxyz",n.encode=function(e,t,r){if(void 0===r){for(var i=1;i<=12;i++){var o=n.encode(e,t,i),a=n.decode(o);if(a.lat==e&&a.lon==t)return o}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,c=0,u=!0,h="",l=-90,p=90,f=-180,d=180;h.length=m?(s=2*s+1,f=m):(s*=2,d=m)}else{var v=(l+p)/2;e>=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(e){var t=n.bounds(e),r=t.sw.lat,i=t.sw.lon,o=t.ne.lat,a=t.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(e){if(0===e.length)throw new Error("Invalid geohash");e=e.toLowerCase();for(var t=!0,r=-90,i=90,o=-180,a=180,s=0;s=0;h--){var l=u>>h&1;if(t){var p=(o+a)/2;1==l?o=p:a=p}else{var f=(r+i)/2;1==l?r=f:i=f}t=!t}}return{sw:{lat:r,lon:o},ne:{lat:i,lon:a}}},n.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),i=e.slice(0,-1),o=e.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[t][o].indexOf(r)&&""!==i&&(i=n.adjacent(i,t)),i+n.base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[t][o].indexOf(r))},n.neighbours=function(e){return{n:n.adjacent(e,"n"),ne:n.adjacent(n.adjacent(e,"n"),"e"),e:n.adjacent(e,"e"),se:n.adjacent(n.adjacent(e,"s"),"e"),s:n.adjacent(e,"s"),sw:n.adjacent(n.adjacent(e,"s"),"w"),w:n.adjacent(e,"w"),nw:n.adjacent(n.adjacent(e,"n"),"w")}},void 0!==t&&t.exports&&(t.exports=n)},{}],22:[function(e,t,r){(function(e){function t(e,t){for(var r=0,n=e.length-1;n>=0;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}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:e.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=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),o="/"===a(e,-1);return(e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),o=n(t.split("/")),a=Math.min(i.length,o.length),s=a,c=0;c>>0):4294967296*(t>>>0)+(e>>>0)}function a(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;i>=e;i--)r.buf[i+n]=r.buf[i]}function s(e,t){for(var r=0;r>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}t.exports=n;var b=e("ieee754");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;n.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos>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=v(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=v(this.buf,this.pos)+4294967296*v(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=v(this.buf,this.pos)+4294967296*y(this.buf,this.pos+4);return this.pos+=8,e},readFloat:function(){var e=b.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=b.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,r,n=this.buf;return r=n[this.pos++],t=127&r,r<128?t:(r=n[this.pos++],t|=(127&r)<<7,r<128?t:(r=n[this.pos++],t|=(127&r)<<14,r<128?t:(r=n[this.pos++],t|=(127&r)<<21,r<128?t:(r=n[this.pos],t|=(15&r)<<28,function(e,t,r){var n,i,a=r.buf;if(i=a[r.pos++],n=(112&i)>>4,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<3,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<10,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<17,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<24,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(1&i)<<31,i<128)return o(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t,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){for(var n="",i=t;i239?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?128==(192&(c=e[i+1]))&&(a=(31&o)<<6|63&c)<=127&&(a=null):3===s?(c=e[i+1],u=e[i+2],128==(192&c)&&128==(192&u)&&((a=(15&o)<<12|(63&c)<<6|63&u)<=2047||a>=55296&&a<=57343)&&(a=null)):4===s&&(c=e[i+1],u=e[i+2],h=e[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&((a=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)<=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}(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=i(this);for(e=e||[];this.pos127;);else if(t===n.Bytes)this.pos=this.readVarint()+this.pos;else if(t===n.Fixed32)this.pos+=4;else{if(t!==n.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;t268435455||e<0?function(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos]=127&e}(r,0,t),function(e,t){var r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||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);n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=63&n|128)}return r}(this.buf,e,this.pos);var r=this.pos-t;r>=128&&a(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),b.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),b.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=128&&a(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,n.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){this.writeMessage(e,s,t)},writePackedSVarint:function(e,t){this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){this.writeMessage(e,l,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,f,t)},writePackedFixed64:function(e,t){this.writeMessage(e,d,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,m,t)},writeBytesField:function(e,t){this.writeTag(e,n.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,n.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,n.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,n.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,n.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,n.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,n.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,n.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,n.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,n.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}}},{ieee754:17}],24:[function(e,t,r){"use strict";function n(e,t,r,o,a){for(r=r||0,o=o||e.length-1,a=a||function(e,t){return et?1:0};o>r;){if(o-r>600){var s=o-r+1,c=t-r+1,u=Math.log(s),h=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*h*(s-h)/s)*(c-s/2<0?-1:1);n(e,t,Math.max(r,Math.floor(t-c*h/s+l)),Math.min(o,Math.floor(t+(s-c)*h/s+l)),a)}var p=e[t],f=r,d=o;for(i(e,r,t),a(e[o],p)>0&&i(e,r,o);f0;)d--}0===a(e[r],p)?i(e,r,d):i(e,++d,o),d<=t&&(r=d+1),t<=d&&(o=d-1)}}function i(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}t.exports=n},{}],25:[function(e,t,r){"use strict";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 i(e,t){o(e,0,e.children.length,t,e)}function o(e,t,r,n,i){i||(i=f(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=t;s=e.minX&&t.maxY>=e.minY}function f(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(e,t,r,n,i){for(var o,a=[t,r];a.length;)(r=a.pop())-(t=a.pop())<=n||(o=t+Math.ceil((r-t)/n/2)*n,m(e,o,t,r,i),a.push(t,o,o,r))}t.exports=n;var m=e("quickselect");n.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,r=[],n=this.toBBox;if(!p(e,t))return r;for(var i,o,a,s,c=[];t;){for(i=0,o=t.children.length;i=0&&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,o=this._minEntries;this._chooseSplitAxis(r,o,n);var a=this._chooseSplitIndex(r,o,n),s=f(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,i(r,this.toBBox),i(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)},_splitRoot:function(e,t){this.data=f([e,t]),this.data.height=e.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,r){var n,i,a,s,c,h,l,p;for(h=l=1/0,n=t;n<=r-t;n++)s=function(e,t){var r=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,i-r)*Math.max(0,o-n)}(i=o(e,0,n,this.toBBox),a=o(e,n,r,this.toBBox)),c=u(i)+u(a),s=t;i--)s=e.children[i],a(l,e.leaf?c(s):s),p+=h(l);return p},_adjustParentBBoxes:function(e,t,r){for(var n=r;n>=0;n--)a(t[n],e)},_condense:function(e){for(var t,r=e.length-1;r>=0;r--)0===e[r].children.length?r>0?(t=e[r-1].children).splice(t.indexOf(e[r]),1):this.clear():i(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";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("./Subject"),o=e("./util/ObjectUnsubscribedError"),a=function(e){function t(t){e.call(this),this._value=t}return n(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return r&&!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.ObjectUnsubscribedError;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(i.Subject);r.BehaviorSubject=a},{"./Subject":34,"./util/ObjectUnsubscribedError":211}],27:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r,n){e.call(this),this.parent=t,this.outerValue=r,this.outerIndex=n,this.index=0}return n(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(e("./Subscriber").Subscriber);r.InnerSubscriber=i},{"./Subscriber":36}],28:[function(e,t,r){"use strict";var n=e("./Observable"),i=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},e.prototype.do=function(e,t,r){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return r&&r()}},e.prototype.accept=function(e,t,r){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){switch(this.kind){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.error);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},e.createNext=function(t){return void 0!==t?new e("N",t):e.undefinedValueNotification},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e.undefinedValueNotification=new e("N",void 0),e}();r.Notification=i},{"./Observable":29}],29:[function(e,t,r){"use strict";var n=e("./util/root"),i=e("./util/toSubscriber"),o=e("./symbol/observable"),a=e("./util/pipe"),s=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this.operator,o=i.toSubscriber(e,t,r);if(n?n.call(o,this.source):o.add(this.source?this._subscribe(o):this._trySubscribe(o)),o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.syncErrorThrown=!0,e.syncErrorValue=t,e.error(t)}},e.prototype.forEach=function(e,t){var r=this;if(t||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?t=n.root.Rx.config.Promise:n.root.Promise&&(t=n.root.Promise)),!t)throw new Error("no Promise impl found");return new t(function(t,n){var i;i=r.subscribe(function(t){if(i)try{e(t)}catch(e){n(e),i.unsubscribe()}else e(t)},n,t)})},e.prototype._subscribe=function(e){return this.source.subscribe(e)},e.prototype[o.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;tt&&(o=Math.max(o,i-t)),o>0&&n.splice(0,o),n},t}(i.Subject);r.ReplaySubject=h;var l=function(){return function(e,t){this.time=e,this.value=t}}()},{"./Subject":34,"./SubjectSubscription":35,"./Subscription":37,"./operators/observeOn":174,"./scheduler/queue":204,"./util/ObjectUnsubscribedError":211}],33:[function(e,t,r){"use strict";var n=function(){function e(t,r){void 0===r&&(r=e.now),this.SchedulerAction=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(r,t)},e.now=Date.now?Date.now:function(){return+new Date},e}();r.Scheduler=n},{}],34:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("./Observable"),o=e("./Subscriber"),a=e("./Subscription"),s=e("./util/ObjectUnsubscribedError"),c=e("./SubjectSubscription"),u=e("./symbol/rxSubscriber"),h=function(e){function t(t){e.call(this,t),this.destination=t}return n(t,e),t}(o.Subscriber);r.SubjectSubscriber=h;var l=function(e){function t(){e.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return n(t,e),t.prototype[u.rxSubscriber]=function(){return new h(this)},t.prototype.lift=function(e){var t=new p(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new s.ObjectUnsubscribedError;if(!this.isStopped)for(var t=this.observers,r=t.length,n=t.slice(),i=0;i=n?i.complete():(i.next(t[r]),e.index=r+1,this.schedule(e)))},t.prototype._subscribe=function(e){var r=this.arrayLike,n=this.scheduler,i=r.length;if(n)return n.schedule(t.dispatch,0,{arrayLike:r,index:0,length:i,subscriber:e});for(var o=0;o1?new t(e,n):1===i?new o.ScalarObservable(e[0],n):new a.EmptyObservable(n)},t.dispatch=function(e){var t=e.array,r=e.index,n=e.count,i=e.subscriber;r>=n?i.complete():(i.next(t[r]),i.closed||(e.index=r+1,this.schedule(e)))},t.prototype._subscribe=function(e){var r=this.array,n=r.length,i=this.scheduler;if(i)return i.schedule(t.dispatch,0,{array:r,index:0,count:n,subscriber:e});for(var o=0;o1)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},t}(a.Subscriber))},{"../Observable":29,"../Subject":34,"../Subscriber":36,"../Subscription":37,"../operators/refCount":179}],92:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Observable"),o=e("../util/subscribeToResult"),a=e("../OuterSubscriber"),s=function(e){function t(t){e.call(this),this.observableFactory=t}return n(t,e),t.create=function(e){return new t(e)},t.prototype._subscribe=function(e){return new c(e,this.observableFactory)},t}(i.Observable);r.DeferObservable=s;var c=function(e){function t(t,r){e.call(this,t),this.factory=r,this.tryDefer()}return n(t,e),t.prototype.tryDefer=function(){try{this._callFactory()}catch(e){this._error(e)}},t.prototype._callFactory=function(){var e=this.factory();e&&this.add(o.subscribeToResult(this,e))},t}(a.OuterSubscriber)},{"../Observable":29,"../OuterSubscriber":31,"../util/subscribeToResult":228}],93:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t){e.call(this),this.scheduler=t}return n(t,e),t.create=function(e){return new t(e)},t.dispatch=function(e){e.subscriber.complete()},t.prototype._subscribe=function(e){var r=this.scheduler;if(r)return r.schedule(t.dispatch,0,{subscriber:e});e.complete()},t}(e("../Observable").Observable);r.EmptyObservable=i},{"../Observable":29}],94:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r){e.call(this),this.error=t,this.scheduler=r}return n(t,e),t.create=function(e,r){return new t(e,r)},t.dispatch=function(e){var t=e.error;e.subscriber.error(t)},t.prototype._subscribe=function(e){var r=this.error,n=this.scheduler;if(e.syncErrorThrowable=!0,n)return n.schedule(t.dispatch,0,{error:r,subscriber:e});e.error(r)},t}(e("../Observable").Observable);r.ErrorObservable=i},{"../Observable":29}],95:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Observable"),o=e("../util/tryCatch"),a=e("../util/isFunction"),s=e("../util/errorObject"),c=e("../Subscription"),u=Object.prototype.toString,h=function(e){function t(t,r,n,i){e.call(this),this.sourceObj=t,this.eventName=r,this.selector=n,this.options=i}return n(t,e),t.create=function(e,r,n,i){return a.isFunction(n)&&(i=n,n=void 0),new t(e,r,i,n)},t.setupSubscription=function(e,r,n,i,o){var a;if(function(e){return!!e&&"[object NodeList]"===u.call(e)}(e)||function(e){return!!e&&"[object HTMLCollection]"===u.call(e)}(e))for(var s=0,h=e.length;sl?l:t:t}var i=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=e("../util/root"),a=e("../Observable"),s=e("../symbol/iterator"),c=function(e){function t(t,r){if(e.call(this),this.scheduler=r,null==t)throw new Error("iterator cannot be null.");this.iterator=function(e){var t=e[s.iterator];if(!t&&"string"==typeof e)return new u(e);if(!t&&void 0!==e.length)return new h(e);if(!t)throw new TypeError("object is not iterable");return e[s.iterator]()}(t)}return i(t,e),t.create=function(e,r){return new t(e,r)},t.dispatch=function(e){var t=e.index,r=e.hasError,n=e.iterator,i=e.subscriber;if(r)i.error(e.error);else{var o=n.next();o.done?i.complete():(i.next(o.value),e.index=t+1,i.closed?"function"==typeof n.return&&n.return():this.schedule(e))}},t.prototype._subscribe=function(e){var r=this.iterator,n=this.scheduler;if(n)return n.schedule(t.dispatch,0,{index:0,iterator:r,subscriber:e});for(;;){var i=r.next();if(i.done){e.complete();break}if(e.next(i.value),e.closed){"function"==typeof r.return&&r.return();break}}},t}(a.Observable);r.IteratorObservable=c;var u=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=e.length),this.str=e,this.idx=t,this.len=r}return e.prototype[s.iterator]=function(){return this},e.prototype.next=function(){return this.idx=2?n.scan(e,t)(this):n.scan(e)(this)}},{"../operators/scan":182}],140:[function(e,t,r){"use strict";var n=e("../operators/share");r.share=function(){return n.share()(this)}},{"../operators/share":183}],141:[function(e,t,r){"use strict";var n=e("../operators/skip");r.skip=function(e){return n.skip(e)(this)}},{"../operators/skip":184}],142:[function(e,t,r){"use strict";var n=e("../operators/skipUntil");r.skipUntil=function(e){return n.skipUntil(e)(this)}},{"../operators/skipUntil":185}],143:[function(e,t,r){"use strict";var n=e("../operators/skipWhile");r.skipWhile=function(e){return n.skipWhile(e)(this)}},{"../operators/skipWhile":186}],144:[function(e,t,r){"use strict";var n=e("../operators/startWith");r.startWith=function(){for(var e=[],t=0;t0&&this.destination.next(t),e.prototype._complete.call(this)},t}(i.Subscriber),s=function(e){function t(t,r,n){e.call(this,t),this.bufferSize=r,this.startBufferEvery=n,this.buffers=[],this.count=0}return n(t,e),t.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 a=n[o];a.push(e),a.length===t&&(n.splice(o,1),this.destination.next(a))}},t.prototype._complete=function(){for(var t=this.buffers,r=this.destination;t.length>0;){var n=t.shift();n.length>0&&r.next(n)}e.prototype._complete.call(this)},t}(i.Subscriber)},{"../Subscriber":36}],155:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscription"),o=e("../util/tryCatch"),a=e("../util/errorObject"),s=e("../OuterSubscriber"),c=e("../util/subscribeToResult");r.bufferWhen=function(e){return function(t){return t.lift(new u(e))}};var u=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.closingSelector))},e}(),h=function(e){function t(t,r){e.call(this,t),this.closingSelector=r,this.subscribing=!1,this.openBuffer()}return n(t,e),t.prototype._next=function(e){this.buffer.push(e)},t.prototype._complete=function(){var t=this.buffer;t&&this.destination.next(t),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},t.prototype.notifyNext=function(e,t,r,n,i){this.openBuffer()},t.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},t.prototype.openBuffer=function(){var e=this.closingSubscription;e&&(this.remove(e),e.unsubscribe());var t=this.buffer;this.buffer&&this.destination.next(t),this.buffer=[];var r=o.tryCatch(this.closingSelector)();r===a.errorObject?this.error(a.errorObject.e):(e=new i.Subscription,this.closingSubscription=e,this.add(e),this.subscribing=!0,e.add(c.subscribeToResult(this,r)),this.subscribing=!1)},t}(s.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscription":37,"../util/errorObject":215,"../util/subscribeToResult":228,"../util/tryCatch":230}],156:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.catchError=function(e){return function(t){var r=new a(e),n=t.lift(r);return r.caught=n}};var a=function(){function e(e){this.selector=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.selector,this.caught))},e}(),s=function(e){function t(t,r,n){e.call(this,t),this.selector=r,this.caught=n}return n(t,e),t.prototype.error=function(t){if(!this.isStopped){var r=void 0;try{r=this.selector(t,this.caught)}catch(t){return void e.prototype.error.call(this,t)}this._unsubscribeAndRecycle(),this.add(o.subscribeToResult(this,r))}},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],157:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../observable/ArrayObservable"),o=e("../util/isArray"),a=e("../OuterSubscriber"),s=e("../util/subscribeToResult"),c={};r.combineLatest=function(){for(var e=[],t=0;t0&&r[0].time-n.now()<=0;)r.shift().notification.observe(i);if(r.length>0){var o=Math.max(0,r[0].time-n.now());this.schedule(e,o)}else t.active=!1},t.prototype._schedule=function(e){this.active=!0,this.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 h(t.now()+this.delay,e);this.queue.push(r),!1===this.active&&this._schedule(t)}},t.prototype._next=function(e){this.scheduleNotification(s.Notification.createNext(e))},t.prototype._error=function(e){this.errored=!0,this.queue=[],this.destination.error(e)},t.prototype._complete=function(){this.scheduleNotification(s.Notification.createComplete())},t}(a.Subscriber),h=function(){return function(e,t){this.time=e,this.notification=t}}()},{"../Notification":28,"../Subscriber":36,"../scheduler/async":203,"../util/isDate":219}],162:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult"),a=e("../util/Set");r.distinct=function(e,t){return function(r){return r.lift(new s(e,t))}};var s=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(e){function t(t,r,n){e.call(this,t),this.keySelector=r,this.values=new a.Set,n&&this.add(o.subscribeToResult(this,n))}return n(t,e),t.prototype.notifyNext=function(e,t,r,n,i){this.values.clear()},t.prototype.notifyError=function(e,t){this._error(e)},t.prototype._next=function(e){this.keySelector?this._useKeySelector(e):this._finalizeNext(e,e)},t.prototype._useKeySelector=function(e){var t,r=this.destination;try{t=this.keySelector(e)}catch(e){return void r.error(e)}this._finalizeNext(t,e)},t.prototype._finalizeNext=function(e,t){var r=this.values;r.has(e)||(r.add(e),this.destination.next(t))},t}(i.OuterSubscriber);r.DistinctSubscriber=c},{"../OuterSubscriber":31,"../util/Set":212,"../util/subscribeToResult":228}],163:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/tryCatch"),a=e("../util/errorObject");r.distinctUntilChanged=function(e,t){return function(r){return r.lift(new s(e,t))}};var s=function(){function e(e,t){this.compare=e,this.keySelector=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.compare,this.keySelector))},e}(),c=function(e){function t(t,r,n){e.call(this,t),this.keySelector=n,this.hasKey=!1,"function"==typeof r&&(this.compare=r)}return n(t,e),t.prototype.compare=function(e,t){return e===t},t.prototype._next=function(e){var t=e;if(this.keySelector&&(t=o.tryCatch(this.keySelector)(e))===a.errorObject)return this.destination.error(a.errorObject.e);var r=!1;if(this.hasKey){if((r=o.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))},t}(i.Subscriber)},{"../Subscriber":36,"../util/errorObject":215,"../util/tryCatch":230}],164:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../util/tryCatch"),o=e("../util/errorObject"),a=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.expand=function(e,t,r){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===r&&(r=void 0),t=(t||0)<1?Number.POSITIVE_INFINITY:t,function(n){return n.lift(new c(e,t,r))}};var c=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 u(e,this.project,this.concurrent,this.scheduler))},e}();r.ExpandOperator=c;var u=function(e){function t(t,r,n,i){e.call(this,t),this.project=r,this.concurrent=n,this.scheduler=i,this.index=0,this.active=0,this.hasCompleted=!1,n0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},t}(a.OuterSubscriber);r.ExpandSubscriber=u},{"../OuterSubscriber":31,"../util/errorObject":215,"../util/subscribeToResult":228,"../util/tryCatch":230}],165:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.filter=function(e,t){return function(r){return r.lift(new o(e,t))}};var o=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(e){function t(t,r,n){e.call(this,t),this.predicate=r,this.thisArg=n,this.count=0}return n(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(i.Subscriber)},{"../Subscriber":36}],166:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../Subscription");r.finalize=function(e){return function(t){return t.lift(new a(e))}};var a=function(){function e(e){this.callback=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.callback))},e}(),s=function(e){function t(t,r){e.call(this,t),this.add(new o.Subscription(r))}return n(t,e),t}(i.Subscriber)},{"../Subscriber":36,"../Subscription":37}],167:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/EmptyError");r.first=function(e,t,r){return function(n){return n.lift(new a(e,t,r,n))}};var a=function(){function e(e,t,r,n){this.predicate=e,this.resultSelector=t,this.defaultValue=r,this.source=n}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.resultSelector,this.defaultValue,this.source))},e}(),s=function(e){function t(t,r,n,i,o){e.call(this,t),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.index=0,this.hasCompleted=!1,this._emitted=!1}return n(t,e),t.prototype._next=function(e){var t=this.index++;this.predicate?this._tryPredicate(e,t):this._emit(e,t)},t.prototype._tryPredicate=function(e,t){var r;try{r=this.predicate(e,t,this.source)}catch(e){return void this.destination.error(e)}r&&this._emit(e,t)},t.prototype._emit=function(e,t){this.resultSelector?this._tryResultSelector(e,t):this._emitFinal(e)},t.prototype._tryResultSelector=function(e,t){var r;try{r=this.resultSelector(e,t)}catch(e){return void this.destination.error(e)}this._emitFinal(r)},t.prototype._emitFinal=function(e){var t=this.destination;this._emitted||(this._emitted=!0,t.next(e),t.complete(),this.hasCompleted=!0)},t.prototype._complete=function(){var e=this.destination;this.hasCompleted||void 0===this.defaultValue?this.hasCompleted||e.error(new o.EmptyError):(e.next(this.defaultValue),e.complete())},t}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":210}],168:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/EmptyError");r.last=function(e,t,r){return function(n){return n.lift(new a(e,t,r,n))}};var a=function(){function e(e,t,r,n){this.predicate=e,this.resultSelector=t,this.defaultValue=r,this.source=n}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.resultSelector,this.defaultValue,this.source))},e}(),s=function(e){function t(t,r,n,i,o){e.call(this,t),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.hasValue=!1,this.index=0,void 0!==i&&(this.lastValue=i,this.hasValue=!0)}return n(t,e),t.prototype._next=function(e){var t=this.index++;if(this.predicate)this._tryPredicate(e,t);else{if(this.resultSelector)return void this._tryResultSelector(e,t);this.lastValue=e,this.hasValue=!0}},t.prototype._tryPredicate=function(e,t){var r;try{r=this.predicate(e,t,this.source)}catch(e){return void this.destination.error(e)}if(r){if(this.resultSelector)return void this._tryResultSelector(e,t);this.lastValue=e,this.hasValue=!0}},t.prototype._tryResultSelector=function(e,t){var r;try{r=this.resultSelector(e,t)}catch(e){return void this.destination.error(e)}this.lastValue=r,this.hasValue=!0},t.prototype._complete=function(){var e=this.destination;this.hasValue?(e.next(this.lastValue),e.complete()):e.error(new o.EmptyError)},t}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":210}],169:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.map=function(e,t){return function(r){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new o(e,t))}};var o=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=o;var a=function(e){function t(t,r,n){e.call(this,t),this.project=r,this.count=0,this.thisArg=n||this}return n(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(i.Subscriber)},{"../Subscriber":36}],170:[function(e,t,r){"use strict";function n(){for(var e=[],t=0;t1&&"number"==typeof e[e.length-1]&&(r=e.pop())):"number"==typeof c&&(r=e.pop()),null===n&&1===e.length&&e[0]instanceof i.Observable?e[0]:a.mergeAll(r)(new o.ArrayObservable(e,n))}var i=e("../Observable"),o=e("../observable/ArrayObservable"),a=e("./mergeAll"),s=e("../util/isScheduler");r.merge=function(){for(var e=[],t=0;t0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},t}(o.OuterSubscriber);r.MergeMapSubscriber=s},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],173:[function(e,t,r){"use strict";var n=e("../observable/ConnectableObservable");r.multicast=function(e,t){return function(r){var o;if(o="function"==typeof e?e:function(){return e},"function"==typeof t)return r.lift(new i(o,t));var a=Object.create(r,n.connectableObservableDescriptor);return a.source=r,a.subjectFactory=o,a}};var i=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=i},{"../observable/ConnectableObservable":91}],174:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../Notification");r.observeOn=function(e,t){return void 0===t&&(t=0),function(r){return r.lift(new a(e,t))}};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 s(e,this.scheduler,this.delay))},e}();r.ObserveOnOperator=a;var s=function(e){function t(t,r,n){void 0===n&&(n=0),e.call(this,t),this.scheduler=r,this.delay=n}return n(t,e),t.dispatch=function(e){var t=e.notification,r=e.destination;t.observe(r),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.add(this.scheduler.schedule(t.dispatch,this.delay,new c(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage(o.Notification.createNext(e))},t.prototype._error=function(e){this.scheduleMessage(o.Notification.createError(e))},t.prototype._complete=function(){this.scheduleMessage(o.Notification.createComplete())},t}(i.Subscriber);r.ObserveOnSubscriber=s;var c=function(){return function(e,t){this.notification=e,this.destination=t}}();r.ObserveOnMessage=c},{"../Notification":28,"../Subscriber":36}],175:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.pairwise=function(){return function(e){return e.lift(new o)}};var o=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new a(e))},e}(),a=function(e){function t(t){e.call(this,t),this.hasPrev=!1}return n(t,e),t.prototype._next=function(e){this.hasPrev?this.destination.next([this.prev,e]):this.hasPrev=!0,this.prev=e},t}(i.Subscriber)},{"../Subscriber":36}],176:[function(e,t,r){"use strict";function n(){for(var e=[],t=0;t1)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},t}(i.Subscriber)},{"../Subscriber":36}],180:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.retry=function(e){return void 0===e&&(e=-1),function(t){return t.lift(new o(e,t))}};var o=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(e){function t(t,r,n){e.call(this,t),this.count=r,this.source=n}return n(t,e),t.prototype.error=function(t){if(!this.isStopped){var r=this.source,n=this.count;if(0===n)return e.prototype.error.call(this,t);n>-1&&(this.count=n-1),r.subscribe(this._unsubscribeAndRecycle())}},t}(i.Subscriber)},{"../Subscriber":36}],181:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.sample=function(e){return function(t){return t.lift(new a(e))}};var a=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var r=new s(e),n=t.subscribe(r);return n.add(o.subscribeToResult(r,this.notifier)),n},e}(),s=function(e){function t(){e.apply(this,arguments),this.hasValue=!1}return n(t,e),t.prototype._next=function(e){this.value=e,this.hasValue=!0},t.prototype.notifyNext=function(e,t,r,n,i){this.emitValue()},t.prototype.notifyComplete=function(){this.emitValue()},t.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],182:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.scan=function(e,t){var r=!1;return arguments.length>=2&&(r=!0),function(n){return n.lift(new o(e,t,r))}};var o=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(e){function t(t,r,n,i){e.call(this,t),this.accumulator=r,this._seed=n,this.hasSeed=i,this.index=0}return n(t,e),Object.defineProperty(t.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=!0,this._seed=e},enumerable:!0,configurable:!0}),t.prototype._next=function(e){if(this.hasSeed)return this._tryNext(e);this.seed=e,this.destination.next(e)},t.prototype._tryNext=function(e){var t,r=this.index++;try{t=this.accumulator(this.seed,e,r)}catch(e){this.destination.error(e)}this.seed=t,this.destination.next(t)},t}(i.Subscriber)},{"../Subscriber":36}],183:[function(e,t,r){"use strict";function n(){return new a.Subject}var i=e("./multicast"),o=e("./refCount"),a=e("../Subject");r.share=function(){return function(e){return o.refCount()(i.multicast(n)(e))}}},{"../Subject":34,"./multicast":173,"./refCount":179}],184:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.skip=function(e){return function(t){return t.lift(new o(e))}};var o=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(e){function t(t,r){e.call(this,t),this.total=r,this.count=0}return n(t,e),t.prototype._next=function(e){++this.count>this.total&&this.destination.next(e)},t}(i.Subscriber)},{"../Subscriber":36}],185:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.skipUntil=function(e){return function(t){return t.lift(new a(e))}};var a=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.notifier))},e}(),s=function(e){function t(t,r){e.call(this,t),this.hasValue=!1,this.isInnerStopped=!1,this.add(o.subscribeToResult(this,r))}return n(t,e),t.prototype._next=function(t){this.hasValue&&e.prototype._next.call(this,t)},t.prototype._complete=function(){this.isInnerStopped?e.prototype._complete.call(this):this.unsubscribe()},t.prototype.notifyNext=function(e,t,r,n,i){this.hasValue=!0},t.prototype.notifyComplete=function(){this.isInnerStopped=!0,this.isStopped&&e.prototype._complete.call(this)},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],186:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.skipWhile=function(e){return function(t){return t.lift(new o(e))}};var o=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(e){function t(t,r){e.call(this,t),this.predicate=r,this.skipping=!0,this.index=0}return n(t,e),t.prototype._next=function(e){var t=this.destination;this.skipping&&this.tryCallPredicate(e),this.skipping||t.next(e)},t.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}},t}(i.Subscriber)},{"../Subscriber":36}],187:[function(e,t,r){"use strict";var n=e("../observable/ArrayObservable"),i=e("../observable/ScalarObservable"),o=e("../observable/EmptyObservable"),a=e("../observable/concat"),s=e("../util/isScheduler");r.startWith=function(){for(var e=[],t=0;t1?a.concat(new n.ArrayObservable(e,r),t):a.concat(new o.EmptyObservable(r),t)}}},{"../observable/ArrayObservable":90,"../observable/EmptyObservable":93,"../observable/ScalarObservable":99,"../observable/concat":102,"../util/isScheduler":224}],188:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.switchMap=function(e,t){return function(r){return r.lift(new a(e,t))}};var a=function(){function e(e,t){this.project=e,this.resultSelector=t}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.project,this.resultSelector))},e}(),s=function(e){function t(t,r,n){e.call(this,t),this.project=r,this.resultSelector=n,this.index=0}return n(t,e),t.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)},t.prototype._innerSub=function(e,t,r){var n=this.innerSubscription;n&&n.unsubscribe(),this.add(this.innerSubscription=o.subscribeToResult(this,e,t,r))},t.prototype._complete=function(){var t=this.innerSubscription;t&&!t.closed||e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.innerSubscription=null},t.prototype.notifyComplete=function(t){this.remove(t),this.innerSubscription=null,this.isStopped&&e.prototype._complete.call(this)},t.prototype.notifyNext=function(e,t,r,n,i){this.resultSelector?this._tryNotifyNext(e,t,r,n):this.destination.next(t)},t.prototype._tryNotifyNext=function(e,t,r,n){var i;try{i=this.resultSelector(e,t,r,n)}catch(e){return void this.destination.error(e)}this.destination.next(i)},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],189:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/ArgumentOutOfRangeError"),a=e("../observable/EmptyObservable");r.take=function(e){return function(t){return 0===e?new a.EmptyObservable:t.lift(new s(e))}};var s=function(){function e(e){if(this.total=e,this.total<0)throw new o.ArgumentOutOfRangeError}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.total))},e}(),c=function(e){function t(t,r){e.call(this,t),this.total=r,this.count=0}return n(t,e),t.prototype._next=function(e){var t=this.total,r=++this.count;r<=t&&(this.destination.next(e),r===t&&(this.destination.complete(),this.unsubscribe()))},t}(i.Subscriber)},{"../Subscriber":36,"../observable/EmptyObservable":93,"../util/ArgumentOutOfRangeError":209}],190:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.takeUntil=function(e){return function(t){return t.lift(new a(e))}};var a=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.notifier))},e}(),s=function(e){function t(t,r){e.call(this,t),this.notifier=r,this.add(o.subscribeToResult(this,r))}return n(t,e),t.prototype.notifyNext=function(e,t,r,n,i){this.complete()},t.prototype.notifyComplete=function(){},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],191:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.takeWhile=function(e){return function(t){return t.lift(new o(e))}};var o=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(e){function t(t,r){e.call(this,t),this.predicate=r,this.index=0}return n(t,e),t.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)},t.prototype.nextOrComplete=function(e,t){var r=this.destination;Boolean(t)?r.next(e):r.complete()},t}(i.Subscriber)},{"../Subscriber":36}],192:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.tap=function(e,t,r){return function(n){return n.lift(new o(e,t,r))}};var o=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 a(e,this.nextOrObserver,this.error,this.complete))},e}(),a=function(e){function t(t,r,n,o){e.call(this,t);var a=new i.Subscriber(r,n,o);a.syncErrorThrowable=!0,this.add(a),this.safeSubscriber=a}return n(t,e),t.prototype._next=function(e){var t=this.safeSubscriber;t.next(e),t.syncErrorThrown?this.destination.error(t.syncErrorValue):this.destination.next(e)},t.prototype._error=function(e){var t=this.safeSubscriber;t.error(e),t.syncErrorThrown?this.destination.error(t.syncErrorValue):this.destination.error(e)},t.prototype._complete=function(){var e=this.safeSubscriber;e.complete(),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.complete()},t}(i.Subscriber)},{"../Subscriber":36}],193:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.defaultThrottleConfig={leading:!0,trailing:!1},r.throttle=function(e,t){return void 0===t&&(t=r.defaultThrottleConfig),function(r){return r.lift(new a(e,t.leading,t.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 s(e,this.durationSelector,this.leading,this.trailing))},e}(),s=function(e){function t(t,r,n,i){e.call(this,t),this.destination=t,this.durationSelector=r,this._leading=n,this._trailing=i,this._hasTrailingValue=!1}return n(t,e),t.prototype._next=function(e){if(this.throttled)this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=e);else{var t=this.tryDurationSelector(e);t&&this.add(this.throttled=o.subscribeToResult(this,t)),this._leading&&(this.destination.next(e),this._trailing&&(this._hasTrailingValue=!0,this._trailingValue=e))}},t.prototype.tryDurationSelector=function(e){try{return this.durationSelector(e)}catch(e){return this.destination.error(e),null}},t.prototype._unsubscribe=function(){var e=this.throttled;this._trailingValue,this._hasTrailingValue,this._trailing;this._trailingValue=null,this._hasTrailingValue=!1,e&&(this.remove(e),this.throttled=null,e.unsubscribe())},t.prototype._sendTrailing=function(){var e=this,t=e.destination,r=e.throttled,n=e._trailing,i=e._trailingValue,o=e._hasTrailingValue;r&&n&&o&&(t.next(i),this._trailingValue=null,this._hasTrailingValue=!1)},t.prototype.notifyNext=function(e,t,r,n,i){this._sendTrailing(),this._unsubscribe()},t.prototype.notifyComplete=function(){this._sendTrailing(),this._unsubscribe()},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],194:[function(e,t,r){"use strict";function n(e){e.subscriber.clearThrottle()}var i=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=e("../Subscriber"),a=e("../scheduler/async"),s=e("./throttle");r.throttleTime=function(e,t,r){return void 0===t&&(t=a.async),void 0===r&&(r=s.defaultThrottleConfig),function(n){return n.lift(new c(e,t,r.leading,r.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(e){function t(t,r,n,i,o){e.call(this,t),this.duration=r,this.scheduler=n,this.leading=i,this.trailing=o,this._hasTrailingValue=!1,this._trailingValue=null}return i(t,e),t.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(n,this.duration,{subscriber:this})),this.leading&&this.destination.next(e))},t.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},t}(o.Subscriber)},{"../Subscriber":36,"../scheduler/async":203,"./throttle":193}],195:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../scheduler/async"),o=e("../util/isDate"),a=e("../Subscriber"),s=e("../util/TimeoutError");r.timeout=function(e,t){void 0===t&&(t=i.async);var r=o.isDate(e),n=r?+e-t.now():Math.abs(e);return function(e){return e.lift(new c(n,r,t,new s.TimeoutError))}};var c=function(){function e(e,t,r,n){this.waitFor=e,this.absoluteTimeout=t,this.scheduler=r,this.errorInstance=n}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.absoluteTimeout,this.waitFor,this.scheduler,this.errorInstance))},e}(),u=function(e){function t(t,r,n,i,o){e.call(this,t),this.absoluteTimeout=r,this.waitFor=n,this.scheduler=i,this.errorInstance=o,this.action=null,this.scheduleTimeout()}return n(t,e),t.dispatchTimeout=function(e){e.error(e.errorInstance)},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(t){this.absoluteTimeout||this.scheduleTimeout(),e.prototype._next.call(this,t)},t.prototype._unsubscribe=function(){this.action=null,this.scheduler=null,this.errorInstance=null},t}(a.Subscriber)},{"../Subscriber":36,"../scheduler/async":203,"../util/TimeoutError":213,"../util/isDate":219}],196:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.withLatestFrom=function(){for(var e=[],t=0;t0){var a=o.indexOf(r);-1!==a&&o.splice(a,1)}},t.prototype.notifyComplete=function(){},t.prototype._next=function(e){if(0===this.toRespond.length){var t=[e].concat(this.values);this.project?this._tryProject(t):this.destination.next(t)}},t.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":228}],197:[function(e,t,r){"use strict";function n(){for(var e=[],t=0;tthis.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),m=function(e){function t(t,r,n){e.call(this,t),this.parent=r,this.observable=n,this.stillUnsubscribed=!0,this.buffer=[],this.isComplete=!1}return i(t,e),t.prototype[h.iterator]=function(){return this},t.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},t.prototype.hasValue=function(){return this.buffer.length>0},t.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},t.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},t.prototype.notifyNext=function(e,t,r,n,i){this.buffer.push(t),this.parent.checkIterators()},t.prototype.subscribe=function(e,t){return u.subscribeToResult(this,this.observable,this,t)},t}(c.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscriber":36,"../observable/ArrayObservable":90,"../symbol/iterator":205,"../util/isArray":217,"../util/subscribeToResult":228}],198:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r){e.call(this)}return n(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(e("../Subscription").Subscription);r.Action=i},{"../Subscription":37}],199:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../util/root"),o=function(e){function t(t,r){e.call(this,t,r),this.scheduler=t,this.work=r,this.pending=!1}return n(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e,this.pending=!0;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,t)),this.delay=t,this.id=this.id||this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),i.root.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){return void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending?t:i.root.clearInterval(t)&&void 0||void 0},t.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))},t.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},t.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},t}(e("./Action").Action);r.AsyncAction=o},{"../util/root":227,"./Action":198}],200:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(){e.apply(this,arguments),this.actions=[],this.active=!1,this.scheduled=void 0}return n(t,e),t.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}}},t}(e("../Scheduler").Scheduler);r.AsyncScheduler=i},{"../Scheduler":33}],201:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r){e.call(this,t,r),this.scheduler=t,this.work=r}return n(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):t.flush(this)},t}(e("./AsyncAction").AsyncAction);r.QueueAction=i},{"./AsyncAction":199}],202:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(){e.apply(this,arguments)}return n(t,e),t}(e("./AsyncScheduler").AsyncScheduler);r.QueueScheduler=i},{"./AsyncScheduler":200}],203:[function(e,t,r){"use strict";var n=e("./AsyncAction"),i=e("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":199,"./AsyncScheduler":200}],204:[function(e,t,r){"use strict";var n=e("./QueueAction"),i=e("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":201,"./QueueScheduler":202}],205:[function(e,t,r){"use strict";function n(e){var t=e.Symbol;if("function"==typeof t)return t.iterator||(t.iterator=t("iterator polyfill")),t.iterator;var r=e.Set;if(r&&"function"==typeof(new r)["@@iterator"])return"@@iterator";var n=e.Map;if(n)for(var i=Object.getOwnPropertyNames(n.prototype),o=0;o=0}},{"../util/isArray":217}],222:[function(e,t,r){"use strict";r.isObject=function(e){return null!=e&&"object"==typeof e}},{}],223:[function(e,t,r){"use strict";r.isPromise=function(e){return e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}},{}],224:[function(e,t,r){"use strict";r.isScheduler=function(e){return e&&"function"==typeof e.schedule}},{}],225:[function(e,t,r){"use strict";r.noop=function(){}},{}],226:[function(e,t,r){"use strict";function n(e){return e?1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}:i.noop}var i=e("./noop");r.pipe=function(){for(var e=[],t=0;t=n||0 0 ) {\n\t\tfloat fogFactor = 0.0;\n\t\tif ( fogType == 1 ) {\n\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t\t} else {\n\t\t\tconst float LOG2 = 1.442695;\n\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );\n\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\t\t}\n\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\t}\n}"].join("\n")),t.compileShader(N),t.compileShader(I),t.attachShader(L,N),t.attachShader(L,I),t.linkProgram(L),T=L,S=t.getAttribLocation(T,"position"),M=t.getAttribLocation(T,"uv"),c=t.getUniformLocation(T,"uvOffset"),u=t.getUniformLocation(T,"uvScale"),h=t.getUniformLocation(T,"rotation"),l=t.getUniformLocation(T,"scale"),p=t.getUniformLocation(T,"color"),f=t.getUniformLocation(T,"map"),d=t.getUniformLocation(T,"opacity"),m=t.getUniformLocation(T,"modelViewMatrix"),v=t.getUniformLocation(T,"projectionMatrix"),g=t.getUniformLocation(T,"fogType"),y=t.getUniformLocation(T,"fogDensity"),b=t.getUniformLocation(T,"fogNear"),_=t.getUniformLocation(T,"fogFar"),x=t.getUniformLocation(T,"fogColor"),t.getUniformLocation(T,"fogDepth"),w=t.getUniformLocation(T,"alphaTest"),(L=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,L.height=8,(N=L.getContext("2d")).fillStyle="white",N.fillRect(0,0,8,8),O=new H(L)}r.useProgram(T),r.initAttributes(),r.enableAttribute(S),r.enableAttribute(M),r.disableUnusedAttributes(),r.disable(t.CULL_FACE),r.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,E),t.vertexAttribPointer(S,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(M,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,C),t.uniformMatrix4fv(v,!1,R.projectionMatrix.elements),r.activeTexture(t.TEXTURE0),t.uniform1i(f,0),N=L=0,(I=o.fog)?(t.uniform3f(x,I.color.r,I.color.g,I.color.b),I.isFog?(t.uniform1f(b,I.near),t.uniform1f(_,I.far),t.uniform1i(g,1),N=L=1):I.isFogExp2&&(t.uniform1f(y,I.density),t.uniform1i(g,2),N=L=2)):(t.uniform1i(g,0),N=L=0);for(var D=0,k=i.length;Dt&&(t=e[r]);return t}function _e(){Object.defineProperty(this,"id",{value:Ei+=2}),this.uuid=ci.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 xe(e,t,r,n,i,o){se.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new we(e,t,r,n,i,o)),this.mergeVertices()}function we(e,t,r,n,i,a){function s(e,t,r,n,i,a,s,m,v,g,y){var b=a/v,_=s/g,x=a/2,w=s/2,S=m/2;s=v+1;var M,E,C=g+1,T=a=0,O=new o;for(E=0;E/gm,function(e,t){if(void 0===(e=_i[t]))throw Error("Can not resolve #include <"+t+">");return Ge(e)})}function Ve(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,r,n){for(e="",t=parseInt(t);tt||e.height>t){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,e),r}return e}function c(e){return ci.isPowerOfTwo(e.width)&&ci.isPowerOfTwo(e.height)}function u(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function h(t){return 1003===t||1004===t||1005===t?e.NEAREST:e.LINEAR}function l(t){(t=t.target).removeEventListener("dispose",l);e:{var r=n.get(t);if(t.image&&r.__image__webglTextureCube)e.deleteTexture(r.__image__webglTextureCube);else{if(void 0===r.__webglInit)break e;e.deleteTexture(r.__webglTexture)}n.remove(t)}a.textures--}function p(t){(t=t.target).removeEventListener("dispose",p);var r=n.get(t),i=n.get(t.texture);if(t){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(i=0;6>i;i++)e.deleteFramebuffer(r.__webglFramebuffer[i]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[i]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer);n.remove(t.texture),n.remove(t)}a.textures--}function f(t,h){var p=n.get(t);if(0v;v++)m[v]=h||f?f?t.image[v].image:t.image[v]:s(t.image[v],i.maxCubemapSize);var g=c(m[0]),y=o.convert(t.format),b=o.convert(t.type);for(d(e.TEXTURE_CUBE_MAP,t,g),v=0;6>v;v++)if(h)for(var _,x=m[v].mipmaps,w=0,S=x.length;wl;l++)i.__webglFramebuffer[l]=e.createFramebuffer()}else i.__webglFramebuffer=e.createFramebuffer();if(s){for(r.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),d(e.TEXTURE_CUBE_MAP,t.texture,h),l=0;6>l;l++)m(i.__webglFramebuffer[l],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+l);u(t.texture,h)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),r.bindTexture(e.TEXTURE_CUBE_MAP,null)}else r.bindTexture(e.TEXTURE_2D,o.__webglTexture),d(e.TEXTURE_2D,t.texture,h),m(i.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),u(t.texture,h)&&e.generateMipmap(e.TEXTURE_2D),r.bindTexture(e.TEXTURE_2D,null);if(t.depthBuffer){if(i=n.get(t),o=!0===t.isWebGLRenderTargetCube,t.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");if(t&&t.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),!t.depthTexture||!t.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(n.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),f(t.depthTexture,0),i=n.get(t.depthTexture).__webglTexture,1026===t.depthTexture.format)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,i,0);else{if(1027!==t.depthTexture.format)throw Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,i,0)}}else if(o)for(i.__webglDepthbuffer=[],o=0;6>o;o++)e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),v(i.__webglDepthbuffer[o],t);else e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),v(i.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(t){var i=t.texture;u(i,c(t))&&(t=t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,i=n.get(i).__webglTexture,r.bindTexture(t,i),e.generateMipmap(t),r.bindTexture(t,null))}}(ce,ue,le,pe,he,Ce,ae),de=new function(e){var t={};return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t[e.uuid]},remove:function(r){r.isInterleavedBufferAttribute&&(r=r.data);var n=t[r.uuid];n&&(e.deleteBuffer(n.buffer),delete t[r.uuid])},update:function(r,n){if(r.isInterleavedBufferAttribute&&(r=r.data),void 0===(i=t[r.uuid])){var i=r.uuid,o=r.array,a=r.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW,s=e.createBuffer();e.bindBuffer(n,s),e.bufferData(n,o,a),r.onUploadCallback(),n=e.FLOAT,o instanceof Float32Array?n=e.FLOAT:o instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):o instanceof Uint16Array?n=e.UNSIGNED_SHORT:o instanceof Int16Array?n=e.SHORT:o instanceof Uint32Array?n=e.UNSIGNED_INT:o instanceof Int32Array?n=e.INT:o instanceof Int8Array?n=e.BYTE:o instanceof Uint8Array&&(n=e.UNSIGNED_BYTE),t[i]={buffer:s,type:n,bytesPerElement:o.BYTES_PER_ELEMENT,version:r.version}}else i.versionu;u++)(l=n[u])&&(s=l[0],l=l[1])?(h&&i.addAttribute("morphTarget"+u,h[s]),o&&i.addAttribute("morphNormal"+u,o[s]),r[u]=l):r[u]=0;a.getUniforms().setValue(e,"morphTargetInfluences",r)}}}(ce),ye=new function(e,t,r){function n(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 i=[],o={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"},a="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering".split(" ");this.getParameters=function(t,i,a,s,c,u,h){var l=o[t.type];if(h.isSkinnedMesh){var p=h.skeleton.bones;if(r.floatVertexTextures)p=1024;else{var f=Math.min(Math.floor((r.maxVertexUniforms-20)/4),p.length);f=he.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+he.maxTextures),G+=1,e},this.setTexture2D=function(){var e=!1;return function(t,r){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),fe.setTexture2D(t,r)}}(),this.setTexture=function(){var e=!1;return function(t,r){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),fe.setTexture2D(t,r)}}(),this.setTextureCube=function(){var e=!1;return function(t,r){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?fe.setTextureCube(t,r):fe.setTextureCubeDynamic(t,r)}}(),this.getRenderTarget=function(){return L},this.setRenderTarget=function(e){(L=e)&&void 0===pe.get(e).__webglFramebuffer&&fe.setupRenderTarget(e);var t=null,r=!1;e?(t=pe.get(e).__webglFramebuffer,e.isWebGLRenderTargetCube&&(t=t[e.activeCubeFace],r=!0),B.copy(e.viewport),U.copy(e.scissor),$=e.scissorTest):(B.copy(Y).multiplyScalar(X),U.copy(K).multiplyScalar(X),$=Z),N!==t&&(ce.bindFramebuffer(ce.FRAMEBUFFER,t),N=t),le.viewport(B),le.scissor(U),le.setScissorTest($),r&&(r=pe.get(e.texture),ce.framebufferTexture2D(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.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 a=pe.get(e).__webglFramebuffer;if(a){var s=!1;a!==N&&(ce.bindFramebuffer(ce.FRAMEBUFFER,a),s=!0);try{var c=e.texture,u=c.format,h=c.type;1023!==u&&Ce.convert(u)!==ce.getParameter(ce.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||Ce.convert(h)===ce.getParameter(ce.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(ue.get("OES_texture_float")||ue.get("WEBGL_color_buffer_float"))||1016===h&&ue.get("EXT_color_buffer_half_float")?ce.checkFramebufferStatus(ce.FRAMEBUFFER)===ce.FRAMEBUFFER_COMPLETE?0<=t&&t<=e.width-n&&0<=r&&r<=e.height-i&&ce.readPixels(t,r,n,i,Ce.convert(u),Ce.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{s&&ce.bindFramebuffer(ce.FRAMEBUFFER,N)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function Qe(e,t){this.name="",this.color=new $(e),this.density=void 0!==t?t:25e-5}function et(e,t,r){this.name="",this.color=new $(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3}function tt(){ne.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function rt(e,t,r,n,i){ne.call(this),this.lensFlares=[],this.positionScreen=new o,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,n,i)}function nt(e){W.call(this),this.type="SpriteMaterial",this.color=new $(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(e)}function it(e){ne.call(this),this.type="Sprite",this.material=void 0!==e?e:new nt}function ot(){ne.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function at(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=e.HAVE_CURRENT_DATA&&(l.needsUpdate=!0),requestAnimationFrame(h)}s.call(this,e,t,r,n,i,o,a,c,u),this.generateMipmaps=!1;var l=this;requestAnimationFrame(h)}function gt(e,t,r,n,i,o,a,c,u,h,l,p){s.call(this,null,o,a,c,u,h,n,i,l,p),this.image={width:t,height:r},this.mipmaps=e,this.generateMipmaps=this.flipY=!1}function yt(e,t,r,n,i,o,a,c,u,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===h&&(r=1012),void 0===r&&1027===h&&(r=1020),s.call(this,null,n,i,o,a,c,h,r,u),this.image={width:e,height:t},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=this.flipY=!1}function bt(e){_e.call(this),this.type="WireframeGeometry";var t,r,n,i=[],a=[0,0],s={},c=["a","b","c"];if(e&&e.isGeometry){var u=e.faces,h=0;for(r=u.length;ht;t++){var p=l[c[t]],f=l[c[(t+1)%3]];a[0]=Math.min(p,f),a[1]=Math.max(p,f),void 0===s[p=a[0]+","+a[1]]&&(s[p]={index1:a[0],index2:a[1]})}}for(p in s)h=s[p],c=e.vertices[h.index1],i.push(c.x,c.y,c.z),c=e.vertices[h.index2],i.push(c.x,c.y,c.z)}else if(e&&e.isBufferGeometry){c=new o;if(null!==e.index){u=e.attributes.position,l=e.index;var d=e.groups;for(0===d.length&&(d=[{start:0,count:l.count,materialIndex:0}]),e=0,n=d.length;et;t++)p=l.getX(h+t),f=l.getX(h+(t+1)%3),a[0]=Math.min(p,f),a[1]=Math.max(p,f),p=a[0]+","+a[1],void 0===s[p]&&(s[p]={index1:a[0],index2:a[1]});for(p in s)h=s[p],c.fromBufferAttribute(u,h.index1),i.push(c.x,c.y,c.z),c.fromBufferAttribute(u,h.index2),i.push(c.x,c.y,c.z)}else for(u=e.attributes.position,h=0,r=u.count/3;ht;t++)s=3*h+t,c.fromBufferAttribute(u,s),i.push(c.x,c.y,c.z),s=3*h+(t+1)%3,c.fromBufferAttribute(u,s),i.push(c.x,c.y,c.z)}this.addAttribute("position",new ve(i,3))}function _t(e,t,r){se.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r},this.fromBufferGeometry(new xt(e,t,r)),this.mergeVertices()}function xt(e,t,r){_e.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:r};var n,i,a=[],s=[],c=[],u=[],h=new o,l=new o,p=new o,f=new o,d=new o,m=t+1;for(n=0;n<=r;n++){var v=n/r;for(i=0;i<=t;i++){var g=i/t,l=e(g,v,l);s.push(l.x,l.y,l.z),0<=g-1e-5?(p=e(g-1e-5,v,p),f.subVectors(l,p)):(p=e(g+1e-5,v,p),f.subVectors(p,l)),0<=v-1e-5?(p=e(g,v-1e-5,p),d.subVectors(l,p)):(p=e(g,v+1e-5,p),d.subVectors(p,l)),h.crossVectors(f,d).normalize(),c.push(h.x,h.y,h.z),u.push(g,v)}}for(n=0;nn&&1===e.x&&(h[t]=e.x-1),0===r.x&&0===r.z&&(h[t]=n/2/Math.PI+.5)}_e.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1;var u=[],h=[];!function(e){for(var r=new o,n=new o,i=new o,c=0;ca&&(.2>t&&(h[e+0]+=1),.2>n&&(h[e+2]+=1),.2>i&&(h[e+4]+=1))}(),this.addAttribute("position",new ve(u,3)),this.addAttribute("normal",new ve(u.slice(),3)),this.addAttribute("uv",new ve(h,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Mt(e,t){se.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Et(e,t)),this.mergeVertices()}function Et(e,t){St.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 Ct(e,t){se.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Tt(e,t)),this.mergeVertices()}function Tt(e,t){St.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 Ot(e,t){se.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Pt(e,t)),this.mergeVertices()}function Pt(e,t){var r=(1+Math.sqrt(5))/2;St.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 jt(e,t){se.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new At(e,t)),this.mergeVertices()}function At(e,t){var r=(1+Math.sqrt(5))/2,n=1/r;St.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 Rt(e,t,r,n,i,o){se.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 Lt(e,t,r,n,i),this.tangents=e.tangents,this.normals=e.normals,this.binormals=e.binormals,this.fromBufferGeometry(e),this.mergeVertices()}function Lt(e,t,n,i,a){function s(r){d=e.getPointAt(r/t,d);var o=c.normals[r];for(r=c.binormals[r],h=0;h<=i;h++){var a=h/i*Math.PI*2,s=Math.sin(a),a=-Math.cos(a);p.x=a*o.x+s*r.x,p.y=a*o.y+s*r.y,p.z=a*o.z+s*r.z,p.normalize(),v.push(p.x,p.y,p.z),l.x=d.x+n*p.x,l.y=d.y+n*p.y,l.z=d.z+n*p.z,m.push(l.x,l.y,l.z)}}_e.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:a},t=t||64,n=n||1,i=i||8,a=a||!1;var c=e.computeFrenetFrames(t,a);this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals;var u,h,l=new o,p=new o,f=new r,d=new o,m=[],v=[],g=[],y=[];for(u=0;uh;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:s,face2:void 0}:i[l].face2=s}for(l in i)(void 0===(n=i[l]).face2||a[n.face1].normal.dot(a[n.face2].normal)<=t)&&(o=e[n.index1],r.push(o.x,o.y,o.z),o=e[n.index2],r.push(o.x,o.y,o.z));this.addAttribute("position",new ve(r,3))}function Zt(e,t,r,n,i,o,a,s){se.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new Jt(e,t,r,n,i,o,a,s)),this.mergeVertices()}function Jt(e,t,n,i,a,s,c,u){function h(n){var a,s=new r,h=new o,g=0,_=!0===n?e:t,x=!0===n?1:-1,w=v;for(a=1;a<=i;a++)f.push(0,y*x,0),d.push(0,x,0),m.push(.5,.5),v++;var S=v;for(a=0;a<=i;a++){var M=a/i*u+c,E=Math.cos(M),M=Math.sin(M);h.x=_*M,h.y=y*x,h.z=_*E,f.push(h.x,h.y,h.z),d.push(0,x,0),s.x=.5*E+.5,s.y=.5*M*x+.5,m.push(s.x,s.y),v++}for(a=0;athis.duration&&this.resetDuration(),this.optimize()}function Gr(e){this.manager=void 0!==e?e:Ai,this.textures={}}function Vr(e){this.manager=void 0!==e?e:Ai}function Hr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function qr(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Ai,this.withCredentials=!1}function Wr(e){this.manager=void 0!==e?e:Ai,this.texturePath=""}function Xr(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 Yr(e,t,r,n){var i=1-e;return i*i*t+2*(1-e)*e*r+e*e*n}function Kr(e,t,r,n,i){var o=1-e,a=1-e;return o*o*o*t+3*a*a*e*r+3*(1-e)*e*e*n+e*e*e*i}function Zr(){this.type="Curve",this.arcLengthDivisions=200}function Jr(e,t){Zr.call(this),this.type="LineCurve",this.v1=e||new r,this.v2=t||new r}function Qr(){Zr.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function en(e,t,r,n,i,o,a,s){Zr.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=r||1,this.yRadius=n||1,this.aStartAngle=i||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function tn(e){Zr.call(this),this.type="SplineCurve",this.points=e||[]}function rn(e,t,n,i){Zr.call(this),this.type="CubicBezierCurve",this.v0=e||new r,this.v1=t||new r,this.v2=n||new r,this.v3=i||new r}function nn(e,t,n){Zr.call(this),this.type="QuadraticBezierCurve",this.v0=e||new r,this.v1=t||new r,this.v2=n||new r}function on(e){Qr.call(this),this.type="Path",this.currentPoint=new r,e&&this.setFromPoints(e)}function an(e){on.call(this,e),this.type="Shape",this.holes=[]}function sn(){this.type="ShapePath",this.subPaths=[],this.currentPath=null}function cn(e){this.type="Font",this.data=e}function un(e){this.manager=void 0!==e?e:Ai}function hn(e){this.manager=void 0!==e?e:Ai}function ln(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new We,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new We,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function pn(e,t,r){ne.call(this),this.type="CubeCamera";var n=new We(90,1,e,t);n.up.set(0,-1,0),n.lookAt(new o(1,0,0)),this.add(n);var i=new We(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new o(-1,0,0)),this.add(i);var a=new We(90,1,e,t);a.up.set(0,0,1),a.lookAt(new o(0,1,0)),this.add(a);var s=new We(90,1,e,t);s.up.set(0,0,-1),s.lookAt(new o(0,-1,0)),this.add(s);var c=new We(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new o(0,0,1)),this.add(c);var u=new We(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new o(0,0,-1)),this.add(u),this.renderTarget=new h(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,o=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,n,r),r.activeCubeFace=1,e.render(t,i,r),r.activeCubeFace=2,e.render(t,a,r),r.activeCubeFace=3,e.render(t,s,r),r.activeCubeFace=4,e.render(t,c,r),r.texture.generateMipmaps=o,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;6>o;o++)i.activeCubeFace=o,e.setRenderTarget(i),e.clear(t,r,n);e.setRenderTarget(null)}}function fn(){ne.call(this),this.type="AudioListener",this.context=zi.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function dn(e){ne.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 mn(e){dn.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function vn(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 gn(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 yn(e,t,r){r=r||bn.parseTrackName(t),this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function bn(e,t,r){this.path=t,this.parsedPath=r||bn.parseTrackName(t),this.node=bn.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function _n(){this.uuid=ci.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 xn(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,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 wn(e){this._root=e,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function Sn(e,t){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=t),this.value=e}function Mn(){_e.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function En(e,t,r,n){this.uuid=ci.generateUUID(),this.data=e,this.itemSize=t,this.offset=r,this.normalized=!0===n}function Cn(e,t){this.uuid=ci.generateUUID(),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.onUploadCallback=function(){},this.version=0}function Tn(e,t,r){Cn.call(this,e,t),this.meshPerAttribute=r||1}function On(e,t,r){ce.call(this,e,t),this.meshPerAttribute=r||1}function Pn(e,t,r,n){this.ray=new Te(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 jn(e,t){return e.distance-t.distance}function An(e,t,r,n){if(!1!==e.visible&&(e.raycast(t,r),!0===n)){n=0;for(var i=(e=e.children).length;nr;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 ve(t,3)),t=new ut({fog:!1}),this.cone=new lt(e,t),this.add(this.cone),this.update()}function Fn(e){var t=[];e&&e.isBone&&t.push(e);for(var r=0;re?-1:0i;i++)8===i||13===i||18===i||23===i?n+="-":14===i?n+="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,n+=t[19===i?3&e|8:e]);return n}}(),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:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?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*ci.DEG2RAD},radToDeg:function(e){return e*ci.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(r.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(r.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:function(){var e=new r,t=new r;return function(r,n){return e.set(r,r),t.set(n,n),this.clamp(e,t)}}(),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=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(e){return this.x*e.x+this.y*e.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)},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 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;return e=this.y-e.y,t*t+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){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(n.prototype,{isMatrix4:!0,set:function(e,t,r,n,i,o,a,s,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]=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 n).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:function(){var e=new o;return function(t){var r=this.elements,n=t.elements,i=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length();return t=1/e.setFromMatrixColumn(t,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]*t,r[9]=n[9]*t,r[10]=n[10]*t,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),a=Math.cos(n),n=Math.sin(n),s=Math.cos(i),i=Math.sin(i);if("XYZ"===e.order){var c=o*s,u=o*i,h=r*s;e=r*i,t[0]=a*s,t[4]=-a*i,t[8]=n,t[1]=u+h*n,t[5]=c-e*n,t[9]=-r*a,t[2]=e-c*n,t[6]=h+u*n,t[10]=o*a}else"YXZ"===e.order?(c=a*s,u=a*i,h=n*s,e=n*i,t[0]=c+e*r,t[4]=h*r-u,t[8]=o*n,t[1]=o*i,t[5]=o*s,t[9]=-r,t[2]=u*r-h,t[6]=e+c*r,t[10]=o*a):"ZXY"===e.order?(c=a*s,u=a*i,h=n*s,e=n*i,t[0]=c-e*r,t[4]=-o*i,t[8]=h+u*r,t[1]=u+h*r,t[5]=o*s,t[9]=e-c*r,t[2]=-o*n,t[6]=r,t[10]=o*a):"ZYX"===e.order?(c=o*s,u=o*i,h=r*s,e=r*i,t[0]=a*s,t[4]=h*n-u,t[8]=c*n+e,t[1]=a*i,t[5]=e*n+c,t[9]=u*n-h,t[2]=-n,t[6]=r*a,t[10]=o*a):"YZX"===e.order?(c=o*a,u=o*n,h=r*a,e=r*n,t[0]=a*s,t[4]=e-c*i,t[8]=h*i+u,t[1]=i,t[5]=o*s,t[9]=-r*s,t[2]=-n*s,t[6]=u*i+h,t[10]=c-e*i):"XZY"===e.order&&(c=o*a,u=o*n,h=r*a,e=r*n,t[0]=a*s,t[4]=-i,t[8]=n*s,t[1]=c*i+e,t[5]=o*s,t[9]=u*i-h,t[2]=h*i-u,t[6]=r*s,t[10]=e*i+c);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,r=e._x,n=e._y,i=e._z,o=e._w,a=i+i;e=r*(u=r+r);var s=r*(h=n+n),r=r*a,c=n*h,n=n*a,i=i*a,u=o*u,h=o*h,o=o*a;return t[0]=1-(c+i),t[4]=s-o,t[8]=r+h,t[1]=s+o,t[5]=1-(e+i),t[9]=n-u,t[2]=r-h,t[6]=n+u,t[10]=1-(e+c),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new o,t=new o,r=new o;return function(n,i,o){var a=this.elements;return r.subVectors(n,i),0===r.lengthSq()&&(r.z=1),r.normalize(),e.crossVectors(o,r),0===e.lengthSq()&&(1===Math.abs(o.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),e.crossVectors(o,r)),e.normalize(),t.crossVectors(r,e),a[0]=e.x,a[4]=t.x,a[8]=r.x,a[1]=e.y,a[5]=t.y,a[9]=r.y,a[2]=e.z,a[6]=t.z,a[10]=r.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],a=r[12],s=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],y=n[0],b=n[4],_=n[8],x=n[12],w=n[1],S=n[5],M=n[9],E=n[13],C=n[2],T=n[6],O=n[10],P=n[14],j=n[3],A=n[7],R=n[11],n=n[15];return t[0]=e*y+i*w+o*C+a*j,t[4]=e*b+i*S+o*T+a*A,t[8]=e*_+i*M+o*O+a*R,t[12]=e*x+i*E+o*P+a*n,t[1]=s*y+c*w+u*C+h*j,t[5]=s*b+c*S+u*T+h*A,t[9]=s*_+c*M+u*O+h*R,t[13]=s*x+c*E+u*P+h*n,t[2]=l*y+p*w+f*C+d*j,t[6]=l*b+p*S+f*T+d*A,t[10]=l*_+p*M+f*O+d*R,t[14]=l*x+p*E+f*P+d*n,t[3]=m*y+v*w+g*C+r*j,t[7]=m*b+v*S+g*T+r*A,t[11]=m*_+v*M+g*O+r*R,t[15]=m*x+v*E+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:function(){var e=new o;return function(t){for(var r=0,n=t.count;rthis.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],t.copy(this),r=1/a;var o=1/s,u=1/c;return t.elements[0]*=r,t.elements[1]*=r,t.elements[2]*=r,t.elements[4]*=o,t.elements[5]*=o,t.elements[6]*=o,t.elements[8]*=u,t.elements[9]*=u,t.elements[10]*=u,n.setFromRotationMatrix(t),i.x=a,i.y=s,i.z=c,this}}(),makePerspective:function(e,t,r,n,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements;return a[0]=2*i/(t-e),a[4]=0,a[8]=(t+e)/(t-e),a[12]=0,a[1]=0,a[5]=2*i/(r-n),a[9]=(r+n)/(r-n),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+i)/(o-i),a[14]=-2*o*i/(o-i),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,r,n,i,o){var a=this.elements,s=1/(t-e),c=1/(r-n),u=1/(o-i);return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-(t+e)*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(e){var t=this.elements;e=e.elements;for(var r=0;16>r;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;16>r;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;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(i,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,r,n,i,o,a){var s=r[n+0],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),s=s*o+n*(f*=a),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)}e[t]=s,e[t+1]=c,e[t+2]=u,e[t+3]=r}}),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()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(i.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,a=Math.sin,s=o(r/2),c=o(n/2),o=o(i/2),r=a(r/2),n=a(n/2),i=a(i/2);return"XYZ"===e?(this._x=r*c*o+s*n*i,this._y=s*n*o-r*c*i,this._z=s*c*i+r*n*o,this._w=s*c*o-r*n*i):"YXZ"===e?(this._x=r*c*o+s*n*i,this._y=s*n*o-r*c*i,this._z=s*c*i-r*n*o,this._w=s*c*o+r*n*i):"ZXY"===e?(this._x=r*c*o-s*n*i,this._y=s*n*o+r*c*i,this._z=s*c*i+r*n*o,this._w=s*c*o-r*n*i):"ZYX"===e?(this._x=r*c*o-s*n*i,this._y=s*n*o+r*c*i,this._z=s*c*i-r*n*o,this._w=s*c*o+r*n*i):"YZX"===e?(this._x=r*c*o+s*n*i,this._y=s*n*o+r*c*i,this._z=s*c*i-r*n*o,this._w=s*c*o-r*n*i):"XZY"===e&&(this._x=r*c*o-s*n*i,this._y=s*n*o-r*c*i,this._z=s*c*i+r*n*o,this._w=s*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],a=t[9],s=t[2],c=t[6],u=r+o+(t=t[10]);return 0o&&r>t?(r=2*Math.sqrt(1+r-o-t),this._w=(c-a)/r,this._x=.25*r,this._y=(e+i)/r,this._z=(n+s)/r):o>t?(r=2*Math.sqrt(1+o-r-t),this._w=(n-s)/r,this._x=(e+i)/r,this._y=.25*r,this._z=(a+c)/r):(r=2*Math.sqrt(1+t-r-o),this._w=(i-e)/r,this._x=(n+s)/r,this._y=(a+c)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new o;return function(r,n){return void 0===t&&(t=new o),1e-6>(e=r.dot(n)+1)?(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(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,a=t._y,s=t._z;return t=t._w,this._x=r*t+e*o+n*s-i*a,this._y=n*t+e*a+i*o-r*s,this._z=i*t+e*s+r*a-n*o,this._w=e*t-r*o-n*a-i*s,this.onChangeCallback(),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;if(0>(s=o*e._w+r*e._x+n*e._y+i*e._z)?(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=Math.sqrt(1-s*s),.001>Math.abs(e))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 a=Math.atan2(e,s),s=Math.sin((1-t)*a)/e;return 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(o.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:function(){var e=new i;return function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e=new i;return function(t,r){return this.applyQuaternion(e.setFromAxisAngle(t,r))}}(),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,a=e.z,s=(e=e.w)*t+o*n-a*r,c=e*r+a*t-i*n,u=e*n+i*r-o*t,t=-i*t-o*r-a*n;return this.x=s*e+t*-i+c*-a-u*-o,this.y=c*e+t*-o+u*-i-s*-a,this.z=u*e+t*-a+s*-o-c*-i,this},project:function(){var e=new n;return function(t){return e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e=new n;return function(t){return e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),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:function(){var e=new o,t=new o;return function(r,n){return e.set(r,r,r),t.set(n,n,n),this.clamp(e,t)}}(),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=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(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:function(){var e=new o;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new o;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){return e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq()),Math.acos(ci.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 e=this.z-e.z,t*t+r*r+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){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(a.prototype,{isMatrix3:!0,set:function(e,t,r,n,i,o,a,s,c){var u=this.elements;return u[0]=e,u[1]=n,u[2]=a,u[3]=t,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(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:function(){var e=new o;return function(t){for(var r=0,n=t.count;rr;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;9>r;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;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 ui=0;s.DEFAULT_IMAGE=void 0,s.DEFAULT_MAPPING=300,Object.defineProperty(s.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(s.prototype,t.prototype,{constructor:s,isTexture:!0,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],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=ci.generateUUID()),!t&&void 0===e.images[n.uuid]){var i=e.images,o=n.uuid,a=n.uuid;if(n instanceof HTMLCanvasElement)var s=n;else{(s=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=n.width,s.height=n.height;var c=s.getContext("2d");n instanceof ImageData?c.putImageData(n,0,0):c.drawImage(n,0,0,n.width,n.height)}s=2048e.x||1e.x?0:1;break;case 1002:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(0>e.y||1e.y?0:1;break;case 1002:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}}),Object.assign(c.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 1e-4>t?(this.x=1,this.z=this.y=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t=(e=e.elements)[0],r=e[4],n=e[8],i=e[1],o=e[5],a=e[9],s=e[2],c=e[6],u=e[10];return.01>Math.abs(r-i)&&.01>Math.abs(n-s)&&.01>Math.abs(a-c)?.1>Math.abs(r+i)&&.1>Math.abs(n+s)&&.1>Math.abs(a+c)&&.1>Math.abs(t+o+u-3)?(this.set(1,0,0,0),this):(e=Math.PI,t=(t+1)/2,o=(o+1)/2,u=(u+1)/2,r=(r+i)/4,n=(n+s)/4,a=(a+c)/4,t>o&&t>u?.01>t?(c=0,r=s=.707106781):(c=Math.sqrt(t),s=r/c,r=n/c):o>u?.01>o?(c=.707106781,s=0,r=.707106781):(s=Math.sqrt(o),c=r/s,r=a/s):.01>u?(s=c=.707106781,r=0):(r=Math.sqrt(u),c=n/r,s=a/r),this.set(c,s,r,e),this):(e=Math.sqrt((c-a)*(c-a)+(n-s)*(n-s)+(i-r)*(i-r)),.001>Math.abs(e)&&(e=1),this.x=(c-a)/e,this.y=(n-s)/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(){var e,t;return function(r,n){return void 0===e&&(e=new c,t=new c),e.set(r,r,r,r),t.set(n,n,n,n),this.clamp(e,t)}}(),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=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(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}}),Object.assign(u.prototype,t.prototype,{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"})}}),(h.prototype=Object.create(u.prototype)).constructor=h,h.prototype.isWebGLRenderTargetCube=!0,(l.prototype=Object.create(s.prototype)).constructor=l,l.prototype.isDataTexture=!0,(p.prototype=Object.create(s.prototype)).constructor=p,p.prototype.isCubeTexture=!0,Object.defineProperty(p.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var hi=new s,li=new p,pi=[],fi=[],di=new Float32Array(16),mi=new Float32Array(9);U.prototype.setValue=function(e,t){for(var r=this.seq,n=0,i=r.length;n!==i;++n){var o=r[n];o.setValue(e,t[o.id])}};var vi=/([\w\d_]+)(\])?(\[|\.)?/g;z.prototype.setValue=function(e,t,r){void 0!==(t=this.map[t])&&t.setValue(e,r,this.renderer)},z.prototype.setOptional=function(e,t,r){void 0!==(t=t[r])&&this.setValue(e,r,t)},z.upload=function(e,t,r,n){for(var i=0,o=t.length;i!==o;++i){var a=t[i],s=r[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}},z.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 gi={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($.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 e(e,t,r){return 0>r&&(r+=1),1r?t:r<2/3?e+6*(t-e)*(2/3-r):e}return function(t,r,n){return t=ci.euclideanModulo(t,1),r=ci.clamp(r,0,1),n=ci.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=e(n,r,t+1/3),this.g=e(n,r,t),this.b=e(n,r,t-1/3)),this}}(),setStyle:function(e){function t(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){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,t(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,t(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 t(r[5]),this.setHSL(n,i,o)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){if(r=r[1],3===(n=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===n)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return e&&0=a?s/(o+c):s/(2-o-c);switch(o){case r:t=(n-i)/s+(n 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * 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\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 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(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\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\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 ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = 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",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], 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\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\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:"#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#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 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\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 ], 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 \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \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 \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \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 \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},xi={basic:{uniforms:bi.merge([yi.common,yi.specularmap,yi.envmap,yi.aomap,yi.lightmap,yi.fog]),vertexShader:_i.meshbasic_vert,fragmentShader:_i.meshbasic_frag},lambert:{uniforms:bi.merge([yi.common,yi.specularmap,yi.envmap,yi.aomap,yi.lightmap,yi.emissivemap,yi.fog,yi.lights,{emissive:{value:new $(0)}}]),vertexShader:_i.meshlambert_vert,fragmentShader:_i.meshlambert_frag},phong:{uniforms:bi.merge([yi.common,yi.specularmap,yi.envmap,yi.aomap,yi.lightmap,yi.emissivemap,yi.bumpmap,yi.normalmap,yi.displacementmap,yi.gradientmap,yi.fog,yi.lights,{emissive:{value:new $(0)},specular:{value:new $(1118481)},shininess:{value:30}}]),vertexShader:_i.meshphong_vert,fragmentShader:_i.meshphong_frag},standard:{uniforms:bi.merge([yi.common,yi.envmap,yi.aomap,yi.lightmap,yi.emissivemap,yi.bumpmap,yi.normalmap,yi.displacementmap,yi.roughnessmap,yi.metalnessmap,yi.fog,yi.lights,{emissive:{value:new $(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:_i.meshphysical_vert,fragmentShader:_i.meshphysical_frag},points:{uniforms:bi.merge([yi.points,yi.fog]),vertexShader:_i.points_vert,fragmentShader:_i.points_frag},dashed:{uniforms:bi.merge([yi.common,yi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_i.linedashed_vert,fragmentShader:_i.linedashed_frag},depth:{uniforms:bi.merge([yi.common,yi.displacementmap]),vertexShader:_i.depth_vert,fragmentShader:_i.depth_frag},normal:{uniforms:bi.merge([yi.common,yi.bumpmap,yi.normalmap,yi.displacementmap,{opacity:{value:1}}]),vertexShader:_i.normal_vert,fragmentShader:_i.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_i.cube_vert,fragmentShader:_i.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_i.equirect_vert,fragmentShader:_i.equirect_frag},distanceRGBA:{uniforms:bi.merge([yi.common,yi.displacementmap,{referencePosition:{value:new o},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_i.distanceRGBA_vert,fragmentShader:_i.distanceRGBA_frag},shadow:{uniforms:bi.merge([yi.lights,yi.fog,{color:{value:new $(0)},opacity:{value:1}}]),vertexShader:_i.shadow_vert,fragmentShader:_i.shadow_frag}};xi.physical={uniforms:bi.merge([xi.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:_i.meshphysical_vert,fragmentShader:_i.meshphysical_frag},Object.assign(G.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;tthis.max.x||e.ythis.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(t||new r).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.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new r).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new r;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).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)}}),(H.prototype=Object.create(s.prototype)).constructor=H;var wi=0;Object.assign(W.prototype,t.prototype,{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.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.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),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.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),0i&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(t,r,n),this.max.set(i,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=e.count;si&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(t,r,n),this.max.set(i,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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(t||new o).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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e=new o;return function(t){return this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){if(0=e.constant},clampPoint:function(e,t){return(t||new o).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new o;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new o;return function(t){return t=t||new Z,this.getCenter(t.center),t.radius=.5*this.getSize(e).length(),t}}(),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(){var e=[new o,new o,new o,new o,new o,new o,new o,new o];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),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(Z.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new K;return function(t,r){var n=this.center;void 0!==r?n.copy(r):e.setFromPoints(t).getCenter(n);for(var i=r=0,o=t.length;i=this.radius},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(t=t||new o).copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return(e=e||new K).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(J.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:function(){var e=new o,t=new o;return function(r,n,i){return n=e.subVectors(i,n).cross(t.subVectors(r,n)).normalize(),this.setFromNormalAndCoplanarPoint(n,r),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(t||new o).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new o;return function(t,r){r=r||new o;var n=t.delta(e),i=this.normal.dot(n);if(0===i){if(0===this.distanceToPoint(t.start))return r.copy(t.start)}else if(!(0>(i=-(t.start.dot(this.normal)+this.constant)/i)||1t&&0e&&0r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes;e=(v=e.elements)[0];var r=v[1],n=v[2],i=v[3],o=v[4],a=v[5],s=v[6],c=v[7],u=v[8],h=v[9],l=v[10],p=v[11],f=v[12],d=v[13],m=v[14],v=v[15];return t[0].setComponents(i-e,c-o,p-u,v-f).normalize(),t[1].setComponents(i+e,c+o,p+u,v+f).normalize(),t[2].setComponents(i+r,c+a,p+h,v+d).normalize(),t[3].setComponents(i-r,c-a,p-h,v-d).normalize(),t[4].setComponents(i-n,c-s,p-l,v-m).normalize(),t[5].setComponents(i+n,c+s,p+l,v+m).normalize(),this},intersectsObject:function(){var e=new Z;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new Z;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){var t=this.planes,r=e.center;e=-e.radius;for(var n=0;6>n;n++)if(t[n].distanceToPoint(r)i;i++){a=n[i];e.x=0o&&0>a)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}}),te.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),te.DefaultOrder="XYZ",Object.defineProperties(te.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(te.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=ci.clamp;e=(l=e.elements)[0];var i=l[4],o=l[8],a=l[1],s=l[5],c=l[9],u=l[2],h=l[6],l=l[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(n(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-c,l),this._z=Math.atan2(-i,e)):(this._x=Math.atan2(h,s),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(c,-1,1)),.99999>Math.abs(c)?(this._y=Math.atan2(o,l),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-u,e),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(-u,l),this._z=Math.atan2(-i,s)):(this._y=0,this._z=Math.atan2(a,e))):"ZYX"===t?(this._y=Math.asin(-n(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(h,l),this._z=Math.atan2(a,e)):(this._x=0,this._z=Math.atan2(-i,s))):"YZX"===t?(this._z=Math.asin(n(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-c,s),this._y=Math.atan2(-u,e)):(this._x=0,this._y=Math.atan2(o,l))):"XZY"===t?(this._z=Math.asin(-n(i,-1,1)),.99999>Math.abs(i)?(this._x=Math.atan2(h,s),this._y=Math.atan2(o,e)):(this._x=Math.atan2(-c,l),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var e=new n;return function(t,r,n){return e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,n)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new i;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),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 o(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(re.prototype,{set:function(e){this.mask=1<a;a++)if(i[a]===i[(a+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=t.dot(this.direction))?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new o;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new o,t=new o,r=new o;return function(n,i,o,a){e.copy(n).add(i).multiplyScalar(.5),t.copy(i).sub(n).normalize(),r.copy(this.origin).sub(e);var s=.5*n.distanceTo(i),c=-this.direction.dot(t),u=r.dot(this.direction),h=-r.dot(t),l=r.lengthSq(),p=Math.abs(1-c*c);if(0=-f?i<=f?(s=1/p,n*=s,i*=s,c=n*(n+c*i+2*u)+i*(c*n+i+2*h)+l):(i=s,n=Math.max(0,-(c*i+u)),c=-n*n+i*(i+2*h)+l):(i=-s,n=Math.max(0,-(c*i+u)),c=-n*n+i*(i+2*h)+l):i<=-f?(n=Math.max(0,-(-c*s+u)),i=0t?null:(t=Math.sqrt(t-i),i=n-t,n+=t,0>i&&0>n?null:0>i?this.at(n,r):this.at(i,r))}}(),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||0>e.normal.dot(this.direction)*t},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 a=(e.min.x-o.x)*r;r*=e.max.x-o.x}else a=(e.max.x-o.x)*r,r*=e.min.x-o.x;if(0<=n){var s=(e.min.y-o.y)*n;n*=e.max.y-o.y}else s=(e.max.y-o.y)*n,n*=e.min.y-o.y;return a>n||s>r?null:((s>a||a!=a)&&(a=s),(ne||s>r?null:((s>a||a!=a)&&(a=s),(er?null:this.at(0<=a?a:r,t)))},intersectsBox:function(){var e=new o;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new o,t=new o,r=new o,n=new o;return function(i,o,a,s,c){if(t.subVectors(o,i),r.subVectors(a,i),n.crossVectors(t,r),0<(o=this.direction.dot(n))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return e.subVectors(this.origin,i),0>(i=s*this.direction.dot(r.crossVectors(e,r)))?null:0>(a=s*this.direction.dot(t.cross(e)))||i+a>o?null:0>(i=-s*e.dot(n))?null:this.at(i/o,c)}}(),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(Oe.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(e||new o).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new o).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 t=t||new o,this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new o,t=new o;return function(r,n){return e.subVectors(r,this.start),t.subVectors(this.end,this.start),r=t.dot(t),r=t.dot(e)/r,n&&(r=ci.clamp(r,0,1)),r}}(),closestPointToPoint:function(e,t,r){return e=this.closestPointToPointParameter(e,t),r=r||new o,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)}}),Object.assign(Pe,{normal:function(){var e=new o;return function(t,r,n,i){return(i=i||new o).subVectors(n,r),e.subVectors(t,r),i.cross(e),0<(t=i.lengthSq())?i.multiplyScalar(1/Math.sqrt(t)):i.set(0,0,0)}}(),barycoordFromPoint:function(){var e=new o,t=new o,r=new o;return function(n,i,a,s,c){e.subVectors(s,i),t.subVectors(a,i),r.subVectors(n,i),n=e.dot(e),i=e.dot(t),a=e.dot(r);var u=t.dot(t);s=t.dot(r);var h=n*u-i*i;return c=c||new o,0===h?c.set(-2,-1,-1):(h=1/h,u=(u*a-i*s)*h,n=(n*s-i*a)*h,c.set(1-u-n,n,u))}}(),containsPoint:function(){var e=new o;return function(t,r,n,i){return 0<=(t=Pe.barycoordFromPoint(t,r,n,i,e)).x&&0<=t.y&&1>=t.x+t.y}}()}),Object.assign(Pe.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},area:function(){var e=new o,t=new o;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new o).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return Pe.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new J).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return Pe.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Pe.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e=new J,t=[new Oe,new Oe,new Oe],r=new o,n=new o;return function(i,a){a=a||new o;var s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(i,r),!0===this.containsPoint(r))a.copy(r);else for(t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a),i=0;ir.far?null:{distance:t,point:_.clone(),object:e})}function i(r,n,i,o,a,s,c,p){return u.fromBufferAttribute(o,s),h.fromBufferAttribute(o,c),l.fromBufferAttribute(o,p),(r=t(r,r.material,n,i,u,h,l,b))&&(a&&(m.fromBufferAttribute(a,s),v.fromBufferAttribute(a,c),g.fromBufferAttribute(a,p),r.uv=e(b,u,h,l,m,v,g)),r.face=new ae(s,c,p,Pe.normal(u,h,l)),r.faceIndex=s),r}var a=new n,s=new Te,c=new Z,u=new o,h=new o,l=new o,p=new o,f=new o,d=new o,m=new r,v=new r,g=new r,y=new o,b=new o,_=new o;return function(r,n){var o=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===o.boundingSphere&&o.computeBoundingSphere(),c.copy(o.boundingSphere),c.applyMatrix4(_),!1!==r.ray.intersectsSphere(c)&&(a.getInverse(_),s.copy(r.ray).applyMatrix4(a),null===o.boundingBox||!1!==s.intersectsBox(o.boundingBox)))){var x;if(o.isBufferGeometry){var w,y=o.index,S=o.attributes.position,_=o.attributes.uv;if(null!==y){var M=0;for(w=y.count;Mo||(o=n.ray.origin.distanceTo(e))n.far||i.push({distance:o,point:e.clone(),face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ot.prototype=Object.assign(Object.create(ne.prototype),{constructor:ot,copy:function(e){ne.prototype.copy.call(this,e,!1);for(var t=0,r=(e=e.levels).length;t=n[i].distance;i++)n[i-1].object.visible=!1,n[i].object.visible=!0;for(;ia||(l.applyMatrix4(this.matrixWorld),(f=n.ray.origin.distanceTo(l))n.far||i.push({distance:f,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}));else for(s=0,v=d.length/3-1;sa||(l.applyMatrix4(this.matrixWorld),(f=n.ray.origin.distanceTo(l))n.far||i.push({distance:f,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else if(s.isGeometry)for(u=s.vertices,h=u.length,s=0;sa||(l.applyMatrix4(this.matrixWorld),(f=n.ray.origin.distanceTo(l))n.far||i.push({distance:f,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),lt.prototype=Object.assign(Object.create(ht.prototype),{constructor:lt,isLineSegments:!0}),pt.prototype=Object.assign(Object.create(ht.prototype),{constructor:pt,isLineLoop:!0}),(ft.prototype=Object.create(W.prototype)).constructor=ft,ft.prototype.isPointsMaterial=!0,ft.prototype.copy=function(e){return W.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},dt.prototype=Object.assign(Object.create(ne.prototype),{constructor:dt,isPoints:!0,raycast:function(){var e=new n,t=new Te,r=new Z;return function(n,i){function a(e,r){var o=t.distanceSqToPoint(e);if(on.far||i.push({distance:a,distanceToRay:Math.sqrt(o),point:e.clone(),index:r,face:null,object:s})}}var s=this,c=this.geometry,u=this.matrixWorld,h=n.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(u),r.radius+=h,!1!==n.ray.intersectsSphere(r)){e.getInverse(u),t.copy(n.ray).applyMatrix4(e);var l=(h=h/((this.scale.x+this.scale.y+this.scale.z)/3))*h,h=new o;if(c.isBufferGeometry){var p=c.index,c=c.attributes.position.array;if(null!==p)for(var f=p.array,p=0,d=f.length;pr)return null;var n,i=[],o=[],a=[];if(0=s--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}var c=n;r<=c&&(c=0),r<=(n=c+1)&&(n=0);var u=n+1;r<=u&&(u=0);e:{var h,l=e[o[c]].x,p=e[o[c]].y,f=e[o[n]].x,d=e[o[n]].y,m=e[o[u]].x,v=e[o[u]].y;if(0>=(f-l)*(v-p)-(d-p)*(m-l))var g=!1;else{var y=m-f,b=v-d,_=l-m,x=p-v,w=f-l;for(g=d-p,h=0;h=-Number.EPSILON&&S>=-Number.EPSILON&&C>=-Number.EPSILON){g=!1;break e}}}g=!0}}if(g){for(i.push([e[o[c]],e[o[n]],e[o[u]]]),a.push([o[c],o[n],o[u]]),c=n,u=n+1;uNumber.EPSILON){if(0f||f>p)return[];if(0>(c=u*h-c*l)||c>p)return[]}else{if(0r?[]:c===r?o?[]:[a]:e<=r?[a,s]:[a,u]))}function o(e,t,r,n){var i=t.x-e.x,o=t.y-e.y;t=r.x-e.x,r=r.y-e.y;var a=n.x-e.x;return n=n.y-e.y,e=i*r-o*t,i=i*n-o*a,Math.abs(e)>Number.EPSILON?(t=a*r-n*t,0n&&(n=r);var i=e+1;return i>r&&(i=0),!!(r=o(u[e],u[n],u[i],y[t]))&&(r=y.length-1,0>(n=t-1)&&(n=r),(i=t+1)>r&&(i=0),!!(r=o(y[t],y[n],y[i],u[e])))}function n(e,t){var r;for(r=0;r--d){console.log('THREE.ShapeUtils: Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!');break}for(c=f;ce;e++)h=t[e].x+":"+t[e].y,void 0!==(h=s[h])&&(t[e]=h);return c.concat()},isClockWise:function(e){return 0>Ti.area(e)}};(Ft.prototype=Object.create(se.prototype)).constructor=Ft,(Bt.prototype=Object.create(_e.prototype)).constructor=Bt,Bt.prototype.getArrays=function(){var e=(e=this.getAttribute("position"))?Array.prototype.slice.call(e.array):[],t=(t=this.getAttribute("uv"))?Array.prototype.slice.call(t.array):[],r=this.index;return{position:e,uv:t,index:r=r?Array.prototype.slice.call(r.array):[]}},Bt.prototype.addShapeList=function(e,t){var r=e.length;t.arrays=this.getArrays();for(var n=0;nNumber.EPSILON){var u=Math.sqrt(c),h=Math.sqrt(a*a+s*s),c=t.x-o/u;if(t=t.y+i/u,s=((n.x-s/h-c)*s-(n.y+a/h-t)*a)/(i*s-o*a),a=c+i*s-e.x,i=t+o*s-e.y,2>=(o=a*a+i*i))return new r(a,i);o=Math.sqrt(o/2)}else e=!1,i>Number.EPSILON?a>Number.EPSILON&&(e=!0):i<-Number.EPSILON?a<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(s)&&(e=!0),e?(a=-o,o=Math.sqrt(c)):(a=i,i=o,o=Math.sqrt(c/2));return new r(a/o,i/o)}function a(e,t){for(z=e.length;0<=--z;){var r=z,n=z-1;0>n&&(n=e.length-1);var i,o=x+2*y;for(i=0;iMath.abs(s-u)?[new r(e,1-n),new r(c,1-i),new r(h,1-o),new r(p,1-t)]:[new r(s,1-n),new r(u,1-i),new r(l,1-o),new r(f,1-t)]}},(Ut.prototype=Object.create(se.prototype)).constructor=Ut,(zt.prototype=Object.create(Bt.prototype)).constructor=zt,($t.prototype=Object.create(se.prototype)).constructor=$t,(Gt.prototype=Object.create(_e.prototype)).constructor=Gt,(Vt.prototype=Object.create(se.prototype)).constructor=Vt,(Ht.prototype=Object.create(_e.prototype)).constructor=Ht,(qt.prototype=Object.create(se.prototype)).constructor=qt,(Wt.prototype=Object.create(_e.prototype)).constructor=Wt,(Xt.prototype=Object.create(se.prototype)).constructor=Xt,(Yt.prototype=Object.create(_e.prototype)).constructor=Yt,(Kt.prototype=Object.create(_e.prototype)).constructor=Kt,(Zt.prototype=Object.create(se.prototype)).constructor=Zt,(Jt.prototype=Object.create(_e.prototype)).constructor=Jt,(Qt.prototype=Object.create(Zt.prototype)).constructor=Qt,(er.prototype=Object.create(Jt.prototype)).constructor=er,(tr.prototype=Object.create(se.prototype)).constructor=tr,(rr.prototype=Object.create(_e.prototype)).constructor=rr;var Oi=Object.freeze({WireframeGeometry:bt,ParametricGeometry:_t,ParametricBufferGeometry:xt,TetrahedronGeometry:Mt,TetrahedronBufferGeometry:Et,OctahedronGeometry:Ct,OctahedronBufferGeometry:Tt,IcosahedronGeometry:Ot,IcosahedronBufferGeometry:Pt,DodecahedronGeometry:jt,DodecahedronBufferGeometry:At,PolyhedronGeometry:wt,PolyhedronBufferGeometry:St,TubeGeometry:Rt,TubeBufferGeometry:Lt,TorusKnotGeometry:Nt,TorusKnotBufferGeometry:It,TorusGeometry:Dt,TorusBufferGeometry:kt,TextGeometry:Ut,TextBufferGeometry:zt,SphereGeometry:$t,SphereBufferGeometry:Gt,RingGeometry:Vt,RingBufferGeometry:Ht,PlaneGeometry:Se,PlaneBufferGeometry:Me,LatheGeometry:qt,LatheBufferGeometry:Wt,ShapeGeometry:Xt,ShapeBufferGeometry:Yt,ExtrudeGeometry:Ft,ExtrudeBufferGeometry:Bt,EdgesGeometry:Kt,ConeGeometry:Qt,ConeBufferGeometry:er,CylinderGeometry:Zt,CylinderBufferGeometry:Jt,CircleGeometry:tr,CircleBufferGeometry:rr,BoxGeometry:xe,BoxBufferGeometry:we});(nr.prototype=Object.create(W.prototype)).constructor=nr,nr.prototype.isShadowMaterial=!0,(ir.prototype=Object.create(Ce.prototype)).constructor=ir,ir.prototype.isRawShaderMaterial=!0,(or.prototype=Object.create(W.prototype)).constructor=or,or.prototype.isMeshStandardMaterial=!0,or.prototype.copy=function(e){return W.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.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},(ar.prototype=Object.create(or.prototype)).constructor=ar,ar.prototype.isMeshPhysicalMaterial=!0,ar.prototype.copy=function(e){return or.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},(sr.prototype=Object.create(W.prototype)).constructor=sr,sr.prototype.isMeshPhongMaterial=!0,sr.prototype.copy=function(e){return W.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.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},(cr.prototype=Object.create(sr.prototype)).constructor=cr,cr.prototype.isMeshToonMaterial=!0,cr.prototype.copy=function(e){return sr.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},(ur.prototype=Object.create(W.prototype)).constructor=ur,ur.prototype.isMeshNormalMaterial=!0,ur.prototype.copy=function(e){return W.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,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},(hr.prototype=Object.create(W.prototype)).constructor=hr,hr.prototype.isMeshLambertMaterial=!0,hr.prototype.copy=function(e){return W.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},(lr.prototype=Object.create(ut.prototype)).constructor=lr,lr.prototype.isLineDashedMaterial=!0,lr.prototype.copy=function(e){return ut.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Pi=Object.freeze({ShadowMaterial:nr,SpriteMaterial:nt,RawShaderMaterial:ir,ShaderMaterial:Ce,PointsMaterial:ft,MeshPhysicalMaterial:ar,MeshStandardMaterial:or,MeshPhongMaterial:sr,MeshToonMaterial:cr,MeshNormalMaterial:ur,MeshLambertMaterial:hr,MeshDepthMaterial:X,MeshDistanceMaterial:Y,MeshBasicMaterial:Ee,LineDashedMaterial:lr,LineBasicMaterial:ut,Material:W}),ji={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={}}},Ai=new pr,Ri={};Object.assign(fr.prototype,{load:function(e,t,r,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,o=ji.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout(function(){t&&t(o),i.manager.itemEnd(e)},0),o;if(void 0===Ri[e]){if(s=e.match(/^data:(.*?)(;base64)?,(.*)$/)){r=s[1];var a=!!s[2],s=s[3],s=window.decodeURIComponent(s);a&&(s=window.atob(s));try{var c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":for(var u=new Uint8Array(s.length),a=0;a=i)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>=i)break t}n=r,r=0}for(;r>>1,et;)--o;return++o,0===i&&o===n||(i>=o&&(o=Math.max(o,1),i=o-1),e=this.getValueSize(),this.times=Li.arraySlice(r,i,o),this.values=Li.arraySlice(this.values,i*e,o*e)),this},validate:function(){var e=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),e=!1);var t=this.times,r=this.values,n=t.length;0===n&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),e=!1);for(var i=null,o=0;o!==n;o++){var a=t[o];if("number"==typeof a&&isNaN(a)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,o,a),e=!1;break}if(null!==i&&i>a){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,o,a,i),e=!1;break}i=a}if(void 0!==r&&Li.isTypedArray(r))for(o=0,t=r.length;o!==t;++o)if(n=r[o],isNaN(n)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,o,n),e=!1;break}return e},optimize:function(){for(var e,t,r=this.times,n=this.values,i=this.getValueSize(),o=2302===this.getInterpolation(),a=1,s=r.length-1,c=1;ch.opacity&&(h.transparent=!0),n.setTextures(u),n.parse(h)}}()}),Object.assign(qr.prototype,{load:function(e,t,r,n){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Hr.prototype.extractUrlBase(e),a=new fr(this.manager);a.setWithCredentials(this.withCredentials),a.load(e,function(r){var n=(r=JSON.parse(r)).metadata;if(void 0!==n&&void 0!==(n=n.type)){if("object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}r=i.parse(r,o),t(r.geometry,r.materials)},r,n)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==e.data&&(e=e.data),e.scale=void 0!==e.scale?1/e.scale:1;var n,i,a,s=new se,u=e,h=u.faces,l=u.vertices,p=u.normals,f=u.colors,d=u.scale,m=0;if(void 0!==u.uvs){for(n=0;ni;i++){var S=h[v++],M=w[2*S];M=new r(M,S=w[2*S+1]),2!==i&&s.faceVertexUvs[n][y].push(M),0!==i&&s.faceVertexUvs[n][y+1].push(M)}}if(b&&(b=3*h[v++],g.normal.set(p[b++],p[b++],p[b]),x.normal.copy(g.normal)),_)for(n=0;4>n;n++)b=3*h[v++],_=new o(p[b++],p[b++],p[b]),2!==n&&g.vertexNormals.push(_),0!==n&&x.vertexNormals.push(_);if(d&&(d=h[v++],d=f[d],g.color.setHex(d),x.color.setHex(d)),l)for(n=0;4>n;n++)d=h[v++],d=f[d],2!==n&&g.vertexColors.push(new $(d)),0!==n&&x.vertexColors.push(new $(d));s.faces.push(g),s.faces.push(x)}else{if(g=new ae,g.a=h[v++],g.b=h[v++],g.c=h[v++],y&&(y=h[v++],g.materialIndex=y),y=s.faces.length,n)for(n=0;ni;i++)S=h[v++],M=w[2*S],S=w[2*S+1],M=new r(M,S),s.faceVertexUvs[n][y].push(M);if(b&&(b=3*h[v++],g.normal.set(p[b++],p[b++],p[b])),_)for(n=0;3>n;n++)b=3*h[v++],_=new o(p[b++],p[b++],p[b]),g.vertexNormals.push(_);if(d&&(d=h[v++],g.color.setHex(f[d])),l)for(n=0;3>n;n++)d=h[v++],g.vertexColors.push(new $(f[d]));s.faces.push(g)}}if(u=e,v=void 0!==u.influencesPerVertex?u.influencesPerVertex:2,u.skinWeights)for(a=0,h=u.skinWeights.length;a(i=r[e]-t))o=e+1;else{if(!(0t&&(t=0),1Number.EPSILON&&(u.normalize(),i=Math.acos(ci.clamp(a[r-1].dot(a[r]),-1,1)),s[r].applyMatrix4(h.makeRotationAxis(u,i))),c[r].crossVectors(a[r],s[r]);if(!0===t)for(i=Math.acos(ci.clamp(s[0].dot(s[e]),-1,1)),i/=e,0=t)return t=r[e]-t,e=this.curves[e],r=e.getLength(),e.getPointAt(0===r?0:1-t/r);e++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,n=this.curves.length;ri;)i+=n;for(;i>n;)i-=n;is.length-2?s.length-1:e+1],s=s[e>s.length-3?s.length-1:e+2];return t.set(Xr(n,i.x,o.x,a.x,s.x),Xr(n,i.y,o.y,a.y,s.y)),t},tn.prototype.copy=function(e){Zr.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;tNumber.EPSILON){if(0>u&&(a=t[o],c=-c,s=t[i],u=-u),!(e.ys.y))if(e.y===a.y){if(e.x===a.x)return!0}else{if(0==(i=u*(e.x-a.x)-c*(e.y-a.y)))return!0;0>i||(n=!n)}}else if(e.y===a.y&&(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x))return!0}return n}var i=Ti.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return r(o);if(t=[],1===o.length){var a=o[0],s=new an;return s.curves=a.curves,t.push(s),t}var c=!i(o[0].getPoints()),c=e?!c:c;s=[];var u=[],h=[],l=0;u[l]=void 0,h[l]=[];for(var p=0,f=o.length;pn&&this._mixBufferRegion(r,e,3*t,1-n,t);for(var n=t,o=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){i.slerpFlat(e,t,e,t,e,r,n)},_lerp:function(e,t,r,n,i){for(var o=1-n,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[r+a]*n}}}),Object.assign(yn.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(bn,{Composite:yn,create:function(e,t,r){return e&&e.isAnimationObjectGroup?new bn.Composite(e,t,r):new bn(e,t,r)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var e=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),t=["material","materials","bones"];return function(r){n=e.exec(r);if(!n)throw Error("PropertyBinding: Cannot parse trackName: "+r);var n,i=(n={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]}).nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var o=n.nodeName.substring(i+1);-1!==t.indexOf(o)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+r);return n}}(),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=function(e){for(var r=0;r=t){var h=t++,l=e[h];for(r[l.uuid]=u,e[u]=l,r[c]=h,e[h]=s,s=0,c=i;s!==c;++s){var p=(l=n[s])[u];l[u]=l[h],l[h]=p}}}this.nCachedObjects_=t},uncache:function(){for(var e,t,r=this._objects,n=r.length,i=this.nCachedObjects_,o=this._indicesByUUID,a=this._bindings,s=a.length,c=0,u=arguments.length;c!==u;++c){var h=o[t=arguments[c].uuid];if(void 0!==h)if(delete o[t],h(t=(e-i)*r)||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;for(var i=this._propertyBindings,o=0,a=t.length;o!==a;++o)t[o].evaluate(r),i[o].accumulate(n,e)}}else this._updateWeight(e)},_updateWeight:function(e){t=0;if(this.enabled){var t=this.weight,r=this._weightInterpolant;if(null!==r){var n=r.evaluate(e)[0],t=t*n;e>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){t=0;if(!this.paused){var t=this.timeScale,r=this._timeScaleInterpolant;if(null!==r){t=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){o=this.time+e;if(0===e)return o;var t=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r)e:{if(-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1)),o>=t)o=t;else{if(!(0>o))break e;o=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1})}else{if(r=2202===r,-1===n&&(0<=e?(n=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),o>=t||0>o){var i=Math.floor(o/t),o=o-t*i,n=n+Math.abs(i),a=this.repetitions-n;0>a?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,o=0e,this._setEndings(e,!e,r)):this._setEndings(!1,!1,r),this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i}))}if(r&&1==(1&n))return this.time=o,t-o}return this.time=o},_setEndings:function(e,t,r){var n=this._interpolantSettings;r?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,r){var n=this._mixer,i=n.time,o=this._weightInterpolant;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}}),Object.assign(wn.prototype,t.prototype,{_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,i=n.length,o=e._propertyBindings;e=e._interpolants;var a=r.uuid,s=this._bindingsByRootAndName,c=s[a];for(void 0===c&&(c={},s[a]=c),s=0;s!==i;++s){var u=n[s],h=u.name,l=c[h];if(void 0===l){if(void 0!==(l=o[s])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,h));continue}++(l=new gn(bn.create(r,h,t&&t._propertyBindings[s].binding.parsedPath),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(l,a,h)}o[s]=l,e[s].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)&&eMath.abs(t)&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.lookAt(this.plane.normal),ne.prototype.updateMatrixWorld.call(this,e)};var $i,Gi;(Zn.prototype=Object.create(ne.prototype)).constructor=Zn,Zn.prototype.setDirection=function(){var e,t=new o;return function(r){.99999r.y?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),Zn.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()},Zn.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},(Jn.prototype=Object.create(lt.prototype)).constructor=Jn;var Vi=new o,Hi=new Qn,qi=new Qn,Wi=new Qn;(ei.prototype=Object.create(Zr.prototype)).constructor=ei,ei.prototype.isCatmullRomCurve3=!0,ei.prototype.getPoint=function(e,t){t=t||new o;var r=this.points;e*=(c=r.length)-(this.closed?0:1);if(e-=u=Math.floor(e),this.closed?u+=0u&&(u=1),1e-4>c&&(c=u),1e-4>s&&(s=u),Hi.initNonuniformCatmullRom(n.x,i.x,a.x,r.x,c,u,s),qi.initNonuniformCatmullRom(n.y,i.y,a.y,r.y,c,u,s),Wi.initNonuniformCatmullRom(n.z,i.z,a.z,r.z,c,u,s)}else"catmullrom"===this.curveType&&(Hi.initCatmullRom(n.x,i.x,a.x,r.x,this.tension),qi.initCatmullRom(n.y,i.y,a.y,r.y,this.tension),Wi.initCatmullRom(n.z,i.z,a.z,r.z,this.tension));return t.set(Hi.calc(e),qi.calc(e),Wi.calc(e)),t},ei.prototype.copy=function(e){Zr.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;tt?1:0},this.length>0)for(var r=this.length>>1;r>=0;r--)this._down(r)}t.exports=n,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--,this.length>0&&(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];e>0;){var i=e-1>>1,o=t[i];if(r(n,o)>=0)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=0)break;t[e]=c,e=a}t[e]=o}}},{}],233:[function(e,t,r){(function(){function e(e){return function(t,r,n,i){r=x(r,i,4);var o=!O(t)&&_.keys(t),a=(o||t).length,s=e>0?0:a-1;return arguments.length<3&&(n=t[o?o[s]:s],s+=e),function(t,r,n,i,o,a){for(;o>=0&&o0?0:i-1;o>=0&&o0?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=t(p.call(n,a,s),_.isNaN))>=0?o+a:-1;for(o=e>0?a:s-1;o>=0&&o=0&&t<=C};_.each=_.forEach=function(e,t,r){t=x(t,r);var n,i;if(O(e))for(n=0,i=e.length;n=0},_.invoke=function(e,t){var r=p.call(arguments,2),n=_.isFunction(t);return _.map(e,function(e){var i=n?t:e[t];return null==i?i:i.apply(e,r)})},_.pluck=function(e,t){return _.map(e,_.property(t))},_.where=function(e,t){return _.filter(e,_.matcher(t))},_.findWhere=function(e,t){return _.find(e,_.matcher(t))},_.max=function(e,t,r){var n,i,o=-1/0,a=-1/0;if(null==t&&null!=e)for(var s=0,c=(e=O(e)?e:_.values(e)).length;so&&(o=n);else t=w(t,r),_.each(e,function(e,r,n){((i=t(e,r,n))>a||i===-1/0&&o===-1/0)&&(o=e,a=i)});return o},_.min=function(e,t,r){var n,i,o=1/0,a=1/0;if(null==t&&null!=e)for(var s=0,c=(e=O(e)?e:_.values(e)).length;sn||void 0===r)return 1;if(rt?(a&&(clearTimeout(a),a=null),s=u,o=e.apply(n,i),a||(n=i=null)):a||!1===r.trailing||(a=setTimeout(c,h)),o}},_.debounce=function(e,t,r){var n,i,o,a,s,c=function(){var u=_.now()-a;u=0?n=setTimeout(c,t-u):(n=null,r||(s=e.apply(o,i),n||(o=i=null)))};return function(){o=this,i=arguments,a=_.now();var u=r&&!n;return n||(n=setTimeout(c,t)),u&&(s=e.apply(o,i),o=i=null),s}},_.wrap=function(e,t){return _.partial(t,e)},_.negate=function(e){return function(){return!e.apply(this,arguments)}},_.compose=function(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}},_.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},_.before=function(e,t){var r;return function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=null),r}},_.once=_.partial(_.before,2);var R=!{toString:null}.propertyIsEnumerable("toString"),L=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];_.keys=function(e){if(!_.isObject(e))return[];if(v)return v(e);var t=[];for(var r in e)_.has(e,r)&&t.push(r);return R&&o(e,t),t},_.allKeys=function(e){if(!_.isObject(e))return[];var t=[];for(var r in e)t.push(r);return R&&o(e,t),t},_.values=function(e){for(var t=_.keys(e),r=t.length,n=Array(r),i=0;i":">",'"':""","'":"'","`":"`"},D=_.invert(I),k=function(e){var t=function(t){return e[t]},r="(?:"+_.keys(e).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,t):e}};_.escape=k(I),_.unescape=k(D),_.result=function(e,t,r){var n=null==e?void 0:e[t];return void 0===n&&(n=r),_.isFunction(n)?n.call(e):n};var F=0;_.uniqueId=function(e){var t=++F+"";return e?e+t:t},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var B=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\u2028|\u2029/g,$=function(e){return"\\"+U[e]};_.template=function(e,t,r){!t&&r&&(t=r),t=_.defaults({},t,_.templateSettings);var n=RegExp([(t.escape||B).source,(t.interpolate||B).source,(t.evaluate||B).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(n,function(t,r,n,a,s){return o+=e.slice(i,s).replace(z,$),i=s+t.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.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(t.variable||"obj","_",o)}catch(e){throw e.source=o,e}var s=function(e){return a.call(this,e,_)},c=t.variable||"obj";return s.source="function("+c+"){\n"+o+"}",s},_.chain=function(e){var t=_(e);return t._chain=!0,t};var G=function(e,t){return e._chain?_(t).chain():t};_.mixin=function(e){_.each(_.functions(e),function(t){var r=_[t]=e[t];_.prototype[t]=function(){var e=[this._wrapped];return l.apply(e,arguments),G(this,r.apply(_,e))}})},_.mixin(_),_.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=c[e];_.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==e&&"splice"!==e||0!==r.length||delete r[0],G(this,r)}}),_.each(["concat","join","slice"],function(e){var t=c[e];_.prototype[e]=function(){return G(this,t.apply(this._wrapped,arguments))}}),_.prototype.value=function(){return this._wrapped},_.prototype.valueOf=_.prototype.toJSON=_.prototype.value,_.prototype.toString=function(){return""+this._wrapped}}).call(this)},{}],234:[function(e,t,r){var n=e("./vdom/create-element.js");t.exports=n},{"./vdom/create-element.js":240}],235:[function(e,t,r){var n=e("./vtree/diff.js");t.exports=n},{"./vtree/diff.js":260}],236:[function(e,t,r){var n=e("./virtual-hyperscript/index.js");t.exports=n},{"./virtual-hyperscript/index.js":247}],237:[function(e,t,r){var n=e("./diff.js"),i=e("./patch.js"),o=e("./h.js"),a=e("./create-element.js"),s=e("./vnode/vnode.js"),c=e("./vnode/vtext.js");t.exports={diff:n,patch:i,h:o,create:a,VNode:s,VText:c}},{"./create-element.js":234,"./diff.js":235,"./h.js":236,"./patch.js":238,"./vnode/vnode.js":256,"./vnode/vtext.js":258}],238:[function(e,t,r){var n=e("./vdom/patch.js");t.exports=n},{"./vdom/patch.js":243}],239:[function(e,t,r){function n(e,t,r){for(var n in t){var c=t[n];void 0===c?i(e,n,c,r):s(c)?(i(e,n,c,r),c.hook&&c.hook(e,n,r?r[n]:void 0)):a(c)?function(e,t,r,n,i){var s=r?r[n]:void 0;if("attributes"===n){for(var c in i){var u=i[c];void 0===u?e.removeAttribute(c):e.setAttribute(c,u)}return}if(s&&a(s)&&o(s)!==o(i))return void(e[n]=i);a(e[n])||(e[n]={});var h="style"===n?"":void 0;for(var l in i){var p=i[l];e[n][l]=void 0===p?h:p}}(e,0,r,n,c):e[n]=c}}function i(e,t,r,n){if(n){var i=n[t];if(s(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 a in i)e.style[a]="";else e[t]="string"==typeof i?"":null}}function o(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}var a=e("is-object"),s=e("../vnode/is-vhook.js");t.exports=n},{"../vnode/is-vhook.js":251,"is-object":20}],240:[function(e,t,r){function n(e,t){var r=t?t.document||i:i,h=t?t.warn:null;if(e=u(e).a,c(e))return e.init();if(s(e))return r.createTextNode(e.text);if(!a(e))return h&&h("Item is not a valid virtual dom node",e),null;var l=null===e.namespace?r.createElement(e.tagName):r.createElementNS(e.namespace,e.tagName),p=e.properties;o(l,p);for(var f=e.children,d=0;d>0,i=e[n],o===a)return i>=t&&i<=r;if(ir))return!0;a=n-1}}return!1}function o(e,t){return e>t?1:-1}var a={};t.exports=function(e,t,r,i){return r&&0!==r.length?(r.sort(o),n(e,t,r,i,0)):{}}},{}],242:[function(e,t,r){function n(e,t,r){var n=e.type,a=e.vNode,u=e.patch;switch(n){case s.REMOVE:return function(e,t){var r=e.parentNode;r&&r.removeChild(e);return i(e,t),null}(t,a);case s.INSERT:return function(e,t,r){var n=r.render(t,r);e&&e.appendChild(n);return e}(t,u,r);case s.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,u,r);case s.WIDGET:return function(e,t,r,n){var o,a=c(t,r);o=a?r.update(t,e)||e:n.render(r,n);var s=e.parentNode;s&&o!==e&&s.replaceChild(o,e);a||i(e,t);return o}(t,a,u,r);case s.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,u,r);case s.ORDER:return function(e,t){for(var r,n,i,o=e.childNodes,a={},s=0;s=c++?null:o[i.to])}(t,u),t;case s.PROPS:return o(t,u,a.properties),t;case s.THUNK:return function(e,t){e&&t&&e!==t&&e.parentNode&&e.parentNode.replaceChild(t,e);return t}(t,r.patch(t,u,r));default:return t}}function i(e,t){"function"==typeof t.destroy&&a(t)&&t.destroy(e)}var o=e("./apply-properties"),a=e("../vnode/is-widget.js"),s=e("../vnode/vpatch.js"),c=e("./update-widget");t.exports=n},{"../vnode/is-widget.js":254,"../vnode/vpatch.js":257,"./apply-properties":239,"./update-widget":244}],243:[function(e,t,r){function n(e,t,r){return r=r||{},r.patch=r.patch&&r.patch!==n?r.patch:function(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 a=s(e,t.a,n),u=e.ownerDocument;r.document||u===i||(r.document=u);for(var h=0;h=i.length?t.length:i[c],g=0;g=v&&s.push(y)}for(var b,_=s.slice(),x=0,w=[],S=[],M=0;Mm?p:m,g=0;g>>0,s=a,c=[],u=0;u0){o.become(r),e._visitRemaining(t,u,r);break}r.visit(o,function(e){c=null,this.resolve(e)},function(e){this.resolved||(c.push(e),0==--s&&this.reject(c))})}else--s;return 0===s&&o.reject(new RangeError("any(): array must not be empty")),i},e.some=function(t,r){var n,i,o,a=e._defer(),s=a._handler,c=[],u=[],h=t.length>>>0,l=0;for(o=0;o(l=Math.min(r,l))?s.reject(new RangeError("some(): array must contain at least "+r+" item(s), but had "+l)):0===l&&s.resolve(c),o=0;o2?u.call(e,o(t),arguments[2]):u.call(e,o(t))},e.reduceRight=function(e,t){return arguments.length>2?h.call(e,o(t),arguments[2]):h.call(e,o(t))},e.prototype.spread=function(e){return this.then(c).then(function(t){return e.apply(this,t)})},e}})}(function(r){t.exports=r(e)})},{"../apply":264,"../state":277}],266:[function(e,t,r){!function(e){"use strict";e(function(){function e(){throw new TypeError("catch predicate must be a function")}function t(e,t){return function(e){return e===Error||null!=e&&e.prototype instanceof Error}(t)?e instanceof t:t(e)}function r(e){return e}return function(n){function i(e,t,r,n){var i=e.call(t);return function(e){return("object"==typeof e||"function"==typeof e)&&null!==e}(i)?function(e,t,r){return o(e).then(function(){return t(r)})}(i,r,n):r(n)}var o=n.resolve,a=n.reject,s=n.prototype.catch;return n.prototype.done=function(e,t){this._handler.visit(this._handler.receiver,e,t)},n.prototype.catch=n.prototype.otherwise=function(r){return arguments.length<2?s.call(this,r):"function"!=typeof r?this.ensure(e):s.call(this,function(e,r){return function(n){return t(n,r)?e.call(this,n):a(n)}}(arguments[1],r))},n.prototype.finally=n.prototype.ensure=function(e){return"function"!=typeof e?this:this.then(function(t){return i(e,this,r,t)},function(t){return i(e,this,a,t)})},n.prototype.else=n.prototype.orElse=function(e){return this.then(void 0,function(){return e})},n.prototype.yield=function(e){return this.then(function(){return e})},n.prototype.tap=function(e){return this.then(e).yield(this)},n}})}(function(e){t.exports=e()})},{}],267:[function(e,t,r){!function(e){"use strict";e(function(){return function(e){return e.prototype.fold=function(t,r){var n=this._beget();return this._handler.fold(function(r,n,i){e._handler(r).fold(function(e,r,n){n.resolve(t.call(this,r,e))},n,this,i)},r,n._handler.receiver,n._handler),n},e}})}(function(e){t.exports=e()})},{}],268:[function(e,t,r){!function(e){"use strict";e(function(e){var t=e("../state").inspect;return function(e){return e.prototype.inspect=function(){return t(e._handler(this))},e}})}(function(r){t.exports=r(e)})},{"../state":277}],269:[function(e,t,r){!function(e){"use strict";e(function(){return function(e){function t(e,n,i,o){function a(o,a){return r(i(o)).then(function(){return t(e,n,i,a)})}return r(o).then(function(t){return r(n(t)).then(function(n){return n?t:r(e(t)).spread(a)})})}var r=e.resolve;return e.iterate=function(e,r,n,i){return t(function(t){return[t,e(t)]},r,n,i)},e.unfold=t,e}})}(function(e){t.exports=e()})},{}],270:[function(e,t,r){!function(e){"use strict";e(function(){return function(e){return e.prototype.progress=function(e){return this.then(void 0,void 0,e)},e}})}(function(e){t.exports=e()})},{}],271:[function(e,t,r){!function(e){"use strict";e(function(e){function t(e,t,n,i){return r.setTimer(function(){e(n,i,t)},t)}var r=e("../env"),n=e("../TimeoutError");return function(e){function i(e,r,n){t(o,e,r,n)}function o(e,t){t.resolve(e)}function a(e,t,r){var i=void 0===e?new n("timed out after "+r+"ms"):e;t.reject(i)}return e.prototype.delay=function(e){var t=this._beget();return this._handler.fold(i,e,void 0,t._handler),t},e.prototype.timeout=function(e,n){var i=this._beget(),o=i._handler,s=t(a,e,n,i._handler);return this._handler.visit(o,function(e){r.clearTimer(s),this.resolve(e)},function(e){r.clearTimer(s),this.reject(e)},o.notify),i},e}})}(function(r){t.exports=r(e)})},{"../TimeoutError":263,"../env":274}],272:[function(e,t,r){!function(e){"use strict";e(function(e){function t(e){throw e}function r(){}var n=e("../env").setTimer,i=e("../format");return function(e){function o(e){e.handled||(f.push(e),h("Potentially unhandled rejection ["+e.id+"] "+i.formatError(e.value)))}function a(e){var t=f.indexOf(e);t>=0&&(f.splice(t,1),l("Handled previous rejection ["+e.id+"] "+i.formatObject(e.value)))}function s(e,t){p.push(e,t),null===d&&(d=n(c,0))}function c(){for(d=null;p.length>0;)p.shift()(p.shift())}var u,h=r,l=r;"undefined"!=typeof console&&(u=console,h=void 0!==u.error?function(e){u.error(e)}:function(e){u.log(e)},l=void 0!==u.info?function(e){u.info(e)}:function(e){u.log(e)}),e.onPotentiallyUnhandledRejection=function(e){s(o,e)},e.onPotentiallyUnhandledRejectionHandled=function(e){s(a,e)},e.onFatalRejection=function(e){s(t,e.value)};var p=[],f=[],d=null;return e}})}(function(r){t.exports=r(e)})},{"../env":274,"../format":275}],273:[function(e,t,r){!function(e){"use strict";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}})}(function(e){t.exports=e()})},{}],274:[function(e,t,r){(function(r){!function(e){"use strict";e(function(e){var t,n="undefined"!=typeof setTimeout&&setTimeout,i=function(e,t){return setTimeout(e,t)},o=function(e){return clearTimeout(e)},a=function(e){return n(e,0)};if(void 0!==r&&"[object process]"===Object.prototype.toString.call(r))a=function(e){return r.nextTick(e)};else if(t="undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver)a=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(!n){var s=e("vertx");i=function(e,t){return s.setTimer(t,e)},o=s.cancelTimer,a=s.runOnLoop||s.runOnContext}return{setTimer:i,clearTimer:o,asap:a}})}(function(r){t.exports=r(e)})}).call(this,e("_process"))},{_process:6}],275:[function(e,t,r){!function(e){"use strict";e(function(){function e(e){var r=String(e);return"[object Object]"===r&&"undefined"!=typeof JSON&&(r=t(e,r)),r}function t(e,t){try{return JSON.stringify(e)}catch(e){return t}}return{formatError:function(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)"},formatObject:e,tryStringify:t}})}(function(e){t.exports=e()})},{}],276:[function(e,t,r){(function(e){!function(t){"use strict";t(function(){return function(t){function r(e,t){this._handler=e===p?t:function(e){function t(e){r.reject(e)}var r=new d;try{e(function(e){r.resolve(e)},t,function(e){r.notify(e)})}catch(e){t(e)}return r}(e)}function n(e){return E(e)?e:new r(p,new m(h(e)))}function i(e){return new r(p,new m(new y(e)))}function o(){return B}function a(e,t,n){function i(e,t,r){h[e]=t,0==--u&&r.become(new g(h))}for(var o,a="function"==typeof t?function(r,o,a){a.resolved||s(n,i,r,e(t,o,r),a)}:i,c=new d,u=n.length>>>0,h=new Array(u),l=0;l0?t(r,o.value,i):(i.become(o),c(e,r+1,o))}else t(r,n,i)}function c(e,t,r){for(var n=t;n0||"function"!=typeof t&&i<0)return new this.constructor(p,n);var o=this._beget(),a=o._handler;return n.chain(a,n.receiver,e,t,r),o},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype._beget=function(){return function(e,t){return new t(p,new d(e.receiver,e.join().context))}(this._handler,this.constructor)},r.all=function(e){return a(A,null,e)},r.race=u,r._traverse=function(e,t){return a(P,e,t)},r._visitRemaining=c,p.prototype.when=p.prototype.become=p.prototype.notify=p.prototype.fail=p.prototype._unreport=p.prototype._report=R,p.prototype._state=0,p.prototype.state=function(){return this._state},p.prototype.join=function(){for(var e=this;void 0!==e.handler;)e=e.handler;return e},p.prototype.chain=function(e,t,r,n,i){this.when({resolver:e,receiver:t,fulfilled:r,rejected:n,progress:i})},p.prototype.visit=function(e,t,r,n){this.chain(k,e,t,r,n)},p.prototype.fold=function(e,t,r,n){this.when(new M(e,t,r,n))},j(p,f),f.prototype.become=function(e){e.fail()};var k=new f;j(p,d),d.prototype._state=0,d.prototype.resolve=function(e){this.become(h(e))},d.prototype.reject=function(e){this.resolved||this.become(new y(e))},d.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 y(new TypeError("Promise cycle"));return e},d.prototype.run=function(){var e=this.consumers,t=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var r=0;r0?r(e.value):t(e.value)}}})}(function(e){t.exports=e()})},{}],278:[function(e,t,r){!function(e){"use strict";e(function(e){function t(e,t,r,n){var i=m.resolve(e);return arguments.length<2?i:i.then(t,r,n)}function r(e){return function(){for(var t=0,r=arguments.length,n=new Array(r);t0?2*Math.atan(.5*n.basicWidth/(o*n.focal)):0;return[e._spatial.degToRad(r.ca),a]}).distinctUntilChanged(function(t,r){return Math.abs(r[0]-t[0])2*Math.PI-Math.PI/90)return i.h("circle",{attributes:{cx:"0",cy:"0",fill:r,r:"1"},namespace:this._svgNamespace},[]);var n=e-t/2-Math.PI/2,o=n+t,a=Math.cos(n),s=Math.sin(n),c=Math.cos(o),u=Math.sin(o),h="M 0 0 "+a+" "+s+" A 1 1 0 "+(t>=Math.PI?1:0)+" 1 "+c+" "+u;return i.h("path",{attributes:{d:h,fill:r},namespace:this._svgNamespace},[])},t.componentName="bearing",t}(a.Component);r.BearingComponent=c,a.ComponentService.register(c),r.default=c},{"../Component":281,"../Geo":284,"rxjs/Observable":29,"virtual-dom":237}],298:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable");e("rxjs/add/observable/combineLatest"),e("rxjs/add/observable/from"),e("rxjs/add/observable/merge"),e("rxjs/add/observable/of"),e("rxjs/add/observable/zip"),e("rxjs/add/operator/catch"),e("rxjs/add/operator/combineLatest"),e("rxjs/add/operator/distinct"),e("rxjs/add/operator/expand"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/mergeMap"),e("rxjs/add/operator/mergeAll"),e("rxjs/add/operator/skip"),e("rxjs/add/operator/switchMap");var o=e("../Edge"),a=e("../Component"),s=function(e){function t(t,r,n){return e.call(this,t,r,n)||this}return n(t,e),t.prototype.setDepth=function(e){this.configure({depth:e})},t.prototype._activate=function(){var e=this;this._sequenceSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$.switchMap(function(e){return e.sequenceEdges$}).filter(function(e){return e.cached}),this._configuration$).switchMap(function(t){var r=t[0],n=t[1],a=Math.max(0,Math.min(4,n.depth.sequence)),s=e._cache$(r.edges,o.EdgeDirection.Next,a),c=e._cache$(r.edges,o.EdgeDirection.Prev,a);return i.Observable.merge(s,c).catch(function(e,t){return console.error("Failed to cache sequence edges.",e),i.Observable.empty()})}).subscribe(function(){}),this._spatialSubscription=this._navigator.stateService.currentNode$.switchMap(function(e){return i.Observable.combineLatest(i.Observable.of(e),e.spatialEdges$.filter(function(e){return e.cached}))}).combineLatest(this._configuration$,function(e,t){return[e[0],e[1],t]}).switchMap(function(t){var r=t[0],n=t[1].edges,a=t[2].depth,s=Math.max(0,Math.min(2,a.pano)),c=r.pano?0:Math.max(0,Math.min(3,a.step)),u=r.pano?0:Math.max(0,Math.min(1,a.turn)),h=e._cache$(n,o.EdgeDirection.Pano,s),l=e._cache$(n,o.EdgeDirection.StepForward,c),p=e._cache$(n,o.EdgeDirection.StepBackward,c),f=e._cache$(n,o.EdgeDirection.StepLeft,c),d=e._cache$(n,o.EdgeDirection.StepRight,c),m=e._cache$(n,o.EdgeDirection.TurnLeft,u),v=e._cache$(n,o.EdgeDirection.TurnRight,u),g=e._cache$(n,o.EdgeDirection.TurnU,u);return i.Observable.merge(l,p,f,d,h,m,v,g).catch(function(e,t){return console.error("Failed to cache spatial edges.",e),i.Observable.empty()})}).subscribe(function(){})},t.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._spatialSubscription.unsubscribe()},t.prototype._getDefaultConfiguration=function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}},t.prototype._cache$=function(e,t,r){var n=this;return i.Observable.zip(i.Observable.of(e),i.Observable.of(r)).expand(function(e){var r=e[0],o=e[1],a=[];if(o>0)for(var s=0,c=r;s-1?e.sequenceEdges$:e.spatialEdges$).first(function(e){return e.cached}).map(function(e){return e.edges})},t.componentName="cache",t}(a.Component);r.CacheComponent=s,a.ComponentService.register(s),r.default=s},{"../Component":281,"../Edge":282,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/expand":60,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeAll":67,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/skip":77,"rxjs/add/operator/switchMap":81}],299:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/BehaviorSubject"),o=e("rxjs/Subject");e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/startWith");var a=function(e){function t(t,r,n){var a=e.call(this)||this;return a._activated$=new i.BehaviorSubject(!1),a._configurationSubject$=new o.Subject,a._activated=!1,a._container=r,a._name=t,a._navigator=n,a._configuration$=a._configurationSubject$.startWith(a.defaultConfiguration).scan(function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}).publishReplay(1).refCount(),a._configuration$.subscribe(function(){}),a}return n(t,e),Object.defineProperty(t.prototype,"activated",{get:function(){return this._activated},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activated$",{get:function(){return this._activated$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"defaultConfiguration",{get:function(){return this._getDefaultConfiguration()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),t.prototype.activate=function(e){this._activated||(void 0!==e&&this._configurationSubject$.next(e),this._activated=!0,this._activate(),this._activated$.next(!0))},t.prototype.configure=function(e){this._configurationSubject$.next(e)},t.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))},t.prototype.resize=function(){},t.componentName="not_worthy",t}(e("../Utils").EventEmitter);r.Component=a,r.default=a},{"../Utils":291,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":75,"rxjs/add/operator/startWith":80}],300:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("underscore"),i=e("../Error"),o=function(){function e(t,r){this._components={};for(var i=0,o=n.values(e.registeredComponents);i0&&e.description?{name:t._name,vnode:t._getRouteAnnotationNode(e.description)}:{name:t._name,vnode:o.h("div",[])}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.unsubscribe(),this._disposableDescription.unsubscribe()},t.prototype._getDefaultConfiguration=function(){return{}},t.prototype.play=function(){this.configure({playing:!0})},t.prototype.stop=function(){this.configure({playing:!1})},t.prototype._getRouteAnnotationNode=function(e){return o.h("div.RouteFrame",{},[o.h("p",{textContent:e},[])])},t.componentName="route",t}(s.Component);r.RouteComponent=l,s.ComponentService.register(l),r.default=l},{"../Component":281,"rxjs/Observable":29,"rxjs/add/observable/fromPromise":43,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinct":57,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":75,underscore:233,"virtual-dom":237}],307:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable");e("rxjs/add/operator/buffer"),e("rxjs/add/operator/debounceTime"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/scan");var o=e("../Component"),a=function(e){function t(t,r,n){return e.call(this,t,r,n)||this}return n(t,e),t.prototype._activate=function(){var e=this;this._sequenceSubscription=this._navigator.stateService.currentNode$.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:{}}).filter(function(e){return e.report.length>0}).mergeMap(function(t){return e._navigator.apiV3.sequenceViewAdd$(t.report).catch(function(e,r){return console.error("Failed to report sequence stats ("+t.report+")",e),i.Observable.empty()})}).subscribe(function(){}),this._imageSubscription=this._navigator.stateService.currentNode$.map(function(e){return e.key}).buffer(this._navigator.stateService.currentNode$.debounceTime(5e3)).scan(function(e,t){e.report=[];for(var r=0,n=t;r0}).mergeMap(function(t){return e._navigator.apiV3.imageViewAdd$(t.report).catch(function(e,r){return console.error("Failed to report image stats ("+t.report+")",e),i.Observable.empty()})}).subscribe(function(){})},t.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._imageSubscription.unsubscribe()},t.prototype._getDefaultConfiguration=function(){return{}},t.componentName="stats",t}(o.Component);r.StatsComponent=a,o.ComponentService.register(a),r.default=a},{"../Component":281,"rxjs/Observable":29,"rxjs/add/operator/buffer":49,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":75}],308:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("virtual-dom"),o=e("rxjs/Observable"),a=e("rxjs/Subject");e("rxjs/add/observable/combineLatest"),e("rxjs/add/operator/do"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/share");var s=e("../../Component"),c=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._renderer=i||new s.DirectionDOMRenderer(o.defaultConfiguration,r.element),o._hoveredKeySubject$=new a.Subject,o._hoveredKey$=o._hoveredKeySubject$.share(),o}return n(t,e),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 e=this;this._configurationSubscription=this._configuration$.subscribe(function(t){e._renderer.setConfiguration(t)}),this._nodeSubscription=this._navigator.stateService.currentNode$.do(function(t){e._container.domRenderer.render$.next({name:e._name,vnode:i.h("div",{},[])}),e._renderer.setNode(t)}).withLatestFrom(this._configuration$).switchMap(function(t){var r=t[0],n=t[1];return o.Observable.combineLatest(r.spatialEdges$,n.distinguishSequence?e._navigator.graphService.cacheSequence$(r.sequenceKey).catch(function(e,t){return console.error("Failed to cache sequence ("+r.sequenceKey+")",e),o.Observable.of(null)}):o.Observable.of(null))}).subscribe(function(t){var r=t[0],n=t[1];e._renderer.setEdges(r,n)}),this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.do(function(t){e._renderer.setRenderCamera(t)}).map(function(t){return e._renderer}).filter(function(e){return e.needsRender}).map(function(t){return{name:e._name,vnode:t.render(e._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(e,t,r,n){return e}).map(function(e){for(var t=e.getElementsByClassName("DirectionsPerspective"),r=0;rt?e:t},e}();r.DirectionDOMCalculator=i,r.default=i},{"../../Geo":284}],310:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("virtual-dom"),i=e("../../Component"),o=e("../../Edge"),a=e("../../Geo"),s=function(){function e(e,t){this._isEdge=!1,this._spatial=new a.Spatial,this._calculator=new i.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=[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(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)-1?this._stepEdges.push(c):this._turnDirections.indexOf(i)>-1?this._turnEdges.push(c):c.data.direction===o.EdgeDirection.Pano&&this._panoEdges.push(c)}if(this._distinguishSequence&&null!=t)for(var a=0,s=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);a-1&&(c+="Sequence"),this._highlightKey===t&&(c+="Highlight");var u=n.h("div."+r,{},[]);return n.h("div."+c,s,[u])},e.prototype._createVNodeDisabled=function(e,t,r){return this._createVNode(e,t,r,this._calculator.outerRadius,"DirectionsArrowDisabled","DirectionsCircleDisabled")},e.prototype._createVNode=function(e,t,r,i,o,a,s,c){var u=this._calculator.angleToCoordinates(t-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(t,r.phi),f=this._calculator.shadowOffset,d="drop-shadow("+-f*p[1]+"px "+f*p[0]+"px 1px rgba(0,0,0,0.8))",m={style:{"-webkit-filter":d,filter:d}},v=n.h("div."+o,m,[]),g=-this._spatial.radToDeg(t-r.phi),y=c?"translate("+h+"px, "+l+"px) rotate("+g+"deg) translateZ(-0.01px)":"translate("+h+"px, "+l+"px) rotate("+g+"deg)",b={attributes:{"data-key":e},onclick:s,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:y,width:this._calculator.stepCircleSizeCss}};return this._sequenceEdgeKeys.indexOf(e)>-1&&(a+="Sequence"),this._highlightKey===e&&(a+="Highlight"),n.h("div."+a,b,[v])},e.prototype._getContainer=function(e,t,r){var i=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",o={oncontextmenu:function(e){e.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:i,width:this._calculator.containerWidthCss}};return n.h("div.DirectionsPerspective",o,t.concat(e))},e}();r.DirectionDOMRenderer=s,r.default=s},{"../../Component":281,"../../Edge":282,"../../Geo":284,"virtual-dom":237}],311:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/operator/catch"),e("rxjs/add/operator/combineLatest"),e("rxjs/add/operator/debounceTime"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/pairwise"),e("rxjs/add/operator/publish"),e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/skipWhile"),e("rxjs/add/operator/startWith"),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/takeUntil"),e("rxjs/add/operator/withLatestFrom");var a=e("../../Component"),s=e("../../Render"),c=e("../../Tiles"),u=e("../../Utils"),h=function(e){function t(t,r,n){var i=e.call(this,t,r,n)||this;return i._imageTileLoader=new c.ImageTileLoader(u.Urls.tileScheme,u.Urls.tileDomain,u.Urls.origin),i._roiCalculator=new c.RegionOfInterestCalculator,i._rendererOperation$=new o.Subject,i._rendererCreator$=new o.Subject,i._rendererDisposer$=new o.Subject,i._renderer$=i._rendererOperation$.scan(function(e,t){return t(e)},null).filter(function(e){return null!=e}).distinctUntilChanged(void 0,function(e){return e.frameId}),i._rendererCreator$.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 a.ImagePlaneGLRenderer}}).subscribe(i._rendererOperation$),i._rendererDisposer$.map(function(){return function(e){return e.dispose(),null}}).subscribe(i._rendererOperation$),i}return n(t,e),t.prototype._activate=function(){var e=this;this._rendererSubscription=this._renderer$.map(function(t){var r={name:e._name,render:{frameId:t.frameId,needsRender:t.needsRender,render:t.render.bind(t),stage:s.GLRenderStage.Background}};return t.clearNeedsRender(),r}).subscribe(this._container.glRenderer.render$),this._rendererCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(e){return function(t){return t.updateFrame(e),t}}).subscribe(this._rendererOperation$);var t=this._navigator.stateService.currentState$.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}).combineLatest(this._configuration$).filter(function(e){return!0===e[1].imageTiling}).map(function(e){return e[0]}).withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$).map(function(t){var r=t[0],n=t[1],i=t[2],o=r.state,a=Math.max(i.width,i.height),s=o.currentNode,u=o.currentTransform,h=a>2048?2048:a>1024?1024:512;return new c.TextureProvider(s.key,u.basicWidth,u.basicHeight,h,s.image,e._imageTileLoader,new c.ImageTileStore,n)}).publishReplay(1).refCount();this._textureProviderSubscription=t.subscribe(function(){}),this._setTextureProviderSubscription=t.map(function(e){return function(t){return t.setTextureProvider(e.key,e),t}}).subscribe(this._rendererOperation$),this._setTileSizeSubscription=this._container.renderService.size$.switchMap(function(e){return i.Observable.combineLatest(t,i.Observable.of(e)).first()}).subscribe(function(e){var t=e[0],r=e[1],n=Math.max(r.width,r.height),i=n>2048?2048:n>1024?1024:512;t.setTileSize(i)}),this._abortTextureProviderSubscription=t.pairwise().subscribe(function(e){e[0].abort()});var r=i.Observable.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.debounceTime(250)).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()]}).pairwise().skipWhile(function(e){return e[1][2]-e[0][2]<0||0===e[1][2]}).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}).distinctUntilChanged().filter(function(e){return e}).switchMap(function(t){return e._container.renderService.renderCameraFrame$.first()}).withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$);this._setRegionOfInterestSubscription=t.switchMap(function(t){return r.map(function(r){var n=r[0],i=r[1],o=r[2];return[e._roiCalculator.computeRegionOfInterest(n,i,o),t]})}).filter(function(e){return!e[1].disposed}).subscribe(function(e){var t=e[0];e[1].setRegionOfInterest(t)});var n=t.switchMap(function(e){return e.hasTexture$}).startWith(!1).publishReplay(1).refCount();this._hasTextureSubscription=n.subscribe(function(){});var o=this._navigator.stateService.currentState$.filter(function(e){return 0===e.state.nodesAhead}).map(function(e){return e.state.currentNode}).distinctUntilChanged(void 0,function(e){return e.key}).debounceTime(1e3).withLatestFrom(n).filter(function(e){return!e[1]}).map(function(e){return e[0]}).filter(function(e){return e.pano?u.Settings.maxImageSize>u.Settings.basePanoramaSize:u.Settings.maxImageSize>u.Settings.baseImageSize}).switchMap(function(e){var t=e.pano?u.Settings.basePanoramaSize:u.Settings.baseImageSize;if(Math.max(e.image.width,e.image.height)>t)return i.Observable.empty();return e.cacheImage$(u.Settings.maxImageSize).map(function(e){return[e.image,e]}).takeUntil(n.filter(function(e){return e})).catch(function(t,r){return console.error("Failed to fetch high res image ("+e.key+")",t),i.Observable.empty()})}).publish().refCount();this._updateBackgroundSubscription=o.withLatestFrom(t).subscribe(function(e){e[0][1].key!==e[1].key||e[1].disposed||e[1].updateBackground(e[0][0])}),this._updateTextureImageSubscription=o.map(function(e){return function(t){return t.updateTextureImage(e[0],e[1]),t}}).subscribe(this._rendererOperation$)},t.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()},t.prototype._getDefaultConfiguration=function(){return{imageTiling:!1}},t.componentName="imagePlane",t}(a.Component);r.ImagePlaneComponent=h,a.ComponentService.register(h),r.default=h},{"../../Component":281,"../../Render":287,"../../Tiles":290,"../../Utils":291,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/operator/catch":52,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/debounceTime":55,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publish":71,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":75,"rxjs/add/operator/skipWhile":79,"rxjs/add/operator/startWith":80,"rxjs/add/operator/switchMap":81,"rxjs/add/operator/takeUntil":83,"rxjs/add/operator/withLatestFrom":87}],312:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("../../Component"),o=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._createImageSphere=function(e,t){var r=this._createTexture(e.image),i=this._createSphereMaterialParameters(t,r),o=new n.ShaderMaterial(i);return this._useMesh(t,e)?new n.Mesh(this._getImageSphereGeo(t,e),o):new n.Mesh(this._getFlatImageSphereGeo(t),o)},e.prototype._createImagePlane=function(e,t){var r=this._createTexture(e.image),i=this._createPlaneMaterialParameters(t,r),o=new n.ShaderMaterial(i),a=this._useMesh(t,e)?this._getImagePlaneGeo(t,e):this._getFlatImagePlaneGeo(t);return new n.Mesh(a,o)},e.prototype._createSphereMaterialParameters=function(e,t){var r=e.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;return{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:e.rt},projectorTex:{type:"t",value:t},thetaLength:{type:"f",value:h},thetaShift:{type:"f",value:u}},vertexShader:i.ImagePlaneShaders.equirectangular.vertex}},e.prototype._createPlaneMaterialParameters=function(e,t){return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.perspective.fragment,side:n.DoubleSide,transparent:!0,uniforms:{bbox:{type:"v4",value:new n.Vector4(0,0,1,1)},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:e.projectorMatrix()},projectorTex:{type:"t",value:t}},vertexShader:i.ImagePlaneShaders.perspective.vertex}},e.prototype._createTexture=function(e){var t=new n.Texture(e);return t.minFilter=n.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 n.Matrix4).getInverse(e.srt),i=5*e.scale,o=this._imageSphereRadius*e.scale,a=t.mesh.vertices,s=a.length/3,c=new Float32Array(a.length),u=0;u 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}"},e}();r.ImagePlaneShaders=n},{path:22}],316:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/combineLatest"),e("rxjs/add/observable/fromEvent"),e("rxjs/add/observable/of"),e("rxjs/add/observable/zip"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/mergeMap"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/withLatestFrom"),e("rxjs/add/operator/zip");var a=e("../../State"),s=e("../../Render"),c=e("../../Utils"),u=e("../../Component"),h=function(){function e(){this._imagePlaneFactory=new u.ImagePlaneFactory,this._imagePlaneScene=new u.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._curtain=1}return Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"curtain",{get:function(){return this._curtain},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"glNeedsRender",{get:function(){return this._glNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domNeedsRender",{get:function(){return this._domNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sliderVisible",{get:function(){return this._sliderVisible},set:function(e){this._sliderVisible=e,this._domNeedsRender=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return null==this._currentKey||null==this._previousKey||this._currentPano},enumerable:!0,configurable:!0}),e.prototype.update=function(e){this._updateFrameId(e.id);var t=this._updateImagePlanes(e.state);this._domNeedsRender=t||this._domNeedsRender,t=this._updateCurtain(e.state.alpha)||t,this._glNeedsRender=t||this._glNeedsRender},e.prototype.updateTexture=function(e,t){var r=t.key===this._currentKey?this._imagePlaneScene.imagePlanes:t.key===this._previousKey?this._imagePlaneScene.imagePlanesOld:[];if(0!==r.length){this._glNeedsRender=!0;for(var n=0,i=r;nc.Settings.basePanoramaSize:c.Settings.maxImageSize>c.Settings.baseImageSize}).mergeMap(function(e){var t=e.pano?c.Settings.basePanoramaSize:c.Settings.baseImageSize;return Math.max(e.image.width,e.image.height)>t?i.Observable.empty():e.cacheImage$(c.Settings.maxImageSize).map(function(e){return[e.image,e]}).catch(function(t,r){return console.error("Failed to fetch high res slider image ("+e.key+")",t),i.Observable.empty()})}).map(function(e){var t=e[0],r=e[1];return function(e){return e.updateTexture(t,r),e}}).subscribe(this._sliderStateOperation$)},t.prototype._deactivate=function(){var e=this;this._navigator.stateService.state$.first().subscribe(function(t){t===a.State.Waiting&&e._navigator.stateService.traverse()}),this._sliderStateDisposer$.next(null),this._setKeysSubscription.unsubscribe(),this._setSliderVisibleSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this.configure({keys:null}),this._sliderControl.removeEventListener("input",this._moveToHandler),this._sliderControl.removeEventListener("change",this._moveToHandler),this._container.element.removeChild(this._sliderContainer),this._moveToHandler=null,this._sliderControl=null,this._sliderWrapper=null,this._sliderContainer=null},t.prototype._getDefaultConfiguration=function(){return{}},t.prototype._catchCacheNode$=function(e){return this._navigator.graphService.cacheNode$(e).catch(function(t,r){return console.error("Failed to cache slider node ("+e+")",t),i.Observable.empty()})},t.componentName="slider",t}(u.Component);r.SliderComponent=l,u.ComponentService.register(l),r.default=l},{"../../Component":281,"../../Render":287,"../../State":288,"../../Utils":291,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/fromEvent":42,"rxjs/add/observable/of":45,"rxjs/add/observable/zip":48,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/scan":75,"rxjs/add/operator/switchMap":81,"rxjs/add/operator/withLatestFrom":87,"rxjs/add/operator/zip":88}],317:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!function(e){e[e.Hidden=0]="Hidden",e[e.Loading=1]="Loading",e[e.Visible=2]="Visible"}(r.CoverState||(r.CoverState={}))},{}],318:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./ICoverConfiguration");r.CoverState=n.CoverState},{"./ICoverConfiguration":317}],319:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../Component"),o=e("../../Edge"),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._enable=function(){var e=this;this._keyDownSubscription=this._container.keyboardService.keyDown$.withLatestFrom(this._navigator.playService.playing$,this._navigator.playService.direction$,this._navigator.playService.speed$,this._navigator.stateService.currentNode$.switchMap(function(e){return e.sequenceEdges$})).subscribe(function(t){var r=t[0],n=t[1],i=t[2],a=t[3],s=t[4];if(!(r.altKey||r.ctrlKey||r.metaKey)){switch(r.key){case"D":if(!r.shiftKey)return;var c=n?null:i===o.EdgeDirection.Next?o.EdgeDirection.Prev:i===o.EdgeDirection.Prev?o.EdgeDirection.Next:null;null!=c&&e._navigator.playService.setDirection(c);break;case" ":if(r.shiftKey)return;if(n)e._navigator.playService.stop();else for(var u=0,h=s.edges;u":e._navigator.playService.setSpeed(a+.05);break;default:return}r.preventDefault()}})},t.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{keyZoom:e}},t}(i.HandlerBase);r.KeyPlayHandler=a,r.default=a},{"../../Component":281,"../../Edge":282}],320:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/withLatestFrom");var i=e("../../Component"),o=e("../../Edge"),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._enable=function(){var e=this,t=this._navigator.stateService.currentNode$.switchMap(function(e){return e.sequenceEdges$});this._keyDownSubscription=this._container.keyboardService.keyDown$.withLatestFrom(t).subscribe(function(t){var r=t[0],n=t[1],i=null;switch(r.keyCode){case 38:i=o.EdgeDirection.Next;break;case 40:i=o.EdgeDirection.Prev;break;default:return}if(r.preventDefault(),r.altKey&&!r.shiftKey&&n.cached)for(var a=0,s=n.edges;ai.lat&&p.latLon.lati.lon&&p.latLon.lon50||a.lerpAltitude(h.id,r,Math.min(1,Math.max(0,1.2-1.2*d/50)))}}),this._renderSubscription=this._navigator.stateService.currentState$.map(function(t){var r=e._markerScene;return{name:e._name,render:{frameId:t.id,needsRender:r.needsRender,render:r.render.bind(r),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$);var l=a.Observable.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).map(function(t){var r=t[0],n=t[1],i=e._container.element,o=e._viewportCoords.canvasPosition(n,i),a=o[0],s=o[1],c=e._viewportCoords.canvasToViewport(a,s,i);return e._markerScene.intersectObjects(c,r.perspective)}).publishReplay(1).refCount(),p=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).map(function(e){return!0}),f=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).map(function(e){return!1}),d=a.Observable.merge(p,f).startWith(!1);this._dragEventSubscription=p.withLatestFrom(l).merge(a.Observable.combineLatest(f,a.Observable.of(null))).startWith([!1,null]).pairwise().subscribe(function(r){var n=r[0],i=r[1],o=i[0],a=o?t.dragstart:t.dragend,s=o?i[1]:n[1],c={marker:e._markerScene.get(s),target:e,type:a};e.fire(a,c)});var m=a.Observable.merge(this._container.mouseService.mouseDown$.map(function(e){return!0}),this._container.mouseService.documentMouseUp$.map(function(e){return!1})).startWith(!1);this._mouseClaimSubscription=a.Observable.combineLatest(this._container.mouseService.active$,l.distinctUntilChanged(),m,d).map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return!t&&null!=r&&n||i}).distinctUntilChanged().subscribe(function(t){t?(e._container.mouseService.claimMouse(e._name,1),e._container.mouseService.claimWheel(e._name,1)):(e._container.mouseService.unclaimMouse(e._name),e._container.mouseService.unclaimWheel(e._name))});var v=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).withLatestFrom(l,this._container.renderService.renderCamera$).map(function(t){var r=t[0],n=t[1],i=t[2],o=e._markerScene.get(n),a=e._container.element,s=e._viewportCoords.projectToCanvas(o.geometry.position.toArray(),a,i.perspective),c=s[0],u=s[1],h=e._viewportCoords.canvasPosition(r,a);return[o,[h[0]-c,h[1]-u],i]}).publishReplay(1).refCount();this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).withLatestFrom(v,this._navigator.stateService.reference$,o).subscribe(function(r){var n=r[0],o=r[1],a=o[0],s=o[1],c=o[2],u=r[2],h=r[3];if(e._markerScene.has(a.id)){var l=e._container.element,p=e._viewportCoords.canvasPosition(n,l),f=p[0],d=p[1],m=f-s[0],v=d-s[1],g=e._viewportCoords.canvasToViewport(m,v,l),y=g[0],b=g[1],_=new i.Vector3(y,b,1).unproject(c.perspective).sub(c.perspective.position).normalize(),x=Math.min(e._relativeGroundAltitude/_.z,h.visibleBBoxSize/2-.1);if(!(x<0)){var w=_.clone().multiplyScalar(x).add(c.perspective.position);w.z=c.perspective.position.z+e._relativeGroundAltitude;var S=e._geoCoords.enuToGeodetic(w.x,w.y,w.z,u.lat,u.lon,u.alt),M=S[0],E=S[1];e._markerScene.update(a.id,w.toArray(),{lat:M,lon:E}),e._markerSet.update(a);var C={marker:a,target:e,type:t.changed};e.fire(t.changed,C)}}})},t.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()},t.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}},t.componentName="marker",t.changed="changed",t.dragstart="dragstart",t.dragend="dragend",t}(s.Component);r.MarkerComponent=l,s.ComponentService.register(l),r.default=l},{"../../Component":281,"../../Geo":284,"../../Graph":285,"../../Render":287,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/map":65,three:231,when:278}],326:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=function(){function e(e,t){this._needsRender=!1,this._interactiveObjects=[],this._markers={},this._objectMarkers={},this._raycaster=t||new n.Raycaster,this._scene=e||new n.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),this._markers[e.id]=e;for(var r=0,n=e.getInteractiveObjects();r0&&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;i0&&0===s[3]?c=-h*s[1]:0===s[1]&&s[3]>0?c=h*s[3]:s[1]>0&&s[3]>0&&(c=h*(s[3]-s[1])/2),s[0]>0&&0===s[2]?u=h*s[0]:0===s[0]&&s[2]>0?u=-h*s[2]:s[0]>0&&s[2]>0&&(u=h*(s[0]-s[2])/2);var l=e._basicRotationThreshold;c=e._spatial.clamp(c,-l,l),u=e._spatial.clamp(u,-l,l),e._navigator.stateService.rotateBasicUnbounded([c,u])}}}})},t.prototype._disable=function(){this._bounceSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{}},t}(e("../../Component").HandlerBase);r.BounceHandler=o,r.default=o},{"../../Component":281,"rxjs/Observable":29}],332:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._viewportCoords=i,o}return n(t,e),t.prototype._enable=function(){var e=this;this._zoomSubscription=i.Observable.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.map(function(e){var t=e.touches[0];return{clientX:t.clientX,clientY:t.clientY,shiftKey:e.shiftKey}})).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(t){var r=t[0],n=t[1],i=t[2],o=e._container.element,a=e._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=e._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.shiftKey?-1:1;e._navigator.stateService.zoomIn(l,h)})},t.prototype._disable=function(){this._zoomSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{doubleClickZoom:e}},t}(e("../../Component").HandlerBase);r.DoubleClickZoomHandler=o,r.default=o},{"../../Component":281,"rxjs/Observable":29}],333:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("three"),o=e("rxjs/Observable");e("rxjs/add/operator/concat"),e("rxjs/add/operator/sample"),e("rxjs/add/operator/takeWhile");var a=function(e){function t(t,r,n,i,o){var a=e.call(this,t,r,n)||this;return a._spatial=o,a._viewportCoords=i,a._basicRotationThreshold=.05,a._forceCoeff=.2,a}return n(t,e),t.prototype._enable=function(){var e=this,t=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).map(function(e){return!0}).share(),r=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).map(function(e){return!1}).share();this._activeMouseSubscription=o.Observable.merge(t,r).subscribe(this._container.mouseService.activate$),this._preventDefaultSubscription=o.Observable.merge(t,r).switchMap(function(t){return t?e._container.mouseService.documentMouseMove$:o.Observable.empty()}).merge(this._container.touchService.touchMove$).subscribe(function(e){e.preventDefault()});var n=this._container.touchService.singleTouchDragStart$.map(function(e){return!0}),a=this._container.touchService.singleTouchDragEnd$.map(function(e){return!1});this._activeTouchSubscription=o.Observable.merge(n,a).subscribe(this._container.touchService.activate$);var s=this._navigator.stateService.currentState$.map(function(e){return e.state.currentNode.fullPano||e.state.nodesAhead<1}).distinctUntilChanged().switchMap(function(t){if(!t)return o.Observable.empty();var r=e._container.mouseService.filtered$(e._component.name,e._container.mouseService.mouseDragStart$).switchMap(function(t){return o.Observable.of(t).concat(e._container.mouseService.filtered$(e._component.name,e._container.mouseService.mouseDrag$)).merge(e._container.mouseService.filtered$(e._component.name,e._container.mouseService.mouseDragEnd$).map(function(e){return null})).takeWhile(function(e){return!!e}).startWith(null)}).pairwise().filter(function(e){return null!=e[0]&&null!=e[1]}),n=o.Observable.merge(e._container.touchService.singleTouchDragStart$,e._container.touchService.singleTouchDrag$,e._container.touchService.singleTouchDragEnd$.map(function(e){return null})).map(function(e){return null!=e&&e.touches.length>0?e.touches[0]:null}).pairwise().filter(function(e){return null!=e[0]&&null!=e[1]});return o.Observable.merge(r,n)}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,this._navigator.stateService.currentCamera$).map(function(t){var r=t[0],n=t[1],o=t[2],a=t[3].clone(),s=r[0],c=r[1],u=c.clientX-s.clientX,h=c.clientY-s.clientY,l=e._container.element,p=e._viewportCoords.canvasPosition(c,l),f=p[0],d=p[1],m=e._viewportCoords.unprojectFromCanvas(f,d,l,n.perspective).sub(n.perspective.position),v=e._viewportCoords.unprojectFromCanvas(f-u,d,l,n.perspective).sub(n.perspective.position),g=e._viewportCoords.unprojectFromCanvas(f,d-h,l,n.perspective).sub(n.perspective.position),y=(u>0?1:-1)*v.angleTo(m),b=(h>0?-1:1)*g.angleTo(m),_=(new i.Quaternion).setFromUnitVectors(a.up,new i.Vector3(0,0,1)),x=_.clone().inverse(),w=new i.Vector3;w.copy(a.lookat).sub(a.position),w.applyQuaternion(_);var S=w.length(),M=Math.atan2(w.y,w.x);M+=y;var E=Math.atan2(Math.sqrt(w.x*w.x+w.y*w.y),w.z);E+=b,E=Math.max(.01,Math.min(Math.PI-.01,E)),w.x=Math.sin(E)*Math.cos(M),w.y=Math.sin(E)*Math.sin(M),w.z=Math.cos(E),w.applyQuaternion(x);var C=(new i.Vector3).copy(a.position).add(w.multiplyScalar(S)),T=o.projectBasic(C.toArray()),O=o.projectBasic(a.lookat.toArray()),P=T[0]-O[0],j=T[1]-O[1];Math.abs(P)>1?P=0:P>.5?P-=1:P<-.5&&(P+=1);var A=e._basicRotationThreshold;if(P=e._spatial.clamp(P,-A,A),j=e._spatial.clamp(j,-A,A),o.fullPano)return[P,j];var R=e._viewportCoords.getPixelDistances(e._container.element,o,n.perspective),L=e._forceCoeff;return R[0]>0&&j<0&&T[1]<.5&&(j/=Math.max(1,L*R[0])),R[1]>0&&P>0&&T[0]>.5&&(P/=Math.max(1,L*R[1])),R[2]>0&&j>0&&T[1]>.5&&(j/=Math.max(1,L*R[2])),R[3]>0&&P<0&&T[0]<.5&&(P/=Math.max(1,L*R[3])),[P,j]}).share();this._rotateBasicWithoutInertiaSubscription=s.subscribe(function(t){e._navigator.stateService.rotateBasicWithoutInertia(t)}),this._rotateBasicSubscription=s.scan(function(t,r){return e._drainBuffer(t),t.push([Date.now(),r]),t},[]).sample(o.Observable.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$),this._container.touchService.singleTouchDragEnd$)).map(function(t){for(var r=e._drainBuffer(t.slice()),n=[0,0],i=0,o=r;i0&&(n[0]/=s,n[1]/=s),n}).subscribe(function(t){e._navigator.stateService.rotateBasic(t)})},t.prototype._disable=function(){this._activeMouseSubscription.unsubscribe(),this._activeTouchSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._rotateBasicSubscription.unsubscribe(),this._rotateBasicWithoutInertiaSubscription.unsubscribe(),this._activeMouseSubscription=null,this._activeTouchSubscription=null,this._preventDefaultSubscription=null,this._rotateBasicSubscription=null},t.prototype._getConfiguration=function(e){return{dragPan:e}},t.prototype._drainBuffer=function(e){for(var t=Date.now();e.length>0&&t-e[0][0]>50;)e.shift();return e},t}(e("../../Component").HandlerBase);r.DragPanHandler=a,r.default=a},{"../../Component":281,"rxjs/Observable":29,"rxjs/add/operator/concat":54,"rxjs/add/operator/sample":74,"rxjs/add/operator/takeWhile":84,three:231}],334:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),e("rxjs/add/observable/merge"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/withLatestFrom");var i=e("../../Component"),o=e("../../Geo"),a=function(e){function t(t,r,n){var a=e.call(this,t,r,n)||this,s=new o.Spatial,c=new o.ViewportCoords;return a._bounceHandler=new i.BounceHandler(a,r,n,c,s),a._doubleClickZoomHandler=new i.DoubleClickZoomHandler(a,r,n,c),a._dragPanHandler=new i.DragPanHandler(a,r,n,c,s),a._scrollZoomHandler=new i.ScrollZoomHandler(a,r,n,c),a._touchZoomHandler=new i.TouchZoomHandler(a,r,n,c),a}return n(t,e),Object.defineProperty(t.prototype,"doubleClickZoom",{get:function(){return this._doubleClickZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dragPan",{get:function(){return this._dragPanHandler},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollZoom",{get:function(){return this._scrollZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchZoom",{get:function(){return this._touchZoomHandler},enumerable:!0,configurable:!0}),t.prototype._activate=function(){var e=this;this._bounceHandler.enable(),this._configurationSubscription=this._configuration$.subscribe(function(t){t.doubleClickZoom?e._doubleClickZoomHandler.enable():e._doubleClickZoomHandler.disable(),t.dragPan?e._dragPanHandler.enable():e._dragPanHandler.disable(),t.scrollZoom?e._scrollZoomHandler.enable():e._scrollZoomHandler.disable(),t.touchZoom?e._touchZoomHandler.enable():e._touchZoomHandler.disable()}),this._container.mouseService.claimMouse(this._name,0)},t.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name),this._configurationSubscription.unsubscribe(),this._bounceHandler.disable(),this._doubleClickZoomHandler.disable(),this._dragPanHandler.disable(),this._scrollZoomHandler.disable(),this._touchZoomHandler.disable()},t.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:!0,dragPan:!0,scrollZoom:!0,touchZoom:!0}},t.componentName="mouse",t}(i.Component);r.MouseComponent=a,i.ComponentService.register(a),r.default=a},{"../../Component":281,"../../Geo":284,"rxjs/add/observable/merge":44,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/withLatestFrom":87}],335:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._viewportCoords=i,o}return n(t,e),t.prototype._enable=function(){var e=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$).withLatestFrom(this._navigator.stateService.currentState$,function(e,t){return[e,t]}).filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}).map(function(e){return e[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,r){return[e,t,r]}).subscribe(function(t){var r=t[0],n=t[1],i=t[2],o=e._container.element,a=e._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=e._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.deltaY;1===r.deltaMode?l*=40:2===r.deltaMode&&(l*=800);var p=-3*l/e._viewportCoords.containerToCanvas(o)[1];e._navigator.stateService.zoomIn(p,h)})},t.prototype._disable=function(){this._container.mouseService.unclaimWheel(this._component.name),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},t.prototype._getConfiguration=function(e){return{scrollZoom:e}},t}(e("../../Component").HandlerBase);r.ScrollZoomHandler=i,r.default=i},{"../../Component":281}],336:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._viewportCoords=i,o}return n(t,e),t.prototype._enable=function(){var e=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(e){e.originalEvent.preventDefault()});var t=this._container.touchService.pinchStart$.map(function(e){return!0}),r=this._container.touchService.pinchEnd$.map(function(e){return!1});this._activeSubscription=i.Observable.merge(t,r).subscribe(this._container.touchService.activate$),this._zoomSubscription=this._container.touchService.pinch$.withLatestFrom(this._navigator.stateService.currentState$).filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}).map(function(e){return e[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(t){var r=t[0],n=t[1],i=t[2],o=e._container.element,a=e._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=e._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=e._viewportCoords.containerToCanvas(o),p=l[0],f=l[1],d=3*r.distanceChange/Math.min(p,f);e._navigator.stateService.zoomIn(d,h)})},t.prototype._disable=function(){this._activeSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},t.prototype._getConfiguration=function(e){return{touchZoom:e}},t}(e("../../Component").HandlerBase);r.TouchZoomHandler=o,r.default=o},{"../../Component":281,"rxjs/Observable":29}],337:[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":338,"./popup/Popup":339}],338:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=e("rxjs/Subject"),a=e("../../Component"),s=e("../../Utils"),c=function(e){function t(t,r,n,i){var a=e.call(this,t,r,n)||this;return a._dom=i||new s.DOM,a._popups=[],a._added$=new o.Subject,a._popups$=new o.Subject,a}return n(t,e),t.prototype.add=function(e){for(var t=0,r=e;t0&&d[0]0&&d[1]u[0]&&(u[0]=w,u[1]=d,u[2]=p)}}if(u[0]>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 a.Alignment.Bottom:return"bottom";case a.Alignment.BottomLeft:return"bottom-left";case a.Alignment.BottomRight:return"bottom-right";case a.Alignment.Center:return"center";case a.Alignment.Left:return"left";case a.Alignment.Right:return"right";case a.Alignment.Top:return"top";case a.Alignment.TopLeft:return"top-left";case a.Alignment.TopRight:return"top-right";default:return null}},e.prototype._normalizeOffset=function(e){if(null==e)return this._normalizeOffset(0);if("number"==typeof e){var t=e,r=(t>=0?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]}}return{bottom:e.bottom||[0,0],"bottom-left":e.bottomLeft||[0,0],"bottom-right":e.bottomRight||[0,0],center:e.center||[0,0],left:e.left||[0,0],right:e.right||[0,0],top:e.top||[0,0],"top-left":e.topLeft||[0,0],"top-right":e.topRight||[0,0]}},e.prototype._pixelToFloats=function(e,t,r,n){var i=[];return e[1]t.height-n&&i.push("top"),e[0]t.width-r/2&&i.push("left"),i},e.prototype._pointFromRectPosition=function(e,t){var r=e[0],n=e[0]n?1:0}),t}).share(),c._tagChanged$=c._renderTags$.switchMap(function(e){return o.Observable.from(e).mergeMap(function(e){return o.Observable.merge(e.tag.changed$,e.tag.geometryChanged$)})}).share(),c._renderTagGLChanged$=c._renderTags$.switchMap(function(e){return o.Observable.from(e).mergeMap(function(e){return e.glObjectsChanged$})}).share(),c._createGeometryChanged$=c._tagCreator.tag$.switchMap(function(e){return null!=e?e.geometryChanged$:o.Observable.empty()}).share(),c._createGLObjectsChanged$=c._tagCreator.tag$.switchMap(function(e){return null!=e?e.glObjectsChanged$:o.Observable.empty()}).share(),c._creatingConfiguration$=c._configuration$.distinctUntilChanged(function(e,t){return e.mode===t.mode},function(e){return{createColor:e.createColor,mode:e.mode}}).publishReplay(1).refCount(),c._creatingConfiguration$.subscribe(function(e){c.fire(t.modechanged,e.mode)}),c}return n(t,e),t.prototype.add=function(e){var t=this;this._activated?this._navigator.stateService.currentTransform$.first().subscribe(function(r){t._tagSet.add(e,r);var n=e.map(function(e){return t._tagSet.get(e.id)});t._tagScene.add(n)}):this._tagSet.addDeactivated(e)},t.prototype.changeMode=function(e){this.configure({mode:e})},t.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)},t.prototype.getAll=function(){return this.activated?this._tagSet.getAll().map(function(e){return e.tag}):this._tagSet.getAllDeactivated()},t.prototype.getTagIdsAt=function(e){var t=this;return i.promise(function(r,n){t._container.renderService.renderCamera$.first().map(function(r){var n=t._viewportCoords.canvasToViewport(e[0],e[1],t._container.element);return t._tagScene.intersectObjects(n,r.perspective)}).subscribe(function(e){r(e)},function(e){n(e)})})},t.prototype.has=function(e){return this._activated?this._tagSet.has(e):this._tagSet.hasDeactivated(e)},t.prototype.remove=function(e){this._activated?(this._tagSet.remove(e),this._tagScene.remove(e)):this._tagSet.removeDeactivated(e)},t.prototype.removeAll=function(){this._activated?(this._tagSet.removeAll(),this._tagScene.removeAll()):this._tagSet.removeAllDeactivated()},t.prototype._activate=function(){var e=this;this._editVertexHandler.enable();var r=o.Observable.from(Object.keys(this._createHandlers)).map(function(t){return e._createHandlers[t]}).filter(function(e){return!!e}).mergeMap(function(e){return e.geometryCreated$}).share();this._fireGeometryCreatedSubscription=r.subscribe(function(r){e.fire(t.geometrycreated,r)}),this._fireCreateGeometryEventSubscription=this._tagCreator.tag$.skipWhile(function(e){return null==e}).distinctUntilChanged().subscribe(function(r){var n=null!=r?t.creategeometrystart:t.creategeometryend;e.fire(n,e)}),this._handlerStopCreateSubscription=r.subscribe(function(){e.changeMode(a.TagMode.Default)}),this._handlerEnablerSubscription=this._creatingConfiguration$.subscribe(function(t){e._disableCreateHandlers();var r=a.TagMode[t.mode],n=e._createHandlers[r];n&&n.enable()}),this._fireTagsChangedSubscription=this._renderTags$.subscribe(function(r){e.fire(t.tagschanged,e)}),this._stopCreateSubscription=this._tagCreator.tag$.switchMap(function(e){return null!=e?e.aborted$.map(function(e){return null}):o.Observable.empty()}).subscribe(function(){e.changeMode(a.TagMode.Default)}),this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(t){e._tagScene.hasCreateTag()&&e._tagScene.removeCreateTag(),null!=t&&e._tagScene.addCreateTag(t)}),this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(t){e._tagScene.updateCreateTagObjects(t)}),this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(t){e._tagScene.updateObjects(t)}),this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(t){e._tagScene.update()}),this._domSubscription=this._renderTags$.startWith([]).do(function(t){e._container.domRenderer.render$.next({name:e._name,vnode:e._tagDomRenderer.clear()})}).combineLatest(this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.startWith(null),this._tagCreator.tag$.merge(this._createGeometryChanged$).startWith(null),function(e,t,r,n,i,o){return[t,r,n,e,i,o]}).map(function(t){return{name:e._name,vnode:e._tagDomRenderer.render(t[3],t[5],t[1],t[0].perspective,t[2])}}).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.map(function(t){var r=e._tagScene;return{name:e._name,render:{frameId:t.id,needsRender:r.needsRender,render:r.render.bind(r),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$),this._navigator.stateService.currentTransform$.first().subscribe(function(t){e._tagSet.activate(t),e._tagScene.add(e._tagSet.getAll())})},t.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")},t.prototype._getDefaultConfiguration=function(){return{createColor:16777215,mode:a.TagMode.Default}},t.prototype._disableCreateHandlers=function(){var e=this._createHandlers;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];r&&r.disable()}},t.componentName="tag",t.creategeometryend="creategeometryend",t.creategeometrystart="creategeometrystart",t.modechanged="modechanged",t.geometrycreated="geometrycreated",t.tagschanged="tagschanged",t}(a.Component);r.TagComponent=u,a.ComponentService.register(u),r.default=u},{"../../Component":281,"../../Geo":284,"../../Render":287,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/empty":40,"rxjs/add/observable/from":41,"rxjs/add/observable/merge":44,"rxjs/add/observable/of":45,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/concat":54,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":75,"rxjs/add/operator/share":76,"rxjs/add/operator/skip":77,"rxjs/add/operator/skipUntil":78,"rxjs/add/operator/startWith":80,"rxjs/add/operator/switchMap":81,"rxjs/add/operator/take":82,"rxjs/add/operator/takeUntil":83,"rxjs/add/operator/withLatestFrom":87,when:278}],346:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Subject");e("rxjs/add/operator/map"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/share"),e("rxjs/add/operator/withLatestFrom");var i=e("../../Component"),o=function(){function e(e,t){this._component=e,this._navigator=t,this._tagOperation$=new n.Subject,this._createPolygon$=new n.Subject,this._createRect$=new n.Subject,this._delete$=new n.Subject,this._tag$=this._tagOperation$.scan(function(e,t){return t(e)},null).share(),this._createRect$.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$).map(function(e){var t=e[0],r=e[1],n=e[2];return function(e){var o=new i.RectGeometry([t[0],t[1],t[0],t[1]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}}).subscribe(this._tagOperation$),this._createPolygon$.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$).map(function(e){var t=e[0],r=e[1],n=e[2];return function(e){var o=new i.PolygonGeometry([[t[0],t[1]],[t[0],t[1]],[t[0],t[1]]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}}).subscribe(this._tagOperation$),this._delete$.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=o,r.default=o},{"../../Component":281,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/scan":75,"rxjs/add/operator/share":76,"rxjs/add/operator/withLatestFrom":87}],347:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("virtual-dom"),i=function(){function e(){}return e.prototype.render=function(e,t,r,i,o){for(var a=[],s=0,c=e;s1||o<0||o>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].");return r._point=t.slice(),r}return n(t,e),Object.defineProperty(t.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),t.prototype.getCentroid2d=function(){return this._point.slice()},t.prototype.getCentroid3d=function(e){return e.unprojectBasic(this._point,200)},t.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)},t}(i.Geometry);r.PointGeometry=o},{"../../../Component":281}],355:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../../Component"),o=function(e){function t(t,r){var n=e.call(this)||this,o=t.length;if(o<3)throw new i.GeometryTagError("A polygon must have three or more positions.");if(t[0][0]!==t[o-1][0]||t[0][1]!==t[o-1][1])throw new i.GeometryTagError("First and last positions must be equivalent.");n._polygon=[];for(var a=0,s=t;a1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");n._polygon.push(f.slice())}if(n._holes=[],null==r)return n;for(var c=0;c1||f[1]<0||f[1]>1)throw new i.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");n._holes[c].push(f.slice())}}return n}return n(t,e),Object.defineProperty(t.prototype,"polygon",{get:function(){return this._polygon},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"holes",{get:function(){return this._holes},enumerable:!0,configurable:!0}),t.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)},t.prototype.getVertex2d=function(e){return this._polygon[e].slice()},t.prototype.removeVertex2d=function(e){if(e<0||e>=this._polygon.length||this._polygon.length<4)throw new i.GeometryTagError("Index for removed vertex must be valid.");if(e>0&&et[3])throw new i.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var n=0,o=t;n1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}return r._anchorIndex=void 0,r._rect=t.slice(0,4),r._inverted=r._rect[0]>r._rect[2],r}return n(t,e),Object.defineProperty(t.prototype,"anchorIndex",{get:function(){return this._anchorIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inverted",{get:function(){return this._inverted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),t.prototype.initializeAnchorIndexing=function(e){if(void 0!==this._anchorIndex)throw new Error("Anchor indexing is already initialized.");if(e<0||e>3)throw new Error("Invalid anchor index: "+e+".");this._anchorIndex=void 0===e?0:e},t.prototype.terminateAnchorIndexing=function(){this._anchorIndex=void 0},t.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&&n[2]>.75&&o<-.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?0:1):!this._inverted&&this._anchorIndex>=2&&r[0]<.25&&n[2]>.75&&o<-.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?0:1):this._inverted&&this._anchorIndex>=2&&r[0]<.25&&n[0]>.75&&o<-.5?(this._inverted=!1,this._anchorIndex=i[0]>r[0]?i[1]>r[1]?3:2:i[1]>r[1]?0:1):!this._inverted&&this._anchorIndex>=2&&r[0]>.75&&n[0]<.25&&o>.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?3:2):!this._inverted&&this._anchorIndex<2&&r[0]>.75&&n[0]<.25&&o>.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?3:2):this._inverted&&this._anchorIndex<2&&r[0]>.75&&n[2]<.25&&o>.5?(this._inverted=!1,this._anchorIndex=i[0]>r[0]?i[1]>r[1]?3:2:i[1]>r[1]?0:1):this._inverted&&this._anchorIndex<2&&r[0]>n[0]?(this._inverted=!1,this._anchorIndex=i[1]>r[1]?0:1):this._inverted&&this._anchorIndex>=2&&r[0]r[1]?3:2):this._inverted?this._anchorIndex<2?this._anchorIndex=i[1]>r[1]?0:1:this._anchorIndex=i[1]>r[1]?3:2:this._anchorIndex=i[0]<=r[0]&&i[1]>r[1]?0:i[0]<=r[0]&&i[1]<=r[1]?1:i[0]>r[0]&&i[1]<=r[1]?2:3;a=[];0===this._anchorIndex?(a[0]=i[0],a[1]=r[1],a[2]=r[0],a[3]=i[1]):1===this._anchorIndex?(a[0]=i[0],a[1]=i[1],a[2]=r[0],a[3]=r[1]):2===this._anchorIndex?(a[0]=r[0],a[1]=i[1],a[2]=i[0],a[3]=r[1]):(a[0]=r[0],a[1]=r[1],a[2]=i[0],a[3]=i[1]),(!this._inverted&&a[0]>a[2]||this._inverted&&a[0]a[3]&&(a[1]=n[1],a[3]=n[3]),this._rect[0]=a[0],this._rect[1]=a[1],this._rect[2]=a[2],this._rect[3]=a[3]}else{this._anchorIndex=i[0]<=r[0]&&i[1]>r[1]?0:i[0]<=r[0]&&i[1]<=r[1]?1:i[0]>r[0]&&i[1]<=r[1]?2:3;var a=[];0===this._anchorIndex?(a[0]=i[0],a[1]=r[1],a[2]=r[0],a[3]=i[1]):1===this._anchorIndex?(a[0]=i[0],a[1]=i[1],a[2]=r[0],a[3]=r[1]):2===this._anchorIndex?(a[0]=r[0],a[1]=i[1],a[2]=i[0],a[3]=r[1]):(a[0]=r[0],a[1]=r[1],a[2]=i[0],a[3]=i[1]),a[0]>a[2]&&(a[0]=n[0],a[2]=n[2]),a[1]>a[3]&&(a[1]=n[1],a[3]=n[3]),this._rect[0]=a[0],this._rect[1]=a[1],this._rect[2]=a[2],this._rect[3]=a[3]}this._notifyChanged$.next(this)},t.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 a=e<2&&i[0]>.75&&n[0]<.25||e>=2&&this._inverted&&i[0]>.75&&n[2]<.25,s=e<2&&this._inverted&&i[0]<.25&&n[0]>.75||e>=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]);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)},t.prototype.setCentroid2d=function(e,t){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!=t.gpano&&t.gpano.CroppedAreaImageWidthPixels===t.gpano.FullPanoWidthPixels)u=this._inverted?e[0]+1-s:e[0]-s;else{var h=-n,l=1-i;u=Math.max(h,Math.min(l,e[0]-s))}var p=-o,f=1-a,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):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)},t.prototype.getPoints3d=function(e){return this._getPoints2d(e).map(function(t){return e.unprojectBasic(t,200)})},t.prototype.getVertex2d=function(e){return this._rectToVertices2d(this._rect)[e]},t.prototype.getNonAdjustedVertex2d=function(e){return this._rectToNonAdjustedVertices2d(this._rect)[e]},t.prototype.getVertex3d=function(e,t){return t.unprojectBasic(this._rectToVertices2d(this._rect)[e],200)},t.prototype.getVertices2d=function(){return this._rectToVertices2d(this._rect)},t.prototype.getVertices3d=function(e){return this._rectToVertices2d(this._rect).map(function(t){return e.unprojectBasic(t,200)})},t.prototype.getCentroid2d=function(){var e=this._rect,t=e[0],r=this._inverted?e[2]+1:e[2],n=e[1];return[t+(r-t)/2,n+(e[3]-n)/2]},t.prototype.getCentroid3d=function(e){var t=this.getCentroid2d();return e.unprojectBasic(t,200)},t.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))},t.prototype.getPoleOfAccessibility3d=function(e){var t=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return e.unprojectBasic(t,200)},t.prototype.getTriangles3d=function(e){return this._triangulate(this._rectToVertices2d(this._rect),this.getVertices3d(e))},t.prototype.validate=function(e){var t=this._rect;return!(!this._inverted&&e[0].25||e[1]4?function(e){e.stopPropagation(),v.removeVertex2d(v.polygon.length-2),r._created$.next(r)}:s,style:{transform:R=this._canvasToTransform(_)}},x=v.polygon.length>4?"TagCompleter":"TagInteractor";n.push(i.h("div."+x,m,[]))}if(v.polygon.length>3){var w=v.getVertex2d(v.polygon.length-3),S=w[0],M=w[1],E=this._viewportCoords.basicToCanvasSafe(S,M,o,this._transform,e);if(null!=E){m={onclick:function(e){e.stopPropagation(),v.removeVertex2d(v.polygon.length-3)},style:{transform:R=this._canvasToTransform(E)}};n.push(i.h("div.TagInteractor",m,[]))}}var C=v.polygon.slice();C.splice(-2,2);for(var T=0,O=C;T=1?n._createHoles():[],n._outline=n._tag.lineWidth>=1?n._createOutline():null,n._geometryChangedSubscription=n._tag.geometry.changed$.subscribe(function(e){null!=n._fill&&n._updateFillGeometry(),n._holes.length>0&&n._updateHoleGeometries(),null!=n._outline&&n._updateOulineGeometry()}),n._changedSubscription=n._tag.changed$.subscribe(function(e){var t=!1;null!=n._fill&&n._updateFillMaterial(n._fill.material),null==n._outline?n._tag.lineWidth>=1&&(n._holes=n._createHoles(),n._outline=n._createOutline(),t=!0):(n._updateHoleMaterials(),n._updateOutlineMaterial()),t&&n._glObjectsChanged$.next(n)}),n}return n(t,e),t.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline(),this._changedSubscription.unsubscribe(),this._geometryChangedSubscription.unsubscribe()},t.prototype.getDOMObjects=function(e,t,r){var n=this,i=[],s=this._tag.geometry instanceof a.RectGeometry,c=!this._transform.gpano,u={offsetHeight:r.height,offsetWidth:r.width};if(null!=this._tag.icon&&(s||c)){var h=this._tag.geometry instanceof a.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfAccessibility2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,u,this._transform,t);if(null!=f){N=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})};if(e.loaded){var d=e.getDOMSprite(this._tag.icon,this._tag.iconFloat),m={onclick:function(e){e.stopPropagation(),n._tag.click$.next(n._tag)},onmousedown:N,style:{transform:w="translate("+Math.round(f[0])+"px,"+Math.round(f[1])+"px)"}};i.push(o.h("div.TagSymbol",m,[d]))}}}else if(null!=this._tag.text&&(s||c)){var v=this._tag.geometry instanceof a.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfAccessibility2d(),g=v[0],y=v[1],b=this._viewportCoords.basicToCanvasSafe(g,y,u,this._transform,t);if(null!=b){var _=Math.round(b[0]),x=Math.round(b[1]),w=this._tag.geometry instanceof a.RectGeometry?"translate("+_+"px,"+x+"px)":"translate(-50%, -50%) translate("+_+"px,"+x+"px)",m={onmousedown:N=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})},style:{color:this._colorToCss(this._tag.textColor),transform:w},textContent:this._tag.text};i.push(o.h("span.TagSymbol",m,[]))}}if(!this._tag.editable)return i;var S=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof a.RectGeometry){var M=this._tag.geometry.getCentroid2d(),E=M[0],C=M[1],T=this._viewportCoords.basicToCanvasSafe(E,C,u,this._transform,t);if(null!=T){m={onmousedown:N=this._interact(a.TagOperation.Centroid,"move"),style:{background:S,transform:w="translate(-50%, -50%) translate("+Math.round(T[0])+"px,"+Math.round(T[1])+"px)"}};i.push(o.h("div.TagMover",m,[]))}}for(var O=this._tag.geometry.getVertices2d(),P=0;P=1&&this._tag.lineOpacity>0,e.opacity=this._tag.lineOpacity,e.transparent=this._tag.lineOpacity<1,e.needsUpdate=!0},t}(a.RenderTag);r.OutlineRenderTag=s},{"../../../Component":281,three:231,"virtual-dom":237}],368:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Subject"),o=e("../../../Component"),a=e("../../../Viewer"),s=function(e){function t(r,n,o){var s=e.call(this,r,n)||this;return o=o||{},s._editable=null!=o.editable&&o.editable,s._fillColor=null==o.fillColor?16777215:o.fillColor,s._fillOpacity=null==o.fillOpacity?0:o.fillOpacity,s._icon=void 0===o.icon?null:o.icon,s._iconFloat=null==o.iconFloat?a.Alignment.Center:o.iconFloat,s._iconIndex=null==o.iconIndex?3:o.iconIndex,s._indicateVertices=null==o.indicateVertices||o.indicateVertices,s._lineColor=null==o.lineColor?16777215:o.lineColor,s._lineOpacity=null==o.lineOpacity?1:o.lineOpacity,s._lineWidth=null==o.lineWidth?1:o.lineWidth,s._text=void 0===o.text?null:o.text,s._textColor=null==o.textColor?16777215:o.textColor,s._click$=new i.Subject,s._click$.subscribe(function(e){s.fire(t.click,s)}),s}return n(t,e),Object.defineProperty(t.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fillColor",{get:function(){return this._fillColor},set:function(e){this._fillColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(e){this._fillOpacity=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(e){this._iconFloat=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(e){this._iconIndex=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(e){this._indicateVertices=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineColor",{get:function(){return this._lineColor},set:function(e){this._lineColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(e){this._lineOpacity=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),t.prototype.setOptions=function(e){this._editable=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)},t.click="click",t}(o.Tag);r.OutlineTag=s,r.default=s},{"../../../Component":281,"../../../Viewer":292,"rxjs/Subject":34}],369:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Subject"),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":284,"rxjs/Subject":34}],370:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("virtual-dom"),o=e("../../../Component"),a=e("../../../Viewer"),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.dispose=function(){},t.prototype.getDOMObjects=function(e,t,r){var n=this,s=this._tag,c={offsetHeight:r.height,offsetWidth:r.width},u=[],h=s.geometry.getCentroid2d(),l=h[0],p=h[1],f=this._viewportCoords.basicToCanvasSafe(l,p,c,this._transform,t);if(null!=f){var d=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:o.TagOperation.None,tag:s})},m=Math.round(f[0]),v=Math.round(f[1]);if(null!=s.icon){if(e.loaded){var g=e.getDOMSprite(s.icon,a.Alignment.Bottom),y={onmousedown:d,style:{pointerEvents:"all",transform:"translate("+m+"px,"+(v+8)+"px)"}};u.push(i.h("div",y,[g]))}}else if(null!=s.text){var b="translate(-50%,0%) translate("+m+"px,"+(v+8)+"px)",y={onmousedown:d,style:{color:this._colorToCss(s.textColor),transform:b},textContent:s.text};u.push(i.h("span.TagSymbol",y,[]))}var _=this._interact(o.TagOperation.Centroid,s,"move"),x=this._colorToCss(s.color),w="translate(-50%,-50%) translate("+m+"px,"+v+"px)";if(s.editable){var S={onmousedown:_,style:{background:x,transform:w}};u.push(i.h("div.TagSpotInteractor",S,[]))}var M={style:{background:x,transform:w}};u.push(i.h("div.TagVertex",M,[]))}return u},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(e,t,r,n){var i=this;return function(o){var a=o.offsetX-o.target.offsetWidth/2,s=o.offsetY-o.target.offsetHeight/2;i._interact$.next({cursor:r,offsetX:a,offsetY:s,operation:e,tag:t,vertexIndex:n})}},t}(o.RenderTag);r.SpotRenderTag=s},{"../../../Component":281,"../../../Viewer":292,"virtual-dom":237}],371:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(t,r,n){var i=e.call(this,t,r)||this;return n=n||{},i._color=null==n.color?16777215:n.color,i._editable=null!=n.editable&&n.editable,i._icon=void 0===n.icon?null:n.icon,i._text=void 0===n.text?null:n.text,i._textColor=null==n.textColor?16777215:n.textColor,i}return n(t,e),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(e){this._color=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),t.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)},t}(e("../../../Component").Tag);r.SpotTag=i,r.default=i},{"../../../Component":281}],372:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Subject");e("rxjs/add/operator/map"),e("rxjs/add/operator/share");var o=function(e){function t(r,n){var o=e.call(this)||this;return o._id=r,o._geometry=n,o._notifyChanged$=new i.Subject,o._notifyChanged$.subscribe(function(e){o.fire(t.changed,o)}),o._geometry.changed$.subscribe(function(e){o.fire(t.geometrychanged,o)}),o}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometryChanged$",{get:function(){var e=this;return this._geometry.changed$.map(function(t){return e}).share()},enumerable:!0,configurable:!0}),t.changed="changed",t.geometrychanged="geometrychanged",t}(e("../../../Utils").EventEmitter);r.Tag=o,r.default=o},{"../../../Utils":291,"rxjs/Subject":34,"rxjs/add/operator/map":65,"rxjs/add/operator/share":76}],373:[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},{}],374:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(t){var r=e.call(this,null!=t?t:"The argument is not valid.")||this;return r.name="ArgumentMapillaryError",r}return n(t,e),t}(e("./MapillaryError").MapillaryError);r.ArgumentMapillaryError=i,r.default=i},{"./MapillaryError":376}],375:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(t){var r=e.call(this,t)||this;return r.name="GraphMapillaryError",r}return n(t,e),t}(e("./MapillaryError").MapillaryError);r.GraphMapillaryError=i,r.default=i},{"./MapillaryError":376}],376:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(t){var r=e.call(this,t)||this;return r.name="MapillaryError",r}return n(t,e),t}(Error);r.MapillaryError=i,r.default=i},{}],377:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=function(){function e(e){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._focal=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),this._focal=1)}return Object.defineProperty(e.prototype,"position",{get:function(){return this._position},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lookat",{get:function(){return this._lookat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"up",{get:function(){return this._up},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focal",{get:function(){return this._focal},set:function(e){this._focal=e},enumerable:!0,configurable:!0}),e.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},e.prototype.copy=function(e){this._position.copy(e.position),this._lookat.copy(e.lookat),this._up.copy(e.up),this._focal=e.focal},e.prototype.clone=function(){var t=new e;return t.position.copy(this._position),t.lookat.copy(this._lookat),t.up.copy(this._up),t.focal=this._focal,t},e.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)},e.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))},e}();r.Camera=i},{three:231}],378:[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 a=this.geodeticToEcef(e,t,r);return this.ecefToEnu(a[0],a[1],a[2],n,i,o)},e.prototype.enuToGeodetic=function(e,t,r,n,i,o){var a=this.enuToEcef(e,t,r,n,i,o);return this.ecefToGeodetic(a[0],a[1],a[2])},e.prototype.ecefToEnu=function(e,t,r,n,i,o){var a=this.geodeticToEcef(n,i,o),s=[e-a[0],t-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);return[-l*s[0]+h*s[1],-u*h*s[0]-u*l*s[1]+c*s[2],c*h*s[0]+c*l*s[1]+u*s[2]]},e.prototype.enuToEcef=function(e,t,r,n,i,o){var a=this.geodeticToEcef(n,i,o);n=n*Math.PI/180,i=i*Math.PI/180;var s=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i);return[-h*e-c*u*t+s*u*r+a[0],u*e-c*h*t+s*h*r+a[1],s*t+c*r+a[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),a=Math.sin(e),s=Math.cos(t),c=Math.sin(t),u=n*n,h=i*i,l=1/Math.sqrt(u*o*o+h*a*a),p=(u*l+r)*o;return[p*s,p*c,(h*l+r)*a]},e.prototype.ecefToGeodetic=function(e,t,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(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},{}],379:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=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 n.Vector3(e[0],e[1],e[2]),r=t.length();return r>0&&t.normalize(),(new n.Matrix4).makeRotationAxis(t,r)},e.prototype.rotate=function(e,t){var r=new n.Vector3(e[0],e[1],e[2]),i=this.rotationMatrix(t);return r.applyMatrix4(i),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(rr||er?e-=n:er?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;return Math.acos((i[0]+i[5]+i[10]-1)/2)},e.prototype.angleToPlane=function(e,t){var r=(new n.Vector3).fromArray(e),i=r.length();if(i.01&&this._scale<50},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 n.Vector3(-e[1],-e[5],-e[9]);case 3:return new n.Vector3(e[1],e[5],e[9]);case 6:return new n.Vector3(-e[0],-e[4],-e[8]);case 8:return new n.Vector3(e[0],e[4],e[8]);default:return new n.Vector3(-e[1],-e[5],-e[9])}},e.prototype.projectorMatrix=function(){var e=this._normalizedToTextureMatrix(),t=this._focal,r=(new n.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){var r=this._basicToSfm(e);return this.unprojectSfM(r,t)},e.prototype.projectSfM=function(e){var t=new n.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){var r=this._sfmToBearing(e),i=new n.Vector4(t*r[0],t*r[1],t*r[2],1);return i.applyMatrix4((new n.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[a=Math.cos(r)*Math.sin(t),s=-Math.sin(r),c=Math.cos(r)*Math.cos(t)]}if(this._gpano){var i=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),o=[e[0]*i+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,e[1]*i+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels],t=2*Math.PI*(o[0]/this.gpano.FullPanoWidthPixels-.5),r=-Math.PI*(o[1]/this.gpano.FullPanoHeightPixels-.5),a=Math.cos(r)*Math.sin(t),s=-Math.sin(r),c=Math.cos(r)*Math.cos(t);return[a,s,c]}var u=new n.Vector3(e[0],e[1],this._focal);return u.normalize(),[u.x,u.y,u.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){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)),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 e[2]>0?[e[0]*this._focal/e[2],e[1]*this._focal/e[2]]:[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),a=(e[0]+n/o/2)/n*o,s=(e[1]+i/o/2)/i*o;switch(this._orientation){case 1:t=a,r=s;break;case 3:t=1-a,r=1-s;break;case 6:t=1-s,r=a;break;case 8:t=s,r=1-a;break;default:t=a,r=s}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&&e>0?e:t},e.prototype._getRt=function(e,t){var r=new n.Vector3(e[0],e[1],e[2]),i=r.length();i>0&&r.normalize();var o=new n.Matrix4;return o.makeRotationAxis(r,i),o.setPosition(new n.Vector3(t[0],t[1],t[2])),o},e.prototype._getSrt=function(e,t){var r=e.clone(),i=r.elements;return i[12]=t*i[12],i[13]=t*i[13],i[14]=t*i[14],r.scale(new n.Vector3(t,t,t)),r},e.prototype._normalizedToTextureMatrix=function(){var e=Math.max(this._width,this._height),t=e/this._width,r=e/this._height;switch(this._orientation){case 1:return(new n.Matrix4).set(t,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1);case 3:return(new n.Matrix4).set(-t,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,-t,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new n.Matrix4).set(0,r,0,.5,t,0,0,.5,0,0,1,0,0,0,0,1);default:return(new n.Matrix4).set(t,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1)}},e}();r.Transform=i},{three:231}],381:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=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=n.unprojectBasic([e,t],this._unprojectDepth),a=this.worldToCamera(o,i);if(a[2]>0)return null;var s=this.cameraToViewport(a,i),c=s[0],u=s[1];return this.viewportToCanvas(c,u,r)},e.prototype.basicToViewport=function(e,t,r,n){var i=r.unprojectBasic([e,t],this._unprojectDepth);return this.projectToViewport(i,n)},e.prototype.cameraToViewport=function(e,t){var r=(new n.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),a=0,s=0,c=0,u=0;return r[1]<0&&n[1]<0&&(a=r[1]>n[1]?-r[1]:-n[1]),n[0]>1&&i[0]>1&&(s=n[0]1&&o[1]>1&&(c=i[1]r[0]?-o[0]:-r[0]),[a,s,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),a=this.viewportToBasic(-1,-1,t,r),s=0,c=0,u=0,h=0,l=this.containerToCanvas(e),p=l[0],f=l[1];if(n[1]<0&&i[1]<0){d=n[1]>i[1]?n[0]:i[0];s=(v=this.basicToCanvas(d,0,e,t,r))[1]>0?v[1]:0}if(i[0]>1&&o[0]>1){m=i[0]1&&a[1]>1){var d=o[1]n[0]?a[1]:n[1],v=this.basicToCanvas(0,m,e,t,r);h=v[0]>0?v[0]:0}return[s,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,a=o+t.clientHeight;return e.clientX>n&&e.clientXo&&e.clientY"===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 et?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},{}],383:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rbush"),i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/from"),e("rxjs/add/operator/catch"),e("rxjs/add/operator/do"),e("rxjs/add/operator/finally"),e("rxjs/add/operator/map"),e("rxjs/add/operator/publish");var a=e("../Edge"),s=e("../Error"),c=e("../Graph"),u=function(){function e(e,t,r,i,s,u){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 o.Subject,this._defaultAlt=2,this._edgeCalculator=null!=i?i:new a.EdgeCalculator,this._filterCreator=null!=s?s:new c.FilterCreator,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=r?r:new c.GraphCalculator,this._configuration=null!=u?u:{maxSequences:50,maxUnusedNodes:100,maxUnusedPreStoredNodes:30,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=t?t:n(16,[".lat",".lon",".lat",".lon"]),this._nodeIndexTiles={},this._nodeToTile={},this._preStored={},this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._tilePrecision=7,this._tileThreshold=20}return Object.defineProperty(e.prototype,"changed$",{get:function(){return this._changed$},enumerable:!0,configurable:!0}),e.prototype.cacheFill$=function(e){var t=this;if(e in this._cachingFull$)throw new s.GraphMapillaryError("Cannot fill node while caching full ("+e+").");if(!this.hasNode(e))throw new s.GraphMapillaryError("Cannot fill node that does not exist in graph ("+e+").");if(e in this._cachingFill$)return this._cachingFill$[e];var r=this.getNode(e);if(r.full)throw new s.GraphMapillaryError("Cannot fill node that is already full ("+e+").");return this._cachingFill$[e]=this._apiV3.imageByKeyFill$([e]).do(function(n){r.full||t._makeFull(r,n[e]),delete t._cachingFill$[e]}).map(function(e){return t}).finally(function(){e in t._cachingFill$&&delete t._cachingFill$[e],t._changed$.next(t)}).publish().refCount(),this._cachingFill$[e]},e.prototype.cacheFull$=function(e){var t=this;if(e in this._cachingFull$)return this._cachingFull$[e];if(this.hasNode(e))throw new s.GraphMapillaryError("Cannot cache full node that already exist in graph ("+e+").");return this._cachingFull$[e]=this._apiV3.imageByKeyFull$([e]).do(function(r){var n=r[e];if(t.hasNode(e)){(i=t.getNode(e)).full||t._makeFull(i,n)}else{if(null==n.sequence||null==n.sequence.key)throw new s.GraphMapillaryError("Node has no sequence ("+e+").");var i=new c.Node(n);t._makeFull(i,n);var o=t._graphCalculator.encodeH(i.originalLatLon,t._tilePrecision);t._preStore(o,i),t._setNode(i),delete t._cachingFull$[e]}}).map(function(e){return t}).finally(function(){e in t._cachingFull$&&delete t._cachingFull$[e],t._changed$.next(t)}).publish().refCount(),this._cachingFull$[e]},e.prototype.cacheNodeSequence$=function(e){if(!this.hasNode(e))throw new s.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 s.GraphMapillaryError("Sequence already cached ("+e+"), ("+t.sequenceKey+").");return this._cacheSequence$(t.sequenceKey)},e.prototype.cacheSequence$=function(e){if(e in this._sequences)throw new s.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 s.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 r=this;if(!this.hasSequence(e))throw new s.GraphMapillaryError("Cannot cache sequence nodes of sequence that does not exist in graph ("+e+").");if(this.hasSequenceNodes(e))throw new s.GraphMapillaryError("Sequence nodes already cached ("+e+").");var n=this.getSequence(e);if(n.key in this._cachingSequenceNodes$)return this._cachingSequenceNodes$[n.key];var o=[],a=n.keys.slice();if(t){var u=a.indexOf(t);if(-1!==u)for(var h=0,l=[20,40];h0){var f=u===a.length-1?1:0,d=a.splice(Math.max(0,u+f-p),p);o.push(d),u-=d.length}}}for(;a.length>0;)o.push(a.splice(0,200));var m=o.length,v=i.Observable.from(o).mergeMap(function(e){return r._apiV3.imageByKeyFull$(e).do(function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];if(r.hasNode(t)){(i=r.getNode(n.key)).full||r._makeFull(i,n)}else{null!=n.sequence&&null!=n.sequence.key||console.warn("Sequence missing, discarding ("+n.key+")");var i=new c.Node(n);r._makeFull(i,n);var o=r._graphCalculator.encodeH(i.originalLatLon,r._tilePrecision);r._preStore(o,i),r._setNode(i)}}m--}).map(function(e){return r})},6).last().finally(function(){delete r._cachingSequenceNodes$[n.key],0===m&&(r._cachedSequenceNodes[n.key]=!0)}).publish().refCount();return this._cachingSequenceNodes$[n.key]=v,v},e.prototype.cacheSpatialArea$=function(e){var t=this;if(!this.hasNode(e))throw new s.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+e+").");if(e in this._cachedSpatialEdges)throw new s.GraphMapillaryError("Node already spatially cached ("+e+").");if(!(e in this._requiredSpatialArea))throw new s.GraphMapillaryError("Spatial area not determined ("+e+").");var r=this._requiredSpatialArea[e];if(0===Object.keys(r.cacheNodes).length)throw new s.GraphMapillaryError("Spatial nodes already cached ("+e+").");if(e in this._cachingSpatialArea$)return this._cachingSpatialArea$[e];for(var n=[];r.cacheKeys.length>0;)n.push(r.cacheKeys.splice(0,200));for(var i=n.length,o=[],a=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];t._makeFull(a,s),delete r.cacheNodes[o]}}0==--i&&delete t._cachingSpatialArea$[e]}).map(function(e){return t}).catch(function(o){for(var a=0,s=n;a-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete t._requiredNodeTiles[e],t._cachedNodeTiles[e]=!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 t._requiredNodeTiles[e],t._cachedNodeTiles[e]=!0),i}).finally(function(){t._changed$.next(t)}).publish().refCount())},a=this,u=0,h=r.caching;u0},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 s.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});i0&&(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);e0},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,"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,"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).map(function(t){return e})},e.prototype.cacheImage$=function(e){var t=this;return this._cache.cacheImage$(this.key,e).map(function(e){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=n,r.default=n},{"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/map":65}],390:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Subject"),i=e("rxjs/Observable");e("rxjs/add/observable/combineLatest"),e("rxjs/add/operator/publishReplay");var o=e("../Graph"),a=e("../Utils"),s=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._sequenceEdgesChanged$=new n.Subject,this._sequenceEdges$=this._sequenceEdgesChanged$.startWith(this._sequenceEdges).publishReplay(1).refCount(),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){}),this._spatialEdgesChanged$=new n.Subject,this._spatialEdges$=this._spatialEdgesChanged$.startWith(this._spatialEdges).publishReplay(1).refCount(),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){}),this._cachingAssets$=null}return Object.defineProperty(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 o=t?a.Settings.basePanoramaSize:a.Settings.baseImageSize;return this._cachingAssets$=i.Observable.combineLatest(this._cacheImage$(e,o),this._cacheMesh$(e,r),function(e,t){return n._loadStatus.loaded=0,n._loadStatus.total=0,t&&(n._mesh=t.object,n._loadStatus.loaded+=t.loaded.loaded,n._loadStatus.total+=t.loaded.total),e&&(n._image=e.object,n._loadStatus.loaded+=e.loaded.loaded,n._loadStatus.total+=e.loaded.total),n}).finally(function(){n._cachingAssets$=null}).publishReplay(1).refCount(),this._cachingAssets$},e.prototype.cacheImage$=function(e,t){var r=this;return null!=this._image&&t<=Math.max(this._image.width,this._image.height)?i.Observable.of(this):this._cacheImage$(e,t).first(function(e){return null!=e.object}).do(function(e){r._disposeImage(),r._image=e.object}).map(function(e){return r})},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._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges),this._disposed=!0,null!=this._imageRequest&&this._imageRequest.abort(),null!=this._meshRequest&&this._meshRequest.abort()},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(e,t){var r=this;return i.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",a.Urls.thumbnail(e,t),!0),i.responseType="arraybuffer",i.timeout=15e3,i.onload=function(t){if(200!==i.status)return r._imageRequest=null,void n.error(new Error("Failed to fetch image ("+e+"). Status: "+i.status+", "+i.statusText));var o=new Image;o.crossOrigin="Anonymous",o.onload=function(i){if(r._imageRequest=null,r._disposed)return window.URL.revokeObjectURL(o.src),void n.error(new Error("Image load was aborted ("+e+")"));n.next({loaded:{loaded:t.loaded,total:t.total},object:o}),n.complete()},o.onerror=function(t){r._imageRequest=null,n.error(new Error("Failed to load image ("+e+")"))};var a=new Blob([i.response]);o.src=window.URL.createObjectURL(a)},i.onprogress=function(e){r._disposed||n.next({loaded:{loaded:e.loaded,total:e.total},object:null})},i.onerror=function(t){r._imageRequest=null,n.error(new Error("Failed to fetch image ("+e+")"))},i.ontimeout=function(t){r._imageRequest=null,n.error(new Error("Image request timed out ("+e+")"))},i.onabort=function(t){r._imageRequest=null,n.error(new Error("Image request was aborted ("+e+")"))},r._imageRequest=i,i.send(null)})},e.prototype._cacheMesh$=function(e,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(e),!0),s.responseType="arraybuffer",s.timeout=15e3,s.onload=function(e){if(n._meshRequest=null,!n._disposed){var r=200===s.status?o.MeshReader.read(new t(s.response)):{faces:[],vertices:[]};i.next({loaded:{loaded:e.loaded,total:e.total},object:r}),i.complete()}},s.onprogress=function(e){n._disposed||i.next({loaded:{loaded:e.loaded,total:e.total},object:null})},s.onerror=function(t){n._meshRequest=null,console.error("Failed to cache mesh ("+e+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},s.ontimeout=function(t){n._meshRequest=null,console.error("Mesh request timed out ("+e+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},s.onabort=function(t){n._meshRequest=null,i.error(new Error("Mesh request was aborted ("+e+")"))},n._meshRequest=s,s.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=s,r.default=s}).call(this,e("buffer").Buffer)},{"../Graph":285,"../Utils":291,buffer:7,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/publishReplay":72}],391:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("underscore"),i=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=n.indexOf(this._keys,e);return t+1>=this._keys.length||-1===t?null:this._keys[t+1]},e.prototype.findPrevKey=function(e){var t=n.indexOf(this._keys,e);return 0===t||-1===t?null:this._keys[t-1]},e}();r.Sequence=i,r.default=i},{underscore:233}],392:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("../../Edge"),o=e("../../Error"),a=e("../../Geo"),s=function(){function e(e,t,r){this._spatial=new a.Spatial,this._geoCoords=new a.GeoCoords,this._settings=null!=e?e:new i.EdgeCalculatorSettings,this._directions=null!=t?t:new i.EdgeCalculatorDirections,this._coefficients=null!=r?r:new i.EdgeCalculatorCoefficients}return e.prototype.getPotentialEdges=function(e,t,r){if(!e.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(!e.merged)return[];for(var i=this._spatial.viewingDirection(e.rotation),a=this._spatial.angleToPlane(i.toArray(),[0,0,1]),s=[],c=0,u=t;cthis._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])-a,b=this._spatial.relativeRotationAngle(e.rotation,h.rotation),_=this._spatial.angleBetweenVector2(1,0,p.x,p.y),x=null!=h.sequenceKey&&null!=e.sequenceKey&&h.sequenceKey===e.sequenceKey,w=null==h.mergeCC&&null==e.mergeCC||h.mergeCC===e.mergeCC,S=h.userKey===e.userKey,M={capturedAt:h.capturedAt,croppedPano:h.pano&&!h.fullPano,directionChange:g,distance:f,fullPano:h.fullPano,key:h.key,motionChange:d,rotation:b,sameMergeCC:w,sameSequence:x,sameUser:S,sequenceKey:h.sequenceKey,verticalDirectionChange:y,verticalMotion:m,worldMotionAzimuth:_};s.push(M)}}}return s},e.prototype.computeSequenceEdges=function(e,t){if(!e.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(e.sequenceKey!==t.key)throw new o.ArgumentMapillaryError("Node and sequence does not correspond.");var r=[],n=t.findNextKey(e.key);null!=n&&r.push({data:{direction:i.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:e.key,to:n});var a=t.findPrevKey(e.key);return null!=a&&r.push({data:{direction:i.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:e.key,to:a}),r},e.prototype.computeSimilarEdges=function(e,t){var r=this;if(!e.full)throw new o.ArgumentMapillaryError("Node has to be full.");for(var n=e.fullPano,a={},s=0,c=t;sthis._settings.similarMaxDirectionChange)continue;v.distance>this._settings.similarMaxDistance||v.sameUser&&Math.abs(v.capturedAt-e.capturedAt)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);ythis._settings.turnMaxDistance)){var p=a.direction!==i.EdgeDirection.TurnU&&l.distancethis._settings.turnMinRigDirectionChange,f=this._spatial.angleDifference(a.directionChange,l.directionChange),d=void 0;if(p&&l.directionChange*a.directionChange>0&&Math.abs(l.directionChange)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)}dthis._settings.panoMaxDistance))if(w.fullPano){if(w.distancethis._settings.panoMaxStepTurnChange)){a.push([h.direction,w]);break}}}}for(var f=Math.PI/this._settings.panoMaxItems,d=[],m=[],v=0;vf)){for(var M=Number.MAX_VALUE,E=0,C=d;Ef)){for(var F=Number.MAX_VALUE,B=0,U=N;B0&&e.elementWidth>0&&e.elementHeight>0}).map(function(e){var t=e.elementWidth/e.elementHeight,r=e.imageAspect/t,n=0,i=0;return e.renderMode===a.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$.filter(function(e){return null!=e.state.currentNode}).distinctUntilChanged(function(e,t){return e===t},function(e){return e.state.currentNode.key}).map(function(e){return e.state.currentTransform.basicAspect}).map(function(e){return function(t){return t.imageAspect=e,t}}).subscribe(this._adaptiveOperation$),this._renderAdaptive$.scan(function(e,t){return null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e},{}).combineLatest(this._offset$).map(function(e){var t=n.values(e[0]),r=e[1],o={style:{bottom:r.bottom+"px",left:r.left+"px","pointer-events":"none",position:"absolute",right:r.right+"px",top:r.top+"px"}};return{name:"adaptiveDomRenderer",vnode:i.h("div.adaptiveDomRenderer",o,t)}}).subscribe(this._render$),this._vNode$=this._render$.scan(function(e,t){return null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e},{}).map(function(e){var t=n.values(e);return i.h("div.domRenderer",t)}),this._vPatch$=this._vNode$.scan(function(e,t){return e.vpatch=i.diff(e.vnode,t),e.vnode=t,e},{vnode:i.h("div.domRenderer",[]),vpatch:null}).pluck("vpatch"),this._element$=this._vPatch$.scan(function(e,t){return i.patch(e,t)},s).publishReplay(1).refCount(),this._element$.subscribe(function(){}),this._renderService.size$.map(function(e){return function(t){return t.elementWidth=e.width,t.elementHeight=e.height,t}}).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.map(function(e){return function(t){return t.renderMode=e,t}}).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=s,r.default=s},{"../Render":287,"rxjs/Subject":34,"rxjs/add/operator/combineLatest":53,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/pluck":70,"rxjs/add/operator/scan":75,underscore:233,"virtual-dom":237}],398:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground"}(n=r.GLRenderStage||(r.GLRenderStage={})),r.default=n},{}],399:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/combineLatest"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/mergeMap"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/share"),e("rxjs/add/operator/startWith");var a=e("../Render"),s=e("../Utils"),c=function(){function e(e,t,r){var c=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._dom=r||new s.DOM,this._renderer$=this._rendererOperation$.scan(function(e,t){return t(e)},{needsRender:!1,renderer:null}),this._renderCollection$=this._renderOperation$.scan(function(e,t){return t(e)},{}).share(),this._renderCamera$=this._renderCameraOperation$.scan(function(e,t){return t(e)},{frameId:-1,needsRender:!1,perspective:null}),this._eraser$=this._eraserOperation$.startWith(function(e){return e}).scan(function(e,t){return t(e)},{needsRender:!1}),i.Observable.combineLatest([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],function(e,t,r,n){return{camera:r,eraser:n,renderer:e,renders:Object.keys(t).map(function(e){return t[e]})}}).filter(function(e){for(var t=e.renderer.needsRender||e.camera.needsRender||e.eraser.needsRender,r=e.camera.frameId,n=0,i=e.renders;nr:e1e-9){var i=t.state.currentTransform,o=null!=t.state.previousTransform?t.state.previousTransform:t.state.currentTransform,a=null!=t.state.previousNode?t.state.previousNode:t.state.currentNode;r.currentAspect=i.basicAspect,r.currentPano=t.state.currentNode.pano,r.previousAspect=o.basicAspect,r.previousPano=a.pano,r.alpha=t.state.alpha,r.zoom=t.state.zoom,r.camera.copy(n),r.updatePerspective(n),r.updateRotation(n),r.updateProjection()}r.frameId=t.id}).map(function(e){return e[1]}).publishReplay(1).refCount(),this._renderCamera$=this._renderCameraFrame$.filter(function(e){return e.changed}).publishReplay(1).refCount(),this._bearing$=this._renderCamera$.map(function(e){var t=s._spatial.radToDeg(s._spatial.azimuthalToBearing(e.rotation.phi));return s._spatial.wrap(t,0,360)}).publishReplay(1).refCount(),this._size$.skip(1).map(function(e){return function(t){return t.updateAspect(e.width,e.height),t.updateProjection(),t}}).subscribe(this._renderCameraOperation$),this._renderMode$.skip(1).map(function(e){return function(t){return t.renderMode=e,t.updateProjection(),t}}).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=s,r.default=s},{"../Geo":284,"../Render":287,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":75,"rxjs/add/operator/skip":77,"rxjs/add/operator/startWith":80,"rxjs/add/operator/withLatestFrom":87}],403:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(e){e[e.Traversing=0]="Traversing",e[e.Waiting=1]="Waiting"}(n=r.State||(r.State={})),r.default=n},{}],404:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../State"),i=e("../Geo"),o=function(){function e(){this._state=new n.TraversingState({alpha:1,camera:new i.Camera,currentIndex:-1,reference:{alt:0,lat:0,lon:0},trajectory:[],zoom:0})}return e.prototype.traverse=function(){this._state=this._state.traverse()},e.prototype.wait=function(){this._state=this._state.wait()},Object.defineProperty(e.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(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.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}();r.StateContext=o},{"../Geo":284,"../State":288}],405:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/BehaviorSubject"),i=e("rxjs/Subject"),o=e("rxjs/util/AnimationFrame");e("rxjs/add/operator/bufferCount"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/do"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/pairwise"),e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/startWith"),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/withLatestFrom");var a=e("../State"),s=function(){function e(){var e=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(e){return e}),this._context$=this._contextOperation$.scan(function(e,t){return t(e)},new a.StateContext).publishReplay(1).refCount(),this._state$=this._context$.map(function(e){return e.state}).distinctUntilChanged().publishReplay(1).refCount(),this._fps$=this._start$.switchMap(function(){return e._frame$.bufferCount(1,e._fpsSampleRate).map(function(e){return(new Date).getTime()}).pairwise().map(function(t){return Math.max(20,1e3*e._fpsSampleRate/(t[1]-t[0]))}).startWith(60)}).share(),this._currentState$=this._frame$.withLatestFrom(this._fps$,this._context$,function(e,t,r){return[e,t,r]}).filter(function(e){return null!=e[2].currentNode}).do(function(e){e[2].update(e[1])}).map(function(e){return{fps:e[1],id:e[0],state:e[2]}}).share(),this._lastState$=this._currentState$.publishReplay(1).refCount();var t=this._currentState$.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}).publishReplay(1).refCount(),r=new i.Subject;t.subscribe(r),this._currentKey$=new n.BehaviorSubject(null),r.map(function(e){return e.state.currentNode.key}).subscribe(this._currentKey$),this._currentNode$=r.map(function(e){return e.state.currentNode}).publishReplay(1).refCount(),this._currentCamera$=r.map(function(e){return e.state.currentCamera}).publishReplay(1).refCount(),this._currentTransform$=r.map(function(e){return e.state.currentTransform}).publishReplay(1).refCount(),this._reference$=r.map(function(e){return e.state.reference}).distinctUntilChanged(function(e,t){return e.lat===t.lat&&e.lon===t.lon},function(e){return{lat:e.lat,lon:e.lon}}).publishReplay(1).refCount(),this._currentNodeExternal$=t.map(function(e){return e.state.currentNode}).publishReplay(1).refCount(),this._appendNode$.map(function(e){return function(t){return t.append([e]),t}}).subscribe(this._contextOperation$),this._inMotionOperation$=new i.Subject,t.map(function(e){return!0}).subscribe(this._inMotionOperation$),this._inMotionOperation$.distinctUntilChanged().filter(function(e){return e}).switchMap(function(t){return e._currentState$.filter(function(e){return 0===e.state.nodesAhead}).map(function(e){return[e.state.camera.clone(),e.state.zoom]}).pairwise().map(function(e){var t=e[0][0],r=e[1][0],n=e[0][1],i=e[1][1];return t.diff(r)>1e-5||Math.abs(n-i)>1e-5}).first(function(e){return!e})}).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._inTranslationOperation$=new i.Subject,t.map(function(e){return!0}).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.distinctUntilChanged().filter(function(e){return e}).switchMap(function(t){return e._currentState$.filter(function(e){return 0===e.state.nodesAhead}).map(function(e){return e.state.camera.position.clone()}).pairwise().map(function(e){return 0!==e[0].distanceToSquared(e[1])}).first(function(e){return!e})}).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._state$.subscribe(function(){}),this._currentNode$.subscribe(function(){}),this._currentCamera$.subscribe(function(){}),this._currentTransform$.subscribe(function(){}),this._reference$.subscribe(function(){}),this._currentNodeExternal$.subscribe(function(){}),this._lastState$.subscribe(function(){}),this._inMotion$.subscribe(function(){}),this._inTranslation$.subscribe(function(){}),this._frameId=null,this._frameGenerator=new o.RequestAnimationFrameDefinition(window)}return Object.defineProperty(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.traverse=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.traverse()})},e.prototype.wait=function(){this._invokeContextOperation(function(e){e.wait()})},e.prototype.appendNodes=function(e){this._invokeContextOperation(function(t){t.append(e)})},e.prototype.prependNodes=function(e){this._invokeContextOperation(function(t){t.prepend(e)})},e.prototype.removeNodes=function(e){this._invokeContextOperation(function(t){t.remove(e)})},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(e){this._invokeContextOperation(function(t){t.set(e)})},e.prototype.rotate=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotate(e)})},e.prototype.rotateBasic=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateBasic(e)})},e.prototype.rotateBasicUnbounded=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateBasicUnbounded(e)})},e.prototype.rotateBasicWithoutInertia=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateBasicWithoutInertia(e)})},e.prototype.rotateToBasic=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateToBasic(e)})},e.prototype.move=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.move(e)})},e.prototype.moveTo=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.moveTo(e)})},e.prototype.zoomIn=function(e,t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(r){r.zoomIn(e,t)})},e.prototype.getCenter=function(){return this._lastState$.first().map(function(e){return e.state.getCenter()})},e.prototype.getZoom=function(){return this._lastState$.first().map(function(e){return e.state.zoom})},e.prototype.setCenter=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.setCenter(e)})},e.prototype.setSpeed=function(e){this._invokeContextOperation(function(t){t.setSpeed(e)})},e.prototype.setZoom=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.setZoom(e)})},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(e){this._contextOperation$.next(function(t){return e(t),t})},e.prototype._frame=function(e){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)},e}();r.StateService=s},{"../State":288,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/bufferCount":50,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/do":59,"rxjs/add/operator/filter":61,"rxjs/add/operator/first":63,"rxjs/add/operator/map":65,"rxjs/add/operator/pairwise":69,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":75,"rxjs/add/operator/startWith":80,"rxjs/add/operator/switchMap":81,"rxjs/add/operator/withLatestFrom":87,"rxjs/util/AnimationFrame":208}],406:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../../Error"),i=e("../../Geo"),o=function(){function e(e){this._spatial=new i.Spatial,this._geoCoords=new i.GeoCoords,this._referenceThreshold=.01,this._reference=e.reference,this._alpha=e.alpha,this._camera=e.camera.clone(),this._zoom=e.zoom,this._currentIndex=e.currentIndex,this._trajectory=e.trajectory.slice(),this._trajectoryTransforms=[],this._trajectoryCameras=[];for(var t=0,r=this._trajectory;t0?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(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 this._trajectoryTransforms.length>0?this._trajectoryTransforms[this.currentIndex]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousTransform",{get:function(){return this._trajectoryTransforms.length>1&&this.currentIndex>0?this._trajectoryTransforms[this.currentIndex-1]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"motionless",{get:function(){return this._motionless},enumerable:!0,configurable:!0}),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-10&&this.remove(this._currentIndex-1)},e.prototype.clear=function(){this.cut(),this._currentIndex>0&&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._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=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()},e.prototype._motionlessTransition=function(){return null!=this._currentNode&&null!=this._previousNode&&!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent())},e.prototype._setReference=function(e){return!(Math.abs(e.latLon.lat-this.reference.lat)0?this._trajectory[this._currentIndex]:null,this._previousNode=this._currentIndex>0?this._trajectory[this._currentIndex-1]:null},e.prototype._setTrajectory=function(e){if(e.length<1)throw new n.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;te?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}(),c=function(e){function t(t){var r=e.call(this,t)||this;return r._adjustCameras(),r._motionless=r._motionlessTransition(),r._baseAlpha=r._alpha,r._animationSpeed=.025,r._speedCoefficient=1,r._unitBezier=new o(.74,.67,.38,.96),r._useBezier=!1,r._rotationDelta=new s(0,0),r._requestedRotationDelta=null,r._basicRotation=[0,0],r._requestedBasicRotation=null,r._requestedBasicRotationUnbounded=null,r._rotationAcceleration=.86,r._rotationIncreaseAlpha=.97,r._rotationDecreaseAlpha=.9,r._rotationThreshold=.001,r._unboundedRotationAlpha=.8,r._desiredZoom=t.zoom,r._minZoom=0,r._maxZoom=3,r._lookatDepth=10,r._desiredLookat=null,r._desiredCenter=null,r}return n(t,e),t.prototype.traverse=function(){throw new Error("Not implemented")},t.prototype.wait=function(){return new a.WaitingState(this)},t.prototype.append=function(t){var r=0===this._trajectory.length;r&&this._resetTransition(),e.prototype.append.call(this,t),r&&(this._setDesiredCenter(),this._setDesiredZoom())},t.prototype.prepend=function(t){var r=0===this._trajectory.length;r&&this._resetTransition(),e.prototype.prepend.call(this,t),r&&(this._setDesiredCenter(),this._setDesiredZoom())},t.prototype.set=function(t){e.prototype.set.call(this,t),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)},t.prototype.move=function(e){throw new Error("Not implemented")},t.prototype.moveTo=function(e){throw new Error("Not implemented")},t.prototype.rotate=function(e){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedBasicRotation=null,null!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+e.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+e.theta):this._requestedRotationDelta=new s(e.phi,e.theta))},t.prototype.rotateBasic=function(e){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,null!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=e[0],this._requestedBasicRotation[1]+=e[1];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()},t.prototype.rotateBasicUnbounded=function(e){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=e[0],this._requestedBasicRotationUnbounded[1]+=e[1]):this._requestedBasicRotationUnbounded=e.slice())},t.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)}},t.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)}},t.prototype.setSpeed=function(e){this._speedCoefficient=this._spatial.clamp(e,0,10)},t.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],o=r[1],a=Math.pow(2,this._zoom),s=Math.pow(2,this._desiredZoom),c=t[0],u=t[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))}},t.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 i.Vector3).fromArray(this.currentTransform.unprojectBasic(t,this._lookatDepth)),n=null!=this.previousTransform?this.previousTransform:this.currentTransform,o=(new i.Vector3).fromArray(n.unprojectBasic(t,this._lookatDepth));this._currentCamera.lookat.copy(r),this._previousCamera.lookat.copy(o)}else this._desiredCenter=t},t.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},t.prototype.update=function(e){1===this._alpha&&this._currentIndex+this._alpha0?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))},t.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)}},t.prototype._updateRotation=function(){if(null!=this._requestedRotationDelta){var e=this._rotationDelta.lengthSquared();return this._requestedRotationDelta.lengthSquared()>e?this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha):this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha),void(this._requestedRotationDelta=null)}this._rotationDelta.isZero||(this._rotationDelta.multiply(this._rotationAcceleration),this._rotationDelta.threshold(this._rotationThreshold))},t.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){var r=this._requestedBasicRotationUnbounded[0],n=this._requestedBasicRotationUnbounded[1];if(Math.abs(r)>0&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*r),Math.abs(n)>0&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*n),null!=this._desiredLookat){var o=this.currentTransform.projectBasic(this._desiredLookat.toArray());o[0]+=r,o[1]+=n,this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(o,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}0===this._basicRotation[0]&&0===this._basicRotation[1]||(this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0],this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1],Math.abs(this._basicRotation[0])0||this._basicRotation[1]>0)&&(this._basicRotation=[0,0]))},t.prototype._setDesiredCenter=function(){if(null!=this._desiredCenter){var e=(new i.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}},t.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0},t}(a.StateBase);r.TraversingState=c},{"../../State":288,"@mapbox/unitbezier":2,three:231}],408:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../State"),o=function(e){function t(t){var r=e.call(this,t)||this;return r._zoom=0,r._adjustCameras(),r._motionless=r._motionlessTransition(),r}return n(t,e),t.prototype.traverse=function(){return new i.TraversingState(this)},t.prototype.wait=function(){throw new Error("Not implemented")},t.prototype.prepend=function(t){e.prototype.prepend.call(this,t),this._motionless=this._motionlessTransition()},t.prototype.set=function(t){e.prototype.set.call(this,t),this._motionless=this._motionlessTransition()},t.prototype.rotate=function(e){},t.prototype.rotateBasic=function(e){},t.prototype.rotateBasicUnbounded=function(e){},t.prototype.rotateBasicWithoutInertia=function(e){},t.prototype.rotateToBasic=function(e){},t.prototype.setSpeed=function(e){},t.prototype.zoomIn=function(e,t){},t.prototype.move=function(e){this._alpha=Math.max(0,Math.min(1,this._alpha+e))},t.prototype.moveTo=function(e){this._alpha=Math.max(0,Math.min(1,e))},t.prototype.update=function(e){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},t.prototype.setCenter=function(e){},t.prototype.setZoom=function(e){},t.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},t.prototype._setCurrentCamera=function(){e.prototype._setCurrentCamera.call(this),this._adjustCameras()},t.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){e=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){var e=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position))}}},t}(i.StateBase);r.WaitingState=o},{"../../State":288}],409:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Observable"),i=function(){function e(e,t,r){this._scheme=e,this._host=t,this._origin=null!=r?"?origin="+r:""}return e.prototype.getTile=function(e,t,r,i,o,a,s){var c="/"+e+"/"+t+","+r+","+i+","+o+"/"+a+","+s+"/0/default.jpg",u=this._scheme+"://"+this._host+c+this._origin,h=null;return[n.Observable.create(function(n){(h=new XMLHttpRequest).open("GET",u,!0),h.responseType="arraybuffer",h.timeout=15e3,h.onload=function(a){if(200===h.status){var s=new Image;s.crossOrigin="Anonymous",s.onload=function(e){n.next(s),n.complete()},s.onerror=function(a){n.error(new Error("Failed to load tile image ("+e+": "+t+","+r+","+i+","+o+")"))};var c=new Blob([h.response]);s.src=window.URL.createObjectURL(c)}else n.error(new Error("Failed to fetch tile ("+e+": "+t+","+r+","+i+","+o+"). Status: "+h.status+", "+h.statusText))},h.onerror=function(a){n.error(new Error("Failed to fetch tile ("+e+": "+t+","+r+","+i+","+o+")"))},h.ontimeout=function(a){n.error(new Error("Tile request timed out ("+e+": "+t+","+r+","+i+","+o+")"))},h.onabort=function(a){n.error(new Error("Tile request was aborted ("+e+": "+t+","+r+","+i+","+o+")"))},h.send(null)}),function(){null!=h&&h.abort()}]},e}();r.ImageTileLoader=i,r.default=i},{"rxjs/Observable":29}],410:[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);et&&(t=i,r=n)}return e[0]+1-e[e.length-1]>t?[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 e>0?1:e<0?-1:0},e}();r.RegionOfInterestCalculator=i,r.default=i},{"../Geo":284}],412:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("rxjs/Subject"),o=function(){function e(e,t,r,n,o,a,s,c){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 i.Subject,this._createdSubject$=new i.Subject,this._created$=this._createdSubject$.publishReplay(1).refCount(),this._createdSubscription=this._created$.subscribe(function(){}),this._hasSubject$=new i.Subject,this._has$=this._hasSubject$.startWith(!1).publishReplay(1).refCount(),this._hasSubscription=this._has$.subscribe(function(){}),this._abortFunctions=[],this._tileSubscriptions={},this._renderedCurrentLevelTiles={},this._renderedTiles={},this._background=o,this._camera=null,this._imageTileLoader=a,this._imageTileStore=s,this._renderer=c,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;td?1:f/d,v=Math.floor(m*this._width),g=Math.floor(m*this._height);this._renderTarget=new n.WebGLRenderTarget(v,g,{depthBuffer:!1,format:n.RGBFormat,magFilter:n.LinearFilter,minFilter:n.LinearFilter,stencilBuffer:!1}),this._renderToTarget(0,0,this._width,this._height,this._background),this._createdSubject$.next(this._renderTarget.texture),this._hasSubject$.next(!0)}this._fetchTiles(l)}},e.prototype.setTileSize=function(e){this._tileSize=e},e.prototype.updateBackground=function(e){this._background=e},e.prototype._fetchTile=function(e,t,r,n,i,o,a,s){var c=this,u=this._imageTileLoader.getTile(this._key,r,n,i,o,a,s),h=u[0],l=u[1];this._abortFunctions.push(l);var p=this._tileKey(this._tileSize,e),f=h.subscribe(function(a){c._renderToTarget(r,n,i,o,a),c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),c._setTileRendered(e,c._currentLevel),c._imageTileStore.addImage(a,p,t),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;rthis._width?this._width-a:t,u=s+t>this._height?this._height-s:t;if(this._imageTileStore.hasImage(o,this._currentLevel))this._renderToTarget(a,s,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,a,s,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 a=[],s=0,c=r;s=h&&v[0]<=l&&v[1]>=p&&v[1]<=f){var g=this._renderedTiles[i].indexOf(v);this._renderedTiles[i].splice(g,1)}}0===this._renderedTiles[i].length&&delete this._renderedTiles[i]}this._renderedTiles[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=o,r.default=o},{"rxjs/Subject":34,three:231}],413:[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},{}],414:[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);r>=0&&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];rt&&(t=n)}return t}).startWith(-1).publishReplay(1).refCount(),this._deferPixels$.subscribe(function(){}),this._documentMouseMove$=i.Observable.fromEvent(s,"mousemove"),this._documentMouseUp$=i.Observable.fromEvent(s,"mouseup"),this._mouseDown$=i.Observable.fromEvent(t,"mousedown"),this._mouseLeave$=i.Observable.fromEvent(t,"mouseleave"),this._mouseMove$=i.Observable.fromEvent(t,"mousemove"),this._mouseUp$=i.Observable.fromEvent(t,"mouseup"),this._mouseOut$=i.Observable.fromEvent(t,"mouseout"),this._mouseOver$=i.Observable.fromEvent(t,"mouseover"),this._domMouseDown$=i.Observable.fromEvent(r,"mousedown"),this._domMouseMove$=i.Observable.fromEvent(r,"mousemove"),this._click$=i.Observable.fromEvent(t,"click"),this._contextMenu$=i.Observable.fromEvent(t,"contextmenu"),this._dblClick$=i.Observable.merge(i.Observable.fromEvent(e,"click"),i.Observable.fromEvent(t,"dblclick")).bufferCount(3,1).filter(function(e){var r=e[0],n=e[1],i=e[2];return"click"===r.type&&"click"===n.type&&"dblclick"===i.type&&r.target.parentNode===t&&n.target.parentNode===t}).map(function(e){return e[2]}).share(),i.Observable.merge(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(function(e){e.preventDefault()}),this._mouseWheel$=i.Observable.merge(i.Observable.fromEvent(t,"wheel"),i.Observable.fromEvent(r,"wheel")).share(),this._consistentContextMenu$=i.Observable.merge(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).bufferCount(3,1).filter(function(e){return"mousedown"===e[0].type&&"contextmenu"===e[1].type&&"mouseup"===e[2].type}).map(function(e){return e[1]}).share();var h=i.Observable.merge(i.Observable.fromEvent(window,"blur"),this._documentMouseUp$.filter(function(e){return 0===e.button})).share(),l=this._createMouseDragInitiate$(this._mouseDown$,h,!0).share();this._mouseDragStart$=this._createMouseDragStart$(l).share(),this._mouseDrag$=this._createMouseDrag$(l,h).share(),this._mouseDragEnd$=this._createMouseDragEnd$(this._mouseDragStart$,h).share();var p=this._createMouseDragInitiate$(this._domMouseDown$,h,!1).share();this._domMouseDragStart$=this._createMouseDragStart$(p).share(),this._domMouseDrag$=this._createMouseDrag$(p,h).share(),this._domMouseDragEnd$=this._createMouseDragEnd$(this._domMouseDragStart$,h).share(),this._proximateClick$=this._mouseDown$.switchMap(function(e){return u._click$.takeUntil(u._createDeferredMouseMove$(e,u._documentMouseMove$)).take(1)}).share(),this._staticClick$=this._mouseDown$.switchMap(function(e){return u._click$.takeUntil(u._documentMouseMove$).take(1)}).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$).publishReplay(1).refCount(),this._wheelOwner$=this._createOwner$(this._claimWheel$).publishReplay(1).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(e,t){return t.map(function(t){var r=t.clientX-e.clientX,n=t.clientY-e.clientY;return[t,Math.sqrt(r*r+n*n)]}).withLatestFrom(this._deferPixels$).filter(function(e){var t=e[0];t[0];return t[1]>e[1]}).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.map(function(e){e[0];return e[1]}).switchMap(function(e){return i.Observable.of(e).concat(r._documentMouseMove$).takeUntil(t)})},e.prototype._createMouseDragEnd$=function(e,t){return e.switchMap(function(e){return t.first()})},e.prototype._createMouseDragStart$=function(e){return e.map(function(e){var t=e[0];e[1];return t})},e.prototype._createMouseDragInitiate$=function(e,t,r){var n=this;return e.filter(function(e){return 0===e.button}).switchMap(function(e){return i.Observable.combineLatest(i.Observable.of(e),r?n._createDeferredMouseMove$(e,n._documentMouseMove$):n._documentMouseMove$).takeUntil(t).take(1)})},e.prototype._createOwner$=function(e){return e.scan(function(e,t){return null==t.zindex?delete e[t.name]:e[t.name]=t.zindex,e},{}).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}).startWith(null)},e.prototype._filtered=function(e,t,r){return t.withLatestFrom(r).filter(function(t){t[0];return t[1]===e}).map(function(e){var t=e[0];e[1];return t})},e}();r.MouseService=s,r.default=s},{"../Geo":284,"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/fromEvent":42,"rxjs/add/operator/distinctUntilChanged":58,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/mergeMap":68,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":75,"rxjs/add/operator/switchMap":81,"rxjs/add/operator/withLatestFrom":87}],426:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/BehaviorSubject"),i=e("rxjs/Observable"),o=e("rxjs/ReplaySubject");e("rxjs/add/observable/throw"),e("rxjs/add/operator/do"),e("rxjs/add/operator/finally"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/mergeMap");var a=e("../API"),s=e("../Graph"),c=e("../Edge"),u=e("../State"),h=e("../Viewer"),l=function(){function e(e,t,r,i,o,c,l,p,f){this._apiV3=null!=r?r:new a.APIv3(e,t),this._imageLoadingService=null!=o?o:new s.ImageLoadingService,this._graphService=null!=i?i: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._cacheService=null!=p?p:new h.CacheService(this._graphService,this._stateService),this._playService=null!=f?f:new h.PlayService(this._graphService,this._stateService),this._keyRequested$=new n.BehaviorSubject(null),this._movedToKey$=new n.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(e){var t=this;this._abortRequest("in dir "+c.EdgeDirection[e]),this._loadingService.startLoading(this._loadingName);var r=this.stateService.currentNode$.first().mergeMap(function(t){return([c.EdgeDirection.Next,c.EdgeDirection.Prev].indexOf(e)>-1?t.sequenceEdges$:t.spatialEdges$).first().map(function(t){for(var r=0,n=t.edges;r.54?a.GraphMode.Sequence:a.GraphMode.Spatial}).distinctUntilChanged().subscribe(function(t){e._graphService.setGraphMode(t)}),this._cacheSubscription=this._stateService.currentNode$.map(function(e){return[e.sequenceKey,e.key]}).distinctUntilChanged(void 0,function(e){var t=e[0];e[1];return t}).combineLatest(this._graphService.graphMode$,this._direction$).switchMap(function(t){var r=t[0],i=r[0],s=r[1],c=t[1],u=t[2];if(u!==o.EdgeDirection.Next&&u!==o.EdgeDirection.Prev)return n.Observable.of([void 0,u]);var h=(c===a.GraphMode.Sequence?e._graphService.cacheSequenceNodes$(i,s):e._graphService.cacheSequence$(i)).retry(3).catch(function(){return n.Observable.of(void 0)});return n.Observable.combineLatest(h,n.Observable.of(u))}).switchMap(function(t){var r=t[0],i=t[1];if(void 0===r)return n.Observable.empty();var a=r.keys.slice();return i===o.EdgeDirection.Prev&&a.reverse(),e._stateService.currentState$.map(function(e){return[e.state.trajectory[e.state.trajectory.length-1].key,e.state.nodesAhead]}).scan(function(t,r){var n=t[0],i=(t[1],r[0]),o=r[1];void 0===n&&(n=i);var s=a.length-1;if(o>=e._nodesAhead||a[s]===n)return[n,[]];var c=a.indexOf(i),u=a.indexOf(n)+1,h=Math.min(s,c+e._nodesAhead-o)+1;return h<=u?[n,[]]:[a[h-1],a.slice(u,h)]},[void 0,[]]).mergeMap(function(e){e[0];var t=e[1];return n.Observable.from(t)})}).mergeMap(function(t){return e._graphService.cacheNode$(t).catch(function(){return n.Observable.empty()})},6).subscribe(),this._playingSubscription=this._stateService.currentState$.filter(function(t){return t.state.nodesAhead-1?r.sequenceEdges$:r.spatialEdges$).first(function(e){return e.cached}).timeout(15e3).zip(n.Observable.of(i)).map(function(e){for(var t=e[0],r=e[1],n=0,i=t.edges;n-1?t.sequenceEdges$:t.spatialEdges$).first(function(e){return e.cached}).timeout(15e3).catch(function(e){return console.error(e),n.Observable.of({cached:!1,edges:[]})});return n.Observable.combineLatest(n.Observable.of(r),i)}).map(function(e){for(var t=e[0],r=0,n=e[1].edges;r1||i[1]<0||i[1]>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,i,o){var a=e[0],s=e[1],c=this._viewportCoords.canvasToViewport(a,s,t),u=c[0],h=c[1],l=new n.Vector3(u,h,1).unproject(r.perspective),p=o.projectBasic(l.toArray());(p[0]<0||p[0]>1||p[1]<0||p[1]>1)&&(p=null);var f=l.clone().sub(r.camera.position).normalize(),d=-2/f.z,m=null;if(d>0&&d<100&&p){var v=f.clone().multiplyScalar(d).add(r.camera.position),g=this._geoCoords.enuToGeodetic(v.x,v.y,v.z,i.lat,i.lon,i.alt).slice(0,2);m={lat:g[0],lon:g[1]}}return{basicPoint:p,latLon:m,pixelPoint:[a,s]}},e}();r.Projection=o,r.default=o},{"../Geo":284,three:231}],430:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("virtual-dom"),o=e("rxjs/Subject");e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/startWith");var a=e("../Viewer"),s=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 n.Texture(this._image),this._texture.minFilter=n.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 n.Object3D;var r=this._texture.clone();r.needsUpdate=!0;var i=this._image.width,o=this._image.height;r.offset.x=t.x/i,r.offset.y=(o-t.y-t.height)/o,r.repeat.x=t.width/i,r.repeat.y=t.height/o;var a=new n.SpriteMaterial({map:r});return new n.Sprite(a)},e.prototype.getDOMSprite=function(e,t){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==t&&(t=a.Alignment.Center);var r=this._json[e];if(!r)return console.warn("Sprite with key"+e+"does not exist in sprite definition."),i.h("div",{},[]);var n=r.y,o=r.x+r.width,s=r.y+r.height,c=r.x,u=-r.x,h=-r.y,l=this._image.height,p=this._image.width;switch(t){case a.Alignment.Bottom:case a.Alignment.Center:case a.Alignment.Top:u-=r.width/2;break;case a.Alignment.BottomLeft:case a.Alignment.Left:case a.Alignment.TopLeft:u-=r.width;break;case a.Alignment.BottomRight:case a.Alignment.Right:case a.Alignment.TopRight:}switch(t){case a.Alignment.Center:case a.Alignment.Left:case a.Alignment.Right:h-=r.height/2;break;case a.Alignment.Top:case a.Alignment.TopLeft:case a.Alignment.TopRight:h-=r.height;break;case a.Alignment.Bottom:case a.Alignment.BottomLeft:case a.Alignment.BottomRight:}var f=1/r.pixelRatio;n*=f,o*=f,s*=f,c*=f,u*=f,h*=f,l*=f,p*=f;var d={src:this._image.src,style:{clip:"rect("+n+"px, "+o+"px, "+s+"px, "+c+"px)",height:l+"px",left:u+"px",position:"absolute",top:h+"px",width:p+"px"}};return i.h("img",d,[])},e}(),c=function(){function e(e){var t=this;if(this._retina=window.devicePixelRatio>1,this._spriteAtlasOperation$=new o.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.startWith(function(e){return e}).scan(function(e,t){return t(e)},new s).publishReplay(1).refCount(),this._spriteAtlas$.subscribe(function(){}),null!=e){var r=this._retina?"@2x":"",n=new XMLHttpRequest;n.open("GET",e+r+".png",!0),n.responseType="arraybuffer",n.onload=function(){var e=new Image;e.onload=function(){t._spriteAtlasOperation$.next(function(t){return t.image=e,t})};var r=new Blob([n.response]);e.src=window.URL.createObjectURL(r)},n.onerror=function(t){console.error(new Error("Failed to fetch sprite sheet ("+e+r+".png)"))},n.send();var i=new XMLHttpRequest;i.open("GET",e+r+".json",!0),i.responseType="text",i.onload=function(){var e=JSON.parse(i.response);t._spriteAtlasOperation$.next(function(t){return t.json=e,t})},i.onerror=function(t){console.error(new Error("Failed to fetch sheet ("+e+r+".json)"))},i.send()}}return Object.defineProperty(e.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),e}();r.SpriteService=c,r.default=c},{"../Viewer":292,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":72,"rxjs/add/operator/scan":75,"rxjs/add/operator/startWith":80,three:231,"virtual-dom":237}],431:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/BehaviorSubject"),i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/timer"),e("rxjs/add/operator/bufferWhen"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/switchMap");var a=function(){function e(e,t){var r=this;this._activeSubject$=new n.BehaviorSubject(!1),this._active$=this._activeSubject$.distinctUntilChanged().publishReplay(1).refCount(),i.Observable.fromEvent(t,"touchmove").subscribe(function(e){e.preventDefault()}),this._touchStart$=i.Observable.fromEvent(e,"touchstart"),this._touchMove$=i.Observable.fromEvent(e,"touchmove"),this._touchEnd$=i.Observable.fromEvent(e,"touchend"),this._touchCancel$=i.Observable.fromEvent(e,"touchcancel");var a=this._touchStart$.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}).share();this._doubleTap$=a.bufferWhen(function(){return a.first().switchMap(function(e){return i.Observable.timer(300).merge(a).take(1)})}).filter(function(e){return 2===e.length}).map(function(e){return e[e.length-1]}).share(),this._doubleTap$.subscribe(function(e){e.preventDefault()}),this._singleTouchMove$=this._touchMove$.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}).share();var s=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}),c=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(e){return e.touches.length>=1}),u=i.Observable.merge(this._touchEnd$,this._touchCancel$).filter(function(e){return 0===e.touches.length});this._singleTouchDragStart$=s.mergeMap(function(e){return r._singleTouchMove$.takeUntil(i.Observable.merge(u,c)).take(1)}),this._singleTouchDragEnd$=s.mergeMap(function(e){return i.Observable.merge(u,c).first()}),this._singleTouchDrag$=s.switchMap(function(e){return r._singleTouchMove$.skip(1).takeUntil(i.Observable.merge(c,u))});var h=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=h.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length}),this._pinchEnd$=h.filter(function(e){return 2!==e.touches.length||2!==e.targetTouches.length}),this._pinchOperation$=new o.Subject,this._pinch$=this._pinchOperation$.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$.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length}).map(function(e){return function(t){var r=e.touches[0],n=e.touches[1],i=Math.min(r.clientX,n.clientX),o=Math.max(r.clientX,n.clientX),a=Math.min(r.clientY,n.clientY),s=i+(o-i)/2,c=a+(Math.max(r.clientY,n.clientY)-a)/2,u=s+r.pageX-r.clientX,h=c+r.pageY-r.clientY,l=s+r.screenX-r.clientX,p=c+r.screenY-r.clientY,f=Math.abs(r.clientX-n.clientX),d=Math.abs(r.clientY-n.clientY),m=Math.sqrt(f*f+d*d),v=m-t.distance;return{changeX:f-t.distanceX,changeY:d-t.distanceY,clientX:s,clientY:c,distance:m,distanceChange:v,distanceX:f,distanceY:d,originalEvent:e,pageX:u,pageY:h,screenX:l,screenY:p,touch1:r,touch2:n}}}).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.switchMap(function(e){return r._pinch$.skip(1).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=a},{"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/timer":47,"rxjs/add/operator/bufferWhen":51,"rxjs/add/operator/filter":61,"rxjs/add/operator/map":65,"rxjs/add/operator/merge":66,"rxjs/add/operator/scan":75,"rxjs/add/operator/switchMap":81}],432:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("when"),o=e("rxjs/Observable"),a=e("../Viewer"),s=e("../Utils"),c=function(e){function t(t,r,n,i,o){var c=e.call(this)||this;return i=null!=i?i:{},s.Settings.setOptions(i),c._navigator=new a.Navigator(r,o),c._container=new a.Container(t,c._navigator.stateService,i),c._observer=new a.Observer(c,c._navigator,c._container),c._componentController=new a.ComponentController(c._container,c._navigator,c._observer,n,i.component),c}return n(t,e),Object.defineProperty(t.prototype,"isNavigable",{get:function(){return this._componentController.navigable},enumerable:!0,configurable:!0}),t.prototype.activateComponent=function(e){this._componentController.activate(e)},t.prototype.activateCover=function(){this._componentController.activateCover()},t.prototype.deactivateComponent=function(e){this._componentController.deactivate(e)},t.prototype.deactivateCover=function(){this._componentController.deactivateCover()},t.prototype.getBearing=function(){var e=this;return i.promise(function(t,r){e._container.renderService.bearing$.first().subscribe(function(e){t(e)},function(e){r(e)})})},t.prototype.getCenter=function(){var e=this;return i.promise(function(t,r){e._navigator.stateService.getCenter().subscribe(function(e){t(e)},function(e){r(e)})})},t.prototype.getComponent=function(e){return this._componentController.get(e)},t.prototype.getContainer=function(){return this._container.element},t.prototype.getZoom=function(){var e=this;return i.promise(function(t,r){e._navigator.stateService.getZoom().subscribe(function(e){t(e)},function(e){r(e)})})},t.prototype.moveCloseTo=function(e,t){var r=this.isNavigable?this._navigator.moveCloseTo$(e,t):o.Observable.throw(new Error("Calling moveCloseTo is not supported when viewer is not navigable."));return i.promise(function(e,t){r.subscribe(function(t){e(t)},function(e){t(e)})})},t.prototype.moveDir=function(e){var t=this.isNavigable?this._navigator.moveDir$(e):o.Observable.throw(new Error("Calling moveDir is not supported when viewer is not navigable."));return i.promise(function(e,r){t.subscribe(function(t){e(t)},function(e){r(e)})})},t.prototype.moveToKey=function(e){var t=this.isNavigable?this._navigator.moveToKey$(e):o.Observable.throw(new Error("Calling moveToKey is not supported when viewer is not navigable."));return i.promise(function(e,r){t.subscribe(function(t){e(t)},function(e){r(e)})})},t.prototype.projectFromBasic=function(e){var t=this;return i.promise(function(r,n){t._observer.projectBasic$(e).subscribe(function(e){r(e)},function(e){n(e)})})},t.prototype.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},t.prototype.setAuthToken=function(e){var t=this.isNavigable?this._navigator.setToken$(e):o.Observable.throw(new Error("Calling setAuthToken is not supported when viewer is not navigable."));return i.promise(function(e,r){t.subscribe(function(){e(void 0)},function(e){r(e)})})},t.prototype.setCenter=function(e){this._navigator.stateService.setCenter(e)},t.prototype.setFilter=function(e){var t=this;return i.promise(function(r,n){t._navigator.setFilter$(e).subscribe(function(){r(void 0)},function(e){n(e)})})},t.prototype.setRenderMode=function(e){this._container.renderService.renderMode$.next(e)},t.prototype.setZoom=function(e){this._navigator.stateService.setZoom(e)},t.prototype.unproject=function(e){var t=this;return i.promise(function(r,n){t._observer.unproject$(e).subscribe(function(e){r(e)},function(e){n(e)})})},t.prototype.unprojectToBasic=function(e){var t=this;return i.promise(function(r,n){t._observer.unprojectBasic$(e).subscribe(function(e){r(e)},function(e){n(e)})})},t.bearingchanged="bearingchanged",t.click="click",t.contextmenu="contextmenu",t.dblclick="dblclick",t.loadingchanged="loadingchanged",t.mousedown="mousedown",t.mousemove="mousemove",t.mouseout="mouseout",t.mouseover="mouseover",t.mouseup="mouseup",t.moveend="moveend",t.movestart="movestart",t.navigablechanged="navigablechanged",t.nodechanged="nodechanged",t.sequenceedgeschanged="sequenceedgeschanged",t.spatialedgeschanged="spatialedgeschanged",t}(s.EventEmitter);r.Viewer=c},{"../Utils":291,"../Viewer":292,"rxjs/Observable":29,when:278}]},{},[286])(286)}); +!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(){return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[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:{}};t[a][0].call(h.exports,function(e){var r=t[a][1][e];return i(r||e)},h,h.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;ac)&&(c=l[0]),(!h||l[1]>u)&&(u=l[1])}var p=c-n,d=u-s,f=Math.min(p,d),m=f/2,v=new a(null,i);if(0===f)return[n,s];for(var g=n;gb.d&&(b=_);for(var x=v.length;v.length;){var w=v.pop();w.d>b.d&&(b=w,r&&console.log("found best %d after %d probes",Math.round(1e4*w.d)/1e4,x)),w.max-b.d<=t||(m=w.h/2,v.push(new o(w.x-m,w.y-m,m,e)),v.push(new o(w.x+m,w.y-m,m,e)),v.push(new o(w.x-m,w.y+m,m,e)),v.push(new o(w.x+m,w.y+m,m,e)),x+=4)}return r&&(console.log("num probes: "+x),console.log("best distance: "+b.d)),[b.x,b.y]}function i(e,t){return t.max-e.max}function o(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;ot!=l[1]>t&&e<(l[0]-h[0])*(t-h[1])/(l[1]-h[1])+h[0]&&(n=!n),i=Math.min(i,function(e,t,r,n){var i=r[0],o=r[1],a=n[0]-i,s=n[1]-o;if(0!==a||0!==s){var c=((e-i)*a+(t-o)*s)/(a*a+s*s);c>1?(i=n[0],o=n[1]):c>0&&(i+=a*c,o+=s*c)}return a=e-i,s=t-o,a*a+s*s}(e,t,h,l))}return(n?1:-1)*Math.sqrt(i)}(e,t,n),this.max=this.d+this.h*Math.SQRT2}var a=e("tinyqueue");t.exports=n,t.exports.default=n},{tinyqueue:242}],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,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){void 0===t&&(t=1e-6);var r,n,i,o,a;for(i=e,a=0;a<8;a++){if(o=this.sampleCurveX(i)-e,Math.abs(o)n)return n;for(;ro?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";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function o(e,t,r){for(var n,o=[],a=t;a0?u-4:u;var h=0;for(t=0;t>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=s[e.charCodeAt(t)]<<2|s[e.charCodeAt(t+1)]>>4,a[h++]=255&i):1===o&&(i=s[e.charCodeAt(t)]<<10|s[e.charCodeAt(t+1)]<<4|s[e.charCodeAt(t+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",s=[],c=0,u=r-n;cu?u:c+16383));return 1===n?(t=e[r-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),s.push(i),s.join("")};for(var a=[],s=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,l=u.length;h>>0:o>>>0;(s=i.exec(n))&&!((c=s.index+s[0].length)>p&&(h.push(n.slice(p,s.index)),!r&&s.length>1&&s[0].replace(a,function(){for(var t=1;t1&&s.index=o));)i.lastIndex===s.index&&i.lastIndex++;return p===n.length?!u&&i.test("")||h.push(""):h.push(n.slice(p)),h.length>o?h.slice(0,o):h}}()},{}],6:[function(e,t,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(h===setTimeout)return setTimeout(e,0);if((h===n||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function a(){m&&d&&(m=!1,d.length?f=d.concat(f):v=-1,f.length&&s())}function s(){if(!m){var e=o(a);m=!0;for(var t=f.length;t;){for(d=f,f=[];++v1)for(var r=1;rI)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return s(e)}return o(e,t,r)}function o(e,t,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return j(e)?function(e,t,r){if(t<0||e.byteLength=I)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+I.toString(16)+" bytes");return 0|e}function h(e,t){if(i.isBuffer(e))return e.length;if(A(e)||j(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 T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return O(e).length;default:if(n)return T(e).length;t=(""+t).toLowerCase(),n=!0}}function l(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,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0);(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,R(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:f(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):f(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function f(e,t,r,n,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=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=2,s/=2,c/=2,r/=2}var u;if(i){var h=-1;for(u=r;us&&(r=s-c),u=r;u>=0;u--){for(var l=!0,p=0;pi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?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:128==(192&(c=e[i+1]))&&(l=(31&o)<<6|63&c)>127&&(a=l);break;case 3:c=e[i+1],u=e[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:c=e[i+1],u=e[i+2],h=e[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)>65535&&l<1114112&&(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 function(e){var t=e.length;if(t<=D)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nr)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,r,n,o,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function E(e,t,r,n,i){return t=+t,r>>>=0,i||M(e,0,r,4),N.write(e,t,r,n,23,4),r+4}function C(e,t,r,n,i){return t=+t,r>>>=0,i||M(e,0,r,8),N.write(e,t,r,n,52,8),r+8}function T(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&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 O(e){return L.toByteArray(function(e){if((e=e.trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function P(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function j(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function A(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function R(e){return e!=e}var L=e("base64-js"),N=e("ieee754");r.Buffer=i,r.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},r.INSPECT_MAX_BYTES=50;var I=2147483647;r.kMaxLength=I,(i.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&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,r){return o(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}(e,t,r)},i.allocUnsafe=function(e){return s(e)},i.allocUnsafeSlow=function(e){return s(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,a=Math.min(r,n);o0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,o){if(!i.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===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;for(var a=o-n,s=r-t,c=Math.min(a,s),u=this.slice(n,o),h=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return g(this,e,t,r);case"latin1":case"binary":return y(this,e,t,r);case"base64":return b(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var D=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},i.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o=i&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},i.prototype.readInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),N.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),N.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),N.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),N.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){S(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){S(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||S(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},i.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},i.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),n>0&&n=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=0;--i)e[i+t]=this[i+r];else if(o<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a=n.next.y&&n.next.y!==n.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.x&&n.x>=l&&i!==n.x&&u(or.x)&&d(n,e)&&(r=n,f=c),n=n.next;return r}(e,t)){var r=f(t,e);o(r,r.next)}}(m[a],r),r=o(r,r.next);return r}(e,t,h,r)),e.length>80*r){p=v=e[0],m=g=e[1];for(var x=r;xv&&(v=y),b>g&&(g=b);_=0!==(_=Math.max(v-p,g-m))?1/_:0}return a(h,l,r,p,m,_),l}function i(e,t,r,n,i){var o,a;if(i===y(e,t,r,n)>0)for(o=t;o=t;o-=n)a=m(o,e[o],e[o+1],a);return a&&l(a,a.next)&&(v(a),a=a.next),a}function o(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!l(n,n.next)&&0!==h(n.prev,n,n.next))n=n.next;else{if(v(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function a(e,t,r,n,i,s,m){if(e){!m&&s&&function(e,t,r,n){var i=e;do{null===i.z&&(i.z=c(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,o,a,s,c,u=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t0||c>0&&n;)0!==s&&(0===c||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,c--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1)}(i)}(e,n,i,s);for(var g,y,b=e;e.prev!==e.next;)if(g=e.prev,y=e.next,s?function(e,t,r,n){var i=e.prev,o=e,a=e.next;if(h(i,o,a)>=0)return!1;var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,d=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=c(s,l,t,r,n),m=c(p,d,t,r,n),v=e.nextZ;for(;v&&v.z<=m;){if(v!==e.prev&&v!==e.next&&u(i.x,i.y,o.x,o.y,a.x,a.y,v.x,v.y)&&h(v.prev,v,v.next)>=0)return!1;v=v.nextZ}v=e.prevZ;for(;v&&v.z>=f;){if(v!==e.prev&&v!==e.next&&u(i.x,i.y,o.x,o.y,a.x,a.y,v.x,v.y)&&h(v.prev,v,v.next)>=0)return!1;v=v.prevZ}return!0}(e,n,i,s):function(e){var t=e.prev,r=e,n=e.next;if(h(t,r,n)>=0)return!1;var i=e.next.next;for(;i!==e.prev;){if(u(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&h(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(e))t.push(g.i/r),t.push(e.i/r),t.push(y.i/r),v(e),e=y.next,b=y.next;else if((e=y)===b){m?1===m?a(e=function(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!l(i,o)&&p(i,n,n.next,o)&&d(i,o)&&d(o,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(o.i/r),v(n),v(n.next),n=e=o),n=n.next}while(n!==e);return n}(e,t,r),t,r,n,i,s,2):2===m&&function(e,t,r,n,i,s){var c=e;do{for(var u=c.next.next;u!==c.prev;){if(c.i!==u.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.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&&p(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&d(e,t)&&d(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)}(c,u)){var h=f(c,u);return c=o(c,c.next),h=o(h,h.next),a(c,t,r,n,i,s),void a(h,t,r,n,i,s)}u=u.next}c=c.next}while(c!==e)}(e,t,r,n,i,s):a(o(e),t,r,n,i,s,1);break}}}function s(e,t){return e.x-t.x}function c(e,t,r,n,i){return e=32767*(e-r)*i,t=32767*(t-n)*i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function u(e,t,r,n,i,o,a,s){return(i-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(n-s)-(r-a)*(t-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function h(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function l(e,t){return e.x===t.x&&e.y===t.y}function p(e,t,r,n){return!!(l(e,t)&&l(r,n)||l(e,n)&&l(r,t))||h(e,t,r)>0!=h(e,t,n)>0&&h(r,n,e)>0!=h(r,n,t)>0}function d(e,t){return h(e.prev,e,e.next)<0?h(e,t,e.next)>=0&&h(e,e.prev,t)>=0:h(e,t,e.prev)<0||h(e,e.next,t)<0}function f(e,t){var r=new g(e.i,e.x,e.y),n=new g(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function m(e,t,r,n){var i=new g(e,t,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 v(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 g(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 y(e,t,r,n){for(var i=0,o=t,a=r-n;o0&&(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];return t||(t=e[n]={}),t}},{"individual/one-version":19}],10:[function(e,t,r){"use strict";function n(e,t){var r;for(r in t)e[r]=t[r];return e}function i(e,t){if(this._jsongUrl=e,"number"==typeof t){t={timeout:t}}this._config=n({timeout:15e3,headers:{}},t||{})}var o=e("./request"),a=e("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:a,get:function(e){var t=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:e,method:"get"}),this._config);return o("GET",t,this)},set:function(e){var t=n(this.buildQueryObject(this._jsongUrl,"POST",{jsonGraph:e,method:"set"}),this._config);t.headers["Content-Type"]="application/x-www-form-urlencoded";return o("POST",t,this)},call:function(e,t,r,i){t=t||[],r=r||[],i=i||[];var a=[];a.push("method=call"),a.push("callPath="+encodeURIComponent(JSON.stringify(e))),a.push("arguments="+encodeURIComponent(JSON.stringify(t))),a.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),a.push("paths="+encodeURIComponent(JSON.stringify(i)));var s=n(this.buildQueryObject(this._jsongUrl,"POST",a.join("&")),this._config);s.headers["Content-Type"]="application/x-www-form-urlencoded";return o("POST",s,this)}},i.XMLHttpSource=i,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,t,r){(function(e){"use strict";t.exports=function(){var t=new e.XMLHttpRequest;if("withCredentials"in t)return t;if(e.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(e){"use strict";t.exports=function(){var t,r,n;if(e.XMLHttpRequest)return new e.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;n<3;n++)try{if(t=r[n],new e.ActiveXObject(t))break}catch(e){}return new e.ActiveXObject(t)}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";function n(){}function i(e,t,r){return n.create(function(n){var i,u,h,l,p,d={method:e||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(p in t)c.call(t,p)&&(d[p]=t[p]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(d);try{i=d.crossDomain?s():a()}catch(e){n.onError(e)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=!1!==d.withCredentials,h=d.headers;for(l in h)c.call(h,l)&&i.setRequestHeader(l,h[l]);if(d.responseType)try{i.responseType=d.responseType}catch(e){if("json"!==d.responseType)throw e}i.onreadystatechange=function(e){4===i.readyState&&(u||(u=!0,function(e,t,r){var n,i;if(t&&e){i=t.responseType,n="response"in t?t.response:t.responseText;var a=1223===t.status?204:t.status;if(a>=200&&a<=399){try{"json"!==i&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){o(e,"invalid json",r)}return e.onNext(n),void e.onCompleted()}401===a||403===a||407===a?o(e,n):410===a?o(e,n):408===a||504===a?o(e,n):o(e,n||"Response code "+a)}}(n,i)))},i.ontimeout=function(e){u||(u=!0,function(e,t,r,n){o(e,"timeout error"||t.statusText||"request error",n)}(n,i,0,e))},i.send(d.data)}catch(e){n.onError(e)}return function(){u||4===i.readyState||(u=!0,i.abort())}})}function o(e,t,r){r||(r=new Error(t)),e.onError(r)}var a=e("./getXMLHttpRequest"),s=e("./getCORSRequest"),c=Object.prototype.hasOwnProperty,u=function(){};n.create=function(e){var t=new n;return t.subscribe=function(t,r,n){var i,o;return i="function"==typeof t?{onNext:t,onError:r||u,onCompleted:n||u}:t,"function"==typeof(o=e(i))?{dispose:o}:o},t},t.exports=i},{"./getCORSRequest":12,"./getXMLHttpRequest":13}],15:[function(e,t,r){(function(n){!function(e){if("object"==typeof r&&void 0!==t)t.exports=e();else{("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).falcor=e()}}(function(){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(e){var t=r[s][1][e];return o(t||e)},l,l.exports,t,r,n,i)}return n[s].exports}for(var a="function"==typeof e&&e,s=0;s1&&!Array.isArray(n)||0===t&&!Array.isArray(n)&&"string"!==i||1===t&&!Array.isArray(n)&&!x(n))return new s(function(e){e.onError(new Error("Invalid argument"))})}return u.create(this,e)},n.prototype.invalidate=function(){var e,t=-1,r=arguments.length,n=arguments[r-1];for(e=new Array(r);++t0){var r=i.Observable.of(e);return e.get.apply(e,s).catch(i.Observable.empty()).concat(r).last().flatMap(function(){return n(t,c)}).filter(function(e){return e})}return i.Observable.return(e)}if(a>0){var o=s.map(function(e){return c.concat(e)});return t.get.apply(t,o).concat(i.Observable.defer(function(){return n(t,c)})).last().filter(function(e){return e})}return i.Observable.empty()})}},{134:134,159:159}],6:[function(e,t,r){var n=e(134),i=e(13),o=e(8),a=e(118);t.exports=function(e){var t=n.fromPath(e);if(!Array.isArray(t))throw new Error("Model#derefSync must be called with an Array path.");var r=i(this,this._path.concat(t),!1),s=r.path,c=r.value;if(r.found&&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(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 n=e(26).create,i=e(22),o=e(27),a=e(120),s=e(33),c=e(29).promote;t.exports=function(e,t,r,u,h,l,p){for(var d,f,m=r,v=h,g=u,y=0;;){if(0===y&&g[s]?(y=v.length,f=g[s]):(d=v[y++],f=m[d]),f){var b=f.$type,_=b&&f.value||f;if(yw;w++)x[w]=v[w];v=x}return[m,v]}},{120:120,22:22,26:26,27:27,29:29,33:33}],12:[function(e,t,r){var n=e(15),i=e(8),o=e(7);t.exports=function(e,t){return function(r,a,s){var c,u,h,l=s[0],p={values:s,optimizedPaths:[]},d=r._root.cache,f=r._path,m=d,v=f.length,g=[];if(v){if(t)return{criticalError:new o};if((m=n(r,f)).$type)return{criticalError:new i(f,f)};for(c=[],u=0;v>u;++u)c[u]=f[u]}else c=[],v=0;for(u=0,h=a.length;h>u;u++)e(r,d,m,a[u],0,l,p,g,c,v,t);return p}}},{15:15,7:7,8:8}],13:[function(e,t,r){var n=e(17),i=e(8);t.exports=function(e,t,r){var o,a,s,c,u,h=t,l=t;for(o=e._boxed,r=e._materialized,a=e._treatErrorsAsValues,e._boxed=!0,e._materialized=void 0===r||r,e._treatErrorsAsValues=!0,s=n(e,h.concat(null),!0),e._boxed=o,e._materialized=r,e._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(e,t,r){function n(e){var t,r,n,i={},o=Object.keys(e);for(r=0,n=o.length;n>r;r++)t=o[r],a(t)||(i[t]=e[t]);return i}function i(e,t,r){Object.keys(e).filter(function(t){return!a(t)&&e[t]}).forEach(function(r){var a=e[r],s=t[r];if(s||(s=t[r]={}),a.$type){var c,u=a.value&&"object"==typeof a.value,h=!e[o];return c=u||h?n(a):a.value,void(t[r]=c)}i(a,s,r)})}var o=e(37),a=e(97);t.exports=function(e){var t={};return i(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_;){if(null!==(h=t[_++])&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if((p=x.$type)===c&&void 0===x.value){S=void 0,M=!1,y=v>_;break}if(v>_){if(p===s){if(o(x)){E=!0,S=void 0,M=!1;break}if(d=n(e,m,m,x,x.value),!(f=d[0])){S=void 0,x=void 0,M=!1;break}p=f.$type,x=f,g=d[1].slice(0)}if(p)break}else S=x;w=x}if(v>_&&!E){for(l=_;v>l;++l)if(null!==t[_]){b=!0;break}for(b?(y=!0,S=void 0):S=x,l=_;v>l;++l)null!==t[l]&&(g[g.length]=t[l])}if(S&&p&&(o(S)?S=void 0:a(e,S)),S&&p===u&&!e._treatErrorsAsValues)throw{path:_===v?t:t.slice(0,_),value:S.value};return S&&e._boxed?S=Boolean(p)&&!r?i(S):S:!S&&e._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(e,t,r){var n=e(46);t.exports=function(e,t){var r=e._getValueSync({_boxed:!0,_root:e._root,_treatErrorsAsValues:e._treatErrorsAsValues},t,!0).value,i=r&&r[n];return null==i?-1:i}},{46:46}],19:[function(e,t,r){var n=e(12),i=e(31),o=n(i,!1),a=n(i,!0);t.exports={getValueSync:e(17),getBoundValue:e(13),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:a}},{12:12,13:13,17:17,31:31}],20:[function(e,t,r){var n=e(29),i=e(25),o=n.promote;t.exports=function(e,t,r,n,a){var s=t.value;a.errors||(a.errors=[]),e._boxed&&(s=i(t)),a.errors.push({path:n.slice(0,r+1),value:s}),o(e,t)}},{25:25,29:29}],21:[function(e,t,r){var n=e(30).fastCopy;t.exports=function(e,t,r,i,o,a,s){i.requestedMissingPaths||(i.requestedMissingPaths=[],i.optimizedMissingPaths=[]),function(e,t,r,n,i,o,a){a.requestedMissingPaths.push(n.slice(0,r).concat(t)),a.optimizedMissingPaths.push(i.slice(0,o).concat(t))}(0,rv;v++)b=p[v],_[b]||(_[b]={}),_=_[b];_[b=p[v]]=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];null!==(y=l[v])?_[y]=S:x[w]=S}}}},{118:118,119:119,120:120,25:25,29:29,37:37}],23:[function(e,t,r){var n=e(27),i=e(26),o=e(29),a=i.remove,s=o.splice,c=e(119),u=e(20),h=e(22),l=e(21),p=e(28),d=e(35);t.exports=function(e,t,r,i,o,f,m,v,g,y,b){var _=t&&t.$type,x=t&&void 0===t.value;return t&&_?void(n(t)?(t[d]||(s(e,t),a(t)),l(e,r,i,f,m,v,g)):_===c?(b&&(m[i]=null),y||e._treatErrorsAsValues?h(e,t,o,i,f,m,v,g,y,b):u(e,t,i,m,f)):(b&&(m[i]=null),(!x||x&&e._materialized)&&h(e,t,o,i,f,m,v,g,y,b))):void(p(e)?h(e,t,o,i,f,m,v,g,y,b):l(e,r,i,f,m,v,g))}},{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 n=e(40);t.exports=function(e){var t,r,i,o=Object.keys(e);for(t={},r=0,i=o.length;i>r;r++){var a=o[r];a[0]!==n&&(t[a]=e[a])}return t}},{40:40}],26:[function(e,t,r){var n=e(43),i=e(33),o=e(42),a=e(44);t.exports={create:function(e,t){var r=t[a]||0;t[n+r]=e,t[a]=r+1,e[o]=r,e[i]=t},remove:function(e){var t=e[i];if(t){for(var r=e[o],s=t[a];s>r;)t[n+r]=t[n+r+1],++r;t[a]=s-1,e[i]=void 0,e[o]=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||tr;r++)o[r]=e[r];for(i=0,n=t.length;n>i;i++)o[r++]=t[i];return o},fastCatSkipNulls:function(e,t){var r,n,i,o=[];for(r=0,n=e.length;n>r;r++)o[r]=e[r];for(i=0,n=t.length;n>i;i++)null!==t[i]&&(o[r++]=t[i]);return o},fastCopy:function(e,t){var r,n,i,o=[];for(n=0,i=t||0,r=e.length;r>i;n++,i++)o[n]=e[i];return o}}},{}],31:[function(e,t,r){var n=e(11),i=e(23),o=e(27),a=e(143).iterateKeySet,s=e(120),c=e(29).promote;t.exports=function e(t,r,u,h,l,p,d,f,m,v,g,y){var b=y,_=m;if(!u||u&&u.$type||l===h.length)i(t,u,h,l,p,d,f,_,v,g,b);else{var x,w,S=l+1,M=!1,E=x=h[l];if("object"==typeof x&&(M={},E=a(x,M)),void 0!==E||!M.done){var C=v+1;do{b=!1;var T;null===E?T=u:(T=u[E],_[v]=E,f[l]=E);var O=_,P=C;if(T){var j=T.$type,A=j&&T.value||T;if(Sw;++w)O[w]=L[w]}}e(t,r,T,h,S,p,d,f,O,P,g,b),M&&!M.done&&(E=a(x,M))}while(M&&!M.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,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 n(e,t,r,i,a,s,u,h,l,p){if(!w(e)&&!e.$type)for(var d in e)if(d[0]!==c&&"$"!==d[0]&&y(e,d)){var f=e[d],m=b(f)&&!f.$type,v=o(r,i,a,d,f,m,!1,s,u,h,l,p),_=v[0],x=v[1];_&&(m?n(f,t+1,r,x,_,s,u,h,l,p):C(_,x,d,h)&&E(x,g(_),h,s))}}function i(e,t,r,n,i,a,c,l){if(_(r))return S(r,i,a),[void 0,t];v(a,r);var f=r,m=r.value,g=t;if(null!=(r=r[h]))g=r[u]||t;else{var y=0,b=m.length-1;g=r=t;do{var x=o(t,g,r,m[y],e,b>y,!0,n,i,a,c,l);if(r=x[0],w(r))return x;g=x[1]}while(y++f,!0,r,n,i);if(t=y[0],b(t))return y;d=y[1]}while(f++=l){var x=e[a];for(g=x;f>=_&&g;)x=x[c],y=g.$size||0,f-=y,!0===b&&h(g,y,e,d),g=x;e[a]=e[c]=g,null==g?e[o]=e[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(e,t,r){var n=e(121),i=e(34),o=e(45),a=e(38),s=e(41),c=e(100);t.exports=function(e,t){if(c(t)&&t.$expires!==n){var r=e[i],u=e[o],h=t[a],l=t[s];t!==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]=t),e[i]=e[a]=r=t,r[a]=h,r[s]=void 0),null!=u&&t!==u||(e[o]=e[s]=u=l||t)}return t}},{100:100,121:121,34:34,38:38,41:41,45:45}],51:[function(e,t,r){var n=e(34),i=e(45),o=e(38),a=e(41);t.exports=function(e,t){var r=e[n],s=e[i],c=t[o],u=t[a];null!=c&&"object"==typeof c&&(c[a]=u),null!=u&&"object"==typeof u&&(u[o]=c),t===r&&(e[n]=e[o]=c),t===s&&(e[i]=e[a]=u),t[o]=t[a]=void 0,r=s=c=u=void 0}},{34:34,38:38,41:41,45:45}],52:[function(e,t,r){function n(e,t){var r=!1;return function(){if(!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 i=e(59),o=e(60),a=0,s=e(57).GetRequest,c=e(76),u=e(78),h=e(119),l=[],p=function(e,t){this.sent=!1,this.scheduled=!1,this.requestQueue=t,this.id=++a,this.type=s,this._scheduler=e,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};p.prototype={batch:function(e,t,r){var i=this,a=i._optimizedPaths,s=i._requestedPaths,c=i._callbacks,u=a.length;return a[u]=t,s[u]=e,c[u]=r,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){o(i,a,function(e,t){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(s,e,t);for(var r=0,n=c.length;n>r;++r){var o=c[r];o&&o(e,t)}}})})),n(i,u)},add:function(e,t,r){var o,a,s=this,c=i(e,t,s._pathMap);c?(a=c[2],o=c[1]):(a=e,o=t);var u=!1,h=!1;if(o.lengthn;++n)for(var o=e[n],a=0,s=o.length;s>a;++a)t[++r]=o[a];return t}(e);if(t){var d=t;d instanceof Error&&(d={message:d.message}),d.$type||(d={$type:h,value:d});var f=p.map(function(e){return{path:e,value:d}});u(n,f,null,o,a)}else c(n,[{paths:p,jsonGraph:r.jsonGraph}],null,o,a);n._path=s}},t.exports=p},{119:119,57:57,59:59,60:60,76:76,78:78}],53:[function(e,t,r){function n(){this.length=0,this.pending=!1,this.pathmaps=[],a.call(this,this._subscribe)}var i=e(159),o=i.Observer,a=i.Observable,s=i.Disposable,c=i.SerialDisposable,u=i.CompositeDisposable,h=e(9),l=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(a.prototype)).constructor=n,n.prototype.insertPath=function(e,t,r,n,i){var o=n||0,a=i||e.length-1,s=r||this.pathmaps[a+1]||(this.pathmaps[a+1]=Object.create(null));if(void 0===s||null===s)return!1;var c,u,h=e[o],p={};c=l(h,p);do{if(u=s[c],a>o){if(null==u){if(t)return!1;u=s[c]=Object.create(null)}if(!1===this.insertPath(e,t,u,o+1,a))return!1}else s[c]=(u||0)+1,this.length+=1;p.done||(c=l(h,p))}while(!p.done);return!0},n.prototype.removePath=function(e,t,r,n){var i=r||0,o=n||e.length-1,a=t||this.pathmaps[o+1];if(void 0===a||null===a)return!0;var s,c,u=0,h=e[i],p={};s=l(h,p);do{if(void 0!==(c=a[s])&&null!==c){if(o>i){u+=this.removePath(e,c,i+1,o);var d=void 0;for(d in c)break;void 0===d&&delete a[s]}else 0===(c=a[s]=(c||1)-1)&&delete a[s],u+=1,this.length-=1;p.done||(s=l(h,p))}}while(!p.done);return u},n.prototype.getSourceObserver=function(e){var t=this;return o.create(function(r){r.jsonGraph=r.jsonGraph||r.jsong||r.values||r.value,r.index=t.index,e.onNext(r)},function(t){e.onError(t)},function(){e.onCompleted()})},n.prototype._subscribe=function(e){var t=this,r=this.queue;t.pending=!0;var n=!1,i=new c,o=s.create(function(){n||(n=!0,r&&r._remove(t))}),a=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 a},t.exports=n},{143:143,159:159,9:9}],54:[function(e,t,r){function n(e,t){this.total=0,this.model=e,this.requests=[],this.scheduler=t}var i=e(58),o=e(40),a=e(90),s=e(100),c=e(143);n.prototype.set=function(e){return e.paths=c.collapse(e.paths),i.create(this.model,e)},n.prototype._remove=function(e){var t=this.requests,r=t.indexOf(e);-1!==r&&t.splice(r,1)},n.prototype.distributePaths=function(e,t,r){var n,i,o=this.model,a=-1,s=e.length,c=-1,u=t.length,h=[];e:for(;++a-1;){for(var l=n[r-1],p=i[r-1],d=c[r-1]||(c[r-1]=Object.keys(p));d.length>0;){var f=d.pop();if(f[0]!==o)if(l.hasOwnProperty(f)){var m=l[f],v=a(m),g=p[f],y=a(g);if(s(m)&&s(g)&&!v&&!y){n[r]=m,i[r]=g,r+=1;continue e}h>u&&(l[f]=g)}else l[f]=p[f]}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 i=e(57),o=e(52);n.prototype={setScheduler:function(e){this.scheduler=e},get:function(e,t,r){function n(){m||0==--l&&r()}var a,s,c,u=this,h=[],l=0,p=u._requests,d=t,f=e,m=!1;for(a=0,s=p.length;s>a;++a)if((c=p[a]).type===i.GetRequest){if(c.sent){var v=c.add(f,d,n);v[0]&&(f=v[1],d=v[2],h[h.length]=v[3],++l)}else c.batch(f,d,n),d=[],f=[],++l;if(!d.length)break}if(d.length){c=new o(u.scheduler,u),p[p.length]=c,++l;var g=c.batch(f,d,n);h[h.length]=g}return function(){if(!m&&0!==l){m=!0;for(var e=h.length,t=0;e>t;++t)h[t]()}}},removeRequest:function(e){for(var t=this._requests,r=t.length;--r>=0;)if(t[r].id===e.id){t.splice(r,1);break}}},t.exports=n},{52:52,57:57}],57:[function(e,t,r){t.exports={GetRequest:"GET"}},{}],58:[function(e,t,r){function n(){o.call(this)}var i=e(159).Observer,o=e(53),a=e(83),s=e(76),c=e(78),u=new Array(0);n.create=function(e,t){var r=new n;return r.model=e,r.jsonGraphEnvelope=t,r},(n.prototype=Object.create(o.prototype)).constructor=n,n.prototype.method="set",n.prototype.insertPath=function(){return!1},n.prototype.removePath=function(){return 0},n.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},n.prototype.getSourceObserver=function(e){var t=this.model,r=t._path,n=this.jsonGraphEnvelope.paths,h=t._root,l=h.errorSelector,p=h.comparator;return o.prototype.getSourceObserver.call(this,i.create(function(i){t._path=u;var o=s(t,[{paths:n,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],t._path=r,e.onNext(i)},function(i){t._path=u,c(t,a(n,function(e){return{path:e,value:i}}),null,l,p),t._path=r,e.onError(i)},function(){e.onCompleted()}))},t.exports=n},{159:159,53:53,76:76,78:78,83:83}],59:[function(e,t,r){var n=e(143).hasIntersection,i=e(84);t.exports=function(e,t,r){for(var o=[],a=[],s=[],c=-1,u=-1,h=!1,l=0,p=t.length;p>l;++l){var d=t[l],f=r[d.length];f&&n(f,d,0)?(!h&&l>0&&(a=i(e,0,l),o=i(t,0,l)),s[++c]=e[l],h=!0):h&&(o[++u]=d,a[u]=e[l])}return h?[s,o,a]:null}},{143:143,84:84}],60:[function(e,t,r){var n=e(143),i=n.toTree,o=n.toPaths;t.exports=function(e,t,r){if(0!==e._count){e.sent=!0,e.scheduled=!1;for(var n=e._pathMap,a=0,s=Object.keys(t).length;s>a;++a)for(var c=t[a],u=0,h=c.length;h>u;++u){var l=c[u],p=l.length;if(n[p]){var d=n[p];d[d.length]=l}else n[p]=[l]}for(var f=Object.keys(n),m=0,v=f.length;v>m;++m){var g=f[m];n[g]=i(n[g])}var y,b=e._collasped=o(n);e.requestQueue.model._source.get(b).subscribe(function(e){y=e},function(e){r(e,y)},function(){r(null,y)})}else e.requestQueue.removeRequest(e)}},{143:143}],61:[function(e,t,r){function n(e){a.call(this,e||function(e){function t(e){return b.concat(e)}var r=this.args,n=this.model,c=h.fromPath(r[0]),p=r[1]||[],d=(r[2]||[]).map(h.fromPath),f=(r[3]||[]).map(h.fromPath),m=n._clone({_path:[]}),v=m.withoutDataSource(),g=n._path,y=g.concat(c),b=y.slice(0,-1),_=i(n.withoutDataSource().get(c)).map(function(e){for(var t=e.json,r=-1,n=c.length;t&&++r0?i(v.set.apply(v,t)._toJSONG()).map(function(t){return{results:e,envelope:t}}):a.return({results:e,envelope:{jsonGraph:{},paths:[]}})}).flatMap(function(e){var o,s=e.envelope,c=e.results,u=c.values,h=c.references,l=c.invalidations,p=u.map(n).map(t),d=h.reduce(r,[]),v=f.map(t),g=d.concat(v);return(o=g.length>0?i(m.get.apply(m,p.concat(g))._toJSONG()):a.return(s)).doAction(function(e){e.invalidated=l})});return a.return(u)}return a.empty()}).defaultIfEmpty(function(e){return e&&"object"==typeof e?o.Observable.defer(function(){var t;try{t=e.call(y,p,d,f)}catch(e){t=a.throw(new u(e))}return t}).map(function(e){var t=e.invalidated;return t&&t.length&&m.invalidate.apply(m,t),e}):a.empty()}(n._source)).mergeAll().flatMap(function(e){return i(v.set(e)).reduce(function(e){return e},null).map(function(){return{invalidated:e.invalidated,paths:e.paths.map(function(e){return e.slice(g.length)})}})}),x=new s;return x.add(_.subscribe(function(t){var r=t.paths,o=t.invalidated,a=n.get.apply(n,r);"AsJSONG"===e.outputFormat&&(a=i(a._toJSONG()).doAction(function(e){e.invalidated=o})),x.add(a.subscribe(e))},function(t){e.onError(t)})),x})}function i(e){return o.Observable.defer(function(){return e})}var o=e(159)&&e(158),a=o.Observable,s=o.CompositeDisposable,c=e(64),u=e(9),h=e(134),l=e(120);n.create=c.create,(n.prototype=Object.create(a.prototype)).constructor=n,n.prototype.invokeSourceRequest=function(e){return this},n.prototype.ensureCollect=function(e){return this},n.prototype.initialize=function(){return this},t.exports=n},{120:120,134:134,158:158,159:159,64:64,9:9}],62:[function(e,t,r){function n(e){i.call(this,e)}var i=e(159).Observable,o=e(64),a=e(134),s=e(88),c=e(49),u=e(81),h=e(46),l=Array.isArray,p=e(101),d=e(98),f=e(99);n.create=o.create,(n.prototype=Object.create(i.prototype)).constructor=n,n.prototype.subscribeCount=0,n.prototype.subscribeLimit=10,n.prototype.initialize=function(){for(var e,t,r=this.model,n=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],s=[],c=this.args,h=-1,m=c.length;++h0){(0,t["_"+r+c+"AsJSON"])(t,u)}}return e.onCompleted(),i.empty})}var i=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),a=(e(159)&&e(158)).Observable,s=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(a.prototype)).constructor=n,n.prototype._mixin=function(){var e=this,t=s(arguments);return new e.constructor(function(r){return e.subscribe(t.reduce(function(e,t){return Object.create(e,t)},r))})},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 r=this;return new o.Promise(function(e,t){var n,i=!1;r.toArray().subscribe(function(e){n=e.length<=1?e[0]:e},function(e){i=!0,t(e)},function(){!1===i&&e(n)})}).then(e,t)},t.exports=n},{105:105,158:158,159:159,32:32,84:84}],65:[function(e,t,r){function n(e){p.call(this,e||function(e){return this.isCompleted?o.call(this,e):function(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),h.empty;for(var t=[],r=[],n=this.model,i=this.isMaster,c=n._root,u=this.outputFormat,l=c.errorSelector,p=this.method,d=this.groups,m=-1,v=d.length;++m0){var _=(0,n["_"+p+y+u])(n,b,null,l);r.push.apply(r,_[1]),"PathValues"===y?t.push.apply(t,b.map(a)):"JSONGs"===y?t.push.apply(t,f(b,s)):t.push.apply(t,_[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,o.call(this,e)):void e.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}.call(this,e)})}function i(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),h.empty;for(var t=[],r=[],n=this.model,i=this.isMaster,c=n._root,u=this.outputFormat,l=c.errorSelector,p=this.method,d=this.groups,m=-1,v=d.length;++m0){var _=(0,n["_"+p+y+u])(n,b,null,l);r.push.apply(r,_[1]),"PathValues"===y?t.push.apply(t,b.map(a)):"JSONGs"===y?t.push.apply(t,f(b,s)):t.push.apply(t,_[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,o.call(this,e)):void e.onError({method:p,optimizedPaths:r,invokeSourceRequest:!0})}function o(e){var t=new l(this.model,this.requestedPaths);return"AsJSONG"===this.outputFormat&&(t=t._toJSONG()),this.isProgressive&&(t=t.progressively()),t.subscribe(e)}function a(e){return e.path}function s(e){return e.paths}var c=e(159),u=c.Observable,h=c.Disposable,l=e(67),p=e(62),d=e(9),f=e(82),m=new Array(0);n.create=p.create,(n.prototype=Object.create(p.prototype)).method="set",n.prototype.constructor=n,n.prototype.invokeSourceRequest=function(e){var t=this,r=this.catch(function(n){var i;if(n&&!0===n.invokeSourceRequest){var o={},a=e._path,s=n.optimizedPaths;e._path=m,e._getPathValuesAsJSONG(e._materialize().withoutDataSource(),s,[o]),e._path=a,i=e._request.set(o).do(function(e){t.isCompleted=s.length===e.paths.length},function(){t.isCompleted=!0}).materialize().flatMap(function(e){if("C"===e.kind)return u.empty();if("E"===e.kind){var t=e.exception;if(d.is(t))return u.throw(e.exception)}return r})}else i=u.throw(n);return i});return new this.constructor(function(e){return r.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),i=e(68),o=e(69),a={dispose:function(){}},s=e(159).Observable,c=t.exports=function(e,t,r,n){this.model=e,this.currentRemainingPaths=t,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(e){var t=[{}],r=[],n=e.isJSONG=this.isJSONGraph,s=this.isProgressive,c=i(this.model,this.currentRemainingPaths,e,s,n,t,r);return c?o(this,this.model,c,e,t,r,1):a}},{159:159,64:64,68:68,69:69}],68:[function(e,t,r){var n=e(19),i=n.getWithPathsAsJSONGraph,o=n.getWithPathsAsPathMap;t.exports=function(e,t,r,n,a,s,c){var u;if((u=a?i(e,t,s):o(e,t,s)).criticalError)return r.onError(u.criticalError),null;var h=u.hasValue,l=!u.requestedMissingPaths||!e._source,p=s[0].json||s[0].jsonGraph;if(u.errors)for(var d=u.errors,f=c.length,m=0,v=d.length;v>m;++m,++f)c[f]=d[m];if(h&&n||p&&l)try{++e._root.syncRefCount,r.onNext(s[0])}catch(e){throw e}finally{--e._root.syncRefCount}return l?(c.length?r.onError(c):r.onCompleted(),null):u}},{19:19}],69:[function(e,t,r){var n=e(68),i=e(10),o=e(30).fastCat,a=e(49),s=e(88),c=e(66),u=e(46);t.exports=function e(t,r,h,l,p,d,f){if(10===f)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,t.isProgressive,t.isJSONGraph,p,d);if(i)y.currentDisposable=e(t,r,i,l,p,d,f+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(e,t,r){var n=e(67);t.exports=function(e){return new n(this,e)}},{67:67}],71:[function(e,t,r){var n=e(134),i=e(64),o=e(72),a=e(116),s=e(67);t.exports=function(){var e=a(arguments,o,"get");if(!0!==e)return new i(function(t){t.onError(e)});var t=n.fromPathsOrPathValues(arguments);return new s(this,t)}},{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 n(e,t,r,i,a,s,c,u,h,l,p,f,m,v,g,b,_){for(var x={},w=tx,!0,i,a,u,p,m,y,b);if(t=C[0],v(t))return a.index=x,C;M=C[1],n=C[2],E=C[3]}while(x++=x)break;l.index=w}}function i(e,t,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,t];y(u,r);var g=r,b=t;if(null!=(r=r[l]))b=r[h]||t,i.index=v.length;else{var _=0,w=v.length-1;b=r=t;do{var E=o(t,b,r,v[_],e,w>_,!0,n,i,a,s,u,p,m);if(r=E[0],S(r))return i.index=_,E;b=E[1]}while(_++S,!0,n,i,a,h,d,f,g);if(r=E[0],y(r))return i.index=S,E;w=E[1]}while(S++o&&(o=0),r>0&&o>r&&(o=r);for(var a=new Array(o);++iL)return}if(O&&A&&!P)return f(v(t,r,e,b,M),e,b);if(P||!A){if(P===a&&l(C)&&(r=C(y(_,b),r)),P&&t===r)null==t[i]&&(t=d(t,O,t.value),e=g(e,-t.$size,M,w),t=f(t,e,b,w));else{var N=!0;!O&&j||(N=c(r)-1);return e}},{39:39,43:43,44:44,46:46}],115:[function(e,t,r){var n=e(36),i=e(46),o=e(39),a=e(108),s=e(114);t.exports=function(e,t,r,c){var u=e;do{var h=u[o];0>=(u.$size=(u.$size||0)-t)&&null!=h?a(u,h,u[n],r):u[i]!==c&&s(u,c),u=h}while(u);return e}},{108:108,114:114,36:36,39:39,46:46}],116:[function(e,t,r){var n=Array.isArray,i=e(101),o=e(99),a=e(98),s=e(134);t.exports=function(e,t,r){for(var c=0,u=e.length;u>c;++c){var h=e[c],l=!1;if(n(h)&&t.path?l=!0:"string"==typeof h&&t.pathSyntax?l=!0:i(h)&&t.pathValue?(h.path=s.fromPath(h.path),l=!0):o(h)&&t.jsonGraph?l=!0:a(h)&&t.json?l=!0:"function"==typeof h&&c+1===u&&t.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(e,t,r){var n=e(130).atom,i=e(106),o=e(122),a=e(37),s=e(85),c=Array.isArray,u=e(88),h=e(87);t.exports=function(e,t,r){var l=0,p=e,d=t;if(d?(p=s(p),l=u(p),p.$type=d):(p=n(r),d=p.$type,p[a]=!0),null==r)l=51;else if(null==l||0>=l)switch(typeof r){case"object":l=c(r)?50+r.length:51;break;case"string":l=50+r.length;break;default:l=51}var f=h(p);return"number"==typeof f&&o>f&&(p.$expires=i()+-1*f),p.$size=l,p}},{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=a.length?a.pop():new i).task=e,o(t)}function i(){this.task=null}var o=e(124),a=[],s=[],c=o.makeRequestCallFromTimer(function(){if(s.length)throw s.shift()});t.exports=n,i.prototype.call=function(){try{this.task.call()}catch(e){n.onerror?n.onerror(e):(s.push(e),c())}finally{this.task=null,a[a.length]=this}}},{124:124}],124:[function(e,t,r){(function(e){"use strict";function r(e){a.length||(o(),s=!0),a[a.length]=e}function n(){for(;cu){for(var t=0,r=a.length-c;r>t;t++)a[t]=a[t+c];a.length-=c,c=0}}a.length=0,c=0,s=!1}function i(e){return function(){function t(){clearTimeout(r),clearInterval(n),e()}var r=setTimeout(t,0),n=setInterval(t,50)}}t.exports=r;var o,a=[],s=!1,c=0,u=1024,h=e.MutationObserver||e.WebKitMutationObserver;o="function"==typeof h?function(e){var t=1,r=new h(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}(n):i(n),r.requestFlush=o,r.makeRequestCallFromTimer=i}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(e,t,r){"use strict";function n(e,t){var r;for(r in t)e[r]=t[r];return e}function i(e,t){if(this._jsongUrl=e,"number"==typeof t){t={timeout:t}}this._config=n({timeout:15e3,headers:{}},t||{})}var o=e(129),a=e(126);Array.isArray,i.prototype={constructor:i,buildQueryObject:a,get:function(e){var t=n(this.buildQueryObject(this._jsongUrl,"GET",{paths:e,method:"get"}),this._config);return o("GET",t,this)},set:function(e){var t="POST",r=n(this.buildQueryObject(this._jsongUrl,t,{jsonGraph:e,method:"set"}),this._config);r.headers["Content-Type"]="application/x-www-form-urlencoded";return o(t,r,this)},call:function(e,t,r,i){t=t||[],r=r||[],i=i||[];var a="POST",s=[];s.push("method=call"),s.push("callPath="+encodeURIComponent(JSON.stringify(e))),s.push("arguments="+encodeURIComponent(JSON.stringify(t))),s.push("pathSuffixes="+encodeURIComponent(JSON.stringify(r))),s.push("paths="+encodeURIComponent(JSON.stringify(i)));var c=n(this.buildQueryObject(this._jsongUrl,a,s.join("&")),this._config);c.headers["Content-Type"]="application/x-www-form-urlencoded";return o(a,c,this)}},i.XMLHttpSource=i,i.default=i,t.exports=i},{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,t,r){(function(e){"use strict";t.exports=function(){var t=new e.XMLHttpRequest;if("withCredentials"in t)return t;if(e.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(e){"use strict";t.exports=function(){var t,r,n;if(e.XMLHttpRequest)return new e.XMLHttpRequest;try{for(r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=0;3>n;n++)try{if(t=r[n],new e.ActiveXObject(t))break}catch(e){}return new e.ActiveXObject(t)}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 i(e,t,r){r||(r=new Error(t)),e.onError(r)}function o(e,t,r){var n,o;if(t&&e){o=t.responseType,n="response"in t?t.response:t.responseText;var a=1223===t.status?204:t.status;if(a>=200&&399>=a){try{"json"!==o&&(n=JSON.parse(n||"")),"string"==typeof n&&(n=JSON.parse(n||""))}catch(r){i(e,"invalid json",r)}return e.onNext(n),void e.onCompleted()}return 401===a||403===a||407===a?i(e,n):410===a?i(e,n):408===a||504===a?i(e,n):i(e,n||"Response code "+a)}}function a(e,t,r,n){i(e,r||t.statusText||"request error",n)}var s=e(128),c=e(127),u=Object.prototype.hasOwnProperty,h=function(){};n.create=function(e){var t=new n;return t.subscribe=function(t,r,n){var i,o;return i="function"==typeof t?{onNext:t,onError:r||h,onCompleted:n||h}:t,"function"==typeof(o=e(i))?{dispose:o}:o},t},t.exports=function(e,t,r){return n.create(function(n){var i,h,l,p,d,f={method:e||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(d in t)u.call(t,d)&&(f[d]=t[d]);f.crossDomain||f.headers["X-Requested-With"]||(f.headers["X-Requested-With"]="XMLHttpRequest"),null!=r.onBeforeRequest&&r.onBeforeRequest(f);try{i=f.crossDomain?c():s()}catch(e){n.onError(e)}try{f.user?i.open(f.method,f.url,f.async,f.user,f.password):i.open(f.method,f.url,f.async),i.timeout=f.timeout,i.withCredentials=!1!==f.withCredentials,l=f.headers;for(p in l)u.call(l,p)&&i.setRequestHeader(p,l[p]);if(f.responseType)try{i.responseType=f.responseType}catch(e){if("json"!==f.responseType)throw e}i.onreadystatechange=function(e){4===i.readyState&&(h||(h=!0,o(n,i)))},i.ontimeout=function(e){h||(h=!0,a(n,i,"timeout error",e))},i.send(f.data)}catch(e){n.onError(e)}return function(){h||4===i.readyState||(h=!0,i.abort())}})}},{127:127,128:128}],130:[function(e,t,r){function n(e,t,r){var n=Object.create(null);if(null!=r){for(var i in r)n[i]=r[i];return n.$type=e,n.value=t,n}return{$type:e,value:t}}var i=e(134);t.exports={ref:function(e,t){return n("ref",i.fromPath(e),t)},atom:function(e,t){return n("atom",e,t)},undefined:function(){return n("atom")},error:function(e,t){return n("error",e,t)},pathValue:function(e,t){return{path:i.fromPath(e),value:t}},pathInvalidation:function(e){return{path:i.fromPath(e),invalidated:!0}}}},{134:134}],131:[function(e,t,r){t.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],132:[function(e,t,r){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),a=function(e,t){return i(new n(e,t))};t.exports=a,a.fromPathsOrPathValues=function(e,t){if(!e)return[];for(var r=[],n=0,i=e.length;i>n;n++)"string"==typeof e[n]?r[n]=a(e[n],t):"string"==typeof e[n].path?r[n]={path:a(e[n].path,t),value:e[n].value}:r[n]=e[n];return r},a.fromPath=function(e,t){return e?"string"==typeof e?a(e,t):e:[]},a.RoutedTokens=o},{131:131,135:135,140:140}],135:[function(e,t,r){var n=e(132),i=e(133),o=e(136);t.exports=function(e){for(var t=e.next(),r={},a=[];!t.done;){switch(t.type){case n.token:var s=+t.token[0];isNaN(s)||i.throwError(i.invalidIdentifier,e),a[a.length]=t.token;break;case n.dotSeparator:0===a.length&&i.throwError(i.unexpectedToken,e);break;case n.space:break;case n.openingBracket:o(e,t,r,a);break;default:i.throwError(i.unexpectedToken,e)}t=e.next()}return 0===a.length&&i.throwError(i.invalidPath,e),a}},{132:132,133:133,136:136}],136:[function(e,t,r){var n=e(132),i=e(133),o=i.indexer,a=e(138),s=e(137),c=e(139);t.exports=function(e,t,r,u){var h=e.next(),l=!1,p=1,d=!1;for(r.indexer=[];!h.done;){switch(h.type){case n.token:case n.quote:r.indexer.length===p&&i.throwError(o.requiresComma,e)}switch(h.type){case n.openingBrace:d=!0,c(e,h,r,u);break;case n.token:var f=+h.token;isNaN(f)&&i.throwError(o.needQuotes,e),r.indexer[r.indexer.length]=f;break;case n.dotSeparator:r.indexer.length||i.throwError(o.leadingDot,e),a(e,h,r,u);break;case n.space:break;case n.closingBracket:l=!0;break;case n.quote:s(e,h,r,u);break;case n.openingBracket:i.throwError(o.nested,e);break;case n.commaSeparator:++p;break;default:i.throwError(i.unexpectedToken,e)}if(l)break;h=e.next()}0===r.indexer.length&&i.throwError(o.empty,e),r.indexer.length>1&&d&&i.throwError(o.routedTokens,e),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(e,t,r){var n=e(132),i=e(133),o=i.quote;t.exports=function(e,t,r,a){for(var s=e.next(),c="",u=t.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,e),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,e)}if(l)break;s=e.next()}0===c.length&&i.throwError(o.empty,e),r.indexer[r.indexer.length]=c}},{132:132,133:133}],138:[function(e,t,r){var n=e(140),i=e(132),o=e(133);t.exports=function(e,t,r,a){var s,c=e.peek(),u=1,h=!1,l=!0,p=r.indexer.length-1,d=n.toNumber(r.indexer[p]);for(isNaN(d)&&o.throwError(o.range.precedingNaN,e);!h&&!c.done;){switch(c.type){case i.dotSeparator:3===u&&o.throwError(o.unexpectedToken,e),3===++u&&(l=!1);break;case i.token:s=n.toNumber(e.next().token),isNaN(s)&&o.throwError(o.range.suceedingNaN,e),h=!0;break;default:h=!0}if(h)break;e.next(),c=e.peek()}r.indexer[p]={from:d,to:l?s:s-1}}},{132:132,133:133,140:140}],139:[function(e,t,r){var n=e(132),i=e(131),o=e(133),a=o.routed;t.exports=function(e,t,r,s){var c=e.next(),u=!1,h="";switch(c.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(a.invalid,e)}var l=e.next();if(l.type===n.colon&&(u=!0,(l=e.next()).type!==n.token&&o.throwError(a.invalid,e),h=l.token,l=e.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,e)}},{131:131,132:132,133:133}],140:[function(e,t,r){function n(e,t,r){return{token:e,done:r,type:t}}function i(e,t,r){var i,b=!1,_="",x=r?y:g;do{if(i=t+1>=e.length)break;var w=e[t+1];if(void 0===w||-1!==x.indexOf(w)){if(_.length)break;++t;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 f:case m:S=o.quote;break;case d:S=o.escape;break;case p:S=o.colon;break;default:S=o.unknown}b=n(w,S,!1);break}_+=w,++t}while(!i);return!b&&_.length&&(b=n(_,o.token,!1)),b||(b={done:!0}),{token:b,idx:t}}var o=e(132),a=".",s=",",c="[",u="]",h="{",l="}",p=":",d="\\",f='"',m="'",v=" ",g="\\'\"[]., ",y="\\{}'\"[]., :",b=t.exports=function(e,t){this._string=e,this._idx=-1,this._extended=t,this.parseString=""};b.prototype={next:function(){var e=this._nextToken?this._nextToken:i(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:i(this._string,this._idx,this._extended);return this._nextToken=e,e.token}},b.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 n=e(144);t.exports=function e(t,r,i){for(var o=t,a=!0;a&&in&&(t.empty=!0)}function i(e,t){t.done=!1;var r=t.isObject=!(!e||"object"!=typeof e);t.isArray=r&&o(e),t.arrayOffset=0}var o=Array.isArray;t.exports=function(e,t){if(void 0===t.isArray&&i(e,t),t.isArray){var r;do{t.loaded&&t.rangeOffset>t.to&&(++t.arrayOffset,t.loaded=!1);if(t.arrayOffset>=e.length){t.done=!0;break}var o=e[t.arrayOffset];if("object"===typeof o){if(t.loaded||n(o,t),t.empty)continue;r=t.rangeOffset++}else++t.arrayOffset,r=o}while(void 0===r);return r}return t.isObject?(t.loaded||n(e,t),t.rangeOffset>t.to?void(t.done=!0):t.rangeOffset++):(t.done=!0,e)}},{}],145:[function(e,t,r){var n=e(142);t.exports=function(e,t){for(var r=[],i=-1,o=0,a=e.length;a>o;++o){var s=e[o];n(t[s.length],s,0)||(r[++i]=s)}return r}},{142:142}],146:[function(e,t,r){var n=e(142);t.exports=function(e,t){for(var r=[],i=-1,o=0,a=e.length;a>o;++o)n(t,e[o],0)||(r[++i]=e[o]);return r}},{142:142}],147:[function(e,t,r){function n(e){return null!==e&&typeof e===l}function i(e,t,r){var n,o,a,h,l,p,d,f,m,v,g,y,b,_,x=c(String(t)),w=Object.create(null),S=[],M=-1,E=0,C=[],T=0;if(h=[],l=-1,r-1>t){for(p=s(e,h);++l0)for(d=o.sets,f=-1,m=d.length,b=h[0];++f1&&h||b;++g1?[h]:h;++l0;++t<=r;){var i=e[t];if(!u(i)){n=!1;break}e[t]=parseInt(i,10)}if(!0===n){e.sort(a);var o=e[0],s=e[r];if(r>=s-o)return{from:o,to:s}}return e}(n))}return e}function a(e,t){return e-t}function s(e,t,r){var n=0;for(var i in e)t[n++]=i;return n>1&&t.sort(r),n}function c(e){for(var t=5381,r=-1,n=e.length;++r=0}var h=Array.isArray,l="object";t.exports=function(e){var t,r=[],a=0;for(var s in e)if(u(s)&&n(t=e[s]))for(var c=i(t,0,parseInt(s,10)).sets,h=-1,l=c.length;++h1)for(var r=1;r0?t:0);return new n(function(t,n){i.push(function(e,r){e?n(e):t(r)});var o=e.apply(r,i);!o||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then||t(o)})}},n.nodeify=function(e){return function(){var t=Array.prototype.slice.call(arguments),r="function"==typeof t[t.length-1]?t.pop():null,o=this;try{return e.apply(this,arguments).nodeify(r,o)}catch(e){if(null===r||void 0===r)return new n(function(t,r){r(e)});i(function(){r.call(o,e)})}}},n.prototype.nodeify=function(e,t){return"function"!=typeof e?this:void this.then(function(r){i(function(){e.call(t,null,r)})},function(r){i(function(){e.call(t,r)})})}},{123:123,152:152}],158:[function(e,t,r){(function(n){(function(i){var o={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},a=o[typeof window]&&window||this,s=o[typeof r]&&r&&!r.nodeType&&r,c=o[typeof t]&&t&&!t.nodeType&&t,u=(c&&c.exports,o[typeof n]&&n);!u||u.global!==u&&u.window!==u||(a=u),"object"==typeof t&&t&&t.exports===s?t.exports=i(a,t.exports,e(159)):a.Rx=i(a,{},a.Rx)}).call(this,function(e,t,r,n){function i(e){if(!S(e))throw new TypeError("fn must be a function");return p=e,function(){try{return p.apply(this,arguments)}catch(e){return N.e=e,N}}}function o(e,t,r){return new v(function(n){var i=!1,o=null,a=[];return e.subscribe(function(e){var s,c;try{c=t(e)}catch(e){return void n.onError(e)}if(s=0,i)try{s=r(c,o)}catch(e){return void n.onError(e)}else i=!0,o=c;s>0&&(o=c,a=[]),s>=0&&a.push(e)},function(e){n.onError(e)},function(){n.onNext(a),n.onCompleted()})},e)}function a(e){if(0===e.length)throw new A;return e[0]}function s(e,t,r,n){if(0>t)throw new L;return new v(function(i){var o=t;return e.subscribe(function(e){0==o--&&(i.onNext(e),i.onCompleted())},function(e){i.onError(e)},function(){r?(i.onNext(n),i.onCompleted()):i.onError(new L)})},e)}function c(e,t,r){return new v(function(n){var i=r,o=!1;return e.subscribe(function(e){o?n.onError(new Error("Sequence contains more than one element")):(i=e,o=!0)},function(e){n.onError(e)},function(){o||t?(n.onNext(i),n.onCompleted()):n.onError(new A)})},e)}function u(e,t,r){return new v(function(n){return e.subscribe(function(e){n.onNext(e),n.onCompleted()},function(e){n.onError(e)},function(){t?(n.onNext(r),n.onCompleted()):n.onError(new A)})},e)}function h(e,t,r){return new v(function(n){var i=r,o=!1;return e.subscribe(function(e){i=e,o=!0},function(e){n.onError(e)},function(){o||t?(n.onNext(i),n.onCompleted()):n.onError(new A)})},e)}function l(e,t,r,i){var o=j(t,r,3);return new v(function(t){var r=0;return e.subscribe(function(n){var a;try{a=o(n,r,e)}catch(e){return void t.onError(e)}a?(t.onNext(i?r:n),t.onCompleted()):r++},function(e){t.onError(e)},function(){t.onNext(i?-1:n),t.onCompleted()})},e)}var p,d=r.Observable,f=d.prototype,m=r.CompositeDisposable,v=r.AnonymousObservable,g=r.Disposable.empty,y=(r.internals.isEqual,r.helpers),b=y.not,_=y.defaultComparer,x=y.identity,w=y.defaultSubComparer,S=y.isFunction,M=y.isPromise,E=y.isArrayLike,C=y.isIterable,T=r.internals.inherits,O=d.fromPromise,P=d.from,j=r.internals.bindCallback,A=r.EmptyError,R=r.ObservableBase,L=r.ArgumentOutOfRangeError,N={e:{}};f.aggregate=function(){var e,t,r=!1,n=this;return 2===arguments.length?(r=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new v(function(i){var o,a,s;return n.subscribe(function(n){!s&&(s=!0);try{o?a=e(a,n):(a=r?e(t,n):n,o=!0)}catch(e){return i.onError(e)}},function(e){i.onError(e)},function(){s&&i.onNext(a),!s&&r&&i.onNext(t),!s&&!r&&i.onError(new A),i.onCompleted()})},n)};var I=function(e){function t(t,r,n,i){this.source=t,this.acc=r,this.hasSeed=n,this.seed=i,e.call(this)}function r(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 T(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this))},r.prototype.onNext=function(e){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=i(this.acc)(this.result,e):(this.result=this.hasSeed?i(this.acc)(this.seed,e):e,this.hasAccumulation=!0),this.result===N&&this.o.onError(this.result.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.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new 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)},t}(R);return f.reduce=function(e){var t=!1;if(2===arguments.length){t=!0;var r=arguments[1]}return new I(this,e,t,r)},f.some=function(e,t){var r=this;return e?r.filter(e,t).some():new v(function(e){return r.subscribe(function(){e.onNext(!0),e.onCompleted()},function(t){e.onError(t)},function(){e.onNext(!1),e.onCompleted()})},r)},f.any=function(){return this.some.apply(this,arguments)},f.isEmpty=function(){return this.any().map(b)},f.every=function(e,t){return this.filter(function(t){return!e(t)},t).some().map(b)},f.all=function(){return this.every.apply(this,arguments)},f.includes=function(e,t){var r=this;return new v(function(n){var i=0,o=+t||0;return Math.abs(o)===1/0&&(o=0),0>o?(n.onNext(!1),n.onCompleted(),g):r.subscribe(function(t){i++>=o&&function(e,t){return 0===e&&0===t||e===t||isNaN(e)&&isNaN(t)}(t,e)&&(n.onNext(!0),n.onCompleted())},function(e){n.onError(e)},function(){n.onNext(!1),n.onCompleted()})},this)},f.contains=function(e,t){f.includes(e,t)},f.count=function(e,t){return e?this.filter(e,t).count():this.reduce(function(e){return e+1},0)},f.indexOf=function(e,t){var r=this;return new v(function(n){var i=0,o=+t||0;return Math.abs(o)===1/0&&(o=0),0>o?(n.onNext(-1),n.onCompleted(),g):r.subscribe(function(t){i>=o&&t===e&&(n.onNext(i),n.onCompleted()),i++},function(e){n.onError(e)},function(){n.onNext(-1),n.onCompleted()})},r)},f.sum=function(e,t){return e&&S(e)?this.map(e,t).sum():this.reduce(function(e,t){return e+t},0)},f.minBy=function(e,t){return t||(t=w),o(this,e,function(e,r){return-1*t(e,r)})},f.min=function(e){return this.minBy(x,e).map(function(e){return a(e)})},f.maxBy=function(e,t){return t||(t=w),o(this,e,t)},f.max=function(e){return this.maxBy(x,e).map(function(e){return a(e)})},f.average=function(e,t){return e&&S(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 A;return e.sum/e.count})},f.sequenceEqual=function(e,t){var r=this;return t||(t=_),new v(function(n){var i=!1,o=!1,a=[],s=[],c=r.subscribe(function(e){var r,i;if(s.length>0){i=s.shift();try{r=t(i,e)}catch(e){return void n.onError(e)}r||(n.onNext(!1),n.onCompleted())}else o?(n.onNext(!1),n.onCompleted()):a.push(e)},function(e){n.onError(e)},function(){i=!0,0===a.length&&(s.length>0?(n.onNext(!1),n.onCompleted()):o&&(n.onNext(!0),n.onCompleted()))});(E(e)||C(e))&&(e=P(e)),M(e)&&(e=O(e));var u=e.subscribe(function(e){var r;if(a.length>0){var o=a.shift();try{r=t(o,e)}catch(e){return void n.onError(e)}r||(n.onNext(!1),n.onCompleted())}else i?(n.onNext(!1),n.onCompleted()):s.push(e)},function(e){n.onError(e)},function(){o=!0,0===s.length&&(a.length>0?(n.onNext(!1),n.onCompleted()):i&&(n.onNext(!0),n.onCompleted()))});return new m(c,u)},r)},f.elementAt=function(e){return s(this,e,!1)},f.elementAtOrDefault=function(e,t){return s(this,e,!0,t)},f.single=function(e,t){return e&&S(e)?this.where(e,t).single():c(this,!1)},f.singleOrDefault=function(e,t,r){return e&&S(e)?this.filter(e,r).singleOrDefault(null,t):c(this,!0,t)},f.first=function(e,t){return e?this.where(e,t).first():u(this,!1)},f.firstOrDefault=function(e,t,r){return e?this.where(e).firstOrDefault(null,t):u(this,!0,t)},f.last=function(e,t){return e?this.where(e,t).last():h(this,!1)},f.lastOrDefault=function(e,t,r){return e?this.where(e,r).lastOrDefault(null,t):h(this,!0,t)},f.find=function(e,t){return l(this,e,t,!1)},f.findIndex=function(e,t){return l(this,e,t,!0)},f.toSet=function(){if(void 0===e.Set)throw new TypeError;var t=this;return new v(function(r){var n=new e.Set;return t.subscribe(function(e){n.add(e)},function(e){r.onError(e)},function(){r.onNext(n),r.onCompleted()})},t)},f.toMap=function(t,r){if(void 0===e.Map)throw new TypeError;var n=this;return new v(function(i){var o=new e.Map;return n.subscribe(function(e){var n;try{n=t(e)}catch(e){return void i.onError(e)}var a=e;if(r)try{a=r(e)}catch(e){return void i.onError(e)}o.set(n,a)},function(e){i.onError(e)},function(){i.onNext(o),i.onCompleted()})},n)},r})}).call(this,void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{159:159}],159:[function(e,t,r){(function(e,n){(function(i){function o(e){for(var t=[],r=0,n=e.length;n>r;r++)t.push(e[r]);return t}function a(e,t){if(K&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(Q)){for(var r=[],n=t;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(e.stack);var i=r.join("\n"+Q+"\n");e.stack=function(e){for(var t=e.split("\n"),r=[],n=0,i=t.length;i>n;n++){var o=t[n];(function(e){var t=u(e);if(!t)return!1;var r=t[0],n=t[1];return r===Z&&n>=J&&br>=n})(o)||function(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}(o)||!o||r.push(o)}return r.join("\n")}(i)}}function c(){if(K)try{throw new Error}catch(r){var e=r.stack.split("\n"),t=u(e[0].indexOf("@")>0?e[1]:e[2]);if(!t)return;return Z=t[0],t[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 h(e){var t=[];if(!Ae(e))return t;je.nonEnumArgs&&e.length&&Re(e)&&(e=Ie.call(e));var r=je.enumPrototypes&&"function"==typeof e,n=je.enumErrorProps&&(e===Ee||e instanceof Error);for(var i in e)r&&"prototype"==i||n&&("message"==i||"name"==i)||t.push(i);if(je.nonEnumShadows&&e!==Ce){var o=e.constructor,a=-1,s=pe;if(e===(o&&o.prototype))var c=e===Te?xe:e===Ee?ge:we.call(e),u=Pe[c];for(;++a-1:void 0});return r.pop(),n.pop(),v}function f(e,t){for(var r=new Array(e),n=0;e>n;n++)r[n]=t();return r}function m(e){if(!Y(e))throw new TypeError("fn must be a function");return Le=e,function(){try{return Le.apply(this,arguments)}catch(e){return Fe.e=e,Fe}}}function v(e){throw e}function g(e,t){this.id=e,this.value=t}function y(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function b(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function _(e){this._s=s}function x(e){this._s=s,this._l=s.length,this._i=0}function w(e){this._a=e}function S(e){this._a=e,this._l=function(e){var t=+e.length;return isNaN(t)?0:0!==t&&function(e){return"number"==typeof e&&D.isFinite(e)}(t)?0>=(t=function(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}(t)*Math.floor(Math.abs(t)))?0:t>kt?kt:t:t}(e),this._i=0}function M(e,t){this.observer=e,this.parent=t}function E(e,t){return tt(e)||(e=ot),new Ft(t,e)}function C(e,t){this.observer=e,this.parent=t}function T(e,t){this.observer=e,this.parent=t}function O(){return!1}function O(){return!1}function P(){return[]}function O(){return!1}function j(){return[]}function A(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 R(e,t,r){var n=he(t,r,3);return e.map(function(t,r){var i=n(t,r,e);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Bt(i)),i}).concatAll()}function L(e){this.comparer=e,this.set=[]}function N(e,t,r){var n=he(t,r,3);return e.map(function(t,r){var i=n(t,r,e);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Bt(i)),i}).mergeAll()}var I={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},D=I[typeof window]&&window||this,k=I[typeof r]&&r&&!r.nodeType&&r,B=I[typeof t]&&t&&!t.nodeType&&t,F=B&&B.exports===k&&k,U=I[typeof n]&&n;!U||U.global!==U&&U.window!==U||(D=U);var $={internals:{},config:{Promise:D.Promise},helpers:{}},z=$.helpers.noop=function(){},G=($.helpers.notDefined=function(e){return void 0===e},$.helpers.identity=function(e){return e}),V=($.helpers.pluck=function(e){return function(t){return t[e]}},$.helpers.just=function(e){return function(){return e}},$.helpers.defaultNow=Date.now),H=$.helpers.defaultComparer=function(e,t){return Ne(e,t)},q=$.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},W=($.helpers.defaultKeySerializer=function(e){return e.toString()},$.helpers.defaultError=function(e){throw e}),X=$.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},Y=($.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},$.helpers.not=function(e){return!e},$.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==we.call(e)}),e}());$.config.longStackSupport=!1;var K=!1;try{throw new Error}catch(e){K=!!e.stack}var Z,J=c(),Q="From previous event:";($.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)}).prototype=Error.prototype;var ee=$.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};ee.prototype=Error.prototype;var te=$.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};te.prototype=Error.prototype;var re=$.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};re.prototype=Error.prototype;var ne=$.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};ne.prototype=Error.prototype;var ie=$.helpers.notImplemented=function(){throw new ne},oe=$.helpers.notSupported=function(){throw new re},ae="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";D.Set&&"function"==typeof(new D.Set)["@@iterator"]&&(ae="@@iterator");var se=$.doneEnumerator={done:!0,value:i},ce=$.helpers.isIterable=function(e){return e[ae]!==i},ue=$.helpers.isArrayLike=function(e){return e&&e.length!==i};$.helpers.iterator=ae;var he=$.internals.bindCallback=function(e,t,r){if(void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}},le=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],pe=le.length,de="[object Arguments]",fe="[object Array]",me="[object Boolean]",ve="[object Date]",ge="[object Error]",ye="[object Number]",be="[object Object]",_e="[object RegExp]",xe="[object String]",we=Object.prototype.toString,Se=Object.prototype.hasOwnProperty,Me=we.call(arguments)==de,Ee=Error.prototype,Ce=Object.prototype,Te=String.prototype,Oe=Ce.propertyIsEnumerable;try{!(we.call(document)==be&&!({toString:0}+""))}catch(e){!0}var Pe={};Pe[fe]=Pe[ve]=Pe[ye]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Pe[me]=Pe[xe]={constructor:!0,toString:!0,valueOf:!0},Pe[ge]=Pe["[object Function]"]=Pe[_e]={constructor:!0,toString:!0},Pe[be]={constructor:!0};var je={};!function(){var e=function(){this.x=1},t=[];e.prototype={valueOf:1,y:1};for(var r in new e)t.push(r);for(r in arguments);je.enumErrorProps=Oe.call(Ee,"message")||Oe.call(Ee,"name"),je.enumPrototypes=Oe.call(e,"prototype"),je.nonEnumArgs=0!=r,je.nonEnumShadows=!/valueOf/.test(t)}(1);var Ae=$.internals.isObject=function(e){var t=typeof e;return e&&("function"==t||"object"==t)||!1},Re=function(e){return!(!e||"object"!=typeof e)&&we.call(e)==de};Me||(Re=function(e){return!(!e||"object"!=typeof e)&&Se.call(e,"callee")});var Le,Ne=$.internals.isEqual=function(e,t){return d(e,t,[],[])},Ie=Array.prototype.slice,De=this.inherits=$.internals.inherits=function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r},ke=$.internals.addProperties=function(e){for(var t=[],r=1,n=arguments.length;n>r;r++)t.push(arguments[r]);for(var i=0,o=t.length;o>i;i++){var a=t[i];for(var s in a)e[s]=a[s]}},Be=$.internals.addRef=function(e,t){return new fr(function(r){return new ze(t.getDisposable(),e.subscribe(r))})},Fe={e:{}};g.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var Ue=$.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},$e=Ue.prototype;$e.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},$e.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var r=this.items[e];this.items[e]=this.items[t],this.items[t]=r,this.percolate(t)}}},$e.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,r=2*e+2,n=e;if(te;e++)r[e]=arguments[e];for(e=0;t>e;e++)if(!We(r[e]))throw new TypeError("Not a disposable");this.disposables=r,this.isDisposed=!1,this.length=r.length},Ge=ze.prototype;Ge.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},Ge.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},Ge.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),r=0;e>r;r++)t[r]=this.disposables[r];for(this.disposables=[],this.length=0,r=0;e>r;r++)t[r].dispose()}};var Ve=$.Disposable=function(e){this.isDisposed=!1,this.action=e||z};Ve.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var He=Ve.create=function(e){return new Ve(e)},qe=Ve.empty={dispose:z},We=Ve.isDisposable=function(e){return e&&Y(e.dispose)},Xe=Ve.checkDisposed=function(e){if(e.isDisposed)throw new ee},Ye=$.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};Ye.prototype.getDisposable=function(){return this.current},Ye.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()},Ye.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var Ke=$.SerialDisposable=function(){this.isDisposed=!1,this.current=null};Ke.prototype.getDisposable=function(){return this.current},Ke.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var r=this.current;this.current=e}r&&r.dispose(),t&&e&&e.dispose()},Ke.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var Ze=$.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?qe:new e(this)},t}();y.prototype.dispose=function(){this.scheduler.scheduleWithState(this,b)};var Je=$.internals.ScheduledItem=function(e,t,r,n,i){this.scheduler=e,this.state=t,this.action=r,this.dueTime=n,this.comparer=i||q,this.disposable=new Ye};Je.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Je.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},Je.prototype.isCancelled=function(){return this.disposable.isDisposed},Je.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Qe=$.Scheduler=function(){function e(e,t,r,n){this.now=e,this._schedule=t,this._scheduleRelative=r,this._scheduleAbsolute=n}function t(e,t){return t(),qe}e.isScheduler=function(t){return t instanceof e};var r=e.prototype;return r.schedule=function(e){return this._schedule(e,t)},r.scheduleWithState=function(e,t){return this._schedule(e,t)},r.scheduleWithRelative=function(e,r){return this._scheduleRelative(r,e,t)},r.scheduleWithRelativeAndState=function(e,t,r){return this._scheduleRelative(e,t,r)},r.scheduleWithAbsolute=function(e,r){return this._scheduleAbsolute(r,e,t)},r.scheduleWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute(e,t,r)},e.now=V,e.normalize=function(e){return 0>e&&(e=0),e},e}(),et=Qe.normalize,tt=Qe.isScheduler;!function(e){function t(e,t){function r(t){i(t,function(t){var n=!1,i=!1,a=e.scheduleWithState(t,function(e,t){return n?o.remove(a):i=!0,r(t),qe});i||(o.add(a),n=!0)})}var n=t[0],i=t[1],o=new ze;return r(n),o}function r(e,t,r){function n(t){o(t,function(t,i){var o=!1,s=!1,c=e[r](t,i,function(e,t){return o?a.remove(c):s=!0,n(t),qe});s||(a.add(c),o=!0)})}var i=t[0],o=t[1],a=new ze;return n(i),a}function n(e,t){e(function(r){t(e,r)})}e.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,n)},e.scheduleRecursiveWithState=function(e,r){return this.scheduleWithState([e,r],t)},e.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,n)},e.scheduleRecursiveWithRelativeAndState=function(e,t,n){return this._scheduleRelative([e,n],t,function(e,t){return r(e,t,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,n)},e.scheduleRecursiveWithAbsoluteAndState=function(e,t,n){return this._scheduleAbsolute([e,n],t,function(e,t){return r(e,t,"scheduleWithAbsoluteAndState")})}}(Qe.prototype),Qe.prototype,Qe.prototype.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,t)},Qe.prototype.schedulePeriodicWithState=function(e,t,r){if(void 0===D.setInterval)throw new re;t=et(t);var n=e,i=D.setInterval(function(){n=r(n)},t);return He(function(){D.clearInterval(i)})},function(e){e.catchError=e.catch=function(e){return new ut(this,e)}}(Qe.prototype);var rt,nt,it=($.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 Ye;return this._cancel=e,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}(),Qe.immediate=function(){return new Qe(V,function(e,t){return t(this,e)},oe,oe)}()),ot=Qe.currentThread=function(){function e(){for(;t.length>0;){var e=t.dequeue();!e.isCancelled()&&e.invoke()}}var t,r=new Qe(V,function(r,n){var i=new Je(this,r,n,this.now());if(t)t.enqueue(i);else{(t=new Ue(4)).enqueue(i);var o=m(e)();if(t=null,o===Fe)return v(o.e)}return i.disposable},oe,oe);return r.scheduleRequired=function(){return!t},r}(),at=function(){var e,t=z;if(D.setTimeout)e=D.setTimeout,t=D.clearTimeout;else{if(!D.WScript)throw new re;e=function(e,t){D.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),st=at.setTimeout,ct=at.clearTimeout;!function(){function t(e){if(o)st(function(){t(e)},0);else{var r=i[e];if(r){o=!0;var n=m(r)();if(nt(e),o=!1,n===Fe)return v(n.e)}}}function r(e){"string"==typeof e.data&&e.data.substring(0,c.length)===c&&t(e.data.substring(c.length))}var n=1,i={},o=!1;nt=function(e){delete i[e]};var a=RegExp("^"+String(we).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),s="function"==typeof(s=U&&F&&U.setImmediate)&&!a.test(s)&&s;if(Y(s))rt=function(e){var r=n++;return i[r]=e,s(function(){t(r)}),r};else if(void 0!==e&&"[object process]"==={}.toString.call(e))rt=function(r){var o=n++;return i[o]=r,e.nextTick(function(){t(o)}),o};else if(function(){if(!D.postMessage||D.importScripts)return!1;var e=!1,t=D.onmessage;return D.onmessage=function(){e=!0},D.postMessage("","*"),D.onmessage=t,e}()){var c="ms.rx.schedule"+Math.random();D.addEventListener?D.addEventListener("message",r,!1):D.attachEvent?D.attachEvent("onmessage",r):D.onmessage=r,rt=function(e){var t=n++;return i[t]=e,D.postMessage(c+currentId,"*"),t}}else if(D.MessageChannel){var u=new D.MessageChannel;u.port1.onmessage=function(e){t(e.data)},rt=function(e){var t=n++;return i[t]=e,u.port2.postMessage(t),t}}else rt="document"in D&&"onreadystatechange"in D.document.createElement("script")?function(e){var r=D.document.createElement("script"),o=n++;return i[o]=e,r.onreadystatechange=function(){t(o),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},D.document.documentElement.appendChild(r),o}:function(e){var r=n++;return i[r]=e,st(function(){t(r)},0),r}}();var ut=(Qe.timeout=Qe.default=function(){return new Qe(V,function(e,t){var r=this,n=new Ye,i=rt(function(){!n.isDisposed&&n.setDisposable(t(r,e))});return new ze(n,He(function(){nt(i)}))},function(e,t,r){var n=this,i=Qe.normalize(t),o=new Ye;if(0===i)return n.scheduleWithState(e,r);var a=st(function(){!o.isDisposed&&o.setDisposable(r(n,e))},i);return new ze(o,He(function(){ct(a)}))},function(e,t,r){return this.scheduleWithRelativeAndState(e,t-this.now(),r)})}(),function(e){function t(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function r(e,t,r){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(r))}function n(e,t,r){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(r))}function i(i,o){this._scheduler=i,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,e.call(this,this._scheduler.now.bind(this._scheduler),t,r,n)}return De(i,e),i.prototype._clone=function(e){return new i(e,this._handler)},i.prototype._wrap=function(e){var t=this;return function(r,n){try{return e(t._getRecursiveWrapper(r),n)}catch(e){if(!t._handler(e))throw e;return qe}}},i.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},i.prototype.schedulePeriodicWithState=function(e,t,r){var n=this,i=!1,o=new Ye;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},i}(Qe)),ht=$.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 tt(e)||(e=it),new fr(function(r){return e.scheduleWithState(t,function(e,t){t._acceptObservable(r),"N"===t.kind&&r.onCompleted()})})},e}(),lt=ht.createOnNext=function(){function e(e){return e(this.value)}function t(e){return e.onNext(this.value)}function r(){return"OnNext("+this.value+")"}return function(n){return new ht("N",n,null,e,t,r)}}(),pt=ht.createOnError=function(){function e(e,t){return t(this.exception)}function t(e){return e.onError(this.exception)}function r(){return"OnError("+this.exception+")"}return function(n){return new ht("E",null,n,e,t,r)}}(),dt=ht.createOnCompleted=function(){function e(e,t,r){return r()}function t(e){return e.onCompleted()}function r(){return"OnCompleted()"}return function(){return new ht("C",null,null,e,t,r)}}(),ft=$.Observer=function(){};ft.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},ft.prototype.asObserver=function(){return new yt(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},ft.prototype.checked=function(){return new bt(this)};var mt=ft.create=function(e,t,r){return e||(e=z),t||(t=W),r||(r=z),new yt(e,t,r)};ft.fromNotifier=function(e,t){return new yt(function(r){return e.call(t,lt(r))},function(r){return e.call(t,pt(r))},function(){return e.call(t,dt())})},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 vt,gt=$.internals.AbstractObserver=function(e){function t(){this.isStopped=!1,e.call(this)}return De(t,e),t.prototype.next=ie,t.prototype.error=ie,t.prototype.completed=ie,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),yt=$.AnonymousObserver=function(e){function t(t,r,n){e.call(this),this._onNext=t,this._onError=r,this._onCompleted=n}return De(t,e),t.prototype.next=function(e){this._onNext(e)},t.prototype.error=function(e){this._onError(e)},t.prototype.completed=function(){this._onCompleted()},t}(gt),bt=function(e){function t(t){e.call(this),this._observer=t,this._state=0}De(t,e);var r=t.prototype;return r.onNext=function(e){this.checkAccess();var t=m(this._observer.onNext).call(this._observer,e);this._state=0,t===Fe&&v(t.e)},r.onError=function(e){this.checkAccess();var t=m(this._observer.onError).call(this._observer,e);this._state=2,t===Fe&&v(t.e)},r.onCompleted=function(){this.checkAccess();var e=m(this._observer.onCompleted).call(this._observer);this._state=2,e===Fe&&v(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)},t}(ft),_t=function(e){function t(t,r,n){e.call(this,t,r),this._cancel=n}return De(t,e),t.prototype.next=function(t){e.prototype.next.call(this,t),this.ensureActive()},t.prototype.error=function(t){e.prototype.error.call(this,t),this.ensureActive()},t.prototype.completed=function(){e.prototype.completed.call(this),this.ensureActive()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},t}($.internals.ScheduledObserver=function(e){function t(t,r){e.call(this),this.scheduler=t,this.observer=r,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Ke}return De(t,e),t.prototype.next=function(e){var t=this;this.queue.push(function(){t.observer.onNext(e)})},t.prototype.error=function(e){var t=this;this.queue.push(function(){t.observer.onError(e)})},t.prototype.completed=function(){var e=this;this.queue.push(function(){e.observer.onCompleted()})},t.prototype.ensureActive=function(){var e=!1,t=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(t.queue.length>0){r=t.queue.shift();try{r()}catch(e){throw t.queue=[],t.hasFaulted=!0,e}e()}else t.isAcquired=!1}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}(gt)),xt=$.Observable=function(){function e(e){if($.config.longStackSupport&&K){try{throw new Error}catch(e){this.stack=e.stack.substring(e.stack.indexOf("\n")+1)}var t=this;this._subscribe=function(r){var n=r.onError.bind(r);return r.onError=function(e){a(e,t),n(e)},e.call(t,r)}}else this._subscribe=e}return vt=e.prototype,vt.subscribe=vt.forEach=function(e,t,r){return this._subscribe("object"==typeof e?e:mt(e,t,r))},vt.subscribeOnNext=function(e,t){return this._subscribe(mt(void 0!==t?function(r){e.call(t,r)}:e))},vt.subscribeOnError=function(e,t){return this._subscribe(mt(null,void 0!==t?function(r){e.call(t,r)}:e))},vt.subscribeOnCompleted=function(e,t){return this._subscribe(mt(null,null,void 0!==t?function(){e.call(t)}:e))},e}(),wt=$.ObservableBase=function(e){function t(e,t){var r=t[0],n=t[1],i=m(n.subscribeCore).call(n,r);return i!==Fe||r.fail(Fe.e)?void r.setDisposable(function(e){return e&&Y(e.dispose)?e:Y(e)?He(e):qe}(i)):v(Fe.e)}function r(e){var r=new mr(e),n=[r,this];return ot.scheduleRequired()?ot.scheduleWithState(n,t):t(0,n),r}function n(){e.call(this,r)}return De(n,e),n.prototype.subscribeCore=ie,n}(xt),St=$.internals.Enumerable=function(){},Mt=function(e){function t(t){this.sources=t,e.call(this)}function r(e,t,r){this.o=e,this.s=t,this.e=r,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){var t,n=new Ke,i=it.scheduleRecursiveWithState(this.sources[ae](),function(i,o){if(!t){var a=m(i.next).call(i);if(a===Fe)return e.onError(a.e);if(a.done)return e.onCompleted();var s=a.value;X(s)&&(s=At(s));var c=new Ye;n.setDisposable(c),c.setDisposable(s.subscribe(new r(e,o,i)))}});return new ze(n,i,He(function(){t=!0}))},r.prototype.onNext=function(e){this.isStopped||this.o.onNext(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.s(this.e))},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},t}(wt);St.prototype.concat=function(){return new Mt(this)};var Et=function(e){function t(t){this.sources=t,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){var t,r=this.sources[ae](),n=new Ke,i=it.scheduleRecursiveWithState(null,function(i,o){if(!t){var a=m(r.next).call(r);if(a===Fe)return e.onError(a.e);if(a.done)return null!==i?e.onError(i):e.onCompleted();var s=a.value;X(s)&&(s=At(s));var c=new Ye;n.setDisposable(c),c.setDisposable(s.subscribe(function(t){e.onNext(t)},o,function(){e.onCompleted()}))}});return new ze(n,i,He(function(){t=!0}))},t}(wt);St.prototype.catchError=function(){return new Et(this)},St.prototype.catchErrorWhen=function(e){var t=this;return new fr(function(r){var n,i=new gr,o=new gr,a=e(i).subscribe(o),s=t[ae](),c=new Ke,u=it.scheduleRecursive(function(e){if(!n){var t=m(s.next).call(s);if(t===Fe)return r.onError(t.e);if(t.done)return void r.onCompleted();var a=t.value;X(a)&&(a=At(a));var u=new Ye,h=new Ye;c.setDisposable(new ze(h,u)),u.setDisposable(a.subscribe(function(e){r.onNext(e)},function(t){h.setDisposable(o.subscribe(e,function(e){r.onError(e)},function(){r.onCompleted()})),i.onNext(t)},function(){r.onCompleted()}))}});return new ze(a,c,u,He(function(){n=!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 De(t,St),t.prototype[ae]=function(){return new r(this)},r.prototype.next=function(){return 0===this.l?se:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(),Tt=St.repeat=function(e,t){return new Ct(e,t)},Ot=function(e){function t(e,t,r){this.s=e,this.fn=t?he(t,r,3):null}function r(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return De(t,St),t.prototype[ae]=function(){return new r(this)},r.prototype.next=function(){return++this.in?(e.onNext(t[n]),i(n+1)):e.onCompleted()})};var Ut=xt.fromArray=function(e,t){return tt(t)||(t=ot),new Ft(e,t)};xt.generate=function(e,t,r,n,i){return tt(i)||(i=ot),new fr(function(o){var a=!0;return i.scheduleRecursiveWithState(e,function(e,i){var s,c;try{a?a=!1:e=r(e),(s=t(e))&&(c=n(e))}catch(e){return o.onError(e)}s?(o.onNext(c),i(e)):o.onCompleted()})})};var $t=function(e){function t(){e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return qe},t}(wt),zt=xt.never=function(){return new $t};xt.of=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return new Ft(t,ot)},xt.ofWithScheduler=function(e){for(var t=arguments.length,r=new Array(t-1),n=1;t>n;n++)r[n-1]=arguments[n];return new Ft(r,e)};var Gt=function(e){function t(t,r){this.obj=t,this.keys=Object.keys(t),this.scheduler=r,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return new C(e,this).run()},t}(wt);C.prototype.run=function(){var e=this.observer,t=this.parent.obj,r=this.parent.keys,n=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,function(i,o){if(n>i){var a=r[i];e.onNext([a,t[a]]),o(i+1)}else e.onCompleted()})},xt.pairs=function(e,t){return t||(t=ot),new Gt(e,t)};var Vt=function(e){function t(t,r,n){this.start=t,this.rangeCount=r,this.scheduler=n,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return new Ht(e,this).run()},t}(wt),Ht=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){var e=this.parent.start,t=this.parent.rangeCount,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,function(n,i){t>n?(r.onNext(e+n),i(n+1)):r.onCompleted()})},e}();xt.range=function(e,t,r){return tt(r)||(r=ot),new Vt(e,t,r)};var qt=function(e){function t(t,r,n){this.value=t,this.repeatCount=null==r?-1:r,this.scheduler=n,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return new T(e,this).run()},t}(wt);T.prototype.run=function(){var e=this.observer,t=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,function(r,n){return(-1===r||r>0)&&(e.onNext(t),r>0&&r--),0===r?e.onCompleted():void n(r)})},xt.repeat=function(e,t,r){return tt(r)||(r=ot),new qt(e,t,r)};var Wt=function(e){function t(t,r){this.value=t,this.scheduler=r,e.call(this)}function r(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 De(t,e),t.prototype.subscribeCore=function(e){return new r(e,this).run()},r.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],n)},t}(wt),Xt=(xt.return=xt.just=xt.returnValue=function(e,t){return tt(t)||(t=it),new Wt(e,t)},function(e){function t(t,r){this.error=t,this.scheduler=r,e.call(this)}function r(e,t){this.o=e,this.p=t}function n(e,t){var r=t[0];t[1].onError(r)}return De(t,e),t.prototype.subscribeCore=function(e){return new r(e,this).run()},r.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],n)},t}(wt)),Yt=xt.throw=xt.throwError=xt.throwException=function(e,t){return tt(t)||(t=it),new Xt(e,t)};xt.using=function(e,t){return new fr(function(r){var n,i,o=qe;try{(n=e())&&(o=n),i=t(n)}catch(e){return new ze(Yt(e).subscribe(r),o)}return new ze(i.subscribe(r),o)})},vt.amb=function(e){var t=this;return new fr(function(r){function n(){o||(o=a,u.dispose())}function i(){o||(o=s,c.dispose())}var o,a="L",s="R",c=new Ye,u=new Ye;return X(e)&&(e=At(e)),c.setDisposable(t.subscribe(function(e){n(),o===a&&r.onNext(e)},function(e){n(),o===a&&r.onError(e)},function(){n(),o===a&&r.onCompleted()})),u.setDisposable(e.subscribe(function(e){i(),o===s&&r.onNext(e)},function(e){i(),o===s&&r.onError(e)},function(){i(),o===s&&r.onCompleted()})),new ze(c,u)})},xt.amb=function(){function e(e,t){return e.amb(t)}var t=zt(),r=[];if(Array.isArray(arguments[0]))r=arguments[0];else for(var n=0,i=arguments.length;i>n;n++)r.push(arguments[n]);for(var n=0,i=r.length;i>n;n++)t=e(t,r[n]);return t},vt.catch=vt.catchError=vt.catchException=function(e){return"function"==typeof e?function(e,t){return new fr(function(r){var n=new Ye,i=new Ke;return i.setDisposable(n),n.setDisposable(e.subscribe(function(e){r.onNext(e)},function(e){try{var n=t(e)}catch(e){return r.onError(e)}X(n)&&(n=At(n));var o=new Ye;i.setDisposable(o),o.setDisposable(n.subscribe(r))},function(e){r.onCompleted(e)})),i},e)}(this,e):Kt([this,e])};var Kt=xt.catchError=xt.catch=xt.catchException=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return Pt(e).catchError()};vt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Zt.apply(this,t)};var Zt=xt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new fr(function(e){function r(t){if(s[t]=!0,c||(c=s.every(G))){try{var r=n.apply(null,h)}catch(t){return e.onError(t)}e.onNext(r)}else u.filter(function(e,r){return r!==t}).every(G)&&e.onCompleted()}function i(t){u[t]=!0,u.every(G)&&e.onCompleted()}for(var o=t.length,a=function(){return!1},s=f(o,a),c=!1,u=f(o,a),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(n){var o=t[n],a=new Ye;X(o)&&(o=At(o)),a.setDisposable(o.subscribe(function(e){h[n]=e,r(n)},function(t){e.onError(t)},function(){i(n)})),l[n]=a}(p);return new ze(l)},this)};vt.concat=function(){for(var e=[],t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return e.unshift(this),Qt.apply(null,e)};var Jt=function(e){function t(t){this.sources=t,e.call(this)}function r(e,t){this.sources=e,this.o=t}return De(t,e),t.prototype.subscribeCore=function(e){return new r(this.sources,e).run()},r.prototype.run=function(){var e,t=new Ke,r=this.sources,n=r.length,i=this.o,o=it.scheduleRecursiveWithState(0,function(o,a){if(!e){if(o===n)return i.onCompleted();var s=r[o];X(s)&&(s=At(s));var c=new Ye;t.setDisposable(c),c.setDisposable(s.subscribe(function(e){i.onNext(e)},function(e){i.onError(e)},function(){a(o+1)}))}});return new ze(t,o,He(function(){e=!0}))},t}(wt),Qt=xt.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,r=arguments.length;r>t;t++)e[t]=arguments[t]}return new Jt(e)};vt.concatAll=vt.concatObservable=function(){return this.merge(1)};var er=function(e){function t(t,r){this.source=t,this.maxConcurrent=r,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){var t=new ze;return t.add(this.source.subscribe(new tr(e,this.maxConcurrent,t))),t},t}(wt),tr=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 t(e,t){this.parent=e,this.sad=t,this.isStopped=!1}return e.prototype.handleSubscribe=function(e){var r=new Ye;this.g.add(r),X(e)&&(e=At(e)),r.setDisposable(e.subscribe(new t(this,r)))},e.prototype.onNext=function(e){this.isStopped||(this.activeCount0?e.handleSubscribe(e.q.shift()):(e.activeCount--,e.done&&0===e.activeCount&&e.o.onCompleted())}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();vt.merge=function(e){return"number"!=typeof e?rr(this,e):new er(this,e)};var rr=xt.merge=function(){var e,t,r=[],n=arguments.length;if(arguments[0])if(tt(arguments[0]))for(e=arguments[0],t=1;n>t;t++)r.push(arguments[t]);else for(e=it,t=0;n>t;t++)r.push(arguments[t]);else for(e=it,t=1;n>t;t++)r.push(arguments[t]);return Array.isArray(r[0])&&(r=r[0]),E(e,r).mergeAll()},nr=$.CompositeError=function(e){this.name="NotImplementedError",this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};nr.prototype=Error.prototype,xt.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var r=0;t>r;r++)e[r]=arguments[r]}var n=E(null,e);return new fr(function(e){function t(){0===a.length?e.onCompleted():1===a.length?e.onError(a[0]):e.onError(new nr(a))}var r=new ze,i=new Ye,o=!1,a=[];return r.add(i),i.setDisposable(n.subscribe(function(n){var i=new Ye;r.add(i),X(n)&&(n=At(n)),i.setDisposable(n.subscribe(function(t){e.onNext(t)},function(e){a.push(e),r.remove(i),o&&1===r.length&&t()},function(){r.remove(i),o&&1===r.length&&t()}))},function(e){a.push(e),o=!0,1===r.length&&t()},function(){o=!0,1===r.length&&t()})),r})};var ir=function(e){function t(t){this.source=t,e.call(this)}function r(e,t){this.o=e,this.g=t,this.isStopped=!1,this.done=!1}function n(e,t,r){this.parent=e,this.g=t,this.sad=r,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){var t=new ze,n=new Ye;return t.add(n),n.setDisposable(this.source.subscribe(new r(e,t))),t},r.prototype.onNext=function(e){if(!this.isStopped){var t=new Ye;this.g.add(t),X(e)&&(e=At(e)),t.setDisposable(e.subscribe(new n(this,this.g,t)))}},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},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(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},n.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},n.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()}},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.parent.o.onError(e),!0)},t}(wt);vt.mergeAll=vt.mergeObservable=function(){return new ir(this)},vt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return or([this,e])};var or=xt.onErrorResumeNext=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,r=arguments.length;r>t;t++)e.push(arguments[t]);return new fr(function(t){var r=0,n=new Ke,i=it.scheduleRecursive(function(i){var o,a;rr;r++)t[r]=arguments[r];var n=t.pop(),i=this;return Array.isArray(t[0])&&(t=t[0]),new fr(function(e){for(var r=t.length,o=f(r,O),a=!1,s=new Array(r),c=new Array(r+1),u=0;r>u;u++)!function(r){var n=t[r],i=new Ye;X(n)&&(n=At(n)),i.setDisposable(n.subscribe(function(e){s[r]=e,o[r]=!0,a=o.every(G)},function(t){e.onError(t)},z)),c[r]=i}(u);var h=new Ye;return h.setDisposable(i.subscribe(function(t){var r=[t].concat(s);if(a){var i=m(n).apply(null,r);return i===Fe?e.onError(i.e):void e.onNext(i)}},function(t){e.onError(t)},function(){e.onCompleted()})),c[r]=h,new ze(c)},this)},vt.zip=function(){if(Array.isArray(arguments[0]))return function(e,t){var r=this;return new fr(function(n){var i=0,o=e.length;return r.subscribe(function(r){if(o>i){var a=e[i++],s=m(t)(r,a);if(s===Fe)return n.onError(s.e);n.onNext(s)}else n.onCompleted()},function(e){n.onError(e)},function(){n.onCompleted()})},r)}.apply(this,arguments);for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=this,i=t.pop();return t.unshift(n),new fr(function(e){for(var r=t.length,o=f(r,P),a=f(r,O),s=new Array(r),c=0;r>c;c++)!function(r){var c=t[r],u=new Ye;X(c)&&(c=At(c)),u.setDisposable(c.subscribe(function(t){if(o[r].push(t),o.every(function(e){return e.length>0})){var s=o.map(function(e){return e.shift()}),c=m(i).apply(n,s);if(c===Fe)return e.onError(c.e);e.onNext(c)}else a.filter(function(e,t){return t!==r}).every(G)&&e.onCompleted()},function(t){e.onError(t)},function(){a[r]=!0,a.every(G)&&e.onCompleted()})),s[r]=u}(c);return new ze(s)},n)},xt.zip=function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=t.shift();return n.zip.apply(n,t)},xt.zipArray=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var r=0;t>r;r++)e[r]=arguments[r]}return new fr(function(t){for(var r=e.length,n=f(r,j),i=f(r,O),o=new Array(r),a=0;r>a;a++)!function(r){o[r]=new Ye,o[r].setDisposable(e[r].subscribe(function(e){if(n[r].push(e),n.every(function(e){return e.length>0})){var o=n.map(function(e){return e.shift()});t.onNext(o)}else if(i.filter(function(e,t){return t!==r}).every(G))return t.onCompleted()},function(e){t.onError(e)},function(){i[r]=!0,i.every(G)&&t.onCompleted()}))}(a);return new ze(o)})},vt.asObservable=function(){var e=this;return new fr(function(t){return e.subscribe(t)},e)},vt.bufferWithCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).selectMany(function(e){return e.toArray()}).where(function(e){return e.length>0})},vt.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)},vt.distinctUntilChanged=function(e,t){var r=this;return t||(t=H),new fr(function(n){var i,o=!1;return r.subscribe(function(r){var a=r;if(e&&(a=m(e)(r))===Fe)return n.onError(a.e);if(o){var s=m(t)(i,a);if(s===Fe)return n.onError(s.e)}o&&s||(o=!0,i=a,n.onNext(r))},function(e){n.onError(e)},function(){n.onCompleted()})},this)};var cr=function(e){function t(t,r,n,i){this.source=t,this.t=!r||Y(r)?mt(r||z,n||z,i||z):r,e.call(this)}function r(e,t){this.o=e,this.t=t,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.t))},r.prototype.onNext=function(e){if(!this.isStopped){var t=m(this.t.onNext).call(this.t,e);t===Fe&&this.o.onError(t.e),this.o.onNext(e)}},r.prototype.onError=function(e){if(!this.isStopped){this.isStopped=!0;var t=m(this.t.onError).call(this.t,e);if(t===Fe)return this.o.onError(t.e);this.o.onError(e)}},r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=m(this.t.onCompleted).call(this.t);if(e===Fe)return this.o.onError(e.e);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)},t}(wt);vt.do=vt.tap=vt.doAction=function(e,t,r){return new cr(this,e,t,r)},vt.doOnNext=vt.tapOnNext=function(e,t){return this.tap(void 0!==t?function(r){e.call(t,r)}:e)},vt.doOnError=vt.tapOnError=function(e,t){return this.tap(z,void 0!==t?function(r){e.call(t,r)}:e)},vt.doOnCompleted=vt.tapOnCompleted=function(e,t){return this.tap(z,null,void 0!==t?function(){e.call(t)}:e)},vt.finally=vt.ensure=function(e){var t=this;return new fr(function(r){var n;try{n=t.subscribe(r)}catch(t){throw e(),t}return He(function(){try{n.dispose()}catch(e){throw e}finally{e()}})},this)},vt.finallyAction=function(e){return this.ensure(e)};var ur=function(e){function t(t){this.source=t,e.call(this)}function r(e){this.o=e,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e))},r.prototype.onNext=z,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)},t}(wt);vt.ignoreElements=function(){return new ur(this)},vt.materialize=function(){var e=this;return new fr(function(t){return e.subscribe(function(e){t.onNext(lt(e))},function(e){t.onNext(pt(e)),t.onCompleted()},function(){t.onNext(dt()),t.onCompleted()})},e)},vt.repeat=function(e){return Tt(this,e).concat()},vt.retry=function(e){return Tt(this,e).catchError()},vt.retryWhen=function(e){return Tt(this).catchErrorWhen(e)};var hr=function(e){function t(t,r,n,i){this.source=t,this.accumulator=r,this.hasSeed=n,this.seed=i,e.call(this)}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new A(e,this))},t}(wt);A.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)}},A.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},A.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},A.prototype.dispose=function(){this.isStopped=!0},A.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.observer.onError(e),!0)},vt.scan=function(){var e,t,r=!1;return 2===arguments.length?(r=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new hr(this,t,r,e)},vt.skipLast=function(e){if(0>e)throw new te;var t=this;return new fr(function(r){var n=[];return t.subscribe(function(t){n.push(t),n.length>e&&r.onNext(n.shift())},function(e){r.onError(e)},function(){r.onCompleted()})},t)},vt.startWith=function(){var e,t=0;arguments.length&&tt(arguments[0])?(e=arguments[0],t=1):e=it;for(var r=[],n=t,i=arguments.length;i>n;n++)r.push(arguments[n]);return Pt([Ut(r,e),this]).concat()},vt.takeLast=function(e){if(0>e)throw new te;var t=this;return new fr(function(r){var n=[];return t.subscribe(function(t){n.push(t),n.length>e&&n.shift()},function(e){r.onError(e)},function(){for(;n.length>0;)r.onNext(n.shift());r.onCompleted()})},t)},vt.takeLastBuffer=function(e){var t=this;return new fr(function(r){var n=[];return t.subscribe(function(t){n.push(t),n.length>e&&n.shift()},function(e){r.onError(e)},function(){r.onNext(n),r.onCompleted()})},t)},vt.windowWithCount=function(e,t){var r=this;if(+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new te;if(null==t&&(t=e),+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new te;return new fr(function(n){function i(){var e=new gr;c.push(e),n.onNext(Be(e,a))}var o=new Ye,a=new Ze(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-e+1;a>=0&&a%t==0&&c.shift().onCompleted(),++s%t==0&&i()},function(e){for(;c.length>0;)c.shift().onError(e);n.onError(e)},function(){for(;c.length>0;)c.shift().onCompleted();n.onCompleted()})),a},r)},vt.selectConcat=vt.concatMap=function(e,t,r){return Y(e)&&Y(t)?this.concatMap(function(r,n){var i=e(r,n);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Bt(i)),i.map(function(e,i){return t(r,e,n,i)})}):Y(e)?R(this,e,r):R(this,function(){return e})},vt.concatMapObserver=vt.selectConcatObserver=function(e,t,r,n){var i=this,o=he(e,n,2),a=he(t,n,1),s=he(r,n,0);return new fr(function(e){var t=0;return i.subscribe(function(r){var n;try{n=o(r,t++)}catch(t){return void e.onError(t)}X(n)&&(n=At(n)),e.onNext(n)},function(t){var r;try{r=a(t)}catch(t){return void e.onError(t)}X(r)&&(r=At(r)),e.onNext(r),e.onCompleted()},function(){var t;try{t=s()}catch(t){return void e.onError(t)}X(t)&&(t=At(t)),e.onNext(t),e.onCompleted()})},this).concatAll()},vt.defaultIfEmpty=function(e){var t=this;return e===i&&(e=null),new fr(function(r){var n=!1;return t.subscribe(function(e){n=!0,r.onNext(e)},function(e){r.onError(e)},function(){!n&&r.onNext(e),r.onCompleted()})},t)},L.prototype.push=function(e){var t=-1===function(e,t,r){for(var n=0,i=e.length;i>n;n++)if(r(e[n],t))return n;return-1}(this.set,e,this.comparer);return t&&this.set.push(e),t},vt.distinct=function(e,t){var r=this;return t||(t=H),new fr(function(n){var i=new L(t);return r.subscribe(function(t){var r=t;if(e)try{r=e(t)}catch(e){return void n.onError(e)}i.push(r)&&n.onNext(t)},function(e){n.onError(e)},function(){n.onCompleted()})},this)};var lr=function(e){function t(t,r,n){this.source=t,this.selector=he(r,n,3),e.call(this)}function r(e,t,r){this.o=e,this.selector=t,this.source=r,this.i=0,this.isStopped=!1}return De(t,e),t.prototype.internalMap=function(e,r){return new t(this.source,function(e,t){return function(r,n,i){return e.call(this,t.selector(r,n,i),n,i)}}(e,this),r)},t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.selector,this))},r.prototype.onNext=function(e){if(!this.isStopped){var t=m(this.selector)(e,this.i++,this.source);return t===Fe?this.o.onError(t.e):void this.o.onNext(t)}},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.o.onError(e),!0)},t}(wt);vt.map=vt.select=function(e,t){var r="function"==typeof e?e:function(){return e};return this instanceof lr?this.internalMap(r,t):new lr(this,r,t)},vt.pluck=function(){var e=arguments,t=arguments.length;if(0===t)throw new Error("List of properties cannot be empty.");return this.map(function(r){for(var n=r,o=0;t>o;o++){var a=n[e[o]];if(void 0===a)return i;n=a}return n})},vt.flatMapObserver=vt.selectManyObserver=function(e,t,r,n){var i=this;return new fr(function(o){var a=0;return i.subscribe(function(t){var r;try{r=e.call(n,t,a++)}catch(e){return void o.onError(e)}X(r)&&(r=At(r)),o.onNext(r)},function(e){var r;try{r=t.call(n,e)}catch(e){return void o.onError(e)}X(r)&&(r=At(r)),o.onNext(r),o.onCompleted()},function(){var e;try{e=r.call(n)}catch(e){return void o.onError(e)}X(e)&&(e=At(e)),o.onNext(e),o.onCompleted()})},i).mergeAll()},vt.selectMany=vt.flatMap=function(e,t,r){return Y(e)&&Y(t)?this.flatMap(function(r,n){var i=e(r,n);return X(i)&&(i=At(i)),(ue(i)||ce(i))&&(i=Bt(i)),i.map(function(e,i){return t(r,e,n,i)})},r):Y(e)?N(this,e,r):N(this,function(){return e})},vt.selectSwitch=vt.flatMapLatest=vt.switchMap=function(e,t){return this.select(e,t).switchLatest()};var pr=function(e){function t(t,r){this.source=t,this.skipCount=r,e.call(this)}function r(e,t){this.c=t,this.r=t,this.o=e,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.skipCount))},r.prototype.onNext=function(e){this.isStopped||(this.r<=0?this.o.onNext(e):this.r--)},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.o.onError(e),!0)},t}(wt);vt.skip=function(e){if(0>e)throw new te;return new pr(this,e)},vt.skipWhile=function(e,t){var r=this,n=he(e,t,3);return new fr(function(e){var t=0,i=!1;return r.subscribe(function(o){if(!i)try{i=!n(o,t++,r)}catch(t){return void e.onError(t)}i&&e.onNext(o)},function(t){e.onError(t)},function(){e.onCompleted()})},r)},vt.take=function(e,t){if(0>e)throw new te;if(0===e)return Nt(t);var r=this;return new fr(function(t){var n=e;return r.subscribe(function(e){n-- >0&&(t.onNext(e),0>=n&&t.onCompleted())},function(e){t.onError(e)},function(){t.onCompleted()})},r)},vt.takeWhile=function(e,t){var r=this,n=he(e,t,3);return new fr(function(e){var t=0,i=!0;return r.subscribe(function(o){if(i){try{i=n(o,t++,r)}catch(t){return void e.onError(t)}i?e.onNext(o):e.onCompleted()}},function(t){e.onError(t)},function(){e.onCompleted()})},r)};var dr=function(e){function t(t,r,n){this.source=t,this.predicate=he(r,n,3),e.call(this)}function r(e,t,r){this.o=e,this.predicate=t,this.source=r,this.i=0,this.isStopped=!1}return De(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.predicate,this))},t.prototype.internalFilter=function(e,r){return new t(this.source,function(e,t){return function(r,n,i){return t.predicate(r,n,i)&&e.call(this,r,n,i)}}(e,this),r)},r.prototype.onNext=function(e){if(!this.isStopped){var t=m(this.predicate)(e,this.i++,this.source);return t===Fe?this.o.onError(t.e):void(t&&this.o.onNext(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.onCompleted())},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return!this.isStopped&&(this.isStopped=!0,this.o.onError(e),!0)},t}(wt);vt.filter=vt.where=function(e,t){return this instanceof dr?this.internalFilter(e,t):new dr(this,e,t)},vt.transduce=function(e){var t=this;return new fr(function(r){var n=e(function(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}(r));return t.subscribe(function(e){try{n["@@transducer/step"](r,e)}catch(e){r.onError(e)}},function(e){r.onError(e)},function(){n["@@transducer/result"](r)})},t)};var fr=$.AnonymousObservable=function(e){function t(e,t){var r=t[0],n=m(t[1])(r);return n!==Fe||r.fail(Fe.e)?void r.setDisposable(function(e){return e&&Y(e.dispose)?e:Y(e)?He(e):qe}(n)):v(Fe.e)}function r(r,n){this.source=n,e.call(this,function(e){var n=new mr(e),i=[n,r];return ot.scheduleRequired()?ot.scheduleWithState(i,t):t(0,i),n})}return De(r,e),r}(xt),mr=function(e){function t(t){e.call(this),this.observer=t,this.m=new Ye}De(t,e);var r=t.prototype;return r.next=function(e){var t=m(this.observer.onNext).call(this.observer,e);t===Fe&&(this.dispose(),v(t.e))},r.error=function(e){var t=m(this.observer.onError).call(this.observer,e);this.dispose(),t===Fe&&v(t.e)},r.completed=function(){var e=m(this.observer.onCompleted).call(this.observer);this.dispose(),e===Fe&&v(e.e)},r.setDisposable=function(e){this.m.setDisposable(e)},r.getDisposable=function(){return this.m.getDisposable()},r.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}(gt),vr=function(e,t){this.subject=e,this.observer=t};vr.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 gr=$.Subject=function(e){function t(e){return Xe(this),this.isStopped?this.hasError?(e.onError(this.error),qe):(e.onCompleted(),qe):(this.observers.push(e),new vr(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return De(r,e),ke(r.prototype,ft.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(Xe(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=o(this.observers),r=t.length;r>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(Xe(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,r=o(this.observers),n=r.length;n>t;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){if(Xe(this),!this.isStopped)for(var t=0,r=o(this.observers),n=r.length;n>t;t++)r[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(e,t){return new yr(e,t)},r}(xt),yr=($.AsyncSubject=function(e){function t(e){return Xe(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),qe):(this.observers.push(e),new vr(this,e))}function r(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return De(r,e),ke(r.prototype,ft,{hasObservers:function(){return Xe(this),this.observers.length>0},onCompleted:function(){var e;if(Xe(this),!this.isStopped){this.isStopped=!0;var t=o(this.observers),r=t.length;if(this.hasValue)for(e=0;r>e;e++){var n=t[e];n.onNext(this.value),n.onCompleted()}else for(e=0;r>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(Xe(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,r=o(this.observers),n=r.length;n>t;t++)r[t].onError(e);this.observers.length=0}},onNext:function(e){Xe(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(xt),$.AnonymousSubject=function(e){function t(e){return this.observable.subscribe(e)}function r(r,n){this.observer=r,this.observable=n,e.call(this,t)}return De(r,e),ke(r.prototype,ft.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),r}(xt));k&&B?F?(B.exports=$).Rx=$:k.Rx=$:D.Rx=$;var br=c()}).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(e,t,r){(function(r){var n,i=void 0!==r?r:"undefined"!=typeof window?window:{},o=e("min-document");"undefined"!=typeof document?n=document:(n=i["__GLOBAL_DOCUMENT_CACHE@4"])||(n=i["__GLOBAL_DOCUMENT_CACHE@4"]=o),t.exports=n}).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,a,s=8*i-n-1,c=(1<>1,h=-7,l=r?i-1:0,p=r?-1:1,d=e[t+l];for(l+=p,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+e[t+l],l+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+e[t+l],l+=p,h-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(t*c-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=f,s/=256,i-=8);for(a=a<0;e[r+d]=255&a,d+=f,a/=256,u-=8);e[r+d-f]|=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){return e in r?r[e]:(r[e]=t,t)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(e,t,r){"use strict";var n=e("./index.js");t.exports=function(e,t,r){var i="__INDIVIDUAL_ONE_VERSION_"+e,o=n(i+"_ENFORCE_SINGLETON",t);if(o!==t)throw new Error("Can only have one copy of "+e+".\nYou already have version "+o+" installed.\nThis means you cannot install version "+t);return n(i,r)}},{"./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 n={};n.base32="0123456789bcdefghjkmnpqrstuvwxyz",n.encode=function(e,t,r){if(void 0===r){for(var i=1;i<=12;i++){var o=n.encode(e,t,i),a=n.decode(o);if(a.lat==e&&a.lon==t)return o}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,c=0,u=!0,h="",l=-90,p=90,d=-180,f=180;h.length=m?(s=2*s+1,d=m):(s*=2,f=m)}else{var v=(l+p)/2;e>=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(e){var t=n.bounds(e),r=t.sw.lat,i=t.sw.lon,o=t.ne.lat,a=t.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(e){if(0===e.length)throw new Error("Invalid geohash");e=e.toLowerCase();for(var t=!0,r=-90,i=90,o=-180,a=180,s=0;s=0;h--){var l=u>>h&1;if(t){var p=(o+a)/2;1==l?o=p:a=p}else{var d=(r+i)/2;1==l?r=d:i=d}t=!t}}return{sw:{lat:r,lon:o},ne:{lat:i,lon:a}}},n.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),i=e.slice(0,-1),o=e.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[t][o].indexOf(r)&&""!==i&&(i=n.adjacent(i,t)),i+n.base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[t][o].indexOf(r))},n.neighbours=function(e){return{n:n.adjacent(e,"n"),ne:n.adjacent(n.adjacent(e,"n"),"e"),e:n.adjacent(e,"e"),se:n.adjacent(n.adjacent(e,"s"),"e"),s:n.adjacent(e,"s"),sw:n.adjacent(n.adjacent(e,"s"),"w"),w:n.adjacent(e,"w"),nw:n.adjacent(n.adjacent(e,"n"),"w")}},void 0!==t&&t.exports&&(t.exports=n)},{}],22:[function(e,t,r){(function(e){function t(e,t){for(var r=0,n=e.length-1;n>=0;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}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:e.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=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),o="/"===a(e,-1);return(e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),o=n(t.split("/")),a=Math.min(i.length,o.length),s=a,c=0;c>>0):4294967296*(t>>>0)+(e>>>0)}function a(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;i>=e;i--)r.buf[i+n]=r.buf[i]}function s(e,t){for(var r=0;r>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}t.exports=n;var b=e("ieee754");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;n.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos>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=v(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=v(this.buf,this.pos)+4294967296*v(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=v(this.buf,this.pos)+4294967296*y(this.buf,this.pos+4);return this.pos+=8,e},readFloat:function(){var e=b.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=b.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,r,n=this.buf;return r=n[this.pos++],t=127&r,r<128?t:(r=n[this.pos++],t|=(127&r)<<7,r<128?t:(r=n[this.pos++],t|=(127&r)<<14,r<128?t:(r=n[this.pos++],t|=(127&r)<<21,r<128?t:(r=n[this.pos],t|=(15&r)<<28,function(e,t,r){var n,i,a=r.buf;if(i=a[r.pos++],n=(112&i)>>4,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<3,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<10,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<17,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(127&i)<<24,i<128)return o(e,n,t);if(i=a[r.pos++],n|=(1&i)<<31,i<128)return o(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t,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){for(var n="",i=t;i239?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?128==(192&(c=e[i+1]))&&(a=(31&o)<<6|63&c)<=127&&(a=null):3===s?(c=e[i+1],u=e[i+2],128==(192&c)&&128==(192&u)&&((a=(15&o)<<12|(63&c)<<6|63&u)<=2047||a>=55296&&a<=57343)&&(a=null)):4===s&&(c=e[i+1],u=e[i+2],h=e[i+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&((a=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&h)<=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}(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=i(this);for(e=e||[];this.pos127;);else if(t===n.Bytes)this.pos=this.readVarint()+this.pos;else if(t===n.Fixed32)this.pos+=4;else{if(t!==n.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;t268435455||e<0?function(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos]=127&e}(r,0,t),function(e,t){var r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||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);n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=63&n|128)}return r}(this.buf,e,this.pos);var r=this.pos-t;r>=128&&a(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),b.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),b.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=128&&a(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,n.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){this.writeMessage(e,s,t)},writePackedSVarint:function(e,t){this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){this.writeMessage(e,l,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){this.writeMessage(e,p,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,d,t)},writePackedFixed64:function(e,t){this.writeMessage(e,f,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,m,t)},writeBytesField:function(e,t){this.writeTag(e,n.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,n.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,n.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,n.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,n.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,n.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,n.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,n.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,n.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,n.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}}},{ieee754:17}],24:[function(e,t,r){"use strict";function n(e,t,r,o,a){for(r=r||0,o=o||e.length-1,a=a||function(e,t){return et?1:0};o>r;){if(o-r>600){var s=o-r+1,c=t-r+1,u=Math.log(s),h=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*h*(s-h)/s)*(c-s/2<0?-1:1);n(e,t,Math.max(r,Math.floor(t-c*h/s+l)),Math.min(o,Math.floor(t+(s-c)*h/s+l)),a)}var p=e[t],d=r,f=o;for(i(e,r,t),a(e[o],p)>0&&i(e,r,o);d0;)f--}0===a(e[r],p)?i(e,r,f):i(e,++f,o),f<=t&&(r=f+1),t<=f&&(o=f-1)}}function i(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}t.exports=n},{}],25:[function(e,t,r){"use strict";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 i(e,t){o(e,0,e.children.length,t,e)}function o(e,t,r,n,i){i||(i=d(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=t;s=e.minX&&t.maxY>=e.minY}function d(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function f(e,t,r,n,i){for(var o,a=[t,r];a.length;)(r=a.pop())-(t=a.pop())<=n||(o=t+Math.ceil((r-t)/n/2)*n,m(e,o,t,r,i),a.push(t,o,o,r))}t.exports=n;var m=e("quickselect");n.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,r=[],n=this.toBBox;if(!p(e,t))return r;for(var i,o,a,s,c=[];t;){for(i=0,o=t.children.length;i=0&&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,o=this._minEntries;this._chooseSplitAxis(r,o,n);var a=this._chooseSplitIndex(r,o,n),s=d(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,i(r,this.toBBox),i(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)},_splitRoot:function(e,t){this.data=d([e,t]),this.data.height=e.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,r){var n,i,a,s,c,h,l,p;for(h=l=1/0,n=t;n<=r-t;n++)s=function(e,t){var r=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,i-r)*Math.max(0,o-n)}(i=o(e,0,n,this.toBBox),a=o(e,n,r,this.toBBox)),c=u(i)+u(a),s=t;i--)s=e.children[i],a(l,e.leaf?c(s):s),p+=h(l);return p},_adjustParentBBoxes:function(e,t,r){for(var n=r;n>=0;n--)a(t[n],e)},_condense:function(e){for(var t,r=e.length-1;r>=0;r--)0===e[r].children.length?r>0?(t=e[r-1].children).splice(t.indexOf(e[r]),1):this.clear():i(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";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("./Subject"),o=e("./util/ObjectUnsubscribedError"),a=function(e){function t(t){e.call(this),this._value=t}return n(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return r&&!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.ObjectUnsubscribedError;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(i.Subject);r.BehaviorSubject=a},{"./Subject":34,"./util/ObjectUnsubscribedError":221}],27:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r,n){e.call(this),this.parent=t,this.outerValue=r,this.outerIndex=n,this.index=0}return n(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(e("./Subscriber").Subscriber);r.InnerSubscriber=i},{"./Subscriber":36}],28:[function(e,t,r){"use strict";var n=e("./Observable"),i=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},e.prototype.do=function(e,t,r){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return r&&r()}},e.prototype.accept=function(e,t,r){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){switch(this.kind){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.error);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},e.createNext=function(t){return void 0!==t?new e("N",t):e.undefinedValueNotification},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e.undefinedValueNotification=new e("N",void 0),e}();r.Notification=i},{"./Observable":29}],29:[function(e,t,r){"use strict";var n=e("./util/root"),i=e("./util/toSubscriber"),o=e("./symbol/observable"),a=e("./util/pipe"),s=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this.operator,o=i.toSubscriber(e,t,r);if(n?n.call(o,this.source):o.add(this.source?this._subscribe(o):this._trySubscribe(o)),o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.syncErrorThrown=!0,e.syncErrorValue=t,e.error(t)}},e.prototype.forEach=function(e,t){var r=this;if(t||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?t=n.root.Rx.config.Promise:n.root.Promise&&(t=n.root.Promise)),!t)throw new Error("no Promise impl found");return new t(function(t,n){var i;i=r.subscribe(function(t){if(i)try{e(t)}catch(e){n(e),i.unsubscribe()}else e(t)},n,t)})},e.prototype._subscribe=function(e){return this.source.subscribe(e)},e.prototype[o.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;tt&&(o=Math.max(o,i-t)),o>0&&n.splice(0,o),n},t}(i.Subject);r.ReplaySubject=h;var l=function(){return function(e,t){this.time=e,this.value=t}}()},{"./Subject":34,"./SubjectSubscription":35,"./Subscription":37,"./operators/observeOn":182,"./scheduler/queue":214,"./util/ObjectUnsubscribedError":221}],33:[function(e,t,r){"use strict";var n=function(){function e(t,r){void 0===r&&(r=e.now),this.SchedulerAction=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(r,t)},e.now=Date.now?Date.now:function(){return+new Date},e}();r.Scheduler=n},{}],34:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("./Observable"),o=e("./Subscriber"),a=e("./Subscription"),s=e("./util/ObjectUnsubscribedError"),c=e("./SubjectSubscription"),u=e("./symbol/rxSubscriber"),h=function(e){function t(t){e.call(this,t),this.destination=t}return n(t,e),t}(o.Subscriber);r.SubjectSubscriber=h;var l=function(e){function t(){e.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return n(t,e),t.prototype[u.rxSubscriber]=function(){return new h(this)},t.prototype.lift=function(e){var t=new p(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new s.ObjectUnsubscribedError;if(!this.isStopped)for(var t=this.observers,r=t.length,n=t.slice(),i=0;i=n?i.complete():(i.next(t[r]),e.index=r+1,this.schedule(e)))},t.prototype._subscribe=function(e){var r=this.arrayLike,n=this.scheduler,i=r.length;if(n)return n.schedule(t.dispatch,0,{arrayLike:r,index:0,length:i,subscriber:e});for(var o=0;o1?new t(e,n):1===i?new o.ScalarObservable(e[0],n):new a.EmptyObservable(n)},t.dispatch=function(e){var t=e.array,r=e.index,n=e.count,i=e.subscriber;r>=n?i.complete():(i.next(t[r]),i.closed||(e.index=r+1,this.schedule(e)))},t.prototype._subscribe=function(e){var r=this.array,n=r.length,i=this.scheduler;if(i)return i.schedule(t.dispatch,0,{array:r,index:0,count:n,subscriber:e});for(var o=0;o1)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},t}(a.Subscriber))},{"../Observable":29,"../Subject":34,"../Subscriber":36,"../Subscription":37,"../operators/refCount":188}],95:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Observable"),o=e("../util/subscribeToResult"),a=e("../OuterSubscriber"),s=function(e){function t(t){e.call(this),this.observableFactory=t}return n(t,e),t.create=function(e){return new t(e)},t.prototype._subscribe=function(e){return new c(e,this.observableFactory)},t}(i.Observable);r.DeferObservable=s;var c=function(e){function t(t,r){e.call(this,t),this.factory=r,this.tryDefer()}return n(t,e),t.prototype.tryDefer=function(){try{this._callFactory()}catch(e){this._error(e)}},t.prototype._callFactory=function(){var e=this.factory();e&&this.add(o.subscribeToResult(this,e))},t}(a.OuterSubscriber)},{"../Observable":29,"../OuterSubscriber":31,"../util/subscribeToResult":238}],96:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t){e.call(this),this.scheduler=t}return n(t,e),t.create=function(e){return new t(e)},t.dispatch=function(e){e.subscriber.complete()},t.prototype._subscribe=function(e){var r=this.scheduler;if(r)return r.schedule(t.dispatch,0,{subscriber:e});e.complete()},t}(e("../Observable").Observable);r.EmptyObservable=i},{"../Observable":29}],97:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r){e.call(this),this.error=t,this.scheduler=r}return n(t,e),t.create=function(e,r){return new t(e,r)},t.dispatch=function(e){var t=e.error;e.subscriber.error(t)},t.prototype._subscribe=function(e){var r=this.error,n=this.scheduler;if(e.syncErrorThrowable=!0,n)return n.schedule(t.dispatch,0,{error:r,subscriber:e});e.error(r)},t}(e("../Observable").Observable);r.ErrorObservable=i},{"../Observable":29}],98:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Observable"),o=e("../util/tryCatch"),a=e("../util/isFunction"),s=e("../util/errorObject"),c=e("../Subscription"),u=Object.prototype.toString,h=function(e){function t(t,r,n,i){e.call(this),this.sourceObj=t,this.eventName=r,this.selector=n,this.options=i}return n(t,e),t.create=function(e,r,n,i){return a.isFunction(n)&&(i=n,n=void 0),new t(e,r,i,n)},t.setupSubscription=function(e,r,n,i,o){var a;if(function(e){return!!e&&"[object NodeList]"===u.call(e)}(e)||function(e){return!!e&&"[object HTMLCollection]"===u.call(e)}(e))for(var s=0,h=e.length;sl?l:t:t}var i=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=e("../util/root"),a=e("../Observable"),s=e("../symbol/iterator"),c=function(e){function t(t,r){if(e.call(this),this.scheduler=r,null==t)throw new Error("iterator cannot be null.");this.iterator=function(e){var t=e[s.iterator];if(!t&&"string"==typeof e)return new u(e);if(!t&&void 0!==e.length)return new h(e);if(!t)throw new TypeError("object is not iterable");return e[s.iterator]()}(t)}return i(t,e),t.create=function(e,r){return new t(e,r)},t.dispatch=function(e){var t=e.index,r=e.hasError,n=e.iterator,i=e.subscriber;if(r)i.error(e.error);else{var o=n.next();o.done?i.complete():(i.next(o.value),e.index=t+1,i.closed?"function"==typeof n.return&&n.return():this.schedule(e))}},t.prototype._subscribe=function(e){var r=this.iterator,n=this.scheduler;if(n)return n.schedule(t.dispatch,0,{index:0,iterator:r,subscriber:e});for(;;){var i=r.next();if(i.done){e.complete();break}if(e.next(i.value),e.closed){"function"==typeof r.return&&r.return();break}}},t}(a.Observable);r.IteratorObservable=c;var u=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=e.length),this.str=e,this.idx=t,this.len=r}return e.prototype[s.iterator]=function(){return this},e.prototype.next=function(){return this.idx=2?n.reduce(e,t)(this):n.reduce(e)(this)}},{"../operators/reduce":187}],142:[function(e,t,r){"use strict";var n=e("../operators/retry");r.retry=function(e){return void 0===e&&(e=-1),n.retry(e)(this)}},{"../operators/retry":189}],143:[function(e,t,r){"use strict";var n=e("../operators/sample");r.sample=function(e){return n.sample(e)(this)}},{"../operators/sample":190}],144:[function(e,t,r){"use strict";var n=e("../operators/scan");r.scan=function(e,t){return arguments.length>=2?n.scan(e,t)(this):n.scan(e)(this)}},{"../operators/scan":191}],145:[function(e,t,r){"use strict";var n=e("../operators/share");r.share=function(){return n.share()(this)}},{"../operators/share":192}],146:[function(e,t,r){"use strict";var n=e("../operators/skip");r.skip=function(e){return n.skip(e)(this)}},{"../operators/skip":193}],147:[function(e,t,r){"use strict";var n=e("../operators/skipUntil");r.skipUntil=function(e){return n.skipUntil(e)(this)}},{"../operators/skipUntil":194}],148:[function(e,t,r){"use strict";var n=e("../operators/skipWhile");r.skipWhile=function(e){return n.skipWhile(e)(this)}},{"../operators/skipWhile":195}],149:[function(e,t,r){"use strict";var n=e("../operators/startWith");r.startWith=function(){for(var e=[],t=0;t0&&this.destination.next(t),e.prototype._complete.call(this)},t}(i.Subscriber),s=function(e){function t(t,r,n){e.call(this,t),this.bufferSize=r,this.startBufferEvery=n,this.buffers=[],this.count=0}return n(t,e),t.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 a=n[o];a.push(e),a.length===t&&(n.splice(o,1),this.destination.next(a))}},t.prototype._complete=function(){for(var t=this.buffers,r=this.destination;t.length>0;){var n=t.shift();n.length>0&&r.next(n)}e.prototype._complete.call(this)},t}(i.Subscriber)},{"../Subscriber":36}],162:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscription"),o=e("../util/tryCatch"),a=e("../util/errorObject"),s=e("../OuterSubscriber"),c=e("../util/subscribeToResult");r.bufferWhen=function(e){return function(t){return t.lift(new u(e))}};var u=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new h(e,this.closingSelector))},e}(),h=function(e){function t(t,r){e.call(this,t),this.closingSelector=r,this.subscribing=!1,this.openBuffer()}return n(t,e),t.prototype._next=function(e){this.buffer.push(e)},t.prototype._complete=function(){var t=this.buffer;t&&this.destination.next(t),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},t.prototype.notifyNext=function(e,t,r,n,i){this.openBuffer()},t.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},t.prototype.openBuffer=function(){var e=this.closingSubscription;e&&(this.remove(e),e.unsubscribe());var t=this.buffer;this.buffer&&this.destination.next(t),this.buffer=[];var r=o.tryCatch(this.closingSelector)();r===a.errorObject?this.error(a.errorObject.e):(e=new i.Subscription,this.closingSubscription=e,this.add(e),this.subscribing=!0,e.add(c.subscribeToResult(this,r)),this.subscribing=!1)},t}(s.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscription":37,"../util/errorObject":225,"../util/subscribeToResult":238,"../util/tryCatch":240}],163:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.catchError=function(e){return function(t){var r=new a(e),n=t.lift(r);return r.caught=n}};var a=function(){function e(e){this.selector=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.selector,this.caught))},e}(),s=function(e){function t(t,r,n){e.call(this,t),this.selector=r,this.caught=n}return n(t,e),t.prototype.error=function(t){if(!this.isStopped){var r=void 0;try{r=this.selector(t,this.caught)}catch(t){return void e.prototype.error.call(this,t)}this._unsubscribeAndRecycle(),this.add(o.subscribeToResult(this,r))}},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":238}],164:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../observable/ArrayObservable"),o=e("../util/isArray"),a=e("../OuterSubscriber"),s=e("../util/subscribeToResult"),c={};r.combineLatest=function(){for(var e=[],t=0;t0&&r[0].time-n.now()<=0;)r.shift().notification.observe(i);if(r.length>0){var o=Math.max(0,r[0].time-n.now());this.schedule(e,o)}else t.active=!1},t.prototype._schedule=function(e){this.active=!0,this.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 h(t.now()+this.delay,e);this.queue.push(r),!1===this.active&&this._schedule(t)}},t.prototype._next=function(e){this.scheduleNotification(s.Notification.createNext(e))},t.prototype._error=function(e){this.errored=!0,this.queue=[],this.destination.error(e)},t.prototype._complete=function(){this.scheduleNotification(s.Notification.createComplete())},t}(a.Subscriber),h=function(){return function(e,t){this.time=e,this.notification=t}}()},{"../Notification":28,"../Subscriber":36,"../scheduler/async":213,"../util/isDate":229}],170:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult"),a=e("../util/Set");r.distinct=function(e,t){return function(r){return r.lift(new s(e,t))}};var s=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(e){function t(t,r,n){e.call(this,t),this.keySelector=r,this.values=new a.Set,n&&this.add(o.subscribeToResult(this,n))}return n(t,e),t.prototype.notifyNext=function(e,t,r,n,i){this.values.clear()},t.prototype.notifyError=function(e,t){this._error(e)},t.prototype._next=function(e){this.keySelector?this._useKeySelector(e):this._finalizeNext(e,e)},t.prototype._useKeySelector=function(e){var t,r=this.destination;try{t=this.keySelector(e)}catch(e){return void r.error(e)}this._finalizeNext(t,e)},t.prototype._finalizeNext=function(e,t){var r=this.values;r.has(e)||(r.add(e),this.destination.next(t))},t}(i.OuterSubscriber);r.DistinctSubscriber=c},{"../OuterSubscriber":31,"../util/Set":222,"../util/subscribeToResult":238}],171:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/tryCatch"),a=e("../util/errorObject");r.distinctUntilChanged=function(e,t){return function(r){return r.lift(new s(e,t))}};var s=function(){function e(e,t){this.compare=e,this.keySelector=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.compare,this.keySelector))},e}(),c=function(e){function t(t,r,n){e.call(this,t),this.keySelector=n,this.hasKey=!1,"function"==typeof r&&(this.compare=r)}return n(t,e),t.prototype.compare=function(e,t){return e===t},t.prototype._next=function(e){var t=e;if(this.keySelector&&(t=o.tryCatch(this.keySelector)(e))===a.errorObject)return this.destination.error(a.errorObject.e);var r=!1;if(this.hasKey){if((r=o.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))},t}(i.Subscriber)},{"../Subscriber":36,"../util/errorObject":225,"../util/tryCatch":240}],172:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../util/tryCatch"),o=e("../util/errorObject"),a=e("../OuterSubscriber"),s=e("../util/subscribeToResult");r.expand=function(e,t,r){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===r&&(r=void 0),t=(t||0)<1?Number.POSITIVE_INFINITY:t,function(n){return n.lift(new c(e,t,r))}};var c=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 u(e,this.project,this.concurrent,this.scheduler))},e}();r.ExpandOperator=c;var u=function(e){function t(t,r,n,i){e.call(this,t),this.project=r,this.concurrent=n,this.scheduler=i,this.index=0,this.active=0,this.hasCompleted=!1,n0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},t}(a.OuterSubscriber);r.ExpandSubscriber=u},{"../OuterSubscriber":31,"../util/errorObject":225,"../util/subscribeToResult":238,"../util/tryCatch":240}],173:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.filter=function(e,t){return function(r){return r.lift(new o(e,t))}};var o=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(e){function t(t,r,n){e.call(this,t),this.predicate=r,this.thisArg=n,this.count=0}return n(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(i.Subscriber)},{"../Subscriber":36}],174:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../Subscription");r.finalize=function(e){return function(t){return t.lift(new a(e))}};var a=function(){function e(e){this.callback=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.callback))},e}(),s=function(e){function t(t,r){e.call(this,t),this.add(new o.Subscription(r))}return n(t,e),t}(i.Subscriber)},{"../Subscriber":36,"../Subscription":37}],175:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/EmptyError");r.first=function(e,t,r){return function(n){return n.lift(new a(e,t,r,n))}};var a=function(){function e(e,t,r,n){this.predicate=e,this.resultSelector=t,this.defaultValue=r,this.source=n}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.resultSelector,this.defaultValue,this.source))},e}(),s=function(e){function t(t,r,n,i,o){e.call(this,t),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.index=0,this.hasCompleted=!1,this._emitted=!1}return n(t,e),t.prototype._next=function(e){var t=this.index++;this.predicate?this._tryPredicate(e,t):this._emit(e,t)},t.prototype._tryPredicate=function(e,t){var r;try{r=this.predicate(e,t,this.source)}catch(e){return void this.destination.error(e)}r&&this._emit(e,t)},t.prototype._emit=function(e,t){this.resultSelector?this._tryResultSelector(e,t):this._emitFinal(e)},t.prototype._tryResultSelector=function(e,t){var r;try{r=this.resultSelector(e,t)}catch(e){return void this.destination.error(e)}this._emitFinal(r)},t.prototype._emitFinal=function(e){var t=this.destination;this._emitted||(this._emitted=!0,t.next(e),t.complete(),this.hasCompleted=!0)},t.prototype._complete=function(){var e=this.destination;this.hasCompleted||void 0===this.defaultValue?this.hasCompleted||e.error(new o.EmptyError):(e.next(this.defaultValue),e.complete())},t}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":220}],176:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/EmptyError");r.last=function(e,t,r){return function(n){return n.lift(new a(e,t,r,n))}};var a=function(){function e(e,t,r,n){this.predicate=e,this.resultSelector=t,this.defaultValue=r,this.source=n}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.resultSelector,this.defaultValue,this.source))},e}(),s=function(e){function t(t,r,n,i,o){e.call(this,t),this.predicate=r,this.resultSelector=n,this.defaultValue=i,this.source=o,this.hasValue=!1,this.index=0,void 0!==i&&(this.lastValue=i,this.hasValue=!0)}return n(t,e),t.prototype._next=function(e){var t=this.index++;if(this.predicate)this._tryPredicate(e,t);else{if(this.resultSelector)return void this._tryResultSelector(e,t);this.lastValue=e,this.hasValue=!0}},t.prototype._tryPredicate=function(e,t){var r;try{r=this.predicate(e,t,this.source)}catch(e){return void this.destination.error(e)}if(r){if(this.resultSelector)return void this._tryResultSelector(e,t);this.lastValue=e,this.hasValue=!0}},t.prototype._tryResultSelector=function(e,t){var r;try{r=this.resultSelector(e,t)}catch(e){return void this.destination.error(e)}this.lastValue=r,this.hasValue=!0},t.prototype._complete=function(){var e=this.destination;this.hasValue?(e.next(this.lastValue),e.complete()):e.error(new o.EmptyError)},t}(i.Subscriber)},{"../Subscriber":36,"../util/EmptyError":220}],177:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.map=function(e,t){return function(r){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new o(e,t))}};var o=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=o;var a=function(e){function t(t,r,n){e.call(this,t),this.project=r,this.count=0,this.thisArg=n||this}return n(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(i.Subscriber)},{"../Subscriber":36}],178:[function(e,t,r){"use strict";function n(){for(var e=[],t=0;t1&&"number"==typeof e[e.length-1]&&(r=e.pop())):"number"==typeof c&&(r=e.pop()),null===n&&1===e.length&&e[0]instanceof i.Observable?e[0]:a.mergeAll(r)(new o.ArrayObservable(e,n))}var i=e("../Observable"),o=e("../observable/ArrayObservable"),a=e("./mergeAll"),s=e("../util/isScheduler");r.merge=function(){for(var e=[],t=0;t0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},t}(o.OuterSubscriber);r.MergeMapSubscriber=s},{"../OuterSubscriber":31,"../util/subscribeToResult":238}],181:[function(e,t,r){"use strict";var n=e("../observable/ConnectableObservable");r.multicast=function(e,t){return function(r){var o;if(o="function"==typeof e?e:function(){return e},"function"==typeof t)return r.lift(new i(o,t));var a=Object.create(r,n.connectableObservableDescriptor);return a.source=r,a.subjectFactory=o,a}};var i=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=i},{"../observable/ConnectableObservable":94}],182:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../Notification");r.observeOn=function(e,t){return void 0===t&&(t=0),function(r){return r.lift(new a(e,t))}};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 s(e,this.scheduler,this.delay))},e}();r.ObserveOnOperator=a;var s=function(e){function t(t,r,n){void 0===n&&(n=0),e.call(this,t),this.scheduler=r,this.delay=n}return n(t,e),t.dispatch=function(e){var t=e.notification,r=e.destination;t.observe(r),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.add(this.scheduler.schedule(t.dispatch,this.delay,new c(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage(o.Notification.createNext(e))},t.prototype._error=function(e){this.scheduleMessage(o.Notification.createError(e))},t.prototype._complete=function(){this.scheduleMessage(o.Notification.createComplete())},t}(i.Subscriber);r.ObserveOnSubscriber=s;var c=function(){return function(e,t){this.notification=e,this.destination=t}}();r.ObserveOnMessage=c},{"../Notification":28,"../Subscriber":36}],183:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.pairwise=function(){return function(e){return e.lift(new o)}};var o=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new a(e))},e}(),a=function(e){function t(t){e.call(this,t),this.hasPrev=!1}return n(t,e),t.prototype._next=function(e){this.hasPrev?this.destination.next([this.prev,e]):this.hasPrev=!0,this.prev=e},t}(i.Subscriber)},{"../Subscriber":36}],184:[function(e,t,r){"use strict";function n(){for(var e=[],t=0;t=2?function(r){return a.pipe(n.scan(e,t),i.takeLast(1),o.defaultIfEmpty(t))(r)}:function(t){return a.pipe(n.scan(function(t,r,n){return e(t,r,n+1)}),i.takeLast(1))(t)}}},{"../util/pipe":236,"./defaultIfEmpty":168,"./scan":191,"./takeLast":199}],188:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.refCount=function(){return function(e){return e.lift(new o(e))}};var o=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(e){function t(t,r){e.call(this,t),this.connectable=r}return n(t,e),t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,t>1)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},t}(i.Subscriber)},{"../Subscriber":36}],189:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.retry=function(e){return void 0===e&&(e=-1),function(t){return t.lift(new o(e,t))}};var o=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(e){function t(t,r,n){e.call(this,t),this.count=r,this.source=n}return n(t,e),t.prototype.error=function(t){if(!this.isStopped){var r=this.source,n=this.count;if(0===n)return e.prototype.error.call(this,t);n>-1&&(this.count=n-1),r.subscribe(this._unsubscribeAndRecycle())}},t}(i.Subscriber)},{"../Subscriber":36}],190:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.sample=function(e){return function(t){return t.lift(new a(e))}};var a=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var r=new s(e),n=t.subscribe(r);return n.add(o.subscribeToResult(r,this.notifier)),n},e}(),s=function(e){function t(){e.apply(this,arguments),this.hasValue=!1}return n(t,e),t.prototype._next=function(e){this.value=e,this.hasValue=!0},t.prototype.notifyNext=function(e,t,r,n,i){this.emitValue()},t.prototype.notifyComplete=function(){this.emitValue()},t.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":238}],191:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.scan=function(e,t){var r=!1;return arguments.length>=2&&(r=!0),function(n){return n.lift(new o(e,t,r))}};var o=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(e){function t(t,r,n,i){e.call(this,t),this.accumulator=r,this._seed=n,this.hasSeed=i,this.index=0}return n(t,e),Object.defineProperty(t.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=!0,this._seed=e},enumerable:!0,configurable:!0}),t.prototype._next=function(e){if(this.hasSeed)return this._tryNext(e);this.seed=e,this.destination.next(e)},t.prototype._tryNext=function(e){var t,r=this.index++;try{t=this.accumulator(this.seed,e,r)}catch(e){this.destination.error(e)}this.seed=t,this.destination.next(t)},t}(i.Subscriber)},{"../Subscriber":36}],192:[function(e,t,r){"use strict";function n(){return new a.Subject}var i=e("./multicast"),o=e("./refCount"),a=e("../Subject");r.share=function(){return function(e){return o.refCount()(i.multicast(n)(e))}}},{"../Subject":34,"./multicast":181,"./refCount":188}],193:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.skip=function(e){return function(t){return t.lift(new o(e))}};var o=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(e){function t(t,r){e.call(this,t),this.total=r,this.count=0}return n(t,e),t.prototype._next=function(e){++this.count>this.total&&this.destination.next(e)},t}(i.Subscriber)},{"../Subscriber":36}],194:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.skipUntil=function(e){return function(t){return t.lift(new a(e))}};var a=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.notifier))},e}(),s=function(e){function t(t,r){e.call(this,t),this.hasValue=!1,this.isInnerStopped=!1,this.add(o.subscribeToResult(this,r))}return n(t,e),t.prototype._next=function(t){this.hasValue&&e.prototype._next.call(this,t)},t.prototype._complete=function(){this.isInnerStopped?e.prototype._complete.call(this):this.unsubscribe()},t.prototype.notifyNext=function(e,t,r,n,i){this.hasValue=!0},t.prototype.notifyComplete=function(){this.isInnerStopped=!0,this.isStopped&&e.prototype._complete.call(this)},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":238}],195:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber");r.skipWhile=function(e){return function(t){return t.lift(new o(e))}};var o=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(e){function t(t,r){e.call(this,t),this.predicate=r,this.skipping=!0,this.index=0}return n(t,e),t.prototype._next=function(e){var t=this.destination;this.skipping&&this.tryCallPredicate(e),this.skipping||t.next(e)},t.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}},t}(i.Subscriber)},{"../Subscriber":36}],196:[function(e,t,r){"use strict";var n=e("../observable/ArrayObservable"),i=e("../observable/ScalarObservable"),o=e("../observable/EmptyObservable"),a=e("../observable/concat"),s=e("../util/isScheduler");r.startWith=function(){for(var e=[],t=0;t1?a.concat(new n.ArrayObservable(e,r),t):a.concat(new o.EmptyObservable(r),t)}}},{"../observable/ArrayObservable":93,"../observable/EmptyObservable":96,"../observable/ScalarObservable":102,"../observable/concat":105,"../util/isScheduler":234}],197:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../OuterSubscriber"),o=e("../util/subscribeToResult");r.switchMap=function(e,t){return function(r){return r.lift(new a(e,t))}};var a=function(){function e(e,t){this.project=e,this.resultSelector=t}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.project,this.resultSelector))},e}(),s=function(e){function t(t,r,n){e.call(this,t),this.project=r,this.resultSelector=n,this.index=0}return n(t,e),t.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)},t.prototype._innerSub=function(e,t,r){var n=this.innerSubscription;n&&n.unsubscribe(),this.add(this.innerSubscription=o.subscribeToResult(this,e,t,r))},t.prototype._complete=function(){var t=this.innerSubscription;t&&!t.closed||e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.innerSubscription=null},t.prototype.notifyComplete=function(t){this.remove(t),this.innerSubscription=null,this.isStopped&&e.prototype._complete.call(this)},t.prototype.notifyNext=function(e,t,r,n,i){this.resultSelector?this._tryNotifyNext(e,t,r,n):this.destination.next(t)},t.prototype._tryNotifyNext=function(e,t,r,n){var i;try{i=this.resultSelector(e,t,r,n)}catch(e){return void this.destination.error(e)}this.destination.next(i)},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":238}],198:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/ArgumentOutOfRangeError"),a=e("../observable/EmptyObservable");r.take=function(e){return function(t){return 0===e?new a.EmptyObservable:t.lift(new s(e))}};var s=function(){function e(e){if(this.total=e,this.total<0)throw new o.ArgumentOutOfRangeError}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.total))},e}(),c=function(e){function t(t,r){e.call(this,t),this.total=r,this.count=0}return n(t,e),t.prototype._next=function(e){var t=this.total,r=++this.count;r<=t&&(this.destination.next(e),r===t&&(this.destination.complete(),this.unsubscribe()))},t}(i.Subscriber)},{"../Subscriber":36,"../observable/EmptyObservable":96,"../util/ArgumentOutOfRangeError":219}],199:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../Subscriber"),o=e("../util/ArgumentOutOfRangeError"),a=e("../observable/EmptyObservable");r.takeLast=function(e){return function(t){return 0===e?new a.EmptyObservable:t.lift(new s(e))}};var s=function(){function e(e){if(this.total=e,this.total<0)throw new o.ArgumentOutOfRangeError}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.total))},e}(),c=function(e){function t(t,r){e.call(this,t),this.total=r,this.ring=new Array,this.count=0}return n(t,e),t.prototype._next=function(e){var t=this.ring,r=this.total,n=this.count++;if(t.length0)for(var r=this.count>=this.total?this.total:this.count,n=this.ring,i=0;i0){var a=o.indexOf(r);-1!==a&&o.splice(a,1)}},t.prototype.notifyComplete=function(){},t.prototype._next=function(e){if(0===this.toRespond.length){var t=[e].concat(this.values);this.project?this._tryProject(t):this.destination.next(t)}},t.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(i.OuterSubscriber)},{"../OuterSubscriber":31,"../util/subscribeToResult":238}],207:[function(e,t,r){"use strict";function n(){for(var e=[],t=0;tthis.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),m=function(e){function t(t,r,n){e.call(this,t),this.parent=r,this.observable=n,this.stillUnsubscribed=!0,this.buffer=[],this.isComplete=!1}return i(t,e),t.prototype[h.iterator]=function(){return this},t.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},t.prototype.hasValue=function(){return this.buffer.length>0},t.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},t.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},t.prototype.notifyNext=function(e,t,r,n,i){this.buffer.push(t),this.parent.checkIterators()},t.prototype.subscribe=function(e,t){return u.subscribeToResult(this,this.observable,this,t)},t}(c.OuterSubscriber)},{"../OuterSubscriber":31,"../Subscriber":36,"../observable/ArrayObservable":93,"../symbol/iterator":215,"../util/isArray":227,"../util/subscribeToResult":238}],208:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r){e.call(this)}return n(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(e("../Subscription").Subscription);r.Action=i},{"../Subscription":37}],209:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=e("../util/root"),o=function(e){function t(t,r){e.call(this,t,r),this.scheduler=t,this.work=r,this.pending=!1}return n(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e,this.pending=!0;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,t)),this.delay=t,this.id=this.id||this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),i.root.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){return void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending?t:i.root.clearInterval(t)&&void 0||void 0},t.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))},t.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},t.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},t}(e("./Action").Action);r.AsyncAction=o},{"../util/root":237,"./Action":208}],210:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(){e.apply(this,arguments),this.actions=[],this.active=!1,this.scheduled=void 0}return n(t,e),t.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}}},t}(e("../Scheduler").Scheduler);r.AsyncScheduler=i},{"../Scheduler":33}],211:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(t,r){e.call(this,t,r),this.scheduler=t,this.work=r}return n(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):t.flush(this)},t}(e("./AsyncAction").AsyncAction);r.QueueAction=i},{"./AsyncAction":209}],212:[function(e,t,r){"use strict";var n=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},i=function(e){function t(){e.apply(this,arguments)}return n(t,e),t}(e("./AsyncScheduler").AsyncScheduler);r.QueueScheduler=i},{"./AsyncScheduler":210}],213:[function(e,t,r){"use strict";var n=e("./AsyncAction"),i=e("./AsyncScheduler");r.async=new i.AsyncScheduler(n.AsyncAction)},{"./AsyncAction":209,"./AsyncScheduler":210}],214:[function(e,t,r){"use strict";var n=e("./QueueAction"),i=e("./QueueScheduler");r.queue=new i.QueueScheduler(n.QueueAction)},{"./QueueAction":211,"./QueueScheduler":212}],215:[function(e,t,r){"use strict";function n(e){var t=e.Symbol;if("function"==typeof t)return t.iterator||(t.iterator=t("iterator polyfill")),t.iterator;var r=e.Set;if(r&&"function"==typeof(new r)["@@iterator"])return"@@iterator";var n=e.Map;if(n)for(var i=Object.getOwnPropertyNames(n.prototype),o=0;o=0}},{"../util/isArray":227}],232:[function(e,t,r){"use strict";r.isObject=function(e){return null!=e&&"object"==typeof e}},{}],233:[function(e,t,r){"use strict";r.isPromise=function(e){return e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}},{}],234:[function(e,t,r){"use strict";r.isScheduler=function(e){return e&&"function"==typeof e.schedule}},{}],235:[function(e,t,r){"use strict";r.noop=function(){}},{}],236:[function(e,t,r){"use strict";function n(e){return e?1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}:i.noop}var i=e("./noop");r.pipe=function(){for(var e=[],t=0;t=n||0 0 ) {\n\t\tfloat fogFactor = 0.0;\n\t\tif ( fogType == 1 ) {\n\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t\t} else {\n\t\t\tconst float LOG2 = 1.442695;\n\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );\n\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\t\t}\n\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\t}\n}"].join("\n")),t.compileShader(N),t.compileShader(I),t.attachShader(L,N),t.attachShader(L,I),t.linkProgram(L),T=L,S=t.getAttribLocation(T,"position"),M=t.getAttribLocation(T,"uv"),c=t.getUniformLocation(T,"uvOffset"),u=t.getUniformLocation(T,"uvScale"),h=t.getUniformLocation(T,"rotation"),l=t.getUniformLocation(T,"scale"),p=t.getUniformLocation(T,"color"),d=t.getUniformLocation(T,"map"),f=t.getUniformLocation(T,"opacity"),m=t.getUniformLocation(T,"modelViewMatrix"),v=t.getUniformLocation(T,"projectionMatrix"),g=t.getUniformLocation(T,"fogType"),y=t.getUniformLocation(T,"fogDensity"),b=t.getUniformLocation(T,"fogNear"),_=t.getUniformLocation(T,"fogFar"),x=t.getUniformLocation(T,"fogColor"),t.getUniformLocation(T,"fogDepth"),w=t.getUniformLocation(T,"alphaTest"),(L=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,L.height=8,(N=L.getContext("2d")).fillStyle="white",N.fillRect(0,0,8,8),O=new H(L)}r.useProgram(T),r.initAttributes(),r.enableAttribute(S),r.enableAttribute(M),r.disableUnusedAttributes(),r.disable(t.CULL_FACE),r.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,E),t.vertexAttribPointer(S,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(M,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,C),t.uniformMatrix4fv(v,!1,R.projectionMatrix.elements),r.activeTexture(t.TEXTURE0),t.uniform1i(d,0),N=L=0,(I=o.fog)?(t.uniform3f(x,I.color.r,I.color.g,I.color.b),I.isFog?(t.uniform1f(b,I.near),t.uniform1f(_,I.far),t.uniform1i(g,1),N=L=1):I.isFogExp2&&(t.uniform1f(y,I.density),t.uniform1i(g,2),N=L=2)):(t.uniform1i(g,0),N=L=0);for(var D=0,k=i.length;Dt&&(t=e[r]);return t}function _e(){Object.defineProperty(this,"id",{value:Ei+=2}),this.uuid=ci.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 xe(e,t,r,n,i,o){se.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new we(e,t,r,n,i,o)),this.mergeVertices()}function we(e,t,r,n,i,a){function s(e,t,r,n,i,a,s,m,v,g,y){var b=a/v,_=s/g,x=a/2,w=s/2,S=m/2;s=v+1;var M,E,C=g+1,T=a=0,O=new o;for(E=0;E/gm,function(e,t){if(void 0===(e=_i[t]))throw Error("Can not resolve #include <"+t+">");return Ge(e)})}function Ve(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,r,n){for(e="",t=parseInt(t);tt||e.height>t){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,e),r}return e}function c(e){return ci.isPowerOfTwo(e.width)&&ci.isPowerOfTwo(e.height)}function u(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function h(t){return 1003===t||1004===t||1005===t?e.NEAREST:e.LINEAR}function l(t){(t=t.target).removeEventListener("dispose",l);e:{var r=n.get(t);if(t.image&&r.__image__webglTextureCube)e.deleteTexture(r.__image__webglTextureCube);else{if(void 0===r.__webglInit)break e;e.deleteTexture(r.__webglTexture)}n.remove(t)}a.textures--}function p(t){(t=t.target).removeEventListener("dispose",p);var r=n.get(t),i=n.get(t.texture);if(t){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(i=0;6>i;i++)e.deleteFramebuffer(r.__webglFramebuffer[i]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[i]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer);n.remove(t.texture),n.remove(t)}a.textures--}function d(t,h){var p=n.get(t);if(0v;v++)m[v]=h||d?d?t.image[v].image:t.image[v]:s(t.image[v],i.maxCubemapSize);var g=c(m[0]),y=o.convert(t.format),b=o.convert(t.type);for(f(e.TEXTURE_CUBE_MAP,t,g),v=0;6>v;v++)if(h)for(var _,x=m[v].mipmaps,w=0,S=x.length;wl;l++)i.__webglFramebuffer[l]=e.createFramebuffer()}else i.__webglFramebuffer=e.createFramebuffer();if(s){for(r.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),f(e.TEXTURE_CUBE_MAP,t.texture,h),l=0;6>l;l++)m(i.__webglFramebuffer[l],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+l);u(t.texture,h)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),r.bindTexture(e.TEXTURE_CUBE_MAP,null)}else r.bindTexture(e.TEXTURE_2D,o.__webglTexture),f(e.TEXTURE_2D,t.texture,h),m(i.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),u(t.texture,h)&&e.generateMipmap(e.TEXTURE_2D),r.bindTexture(e.TEXTURE_2D,null);if(t.depthBuffer){if(i=n.get(t),o=!0===t.isWebGLRenderTargetCube,t.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");if(t&&t.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),!t.depthTexture||!t.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(n.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),d(t.depthTexture,0),i=n.get(t.depthTexture).__webglTexture,1026===t.depthTexture.format)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,i,0);else{if(1027!==t.depthTexture.format)throw Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,i,0)}}else if(o)for(i.__webglDepthbuffer=[],o=0;6>o;o++)e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),v(i.__webglDepthbuffer[o],t);else e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),v(i.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(t){var i=t.texture;u(i,c(t))&&(t=t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,i=n.get(i).__webglTexture,r.bindTexture(t,i),e.generateMipmap(t),r.bindTexture(t,null))}}(ce,ue,le,pe,he,Ce,ae),fe=new function(e){var t={};return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t[e.uuid]},remove:function(r){r.isInterleavedBufferAttribute&&(r=r.data);var n=t[r.uuid];n&&(e.deleteBuffer(n.buffer),delete t[r.uuid])},update:function(r,n){if(r.isInterleavedBufferAttribute&&(r=r.data),void 0===(i=t[r.uuid])){var i=r.uuid,o=r.array,a=r.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW,s=e.createBuffer();e.bindBuffer(n,s),e.bufferData(n,o,a),r.onUploadCallback(),n=e.FLOAT,o instanceof Float32Array?n=e.FLOAT:o instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):o instanceof Uint16Array?n=e.UNSIGNED_SHORT:o instanceof Int16Array?n=e.SHORT:o instanceof Uint32Array?n=e.UNSIGNED_INT:o instanceof Int32Array?n=e.INT:o instanceof Int8Array?n=e.BYTE:o instanceof Uint8Array&&(n=e.UNSIGNED_BYTE),t[i]={buffer:s,type:n,bytesPerElement:o.BYTES_PER_ELEMENT,version:r.version}}else i.versionu;u++)(l=n[u])&&(s=l[0],l=l[1])?(h&&i.addAttribute("morphTarget"+u,h[s]),o&&i.addAttribute("morphNormal"+u,o[s]),r[u]=l):r[u]=0;a.getUniforms().setValue(e,"morphTargetInfluences",r)}}}(ce),ye=new function(e,t,r){function n(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 i=[],o={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"},a="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking dithering".split(" ");this.getParameters=function(t,i,a,s,c,u,h){var l=o[t.type];if(h.isSkinnedMesh){var p=h.skeleton.bones;if(r.floatVertexTextures)p=1024;else{var d=Math.min(Math.floor((r.maxVertexUniforms-20)/4),p.length);d=he.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+he.maxTextures),G+=1,e},this.setTexture2D=function(){var e=!1;return function(t,r){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),de.setTexture2D(t,r)}}(),this.setTexture=function(){var e=!1;return function(t,r){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),de.setTexture2D(t,r)}}(),this.setTextureCube=function(){var e=!1;return function(t,r){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?de.setTextureCube(t,r):de.setTextureCubeDynamic(t,r)}}(),this.getRenderTarget=function(){return L},this.setRenderTarget=function(e){(L=e)&&void 0===pe.get(e).__webglFramebuffer&&de.setupRenderTarget(e);var t=null,r=!1;e?(t=pe.get(e).__webglFramebuffer,e.isWebGLRenderTargetCube&&(t=t[e.activeCubeFace],r=!0),F.copy(e.viewport),U.copy(e.scissor),z=e.scissorTest):(F.copy(Y).multiplyScalar(X),U.copy(K).multiplyScalar(X),z=Z),N!==t&&(ce.bindFramebuffer(ce.FRAMEBUFFER,t),N=t),le.viewport(F),le.scissor(U),le.setScissorTest(z),r&&(r=pe.get(e.texture),ce.framebufferTexture2D(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.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 a=pe.get(e).__webglFramebuffer;if(a){var s=!1;a!==N&&(ce.bindFramebuffer(ce.FRAMEBUFFER,a),s=!0);try{var c=e.texture,u=c.format,h=c.type;1023!==u&&Ce.convert(u)!==ce.getParameter(ce.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||Ce.convert(h)===ce.getParameter(ce.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(ue.get("OES_texture_float")||ue.get("WEBGL_color_buffer_float"))||1016===h&&ue.get("EXT_color_buffer_half_float")?ce.checkFramebufferStatus(ce.FRAMEBUFFER)===ce.FRAMEBUFFER_COMPLETE?0<=t&&t<=e.width-n&&0<=r&&r<=e.height-i&&ce.readPixels(t,r,n,i,Ce.convert(u),Ce.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{s&&ce.bindFramebuffer(ce.FRAMEBUFFER,N)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function Qe(e,t){this.name="",this.color=new z(e),this.density=void 0!==t?t:25e-5}function et(e,t,r){this.name="",this.color=new z(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3}function tt(){ne.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function rt(e,t,r,n,i){ne.call(this),this.lensFlares=[],this.positionScreen=new o,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,n,i)}function nt(e){W.call(this),this.type="SpriteMaterial",this.color=new z(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(e)}function it(e){ne.call(this),this.type="Sprite",this.material=void 0!==e?e:new nt}function ot(){ne.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function at(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=e.HAVE_CURRENT_DATA&&(l.needsUpdate=!0),requestAnimationFrame(h)}s.call(this,e,t,r,n,i,o,a,c,u),this.generateMipmaps=!1;var l=this;requestAnimationFrame(h)}function gt(e,t,r,n,i,o,a,c,u,h,l,p){s.call(this,null,o,a,c,u,h,n,i,l,p),this.image={width:t,height:r},this.mipmaps=e,this.generateMipmaps=this.flipY=!1}function yt(e,t,r,n,i,o,a,c,u,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===h&&(r=1012),void 0===r&&1027===h&&(r=1020),s.call(this,null,n,i,o,a,c,h,r,u),this.image={width:e,height:t},this.magFilter=void 0!==a?a:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=this.flipY=!1}function bt(e){_e.call(this),this.type="WireframeGeometry";var t,r,n,i=[],a=[0,0],s={},c=["a","b","c"];if(e&&e.isGeometry){var u=e.faces,h=0;for(r=u.length;ht;t++){var p=l[c[t]],d=l[c[(t+1)%3]];a[0]=Math.min(p,d),a[1]=Math.max(p,d),void 0===s[p=a[0]+","+a[1]]&&(s[p]={index1:a[0],index2:a[1]})}}for(p in s)h=s[p],c=e.vertices[h.index1],i.push(c.x,c.y,c.z),c=e.vertices[h.index2],i.push(c.x,c.y,c.z)}else if(e&&e.isBufferGeometry){c=new o;if(null!==e.index){u=e.attributes.position,l=e.index;var f=e.groups;for(0===f.length&&(f=[{start:0,count:l.count,materialIndex:0}]),e=0,n=f.length;et;t++)p=l.getX(h+t),d=l.getX(h+(t+1)%3),a[0]=Math.min(p,d),a[1]=Math.max(p,d),p=a[0]+","+a[1],void 0===s[p]&&(s[p]={index1:a[0],index2:a[1]});for(p in s)h=s[p],c.fromBufferAttribute(u,h.index1),i.push(c.x,c.y,c.z),c.fromBufferAttribute(u,h.index2),i.push(c.x,c.y,c.z)}else for(u=e.attributes.position,h=0,r=u.count/3;ht;t++)s=3*h+t,c.fromBufferAttribute(u,s),i.push(c.x,c.y,c.z),s=3*h+(t+1)%3,c.fromBufferAttribute(u,s),i.push(c.x,c.y,c.z)}this.addAttribute("position",new ve(i,3))}function _t(e,t,r){se.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r},this.fromBufferGeometry(new xt(e,t,r)),this.mergeVertices()}function xt(e,t,r){_e.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:r};var n,i,a=[],s=[],c=[],u=[],h=new o,l=new o,p=new o,d=new o,f=new o,m=t+1;for(n=0;n<=r;n++){var v=n/r;for(i=0;i<=t;i++){var g=i/t,l=e(g,v,l);s.push(l.x,l.y,l.z),0<=g-1e-5?(p=e(g-1e-5,v,p),d.subVectors(l,p)):(p=e(g+1e-5,v,p),d.subVectors(p,l)),0<=v-1e-5?(p=e(g,v-1e-5,p),f.subVectors(l,p)):(p=e(g,v+1e-5,p),f.subVectors(p,l)),h.crossVectors(d,f).normalize(),c.push(h.x,h.y,h.z),u.push(g,v)}}for(n=0;nn&&1===e.x&&(h[t]=e.x-1),0===r.x&&0===r.z&&(h[t]=n/2/Math.PI+.5)}_e.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1;var u=[],h=[];!function(e){for(var r=new o,n=new o,i=new o,c=0;ca&&(.2>t&&(h[e+0]+=1),.2>n&&(h[e+2]+=1),.2>i&&(h[e+4]+=1))}(),this.addAttribute("position",new ve(u,3)),this.addAttribute("normal",new ve(u.slice(),3)),this.addAttribute("uv",new ve(h,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Mt(e,t){se.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Et(e,t)),this.mergeVertices()}function Et(e,t){St.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 Ct(e,t){se.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Tt(e,t)),this.mergeVertices()}function Tt(e,t){St.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 Ot(e,t){se.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Pt(e,t)),this.mergeVertices()}function Pt(e,t){var r=(1+Math.sqrt(5))/2;St.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 jt(e,t){se.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new At(e,t)),this.mergeVertices()}function At(e,t){var r=(1+Math.sqrt(5))/2,n=1/r;St.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 Rt(e,t,r,n,i,o){se.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 Lt(e,t,r,n,i),this.tangents=e.tangents,this.normals=e.normals,this.binormals=e.binormals,this.fromBufferGeometry(e),this.mergeVertices()}function Lt(e,t,n,i,a){function s(r){f=e.getPointAt(r/t,f);var o=c.normals[r];for(r=c.binormals[r],h=0;h<=i;h++){var a=h/i*Math.PI*2,s=Math.sin(a),a=-Math.cos(a);p.x=a*o.x+s*r.x,p.y=a*o.y+s*r.y,p.z=a*o.z+s*r.z,p.normalize(),v.push(p.x,p.y,p.z),l.x=f.x+n*p.x,l.y=f.y+n*p.y,l.z=f.z+n*p.z,m.push(l.x,l.y,l.z)}}_e.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:a},t=t||64,n=n||1,i=i||8,a=a||!1;var c=e.computeFrenetFrames(t,a);this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals;var u,h,l=new o,p=new o,d=new r,f=new o,m=[],v=[],g=[],y=[];for(u=0;uh;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:s,face2:void 0}:i[l].face2=s}for(l in i)(void 0===(n=i[l]).face2||a[n.face1].normal.dot(a[n.face2].normal)<=t)&&(o=e[n.index1],r.push(o.x,o.y,o.z),o=e[n.index2],r.push(o.x,o.y,o.z));this.addAttribute("position",new ve(r,3))}function Zt(e,t,r,n,i,o,a,s){se.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new Jt(e,t,r,n,i,o,a,s)),this.mergeVertices()}function Jt(e,t,n,i,a,s,c,u){function h(n){var a,s=new r,h=new o,g=0,_=!0===n?e:t,x=!0===n?1:-1,w=v;for(a=1;a<=i;a++)d.push(0,y*x,0),f.push(0,x,0),m.push(.5,.5),v++;var S=v;for(a=0;a<=i;a++){var M=a/i*u+c,E=Math.cos(M),M=Math.sin(M);h.x=_*M,h.y=y*x,h.z=_*E,d.push(h.x,h.y,h.z),f.push(0,x,0),s.x=.5*E+.5,s.y=.5*M*x+.5,m.push(s.x,s.y),v++}for(a=0;athis.duration&&this.resetDuration(),this.optimize()}function Gr(e){this.manager=void 0!==e?e:Ai,this.textures={}}function Vr(e){this.manager=void 0!==e?e:Ai}function Hr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function qr(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Ai,this.withCredentials=!1}function Wr(e){this.manager=void 0!==e?e:Ai,this.texturePath=""}function Xr(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 Yr(e,t,r,n){var i=1-e;return i*i*t+2*(1-e)*e*r+e*e*n}function Kr(e,t,r,n,i){var o=1-e,a=1-e;return o*o*o*t+3*a*a*e*r+3*(1-e)*e*e*n+e*e*e*i}function Zr(){this.type="Curve",this.arcLengthDivisions=200}function Jr(e,t){Zr.call(this),this.type="LineCurve",this.v1=e||new r,this.v2=t||new r}function Qr(){Zr.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function en(e,t,r,n,i,o,a,s){Zr.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=r||1,this.yRadius=n||1,this.aStartAngle=i||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function tn(e){Zr.call(this),this.type="SplineCurve",this.points=e||[]}function rn(e,t,n,i){Zr.call(this),this.type="CubicBezierCurve",this.v0=e||new r,this.v1=t||new r,this.v2=n||new r,this.v3=i||new r}function nn(e,t,n){Zr.call(this),this.type="QuadraticBezierCurve",this.v0=e||new r,this.v1=t||new r,this.v2=n||new r}function on(e){Qr.call(this),this.type="Path",this.currentPoint=new r,e&&this.setFromPoints(e)}function an(e){on.call(this,e),this.type="Shape",this.holes=[]}function sn(){this.type="ShapePath",this.subPaths=[],this.currentPath=null}function cn(e){this.type="Font",this.data=e}function un(e){this.manager=void 0!==e?e:Ai}function hn(e){this.manager=void 0!==e?e:Ai}function ln(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new We,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new We,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function pn(e,t,r){ne.call(this),this.type="CubeCamera";var n=new We(90,1,e,t);n.up.set(0,-1,0),n.lookAt(new o(1,0,0)),this.add(n);var i=new We(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new o(-1,0,0)),this.add(i);var a=new We(90,1,e,t);a.up.set(0,0,1),a.lookAt(new o(0,1,0)),this.add(a);var s=new We(90,1,e,t);s.up.set(0,0,-1),s.lookAt(new o(0,-1,0)),this.add(s);var c=new We(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new o(0,0,1)),this.add(c);var u=new We(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new o(0,0,-1)),this.add(u),this.renderTarget=new h(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,o=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,n,r),r.activeCubeFace=1,e.render(t,i,r),r.activeCubeFace=2,e.render(t,a,r),r.activeCubeFace=3,e.render(t,s,r),r.activeCubeFace=4,e.render(t,c,r),r.texture.generateMipmaps=o,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;6>o;o++)i.activeCubeFace=o,e.setRenderTarget(i),e.clear(t,r,n);e.setRenderTarget(null)}}function dn(){ne.call(this),this.type="AudioListener",this.context=$i.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function fn(e){ne.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 mn(e){fn.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function vn(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 gn(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 yn(e,t,r){r=r||bn.parseTrackName(t),this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function bn(e,t,r){this.path=t,this.parsedPath=r||bn.parseTrackName(t),this.node=bn.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function _n(){this.uuid=ci.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 xn(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,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 wn(e){this._root=e,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function Sn(e,t){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=t),this.value=e}function Mn(){_e.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function En(e,t,r,n){this.uuid=ci.generateUUID(),this.data=e,this.itemSize=t,this.offset=r,this.normalized=!0===n}function Cn(e,t){this.uuid=ci.generateUUID(),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.onUploadCallback=function(){},this.version=0}function Tn(e,t,r){Cn.call(this,e,t),this.meshPerAttribute=r||1}function On(e,t,r){ce.call(this,e,t),this.meshPerAttribute=r||1}function Pn(e,t,r,n){this.ray=new Te(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 jn(e,t){return e.distance-t.distance}function An(e,t,r,n){if(!1!==e.visible&&(e.raycast(t,r),!0===n)){n=0;for(var i=(e=e.children).length;nr;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 ve(t,3)),t=new ut({fog:!1}),this.cone=new lt(e,t),this.add(this.cone),this.update()}function Bn(e){var t=[];e&&e.isBone&&t.push(e);for(var r=0;re?-1:0i;i++)8===i||13===i||18===i||23===i?n+="-":14===i?n+="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,n+=t[19===i?3&e|8:e]);return n}}(),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:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?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*ci.DEG2RAD},radToDeg:function(e){return e*ci.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(r.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(r.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:function(){var e=new r,t=new r;return function(r,n){return e.set(r,r),t.set(n,n),this.clamp(e,t)}}(),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=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(e){return this.x*e.x+this.y*e.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)},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 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;return e=this.y-e.y,t*t+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){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(n.prototype,{isMatrix4:!0,set:function(e,t,r,n,i,o,a,s,c,u,h,l,p,d,f,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]=a,v[13]=s,v[2]=c,v[6]=u,v[10]=h,v[14]=l,v[3]=p,v[7]=d,v[11]=f,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 n).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:function(){var e=new o;return function(t){var r=this.elements,n=t.elements,i=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length();return t=1/e.setFromMatrixColumn(t,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]*t,r[9]=n[9]*t,r[10]=n[10]*t,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),a=Math.cos(n),n=Math.sin(n),s=Math.cos(i),i=Math.sin(i);if("XYZ"===e.order){var c=o*s,u=o*i,h=r*s;e=r*i,t[0]=a*s,t[4]=-a*i,t[8]=n,t[1]=u+h*n,t[5]=c-e*n,t[9]=-r*a,t[2]=e-c*n,t[6]=h+u*n,t[10]=o*a}else"YXZ"===e.order?(c=a*s,u=a*i,h=n*s,e=n*i,t[0]=c+e*r,t[4]=h*r-u,t[8]=o*n,t[1]=o*i,t[5]=o*s,t[9]=-r,t[2]=u*r-h,t[6]=e+c*r,t[10]=o*a):"ZXY"===e.order?(c=a*s,u=a*i,h=n*s,e=n*i,t[0]=c-e*r,t[4]=-o*i,t[8]=h+u*r,t[1]=u+h*r,t[5]=o*s,t[9]=e-c*r,t[2]=-o*n,t[6]=r,t[10]=o*a):"ZYX"===e.order?(c=o*s,u=o*i,h=r*s,e=r*i,t[0]=a*s,t[4]=h*n-u,t[8]=c*n+e,t[1]=a*i,t[5]=e*n+c,t[9]=u*n-h,t[2]=-n,t[6]=r*a,t[10]=o*a):"YZX"===e.order?(c=o*a,u=o*n,h=r*a,e=r*n,t[0]=a*s,t[4]=e-c*i,t[8]=h*i+u,t[1]=i,t[5]=o*s,t[9]=-r*s,t[2]=-n*s,t[6]=u*i+h,t[10]=c-e*i):"XZY"===e.order&&(c=o*a,u=o*n,h=r*a,e=r*n,t[0]=a*s,t[4]=-i,t[8]=n*s,t[1]=c*i+e,t[5]=o*s,t[9]=u*i-h,t[2]=h*i-u,t[6]=r*s,t[10]=e*i+c);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,r=e._x,n=e._y,i=e._z,o=e._w,a=i+i;e=r*(u=r+r);var s=r*(h=n+n),r=r*a,c=n*h,n=n*a,i=i*a,u=o*u,h=o*h,o=o*a;return t[0]=1-(c+i),t[4]=s-o,t[8]=r+h,t[1]=s+o,t[5]=1-(e+i),t[9]=n-u,t[2]=r-h,t[6]=n+u,t[10]=1-(e+c),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new o,t=new o,r=new o;return function(n,i,o){var a=this.elements;return r.subVectors(n,i),0===r.lengthSq()&&(r.z=1),r.normalize(),e.crossVectors(o,r),0===e.lengthSq()&&(1===Math.abs(o.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),e.crossVectors(o,r)),e.normalize(),t.crossVectors(r,e),a[0]=e.x,a[4]=t.x,a[8]=r.x,a[1]=e.y,a[5]=t.y,a[9]=r.y,a[2]=e.z,a[6]=t.z,a[10]=r.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],a=r[12],s=r[1],c=r[5],u=r[9],h=r[13],l=r[2],p=r[6],d=r[10],f=r[14],m=r[3],v=r[7],g=r[11],r=r[15],y=n[0],b=n[4],_=n[8],x=n[12],w=n[1],S=n[5],M=n[9],E=n[13],C=n[2],T=n[6],O=n[10],P=n[14],j=n[3],A=n[7],R=n[11],n=n[15];return t[0]=e*y+i*w+o*C+a*j,t[4]=e*b+i*S+o*T+a*A,t[8]=e*_+i*M+o*O+a*R,t[12]=e*x+i*E+o*P+a*n,t[1]=s*y+c*w+u*C+h*j,t[5]=s*b+c*S+u*T+h*A,t[9]=s*_+c*M+u*O+h*R,t[13]=s*x+c*E+u*P+h*n,t[2]=l*y+p*w+d*C+f*j,t[6]=l*b+p*S+d*T+f*A,t[10]=l*_+p*M+d*O+f*R,t[14]=l*x+p*E+d*P+f*n,t[3]=m*y+v*w+g*C+r*j,t[7]=m*b+v*S+g*T+r*A,t[11]=m*_+v*M+g*O+r*R,t[15]=m*x+v*E+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:function(){var e=new o;return function(t){for(var r=0,n=t.count;rthis.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],t.copy(this),r=1/a;var o=1/s,u=1/c;return t.elements[0]*=r,t.elements[1]*=r,t.elements[2]*=r,t.elements[4]*=o,t.elements[5]*=o,t.elements[6]*=o,t.elements[8]*=u,t.elements[9]*=u,t.elements[10]*=u,n.setFromRotationMatrix(t),i.x=a,i.y=s,i.z=c,this}}(),makePerspective:function(e,t,r,n,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements;return a[0]=2*i/(t-e),a[4]=0,a[8]=(t+e)/(t-e),a[12]=0,a[1]=0,a[5]=2*i/(r-n),a[9]=(r+n)/(r-n),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+i)/(o-i),a[14]=-2*o*i/(o-i),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,r,n,i,o){var a=this.elements,s=1/(t-e),c=1/(r-n),u=1/(o-i);return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-(t+e)*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(e){var t=this.elements;e=e.elements;for(var r=0;16>r;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;16>r;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;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(i,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,r,n,i,o,a){var s=r[n+0],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,d=0<=p?1:-1,f=1-p*p;f>Number.EPSILON&&(f=Math.sqrt(f),p=Math.atan2(f,p*d),o=Math.sin(o*p)/f,a=Math.sin(a*p)/f),s=s*o+n*(d*=a),c=c*o+h*d,u=u*o+l*d,r=r*o+i*d,o===1-a&&(a=1/Math.sqrt(s*s+c*c+u*u+r*r),s*=a,c*=a,u*=a,r*=a)}e[t]=s,e[t+1]=c,e[t+2]=u,e[t+3]=r}}),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()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(i.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,a=Math.sin,s=o(r/2),c=o(n/2),o=o(i/2),r=a(r/2),n=a(n/2),i=a(i/2);return"XYZ"===e?(this._x=r*c*o+s*n*i,this._y=s*n*o-r*c*i,this._z=s*c*i+r*n*o,this._w=s*c*o-r*n*i):"YXZ"===e?(this._x=r*c*o+s*n*i,this._y=s*n*o-r*c*i,this._z=s*c*i-r*n*o,this._w=s*c*o+r*n*i):"ZXY"===e?(this._x=r*c*o-s*n*i,this._y=s*n*o+r*c*i,this._z=s*c*i+r*n*o,this._w=s*c*o-r*n*i):"ZYX"===e?(this._x=r*c*o-s*n*i,this._y=s*n*o+r*c*i,this._z=s*c*i-r*n*o,this._w=s*c*o+r*n*i):"YZX"===e?(this._x=r*c*o+s*n*i,this._y=s*n*o+r*c*i,this._z=s*c*i-r*n*o,this._w=s*c*o-r*n*i):"XZY"===e&&(this._x=r*c*o-s*n*i,this._y=s*n*o-r*c*i,this._z=s*c*i+r*n*o,this._w=s*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],a=t[9],s=t[2],c=t[6],u=r+o+(t=t[10]);return 0o&&r>t?(r=2*Math.sqrt(1+r-o-t),this._w=(c-a)/r,this._x=.25*r,this._y=(e+i)/r,this._z=(n+s)/r):o>t?(r=2*Math.sqrt(1+o-r-t),this._w=(n-s)/r,this._x=(e+i)/r,this._y=.25*r,this._z=(a+c)/r):(r=2*Math.sqrt(1+t-r-o),this._w=(i-e)/r,this._x=(n+s)/r,this._y=(a+c)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new o;return function(r,n){return void 0===t&&(t=new o),1e-6>(e=r.dot(n)+1)?(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(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,a=t._y,s=t._z;return t=t._w,this._x=r*t+e*o+n*s-i*a,this._y=n*t+e*a+i*o-r*s,this._z=i*t+e*s+r*a-n*o,this._w=e*t-r*o-n*a-i*s,this.onChangeCallback(),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;if(0>(s=o*e._w+r*e._x+n*e._y+i*e._z)?(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=Math.sqrt(1-s*s),.001>Math.abs(e))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 a=Math.atan2(e,s),s=Math.sin((1-t)*a)/e;return 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(o.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:function(){var e=new i;return function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e=new i;return function(t,r){return this.applyQuaternion(e.setFromAxisAngle(t,r))}}(),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,a=e.z,s=(e=e.w)*t+o*n-a*r,c=e*r+a*t-i*n,u=e*n+i*r-o*t,t=-i*t-o*r-a*n;return this.x=s*e+t*-i+c*-a-u*-o,this.y=c*e+t*-o+u*-i-s*-a,this.z=u*e+t*-a+s*-o-c*-i,this},project:function(){var e=new n;return function(t){return e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e=new n;return function(t){return e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),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:function(){var e=new o,t=new o;return function(r,n){return e.set(r,r,r),t.set(n,n,n),this.clamp(e,t)}}(),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=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(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:function(){var e=new o;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new o;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){return e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq()),Math.acos(ci.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 e=this.z-e.z,t*t+r*r+e*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){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(a.prototype,{isMatrix3:!0,set:function(e,t,r,n,i,o,a,s,c){var u=this.elements;return u[0]=e,u[1]=n,u[2]=a,u[3]=t,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(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:function(){var e=new o;return function(t){for(var r=0,n=t.count;rr;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;9>r;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;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 ui=0;s.DEFAULT_IMAGE=void 0,s.DEFAULT_MAPPING=300,Object.defineProperty(s.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(s.prototype,t.prototype,{constructor:s,isTexture:!0,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],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=ci.generateUUID()),!t&&void 0===e.images[n.uuid]){var i=e.images,o=n.uuid,a=n.uuid;if(n instanceof HTMLCanvasElement)var s=n;else{(s=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=n.width,s.height=n.height;var c=s.getContext("2d");n instanceof ImageData?c.putImageData(n,0,0):c.drawImage(n,0,0,n.width,n.height)}s=2048e.x||1e.x?0:1;break;case 1002:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(0>e.y||1e.y?0:1;break;case 1002:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}}),Object.assign(c.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 1e-4>t?(this.x=1,this.z=this.y=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t=(e=e.elements)[0],r=e[4],n=e[8],i=e[1],o=e[5],a=e[9],s=e[2],c=e[6],u=e[10];return.01>Math.abs(r-i)&&.01>Math.abs(n-s)&&.01>Math.abs(a-c)?.1>Math.abs(r+i)&&.1>Math.abs(n+s)&&.1>Math.abs(a+c)&&.1>Math.abs(t+o+u-3)?(this.set(1,0,0,0),this):(e=Math.PI,t=(t+1)/2,o=(o+1)/2,u=(u+1)/2,r=(r+i)/4,n=(n+s)/4,a=(a+c)/4,t>o&&t>u?.01>t?(c=0,r=s=.707106781):(c=Math.sqrt(t),s=r/c,r=n/c):o>u?.01>o?(c=.707106781,s=0,r=.707106781):(s=Math.sqrt(o),c=r/s,r=a/s):.01>u?(s=c=.707106781,r=0):(r=Math.sqrt(u),c=n/r,s=a/r),this.set(c,s,r,e),this):(e=Math.sqrt((c-a)*(c-a)+(n-s)*(n-s)+(i-r)*(i-r)),.001>Math.abs(e)&&(e=1),this.x=(c-a)/e,this.y=(n-s)/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(){var e,t;return function(r,n){return void 0===e&&(e=new c,t=new c),e.set(r,r,r,r),t.set(n,n,n,n),this.clamp(e,t)}}(),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=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(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}}),Object.assign(u.prototype,t.prototype,{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"})}}),(h.prototype=Object.create(u.prototype)).constructor=h,h.prototype.isWebGLRenderTargetCube=!0,(l.prototype=Object.create(s.prototype)).constructor=l,l.prototype.isDataTexture=!0,(p.prototype=Object.create(s.prototype)).constructor=p,p.prototype.isCubeTexture=!0,Object.defineProperty(p.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var hi=new s,li=new p,pi=[],di=[],fi=new Float32Array(16),mi=new Float32Array(9);U.prototype.setValue=function(e,t){for(var r=this.seq,n=0,i=r.length;n!==i;++n){var o=r[n];o.setValue(e,t[o.id])}};var vi=/([\w\d_]+)(\])?(\[|\.)?/g;$.prototype.setValue=function(e,t,r){void 0!==(t=this.map[t])&&t.setValue(e,r,this.renderer)},$.prototype.setOptional=function(e,t,r){void 0!==(t=t[r])&&this.setValue(e,r,t)},$.upload=function(e,t,r,n){for(var i=0,o=t.length;i!==o;++i){var a=t[i],s=r[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}},$.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 gi={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(z.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 e(e,t,r){return 0>r&&(r+=1),1r?t:r<2/3?e+6*(t-e)*(2/3-r):e}return function(t,r,n){return t=ci.euclideanModulo(t,1),r=ci.clamp(r,0,1),n=ci.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=e(n,r,t+1/3),this.g=e(n,r,t),this.b=e(n,r,t-1/3)),this}}(),setStyle:function(e){function t(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){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,t(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,t(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 t(r[5]),this.setHSL(n,i,o)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){if(r=r[1],3===(n=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===n)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return e&&0=a?s/(o+c):s/(2-o-c);switch(o){case r:t=(n-i)/s+(n 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * 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\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 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(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\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\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 ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = 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",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], 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\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\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:"#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#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 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\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 ], 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 \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \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 \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \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 \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},xi={basic:{uniforms:bi.merge([yi.common,yi.specularmap,yi.envmap,yi.aomap,yi.lightmap,yi.fog]),vertexShader:_i.meshbasic_vert,fragmentShader:_i.meshbasic_frag},lambert:{uniforms:bi.merge([yi.common,yi.specularmap,yi.envmap,yi.aomap,yi.lightmap,yi.emissivemap,yi.fog,yi.lights,{emissive:{value:new z(0)}}]),vertexShader:_i.meshlambert_vert,fragmentShader:_i.meshlambert_frag},phong:{uniforms:bi.merge([yi.common,yi.specularmap,yi.envmap,yi.aomap,yi.lightmap,yi.emissivemap,yi.bumpmap,yi.normalmap,yi.displacementmap,yi.gradientmap,yi.fog,yi.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:_i.meshphong_vert,fragmentShader:_i.meshphong_frag},standard:{uniforms:bi.merge([yi.common,yi.envmap,yi.aomap,yi.lightmap,yi.emissivemap,yi.bumpmap,yi.normalmap,yi.displacementmap,yi.roughnessmap,yi.metalnessmap,yi.fog,yi.lights,{emissive:{value:new z(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:_i.meshphysical_vert,fragmentShader:_i.meshphysical_frag},points:{uniforms:bi.merge([yi.points,yi.fog]),vertexShader:_i.points_vert,fragmentShader:_i.points_frag},dashed:{uniforms:bi.merge([yi.common,yi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_i.linedashed_vert,fragmentShader:_i.linedashed_frag},depth:{uniforms:bi.merge([yi.common,yi.displacementmap]),vertexShader:_i.depth_vert,fragmentShader:_i.depth_frag},normal:{uniforms:bi.merge([yi.common,yi.bumpmap,yi.normalmap,yi.displacementmap,{opacity:{value:1}}]),vertexShader:_i.normal_vert,fragmentShader:_i.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_i.cube_vert,fragmentShader:_i.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_i.equirect_vert,fragmentShader:_i.equirect_frag},distanceRGBA:{uniforms:bi.merge([yi.common,yi.displacementmap,{referencePosition:{value:new o},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_i.distanceRGBA_vert,fragmentShader:_i.distanceRGBA_frag},shadow:{uniforms:bi.merge([yi.lights,yi.fog,{color:{value:new z(0)},opacity:{value:1}}]),vertexShader:_i.shadow_vert,fragmentShader:_i.shadow_frag}};xi.physical={uniforms:bi.merge([xi.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:_i.meshphysical_vert,fragmentShader:_i.meshphysical_frag},Object.assign(G.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;tthis.max.x||e.ythis.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(t||new r).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.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new r).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new r;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).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)}}),(H.prototype=Object.create(s.prototype)).constructor=H;var wi=0;Object.assign(W.prototype,t.prototype,{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.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.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),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.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),0i&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(t,r,n),this.max.set(i,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=e.count;si&&(i=u),h>o&&(o=h),l>a&&(a=l)}return this.min.set(t,r,n),this.max.set(i,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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(t||new o).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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e=new o;return function(t){return this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){if(0=e.constant},clampPoint:function(e,t){return(t||new o).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new o;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new o;return function(t){return t=t||new Z,this.getCenter(t.center),t.radius=.5*this.getSize(e).length(),t}}(),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(){var e=[new o,new o,new o,new o,new o,new o,new o,new o];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),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(Z.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new K;return function(t,r){var n=this.center;void 0!==r?n.copy(r):e.setFromPoints(t).getCenter(n);for(var i=r=0,o=t.length;i=this.radius},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(t=t||new o).copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return(e=e||new K).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(J.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:function(){var e=new o,t=new o;return function(r,n,i){return n=e.subVectors(i,n).cross(t.subVectors(r,n)).normalize(),this.setFromNormalAndCoplanarPoint(n,r),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(t||new o).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new o;return function(t,r){r=r||new o;var n=t.delta(e),i=this.normal.dot(n);if(0===i){if(0===this.distanceToPoint(t.start))return r.copy(t.start)}else if(!(0>(i=-(t.start.dot(this.normal)+this.constant)/i)||1t&&0e&&0r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes;e=(v=e.elements)[0];var r=v[1],n=v[2],i=v[3],o=v[4],a=v[5],s=v[6],c=v[7],u=v[8],h=v[9],l=v[10],p=v[11],d=v[12],f=v[13],m=v[14],v=v[15];return t[0].setComponents(i-e,c-o,p-u,v-d).normalize(),t[1].setComponents(i+e,c+o,p+u,v+d).normalize(),t[2].setComponents(i+r,c+a,p+h,v+f).normalize(),t[3].setComponents(i-r,c-a,p-h,v-f).normalize(),t[4].setComponents(i-n,c-s,p-l,v-m).normalize(),t[5].setComponents(i+n,c+s,p+l,v+m).normalize(),this},intersectsObject:function(){var e=new Z;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new Z;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){var t=this.planes,r=e.center;e=-e.radius;for(var n=0;6>n;n++)if(t[n].distanceToPoint(r)i;i++){a=n[i];e.x=0o&&0>a)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}}),te.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),te.DefaultOrder="XYZ",Object.defineProperties(te.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(te.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=ci.clamp;e=(l=e.elements)[0];var i=l[4],o=l[8],a=l[1],s=l[5],c=l[9],u=l[2],h=l[6],l=l[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(n(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-c,l),this._z=Math.atan2(-i,e)):(this._x=Math.atan2(h,s),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(c,-1,1)),.99999>Math.abs(c)?(this._y=Math.atan2(o,l),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-u,e),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(-u,l),this._z=Math.atan2(-i,s)):(this._y=0,this._z=Math.atan2(a,e))):"ZYX"===t?(this._y=Math.asin(-n(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(h,l),this._z=Math.atan2(a,e)):(this._x=0,this._z=Math.atan2(-i,s))):"YZX"===t?(this._z=Math.asin(n(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-c,s),this._y=Math.atan2(-u,e)):(this._x=0,this._y=Math.atan2(o,l))):"XZY"===t?(this._z=Math.asin(-n(i,-1,1)),.99999>Math.abs(i)?(this._x=Math.atan2(h,s),this._y=Math.atan2(o,e)):(this._x=Math.atan2(-c,l),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var e=new n;return function(t,r,n){return e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,n)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new i;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),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 o(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(re.prototype,{set:function(e){this.mask=1<a;a++)if(i[a]===i[(a+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=t.dot(this.direction))?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new o;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new o,t=new o,r=new o;return function(n,i,o,a){e.copy(n).add(i).multiplyScalar(.5),t.copy(i).sub(n).normalize(),r.copy(this.origin).sub(e);var s=.5*n.distanceTo(i),c=-this.direction.dot(t),u=r.dot(this.direction),h=-r.dot(t),l=r.lengthSq(),p=Math.abs(1-c*c);if(0=-d?i<=d?(s=1/p,n*=s,i*=s,c=n*(n+c*i+2*u)+i*(c*n+i+2*h)+l):(i=s,n=Math.max(0,-(c*i+u)),c=-n*n+i*(i+2*h)+l):(i=-s,n=Math.max(0,-(c*i+u)),c=-n*n+i*(i+2*h)+l):i<=-d?(n=Math.max(0,-(-c*s+u)),i=0t?null:(t=Math.sqrt(t-i),i=n-t,n+=t,0>i&&0>n?null:0>i?this.at(n,r):this.at(i,r))}}(),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||0>e.normal.dot(this.direction)*t},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 a=(e.min.x-o.x)*r;r*=e.max.x-o.x}else a=(e.max.x-o.x)*r,r*=e.min.x-o.x;if(0<=n){var s=(e.min.y-o.y)*n;n*=e.max.y-o.y}else s=(e.max.y-o.y)*n,n*=e.min.y-o.y;return a>n||s>r?null:((s>a||a!=a)&&(a=s),(ne||s>r?null:((s>a||a!=a)&&(a=s),(er?null:this.at(0<=a?a:r,t)))},intersectsBox:function(){var e=new o;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new o,t=new o,r=new o,n=new o;return function(i,o,a,s,c){if(t.subVectors(o,i),r.subVectors(a,i),n.crossVectors(t,r),0<(o=this.direction.dot(n))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return e.subVectors(this.origin,i),0>(i=s*this.direction.dot(r.crossVectors(e,r)))?null:0>(a=s*this.direction.dot(t.cross(e)))||i+a>o?null:0>(i=-s*e.dot(n))?null:this.at(i/o,c)}}(),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(Oe.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(e||new o).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new o).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 t=t||new o,this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new o,t=new o;return function(r,n){return e.subVectors(r,this.start),t.subVectors(this.end,this.start),r=t.dot(t),r=t.dot(e)/r,n&&(r=ci.clamp(r,0,1)),r}}(),closestPointToPoint:function(e,t,r){return e=this.closestPointToPointParameter(e,t),r=r||new o,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)}}),Object.assign(Pe,{normal:function(){var e=new o;return function(t,r,n,i){return(i=i||new o).subVectors(n,r),e.subVectors(t,r),i.cross(e),0<(t=i.lengthSq())?i.multiplyScalar(1/Math.sqrt(t)):i.set(0,0,0)}}(),barycoordFromPoint:function(){var e=new o,t=new o,r=new o;return function(n,i,a,s,c){e.subVectors(s,i),t.subVectors(a,i),r.subVectors(n,i),n=e.dot(e),i=e.dot(t),a=e.dot(r);var u=t.dot(t);s=t.dot(r);var h=n*u-i*i;return c=c||new o,0===h?c.set(-2,-1,-1):(h=1/h,u=(u*a-i*s)*h,n=(n*s-i*a)*h,c.set(1-u-n,n,u))}}(),containsPoint:function(){var e=new o;return function(t,r,n,i){return 0<=(t=Pe.barycoordFromPoint(t,r,n,i,e)).x&&0<=t.y&&1>=t.x+t.y}}()}),Object.assign(Pe.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},area:function(){var e=new o,t=new o;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new o).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return Pe.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new J).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return Pe.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Pe.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e=new J,t=[new Oe,new Oe,new Oe],r=new o,n=new o;return function(i,a){a=a||new o;var s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(i,r),!0===this.containsPoint(r))a.copy(r);else for(t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a),i=0;ir.far?null:{distance:t,point:_.clone(),object:e})}function i(r,n,i,o,a,s,c,p){return u.fromBufferAttribute(o,s),h.fromBufferAttribute(o,c),l.fromBufferAttribute(o,p),(r=t(r,r.material,n,i,u,h,l,b))&&(a&&(m.fromBufferAttribute(a,s),v.fromBufferAttribute(a,c),g.fromBufferAttribute(a,p),r.uv=e(b,u,h,l,m,v,g)),r.face=new ae(s,c,p,Pe.normal(u,h,l)),r.faceIndex=s),r}var a=new n,s=new Te,c=new Z,u=new o,h=new o,l=new o,p=new o,d=new o,f=new o,m=new r,v=new r,g=new r,y=new o,b=new o,_=new o;return function(r,n){var o=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===o.boundingSphere&&o.computeBoundingSphere(),c.copy(o.boundingSphere),c.applyMatrix4(_),!1!==r.ray.intersectsSphere(c)&&(a.getInverse(_),s.copy(r.ray).applyMatrix4(a),null===o.boundingBox||!1!==s.intersectsBox(o.boundingBox)))){var x;if(o.isBufferGeometry){var w,y=o.index,S=o.attributes.position,_=o.attributes.uv;if(null!==y){var M=0;for(w=y.count;Mo||(o=n.ray.origin.distanceTo(e))n.far||i.push({distance:o,point:e.clone(),face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ot.prototype=Object.assign(Object.create(ne.prototype),{constructor:ot,copy:function(e){ne.prototype.copy.call(this,e,!1);for(var t=0,r=(e=e.levels).length;t=n[i].distance;i++)n[i-1].object.visible=!1,n[i].object.visible=!0;for(;ia||(l.applyMatrix4(this.matrixWorld),(d=n.ray.origin.distanceTo(l))n.far||i.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}));else for(s=0,v=f.length/3-1;sa||(l.applyMatrix4(this.matrixWorld),(d=n.ray.origin.distanceTo(l))n.far||i.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else if(s.isGeometry)for(u=s.vertices,h=u.length,s=0;sa||(l.applyMatrix4(this.matrixWorld),(d=n.ray.origin.distanceTo(l))n.far||i.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),lt.prototype=Object.assign(Object.create(ht.prototype),{constructor:lt,isLineSegments:!0}),pt.prototype=Object.assign(Object.create(ht.prototype),{constructor:pt,isLineLoop:!0}),(dt.prototype=Object.create(W.prototype)).constructor=dt,dt.prototype.isPointsMaterial=!0,dt.prototype.copy=function(e){return W.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},ft.prototype=Object.assign(Object.create(ne.prototype),{constructor:ft,isPoints:!0,raycast:function(){var e=new n,t=new Te,r=new Z;return function(n,i){function a(e,r){var o=t.distanceSqToPoint(e);if(on.far||i.push({distance:a,distanceToRay:Math.sqrt(o),point:e.clone(),index:r,face:null,object:s})}}var s=this,c=this.geometry,u=this.matrixWorld,h=n.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(u),r.radius+=h,!1!==n.ray.intersectsSphere(r)){e.getInverse(u),t.copy(n.ray).applyMatrix4(e);var l=(h=h/((this.scale.x+this.scale.y+this.scale.z)/3))*h,h=new o;if(c.isBufferGeometry){var p=c.index,c=c.attributes.position.array;if(null!==p)for(var d=p.array,p=0,f=d.length;pr)return null;var n,i=[],o=[],a=[];if(0=s--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}var c=n;r<=c&&(c=0),r<=(n=c+1)&&(n=0);var u=n+1;r<=u&&(u=0);e:{var h,l=e[o[c]].x,p=e[o[c]].y,d=e[o[n]].x,f=e[o[n]].y,m=e[o[u]].x,v=e[o[u]].y;if(0>=(d-l)*(v-p)-(f-p)*(m-l))var g=!1;else{var y=m-d,b=v-f,_=l-m,x=p-v,w=d-l;for(g=f-p,h=0;h=-Number.EPSILON&&S>=-Number.EPSILON&&C>=-Number.EPSILON){g=!1;break e}}}g=!0}}if(g){for(i.push([e[o[c]],e[o[n]],e[o[u]]]),a.push([o[c],o[n],o[u]]),c=n,u=n+1;uNumber.EPSILON){if(0d||d>p)return[];if(0>(c=u*h-c*l)||c>p)return[]}else{if(0r?[]:c===r?o?[]:[a]:e<=r?[a,s]:[a,u]))}function o(e,t,r,n){var i=t.x-e.x,o=t.y-e.y;t=r.x-e.x,r=r.y-e.y;var a=n.x-e.x;return n=n.y-e.y,e=i*r-o*t,i=i*n-o*a,Math.abs(e)>Number.EPSILON?(t=a*r-n*t,0n&&(n=r);var i=e+1;return i>r&&(i=0),!!(r=o(u[e],u[n],u[i],y[t]))&&(r=y.length-1,0>(n=t-1)&&(n=r),(i=t+1)>r&&(i=0),!!(r=o(y[t],y[n],y[i],u[e])))}function n(e,t){var r;for(r=0;r--f){console.log('THREE.ShapeUtils: Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!');break}for(c=d;ce;e++)h=t[e].x+":"+t[e].y,void 0!==(h=s[h])&&(t[e]=h);return c.concat()},isClockWise:function(e){return 0>Ti.area(e)}};(Bt.prototype=Object.create(se.prototype)).constructor=Bt,(Ft.prototype=Object.create(_e.prototype)).constructor=Ft,Ft.prototype.getArrays=function(){var e=(e=this.getAttribute("position"))?Array.prototype.slice.call(e.array):[],t=(t=this.getAttribute("uv"))?Array.prototype.slice.call(t.array):[],r=this.index;return{position:e,uv:t,index:r=r?Array.prototype.slice.call(r.array):[]}},Ft.prototype.addShapeList=function(e,t){var r=e.length;t.arrays=this.getArrays();for(var n=0;nNumber.EPSILON){var u=Math.sqrt(c),h=Math.sqrt(a*a+s*s),c=t.x-o/u;if(t=t.y+i/u,s=((n.x-s/h-c)*s-(n.y+a/h-t)*a)/(i*s-o*a),a=c+i*s-e.x,i=t+o*s-e.y,2>=(o=a*a+i*i))return new r(a,i);o=Math.sqrt(o/2)}else e=!1,i>Number.EPSILON?a>Number.EPSILON&&(e=!0):i<-Number.EPSILON?a<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(s)&&(e=!0),e?(a=-o,o=Math.sqrt(c)):(a=i,i=o,o=Math.sqrt(c/2));return new r(a/o,i/o)}function a(e,t){for($=e.length;0<=--$;){var r=$,n=$-1;0>n&&(n=e.length-1);var i,o=x+2*y;for(i=0;iMath.abs(s-u)?[new r(e,1-n),new r(c,1-i),new r(h,1-o),new r(p,1-t)]:[new r(s,1-n),new r(u,1-i),new r(l,1-o),new r(d,1-t)]}},(Ut.prototype=Object.create(se.prototype)).constructor=Ut,($t.prototype=Object.create(Ft.prototype)).constructor=$t,(zt.prototype=Object.create(se.prototype)).constructor=zt,(Gt.prototype=Object.create(_e.prototype)).constructor=Gt,(Vt.prototype=Object.create(se.prototype)).constructor=Vt,(Ht.prototype=Object.create(_e.prototype)).constructor=Ht,(qt.prototype=Object.create(se.prototype)).constructor=qt,(Wt.prototype=Object.create(_e.prototype)).constructor=Wt,(Xt.prototype=Object.create(se.prototype)).constructor=Xt,(Yt.prototype=Object.create(_e.prototype)).constructor=Yt,(Kt.prototype=Object.create(_e.prototype)).constructor=Kt,(Zt.prototype=Object.create(se.prototype)).constructor=Zt,(Jt.prototype=Object.create(_e.prototype)).constructor=Jt,(Qt.prototype=Object.create(Zt.prototype)).constructor=Qt,(er.prototype=Object.create(Jt.prototype)).constructor=er,(tr.prototype=Object.create(se.prototype)).constructor=tr,(rr.prototype=Object.create(_e.prototype)).constructor=rr;var Oi=Object.freeze({WireframeGeometry:bt,ParametricGeometry:_t,ParametricBufferGeometry:xt,TetrahedronGeometry:Mt,TetrahedronBufferGeometry:Et,OctahedronGeometry:Ct,OctahedronBufferGeometry:Tt,IcosahedronGeometry:Ot,IcosahedronBufferGeometry:Pt,DodecahedronGeometry:jt,DodecahedronBufferGeometry:At,PolyhedronGeometry:wt,PolyhedronBufferGeometry:St,TubeGeometry:Rt,TubeBufferGeometry:Lt,TorusKnotGeometry:Nt,TorusKnotBufferGeometry:It,TorusGeometry:Dt,TorusBufferGeometry:kt,TextGeometry:Ut,TextBufferGeometry:$t,SphereGeometry:zt,SphereBufferGeometry:Gt,RingGeometry:Vt,RingBufferGeometry:Ht,PlaneGeometry:Se,PlaneBufferGeometry:Me,LatheGeometry:qt,LatheBufferGeometry:Wt,ShapeGeometry:Xt,ShapeBufferGeometry:Yt,ExtrudeGeometry:Bt,ExtrudeBufferGeometry:Ft,EdgesGeometry:Kt,ConeGeometry:Qt,ConeBufferGeometry:er,CylinderGeometry:Zt,CylinderBufferGeometry:Jt,CircleGeometry:tr,CircleBufferGeometry:rr,BoxGeometry:xe,BoxBufferGeometry:we});(nr.prototype=Object.create(W.prototype)).constructor=nr,nr.prototype.isShadowMaterial=!0,(ir.prototype=Object.create(Ce.prototype)).constructor=ir,ir.prototype.isRawShaderMaterial=!0,(or.prototype=Object.create(W.prototype)).constructor=or,or.prototype.isMeshStandardMaterial=!0,or.prototype.copy=function(e){return W.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.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},(ar.prototype=Object.create(or.prototype)).constructor=ar,ar.prototype.isMeshPhysicalMaterial=!0,ar.prototype.copy=function(e){return or.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},(sr.prototype=Object.create(W.prototype)).constructor=sr,sr.prototype.isMeshPhongMaterial=!0,sr.prototype.copy=function(e){return W.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.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},(cr.prototype=Object.create(sr.prototype)).constructor=cr,cr.prototype.isMeshToonMaterial=!0,cr.prototype.copy=function(e){return sr.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},(ur.prototype=Object.create(W.prototype)).constructor=ur,ur.prototype.isMeshNormalMaterial=!0,ur.prototype.copy=function(e){return W.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,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},(hr.prototype=Object.create(W.prototype)).constructor=hr,hr.prototype.isMeshLambertMaterial=!0,hr.prototype.copy=function(e){return W.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},(lr.prototype=Object.create(ut.prototype)).constructor=lr,lr.prototype.isLineDashedMaterial=!0,lr.prototype.copy=function(e){return ut.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Pi=Object.freeze({ShadowMaterial:nr,SpriteMaterial:nt,RawShaderMaterial:ir,ShaderMaterial:Ce,PointsMaterial:dt,MeshPhysicalMaterial:ar,MeshStandardMaterial:or,MeshPhongMaterial:sr,MeshToonMaterial:cr,MeshNormalMaterial:ur,MeshLambertMaterial:hr,MeshDepthMaterial:X,MeshDistanceMaterial:Y,MeshBasicMaterial:Ee,LineDashedMaterial:lr,LineBasicMaterial:ut,Material:W}),ji={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={}}},Ai=new pr,Ri={};Object.assign(dr.prototype,{load:function(e,t,r,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,o=ji.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout(function(){t&&t(o),i.manager.itemEnd(e)},0),o;if(void 0===Ri[e]){if(s=e.match(/^data:(.*?)(;base64)?,(.*)$/)){r=s[1];var a=!!s[2],s=s[3],s=window.decodeURIComponent(s);a&&(s=window.atob(s));try{var c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":for(var u=new Uint8Array(s.length),a=0;a=i)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>=i)break t}n=r,r=0}for(;r>>1,et;)--o;return++o,0===i&&o===n||(i>=o&&(o=Math.max(o,1),i=o-1),e=this.getValueSize(),this.times=Li.arraySlice(r,i,o),this.values=Li.arraySlice(this.values,i*e,o*e)),this},validate:function(){var e=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),e=!1);var t=this.times,r=this.values,n=t.length;0===n&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),e=!1);for(var i=null,o=0;o!==n;o++){var a=t[o];if("number"==typeof a&&isNaN(a)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,o,a),e=!1;break}if(null!==i&&i>a){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,o,a,i),e=!1;break}i=a}if(void 0!==r&&Li.isTypedArray(r))for(o=0,t=r.length;o!==t;++o)if(n=r[o],isNaN(n)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,o,n),e=!1;break}return e},optimize:function(){for(var e,t,r=this.times,n=this.values,i=this.getValueSize(),o=2302===this.getInterpolation(),a=1,s=r.length-1,c=1;ch.opacity&&(h.transparent=!0),n.setTextures(u),n.parse(h)}}()}),Object.assign(qr.prototype,{load:function(e,t,r,n){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Hr.prototype.extractUrlBase(e),a=new dr(this.manager);a.setWithCredentials(this.withCredentials),a.load(e,function(r){var n=(r=JSON.parse(r)).metadata;if(void 0!==n&&void 0!==(n=n.type)){if("object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}r=i.parse(r,o),t(r.geometry,r.materials)},r,n)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==e.data&&(e=e.data),e.scale=void 0!==e.scale?1/e.scale:1;var n,i,a,s=new se,u=e,h=u.faces,l=u.vertices,p=u.normals,d=u.colors,f=u.scale,m=0;if(void 0!==u.uvs){for(n=0;ni;i++){var S=h[v++],M=w[2*S];M=new r(M,S=w[2*S+1]),2!==i&&s.faceVertexUvs[n][y].push(M),0!==i&&s.faceVertexUvs[n][y+1].push(M)}}if(b&&(b=3*h[v++],g.normal.set(p[b++],p[b++],p[b]),x.normal.copy(g.normal)),_)for(n=0;4>n;n++)b=3*h[v++],_=new o(p[b++],p[b++],p[b]),2!==n&&g.vertexNormals.push(_),0!==n&&x.vertexNormals.push(_);if(f&&(f=h[v++],f=d[f],g.color.setHex(f),x.color.setHex(f)),l)for(n=0;4>n;n++)f=h[v++],f=d[f],2!==n&&g.vertexColors.push(new z(f)),0!==n&&x.vertexColors.push(new z(f));s.faces.push(g),s.faces.push(x)}else{if(g=new ae,g.a=h[v++],g.b=h[v++],g.c=h[v++],y&&(y=h[v++],g.materialIndex=y),y=s.faces.length,n)for(n=0;ni;i++)S=h[v++],M=w[2*S],S=w[2*S+1],M=new r(M,S),s.faceVertexUvs[n][y].push(M);if(b&&(b=3*h[v++],g.normal.set(p[b++],p[b++],p[b])),_)for(n=0;3>n;n++)b=3*h[v++],_=new o(p[b++],p[b++],p[b]),g.vertexNormals.push(_);if(f&&(f=h[v++],g.color.setHex(d[f])),l)for(n=0;3>n;n++)f=h[v++],g.vertexColors.push(new z(d[f]));s.faces.push(g)}}if(u=e,v=void 0!==u.influencesPerVertex?u.influencesPerVertex:2,u.skinWeights)for(a=0,h=u.skinWeights.length;a(i=r[e]-t))o=e+1;else{if(!(0t&&(t=0),1Number.EPSILON&&(u.normalize(),i=Math.acos(ci.clamp(a[r-1].dot(a[r]),-1,1)),s[r].applyMatrix4(h.makeRotationAxis(u,i))),c[r].crossVectors(a[r],s[r]);if(!0===t)for(i=Math.acos(ci.clamp(s[0].dot(s[e]),-1,1)),i/=e,0=t)return t=r[e]-t,e=this.curves[e],r=e.getLength(),e.getPointAt(0===r?0:1-t/r);e++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,n=this.curves.length;ri;)i+=n;for(;i>n;)i-=n;is.length-2?s.length-1:e+1],s=s[e>s.length-3?s.length-1:e+2];return t.set(Xr(n,i.x,o.x,a.x,s.x),Xr(n,i.y,o.y,a.y,s.y)),t},tn.prototype.copy=function(e){Zr.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;tNumber.EPSILON){if(0>u&&(a=t[o],c=-c,s=t[i],u=-u),!(e.ys.y))if(e.y===a.y){if(e.x===a.x)return!0}else{if(0==(i=u*(e.x-a.x)-c*(e.y-a.y)))return!0;0>i||(n=!n)}}else if(e.y===a.y&&(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x))return!0}return n}var i=Ti.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return r(o);if(t=[],1===o.length){var a=o[0],s=new an;return s.curves=a.curves,t.push(s),t}var c=!i(o[0].getPoints()),c=e?!c:c;s=[];var u=[],h=[],l=0;u[l]=void 0,h[l]=[];for(var p=0,d=o.length;pn&&this._mixBufferRegion(r,e,3*t,1-n,t);for(var n=t,o=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){i.slerpFlat(e,t,e,t,e,r,n)},_lerp:function(e,t,r,n,i){for(var o=1-n,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[r+a]*n}}}),Object.assign(yn.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(bn,{Composite:yn,create:function(e,t,r){return e&&e.isAnimationObjectGroup?new bn.Composite(e,t,r):new bn(e,t,r)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var e=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),t=["material","materials","bones"];return function(r){n=e.exec(r);if(!n)throw Error("PropertyBinding: Cannot parse trackName: "+r);var n,i=(n={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]}).nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var o=n.nodeName.substring(i+1);-1!==t.indexOf(o)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+r);return n}}(),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=function(e){for(var r=0;r=t){var h=t++,l=e[h];for(r[l.uuid]=u,e[u]=l,r[c]=h,e[h]=s,s=0,c=i;s!==c;++s){var p=(l=n[s])[u];l[u]=l[h],l[h]=p}}}this.nCachedObjects_=t},uncache:function(){for(var e,t,r=this._objects,n=r.length,i=this.nCachedObjects_,o=this._indicesByUUID,a=this._bindings,s=a.length,c=0,u=arguments.length;c!==u;++c){var h=o[t=arguments[c].uuid];if(void 0!==h)if(delete o[t],h(t=(e-i)*r)||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;for(var i=this._propertyBindings,o=0,a=t.length;o!==a;++o)t[o].evaluate(r),i[o].accumulate(n,e)}}else this._updateWeight(e)},_updateWeight:function(e){t=0;if(this.enabled){var t=this.weight,r=this._weightInterpolant;if(null!==r){var n=r.evaluate(e)[0],t=t*n;e>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){t=0;if(!this.paused){var t=this.timeScale,r=this._timeScaleInterpolant;if(null!==r){t=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){o=this.time+e;if(0===e)return o;var t=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r)e:{if(-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1)),o>=t)o=t;else{if(!(0>o))break e;o=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1})}else{if(r=2202===r,-1===n&&(0<=e?(n=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),o>=t||0>o){var i=Math.floor(o/t),o=o-t*i,n=n+Math.abs(i),a=this.repetitions-n;0>a?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,o=0e,this._setEndings(e,!e,r)):this._setEndings(!1,!1,r),this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i}))}if(r&&1==(1&n))return this.time=o,t-o}return this.time=o},_setEndings:function(e,t,r){var n=this._interpolantSettings;r?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,r){var n=this._mixer,i=n.time,o=this._weightInterpolant;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}}),Object.assign(wn.prototype,t.prototype,{_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,i=n.length,o=e._propertyBindings;e=e._interpolants;var a=r.uuid,s=this._bindingsByRootAndName,c=s[a];for(void 0===c&&(c={},s[a]=c),s=0;s!==i;++s){var u=n[s],h=u.name,l=c[h];if(void 0===l){if(void 0!==(l=o[s])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,h));continue}++(l=new gn(bn.create(r,h,t&&t._propertyBindings[s].binding.parsedPath),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(l,a,h)}o[s]=l,e[s].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)&&eMath.abs(t)&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.lookAt(this.plane.normal),ne.prototype.updateMatrixWorld.call(this,e)};var zi,Gi;(Zn.prototype=Object.create(ne.prototype)).constructor=Zn,Zn.prototype.setDirection=function(){var e,t=new o;return function(r){.99999r.y?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),Zn.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()},Zn.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},(Jn.prototype=Object.create(lt.prototype)).constructor=Jn;var Vi=new o,Hi=new Qn,qi=new Qn,Wi=new Qn;(ei.prototype=Object.create(Zr.prototype)).constructor=ei,ei.prototype.isCatmullRomCurve3=!0,ei.prototype.getPoint=function(e,t){t=t||new o;var r=this.points;e*=(c=r.length)-(this.closed?0:1);if(e-=u=Math.floor(e),this.closed?u+=0u&&(u=1),1e-4>c&&(c=u),1e-4>s&&(s=u),Hi.initNonuniformCatmullRom(n.x,i.x,a.x,r.x,c,u,s),qi.initNonuniformCatmullRom(n.y,i.y,a.y,r.y,c,u,s),Wi.initNonuniformCatmullRom(n.z,i.z,a.z,r.z,c,u,s)}else"catmullrom"===this.curveType&&(Hi.initCatmullRom(n.x,i.x,a.x,r.x,this.tension),qi.initCatmullRom(n.y,i.y,a.y,r.y,this.tension),Wi.initCatmullRom(n.z,i.z,a.z,r.z,this.tension));return t.set(Hi.calc(e),qi.calc(e),Wi.calc(e)),t},ei.prototype.copy=function(e){Zr.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;tt?1:0},this.length>0)for(var r=this.length>>1;r>=0;r--)this._down(r)}t.exports=n,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--,this.length>0&&(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];e>0;){var i=e-1>>1,o=t[i];if(r(n,o)>=0)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=0)break;t[e]=c,e=a}t[e]=o}}},{}],243:[function(e,t,r){(function(){function e(e){return function(t,r,n,i){r=x(r,i,4);var o=!O(t)&&_.keys(t),a=(o||t).length,s=e>0?0:a-1;return arguments.length<3&&(n=t[o?o[s]:s],s+=e),function(t,r,n,i,o,a){for(;o>=0&&o0?0:i-1;o>=0&&o0?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=t(p.call(n,a,s),_.isNaN))>=0?o+a:-1;for(o=e>0?a:s-1;o>=0&&o=0&&t<=C};_.each=_.forEach=function(e,t,r){t=x(t,r);var n,i;if(O(e))for(n=0,i=e.length;n=0},_.invoke=function(e,t){var r=p.call(arguments,2),n=_.isFunction(t);return _.map(e,function(e){var i=n?t:e[t];return null==i?i:i.apply(e,r)})},_.pluck=function(e,t){return _.map(e,_.property(t))},_.where=function(e,t){return _.filter(e,_.matcher(t))},_.findWhere=function(e,t){return _.find(e,_.matcher(t))},_.max=function(e,t,r){var n,i,o=-1/0,a=-1/0;if(null==t&&null!=e)for(var s=0,c=(e=O(e)?e:_.values(e)).length;so&&(o=n);else t=w(t,r),_.each(e,function(e,r,n){((i=t(e,r,n))>a||i===-1/0&&o===-1/0)&&(o=e,a=i)});return o},_.min=function(e,t,r){var n,i,o=1/0,a=1/0;if(null==t&&null!=e)for(var s=0,c=(e=O(e)?e:_.values(e)).length;sn||void 0===r)return 1;if(rt?(a&&(clearTimeout(a),a=null),s=u,o=e.apply(n,i),a||(n=i=null)):a||!1===r.trailing||(a=setTimeout(c,h)),o}},_.debounce=function(e,t,r){var n,i,o,a,s,c=function(){var u=_.now()-a;u=0?n=setTimeout(c,t-u):(n=null,r||(s=e.apply(o,i),n||(o=i=null)))};return function(){o=this,i=arguments,a=_.now();var u=r&&!n;return n||(n=setTimeout(c,t)),u&&(s=e.apply(o,i),o=i=null),s}},_.wrap=function(e,t){return _.partial(t,e)},_.negate=function(e){return function(){return!e.apply(this,arguments)}},_.compose=function(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}},_.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},_.before=function(e,t){var r;return function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=null),r}},_.once=_.partial(_.before,2);var R=!{toString:null}.propertyIsEnumerable("toString"),L=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];_.keys=function(e){if(!_.isObject(e))return[];if(v)return v(e);var t=[];for(var r in e)_.has(e,r)&&t.push(r);return R&&o(e,t),t},_.allKeys=function(e){if(!_.isObject(e))return[];var t=[];for(var r in e)t.push(r);return R&&o(e,t),t},_.values=function(e){for(var t=_.keys(e),r=t.length,n=Array(r),i=0;i":">",'"':""","'":"'","`":"`"},D=_.invert(I),k=function(e){var t=function(t){return e[t]},r="(?:"+_.keys(e).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,t):e}};_.escape=k(I),_.unescape=k(D),_.result=function(e,t,r){var n=null==e?void 0:e[t];return void 0===n&&(n=r),_.isFunction(n)?n.call(e):n};var B=0;_.uniqueId=function(e){var t=++B+"";return e?e+t:t},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var F=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},$=/\\|'|\r|\n|\u2028|\u2029/g,z=function(e){return"\\"+U[e]};_.template=function(e,t,r){!t&&r&&(t=r),t=_.defaults({},t,_.templateSettings);var n=RegExp([(t.escape||F).source,(t.interpolate||F).source,(t.evaluate||F).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(n,function(t,r,n,a,s){return o+=e.slice(i,s).replace($,z),i=s+t.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.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(t.variable||"obj","_",o)}catch(e){throw e.source=o,e}var s=function(e){return a.call(this,e,_)},c=t.variable||"obj";return s.source="function("+c+"){\n"+o+"}",s},_.chain=function(e){var t=_(e);return t._chain=!0,t};var G=function(e,t){return e._chain?_(t).chain():t};_.mixin=function(e){_.each(_.functions(e),function(t){var r=_[t]=e[t];_.prototype[t]=function(){var e=[this._wrapped];return l.apply(e,arguments),G(this,r.apply(_,e))}})},_.mixin(_),_.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=c[e];_.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==e&&"splice"!==e||0!==r.length||delete r[0],G(this,r)}}),_.each(["concat","join","slice"],function(e){var t=c[e];_.prototype[e]=function(){return G(this,t.apply(this._wrapped,arguments))}}),_.prototype.value=function(){return this._wrapped},_.prototype.valueOf=_.prototype.toJSON=_.prototype.value,_.prototype.toString=function(){return""+this._wrapped}}).call(this)},{}],244:[function(e,t,r){var n=e("./vdom/create-element.js");t.exports=n},{"./vdom/create-element.js":250}],245:[function(e,t,r){var n=e("./vtree/diff.js");t.exports=n},{"./vtree/diff.js":270}],246:[function(e,t,r){var n=e("./virtual-hyperscript/index.js");t.exports=n},{"./virtual-hyperscript/index.js":257}],247:[function(e,t,r){var n=e("./diff.js"),i=e("./patch.js"),o=e("./h.js"),a=e("./create-element.js"),s=e("./vnode/vnode.js"),c=e("./vnode/vtext.js");t.exports={diff:n,patch:i,h:o,create:a,VNode:s,VText:c}},{"./create-element.js":244,"./diff.js":245,"./h.js":246,"./patch.js":248,"./vnode/vnode.js":266,"./vnode/vtext.js":268}],248:[function(e,t,r){var n=e("./vdom/patch.js");t.exports=n},{"./vdom/patch.js":253}],249:[function(e,t,r){function n(e,t,r){for(var n in t){var c=t[n];void 0===c?i(e,n,c,r):s(c)?(i(e,n,c,r),c.hook&&c.hook(e,n,r?r[n]:void 0)):a(c)?function(e,t,r,n,i){var s=r?r[n]:void 0;if("attributes"===n){for(var c in i){var u=i[c];void 0===u?e.removeAttribute(c):e.setAttribute(c,u)}return}if(s&&a(s)&&o(s)!==o(i))return void(e[n]=i);a(e[n])||(e[n]={});var h="style"===n?"":void 0;for(var l in i){var p=i[l];e[n][l]=void 0===p?h:p}}(e,0,r,n,c):e[n]=c}}function i(e,t,r,n){if(n){var i=n[t];if(s(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 a in i)e.style[a]="";else e[t]="string"==typeof i?"":null}}function o(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}var a=e("is-object"),s=e("../vnode/is-vhook.js");t.exports=n},{"../vnode/is-vhook.js":261,"is-object":20}],250:[function(e,t,r){function n(e,t){var r=t?t.document||i:i,h=t?t.warn:null;if(e=u(e).a,c(e))return e.init();if(s(e))return r.createTextNode(e.text);if(!a(e))return h&&h("Item is not a valid virtual dom node",e),null;var l=null===e.namespace?r.createElement(e.tagName):r.createElementNS(e.namespace,e.tagName),p=e.properties;o(l,p);for(var d=e.children,f=0;f>0,i=e[n],o===a)return i>=t&&i<=r;if(ir))return!0;a=n-1}}return!1}function o(e,t){return e>t?1:-1}var a={};t.exports=function(e,t,r,i){return r&&0!==r.length?(r.sort(o),n(e,t,r,i,0)):{}}},{}],252:[function(e,t,r){function n(e,t,r){var n=e.type,a=e.vNode,u=e.patch;switch(n){case s.REMOVE:return function(e,t){var r=e.parentNode;r&&r.removeChild(e);return i(e,t),null}(t,a);case s.INSERT:return function(e,t,r){var n=r.render(t,r);e&&e.appendChild(n);return e}(t,u,r);case s.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,u,r);case s.WIDGET:return function(e,t,r,n){var o,a=c(t,r);o=a?r.update(t,e)||e:n.render(r,n);var s=e.parentNode;s&&o!==e&&s.replaceChild(o,e);a||i(e,t);return o}(t,a,u,r);case s.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,u,r);case s.ORDER:return function(e,t){for(var r,n,i,o=e.childNodes,a={},s=0;s=c++?null:o[i.to])}(t,u),t;case s.PROPS:return o(t,u,a.properties),t;case s.THUNK:return function(e,t){e&&t&&e!==t&&e.parentNode&&e.parentNode.replaceChild(t,e);return t}(t,r.patch(t,u,r));default:return t}}function i(e,t){"function"==typeof t.destroy&&a(t)&&t.destroy(e)}var o=e("./apply-properties"),a=e("../vnode/is-widget.js"),s=e("../vnode/vpatch.js"),c=e("./update-widget");t.exports=n},{"../vnode/is-widget.js":264,"../vnode/vpatch.js":267,"./apply-properties":249,"./update-widget":254}],253:[function(e,t,r){function n(e,t,r){return r=r||{},r.patch=r.patch&&r.patch!==n?r.patch:function(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 a=s(e,t.a,n),u=e.ownerDocument;r.document||u===i||(r.document=u);for(var h=0;h=i.length?t.length:i[c],g=0;g=v&&s.push(y)}for(var b,_=s.slice(),x=0,w=[],S=[],M=0;Mm?p:m,g=0;g>>0,s=a,c=[],u=0;u0){o.become(r),e._visitRemaining(t,u,r);break}r.visit(o,function(e){c=null,this.resolve(e)},function(e){this.resolved||(c.push(e),0==--s&&this.reject(c))})}else--s;return 0===s&&o.reject(new RangeError("any(): array must not be empty")),i},e.some=function(t,r){var n,i,o,a=e._defer(),s=a._handler,c=[],u=[],h=t.length>>>0,l=0;for(o=0;o(l=Math.min(r,l))?s.reject(new RangeError("some(): array must contain at least "+r+" item(s), but had "+l)):0===l&&s.resolve(c),o=0;o2?u.call(e,o(t),arguments[2]):u.call(e,o(t))},e.reduceRight=function(e,t){return arguments.length>2?h.call(e,o(t),arguments[2]):h.call(e,o(t))},e.prototype.spread=function(e){return this.then(c).then(function(t){return e.apply(this,t)})},e}})}(function(r){t.exports=r(e)})},{"../apply":274,"../state":287}],276:[function(e,t,r){!function(e){"use strict";e(function(){function e(){throw new TypeError("catch predicate must be a function")}function t(e,t){return function(e){return e===Error||null!=e&&e.prototype instanceof Error}(t)?e instanceof t:t(e)}function r(e){return e}return function(n){function i(e,t,r,n){var i=e.call(t);return function(e){return("object"==typeof e||"function"==typeof e)&&null!==e}(i)?function(e,t,r){return o(e).then(function(){return t(r)})}(i,r,n):r(n)}var o=n.resolve,a=n.reject,s=n.prototype.catch;return n.prototype.done=function(e,t){this._handler.visit(this._handler.receiver,e,t)},n.prototype.catch=n.prototype.otherwise=function(r){return arguments.length<2?s.call(this,r):"function"!=typeof r?this.ensure(e):s.call(this,function(e,r){return function(n){return t(n,r)?e.call(this,n):a(n)}}(arguments[1],r))},n.prototype.finally=n.prototype.ensure=function(e){return"function"!=typeof e?this:this.then(function(t){return i(e,this,r,t)},function(t){return i(e,this,a,t)})},n.prototype.else=n.prototype.orElse=function(e){return this.then(void 0,function(){return e})},n.prototype.yield=function(e){return this.then(function(){return e})},n.prototype.tap=function(e){return this.then(e).yield(this)},n}})}(function(e){t.exports=e()})},{}],277:[function(e,t,r){!function(e){"use strict";e(function(){return function(e){return e.prototype.fold=function(t,r){var n=this._beget();return this._handler.fold(function(r,n,i){e._handler(r).fold(function(e,r,n){n.resolve(t.call(this,r,e))},n,this,i)},r,n._handler.receiver,n._handler),n},e}})}(function(e){t.exports=e()})},{}],278:[function(e,t,r){!function(e){"use strict";e(function(e){var t=e("../state").inspect;return function(e){return e.prototype.inspect=function(){return t(e._handler(this))},e}})}(function(r){t.exports=r(e)})},{"../state":287}],279:[function(e,t,r){!function(e){"use strict";e(function(){return function(e){function t(e,n,i,o){function a(o,a){return r(i(o)).then(function(){return t(e,n,i,a)})}return r(o).then(function(t){return r(n(t)).then(function(n){return n?t:r(e(t)).spread(a)})})}var r=e.resolve;return e.iterate=function(e,r,n,i){return t(function(t){return[t,e(t)]},r,n,i)},e.unfold=t,e}})}(function(e){t.exports=e()})},{}],280:[function(e,t,r){!function(e){"use strict";e(function(){return function(e){return e.prototype.progress=function(e){return this.then(void 0,void 0,e)},e}})}(function(e){t.exports=e()})},{}],281:[function(e,t,r){!function(e){"use strict";e(function(e){function t(e,t,n,i){return r.setTimer(function(){e(n,i,t)},t)}var r=e("../env"),n=e("../TimeoutError");return function(e){function i(e,r,n){t(o,e,r,n)}function o(e,t){t.resolve(e)}function a(e,t,r){var i=void 0===e?new n("timed out after "+r+"ms"):e;t.reject(i)}return e.prototype.delay=function(e){var t=this._beget();return this._handler.fold(i,e,void 0,t._handler),t},e.prototype.timeout=function(e,n){var i=this._beget(),o=i._handler,s=t(a,e,n,i._handler);return this._handler.visit(o,function(e){r.clearTimer(s),this.resolve(e)},function(e){r.clearTimer(s),this.reject(e)},o.notify),i},e}})}(function(r){t.exports=r(e)})},{"../TimeoutError":273,"../env":284}],282:[function(e,t,r){!function(e){"use strict";e(function(e){function t(e){throw e}function r(){}var n=e("../env").setTimer,i=e("../format");return function(e){function o(e){e.handled||(d.push(e),h("Potentially unhandled rejection ["+e.id+"] "+i.formatError(e.value)))}function a(e){var t=d.indexOf(e);t>=0&&(d.splice(t,1),l("Handled previous rejection ["+e.id+"] "+i.formatObject(e.value)))}function s(e,t){p.push(e,t),null===f&&(f=n(c,0))}function c(){for(f=null;p.length>0;)p.shift()(p.shift())}var u,h=r,l=r;"undefined"!=typeof console&&(u=console,h=void 0!==u.error?function(e){u.error(e)}:function(e){u.log(e)},l=void 0!==u.info?function(e){u.info(e)}:function(e){u.log(e)}),e.onPotentiallyUnhandledRejection=function(e){s(o,e)},e.onPotentiallyUnhandledRejectionHandled=function(e){s(a,e)},e.onFatalRejection=function(e){s(t,e.value)};var p=[],d=[],f=null;return e}})}(function(r){t.exports=r(e)})},{"../env":284,"../format":285}],283:[function(e,t,r){!function(e){"use strict";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}})}(function(e){t.exports=e()})},{}],284:[function(e,t,r){(function(r){!function(e){"use strict";e(function(e){var t,n="undefined"!=typeof setTimeout&&setTimeout,i=function(e,t){return setTimeout(e,t)},o=function(e){return clearTimeout(e)},a=function(e){return n(e,0)};if(void 0!==r&&"[object process]"===Object.prototype.toString.call(r))a=function(e){return r.nextTick(e)};else if(t="undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver)a=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(!n){var s=e("vertx");i=function(e,t){return s.setTimer(t,e)},o=s.cancelTimer,a=s.runOnLoop||s.runOnContext}return{setTimer:i,clearTimer:o,asap:a}})}(function(r){t.exports=r(e)})}).call(this,e("_process"))},{_process:6}],285:[function(e,t,r){!function(e){"use strict";e(function(){function e(e){var r=String(e);return"[object Object]"===r&&"undefined"!=typeof JSON&&(r=t(e,r)),r}function t(e,t){try{return JSON.stringify(e)}catch(e){return t}}return{formatError:function(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)"},formatObject:e,tryStringify:t}})}(function(e){t.exports=e()})},{}],286:[function(e,t,r){(function(e){!function(t){"use strict";t(function(){return function(t){function r(e,t){this._handler=e===p?t:function(e){function t(e){r.reject(e)}var r=new f;try{e(function(e){r.resolve(e)},t,function(e){r.notify(e)})}catch(e){t(e)}return r}(e)}function n(e){return E(e)?e:new r(p,new m(h(e)))}function i(e){return new r(p,new m(new y(e)))}function o(){return F}function a(e,t,n){function i(e,t,r){h[e]=t,0==--u&&r.become(new g(h))}for(var o,a="function"==typeof t?function(r,o,a){a.resolved||s(n,i,r,e(t,o,r),a)}:i,c=new f,u=n.length>>>0,h=new Array(u),l=0;l0?t(r,o.value,i):(i.become(o),c(e,r+1,o))}else t(r,n,i)}function c(e,t,r){for(var n=t;n0||"function"!=typeof t&&i<0)return new this.constructor(p,n);var o=this._beget(),a=o._handler;return n.chain(a,n.receiver,e,t,r),o},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype._beget=function(){return function(e,t){return new t(p,new f(e.receiver,e.join().context))}(this._handler,this.constructor)},r.all=function(e){return a(A,null,e)},r.race=u,r._traverse=function(e,t){return a(P,e,t)},r._visitRemaining=c,p.prototype.when=p.prototype.become=p.prototype.notify=p.prototype.fail=p.prototype._unreport=p.prototype._report=R,p.prototype._state=0,p.prototype.state=function(){return this._state},p.prototype.join=function(){for(var e=this;void 0!==e.handler;)e=e.handler;return e},p.prototype.chain=function(e,t,r,n,i){this.when({resolver:e,receiver:t,fulfilled:r,rejected:n,progress:i})},p.prototype.visit=function(e,t,r,n){this.chain(k,e,t,r,n)},p.prototype.fold=function(e,t,r,n){this.when(new M(e,t,r,n))},j(p,d),d.prototype.become=function(e){e.fail()};var k=new d;j(p,f),f.prototype._state=0,f.prototype.resolve=function(e){this.become(h(e))},f.prototype.reject=function(e){this.resolved||this.become(new y(e))},f.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 y(new TypeError("Promise cycle"));return e},f.prototype.run=function(){var e=this.consumers,t=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var r=0;r0?r(e.value):t(e.value)}}})}(function(e){t.exports=e()})},{}],288:[function(e,t,r){!function(e){"use strict";e(function(e){function t(e,t,r,n){var i=m.resolve(e);return arguments.length<2?i:i.then(t,r,n)}function r(e){return function(){for(var t=0,r=arguments.length,n=new Array(r);t0?2*Math.atan(.5*n.basicWidth/(o*n.focal)):0;return[e._spatial.degToRad(r.ca),a]}).distinctUntilChanged(function(t,r){return Math.abs(r[0]-t[0])2*Math.PI-Math.PI/90)return i.h("circle",{attributes:{cx:"0",cy:"0",fill:r,r:"1"},namespace:this._svgNamespace},[]);var n=e-t/2-Math.PI/2,o=n+t,a=Math.cos(n),s=Math.sin(n),c=Math.cos(o),u=Math.sin(o),h="M 0 0 "+a+" "+s+" A 1 1 0 "+(t>=Math.PI?1:0)+" 1 "+c+" "+u;return i.h("path",{attributes:{d:h,fill:r},namespace:this._svgNamespace},[])},t.componentName="bearing",t}(a.Component);r.BearingComponent=c,a.ComponentService.register(c),r.default=c},{"../Component":291,"../Geo":294,"rxjs/Observable":29,"virtual-dom":247}],308:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable");e("rxjs/add/observable/combineLatest"),e("rxjs/add/observable/from"),e("rxjs/add/observable/merge"),e("rxjs/add/observable/of"),e("rxjs/add/observable/zip"),e("rxjs/add/operator/catch"),e("rxjs/add/operator/combineLatest"),e("rxjs/add/operator/distinct"),e("rxjs/add/operator/expand"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/mergeMap"),e("rxjs/add/operator/mergeAll"),e("rxjs/add/operator/skip"),e("rxjs/add/operator/switchMap");var o=e("../Edge"),a=e("../Component"),s=function(e){function t(t,r,n){return e.call(this,t,r,n)||this}return n(t,e),t.prototype.setDepth=function(e){this.configure({depth:e})},t.prototype._activate=function(){var e=this;this._sequenceSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$.switchMap(function(e){return e.sequenceEdges$}).filter(function(e){return e.cached}),this._configuration$).switchMap(function(t){var r=t[0],n=t[1],a=Math.max(0,Math.min(4,n.depth.sequence)),s=e._cache$(r.edges,o.EdgeDirection.Next,a),c=e._cache$(r.edges,o.EdgeDirection.Prev,a);return i.Observable.merge(s,c).catch(function(e,t){return console.error("Failed to cache sequence edges.",e),i.Observable.empty()})}).subscribe(function(){}),this._spatialSubscription=this._navigator.stateService.currentNode$.switchMap(function(e){return i.Observable.combineLatest(i.Observable.of(e),e.spatialEdges$.filter(function(e){return e.cached}))}).combineLatest(this._configuration$,function(e,t){return[e[0],e[1],t]}).switchMap(function(t){var r=t[0],n=t[1].edges,a=t[2].depth,s=Math.max(0,Math.min(2,a.pano)),c=r.pano?0:Math.max(0,Math.min(3,a.step)),u=r.pano?0:Math.max(0,Math.min(1,a.turn)),h=e._cache$(n,o.EdgeDirection.Pano,s),l=e._cache$(n,o.EdgeDirection.StepForward,c),p=e._cache$(n,o.EdgeDirection.StepBackward,c),d=e._cache$(n,o.EdgeDirection.StepLeft,c),f=e._cache$(n,o.EdgeDirection.StepRight,c),m=e._cache$(n,o.EdgeDirection.TurnLeft,u),v=e._cache$(n,o.EdgeDirection.TurnRight,u),g=e._cache$(n,o.EdgeDirection.TurnU,u);return i.Observable.merge(l,p,d,f,h,m,v,g).catch(function(e,t){return console.error("Failed to cache spatial edges.",e),i.Observable.empty()})}).subscribe(function(){})},t.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._spatialSubscription.unsubscribe()},t.prototype._getDefaultConfiguration=function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}},t.prototype._cache$=function(e,t,r){var n=this;return i.Observable.zip(i.Observable.of(e),i.Observable.of(r)).expand(function(e){var r=e[0],o=e[1],a=[];if(o>0)for(var s=0,c=r;s-1?e.sequenceEdges$:e.spatialEdges$).first(function(e){return e.cached}).map(function(e){return e.edges})},t.componentName="cache",t}(a.Component);r.CacheComponent=s,a.ComponentService.register(s),r.default=s},{"../Component":291,"../Edge":292,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/from":42,"rxjs/add/observable/merge":45,"rxjs/add/observable/of":46,"rxjs/add/observable/zip":49,"rxjs/add/operator/catch":54,"rxjs/add/operator/combineLatest":55,"rxjs/add/operator/distinct":59,"rxjs/add/operator/expand":62,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/merge":68,"rxjs/add/operator/mergeAll":69,"rxjs/add/operator/mergeMap":70,"rxjs/add/operator/skip":80,"rxjs/add/operator/switchMap":84}],309:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/BehaviorSubject"),o=e("rxjs/Subject");e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/startWith");var a=function(e){function t(t,r,n){var a=e.call(this)||this;return a._activated$=new i.BehaviorSubject(!1),a._configurationSubject$=new o.Subject,a._activated=!1,a._container=r,a._name=t,a._navigator=n,a._configuration$=a._configurationSubject$.startWith(a.defaultConfiguration).scan(function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}).publishReplay(1).refCount(),a._configuration$.subscribe(function(){}),a}return n(t,e),Object.defineProperty(t.prototype,"activated",{get:function(){return this._activated},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activated$",{get:function(){return this._activated$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"defaultConfiguration",{get:function(){return this._getDefaultConfiguration()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),t.prototype.activate=function(e){this._activated||(void 0!==e&&this._configurationSubject$.next(e),this._activated=!0,this._activate(),this._activated$.next(!0))},t.prototype.configure=function(e){this._configurationSubject$.next(e)},t.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))},t.prototype.resize=function(){},t.componentName="not_worthy",t}(e("../Utils").EventEmitter);r.Component=a,r.default=a},{"../Utils":301,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":74,"rxjs/add/operator/scan":78,"rxjs/add/operator/startWith":83}],310:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("underscore"),i=e("../Error"),o=function(){function e(t,r){this._components={};for(var i=0,o=n.values(e.registeredComponents);i0&&e.description?{name:t._name,vnode:t._getRouteAnnotationNode(e.description)}:{name:t._name,vnode:o.h("div",[])}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.unsubscribe(),this._disposableDescription.unsubscribe()},t.prototype._getDefaultConfiguration=function(){return{}},t.prototype.play=function(){this.configure({playing:!0})},t.prototype.stop=function(){this.configure({playing:!1})},t.prototype._getRouteAnnotationNode=function(e){return o.h("div.RouteFrame",{},[o.h("p",{textContent:e},[])])},t.componentName="route",t}(s.Component);r.RouteComponent=l,s.ComponentService.register(l),r.default=l},{"../Component":291,"rxjs/Observable":29,"rxjs/add/observable/fromPromise":44,"rxjs/add/observable/of":46,"rxjs/add/operator/combineLatest":55,"rxjs/add/operator/distinct":59,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/mergeMap":70,"rxjs/add/operator/pluck":72,"rxjs/add/operator/scan":78,underscore:243,"virtual-dom":247}],317:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable");e("rxjs/add/operator/buffer"),e("rxjs/add/operator/debounceTime"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/scan");var o=e("../Component"),a=function(e){function t(t,r,n){return e.call(this,t,r,n)||this}return n(t,e),t.prototype._activate=function(){var e=this;this._sequenceSubscription=this._navigator.stateService.currentNode$.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:{}}).filter(function(e){return e.report.length>0}).mergeMap(function(t){return e._navigator.apiV3.sequenceViewAdd$(t.report).catch(function(e,r){return console.error("Failed to report sequence stats ("+t.report+")",e),i.Observable.empty()})}).subscribe(function(){}),this._imageSubscription=this._navigator.stateService.currentNode$.map(function(e){return e.key}).buffer(this._navigator.stateService.currentNode$.debounceTime(5e3)).scan(function(e,t){e.report=[];for(var r=0,n=t;r0}).mergeMap(function(t){return e._navigator.apiV3.imageViewAdd$(t.report).catch(function(e,r){return console.error("Failed to report image stats ("+t.report+")",e),i.Observable.empty()})}).subscribe(function(){})},t.prototype._deactivate=function(){this._sequenceSubscription.unsubscribe(),this._imageSubscription.unsubscribe()},t.prototype._getDefaultConfiguration=function(){return{}},t.componentName="stats",t}(o.Component);r.StatsComponent=a,o.ComponentService.register(a),r.default=a},{"../Component":291,"rxjs/Observable":29,"rxjs/add/operator/buffer":51,"rxjs/add/operator/debounceTime":57,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/scan":78}],318:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("virtual-dom"),o=e("rxjs/Observable"),a=e("rxjs/Subject");e("rxjs/add/observable/combineLatest"),e("rxjs/add/operator/do"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/share");var s=e("../../Component"),c=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._renderer=i||new s.DirectionDOMRenderer(o.defaultConfiguration,r.element),o._hoveredKeySubject$=new a.Subject,o._hoveredKey$=o._hoveredKeySubject$.share(),o}return n(t,e),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 e=this;this._configurationSubscription=this._configuration$.subscribe(function(t){e._renderer.setConfiguration(t)}),this._nodeSubscription=this._navigator.stateService.currentNode$.do(function(t){e._container.domRenderer.render$.next({name:e._name,vnode:i.h("div",{},[])}),e._renderer.setNode(t)}).withLatestFrom(this._configuration$).switchMap(function(t){var r=t[0],n=t[1];return o.Observable.combineLatest(r.spatialEdges$,n.distinguishSequence?e._navigator.graphService.cacheSequence$(r.sequenceKey).catch(function(e,t){return console.error("Failed to cache sequence ("+r.sequenceKey+")",e),o.Observable.of(null)}):o.Observable.of(null))}).subscribe(function(t){var r=t[0],n=t[1];e._renderer.setEdges(r,n)}),this._renderCameraSubscription=this._container.renderService.renderCameraFrame$.do(function(t){e._renderer.setRenderCamera(t)}).map(function(t){return e._renderer}).filter(function(e){return e.needsRender}).map(function(t){return{name:e._name,vnode:t.render(e._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(e,t,r,n){return e}).map(function(e){for(var t=e.getElementsByClassName("DirectionsPerspective"),r=0;rt?e:t},e}();r.DirectionDOMCalculator=i,r.default=i},{"../../Geo":294}],320:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("virtual-dom"),i=e("../../Component"),o=e("../../Edge"),a=e("../../Error"),s=e("../../Geo"),c=function(){function e(e,t){this._isEdge=!1,this._spatial=new s.Spatial,this._calculator=new i.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=[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(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)-1?this._stepEdges.push(c):this._turnDirections.indexOf(i)>-1?this._turnEdges.push(c):c.data.direction===o.EdgeDirection.Pano&&this._panoEdges.push(c)}if(this._distinguishSequence&&null!=t)for(var a=0,s=this._panoEdges.concat(this._stepEdges).concat(this._turnEdges);a-1&&(u+="Sequence"),this._highlightKey===t&&(u+="Highlight");var h=n.h("div."+r,{},[]);return n.h("div."+u,c,[h])},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,i,o,a,s,c){var u=this._calculator.angleToCoordinates(t-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(t,r.phi),d=this._calculator.shadowOffset,f="drop-shadow("+-d*p[1]+"px "+d*p[0]+"px 1px rgba(0,0,0,0.8))",m={style:{"-webkit-filter":f,filter:f}},v=n.h("div."+o,m,[]),g=-this._spatial.radToDeg(t-r.phi),y=c?"translate("+h+"px, "+l+"px) rotate("+g+"deg) translateZ(-0.01px)":"translate("+h+"px, "+l+"px) rotate("+g+"deg)",b={attributes:{"data-key":e},onclick:s,style:{height:this._calculator.stepCircleSizeCss,marginLeft:this._calculator.stepCircleMarginCss,marginTop:this._calculator.stepCircleMarginCss,transform:y,width:this._calculator.stepCircleSizeCss}};return this._sequenceEdgeKeys.indexOf(e)>-1&&(a+="Sequence"),this._highlightKey===e&&(a+="Highlight"),n.h("div."+a,b,[v])},e.prototype._getContainer=function(e,t,r){var i=this._isEdge?"rotateX(60deg)":"perspective("+this._calculator.containerWidthCss+") rotateX(60deg)",o={oncontextmenu:function(e){e.preventDefault()},style:{bottom:this._calculator.containerBottomCss,height:this._calculator.containerHeightCss,left:this._calculator.containerLeftCss,marginLeft:this._calculator.containerMarginCss,transform:i,width:this._calculator.containerWidthCss}};return n.h("div.DirectionsPerspective",o,t.concat(e))},e}();r.DirectionDOMRenderer=c,r.default=c},{"../../Component":291,"../../Edge":292,"../../Error":293,"../../Geo":294,"virtual-dom":247}],321:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/operator/catch"),e("rxjs/add/operator/combineLatest"),e("rxjs/add/operator/debounceTime"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/pairwise"),e("rxjs/add/operator/publish"),e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/skipWhile"),e("rxjs/add/operator/startWith"),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/takeUntil"),e("rxjs/add/operator/withLatestFrom");var a=e("../../Component"),s=e("../../Render"),c=e("../../Tiles"),u=e("../../Utils"),h=function(e){function t(t,r,n){var i=e.call(this,t,r,n)||this;return i._imageTileLoader=new c.ImageTileLoader(u.Urls.tileScheme,u.Urls.tileDomain,u.Urls.origin),i._roiCalculator=new c.RegionOfInterestCalculator,i._rendererOperation$=new o.Subject,i._rendererCreator$=new o.Subject,i._rendererDisposer$=new o.Subject,i._renderer$=i._rendererOperation$.scan(function(e,t){return t(e)},null).filter(function(e){return null!=e}).distinctUntilChanged(void 0,function(e){return e.frameId}),i._rendererCreator$.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 a.ImagePlaneGLRenderer}}).subscribe(i._rendererOperation$),i._rendererDisposer$.map(function(){return function(e){return e.dispose(),null}}).subscribe(i._rendererOperation$),i}return n(t,e),t.prototype._activate=function(){var e=this;this._rendererSubscription=this._renderer$.map(function(t){var r={name:e._name,render:{frameId:t.frameId,needsRender:t.needsRender,render:t.render.bind(t),stage:s.GLRenderStage.Background}};return t.clearNeedsRender(),r}).subscribe(this._container.glRenderer.render$),this._rendererCreator$.next(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(e){return function(t){return t.updateFrame(e),t}}).subscribe(this._rendererOperation$);var t=this._navigator.stateService.currentState$.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}).combineLatest(this._configuration$).filter(function(e){return!0===e[1].imageTiling}).map(function(e){return e[0]}).withLatestFrom(this._container.glRenderer.webGLRenderer$,this._container.renderService.size$).map(function(t){var r=t[0],n=t[1],i=t[2],o=r.state,a=Math.max(i.width,i.height),s=o.currentNode,u=o.currentTransform,h=a>2048?2048:a>1024?1024:512;return new c.TextureProvider(s.key,u.basicWidth,u.basicHeight,h,s.image,e._imageTileLoader,new c.ImageTileStore,n)}).publishReplay(1).refCount();this._textureProviderSubscription=t.subscribe(function(){}),this._setTextureProviderSubscription=t.map(function(e){return function(t){return t.setTextureProvider(e.key,e),t}}).subscribe(this._rendererOperation$),this._setTileSizeSubscription=this._container.renderService.size$.switchMap(function(e){return i.Observable.combineLatest(t,i.Observable.of(e)).first()}).subscribe(function(e){var t=e[0],r=e[1],n=Math.max(r.width,r.height),i=n>2048?2048:n>1024?1024:512;t.setTileSize(i)}),this._abortTextureProviderSubscription=t.pairwise().subscribe(function(e){e[0].abort()});var r=i.Observable.combineLatest(this._container.renderService.renderCameraFrame$,this._container.renderService.size$.debounceTime(250)).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()]}).pairwise().skipWhile(function(e){return e[1][2]-e[0][2]<0||0===e[1][2]}).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}).distinctUntilChanged().filter(function(e){return e}).switchMap(function(t){return e._container.renderService.renderCameraFrame$.first()}).withLatestFrom(this._container.renderService.size$,this._navigator.stateService.currentTransform$);this._setRegionOfInterestSubscription=t.switchMap(function(t){return r.map(function(r){var n=r[0],i=r[1],o=r[2];return[e._roiCalculator.computeRegionOfInterest(n,i,o),t]})}).filter(function(e){return!e[1].disposed}).subscribe(function(e){var t=e[0];e[1].setRegionOfInterest(t)});var n=t.switchMap(function(e){return e.hasTexture$}).startWith(!1).publishReplay(1).refCount();this._hasTextureSubscription=n.subscribe(function(){});var o=this._navigator.stateService.currentState$.filter(function(e){return 0===e.state.nodesAhead}).map(function(e){return e.state.currentNode}).distinctUntilChanged(void 0,function(e){return e.key}).debounceTime(1e3).withLatestFrom(n).filter(function(e){return!e[1]}).map(function(e){return e[0]}).filter(function(e){return e.pano?u.Settings.maxImageSize>u.Settings.basePanoramaSize:u.Settings.maxImageSize>u.Settings.baseImageSize}).switchMap(function(e){var t=e.pano?u.Settings.basePanoramaSize:u.Settings.baseImageSize;if(Math.max(e.image.width,e.image.height)>t)return i.Observable.empty();return e.cacheImage$(u.Settings.maxImageSize).map(function(e){return[e.image,e]}).takeUntil(n.filter(function(e){return e})).catch(function(t,r){return console.error("Failed to fetch high res image ("+e.key+")",t),i.Observable.empty()})}).publish().refCount();this._updateBackgroundSubscription=o.withLatestFrom(t).subscribe(function(e){e[0][1].key!==e[1].key||e[1].disposed||e[1].updateBackground(e[0][0])}),this._updateTextureImageSubscription=o.map(function(e){return function(t){return t.updateTextureImage(e[0],e[1]),t}}).subscribe(this._rendererOperation$)},t.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()},t.prototype._getDefaultConfiguration=function(){return{imageTiling:!1}},t.componentName="imagePlane",t}(a.Component);r.ImagePlaneComponent=h,a.ComponentService.register(h),r.default=h},{"../../Component":291,"../../Render":297,"../../Tiles":300,"../../Utils":301,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/operator/catch":54,"rxjs/add/operator/combineLatest":55,"rxjs/add/operator/debounceTime":57,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/pairwise":71,"rxjs/add/operator/publish":73,"rxjs/add/operator/publishReplay":74,"rxjs/add/operator/scan":78,"rxjs/add/operator/skipWhile":82,"rxjs/add/operator/startWith":83,"rxjs/add/operator/switchMap":84,"rxjs/add/operator/takeUntil":86,"rxjs/add/operator/withLatestFrom":90}],322:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("../../Component"),o=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._createImageSphere=function(e,t){var r=this._createTexture(e.image),i=this._createSphereMaterialParameters(t,r),o=new n.ShaderMaterial(i);return this._useMesh(t,e)?new n.Mesh(this._getImageSphereGeo(t,e),o):new n.Mesh(this._getFlatImageSphereGeo(t),o)},e.prototype._createImagePlane=function(e,t){var r=this._createTexture(e.image),i=this._createPlaneMaterialParameters(t,r),o=new n.ShaderMaterial(i),a=this._useMesh(t,e)?this._getImagePlaneGeo(t,e):this._getFlatImagePlaneGeo(t);return new n.Mesh(a,o)},e.prototype._createSphereMaterialParameters=function(e,t){var r=e.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;return{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:e.rt},projectorTex:{type:"t",value:t},thetaLength:{type:"f",value:h},thetaShift:{type:"f",value:u}},vertexShader:i.ImagePlaneShaders.equirectangular.vertex}},e.prototype._createPlaneMaterialParameters=function(e,t){return{depthWrite:!1,fragmentShader:i.ImagePlaneShaders.perspective.fragment,side:n.DoubleSide,transparent:!0,uniforms:{bbox:{type:"v4",value:new n.Vector4(0,0,1,1)},opacity:{type:"f",value:1},projectorMat:{type:"m4",value:e.projectorMatrix()},projectorTex:{type:"t",value:t}},vertexShader:i.ImagePlaneShaders.perspective.vertex}},e.prototype._createTexture=function(e){var t=new n.Texture(e);return t.minFilter=n.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 n.Matrix4).getInverse(e.srt),i=5*e.scale,o=this._imageSphereRadius*e.scale,a=t.mesh.vertices,s=a.length/3,c=new Float32Array(a.length),u=0;u 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}"},e}();r.ImagePlaneShaders=n},{path:22}],326:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/combineLatest"),e("rxjs/add/observable/fromEvent"),e("rxjs/add/observable/of"),e("rxjs/add/observable/zip"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/mergeMap"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/withLatestFrom"),e("rxjs/add/operator/zip");var a=e("../../State"),s=e("../../Render"),c=e("../../Utils"),u=e("../../Component"),h=function(){function e(){this._imagePlaneFactory=new u.ImagePlaneFactory,this._imagePlaneScene=new u.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._curtain=1}return Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"curtain",{get:function(){return this._curtain},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"glNeedsRender",{get:function(){return this._glNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domNeedsRender",{get:function(){return this._domNeedsRender},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sliderVisible",{get:function(){return this._sliderVisible},set:function(e){this._sliderVisible=e,this._domNeedsRender=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return null==this._currentKey||null==this._previousKey||this._currentPano},enumerable:!0,configurable:!0}),e.prototype.update=function(e){this._updateFrameId(e.id);var t=this._updateImagePlanes(e.state);this._domNeedsRender=t||this._domNeedsRender,t=this._updateCurtain(e.state.alpha)||t,this._glNeedsRender=t||this._glNeedsRender},e.prototype.updateTexture=function(e,t){var r=t.key===this._currentKey?this._imagePlaneScene.imagePlanes:t.key===this._previousKey?this._imagePlaneScene.imagePlanesOld:[];if(0!==r.length){this._glNeedsRender=!0;for(var n=0,i=r;nc.Settings.basePanoramaSize:c.Settings.maxImageSize>c.Settings.baseImageSize}).mergeMap(function(e){var t=e.pano?c.Settings.basePanoramaSize:c.Settings.baseImageSize;return Math.max(e.image.width,e.image.height)>t?i.Observable.empty():e.cacheImage$(c.Settings.maxImageSize).map(function(e){return[e.image,e]}).catch(function(t,r){return console.error("Failed to fetch high res slider image ("+e.key+")",t),i.Observable.empty()})}).map(function(e){var t=e[0],r=e[1];return function(e){return e.updateTexture(t,r),e}}).subscribe(this._sliderStateOperation$)},t.prototype._deactivate=function(){var e=this;this._navigator.stateService.state$.first().subscribe(function(t){t===a.State.Waiting&&e._navigator.stateService.traverse()}),this._sliderStateDisposer$.next(null),this._setKeysSubscription.unsubscribe(),this._setSliderVisibleSubscription.unsubscribe(),this._stateSubscription.unsubscribe(),this._glRenderSubscription.unsubscribe(),this._domRenderSubscription.unsubscribe(),this._nodeSubscription.unsubscribe(),this.configure({keys:null}),this._sliderControl.removeEventListener("input",this._moveToHandler),this._sliderControl.removeEventListener("change",this._moveToHandler),this._container.element.removeChild(this._sliderContainer),this._moveToHandler=null,this._sliderControl=null,this._sliderWrapper=null,this._sliderContainer=null},t.prototype._getDefaultConfiguration=function(){return{}},t.prototype._catchCacheNode$=function(e){return this._navigator.graphService.cacheNode$(e).catch(function(t,r){return console.error("Failed to cache slider node ("+e+")",t),i.Observable.empty()})},t.componentName="slider",t}(u.Component);r.SliderComponent=l,u.ComponentService.register(l),r.default=l},{"../../Component":291,"../../Render":297,"../../State":298,"../../Utils":301,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/fromEvent":43,"rxjs/add/observable/of":46,"rxjs/add/observable/zip":49,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/filter":63,"rxjs/add/operator/first":65,"rxjs/add/operator/map":67,"rxjs/add/operator/merge":68,"rxjs/add/operator/mergeMap":70,"rxjs/add/operator/scan":78,"rxjs/add/operator/switchMap":84,"rxjs/add/operator/withLatestFrom":90,"rxjs/add/operator/zip":91}],327:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!function(e){e[e.Hidden=0]="Hidden",e[e.Loading=1]="Loading",e[e.Visible=2]="Visible"}(r.CoverState||(r.CoverState={}))},{}],328:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./ICoverConfiguration");r.CoverState=n.CoverState},{"./ICoverConfiguration":327}],329:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../Component"),o=e("../../Edge"),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._enable=function(){var e=this;this._keyDownSubscription=this._container.keyboardService.keyDown$.withLatestFrom(this._navigator.playService.playing$,this._navigator.playService.direction$,this._navigator.playService.speed$,this._navigator.stateService.currentNode$.switchMap(function(e){return e.sequenceEdges$})).subscribe(function(t){var r=t[0],n=t[1],i=t[2],a=t[3],s=t[4];if(!(r.altKey||r.ctrlKey||r.metaKey)){switch(r.key){case"D":if(!r.shiftKey)return;var c=n?null:i===o.EdgeDirection.Next?o.EdgeDirection.Prev:i===o.EdgeDirection.Prev?o.EdgeDirection.Next:null;null!=c&&e._navigator.playService.setDirection(c);break;case" ":if(r.shiftKey)return;if(n)e._navigator.playService.stop();else for(var u=0,h=s.edges;u":e._navigator.playService.setSpeed(a+.05);break;default:return}r.preventDefault()}})},t.prototype._disable=function(){this._keyDownSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{keyZoom:e}},t}(i.HandlerBase);r.KeyPlayHandler=a,r.default=a},{"../../Component":291,"../../Edge":292}],330:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/withLatestFrom");var i=e("../../Component"),o=e("../../Edge"),a=e("../../Error"),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._enable=function(){var e=this,t=this._navigator.stateService.currentNode$.switchMap(function(e){return e.sequenceEdges$});this._keyDownSubscription=this._container.keyboardService.keyDown$.withLatestFrom(t).subscribe(function(t){var r=t[0],n=t[1],i=null;switch(r.keyCode){case 38:i=o.EdgeDirection.Next;break;case 40:i=o.EdgeDirection.Prev;break;default:return}if(r.preventDefault(),r.altKey&&!r.shiftKey&&n.cached)for(var s=0,c=n.edges;si.lat&&p.latLon.lati.lon&&p.latLon.lon50||a.lerpAltitude(h.id,r,Math.min(1,Math.max(0,1.2-1.2*f/50)))}}),this._renderSubscription=this._navigator.stateService.currentState$.map(function(t){var r=e._markerScene;return{name:e._name,render:{frameId:t.id,needsRender:r.needsRender,render:r.render.bind(r),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$);var l=a.Observable.combineLatest(this._container.renderService.renderCamera$,this._container.mouseService.mouseMove$).map(function(t){var r=t[0],n=t[1],i=e._container.element,o=e._viewportCoords.canvasPosition(n,i),a=o[0],s=o[1],c=e._viewportCoords.canvasToViewport(a,s,i);return e._markerScene.intersectObjects(c,r.perspective)}).publishReplay(1).refCount(),p=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).map(function(e){return!0}),d=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).map(function(e){return!1}),f=a.Observable.merge(p,d).startWith(!1);this._dragEventSubscription=p.withLatestFrom(l).merge(a.Observable.combineLatest(d,a.Observable.of(null))).startWith([!1,null]).pairwise().subscribe(function(r){var n=r[0],i=r[1],o=i[0],a=o?t.dragstart:t.dragend,s=o?i[1]:n[1],c={marker:e._markerScene.get(s),target:e,type:a};e.fire(a,c)});var m=a.Observable.merge(this._container.mouseService.mouseDown$.map(function(e){return!0}),this._container.mouseService.documentMouseUp$.map(function(e){return!1})).startWith(!1);this._mouseClaimSubscription=a.Observable.combineLatest(this._container.mouseService.active$,l.distinctUntilChanged(),m,f).map(function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return!t&&null!=r&&n||i}).distinctUntilChanged().subscribe(function(t){t?(e._container.mouseService.claimMouse(e._name,1),e._container.mouseService.claimWheel(e._name,1)):(e._container.mouseService.unclaimMouse(e._name),e._container.mouseService.unclaimWheel(e._name))});var v=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragStart$).withLatestFrom(l,this._container.renderService.renderCamera$).map(function(t){var r=t[0],n=t[1],i=t[2],o=e._markerScene.get(n),a=e._container.element,s=e._viewportCoords.projectToCanvas(o.geometry.position.toArray(),a,i.perspective),c=s[0],u=s[1],h=e._viewportCoords.canvasPosition(r,a);return[o,[h[0]-c,h[1]-u],i]}).publishReplay(1).refCount();this._updateMarkerSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).withLatestFrom(v,this._navigator.stateService.reference$,o).subscribe(function(r){var n=r[0],o=r[1],a=o[0],s=o[1],c=o[2],u=r[2],h=r[3];if(e._markerScene.has(a.id)){var l=e._container.element,p=e._viewportCoords.canvasPosition(n,l),d=p[0],f=p[1],m=d-s[0],v=f-s[1],g=e._viewportCoords.canvasToViewport(m,v,l),y=g[0],b=g[1],_=new i.Vector3(y,b,1).unproject(c.perspective).sub(c.perspective.position).normalize(),x=Math.min(e._relativeGroundAltitude/_.z,h.visibleBBoxSize/2-.1);if(!(x<0)){var w=_.clone().multiplyScalar(x).add(c.perspective.position);w.z=c.perspective.position.z+e._relativeGroundAltitude;var S=e._geoCoords.enuToGeodetic(w.x,w.y,w.z,u.lat,u.lon,u.alt),M=S[0],E=S[1];e._markerScene.update(a.id,w.toArray(),{lat:M,lon:E}),e._markerSet.update(a);var C={marker:a,target:e,type:t.changed};e.fire(t.changed,C)}}})},t.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()},t.prototype._getDefaultConfiguration=function(){return{visibleBBoxSize:100}},t.componentName="marker",t.changed="changed",t.dragstart="dragstart",t.dragend="dragend",t}(s.Component);r.MarkerComponent=l,s.ComponentService.register(l),r.default=l},{"../../Component":291,"../../Geo":294,"../../Graph":295,"../../Render":297,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/map":67,three:241,when:288}],336:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=function(){function e(e,t){this._needsRender=!1,this._interactiveObjects=[],this._markers={},this._objectMarkers={},this._raycaster=t||new n.Raycaster,this._scene=e||new n.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),this._markers[e.id]=e;for(var r=0,n=e.getInteractiveObjects();r0&&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;i0&&0===s[3]?c=-h*s[1]:0===s[1]&&s[3]>0?c=h*s[3]:s[1]>0&&s[3]>0&&(c=h*(s[3]-s[1])/2),s[0]>0&&0===s[2]?u=h*s[0]:0===s[0]&&s[2]>0?u=-h*s[2]:s[0]>0&&s[2]>0&&(u=h*(s[0]-s[2])/2);var l=e._basicRotationThreshold;c=e._spatial.clamp(c,-l,l),u=e._spatial.clamp(u,-l,l),e._navigator.stateService.rotateBasicUnbounded([c,u])}}}})},t.prototype._disable=function(){this._bounceSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{}},t}(e("../../Component").HandlerBase);r.BounceHandler=o,r.default=o},{"../../Component":291,"rxjs/Observable":29}],342:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._viewportCoords=i,o}return n(t,e),t.prototype._enable=function(){var e=this;this._zoomSubscription=i.Observable.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.dblClick$),this._container.touchService.doubleTap$.map(function(e){var t=e.touches[0];return{clientX:t.clientX,clientY:t.clientY,shiftKey:e.shiftKey}})).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(t){var r=t[0],n=t[1],i=t[2],o=e._container.element,a=e._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=e._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.shiftKey?-1:1;e._navigator.stateService.zoomIn(l,h)})},t.prototype._disable=function(){this._zoomSubscription.unsubscribe()},t.prototype._getConfiguration=function(e){return{doubleClickZoom:e}},t}(e("../../Component").HandlerBase);r.DoubleClickZoomHandler=o,r.default=o},{"../../Component":291,"rxjs/Observable":29}],343:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("three"),o=e("rxjs/Observable");e("rxjs/add/operator/concat"),e("rxjs/add/operator/sample"),e("rxjs/add/operator/takeWhile");var a=function(e){function t(t,r,n,i,o){var a=e.call(this,t,r,n)||this;return a._spatial=o,a._viewportCoords=i,a._basicRotationThreshold=.05,a._forceCoeff=.2,a}return n(t,e),t.prototype._enable=function(){var e=this,t=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragStart$).map(function(e){return!0}).share(),r=this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$).map(function(e){return!1}).share();this._activeMouseSubscription=o.Observable.merge(t,r).subscribe(this._container.mouseService.activate$),this._preventDefaultSubscription=o.Observable.merge(t,r).switchMap(function(t){return t?e._container.mouseService.documentMouseMove$:o.Observable.empty()}).merge(this._container.touchService.touchMove$).subscribe(function(e){e.preventDefault()});var n=this._container.touchService.singleTouchDragStart$.map(function(e){return!0}),a=this._container.touchService.singleTouchDragEnd$.map(function(e){return!1});this._activeTouchSubscription=o.Observable.merge(n,a).subscribe(this._container.touchService.activate$);var s=this._navigator.stateService.currentState$.map(function(e){return e.state.currentNode.fullPano||e.state.nodesAhead<1}).distinctUntilChanged().switchMap(function(t){if(!t)return o.Observable.empty();var r=e._container.mouseService.filtered$(e._component.name,e._container.mouseService.mouseDragStart$).switchMap(function(t){return o.Observable.of(t).concat(e._container.mouseService.filtered$(e._component.name,e._container.mouseService.mouseDrag$)).merge(e._container.mouseService.filtered$(e._component.name,e._container.mouseService.mouseDragEnd$).map(function(e){return null})).takeWhile(function(e){return!!e}).startWith(null)}).pairwise().filter(function(e){return null!=e[0]&&null!=e[1]}),n=o.Observable.merge(e._container.touchService.singleTouchDragStart$,e._container.touchService.singleTouchDrag$,e._container.touchService.singleTouchDragEnd$.map(function(e){return null})).map(function(e){return null!=e&&e.touches.length>0?e.touches[0]:null}).pairwise().filter(function(e){return null!=e[0]&&null!=e[1]});return o.Observable.merge(r,n)}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,this._navigator.stateService.currentCamera$).map(function(t){var r=t[0],n=t[1],o=t[2],a=t[3].clone(),s=r[0],c=r[1],u=c.clientX-s.clientX,h=c.clientY-s.clientY,l=e._container.element,p=e._viewportCoords.canvasPosition(c,l),d=p[0],f=p[1],m=e._viewportCoords.unprojectFromCanvas(d,f,l,n.perspective).sub(n.perspective.position),v=e._viewportCoords.unprojectFromCanvas(d-u,f,l,n.perspective).sub(n.perspective.position),g=e._viewportCoords.unprojectFromCanvas(d,f-h,l,n.perspective).sub(n.perspective.position),y=(u>0?1:-1)*v.angleTo(m),b=(h>0?-1:1)*g.angleTo(m),_=(new i.Quaternion).setFromUnitVectors(a.up,new i.Vector3(0,0,1)),x=_.clone().inverse(),w=new i.Vector3;w.copy(a.lookat).sub(a.position),w.applyQuaternion(_);var S=w.length(),M=Math.atan2(w.y,w.x);M+=y;var E=Math.atan2(Math.sqrt(w.x*w.x+w.y*w.y),w.z);E+=b,E=Math.max(.01,Math.min(Math.PI-.01,E)),w.x=Math.sin(E)*Math.cos(M),w.y=Math.sin(E)*Math.sin(M),w.z=Math.cos(E),w.applyQuaternion(x);var C=(new i.Vector3).copy(a.position).add(w.multiplyScalar(S)),T=o.projectBasic(C.toArray()),O=o.projectBasic(a.lookat.toArray()),P=T[0]-O[0],j=T[1]-O[1];Math.abs(P)>1?P=0:P>.5?P-=1:P<-.5&&(P+=1);var A=e._basicRotationThreshold;if(P=e._spatial.clamp(P,-A,A),j=e._spatial.clamp(j,-A,A),o.fullPano)return[P,j];var R=e._viewportCoords.getPixelDistances(e._container.element,o,n.perspective),L=e._forceCoeff;return R[0]>0&&j<0&&T[1]<.5&&(j/=Math.max(1,L*R[0])),R[1]>0&&P>0&&T[0]>.5&&(P/=Math.max(1,L*R[1])),R[2]>0&&j>0&&T[1]>.5&&(j/=Math.max(1,L*R[2])),R[3]>0&&P<0&&T[0]<.5&&(P/=Math.max(1,L*R[3])),[P,j]}).share();this._rotateBasicWithoutInertiaSubscription=s.subscribe(function(t){e._navigator.stateService.rotateBasicWithoutInertia(t)}),this._rotateBasicSubscription=s.scan(function(t,r){return e._drainBuffer(t),t.push([Date.now(),r]),t},[]).sample(o.Observable.merge(this._container.mouseService.filtered$(this._component.name,this._container.mouseService.mouseDragEnd$),this._container.touchService.singleTouchDragEnd$)).map(function(t){for(var r=e._drainBuffer(t.slice()),n=[0,0],i=0,o=r;i0&&(n[0]/=s,n[1]/=s),n}).subscribe(function(t){e._navigator.stateService.rotateBasic(t)})},t.prototype._disable=function(){this._activeMouseSubscription.unsubscribe(),this._activeTouchSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._rotateBasicSubscription.unsubscribe(),this._rotateBasicWithoutInertiaSubscription.unsubscribe(),this._activeMouseSubscription=null,this._activeTouchSubscription=null,this._preventDefaultSubscription=null,this._rotateBasicSubscription=null},t.prototype._getConfiguration=function(e){return{dragPan:e}},t.prototype._drainBuffer=function(e){for(var t=Date.now();e.length>0&&t-e[0][0]>50;)e.shift();return e},t}(e("../../Component").HandlerBase);r.DragPanHandler=a,r.default=a},{"../../Component":291,"rxjs/Observable":29,"rxjs/add/operator/concat":56,"rxjs/add/operator/sample":77,"rxjs/add/operator/takeWhile":87,three:241}],344:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0}),e("rxjs/add/observable/merge"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/withLatestFrom");var i=e("../../Component"),o=e("../../Geo"),a=function(e){function t(t,r,n){var a=e.call(this,t,r,n)||this,s=new o.Spatial,c=new o.ViewportCoords;return a._bounceHandler=new i.BounceHandler(a,r,n,c,s),a._doubleClickZoomHandler=new i.DoubleClickZoomHandler(a,r,n,c),a._dragPanHandler=new i.DragPanHandler(a,r,n,c,s),a._scrollZoomHandler=new i.ScrollZoomHandler(a,r,n,c),a._touchZoomHandler=new i.TouchZoomHandler(a,r,n,c),a}return n(t,e),Object.defineProperty(t.prototype,"doubleClickZoom",{get:function(){return this._doubleClickZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dragPan",{get:function(){return this._dragPanHandler},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrollZoom",{get:function(){return this._scrollZoomHandler},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchZoom",{get:function(){return this._touchZoomHandler},enumerable:!0,configurable:!0}),t.prototype._activate=function(){var e=this;this._bounceHandler.enable(),this._configurationSubscription=this._configuration$.subscribe(function(t){t.doubleClickZoom?e._doubleClickZoomHandler.enable():e._doubleClickZoomHandler.disable(),t.dragPan?e._dragPanHandler.enable():e._dragPanHandler.disable(),t.scrollZoom?e._scrollZoomHandler.enable():e._scrollZoomHandler.disable(),t.touchZoom?e._touchZoomHandler.enable():e._touchZoomHandler.disable()}),this._container.mouseService.claimMouse(this._name,0)},t.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name),this._configurationSubscription.unsubscribe(),this._bounceHandler.disable(),this._doubleClickZoomHandler.disable(),this._dragPanHandler.disable(),this._scrollZoomHandler.disable(),this._touchZoomHandler.disable()},t.prototype._getDefaultConfiguration=function(){return{doubleClickZoom:!1,dragPan:!0,scrollZoom:!0,touchZoom:!0}},t.componentName="mouse",t}(i.Component);r.MouseComponent=a,i.ComponentService.register(a),r.default=a},{"../../Component":291,"../../Geo":294,"rxjs/add/observable/merge":45,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/withLatestFrom":90}],345:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._viewportCoords=i,o}return n(t,e),t.prototype._enable=function(){var e=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$).withLatestFrom(this._navigator.stateService.currentState$,function(e,t){return[e,t]}).filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}).map(function(e){return e[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,r){return[e,t,r]}).subscribe(function(t){var r=t[0],n=t[1],i=t[2],o=e._container.element,a=e._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=e._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=r.deltaY;1===r.deltaMode?l*=40:2===r.deltaMode&&(l*=800);var p=-3*l/e._viewportCoords.containerToCanvas(o)[1];e._navigator.stateService.zoomIn(p,h)})},t.prototype._disable=function(){this._container.mouseService.unclaimWheel(this._component.name),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},t.prototype._getConfiguration=function(e){return{scrollZoom:e}},t}(e("../../Component").HandlerBase);r.ScrollZoomHandler=i,r.default=i},{"../../Component":291}],346:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n)||this;return o._viewportCoords=i,o}return n(t,e),t.prototype._enable=function(){var e=this;this._preventDefaultSubscription=this._container.touchService.pinch$.subscribe(function(e){e.originalEvent.preventDefault()});var t=this._container.touchService.pinchStart$.map(function(e){return!0}),r=this._container.touchService.pinchEnd$.map(function(e){return!1});this._activeSubscription=i.Observable.merge(t,r).subscribe(this._container.touchService.activate$),this._zoomSubscription=this._container.touchService.pinch$.withLatestFrom(this._navigator.stateService.currentState$).filter(function(e){var t=e[1].state;return t.currentNode.fullPano||t.nodesAhead<1}).map(function(e){return e[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$).subscribe(function(t){var r=t[0],n=t[1],i=t[2],o=e._container.element,a=e._viewportCoords.canvasPosition(r,o),s=a[0],c=a[1],u=e._viewportCoords.unprojectFromCanvas(s,c,o,n.perspective),h=i.projectBasic(u.toArray()),l=e._viewportCoords.containerToCanvas(o),p=l[0],d=l[1],f=3*r.distanceChange/Math.min(p,d);e._navigator.stateService.zoomIn(f,h)})},t.prototype._disable=function(){this._activeSubscription.unsubscribe(),this._preventDefaultSubscription.unsubscribe(),this._zoomSubscription.unsubscribe(),this._preventDefaultSubscription=null,this._zoomSubscription=null},t.prototype._getConfiguration=function(e){return{touchZoom:e}},t}(e("../../Component").HandlerBase);r.TouchZoomHandler=o,r.default=o},{"../../Component":291,"rxjs/Observable":29}],347:[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":348,"./popup/Popup":349}],348:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Observable"),o=e("rxjs/Subject"),a=e("../../Component"),s=e("../../Utils"),c=function(e){function t(t,r,n,i){var a=e.call(this,t,r,n)||this;return a._dom=i||new s.DOM,a._popups=[],a._added$=new o.Subject,a._popups$=new o.Subject,a}return n(t,e),t.prototype.add=function(e){for(var t=0,r=e;t0&&f[0]0&&f[1]u[0]&&(u[0]=w,u[1]=f,u[2]=p)}}if(u[0]>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 a.Alignment.Bottom:return"bottom";case a.Alignment.BottomLeft:return"bottom-left";case a.Alignment.BottomRight:return"bottom-right";case a.Alignment.Center:return"center";case a.Alignment.Left:return"left";case a.Alignment.Right:return"right";case a.Alignment.Top:return"top";case a.Alignment.TopLeft:return"top-left";case a.Alignment.TopRight:return"top-right";default:return null}},e.prototype._normalizeOffset=function(e){if(null==e)return this._normalizeOffset(0);if("number"==typeof e){var t=e,r=(t>=0?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]}}return{bottom:e.bottom||[0,0],"bottom-left":e.bottomLeft||[0,0],"bottom-right":e.bottomRight||[0,0],center:e.center||[0,0],left:e.left||[0,0],right:e.right||[0,0],top:e.top||[0,0],"top-left":e.topLeft||[0,0],"top-right":e.topRight||[0,0]}},e.prototype._pixelToFloats=function(e,t,r,n){var i=[];return e[1]t.height-n&&i.push("top"),e[0]t.width-r/2&&i.push("left"),i},e.prototype._pointFromRectPosition=function(e,t){var r=e[0],n=e[0]n?1:0}),t}).share(),c._tagChanged$=c._renderTags$.switchMap(function(e){return o.Observable.from(e).mergeMap(function(e){return o.Observable.merge(e.tag.changed$,e.tag.geometryChanged$)})}).share(),c._renderTagGLChanged$=c._renderTags$.switchMap(function(e){return o.Observable.from(e).mergeMap(function(e){return e.glObjectsChanged$})}).share(),c._createGeometryChanged$=c._tagCreator.tag$.switchMap(function(e){return null!=e?e.geometryChanged$:o.Observable.empty()}).share(),c._createGLObjectsChanged$=c._tagCreator.tag$.switchMap(function(e){return null!=e?e.glObjectsChanged$:o.Observable.empty()}).share(),c._creatingConfiguration$=c._configuration$.distinctUntilChanged(function(e,t){return e.mode===t.mode},function(e){return{createColor:e.createColor,mode:e.mode}}).publishReplay(1).refCount(),c._creatingConfiguration$.subscribe(function(e){c.fire(t.modechanged,e.mode)}),c}return n(t,e),t.prototype.add=function(e){var t=this;this._activated?this._navigator.stateService.currentTransform$.first().subscribe(function(r){t._tagSet.add(e,r);var n=e.map(function(e){return t._tagSet.get(e.id)});t._tagScene.add(n)}):this._tagSet.addDeactivated(e)},t.prototype.changeMode=function(e){this.configure({mode:e})},t.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)},t.prototype.getAll=function(){return this.activated?this._tagSet.getAll().map(function(e){return e.tag}):this._tagSet.getAllDeactivated()},t.prototype.getTagIdsAt=function(e){var t=this;return i.promise(function(r,n){t._container.renderService.renderCamera$.first().map(function(r){var n=t._viewportCoords.canvasToViewport(e[0],e[1],t._container.element);return t._tagScene.intersectObjects(n,r.perspective)}).subscribe(function(e){r(e)},function(e){n(e)})})},t.prototype.has=function(e){return this._activated?this._tagSet.has(e):this._tagSet.hasDeactivated(e)},t.prototype.remove=function(e){this._activated?(this._tagSet.remove(e),this._tagScene.remove(e)):this._tagSet.removeDeactivated(e)},t.prototype.removeAll=function(){this._activated?(this._tagSet.removeAll(),this._tagScene.removeAll()):this._tagSet.removeAllDeactivated()},t.prototype._activate=function(){var e=this;this._editVertexHandler.enable();var r=o.Observable.from(Object.keys(this._createHandlers)).map(function(t){return e._createHandlers[t]}).filter(function(e){return!!e}).mergeMap(function(e){return e.geometryCreated$}).share();this._fireGeometryCreatedSubscription=r.subscribe(function(r){e.fire(t.geometrycreated,r)}),this._fireCreateGeometryEventSubscription=this._tagCreator.tag$.skipWhile(function(e){return null==e}).distinctUntilChanged().subscribe(function(r){var n=null!=r?t.creategeometrystart:t.creategeometryend;e.fire(n,e)}),this._handlerStopCreateSubscription=r.subscribe(function(){e.changeMode(a.TagMode.Default)}),this._handlerEnablerSubscription=this._creatingConfiguration$.subscribe(function(t){e._disableCreateHandlers();var r=a.TagMode[t.mode],n=e._createHandlers[r];n&&n.enable()}),this._fireTagsChangedSubscription=this._renderTags$.subscribe(function(r){e.fire(t.tagschanged,e)}),this._stopCreateSubscription=this._tagCreator.tag$.switchMap(function(e){return null!=e?e.aborted$.map(function(e){return null}):o.Observable.empty()}).subscribe(function(){e.changeMode(a.TagMode.Default)}),this._setGLCreateTagSubscription=this._tagCreator.tag$.subscribe(function(t){e._tagScene.hasCreateTag()&&e._tagScene.removeCreateTag(),null!=t&&e._tagScene.addCreateTag(t)}),this._createGLObjectsChangedSubscription=this._createGLObjectsChanged$.subscribe(function(t){e._tagScene.updateCreateTagObjects(t)}),this._updateGLObjectsSubscription=this._renderTagGLChanged$.subscribe(function(t){e._tagScene.updateObjects(t)}),this._updateTagSceneSubscription=this._tagChanged$.subscribe(function(t){e._tagScene.update()}),this._domSubscription=this._renderTags$.startWith([]).do(function(t){e._container.domRenderer.render$.next({name:e._name,vnode:e._tagDomRenderer.clear()})}).combineLatest(this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._container.renderService.size$,this._tagChanged$.startWith(null),this._tagCreator.tag$.merge(this._createGeometryChanged$).startWith(null),function(e,t,r,n,i,o){return[t,r,n,e,i,o]}).map(function(t){return{name:e._name,vnode:e._tagDomRenderer.render(t[3],t[5],t[1],t[0].perspective,t[2])}}).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.map(function(t){var r=e._tagScene;return{name:e._name,render:{frameId:t.id,needsRender:r.needsRender,render:r.render.bind(r),stage:c.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$),this._navigator.stateService.currentTransform$.first().subscribe(function(t){e._tagSet.activate(t),e._tagScene.add(e._tagSet.getAll())})},t.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")},t.prototype._getDefaultConfiguration=function(){return{createColor:16777215,mode:a.TagMode.Default}},t.prototype._disableCreateHandlers=function(){var e=this._createHandlers;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];r&&r.disable()}},t.componentName="tag",t.creategeometryend="creategeometryend",t.creategeometrystart="creategeometrystart",t.modechanged="modechanged",t.geometrycreated="geometrycreated",t.tagschanged="tagschanged",t}(a.Component);r.TagComponent=u,a.ComponentService.register(u),r.default=u},{"../../Component":291,"../../Geo":294,"../../Render":297,"rxjs/Observable":29,"rxjs/add/observable/combineLatest":38,"rxjs/add/observable/empty":41,"rxjs/add/observable/from":42,"rxjs/add/observable/merge":45,"rxjs/add/observable/of":46,"rxjs/add/operator/combineLatest":55,"rxjs/add/operator/concat":56,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/do":61,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/merge":68,"rxjs/add/operator/mergeMap":70,"rxjs/add/operator/publishReplay":74,"rxjs/add/operator/scan":78,"rxjs/add/operator/share":79,"rxjs/add/operator/skip":80,"rxjs/add/operator/skipUntil":81,"rxjs/add/operator/startWith":83,"rxjs/add/operator/switchMap":84,"rxjs/add/operator/take":85,"rxjs/add/operator/takeUntil":86,"rxjs/add/operator/withLatestFrom":90,when:288}],355:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Subject");e("rxjs/add/operator/map"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/share"),e("rxjs/add/operator/withLatestFrom");var i=e("../../Component"),o=function(){function e(e,t){this._component=e,this._navigator=t,this._tagOperation$=new n.Subject,this._createPolygon$=new n.Subject,this._createRect$=new n.Subject,this._delete$=new n.Subject,this._tag$=this._tagOperation$.scan(function(e,t){return t(e)},null).share(),this._createRect$.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$).map(function(e){var t=e[0],r=e[1],n=e[2];return function(e){var o=new i.RectGeometry([t[0],t[1],t[0],t[1]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}}).subscribe(this._tagOperation$),this._createPolygon$.withLatestFrom(this._component.configuration$,this._navigator.stateService.currentTransform$).map(function(e){var t=e[0],r=e[1],n=e[2];return function(e){var o=new i.PolygonGeometry([[t[0],t[1]],[t[0],t[1]],[t[0],t[1]]]);return new i.OutlineCreateTag(o,{color:r.createColor},n)}}).subscribe(this._tagOperation$),this._delete$.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=o,r.default=o},{"../../Component":291,"rxjs/Subject":34,"rxjs/add/operator/map":67,"rxjs/add/operator/scan":78,"rxjs/add/operator/share":79,"rxjs/add/operator/withLatestFrom":90}],356:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("virtual-dom"),i=function(){function e(){}return e.prototype.render=function(e,t,r,i,o){for(var a=[],s=0,c=e;s1||o<0||o>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].");return r._point=t.slice(),r}return n(t,e),Object.defineProperty(t.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),t.prototype.getCentroid2d=function(){return this._point.slice()},t.prototype.getCentroid3d=function(e){return e.unprojectBasic(this._point,200)},t.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)},t}(i.Geometry);r.PointGeometry=o},{"../../../Component":291}],364:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../../Component"),o=function(e){function t(t,r){var n=e.call(this)||this,o=t.length;if(o<3)throw new i.GeometryTagError("A polygon must have three or more positions.");if(t[0][0]!==t[o-1][0]||t[0][1]!==t[o-1][1])throw new i.GeometryTagError("First and last positions must be equivalent.");n._polygon=[];for(var a=0,s=t;a1||d[1]<0||d[1]>1)throw new i.GeometryTagError("Basic coordinates of polygon must be on the interval [0, 1].");n._polygon.push(d.slice())}if(n._holes=[],null==r)return n;for(var c=0;c1||d[1]<0||d[1]>1)throw new i.GeometryTagError("Basic coordinates of hole must be on the interval [0, 1].");n._holes[c].push(d.slice())}}return n}return n(t,e),Object.defineProperty(t.prototype,"polygon",{get:function(){return this._polygon},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"holes",{get:function(){return this._holes},enumerable:!0,configurable:!0}),t.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)},t.prototype.getVertex2d=function(e){return this._polygon[e].slice()},t.prototype.removeVertex2d=function(e){if(e<0||e>=this._polygon.length||this._polygon.length<4)throw new i.GeometryTagError("Index for removed vertex must be valid.");if(e>0&&et[3])throw new i.GeometryTagError("Basic Y coordinates values can not be inverted.");for(var n=0,o=t;n1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}return r._anchorIndex=void 0,r._rect=t.slice(0,4),r._inverted=r._rect[0]>r._rect[2],r}return n(t,e),Object.defineProperty(t.prototype,"anchorIndex",{get:function(){return this._anchorIndex},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inverted",{get:function(){return this._inverted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),t.prototype.initializeAnchorIndexing=function(e){if(void 0!==this._anchorIndex)throw new Error("Anchor indexing is already initialized.");if(e<0||e>3)throw new Error("Invalid anchor index: "+e+".");this._anchorIndex=void 0===e?0:e},t.prototype.terminateAnchorIndexing=function(){this._anchorIndex=void 0},t.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&&n[2]>.75&&o<-.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?0:1):!this._inverted&&this._anchorIndex>=2&&r[0]<.25&&n[2]>.75&&o<-.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?0:1):this._inverted&&this._anchorIndex>=2&&r[0]<.25&&n[0]>.75&&o<-.5?(this._inverted=!1,this._anchorIndex=i[0]>r[0]?i[1]>r[1]?3:2:i[1]>r[1]?0:1):!this._inverted&&this._anchorIndex>=2&&r[0]>.75&&n[0]<.25&&o>.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?3:2):!this._inverted&&this._anchorIndex<2&&r[0]>.75&&n[0]<.25&&o>.5?(this._inverted=!0,this._anchorIndex=i[1]>r[1]?3:2):this._inverted&&this._anchorIndex<2&&r[0]>.75&&n[2]<.25&&o>.5?(this._inverted=!1,this._anchorIndex=i[0]>r[0]?i[1]>r[1]?3:2:i[1]>r[1]?0:1):this._inverted&&this._anchorIndex<2&&r[0]>n[0]?(this._inverted=!1,this._anchorIndex=i[1]>r[1]?0:1):this._inverted&&this._anchorIndex>=2&&r[0]r[1]?3:2):this._inverted?this._anchorIndex<2?this._anchorIndex=i[1]>r[1]?0:1:this._anchorIndex=i[1]>r[1]?3:2:this._anchorIndex=i[0]<=r[0]&&i[1]>r[1]?0:i[0]<=r[0]&&i[1]<=r[1]?1:i[0]>r[0]&&i[1]<=r[1]?2:3;a=[];0===this._anchorIndex?(a[0]=i[0],a[1]=r[1],a[2]=r[0],a[3]=i[1]):1===this._anchorIndex?(a[0]=i[0],a[1]=i[1],a[2]=r[0],a[3]=r[1]):2===this._anchorIndex?(a[0]=r[0],a[1]=i[1],a[2]=i[0],a[3]=r[1]):(a[0]=r[0],a[1]=r[1],a[2]=i[0],a[3]=i[1]),(!this._inverted&&a[0]>a[2]||this._inverted&&a[0]a[3]&&(a[1]=n[1],a[3]=n[3]),this._rect[0]=a[0],this._rect[1]=a[1],this._rect[2]=a[2],this._rect[3]=a[3]}else{this._anchorIndex=i[0]<=r[0]&&i[1]>r[1]?0:i[0]<=r[0]&&i[1]<=r[1]?1:i[0]>r[0]&&i[1]<=r[1]?2:3;var a=[];0===this._anchorIndex?(a[0]=i[0],a[1]=r[1],a[2]=r[0],a[3]=i[1]):1===this._anchorIndex?(a[0]=i[0],a[1]=i[1],a[2]=r[0],a[3]=r[1]):2===this._anchorIndex?(a[0]=r[0],a[1]=i[1],a[2]=i[0],a[3]=r[1]):(a[0]=r[0],a[1]=r[1],a[2]=i[0],a[3]=i[1]),a[0]>a[2]&&(a[0]=n[0],a[2]=n[2]),a[1]>a[3]&&(a[1]=n[1],a[3]=n[3]),this._rect[0]=a[0],this._rect[1]=a[1],this._rect[2]=a[2],this._rect[3]=a[3]}this._notifyChanged$.next(this)},t.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 a=e<2&&i[0]>.75&&n[0]<.25||e>=2&&this._inverted&&i[0]>.75&&n[2]<.25,s=e<2&&this._inverted&&i[0]<.25&&n[0]>.75||e>=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]);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)},t.prototype.setCentroid2d=function(e,t){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!=t.gpano&&t.gpano.CroppedAreaImageWidthPixels===t.gpano.FullPanoWidthPixels)u=this._inverted?e[0]+1-s:e[0]-s;else{var h=-n,l=1-i;u=Math.max(h,Math.min(l,e[0]-s))}var p=-o,d=1-a,f=Math.max(p,Math.min(d,e[1]-c));this._rect[0]=r[0]+u,this._rect[1]=r[1]+f,this._rect[2]=r[2]+u,this._rect[3]=r[3]+f,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)},t.prototype.getPoints3d=function(e){return this._getPoints2d(e).map(function(t){return e.unprojectBasic(t,200)})},t.prototype.getVertex2d=function(e){return this._rectToVertices2d(this._rect)[e]},t.prototype.getNonAdjustedVertex2d=function(e){return this._rectToNonAdjustedVertices2d(this._rect)[e]},t.prototype.getVertex3d=function(e,t){return t.unprojectBasic(this._rectToVertices2d(this._rect)[e],200)},t.prototype.getVertices2d=function(){return this._rectToVertices2d(this._rect)},t.prototype.getVertices3d=function(e){return this._rectToVertices2d(this._rect).map(function(t){return e.unprojectBasic(t,200)})},t.prototype.getCentroid2d=function(){var e=this._rect,t=e[0],r=this._inverted?e[2]+1:e[2],n=e[1];return[t+(r-t)/2,n+(e[3]-n)/2]},t.prototype.getCentroid3d=function(e){var t=this.getCentroid2d();return e.unprojectBasic(t,200)},t.prototype.getPoleOfAccessibility2d=function(){return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect))},t.prototype.getPoleOfAccessibility3d=function(e){var t=this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));return e.unprojectBasic(t,200)},t.prototype.getTriangles3d=function(e){return this._triangulate(this._rectToVertices2d(this._rect),this.getVertices3d(e))},t.prototype.validate=function(e){var t=this._rect;return!(!this._inverted&&e[0].25||e[1]4?function(e){e.stopPropagation(),v.removeVertex2d(v.polygon.length-2),r._created$.next(r)}:s,style:{transform:R=this._canvasToTransform(_)}},x=v.polygon.length>4?"TagCompleter":"TagInteractor";n.push(i.h("div."+x,m,[]))}if(v.polygon.length>3){var w=v.getVertex2d(v.polygon.length-3),S=w[0],M=w[1],E=this._viewportCoords.basicToCanvasSafe(S,M,o,this._transform,e);if(null!=E){m={onclick:function(e){e.stopPropagation(),v.removeVertex2d(v.polygon.length-3)},style:{transform:R=this._canvasToTransform(E)}};n.push(i.h("div.TagInteractor",m,[]))}}var C=v.polygon.slice();C.splice(-2,2);for(var T=0,O=C;T=1?n._createHoles():[],n._outline=n._tag.lineWidth>=1?n._createOutline():null,n._geometryChangedSubscription=n._tag.geometry.changed$.subscribe(function(e){null!=n._fill&&n._updateFillGeometry(),n._holes.length>0&&n._updateHoleGeometries(),null!=n._outline&&n._updateOulineGeometry()}),n._changedSubscription=n._tag.changed$.subscribe(function(e){var t=!1;null!=n._fill&&n._updateFillMaterial(n._fill.material),null==n._outline?n._tag.lineWidth>=1&&(n._holes=n._createHoles(),n._outline=n._createOutline(),t=!0):(n._updateHoleMaterials(),n._updateOutlineMaterial()),t&&n._glObjectsChanged$.next(n)}),n}return n(t,e),t.prototype.dispose=function(){this._disposeFill(),this._disposeHoles(),this._disposeOutline(),this._changedSubscription.unsubscribe(),this._geometryChangedSubscription.unsubscribe()},t.prototype.getDOMObjects=function(e,t,r){var n=this,i=[],s=this._tag.geometry instanceof a.RectGeometry,c=!this._transform.gpano,u={offsetHeight:r.height,offsetWidth:r.width};if(null!=this._tag.icon&&(s||c)){var h=this._tag.geometry instanceof a.RectGeometry?this._tag.geometry.getVertex2d(this._tag.iconIndex):this._tag.geometry.getPoleOfAccessibility2d(),l=h[0],p=h[1],d=this._viewportCoords.basicToCanvasSafe(l,p,u,this._transform,t);if(null!=d){N=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})};if(e.loaded){var f=e.getDOMSprite(this._tag.icon,this._tag.iconFloat),m={onclick:function(e){e.stopPropagation(),n._tag.click$.next(n._tag)},onmousedown:N,style:{transform:w="translate("+Math.round(d[0])+"px,"+Math.round(d[1])+"px)"}};i.push(o.h("div.TagSymbol",m,[f]))}}}else if(null!=this._tag.text&&(s||c)){var v=this._tag.geometry instanceof a.RectGeometry?this._tag.geometry.getVertex2d(3):this._tag.geometry.getPoleOfAccessibility2d(),g=v[0],y=v[1],b=this._viewportCoords.basicToCanvasSafe(g,y,u,this._transform,t);if(null!=b){var _=Math.round(b[0]),x=Math.round(b[1]),w=this._tag.geometry instanceof a.RectGeometry?"translate("+_+"px,"+x+"px)":"translate(-50%, -50%) translate("+_+"px,"+x+"px)",m={onmousedown:N=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:a.TagOperation.None,tag:n._tag})},style:{color:this._colorToCss(this._tag.textColor),transform:w},textContent:this._tag.text};i.push(o.h("span.TagSymbol",m,[]))}}if(!this._tag.editable)return i;var S=this._colorToCss(this._tag.lineColor);if(this._tag.geometry instanceof a.RectGeometry){var M=this._tag.geometry.getCentroid2d(),E=M[0],C=M[1],T=this._viewportCoords.basicToCanvasSafe(E,C,u,this._transform,t);if(null!=T){m={onmousedown:N=this._interact(a.TagOperation.Centroid,"move"),style:{background:S,transform:w="translate(-50%, -50%) translate("+Math.round(T[0])+"px,"+Math.round(T[1])+"px)"}};i.push(o.h("div.TagMover",m,[]))}}for(var O=this._tag.geometry.getVertices2d(),P=0;P=1&&this._tag.lineOpacity>0,e.opacity=this._tag.lineOpacity,e.transparent=this._tag.lineOpacity<1,e.needsUpdate=!0},t}(a.RenderTag);r.OutlineRenderTag=s},{"../../../Component":291,three:241,"virtual-dom":247}],377:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Subject"),o=e("../../../Component"),a=e("../../../Viewer"),s=function(e){function t(r,n,o){var s=e.call(this,r,n)||this;return o=o||{},s._editable=null!=o.editable&&o.editable,s._fillColor=null==o.fillColor?16777215:o.fillColor,s._fillOpacity=null==o.fillOpacity?0:o.fillOpacity,s._icon=void 0===o.icon?null:o.icon,s._iconFloat=null==o.iconFloat?a.Alignment.Center:o.iconFloat,s._iconIndex=null==o.iconIndex?3:o.iconIndex,s._indicateVertices=null==o.indicateVertices||o.indicateVertices,s._lineColor=null==o.lineColor?16777215:o.lineColor,s._lineOpacity=null==o.lineOpacity?1:o.lineOpacity,s._lineWidth=null==o.lineWidth?1:o.lineWidth,s._text=void 0===o.text?null:o.text,s._textColor=null==o.textColor?16777215:o.textColor,s._click$=new i.Subject,s._click$.subscribe(function(e){s.fire(t.click,s)}),s}return n(t,e),Object.defineProperty(t.prototype,"click$",{get:function(){return this._click$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fillColor",{get:function(){return this._fillColor},set:function(e){this._fillColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fillOpacity",{get:function(){return this._fillOpacity},set:function(e){this._fillOpacity=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconFloat",{get:function(){return this._iconFloat},set:function(e){this._iconFloat=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconIndex",{get:function(){return this._iconIndex},set:function(e){this._iconIndex=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indicateVertices",{get:function(){return this._indicateVertices},set:function(e){this._indicateVertices=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineColor",{get:function(){return this._lineColor},set:function(e){this._lineColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineOpacity",{get:function(){return this._lineOpacity},set:function(e){this._lineOpacity=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),t.prototype.setOptions=function(e){this._editable=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)},t.click="click",t}(o.Tag);r.OutlineTag=s,r.default=s},{"../../../Component":291,"../../../Viewer":302,"rxjs/Subject":34}],378:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Subject"),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":294,"rxjs/Subject":34}],379:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("virtual-dom"),o=e("../../../Component"),a=e("../../../Viewer"),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.dispose=function(){},t.prototype.getDOMObjects=function(e,t,r){var n=this,s=this._tag,c={offsetHeight:r.height,offsetWidth:r.width},u=[],h=s.geometry.getCentroid2d(),l=h[0],p=h[1],d=this._viewportCoords.basicToCanvasSafe(l,p,c,this._transform,t);if(null!=d){var f=function(e){n._interact$.next({offsetX:0,offsetY:0,operation:o.TagOperation.None,tag:s})},m=Math.round(d[0]),v=Math.round(d[1]);if(null!=s.icon){if(e.loaded){var g=e.getDOMSprite(s.icon,a.Alignment.Bottom),y={onmousedown:f,style:{pointerEvents:"all",transform:"translate("+m+"px,"+(v+8)+"px)"}};u.push(i.h("div",y,[g]))}}else if(null!=s.text){var b="translate(-50%,0%) translate("+m+"px,"+(v+8)+"px)",y={onmousedown:f,style:{color:this._colorToCss(s.textColor),transform:b},textContent:s.text};u.push(i.h("span.TagSymbol",y,[]))}var _=this._interact(o.TagOperation.Centroid,s,"move"),x=this._colorToCss(s.color),w="translate(-50%,-50%) translate("+m+"px,"+v+"px)";if(s.editable){var S={onmousedown:_,style:{background:x,transform:w}};u.push(i.h("div.TagSpotInteractor",S,[]))}var M={style:{background:x,transform:w}};u.push(i.h("div.TagVertex",M,[]))}return u},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(e,t,r,n){var i=this;return function(o){var a=o.offsetX-o.target.offsetWidth/2,s=o.offsetY-o.target.offsetHeight/2;i._interact$.next({cursor:r,offsetX:a,offsetY:s,operation:e,tag:t,vertexIndex:n})}},t}(o.RenderTag);r.SpotRenderTag=s},{"../../../Component":291,"../../../Viewer":302,"virtual-dom":247}],380:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(t,r,n){var i=e.call(this,t,r)||this;return n=n||{},i._color=null==n.color?16777215:n.color,i._editable=null!=n.editable&&n.editable,i._icon=void 0===n.icon?null:n.icon,i._text=void 0===n.text?null:n.text,i._textColor=null==n.textColor?16777215:n.textColor,i}return n(t,e),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(e){this._color=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.next(this)},enumerable:!0,configurable:!0}),t.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)},t}(e("../../../Component").Tag);r.SpotTag=i,r.default=i},{"../../../Component":291}],381:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("rxjs/Subject");e("rxjs/add/operator/map"),e("rxjs/add/operator/share");var o=function(e){function t(r,n){var o=e.call(this)||this;return o._id=r,o._geometry=n,o._notifyChanged$=new i.Subject,o._notifyChanged$.subscribe(function(e){o.fire(t.changed,o)}),o._geometry.changed$.subscribe(function(e){o.fire(t.geometrychanged,o)}),o}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometryChanged$",{get:function(){var e=this;return this._geometry.changed$.map(function(t){return e}).share()},enumerable:!0,configurable:!0}),t.changed="changed",t.geometrychanged="geometrychanged",t}(e("../../../Utils").EventEmitter);r.Tag=o,r.default=o},{"../../../Utils":301,"rxjs/Subject":34,"rxjs/add/operator/map":67,"rxjs/add/operator/share":79}],382:[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},{}],383:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(r){var n=e.call(this,null!=r?r:"The request was aborted.")||this;return Object.setPrototypeOf(n,t.prototype),n.name="AbortMapillaryError",n}return n(t,e),t}(e("./MapillaryError").MapillaryError);r.AbortMapillaryError=i,r.default=i},{"./MapillaryError":386}],384:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(r){var n=e.call(this,null!=r?r:"The argument is not valid.")||this;return Object.setPrototypeOf(n,t.prototype),n.name="ArgumentMapillaryError",n}return n(t,e),t}(e("./MapillaryError").MapillaryError);r.ArgumentMapillaryError=i,r.default=i},{"./MapillaryError":386}],385:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n.name="GraphMapillaryError",n}return n(t,e),t}(e("./MapillaryError").MapillaryError);r.GraphMapillaryError=i,r.default=i},{"./MapillaryError":386}],386:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n.name="MapillaryError",n}return n(t,e),t}(Error);r.MapillaryError=i,r.default=i},{}],387:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=function(){function e(e){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._focal=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),this._focal=1)}return Object.defineProperty(e.prototype,"position",{get:function(){return this._position},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lookat",{get:function(){return this._lookat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"up",{get:function(){return this._up},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focal",{get:function(){return this._focal},set:function(e){this._focal=e},enumerable:!0,configurable:!0}),e.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},e.prototype.copy=function(e){this._position.copy(e.position),this._lookat.copy(e.lookat),this._up.copy(e.up),this._focal=e.focal},e.prototype.clone=function(){var t=new e;return t.position.copy(this._position),t.lookat.copy(this._lookat),t.up.copy(this._up),t.focal=this._focal,t},e.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)},e.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))},e}();r.Camera=i},{three:241}],388:[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 a=this.geodeticToEcef(e,t,r);return this.ecefToEnu(a[0],a[1],a[2],n,i,o)},e.prototype.enuToGeodetic=function(e,t,r,n,i,o){var a=this.enuToEcef(e,t,r,n,i,o);return this.ecefToGeodetic(a[0],a[1],a[2])},e.prototype.ecefToEnu=function(e,t,r,n,i,o){var a=this.geodeticToEcef(n,i,o),s=[e-a[0],t-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);return[-l*s[0]+h*s[1],-u*h*s[0]-u*l*s[1]+c*s[2],c*h*s[0]+c*l*s[1]+u*s[2]]},e.prototype.enuToEcef=function(e,t,r,n,i,o){var a=this.geodeticToEcef(n,i,o);n=n*Math.PI/180,i=i*Math.PI/180;var s=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i);return[-h*e-c*u*t+s*u*r+a[0],u*e-c*h*t+s*h*r+a[1],s*t+c*r+a[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),a=Math.sin(e),s=Math.cos(t),c=Math.sin(t),u=n*n,h=i*i,l=1/Math.sqrt(u*o*o+h*a*a),p=(u*l+r)*o;return[p*s,p*c,(h*l+r)*a]},e.prototype.ecefToGeodetic=function(e,t,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(e*e+t*t),l=Math.atan2(r*n,h*i),p=Math.sin(l),d=Math.cos(l),f=Math.atan2(t,e),m=Math.atan2(r+u*u*i*p*p*p,h-c*c*n*d*d*d),v=Math.sin(m),g=h/Math.cos(m)-n/Math.sqrt(1-c*c*v*v);return[180*m/Math.PI,180*f/Math.PI,g]},e}();r.GeoCoords=n,r.default=n},{}],389:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=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 n.Vector3(e[0],e[1],e[2]),r=t.length();return r>0&&t.normalize(),(new n.Matrix4).makeRotationAxis(t,r)},e.prototype.rotate=function(e,t){var r=new n.Vector3(e[0],e[1],e[2]),i=this.rotationMatrix(t);return r.applyMatrix4(i),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(rr||er?e-=n:er?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;return Math.acos((i[0]+i[5]+i[10]-1)/2)},e.prototype.angleToPlane=function(e,t){var r=(new n.Vector3).fromArray(e),i=r.length();if(i.01&&this._scale<50},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 n.Vector3(-e[1],-e[5],-e[9]);case 3:return new n.Vector3(e[1],e[5],e[9]);case 6:return new n.Vector3(-e[0],-e[4],-e[8]);case 8:return new n.Vector3(e[0],e[4],e[8]);default:return new n.Vector3(-e[1],-e[5],-e[9])}},e.prototype.projectorMatrix=function(){var e=this._normalizedToTextureMatrix(),t=this._focal,r=(new n.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){var r=this._basicToSfm(e);return this.unprojectSfM(r,t)},e.prototype.projectSfM=function(e){var t=new n.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){var r=this._sfmToBearing(e),i=new n.Vector4(t*r[0],t*r[1],t*r[2],1);return i.applyMatrix4((new n.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[a=Math.cos(r)*Math.sin(t),s=-Math.sin(r),c=Math.cos(r)*Math.cos(t)]}if(this._gpano){var i=Math.max(this.gpano.CroppedAreaImageWidthPixels,this.gpano.CroppedAreaImageHeightPixels),o=[e[0]*i+this.gpano.CroppedAreaImageWidthPixels/2+this.gpano.CroppedAreaLeftPixels,e[1]*i+this.gpano.CroppedAreaImageHeightPixels/2+this.gpano.CroppedAreaTopPixels],t=2*Math.PI*(o[0]/this.gpano.FullPanoWidthPixels-.5),r=-Math.PI*(o[1]/this.gpano.FullPanoHeightPixels-.5),a=Math.cos(r)*Math.sin(t),s=-Math.sin(r),c=Math.cos(r)*Math.cos(t);return[a,s,c]}var u=new n.Vector3(e[0],e[1],this._focal);return u.normalize(),[u.x,u.y,u.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){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)),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 e[2]>0?[e[0]*this._focal/e[2],e[1]*this._focal/e[2]]:[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),a=(e[0]+n/o/2)/n*o,s=(e[1]+i/o/2)/i*o;switch(this._orientation){case 1:t=a,r=s;break;case 3:t=1-a,r=1-s;break;case 6:t=1-s,r=a;break;case 8:t=s,r=1-a;break;default:t=a,r=s}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&&e>0?e:t},e.prototype._getRt=function(e,t){var r=new n.Vector3(e[0],e[1],e[2]),i=r.length();i>0&&r.normalize();var o=new n.Matrix4;return o.makeRotationAxis(r,i),o.setPosition(new n.Vector3(t[0],t[1],t[2])),o},e.prototype._getSrt=function(e,t){var r=e.clone(),i=r.elements;return i[12]=t*i[12],i[13]=t*i[13],i[14]=t*i[14],r.scale(new n.Vector3(t,t,t)),r},e.prototype._normalizedToTextureMatrix=function(){var e=Math.max(this._width,this._height),t=e/this._width,r=e/this._height;switch(this._orientation){case 1:return(new n.Matrix4).set(t,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1);case 3:return(new n.Matrix4).set(-t,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,-t,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new n.Matrix4).set(0,r,0,.5,t,0,0,.5,0,0,1,0,0,0,0,1);default:return(new n.Matrix4).set(t,0,0,.5,0,-r,0,.5,0,0,1,0,0,0,0,1)}},e}();r.Transform=i},{three:241}],391:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=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=n.unprojectBasic([e,t],this._unprojectDepth),a=this.worldToCamera(o,i);if(a[2]>0)return null;var s=this.cameraToViewport(a,i),c=s[0],u=s[1];return this.viewportToCanvas(c,u,r)},e.prototype.basicToViewport=function(e,t,r,n){var i=r.unprojectBasic([e,t],this._unprojectDepth);return this.projectToViewport(i,n)},e.prototype.cameraToViewport=function(e,t){var r=(new n.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),a=0,s=0,c=0,u=0;return r[1]<0&&n[1]<0&&(a=r[1]>n[1]?-r[1]:-n[1]),n[0]>1&&i[0]>1&&(s=n[0]1&&o[1]>1&&(c=i[1]r[0]?-o[0]:-r[0]),[a,s,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),a=this.viewportToBasic(-1,-1,t,r),s=0,c=0,u=0,h=0,l=this.containerToCanvas(e),p=l[0],d=l[1];if(n[1]<0&&i[1]<0){f=n[1]>i[1]?n[0]:i[0];s=(v=this.basicToCanvas(f,0,e,t,r))[1]>0?v[1]:0}if(i[0]>1&&o[0]>1){m=i[0]1&&a[1]>1){var f=o[1]n[0]?a[1]:n[1],v=this.basicToCanvas(0,m,e,t,r);h=v[0]>0?v[0]:0}return[s,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,a=o+t.clientHeight;return e.clientX>n&&e.clientXo&&e.clientY"===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 et?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},{}],393:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rbush"),i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/from"),e("rxjs/add/operator/catch"),e("rxjs/add/operator/do"),e("rxjs/add/operator/finally"),e("rxjs/add/operator/last"),e("rxjs/add/operator/map"),e("rxjs/add/operator/publish"),e("rxjs/add/operator/reduce");var a=e("../Edge"),s=e("../Error"),c=e("../Graph"),u=function(){function e(e,t,r,i,s,u){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 o.Subject,this._defaultAlt=2,this._edgeCalculator=null!=i?i:new a.EdgeCalculator,this._filterCreator=null!=s?s:new c.FilterCreator,this._filter=this._filterCreator.createFilter(void 0),this._graphCalculator=null!=r?r:new c.GraphCalculator,this._configuration=null!=u?u:{maxSequences:50,maxUnusedNodes:100,maxUnusedPreStoredNodes:30,maxUnusedTiles:20},this._nodes={},this._nodeIndex=null!=t?t:n(16,[".lat",".lon",".lat",".lon"]),this._nodeIndexTiles={},this._nodeToTile={},this._preStored={},this._requiredNodeTiles={},this._requiredSpatialArea={},this._sequences={},this._tilePrecision=7,this._tileThreshold=20}return Object.defineProperty(e.prototype,"changed$",{get:function(){return this._changed$},enumerable:!0,configurable:!0}),e.prototype.cacheBoundingBox$=function(e,t){var r=this,n=this._graphCalculator.encodeHsFromBoundingBox(e,t).filter(function(e){return!(e in r._cachedTiles)}).map(function(e){return e in r._cachingTiles$?r._cachingTiles$[e]:r._cacheTile$(e)});return 0===n.length&&n.push(i.Observable.of(this)),i.Observable.from(n).mergeAll().last().mergeMap(function(n){for(var o=[],a=[],s=0,c=r._nodeIndex.search({maxX:t.lat,maxY:t.lon,minX:e.lat,minY:e.lon}).map(function(e){return e.node});s0;)h.push(a.splice(0,200));var l=i.Observable.of(o),p=h.map(function(e){return r._apiV3.imageByKeyFill$(e).map(function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n)&&r.hasNode(n)){var i=r.getNode(n);i.full||r._makeFull(i,e[n]),t.push(i)}return t})});return i.Observable.merge(l,i.Observable.from(p).mergeAll())}).reduce(function(e,t){return e.concat(t)})},e.prototype.cacheFill$=function(e){var t=this;if(e in this._cachingFull$)throw new s.GraphMapillaryError("Cannot fill node while caching full ("+e+").");if(!this.hasNode(e))throw new s.GraphMapillaryError("Cannot fill node that does not exist in graph ("+e+").");if(e in this._cachingFill$)return this._cachingFill$[e];var r=this.getNode(e);if(r.full)throw new s.GraphMapillaryError("Cannot fill node that is already full ("+e+").");return this._cachingFill$[e]=this._apiV3.imageByKeyFill$([e]).do(function(n){r.full||t._makeFull(r,n[e]),delete t._cachingFill$[e]}).map(function(e){return t}).finally(function(){e in t._cachingFill$&&delete t._cachingFill$[e],t._changed$.next(t)}).publish().refCount(),this._cachingFill$[e]},e.prototype.cacheFull$=function(e){var t=this;if(e in this._cachingFull$)return this._cachingFull$[e];if(this.hasNode(e))throw new s.GraphMapillaryError("Cannot cache full node that already exist in graph ("+e+").");return this._cachingFull$[e]=this._apiV3.imageByKeyFull$([e]).do(function(r){var n=r[e];if(t.hasNode(e)){(i=t.getNode(e)).full||t._makeFull(i,n)}else{if(null==n.sequence_key)throw new s.GraphMapillaryError("Node has no sequence key ("+e+").");var i=new c.Node(n);t._makeFull(i,n);var o=t._graphCalculator.encodeH(i.originalLatLon,t._tilePrecision);t._preStore(o,i),t._setNode(i),delete t._cachingFull$[e]}}).map(function(e){return t}).finally(function(){e in t._cachingFull$&&delete t._cachingFull$[e],t._changed$.next(t)}).publish().refCount(),this._cachingFull$[e]},e.prototype.cacheNodeSequence$=function(e){if(!this.hasNode(e))throw new s.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 s.GraphMapillaryError("Sequence already cached ("+e+"), ("+t.sequenceKey+").");return this._cacheSequence$(t.sequenceKey)},e.prototype.cacheSequence$=function(e){if(e in this._sequences)throw new s.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 s.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 r=this;if(!this.hasSequence(e))throw new s.GraphMapillaryError("Cannot cache sequence nodes of sequence that does not exist in graph ("+e+").");if(this.hasSequenceNodes(e))throw new s.GraphMapillaryError("Sequence nodes already cached ("+e+").");var n=this.getSequence(e);if(n.key in this._cachingSequenceNodes$)return this._cachingSequenceNodes$[n.key];var o=[],a=n.keys.slice();if(t&&a.length>50){var u=a.indexOf(t),h=Math.max(0,Math.min(u-25,a.length-50));o.push(a.splice(h,50))}for(;a.length>0;)o.push(a.splice(0,200));var l=o.length,p=i.Observable.from(o).mergeMap(function(e){return r._apiV3.imageByKeyFull$(e).do(function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];if(r.hasNode(t)){(i=r.getNode(n.key)).full||r._makeFull(i,n)}else{null==n.sequence_key&&console.warn("Sequence missing, discarding node ("+n.key+")");var i=new c.Node(n);r._makeFull(i,n);var o=r._graphCalculator.encodeH(i.originalLatLon,r._tilePrecision);r._preStore(o,i),r._setNode(i)}}l--}).map(function(e){return r})},6).last().finally(function(){delete r._cachingSequenceNodes$[n.key],0===l&&(r._cachedSequenceNodes[n.key]=!0)}).publish().refCount();return this._cachingSequenceNodes$[n.key]=p,p},e.prototype.cacheSpatialArea$=function(e){var t=this;if(!this.hasNode(e))throw new s.GraphMapillaryError("Cannot cache spatial area of node that does not exist in graph ("+e+").");if(e in this._cachedSpatialEdges)throw new s.GraphMapillaryError("Node already spatially cached ("+e+").");if(!(e in this._requiredSpatialArea))throw new s.GraphMapillaryError("Spatial area not determined ("+e+").");var r=this._requiredSpatialArea[e];if(0===Object.keys(r.cacheNodes).length)throw new s.GraphMapillaryError("Spatial nodes already cached ("+e+").");if(e in this._cachingSpatialArea$)return this._cachingSpatialArea$[e];for(var n=[];r.cacheKeys.length>0;)n.push(r.cacheKeys.splice(0,200));for(var i=n.length,o=[],a=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];t._makeFull(a,s),delete r.cacheNodes[o]}}0==--i&&delete t._cachingSpatialArea$[e]}).map(function(e){return t}).catch(function(o){for(var a=0,s=n;a-1&&r.caching.splice(o,1),0===r.caching.length&&0===r.cache.length&&(delete t._requiredNodeTiles[e],t._cachedNodeTiles[e]=!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 t._requiredNodeTiles[e],t._cachedNodeTiles[e]=!0),i}).finally(function(){t._changed$.next(t)}).publish().refCount())},a=this,c=0,u=r.caching;c0},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 s.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});i0&&(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);e0},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).map(function(t){return e})},e.prototype.cacheImage$=function(e){var t=this;return this._cache.cacheImage$(this.key,e).map(function(e){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=n,r.default=n},{"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/map":67}],400:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Subject"),i=e("rxjs/Observable");e("rxjs/add/observable/combineLatest"),e("rxjs/add/operator/publishReplay");var o=e("../Graph"),a=e("../Utils"),s=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._sequenceEdgesChanged$=new n.Subject,this._sequenceEdges$=this._sequenceEdgesChanged$.startWith(this._sequenceEdges).publishReplay(1).refCount(),this._sequenceEdgesSubscription=this._sequenceEdges$.subscribe(function(){}),this._spatialEdgesChanged$=new n.Subject,this._spatialEdges$=this._spatialEdgesChanged$.startWith(this._spatialEdges).publishReplay(1).refCount(),this._spatialEdgesSubscription=this._spatialEdges$.subscribe(function(){}),this._cachingAssets$=null}return Object.defineProperty(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 o=t?a.Settings.basePanoramaSize:a.Settings.baseImageSize;return this._cachingAssets$=i.Observable.combineLatest(this._cacheImage$(e,o),this._cacheMesh$(e,r),function(e,t){return n._loadStatus.loaded=0,n._loadStatus.total=0,t&&(n._mesh=t.object,n._loadStatus.loaded+=t.loaded.loaded,n._loadStatus.total+=t.loaded.total),e&&(n._image=e.object,n._loadStatus.loaded+=e.loaded.loaded,n._loadStatus.total+=e.loaded.total),n}).finally(function(){n._cachingAssets$=null}).publishReplay(1).refCount(),this._cachingAssets$},e.prototype.cacheImage$=function(e,t){var r=this;return null!=this._image&&t<=Math.max(this._image.width,this._image.height)?i.Observable.of(this):this._cacheImage$(e,t).first(function(e){return null!=e.object}).do(function(e){r._disposeImage(),r._image=e.object}).map(function(e){return r})},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._sequenceEdgesSubscription.unsubscribe(),this._spatialEdgesSubscription.unsubscribe(),this._disposeImage(),this._mesh=null,this._loadStatus.loaded=0,this._loadStatus.total=0,this._sequenceEdges={cached:!1,edges:[]},this._spatialEdges={cached:!1,edges:[]},this._sequenceEdgesChanged$.next(this._sequenceEdges),this._spatialEdgesChanged$.next(this._spatialEdges),this._disposed=!0,null!=this._imageRequest&&this._imageRequest.abort(),null!=this._meshRequest&&this._meshRequest.abort()},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(e,t){var r=this;return i.Observable.create(function(n){var i=new XMLHttpRequest;i.open("GET",a.Urls.thumbnail(e,t,a.Urls.origin),!0),i.responseType="arraybuffer",i.timeout=15e3,i.onload=function(t){if(200!==i.status)return r._imageRequest=null,void n.error(new Error("Failed to fetch image ("+e+"). Status: "+i.status+", "+i.statusText));var o=new Image;o.crossOrigin="Anonymous",o.onload=function(i){if(r._imageRequest=null,r._disposed)return window.URL.revokeObjectURL(o.src),void n.error(new Error("Image load was aborted ("+e+")"));n.next({loaded:{loaded:t.loaded,total:t.total},object:o}),n.complete()},o.onerror=function(t){r._imageRequest=null,n.error(new Error("Failed to load image ("+e+")"))};var a=new Blob([i.response]);o.src=window.URL.createObjectURL(a)},i.onprogress=function(e){r._disposed||n.next({loaded:{loaded:e.loaded,total:e.total},object:null})},i.onerror=function(t){r._imageRequest=null,n.error(new Error("Failed to fetch image ("+e+")"))},i.ontimeout=function(t){r._imageRequest=null,n.error(new Error("Image request timed out ("+e+")"))},i.onabort=function(t){r._imageRequest=null,n.error(new Error("Image request was aborted ("+e+")"))},r._imageRequest=i,i.send(null)})},e.prototype._cacheMesh$=function(e,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(e),!0),s.responseType="arraybuffer",s.timeout=15e3,s.onload=function(e){if(n._meshRequest=null,!n._disposed){var r=200===s.status?o.MeshReader.read(new t(s.response)):{faces:[],vertices:[]};i.next({loaded:{loaded:e.loaded,total:e.total},object:r}),i.complete()}},s.onprogress=function(e){n._disposed||i.next({loaded:{loaded:e.loaded,total:e.total},object:null})},s.onerror=function(t){n._meshRequest=null,console.error("Failed to cache mesh ("+e+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},s.ontimeout=function(t){n._meshRequest=null,console.error("Mesh request timed out ("+e+")"),i.next(n._createEmptyMeshLoadStatus()),i.complete()},s.onabort=function(t){n._meshRequest=null,i.error(new Error("Mesh request was aborted ("+e+")"))},n._meshRequest=s,s.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=s,r.default=s}).call(this,e("buffer").Buffer)},{"../Graph":295,"../Utils":301,buffer:7,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/publishReplay":74}],401:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("underscore"),i=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=n.indexOf(this._keys,e);return t+1>=this._keys.length||-1===t?null:this._keys[t+1]},e.prototype.findPrevKey=function(e){var t=n.indexOf(this._keys,e);return 0===t||-1===t?null:this._keys[t-1]},e}();r.Sequence=i,r.default=i},{underscore:243}],402:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("../../Edge"),o=e("../../Error"),a=e("../../Geo"),s=function(){function e(e,t,r){this._spatial=new a.Spatial,this._geoCoords=new a.GeoCoords,this._settings=null!=e?e:new i.EdgeCalculatorSettings,this._directions=null!=t?t:new i.EdgeCalculatorDirections,this._coefficients=null!=r?r:new i.EdgeCalculatorCoefficients}return e.prototype.getPotentialEdges=function(e,t,r){if(!e.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(!e.merged)return[];for(var i=this._spatial.viewingDirection(e.rotation),a=this._spatial.angleToPlane(i.toArray(),[0,0,1]),s=[],c=0,u=t;cthis._settings.maxDistance&&r.indexOf(h.key)<0)){var f=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])-a,b=this._spatial.relativeRotationAngle(e.rotation,h.rotation),_=this._spatial.angleBetweenVector2(1,0,p.x,p.y),x=null!=h.sequenceKey&&null!=e.sequenceKey&&h.sequenceKey===e.sequenceKey,w=null==h.mergeCC&&null==e.mergeCC||h.mergeCC===e.mergeCC,S=h.userKey===e.userKey,M={capturedAt:h.capturedAt,croppedPano:h.pano&&!h.fullPano,directionChange:g,distance:d,fullPano:h.fullPano,key:h.key,motionChange:f,rotation:b,sameMergeCC:w,sameSequence:x,sameUser:S,sequenceKey:h.sequenceKey,verticalDirectionChange:y,verticalMotion:m,worldMotionAzimuth:_};s.push(M)}}}return s},e.prototype.computeSequenceEdges=function(e,t){if(!e.full)throw new o.ArgumentMapillaryError("Node has to be full.");if(e.sequenceKey!==t.key)throw new o.ArgumentMapillaryError("Node and sequence does not correspond.");var r=[],n=t.findNextKey(e.key);null!=n&&r.push({data:{direction:i.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:e.key,to:n});var a=t.findPrevKey(e.key);return null!=a&&r.push({data:{direction:i.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:e.key,to:a}),r},e.prototype.computeSimilarEdges=function(e,t){var r=this;if(!e.full)throw new o.ArgumentMapillaryError("Node has to be full.");for(var n=e.fullPano,a={},s=0,c=t;sthis._settings.similarMaxDirectionChange)continue;v.distance>this._settings.similarMaxDistance||v.sameUser&&Math.abs(v.capturedAt-e.capturedAt)this._settings.stepMaxDirectionChange)){var f=this._spatial.angleDifference(s.motionChange,d.motionChange),m=this._spatial.angleDifference(d.directionChange,f),v=Math.max(Math.abs(f),Math.abs(m));if(!(Math.abs(v)>this._settings.stepMaxDrift)){var g=d.key;if(!s.useFallback||g!==r&&g!==n||(h=d),!(d.distance>this._settings.stepMaxDistance)){f=Math.sqrt(f*f+d.verticalMotion*d.verticalMotion);var y=this._coefficients.stepPreferredDistance*Math.abs(d.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*f/this._settings.stepMaxDrift+this._coefficients.stepRotation*d.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(d.sameSequence?0:1)+this._coefficients.stepMergeCCPenalty*(d.sameMergeCC?0:1);ythis._settings.turnMaxDistance)){var p=a.direction!==i.EdgeDirection.TurnU&&l.distancethis._settings.turnMinRigDirectionChange,d=this._spatial.angleDifference(a.directionChange,l.directionChange),f=void 0;if(p&&l.directionChange*a.directionChange>0&&Math.abs(l.directionChange)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),f=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)}fthis._settings.panoMaxDistance))if(w.fullPano){if(w.distancethis._settings.panoMaxStepTurnChange)){a.push([h.direction,w]);break}}}}for(var d=Math.PI/this._settings.panoMaxItems,f=[],m=[],v=0;vd)){for(var M=Number.MAX_VALUE,E=0,C=f;Ed)){for(var B=Number.MAX_VALUE,F=0,U=N;F0&&e.elementWidth>0&&e.elementHeight>0}).map(function(e){var t=e.elementWidth/e.elementHeight,r=e.imageAspect/t,n=0,i=0;return e.renderMode===a.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$.filter(function(e){return null!=e.state.currentNode}).distinctUntilChanged(function(e,t){return e===t},function(e){return e.state.currentNode.key}).map(function(e){return e.state.currentTransform.basicAspect}).map(function(e){return function(t){return t.imageAspect=e,t}}).subscribe(this._adaptiveOperation$),this._renderAdaptive$.scan(function(e,t){return null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e},{}).combineLatest(this._offset$).map(function(e){var t=n.values(e[0]),r=e[1],o={style:{bottom:r.bottom+"px",left:r.left+"px","pointer-events":"none",position:"absolute",right:r.right+"px",top:r.top+"px"}};return{name:"adaptiveDomRenderer",vnode:i.h("div.adaptiveDomRenderer",o,t)}}).subscribe(this._render$),this._vNode$=this._render$.scan(function(e,t){return null==t.vnode?delete e[t.name]:e[t.name]=t.vnode,e},{}).map(function(e){var t=n.values(e);return i.h("div.domRenderer",t)}),this._vPatch$=this._vNode$.scan(function(e,t){return e.vpatch=i.diff(e.vnode,t),e.vnode=t,e},{vnode:i.h("div.domRenderer",[]),vpatch:null}).pluck("vpatch"),this._element$=this._vPatch$.scan(function(e,t){return i.patch(e,t)},s).publishReplay(1).refCount(),this._element$.subscribe(function(){}),this._renderService.size$.map(function(e){return function(t){return t.elementWidth=e.width,t.elementHeight=e.height,t}}).subscribe(this._adaptiveOperation$),this._renderService.renderMode$.map(function(e){return function(t){return t.renderMode=e,t}}).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=s,r.default=s},{"../Render":297,"rxjs/Subject":34,"rxjs/add/operator/combineLatest":55,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/pluck":72,"rxjs/add/operator/scan":78,underscore:243,"virtual-dom":247}],408:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground"}(n=r.GLRenderStage||(r.GLRenderStage={})),r.default=n},{}],409:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/combineLatest"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/mergeMap"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/share"),e("rxjs/add/operator/startWith");var a=e("../Render"),s=e("../Utils"),c=function(){function e(e,t,r){var c=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._dom=r||new s.DOM,this._renderer$=this._rendererOperation$.scan(function(e,t){return t(e)},{needsRender:!1,renderer:null}),this._renderCollection$=this._renderOperation$.scan(function(e,t){return t(e)},{}).share(),this._renderCamera$=this._renderCameraOperation$.scan(function(e,t){return t(e)},{frameId:-1,needsRender:!1,perspective:null}),this._eraser$=this._eraserOperation$.startWith(function(e){return e}).scan(function(e,t){return t(e)},{needsRender:!1}),i.Observable.combineLatest([this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$],function(e,t,r,n){return{camera:r,eraser:n,renderer:e,renders:Object.keys(t).map(function(e){return t[e]})}}).filter(function(e){for(var t=e.renderer.needsRender||e.camera.needsRender||e.eraser.needsRender,r=e.camera.frameId,n=0,i=e.renders;nr:e1e-9){var i=t.state.currentTransform,o=null!=t.state.previousTransform?t.state.previousTransform:t.state.currentTransform,a=null!=t.state.previousNode?t.state.previousNode:t.state.currentNode;r.currentAspect=i.basicAspect,r.currentPano=t.state.currentNode.pano,r.previousAspect=o.basicAspect,r.previousPano=a.pano,r.alpha=t.state.alpha,r.zoom=t.state.zoom,r.camera.copy(n),r.updatePerspective(n),r.updateRotation(n),r.updateProjection()}r.frameId=t.id}).map(function(e){return e[1]}).publishReplay(1).refCount(),this._renderCamera$=this._renderCameraFrame$.filter(function(e){return e.changed}).publishReplay(1).refCount(),this._bearing$=this._renderCamera$.map(function(e){var t=s._spatial.radToDeg(s._spatial.azimuthalToBearing(e.rotation.phi));return s._spatial.wrap(t,0,360)}).publishReplay(1).refCount(),this._size$.skip(1).map(function(e){return function(t){return t.updateAspect(e.width,e.height),t.updateProjection(),t}}).subscribe(this._renderCameraOperation$),this._renderMode$.skip(1).map(function(e){return function(t){return t.renderMode=e,t.updateProjection(),t}}).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=s,r.default=s},{"../Geo":294,"../Render":297,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/observable/combineLatest":38,"rxjs/add/operator/do":61,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/publishReplay":74,"rxjs/add/operator/scan":78,"rxjs/add/operator/skip":80,"rxjs/add/operator/startWith":83,"rxjs/add/operator/withLatestFrom":90}],413:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(e){e[e.Traversing=0]="Traversing",e[e.Waiting=1]="Waiting"}(n=r.State||(r.State={})),r.default=n},{}],414:[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.traverse=function(){this._state=this._state.traverse()},e.prototype.wait=function(){this._state=this._state.wait()},Object.defineProperty(e.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(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.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}();r.StateContext=o},{"../Geo":294,"../State":298}],415:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/BehaviorSubject"),i=e("rxjs/Subject"),o=e("rxjs/util/AnimationFrame");e("rxjs/add/operator/bufferCount"),e("rxjs/add/operator/distinctUntilChanged"),e("rxjs/add/operator/do"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/pairwise"),e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/startWith"),e("rxjs/add/operator/switchMap"),e("rxjs/add/operator/withLatestFrom");var a=e("../State"),s=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 n.BehaviorSubject(function(e){return e}),this._context$=this._contextOperation$.scan(function(e,t){return t(e)},new a.StateContext(e)).publishReplay(1).refCount(),this._state$=this._context$.map(function(e){return e.state}).distinctUntilChanged().publishReplay(1).refCount(),this._fps$=this._start$.switchMap(function(){return t._frame$.bufferCount(1,t._fpsSampleRate).map(function(e){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(e,t,r){return[e,t,r]}).filter(function(e){return null!=e[2].currentNode}).do(function(e){e[2].update(e[1])}).map(function(e){return{fps:e[1],id:e[0],state:e[2]}}).share(),this._lastState$=this._currentState$.publishReplay(1).refCount();var r=this._currentState$.distinctUntilChanged(void 0,function(e){return e.state.currentNode.key}).publishReplay(1).refCount(),s=new i.Subject;r.subscribe(s),this._currentKey$=new n.BehaviorSubject(null),s.map(function(e){return e.state.currentNode.key}).subscribe(this._currentKey$),this._currentNode$=s.map(function(e){return e.state.currentNode}).publishReplay(1).refCount(),this._currentCamera$=s.map(function(e){return e.state.currentCamera}).publishReplay(1).refCount(),this._currentTransform$=s.map(function(e){return e.state.currentTransform}).publishReplay(1).refCount(),this._reference$=s.map(function(e){return e.state.reference}).distinctUntilChanged(function(e,t){return e.lat===t.lat&&e.lon===t.lon},function(e){return{lat:e.lat,lon:e.lon}}).publishReplay(1).refCount(),this._currentNodeExternal$=r.map(function(e){return e.state.currentNode}).publishReplay(1).refCount(),this._appendNode$.map(function(e){return function(t){return t.append([e]),t}}).subscribe(this._contextOperation$),this._inMotionOperation$=new i.Subject,r.map(function(e){return!0}).subscribe(this._inMotionOperation$),this._inMotionOperation$.distinctUntilChanged().filter(function(e){return e}).switchMap(function(e){return t._currentState$.filter(function(e){return 0===e.state.nodesAhead}).map(function(e){return[e.state.camera.clone(),e.state.zoom]}).pairwise().map(function(e){var t=e[0][0],r=e[1][0],n=e[0][1],i=e[1][1];return t.diff(r)>1e-5||Math.abs(n-i)>1e-5}).first(function(e){return!e})}).subscribe(this._inMotionOperation$),this._inMotion$=this._inMotionOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._inTranslationOperation$=new i.Subject,r.map(function(e){return!0}).subscribe(this._inTranslationOperation$),this._inTranslationOperation$.distinctUntilChanged().filter(function(e){return e}).switchMap(function(e){return t._currentState$.filter(function(e){return 0===e.state.nodesAhead}).map(function(e){return e.state.camera.position.clone()}).pairwise().map(function(e){return 0!==e[0].distanceToSquared(e[1])}).first(function(e){return!e})}).subscribe(this._inTranslationOperation$),this._inTranslation$=this._inTranslationOperation$.distinctUntilChanged().publishReplay(1).refCount(),this._state$.subscribe(function(){}),this._currentNode$.subscribe(function(){}),this._currentCamera$.subscribe(function(){}),this._currentTransform$.subscribe(function(){}),this._reference$.subscribe(function(){}),this._currentNodeExternal$.subscribe(function(){}),this._lastState$.subscribe(function(){}),this._inMotion$.subscribe(function(){}),this._inTranslation$.subscribe(function(){}),this._frameId=null,this._frameGenerator=new o.RequestAnimationFrameDefinition(window)}return Object.defineProperty(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.traverse=function(){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(e){e.traverse()})},e.prototype.wait=function(){this._invokeContextOperation(function(e){e.wait()})},e.prototype.appendNodes=function(e){this._invokeContextOperation(function(t){t.append(e)})},e.prototype.prependNodes=function(e){this._invokeContextOperation(function(t){t.prepend(e)})},e.prototype.removeNodes=function(e){this._invokeContextOperation(function(t){t.remove(e)})},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(e){this._invokeContextOperation(function(t){t.set(e)})},e.prototype.rotate=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotate(e)})},e.prototype.rotateBasic=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateBasic(e)})},e.prototype.rotateBasicUnbounded=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateBasicUnbounded(e)})},e.prototype.rotateBasicWithoutInertia=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateBasicWithoutInertia(e)})},e.prototype.rotateToBasic=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.rotateToBasic(e)})},e.prototype.move=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.move(e)})},e.prototype.moveTo=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.moveTo(e)})},e.prototype.zoomIn=function(e,t){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(r){r.zoomIn(e,t)})},e.prototype.getCenter=function(){return this._lastState$.first().map(function(e){return e.state.getCenter()})},e.prototype.getZoom=function(){return this._lastState$.first().map(function(e){return e.state.zoom})},e.prototype.setCenter=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.setCenter(e)})},e.prototype.setSpeed=function(e){this._invokeContextOperation(function(t){t.setSpeed(e)})},e.prototype.setTransitionMode=function(e){this._invokeContextOperation(function(t){t.setTransitionMode(e)})},e.prototype.setZoom=function(e){this._inMotionOperation$.next(!0),this._invokeContextOperation(function(t){t.setZoom(e)})},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(e){this._contextOperation$.next(function(t){return e(t),t})},e.prototype._frame=function(e){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.next(this._frameId)},e}();r.StateService=s},{"../State":298,"rxjs/BehaviorSubject":26,"rxjs/Subject":34,"rxjs/add/operator/bufferCount":52,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/do":61,"rxjs/add/operator/filter":63,"rxjs/add/operator/first":65,"rxjs/add/operator/map":67,"rxjs/add/operator/pairwise":71,"rxjs/add/operator/publishReplay":74,"rxjs/add/operator/scan":78,"rxjs/add/operator/startWith":83,"rxjs/add/operator/switchMap":84,"rxjs/add/operator/withLatestFrom":90,"rxjs/util/AnimationFrame":218}],416:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;!function(e){e[e.Default=0]="Default",e[e.Instantaneous=1]="Instantaneous"}(n=r.TransitionMode||(r.TransitionMode={})),r.default=n},{}],417:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../../Error"),i=e("../../Geo"),o=e("../../State"),a=function(){function e(e){this._spatial=new i.Spatial,this._geoCoords=new i.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;t0?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(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 this._trajectoryTransforms.length>0?this._trajectoryTransforms[this.currentIndex]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousTransform",{get:function(){return this._trajectoryTransforms.length>1&&this.currentIndex>0?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.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-10&&this.remove(this._currentIndex-1)},e.prototype.clear=function(){this.cut(),this._currentIndex>0&&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._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=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()},e.prototype._motionlessTransition=function(){return null!=this._currentNode&&null!=this._previousNode&&(this._transitionMode===o.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)0?this._trajectory[this._currentIndex]:null,this._previousNode=this._currentIndex>0?this._trajectory[this._currentIndex-1]:null},e.prototype._setTrajectory=function(e){if(e.length<1)throw new n.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;te?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}(),c=function(e){function t(t){var r=e.call(this,t)||this;return r._adjustCameras(),r._motionless=r._motionlessTransition(),r._baseAlpha=r._alpha,r._animationSpeed=.025,r._speedCoefficient=1,r._unitBezier=new o(.74,.67,.38,.96),r._useBezier=!1,r._rotationDelta=new s(0,0),r._requestedRotationDelta=null,r._basicRotation=[0,0],r._requestedBasicRotation=null,r._requestedBasicRotationUnbounded=null,r._rotationAcceleration=.86,r._rotationIncreaseAlpha=.97,r._rotationDecreaseAlpha=.9,r._rotationThreshold=.001,r._unboundedRotationAlpha=.8,r._desiredZoom=t.zoom,r._minZoom=0,r._maxZoom=3,r._lookatDepth=10,r._desiredLookat=null,r._desiredCenter=null,r}return n(t,e),t.prototype.traverse=function(){throw new Error("Not implemented")},t.prototype.wait=function(){return new a.WaitingState(this)},t.prototype.append=function(t){var r=0===this._trajectory.length;r&&this._resetTransition(),e.prototype.append.call(this,t),r&&(this._setDesiredCenter(),this._setDesiredZoom())},t.prototype.prepend=function(t){var r=0===this._trajectory.length;r&&this._resetTransition(),e.prototype.prepend.call(this,t),r&&(this._setDesiredCenter(),this._setDesiredZoom())},t.prototype.set=function(t){e.prototype.set.call(this,t),this._desiredLookat=null,this._resetTransition(),this._clearRotation(),this._setDesiredCenter(),this._setDesiredZoom(),this._trajectory.length<3&&(this._useBezier=!0)},t.prototype.move=function(e){throw new Error("Not implemented")},t.prototype.moveTo=function(e){throw new Error("Not implemented")},t.prototype.rotate=function(e){null!=this._currentNode&&(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedBasicRotation=null,null!=this._requestedRotationDelta?(this._requestedRotationDelta.phi=this._requestedRotationDelta.phi+e.phi,this._requestedRotationDelta.theta=this._requestedRotationDelta.theta+e.theta):this._requestedRotationDelta=new s(e.phi,e.theta))},t.prototype.rotateBasic=function(e){if(null!=this._currentNode)if(this._desiredZoom=this._zoom,this._desiredLookat=null,this._requestedRotationDelta=null,null!=this._requestedBasicRotation){this._requestedBasicRotation[0]+=e[0],this._requestedBasicRotation[1]+=e[1];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()},t.prototype.rotateBasicUnbounded=function(e){null!=this._currentNode&&(null!=this._requestedBasicRotationUnbounded?(this._requestedBasicRotationUnbounded[0]+=e[0],this._requestedBasicRotationUnbounded[1]+=e[1]):this._requestedBasicRotationUnbounded=e.slice())},t.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)}},t.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)}},t.prototype.setSpeed=function(e){this._speedCoefficient=this._spatial.clamp(e,0,10)},t.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],o=r[1],a=Math.pow(2,this._zoom),s=Math.pow(2,this._desiredZoom),c=t[0],u=t[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))}},t.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 i.Vector3).fromArray(this.currentTransform.unprojectBasic(t,this._lookatDepth)),n=null!=this.previousTransform?this.previousTransform:this.currentTransform,o=(new i.Vector3).fromArray(n.unprojectBasic(t,this._lookatDepth));this._currentCamera.lookat.copy(r),this._previousCamera.lookat.copy(o)}else this._desiredCenter=t},t.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},t.prototype.update=function(e){1===this._alpha&&this._currentIndex+this._alpha0?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))},t.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)}},t.prototype._updateRotation=function(){if(null!=this._requestedRotationDelta){var e=this._rotationDelta.lengthSquared();return this._requestedRotationDelta.lengthSquared()>e?this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationIncreaseAlpha):this._rotationDelta.lerp(this._requestedRotationDelta,this._rotationDecreaseAlpha),void(this._requestedRotationDelta=null)}this._rotationDelta.isZero||(this._rotationDelta.multiply(this._rotationAcceleration),this._rotationDelta.threshold(this._rotationThreshold))},t.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){var r=this._requestedBasicRotationUnbounded[0],n=this._requestedBasicRotationUnbounded[1];if(Math.abs(r)>0&&(this._basicRotation[0]=(1-this._unboundedRotationAlpha)*this._basicRotation[0]+this._unboundedRotationAlpha*r),Math.abs(n)>0&&(this._basicRotation[1]=(1-this._unboundedRotationAlpha)*this._basicRotation[1]+this._unboundedRotationAlpha*n),null!=this._desiredLookat){var o=this.currentTransform.projectBasic(this._desiredLookat.toArray());o[0]+=r,o[1]+=n,this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic(o,this._lookatDepth))}this._requestedBasicRotationUnbounded=null}0===this._basicRotation[0]&&0===this._basicRotation[1]||(this._basicRotation[0]=this._rotationAcceleration*this._basicRotation[0],this._basicRotation[1]=this._rotationAcceleration*this._basicRotation[1],Math.abs(this._basicRotation[0])0||this._basicRotation[1]>0)&&(this._basicRotation=[0,0]))},t.prototype._setDesiredCenter=function(){if(null!=this._desiredCenter){var e=(new i.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}},t.prototype._setDesiredZoom=function(){this._desiredZoom=this._currentNode.fullPano||null==this._previousNode?this._zoom:0},t}(a.StateBase);r.TraversingState=c},{"../../State":298,"@mapbox/unitbezier":2,three:241}],419:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("../../State"),o=function(e){function t(t){var r=e.call(this,t)||this;return r._zoom=0,r._adjustCameras(),r._motionless=r._motionlessTransition(),r}return n(t,e),t.prototype.traverse=function(){return new i.TraversingState(this)},t.prototype.wait=function(){throw new Error("Not implemented")},t.prototype.prepend=function(t){e.prototype.prepend.call(this,t),this._motionless=this._motionlessTransition()},t.prototype.set=function(t){e.prototype.set.call(this,t),this._motionless=this._motionlessTransition()},t.prototype.rotate=function(e){},t.prototype.rotateBasic=function(e){},t.prototype.rotateBasicUnbounded=function(e){},t.prototype.rotateBasicWithoutInertia=function(e){},t.prototype.rotateToBasic=function(e){},t.prototype.setSpeed=function(e){},t.prototype.zoomIn=function(e,t){},t.prototype.move=function(e){this._alpha=Math.max(0,Math.min(1,this._alpha+e))},t.prototype.moveTo=function(e){this._alpha=Math.max(0,Math.min(1,e))},t.prototype.update=function(e){this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},t.prototype.setCenter=function(e){},t.prototype.setZoom=function(e){},t.prototype._getAlpha=function(){return this._motionless?Math.round(this._alpha):this._alpha},t.prototype._setCurrentCamera=function(){e.prototype._setCurrentCamera.call(this),this._adjustCameras()},t.prototype._adjustCameras=function(){if(null!=this._previousNode){if(this._currentNode.fullPano){e=this._camera.lookat.clone().sub(this._camera.position);this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}if(this._previousNode.fullPano){var e=this._currentCamera.lookat.clone().sub(this._currentCamera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position))}}},t}(i.StateBase);r.WaitingState=o},{"../../State":298}],420:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/Observable"),i=function(){function e(e,t,r){this._scheme=e,this._host=t,this._origin=null!=r?"?origin="+r:""}return e.prototype.getTile=function(e,t,r,i,o,a,s){var c="/"+e+"/"+t+","+r+","+i+","+o+"/"+a+","+s+"/0/default.jpg",u=this._scheme+"://"+this._host+c+this._origin,h=null;return[n.Observable.create(function(n){(h=new XMLHttpRequest).open("GET",u,!0),h.responseType="arraybuffer",h.timeout=15e3,h.onload=function(a){if(200===h.status){var s=new Image;s.crossOrigin="Anonymous",s.onload=function(e){n.next(s),n.complete()},s.onerror=function(a){n.error(new Error("Failed to load tile image ("+e+": "+t+","+r+","+i+","+o+")"))};var c=new Blob([h.response]);s.src=window.URL.createObjectURL(c)}else n.error(new Error("Failed to fetch tile ("+e+": "+t+","+r+","+i+","+o+"). Status: "+h.status+", "+h.statusText))},h.onerror=function(a){n.error(new Error("Failed to fetch tile ("+e+": "+t+","+r+","+i+","+o+")"))},h.ontimeout=function(a){n.error(new Error("Tile request timed out ("+e+": "+t+","+r+","+i+","+o+")"))},h.onabort=function(a){n.error(new Error("Tile request was aborted ("+e+": "+t+","+r+","+i+","+o+")"))},h.send(null)}),function(){null!=h&&h.abort()}]},e}();r.ImageTileLoader=i,r.default=i},{"rxjs/Observable":29}],421:[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);et&&(t=i,r=n)}return e[0]+1-e[e.length-1]>t?[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 e>0?1:e<0?-1:0},e}();r.RegionOfInterestCalculator=i,r.default=i},{"../Geo":294}],423:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("rxjs/Subject"),o=function(){function e(e,t,r,n,o,a,s,c){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 i.Subject,this._createdSubject$=new i.Subject,this._created$=this._createdSubject$.publishReplay(1).refCount(),this._createdSubscription=this._created$.subscribe(function(){}),this._hasSubject$=new i.Subject,this._has$=this._hasSubject$.startWith(!1).publishReplay(1).refCount(),this._hasSubscription=this._has$.subscribe(function(){}),this._abortFunctions=[],this._tileSubscriptions={},this._renderedCurrentLevelTiles={},this._renderedTiles={},this._background=o,this._camera=null,this._imageTileLoader=a,this._imageTileStore=s,this._renderer=c,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;tf?1:d/f,v=Math.floor(m*this._width),g=Math.floor(m*this._height);this._renderTarget=new n.WebGLRenderTarget(v,g,{depthBuffer:!1,format:n.RGBFormat,magFilter:n.LinearFilter,minFilter:n.LinearFilter,stencilBuffer:!1}),this._renderToTarget(0,0,this._width,this._height,this._background),this._createdSubject$.next(this._renderTarget.texture),this._hasSubject$.next(!0)}this._fetchTiles(l)}},e.prototype.setTileSize=function(e){this._tileSize=e},e.prototype.updateBackground=function(e){this._background=e},e.prototype._fetchTile=function(e,t,r,n,i,o,a,s){var c=this,u=this._imageTileLoader.getTile(this._key,r,n,i,o,a,s),h=u[0],l=u[1];this._abortFunctions.push(l);var p=this._tileKey(this._tileSize,e),d=h.subscribe(function(a){c._renderToTarget(r,n,i,o,a),c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),c._setTileRendered(e,c._currentLevel),c._imageTileStore.addImage(a,p,t),c._updated$.next(!0)},function(e){c._removeFromDictionary(p,c._tileSubscriptions),c._removeFromArray(l,c._abortFunctions),console.error(e)});d.closed||(this._tileSubscriptions[p]=d)},e.prototype._fetchTiles=function(e){for(var t=this._tileSize*Math.pow(2,this._maxLevel-this._currentLevel),r=0,n=e;rthis._width?this._width-a:t,u=s+t>this._height?this._height-s:t;if(this._imageTileStore.hasImage(o,this._currentLevel))this._renderToTarget(a,s,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,a,s,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 a=[],s=0,c=r;s=h&&v[0]<=l&&v[1]>=p&&v[1]<=d){var g=this._renderedTiles[i].indexOf(v);this._renderedTiles[i].splice(g,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=o,r.default=o},{"rxjs/Subject":34,three:241}],424:[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},{}],425:[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);r>=0&&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];rt&&(t=n)}return t}).startWith(-1).publishReplay(1).refCount(),this._deferPixels$.subscribe(function(){}),this._documentMouseMove$=i.Observable.fromEvent(s,"mousemove"),this._documentMouseUp$=i.Observable.fromEvent(s,"mouseup"),this._mouseDown$=i.Observable.fromEvent(t,"mousedown"),this._mouseLeave$=i.Observable.fromEvent(t,"mouseleave"),this._mouseMove$=i.Observable.fromEvent(t,"mousemove"),this._mouseUp$=i.Observable.fromEvent(t,"mouseup"),this._mouseOut$=i.Observable.fromEvent(t,"mouseout"),this._mouseOver$=i.Observable.fromEvent(t,"mouseover"),this._domMouseDown$=i.Observable.fromEvent(r,"mousedown"),this._domMouseMove$=i.Observable.fromEvent(r,"mousemove"),this._click$=i.Observable.fromEvent(t,"click"),this._contextMenu$=i.Observable.fromEvent(t,"contextmenu"),this._dblClick$=i.Observable.merge(i.Observable.fromEvent(e,"click"),i.Observable.fromEvent(t,"dblclick")).bufferCount(3,1).filter(function(e){var r=e[0],n=e[1],i=e[2];return"click"===r.type&&"click"===n.type&&"dblclick"===i.type&&r.target.parentNode===t&&n.target.parentNode===t}).map(function(e){return e[2]}).share(),i.Observable.merge(this._domMouseDown$,this._domMouseMove$,this._dblClick$,this._contextMenu$).subscribe(function(e){e.preventDefault()}),this._mouseWheel$=i.Observable.merge(i.Observable.fromEvent(t,"wheel"),i.Observable.fromEvent(r,"wheel")).share(),this._consistentContextMenu$=i.Observable.merge(this._mouseDown$,this._mouseMove$,this._mouseOut$,this._mouseUp$,this._contextMenu$).bufferCount(3,1).filter(function(e){return"mousedown"===e[0].type&&"contextmenu"===e[1].type&&"mouseup"===e[2].type}).map(function(e){return e[1]}).share();var h=i.Observable.merge(i.Observable.fromEvent(window,"blur"),this._documentMouseUp$.filter(function(e){return 0===e.button})).share(),l=this._createMouseDragInitiate$(this._mouseDown$,h,!0).share();this._mouseDragStart$=this._createMouseDragStart$(l).share(),this._mouseDrag$=this._createMouseDrag$(l,h).share(),this._mouseDragEnd$=this._createMouseDragEnd$(this._mouseDragStart$,h).share();var p=this._createMouseDragInitiate$(this._domMouseDown$,h,!1).share();this._domMouseDragStart$=this._createMouseDragStart$(p).share(),this._domMouseDrag$=this._createMouseDrag$(p,h).share(),this._domMouseDragEnd$=this._createMouseDragEnd$(this._domMouseDragStart$,h).share(),this._proximateClick$=this._mouseDown$.switchMap(function(e){return u._click$.takeUntil(u._createDeferredMouseMove$(e,u._documentMouseMove$)).take(1)}).share(),this._staticClick$=this._mouseDown$.switchMap(function(e){return u._click$.takeUntil(u._documentMouseMove$).take(1)}).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$).publishReplay(1).refCount(),this._wheelOwner$=this._createOwner$(this._claimWheel$).publishReplay(1).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(e,t){return t.map(function(t){var r=t.clientX-e.clientX,n=t.clientY-e.clientY;return[t,Math.sqrt(r*r+n*n)]}).withLatestFrom(this._deferPixels$).filter(function(e){var t=e[0];t[0];return t[1]>e[1]}).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.map(function(e){e[0];return e[1]}).switchMap(function(e){return i.Observable.of(e).concat(r._documentMouseMove$).takeUntil(t)})},e.prototype._createMouseDragEnd$=function(e,t){return e.switchMap(function(e){return t.first()})},e.prototype._createMouseDragStart$=function(e){return e.map(function(e){var t=e[0];e[1];return t})},e.prototype._createMouseDragInitiate$=function(e,t,r){var n=this;return e.filter(function(e){return 0===e.button}).switchMap(function(e){return i.Observable.combineLatest(i.Observable.of(e),r?n._createDeferredMouseMove$(e,n._documentMouseMove$):n._documentMouseMove$).takeUntil(t).take(1)})},e.prototype._createOwner$=function(e){return e.scan(function(e,t){return null==t.zindex?delete e[t.name]:e[t.name]=t.zindex,e},{}).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}).startWith(null)},e.prototype._filtered=function(e,t,r){return t.withLatestFrom(r).filter(function(t){t[0];return t[1]===e}).map(function(e){var t=e[0];e[1];return t})},e}();r.MouseService=s,r.default=s},{"../Geo":294,"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/fromEvent":43,"rxjs/add/operator/distinctUntilChanged":60,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/merge":68,"rxjs/add/operator/mergeMap":70,"rxjs/add/operator/publishReplay":74,"rxjs/add/operator/scan":78,"rxjs/add/operator/switchMap":84,"rxjs/add/operator/withLatestFrom":90}],437:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/BehaviorSubject"),i=e("rxjs/Observable"),o=e("rxjs/ReplaySubject");e("rxjs/add/observable/throw"),e("rxjs/add/operator/do"),e("rxjs/add/operator/finally"),e("rxjs/add/operator/first"),e("rxjs/add/operator/map"),e("rxjs/add/operator/mergeMap");var a=e("../API"),s=e("../Graph"),c=e("../Edge"),u=e("../Error"),h=e("../State"),l=e("../Viewer"),p=function(){function e(e,t,r,i,o,c,u,p,d,f){this._apiV3=null!=i?i:new a.APIv3(e,r),this._imageLoadingService=null!=c?c:new s.ImageLoadingService,this._graphService=null!=o?o:new s.GraphService(new s.Graph(this.apiV3),this._imageLoadingService),this._loadingService=null!=u?u:new l.LoadingService,this._loadingName="navigator",this._stateService=null!=p?p:new h.StateService(t.transitionMode),this._cacheService=null!=d?d:new l.CacheService(this._graphService,this._stateService),this._playService=null!=f?f:new l.PlayService(this._graphService,this._stateService),this._keyRequested$=new n.BehaviorSubject(null),this._movedToKey$=new n.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(e){var t=this;this._abortRequest("in dir "+c.EdgeDirection[e]),this._loadingService.startLoading(this._loadingName);var r=this.stateService.currentNode$.first().mergeMap(function(t){return([c.EdgeDirection.Next,c.EdgeDirection.Prev].indexOf(e)>-1?t.sequenceEdges$:t.spatialEdges$).first().map(function(t){for(var r=0,n=t.edges;r.54?a.GraphMode.Sequence:a.GraphMode.Spatial}).distinctUntilChanged().subscribe(function(t){e._graphService.setGraphMode(t)}),this._cacheSubscription=this._stateService.currentNode$.map(function(e){return[e.sequenceKey,e.key]}).distinctUntilChanged(void 0,function(e){var t=e[0];e[1];return t}).combineLatest(this._graphService.graphMode$,this._direction$).switchMap(function(t){var r=t[0],i=r[0],s=r[1],c=t[1],u=t[2];if(u!==o.EdgeDirection.Next&&u!==o.EdgeDirection.Prev)return n.Observable.of([void 0,u]);var h=(c===a.GraphMode.Sequence?e._graphService.cacheSequenceNodes$(i,s):e._graphService.cacheSequence$(i)).retry(3).catch(function(e){return console.error(e),n.Observable.of(void 0)});return n.Observable.combineLatest(h,n.Observable.of(u))}).switchMap(function(t){var r=t[0],i=t[1];if(void 0===r)return n.Observable.empty();var a=r.keys.slice();return i===o.EdgeDirection.Prev&&a.reverse(),e._stateService.currentState$.map(function(e){return[e.state.trajectory[e.state.trajectory.length-1].key,e.state.nodesAhead]}).scan(function(t,r){var n=t[0],i=(t[1],r[0]),o=r[1];void 0===n&&(n=i);var s=a.length-1;if(o>=e._nodesAhead||a[s]===n)return[n,[]];var c=a.indexOf(i),u=a.indexOf(n)+1,h=Math.min(s,c+e._nodesAhead-o)+1;return h<=u?[n,[]]:[a[h-1],a.slice(u,h)]},[void 0,[]]).mergeMap(function(e){e[0];var t=e[1];return n.Observable.from(t)})}).mergeMap(function(t){return e._graphService.cacheNode$(t).catch(function(){return n.Observable.empty()})},6).subscribe(),this._playingSubscription=this._stateService.currentState$.filter(function(t){return t.state.nodesAhead=0;i--){var o=r[i];if(o.sequenceKey!==t.sequenceKey)break;if(o.capturedAt!==t.capturedAt){n=o.capturedAt-1?i.sequenceEdges$:i.spatialEdges$).first(function(e){return e.cached}).timeout(15e3).zip(n.Observable.of(s)).map(function(e){for(var t=e[0],r=e[1],n=0,i=t.edges;n-1?t.sequenceEdges$:t.spatialEdges$).first(function(e){return e.cached}).timeout(15e3).catch(function(e){return console.error(e),n.Observable.of({cached:!1,edges:[]})});return n.Observable.combineLatest(n.Observable.of(r),i).map(function(e){for(var t=e[0],r=0,n=e[1].edges;re.capturedAt===t){var u=Math.abs(c.capturedAt-e.capturedAt);u>15e3||(!o||u1||i[1]<0||i[1]>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,i,o){var a=e[0],s=e[1],c=this._viewportCoords.canvasToViewport(a,s,t),u=c[0],h=c[1],l=new n.Vector3(u,h,1).unproject(r.perspective),p=o.projectBasic(l.toArray());(p[0]<0||p[0]>1||p[1]<0||p[1]>1)&&(p=null);var d=l.clone().sub(r.camera.position).normalize(),f=-2/d.z,m=null;if(f>0&&f<100&&p){var v=d.clone().multiplyScalar(f).add(r.camera.position),g=this._geoCoords.enuToGeodetic(v.x,v.y,v.z,i.lat,i.lon,i.alt).slice(0,2);m={lat:g[0],lon:g[1]}}return{basicPoint:p,latLon:m,pixelPoint:[a,s]}},e}();r.Projection=o,r.default=o},{"../Geo":294,three:241}],441:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("three"),i=e("virtual-dom"),o=e("rxjs/Subject");e("rxjs/add/operator/publishReplay"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/startWith");var a=e("../Viewer"),s=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 n.Texture(this._image),this._texture.minFilter=n.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 n.Object3D;var r=this._texture.clone();r.needsUpdate=!0;var i=this._image.width,o=this._image.height;r.offset.x=t.x/i,r.offset.y=(o-t.y-t.height)/o,r.repeat.x=t.width/i,r.repeat.y=t.height/o;var a=new n.SpriteMaterial({map:r});return new n.Sprite(a)},e.prototype.getDOMSprite=function(e,t){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==t&&(t=a.Alignment.Center);var r=this._json[e];if(!r)return console.warn("Sprite with key"+e+"does not exist in sprite definition."),i.h("div",{},[]);var n=r.y,o=r.x+r.width,s=r.y+r.height,c=r.x,u=-r.x,h=-r.y,l=this._image.height,p=this._image.width;switch(t){case a.Alignment.Bottom:case a.Alignment.Center:case a.Alignment.Top:u-=r.width/2;break;case a.Alignment.BottomLeft:case a.Alignment.Left:case a.Alignment.TopLeft:u-=r.width;break;case a.Alignment.BottomRight:case a.Alignment.Right:case a.Alignment.TopRight:}switch(t){case a.Alignment.Center:case a.Alignment.Left:case a.Alignment.Right:h-=r.height/2;break;case a.Alignment.Top:case a.Alignment.TopLeft:case a.Alignment.TopRight:h-=r.height;break;case a.Alignment.Bottom:case a.Alignment.BottomLeft:case a.Alignment.BottomRight:}var d=1/r.pixelRatio;n*=d,o*=d,s*=d,c*=d,u*=d,h*=d,l*=d,p*=d;var f={src:this._image.src,style:{clip:"rect("+n+"px, "+o+"px, "+s+"px, "+c+"px)",height:l+"px",left:u+"px",position:"absolute",top:h+"px",width:p+"px"}};return i.h("img",f,[])},e}(),c=function(){function e(e){var t=this;if(this._retina=window.devicePixelRatio>1,this._spriteAtlasOperation$=new o.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.startWith(function(e){return e}).scan(function(e,t){return t(e)},new s).publishReplay(1).refCount(),this._spriteAtlas$.subscribe(function(){}),null!=e){var r=this._retina?"@2x":"",n=new XMLHttpRequest;n.open("GET",e+r+".png",!0),n.responseType="arraybuffer",n.onload=function(){var e=new Image;e.onload=function(){t._spriteAtlasOperation$.next(function(t){return t.image=e,t})};var r=new Blob([n.response]);e.src=window.URL.createObjectURL(r)},n.onerror=function(t){console.error(new Error("Failed to fetch sprite sheet ("+e+r+".png)"))},n.send();var i=new XMLHttpRequest;i.open("GET",e+r+".json",!0),i.responseType="text",i.onload=function(){var e=JSON.parse(i.response);t._spriteAtlasOperation$.next(function(t){return t.json=e,t})},i.onerror=function(t){console.error(new Error("Failed to fetch sheet ("+e+r+".json)"))},i.send()}}return Object.defineProperty(e.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),e}();r.SpriteService=c,r.default=c},{"../Viewer":302,"rxjs/Subject":34,"rxjs/add/operator/publishReplay":74,"rxjs/add/operator/scan":78,"rxjs/add/operator/startWith":83,three:241,"virtual-dom":247}],442:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("rxjs/BehaviorSubject"),i=e("rxjs/Observable"),o=e("rxjs/Subject");e("rxjs/add/observable/timer"),e("rxjs/add/operator/bufferWhen"),e("rxjs/add/operator/filter"),e("rxjs/add/operator/map"),e("rxjs/add/operator/merge"),e("rxjs/add/operator/scan"),e("rxjs/add/operator/switchMap");var a=function(){function e(e,t){var r=this;this._activeSubject$=new n.BehaviorSubject(!1),this._active$=this._activeSubject$.distinctUntilChanged().publishReplay(1).refCount(),i.Observable.fromEvent(t,"touchmove").subscribe(function(e){e.preventDefault()}),this._touchStart$=i.Observable.fromEvent(e,"touchstart"),this._touchMove$=i.Observable.fromEvent(e,"touchmove"),this._touchEnd$=i.Observable.fromEvent(e,"touchend"),this._touchCancel$=i.Observable.fromEvent(e,"touchcancel");var a=this._touchStart$.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}).share();this._doubleTap$=a.bufferWhen(function(){return a.first().switchMap(function(e){return i.Observable.timer(300).merge(a).take(1)})}).filter(function(e){return 2===e.length}).map(function(e){return e[e.length-1]}).share(),this._doubleTap$.subscribe(function(e){e.preventDefault()}),this._singleTouchMove$=this._touchMove$.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}).share();var s=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}),c=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(e){return e.touches.length>=1}),u=i.Observable.merge(this._touchEnd$,this._touchCancel$).filter(function(e){return 0===e.touches.length});this._singleTouchDragStart$=s.mergeMap(function(e){return r._singleTouchMove$.takeUntil(i.Observable.merge(u,c)).take(1)}),this._singleTouchDragEnd$=s.mergeMap(function(e){return i.Observable.merge(u,c).first()}),this._singleTouchDrag$=s.switchMap(function(e){return r._singleTouchMove$.skip(1).takeUntil(i.Observable.merge(c,u))});var h=i.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$);this._pinchStart$=h.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length}),this._pinchEnd$=h.filter(function(e){return 2!==e.touches.length||2!==e.targetTouches.length}),this._pinchOperation$=new o.Subject,this._pinch$=this._pinchOperation$.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$.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length}).map(function(e){return function(t){var r=e.touches[0],n=e.touches[1],i=Math.min(r.clientX,n.clientX),o=Math.max(r.clientX,n.clientX),a=Math.min(r.clientY,n.clientY),s=i+(o-i)/2,c=a+(Math.max(r.clientY,n.clientY)-a)/2,u=s+r.pageX-r.clientX,h=c+r.pageY-r.clientY,l=s+r.screenX-r.clientX,p=c+r.screenY-r.clientY,d=Math.abs(r.clientX-n.clientX),f=Math.abs(r.clientY-n.clientY),m=Math.sqrt(d*d+f*f),v=m-t.distance;return{changeX:d-t.distanceX,changeY:f-t.distanceY,clientX:s,clientY:c,distance:m,distanceChange:v,distanceX:d,distanceY:f,originalEvent:e,pageX:u,pageY:h,screenX:l,screenY:p,touch1:r,touch2:n}}}).subscribe(this._pinchOperation$),this._pinchChange$=this._pinchStart$.switchMap(function(e){return r._pinch$.skip(1).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=a},{"rxjs/BehaviorSubject":26,"rxjs/Observable":29,"rxjs/Subject":34,"rxjs/add/observable/timer":48,"rxjs/add/operator/bufferWhen":53,"rxjs/add/operator/filter":63,"rxjs/add/operator/map":67,"rxjs/add/operator/merge":68,"rxjs/add/operator/scan":78,"rxjs/add/operator/switchMap":84}],443:[function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var i=e("when"),o=e("rxjs/Observable"),a=e("../Viewer"),s=e("../Utils"),c=function(e){function t(t,r,n,i,o){var c=e.call(this)||this;return i=null!=i?i:{},s.Settings.setOptions(i),s.Urls.setOptions(i.url),c._navigator=new a.Navigator(r,i,o),c._container=new a.Container(t,c._navigator.stateService,i),c._observer=new a.Observer(c,c._navigator,c._container),c._componentController=new a.ComponentController(c._container,c._navigator,c._observer,n,i.component),c}return n(t,e),Object.defineProperty(t.prototype,"isNavigable",{get:function(){return this._componentController.navigable},enumerable:!0,configurable:!0}),t.prototype.activateComponent=function(e){this._componentController.activate(e)},t.prototype.activateCover=function(){this._componentController.activateCover()},t.prototype.deactivateComponent=function(e){this._componentController.deactivate(e)},t.prototype.deactivateCover=function(){this._componentController.deactivateCover()},t.prototype.getBearing=function(){var e=this;return i.promise(function(t,r){e._container.renderService.bearing$.first().subscribe(function(e){t(e)},function(e){r(e)})})},t.prototype.getCenter=function(){var e=this;return i.promise(function(t,r){e._navigator.stateService.getCenter().subscribe(function(e){t(e)},function(e){r(e)})})},t.prototype.getComponent=function(e){return this._componentController.get(e)},t.prototype.getContainer=function(){return this._container.element},t.prototype.getZoom=function(){var e=this;return i.promise(function(t,r){e._navigator.stateService.getZoom().subscribe(function(e){t(e)},function(e){r(e)})})},t.prototype.moveCloseTo=function(e,t){var r=this.isNavigable?this._navigator.moveCloseTo$(e,t):o.Observable.throw(new Error("Calling moveCloseTo is not supported when viewer is not navigable."));return i.promise(function(e,t){r.subscribe(function(t){e(t)},function(e){t(e)})})},t.prototype.moveDir=function(e){var t=this.isNavigable?this._navigator.moveDir$(e):o.Observable.throw(new Error("Calling moveDir is not supported when viewer is not navigable."));return i.promise(function(e,r){t.subscribe(function(t){e(t)},function(e){r(e)})})},t.prototype.moveToKey=function(e){var t=this.isNavigable?this._navigator.moveToKey$(e):o.Observable.throw(new Error("Calling moveToKey is not supported when viewer is not navigable."));return i.promise(function(e,r){t.subscribe(function(t){e(t)},function(e){r(e)})})},t.prototype.projectFromBasic=function(e){var t=this;return i.promise(function(r,n){t._observer.projectBasic$(e).subscribe(function(e){r(e)},function(e){n(e)})})},t.prototype.resize=function(){this._container.renderService.resize$.next(null),this._componentController.resize()},t.prototype.setAuthToken=function(e){var t=this.isNavigable?this._navigator.setToken$(e):o.Observable.throw(new Error("Calling setAuthToken is not supported when viewer is not navigable."));return i.promise(function(e,r){t.subscribe(function(){e(void 0)},function(e){r(e)})})},t.prototype.setCenter=function(e){this._navigator.stateService.setCenter(e)},t.prototype.setFilter=function(e){var t=this;return i.promise(function(r,n){t._navigator.setFilter$(e).subscribe(function(){r(void 0)},function(e){n(e)})})},t.prototype.setRenderMode=function(e){this._container.renderService.renderMode$.next(e)},t.prototype.setTransitionMode=function(e){this._navigator.stateService.setTransitionMode(e)},t.prototype.setZoom=function(e){this._navigator.stateService.setZoom(e)},t.prototype.unproject=function(e){var t=this;return i.promise(function(r,n){t._observer.unproject$(e).subscribe(function(e){r(e)},function(e){n(e)})})},t.prototype.unprojectToBasic=function(e){var t=this;return i.promise(function(r,n){t._observer.unprojectBasic$(e).subscribe(function(e){r(e)},function(e){n(e)})})},t.bearingchanged="bearingchanged",t.click="click",t.contextmenu="contextmenu",t.dblclick="dblclick",t.loadingchanged="loadingchanged",t.mousedown="mousedown",t.mousemove="mousemove",t.mouseout="mouseout",t.mouseover="mouseover",t.mouseup="mouseup",t.moveend="moveend",t.movestart="movestart",t.navigablechanged="navigablechanged",t.nodechanged="nodechanged",t.sequenceedgeschanged="sequenceedgeschanged",t.spatialedgeschanged="spatialedgeschanged",t}(s.EventEmitter);r.Viewer=c},{"../Utils":301,"../Viewer":302,"rxjs/Observable":29,when:288}]},{},[296])(296)});