mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-02 17:33:31 +00:00
40 lines
1.1 MiB
40 lines
1.1 MiB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Mapillary=e()}}(function(){var e;return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var h=n[s]={exports:{}};e[s][0].call(h.exports,function(t){var n=e[s][1][t];return i(n?n:t)},h,h.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){"use strict";function r(){if(u.length)throw u.shift()}function i(e){var t;t=a.length?a.pop():new o,t.task=e,s(t)}function o(){this.task=null}var s=e("./raw"),a=[],u=[],c=s.makeRequestCallFromTimer(r);t.exports=i,o.prototype.call=function(){try{this.task.call()}catch(e){i.onerror?i.onerror(e):(u.push(e),c())}finally{this.task=null,a[a.length]=this}}},{"./raw":2}],2:[function(e,t,n){(function(e){"use strict";function n(e){a.length||(s(),u=!0),a[a.length]=e}function r(){for(;c<a.length;){var e=c;if(c+=1,a[e].call(),c>h){for(var t=0,n=a.length-c;n>t;t++)a[t]=a[t+c];a.length-=c,c=0}}a.length=0,c=0,u=!1}function i(e){var t=1,n=new l(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}function o(e){return function(){function t(){clearTimeout(n),clearInterval(r),e()}var n=setTimeout(t,0),r=setInterval(t,50)}}t.exports=n;var s,a=[],u=!1,c=0,h=1024,l=e.MutationObserver||e.WebKitMutationObserver;s="function"==typeof l?i(r):o(r),n.requestFlush=s,n.makeRequestCallFromTimer=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t,n){"use strict";function r(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;n>t;++t)u[t]=e[t],c[e.charCodeAt(t)]=t;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63}function i(e){var t,n,r,i,o,s,a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new h(3*a/4-o),r=o>0?a-4:a;var u=0;for(t=0,n=0;r>t;t+=4,n+=3)i=c[e.charCodeAt(t)]<<18|c[e.charCodeAt(t+1)]<<12|c[e.charCodeAt(t+2)]<<6|c[e.charCodeAt(t+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function o(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}function s(e,t,n){for(var r,i=[],s=t;n>s;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],i.push(o(r));return i.join("")}function a(e){for(var t,n=e.length,r=n%3,i="",o=[],a=16383,c=0,h=n-r;h>c;c+=a)o.push(s(e,c,c+a>h?h:c+a));return 1===r?(t=e[n-1],i+=u[t>>2],i+=u[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="="),o.push(i),o.join("")}n.toByteArray=i,n.fromByteArray=a;var u=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array;r()},{}],4:[function(e,t,n){},{}],5:[function(e,t,n){t.exports=function(e){var t,n=String.prototype.split,r=/()??/.exec("")[1]===e;return t=function(t,i,o){if("[object RegExp]"!==Object.prototype.toString.call(i))return n.call(t,i,o);var s,a,u,c,h=[],l=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.extended?"x":"")+(i.sticky?"y":""),p=0,i=new RegExp(i.source,l+"g");for(t+="",r||(s=new RegExp("^"+i.source+"$(?!\\s)",l)),o=o===e?-1>>>0:o>>>0;(a=i.exec(t))&&(u=a.index+a[0].length,!(u>p&&(h.push(t.slice(p,a.index)),!r&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===e&&(a[t]=e)}),a.length>1&&a.index<t.length&&Array.prototype.push.apply(h,a.slice(1)),c=a[0].length,p=u,h.length>=o)));)i.lastIndex===a.index&&i.lastIndex++;return p===t.length?!c&&i.test("")||h.push(""):h.push(t.slice(p)),h.length>o?h.slice(0,o):h}}()},{}],6:[function(e,t,n){function r(){h=!1,a.length?c=a.concat(c):l=-1,c.length&&i()}function i(){if(!h){var e=setTimeout(r);h=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,h=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function s(){}var a,u=t.exports={},c=[],h=!1,l=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new o(e,t)),1!==c.length||h||setTimeout(i,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=s,u.addListener=s,u.once=s,u.off=s,u.removeListener=s,u.removeAllListeners=s,u.emit=s,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],7:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}function i(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=s.prototype):(null===e&&(e=new s(t)),e.length=t),e}function s(e,t,n){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return a(this,e,t,n)}function a(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?f(e,t,n,r):"string"==typeof t?l(e,t,n):d(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number')}function c(e,t,n,r){return u(t),0>=t?o(e,t):void 0!==n?"string"==typeof r?o(e,t).fill(n,r):o(e,t).fill(n):o(e,t)}function h(e,t){if(u(t),e=o(e,0>t?0:0|m(t)),!s.TYPED_ARRAY_SUPPORT)for(var n=0;t>n;n++)e[n]=0;return e}function l(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!s.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,n);return e=o(e,r),e.write(t,n),e}function p(e,t){var n=0|m(t.length);e=o(e,n);for(var r=0;n>r;r+=1)e[r]=255&t[r];return e}function f(e,t,n,r){if(t.byteLength,0>n||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),s.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=s.prototype):e=p(e,t),e}function d(e,t){if(s.isBuffer(t)){var n=0|m(t.length);return e=o(e,n),0===e.length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||Y(t.length)?o(e,0):p(e,t);if("Buffer"===t.type&&J(t.data))return p(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function m(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function v(e){return+e!=e&&(e=0),s.alloc(+e)}function g(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return n;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if(n>>>=0,t>>>=0,t>=n)return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return O(this,t,n);case"binary":return L(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function _(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,s=e.length,a=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}for(var u=-1,c=0;s>n+c;c++)if(i(e,n+c)===i(t,-1===u?0:c-u)){if(-1===u&&(u=c),c-u+1===a)return(n+u)*o}else-1!==u&&(c-=c-u),u=-1;return-1}function x(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new Error("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;r>s;s++){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function w(e,t,n,r){return X(H(t,e.length-n),e,n,r)}function S(e,t,n,r){return X($(t),e,n,r)}function M(e,t,n,r){return S(e,t,n,r)}function E(e,t,n,r){return X(q(t),e,n,r)}function C(e,t,n,r){return X(W(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?K.fromByteArray(e):K.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;n>i;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(n>=i+a){var u,c,h,l;switch(a){case 1:128>o&&(s=o);break;case 2:u=e[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=e[i+1],c=e[i+2],128===(192&u)&&128===(192&c)&&(l=(15&o)<<12|(63&u)<<6|63&c,l>2047&&(55296>l||l>57343)&&(s=l));break;case 4:u=e[i+1],c=e[i+2],h=e[i+3],128===(192&u)&&128===(192&c)&&128===(192&h)&&(l=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&h,l>65535&&1114112>l&&(s=l))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return P(r)}function P(e){var t=e.length;if(Q>=t)return String.fromCharCode.apply(String,e);for(var n="",r=0;t>r;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Q));return n}function O(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(127&e[i]);return r}function L(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=t;n>o;o++)i+=z(e[o]);return i}function N(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function D(e,t,n){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,n,r,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||o>t)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function k(e,t,n,r){0>t&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);o>i;i++)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function j(e,t,n,r){0>t&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);o>i;i++)e[n+i]=t>>>8*(r?i:3-i)&255}function F(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(0>n)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return i||F(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,i){return i||F(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function U(e){if(e=G(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function G(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return 16>e?"0"+e.toString(16):e.toString(16)}function H(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],s=0;r>s;s++){if(n=e.charCodeAt(s),n>55295&&57344>n){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(56320>n){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,128>n){if((t-=1)<0)break;o.push(n)}else if(2048>n){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(65536>n){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(1114112>n))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function $(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}function W(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);s++)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function q(e){return K.toByteArray(U(e))}function X(e,t,n,r){for(var i=0;r>i&&!(i+n>=t.length||i>=e.length);i++)t[i+n]=e[i];return i}function Y(e){return e!==e}var K=e("base64-js"),Z=e("ieee754"),J=e("isarray");n.Buffer=s,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),s.poolSize=8192,s._augment=function(e){return e.__proto__=s.prototype,e},s.from=function(e,t,n){return a(null,e,t,n)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(e,t,n){return c(null,e,t,n)},s.allocUnsafe=function(e){return h(null,e)},s.allocUnsafeSlow=function(e){return h(null,e)},s.isBuffer=function(e){return!(null==e||!e._isBuffer)},s.compare=function(e,t){if(!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);o>i;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return r>n?-1:n>r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!J(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;n++){var o=e[n];if(!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},s.byteLength=g,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;e>t;t+=2)_(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;e>t;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},s.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):y.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),0>t||n>e.length||0>r||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,a=n-t,u=Math.min(o,a),c=this.slice(r,i),h=e.slice(t,n),l=0;u>l;++l)if(c[l]!==h[l]){o=c[l],a=h[l];break}return a>o?-1:o>a?1:0},s.prototype.indexOf=function(e,t,n){if("string"==typeof t?(n=t,t=0):t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:b(this,e,t,n);if("number"==typeof e)return s.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):b(this,[e],t,n);throw new TypeError("val must be string, number or Buffer")},s.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},s.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t=0|t,isFinite(n)?(n=0|n,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(0>n||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return S(this,e,t,n);case"binary":return M(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;s.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e);var r;if(s.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=s.prototype;else{var i=t-e;r=new s(i,void 0);for(var o=0;i>o;o++)r[o]=this[o+e]}return r},s.prototype.readUIntLE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},s.prototype.readUIntBE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||D(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),Z.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),Z.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;I(this,e,t,n,i,0)}var o=1,s=0;for(this[t]=255&e;++s<n&&(o*=256);)this[t+s]=e/o&255;return t+n},s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;I(this,e,t,n,i,0)}var o=n-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);I(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)0>e&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);I(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)0>e&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||I(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return V(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&n>r&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&t>n&&r>t)for(i=o-1;i>=0;i--)e[i+t]=this[i+n];else if(1e3>o||!s.TYPED_ARRAY_SUPPORT)for(i=0;o>i;i++)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},s.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);256>i&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e=255&e);if(0>t||this.length<t||this.length<n)throw new RangeError("Out of range index");if(t>=n)return this;t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;n>o;o++)this[o]=e;else{var a=s.isBuffer(e)?e:H(new s(e,r).toString()),u=a.length;for(o=0;n-t>o;o++)this[o+t]=a[o%u]}return this};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":3,ieee754:178,isarray:182}],8:[function(e,t,n){"use strict";function r(e){var t=e[s];return t||(t=e[s]={}),t}var i=e("individual/one-version"),o="7";i("ev-store",o);var s="__EV_STORE_KEY@"+o;t.exports=r},{"individual/one-version":180}],9:[function(e,t,n){"use strict";function r(e,t){var n;for(n in t)e[n]=t[n];return e}function i(e,t){if(this._jsongUrl=e,"number"==typeof t){var n={timeout:t};t=n}this._config=r({timeout:15e3,headers:{}},t||{})}var o=e("./request"),s=e("./buildQueryObject");Array.isArray;i.prototype={constructor:i,buildQueryObject:s,get:function(e){var t="GET",n=this.buildQueryObject(this._jsongUrl,t,{paths:e,method:"get"}),i=r(n,this._config),s=this;return o(t,i,s)},set:function(e){var t="POST",n=this.buildQueryObject(this._jsongUrl,t,{jsonGraph:e,method:"set"}),i=r(n,this._config);i.headers["Content-Type"]="application/x-www-form-urlencoded";var s=this;return o(t,i,s)},call:function(e,t,n,i){t=t||[],n=n||[],i=i||[];var s="POST",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(n))),a.push("paths="+encodeURIComponent(JSON.stringify(i)));var u=this.buildQueryObject(this._jsongUrl,s,a.join("&")),c=r(u,this._config);c.headers["Content-Type"]="application/x-www-form-urlencoded";var h=this;return o(s,c,h)}},i.XMLHttpSource=i,i["default"]=i,t.exports=i},{"./buildQueryObject":10,"./request":13}],10:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r,i=[],o={url:e},s=-1!==e.indexOf("?"),a=s?"&":"?";return"string"==typeof n?i.push(n):(r=Object.keys(n),r.forEach(function(e){var t="object"==typeof n[e]?JSON.stringify(n[e]):n[e];i.push(e+"="+encodeURIComponent(t))})),"GET"===t?o.url+=a+i.join("&"):o.data=i.join("&"),o}},{}],11:[function(e,t,n){(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:{})},{}],12:[function(e,t,n){(function(e){"use strict";t.exports=function(){var t,n,r;if(e.XMLHttpRequest)return new e.XMLHttpRequest;try{for(n=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=0;3>r;r++)try{if(t=n[r],new e.ActiveXObject(t))break}catch(i){}return new e.ActiveXObject(t)}catch(i){throw new Error("XMLHttpRequest is not supported by your browser")}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,n){"use strict";function r(){}function i(e,t,n){return r.create(function(r){var i,o,l,p,f,d={method:e||"GET",crossDomain:!1,async:!0,headers:{},responseType:"json"};for(f in t)h.call(t,f)&&(d[f]=t[f]);d.crossDomain||d.headers["X-Requested-With"]||(d.headers["X-Requested-With"]="XMLHttpRequest"),null!=n.onBeforeRequest&&n.onBeforeRequest(d);try{i=d.crossDomain?c():u()}catch(m){r.onError(m)}try{d.user?i.open(d.method,d.url,d.async,d.user,d.password):i.open(d.method,d.url,d.async),i.timeout=d.timeout,i.withCredentials=d.withCredentials!==!1,l=d.headers;for(p in l)h.call(l,p)&&i.setRequestHeader(p,l[p]);if(d.responseType)try{i.responseType=d.responseType}catch(v){if("json"!==d.responseType)throw v}i.onreadystatechange=function(e){4===i.readyState&&(o||(o=!0,s(r,i,e)))},i.ontimeout=function(e){o||(o=!0,a(r,i,"timeout error",e))},i.send(d.data)}catch(v){r.onError(v)}return function(){o||4===i.readyState||(o=!0,i.abort())}})}function o(e,t,n){n||(n=new Error(t)),e.onError(n)}function s(e,t,n){var r,i;if(t&&e){i=t.responseType,r="response"in t?t.response:t.responseText;var s=1223===t.status?204:t.status;if(s>=200&&399>=s){try{"json"!==i&&(r=JSON.parse(r||"")),"string"==typeof r&&(r=JSON.parse(r||""))}catch(n){o(e,"invalid json",n)}return e.onNext(r),void e.onCompleted()}return 401===s||403===s||407===s?o(e,r):410===s?o(e,r):408===s||504===s?o(e,r):o(e,r||"Response code "+s)}}function a(e,t,n,r){o(e,n||t.statusText||"request error",r)}var u=e("./getXMLHttpRequest"),c=e("./getCORSRequest"),h=Object.prototype.hasOwnProperty,l=function(){};r.create=function(e){var t=new r;return t.subscribe=function(t,n,r){var i,o;return i="function"==typeof t?{onNext:t,onError:n||l,onCompleted:r||l}:t,o=e(i),"function"==typeof o?{dispose:o}:o},t},t.exports=i},{"./getCORSRequest":11,"./getXMLHttpRequest":12}],14:[function(e,t,n){function r(e,t,n){var r=Object.create(null);if(null!=n){for(var i in n)r[i]=n[i];return r.$type=e,r.value=t,r}return{$type:e,value:t}}var i=e("falcor-path-syntax");t.exports={ref:function(e,t){return r("ref",i.fromPath(e),t)},atom:function(e,t){return r("atom",e,t)},undefined:function(){return r("atom")},error:function(e,t){return r("error",e,t)},pathValue:function(e,t){return{path:i.fromPath(e),value:t}},pathInvalidation:function(e){return{path:i.fromPath(e),invalidated:!0}}}},{"falcor-path-syntax":18}],15:[function(e,t,n){t.exports={integers:"integers",ranges:"ranges",keys:"keys"}},{}],16:[function(e,t,n){var r={token:"token",dotSeparator:".",commaSeparator:",",openingBracket:"[",closingBracket:"]",openingBrace:"{",closingBrace:"}",escape:"\\",space:" ",colon:":",quote:"quote",unknown:"unknown"};t.exports=r},{}],17:[function(e,t,n){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,n){if(n)throw e+" -- "+t.parseString+" with next token: "+n;throw e+" -- "+t.parseString}}},{}],18:[function(e,t,n){var r=e("./tokenizer"),i=e("./parse-tree/head"),o=e("./RoutedTokens"),s=function(e,t){return i(new r(e,t))};t.exports=s,s.fromPathsOrPathValues=function(e,t){if(!e)return[];for(var n=[],r=0,i=e.length;i>r;r++)"string"==typeof e[r]?n[r]=s(e[r],t):"string"==typeof e[r].path?n[r]={path:s(e[r].path,t),value:e[r].value}:n[r]=e[r];return n},s.fromPath=function(e,t){return e?"string"==typeof e?s(e,t):e:[]},s.RoutedTokens=o},{"./RoutedTokens":15,"./parse-tree/head":19,"./tokenizer":24}],19:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../exceptions"),o=e("./indexer");t.exports=function(e){for(var t=e.next(),n={},s=[];!t.done;){switch(t.type){case r.token:var a=+t.token[0];isNaN(a)||i.throwError(i.invalidIdentifier,e),s[s.length]=t.token;break;case r.dotSeparator:0===s.length&&i.throwError(i.unexpectedToken,e);break;case r.space:break;case r.openingBracket:o(e,t,n,s);break;default:i.throwError(i.unexpectedToken,e)}t=e.next()}return 0===s.length&&i.throwError(i.invalidPath,e),s}},{"./../TokenTypes":16,"./../exceptions":17,"./indexer":20}],20:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../exceptions"),o=i.indexer,s=e("./range"),a=e("./quote"),u=e("./routed");t.exports=function(e,t,n,c){var h=e.next(),l=!1,p=1,f=!1;for(n.indexer=[];!h.done;){switch(h.type){case r.token:case r.quote:n.indexer.length===p&&i.throwError(o.requiresComma,e)}switch(h.type){case r.openingBrace:f=!0,u(e,h,n,c);
|
||
break;case r.token:var d=+h.token;isNaN(d)&&i.throwError(o.needQuotes,e),n.indexer[n.indexer.length]=d;break;case r.dotSeparator:n.indexer.length||i.throwError(o.leadingDot,e),s(e,h,n,c);break;case r.space:break;case r.closingBracket:l=!0;break;case r.quote:a(e,h,n,c);break;case r.openingBracket:i.throwError(o.nested,e);break;case r.commaSeparator:++p;break;default:i.throwError(i.unexpectedToken,e)}if(l)break;h=e.next()}0===n.indexer.length&&i.throwError(o.empty,e),n.indexer.length>1&&f&&i.throwError(o.routedTokens,e),1===n.indexer.length&&(n.indexer=n.indexer[0]),c[c.length]=n.indexer,n.indexer=void 0}},{"./../TokenTypes":16,"./../exceptions":17,"./quote":21,"./range":22,"./routed":23}],21:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../exceptions"),o=i.quote;t.exports=function(e,t,n,s){for(var a=e.next(),u="",c=t.token,h=!1,l=!1;!a.done;){switch(a.type){case r.token:case r.space:case r.dotSeparator:case r.commaSeparator:case r.openingBracket:case r.closingBracket:case r.openingBrace:case r.closingBrace:h&&i.throwError(o.illegalEscape,e),u+=a.token;break;case r.quote:h?(u+=a.token,h=!1):a.token!==c?u+=a.token:l=!0;break;case r.escape:h=!0;break;default:i.throwError(i.unexpectedToken,e)}if(l)break;a=e.next()}0===u.length&&i.throwError(o.empty,e),n.indexer[n.indexer.length]=u}},{"./../TokenTypes":16,"./../exceptions":17}],22:[function(e,t,n){var r=e("./../tokenizer"),i=e("./../TokenTypes"),o=e("./../exceptions");t.exports=function(e,t,n,s){var a,u=e.peek(),c=1,h=!1,l=!0,p=n.indexer.length-1,f=r.toNumber(n.indexer[p]);for(isNaN(f)&&o.throwError(o.range.precedingNaN,e);!h&&!u.done;){switch(u.type){case i.dotSeparator:3===c&&o.throwError(o.unexpectedToken,e),++c,3===c&&(l=!1);break;case i.token:a=r.toNumber(e.next().token),isNaN(a)&&o.throwError(o.range.suceedingNaN,e),h=!0;break;default:h=!0}if(h)break;e.next(),u=e.peek()}n.indexer[p]={from:f,to:l?a:a-1}}},{"./../TokenTypes":16,"./../exceptions":17,"./../tokenizer":24}],23:[function(e,t,n){var r=e("./../TokenTypes"),i=e("./../RoutedTokens"),o=e("./../exceptions"),s=o.routed;t.exports=function(e,t,n,a){var u=e.next(),c=!1,h="";switch(u.token){case i.integers:case i.ranges:case i.keys:break;default:o.throwError(s.invalid,e)}var l=e.next();if(l.type===r.colon&&(c=!0,l=e.next(),l.type!==r.token&&o.throwError(s.invalid,e),h=l.token,l=e.next()),l.type===r.closingBrace){var p={type:u.token,named:c,name:h};n.indexer[n.indexer.length]=p}else o.throwError(s.invalid,e)}},{"./../RoutedTokens":15,"./../TokenTypes":16,"./../exceptions":17}],24:[function(e,t,n){function r(e,t,n){return{token:e,done:n,type:t}}function i(e,t,n){var i,_=!1,b="",x=n?y:g;do{if(i=t+1>=e.length)break;var w=e[t+1];if(void 0===w||-1!==x.indexOf(w)){if(b.length)break;++t;var S;switch(w){case s:S=o.dotSeparator;break;case a:S=o.commaSeparator;break;case u:S=o.openingBracket;break;case c: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}_=r(w,S,!1);break}b+=w,++t}while(!i);return!_&&b.length&&(_=r(b,o.token,!1)),_||(_={done:!0}),{token:_,idx:t}}var o=e("./../TokenTypes"),s=".",a=",",u="[",c="]",h="{",l="}",p=":",f="\\",d='"',m="'",v=" ",g="\\'\"[]., ",y="\\{}'\"[]., :",_=t.exports=function(e,t){this._string=e,this._idx=-1,this._extended=t,this.parseString=""};_.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}},_.toNumber=function(e){return isNaN(+e)?NaN:+e}},{"./../TokenTypes":16}],25:[function(e,t,n){var r=e("./toPaths"),i=e("./toTree");t.exports=function(e){var t=e.reduce(function(e,t){var n=t.length;return e[n]||(e[n]=[]),e[n].push(t),e},{});return Object.keys(t).forEach(function(e){t[e]=i(t[e])}),r(t)}},{"./toPaths":31,"./toTree":32}],26:[function(e,t,n){var r=e("./iterateKeySet");t.exports=function i(e,t,n){for(var o=e,s=!0;s&&n<t.length;++n){var a=t[n],u=typeof a;if(a&&"object"===u){var c={},h=r(a,c),l=n+1;do{var p=o[h];s=void 0!==p,s&&(s=i(p,t,l)),h=r(a,c)}while(s&&!c.done);break}o=o[a],s=void 0!==o}return s}},{"./iterateKeySet":28}],27:[function(e,t,n){t.exports={iterateKeySet:e("./iterateKeySet"),toTree:e("./toTree"),toTreeWithUnion:e("./toTreeWithUnion"),pathsComplementFromTree:e("./pathsComplementFromTree"),pathsComplementFromLengthTree:e("./pathsComplementFromLengthTree"),hasIntersection:e("./hasIntersection"),toPaths:e("./toPaths"),collapse:e("./collapse")}},{"./collapse":25,"./hasIntersection":26,"./iterateKeySet":28,"./pathsComplementFromLengthTree":29,"./pathsComplementFromTree":30,"./toPaths":31,"./toTree":32,"./toTreeWithUnion":33}],28:[function(e,t,n){function r(e,t){var n=t.from=e.from||0,r=t.to=e.to||"number"==typeof e.length&&t.from+e.length-1||0;t.rangeOffset=t.from,t.loaded=!0,n>r&&(t.empty=!0)}function i(e,t){t.done=!1;var n=t.isObject=!(!e||"object"!=typeof e);t.isArray=n&&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 n;do{t.loaded&&t.rangeOffset>t.to&&(++t.arrayOffset,t.loaded=!1);var o=t.arrayOffset,s=e.length;if(o>=s){t.done=!0;break}var a=e[t.arrayOffset],u=typeof a;if("object"===u){if(t.loaded||r(a,t),t.empty)continue;n=t.rangeOffset++}else++t.arrayOffset,n=a}while(void 0===n);return n}return t.isObject?(t.loaded||r(e,t),t.rangeOffset>t.to?void(t.done=!0):t.rangeOffset++):(t.done=!0,e)}},{}],29:[function(e,t,n){var r=e("./hasIntersection");t.exports=function(e,t){for(var n=[],i=-1,o=0,s=e.length;s>o;++o){var a=e[o];r(t[a.length],a,0)||(n[++i]=a)}return n}},{"./hasIntersection":26}],30:[function(e,t,n){var r=e("./hasIntersection");t.exports=function(e,t){for(var n=[],i=-1,o=0,s=e.length;s>o;++o)r(t,e[o],0)||(n[++i]=e[o]);return n}},{"./hasIntersection":26}],31:[function(e,t,n){function r(e){return null!==e&&typeof e===p}function i(e,t,n){var r,o,s,a,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(a=[],l=-1,n-1>t){for(p=u(e,a);++l<p;)r=a[l],o=i(e[r],t+1,n),s=o.code,w[s]?o=w[s]:(S[E++]=s,o=w[s]={keys:[],sets:o.sets}),x=c(x+r+s),h(r)&&o.keys.push(parseInt(r,10))||o.keys.push(r);for(;++M<E;)if(r=S[M],o=w[r],a=o.keys,p=a.length,p>0)for(f=o.sets,d=-1,m=f.length,_=a[0];++d<m;){for(v=f[d],g=-1,y=v.length,b=new Array(y+1),b[0]=p>1&&a||_;++g<y;)b[g+1]=v[g];C[T++]=b}}else for(p=u(e,a),p>1?C[T++]=[a]:C[T++]=a;++l<p;)x=c(x+a[l]);return{code:x,sets:C}}function o(e){for(var t=-1,n=e.length;++t<n;){var r=e[t];l(r)&&(e[t]=s(r))}return e}function s(e){for(var t=-1,n=e.length-1,r=n>0;++t<=n;){var i=e[t];if(!h(i)){r=!1;break}e[t]=parseInt(i,10)}if(r===!0){e.sort(a);var o=e[0],s=e[n];if(n>=s-o)return{from:o,to:s}}return e}function a(e,t){return e-t}function u(e,t,n){var r=0;for(var i in e)t[r++]=i;return r>1&&t.sort(n),r}function c(e){for(var t=5381,n=-1,r=e.length;++n<r;)t=(t<<5)+t+e.charCodeAt(n);return String(t)}function h(e){return!l(e)&&e-parseFloat(e)+1>=0}var l=Array.isArray,p="object";t.exports=function(e){var t,n=[],s=0;for(var a in e)if(h(a)&&r(t=e[a]))for(var u=i(t,0,parseInt(a,10)).sets,c=-1,l=u.length;++c<l;)n[s++]=o(u[c]);return n}},{}],32:[function(e,t,n){function r(e,t,n){var o,s=t[n],a={},u=n+1;o=i(s,a);do{var c=e[o];c||(u===t.length?e[o]=null:c=e[o]={}),u<t.length&&r(c,t,u),a.done||(o=i(s,a))}while(!a.done)}var i=e("./../lib/iterateKeySet");Array.isArray;t.exports=function(e){return e.reduce(function(e,t){return r(e,t,0),e},{})}},{"./../lib/iterateKeySet":28}],33:[function(e,t,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],34:[function(e,t,n){function r(e){var t=e||{};this._root=t._root||new i(t),this._path=t.path||t._path||[],this._scheduler=t.scheduler||t._scheduler||new f,this._source=t.source||t._source,this._request=t.request||t._request||new s(this,this._scheduler),this._ID=T++,"number"==typeof t.maxSize?this._maxSize=t.maxSize:this._maxSize=t._maxSize||r.prototype._maxSize,"number"==typeof t.collectRatio?this._collectRatio=t.collectRatio:this._collectRatio=t._collectRatio||r.prototype._collectRatio,(t.boxed||t.hasOwnProperty("_boxed"))&&(this._boxed=t.boxed||t._boxed),(t.materialized||t.hasOwnProperty("_materialized"))&&(this._materialized=t.materialized||t._materialized),"boolean"==typeof t.treatErrorsAsValues?this._treatErrorsAsValues=t.treatErrorsAsValues:t.hasOwnProperty("_treatErrorsAsValues")&&(this._treatErrorsAsValues=t._treatErrorsAsValues),t.cache&&this.setCache(t.cache)}var i=e("./ModelRoot"),o=e("./ModelDataSourceAdapter"),s=e("./request/RequestQueueRx"),a=e("./response/ModelResponse"),u=e("./response/SetResponse"),c=e("./response/CallResponse"),h=e("./response/InvalidateResponse"),l=e("./schedulers/ASAPScheduler"),p=e("./schedulers/TimeoutScheduler"),f=e("./schedulers/ImmediateScheduler"),d=e("./support/array-clone"),m=e("./support/array-slice"),v=e("./lru/collect"),g=e("falcor-path-syntax"),y=e("./support/getSize"),_=e("./support/isObject"),b=e("./support/isFunction"),x=e("./support/isPrimitive"),w=e("./support/isJSONEnvelope"),S=e("./support/isJSONGraphEnvelope"),M=e("./set/setPathMaps"),E=e("./set/setJSONGraphs"),C=e("falcor-json-graph"),T=0,A=e("./support/validateInput"),P=function(){},O=e("./get/getCache"),L=e("./get"),R={pathValue:!0,pathSyntax:!0,json:!0,jsonGraph:!0},N=e("./response/get/validInput");t.exports=r,r.ref=C.ref,r.atom=C.atom,r.error=C.error,r.pathValue=C.pathValue,r.prototype.constructor=r,r.prototype._materialized=!1,r.prototype._boxed=!1,r.prototype._progressive=!1,r.prototype._treatErrorsAsValues=!1,r.prototype._maxSize=Math.pow(2,53)-1,r.prototype._collectRatio=.75,r.prototype.get=e("./response/get"),r.prototype._getWithPaths=e("./response/get/getWithPaths"),r.prototype.set=function(){var e=A(arguments,R,"set");return e!==!0?new a(function(t){t.onError(e)}):this._set.apply(this,arguments)},r.prototype.preload=function(){var e=A(arguments,N,"preload");if(e!==!0)return new a(function(t){t.onError(e)});var t=Array.prototype.slice.call(arguments),n=this;return new a(function(e){return n.get.apply(n,t).subscribe(function(){},function(t){e.onError(t)},function(){e.onCompleted()})})},r.prototype._set=function(){var e,t=-1,n=arguments.length,r=arguments[n-1];for(b(r)?n-=1:r=void 0,e=new Array(n);++t<n;)e[t]=arguments[t];return u.create(this,e,r)},r.prototype.call=function(){var e,t=-1,n=arguments.length;for(e=new Array(n);++t<n;){var r=arguments[t];e[t]=r;var i=typeof r;if(t>1&&!Array.isArray(r)||0===t&&!Array.isArray(r)&&"string"!==i||1===t&&!Array.isArray(r)&&!x(r))return new a(function(e){e.onError(new Error("Invalid argument"))})}return c.create(this,e)},r.prototype.invalidate=function(){var e,t=-1,n=arguments.length,r=arguments[n-1];for(e=new Array(n);++t<n;)if(e[t]=g.fromPath(arguments[t]),"object"!=typeof e[t])throw new Error("Invalid argument");h.create(this,e,r).subscribe(P,function(e){throw e})},r.prototype.deref=e("./deref"),r.prototype.getValue=e("./get/getValue"),r.prototype.setValue=e("./set/setValue"),r.prototype._getValueSync=e("./get/sync"),r.prototype._setValueSync=e("./set/sync"),r.prototype._derefSync=e("./deref/sync"),r.prototype.setCache=function(e){var t=this._root.cache;if(e!==t){var n=this._root,r=this._path;this._path=[],this._root.cache={},"undefined"!=typeof t&&v(n,n.expired,y(t),0),S(e)?E(this,[e]):w(e)?M(this,[e]):_(e)&&M(this,[{json:e}]),this._path=r}else"undefined"==typeof t&&(this._root.cache={});return this},r.prototype.getCache=function(){var e=m(arguments);if(0===e.length)return O(this._root.cache);var t=[{}],n=this._path;return L.getWithPathsAsJSONGraph(this,e,t),this._path=n,t[0].jsonGraph},r.prototype.getVersion=function(e){var t=e&&g.fromPath(e)||[];if(Array.isArray(t)===!1)throw new Error("Model#getVersion must be called with an Array path.");return this._path.length&&(t=this._path.concat(t)),this._getVersion(this,t)},r.prototype._syncCheck=function(e){if(Boolean(this._source)&&this._root.syncRefCount<=0&&this._root.unsafeMode===!1)throw new Error("Model#"+e+" may only be called within the context of a request selector.");return!0},r.prototype._clone=function(e){var t=new r(this);for(var n in e){var i=e[n];"delete"===i?delete t[n]:t[n]=i}return t.setCache=void 0,t},r.prototype.batch=function(e){var t=e;"number"==typeof t?t=new p(Math.round(Math.abs(t))):t&&t.schedule||(t=new l);var n=this._clone();return n._request=new s(n,t),n},r.prototype.unbatch=function(){var e=this._clone();return e._request=new s(e,new f),e},r.prototype.treatErrorsAsValues=function(){return this._clone({_treatErrorsAsValues:!0})},r.prototype.asDataSource=function(){return new o(this)},r.prototype._materialize=function(){return this._clone({_materialized:!0})},r.prototype._dematerialize=function(){return this._clone({_materialized:"delete"})},r.prototype.boxValues=function(){return this._clone({_boxed:!0})},r.prototype.unboxValues=function(){return this._clone({_boxed:"delete"})},r.prototype.withoutDataSource=function(){return this._clone({_source:"delete"})},r.prototype.toJSON=function(){return{$type:"ref",value:this._path}},r.prototype.getPath=function(){return d(this._path)},r.prototype._getBoundValue=e("./get/getBoundValue"),r.prototype._getVersion=e("./get/getVersion"),r.prototype._getValueSync=e("./get/getValueSync"),r.prototype._getPathValuesAsPathMap=L.getWithPathsAsPathMap,r.prototype._getPathValuesAsJSONG=L.getWithPathsAsJSONGraph,r.prototype._setPathValuesAsJSON=e("./set/setPathValues"),r.prototype._setPathValuesAsJSONG=e("./set/setPathValues"),r.prototype._setPathValuesAsPathMap=e("./set/setPathValues"),r.prototype._setPathValuesAsValues=e("./set/setPathValues"),r.prototype._setPathMapsAsJSON=e("./set/setPathMaps"),r.prototype._setPathMapsAsJSONG=e("./set/setPathMaps"),r.prototype._setPathMapsAsPathMap=e("./set/setPathMaps"),r.prototype._setPathMapsAsValues=e("./set/setPathMaps"),r.prototype._setJSONGsAsJSON=e("./set/setJSONGraphs"),r.prototype._setJSONGsAsJSONG=e("./set/setJSONGraphs"),r.prototype._setJSONGsAsPathMap=e("./set/setJSONGraphs"),r.prototype._setJSONGsAsValues=e("./set/setJSONGraphs"),r.prototype._setCache=e("./set/setPathMaps"),r.prototype._invalidatePathValuesAsJSON=e("./invalidate/invalidatePathSets"),r.prototype._invalidatePathMapsAsJSON=e("./invalidate/invalidatePathMaps")},{"./ModelDataSourceAdapter":35,"./ModelRoot":36,"./deref":37,"./deref/sync":38,"./get":51,"./get/getBoundValue":45,"./get/getCache":46,"./get/getValue":48,"./get/getValueSync":49,"./get/getVersion":50,"./get/sync":56,"./invalidate/invalidatePathMaps":79,"./invalidate/invalidatePathSets":80,"./lru/collect":81,"./request/RequestQueueRx":87,"./response/CallResponse":93,"./response/InvalidateResponse":95,"./response/ModelResponse":96,"./response/SetResponse":97,"./response/get":103,"./response/get/getWithPaths":102,"./response/get/validInput":104,"./schedulers/ASAPScheduler":105,"./schedulers/ImmediateScheduler":106,"./schedulers/TimeoutScheduler":107,"./set/setJSONGraphs":108,"./set/setPathMaps":109,"./set/setPathValues":110,"./set/setValue":111,"./set/sync":112,"./support/array-clone":113,"./support/array-slice":116,"./support/getSize":120,"./support/isFunction":128,"./support/isJSONEnvelope":130,"./support/isJSONGraphEnvelope":131,"./support/isObject":132,"./support/isPrimitive":134,"./support/validateInput":148,"falcor-json-graph":14,"falcor-path-syntax":18}],35:[function(e,t,n){function r(e){this._model=e._materialize().treatErrorsAsValues()}r.prototype.get=function(e){return this._model.get.apply(this._model,e)._toJSONG()},r.prototype.set=function(e){return this._model.set(e)._toJSONG()},r.prototype.call=function(e,t,n,r){var i=[e,t,n].concat(r);return this._model.call.apply(this._model,i)._toJSONG()},t.exports=r},{}],36:[function(e,t,n){function r(e){var t=e||{};this.syncRefCount=0,this.expired=t.expired||[],this.unsafeMode=t.unsafeMode||!1,this.collectionScheduler=t.collectionScheduler||new s,this.cache={},i(t.comparator)&&(this.comparator=t.comparator),i(t.errorSelector)&&(this.errorSelector=t.errorSelector),i(t.onChange)&&(this.onChange=t.onChange)}var i=e("./support/isFunction"),o=e("./support/hasOwn"),s=e("./schedulers/ImmediateScheduler");r.prototype.errorSelector=function(e,t){return t},r.prototype.comparator=function(e,t){return o(e,"value")&&o(t,"value")?e.value===t.value&&e.$type===t.$type&&e.$expires===t.$expires:e===t},t.exports=r},{"./schedulers/ImmediateScheduler":106,"./support/hasOwn":123,"./support/isFunction":128}],37:[function(e,t,n){function r(e,t){var n,r=!1;try{++e._root.syncRefCount,n=e._derefSync(t)}catch(o){n=o,r=!0}finally{--e._root.syncRefCount}return r?i.Observable["throw"](n):i.Observable["return"](n)}var i=e("rx/dist/rx"),o=e("falcor-path-syntax");t.exports=function(e){for(var t=this,n=-1,s=arguments.length-1,a=new Array(s),u=o.fromPath(e);++n<s;)a[n]=o.fromPath(arguments[n+1]);if(0===s)throw new Error("Model#deref requires at least one value path.");return i.Observable.defer(function(){return r(t,u)}).flatMap(function(e){if(Boolean(e)){if(s>0){var n=i.Observable.of(e);return e.get.apply(e,a)["catch"](i.Observable.empty()).concat(n).last().flatMap(function(){return r(t,u)}).filter(function(e){return e})}return i.Observable["return"](e)}if(s>0){var o=a.map(function(e){return u.concat(e)});return t.get.apply(t,o).concat(i.Observable.defer(function(){return r(t,u)})).last().filter(function(e){return e})}return i.Observable.empty()})}},{"falcor-path-syntax":18,"rx/dist/rx":156}],38:[function(e,t,n){var r=e("falcor-path-syntax"),i=e("./../get/getBoundValue"),o=e("./../errors/InvalidModelError"),s=e("./../types/atom");t.exports=function(e){var t=r.fromPath(e);if(!Array.isArray(t))throw new Error("Model#derefSync must be called with an Array path.");var n=i(this,this._path.concat(t),!1),a=n.path,u=n.value,c=n.found;if(c&&void 0!==u&&(u.$type!==s||void 0!==u.value)){if(u.$type)throw new o;return this._clone({_path:a})}}},{"./../errors/InvalidModelError":40,"./../get/getBoundValue":45,"./../types/atom":150,"falcor-path-syntax":18}],39:[function(e,t,n){function r(){this.message=r.message,this.stack=(new Error).stack}r.prototype=new Error,r.prototype.name="BoundJSONGraphModelError",r.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=r},{}],40:[function(e,t,n){function r(e,t){this.message=o,this.stack=(new Error).stack,this.boundPath=e,this.shortedPath=t}var i="InvalidModelError",o="The boundPath of the model is not valid since a value or error was found before the path end.";r.prototype=new Error,r.prototype.name=i,r.message=o,t.exports=r},{}],41:[function(e,t,n){function r(e){this.message="An exception was thrown when making a request.",this.stack=(new Error).stack,this.innerError=e}var i="InvalidSourceError";r.prototype=new Error,r.prototype.name=i,r.is=function(e){return e&&e.name===i},t.exports=r},{}],42:[function(e,t,n){function r(){this.message="The allowed number of retries have been exceeded.",this.stack=(new Error).stack}var i="MaxRetryExceededError";r.prototype=new Error,r.prototype.name=i,r.is=function(e){return e&&e.name===i},t.exports=r},{}],43:[function(e,t,n){function r(e,t,n,r,i,l,p){for(var f,d,m=n,v=i,g=r,y=0;;){if(0===y&&g[c]?(y=v.length,d=g[c]):(f=v[y++],d=m[f]),d){var _=d.$type,b=_&&d.value||d;if(y<v.length){if(_){m=d;break}m=d;continue}if(m=d,_&&a(d))break;if(g[c]||o(g,d),_===u){p?s(e,d,l,null,null,null,v,v.length,p):h(e,d),y=0,v=b,g=d,m=t;continue}break}m=void 0;break}if(y<v.length&&void 0!==m){for(var x=[],w=0;y>w;w++)x[w]=v[w];v=x}return[m,v]}var i=e("./../get/util/hardlink"),o=i.create,s=e("./../get/onValue"),a=e("./../get/util/isExpired"),u=e("./../types/ref"),c=e("./../internal/context"),h=e("./../get/util/lru").promote;t.exports=r},{"./../get/onValue":54,"./../get/util/hardlink":58,"./../get/util/isExpired":59,"./../get/util/lru":61,"./../internal/context":65,"./../types/ref":152}],44:[function(e,t,n){var r=e("./../get/getCachePosition"),i=e("./../errors/InvalidModelError"),o=e("./../errors/BoundJSONGraphModelError");t.exports=function(e,t){return function(n,s,a){var u,c,h,l=a[0],p={values:a,optimizedPaths:[]},f=n._root.cache,d=n._path,m=f,v=d.length,g=[];if(v){if(t)return{criticalError:new o};if(m=r(n,d),m.$type)return{criticalError:new i(d,d)};for(u=[],c=0;v>c;++c)u[c]=d[c]}else u=[],v=0;for(c=0,h=s.length;h>c;c++)e(n,f,m,s[c],0,l,p,g,u,v,t);return p}}},{"./../errors/BoundJSONGraphModelError":39,"./../errors/InvalidModelError":40,"./../get/getCachePosition":47}],45:[function(e,t,n){var r=e("./../get/getValueSync"),i=e("./../errors/InvalidModelError");t.exports=function(e,t,n){var o,s,a,u,c,h=t,l=t;for(o=e._boxed,n=e._materialized,s=e._treatErrorsAsValues,e._boxed=!0,e._materialized=void 0===n||n,e._treatErrorsAsValues=!0,a=r(e,h.concat(null),!0),e._boxed=o,e._materialized=n,e._treatErrorsAsValues=s,h=a.optimizedPath,u=a.shorted,c=a.found,a=a.value;h.length&&null===h[h.length-1];)h.pop();if(c&&u)throw new i(l,h);return{path:h,value:a,shorted:u,found:c}}},{"./../errors/InvalidModelError":40,"./../get/getValueSync":49}],46:[function(e,t,n){function r(e){var t,n,r,i={},o=Object.keys(e);for(n=0,r=o.length;r>n;n++)t=o[n],s(t)||(i[t]=e[t]);return i}function i(e,t,n){Object.keys(e).filter(function(t){return!s(t)&&e[t]}).forEach(function(n){var s=e[n],a=t[n];if(a||(a=t[n]={}),s.$type){var u,c=s.value&&"object"==typeof s.value,h=!e[o];return u=c||h?r(s):s.value,void(t[n]=u)}i(s,a,n)})}var o=e("./../internal/model-created"),s=e("./../support/isInternalKey");t.exports=function(e){var t={};return i(e,t),t}},{"./../internal/model-created":69,"./../support/isInternalKey":129}],47:[function(e,t,n){t.exports=function(e,t){for(var n=e._root.cache,r=-1,i=t.length;++r<i&&n&&!n.$type;)n=n[t[r]];return n}},{}],48:[function(e,t,n){var r=e("./../response/ModelResponse"),i=e("falcor-path-syntax");t.exports=function(e){for(var t=i.fromPath(e),n=0,o=t.length;++n<o;)if("object"==typeof t[n])return new r(function(e){e.onError(new Error("Paths must be simple paths"))});var s=this;return new r(function(e){return s.get(t).subscribe(function(n){for(var r=n.json,i=-1,o=t.length;r&&++i<o;)r=r[t[i]];e.onNext(r)},function(t){e.onError(t)},function(){e.onCompleted()})})}},{"./../response/ModelResponse":96,"falcor-path-syntax":18}],49:[function(e,t,n){var r=e("./../get/followReference"),i=e("./../get/util/clone"),o=e("./../get/util/isExpired"),s=e("./../get/util/lru").promote,a=e("./../types/ref"),u=e("./../types/atom"),c=e("./../types/error");t.exports=function(e,t,n){for(var h,l,p,f,d,m=e._root.cache,v=t.length,g=[],y=!1,_=!1,b=0,x=m,w=m,S=m,M=!0,E=!1;x&&v>b;){if(h=t[b++],null!==h&&(x=w[h],g[g.length]=h),!x){S=void 0,y=!0,M=!1;break}if(p=x.$type,p===u&&void 0===x.value){S=void 0,M=!1,y=v>b;break}if(v>b){if(p===a){if(o(x)){E=!0,S=void 0,M=!1;break}if(f=r(e,m,m,x,x.value),d=f[0],!d){S=void 0,x=void 0,M=!1;break}p=d.$type,x=d,g=f[1].slice(0)}if(p)break}else S=x;w=x}if(v>b&&!E){for(l=b;v>l;++l)if(null!==t[b]){_=!0;break}for(_?(y=!0,S=void 0):S=x,l=b;v>l;++l)null!==t[l]&&(g[g.length]=t[l])}if(S&&p&&(o(S)?S=void 0:s(e,S)),S&&p===c&&!e._treatErrorsAsValues)throw{path:b===v?t:t.slice(0,b),value:S.value};return S&&e._boxed?S=Boolean(p)&&!n?i(S):S:!S&&e._materialized?S={$type:u}:S&&(S=S.value),{value:S,shorted:y,optimizedPath:g,found:M}}},{"./../get/followReference":43,"./../get/util/clone":57,"./../get/util/isExpired":59,"./../get/util/lru":61,"./../types/atom":150,"./../types/error":151,"./../types/ref":152}],50:[function(e,t,n){var r=e("./../internal/version");t.exports=function(e,t){var n=e._getValueSync({_boxed:!0,_root:e._root,_treatErrorsAsValues:e._treatErrorsAsValues},t,!0).value,i=n&&n[r];return null==i?-1:i}},{"./../internal/version":78}],51:[function(e,t,n){var r=e("./get"),i=e("./walkPath"),o=r(i,!1),s=r(i,!0);t.exports={getValueSync:e("./../get/getValueSync"),getBoundValue:e("./../get/getBoundValue"),getWithPathsAsPathMap:o,getWithPathsAsJSONGraph:s}},{"./../get/getBoundValue":45,"./../get/getValueSync":49,"./get":44,"./walkPath":63}],52:[function(e,t,n){var r=e("./../get/util/lru"),i=e("./../get/util/clone"),o=r.promote;t.exports=function(e,t,n,r,s){var a=t.value;s.errors||(s.errors=[]),e._boxed&&(a=i(t)),s.errors.push({path:r.slice(0,n+1),value:a}),o(e,t)}},{"./../get/util/clone":57,"./../get/util/lru":61}],53:[function(e,t,n){function r(e,t,n,r,i,o,s){s.requestedMissingPaths.push(r.slice(0,n).concat(t)),s.optimizedMissingPaths.push(i.slice(0,o).concat(t))}var i=e("./util/support"),o=i.fastCopy;t.exports=function(e,t,n,i,s,a,u){var c;i.requestedMissingPaths||(i.requestedMissingPaths=[],i.optimizedMissingPaths=[]),c=n<t.length?o(t,n):[],r(e,c,n,s,a,u,i)}},{"./util/support":62}],54:[function(e,t,n){var r=e("./util/lru"),i=e("./util/clone"),o=r.promote,s=e("./../types/ref"),a=e("./../types/atom"),u=e("./../types/error"),c=e("./../internal/model-created");t.exports=function(e,t,n,r,h,l,p,f,d,m){if(n){var v,g,y,_,b,x,w,S,M=!1;if(t&&o(e,t),t&&void 0!==t.value||(M=e._materialized),M)S={$type:a};else if(e._boxed)S=i(t);else if(t.$type===s||t.$type===u)S=d?i(t):t.value;else if(d){var E=t.value&&"object"==typeof t.value,C=!t[c];S=E||C?i(t):t.value}else S=t.value;if(h&&(h.hasValue=!0),d){for(b=n.jsonGraph,b||(b=n.jsonGraph={},n.paths=[]),v=0,g=f-1;g>v;v++)_=p[v],b[_]||(b[_]={}),b=b[_];_=p[v],b[_]=M?{$type:a}:S,l&&n.paths.push(l.slice(0,r))}else if(0===r)n.json=S;else{for(b=n.json,b||(b=n.json={}),v=0;r-1>v;v++)y=l[v],b[y]||(b[y]={}),x=b,w=y,b=b[y];y=l[v],null!==y?b[y]=S:x[w]=S}}}},{"./../internal/model-created":69,"./../types/atom":150,"./../types/error":151,"./../types/ref":152,"./util/clone":57,"./util/lru":61}],55:[function(e,t,n){var r=e("./util/isExpired"),i=e("./util/hardlink"),o=e("./util/lru"),s=i.remove,a=o.splice,u=e("./../types/error"),c=e("./onError"),h=e("./onValue"),l=e("./onMissing"),p=e("./util/isMaterialzed"),f=e("./../internal/invalidated");t.exports=function(e,t,n,i,o,d,m,v,g,y,_){var b=t&&t.$type,x=t&&void 0===t.value;return t&&b?void(r(t)?(t[f]||(a(e,t),s(t)),l(e,n,i,d,m,v,g)):b===u?(_&&(m[i]=null),y||e._treatErrorsAsValues?h(e,t,o,i,d,m,v,g,y,_):c(e,t,i,m,d)):(_&&(m[i]=null),(!x||x&&e._materialized)&&h(e,t,o,i,d,m,v,g,y,_))):void(p(e)?h(e,t,o,i,d,m,v,g,y,_):l(e,n,i,d,m,v,g))}},{"./../internal/invalidated":67,"./../types/error":151,"./onError":52,"./onMissing":53,"./onValue":54,"./util/hardlink":58,"./util/isExpired":59,"./util/isMaterialzed":60,"./util/lru":61}],56:[function(e,t,n){var r=e("falcor-path-syntax");t.exports=function(e){var t=r.fromPath(e);if(Array.isArray(t)===!1)throw new Error("Model#getValueSync must be called with an Array path.");return this._path.length&&(t=this._path.concat(t)),this._syncCheck("getValueSync")&&this._getValueSync(this,t).value}},{"falcor-path-syntax":18}],57:[function(e,t,n){var r=e("./../../internal/prefix");t.exports=function(e){var t,n,i,o=Object.keys(e);for(t={},n=0,i=o.length;i>n;n++){var s=o[n];s[0]!==r&&(t[s]=e[s])}return t}},{"./../../internal/prefix":72}],58:[function(e,t,n){function r(e,t){var n=t[u]||0;t[o+n]=e,t[u]=n+1,e[a]=n,e[s]=t}function i(e){var t=e[s];if(t){for(var n=e[a],r=t[u];r>n;)t[o+n]=t[o+n+1],++n;t[u]=r-1,e[s]=void 0,e[a]=void 0}}var o=e("./../../internal/ref"),s=e("./../../internal/context"),a=e("./../../internal/ref-index"),u=e("./../../internal/refs-length");t.exports={create:r,remove:i}},{"./../../internal/context":65,"./../../internal/ref":75,"./../../internal/ref-index":74,"./../../internal/refs-length":76}],59:[function(e,t,n){var r=e("./../../support/now");t.exports=function(e){var t=void 0===e.$expires&&-1||e.$expires;return-1!==t&&1!==t&&(0===t||t<r())}},{"./../../support/now":138}],60:[function(e,t,n){t.exports=function(e){return e._materialized&&!e._source}},{}],61:[function(e,t,n){function r(e,t){var n=e._root,r=n[o];if(r!==t){var i=t[u],s=t[a];s&&(s[u]=i),i&&(i[a]=s),t[u]=void 0,n[o]=t,t[a]=r,r[u]=t}}function i(e,t){var n=e._root,r=t[u],i=t[a];i&&(i[u]=r),r&&(r[a]=i),t[u]=void 0,t===n[o]&&(n[o]=void 0),t===n[s]&&(n[s]=void 0),t[c]=!0,n.expired.push(t)}var o=e("./../../internal/head"),s=e("./../../internal/tail"),a=e("./../../internal/next"),u=e("./../../internal/prev"),c=e("./../../internal/invalidated");t.exports={promote:r,splice:i}},{"./../../internal/head":66,"./../../internal/invalidated":67,"./../../internal/next":70,"./../../internal/prev":73,"./../../internal/tail":77}],62:[function(e,t,n){function r(e,t){var n,r,i,o=[];for(r=0,i=t||0,n=e.length;n>i;r++,i++)o[r]=e[i];return o}function i(e,t){var n,r,i,o=[];for(n=0,r=e.length;r>n;n++)o[n]=e[n];for(i=0,r=t.length;r>i;i++)null!==t[i]&&(o[n++]=t[i]);return o}function o(e,t){var n,r,i,o=[];for(n=0,r=e.length;r>n;n++)o[n]=e[n];for(i=0,r=t.length;r>i;i++)o[n++]=t[i];return o}t.exports={fastCat:o,fastCatSkipNulls:i,fastCopy:r}},{}],63:[function(e,t,n){var r=e("./followReference"),i=e("./onValueType"),o=e("./util/isExpired"),s=e("falcor-path-utils").iterateKeySet,a=e("./../types/ref"),u=e("./util/lru").promote;t.exports=function c(e,t,n,h,l,p,f,d,m,v,g,y){var _=y,b=m;if(!n||n&&n.$type||l===h.length)return void i(e,n,h,l,p,f,d,b,v,g,_);var x,w;x=h[l];var S="object"==typeof x,M=l+1,E=!1,C=x;if(S&&(E={},C=s(x,E)),void 0!==C||!E.done){var T=v+1;do{_=!1;var A;null===C?A=n:(A=n[C],b[v]=C,d[l]=C);var P=b,O=T;if(A){var L=A.$type,R=L&&A.value||A;if(M<h.length&&L&&L===a&&!o(A)){g&&i(e,A,h,M,p,f,null,b,O,g,_),u(e,A);var N=r(e,t,t,A,R,p,g);_=!0,A=N[0];var D=N[1];for(P=[],O=D.length,w=0;O>w;++w)P[w]=D[w]}}c(e,t,A,h,M,p,f,d,P,O,g,_),E&&!E.done&&(C=s(x,E))}while(E&&!E.done)}}},{"./../types/ref":152,"./followReference":43,"./onValueType":55,"./util/isExpired":59,"./util/lru":61,"falcor-path-utils":27}],64:[function(e,t,n){"use strict";function r(e){return new r.Model(e)}"function"==typeof Promise?r.Promise=Promise:r.Promise=e("promise"),t.exports=r,r.Model=e("./Model")},{"./Model":34,promise:188}],65:[function(e,t,n){t.exports=e("./../internal/prefix")+"context"},{"./../internal/prefix":72}],66:[function(e,t,n){t.exports=e("./../internal/prefix")+"head"},{"./../internal/prefix":72}],67:[function(e,t,n){t.exports=e("./../internal/prefix")+"invalidated"},{"./../internal/prefix":72}],68:[function(e,t,n){t.exports=e("./../internal/prefix")+"key"},{"./../internal/prefix":72}],69:[function(e,t,n){t.exports="$modelCreated"},{}],70:[function(e,t,n){t.exports=e("./../internal/prefix")+"next"},{"./../internal/prefix":72}],71:[function(e,t,n){t.exports=e("./../internal/prefix")+"parent"},{"./../internal/prefix":72}],72:[function(e,t,n){t.exports=String.fromCharCode(30)},{}],73:[function(e,t,n){t.exports=e("./../internal/prefix")+"prev"},{"./../internal/prefix":72}],74:[function(e,t,n){t.exports=e("./../internal/prefix")+"ref-index"},{"./../internal/prefix":72}],75:[function(e,t,n){t.exports=e("./../internal/prefix")+"ref"},{"./../internal/prefix":72}],76:[function(e,t,n){t.exports=e("./../internal/prefix")+"refs-length"},{"./../internal/prefix":72}],77:[function(e,t,n){t.exports=e("./../internal/prefix")+"tail"},{"./../internal/prefix":72}],78:[function(e,t,n){t.exports=e("./../internal/prefix")+"version"},{"./../internal/prefix":72}],79:[function(e,t,n){function r(e,t,n,i,s,a,c,h,l,p){if(!w(e)&&!e.$type)for(var f in e)if(f[0]!==u&&"$"!==f[0]&&y(e,f)){var d=e[f],m=_(d)&&!d.$type,v=o(n,i,s,f,d,m,!1,a,c,h,l,p),b=v[0],x=v[1];b&&(m?r(d,t+1,n,x,b,a,c,h,l,p):C(b,x,f,h)&&E(x,g(b),h,a))}}function i(e,t,n,r,i,s,u,l){if(b(n))return S(n,i,s),[void 0,t];v(s,n);var d=n,m=n.value,g=t;if(n=n[h],null!=n)g=n[c]||t;else{var y=0,_=m.length-1;g=n=t;do{var x=m[y],M=_>y,E=o(t,g,n,x,e,M,!0,r,i,s,u,l);if(n=E[0],w(n))return E;g=E[1]}while(y++<_);if(d[h]!==n){var C=n[f]||0;n[f]=C+1,n[a+C]=d,d[h]=n,d[p]=C}}return[n,g]}function o(e,t,n,r,o,a,u,c,h,l,p,f){for(var m=n.$type;m===d;){var v=i(o,e,n,c,h,l,p,f);if(n=v[0],w(n))return v;t=v[1],m=n&&n.$type}if(void 0!==m)return[n,t];if(null==r){if(a)throw new Error("`null` is not allowed in branch key positions.");n&&(r=n[s])}else t=n,n=t[r];return[n,t];
|
||
}var s=e("./../internal/key"),a=e("./../internal/ref"),u=e("./../internal/prefix"),c=e("./../internal/parent"),h=e("./../internal/context"),l=e("./../internal/version"),p=e("./../internal/ref-index"),f=e("./../internal/refs-length"),d=e("./../types/ref"),m=e("./../get/getBoundValue"),v=e("./../lru/promote"),g=e("./../support/getSize"),y=e("./../support/hasOwn"),_=e("./../support/isObject"),b=e("./../support/isExpired"),x=e("./../support/isFunction"),w=e("./../support/isPrimitive"),S=e("./../support/expireNode"),M=e("./../support/incrementVersion"),E=e("./../support/updateNodeAncestors"),C=e("./../support/removeNodeAndDescendants");t.exports=function(e,t){for(var n=e._root,i=n,o=n.expired,s=M(),a=n._comparator,u=n._errorSelector,h=e._path,p=n.cache,f=h.length?m(e,h).value:p,d=f[c]||p,v=p[l],g=-1,y=t.length;++g<y;){var _=t[g];r(_.json,0,p,d,f,s,o,i,a,u)}var b=p[l],w=n.onChange;x(w)&&v!==b&&w()}},{"./../get/getBoundValue":45,"./../internal/context":65,"./../internal/key":68,"./../internal/parent":71,"./../internal/prefix":72,"./../internal/ref":75,"./../internal/ref-index":74,"./../internal/refs-length":76,"./../internal/version":78,"./../lru/promote":82,"./../support/expireNode":118,"./../support/getSize":120,"./../support/hasOwn":123,"./../support/incrementVersion":124,"./../support/isExpired":127,"./../support/isFunction":128,"./../support/isObject":132,"./../support/isPrimitive":134,"./../support/removeNodeAndDescendants":141,"./../support/updateNodeAncestors":147,"./../types/ref":152}],80:[function(e,t,n){function r(e,t,n,i,s,a,u,c){var h={},l=t<e.length-1,p=e[t],f=x(p,h);do{var d=o(n,i,s,f,l,!1,a,u,c),m=d[0],g=d[1];m&&(l?r(e,t+1,n,g,m,a,u,c):M(m,g,f,c)&&S(g,v(m),c,a)),f=x(p,h)}while(!h.done)}function i(e,t,n,r,i){if(g(t))return b(t,r,i),[void 0,e];m(i,t);var s=t,h=t.value,f=e;if(t=t[c],null!=t)f=t[u]||e;else{var d=0,v=h.length-1;f=t=e;do{var y=h[d],x=v>d,w=o(e,f,t,y,x,!0,n,r,i);if(t=w[0],_(t))return w;f=w[1]}while(d++<v);if(s[c]!==t){var S=t[p]||0;t[p]=S+1,t[a+S]=s,s[c]=t,s[l]=S}}return[t,f]}function o(e,t,n,r,o,a,u,c,h){for(var l=n.$type;l===f;){var p=i(e,n,u,c,h);if(n=p[0],_(n))return p;t=p[1],l=n.$type}if(void 0!==l)return[n,t];if(null==r){if(o)throw new Error("`null` is not allowed in branch key positions.");n&&(r=n[s])}else t=n,n=t[r];return[n,t]}var s=e("./../internal/key"),a=e("./../internal/ref"),u=e("./../internal/parent"),c=e("./../internal/context"),h=e("./../internal/version"),l=e("./../internal/ref-index"),p=e("./../internal/refs-length"),f=e("./../types/ref"),d=e("./../get/getBoundValue"),m=e("./../lru/promote"),v=e("./../support/getSize"),g=e("./../support/isExpired"),y=e("./../support/isFunction"),_=e("./../support/isPrimitive"),b=e("./../support/expireNode"),x=e("falcor-path-utils").iterateKeySet,w=e("./../support/incrementVersion"),S=e("./../support/updateNodeAncestors"),M=e("./../support/removeNodeAndDescendants");t.exports=function(e,t){for(var n=e._root,i=n,o=n.expired,s=w(),a=e._path,c=n.cache,l=a.length?d(e,a).value:c,p=l[u]||c,f=c[h],m=-1,v=t.length;++m<v;){var g=t[m];r(g,0,c,p,l,s,o,i)}var _=c[h],b=n.onChange;y(b)&&f!==_&&b()}},{"./../get/getBoundValue":45,"./../internal/context":65,"./../internal/key":68,"./../internal/parent":71,"./../internal/ref":75,"./../internal/ref-index":74,"./../internal/refs-length":76,"./../internal/version":78,"./../lru/promote":82,"./../support/expireNode":118,"./../support/getSize":120,"./../support/incrementVersion":124,"./../support/isExpired":127,"./../support/isFunction":128,"./../support/isPrimitive":134,"./../support/removeNodeAndDescendants":141,"./../support/updateNodeAncestors":147,"./../types/ref":152,"falcor-path-utils":27}],81:[function(e,t,n){var r=e("./../internal/key"),i=e("./../internal/parent"),o=e("./../internal/head"),s=e("./../internal/tail"),a=e("./../internal/next"),u=e("./../internal/prev"),c=e("./../support/removeNode"),h=e("./../support/updateNodeAncestors");t.exports=function(e,t,n,l,p,f){var d=n,m=p;"number"!=typeof m&&(m=.75);var v,g,y,_="number"==typeof f,b=l*m;for(g=t.pop();g;)y=g.$size||0,d-=y,_===!0?h(g,y,e,f):(v=g[i])&&c(g,v,g[r],e),g=t.pop();if(d>=l){var x=e[s];for(g=x;d>=b&&g;)x=x[u],y=g.$size||0,d-=y,_===!0&&h(g,y,e,f),g=x;e[s]=e[u]=g,null==g?e[o]=e[a]=void 0:g[a]=void 0}}},{"./../internal/head":66,"./../internal/key":68,"./../internal/next":70,"./../internal/parent":71,"./../internal/prev":73,"./../internal/tail":77,"./../support/removeNode":140,"./../support/updateNodeAncestors":147}],82:[function(e,t,n){var r=e("./../values/expires-never"),i=e("./../internal/head"),o=e("./../internal/tail"),s=e("./../internal/next"),a=e("./../internal/prev"),u=e("./../support/isObject");t.exports=function(e,t){if(u(t)&&t.$expires!==r){var n=e[i],c=e[o],h=t[s],l=t[a];t!==n&&(null!=h&&"object"==typeof h&&(h[a]=l),null!=l&&"object"==typeof l&&(l[s]=h),h=n,null!=n&&"object"==typeof n&&(n[a]=t),e[i]=e[s]=n=t,n[s]=h,n[a]=void 0),null!=c&&t!==c||(e[o]=e[a]=c=l||t)}return t}},{"./../internal/head":66,"./../internal/next":70,"./../internal/prev":73,"./../internal/tail":77,"./../support/isObject":132,"./../values/expires-never":153}],83:[function(e,t,n){var r=e("./../internal/head"),i=e("./../internal/tail"),o=e("./../internal/next"),s=e("./../internal/prev");t.exports=function(e,t){var n=e[r],a=e[i],u=t[o],c=t[s];null!=u&&"object"==typeof u&&(u[s]=c),null!=c&&"object"==typeof c&&(c[o]=u),t===n&&(e[r]=e[o]=u),t===a&&(e[i]=e[s]=c),t[o]=t[s]=void 0,n=a=u=c=void 0}},{"./../internal/head":66,"./../internal/next":70,"./../internal/prev":73,"./../internal/tail":77}],84:[function(e,t,n){function r(e,t){var n=!1;return function(){if(!n&&!e._disposed){n=!0,e._callbacks[t]=null,e._optimizedPaths[t]=[],e._requestedPaths[t]=[];var r=--e._count;0!==r||e.sent||(e._disposable.dispose(),e.requestQueue.removeRequest(e))}}}function i(e){for(var t=[],n=-1,r=0,i=e.length;i>r;++r)for(var o=e[r],s=0,a=o.length;a>s;++s)t[++n]=o[s];return t}var o=e("./complement"),s=e("./flushGetRequest"),a=0,u=e("./RequestTypes").GetRequest,c=e("./../set/setJSONGraphs"),h=e("./../set/setPathValues"),l=e("./../types/error"),p=[],f=function(e,t){this.sent=!1,this.scheduled=!1,this.requestQueue=t,this.id=++a,this.type=u,this._scheduler=e,this._pathMap={},this._optimizedPaths=[],this._requestedPaths=[],this._callbacks=[],this._count=0,this._disposable=null,this._collapsed=null,this._disposed=!1};f.prototype={batch:function(e,t,n){var i=this,o=i._optimizedPaths,a=i._requestedPaths,u=i._callbacks,c=o.length;return o[c]=t,a[c]=e,u[c]=n,++i._count,i.scheduled||(i.scheduled=!0,i._disposable=i._scheduler.schedule(function(){s(i,o,function(e,t){if(i.requestQueue.removeRequest(i),i._disposed=!0,i._count){i._merge(a,e,t);for(var n=0,r=u.length;r>n;++n){var o=u[n];o&&o(e,t)}}})})),r(i,c)},add:function(e,t,n){var i,s,a=this,u=o(e,t,a._pathMap);u?(s=u[2],i=u[1]):(s=e,i=t);var c=!1,h=!1;if(i.length<t.length){c=!0;var l=a._callbacks.length;a._callbacks[l]=n,a._requestedPaths[l]=u[0],a._optimizedPaths[l]=[],++a._count,h=r(a,l)}return[c,s,i,h]},_merge:function(e,t,n){var r=this,o=r.requestQueue.model,s=o._root,a=s.errorSelector,u=s.comparator,f=o._path;o._path=p;var d=i(e);if(t){var m=t;m instanceof Error&&(m={message:m.message}),m.$type||(m={$type:l,value:m});var v=d.map(function(e){return{path:e,value:m}});h(o,v,null,a,u)}else c(o,[{paths:d,jsonGraph:n.jsonGraph}],null,a,u);o._path=f}},t.exports=f},{"./../set/setJSONGraphs":108,"./../set/setPathValues":110,"./../types/error":151,"./RequestTypes":89,"./complement":91,"./flushGetRequest":92}],85:[function(e,t,n){function r(){this.length=0,this.pending=!1,this.pathmaps=[],s.call(this,this._subscribe)}var i=e("rx/dist/rx"),o=i.Observer,s=i.Observable,a=i.Disposable,u=i.SerialDisposable,c=i.CompositeDisposable,h=e("./../errors/InvalidSourceError"),l=e("falcor-path-utils"),p=l.iterateKeySet;r.create=function(e,t,n){var r=new this;return r.queue=e,r.model=t,r.index=n,r},r.prototype=Object.create(s.prototype),r.prototype.constructor=r,r.prototype.insertPath=function(e,t,n,r,i){var o=r||0,s=i||e.length-1,a=n||this.pathmaps[s+1]||(this.pathmaps[s+1]=Object.create(null));if(void 0===a||null===a)return!1;var u,c,h=e[o],l={};u=p(h,l);do{if(c=a[u],s>o){if(null==c){if(t)return!1;c=a[u]=Object.create(null)}if(this.insertPath(e,t,c,o+1,s)===!1)return!1}else a[u]=(c||0)+1,this.length+=1;l.done||(u=p(h,l))}while(!l.done);return!0},r.prototype.removePath=function(e,t,n,r){var i=n||0,o=r||e.length-1,s=t||this.pathmaps[o+1];if(void 0===s||null===s)return!0;var a,u,c=0,h=e[i],l={};a=p(h,l);do if(u=s[a],void 0!==u&&null!==u){if(o>i){c+=this.removePath(e,u,i+1,o);var f=void 0;for(f in u)break;void 0===f&&delete s[a]}else u=s[a]=(u||1)-1,0===u&&delete s[a],c+=1,this.length-=1;l.done||(a=p(h,l))}while(!l.done);return c},r.prototype.getSourceObserver=function(e){var t=this;return o.create(function(n){n.jsonGraph=n.jsonGraph||n.jsong||n.values||n.value,n.index=t.index,e.onNext(n)},function(t){e.onError(t)},function(){e.onCompleted()})},r.prototype._subscribe=function(e){var t=this,n=this.queue;t.pending=!0;var r=!1,i=new u,o=a.create(function(){r||(r=!0,n&&n._remove(t))}),s=new c(i,o);try{i.setDisposable(this.model._source[this.method](this.getSourceArgs()).subscribe(this.getSourceObserver(e)))}catch(l){throw new h(l)}return s},t.exports=r},{"./../errors/InvalidSourceError":41,"falcor-path-utils":27,"rx/dist/rx":156}],86:[function(e,t,n){function r(e,t){this.total=0,this.model=e,this.requests=[],this.scheduler=t}var i=e("./../request/SetRequest"),o=e("./../internal/prefix"),s=e("./../support/getType"),a=e("./../support/isObject"),u=e("falcor-path-utils");r.prototype.set=function(e){return e.paths=u.collapse(e.paths),i.create(this.model,e)},r.prototype._remove=function(e){var t=this.requests,n=t.indexOf(e);-1!==n&&t.splice(n,1)},r.prototype.distributePaths=function(e,t,n){var r,i,o=this.model,s=-1,a=e.length,u=-1,c=t.length,h=[];e:for(;++s<a;){var l=e[s];for(u=-1;++u<c;)if(i=t[u],i.insertPath(l,i.pending)){h[u]=i;continue e}r||(r=n.create(this,o,this.total++),t[u]=r,h[c++]=r),r.insertPath(l,!1)}var p=[],f=-1;for(u=-1;++u<c;)i=h[u],null!=i&&(p[++f]=i);return p},r.prototype.mergeJSONGraphs=function(e,t){var n=0,r=[],i=[],u=[],c=e.index,h=t.index;e.index=Math.max(c,h),r[-1]=e.jsonGraph||{},i[-1]=t.jsonGraph||{};e:for(;n>-1;){for(var l=r[n-1],p=i[n-1],f=u[n-1]||(u[n-1]=Object.keys(p));f.length>0;){var d=f.pop();if(d[0]!==o)if(l.hasOwnProperty(d)){var m=l[d],v=s(m),g=p[d],y=s(g);if(a(m)&&a(g)&&!v&&!y){r[n]=m,i[n]=g,n+=1;continue e}h>c&&(l[d]=g)}else l[d]=p[d]}n-=1}return e},t.exports=r},{"./../internal/prefix":72,"./../request/SetRequest":90,"./../support/getType":122,"./../support/isObject":132,"falcor-path-utils":27}],87:[function(e,t,n){function r(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var i=e("./RequestQueue"),o=e("./RequestQueueV2");r.prototype.get=o.prototype.get,r.prototype.removeRequest=o.prototype.removeRequest,r.prototype.set=i.prototype.set,r.prototype.call=i.prototype.call,t.exports=r},{"./RequestQueue":86,"./RequestQueueV2":88}],88:[function(e,t,n){function r(e,t){this.model=e,this.scheduler=t,this.requests=this._requests=[]}var i=e("./RequestTypes"),o=e("./GetRequestV2");r.prototype={setScheduler:function(e){this.scheduler=e},get:function(e,t,n){function r(){m||(--l,0===l&&n())}var s,a,u,c=this,h=[],l=0,p=c._requests,f=t,d=e,m=!1;for(s=0,a=p.length;a>s;++s)if(u=p[s],u.type===i.GetRequest){if(u.sent){var v=u.add(d,f,r);v[0]&&(d=v[1],f=v[2],h[h.length]=v[3],++l)}else u.batch(d,f,r),f=[],d=[],++l;if(!f.length)break}if(f.length){u=new o(c.scheduler,c),p[p.length]=u,++l;var g=u.batch(d,f,r);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,n=t.length;--n>=0;)if(t[n].id===e.id){t.splice(n,1);break}}},t.exports=r},{"./GetRequestV2":84,"./RequestTypes":89}],89:[function(e,t,n){t.exports={GetRequest:"GET"}},{}],90:[function(e,t,n){function r(){s.call(this)}var i=e("rx/dist/rx"),o=i.Observer,s=e("./../request/Request"),a=e("./../support/array-map"),u=e("./../set/setJSONGraphs"),c=e("./../set/setPathValues"),h=new Array(0);r.create=function(e,t){var n=new r;return n.model=e,n.jsonGraphEnvelope=t,n},r.prototype=Object.create(s.prototype),r.prototype.constructor=r,r.prototype.method="set",r.prototype.insertPath=function(){return!1},r.prototype.removePath=function(){return 0},r.prototype.getSourceArgs=function(){return this.jsonGraphEnvelope},r.prototype.getSourceObserver=function(e){var t=this.model,n=t._path,r=this.jsonGraphEnvelope.paths,i=t._root,l=i.errorSelector,p=i.comparator;return s.prototype.getSourceObserver.call(this,o.create(function(i){t._path=h;var o=u(t,[{paths:r,jsonGraph:i.jsonGraph}],null,l,p);i.paths=o[1],t._path=n,e.onNext(i)},function(i){t._path=h,c(t,a(r,function(e){return{path:e,value:i}}),null,l,p),t._path=n,e.onError(i)},function(){e.onCompleted()}))},t.exports=r},{"./../request/Request":85,"./../set/setJSONGraphs":108,"./../set/setPathValues":110,"./../support/array-map":115,"rx/dist/rx":156}],91:[function(e,t,n){var r=e("falcor-path-utils").hasIntersection,i=e("./../support/array-slice");t.exports=function(e,t,n){for(var o=[],s=[],a=[],u=-1,c=-1,h=!1,l=0,p=t.length;p>l;++l){var f=t[l],d=n[f.length];d&&r(d,f,0)?(!h&&l>0&&(s=i(e,0,l),o=i(t,0,l)),a[++u]=e[l],h=!0):h&&(o[++c]=f,s[c]=e[l])}return h?[a,o,s]:null}},{"./../support/array-slice":116,"falcor-path-utils":27}],92:[function(e,t,n){var r=e("falcor-path-utils"),i=r.toTree,o=r.toPaths;t.exports=function(e,t,n){if(0===e._count)return void e.requestQueue.removeRequest(e);e.sent=!0,e.scheduled=!1;for(var r=e._pathMap,s=Object.keys(t),a=0,u=s.length;u>a;++a)for(var c=t[a],h=0,l=c.length;l>h;++h){var p=c[h],f=p.length;if(r[f]){var d=r[f];d[d.length]=p}else r[f]=[p]}for(var m=Object.keys(r),v=0,g=m.length;g>v;++v){var y=m[v];r[y]=i(r[y])}var _,b=e._collasped=o(r);e.requestQueue.model._source.get(b).subscribe(function(e){_=e},function(e){n(e,_)},function(){n(null,_)})}},{"falcor-path-utils":27}],93:[function(e,t,n){function r(e){a.call(this,e||o)}function i(e){return s.Observable.defer(function(){return e})}function o(e){function t(e){function t(e,t){if(Boolean(t.invalidated))e.invalidations.push(e.localThisPath.concat(t.path));else{var n=t.path,r=t.value;Boolean(r)&&"object"==typeof r&&r.$type===p?e.references.push({path:o(n),value:t.value}):e.values.push({path:o(n),value:t.value})}return e}function n(e){var t=e.values.concat(e.references);return t.length>0?i(_.set.apply(_,t)._toJSONG()).map(function(t){return{results:e,envelope:t}}):a["return"]({results:e,envelope:{jsonGraph:{},paths:[]}})}function r(e){var t,n=e.envelope,r=e.results,c=r.values,h=r.references,l=r.invalidations,p=c.map(u).map(o),f=h.reduce(s,[]),d=g.map(o),m=f.concat(d);return t=m.length>0?i(y.get.apply(y,p.concat(m))._toJSONG()):a["return"](n),t.doAction(function(e){e.invalidated=l})}function s(e,t){var n=t.path;return e.push.apply(e,v.map(function(e){return n.concat(e)})),e}function u(e){return e.path}var c=e&&e.localFn;if("function"==typeof c){var h=e.model,l=h._path,f=c.apply(h,m).reduce(t,{values:[],references:[],invalidations:[],localThisPath:l}).flatMap(n).flatMap(r);return a["return"](f)}return a.empty()}function n(e){function t(e){var t=e.invalidated;return t&&t.length&&y.invalidate.apply(y,t),e}return e&&"object"==typeof e?s.Observable.defer(function(){var t;try{t=e.call(x,m,v,g)}catch(n){t=a["throw"](new h(n))}return t}).map(t):a.empty()}function r(e){return i(_.set(e)).reduce(function(e){return e},null).map(function(){return{invalidated:e.invalidated,paths:e.paths.map(function(e){return e.slice(b.length)})}})}function o(e){return w.concat(e)}var c=this.args,f=this.model,d=l.fromPath(c[0]),m=c[1]||[],v=(c[2]||[]).map(l.fromPath),g=(c[3]||[]).map(l.fromPath),y=f._clone({_path:[]}),_=y.withoutDataSource(),b=f._path,x=b.concat(d),w=x.slice(0,-1),S=i(f.withoutDataSource().get(d)).map(function(e){for(var t=e.json,n=-1,r=d.length;t&&++n<r;)t=t[d[n]];var i=y._derefSync(w).boxValues();return{model:i,localFn:t}}).flatMap(t).defaultIfEmpty(n(f._source)).mergeAll().flatMap(r),M=new u;return M.add(S.subscribe(function(t){var n=t.paths,r=t.invalidated,o=f.get.apply(f,n);"AsJSONG"===e.outputFormat&&(o=i(o._toJSONG()).doAction(function(e){e.invalidated=r})),M.add(o.subscribe(e))},function(t){e.onError(t)})),M}var s=e("rx/dist/rx")&&e("rx/dist/rx.aggregates"),a=s.Observable,u=s.CompositeDisposable,c=e("./../response/ModelResponse"),h=e("./../errors/InvalidSourceError"),l=e("falcor-path-syntax"),p=e("./../types/ref");r.create=c.create,r.prototype=Object.create(a.prototype),r.prototype.constructor=r,r.prototype.invokeSourceRequest=function(e){return this},r.prototype.ensureCollect=function(e){return this},r.prototype.initialize=function(){return this},t.exports=r},{"./../errors/InvalidSourceError":41,"./../response/ModelResponse":96,"./../types/ref":152,"falcor-path-syntax":18,"rx/dist/rx":156,"rx/dist/rx.aggregates":155}],94:[function(e,t,n){function r(e){o.call(this,e)}var i=e("rx/dist/rx"),o=i.Observable,s=e("./../response/ModelResponse"),a=e("falcor-path-syntax"),u=e("./../support/getSize"),c=e("./../lru/collect"),h=e("./../support/array-clone"),l=e("./../internal/version"),p=Array.isArray,f=e("./../support/isPathValue"),d=e("./../support/isJSONEnvelope"),m=e("./../support/isJSONGraphEnvelope");r.create=s.create,r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.prototype.subscribeCount=0,r.prototype.subscribeLimit=10,r.prototype.initialize=function(){for(var e,t,n=this.model,r=this.outputFormat||"AsPathMap",i=this.isProgressive,o=[{}],s=[],u=this.args,c=-1,l=u.length;++c<l;){var v,g=u[c];p(g)||"string"==typeof g?(g=a.fromPath(g),v="PathValues"):f(g)?(g.path=a.fromPath(g.path),v="PathValues"):m(g)?v="JSONGs":d(g)&&(v="PathMaps"),t!==v&&(t=v,e={inputType:v,arguments:[]},s.push(e),e.values=o),e.arguments.push(g)}return this.boundPath=h(n._path),this.groups=s,this.outputFormat=r,this.isProgressive=i,this.isCompleted=!1,this.isMaster=null==n._source,this.values=o,this},r.prototype.invokeSourceRequest=function(e){return this},r.prototype.ensureCollect=function(e){var t=this["finally"](function(){var t=e._root,n=t.cache;t.collectionScheduler.schedule(function(){c(t,t.expired,u(n),e._maxSize,e._collectRatio,n[l])})});return new this.constructor(function(e){return t.subscribe(e)})},t.exports=r},{"./../internal/version":78,"./../lru/collect":81,"./../response/ModelResponse":96,"./../support/array-clone":113,"./../support/getSize":120,"./../support/isJSONEnvelope":130,"./../support/isJSONGraphEnvelope":131,"./../support/isPathValue":133,"falcor-path-syntax":18,"rx/dist/rx":156}],95:[function(e,t,n){function r(e){a.call(this,e||i)}function i(e){for(var t=this.model,n=this.method,r=this.groups,i=-1,o=r.length;++i<o;){var a=r[i],u=a.inputType,c=a.arguments;if(c.length>0){var h="_"+n+u+"AsJSON",l=t[h];l(t,c)}}return e.onCompleted(),s.empty}var o=e("rx/dist/rx"),s=o.Disposable,a=e("./../response/IdempotentResponse");r.create=a.create,r.prototype=Object.create(a.prototype),r.prototype.method="invalidate",r.prototype.constructor=r,t.exports=r},{"./../response/IdempotentResponse":94,"rx/dist/rx":156}],96:[function(e,t,n){function r(e){this._subscribe=e}function i(e){var t=this.model,n=new this.type;return n.model=t,n.args=this.args,n.outputFormat=e.outputFormat||"AsPathMap",n.isProgressive=e.isProgressive||!1,n.subscribeCount=0,n.subscribeLimit=e.retryLimit||10,n.initialize().invokeSourceRequest(t).ensureCollect(t).subscribe(e)}var o=e("./../"),s=e("rx/dist/rx")&&e("rx/dist/rx.aggregates"),a=s.Observable,u=e("./../support/array-slice"),c=e("./../support/noop"),h={outputFormat:{value:"AsJSONG"}},l={isProgressive:{value:!0}};r.create=function(e,t){var n=new r(i);return n.args=t,n.type=this,n.model=e,n},r.prototype=Object.create(a.prototype),r.prototype.constructor=r,r.prototype._mixin=function(){var e=this,t=u(arguments);return new e.constructor(function(n){return e.subscribe(t.reduce(function(e,t){return Object.create(e,t)},n))})},r.prototype._toJSONG=function(){return this._mixin(h)},r.prototype.progressively=function(){return this._mixin(l)},r.prototype.subscribe=function(e,t,n){var r=e;r&&"object"==typeof r||(r={onNext:e||c,onError:t||c,onCompleted:n||c});var i=this._subscribe(r);switch(typeof i){case"function":return{dispose:i};case"object":return i||{dispose:c};default:return{dispose:c}}},r.prototype.then=function(e,t){var n=this;return new o.Promise(function(e,t){var r,i=!1;n.toArray().subscribe(function(e){r=e.length<=1?e[0]:e},function(e){i=!0,t(e)},function(){i===!1&&e(r)})}).then(e,t)},t.exports=r},{"./../":64,"./../support/array-slice":116,"./../support/noop":137,"rx/dist/rx":156,"rx/dist/rx.aggregates":155}],97:[function(e,t,n){function r(e){f.call(this,e||i)}function i(e){return this.isCompleted?s.call(this,e):o.call(this,e)}function o(e){if(this.subscribeCount++>this.subscribeLimit)return e.onError("Loop kill switch thrown."),l.empty;for(var t=[],n=[],r=this.model,i=this.isMaster,o=r._root,c=this.outputFormat,h=o.errorSelector,p=this.method,f=this.groups,d=-1,v=f.length;++d<v;){var g=f[d],y=g.inputType,_=g.arguments;if(_.length>0){var b="_"+p+y+c,x=r[b],w=x(r,_,null,h);n.push.apply(n,w[1]),"PathValues"===y?t.push.apply(t,_.map(a)):"JSONGs"===y?t.push.apply(t,m(_,u)):t.push.apply(t,w[0])}}return this.requestedPaths=t,i?(this.isCompleted=!0,s.call(this,e)):void e.onError({method:p,optimizedPaths:n,invokeSourceRequest:!0})}function s(e){var t=new p(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 u(e){return e.paths}var c=e("rx/dist/rx"),h=c.Observable,l=c.Disposable,p=e("./get/GetResponse"),f=e("./../response/IdempotentResponse"),d=e("./../errors/InvalidSourceError"),m=e("./../support/array-flat-map"),v=new Array(0);r.create=f.create,r.prototype=Object.create(f.prototype),r.prototype.method="set",r.prototype.constructor=r,r.prototype.invokeSourceRequest=function(e){var t=this,n=this["catch"](function(r){var i;if(r&&r.invokeSourceRequest===!0){var o={},s=e._path,a=r.optimizedPaths;e._path=v,e._getPathValuesAsJSONG(e._materialize().withoutDataSource(),a,[o]),e._path=s,i=e._request.set(o)["do"](function(e){t.isCompleted=a.length===e.paths.length},function(){t.isCompleted=!0}).materialize().flatMap(function(e){if("C"===e.kind)return h.empty();if("E"===e.kind){var t=e.exception;if(d.is(t))return h["throw"](e.exception)}return n})}else i=h["throw"](r);return i});return new this.constructor(function(e){return n.subscribe(e)})},t.exports=r},{"./../errors/InvalidSourceError":41,"./../response/IdempotentResponse":94,"./../support/array-flat-map":114,"./get/GetResponse":99,"rx/dist/rx":156}],98:[function(e,t,n){var r=function(e){this.disposed=!1,this.currentDisposable=e};r.prototype={dispose:function(){if(!this.disposed&&this.currentDisposable){this.disposed=!0;var e=this.currentDisposable;e.dispose?e.dispose():e()}}},t.exports=r},{}],99:[function(e,t,n){var r=e("./../ModelResponse"),i=e("./checkCacheAndReport"),o=e("./getRequestCycle"),s={dispose:function(){}},a=e("rx/dist/rx").Observable,u=t.exports=function(e,t,n,r){this.model=e,this.currentRemainingPaths=t,this.isJSONGraph=n||!1,this.isProgressive=r||!1};u.prototype=Object.create(a.prototype),u.prototype.subscribe=r.prototype.subscribe,u.prototype.then=r.prototype.then,u.prototype._toJSONG=function(){return new u(this.model,this.currentRemainingPaths,!0,this.isProgressive)},u.prototype.progressively=function(){return new u(this.model,this.currentRemainingPaths,this.isJSONGraph,!0)},u.prototype._subscribe=function(e){var t=[{}],n=[],r=e.isJSONG=this.isJSONGraph,a=this.isProgressive,u=i(this.model,this.currentRemainingPaths,e,a,r,t,n);return u?o(this,this.model,u,e,t,n,1):s}},{"./../ModelResponse":96,"./checkCacheAndReport":100,"./getRequestCycle":101,"rx/dist/rx":156}],100:[function(e,t,n){var r=e("./../../get"),i=r.getWithPathsAsJSONGraph,o=r.getWithPathsAsPathMap;t.exports=function(e,t,n,r,s,a,u){var c;if(c=s?i(e,t,a):o(e,t,a),c.criticalError)return n.onError(c.criticalError),null;var h=c.hasValue,l=!c.requestedMissingPaths||!e._source,p=a[0].json||a[0].jsonGraph;if(c.errors)for(var f=c.errors,d=u.length,m=0,v=f.length;v>m;++m,++d)u[d]=f[m];if(h&&r||p&&l)try{++e._root.syncRefCount,n.onNext(a[0])}catch(g){throw g}finally{--e._root.syncRefCount}return l?(u.length?n.onError(u):n.onCompleted(),null):c}},{"./../../get":51}],101:[function(e,t,n){var r=e("./checkCacheAndReport"),i=e("./../../errors/MaxRetryExceededError"),o=e("./../../get/util/support").fastCat,s=e("./../../lru/collect"),a=e("./../../support/getSize"),u=e("./AssignableDisposable"),c=e("./../../internal/version");t.exports=function h(e,t,n,l,p,f,d){if(10===d)throw new i;var m=t._request,v=n.requestedMissingPaths,g=n.optimizedMissingPaths,y=new u,_=[],b=t._path;if(b.length)for(var x=0,w=v.length;w>x;++x)_[x]=o(b,v[x]);else _=v;var S=m.get(_,g,function(){var n=r(t,v,l,e.isProgressive,e.isJSONGraph,p,f);if(n)y.currentDisposable=h(e,t,n,l,p,f,d+1);else{var i=t._root,o=i.cache,u=o[c];s(i,i.expired,a(o),t._maxSize,t._collectRatio,u)}});return y.currentDisposable=S,y}},{"./../../errors/MaxRetryExceededError":42,"./../../get/util/support":62,"./../../internal/version":78,"./../../lru/collect":81,"./../../support/getSize":120,"./AssignableDisposable":98,"./checkCacheAndReport":100}],102:[function(e,t,n){var r=e("./GetResponse");t.exports=function(e){return new r(this,e)}},{"./GetResponse":99}],103:[function(e,t,n){var r=e("falcor-path-syntax"),i=e("./../ModelResponse"),o=e("./validInput"),s=e("./../../support/validateInput"),a=e("./GetResponse");t.exports=function(){var e=s(arguments,o,"get");if(e!==!0)return new i(function(t){t.onError(e)});var t=r.fromPathsOrPathValues(arguments);return new a(this,t)}},{"./../../support/validateInput":148,"./../ModelResponse":96,"./GetResponse":99,"./validInput":104,"falcor-path-syntax":18}],104:[function(e,t,n){t.exports={path:!0,pathSyntax:!0}},{}],105:[function(e,t,n){function r(){}var i=e("asap"),o=e("rx/dist/rx"),s=o.Disposable;r.prototype.schedule=function(e){return i(e),s.empty},r.prototype.scheduleWithState=function(e,t){var n=this;return i(function(){t(n,e)}),s.empty},t.exports=r},{asap:1,"rx/dist/rx":156}],106:[function(e,t,n){function r(){}var i=e("rx/dist/rx"),o=i.Disposable;r.prototype.schedule=function(e){return e(),o.empty},r.prototype.scheduleWithState=function(e,t){return t(this,e),o.empty},t.exports=r},{"rx/dist/rx":156}],107:[function(e,t,n){function r(e){this.delay=e}var i=e("rx/dist/rx"),o=i.Disposable;r.prototype.schedule=function(e){var t=setTimeout(e,this.delay);return o.create(function(){void 0!==t&&(clearTimeout(t),t=void 0)})},r.prototype.scheduleWithState=function(e,t){var n=this,r=setTimeout(function(){t(n,e)},this.delay);return o.create(function(){void 0!==r&&(clearTimeout(r),r=void 0)})},t.exports=r},{"rx/dist/rx":156}],108:[function(e,t,n){function r(e,t,n,i,s,a,u,c,h,l,p,d,m,v,g,_,b){for(var x={},w=t<e.length-1,S=e[t],M=y(S,x),E=d.index;;){p.depth=t;var C=o(n,i,s,a,u,c,M,w,!1,p,d,m,v,g,_,b);p[t]=M,p.index=t,d[d.index++]=M;var T=C[0],A=C[1];if(T&&(w?r(e,t+1,n,A,T,a,C[3],C[2],h,l,p,d,m,v,g,_,b):(f(g,T),h.push(p.slice(0,p.index+1)),l.push(d.slice(0,d.index)))),M=y(S,x),x.done)break;d.index=E}}function i(e,t,n,r,i,s,c,p,m,y,_){var b=t.value;if(s.splice(0,s.length),s.push.apply(s,b),d(t))return s.index=b.length,g(t,p,m),[void 0,e,r,n];f(m,t);var x=0,w=t,S=b.length-1,M=t=e,E=r=n;do{var C=b[x],T=S>x,A=o(e,M,t,n,E,r,C,T,!0,i,s,c,p,m,y,_);if(t=A[0],v(t))return s.index=x,A;M=A[1],r=A[2],E=A[3]}while(x++<S);if(s.index=x,w[u]!==t){var P=t[l]||0;t[l]=P+1,t[a+P]=w,w[u]=t,w[h]=P}return[t,M,r,E]}function o(e,t,n,r,o,a,u,c,h,l,f,d,m,g,y,_){for(var x=n.$type;x===p;){var w=i(e,n,r,a,l,f,d,m,g,y,_);if(n=w[0],v(n))return w;t=w[1],a=w[2],o=w[3],x=n.$type}if(void 0!==x)return[n,t,a,o];if(null==u){if(c)throw new Error("`null` is not allowed in branch key positions.");n&&(u=n[s])}else t=n,o=a,n=t[u],a=o&&o[u];return n=b(t,n,a,u,l,f,d,m,g,y,_),[n,t,a,o]}var s=e("./../internal/key"),a=e("./../internal/ref"),u=e("./../internal/context"),c=e("./../internal/version"),h=e("./../internal/ref-index"),l=e("./../internal/refs-length"),p=e("./../types/ref"),f=e("./../lru/promote"),d=e("./../support/isAlreadyExpired"),m=e("./../support/isFunction"),v=e("./../support/isPrimitive"),g=e("./../support/expireNode"),y=e("falcor-path-utils").iterateKeySet,_=e("./../support/incrementVersion"),b=e("./../support/mergeJSONGraphNode");t.exports=function(e,t,n,i,o){for(var s=e._root,a=s,u=s.expired,h=_(),l=s.cache,p=l[c],f=[],d=[],v=[],g=[],y=-1,b=t.length;++y<b;)for(var x=t[y],w=x.paths,S=x.jsonGraph,M=-1,E=w.length;++M<E;){var C=w[M];d.index=0,r(C,0,l,l,l,S,S,S,v,g,f,d,h,u,a,o,i)}var T=l[c],A=s.onChange;return m(A)&&p!==T&&A(),[v,g]}},{"./../internal/context":65,"./../internal/key":68,"./../internal/ref":75,"./../internal/ref-index":74,"./../internal/refs-length":76,"./../internal/version":78,"./../lru/promote":82,"./../support/expireNode":118,"./../support/incrementVersion":124,"./../support/isAlreadyExpired":126,"./../support/isFunction":128,"./../support/isPrimitive":134,"./../support/mergeJSONGraphNode":135,"./../types/ref":152,"falcor-path-utils":27}],109:[function(e,t,n){function r(e,t,n,i,a,u,c,h,l,p,f,d,m,v){var g=s(e);if(g&&g.length)for(var _=0,x=g.length,w=l.index;;){var S=g[_],M=e[S],E=b(M)&&!M.$type;h.depth=t;var C=o(n,i,a,S,M,E,!1,h,l,p,f,d,m,v);h[t]=S,h.index=t,l[l.index++]=S;var T=C[0],A=C[1];if(T&&(E?r(M,t+1,n,A,T,u,c,h,l,p,f,d,m,v):(y(d,T),u.push(h.slice(0,h.index+1)),c.push(l.slice(0,l.index)))),++_>=x)break;l.index=w}}function i(e,t,n,r,i,s,a,c,p,m){var v=n.value;if(i.splice(0,i.length),i.push.apply(i,v),x(n))return i.index=v.length,M(n,a,c),[void 0,t];y(c,n);var g=n,_=t;if(n=n[l],null!=n)_=n[h]||t,i.index=v.length;else{var b=0,w=v.length-1;_=n=t;do{var E=v[b],C=w>b,T=o(t,_,n,E,e,C,!0,r,i,s,a,c,p,m);if(n=T[0],S(n))return i.index=b,T;_=T[1]}while(b++<w);if(i.index=b,g[l]!==n){var A=n[d]||0;n[d]=A+1,n[u+A]=g,g[l]=n,g[f]=A}}return[n,_]}function o(e,t,n,r,o,s,u,c,h,l,p,f,d,v){for(var g=n.$type;g===m;){var y=i(o,e,n,c,h,l,p,f,d,v);if(n=y[0],S(n))return y;t=y[1],g=n&&n.$type}if(void 0!==g)return[n,t];if(null==r){if(s)throw new Error("`null` is not allowed in branch key positions.");n&&(r=n[a])}else t=n,n=t[r];return n=C(t,n,r,o,s,u,c,h,l,p,f,d,v),[n,t]}function s(e){if(b(e)&&!e.$type){var t=[],n=0;g(e)&&(t[n++]="length");for(var r in e)r[0]!==c&&"$"!==r[0]&&_(e,r)&&(t[n++]=r);return t}}var a=e("./../internal/key"),u=e("./../internal/ref"),c=e("./../internal/prefix"),h=e("./../internal/parent"),l=e("./../internal/context"),p=e("./../internal/version"),f=e("./../internal/ref-index"),d=e("./../internal/refs-length"),m=e("./../types/ref"),v=e("./../get/getBoundValue"),g=Array.isArray,y=e("./../lru/promote"),_=e("./../support/hasOwn"),b=e("./../support/isObject"),x=e("./../support/isExpired"),w=e("./../support/isFunction"),S=e("./../support/isPrimitive"),M=e("./../support/expireNode"),E=e("./../support/incrementVersion"),C=e("./../support/mergeValueOrInsertBranch");t.exports=function(e,t,n,i,o){for(var s=e._root,a=s,u=s.expired,c=E(),l=e._path,f=s.cache,d=l.length?v(e,l).value:f,m=d[h]||f,g=f[p],y=[],_=[],b=[],x=l.length,S=-1,M=t.length;++S<M;){var C=t[S],T=l.slice(0);T.index=x,r(C.json,0,f,m,d,_,b,y,T,c,u,a,o,i)}var A=f[p],P=s.onChange;return w(P)&&g!==A&&P(),[_,b]}},{"./../get/getBoundValue":45,"./../internal/context":65,"./../internal/key":68,"./../internal/parent":71,"./../internal/prefix":72,"./../internal/ref":75,"./../internal/ref-index":74,"./../internal/refs-length":76,"./../internal/version":78,"./../lru/promote":82,"./../support/expireNode":118,"./../support/hasOwn":123,"./../support/incrementVersion":124,"./../support/isExpired":127,"./../support/isFunction":128,"./../support/isObject":132,"./../support/isPrimitive":134,"./../support/mergeValueOrInsertBranch":136,"./../types/ref":152}],110:[function(e,t,n){function r(e,t,n,i,s,a,u,c,h,l,p,f,d,v,g){
|
||
for(var y={},_=n<t.length-1,x=t[n],w=b(x,y),S=l.index;;){h.depth=n;var M=o(i,s,a,w,e,_,!1,h,l,p,f,d,v,g);h[n]=w,h.index=n,l[l.index++]=w;var E=M[0],C=M[1];if(E&&(_?r(e,t,n+1,i,C,E,u,c,h,l,p,f,d,v,g):(m(d,E),u.push(h.slice(0,h.index+1)),c.push(l.slice(0,l.index)))),w=b(x,y),y.done)break;l.index=S}}function i(e,t,n,r,i,s,h,f,d,g){var b=n.value;if(i.splice(0,i.length),i.push.apply(i,b),v(n))return i.index=b.length,_(n,h,f),[void 0,t];m(f,n);var x=n,w=t;if(n=n[c],null!=n)w=n[u]||t,i.index=b.length;else{var S=0,M=b.length-1;w=n=t;do{var E=b[S],C=M>S,T=o(t,w,n,E,e,C,!0,r,i,s,h,f,d,g);if(n=T[0],y(n))return i.index=S,T;w=T[1]}while(S++<M);if(i.index=S,x[c]!==n){var A=n[p]||0;n[p]=A+1,n[a+A]=x,x[c]=n,x[l]=A}}return[n,w]}function o(e,t,n,r,o,a,u,c,h,l,p,d,m,v){for(var g=n.$type;g===f;){var _=i(o,e,n,c,h,l,p,d,m,v);if(n=_[0],y(n))return _;t=_[1],g=n.$type}if(void 0!==g)return[n,t];if(null==r){if(a)throw new Error("`null` is not allowed in branch key positions.");n&&(r=n[s])}else t=n,n=t[r];return n=w(t,n,r,o,a,u,c,h,l,p,d,m,v),[n,t]}var s=e("./../internal/key"),a=e("./../internal/ref"),u=e("./../internal/parent"),c=e("./../internal/context"),h=e("./../internal/version"),l=e("./../internal/ref-index"),p=e("./../internal/refs-length"),f=e("./../types/ref"),d=e("./../get/getBoundValue"),m=e("./../lru/promote"),v=e("./../support/isExpired"),g=e("./../support/isFunction"),y=e("./../support/isPrimitive"),_=e("./../support/expireNode"),b=e("falcor-path-utils").iterateKeySet,x=e("./../support/incrementVersion"),w=e("./../support/mergeValueOrInsertBranch");t.exports=function(e,t,n,i,o){for(var s=e._root,a=s,c=s.expired,l=x(),p=e._path,f=s.cache,m=p.length?d(e,p).value:f,v=m[u]||f,y=f[h],_=[],b=[],w=[],S=p.length,M=-1,E=t.length;++M<E;){var C=t[M],T=C.path,A=C.value,P=p.slice(0);P.index=S,r(A,T,0,f,v,m,b,w,_,P,l,c,a,o,i)}var O=f[h],L=s.onChange;return g(L)&&y!==O&&L(),[b,w]}},{"./../get/getBoundValue":45,"./../internal/context":65,"./../internal/key":68,"./../internal/parent":71,"./../internal/ref":75,"./../internal/ref-index":74,"./../internal/refs-length":76,"./../internal/version":78,"./../lru/promote":82,"./../support/expireNode":118,"./../support/incrementVersion":124,"./../support/isExpired":127,"./../support/isFunction":128,"./../support/isPrimitive":134,"./../support/mergeValueOrInsertBranch":136,"./../types/ref":152,"falcor-path-utils":27}],111:[function(e,t,n){var r=e("falcor-json-graph"),i=e("./../response/ModelResponse"),o=e("./../support/isPathValue");t.exports=function(e,t){for(var n=o(e)?e:r.pathValue(e,t),s=0,a=n.path,u=a.length;++s<u;)if("object"==typeof a[s])return new i(function(e){e.onError(new Error("Paths must be simple paths"))});var c=this;return new i(function(e){return c._set(n).subscribe(function(t){for(var n=t.json,r=-1,i=a.length;n&&++r<i;)n=n[a[r]];e.onNext(n)},function(t){e.onError(t)},function(){e.onCompleted()})})}},{"./../response/ModelResponse":96,"./../support/isPathValue":133,"falcor-json-graph":14}],112:[function(e,t,n){var r=e("falcor-path-syntax"),i=e("./../support/isPathValue"),o=e("./../set/setPathValues");t.exports=function(e,t,n,s){var a=r.fromPath(e),u=t,c=n,h=s;if(i(a)?(h=c,c=u,u=a):u={path:a,value:u},i(u)===!1)throw new Error("Model#setValueSync must be called with an Array path.");return"function"!=typeof c&&(c=this._root._errorSelector),"function"!=typeof h&&(h=this._root._comparator),this._syncCheck("setValueSync")?(o(this,[u]),this._getValueSync(this,u.path).value):void 0}},{"./../set/setPathValues":110,"./../support/isPathValue":133,"falcor-path-syntax":18}],113:[function(e,t,n){t.exports=function(e){if(!e)return e;for(var t=-1,n=e.length,r=[];++t<n;)r[t]=e[t];return r}},{}],114:[function(e,t,n){t.exports=function(e,t){for(var n=-1,r=-1,i=e.length,o=[];++r<i;)for(var s=t(e[r],r,e),a=-1,u=s.length;++a<u;)o[++n]=s[a];return o}},{}],115:[function(e,t,n){t.exports=function(e,t){for(var n=-1,r=e.length,i=new Array(r);++n<r;)i[n]=t(e[n],n,e);return i}},{}],116:[function(e,t,n){t.exports=function(e,t,n){var r=t||0,i=-1,o=e.length-r;0>o&&(o=0),n>0&&o>n&&(o=n);for(var s=new Array(o);++i<o;)s[i]=e[i+r];return s}},{}],117:[function(e,t,n){var r=e("./../internal/prefix"),i=e("./../support/hasOwn"),o=Array.isArray,s=e("./../support/isObject");t.exports=function(e){var t=e;if(s(t)){t=o(e)?[]:{};var n=e;for(var a in n)a[0]!==r&&i(n,a)&&(t[a]=n[a])}return t}},{"./../internal/prefix":72,"./../support/hasOwn":123,"./../support/isObject":132}],118:[function(e,t,n){var r=e("./../lru/splice"),i=e("./../internal/invalidated");t.exports=function(e,t,n){return e[i]||(e[i]=!0,t.push(e),r(n,e)),e}},{"./../internal/invalidated":67,"./../lru/splice":83}],119:[function(e,t,n){var r=e("./isObject");t.exports=function(e){return r(e)&&e.$expires||void 0}},{"./isObject":132}],120:[function(e,t,n){var r=e("./../support/isObject");t.exports=function(e){return r(e)&&e.$size||0}},{"./../support/isObject":132}],121:[function(e,t,n){var r=e("./../support/isObject");t.exports=function(e){return r(e)&&e.$timestamp||void 0}},{"./../support/isObject":132}],122:[function(e,t,n){var r=e("./../support/isObject");t.exports=function(e,t){var n=r(e)&&e.$type||void 0;return t&&n?"branch":n}},{"./../support/isObject":132}],123:[function(e,t,n){var r=e("./isObject"),i=Object.prototype.hasOwnProperty;t.exports=function(e,t){return r(e)&&i.call(e,t)}},{"./isObject":132}],124:[function(e,t,n){var r=1;t.exports=function(){return r++}},{}],125:[function(e,t,n){var r=e("./../internal/key"),i=e("./../internal/parent"),o=e("./../internal/version");t.exports=function(e,t,n,s){return e[r]=n,e[i]=t,e[o]=s,t[n]=e,e}},{"./../internal/key":68,"./../internal/parent":71,"./../internal/version":78}],126:[function(e,t,n){var r=e("./../support/now"),i=e("./../values/expires-now"),o=e("./../values/expires-never");t.exports=function(e){var t=e.$expires;return null!=t&&t!==o&&t!==i&&t<r()}},{"./../support/now":138,"./../values/expires-never":153,"./../values/expires-now":154}],127:[function(e,t,n){var r=e("./../support/now"),i=e("../values/expires-now"),o=e("../values/expires-never");t.exports=function(e){var t=e.$expires;return null!=t&&t!==o&&(t===i||t<r())}},{"../values/expires-never":153,"../values/expires-now":154,"./../support/now":138}],128:[function(e,t,n){var r="function";t.exports=function(e){return Boolean(e)&&typeof e===r}},{}],129:[function(e,t,n){var r=e("./../internal/prefix");t.exports=function(e){return"$size"===e||e&&e.charAt(0)===r}},{"./../internal/prefix":72}],130:[function(e,t,n){var r=e("./../support/isObject");t.exports=function(e){return r(e)&&"json"in e}},{"./../support/isObject":132}],131:[function(e,t,n){var r=Array.isArray,i=e("./../support/isObject");t.exports=function(e){return i(e)&&r(e.paths)&&(i(e.jsonGraph)||i(e.jsong)||i(e.json)||i(e.values)||i(e.value))}},{"./../support/isObject":132}],132:[function(e,t,n){var r="object";t.exports=function(e){return null!==e&&typeof e===r}},{}],133:[function(e,t,n){var r=Array.isArray,i=e("./../support/isObject");t.exports=function(e){return i(e)&&(r(e.path)||"string"==typeof e.path)}},{"./../support/isObject":132}],134:[function(e,t,n){var r="object";t.exports=function(e){return null==e||typeof e!==r}},{}],135:[function(e,t,n){var r=e("./../internal/key"),i=e("./../internal/parent"),o=e("./../types/ref"),s=e("./../types/error"),a=e("./../support/getSize"),u=e("./../support/getTimestamp"),c=e("./../support/isObject"),h=e("./../support/isExpired"),l=e("./../support/isFunction"),p=e("./../lru/promote"),f=e("./../support/wrapNode"),d=e("./../support/insertNode"),m=e("./../support/expireNode"),v=e("./../support/replaceNode"),g=e("./../support/updateNodeAncestors"),y=e("./../support/reconstructPath");t.exports=function(e,t,n,_,b,x,w,S,M,E,C){var T,A,P,O,L,R,N;if(t===n){if(null===n)return t=f(n,void 0,n),e=g(e,-t.$size,M,w),t=d(t,e,_),p(M,t),t;if(void 0===n)return n;if(O=c(t),O&&(A=t.$type,null==A))return null==t[i]&&(t[r]=_,t[i]=e),t}else O=c(t),O&&(A=t.$type);if(A!==o){if(L=c(n),L&&(P=n.$type),O&&!A&&(null==n||L&&!P))return t}else{if(null==n)return h(t)?void m(t,S,M):t;if(L=c(n),L&&(P=n.$type,P===o))if(t===n){if(null!=t[i])return t}else if(R=t.$timestamp,N=n.$timestamp,!h(t)&&!h(n)&&R>N)return}if(A&&L&&!P)return d(v(t,n,e,_,M),e,_);if(P||!L){if(P===s&&l(C)&&(n=C(y(b,_),n)),P&&t===n)null==t[i]&&(t=f(t,A,t.value),e=g(e,-t.$size,M,w),t=d(t,e,_,w));else{var D=!0;!A&&O||(D=u(n)<u(t)==!1,(A||P)&&l(E)&&(D=!E(t,n,x.slice(0,x.index)))),D&&(n=f(n,P,P?n.value:n),T=a(t)-a(n),t=v(t,n,e,_,M),e=g(e,T,M,w),t=d(t,e,_,w))}h(t)?m(t,S,M):p(M,t)}else null==t&&(t=d(n,e,_));return t}},{"./../internal/key":68,"./../internal/parent":71,"./../lru/promote":82,"./../support/expireNode":118,"./../support/getSize":120,"./../support/getTimestamp":121,"./../support/insertNode":125,"./../support/isExpired":127,"./../support/isFunction":128,"./../support/isObject":132,"./../support/reconstructPath":139,"./../support/replaceNode":142,"./../support/updateNodeAncestors":147,"./../support/wrapNode":149,"./../types/error":151,"./../types/ref":152}],136:[function(e,t,n){var r=e("./../types/ref"),i=e("./../types/error"),o=e("./../support/getType"),s=e("./../support/getSize"),a=e("./../support/getTimestamp"),u=e("./../support/isExpired"),c=e("./../support/isPrimitive"),h=e("./../support/isFunction"),l=e("./../support/wrapNode"),p=e("./../support/expireNode"),f=e("./../support/insertNode"),d=e("./../support/replaceNode"),m=e("./../support/updateNodeAncestors"),v=e("./../support/updateBackReferenceVersions"),g=e("./../support/reconstructPath");t.exports=function(e,t,n,y,_,b,x,w,S,M,E,C,T){var A=o(t,b);if(_||b)A&&u(t)&&(A="expired",p(t,M,E)),(A&&A!==r||c(t))&&(t=d(t,{},e,n,E),t=f(t,e,n,S),t=v(t,S));else{var P=y,O=o(P),L=a(P)<a(t)==!1;if((A||O)&&h(C)&&(L=!C(t,P,w.slice(0,w.index))),L){O===i&&h(T)&&(P=T(g(x,n),P)),P=l(P,O,O?P.value:P);var R=s(t)-s(P);t=d(t,P,e,n,E),e=m(e,R,E,S),t=f(t,e,n,S)}}return t}},{"./../support/expireNode":118,"./../support/getSize":120,"./../support/getTimestamp":121,"./../support/getType":122,"./../support/insertNode":125,"./../support/isExpired":127,"./../support/isFunction":128,"./../support/isPrimitive":134,"./../support/reconstructPath":139,"./../support/replaceNode":142,"./../support/updateBackReferenceVersions":146,"./../support/updateNodeAncestors":147,"./../support/wrapNode":149,"./../types/error":151,"./../types/ref":152}],137:[function(e,t,n){t.exports=function(){}},{}],138:[function(e,t,n){t.exports=Date.now},{}],139:[function(e,t,n){t.exports=function(e,t){var n=e.slice(0,e.depth);return n[n.length]=t,n}},{}],140:[function(e,t,n){var r=e("./../types/ref"),i=e("./../internal/parent"),o=e("./../lru/splice"),s=e("./../support/isObject"),a=e("./../support/unlinkBackReferences"),u=e("./../support/unlinkForwardReference");t.exports=function(e,t,n,c){if(s(e)){var h=e.$type;return Boolean(h)&&(h===r&&u(e),o(c,e)),a(e),t[n]=e[i]=void 0,!0}return!1}},{"./../internal/parent":71,"./../lru/splice":83,"./../support/isObject":132,"./../support/unlinkBackReferences":144,"./../support/unlinkForwardReference":145,"./../types/ref":152}],141:[function(e,t,n){var r=e("./../support/hasOwn"),i=e("./../internal/prefix"),o=e("./../support/removeNode");t.exports=function s(e,t,n,a){if(o(e,t,n,a)){if(null==e.$type)for(var u in e)u[0]!==i&&"$"!==u[0]&&r(e,u)&&s(e[u],e,u,a);return!0}return!1}},{"./../internal/prefix":72,"./../support/hasOwn":123,"./../support/removeNode":140}],142:[function(e,t,n){var r=e("./../support/isObject"),i=e("./../support/transferBackReferences"),o=e("./../support/removeNodeAndDescendants");t.exports=function(e,t,n,s,a){return e===t?e:(r(e)&&(i(e,t),o(e,n,s,a)),n[s]=t,t)}},{"./../support/isObject":132,"./../support/removeNodeAndDescendants":141,"./../support/transferBackReferences":143}],143:[function(e,t,n){var r=e("./../internal/ref"),i=e("./../internal/context"),o=e("./../internal/refs-length");t.exports=function(e,t){for(var n=e[o]||0,s=t[o]||0,a=-1;++a<n;){var u=e[r+a];void 0!==u&&(u[i]=t,t[r+(s+a)]=u,e[r+a]=void 0)}return t[o]=n+s,e[o]=void 0,t}},{"./../internal/context":65,"./../internal/ref":75,"./../internal/refs-length":76}],144:[function(e,t,n){var r=e("./../internal/ref"),i=e("./../internal/context"),o=e("./../internal/ref-index"),s=e("./../internal/refs-length");t.exports=function(e){for(var t=-1,n=e[s]||0;++t<n;){var a=e[r+t];null!=a&&(a[i]=a[o]=e[r+t]=void 0)}return e[s]=void 0,e}},{"./../internal/context":65,"./../internal/ref":75,"./../internal/ref-index":74,"./../internal/refs-length":76}],145:[function(e,t,n){var r=e("./../internal/ref"),i=e("./../internal/context"),o=e("./../internal/ref-index"),s=e("./../internal/refs-length");t.exports=function(e){var t=e[i];if(t){for(var n=(e[o]||0)-1,a=(t[s]||0)-1;++n<=a;)t[r+n]=t[r+(n+1)];t[s]=a,e[o]=e[i]=t=void 0}return e}},{"./../internal/context":65,"./../internal/ref":75,"./../internal/ref-index":74,"./../internal/refs-length":76}],146:[function(e,t,n){var r=e("./../internal/ref"),i=e("./../internal/parent"),o=e("./../internal/version"),s=e("./../internal/refs-length");t.exports=function(e,t){var n=[e],a=0;do{var u=n[a--];if(u&&u[o]!==t){u[o]=t,n[a++]=u[i];for(var c=-1,h=u[s]||0;++c<h;)n[a++]=u[r+c]}}while(a>-1);return e}},{"./../internal/parent":71,"./../internal/ref":75,"./../internal/refs-length":76,"./../internal/version":78}],147:[function(e,t,n){var r=e("./../internal/key"),i=e("./../internal/version"),o=e("./../internal/parent"),s=e("./../support/removeNode"),a=e("./../support/updateBackReferenceVersions");t.exports=function(e,t,n,u){var c=e;do{var h=c[o],l=c.$size=(c.$size||0)-t;0>=l&&null!=h?s(c,h,c[r],n):c[i]!==u&&a(c,u),c=h}while(c);return e}},{"./../internal/key":68,"./../internal/parent":71,"./../internal/version":78,"./../support/removeNode":140,"./../support/updateBackReferenceVersions":146}],148:[function(e,t,n){var r=Array.isArray,i=e("./../support/isPathValue"),o=e("./../support/isJSONGraphEnvelope"),s=e("./../support/isJSONEnvelope"),a=e("falcor-path-syntax");t.exports=function(e,t,n){for(var u=0,c=e.length;c>u;++u){var h=e[u],l=!1;if(r(h)&&t.path?l=!0:"string"==typeof h&&t.pathSyntax?l=!0:i(h)&&t.pathValue?(h.path=a.fromPath(h.path),l=!0):o(h)&&t.jsonGraph?l=!0:s(h)&&t.json?l=!0:"function"==typeof h&&u+1===c&&t.selector&&(l=!0),!l)return new Error("Unrecognized argument "+typeof h+" ["+String(h)+"] to Model#"+n)}return!0}},{"./../support/isJSONEnvelope":130,"./../support/isJSONGraphEnvelope":131,"./../support/isPathValue":133,"falcor-path-syntax":18}],149:[function(e,t,n){var r=e("falcor-json-graph"),i=r.atom,o=e("./../support/now"),s=e("../values/expires-now"),a=e("./../internal/model-created"),u=50,c=e("./../support/clone"),h=Array.isArray,l=e("./../support/getSize"),p=e("./../support/getExpires");t.exports=function(e,t,n){var r=0,f=e,d=t;if(d?(f=c(f),r=l(f),f.$type=d):(f=i(n),d=f.$type,f[a]=!0),null==n)r=u+1;else if(null==r||0>=r)switch(typeof n){case"object":r=h(n)?u+n.length:u+1;break;case"string":r=u+n.length;break;default:r=u+1}var m=p(f);return"number"==typeof m&&s>m&&(f.$expires=o()+-1*m),f.$size=r,f}},{"../values/expires-now":154,"./../internal/model-created":69,"./../support/clone":117,"./../support/getExpires":119,"./../support/getSize":120,"./../support/now":138,"falcor-json-graph":14}],150:[function(e,t,n){t.exports="atom"},{}],151:[function(e,t,n){t.exports="error"},{}],152:[function(e,t,n){t.exports="ref"},{}],153:[function(e,t,n){t.exports=1},{}],154:[function(e,t,n){t.exports=0},{}],155:[function(t,n,r){(function(i){(function(o){var s={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},a=s[typeof window]&&window||this,u=s[typeof r]&&r&&!r.nodeType&&r,c=s[typeof n]&&n&&!n.nodeType&&n,h=(c&&c.exports===u&&u,s[typeof i]&&i);!h||h.global!==h&&h.window!==h||(a=h),"function"==typeof e&&e.amd?e(["rx"],function(e,t){return o(a,t,e)}):"object"==typeof n&&n&&n.exports===u?n.exports=o(a,n.exports,t("./rx")):a.Rx=o(a,{},a.Rx)}).call(this,function(e,t,n,r){function i(){try{return f.apply(this,arguments)}catch(e){return I.e=e,I}}function o(e){if(!M(e))throw new TypeError("fn must be a function");return f=e,i}function s(e,t,n){return new g(function(r){var i=!1,o=null,s=[];return e.subscribe(function(e){var a,u;try{u=t(e)}catch(c){return void r.onError(c)}if(a=0,i)try{a=n(u,o)}catch(h){return void r.onError(h)}else i=!0,o=u;a>0&&(o=u,s=[]),a>=0&&s.push(e)},function(e){r.onError(e)},function(){r.onNext(s),r.onCompleted()})},e)}function a(e){if(0===e.length)throw new R;return e[0]}function u(e,t,n,r){if(0>t)throw new D;return new g(function(i){var o=t;return e.subscribe(function(e){0===o--&&(i.onNext(e),i.onCompleted())},function(e){i.onError(e)},function(){n?(i.onNext(r),i.onCompleted()):i.onError(new D)})},e)}function c(e,t,n){return new g(function(r){var i=n,o=!1;return e.subscribe(function(e){o?r.onError(new Error("Sequence contains more than one element")):(i=e,o=!0)},function(e){r.onError(e)},function(){o||t?(r.onNext(i),r.onCompleted()):r.onError(new R)})},e)}function h(e,t,n){return new g(function(r){return e.subscribe(function(e){r.onNext(e),r.onCompleted()},function(e){r.onError(e)},function(){t?(r.onNext(n),r.onCompleted()):r.onError(new R)})},e)}function l(e,t,n){return new g(function(r){var i=n,o=!1;return e.subscribe(function(e){i=e,o=!0},function(e){r.onError(e)},function(){o||t?(r.onNext(i),r.onCompleted()):r.onError(new R)})},e)}function p(e,t,n,i){var o=L(t,n,3);return new g(function(t){var n=0;return e.subscribe(function(r){var s;try{s=o(r,n,e)}catch(a){return void t.onError(a)}s?(t.onNext(i?n:r),t.onCompleted()):n++},function(e){t.onError(e)},function(){t.onNext(i?-1:r),t.onCompleted()})},e)}var f,d=n.Observable,m=d.prototype,v=n.CompositeDisposable,g=n.AnonymousObservable,y=n.Disposable.empty,_=(n.internals.isEqual,n.helpers),b=_.not,x=_.defaultComparer,w=_.identity,S=_.defaultSubComparer,M=_.isFunction,E=_.isPromise,C=_.isArrayLike,T=_.isIterable,A=n.internals.inherits,P=d.fromPromise,O=d.from,L=n.internals.bindCallback,R=n.EmptyError,N=n.ObservableBase,D=n.ArgumentOutOfRangeError,I={e:{}};m.aggregate=function(){var e,t,n=!1,r=this;return 2===arguments.length?(n=!0,t=arguments[0],e=arguments[1]):e=arguments[0],new g(function(i){var o,s,a;return r.subscribe(function(r){!a&&(a=!0);try{o?s=e(s,r):(s=n?e(t,r):r,o=!0)}catch(u){return i.onError(u)}},function(e){i.onError(e)},function(){a&&i.onNext(s),!a&&n&&i.onNext(t),!a&&!n&&i.onError(new R),i.onCompleted()})},r)};var k=function(e){function t(t,n,r,i){this.source=t,this.acc=n,this.hasSeed=r,this.seed=i,e.call(this)}function n(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 A(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this))},n.prototype.onNext=function(e){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=o(this.acc)(this.result,e):(this.result=this.hasSeed?o(this.acc)(this.seed,e):e,this.hasAccumulation=!0),this.result===I&&this.o.onError(this.result.e))},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new R),this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(N);return m.reduce=function(e){var t=!1;if(2===arguments.length){t=!0;var n=arguments[1]}return new k(this,e,t,n)},m.some=function(e,t){var n=this;return e?n.filter(e,t).some():new g(function(e){return n.subscribe(function(){e.onNext(!0),e.onCompleted()},function(t){e.onError(t)},function(){e.onNext(!1),e.onCompleted()})},n)},m.any=function(){return this.some.apply(this,arguments)},m.isEmpty=function(){return this.any().map(b)},m.every=function(e,t){return this.filter(function(t){return!e(t)},t).some().map(b)},m.all=function(){return this.every.apply(this,arguments)},m.includes=function(e,t){function n(e,t){return 0===e&&0===t||e===t||isNaN(e)&&isNaN(t)}var r=this;return new g(function(i){var o=0,s=+t||0;return Math.abs(s)===1/0&&(s=0),0>s?(i.onNext(!1),i.onCompleted(),y):r.subscribe(function(t){o++>=s&&n(t,e)&&(i.onNext(!0),i.onCompleted())},function(e){i.onError(e)},function(){i.onNext(!1),i.onCompleted()})},this)},m.contains=function(e,t){m.includes(e,t)},m.count=function(e,t){return e?this.filter(e,t).count():this.reduce(function(e){return e+1},0)},m.indexOf=function(e,t){var n=this;return new g(function(r){var i=0,o=+t||0;return Math.abs(o)===1/0&&(o=0),0>o?(r.onNext(-1),r.onCompleted(),y):n.subscribe(function(t){i>=o&&t===e&&(r.onNext(i),r.onCompleted()),i++},function(e){r.onError(e)},function(){r.onNext(-1),r.onCompleted()})},n)},m.sum=function(e,t){return e&&M(e)?this.map(e,t).sum():this.reduce(function(e,t){return e+t},0)},m.minBy=function(e,t){return t||(t=S),s(this,e,function(e,n){return-1*t(e,n)})},m.min=function(e){return this.minBy(w,e).map(function(e){return a(e)})},m.maxBy=function(e,t){return t||(t=S),s(this,e,t)},m.max=function(e){return this.maxBy(w,e).map(function(e){return a(e)})},m.average=function(e,t){return e&&M(e)?this.map(e,t).average():this.reduce(function(e,t){return{sum:e.sum+t,count:e.count+1}},{sum:0,count:0}).map(function(e){if(0===e.count)throw new R;return e.sum/e.count})},m.sequenceEqual=function(e,t){var n=this;return t||(t=x),new g(function(r){var i=!1,o=!1,s=[],a=[],u=n.subscribe(function(e){var n,i;if(a.length>0){i=a.shift();try{n=t(i,e)}catch(u){return void r.onError(u)}n||(r.onNext(!1),r.onCompleted())}else o?(r.onNext(!1),r.onCompleted()):s.push(e)},function(e){r.onError(e)},function(){i=!0,0===s.length&&(a.length>0?(r.onNext(!1),r.onCompleted()):o&&(r.onNext(!0),r.onCompleted()))});(C(e)||T(e))&&(e=O(e)),E(e)&&(e=P(e));var c=e.subscribe(function(e){var n;if(s.length>0){var o=s.shift();try{n=t(o,e)}catch(u){return void r.onError(u)}n||(r.onNext(!1),r.onCompleted())}else i?(r.onNext(!1),r.onCompleted()):a.push(e)},function(e){r.onError(e)},function(){o=!0,0===a.length&&(s.length>0?(r.onNext(!1),r.onCompleted()):i&&(r.onNext(!0),r.onCompleted()))});return new v(u,c)},n)},m.elementAt=function(e){return u(this,e,!1)},m.elementAtOrDefault=function(e,t){return u(this,e,!0,t)},m.single=function(e,t){return e&&M(e)?this.where(e,t).single():c(this,!1)},m.singleOrDefault=function(e,t,n){return e&&M(e)?this.filter(e,n).singleOrDefault(null,t):c(this,!0,t)},m.first=function(e,t){return e?this.where(e,t).first():h(this,!1)},m.firstOrDefault=function(e,t,n){return e?this.where(e).firstOrDefault(null,t):h(this,!0,t)},m.last=function(e,t){return e?this.where(e,t).last():l(this,!1)},m.lastOrDefault=function(e,t,n){return e?this.where(e,n).lastOrDefault(null,t):l(this,!0,t)},m.find=function(e,t){return p(this,e,t,!1)},m.findIndex=function(e,t){return p(this,e,t,!0)},m.toSet=function(){if("undefined"==typeof e.Set)throw new TypeError;var t=this;return new g(function(n){var r=new e.Set;return t.subscribe(function(e){r.add(e)},function(e){n.onError(e)},function(){n.onNext(r),n.onCompleted()})},t)},m.toMap=function(t,n){if("undefined"==typeof e.Map)throw new TypeError;var r=this;return new g(function(i){var o=new e.Map;return r.subscribe(function(e){var r;try{r=t(e)}catch(s){return void i.onError(s)}var a=e;if(n)try{a=n(e)}catch(s){return void i.onError(s)}o.set(r,a)},function(e){i.onError(e)},function(){i.onNext(o),i.onCompleted()})},r)},n})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./rx":156}],156:[function(t,n,r){(function(t,i){(function(o){function a(e){for(var t=[],n=0,r=e.length;r>n;n++)t.push(e[n]);return t}function u(e,t){if(ce&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(fe)){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var i=n.join("\n"+fe+"\n");e.stack=c(i)}}function c(e){for(var t=e.split("\n"),n=[],r=0,i=t.length;i>r;r++){var o=t[r];h(o)||l(o)||!o||n.push(o)}return n.join("\n")}function h(e){var t=f(e);if(!t)return!1;var n=t[0],r=t[1];return n===le&&r>=pe&&Fn>=r}function l(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function p(){if(ce)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=f(n);if(!r)return;return le=r[0],r[1]}}function f(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function d(e){var t=[];if(!Xe(e))return t;qe.nonEnumArgs&&e.length&&Ye(e)&&(e=Je.call(e));var n=qe.enumPrototypes&&"function"==typeof e,r=qe.enumErrorProps&&(e===Ge||e instanceof Error);for(var i in e)n&&"prototype"==i||r&&("message"==i||"name"==i)||t.push(i);if(qe.nonEnumShadows&&e!==ze){var o=e.constructor,s=-1,a=Ae;if(e===(o&&o.prototype))var u=e===He?Fe:e===Ge?Ne:Be.call(e),c=We[u];for(;++s<a;)i=Te[s],c&&c[i]||!Ve.call(e,i)||t.push(i)}return t}function m(e,t,n){for(var r=-1,i=n(e),o=i.length;++r<o;){var s=i[r];if(t(e[s],s,e)===!1)break}return e}function v(e,t){return m(e,t,d)}function g(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}function y(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;var i=typeof e,o=typeof t;if(e===e&&(null==e||null==t||"function"!=i&&"object"!=i&&"function"!=o&&"object"!=o))return!1;var s=Be.call(e),a=Be.call(t);if(s==Pe&&(s=ke),a==Pe&&(a=ke),s!=a)return!1;switch(s){case Le:case Re:return+e==+t;case Ie:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case je:case Fe:return e==String(t)}var u=s==Oe;if(!u){if(s!=ke||!qe.nodeClass&&(g(e)||g(t)))return!1;var c=!qe.argsObject&&Ye(e)?Object:e.constructor,h=!qe.argsObject&&Ye(t)?Object:t.constructor;if(!(c==h||Ve.call(e,"constructor")&&Ve.call(t,"constructor")||ue(c)&&c instanceof c&&ue(h)&&h instanceof h||!("constructor"in e&&"constructor"in t)))return!1}n||(n=[]),r||(r=[]);for(var l=n.length;l--;)if(n[l]==e)return r[l]==t;var p=0,f=!0;if(n.push(e),r.push(t),u){if(l=e.length,p=t.length,f=p==l)for(;p--;){var d=t[p];if(!(f=y(e[p],d,n,r)))break}}else v(t,function(t,i,o){return Ve.call(o,i)?(p++,f=Ve.call(e,i)&&y(e[i],t,n,r)):void 0}),f&&v(e,function(e,t,n){return Ve.call(n,t)?f=--p>-1:void 0});return n.pop(),r.pop(),f}function _(e,t){for(var n=new Array(e),r=0;e>r;r++)n[r]=t();return n}function b(){try{return Ke.apply(this,arguments)}catch(e){return nt.e=e,nt}}function x(e){if(!ue(e))throw new TypeError("fn must be a function");return Ke=e,b}function w(e){throw e}function S(e,t){this.id=e,this.value=t}function M(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function E(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function C(e){this._s=s}function T(e){this._s=s,this._l=s.length,this._i=0}function A(e){this._a=e}function P(e){this._a=e,this._l=N(e),this._i=0}function O(e){return"number"==typeof e&&Y.isFinite(e)}function L(e){var t,n=e[xe];if(!n&&"string"==typeof e)return t=new C(e),t[xe]();if(!n&&e.length!==o)return t=new A(e),t[xe]();if(!n)throw new TypeError("Object is not iterable");return e[xe]()}function R(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}function N(e){var t=+e.length;return isNaN(t)?0:0!==t&&O(t)?(t=R(t)*Math.floor(Math.abs(t)),0>=t?0:t>tn?tn:t):t}function D(e,t){this.observer=e,this.parent=t}function I(e,t){return yt(e)||(e=wt),new rn(t,e)}function k(e,t){this.observer=e,this.parent=t}function j(e,t){this.observer=e,this.parent=t}function F(e,t){return new Nn(function(n){var r=new pt,i=new ft;return i.setDisposable(r),r.setDisposable(e.subscribe(function(e){n.onNext(e)},function(e){try{var r=t(e)}catch(o){return n.onError(o)}ae(r)&&(r=Yt(r));var s=new pt;i.setDisposable(s),s.setDisposable(r.subscribe(n))},function(e){n.onCompleted(e)})),i},e)}function B(){return!1}function V(e,t){var n=this;return new Nn(function(r){var i=0,o=e.length;return n.subscribe(function(n){if(o>i){var s=e[i++],a=x(t)(n,s);if(a===nt)return r.onError(a.e);r.onNext(a)}else r.onCompleted()},function(e){r.onError(e)},function(){r.onCompleted()})},n)}function B(){return!1}function U(){return[]}function B(){return!1}function G(){return[]}function z(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 H(e,t,n){var r=Ce(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i}).concatAll()}function $(e,t,n){for(var r=0,i=e.length;i>r;r++)if(n(e[r],t))return r;return-1}function W(e){this.comparer=e,this.set=[]}function q(e,t,n){var r=Ce(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i}).mergeAll()}var X={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Y=X[typeof window]&&window||this,K=X[typeof r]&&r&&!r.nodeType&&r,Z=X[typeof n]&&n&&!n.nodeType&&n,J=Z&&Z.exports===K&&K,Q=X[typeof i]&&i;!Q||Q.global!==Q&&Q.window!==Q||(Y=Q);var ee={internals:{},config:{Promise:Y.Promise},helpers:{}},te=ee.helpers.noop=function(){},ne=(ee.helpers.notDefined=function(e){return"undefined"==typeof e},ee.helpers.identity=function(e){return e}),re=(ee.helpers.pluck=function(e){return function(t){return t[e]}},ee.helpers.just=function(e){return function(){return e}},ee.helpers.defaultNow=Date.now),ie=ee.helpers.defaultComparer=function(e,t){return Ze(e,t)},oe=ee.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},se=(ee.helpers.defaultKeySerializer=function(e){return e.toString()},ee.helpers.defaultError=function(e){throw e}),ae=ee.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},ue=(ee.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},ee.helpers.not=function(e){return!e},ee.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==Be.call(e)}),e}());ee.config.longStackSupport=!1;var ce=!1;try{throw new Error}catch(he){ce=!!he.stack}var le,pe=p(),fe="From previous event:",de=ee.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};de.prototype=Error.prototype;var me=ee.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};me.prototype=Error.prototype;var ve=ee.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};ve.prototype=Error.prototype;var ge=ee.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};ge.prototype=Error.prototype;var ye=ee.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};ye.prototype=Error.prototype;var _e=ee.helpers.notImplemented=function(){throw new ye},be=ee.helpers.notSupported=function(){throw new ge},xe="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";Y.Set&&"function"==typeof(new Y.Set)["@@iterator"]&&(xe="@@iterator");var we=ee.doneEnumerator={done:!0,value:o},Se=ee.helpers.isIterable=function(e){return e[xe]!==o},Me=ee.helpers.isArrayLike=function(e){return e&&e.length!==o};ee.helpers.iterator=xe;var Ee,Ce=ee.internals.bindCallback=function(e,t,n){if("undefined"==typeof t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},Te=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ae=Te.length,Pe="[object Arguments]",Oe="[object Array]",Le="[object Boolean]",Re="[object Date]",Ne="[object Error]",De="[object Function]",Ie="[object Number]",ke="[object Object]",je="[object RegExp]",Fe="[object String]",Be=Object.prototype.toString,Ve=Object.prototype.hasOwnProperty,Ue=Be.call(arguments)==Pe,Ge=Error.prototype,ze=Object.prototype,He=String.prototype,$e=ze.propertyIsEnumerable;
|
||
try{Ee=!(Be.call(document)==ke&&!({toString:0}+""))}catch(he){Ee=!0}var We={};We[Oe]=We[Re]=We[Ie]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},We[Le]=We[Fe]={constructor:!0,toString:!0,valueOf:!0},We[Ne]=We[De]=We[je]={constructor:!0,toString:!0},We[ke]={constructor:!0};var qe={};!function(){var e=function(){this.x=1},t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments);qe.enumErrorProps=$e.call(Ge,"message")||$e.call(Ge,"name"),qe.enumPrototypes=$e.call(e,"prototype"),qe.nonEnumArgs=0!=n,qe.nonEnumShadows=!/valueOf/.test(t)}(1);var Xe=ee.internals.isObject=function(e){var t=typeof e;return e&&("function"==t||"object"==t)||!1},Ye=function(e){return e&&"object"==typeof e?Be.call(e)==Pe:!1};Ue||(Ye=function(e){return e&&"object"==typeof e?Ve.call(e,"callee"):!1});var Ke,Ze=ee.internals.isEqual=function(e,t){return y(e,t,[],[])},Je=({}.hasOwnProperty,Array.prototype.slice),Qe=this.inherits=ee.internals.inherits=function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n},et=ee.internals.addProperties=function(e){for(var t=[],n=1,r=arguments.length;r>n;n++)t.push(arguments[n]);for(var i=0,o=t.length;o>i;i++){var s=t[i];for(var a in s)e[a]=s[a]}},tt=ee.internals.addRef=function(e,t){return new Nn(function(n){return new ot(t.getDisposable(),e.subscribe(n))})},nt={e:{}};S.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var rt=ee.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},it=rt.prototype;it.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},it.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}}},it.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,n=2*e+2,r=e;if(t<this.length&&this.isHigherPriority(t,r)&&(r=t),n<this.length&&this.isHigherPriority(n,r)&&(r=n),r!==e){var i=this.items[e];this.items[e]=this.items[r],this.items[r]=i,this.heapify(r)}}},it.peek=function(){return this.items[0].value},it.removeAt=function(e){this.items[e]=this.items[--this.length],this.items[this.length]=o,this.heapify()},it.dequeue=function(){var e=this.peek();return this.removeAt(0),e},it.enqueue=function(e){var t=this.length++;this.items[t]=new S(rt.count++,e),this.percolate(t)},it.remove=function(e){for(var t=0;t<this.length;t++)if(this.items[t].value===e)return this.removeAt(t),!0;return!1},rt.count=0;var ot=ee.CompositeDisposable=function(){var e,t,n=[];if(Array.isArray(arguments[0]))n=arguments[0],t=n.length;else for(t=arguments.length,n=new Array(t),e=0;t>e;e++)n[e]=arguments[e];for(e=0;t>e;e++)if(!ht(n[e]))throw new TypeError("Not a disposable");this.disposables=n,this.isDisposed=!1,this.length=n.length},st=ot.prototype;st.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},st.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},st.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;e>n;n++)t[n]=this.disposables[n];for(this.disposables=[],this.length=0,n=0;e>n;n++)t[n].dispose()}};var at=ee.Disposable=function(e){this.isDisposed=!1,this.action=e||te};at.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ut=at.create=function(e){return new at(e)},ct=at.empty={dispose:te},ht=at.isDisposable=function(e){return e&&ue(e.dispose)},lt=at.checkDisposed=function(e){if(e.isDisposed)throw new me},pt=ee.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};pt.prototype.getDisposable=function(){return this.current},pt.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()},pt.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var ft=ee.SerialDisposable=function(){this.isDisposed=!1,this.current=null};ft.prototype.getDisposable=function(){return this.current},ft.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e}n&&n.dispose(),t&&e&&e.dispose()},ft.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var dt=ee.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?ct:new e(this)},t}();M.prototype.dispose=function(){this.scheduler.scheduleWithState(this,E)};var mt=ee.internals.ScheduledItem=function(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||oe,this.disposable=new pt};mt.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},mt.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},mt.prototype.isCancelled=function(){return this.disposable.isDisposed},mt.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var vt=ee.Scheduler=function(){function e(e,t,n,r){this.now=e,this._schedule=t,this._scheduleRelative=n,this._scheduleAbsolute=r}function t(e,t){return t(),ct}e.isScheduler=function(t){return t instanceof e};var n=e.prototype;return n.schedule=function(e){return this._schedule(e,t)},n.scheduleWithState=function(e,t){return this._schedule(e,t)},n.scheduleWithRelative=function(e,n){return this._scheduleRelative(n,e,t)},n.scheduleWithRelativeAndState=function(e,t,n){return this._scheduleRelative(e,t,n)},n.scheduleWithAbsolute=function(e,n){return this._scheduleAbsolute(n,e,t)},n.scheduleWithAbsoluteAndState=function(e,t,n){return this._scheduleAbsolute(e,t,n)},e.now=re,e.normalize=function(e){return 0>e&&(e=0),e},e}(),gt=vt.normalize,yt=vt.isScheduler;!function(e){function t(e,t){function n(t){i(t,function(t){var r=!1,i=!1,s=e.scheduleWithState(t,function(e,t){return r?o.remove(s):i=!0,n(t),ct});i||(o.add(s),r=!0)})}var r=t[0],i=t[1],o=new ot;return n(r),o}function n(e,t,n){function r(t){o(t,function(t,i){var o=!1,a=!1,u=e[n](t,i,function(e,t){return o?s.remove(u):a=!0,r(t),ct});a||(s.add(u),o=!0)})}var i=t[0],o=t[1],s=new ot;return r(i),s}function r(e,t){e(function(n){t(e,n)})}e.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,r)},e.scheduleRecursiveWithState=function(e,n){return this.scheduleWithState([e,n],t)},e.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,r)},e.scheduleRecursiveWithRelativeAndState=function(e,t,r){return this._scheduleRelative([e,r],t,function(e,t){return n(e,t,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,r)},e.scheduleRecursiveWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute([e,r],t,function(e,t){return n(e,t,"scheduleWithAbsoluteAndState")})}}(vt.prototype),function(e){vt.prototype.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,t)},vt.prototype.schedulePeriodicWithState=function(e,t,n){if("undefined"==typeof Y.setInterval)throw new ge;t=gt(t);var r=e,i=Y.setInterval(function(){r=n(r)},t);return ut(function(){Y.clearInterval(i)})}}(vt.prototype),function(e){e.catchError=e["catch"]=function(e){return new Ct(this,e)}}(vt.prototype);var _t,bt,xt=(ee.internals.SchedulePeriodicRecursive=function(){function e(e,t){t(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new pt;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,e.bind(this))),t},t}(),vt.immediate=function(){function e(e,t){return t(this,e)}return new vt(re,e,be,be)}()),wt=vt.currentThread=function(){function e(){for(;n.length>0;){var e=n.dequeue();!e.isCancelled()&&e.invoke()}}function t(t,r){var i=new mt(this,t,r,this.now());if(n)n.enqueue(i);else{n=new rt(4),n.enqueue(i);var o=x(e)();if(n=null,o===nt)return w(o.e)}return i.disposable}var n,r=new vt(re,t,be,be);return r.scheduleRequired=function(){return!n},r}(),St=function(){var e,t=te;if(Y.setTimeout)e=Y.setTimeout,t=Y.clearTimeout;else{if(!Y.WScript)throw new ge;e=function(e,t){Y.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),Mt=St.setTimeout,Et=St.clearTimeout;!function(){function e(t){if(s)Mt(function(){e(t)},0);else{var n=o[t];if(n){s=!0;var r=x(n)();if(bt(t),s=!1,r===nt)return w(r.e)}}}function n(){if(!Y.postMessage||Y.importScripts)return!1;var e=!1,t=Y.onmessage;return Y.onmessage=function(){e=!0},Y.postMessage("","*"),Y.onmessage=t,e}function r(t){"string"==typeof t.data&&t.data.substring(0,c.length)===c&&e(t.data.substring(c.length))}var i=1,o={},s=!1;bt=function(e){delete o[e]};var a=RegExp("^"+String(Be).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),u="function"==typeof(u=Q&&J&&Q.setImmediate)&&!a.test(u)&&u;if(ue(u))_t=function(t){var n=i++;return o[n]=t,u(function(){e(n)}),n};else if("undefined"!=typeof t&&"[object process]"==={}.toString.call(t))_t=function(n){var r=i++;return o[r]=n,t.nextTick(function(){e(r)}),r};else if(n()){var c="ms.rx.schedule"+Math.random();Y.addEventListener?Y.addEventListener("message",r,!1):Y.attachEvent?Y.attachEvent("onmessage",r):Y.onmessage=r,_t=function(e){var t=i++;return o[t]=e,Y.postMessage(c+currentId,"*"),t}}else if(Y.MessageChannel){var h=new Y.MessageChannel;h.port1.onmessage=function(t){e(t.data)},_t=function(e){var t=i++;return o[t]=e,h.port2.postMessage(t),t}}else _t="document"in Y&&"onreadystatechange"in Y.document.createElement("script")?function(t){var n=Y.document.createElement("script"),r=i++;return o[r]=t,n.onreadystatechange=function(){e(r),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},Y.document.documentElement.appendChild(n),r}:function(t){var n=i++;return o[n]=t,Mt(function(){e(n)},0),n}}();var Ct=(vt.timeout=vt["default"]=function(){function e(e,t){var n=this,r=new pt,i=_t(function(){!r.isDisposed&&r.setDisposable(t(n,e))});return new ot(r,ut(function(){bt(i)}))}function t(e,t,n){var r=this,i=vt.normalize(t),o=new pt;if(0===i)return r.scheduleWithState(e,n);var s=Mt(function(){!o.isDisposed&&o.setDisposable(n(r,e))},i);return new ot(o,ut(function(){Et(s)}))}function n(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}return new vt(re,e,t,n)}(),function(e){function t(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function n(e,t,n){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(n))}function r(e,t,n){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(n))}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,n,r)}return Qe(i,e),i.prototype._clone=function(e){return new i(e,this._handler)},i.prototype._wrap=function(e){var t=this;return function(n,r){try{return e(t._getRecursiveWrapper(n),r)}catch(i){if(!t._handler(i))throw i;return ct}}},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,n){var r=this,i=!1,o=new pt;return o.setDisposable(this._scheduler.schedulePeriodicWithState(e,t,function(e){if(i)return null;try{return n(e)}catch(t){if(i=!0,!r._handler(t))throw t;return o.dispose(),null}})),o},i}(vt)),Tt=ee.Notification=function(){function e(e,t,n,r,i,o){this.kind=e,this.value=t,this.exception=n,this._accept=r,this._acceptObservable=i,this.toString=o}return e.prototype.accept=function(e,t,n){return e&&"object"==typeof e?this._acceptObservable(e):this._accept(e,t,n)},e.prototype.toObservable=function(e){var t=this;return yt(e)||(e=xt),new Nn(function(n){return e.scheduleWithState(t,function(e,t){t._acceptObservable(n),"N"===t.kind&&n.onCompleted()})})},e}(),At=Tt.createOnNext=function(){function e(e){return e(this.value)}function t(e){return e.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){return new Tt("N",r,null,e,t,n)}}(),Pt=Tt.createOnError=function(){function e(e,t){return t(this.exception)}function t(e){return e.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){return new Tt("E",null,r,e,t,n)}}(),Ot=Tt.createOnCompleted=function(){function e(e,t,n){return n()}function t(e){return e.onCompleted()}function n(){return"OnCompleted()"}return function(){return new Tt("C",null,null,e,t,n)}}(),Lt=ee.Observer=function(){};Lt.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},Lt.prototype.asObserver=function(){return new It(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Lt.prototype.checked=function(){return new kt(this)};var Rt=Lt.create=function(e,t,n){return e||(e=te),t||(t=se),n||(n=te),new It(e,t,n)};Lt.fromNotifier=function(e,t){return new It(function(n){return e.call(t,At(n))},function(n){return e.call(t,Pt(n))},function(){return e.call(t,Ot())})},Lt.prototype.notifyOn=function(e){return new Ft(e,this)},Lt.prototype.makeSafe=function(e){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,e)};var Nt,Dt=ee.internals.AbstractObserver=function(e){function t(){this.isStopped=!1,e.call(this)}return Qe(t,e),t.prototype.next=_e,t.prototype.error=_e,t.prototype.completed=_e,t.prototype.onNext=function(e){this.isStopped||this.next(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.error(e),!0)},t}(Lt),It=ee.AnonymousObserver=function(e){function t(t,n,r){e.call(this),this._onNext=t,this._onError=n,this._onCompleted=r}return Qe(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}(Dt),kt=function(e){function t(t){e.call(this),this._observer=t,this._state=0}Qe(t,e);var n=t.prototype;return n.onNext=function(e){this.checkAccess();var t=x(this._observer.onNext).call(this._observer,e);this._state=0,t===nt&&w(t.e)},n.onError=function(e){this.checkAccess();var t=x(this._observer.onError).call(this._observer,e);this._state=2,t===nt&&w(t.e)},n.onCompleted=function(){this.checkAccess();var e=x(this._observer.onCompleted).call(this._observer);this._state=2,e===nt&&w(e.e)},n.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}(Lt),jt=ee.internals.ScheduledObserver=function(e){function t(t,n){e.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new ft}return Qe(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 n;if(!(t.queue.length>0))return void(t.isAcquired=!1);n=t.queue.shift();try{n()}catch(r){throw t.queue=[],t.hasFaulted=!0,r}e()}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}(Dt),Ft=function(e){function t(t,n,r){e.call(this,t,n),this._cancel=r}return Qe(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}(jt),Bt=ee.Observable=function(){function e(e){if(ee.config.longStackSupport&&ce){try{throw new Error}catch(t){this.stack=t.stack.substring(t.stack.indexOf("\n")+1)}var n=this;this._subscribe=function(t){var r=t.onError.bind(t);return t.onError=function(e){u(e,n),r(e)},e.call(n,t)}}else this._subscribe=e}return Nt=e.prototype,Nt.subscribe=Nt.forEach=function(e,t,n){return this._subscribe("object"==typeof e?e:Rt(e,t,n))},Nt.subscribeOnNext=function(e,t){return this._subscribe(Rt("undefined"!=typeof t?function(n){e.call(t,n)}:e))},Nt.subscribeOnError=function(e,t){return this._subscribe(Rt(null,"undefined"!=typeof t?function(n){e.call(t,n)}:e))},Nt.subscribeOnCompleted=function(e,t){return this._subscribe(Rt(null,null,"undefined"!=typeof t?function(){e.call(t)}:e))},e}(),Vt=ee.ObservableBase=function(e){function t(e){return e&&ue(e.dispose)?e:ue(e)?ut(e):ct}function n(e,n){var r=n[0],i=n[1],o=x(i.subscribeCore).call(i,r);return o!==nt||r.fail(nt.e)?void r.setDisposable(t(o)):w(nt.e)}function r(e){var t=new Dn(e),r=[t,this];return wt.scheduleRequired()?wt.scheduleWithState(r,n):n(null,r),t}function i(){e.call(this,r)}return Qe(i,e),i.prototype.subscribeCore=_e,i}(Bt),Ut=ee.internals.Enumerable=function(){},Gt=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t,n){this.o=e,this.s=t,this.e=n,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){var t,r=new ft,i=xt.scheduleRecursiveWithState(this.sources[xe](),function(i,o){if(!t){var s=x(i.next).call(i);if(s===nt)return e.onError(s.e);if(s.done)return e.onCompleted();var a=s.value;ae(a)&&(a=Yt(a));var u=new pt;r.setDisposable(u),u.setDisposable(a.subscribe(new n(e,o,i)))}});return new ot(r,i,ut(function(){t=!0}))},n.prototype.onNext=function(e){this.isStopped||this.o.onNext(e)},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Ut.prototype.concat=function(){return new Gt(this)};var zt=function(e){function t(t){this.sources=t,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t,n=this.sources[xe](),r=new ft,i=xt.scheduleRecursiveWithState(null,function(i,o){if(!t){var s=x(n.next).call(n);if(s===nt)return e.onError(s.e);if(s.done)return null!==i?e.onError(i):e.onCompleted();var a=s.value;ae(a)&&(a=Yt(a));var u=new pt;r.setDisposable(u),u.setDisposable(a.subscribe(function(t){e.onNext(t)},o,function(){e.onCompleted()}))}});return new ot(r,i,ut(function(){t=!0}))},t}(Vt);Ut.prototype.catchError=function(){return new zt(this)},Ut.prototype.catchErrorWhen=function(e){var t=this;return new Nn(function(n){var r,i,o=new kn,s=new kn,a=e(o),u=a.subscribe(s),c=t[xe](),h=new ft,l=xt.scheduleRecursive(function(e){if(!r){var t=x(c.next).call(c);if(t===nt)return n.onError(t.e);if(t.done)return void(i?n.onError(i):n.onCompleted());var a=t.value;ae(a)&&(a=Yt(a));var u=new pt,l=new pt;h.setDisposable(new ot(l,u)),u.setDisposable(a.subscribe(function(e){n.onNext(e)},function(t){l.setDisposable(s.subscribe(e,function(e){n.onError(e)},function(){n.onCompleted()})),o.onNext(t)},function(){n.onCompleted()}))}});return new ot(u,h,l,ut(function(){r=!0}))})};var Ht=function(e){function t(e,t){this.v=e,this.c=null==t?-1:t}function n(e){this.v=e.v,this.l=e.c}return Qe(t,e),t.prototype[xe]=function(){return new n(this)},n.prototype.next=function(){return 0===this.l?we:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(Ut),$t=Ut.repeat=function(e,t){return new Ht(e,t)},Wt=function(e){function t(e,t,n){this.s=e,this.fn=t?Ce(t,n,3):null}function n(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return Qe(t,e),t.prototype[xe]=function(){return new n(this)},n.prototype.next=function(){return++this.i<this.l?{done:!1,value:this.fn?this.fn(this.s[this.i],this.i,this.s):this.s[this.i]}:we},t}(Ut),qt=Ut.of=function(e,t,n){return new Wt(e,t,n)};Nt.observeOn=function(e){var t=this;return new Nn(function(n){return t.subscribe(new Ft(e,n))},t)},Nt.subscribeOn=function(e){var t=this;return new Nn(function(n){var r=new pt,i=new ft;return i.setDisposable(r),r.setDisposable(e.schedule(function(){i.setDisposable(new M(e,t.subscribe(n)))})),i},t)};var Xt=function(e){function t(t){this.p=t,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.p.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),ct},t}(Vt),Yt=Bt.fromPromise=function(e){return new Xt(e)};Nt.toPromise=function(e){if(e||(e=ee.config.Promise),!e)throw new ge("Promise type not provided nor in Rx.config.Promise");var t=this;return new e(function(e,n){var r,i=!1;t.subscribe(function(e){r=e,i=!0},n,function(){i&&e(r)})})};var Kt=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.a=[],this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},n.prototype.onNext=function(e){this.isStopped||this.a.push(e)},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onNext(this.a),this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.toArray=function(){return new Kt(this)},Bt.create=Bt.createWithDisposable=function(e,t){return new Nn(e,t)};var Zt=(Bt.defer=function(e){return new Nn(function(t){var n;try{n=e()}catch(r){return dn(r).subscribe(t)}return ae(n)&&(n=Yt(n)),n.subscribe(t)})},function(e){function t(t){this.scheduler=t,e.call(this)}function n(e,t){this.observer=e,this.parent=t}function r(e,t){t.onCompleted()}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new n(e,this);return t.run()},n.prototype.run=function(){return this.parent.scheduler.scheduleWithState(this.observer,r)},t}(Vt)),Jt=Bt.empty=function(e){return yt(e)||(e=xt),new Zt(e)},Qt=function(e){function t(t,n,r){this.iterable=t,this.mapper=n,this.scheduler=r,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new en(e,this);return t.run()},t}(Vt),en=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){function e(e,t){try{var o=n.next()}catch(s){return r.onError(s)}if(o.done)return r.onCompleted();var a=o.value;if(i)try{a=i(a,e)}catch(s){return r.onError(s)}r.onNext(a),t(e+1)}var t=Object(this.parent.iterable),n=L(t),r=this.observer,i=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},e}(),tn=Math.pow(2,53)-1;C.prototype[xe]=function(){return new T(this._s)},T.prototype[xe]=function(){return this},T.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:we},A.prototype[xe]=function(){return new P(this._a)},P.prototype[xe]=function(){return this},P.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:we};var nn=Bt.from=function(e,t,n,r){if(null==e)throw new Error("iterable cannot be null.");if(t&&!ue(t))throw new Error("mapFn when provided must be a function");if(t)var i=Ce(t,n,2);return yt(r)||(r=wt),new Qt(e,i,r)},rn=function(e){function t(t,n){this.args=t,this.scheduler=n,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new D(e,this);return t.run()},t}(Vt);D.prototype.run=function(){function e(e,i){r>e?(t.onNext(n[e]),i(e+1)):t.onCompleted()}var t=this.observer,n=this.parent.args,r=n.length;return this.parent.scheduler.scheduleRecursiveWithState(0,e)};var on=Bt.fromArray=function(e,t){return yt(t)||(t=wt),new rn(e,t)};Bt.generate=function(e,t,n,r,i){return yt(i)||(i=wt),new Nn(function(o){var s=!0;return i.scheduleRecursiveWithState(e,function(e,i){var a,u;try{s?s=!1:e=n(e),a=t(e),a&&(u=r(e))}catch(c){return o.onError(c)}a?(o.onNext(u),i(e)):o.onCompleted()})})};var sn=function(e){function t(){e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){return ct},t}(Vt),an=Bt.never=function(){return new sn};Bt.of=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return new rn(t,wt)},Bt.ofWithScheduler=function(e){for(var t=arguments.length,n=new Array(t-1),r=1;t>r;r++)n[r-1]=arguments[r];return new rn(n,e)};var un=function(e){function t(t,n){this.obj=t,this.keys=Object.keys(t),this.scheduler=n,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new k(e,this);return t.run()},t}(Vt);k.prototype.run=function(){function e(e,o){if(i>e){var s=r[e];t.onNext([s,n[s]]),o(e+1)}else t.onCompleted()}var t=this.observer,n=this.parent.obj,r=this.parent.keys,i=r.length;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},Bt.pairs=function(e,t){return t||(t=wt),new un(e,t)};var cn=function(e){function t(t,n,r){this.start=t,this.rangeCount=n,this.scheduler=r,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new hn(e,this);return t.run()},t}(Vt),hn=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){function e(e,i){n>e?(r.onNext(t+e),i(e+1)):r.onCompleted()}var t=this.parent.start,n=this.parent.rangeCount,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},e}();Bt.range=function(e,t,n){return yt(n)||(n=wt),new cn(e,t,n)};var ln=function(e){function t(t,n,r){this.value=t,this.repeatCount=null==n?-1:n,this.scheduler=r,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new j(e,this);return t.run()},t}(Vt);j.prototype.run=function(){function e(e,r){return(-1===e||e>0)&&(t.onNext(n),e>0&&e--),0===e?t.onCompleted():void r(e)}var t=this.observer,n=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,e)},Bt.repeat=function(e,t,n){return yt(n)||(n=wt),new ln(e,t,n)};var pn=function(e){function t(t,n){this.value=t,this.scheduler=n,e.call(this)}function n(e,t){this.observer=e,this.parent=t}function r(e,t){var n=t[0],r=t[1];r.onNext(n),r.onCompleted()}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new n(e,this);return t.run()},n.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],r)},t}(Vt),fn=(Bt["return"]=Bt.just=Bt.returnValue=function(e,t){return yt(t)||(t=xt),new pn(e,t)},function(e){function t(t,n){this.error=t,this.scheduler=n,e.call(this)}function n(e,t){this.o=e,this.p=t}function r(e,t){var n=t[0],r=t[1];r.onError(n)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new n(e,this);return t.run()},n.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],r)},t}(Vt)),dn=Bt["throw"]=Bt.throwError=Bt.throwException=function(e,t){return yt(t)||(t=xt),new fn(e,t)};Bt.using=function(e,t){return new Nn(function(n){var r,i,o=ct;try{r=e(),r&&(o=r),i=t(r)}catch(s){return new ot(dn(s).subscribe(n),o)}return new ot(i.subscribe(n),o)})},Nt.amb=function(e){var t=this;return new Nn(function(n){function r(){o||(o=s,c.dispose())}function i(){o||(o=a,u.dispose())}var o,s="L",a="R",u=new pt,c=new pt;return ae(e)&&(e=Yt(e)),u.setDisposable(t.subscribe(function(e){r(),o===s&&n.onNext(e)},function(e){r(),o===s&&n.onError(e)},function(){r(),o===s&&n.onCompleted()})),c.setDisposable(e.subscribe(function(e){i(),o===a&&n.onNext(e)},function(e){i(),o===a&&n.onError(e)},function(){i(),o===a&&n.onCompleted()})),new ot(u,c)})},Bt.amb=function(){function e(e,t){return e.amb(t)}var t=an(),n=[];if(Array.isArray(arguments[0]))n=arguments[0];else for(var r=0,i=arguments.length;i>r;r++)n.push(arguments[r]);for(var r=0,i=n.length;i>r;r++)t=e(t,n[r]);return t},Nt["catch"]=Nt.catchError=Nt.catchException=function(e){return"function"==typeof e?F(this,e):mn([this,e])};var mn=Bt.catchError=Bt["catch"]=Bt.catchException=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return qt(e).catchError()};Nt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),vn.apply(this,t)};var vn=Bt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=t.pop();return Array.isArray(t[0])&&(t=t[0]),new Nn(function(e){function n(t){if(a[t]=!0,u||(u=a.every(ne))){try{var n=r.apply(null,h)}catch(i){return e.onError(i)}e.onNext(n)}else c.filter(function(e,n){return n!==t}).every(ne)&&e.onCompleted()}function i(t){c[t]=!0,c.every(ne)&&e.onCompleted()}for(var o=t.length,s=function(){return!1},a=_(o,s),u=!1,c=_(o,s),h=new Array(o),l=new Array(o),p=0;o>p;p++)!function(r){var o=t[r],s=new pt;ae(o)&&(o=Yt(o)),s.setDisposable(o.subscribe(function(e){h[r]=e,n(r)},function(t){e.onError(t)},function(){i(r)})),l[r]=s}(p);return new ot(l)},this)};Nt.concat=function(){for(var e=[],t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return e.unshift(this),yn.apply(null,e)};var gn=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){this.sources=e,this.o=t}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new n(this.sources,e);return t.run()},n.prototype.run=function(){var e,t=new ft,n=this.sources,r=n.length,i=this.o,o=xt.scheduleRecursiveWithState(0,function(o,s){if(!e){if(o===r)return i.onCompleted();var a=n[o];ae(a)&&(a=Yt(a));var u=new pt;t.setDisposable(u),u.setDisposable(a.subscribe(function(e){i.onNext(e)},function(e){i.onError(e)},function(){s(o+1)}))}});return new ot(t,o,ut(function(){e=!0}))},t}(Vt),yn=Bt.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,n=arguments.length;n>t;t++)e[t]=arguments[t]}return new gn(e)};Nt.concatAll=Nt.concatObservable=function(){return this.merge(1)};var _n=function(e){function t(t,n){this.source=t,this.maxConcurrent=n,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new ot;return t.add(this.source.subscribe(new bn(e,this.maxConcurrent,t))),t},t}(Vt),bn=function(){function e(e,t,n){this.o=e,this.max=t,this.g=n,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 n=new pt;this.g.add(n),ae(e)&&(e=Yt(e)),n.setDisposable(e.subscribe(new t(this,n)))},e.prototype.onNext=function(e){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(e)):this.q.push(e))},e.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,
|
||
this.o.onError(e),!0)},t.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},t.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=this.parent;e.g.remove(this.sad),e.q.length>0?e.handleSubscribe(e.q.shift()):(e.activeCount--,e.done&&0===e.activeCount&&e.o.onCompleted())}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();Nt.merge=function(e){return"number"!=typeof e?xn(this,e):new _n(this,e)};var xn=Bt.merge=function(){var e,t,n=[],r=arguments.length;if(arguments[0])if(yt(arguments[0]))for(e=arguments[0],t=1;r>t;t++)n.push(arguments[t]);else for(e=xt,t=0;r>t;t++)n.push(arguments[t]);else for(e=xt,t=1;r>t;t++)n.push(arguments[t]);return Array.isArray(n[0])&&(n=n[0]),I(e,n).mergeAll()},wn=ee.CompositeError=function(e){this.name="NotImplementedError",this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};wn.prototype=Error.prototype,Bt.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}var r=I(null,e);return new Nn(function(e){function t(){0===s.length?e.onCompleted():1===s.length?e.onError(s[0]):e.onError(new wn(s))}var n=new ot,i=new pt,o=!1,s=[];return n.add(i),i.setDisposable(r.subscribe(function(r){var i=new pt;n.add(i),ae(r)&&(r=Yt(r)),i.setDisposable(r.subscribe(function(t){e.onNext(t)},function(e){s.push(e),n.remove(i),o&&1===n.length&&t()},function(){n.remove(i),o&&1===n.length&&t()}))},function(e){s.push(e),o=!0,1===n.length&&t()},function(){o=!0,1===n.length&&t()})),n})};var Sn=function(e){function t(t){this.source=t,e.call(this)}function n(e,t){this.o=e,this.g=t,this.isStopped=!1,this.done=!1}function r(e,t,n){this.parent=e,this.g=t,this.sad=n,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new ot,r=new pt;return t.add(r),r.setDisposable(this.source.subscribe(new n(e,t))),t},n.prototype.onNext=function(e){if(!this.isStopped){var t=new pt;this.g.add(t),ae(e)&&(e=Yt(e)),t.setDisposable(e.subscribe(new r(this,this.g,t)))}},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},r.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},r.prototype.onCompleted=function(){if(!this.isStopped){var e=this.parent;this.isStopped=!0,e.g.remove(this.sad),e.done&&1===e.g.length&&e.o.onCompleted()}},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},t}(Vt);Nt.mergeAll=Nt.mergeObservable=function(){return new Sn(this)},Nt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return Mn([this,e])};var Mn=Bt.onErrorResumeNext=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return new Nn(function(t){var n=0,r=new ft,i=xt.scheduleRecursive(function(i){var o,s;n<e.length?(o=e[n++],ae(o)&&(o=Yt(o)),s=new pt,r.setDisposable(s),s.setDisposable(o.subscribe(t.onNext.bind(t),i,i))):t.onCompleted()});return new ot(r,i)})};Nt.skipUntil=function(e){var t=this;return new Nn(function(n){var r=!1,i=new ot(t.subscribe(function(e){r&&n.onNext(e)},function(e){n.onError(e)},function(){r&&n.onCompleted()}));ae(e)&&(e=Yt(e));var o=new pt;return i.add(o),o.setDisposable(e.subscribe(function(){r=!0,o.dispose()},function(e){n.onError(e)},function(){o.dispose()})),i},t)};var En=function(e){function t(t){this.source=t,e.call(this)}function n(e,t){this.o=e,this.inner=t,this.stopped=!1,this.latest=0,this.hasLatest=!1,this.isStopped=!1}function r(e,t){this.parent=e,this.id=t,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){var t=new ft,r=this.source.subscribe(new n(e,t));return new ot(r,t)},n.prototype.onNext=function(e){if(!this.isStopped){var t=new pt,n=++this.latest;this.hasLatest=!0,this.inner.setDisposable(t),ae(e)&&(e=Yt(e)),t.setDisposable(e.subscribe(new r(this,n)))}},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.stopped=!0,!this.hasLatest&&this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},r.prototype.onNext=function(e){this.isStopped||this.parent.latest===this.id&&this.parent.o.onNext(e)},r.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&this.parent.o.onError(e))},r.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.isStopped&&this.parent.o.onCompleted()))},r.prototype.dispose=function(){this.isStopped=!0},r.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},t}(Vt);Nt["switch"]=Nt.switchLatest=function(){return new En(this)};var Cn=function(e){function t(t,n){this.source=t,this.other=ae(n)?Yt(n):n,e.call(this)}function n(e){this.o=e,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return new ot(this.source.subscribe(e),this.other.subscribe(new n(e)))},n.prototype.onNext=function(e){this.isStopped||this.o.onCompleted()},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){!this.isStopped&&(this.isStopped=!0)},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.takeUntil=function(e){return new Cn(this,e)},Nt.withLatestFrom=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=t.pop(),i=this;return Array.isArray(t[0])&&(t=t[0]),new Nn(function(e){for(var n=t.length,o=_(n,B),s=!1,a=new Array(n),u=new Array(n+1),c=0;n>c;c++)!function(n){var r=t[n],i=new pt;ae(r)&&(r=Yt(r)),i.setDisposable(r.subscribe(function(e){a[n]=e,o[n]=!0,s=o.every(ne)},function(t){e.onError(t)},te)),u[n]=i}(c);var h=new pt;return h.setDisposable(i.subscribe(function(t){var n=[t].concat(a);if(s){var i=x(r).apply(null,n);return i===nt?e.onError(i.e):void e.onNext(i)}},function(t){e.onError(t)},function(){e.onCompleted()})),u[n]=h,new ot(u)},this)},Nt.zip=function(){if(Array.isArray(arguments[0]))return V.apply(this,arguments);for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t.pop();return t.unshift(r),new Nn(function(e){for(var n=t.length,o=_(n,U),s=_(n,B),a=new Array(n),u=0;n>u;u++)!function(n){var u=t[n],c=new pt;ae(u)&&(u=Yt(u)),c.setDisposable(u.subscribe(function(t){if(o[n].push(t),o.every(function(e){return e.length>0})){var a=o.map(function(e){return e.shift()}),u=x(i).apply(r,a);if(u===nt)return e.onError(u.e);e.onNext(u)}else s.filter(function(e,t){return t!==n}).every(ne)&&e.onCompleted()},function(t){e.onError(t)},function(){s[n]=!0,s.every(ne)&&e.onCompleted()})),a[n]=c}(u);return new ot(a)},r)},Bt.zip=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=t.shift();return r.zip.apply(r,t)},Bt.zipArray=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new Nn(function(t){for(var n=e.length,r=_(n,G),i=_(n,B),o=new Array(n),s=0;n>s;s++)!function(n){o[n]=new pt,o[n].setDisposable(e[n].subscribe(function(e){if(r[n].push(e),r.every(function(e){return e.length>0})){var o=r.map(function(e){return e.shift()});t.onNext(o)}else if(i.filter(function(e,t){return t!==n}).every(ne))return t.onCompleted()},function(e){t.onError(e)},function(){i[n]=!0,i.every(ne)&&t.onCompleted()}))}(s);return new ot(o)})},Nt.asObservable=function(){var e=this;return new Nn(function(t){return e.subscribe(t)},e)},Nt.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})},Nt.dematerialize=function(){var e=this;return new Nn(function(t){return e.subscribe(function(e){return e.accept(t)},function(e){t.onError(e)},function(){t.onCompleted()})},this)},Nt.distinctUntilChanged=function(e,t){var n=this;return t||(t=ie),new Nn(function(r){var i,o=!1;return n.subscribe(function(n){var s=n;if(e&&(s=x(e)(n),s===nt))return r.onError(s.e);if(o){var a=x(t)(i,s);if(a===nt)return r.onError(a.e)}o&&a||(o=!0,i=s,r.onNext(n))},function(e){r.onError(e)},function(){r.onCompleted()})},this)};var Tn=function(e){function t(t,n,r,i){this.source=t,this.t=!n||ue(n)?Rt(n||te,r||te,i||te):n,e.call(this)}function n(e,t){this.o=e,this.t=t,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.t))},n.prototype.onNext=function(e){if(!this.isStopped){var t=x(this.t.onNext).call(this.t,e);t===nt&&this.o.onError(t.e),this.o.onNext(e)}},n.prototype.onError=function(e){if(!this.isStopped){this.isStopped=!0;var t=x(this.t.onError).call(this.t,e);if(t===nt)return this.o.onError(t.e);this.o.onError(e)}},n.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var e=x(this.t.onCompleted).call(this.t);if(e===nt)return this.o.onError(e.e);this.o.onCompleted()}},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt["do"]=Nt.tap=Nt.doAction=function(e,t,n){return new Tn(this,e,t,n)},Nt.doOnNext=Nt.tapOnNext=function(e,t){return this.tap("undefined"!=typeof t?function(n){e.call(t,n)}:e)},Nt.doOnError=Nt.tapOnError=function(e,t){return this.tap(te,"undefined"!=typeof t?function(n){e.call(t,n)}:e)},Nt.doOnCompleted=Nt.tapOnCompleted=function(e,t){return this.tap(te,null,"undefined"!=typeof t?function(){e.call(t)}:e)},Nt["finally"]=Nt.ensure=function(e){var t=this;return new Nn(function(n){var r;try{r=t.subscribe(n)}catch(i){throw e(),i}return ut(function(){try{r.dispose()}catch(t){throw t}finally{e()}})},this)},Nt.finallyAction=function(e){return this.ensure(e)};var An=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},n.prototype.onNext=te,n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},t}(Vt);Nt.ignoreElements=function(){return new An(this)},Nt.materialize=function(){var e=this;return new Nn(function(t){return e.subscribe(function(e){t.onNext(At(e))},function(e){t.onNext(Pt(e)),t.onCompleted()},function(){t.onNext(Ot()),t.onCompleted()})},e)},Nt.repeat=function(e){return $t(this,e).concat()},Nt.retry=function(e){return $t(this,e).catchError()},Nt.retryWhen=function(e){return $t(this).catchErrorWhen(e)};var Pn=function(e){function t(t,n,r,i){this.source=t,this.accumulator=n,this.hasSeed=r,this.seed=i,e.call(this)}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new z(e,this))},t}(Vt);z.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(t){return this.observer.onError(t)}this.observer.onNext(this.accumulation)}},z.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},z.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},z.prototype.dispose=function(){this.isStopped=!0},z.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},Nt.scan=function(){var e,t,n=!1;return 2===arguments.length?(n=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new Pn(this,t,n,e)},Nt.skipLast=function(e){if(0>e)throw new ve;var t=this;return new Nn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&n.onNext(r.shift())},function(e){n.onError(e)},function(){n.onCompleted()})},t)},Nt.startWith=function(){var e,t=0;arguments.length&&yt(arguments[0])?(e=arguments[0],t=1):e=xt;for(var n=[],r=t,i=arguments.length;i>r;r++)n.push(arguments[r]);return qt([on(n,e),this]).concat()},Nt.takeLast=function(e){if(0>e)throw new ve;var t=this;return new Nn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},function(e){n.onError(e)},function(){for(;r.length>0;)n.onNext(r.shift());n.onCompleted()})},t)},Nt.takeLastBuffer=function(e){var t=this;return new Nn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},function(e){n.onError(e)},function(){n.onNext(r),n.onCompleted()})},t)},Nt.windowWithCount=function(e,t){var n=this;if(+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new ve;if(null==t&&(t=e),+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new ve;return new Nn(function(r){function i(){var e=new kn;u.push(e),r.onNext(tt(e,s))}var o=new pt,s=new dt(o),a=0,u=[];return i(),o.setDisposable(n.subscribe(function(n){for(var r=0,o=u.length;o>r;r++)u[r].onNext(n);var s=a-e+1;s>=0&&s%t===0&&u.shift().onCompleted(),++a%t===0&&i()},function(e){for(;u.length>0;)u.shift().onError(e);r.onError(e)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),s},n)},Nt.selectConcat=Nt.concatMap=function(e,t,n){return ue(e)&&ue(t)?this.concatMap(function(n,r){var i=e(n,r);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i.map(function(e,i){return t(n,e,r,i)})}):ue(e)?H(this,e,n):H(this,function(){return e})},Nt.concatMapObserver=Nt.selectConcatObserver=function(e,t,n,r){var i=this,o=Ce(e,r,2),s=Ce(t,r,1),a=Ce(n,r,0);return new Nn(function(e){var t=0;return i.subscribe(function(n){var r;try{r=o(n,t++)}catch(i){return void e.onError(i)}ae(r)&&(r=Yt(r)),e.onNext(r)},function(t){var n;try{n=s(t)}catch(r){return void e.onError(r)}ae(n)&&(n=Yt(n)),e.onNext(n),e.onCompleted()},function(){var t;try{t=a()}catch(n){return void e.onError(n)}ae(t)&&(t=Yt(t)),e.onNext(t),e.onCompleted()})},this).concatAll()},Nt.defaultIfEmpty=function(e){var t=this;return e===o&&(e=null),new Nn(function(n){var r=!1;return t.subscribe(function(e){r=!0,n.onNext(e)},function(e){n.onError(e)},function(){!r&&n.onNext(e),n.onCompleted()})},t)},W.prototype.push=function(e){var t=-1===$(this.set,e,this.comparer);return t&&this.set.push(e),t},Nt.distinct=function(e,t){var n=this;return t||(t=ie),new Nn(function(r){var i=new W(t);return n.subscribe(function(t){var n=t;if(e)try{n=e(t)}catch(o){return void r.onError(o)}i.push(n)&&r.onNext(t)},function(e){r.onError(e)},function(){r.onCompleted()})},this)};var On=function(e){function t(t,n,r){this.source=t,this.selector=Ce(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return e.call(this,t.selector(n,r,i),r,i)}}function r(e,t,n){this.o=e,this.selector=t,this.source=n,this.i=0,this.isStopped=!1}return Qe(t,e),t.prototype.internalMap=function(e,r){return new t(this.source,n(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=x(this.selector)(e,this.i++,this.source);return t===nt?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?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.map=Nt.select=function(e,t){var n="function"==typeof e?e:function(){return e};return this instanceof On?this.internalMap(n,t):new On(this,n,t)},Nt.pluck=function(){var e=arguments,t=arguments.length;if(0===t)throw new Error("List of properties cannot be empty.");return this.map(function(n){for(var r=n,i=0;t>i;i++){var s=r[e[i]];if("undefined"==typeof s)return o;r=s}return r})},Nt.flatMapObserver=Nt.selectManyObserver=function(e,t,n,r){var i=this;return new Nn(function(o){var s=0;return i.subscribe(function(t){var n;try{n=e.call(r,t,s++)}catch(i){return void o.onError(i)}ae(n)&&(n=Yt(n)),o.onNext(n)},function(e){var n;try{n=t.call(r,e)}catch(i){return void o.onError(i)}ae(n)&&(n=Yt(n)),o.onNext(n),o.onCompleted()},function(){var e;try{e=n.call(r)}catch(t){return void o.onError(t)}ae(e)&&(e=Yt(e)),o.onNext(e),o.onCompleted()})},i).mergeAll()},Nt.selectMany=Nt.flatMap=function(e,t,n){return ue(e)&&ue(t)?this.flatMap(function(n,r){var i=e(n,r);return ae(i)&&(i=Yt(i)),(Me(i)||Se(i))&&(i=nn(i)),i.map(function(e,i){return t(n,e,r,i)})},n):ue(e)?q(this,e,n):q(this,function(){return e})},Nt.selectSwitch=Nt.flatMapLatest=Nt.switchMap=function(e,t){return this.select(e,t).switchLatest()};var Ln=function(e){function t(t,n){this.source=t,this.skipCount=n,e.call(this)}function n(e,t){this.c=t,this.r=t,this.o=e,this.isStopped=!1}return Qe(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.skipCount))},n.prototype.onNext=function(e){this.isStopped||(this.r<=0?this.o.onNext(e):this.r--)},n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.skip=function(e){if(0>e)throw new ve;return new Ln(this,e)},Nt.skipWhile=function(e,t){var n=this,r=Ce(e,t,3);return new Nn(function(e){var t=0,i=!1;return n.subscribe(function(o){if(!i)try{i=!r(o,t++,n)}catch(s){return void e.onError(s)}i&&e.onNext(o)},function(t){e.onError(t)},function(){e.onCompleted()})},n)},Nt.take=function(e,t){if(0>e)throw new ve;if(0===e)return Jt(t);var n=this;return new Nn(function(t){var r=e;return n.subscribe(function(e){r-- >0&&(t.onNext(e),0>=r&&t.onCompleted())},function(e){t.onError(e)},function(){t.onCompleted()})},n)},Nt.takeWhile=function(e,t){var n=this,r=Ce(e,t,3);return new Nn(function(e){var t=0,i=!0;return n.subscribe(function(o){if(i){try{i=r(o,t++,n)}catch(s){return void e.onError(s)}i?e.onNext(o):e.onCompleted()}},function(t){e.onError(t)},function(){e.onCompleted()})},n)};var Rn=function(e){function t(t,n,r){this.source=t,this.predicate=Ce(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return t.predicate(n,r,i)&&e.call(this,n,r,i)}}function r(e,t,n){this.o=e,this.predicate=t,this.source=n,this.i=0,this.isStopped=!1}return Qe(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,n(e,this),r)},r.prototype.onNext=function(e){if(!this.isStopped){var t=x(this.predicate)(e,this.i++,this.source);return t===nt?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?!1:(this.isStopped=!0,this.o.onError(e),!0)},t}(Vt);Nt.filter=Nt.where=function(e,t){return this instanceof Rn?this.internalFilter(e,t):new Rn(this,e,t)},Nt.transduce=function(e){function t(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}var n=this;return new Nn(function(r){var i=e(t(r));return n.subscribe(function(e){try{i["@@transducer/step"](r,e)}catch(t){r.onError(t)}},function(e){r.onError(e)},function(){i["@@transducer/result"](r)})},n)};var Nn=ee.AnonymousObservable=function(e){function t(e){return e&&ue(e.dispose)?e:ue(e)?ut(e):ct}function n(e,n){var r=n[0],i=n[1],o=x(i)(r);return o!==nt||r.fail(nt.e)?void r.setDisposable(t(o)):w(nt.e)}function r(t,r){function i(e){var r=new Dn(e),i=[r,t];return wt.scheduleRequired()?wt.scheduleWithState(i,n):n(null,i),r}this.source=r,e.call(this,i)}return Qe(r,e),r}(Bt),Dn=function(e){function t(t){e.call(this),this.observer=t,this.m=new pt}Qe(t,e);var n=t.prototype;return n.next=function(e){var t=x(this.observer.onNext).call(this.observer,e);t===nt&&(this.dispose(),w(t.e))},n.error=function(e){var t=x(this.observer.onError).call(this.observer,e);this.dispose(),t===nt&&w(t.e)},n.completed=function(){var e=x(this.observer.onCompleted).call(this.observer);this.dispose(),e===nt&&w(e.e)},n.setDisposable=function(e){this.m.setDisposable(e)},n.getDisposable=function(){return this.m.getDisposable()},n.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}(Dt),In=function(e,t){this.subject=e,this.observer=t};In.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 kn=ee.Subject=function(e){function t(e){return lt(this),this.isStopped?this.hasError?(e.onError(this.error),ct):(e.onCompleted(),ct):(this.observers.push(e),new In(this,e))}function n(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Qe(n,e),et(n.prototype,Lt.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(lt(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=a(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(lt(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(lt(this),!this.isStopped)for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(e,t){return new jn(e,t)},n}(Bt),jn=(ee.AsyncSubject=function(e){function t(e){return lt(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),ct):(this.observers.push(e),new In(this,e))}function n(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Qe(n,e),et(n.prototype,Lt,{hasObservers:function(){return lt(this),this.observers.length>0},onCompleted:function(){var e,t;if(lt(this),!this.isStopped){this.isStopped=!0;var n=a(this.observers),t=n.length;if(this.hasValue)for(e=0;t>e;e++){var r=n[e];r.onNext(this.value),r.onCompleted()}else for(e=0;t>e;e++)n[e].onCompleted();this.observers.length=0}},onError:function(e){if(lt(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){lt(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Bt),ee.AnonymousSubject=function(e){function t(e){return this.observable.subscribe(e)}function n(n,r){this.observer=n,this.observable=r,e.call(this,t)}return Qe(n,e),et(n.prototype,Lt.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),n}(Bt));"function"==typeof e&&"object"==typeof e.amd&&e.amd?(Y.Rx=ee,e(function(){return ee})):K&&Z?J?(Z.exports=ee).Rx=ee:K.Rx=ee:Y.Rx=ee;var Fn=p()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:6}],157:[function(e,t,n){(function(n){var r="undefined"!=typeof n?n:"undefined"!=typeof window?window:{},i=e("min-document");if("undefined"!=typeof document)t.exports=document;else{var o=r["__GLOBAL_DOCUMENT_CACHE@4"];o||(o=r["__GLOBAL_DOCUMENT_CACHE@4"]=i),t.exports=o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":4}],158:[function(e,t,n){var r=e("./lib");t.exports={Graph:r.Graph,json:e("./lib/json"),alg:e("./lib/alg"),version:r.version}},{"./lib":174,"./lib/alg":165,"./lib/json":175}],159:[function(e,t,n){function r(e){function t(o){i.has(r,o)||(r[o]=!0,n.push(o),i.each(e.successors(o),t),i.each(e.predecessors(o),t))}var n,r={},o=[];return i.each(e.nodes(),function(e){n=[],t(e),n.length&&o.push(n)}),o}var i=e("../lodash");t.exports=r},{"../lodash":176}],160:[function(e,t,n){function r(e,t,n){o.isArray(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),s=[],a={};return o.each(t,function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);i(e,t,"post"===n,a,r,s)}),s}function i(e,t,n,r,s,a){o.has(r,t)||(r[t]=!0,n||a.push(t),o.each(s(t),function(t){i(e,t,n,r,s,a)}),n&&a.push(t))}var o=e("../lodash");t.exports=r},{"../lodash":176}],161:[function(e,t,n){function r(e,t,n){return o.transform(e.nodes(),function(r,o){r[o]=i(e,o,t,n)},{})}var i=e("./dijkstra"),o=e("../lodash");t.exports=r},{"../lodash":176,"./dijkstra":162}],162:[function(e,t,n){function r(e,t,n,r){return i(e,String(t),n||a,r||function(t){return e.outEdges(t)})}function i(e,t,n,r){var i,o,a={},u=new s,c=function(e){var t=e.v!==i?e.v:e.w,r=a[t],s=n(e),c=o.distance+s;if(0>s)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+s);c<r.distance&&(r.distance=c,r.predecessor=i,u.decrease(t,c))};for(e.nodes().forEach(function(e){var n=e===t?0:Number.POSITIVE_INFINITY;a[e]={distance:n},u.add(e,n)});u.size()>0&&(i=u.removeMin(),o=a[i],o.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(c);return a}var o=e("../lodash"),s=e("../data/priority-queue");t.exports=r;var a=o.constant(1)},{"../data/priority-queue":172,"../lodash":176}],163:[function(e,t,n){function r(e){return i.filter(o(e),function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}var i=e("../lodash"),o=e("./tarjan");t.exports=r},{"../lodash":176,"./tarjan":170}],164:[function(e,t,n){function r(e,t,n){return i(e,t||s,n||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:Number.POSITIVE_INFINITY})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,o=t(n);r[e][i]={distance:o,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[e],i=t[n],s=o[n],a=r.distance+i.distance;a<s.distance&&(s.distance=a,s.predecessor=i.predecessor)})})}),r}var o=e("../lodash");t.exports=r;var s=o.constant(1)},{"../lodash":176}],165:[function(e,t,n){t.exports={components:e("./components"),dijkstra:e("./dijkstra"),dijkstraAll:e("./dijkstra-all"),findCycles:e("./find-cycles"),floydWarshall:e("./floyd-warshall"),isAcyclic:e("./is-acyclic"),postorder:e("./postorder"),preorder:e("./preorder"),prim:e("./prim"),tarjan:e("./tarjan"),topsort:e("./topsort")}},{"./components":159,"./dijkstra":162,"./dijkstra-all":161,"./find-cycles":163,"./floyd-warshall":164,"./is-acyclic":166,"./postorder":167,"./preorder":168,"./prim":169,"./tarjan":170,"./topsort":171}],166:[function(e,t,n){function r(e){try{i(e)}catch(t){if(t instanceof i.CycleException)return!1;throw t}return!0}var i=e("./topsort");t.exports=r},{"./topsort":171}],167:[function(e,t,n){function r(e,t){return i(e,t,"post")}var i=e("./dfs");t.exports=r},{"./dfs":160}],168:[function(e,t,n){function r(e,t){return i(e,t,"pre")}var i=e("./dfs");t.exports=r},{"./dfs":160}],169:[function(e,t,n){function r(e,t){function n(e){var n=e.v===r?e.w:e.v,i=c.priority(n);if(void 0!==i){var o=t(e);i>o&&(u[n]=r,c.decrease(n,o))}}var r,a=new o,u={},c=new s;if(0===e.nodeCount())return a;i.each(e.nodes(),function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)}),c.decrease(e.nodes()[0],0);for(var h=!1;c.size()>0;){if(r=c.removeMin(),i.has(u,r))a.setEdge(r,u[r]);else{if(h)throw new Error("Input graph is not connected: "+e);h=!0}e.nodeEdges(r).forEach(n)}return a}var i=e("../lodash"),o=e("../graph"),s=e("../data/priority-queue");t.exports=r},{"../data/priority-queue":172,"../graph":173,"../lodash":176}],170:[function(e,t,n){function r(e){function t(a){var u=o[a]={onStack:!0,lowlink:n,index:n++};if(r.push(a),e.successors(a).forEach(function(e){i.has(o,e)?o[e].onStack&&(u.lowlink=Math.min(u.lowlink,o[e].index)):(t(e),u.lowlink=Math.min(u.lowlink,o[e].lowlink))}),u.lowlink===u.index){var c,h=[];do c=r.pop(),o[c].onStack=!1,h.push(c);while(a!==c);s.push(h)}}var n=0,r=[],o={},s=[];return e.nodes().forEach(function(e){i.has(o,e)||t(e)}),s}var i=e("../lodash");t.exports=r},{"../lodash":176}],171:[function(e,t,n){function r(e){function t(a){if(o.has(r,a))throw new i;o.has(n,a)||(r[a]=!0,n[a]=!0,o.each(e.predecessors(a),t),delete r[a],s.push(a))}var n={},r={},s=[];if(o.each(e.sinks(),t),o.size(n)!==e.nodeCount())throw new i;return s}function i(){}var o=e("../lodash");t.exports=r,r.CycleException=i},{"../lodash":176}],172:[function(e,t,n){function r(){this._arr=[],this._keyIndices={}}var i=e("../lodash");t.exports=r,r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(e){return e.key})},r.prototype.has=function(e){return i.has(this._keyIndices,e)},r.prototype.priority=function(e){var t=this._keyIndices[e];return void 0!==t?this._arr[t].priority:void 0},r.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(e,t){var n=this._keyIndices;if(e=String(e),!i.has(n,e)){var r=this._arr,o=r.length;return n[e]=o,r.push({key:e,priority:t}),this._decrease(o),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},r.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)},r.prototype._heapify=function(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))},r.prototype._decrease=function(e){for(var t,n=this._arr,r=n[e].priority;0!==e&&(t=e>>1,!(n[t].priority<r));)this._swap(e,t),e=t},r.prototype._swap=function(e,t){var n=this._arr,r=this._keyIndices,i=n[e],o=n[t];n[e]=o,n[t]=i,r[o.key]=e,r[i.key]=t}},{"../lodash":176}],173:[function(e,t,n){"use strict";function r(e){this._isDirected=c.has(e,"directed")?e.directed:!0,this._isMultigraph=c.has(e,"multigraph")?e.multigraph:!1,this._isCompound=c.has(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=c.constant(void 0),this._defaultEdgeLabelFn=c.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[l]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,t){e[t]?e[t]++:e[t]=1}function o(e,t){--e[t]||delete e[t];
|
||
}function s(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var s=i;i=o,o=s}return i+p+o+p+(c.isUndefined(r)?h:r)}function a(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var s=i;i=o,o=s}var a={v:i,w:o};return r&&(a.name=r),a}function u(e,t){return s(e,t.v,t.w,t.name)}var c=e("./lodash");t.exports=r;var h="\x00",l="\x00",p="";r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(e){return this._label=e,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(e){return c.isFunction(e)||(e=c.constant(e)),this._defaultNodeLabelFn=e,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return c.keys(this._nodes)},r.prototype.sources=function(){return c.filter(this.nodes(),function(e){return c.isEmpty(this._in[e])},this)},r.prototype.sinks=function(){return c.filter(this.nodes(),function(e){return c.isEmpty(this._out[e])},this)},r.prototype.setNodes=function(e,t){var n=arguments;return c.each(e,function(e){n.length>1?this.setNode(e,t):this.setNode(e)},this),this},r.prototype.setNode=function(e,t){return c.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=l,this._children[e]={},this._children[l][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},r.prototype.node=function(e){return this._nodes[e]},r.prototype.hasNode=function(e){return c.has(this._nodes,e)},r.prototype.removeNode=function(e){var t=this;if(c.has(this._nodes,e)){var n=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],c.each(this.children(e),function(e){this.setParent(e)},this),delete this._children[e]),c.each(c.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],c.each(c.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},r.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(c.isUndefined(t))t=l;else{t+="";for(var n=t;!c.isUndefined(n);n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},r.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},r.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==l)return t}},r.prototype.children=function(e){if(c.isUndefined(e)&&(e=l),this._isCompound){var t=this._children[e];if(t)return c.keys(t)}else{if(e===l)return this.nodes();if(this.hasNode(e))return[]}},r.prototype.predecessors=function(e){var t=this._preds[e];return t?c.keys(t):void 0},r.prototype.successors=function(e){var t=this._sucs[e];return t?c.keys(t):void 0},r.prototype.neighbors=function(e){var t=this.predecessors(e);return t?c.union(t,this.successors(e)):void 0},r.prototype.filterNodes=function(e){function t(e){var o=r.parent(e);return void 0===o||n.hasNode(o)?(i[e]=o,o):o in i?i[o]:t(o)}var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),c.each(this._nodes,function(t,r){e(r)&&n.setNode(r,t)},this),c.each(this._edgeObjs,function(e){n.hasNode(e.v)&&n.hasNode(e.w)&&n.setEdge(e,this.edge(e))},this);var r=this,i={};return this._isCompound&&c.each(n.nodes(),function(e){n.setParent(e,t(e))}),n},r.prototype.setDefaultEdgeLabel=function(e){return c.isFunction(e)||(e=c.constant(e)),this._defaultEdgeLabelFn=e,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return c.values(this._edgeObjs)},r.prototype.setPath=function(e,t){var n=this,r=arguments;return c.reduce(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this},r.prototype.setEdge=function(){var e,t,n,r,o=!1,u=arguments[0];"object"==typeof u&&null!==u&&"v"in u?(e=u.v,t=u.w,n=u.name,2===arguments.length&&(r=arguments[1],o=!0)):(e=u,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],o=!0)),e=""+e,t=""+t,c.isUndefined(n)||(n=""+n);var h=s(this._isDirected,e,t,n);if(c.has(this._edgeLabels,h))return o&&(this._edgeLabels[h]=r),this;if(!c.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[h]=o?r:this._defaultEdgeLabelFn(e,t,n);var l=a(this._isDirected,e,t,n);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[h]=l,i(this._preds[t],e),i(this._sucs[e],t),this._in[t][h]=l,this._out[e][h]=l,this._edgeCount++,this},r.prototype.edge=function(e,t,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,e,t,n);return this._edgeLabels[r]},r.prototype.hasEdge=function(e,t,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,e,t,n);return c.has(this._edgeLabels,r)},r.prototype.removeEdge=function(e,t,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},r.prototype.inEdges=function(e,t){var n=this._in[e];if(n){var r=c.values(n);return t?c.filter(r,function(e){return e.v===t}):r}},r.prototype.outEdges=function(e,t){var n=this._out[e];if(n){var r=c.values(n);return t?c.filter(r,function(e){return e.w===t}):r}},r.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);return n?n.concat(this.outEdges(e,t)):void 0}},{"./lodash":176}],174:[function(e,t,n){t.exports={Graph:e("./graph"),version:e("./version")}},{"./graph":173,"./version":177}],175:[function(e,t,n){function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:o(e)};return a.isUndefined(e.graph())||(t.value=a.clone(e.graph())),t}function i(e){return a.map(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),i={v:t};return a.isUndefined(n)||(i.value=n),a.isUndefined(r)||(i.parent=r),i})}function o(e){return a.map(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return a.isUndefined(t.name)||(r.name=t.name),a.isUndefined(n)||(r.value=n),r})}function s(e){var t=new u(e.options).setGraph(e.value);return a.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),a.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var a=e("./lodash"),u=e("./graph");t.exports={write:r,read:s}},{"./graph":173,"./lodash":176}],176:[function(e,t,n){var r;if("function"==typeof e)try{r=e("lodash")}catch(i){}r||(r=window._),t.exports=r},{lodash:184}],177:[function(e,t,n){t.exports="2.1.0"},{}],178:[function(e,t,n){n.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,h=-7,l=n?i-1:0,p=n?-1:1,f=e[t+l];for(l+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+e[t+l],l+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+e[t+l],l+=p,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,l=h>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,d=r?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?p/u:p*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+f]=255&s,f+=d,s/=256,c-=8);e[n+f-d]|=128*m}},{}],179:[function(e,t,n){(function(e){"use strict";function n(e,t){return e in r?r[e]:(r[e]=t,t)}var r="undefined"!=typeof window?window:"undefined"!=typeof e?e:{};t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],180:[function(e,t,n){"use strict";function r(e,t,n){var r="__INDIVIDUAL_ONE_VERSION_"+e,o=r+"_ENFORCE_SINGLETON",s=i(o,t);if(s!==t)throw new Error("Can only have one copy of "+e+".\nYou already have version "+s+" installed.\nThis means you cannot install version "+t);return i(r,n)}var i=e("./index.js");t.exports=r},{"./index.js":179}],181:[function(e,t,n){"use strict";t.exports=function(e){return"object"==typeof e&&null!==e}},{}],182:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],183:[function(t,n,r){"use strict";var i={};i.base32="0123456789bcdefghjkmnpqrstuvwxyz",i.encode=function(e,t,n){if("undefined"==typeof n){for(var r=1;12>=r;r++){var o=i.encode(e,t,r),s=i.decode(o);if(s.lat==e&&s.lon==t)return o}n=12}if(e=Number(e),t=Number(t),n=Number(n),isNaN(e)||isNaN(t)||isNaN(n))throw new Error("Invalid geohash");for(var a=0,u=0,c=!0,h="",l=-90,p=90,f=-180,d=180;h.length<n;){if(c){var m=(f+d)/2;t>m?(a=2*a+1,f=m):(a=2*a,d=m)}else{var v=(l+p)/2;e>v?(a=2*a+1,l=v):(a=2*a,p=v)}c=!c,5==++u&&(h+=i.base32.charAt(a),u=0,a=0)}return h},i.decode=function(e){var t=i.bounds(e),n=t.sw.lat,r=t.sw.lon,o=t.ne.lat,s=t.ne.lon,a=(n+o)/2,u=(r+s)/2;return a=a.toFixed(Math.floor(2-Math.log(o-n)/Math.LN10)),u=u.toFixed(Math.floor(2-Math.log(s-r)/Math.LN10)),{lat:Number(a),lon:Number(u)}},i.bounds=function(e){if(0===e.length)throw new Error("Invalid geohash");e=e.toLowerCase();for(var t=!0,n=-90,r=90,o=-180,s=180,a=0;a<e.length;a++){var u=e.charAt(a),c=i.base32.indexOf(u);if(-1==c)throw new Error("Invalid geohash");for(var h=4;h>=0;h--){var l=c>>h&1;if(t){var p=(o+s)/2;1==l?o=p:s=p}else{var f=(n+r)/2;1==l?n=f:r=f}t=!t}}var d={sw:{lat:n,lon:o},ne:{lat:r,lon:s}};return d},i.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 n={n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]},r={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]},o=e.slice(-1),s=e.slice(0,-1),a=e.length%2;return-1!=r[t][a].indexOf(o)&&""!==s&&(s=i.adjacent(s,t)),s+i.base32.charAt(n[t][a].indexOf(o))},i.neighbours=function(e){return{n:i.adjacent(e,"n"),ne:i.adjacent(i.adjacent(e,"n"),"e"),e:i.adjacent(e,"e"),se:i.adjacent(i.adjacent(e,"s"),"e"),s:i.adjacent(e,"s"),sw:i.adjacent(i.adjacent(e,"s"),"w"),w:i.adjacent(e,"w"),nw:i.adjacent(i.adjacent(e,"n"),"w")}},"undefined"!=typeof n&&n.exports&&(n.exports=i),"function"==typeof e&&e.amd&&e([],function(){return i})},{}],184:[function(t,n,r){(function(t){(function(){function i(e,t){if(e!==t){var n=null===e,r=e===C,i=e===e,o=null===t,s=t===C,a=t===t;if(e>t&&!o||!i||n&&!s&&a||r&&a)return 1;if(t>e&&!n||!a||o&&!r&&i||s&&i)return-1}return 0}function o(e,t,n){for(var r=e.length,i=n?r:-1;n?i--:++i<r;)if(t(e[i],i,e))return i;return-1}function s(e,t,n){if(t!==t)return g(e,n);for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function a(e){return"function"==typeof e||!1}function u(e){return null==e?"":e+""}function c(e,t){for(var n=-1,r=e.length;++n<r&&t.indexOf(e.charAt(n))>-1;);return n}function h(e,t){for(var n=e.length;n--&&t.indexOf(e.charAt(n))>-1;);return n}function l(e,t){return i(e.criteria,t.criteria)||e.index-t.index}function p(e,t,n){for(var r=-1,o=e.criteria,s=t.criteria,a=o.length,u=n.length;++r<a;){var c=i(o[r],s[r]);if(c){if(r>=u)return c;var h=n[r];return c*("asc"===h||h===!0?1:-1)}}return e.index-t.index}function f(e){return $e[e]}function d(e){return We[e]}function m(e,t,n){return t?e=Ye[e]:n&&(e=Ke[e]),"\\"+e}function v(e){return"\\"+Ke[e]}function g(e,t,n){for(var r=e.length,i=t+(n?0:-1);n?i--:++i<r;){var o=e[i];if(o!==o)return i}return-1}function y(e){return!!e&&"object"==typeof e}function _(e){return 160>=e&&e>=9&&13>=e||32==e||160==e||5760==e||6158==e||e>=8192&&(8202>=e||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}function b(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n<r;)e[n]===t&&(e[n]=$,o[++i]=n);return o}function x(e,t){for(var n,r=-1,i=e.length,o=-1,s=[];++r<i;){var a=e[r],u=t?t(a,r,e):a;r&&n===u||(n=u,s[++o]=a)}return s}function w(e){for(var t=-1,n=e.length;++t<n&&_(e.charCodeAt(t)););return t}function S(e){for(var t=e.length;t--&&_(e.charCodeAt(t)););return t}function M(e){return qe[e]}function E(e){function t(e){if(y(e)&&!Pa(e)&&!(e instanceof _)){if(e instanceof r)return e;if(ts.call(e,"__chain__")&&ts.call(e,"__wrapped__"))return fr(e)}return new r(e)}function n(){}function r(e,t,n){this.__wrapped__=e,this.__actions__=n||[],this.__chain__=!!t}function _(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=As,this.__views__=[]}function J(){var e=new _(this.__wrapped__);return e.__actions__=et(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=et(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=et(this.__views__),e}function ne(){if(this.__filtered__){var e=new _(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function ie(){var e=this.__wrapped__.value(),t=this.__dir__,n=Pa(e),r=0>t,i=n?e.length:0,o=Wn(0,i,this.__views__),s=o.start,a=o.end,u=a-s,c=r?a:s-1,h=this.__iteratees__,l=h.length,p=0,f=Ss(u,this.__takeCount__);if(!n||U>i||i==u&&f==u)return nn(r&&n?e.reverse():e,this.__actions__);var d=[];e:for(;u--&&f>p;){c+=t;for(var m=-1,v=e[c];++m<l;){var g=h[m],y=g.iteratee,_=g.type,b=y(v);if(_==z)v=b;else if(!b){if(_==G)continue e;break e}}d[p++]=v}return d}function $e(){this.__data__={}}function We(e){return this.has(e)&&delete this.__data__[e]}function qe(e){return"__proto__"==e?C:this.__data__[e]}function Xe(e){return"__proto__"!=e&&ts.call(this.__data__,e)}function Ye(e,t){return"__proto__"!=e&&(this.__data__[e]=t),this}function Ke(e){var t=e?e.length:0;for(this.data={hash:gs(null),set:new ls};t--;)this.push(e[t])}function Ze(e,t){var n=e.data,r="string"==typeof t||Di(t)?n.set.has(t):n.hash[t];return r?0:-1}function Je(e){var t=this.data;"string"==typeof e||Di(e)?t.set.add(e):t.hash[e]=!0}function Qe(e,t){for(var n=-1,r=e.length,i=-1,o=t.length,s=Uo(r+o);++n<r;)s[n]=e[n];for(;++i<o;)s[n++]=t[i];return s}function et(e,t){var n=-1,r=e.length;for(t||(t=Uo(r));++n<r;)t[n]=e[n];return t}function tt(e,t){for(var n=-1,r=e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function nt(e,t){for(var n=e.length;n--&&t(e[n],n,e)!==!1;);return e}function ot(e,t){for(var n=-1,r=e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function st(e,t,n,r){for(var i=-1,o=e.length,s=r,a=s;++i<o;){var u=e[i],c=+t(u);n(c,s)&&(s=c,a=u)}return a}function at(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[++i]=s)}return o}function ut(e,t){for(var n=-1,r=e.length,i=Uo(r);++n<r;)i[n]=t(e[n],n,e);return i}function ct(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function ht(e,t,n,r){var i=-1,o=e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function lt(e,t,n,r){var i=e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function pt(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function ft(e,t){for(var n=e.length,r=0;n--;)r+=+t(e[n])||0;return r}function dt(e,t){return e===C?t:e}function mt(e,t,n,r){return e!==C&&ts.call(r,n)?e:t}function vt(e,t,n){for(var r=-1,i=Va(t),o=i.length;++r<o;){var s=i[r],a=e[s],u=n(a,t[s],s,e,t);(u===u?u===a:a!==a)&&(a!==C||s in e)||(e[s]=u)}return e}function gt(e,t){return null==t?e:_t(t,Va(t),e)}function yt(e,t){for(var n=-1,r=null==e,i=!r&&Zn(e),o=i?e.length:0,s=t.length,a=Uo(s);++n<s;){var u=t[n];i?a[n]=Jn(u,o)?e[u]:C:a[n]=r?C:e[u]}return a}function _t(e,t,n){n||(n={});for(var r=-1,i=t.length;++r<i;){var o=t[r];n[o]=e[o]}return n}function bt(e,t,n){var r=typeof e;return"function"==r?t===C?e:sn(e,t,n):null==e?Ao:"object"==r?Bt(e):t===C?Do(e):Vt(e,t)}function xt(e,t,n,r,i,o,s){var a;if(n&&(a=i?n(e,r,i):n(e)),a!==C)return a;if(!Di(e))return e;var u=Pa(e);if(u){if(a=qn(e),!t)return et(e,a)}else{var c=rs.call(e),h=c==Z;if(c!=ee&&c!=W&&(!h||i))return He[c]?Yn(e,c,t):i?e:{};if(a=Xn(h?{}:e),!t)return gt(a,e)}o||(o=[]),s||(s=[]);for(var l=o.length;l--;)if(o[l]==e)return s[l];return o.push(e),s.push(a),(u?tt:Lt)(e,function(r,i){a[i]=xt(r,t,n,i,e,o,s)}),a}function wt(e,t,n){if("function"!=typeof e)throw new Ko(H);return ps(function(){e.apply(C,n)},t)}function St(e,t){var n=e?e.length:0,r=[];if(!n)return r;var i=-1,o=zn(),a=o==s,u=a&&t.length>=U?mn(t):null,c=t.length;u&&(o=Ze,a=!1,t=u);e:for(;++i<n;){var h=e[i];if(a&&h===h){for(var l=c;l--;)if(t[l]===h)continue e;r.push(h)}else o(t,h,0)<0&&r.push(h)}return r}function Mt(e,t){var n=!0;return ks(e,function(e,r,i){return n=!!t(e,r,i)}),n}function Et(e,t,n,r){var i=r,o=i;return ks(e,function(e,s,a){var u=+t(e,s,a);(n(u,i)||u===r&&u===o)&&(i=u,o=e)}),o}function Ct(e,t,n,r){var i=e.length;for(n=null==n?0:+n||0,0>n&&(n=-n>i?0:i+n),r=r===C||r>i?i:+r||0,0>r&&(r+=i),i=n>r?0:r>>>0,n>>>=0;i>n;)e[n++]=t;return e}function Tt(e,t){var n=[];return ks(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function At(e,t,n,r){var i;return n(e,function(e,n,o){return t(e,n,o)?(i=r?n:e,!1):void 0}),i}function Pt(e,t,n,r){r||(r=[]);for(var i=-1,o=e.length;++i<o;){var s=e[i];y(s)&&Zn(s)&&(n||Pa(s)||Ei(s))?t?Pt(s,t,n,r):ct(r,s):n||(r[r.length]=s)}return r}function Ot(e,t){return Fs(e,t,eo)}function Lt(e,t){return Fs(e,t,Va)}function Rt(e,t){return Bs(e,t,Va)}function Nt(e,t){for(var n=-1,r=t.length,i=-1,o=[];++n<r;){var s=t[n];Ni(e[s])&&(o[++i]=s)}return o}function Dt(e,t,n){if(null!=e){n!==C&&n in lr(e)&&(t=[n]);for(var r=0,i=t.length;null!=e&&i>r;)e=e[t[r++]];return r&&r==i?e:C}}function It(e,t,n,r,i,o){return e===t?!0:null==e||null==t||!Di(e)&&!y(t)?e!==e&&t!==t:kt(e,t,It,n,r,i,o)}function kt(e,t,n,r,i,o,s){var a=Pa(e),u=Pa(t),c=q,h=q;a||(c=rs.call(e),c==W?c=ee:c!=ee&&(a=zi(e))),u||(h=rs.call(t),h==W?h=ee:h!=ee&&(u=zi(t)));var l=c==ee,p=h==ee,f=c==h;if(f&&!a&&!l)return Bn(e,t,c);if(!i){var d=l&&ts.call(e,"__wrapped__"),m=p&&ts.call(t,"__wrapped__");if(d||m)return n(d?e.value():e,m?t.value():t,r,i,o,s)}if(!f)return!1;o||(o=[]),s||(s=[]);for(var v=o.length;v--;)if(o[v]==e)return s[v]==t;o.push(e),s.push(t);var g=(a?Fn:Vn)(e,t,n,r,i,o,s);return o.pop(),s.pop(),g}function jt(e,t,n){var r=t.length,i=r,o=!n;if(null==e)return!i;for(e=lr(e);r--;){var s=t[r];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++r<i;){s=t[r];var a=s[0],u=e[a],c=s[1];if(o&&s[2]){if(u===C&&!(a in e))return!1}else{var h=n?n(u,c,a):C;if(!(h===C?It(c,u,n,!0):h))return!1}}return!0}function Ft(e,t){var n=-1,r=Zn(e)?Uo(e.length):[];return ks(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function Bt(e){var t=Hn(e);if(1==t.length&&t[0][2]){var n=t[0][0],r=t[0][1];return function(e){return null==e?!1:e[n]===r&&(r!==C||n in lr(e))}}return function(e){return jt(e,t)}}function Vt(e,t){var n=Pa(e),r=er(e)&&rr(t),i=e+"";return e=pr(e),function(o){if(null==o)return!1;var s=i;if(o=lr(o),(n||!r)&&!(s in o)){if(o=1==e.length?o:Dt(o,Xt(e,0,-1)),null==o)return!1;s=Cr(e),o=lr(o)}return o[s]===t?t!==C||s in o:It(t,o[s],C,!0)}}function Ut(e,t,n,r,i){if(!Di(e))return e;var o=Zn(t)&&(Pa(t)||zi(t)),s=o?C:Va(t);return tt(s||t,function(a,u){if(s&&(u=a,a=t[u]),y(a))r||(r=[]),i||(i=[]),Gt(e,t,u,Ut,n,r,i);else{var c=e[u],h=n?n(c,a,u,e,t):C,l=h===C;l&&(h=a),h===C&&(!o||u in e)||!l&&(h===h?h===c:c!==c)||(e[u]=h)}}),e}function Gt(e,t,n,r,i,o,s){for(var a=o.length,u=t[n];a--;)if(o[a]==u)return void(e[n]=s[a]);var c=e[n],h=i?i(c,u,n,e,t):C,l=h===C;l&&(h=u,Zn(u)&&(Pa(u)||zi(u))?h=Pa(c)?c:Zn(c)?et(c):[]:Vi(u)||Ei(u)?h=Ei(c)?Xi(c):Vi(c)?c:{}:l=!1),o.push(u),s.push(h),l?e[n]=r(h,u,i,o,s):(h===h?h!==c:c===c)&&(e[n]=h)}function zt(e){return function(t){return null==t?C:t[e]}}function Ht(e){var t=e+"";return e=pr(e),function(n){return Dt(n,e,t)}}function $t(e,t){for(var n=e?t.length:0;n--;){var r=t[n];if(r!=i&&Jn(r)){var i=r;fs.call(e,r,1)}}return e}function Wt(e,t){return e+ys(Cs()*(t-e+1))}function qt(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function Xt(e,t,n){var r=-1,i=e.length;t=null==t?0:+t||0,0>t&&(t=-t>i?0:i+t),n=n===C||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Uo(i);++r<i;)o[r]=e[r+t];return o}function Yt(e,t){var n;return ks(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}function Kt(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Zt(e,t,n){var r=Un(),i=-1;t=ut(t,function(e){return r(e)});var o=Ft(e,function(e){var n=ut(t,function(t){return t(e)});return{criteria:n,index:++i,value:e}});return Kt(o,function(e,t){return p(e,t,n)})}function Jt(e,t){var n=0;return ks(e,function(e,r,i){n+=+t(e,r,i)||0}),n}function Qt(e,t){var n=-1,r=zn(),i=e.length,o=r==s,a=o&&i>=U,u=a?mn():null,c=[];u?(r=Ze,o=!1):(a=!1,u=t?[]:c);e:for(;++n<i;){var h=e[n],l=t?t(h,n,e):h;if(o&&h===h){for(var p=u.length;p--;)if(u[p]===l)continue e;t&&u.push(l),c.push(h)}else r(u,l,0)<0&&((t||a)&&u.push(l),c.push(h))}return c}function en(e,t){for(var n=-1,r=t.length,i=Uo(r);++n<r;)i[n]=e[t[n]];return i}function tn(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?Xt(e,r?0:o,r?o+1:i):Xt(e,r?o+1:0,r?i:o)}function nn(e,t){var n=e;n instanceof _&&(n=n.value());for(var r=-1,i=t.length;++r<i;){var o=t[r];n=o.func.apply(o.thisArg,ct([n],o.args))}return n}function rn(e,t,n){var r=0,i=e?e.length:r;if("number"==typeof t&&t===t&&Ls>=i){for(;i>r;){var o=r+i>>>1,s=e[o];(n?t>=s:t>s)&&null!==s?r=o+1:i=o}return i}return on(e,t,Ao,n)}function on(e,t,n,r){t=n(t);for(var i=0,o=e?e.length:0,s=t!==t,a=null===t,u=t===C;o>i;){var c=ys((i+o)/2),h=n(e[c]),l=h!==C,p=h===h;if(s)var f=p||r;else f=a?p&&l&&(r||null!=h):u?p&&(r||l):null==h?!1:r?t>=h:t>h;f?i=c+1:o=c}return Ss(o,Os)}function sn(e,t,n){if("function"!=typeof e)return Ao;if(t===C)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)};case 5:return function(n,r,i,o,s){return e.call(t,n,r,i,o,s)}}return function(){return e.apply(t,arguments)}}function an(e){var t=new ss(e.byteLength),n=new ds(t);return n.set(new ds(e)),t}function un(e,t,n){for(var r=n.length,i=-1,o=ws(e.length-r,0),s=-1,a=t.length,u=Uo(a+o);++s<a;)u[s]=t[s];for(;++i<r;)u[n[i]]=e[i];for(;o--;)u[s++]=e[i++];return u}function cn(e,t,n){for(var r=-1,i=n.length,o=-1,s=ws(e.length-i,0),a=-1,u=t.length,c=Uo(s+u);++o<s;)c[o]=e[o];for(var h=o;++a<u;)c[h+a]=t[a];for(;++r<i;)c[h+n[r]]=e[o++];return c}function hn(e,t){return function(n,r,i){var o=t?t():{};if(r=Un(r,i,3),Pa(n))for(var s=-1,a=n.length;++s<a;){var u=n[s];e(o,u,r(u,s,n),n)}else ks(n,function(t,n,i){e(o,t,r(t,n,i),i)});return o}}function ln(e){return gi(function(t,n){var r=-1,i=null==t?0:n.length,o=i>2?n[i-2]:C,s=i>2?n[2]:C,a=i>1?n[i-1]:C;for("function"==typeof o?(o=sn(o,a,5),i-=2):(o="function"==typeof a?a:C,i-=o?1:0),s&&Qn(n[0],n[1],s)&&(o=3>i?C:o,i=1);++r<i;){var u=n[r];u&&e(t,u,o)}return t})}function pn(e,t){return function(n,r){var i=n?Gs(n):0;if(!nr(i))return e(n,r);for(var o=t?i:-1,s=lr(n);(t?o--:++o<i)&&r(s[o],o,s)!==!1;);return n}}function fn(e){return function(t,n,r){for(var i=lr(t),o=r(t),s=o.length,a=e?s:-1;e?a--:++a<s;){var u=o[a];if(n(i[u],u,i)===!1)break}return t}}function dn(e,t){function n(){var i=this&&this!==rt&&this instanceof n?r:e;return i.apply(t,arguments)}var r=gn(e);return n}function mn(e){return gs&&ls?new Ke(e):null}function vn(e){return function(t){for(var n=-1,r=Eo(ho(t)),i=r.length,o="";++n<i;)o=e(o,r[n],n);return o}}function gn(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Is(e.prototype),r=e.apply(n,t);return Di(r)?r:n}}function yn(e){function t(n,r,i){i&&Qn(n,r,i)&&(r=C);var o=jn(n,e,C,C,C,C,C,r);return o.placeholder=t.placeholder,o}return t}function _n(e,t){return gi(function(n){var r=n[0];return null==r?r:(n.push(t),e.apply(C,n))})}function bn(e,t){return function(n,r,i){if(i&&Qn(n,r,i)&&(r=C),r=Un(r,i,3),1==r.length){n=Pa(n)?n:hr(n);var o=st(n,r,e,t);if(!n.length||o!==t)return o}return Et(n,r,e,t)}}function xn(e,t){return function(n,r,i){if(r=Un(r,i,3),Pa(n)){var s=o(n,r,t);return s>-1?n[s]:C}return At(n,r,e)}}function wn(e){return function(t,n,r){return t&&t.length?(n=Un(n,r,3),o(t,n,e)):-1}}function Sn(e){return function(t,n,r){return n=Un(n,r,3),At(t,n,e,!0)}}function Mn(e){return function(){for(var t,n=arguments.length,i=e?n:-1,o=0,s=Uo(n);e?i--:++i<n;){var a=s[o++]=arguments[i];if("function"!=typeof a)throw new Ko(H);!t&&r.prototype.thru&&"wrapper"==Gn(a)&&(t=new r([],!0))}for(i=t?-1:n;++i<n;){a=s[i];var u=Gn(a),c="wrapper"==u?Us(a):C;t=c&&tr(c[0])&&c[1]==(I|L|N|k)&&!c[4].length&&1==c[9]?t[Gn(c[0])].apply(t,c[3]):1==a.length&&tr(a)?t[u]():t.thru(a)}return function(){var e=arguments,r=e[0];if(t&&1==e.length&&Pa(r)&&r.length>=U)return t.plant(r).value();for(var i=0,o=n?s[i].apply(this,e):r;++i<n;)o=s[i].call(this,o);return o}}}function En(e,t){return function(n,r,i){return"function"==typeof r&&i===C&&Pa(n)?e(n,r):t(n,sn(r,i,3))}}function Cn(e){return function(t,n,r){return"function"==typeof n&&r===C||(n=sn(n,r,3)),e(t,n,eo)}}function Tn(e){return function(t,n,r){return"function"==typeof n&&r===C||(n=sn(n,r,3)),e(t,n)}}function An(e){return function(t,n,r){var i={};return n=Un(n,r,3),Lt(t,function(t,r,o){var s=n(t,r,o);r=e?s:r,t=e?t:s,i[r]=t}),i}}function Pn(e){return function(t,n,r){return t=u(t),(e?t:"")+Nn(t,n,r)+(e?"":t)}}function On(e){var t=gi(function(n,r){var i=b(r,t.placeholder);return jn(n,e,C,r,i)});return t}function Ln(e,t){return function(n,r,i,o){var s=arguments.length<3;return"function"==typeof r&&o===C&&Pa(n)?e(n,r,i,s):qt(n,Un(r,o,4),i,s,t)}}function Rn(e,t,n,r,i,o,s,a,u,c){function h(){for(var y=arguments.length,_=y,x=Uo(y);_--;)x[_]=arguments[_];if(r&&(x=un(x,r,i)),o&&(x=cn(x,o,s)),d||v){var w=h.placeholder,S=b(x,w);if(y-=S.length,c>y){var M=a?et(a):C,E=ws(c-y,0),T=d?S:C,O=d?C:S,L=d?x:C,R=d?C:x;t|=d?N:D,t&=~(d?D:N),m||(t&=~(A|P));var I=[e,t,n,L,T,R,O,M,u,E],k=Rn.apply(C,I);return tr(e)&&zs(k,I),k.placeholder=w,k}}var j=p?n:this,F=f?j[e]:e;return a&&(x=ur(x,a)),l&&u<x.length&&(x.length=u),this&&this!==rt&&this instanceof h&&(F=g||gn(e)),F.apply(j,x)}var l=t&I,p=t&A,f=t&P,d=t&L,m=t&O,v=t&R,g=f?C:gn(e);return h}function Nn(e,t,n){var r=e.length;if(t=+t,r>=t||!bs(t))return"";var i=t-r;return n=null==n?" ":n+"",go(n,vs(i/n.length)).slice(0,i)}function Dn(e,t,n,r){function i(){for(var t=-1,a=arguments.length,u=-1,c=r.length,h=Uo(c+a);++u<c;)h[u]=r[u];for(;a--;)h[u++]=arguments[++t];var l=this&&this!==rt&&this instanceof i?s:e;return l.apply(o?n:this,h)}var o=t&A,s=gn(e);return i}function In(e){var t=$o[e];return function(e,n){return n=n===C?0:+n||0,n?(n=cs(10,n),t(e*n)/n):t(e)}}function kn(e){return function(t,n,r,i){var o=Un(r);return null==r&&o===bt?rn(t,n,e):on(t,n,o(r,i,1),e)}}function jn(e,t,n,r,i,o,s,a){var u=t&P;if(!u&&"function"!=typeof e)throw new Ko(H);var c=r?r.length:0;if(c||(t&=~(N|D),r=i=C),c-=i?i.length:0,t&D){var h=r,l=i;r=i=C}var p=u?C:Us(e),f=[e,t,n,r,i,h,l,o,s,a];if(p&&(ir(f,p),t=f[1],a=f[9]),f[9]=null==a?u?0:e.length:ws(a-c,0)||0,t==A)var d=dn(f[0],f[2]);else d=t!=N&&t!=(A|N)||f[4].length?Rn.apply(C,f):Dn.apply(C,f);var m=p?Vs:zs;return m(d,f)}function Fn(e,t,n,r,i,o,s){var a=-1,u=e.length,c=t.length;if(u!=c&&!(i&&c>u))return!1;for(;++a<u;){var h=e[a],l=t[a],p=r?r(i?l:h,i?h:l,a):C;if(p!==C){if(p)continue;return!1}if(i){if(!pt(t,function(e){return h===e||n(h,e,r,i,o,s)}))return!1}else if(h!==l&&!n(h,l,r,i,o,s))return!1}return!0}function Bn(e,t,n){switch(n){case X:case Y:return+e==+t;case K:return e.name==t.name&&e.message==t.message;case Q:return e!=+e?t!=+t:e==+t;case te:case re:return e==t+""}return!1}function Vn(e,t,n,r,i,o,s){var a=Va(e),u=a.length,c=Va(t),h=c.length;if(u!=h&&!i)return!1;for(var l=u;l--;){var p=a[l];if(!(i?p in t:ts.call(t,p)))return!1}for(var f=i;++l<u;){p=a[l];var d=e[p],m=t[p],v=r?r(i?m:d,i?d:m,p):C;if(!(v===C?n(d,m,r,i,o,s):v))return!1;f||(f="constructor"==p)}if(!f){var g=e.constructor,y=t.constructor;if(g!=y&&"constructor"in e&&"constructor"in t&&!("function"==typeof g&&g instanceof g&&"function"==typeof y&&y instanceof y))return!1}return!0}function Un(e,n,r){var i=t.callback||Co;return i=i===Co?bt:i,r?i(e,n,r):i}function Gn(e){for(var t=e.name,n=Ds[t],r=n?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function zn(e,n,r){var i=t.indexOf||Mr;return i=i===Mr?s:i,e?i(e,n,r):i}function Hn(e){for(var t=to(e),n=t.length;n--;)t[n][2]=rr(t[n][1]);return t}function $n(e,t){var n=null==e?C:e[t];return ji(n)?n:C}function Wn(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=Ss(t,e+s);break;case"takeRight":e=ws(e,t-s)}}return{start:e,end:t}}function qn(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ts.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Xn(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=qo),new t}function Yn(e,t,n){var r=e.constructor;switch(t){case oe:return an(e);case X:case Y:return new r(+e);case se:case ae:case ue:case ce:case he:case le:case pe:case fe:case de:var i=e.buffer;return new r(n?an(i):i,e.byteOffset,e.length);case Q:case re:return new r(e);case te:var o=new r(e.source,Ne.exec(e));o.lastIndex=e.lastIndex}return o}function Kn(e,t,n){null==e||er(t,e)||(t=pr(t),e=1==t.length?e:Dt(e,Xt(t,0,-1)),t=Cr(t));var r=null==e?e:e[t];return null==r?C:r.apply(e,n)}function Zn(e){return null!=e&&nr(Gs(e))}function Jn(e,t){return e="number"==typeof e||ke.test(e)?+e:-1,t=null==t?Rs:t,e>-1&&e%1==0&&t>e}function Qn(e,t,n){if(!Di(n))return!1;var r=typeof t;if("number"==r?Zn(n)&&Jn(t,n.length):"string"==r&&t in n){var i=n[t];return e===e?e===i:i!==i}return!1}function er(e,t){var n=typeof e;if("string"==n&&Ce.test(e)||"number"==n)return!0;if(Pa(e))return!1;var r=!Ee.test(e);return r||null!=t&&e in lr(t)}function tr(e){var n=Gn(e);if(!(n in _.prototype))return!1;var r=t[n];if(e===r)return!0;var i=Us(r);return!!i&&e===i[0]}function nr(e){return"number"==typeof e&&e>-1&&e%1==0&&Rs>=e}function rr(e){return e===e&&!Di(e)}function ir(e,t){var n=e[1],r=t[1],i=n|r,o=I>i,s=r==I&&n==L||r==I&&n==k&&e[7].length<=t[8]||r==(I|k)&&n==L;if(!o&&!s)return e;r&A&&(e[2]=t[2],i|=n&A?0:O);var a=t[3];if(a){var u=e[3];e[3]=u?un(u,a,t[4]):et(a),e[4]=u?b(e[3],$):et(t[4])}return a=t[5],a&&(u=e[5],e[5]=u?cn(u,a,t[6]):et(a),e[6]=u?b(e[5],$):et(t[6])),a=t[7],a&&(e[7]=et(a)),r&I&&(e[8]=null==e[8]?t[8]:Ss(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}function or(e,t){return e===C?t:Oa(e,t,or)}function sr(e,t){e=lr(e);for(var n=-1,r=t.length,i={};++n<r;){var o=t[n];o in e&&(i[o]=e[o])}return i}function ar(e,t){var n={};return Ot(e,function(e,r,i){t(e,r,i)&&(n[r]=e)}),n}function ur(e,t){for(var n=e.length,r=Ss(t.length,n),i=et(e);r--;){var o=t[r];e[r]=Jn(o,n)?i[o]:C}return e}function cr(e){for(var t=eo(e),n=t.length,r=n&&e.length,i=!!r&&nr(r)&&(Pa(e)||Ei(e)),o=-1,s=[];++o<n;){var a=t[o];(i&&Jn(a,r)||ts.call(e,a))&&s.push(a)}return s}function hr(e){return null==e?[]:Zn(e)?Di(e)?e:qo(e):oo(e)}function lr(e){return Di(e)?e:qo(e)}function pr(e){if(Pa(e))return e;var t=[];return u(e).replace(Te,function(e,n,r,i){t.push(r?i.replace(Le,"$1"):n||e)}),t}function fr(e){return e instanceof _?e.clone():new r(e.__wrapped__,e.__chain__,et(e.__actions__));
|
||
}function dr(e,t,n){t=(n?Qn(e,t,n):null==t)?1:ws(ys(t)||1,1);for(var r=0,i=e?e.length:0,o=-1,s=Uo(vs(i/t));i>r;)s[++o]=Xt(e,r,r+=t);return s}function mr(e){for(var t=-1,n=e?e.length:0,r=-1,i=[];++t<n;){var o=e[t];o&&(i[++r]=o)}return i}function vr(e,t,n){var r=e?e.length:0;return r?((n?Qn(e,t,n):null==t)&&(t=1),Xt(e,0>t?0:t)):[]}function gr(e,t,n){var r=e?e.length:0;return r?((n?Qn(e,t,n):null==t)&&(t=1),t=r-(+t||0),Xt(e,0,0>t?0:t)):[]}function yr(e,t,n){return e&&e.length?tn(e,Un(t,n,3),!0,!0):[]}function _r(e,t,n){return e&&e.length?tn(e,Un(t,n,3),!0):[]}function br(e,t,n,r){var i=e?e.length:0;return i?(n&&"number"!=typeof n&&Qn(e,t,n)&&(n=0,r=i),Ct(e,t,n,r)):[]}function xr(e){return e?e[0]:C}function wr(e,t,n){var r=e?e.length:0;return n&&Qn(e,t,n)&&(t=!1),r?Pt(e,t):[]}function Sr(e){var t=e?e.length:0;return t?Pt(e,!0):[]}function Mr(e,t,n){var r=e?e.length:0;if(!r)return-1;if("number"==typeof n)n=0>n?ws(r+n,0):n;else if(n){var i=rn(e,t);return r>i&&(t===t?t===e[i]:e[i]!==e[i])?i:-1}return s(e,t,n||0)}function Er(e){return gr(e,1)}function Cr(e){var t=e?e.length:0;return t?e[t-1]:C}function Tr(e,t,n){var r=e?e.length:0;if(!r)return-1;var i=r;if("number"==typeof n)i=(0>n?ws(r+n,0):Ss(n||0,r-1))+1;else if(n){i=rn(e,t,!0)-1;var o=e[i];return(t===t?t===o:o!==o)?i:-1}if(t!==t)return g(e,i,!0);for(;i--;)if(e[i]===t)return i;return-1}function Ar(){var e=arguments,t=e[0];if(!t||!t.length)return t;for(var n=0,r=zn(),i=e.length;++n<i;)for(var o=0,s=e[n];(o=r(t,s,o))>-1;)fs.call(t,o,1);return t}function Pr(e,t,n){var r=[];if(!e||!e.length)return r;var i=-1,o=[],s=e.length;for(t=Un(t,n,3);++i<s;){var a=e[i];t(a,i,e)&&(r.push(a),o.push(i))}return $t(e,o),r}function Or(e){return vr(e,1)}function Lr(e,t,n){var r=e?e.length:0;return r?(n&&"number"!=typeof n&&Qn(e,t,n)&&(t=0,n=r),Xt(e,t,n)):[]}function Rr(e,t,n){var r=e?e.length:0;return r?((n?Qn(e,t,n):null==t)&&(t=1),Xt(e,0,0>t?0:t)):[]}function Nr(e,t,n){var r=e?e.length:0;return r?((n?Qn(e,t,n):null==t)&&(t=1),t=r-(+t||0),Xt(e,0>t?0:t)):[]}function Dr(e,t,n){return e&&e.length?tn(e,Un(t,n,3),!1,!0):[]}function Ir(e,t,n){return e&&e.length?tn(e,Un(t,n,3)):[]}function kr(e,t,n,r){var i=e?e.length:0;if(!i)return[];null!=t&&"boolean"!=typeof t&&(r=n,n=Qn(e,t,r)?C:t,t=!1);var o=Un();return null==n&&o===bt||(n=o(n,r,3)),t&&zn()==s?x(e,n):Qt(e,n)}function jr(e){if(!e||!e.length)return[];var t=-1,n=0;e=at(e,function(e){return Zn(e)?(n=ws(e.length,n),!0):void 0});for(var r=Uo(n);++t<n;)r[t]=ut(e,zt(t));return r}function Fr(e,t,n){var r=e?e.length:0;if(!r)return[];var i=jr(e);return null==t?i:(t=sn(t,n,4),ut(i,function(e){return ht(e,t,C,!0)}))}function Br(){for(var e=-1,t=arguments.length;++e<t;){var n=arguments[e];if(Zn(n))var r=r?ct(St(r,n),St(n,r)):n}return r?Qt(r):[]}function Vr(e,t){var n=-1,r=e?e.length:0,i={};for(!r||t||Pa(e[0])||(t=[]);++n<r;){var o=e[n];t?i[o]=t[n]:o&&(i[o[0]]=o[1])}return i}function Ur(e){var n=t(e);return n.__chain__=!0,n}function Gr(e,t,n){return t.call(n,e),e}function zr(e,t,n){return t.call(n,e)}function Hr(){return Ur(this)}function $r(){return new r(this.value(),this.__chain__)}function Wr(e){for(var t,r=this;r instanceof n;){var i=fr(r);t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t}function qr(){var e=this.__wrapped__,t=function(e){return n&&n.__dir__<0?e:e.reverse()};if(e instanceof _){var n=e;return this.__actions__.length&&(n=new _(this)),n=n.reverse(),n.__actions__.push({func:zr,args:[t],thisArg:C}),new r(n,this.__chain__)}return this.thru(t)}function Xr(){return this.value()+""}function Yr(){return nn(this.__wrapped__,this.__actions__)}function Kr(e,t,n){var r=Pa(e)?ot:Mt;return n&&Qn(e,t,n)&&(t=C),"function"==typeof t&&n===C||(t=Un(t,n,3)),r(e,t)}function Zr(e,t,n){var r=Pa(e)?at:Tt;return t=Un(t,n,3),r(e,t)}function Jr(e,t){return ia(e,Bt(t))}function Qr(e,t,n,r){var i=e?Gs(e):0;return nr(i)||(e=oo(e),i=e.length),n="number"!=typeof n||r&&Qn(t,n,r)?0:0>n?ws(i+n,0):n||0,"string"==typeof e||!Pa(e)&&Gi(e)?i>=n&&e.indexOf(t,n)>-1:!!i&&zn(e,t,n)>-1}function ei(e,t,n){var r=Pa(e)?ut:Ft;return t=Un(t,n,3),r(e,t)}function ti(e,t){return ei(e,Do(t))}function ni(e,t,n){var r=Pa(e)?at:Tt;return t=Un(t,n,3),r(e,function(e,n,r){return!t(e,n,r)})}function ri(e,t,n){if(n?Qn(e,t,n):null==t){e=hr(e);var r=e.length;return r>0?e[Wt(0,r-1)]:C}var i=-1,o=qi(e),r=o.length,s=r-1;for(t=Ss(0>t?0:+t||0,r);++i<t;){var a=Wt(i,s),u=o[a];o[a]=o[i],o[i]=u}return o.length=t,o}function ii(e){return ri(e,As)}function oi(e){var t=e?Gs(e):0;return nr(t)?t:Va(e).length}function si(e,t,n){var r=Pa(e)?pt:Yt;return n&&Qn(e,t,n)&&(t=C),"function"==typeof t&&n===C||(t=Un(t,n,3)),r(e,t)}function ai(e,t,n){if(null==e)return[];n&&Qn(e,t,n)&&(t=C);var r=-1;t=Un(t,n,3);var i=Ft(e,function(e,n,i){return{criteria:t(e,n,i),index:++r,value:e}});return Kt(i,l)}function ui(e,t,n,r){return null==e?[]:(r&&Qn(t,n,r)&&(n=C),Pa(t)||(t=null==t?[]:[t]),Pa(n)||(n=null==n?[]:[n]),Zt(e,t,n))}function ci(e,t){return Zr(e,Bt(t))}function hi(e,t){if("function"!=typeof t){if("function"!=typeof e)throw new Ko(H);var n=e;e=t,t=n}return e=bs(e=+e)?e:0,function(){return--e<1?t.apply(this,arguments):void 0}}function li(e,t,n){return n&&Qn(e,t,n)&&(t=C),t=e&&null==t?e.length:ws(+t||0,0),jn(e,I,C,C,C,C,t)}function pi(e,t){var n;if("function"!=typeof t){if("function"!=typeof e)throw new Ko(H);var r=e;e=t,t=r}return function(){return--e>0&&(n=t.apply(this,arguments)),1>=e&&(t=C),n}}function fi(e,t,n){function r(){f&&as(f),c&&as(c),m=0,c=f=d=C}function i(t,n){n&&as(n),c=f=d=C,t&&(m=ma(),h=e.apply(p,u),f||c||(u=p=C))}function o(){var e=t-(ma()-l);0>=e||e>t?i(d,c):f=ps(o,e)}function s(){i(g,f)}function a(){if(u=arguments,l=ma(),p=this,d=g&&(f||!y),v===!1)var n=y&&!f;else{c||y||(m=l);var r=v-(l-m),i=0>=r||r>v;i?(c&&(c=as(c)),m=l,h=e.apply(p,u)):c||(c=ps(s,r))}return i&&f?f=as(f):f||t===v||(f=ps(o,t)),n&&(i=!0,h=e.apply(p,u)),!i||f||c||(u=p=C),h}var u,c,h,l,p,f,d,m=0,v=!1,g=!0;if("function"!=typeof e)throw new Ko(H);if(t=0>t?0:+t||0,n===!0){var y=!0;g=!1}else Di(n)&&(y=!!n.leading,v="maxWait"in n&&ws(+n.maxWait||0,t),g="trailing"in n?!!n.trailing:g);return a.cancel=r,a}function di(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new Ko(H);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new di.Cache,n}function mi(e){if("function"!=typeof e)throw new Ko(H);return function(){return!e.apply(this,arguments)}}function vi(e){return pi(2,e)}function gi(e,t){if("function"!=typeof e)throw new Ko(H);return t=ws(t===C?e.length-1:+t||0,0),function(){for(var n=arguments,r=-1,i=ws(n.length-t,0),o=Uo(i);++r<i;)o[r]=n[t+r];switch(t){case 0:return e.call(this,o);case 1:return e.call(this,n[0],o);case 2:return e.call(this,n[0],n[1],o)}var s=Uo(t+1);for(r=-1;++r<t;)s[r]=n[r];return s[t]=o,e.apply(this,s)}}function yi(e){if("function"!=typeof e)throw new Ko(H);return function(t){return e.apply(this,t)}}function _i(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ko(H);return n===!1?r=!1:Di(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),fi(e,t,{leading:r,maxWait:+t,trailing:i})}function bi(e,t){return t=null==t?Ao:t,jn(t,N,C,[e],[])}function xi(e,t,n,r){return t&&"boolean"!=typeof t&&Qn(e,t,n)?t=!1:"function"==typeof t&&(r=n,n=t,t=!1),"function"==typeof n?xt(e,t,sn(n,r,1)):xt(e,t)}function wi(e,t,n){return"function"==typeof t?xt(e,!0,sn(t,n,1)):xt(e,!0)}function Si(e,t){return e>t}function Mi(e,t){return e>=t}function Ei(e){return y(e)&&Zn(e)&&ts.call(e,"callee")&&!hs.call(e,"callee")}function Ci(e){return e===!0||e===!1||y(e)&&rs.call(e)==X}function Ti(e){return y(e)&&rs.call(e)==Y}function Ai(e){return!!e&&1===e.nodeType&&y(e)&&!Vi(e)}function Pi(e){return null==e?!0:Zn(e)&&(Pa(e)||Gi(e)||Ei(e)||y(e)&&Ni(e.splice))?!e.length:!Va(e).length}function Oi(e,t,n,r){n="function"==typeof n?sn(n,r,3):C;var i=n?n(e,t):C;return i===C?It(e,t,n):!!i}function Li(e){return y(e)&&"string"==typeof e.message&&rs.call(e)==K}function Ri(e){return"number"==typeof e&&bs(e)}function Ni(e){return Di(e)&&rs.call(e)==Z}function Di(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ii(e,t,n,r){return n="function"==typeof n?sn(n,r,3):C,jt(e,Hn(t),n)}function ki(e){return Bi(e)&&e!=+e}function ji(e){return null==e?!1:Ni(e)?os.test(es.call(e)):y(e)&&Ie.test(e)}function Fi(e){return null===e}function Bi(e){return"number"==typeof e||y(e)&&rs.call(e)==Q}function Vi(e){var t;if(!y(e)||rs.call(e)!=ee||Ei(e)||!ts.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var n;return Ot(e,function(e,t){n=t}),n===C||ts.call(e,n)}function Ui(e){return Di(e)&&rs.call(e)==te}function Gi(e){return"string"==typeof e||y(e)&&rs.call(e)==re}function zi(e){return y(e)&&nr(e.length)&&!!ze[rs.call(e)]}function Hi(e){return e===C}function $i(e,t){return t>e}function Wi(e,t){return t>=e}function qi(e){var t=e?Gs(e):0;return nr(t)?t?et(e):[]:oo(e)}function Xi(e){return _t(e,eo(e))}function Yi(e,t,n){var r=Is(e);return n&&Qn(e,t,n)&&(t=C),t?gt(r,t):r}function Ki(e){return Nt(e,eo(e))}function Zi(e,t,n){var r=null==e?C:Dt(e,pr(t),t+"");return r===C?n:r}function Ji(e,t){if(null==e)return!1;var n=ts.call(e,t);if(!n&&!er(t)){if(t=pr(t),e=1==t.length?e:Dt(e,Xt(t,0,-1)),null==e)return!1;t=Cr(t),n=ts.call(e,t)}return n||nr(e.length)&&Jn(t,e.length)&&(Pa(e)||Ei(e))}function Qi(e,t,n){n&&Qn(e,t,n)&&(t=C);for(var r=-1,i=Va(e),o=i.length,s={};++r<o;){var a=i[r],u=e[a];t?ts.call(s,u)?s[u].push(a):s[u]=[a]:s[u]=a}return s}function eo(e){if(null==e)return[];Di(e)||(e=qo(e));var t=e.length;t=t&&nr(t)&&(Pa(e)||Ei(e))&&t||0;for(var n=e.constructor,r=-1,i="function"==typeof n&&n.prototype===e,o=Uo(t),s=t>0;++r<t;)o[r]=r+"";for(var a in e)s&&Jn(a,t)||"constructor"==a&&(i||!ts.call(e,a))||o.push(a);return o}function to(e){e=lr(e);for(var t=-1,n=Va(e),r=n.length,i=Uo(r);++t<r;){var o=n[t];i[t]=[o,e[o]]}return i}function no(e,t,n){var r=null==e?C:e[t];return r===C&&(null==e||er(t,e)||(t=pr(t),e=1==t.length?e:Dt(e,Xt(t,0,-1)),r=null==e?C:e[Cr(t)]),r=r===C?n:r),Ni(r)?r.call(e):r}function ro(e,t,n){if(null==e)return e;var r=t+"";t=null!=e[r]||er(t,e)?[r]:pr(t);for(var i=-1,o=t.length,s=o-1,a=e;null!=a&&++i<o;){var u=t[i];Di(a)&&(i==s?a[u]=n:null==a[u]&&(a[u]=Jn(t[i+1])?[]:{})),a=a[u]}return e}function io(e,t,n,r){var i=Pa(e)||zi(e);if(t=Un(t,r,4),null==n)if(i||Di(e)){var o=e.constructor;n=i?Pa(e)?new o:[]:Is(Ni(o)?o.prototype:C)}else n={};return(i?tt:Lt)(e,function(e,r,i){return t(n,e,r,i)}),n}function oo(e){return en(e,Va(e))}function so(e){return en(e,eo(e))}function ao(e,t,n){return t=+t||0,n===C?(n=t,t=0):n=+n||0,e>=Ss(t,n)&&e<ws(t,n)}function uo(e,t,n){n&&Qn(e,t,n)&&(t=n=C);var r=null==e,i=null==t;if(null==n&&(i&&"boolean"==typeof e?(n=e,e=1):"boolean"==typeof t&&(n=t,i=!0)),r&&i&&(t=1,i=!1),e=+e||0,i?(t=e,e=0):t=+t||0,n||e%1||t%1){var o=Cs();return Ss(e+o*(t-e+us("1e-"+((o+"").length-1))),t)}return Wt(e,t)}function co(e){return e=u(e),e&&e.charAt(0).toUpperCase()+e.slice(1)}function ho(e){return e=u(e),e&&e.replace(je,f).replace(Oe,"")}function lo(e,t,n){e=u(e),t+="";var r=e.length;return n=n===C?r:Ss(0>n?0:+n||0,r),n-=t.length,n>=0&&e.indexOf(t,n)==n}function po(e){return e=u(e),e&&xe.test(e)?e.replace(_e,d):e}function fo(e){return e=u(e),e&&Pe.test(e)?e.replace(Ae,m):e||"(?:)"}function mo(e,t,n){e=u(e),t=+t;var r=e.length;if(r>=t||!bs(t))return e;var i=(t-r)/2,o=ys(i),s=vs(i);return n=Nn("",s,n),n.slice(0,o)+e+n}function vo(e,t,n){return(n?Qn(e,t,n):null==t)?t=0:t&&(t=+t),e=bo(e),Es(e,t||(De.test(e)?16:10))}function go(e,t){var n="";if(e=u(e),t=+t,1>t||!e||!bs(t))return n;do t%2&&(n+=e),t=ys(t/2),e+=e;while(t);return n}function yo(e,t,n){return e=u(e),n=null==n?0:Ss(0>n?0:+n||0,e.length),e.lastIndexOf(t,n)==n}function _o(e,n,r){var i=t.templateSettings;r&&Qn(e,n,r)&&(n=r=C),e=u(e),n=vt(gt({},r||n),i,mt);var o,s,a=vt(gt({},n.imports),i.imports,mt),c=Va(a),h=en(a,c),l=0,p=n.interpolate||Fe,f="__p += '",d=Xo((n.escape||Fe).source+"|"+p.source+"|"+(p===Me?Re:Fe).source+"|"+(n.evaluate||Fe).source+"|$","g"),m="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++Ge+"]")+"\n";e.replace(d,function(t,n,r,i,a,u){return r||(r=i),f+=e.slice(l,u).replace(Be,v),n&&(o=!0,f+="' +\n__e("+n+") +\n'"),a&&(s=!0,f+="';\n"+a+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+t.length,t}),f+="';\n";var g=n.variable;g||(f="with (obj) {\n"+f+"\n}\n"),f=(s?f.replace(me,""):f).replace(ve,"$1").replace(ge,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var y=Za(function(){return Ho(c,m+"return "+f).apply(C,h)});if(y.source=f,Li(y))throw y;return y}function bo(e,t,n){var r=e;return(e=u(e))?(n?Qn(r,t,n):null==t)?e.slice(w(e),S(e)+1):(t+="",e.slice(c(e,t),h(e,t)+1)):e}function xo(e,t,n){var r=e;return e=u(e),e?(n?Qn(r,t,n):null==t)?e.slice(w(e)):e.slice(c(e,t+"")):e}function wo(e,t,n){var r=e;return e=u(e),e?(n?Qn(r,t,n):null==t)?e.slice(0,S(e)+1):e.slice(0,h(e,t+"")+1):e}function So(e,t,n){n&&Qn(e,t,n)&&(t=C);var r=j,i=F;if(null!=t)if(Di(t)){var o="separator"in t?t.separator:o;r="length"in t?+t.length||0:r,i="omission"in t?u(t.omission):i}else r=+t||0;if(e=u(e),r>=e.length)return e;var s=r-i.length;if(1>s)return i;var a=e.slice(0,s);if(null==o)return a+i;if(Ui(o)){if(e.slice(s).search(o)){var c,h,l=e.slice(0,s);for(o.global||(o=Xo(o.source,(Ne.exec(o)||"")+"g")),o.lastIndex=0;c=o.exec(l);)h=c.index;a=a.slice(0,null==h?s:h)}}else if(e.indexOf(o,s)!=s){var p=a.lastIndexOf(o);p>-1&&(a=a.slice(0,p))}return a+i}function Mo(e){return e=u(e),e&&be.test(e)?e.replace(ye,M):e}function Eo(e,t,n){return n&&Qn(e,t,n)&&(t=C),e=u(e),e.match(t||Ve)||[]}function Co(e,t,n){return n&&Qn(e,t,n)&&(t=C),y(e)?Po(e):bt(e,t)}function To(e){return function(){return e}}function Ao(e){return e}function Po(e){return Bt(xt(e,!0))}function Oo(e,t){return Vt(e,xt(t,!0))}function Lo(e,t,n){if(null==n){var r=Di(t),i=r?Va(t):C,o=i&&i.length?Nt(t,i):C;(o?o.length:r)||(o=!1,n=t,t=e,e=this)}o||(o=Nt(t,Va(t)));var s=!0,a=-1,u=Ni(e),c=o.length;n===!1?s=!1:Di(n)&&"chain"in n&&(s=n.chain);for(;++a<c;){var h=o[a],l=t[h];e[h]=l,u&&(e.prototype[h]=function(t){return function(){var n=this.__chain__;if(s||n){var r=e(this.__wrapped__),i=r.__actions__=et(this.__actions__);return i.push({func:t,args:arguments,thisArg:e}),r.__chain__=n,r}return t.apply(e,ct([this.value()],arguments))}}(l))}return e}function Ro(){return rt._=is,this}function No(){}function Do(e){return er(e)?zt(e):Ht(e)}function Io(e){return function(t){return Dt(e,pr(t),t+"")}}function ko(e,t,n){n&&Qn(e,t,n)&&(t=n=C),e=+e||0,n=null==n?1:+n||0,null==t?(t=e,e=0):t=+t||0;for(var r=-1,i=ws(vs((t-e)/(n||1)),0),o=Uo(i);++r<i;)o[r]=e,e+=n;return o}function jo(e,t,n){if(e=ys(e),1>e||!bs(e))return[];var r=-1,i=Uo(Ss(e,Ps));for(t=sn(t,n,1);++r<e;)Ps>r?i[r]=t(r):t(r);return i}function Fo(e){var t=++ns;return u(e)+t}function Bo(e,t){return(+e||0)+(+t||0)}function Vo(e,t,n){return n&&Qn(e,t,n)&&(t=C),t=Un(t,n,3),1==t.length?ft(Pa(e)?e:hr(e),t):Jt(e,t)}e=e?it.defaults(rt.Object(),e,it.pick(rt,Ue)):rt;var Uo=e.Array,Go=e.Date,zo=e.Error,Ho=e.Function,$o=e.Math,Wo=e.Number,qo=e.Object,Xo=e.RegExp,Yo=e.String,Ko=e.TypeError,Zo=Uo.prototype,Jo=qo.prototype,Qo=Yo.prototype,es=Ho.prototype.toString,ts=Jo.hasOwnProperty,ns=0,rs=Jo.toString,is=rt._,os=Xo("^"+es.call(ts).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ss=e.ArrayBuffer,as=e.clearTimeout,us=e.parseFloat,cs=$o.pow,hs=Jo.propertyIsEnumerable,ls=$n(e,"Set"),ps=e.setTimeout,fs=Zo.splice,ds=e.Uint8Array,ms=$n(e,"WeakMap"),vs=$o.ceil,gs=$n(qo,"create"),ys=$o.floor,_s=$n(Uo,"isArray"),bs=e.isFinite,xs=$n(qo,"keys"),ws=$o.max,Ss=$o.min,Ms=$n(Go,"now"),Es=e.parseInt,Cs=$o.random,Ts=Wo.NEGATIVE_INFINITY,As=Wo.POSITIVE_INFINITY,Ps=4294967295,Os=Ps-1,Ls=Ps>>>1,Rs=9007199254740991,Ns=ms&&new ms,Ds={};t.support={};t.templateSettings={escape:we,evaluate:Se,interpolate:Me,variable:"",imports:{_:t}};var Is=function(){function e(){}return function(t){if(Di(t)){e.prototype=t;var n=new e;e.prototype=C}return n||{}}}(),ks=pn(Lt),js=pn(Rt,!0),Fs=fn(),Bs=fn(!0),Vs=Ns?function(e,t){return Ns.set(e,t),e}:Ao,Us=Ns?function(e){return Ns.get(e)}:No,Gs=zt("length"),zs=function(){var e=0,t=0;return function(n,r){var i=ma(),o=V-(i-t);if(t=i,o>0){if(++e>=B)return n}else e=0;return Vs(n,r)}}(),Hs=gi(function(e,t){return y(e)&&Zn(e)?St(e,Pt(t,!1,!0)):[]}),$s=wn(),Ws=wn(!0),qs=gi(function(e){for(var t=e.length,n=t,r=Uo(l),i=zn(),o=i==s,a=[];n--;){var u=e[n]=Zn(u=e[n])?u:[];r[n]=o&&u.length>=120?mn(n&&u):null}var c=e[0],h=-1,l=c?c.length:0,p=r[0];e:for(;++h<l;)if(u=c[h],(p?Ze(p,u):i(a,u,0))<0){for(var n=t;--n;){var f=r[n];if((f?Ze(f,u):i(e[n],u,0))<0)continue e}p&&p.push(u),a.push(u)}return a}),Xs=gi(function(e,t){t=Pt(t);var n=yt(e,t);return $t(e,t.sort(i)),n}),Ys=kn(),Ks=kn(!0),Zs=gi(function(e){return Qt(Pt(e,!1,!0))}),Js=gi(function(e,t){return Zn(e)?St(e,t):[]}),Qs=gi(jr),ea=gi(function(e){var t=e.length,n=t>2?e[t-2]:C,r=t>1?e[t-1]:C;return t>2&&"function"==typeof n?t-=2:(n=t>1&&"function"==typeof r?(--t,r):C,r=C),e.length=t,Fr(e,n,r)}),ta=gi(function(e){return e=Pt(e),this.thru(function(t){return Qe(Pa(t)?t:[lr(t)],e)})}),na=gi(function(e,t){return yt(e,Pt(t))}),ra=hn(function(e,t,n){ts.call(e,n)?++e[n]:e[n]=1}),ia=xn(ks),oa=xn(js,!0),sa=En(tt,ks),aa=En(nt,js),ua=hn(function(e,t,n){ts.call(e,n)?e[n].push(t):e[n]=[t]}),ca=hn(function(e,t,n){e[n]=t}),ha=gi(function(e,t,n){var r=-1,i="function"==typeof t,o=er(t),s=Zn(e)?Uo(e.length):[];return ks(e,function(e){var a=i?t:o&&null!=e?e[t]:C;s[++r]=a?a.apply(e,n):Kn(e,t,n)}),s}),la=hn(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),pa=Ln(ht,ks),fa=Ln(lt,js),da=gi(function(e,t){if(null==e)return[];var n=t[2];return n&&Qn(t[0],t[1],n)&&(t.length=1),Zt(e,Pt(t),[])}),ma=Ms||function(){return(new Go).getTime()},va=gi(function(e,t,n){var r=A;if(n.length){var i=b(n,va.placeholder);r|=N}return jn(e,r,t,n,i)}),ga=gi(function(e,t){t=t.length?Pt(t):Ki(e);for(var n=-1,r=t.length;++n<r;){var i=t[n];e[i]=jn(e[i],A,e)}return e}),ya=gi(function(e,t,n){var r=A|P;if(n.length){var i=b(n,ya.placeholder);r|=N}return jn(t,r,e,n,i)}),_a=yn(L),ba=yn(R),xa=gi(function(e,t){return wt(e,1,t)}),wa=gi(function(e,t,n){return wt(e,t,n)}),Sa=Mn(),Ma=Mn(!0),Ea=gi(function(e,t){if(t=Pt(t),"function"!=typeof e||!ot(t,a))throw new Ko(H);var n=t.length;return gi(function(r){for(var i=Ss(r.length,n);i--;)r[i]=t[i](r[i]);return e.apply(this,r)})}),Ca=On(N),Ta=On(D),Aa=gi(function(e,t){return jn(e,k,C,C,C,Pt(t))}),Pa=_s||function(e){return y(e)&&nr(e.length)&&rs.call(e)==q},Oa=ln(Ut),La=ln(function(e,t,n){return n?vt(e,t,n):gt(e,t)}),Ra=_n(La,dt),Na=_n(Oa,or),Da=Sn(Lt),Ia=Sn(Rt),ka=Cn(Fs),ja=Cn(Bs),Fa=Tn(Lt),Ba=Tn(Rt),Va=xs?function(e){var t=null==e?C:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&Zn(e)?cr(e):Di(e)?xs(e):[]}:cr,Ua=An(!0),Ga=An(),za=gi(function(e,t){if(null==e)return{};if("function"!=typeof t[0]){var t=ut(Pt(t),Yo);return sr(e,St(eo(e),t))}var n=sn(t[0],t[1],3);return ar(e,function(e,t,r){return!n(e,t,r)})}),Ha=gi(function(e,t){return null==e?{}:"function"==typeof t[0]?ar(e,sn(t[0],t[1],3)):sr(e,Pt(t))}),$a=vn(function(e,t,n){return t=t.toLowerCase(),e+(n?t.charAt(0).toUpperCase()+t.slice(1):t)}),Wa=vn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),qa=Pn(),Xa=Pn(!0),Ya=vn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Ka=vn(function(e,t,n){return e+(n?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))}),Za=gi(function(e,t){try{return e.apply(C,t)}catch(n){return Li(n)?n:new zo(n)}}),Ja=gi(function(e,t){return function(n){return Kn(n,e,t)}}),Qa=gi(function(e,t){return function(n){return Kn(e,n,t)}}),eu=In("ceil"),tu=In("floor"),nu=bn(Si,Ts),ru=bn($i,As),iu=In("round");return t.prototype=n.prototype,r.prototype=Is(n.prototype),r.prototype.constructor=r,_.prototype=Is(n.prototype),_.prototype.constructor=_,$e.prototype["delete"]=We,$e.prototype.get=qe,$e.prototype.has=Xe,$e.prototype.set=Ye,Ke.prototype.push=Je,di.Cache=$e,t.after=hi,t.ary=li,t.assign=La,t.at=na,t.before=pi,t.bind=va,t.bindAll=ga,t.bindKey=ya,t.callback=Co,t.chain=Ur,t.chunk=dr,t.compact=mr,t.constant=To,t.countBy=ra,t.create=Yi,t.curry=_a,t.curryRight=ba,t.debounce=fi,t.defaults=Ra,t.defaultsDeep=Na,t.defer=xa,t.delay=wa,t.difference=Hs,t.drop=vr,t.dropRight=gr,t.dropRightWhile=yr,t.dropWhile=_r,t.fill=br,t.filter=Zr,t.flatten=wr,t.flattenDeep=Sr,t.flow=Sa,t.flowRight=Ma,t.forEach=sa,t.forEachRight=aa,t.forIn=ka,t.forInRight=ja,t.forOwn=Fa,t.forOwnRight=Ba,t.functions=Ki,t.groupBy=ua,t.indexBy=ca,t.initial=Er,t.intersection=qs,t.invert=Qi,t.invoke=ha,t.keys=Va,t.keysIn=eo,t.map=ei,t.mapKeys=Ua,t.mapValues=Ga,t.matches=Po,t.matchesProperty=Oo,t.memoize=di,t.merge=Oa,t.method=Ja,t.methodOf=Qa,t.mixin=Lo,t.modArgs=Ea,t.negate=mi,t.omit=za,t.once=vi,t.pairs=to,t.partial=Ca,t.partialRight=Ta,t.partition=la,t.pick=Ha,t.pluck=ti,t.property=Do,t.propertyOf=Io,t.pull=Ar,t.pullAt=Xs,t.range=ko,t.rearg=Aa,t.reject=ni,t.remove=Pr,t.rest=Or,t.restParam=gi,t.set=ro,t.shuffle=ii,t.slice=Lr,t.sortBy=ai,t.sortByAll=da,t.sortByOrder=ui,t.spread=yi,t.take=Rr,t.takeRight=Nr,t.takeRightWhile=Dr,t.takeWhile=Ir,t.tap=Gr,t.throttle=_i,t.thru=zr,t.times=jo,t.toArray=qi,t.toPlainObject=Xi,t.transform=io,t.union=Zs,t.uniq=kr,t.unzip=jr,t.unzipWith=Fr,t.values=oo,t.valuesIn=so,t.where=ci,t.without=Js,t.wrap=bi,t.xor=Br,t.zip=Qs,t.zipObject=Vr,t.zipWith=ea,t.backflow=Ma,t.collect=ei,t.compose=Ma,t.each=sa,t.eachRight=aa,t.extend=La,t.iteratee=Co,t.methods=Ki,t.object=Vr,t.select=Zr,t.tail=Or,t.unique=kr,Lo(t,t),t.add=Bo,t.attempt=Za,t.camelCase=$a,t.capitalize=co,t.ceil=eu,t.clone=xi,t.cloneDeep=wi,t.deburr=ho,t.endsWith=lo,t.escape=po,t.escapeRegExp=fo,t.every=Kr,t.find=ia,t.findIndex=$s,t.findKey=Da,t.findLast=oa,t.findLastIndex=Ws,t.findLastKey=Ia,t.findWhere=Jr,t.first=xr,t.floor=tu,t.get=Zi,t.gt=Si,t.gte=Mi,t.has=Ji,t.identity=Ao,t.includes=Qr,t.indexOf=Mr,t.inRange=ao,t.isArguments=Ei,t.isArray=Pa,t.isBoolean=Ci,t.isDate=Ti,t.isElement=Ai,t.isEmpty=Pi,t.isEqual=Oi,t.isError=Li,t.isFinite=Ri,t.isFunction=Ni,t.isMatch=Ii,t.isNaN=ki,t.isNative=ji,t.isNull=Fi,t.isNumber=Bi,t.isObject=Di,t.isPlainObject=Vi,t.isRegExp=Ui,t.isString=Gi,t.isTypedArray=zi,t.isUndefined=Hi,t.kebabCase=Wa,t.last=Cr,t.lastIndexOf=Tr,t.lt=$i,t.lte=Wi,t.max=nu,t.min=ru,t.noConflict=Ro,t.noop=No,t.now=ma,t.pad=mo,t.padLeft=qa,t.padRight=Xa,t.parseInt=vo,t.random=uo,t.reduce=pa,t.reduceRight=fa,t.repeat=go,t.result=no,t.round=iu,t.runInContext=E,t.size=oi,t.snakeCase=Ya,t.some=si,t.sortedIndex=Ys,t.sortedLastIndex=Ks,t.startCase=Ka,t.startsWith=yo,t.sum=Vo,t.template=_o,t.trim=bo,t.trimLeft=xo,t.trimRight=wo,t.trunc=So,t.unescape=Mo,t.uniqueId=Fo,t.words=Eo,t.all=Kr,t.any=si,t.contains=Qr,t.eq=Oi,t.detect=ia,t.foldl=pa,t.foldr=fa,t.head=xr,t.include=Qr,t.inject=pa,Lo(t,function(){var e={};return Lt(t,function(n,r){t.prototype[r]||(e[r]=n)}),e}(),!1),t.sample=ri,t.prototype.sample=function(e){return this.__chain__||null!=e?this.thru(function(t){return ri(t,e)}):ri(this.value())},t.VERSION=T,tt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){t[e].placeholder=t}),tt(["drop","take"],function(e,t){_.prototype[e]=function(n){var r=this.__filtered__;if(r&&!t)return new _(this);n=null==n?1:ws(ys(n)||0,0);var i=this.clone();return r?i.__takeCount__=Ss(i.__takeCount__,n):i.__views__.push({size:n,type:e+(i.__dir__<0?"Right":"")}),i},_.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),tt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n!=z;_.prototype[e]=function(e,t){var i=this.clone();return i.__iteratees__.push({iteratee:Un(e,t,1),type:n}),i.__filtered__=i.__filtered__||r,i}}),tt(["first","last"],function(e,t){var n="take"+(t?"Right":"");_.prototype[e]=function(){return this[n](1).value()[0]}}),tt(["initial","rest"],function(e,t){var n="drop"+(t?"":"Right");_.prototype[e]=function(){return this.__filtered__?new _(this):this[n](1)}}),tt(["pluck","where"],function(e,t){var n=t?"filter":"map",r=t?Bt:Do;_.prototype[e]=function(e){return this[n](r(e))}}),_.prototype.compact=function(){return this.filter(Ao)},_.prototype.reject=function(e,t){return e=Un(e,t,1),this.filter(function(t){return!e(t)})},_.prototype.slice=function(e,t){e=null==e?0:+e||0;var n=this;return n.__filtered__&&(e>0||0>t)?new _(n):(0>e?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==C&&(t=+t||0,n=0>t?n.dropRight(-t):n.take(t-e)),n)},_.prototype.takeRightWhile=function(e,t){return this.reverse().takeWhile(e,t).reverse()},_.prototype.toArray=function(){return this.take(As)},Lt(_.prototype,function(e,n){var i=/^(?:filter|map|reject)|While$/.test(n),o=/^(?:first|last)$/.test(n),s=t[o?"take"+("last"==n?"Right":""):n];s&&(t.prototype[n]=function(){var t=o?[1]:arguments,n=this.__chain__,a=this.__wrapped__,u=!!this.__actions__.length,c=a instanceof _,h=t[0],l=c||Pa(a);l&&i&&"function"==typeof h&&1!=h.length&&(c=l=!1);var p=function(e){return o&&n?s(e,1)[0]:s.apply(C,ct([e],t))},f={func:zr,args:[p],thisArg:C},d=c&&!u;if(o&&!n)return d?(a=a.clone(),a.__actions__.push(f),e.call(a)):s.call(C,this.value())[0];if(!o&&l){a=d?a:new _(this);var m=e.apply(a,t);return m.__actions__.push(f),new r(m,n)}return this.thru(p)})}),tt(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(e){var n=(/^(?:replace|split)$/.test(e)?Qo:Zo)[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:join|pop|replace|shift)$/.test(e);t.prototype[e]=function(){var e=arguments;return i&&!this.__chain__?n.apply(this.value(),e):this[r](function(t){return n.apply(t,e)})}}),Lt(_.prototype,function(e,n){var r=t[n];if(r){var i=r.name,o=Ds[i]||(Ds[i]=[]);o.push({name:n,func:r})}}),Ds[Rn(C,P).name]=[{name:"wrapper",func:C}],_.prototype.clone=J,_.prototype.reverse=ne,_.prototype.value=ie,t.prototype.chain=Hr,t.prototype.commit=$r,t.prototype.concat=ta,t.prototype.plant=Wr,t.prototype.reverse=qr,t.prototype.toString=Xr,t.prototype.run=t.prototype.toJSON=t.prototype.valueOf=t.prototype.value=Yr,t.prototype.collect=t.prototype.map,t.prototype.head=t.prototype.first,t.prototype.select=t.prototype.filter,t.prototype.tail=t.prototype.rest,t}var C,T="3.10.1",A=1,P=2,O=4,L=8,R=16,N=32,D=64,I=128,k=256,j=30,F="...",B=150,V=16,U=200,G=1,z=2,H="Expected a function",$="__lodash_placeholder__",W="[object Arguments]",q="[object Array]",X="[object Boolean]",Y="[object Date]",K="[object Error]",Z="[object Function]",J="[object Map]",Q="[object Number]",ee="[object Object]",te="[object RegExp]",ne="[object Set]",re="[object String]",ie="[object WeakMap]",oe="[object ArrayBuffer]",se="[object Float32Array]",ae="[object Float64Array]",ue="[object Int8Array]",ce="[object Int16Array]",he="[object Int32Array]",le="[object Uint8Array]",pe="[object Uint8ClampedArray]",fe="[object Uint16Array]",de="[object Uint32Array]",me=/\b__p \+= '';/g,ve=/\b(__p \+=) '' \+/g,ge=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ye=/&(?:amp|lt|gt|quot|#39|#96);/g,_e=/[&<>"'`]/g,be=RegExp(ye.source),xe=RegExp(_e.source),we=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Me=/<%=([\s\S]+?)%>/g,Ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,Ce=/^\w*$/,Te=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,Ae=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,Pe=RegExp(Ae.source),Oe=/[\u0300-\u036f\ufe20-\ufe23]/g,Le=/\\(\\)?/g,Re=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ne=/\w*$/,De=/^0[xX]/,Ie=/^\[object .+?Constructor\]$/,ke=/^\d+$/,je=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Fe=/($^)/,Be=/['\n\r\u2028\u2029\\]/g,Ve=function(){var e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",t="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(e+"+(?="+e+t+")|"+e+"?"+t+"|"+e+"+|[0-9]+","g")}(),Ue=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],Ge=-1,ze={};ze[se]=ze[ae]=ze[ue]=ze[ce]=ze[he]=ze[le]=ze[pe]=ze[fe]=ze[de]=!0,ze[W]=ze[q]=ze[oe]=ze[X]=ze[Y]=ze[K]=ze[Z]=ze[J]=ze[Q]=ze[ee]=ze[te]=ze[ne]=ze[re]=ze[ie]=!1;var He={};He[W]=He[q]=He[oe]=He[X]=He[Y]=He[se]=He[ae]=He[ue]=He[ce]=He[he]=He[Q]=He[ee]=He[te]=He[re]=He[le]=He[pe]=He[fe]=He[de]=!0,He[K]=He[Z]=He[J]=He[ne]=He[ie]=!1;var $e={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},We={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qe={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Xe={"function":!0,object:!0},Ye={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ze=Xe[typeof r]&&r&&!r.nodeType&&r,Je=Xe[typeof n]&&n&&!n.nodeType&&n,Qe=Ze&&Je&&"object"==typeof t&&t&&t.Object&&t,et=Xe[typeof self]&&self&&self.Object&&self,tt=Xe[typeof window]&&window&&window.Object&&window,nt=Je&&Je.exports===Ze&&Ze,rt=Qe||tt!==(this&&this.window)&&tt||et||this,it=E();"function"==typeof e&&"object"==typeof e.amd&&e.amd?(rt._=it,e(function(){return it})):Ze&&Je?nt?(Je.exports=it)._=it:Ze._=it:rt._=it}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],185:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(e){return i.exec(e).slice(1)};n.resolve=function(){for(var n="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,i="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),o="/"===s(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),o=r(t.split("/")),s=Math.min(i.length,o.length),a=s,u=0;s>u;u++)if(i[u]!==o[u]){a=u;break}for(var c=[],u=a;u<i.length;u++)c.push("..");return c=c.concat(o.slice(a)),c.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=o(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},n.basename=function(e,t){var n=o(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return o(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n);
|
||
}:function(e,t,n){return 0>t&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:6}],186:[function(e,t,n){"use strict";function r(e){var t;e&&e.length&&(t=e,e=t.length);var n=new Uint8Array(e||0);return t&&n.set(t),n.readUInt32LE=o.readUInt32LE,n.writeUInt32LE=o.writeUInt32LE,n.readInt32LE=o.readInt32LE,n.writeInt32LE=o.writeInt32LE,n.readFloatLE=o.readFloatLE,n.writeFloatLE=o.writeFloatLE,n.readDoubleLE=o.readDoubleLE,n.writeDoubleLE=o.writeDoubleLE,n.toString=o.toString,n.write=o.write,n.slice=o.slice,n.copy=o.copy,n._isBuffer=!0,n}function i(e){for(var t,n,r=e.length,i=[],o=0;r>o;o++){if(t=e.charCodeAt(o),t>55295&&57344>t){if(!n){t>56319||o+1===r?i.push(239,191,189):n=t;continue}if(56320>t){i.push(239,191,189),n=t;continue}t=n-55296<<10|t-56320|65536,n=null}else n&&(i.push(239,191,189),n=null);128>t?i.push(t):2048>t?i.push(t>>6|192,63&t|128):65536>t?i.push(t>>12|224,t>>6&63|128,63&t|128):i.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}return i}t.exports=r;var o,s,a,u=e("ieee754");o={readUInt32LE:function(e){return(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},writeUInt32LE:function(e,t){this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24},readInt32LE:function(e){return(this[e]|this[e+1]<<8|this[e+2]<<16)+(this[e+3]<<24)},readFloatLE:function(e){return u.read(this,e,!0,23,4)},readDoubleLE:function(e){return u.read(this,e,!0,52,8)},writeFloatLE:function(e,t){return u.write(this,e,t,!0,23,4)},writeDoubleLE:function(e,t){return u.write(this,e,t,!0,52,8)},toString:function(e,t,n){var r="",i="";t=t||0,n=Math.min(this.length,n||this.length);for(var o=t;n>o;o++){var s=this[o];127>=s?(r+=decodeURIComponent(i)+String.fromCharCode(s),i=""):i+="%"+s.toString(16)}return r+=decodeURIComponent(i)},write:function(e,t){for(var n=e===s?a:i(e),r=0;r<n.length;r++)this[t+r]=n[r]},slice:function(e,t){return this.subarray(e,t)},copy:function(e,t){t=t||0;for(var n=0;n<this.length;n++)e[t+n]=this[n]}},o.writeInt32LE=o.writeUInt32LE,r.byteLength=function(e){return s=e,a=i(e),a.length},r.isBuffer=function(e){return!(!e||!e._isBuffer)}},{ieee754:178}],187:[function(e,t,n){(function(n){"use strict";function r(e){this.buf=f.isBuffer(e)?e:new f(e||0),this.pos=0,this.length=this.buf.length}function i(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function o(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function s(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function a(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function u(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function c(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function h(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function l(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function p(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}t.exports=r;var f=n.Buffer||e("./buffer");r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var d=4294967296,m=1/d,v=Math.pow(2,63);r.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=this.buf.readUInt32LE(this.pos);return this.pos+=4,e},readSFixed32:function(){var e=this.buf.readInt32LE(this.pos);return this.pos+=4,e},readFixed64:function(){var e=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*d;return this.pos+=8,e},readSFixed64:function(){var e=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*d;return this.pos+=8,e},readFloat:function(){var e=this.buf.readFloatLE(this.pos);return this.pos+=4,e},readDouble:function(){var e=this.buf.readDoubleLE(this.pos);return this.pos+=8,e},readVarint:function(){var e,t,n,r,i,o,s=this.buf;if(n=s[this.pos++],128>n)return n;if(n=127&n,r=s[this.pos++],128>r)return n|r<<7;if(r=(127&r)<<7,i=s[this.pos++],128>i)return n|r|i<<14;if(i=(127&i)<<14,o=s[this.pos++],128>o)return n|r|i|o<<21;if(e=n|r|i|(127&o)<<21,t=s[this.pos++],e+=268435456*(127&t),128>t)return e;if(t=s[this.pos++],e+=34359738368*(127&t),128>t)return e;if(t=s[this.pos++],e+=4398046511104*(127&t),128>t)return e;if(t=s[this.pos++],e+=562949953421312*(127&t),128>t)return e;if(t=s[this.pos++],e+=72057594037927940*(127&t),128>t)return e;if(t=s[this.pos++],e+=0x8000000000000000*(127&t),128>t)return e;throw new Error("Expected varint not more than 10 bytes")},readVarint64:function(){var e=this.pos,t=this.readVarint();if(v>t)return t;for(var n=this.pos-2;255===this.buf[n];)n--;e>n&&(n=e),t=0;for(var r=0;n-e+1>r;r++){var i=127&~this.buf[e+r];t+=4>r?i<<7*r:i*Math.pow(2,7*r)}return-t-1},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=this.buf.toString("utf8",this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.slice(this.pos,e);return this.pos=e,t},readPackedVarint:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readVarint());return t},readPackedSVarint:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(e){var t=7&e;if(t===r.Varint)for(;this.buf[this.pos++]>127;);else if(t===r.Bytes)this.pos=this.readVarint()+this.pos;else if(t===r.Fixed32)this.pos+=4;else{if(t!==r.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new f(t);this.buf.copy(n),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.slice(0,this.length)},writeFixed32:function(e){this.realloc(4),this.buf.writeUInt32LE(e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),this.buf.writeInt32LE(e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),this.buf.writeInt32LE(-1&e,this.pos),this.buf.writeUInt32LE(Math.floor(e*m),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),this.buf.writeInt32LE(-1&e,this.pos),this.buf.writeInt32LE(Math.floor(e*m),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e,127>=e)this.realloc(1),this.buf[this.pos++]=e;else if(16383>=e)this.realloc(2),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127;else if(2097151>=e)this.realloc(3),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127|128,this.buf[this.pos++]=e>>>14&127;else if(268435455>=e)this.realloc(4),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127|128,this.buf[this.pos++]=e>>>14&127|128,this.buf[this.pos++]=e>>>21&127;else{for(var t=this.pos;e>=128;)this.realloc(1),this.buf[this.pos++]=255&e|128,e/=128;if(this.realloc(1),this.buf[this.pos++]=0|e,this.pos-t>10)throw new Error("Given varint doesn't fit into 10 bytes")}},writeSVarint:function(e){this.writeVarint(0>e?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e);var t=f.byteLength(e);this.writeVarint(t),this.realloc(t),this.buf.write(e,this.pos),this.pos+=t},writeFloat:function(e){this.realloc(4),this.buf.writeFloatLE(e,this.pos),this.pos+=4},writeDouble:function(e){this.realloc(8),this.buf.writeDoubleLE(e,this.pos),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;t>n;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n,i=127>=r?1:16383>=r?2:2097151>=r?3:268435455>=r?4:Math.ceil(Math.log(r)/(7*Math.LN2));if(i>1){this.realloc(i-1);for(var o=this.pos-1;o>=n;o--)this.buf[o+i-1]=this.buf[o]}this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,r.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){this.writeMessage(e,i,t)},writePackedSVarint:function(e,t){this.writeMessage(e,o,t)},writePackedBoolean:function(e,t){this.writeMessage(e,u,t)},writePackedFloat:function(e,t){this.writeMessage(e,s,t)},writePackedDouble:function(e,t){this.writeMessage(e,a,t)},writePackedFixed32:function(e,t){this.writeMessage(e,c,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,h,t)},writePackedFixed64:function(e,t){this.writeMessage(e,l,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,p,t)},writeBytesField:function(e,t){this.writeTag(e,r.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,r.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,r.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,r.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,r.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,r.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,r.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,r.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,r.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,r.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":186}],188:[function(e,t,n){"use strict";t.exports=e("./lib")},{"./lib":193}],189:[function(e,t,n){"use strict";function r(){}function i(e){try{return e.then}catch(t){return v=t,g}}function o(e,t){try{return e(t)}catch(n){return v=n,g}}function s(e,t,n){try{e(t,n)}catch(r){return v=r,g}}function a(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._37=0,this._12=null,this._59=[],e!==r&&d(e,this)}function u(e,t,n){return new e.constructor(function(i,o){var s=new a(r);s.then(i,o),c(e,new f(t,n,s))})}function c(e,t){for(;3===e._37;)e=e._12;return 0===e._37?void e._59.push(t):void m(function(){var n=1===e._37?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._37?h(t.promise,e._12):l(t.promise,e._12));var r=o(n,e._12);r===g?l(t.promise,v):h(t.promise,r)})}function h(e,t){if(t===e)return l(e,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var n=i(t);if(n===g)return l(e,v);if(n===e.then&&t instanceof a)return e._37=3,e._12=t,void p(e);if("function"==typeof n)return void d(n.bind(t),e)}e._37=1,e._12=t,p(e)}function l(e,t){e._37=2,e._12=t,p(e)}function p(e){for(var t=0;t<e._59.length;t++)c(e,e._59[t]);e._59=null}function f(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function d(e,t){var n=!1,r=s(e,function(e){n||(n=!0,h(t,e))},function(e){n||(n=!0,l(t,e))});n||r!==g||(n=!0,l(t,v))}var m=e("asap/raw"),v=null,g={};t.exports=a,a._99=r,a.prototype.then=function(e,t){if(this.constructor!==a)return u(this,e,t);var n=new a(r);return c(this,new f(e,t,n)),n}},{"asap/raw":2}],190:[function(e,t,n){"use strict";var r=e("./core.js");t.exports=r,r.prototype.done=function(e,t){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(e){setTimeout(function(){throw e},0)})}},{"./core.js":189}],191:[function(e,t,n){"use strict";function r(e){var t=new i(i._99);return t._37=1,t._12=e,t}var i=e("./core.js");t.exports=i;var o=r(!0),s=r(!1),a=r(null),u=r(void 0),c=r(0),h=r("");i.resolve=function(e){if(e instanceof i)return e;if(null===e)return a;if(void 0===e)return u;if(e===!0)return o;if(e===!1)return s;if(0===e)return c;if(""===e)return h;if("object"==typeof e||"function"==typeof e)try{var t=e.then;if("function"==typeof t)return new i(t.bind(e))}catch(n){return new i(function(e,t){t(n)})}return r(e)},i.all=function(e){var t=Array.prototype.slice.call(e);return new i(function(e,n){function r(s,a){if(a&&("object"==typeof a||"function"==typeof a)){if(a instanceof i&&a.then===i.prototype.then){for(;3===a._37;)a=a._12;return 1===a._37?r(s,a._12):(2===a._37&&n(a._12),void a.then(function(e){r(s,e)},n))}var u=a.then;if("function"==typeof u){var c=new i(u.bind(a));return void c.then(function(e){r(s,e)},n)}}t[s]=a,0===--o&&e(t)}if(0===t.length)return e([]);for(var o=t.length,s=0;s<t.length;s++)r(s,t[s])})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(e){return new i(function(t,n){e.forEach(function(e){i.resolve(e).then(t,n)})})},i.prototype["catch"]=function(e){return this.then(null,e)}},{"./core.js":189}],192:[function(e,t,n){"use strict";var r=e("./core.js");t.exports=r,r.prototype["finally"]=function(e){return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})}},{"./core.js":189}],193:[function(e,t,n){"use strict";t.exports=e("./core.js"),e("./done.js"),e("./finally.js"),e("./es6-extensions.js"),e("./node-extensions.js")},{"./core.js":189,"./done.js":190,"./es6-extensions.js":191,"./finally.js":192,"./node-extensions.js":194}],194:[function(e,t,n){"use strict";var r=e("./core.js"),i=e("asap");t.exports=r,r.denodeify=function(e,t){return t=t||1/0,function(){var n=this,i=Array.prototype.slice.call(arguments,0,t>0?t:0);return new r(function(t,r){i.push(function(e,n){e?r(e):t(n)});var o=e.apply(n,i);!o||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then||t(o)})}},r.nodeify=function(e){return function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof t[t.length-1]?t.pop():null,o=this;try{return e.apply(this,arguments).nodeify(n,o)}catch(s){if(null===n||"undefined"==typeof n)return new r(function(e,t){t(s)});i(function(){n.call(o,s)})}}},r.prototype.nodeify=function(e,t){return"function"!=typeof e?this:void this.then(function(n){i(function(){e.call(t,null,n)})},function(n){i(function(){e.call(t,n)})})}},{"./core.js":189,asap:1}],195:[function(t,n,r){!function(){"use strict";function t(e,n){return this instanceof t?(this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),n&&this._initFormat(n),void this.clear()):new t(e,n)}function r(e,t){e.bbox=i(e,0,e.children.length,t)}function i(e,t,n,r){for(var i,a=o(),u=t;n>u;u++)i=e.children[u],s(a,e.leaf?r(i):i.bbox);return a}function o(){return[1/0,1/0,-(1/0),-(1/0)]}function s(e,t){return e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3]),e}function a(e,t){return e.bbox[0]-t.bbox[0]}function u(e,t){return e.bbox[1]-t.bbox[1]}function c(e){return(e[2]-e[0])*(e[3]-e[1])}function h(e){return e[2]-e[0]+(e[3]-e[1])}function l(e,t){return(Math.max(t[2],e[2])-Math.min(t[0],e[0]))*(Math.max(t[3],e[3])-Math.min(t[1],e[1]))}function p(e,t){var n=Math.max(e[0],t[0]),r=Math.max(e[1],t[1]),i=Math.min(e[2],t[2]),o=Math.min(e[3],t[3]);return Math.max(0,i-n)*Math.max(0,o-r)}function f(e,t){return e[0]<=t[0]&&e[1]<=t[1]&&t[2]<=e[2]&&t[3]<=e[3]}function d(e,t){return t[0]<=e[2]&&t[1]<=e[3]&&t[2]>=e[0]&&t[3]>=e[1]}function m(e,t,n,r,i){for(var o,s=[t,n];s.length;)n=s.pop(),t=s.pop(),r>=n-t||(o=t+Math.ceil((n-t)/r/2)*r,v(e,t,n,o,i),s.push(t,o,o,n))}function v(e,t,n,r,i){for(var o,s,a,u,c,h,l,p,f;n>t;){for(n-t>600&&(o=n-t+1,s=r-t+1,a=Math.log(o),u=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*u*(o-u)/o)*(0>s-o/2?-1:1),h=Math.max(t,Math.floor(r-s*u/o+c)),l=Math.min(n,Math.floor(r+(o-s)*u/o+c)),v(e,h,l,r,i)),p=e[r],s=t,f=n,g(e,t,r),i(e[n],p)>0&&g(e,t,n);f>s;){for(g(e,s,f),s++,f--;i(e[s],p)<0;)s++;for(;i(e[f],p)>0;)f--}0===i(e[t],p)?g(e,t,f):(f++,g(e,f,n)),r>=f&&(t=f+1),f>=r&&(n=f-1)}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}t.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,n=[],r=this.toBBox;if(!d(e,t.bbox))return n;for(var i,o,s,a,u=[];t;){for(i=0,o=t.children.length;o>i;i++)s=t.children[i],a=t.leaf?r(s):s.bbox,d(e,a)&&(t.leaf?n.push(s):f(e,a)?this._all(s,n):u.push(s));t=u.pop()}return n},collides:function(e){var t=this.data,n=this.toBBox;if(!d(e,t.bbox))return!1;for(var r,i,o,s,a=[];t;){for(r=0,i=t.children.length;i>r;r++)if(o=t.children[r],s=t.leaf?n(o):o.bbox,d(e,s)){if(t.leaf||f(e,s))return!0;a.push(o)}t=a.pop()}return!1},load:function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0,n=e.length;n>t;t++)this.insert(e[t]);return this}var r=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var i=this.data;this.data=r,r=i}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(e){return e&&this._insert(e,this.data.height-1),this},clear:function(){return this.data={children:[],height:1,bbox:o(),leaf:!0},this},remove:function(e){if(!e)return this;for(var t,n,r,i,o=this.data,s=this.toBBox(e),a=[],u=[];o||a.length;){if(o||(o=a.pop(),n=a[a.length-1],t=u.pop(),i=!0),o.leaf&&(r=o.children.indexOf(e),-1!==r))return o.children.splice(r,1),a.push(o),this._condense(a),this;i||o.leaf||!f(o.bbox,s)?n?(t++,o=n.children[t],i=!1):o=null:(a.push(o),u.push(t),t=0,n=o,o=o.children[0])}return this},toBBox:function(e){return e},compareMinX:function(e,t){return e[0]-t[0]},compareMinY:function(e,t){return e[1]-t[1]},toJSON:function(){return this.data},fromJSON:function(e){return this.data=e,this},_all:function(e,t){for(var n=[];e;)e.leaf?t.push.apply(t,e.children):n.push.apply(n,e.children),e=n.pop();return t},_build:function(e,t,n,i){var o,s=n-t+1,a=this._maxEntries;if(a>=s)return o={children:e.slice(t,n+1),height:1,bbox:null,leaf:!0},r(o,this.toBBox),o;i||(i=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,i-1))),o={children:[],height:i,bbox:null,leaf:!1};var u,c,h,l,p=Math.ceil(s/a),f=p*Math.ceil(Math.sqrt(a));for(m(e,t,n,f,this.compareMinX),u=t;n>=u;u+=f)for(h=Math.min(u+f-1,n),m(e,u,h,p,this.compareMinY),c=u;h>=c;c+=p)l=Math.min(c+p-1,h),o.children.push(this._build(e,c,l,i-1));return r(o,this.toBBox),o},_chooseSubtree:function(e,t,n,r){for(var i,o,s,a,u,h,p,f;;){if(r.push(t),t.leaf||r.length-1===n)break;for(p=f=1/0,i=0,o=t.children.length;o>i;i++)s=t.children[i],u=c(s.bbox),h=l(e,s.bbox)-u,f>h?(f=h,p=p>u?u:p,a=s):h===f&&p>u&&(p=u,a=s);t=a}return t},_insert:function(e,t,n){var r=this.toBBox,i=n?e.bbox:r(e),o=[],a=this._chooseSubtree(i,this.data,t,o);for(a.children.push(e),s(a.bbox,i);t>=0&&o[t].children.length>this._maxEntries;)this._split(o,t),t--;this._adjustParentBBoxes(i,o,t)},_split:function(e,t){var n=e[t],i=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,i);var s=this._chooseSplitIndex(n,o,i),a={children:n.children.splice(s,n.children.length-s),height:n.height,bbox:null,leaf:!1};n.leaf&&(a.leaf=!0),r(n,this.toBBox),r(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)},_splitRoot:function(e,t){this.data={children:[e,t],height:e.height+1,bbox:null,leaf:!1},r(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,n){var r,o,s,a,u,h,l,f;for(h=l=1/0,r=t;n-t>=r;r++)o=i(e,0,r,this.toBBox),s=i(e,r,n,this.toBBox),a=p(o,s),u=c(o)+c(s),h>a?(h=a,f=r,l=l>u?u:l):a===h&&l>u&&(l=u,f=r);return f},_chooseSplitAxis:function(e,t,n){var r=e.leaf?this.compareMinX:a,i=e.leaf?this.compareMinY:u,o=this._allDistMargin(e,t,n,r),s=this._allDistMargin(e,t,n,i);s>o&&e.children.sort(r)},_allDistMargin:function(e,t,n,r){e.children.sort(r);var o,a,u=this.toBBox,c=i(e,0,t,u),l=i(e,n-t,n,u),p=h(c)+h(l);for(o=t;n-t>o;o++)a=e.children[o],s(c,e.leaf?u(a):a.bbox),p+=h(c);for(o=n-t-1;o>=t;o--)a=e.children[o],s(l,e.leaf?u(a):a.bbox),p+=h(l);return p},_adjustParentBBoxes:function(e,t,n){for(var r=n;r>=0;r--)s(t[r].bbox,e)},_condense:function(e){for(var t,n=e.length-1;n>=0;n--)0===e[n].children.length?n>0?(t=e[n-1].children,t.splice(t.indexOf(e[n]),1)):this.clear():r(e[n],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 [a"+e.join(", a")+"];")}},"function"==typeof e&&e.amd?e("rbush",function(){return t}):"undefined"!=typeof n?n.exports=t:"undefined"!=typeof self?self.rbush=t:window.rbush=t}()},{}],196:[function(t,n,r){!function(e,t){"use strict";var n;e(function(e){function r(e,t){var n,r,i,o;if(n=e,i={},t){for(r in t)o=new RegExp("\\{"+r+"\\}"),o.test(n)?n=n.replace(o,encodeURIComponent(t[r]),"g"):i[r]=t[r];for(r in i)n+=-1===n.indexOf("?")?"?":"&",n+=encodeURIComponent(r),null!==i[r]&&void 0!==i[r]&&(n+="=",n+=encodeURIComponent(i[r]))}return n}function i(e,t){return 0===e.indexOf(t)}function o(e,t){return this instanceof o?void(e instanceof o?(this._template=e.template,this._params=s({},this._params,t)):(this._template=(e||"").toString(),this._params=t||{})):new o(e,t)}var s,a,u,c,h;return s=e("./util/mixin"),u=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?(\/[^?#]*)?(\?[^#]*)?(#\S*)?/i,c=/^([a-z][a-z0-9\-\+\.]*:\/\/|\/)/i,h=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?\//i,o.prototype={append:function(e,t){return new o(this._template+e,s({},this._params,t))},fullyQualify:function(){if(!t)return this;if(this.isFullyQualified())return this;var e=this._template;return i(e,"//")?e=a.protocol+e:i(e,"/")?e=a.origin+e:this.isAbsolute()||(e=a.origin+a.pathname.substring(0,a.pathname.lastIndexOf("/")+1)),-1===e.indexOf("/",8)&&(e+="/"),new o(e,this._params)},isAbsolute:function(){return c.test(this.build())},isFullyQualified:function(){return h.test(this.build())},isCrossOrigin:function(){if(!a)return!0;var e=this.parts();return e.protocol!==a.protocol||e.hostname!==a.hostname||e.port!==a.port},parts:function(){var e,t;return e=this.fullyQualify().build().match(u),t={href:e[0],protocol:e[1],host:e[3]||"",hostname:e[4]||"",port:e[6],pathname:e[7]||"",search:e[8]||"",hash:e[9]||""},t.origin=t.protocol+"//"+t.host,t.port=t.port||("https:"===t.protocol?"443":"http:"===t.protocol?"80":""),t},build:function(e){return r(this._template,s({},this._params,e))},toString:function(){return this.build()}},a=t?new o(t.href).parts():n,o})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)},"undefined"!=typeof window?window.location:void 0)},{"./util/mixin":214}],197:[function(t,n,r){!function(e){"use strict";e(function(e){var t=e("./client/default"),n=e("./client/xhr");return t.setPlatformDefaultClient(n),t})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./client/default":199,"./client/xhr":200}],198:[function(t,n,r){!function(e){"use strict";e(function(){return function(e,t){return t&&(e.skip=function(){return t}),e.wrap=function(t,n){return t(e,n)},e.chain=function(){return"undefined"!=typeof console&&console.log("rest.js: client.chain() is deprecated, use client.wrap() instead"),e.wrap.apply(this,arguments)},e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],199:[function(t,n,r){!function(e){"use strict";var t;e(function(e){function n(){return i.apply(t,arguments)}var r,i,o;return r=e("../client"),n.setDefaultClient=function(e){i=e},n.getDefaultClient=function(){return i},n.resetDefaultClient=function(){i=o},n.setPlatformDefaultClient=function(e){if(o)throw new Error("Unable to redefine platformDefaultClient");i=o=e},r(n)})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../client":198}],200:[function(t,n,r){!function(e,t){"use strict";e(function(e){function n(e){var t={};return e?(e.trim().split(c).forEach(function(e){var n,r,i;n=e.indexOf(":"),r=s(e.substring(0,n).trim()),i=e.substring(n+1).trim(),t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i}),t):t}function r(e,t){return Object.keys(t||{}).forEach(function(n){if(t.hasOwnProperty(n)&&n in e)try{e[n]=t[n]}catch(r){}}),e}var i,o,s,a,u,c;return i=e("when"),o=e("../UrlBuilder"),s=e("../util/normalizeHeaderName"),a=e("../util/responsePromise"),u=e("../client"),c=/[\r|\n]+/,u(function(e){return a.promise(function(i,s){var a,u,c,h,l,p,f,d;if(e="string"==typeof e?{path:e}:e||{},f={request:e},e.canceled)return f.error="precanceled",void s(f);if(l=e.entity,e.method=e.method||(l?"POST":"GET"),u=e.method,c=f.url=new o(e.path||"",e.params).build(),d=e.engine||t.XMLHttpRequest,!d)return void s({request:e,url:c,error:"xhr-not-available"});try{a=f.raw=new d,r(a,e.mixin),a.open(u,c,!0),r(a,e.mixin),h=e.headers;for(p in h)"Content-Type"===p&&"multipart/form-data"===h[p]||a.setRequestHeader(p,h[p]);e.canceled=!1,e.cancel=function(){e.canceled=!0,a.abort(),s(f)},a.onreadystatechange=function(){e.canceled||a.readyState===(d.DONE||4)&&(f.status={code:a.status,text:a.statusText},f.headers=n(a.getAllResponseHeaders()),f.entity=a.responseText,f.status.code>0?i(f):setTimeout(function(){i(f)},0))};try{a.onerror=function(){f.error="loaderror",s(f)}}catch(m){}a.send(l)}catch(m){f.error="loaderror",s(f)}})})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)},"undefined"!=typeof window?window:void 0)},{"../UrlBuilder":196,"../client":198,"../util/normalizeHeaderName":215,"../util/responsePromise":216,when:267}],201:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e){return e}function n(e){return e}function r(e){return e}function i(e){return l.promise(function(t,n){e.forEach(function(e){l(e,t,n)})})}function o(e){return this instanceof o?void u(this,e):new o(e)}function s(e){var s,u,p,f;return e=e||{},s=e.init||t,u=e.request||n,p=e.success||e.response||r,f=e.error||function(){return l((e.response||r).apply(this,arguments),l.reject,l.reject)},function(t,n){function r(e){var s,a;return s={},a={arguments:Array.prototype.slice.call(arguments),client:r},e="string"==typeof e?{path:e}:e||{},e.originator=e.originator||r,c(u.call(s,e,n,a),function(e){var r,u,c;return c=t,e instanceof o&&(u=e.abort,c=e.client||c,r=e.response,e=e.request),r=r||l(e,function(e){return l(c(e),function(e){return p.call(s,e,n,a)},function(e){return f.call(s,e,n,a)})}),u?i([r,u]):r},function(t){return l.reject({request:e,error:t})})}return"object"==typeof t&&(n=t),"function"!=typeof t&&(t=e.client||a),n=s(n||{}),h(r,t)}}var a,u,c,h,l;return a=e("./client/default"),u=e("./util/mixin"),c=e("./util/responsePromise"),h=e("./client"),l=e("when"),s.ComplexRequest=o,s})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./client":198,"./client/default":199,"./util/mixin":214,"./util/responsePromise":216,when:267}],202:[function(t,n,r){!function(e){"use strict";e(function(e){var t,n,r,i,o;return t=e("../interceptor"),n=e("../mime"),r=e("../mime/registry"),o=e("when"),i={read:function(e){return e},write:function(e){return e}},t({init:function(e){return e.registry=e.registry||r,e},request:function(e,t){var r,s;return s=e.headers||(e.headers={}),r=n.parse(s["Content-Type"]=s["Content-Type"]||t.mime||"text/plain"),s.Accept=s.Accept||t.accept||r.raw+", application/json;q=0.8, text/plain;q=0.5, */*;q=0.2","entity"in e?t.registry.lookup(r).otherwise(function(){if(t.permissive)return i;throw"mime-unknown"}).then(function(n){var i=t.client||e.originator;return o.attempt(n.write,e.entity,{client:i,request:e,mime:r,registry:t.registry}).otherwise(function(){throw"mime-serialization"}).then(function(t){return e.entity=t,e})}):e},response:function(e,t){if(!(e.headers&&e.headers["Content-Type"]&&e.entity))return e;var r=n.parse(e.headers["Content-Type"]);return t.registry.lookup(r).otherwise(function(){return i}).then(function(n){var i=t.client||e.request&&e.request.originator;return o.attempt(n.read,e.entity,{client:i,response:e,mime:r,registry:t.registry}).otherwise(function(t){throw e.error="mime-deserialization",e.cause=t,e}).then(function(t){return e.entity=t,e})})}})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../interceptor":201,"../mime":205,"../mime/registry":206,when:267}],203:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t){return 0===e.indexOf(t)}function n(e,t){return e.lastIndexOf(t)+t.length===e.length}var r,i;return r=e("../interceptor"),i=e("../UrlBuilder"),r({request:function(e,r){var o;return r.prefix&&!new i(e.path).isFullyQualified()&&(o=r.prefix,e.path&&(n(o,"/")||t(e.path,"/")||(o+="/"),o+=e.path),e.path=o),e}})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../UrlBuilder":196,"../interceptor":201}],204:[function(t,n,r){!function(e){"use strict";e(function(e){var t,n,r;return t=e("../interceptor"),n=e("../util/uriTemplate"),r=e("../util/mixin"),t({init:function(e){return e.params=e.params||{},e.template=e.template||"",e},request:function(e,t){var i,o;return i=e.path||t.template,o=r({},e.params,t.params),e.path=n.expand(i,o),delete e.params,e}})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../interceptor":201,"../util/mixin":214,"../util/uriTemplate":218}],205:[function(t,n,r){!function(e){"use strict";var t;e(function(){function e(e){var n,r;return n=e.split(";"),r=n[0].trim().split("+"),{raw:e,type:r[0],suffix:r[1]?"+"+r[1]:"",params:n.slice(1).reduce(function(e,n){return n=n.split("="),e[n[0].trim()]=n[1]?n[1].trim():t,e},{})}}return{parse:e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],206:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e){this.lookup=function(t){var i;return i="string"==typeof t?n.parse(t):t,e[i.raw]?e[i.raw]:e[i.type+i.suffix]?e[i.type+i.suffix]:e[i.type]?e[i.type]:e[i.suffix]?e[i.suffix]:r.reject(new Error('Unable to locate converter for mime "'+i.raw+'"'))},this.delegate=function(e){return{read:function(){var t=arguments;return this.lookup(e).then(function(e){return e.read.apply(this,t)}.bind(this))}.bind(this),write:function(){var t=arguments;return this.lookup(e).then(function(e){return e.write.apply(this,t)}.bind(this))}.bind(this)}},this.register=function(t,n){return e[t]=r(n),e[t]},this.child=function(){return new t(Object.create(e))}}var n,r,i;return n=e("../mime"),r=e("when"),i=new t({}),i.register("application/hal",e("./type/application/hal")),i.register("application/json",e("./type/application/json")),i.register("application/x-www-form-urlencoded",e("./type/application/x-www-form-urlencoded")),i.register("multipart/form-data",e("./type/multipart/form-data")),i.register("text/plain",e("./type/text/plain")),i.register("+json",i.delegate("application/json")),i})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../mime":205,"./type/application/hal":207,"./type/application/json":208,"./type/application/x-www-form-urlencoded":209,"./type/multipart/form-data":210,"./type/text/plain":211,when:267}],207:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!1,writeable:!0})}var n,r,i,o,s,a;return n=e("../../../interceptor/pathPrefix"),r=e("../../../interceptor/template"),i=e("../../../util/find"),o=e("../../../util/lazyPromise"),s=e("../../../util/responsePromise"),a=e("when"),{read:function(e,u){function c(e,t){(t&&l&&l.warn||l.log)&&(l.warn||l.log).call(l,"Relationship '"+e+"' is deprecated, see "+t)}var h,l;return u=u||{},h=u.client,l=u.console||l,u.registry.lookup(u.mime.suffix).then(function(l){return a(l.read(e,u)).then(function(e){return i.findProperties(e,"_embedded",function(e,n,r){
|
||
Object.keys(e).forEach(function(r){if(!(r in n)){var i=s({entity:e[r]});t(n,r,i)}}),t(n,r,e)}),i.findProperties(e,"_links",function(e,i,a){Object.keys(e).forEach(function(n){var a=e[n];n in i||t(i,n,s.make(o(function(){return a.deprecation&&c(n,a.deprecation),a.templated===!0?r(h)({path:a.href}):h({path:a.href})})))}),t(i,a,e),t(i,"clientFor",function(t,i){var o=e[t];if(!o)throw new Error("Unknown relationship: "+t);return o.deprecation&&c(t,o.deprecation),o.templated===!0?r(i||h,{template:o.href}):n(i||h,{prefix:o.href})}),t(i,"requestFor",function(e,t,n){var r=this.clientFor(e,n);return r(t)})}),e})})},write:function(e,t){return t.registry.lookup(t.mime.suffix).then(function(n){return n.write(e,t)})}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../../../interceptor/pathPrefix":203,"../../../interceptor/template":204,"../../../util/find":212,"../../../util/lazyPromise":213,"../../../util/responsePromise":216,when:267}],208:[function(t,n,r){!function(e){"use strict";e(function(){function e(t,n){return{read:function(e){return JSON.parse(e,t)},write:function(e){return JSON.stringify(e,n)},extend:e}}return e()})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],209:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){return e=encodeURIComponent(e),e.replace(r,"+")}function t(e){return e=e.replace(i," "),decodeURIComponent(e)}function n(t,r,i){return Array.isArray(i)?i.forEach(function(e){t=n(t,r,e)}):(t.length>0&&(t+="&"),t+=e(r),void 0!==i&&null!==i&&(t+="="+e(i))),t}var r,i;return r=/%20/g,i=/\+/g,{read:function(e){var n={};return e.split("&").forEach(function(e){var r,i,o;r=e.split("="),i=t(r[0]),o=2===r.length?t(r[1]):null,i in n?(Array.isArray(n[i])||(n[i]=[n[i]]),n[i].push(o)):n[i]=o}),n},write:function(e){var t="";return Object.keys(e).forEach(function(r){t=n(t,r,e[r])}),t}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],210:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){return e&&1===e.nodeType&&"FORM"===e.tagName}function t(e){var t,n=new FormData;for(var r in e)e.hasOwnProperty(r)&&(t=e[r],t instanceof File?n.append(r,t,t.name):t instanceof Blob?n.append(r,t):n.append(r,String(t)));return n}return{write:function(n){if("undefined"==typeof FormData)throw new Error("The multipart/form-data mime serializer requires FormData support");if(n instanceof FormData)return n;if(e(n))return new FormData(n);if("object"==typeof n&&null!==n)return t(n);throw new Error("Unable to create FormData from object "+n)}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],211:[function(t,n,r){!function(e){"use strict";e(function(){return{read:function(e){return e},write:function(e){return e.toString()}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],212:[function(t,n,r){!function(e){"use strict";e(function(){return{findProperties:function e(t,n,r){"object"==typeof t&&null!==t&&(n in t&&r(t[n],t,n),Object.keys(t).forEach(function(i){e(t[i],n,r)}))}}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],213:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e){var t,r,i,o,s;return t=n.defer(),r=!1,i=t.resolver,o=t.promise,s=o.then,o.then=function(){return r||(r=!0,n.attempt(e).then(i.resolve,i.reject)),s.apply(o,arguments)},o}var n;return n=e("when"),t})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{when:267}],214:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){var n,r,i,o;for(e||(e={}),n=1,r=arguments.length;r>n;n+=1){i=arguments[n];for(o in i)o in e&&(e[o]===i[o]||o in t&&t[o]===i[o])||(e[o]=i[o])}return e}var t={};return e})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],215:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){return e.toLowerCase().split("-").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}).join("-")}return e})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],216:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t){return e.then(function(e){return e&&e[t]},function(e){return c.reject(e&&e[t])})}function n(){return t(this,"entity")}function r(){return t(t(this,"status"),"code")}function i(){return t(this,"headers")}function o(e){return e=h(e),t(this.headers(),e)}function s(e){return e=[].concat(e),a(c.reduce(e,function(e,t){if("string"==typeof t&&(t={rel:t}),"function"!=typeof e.entity.clientFor)throw new Error("Hypermedia response expected");var n=e.entity.clientFor(t.rel);return n({params:t.params})},this))}function a(e){return e.status=r,e.headers=i,e.header=o,e.entity=n,e.follow=s,e}function u(){return a(c.apply(c,arguments))}var c=e("when"),h=e("./normalizeHeaderName");return u.make=a,u.reject=function(e){return a(c.reject(e))},u.promise=function(e){return a(c.promise(e))},u})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./normalizeHeaderName":215,when:267}],217:[function(t,n,r){!function(e){"use strict";e(function(){function e(e,t){if("string"!=typeof e)throw new Error("String required for URL encoding");return e.split("").map(function(e){if(t.hasOwnProperty(e))return e;var n=e.charCodeAt(0);if(127>=n){var r=n.toString(16).toUpperCase();return"%"+(r.length%2===1?"0":"")+r}return encodeURIComponent(e).toUpperCase()}).join("")}function t(t){return t=t||r.unreserved,function(n){return e(n,t)}}function n(e){return decodeURIComponent(e)}var r;return r=function(){var e={alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",digit:"0123456789"};return e.genDelims=":/?#[]@",e.subDelims="!$&'()*+,;=",e.reserved=e.genDelims+e.subDelims,e.unreserved=e.alpha+e.digit+"-._~",e.url=e.reserved+e.unreserved,e.scheme=e.alpha+e.digit+"+-.",e.userinfo=e.unreserved+e.subDelims+":",e.host=e.unreserved+e.subDelims,e.port=e.digit,e.pchar=e.unreserved+e.subDelims+":@",e.segment=e.pchar,e.path=e.segment+"/",e.query=e.pchar+"/?",e.fragment=e.pchar+"/?",Object.keys(e).reduce(function(t,n){return t[n]=e[n].split("").reduce(function(e,t){return e[t]=!0,e},{}),t},{})}(),{decode:n,encode:t(),encodeURL:t(r.url),encodeScheme:t(r.scheme),encodeUserInfo:t(r.userinfo),encodeHost:t(r.host),encodePort:t(r.port),encodePathSegment:t(r.segment),encodePath:t(r.path),encodeQuery:t(r.query),encodeFragment:t(r.fragment)}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{}],218:[function(t,n,r){!function(e){"use strict";var t;e(function(e){function n(e,n,r){return n.split(",").reduce(function(n,i){var s,u;if(s={},"*"===i.slice(-1)&&(i=i.slice(0,-1),s.explode=!0),a.test(i)){var c=a.exec(i);i=c[1],s.maxLength=parseInt(c[2])}return i=o.decode(i),u=r[i],u===t||null===u?n:(Array.isArray(u)?n+=u.reduce(function(t,n){return t.length?(t+=s.explode?e.separator:",",e.named&&s.explode&&(t+=e.encoder(i),t+=n.length?"=":e.empty)):(t+=e.first,e.named&&(t+=e.encoder(i),t+=n.length?"=":e.empty)),t+=e.encoder(n)},""):"object"==typeof u?n+=Object.keys(u).reduce(function(t,n){return t.length?t+=s.explode?e.separator:",":(t+=e.first,e.named&&!s.explode&&(t+=e.encoder(i),t+=u[n].length?"=":e.empty)),t+=e.encoder(n),t+=s.explode?"=":",",t+=e.encoder(u[n])},""):(u=String(u),s.maxLength&&(u=u.slice(0,s.maxLength)),n+=n.length?e.separator:e.first,e.named&&(n+=e.encoder(i),n+=u.length?"=":e.empty),n+=e.encoder(u)),n)},"")}function r(e,t){var r;if(r=s[e.slice(0,1)],r?e=e.slice(1):r=s[""],r.reserved)throw new Error("Reserved expression operations are not supported");return n(r,e,t)}function i(e,t){var n,i,o;for(o="",i=0;;){if(n=e.indexOf("{",i),-1===n){o+=e.slice(i);break}o+=e.slice(i,n),i=e.indexOf("}",n)+1,o+=r(e.slice(n+1,i-1),t)}return o}var o,s,a;return o=e("./uriEncoder"),a=/^([^:]*):([0-9]+)$/,s={"":{first:"",separator:",",named:!1,empty:"",encoder:o.encode},"+":{first:"",separator:",",named:!1,empty:"",encoder:o.encodeURL},"#":{first:"#",separator:",",named:!1,empty:"",encoder:o.encodeURL},".":{first:".",separator:".",named:!1,empty:"",encoder:o.encode},"/":{first:"/",separator:"/",named:!1,empty:"",encoder:o.encode},";":{first:";",separator:";",named:!0,empty:"",encoder:o.encode},"?":{first:"?",separator:"&",named:!0,empty:"=",encoder:o.encode},"&":{first:"&",separator:"&",named:!0,empty:"=",encoder:o.encode},"=":{reserved:!0},",":{reserved:!0},"!":{reserved:!0},"@":{reserved:!0},"|":{reserved:!0}},{expand:i}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./uriEncoder":217}],219:[function(t,n,r){(function(t,i){(function(o){function s(e){return e&&e.Object===Object?e:null}function a(e){for(var t=[],n=0,r=e.length;r>n;n++)t.push(e[n]);return t}function u(e){return function(){try{return e.apply(this,arguments)}catch(t){return nt.e=t,nt}}}function c(e){throw e}function h(e,t){if(it&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(ut)){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var i=n.join("\n"+ut+"\n");e.stack=l(i)}}function l(e){for(var t=e.split("\n"),n=[],r=0,i=t.length;i>r;r++){var o=t[r];p(o)||f(o)||!o||n.push(o)}return n.join("\n")}function p(e){var t=m(e);if(!t)return!1;var n=t[0],r=t[1];return n===st&&r>=at&&Fs>=r}function f(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function d(){if(it)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=m(n);if(!r)return;return st=r[0],r[1]}}function m(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function v(e,t,n,r,i,s){var a=Yt(e),u=a.length,c=Yt(t),h=c.length;if(u!==h&&!r)return!1;for(var l,p=u;p--;)if(l=a[p],!(r?l in t:Wt.call(t,l)))return!1;for(var f=r;++p<u;){l=a[p];var d,m=e[l],v=t[l];if(!(d===o?n(m,v,r,i,s):d))return!1;f||(f="constructor"===l)}if(!f){var g=e.constructor,y=t.constructor;if(g!==y&&"constructor"in e&&"constructor"in t&&!("function"==typeof g&&g instanceof g&&"function"==typeof y&&y instanceof y))return!1}return!0}function g(e,t,n){switch(n){case St:case Mt:return+e===+t;case Et:return e.name===t.name&&e.message===t.message;case At:return e!==+e?t!==+t:e===+t;case Ot:case Rt:return e===t+""}return!1}function y(e){return!!e&&"object"==typeof e}function _(e){return"number"==typeof e&&e>-1&&e%1===0&&Xt>=e}function b(e){return y(e)&&_(e.length)&&!!Ht[qt.call(e)]}function x(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function w(e,t,n,r,i,s){var a=-1,u=e.length,c=t.length;if(u!==c&&!(r&&c>u))return!1;for(;++a<u;){var h,l=e[a],p=t[a];if(h!==o){if(h)continue;return!1}if(r){if(!x(t,function(e){return l===e||n(l,e,r,i,s)}))return!1}else if(l!==p&&!n(l,p,r,i,s))return!1}return!0}function S(e,t,n,r,i,o){var s=Zt(e),a=Zt(t),u=wt,c=wt;s||(u=qt.call(e),u===xt?u=Pt:u!==Pt&&(s=b(e))),a||(c=qt.call(t),c===xt&&(c=Pt));var h=u===Pt&&!Kt(e),l=c===Pt&&!Kt(t),p=u===c;if(p&&!s&&!h)return g(e,t,u);if(!r){var f=h&&Wt.call(e,"__wrapped__"),d=l&&Wt.call(t,"__wrapped__");if(f||d)return n(f?e.value():e,d?t.value():t,r,i,o)}if(!p)return!1;i||(i=[]),o||(o=[]);for(var m=i.length;m--;)if(i[m]===e)return o[m]===t;i.push(e),o.push(t);var y=(s?w:v)(e,t,n,r,i,o);return i.pop(),o.pop(),y}function M(e,t,n,r,i){return e===t?!0:null==e||null==t||!se(e)&&!y(t)?e!==e&&t!==t:S(e,t,M,n,r,i)}function E(e,t){for(var n=new Array(e),r=0;e>r;r++)n[r]=t();return n}function C(e,t){this.id=e,this.value=t}function T(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function A(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function P(e){this._s=e,this.isDisposed=!1}function O(e){this._s=e}function L(e){this._s=e,this._l=e.length,this._i=0}function R(e){this._a=e}function N(e){this._a=e,this._l=j(e),this._i=0}function D(e){return"number"==typeof e&&We.isFinite(e)}function I(e){var t,n=e[mt];if(!n&&"string"==typeof e)return t=new O(e),t[mt]();if(!n&&e.length!==o)return t=new R(e),t[mt]();if(!n)throw new TypeError("Object is not iterable");return e[mt]()}function k(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}function j(e){var t=+e.length;return isNaN(t)?0:0!==t&&D(t)?(t=k(t)*Math.floor(Math.abs(t)),0>=t?0:t>gr?gr:t):t}function F(e,t){return xn(e)||(e=An),new _r(t,e)}function B(e,t){this.observer=e,this.parent=t}function V(e,t){return e.amb(t)}function U(){return!1}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function U(){return!1}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function U(){return!1}function z(){return[]}function U(){return!1}function z(){return[]}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function H(e){return function(t){return e.subscribe(t)}}function $(e){return e.toArray()}function W(e){return e.length>0}function q(e){return{"@@iterator":function(){return{next:function(){return{done:!1,value:e}}}}}}function q(e){return{"@@iterator":function(){return{next:function(){return{done:!1,value:e}}}}}}function X(e,t,n){var r=_t(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return et(i)&&(i=cr(i)),(yt(i)||gt(i))&&(i=yr(i)),i}).concatAll()}function Y(e,t,n){for(var r=0,i=e.length;i>r;r++)if(n(e[r],t))return r;return-1}function K(e){this.comparer=e,this.set=[]}function Z(e,t){return function(n){for(var r=n,i=0;t>i;i++){var s=r[e[i]];if("undefined"==typeof s)return o;r=s}return r}}function J(e){if(0===e.length)throw new ct;return e[0]}function Q(e,t,n,r){var i=_t(t,n,3);return new Ps(function(t){return e.subscribe(new po(t,e,i,r))},e)}function ee(e){return e?Kn.isObservable(e)?e:et(e)?Kn.fromPromise(e):oe(e)||ie(e)?wo.call(this,e):tt(e)?re.call(this,e):yt(e)||gt(e)?te.call(this,e):se(e)?ne.call(this,e):e:e}function te(e){return Kn.from(e).concatMap(function(e){return Kn.isObservable(e)||se(e)?ee.call(null,e):qe.Observable.just(e)}).toArray()}function ne(e){function t(e,t){n[t]=o,i.push(e.map(function(e){n[t]=e}))}for(var n=new e.constructor,r=Object.keys(e),i=[],s=0,a=r.length;a>s;s++){var u=r[s],c=ee.call(this,e[u]);c&&Kn.isObservable(c)?t(c,u):n[u]=e[u]}return Kn.forkJoin.apply(Kn,i).map(function(){return n})}function re(e){var t=this;return new Ps(function(n){e.call(t,function(){var e=arguments[0],t=arguments[1];if(e)return n.onError(e);if(arguments.length>2){for(var r=[],i=1,o=arguments.length;o>i;i++)r.push(arguments[i]);t=r}n.onNext(t),n.onCompleted()})})}function ie(e){return tt(e.next)&&tt(e["throw"])}function oe(e){var t=e.constructor;return t?"GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName?!0:ie(t.prototype):!1}function se(e){return Object==e.constructor}function ae(e,t,n,r){var i=new Ds;return r.push(ue(i,t,n)),e.apply(t,r),i.asObservable()}function ue(e,t,n){return function(){for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];if(tt(n)){if(i=rt(n).apply(t,i),i===nt)return e.onError(i.e);e.onNext(i)}else i.length<=1?e.onNext(i[0]):e.onNext(i);e.onCompleted()}}function ce(e,t,n,r){var i=new Ds;return r.push(he(i,t,n)),e.apply(t,r),i.asObservable()}function he(e,t,n){return function(){var r=arguments[0];if(r)return e.onError(r);for(var i=arguments.length,o=[],s=1;i>s;s++)o[s-1]=arguments[s];if(tt(n)){var o=rt(n).apply(t,o);if(o===nt)return e.onError(o.e);e.onNext(o)}else o.length<=1?e.onNext(o[0]):e.onNext(o);e.onCompleted()}}function le(e){return We.StaticNodeList?e instanceof We.StaticNodeList||e instanceof We.NodeList:"[object NodeList]"===Object.prototype.toString.call(e)}function pe(e,t,n){this._e=e,this._n=t,this._fn=n,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function fe(e,t,n){var r=new on,i=Object.prototype.toString.call(e);if(le(e)||"[object HTMLCollection]"===i)for(var o=0,s=e.length;s>o;o++)r.add(fe(e.item(o),t,n));else e&&r.add(new pe(e,t,n));return r}function de(e,t,n){return new Ps(function(r){function i(e,t){if(c[t]=e,s[t]=!0,a||(a=s.every(Ye))){if(o)return r.onError(o);var i=rt(n).apply(null,c);if(i===nt)return r.onError(i.e);r.onNext(i)}u&&c[1]&&r.onCompleted()}var o,s=[!1,!1],a=!1,u=!1,c=new Array(2);return new mn(e.subscribe(function(e){i(e,0)},function(e){c[1]?r.onError(e):o=e},function(){u=!0,c[1]&&r.onCompleted()}),t.subscribe(function(e){i(e,1)},function(e){r.onError(e)},function(){u=!0,i(!0,1)}))},e)}function $(e){return e.toArray()}function me(e,t){return e.groupJoin(this,t,mr,function(e,t){return t})}function ve(e){var t=this;return new Ps(function(n){var r=new Ns,i=new on,o=new gn(i);return n.onNext(tn(r,o)),i.add(t.subscribe(function(e){r.onNext(e)},function(e){r.onError(e),n.onError(e)},function(){r.onCompleted(),n.onCompleted()})),et(e)&&(e=cr(e)),i.add(e.subscribe(function(e){r.onCompleted(),r=new Ns,n.onNext(tn(r,o))},function(e){r.onError(e),n.onError(e)},function(){r.onCompleted(),n.onCompleted()})),o},t)}function ge(e){var t=this;return new Ps(function(n){function r(){var t;try{t=e()}catch(o){return void n.onError(o)}et(t)&&(t=cr(t));var u=new fn;i.setDisposable(u),u.setDisposable(t.take(1).subscribe(Xe,function(e){a.onError(e),n.onError(e)},function(){a.onCompleted(),a=new Ns,n.onNext(tn(a,s)),r()}))}var i=new dn,o=new on(i),s=new gn(o),a=new Ns;return n.onNext(tn(a,s)),o.add(t.subscribe(function(e){a.onNext(e)},function(e){a.onError(e),n.onError(e)},function(){a.onCompleted(),n.onCompleted()})),r(),s},t)}function ye(e,t){return new Bo(e,t)}function G(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function _e(e){this.patterns=e}function be(e,t){this.expression=e,this.selector=t}function xe(e){return function(t){e.onError(t)}}function we(e,t){return function(){var n=rt(e.selector).apply(e,arguments);return n===nt?t.onError(n.e):void t.onNext(n)}}function Se(e,t,n){var r=e.get(t);if(!r){var i=new qo(t,n);return e.set(t,i),i}return r}function Me(e,t,n){this.joinObserverArray=e,this.onNext=t,this.onCompleted=n,this.joinObservers=new Wo;for(var r=0,i=this.joinObserverArray.length;i>r;r++){var o=this.joinObserverArray[r];this.joinObservers.set(o,o)}}function Ee(e,t){return new Xo(e,t)}function Ce(e,t,n){return new Ps(function(r){var i=e,o=bn(t);return n.scheduleRecursiveFuture(0,i,function(e,t){if(o>0){var s=n.now();i=new Date(i.getTime()+o),i.getTime()<=s&&(i=new Date(s+o))}r.onNext(e),t(e+1,new Date(i))})})}function Te(e,t,n){return e===t?new Ps(function(e){return n.schedulePeriodic(0,t,function(t){return e.onNext(t),t+1})}):pr(function(){return Ce(new Date(n.now()+e),t,n)})}function Ae(e,t,n){return new Ps(function(r){var i,o=!1,s=new dn,a=null,u=[],c=!1;return i=e.materialize().timestamp(n).subscribe(function(e){var i,h;"E"===e.value.kind?(u=[],u.push(e),a=e.value.error,h=!c):(u.push({value:e.value,timestamp:e.timestamp+t}),h=!o,o=!0),h&&(null!==a?r.onError(a):(i=new fn,s.setDisposable(i),i.setDisposable(n.scheduleRecursiveFuture(null,t,function(e,t){var i,s,h,l;if(null===a){c=!0;do h=null,u.length>0&&u[0].timestamp-n.now()<=0&&(h=u.shift().value),null!==h&&h.accept(r);while(null!==h);l=!1,s=0,u.length>0?(l=!0,s=Math.max(0,u[0].timestamp-n.now())):o=!1,i=a,c=!1,null!==i?r.onError(i):l&&t(null,s)}}))))}),new mn(i,s)},e)}function Pe(e,t,n){return pr(function(){return Ae(e,t-n.now(),n)})}function Oe(e,t,n){var r,i;return tt(t)?i=t:(r=t,i=n),new Ps(function(t){function n(){u.setDisposable(e.subscribe(function(e){var n=rt(i)(e);if(n===nt)return t.onError(n.e);var r=new fn;s.add(r),r.setDisposable(n.subscribe(function(){t.onNext(e),s.remove(r),o()},function(e){t.onError(e)},function(){t.onNext(e),s.remove(r),o()}))},function(e){t.onError(e)},function(){a=!0,u.dispose(),o()}))}function o(){a&&0===s.length&&t.onCompleted()}var s=new on,a=!1,u=new dn;return r?u.setDisposable(r.subscribe(n,function(e){t.onError(e)},n)):n(),new mn(u,s)},e)}function Le(e,t){return new Ps(function(n){var r,i=!1,o=new dn,s=0,a=e.subscribe(function(e){var a=rt(t)(e);if(a===nt)return n.onError(a.e);et(a)&&(a=cr(a)),i=!0,r=e,s++;var u=s,c=new fn;o.setDisposable(c),c.setDisposable(a.subscribe(function(){i&&s===u&&n.onNext(r),i=!1,c.dispose()},function(e){n.onError(e)},function(){i&&s===u&&n.onNext(r),i=!1,c.dispose()}))},function(e){o.dispose(),n.onError(e),i=!1,s++},function(){o.dispose(),i&&n.onNext(r),n.onCompleted(),i=!1,s++});return new mn(a,o)},e)}function $(e){return e.toArray()}function $(e){return e.toArray()}function Re(e,t,n,r){return tt(t)&&(r=n,n=t,t=Mr()),Kn.isObservable(r)||(r=Or(new os)),new Ps(function(i){function o(e){function t(){return l=n===h}var n=h,o=new fn;u.setDisposable(o),o.setDisposable(e.subscribe(function(){t()&&a.setDisposable(r.subscribe(i)),o.dispose()},function(e){t()&&i.onError(e)},function(){t()&&a.setDisposable(r.subscribe(i))}))}function s(){var e=!l;return e&&h++,e}var a=new dn,u=new dn,c=new fn;a.setDisposable(c);var h=0,l=!1;return o(t),c.setDisposable(e.subscribe(function(e){if(s()){i.onNext(e);var t=rt(n)(e);if(t===nt)return i.onError(t.e);o(et(t)?cr(t):t)}},function(e){s()&&i.onError(e)},function(){s()&&i.onCompleted()})),new mn(a,u)},e)}function Ne(e,t,n,r){return xn(n)&&(r=n,n=Or(new os)),n instanceof Error&&(n=Or(n)),xn(r)||(r=Nn),Kn.isObservable(n)||(n=Or(new os)),new Ps(function(i){function o(){var e=s;h.setDisposable(r.scheduleFuture(null,t,function(){c=s===e,c&&(et(n)&&(n=cr(n)),u.setDisposable(n.subscribe(i)))}))}var s=0,a=new fn,u=new dn,c=!1,h=new dn;return u.setDisposable(a),o(),a.setDisposable(e.subscribe(function(e){c||(s++,i.onNext(e),o())},function(e){c||(s++,i.onError(e))},function(){c||(s++,i.onCompleted())})),new mn(u,h)},e)}function De(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}function Ie(e){this.predicate=e}function ke(e){this.predicate=e}function je(e,t){var n=this;this.scheduler=e,this.messages=t,this.subscriptions=[],this.observers=[];for(var r=0,i=this.messages.length;i>r;r++){var o=this.messages[r],s=o.value;!function(t){e.scheduleAbsolute(null,o.time,function(){for(var e=n.observers.slice(0),r=0,i=e.length;i>r;r++)t.accept(e[r]);return cn})}(s)}}var Fe={"function":!0,object:!0},Be=Fe[typeof r]&&r&&!r.nodeType?r:null,Ve=Fe[typeof n]&&n&&!n.nodeType?n:null,Ue=s(Be&&Ve&&"object"==typeof i&&i),Ge=s(Fe[typeof self]&&self),ze=s(Fe[typeof window]&&window),He=Ve&&Ve.exports===Be?Be:null,$e=s(Fe[typeof this]&&this),We=Ue||ze!==($e&&$e.window)&&ze||Ge||$e||Function("return this")(),qe={internals:{},config:{Promise:We.Promise},helpers:{}},Xe=qe.helpers.noop=function(){},Ye=qe.helpers.identity=function(e){return e},Ke=qe.helpers.defaultNow=Date.now,Ze=qe.helpers.defaultComparer=function(e,t){return Jt(e,t)},Je=qe.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},Qe=(qe.helpers.defaultKeySerializer=function(e){return e.toString()},qe.helpers.defaultError=function(e){throw e}),et=qe.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},tt=qe.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==toString.call(e)}),e}(),nt={e:{}},rt=qe.internals.tryCatch=function(e){if(!tt(e))throw new TypeError("fn must be a function");return u(e)};qe.config.longStackSupport=!1;var it=!1,ot=rt(function(){throw new Error})();it=!!ot.e&&!!ot.e.stack;var st,at=d(),ut="From previous event:",ct=qe.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};ct.prototype=Object.create(Error.prototype),ct.prototype.name="EmptyError";var ht=qe.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};ht.prototype=Object.create(Error.prototype),ht.prototype.name="ObjectDisposedError";var lt=qe.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};lt.prototype=Object.create(Error.prototype),lt.prototype.name="ArgumentOutOfRangeError";var pt=qe.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};pt.prototype=Object.create(Error.prototype),pt.prototype.name="NotSupportedError";var ft=qe.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};ft.prototype=Object.create(Error.prototype),ft.prototype.name="NotImplementedError";var dt=qe.helpers.notImplemented=function(){throw new ft},mt=(qe.helpers.notSupported=function(){throw new pt},"function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_");We.Set&&"function"==typeof(new We.Set)["@@iterator"]&&(mt="@@iterator");var vt=qe.doneEnumerator={done:!0,value:o},gt=qe.helpers.isIterable=function(e){return e&&e[mt]!==o},yt=qe.helpers.isArrayLike=function(e){return e&&e.length!==o};qe.helpers.iterator=mt;var _t=qe.internals.bindCallback=function(e,t,n){if("undefined"==typeof t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},bt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],xt=(bt.length,"[object Arguments]"),wt="[object Array]",St="[object Boolean]",Mt="[object Date]",Et="[object Error]",Ct="[object Function]",Tt="[object Map]",At="[object Number]",Pt="[object Object]",Ot="[object RegExp]",Lt="[object Set]",Rt="[object String]",Nt="[object WeakMap]",Dt="[object ArrayBuffer]",It="[object Float32Array]",kt="[object Float64Array]",jt="[object Int8Array]",Ft="[object Int16Array]",Bt="[object Int32Array]",Vt="[object Uint8Array]",Ut="[object Uint8ClampedArray]",Gt="[object Uint16Array]",zt="[object Uint32Array]",Ht={};Ht[It]=Ht[kt]=Ht[jt]=Ht[Ft]=Ht[Bt]=Ht[Vt]=Ht[Ut]=Ht[Gt]=Ht[zt]=!0,Ht[xt]=Ht[wt]=Ht[Dt]=Ht[St]=Ht[Mt]=Ht[Et]=Ht[Ct]=Ht[Tt]=Ht[At]=Ht[Pt]=Ht[Ot]=Ht[Lt]=Ht[Rt]=Ht[Nt]=!1;var $t=Object.prototype,Wt=$t.hasOwnProperty,qt=$t.toString,Xt=Math.pow(2,53)-1,Yt=Object.keys||function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=n.length;return function(i){if("object"!=typeof i&&("function"!=typeof i||null===i))throw new TypeError("Object.keys called on non-object");var o,s,a=[];for(o in i)e.call(i,o)&&a.push(o);if(t)for(s=0;r>s;s++)e.call(i,n[s])&&a.push(n[s]);return a}}(),se=qe.internals.isObject=function(e){var t=typeof e;return!!e&&("object"===t||"function"===t)},Kt=function(){try{Object({toString:0}+"")}catch(e){return function(){return!1}}return function(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}}(),Zt=Array.isArray||function(e){return y(e)&&_(e.length)&&qt.call(e)===wt},Jt=qe.internals.isEqual=function(e,t){return M(e,t)},Qt=({}.hasOwnProperty,Array.prototype.slice,qe.internals.inherits=function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}),en=qe.internals.addProperties=function(e){for(var t=[],n=1,r=arguments.length;r>n;n++)t.push(arguments[n]);for(var i=0,o=t.length;o>i;i++){var s=t[i];for(var a in s)e[a]=s[a]}},tn=qe.internals.addRef=function(e,t){return new Ps(function(n){return new mn(t.getDisposable(),e.subscribe(n))})};C.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var nn=qe.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},rn=nn.prototype;rn.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},rn.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}}},rn.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,n=2*e+2,r=e;if(t<this.length&&this.isHigherPriority(t,r)&&(r=t),n<this.length&&this.isHigherPriority(n,r)&&(r=n),r!==e){var i=this.items[e];this.items[e]=this.items[r],this.items[r]=i,this.heapify(r)}}},rn.peek=function(){return this.items[0].value},rn.removeAt=function(e){this.items[e]=this.items[--this.length],this.items[this.length]=o,this.heapify()},rn.dequeue=function(){var e=this.peek();return this.removeAt(0),e},rn.enqueue=function(e){var t=this.length++;this.items[t]=new C(nn.count++,e),this.percolate(t)},rn.remove=function(e){for(var t=0;t<this.length;t++)if(this.items[t].value===e)return this.removeAt(t),!0;return!1},nn.count=0;var on=qe.CompositeDisposable=function(){var e,t,n=[];if(Array.isArray(arguments[0]))n=arguments[0];else for(t=arguments.length,n=new Array(t),e=0;t>e;e++)n[e]=arguments[e];this.disposables=n,this.isDisposed=!1,this.length=n.length},sn=on.prototype;sn.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},sn.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},sn.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;e>n;n++)t[n]=this.disposables[n];for(this.disposables=[],this.length=0,n=0;e>n;n++)t[n].dispose()}};var an=qe.Disposable=function(e){this.isDisposed=!1,this.action=e||Xe};an.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var un=an.create=function(e){return new an(e)},cn=an.empty={dispose:Xe},hn=an.isDisposable=function(e){return e&&tt(e.dispose)},ln=an.checkDisposed=function(e){if(e.isDisposed)throw new ht},pn=an._fixup=function(e){return hn(e)?e:cn},fn=qe.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};fn.prototype.getDisposable=function(){return this.current},fn.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()},fn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null,e&&e.dispose()}};var dn=qe.SerialDisposable=function(){this.isDisposed=!1,this.current=null};dn.prototype.getDisposable=function(){return this.current},dn.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e}n&&n.dispose(),t&&e&&e.dispose()},dn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var mn=qe.BinaryDisposable=function(e,t){this._first=e,this._second=t,this.isDisposed=!1};mn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this._first;this._first=null,e&&e.dispose();var t=this._second;this._second=null,t&&t.dispose()}};var vn=qe.NAryDisposable=function(e){this._disposables=e,this.isDisposed=!1};vn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=0,t=this._disposables.length;t>e;e++)this._disposables[e].dispose();this._disposables.length=0}};var gn=qe.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?cn:new e(this)},t}();T.prototype.dispose=function(){this.scheduler.schedule(this,A)};var yn=qe.internals.ScheduledItem=function(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||Je,this.disposable=new fn};yn.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},yn.prototype.compareTo=function(e){
|
||
return this.comparer(this.dueTime,e.dueTime)},yn.prototype.isCancelled=function(){return this.disposable.isDisposed},yn.prototype.invokeCore=function(){return pn(this.action(this.scheduler,this.state))};var _n=qe.Scheduler=function(){function e(){}e.isScheduler=function(t){return t instanceof e};var t=e.prototype;return t.schedule=function(e,t){throw new ft},t.scheduleFuture=function(t,n,r){var i=n;return i instanceof Date&&(i-=this.now()),i=e.normalize(i),0===i?this.schedule(t,r):this._scheduleFuture(t,i,r)},t._scheduleFuture=function(e,t,n){throw new ft},e.now=Ke,e.prototype.now=Ke,e.normalize=function(e){return 0>e&&(e=0),e},e}(),bn=_n.normalize,xn=_n.isScheduler;!function(e){function t(e,t){function n(t){function r(e,t){return s?o.remove(u):a=!0,i(t,n),cn}var s=!1,a=!1,u=e.schedule(t,r);a||(o.add(u),s=!0)}var r=t[0],i=t[1],o=new on;return i(r,n),o}function n(e,t){function n(t,r){function s(e,t){return a?o.remove(c):u=!0,i(t,n),cn}var a=!1,u=!1,c=e.scheduleFuture(t,r,s);u||(o.add(c),a=!0)}var r=t[0],i=t[1],o=new on;return i(r,n),o}e.scheduleRecursive=function(e,n){return this.schedule([e,n],t)},e.scheduleRecursiveFuture=function(e,t,r){return this.scheduleFuture([e,r],t,n)}}(_n.prototype),function(e){e.schedulePeriodic=function(e,t,n){if("undefined"==typeof We.setInterval)throw new pt;t=bn(t);var r=e,i=We.setInterval(function(){r=n(r)},t);return un(function(){We.clearInterval(i)})}}(_n.prototype),function(e){e.catchError=e["catch"]=function(e){return new Dn(this,e)}}(_n.prototype);var wn,Sn,Mn=qe.internals.SchedulePeriodicRecursive=function(){function e(e){return function(t,n){n(0,e._period);var r=rt(e._action)(e._state);r===nt&&(e._cancel.dispose(),c(r.e)),e._state=r}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new fn;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,e(this))),t},t}(),En=function(e){function t(){e.call(this)}return Qt(t,e),t.prototype.schedule=function(e,t){return pn(t(this,e))},t}(_n),Cn=_n.immediate=new En,Tn=function(e){function t(){for(;r.length>0;){var e=r.dequeue();!e.isCancelled()&&e.invoke()}}function n(){e.call(this)}var r;return Qt(n,e),n.prototype.schedule=function(e,n){var i=new yn(this,e,n,this.now());if(r)r.enqueue(i);else{r=new nn(4),r.enqueue(i);var o=rt(t)();r=null,o===nt&&c(o.e)}return i.disposable},n.prototype.scheduleRequired=function(){return!r},n}(_n),An=_n.currentThread=new Tn,Pn=function(){var e,t=Xe;if(We.setTimeout)e=We.setTimeout,t=We.clearTimeout;else{if(!We.WScript)throw new pt;e=function(e,t){We.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}(),On=Pn.setTimeout,Ln=Pn.clearTimeout;!function(){function e(t){if(o)On(function(){e(t)},0);else{var n=i[t];if(n){o=!0;var r=rt(n)();Sn(t),o=!1,r===nt&&c(r.e)}}}function n(){if(!We.postMessage||We.importScripts)return!1;var e=!1,t=We.onmessage;return We.onmessage=function(){e=!0},We.postMessage("","*"),We.onmessage=t,e}var r=1,i={},o=!1;Sn=function(e){delete i[e]};var s=new RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),a="function"==typeof(a=Ue&&He&&Ue.setImmediate)&&!s.test(a)&&a;if(tt(a))wn=function(t){var n=r++;return i[n]=t,a(function(){e(n)}),n};else if("undefined"!=typeof t&&"[object process]"==={}.toString.call(t))wn=function(n){var o=r++;return i[o]=n,t.nextTick(function(){e(o)}),o};else if(n()){var u="ms.rx.schedule"+Math.random(),h=function(t){"string"==typeof t.data&&t.data.substring(0,u.length)===u&&e(t.data.substring(u.length))};We.addEventListener("message",h,!1),wn=function(e){var t=r++;return i[t]=e,We.postMessage(u+t,"*"),t}}else if(We.MessageChannel){var l=new We.MessageChannel;l.port1.onmessage=function(t){e(t.data)},wn=function(e){var t=r++;return i[t]=e,l.port2.postMessage(t),t}}else wn="document"in We&&"onreadystatechange"in We.document.createElement("script")?function(t){var n=We.document.createElement("script"),o=r++;return i[o]=t,n.onreadystatechange=function(){e(o),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},We.document.documentElement.appendChild(n),o}:function(t){var n=r++;return i[n]=t,On(function(){e(n)},0),n}}();var Rn=function(e){function t(){e.call(this)}function n(e,t,n,r){return function(){e.setDisposable(an._fixup(t(n,r)))}}function r(e){this._id=e,this.isDisposed=!1}function i(e){this._id=e,this.isDisposed=!1}function o(e,t,n){return function(){t(e,n)}}return Qt(t,e),r.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Sn(this._id))},i.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Ln(this._id))},t.prototype.schedule=function(e,t){var i=new fn,o=wn(n(i,t,this,e));return new mn(i,new r(o))},t.prototype._scheduleFuture=function(e,t,r){if(0===t)return this.schedule(e,r);var o=new fn,s=On(n(o,r,this,e),t);return new mn(o,new i(s))},t.prototype.scheduleLongRunning=function(e,t){var n=un(Xe);return wn(o(e,t,n)),n},t}(_n),Nn=_n["default"]=_n.async=new Rn,Dn=function(e){function t(t,n){this._scheduler=t,this._handler=n,this._recursiveOriginal=null,this._recursiveWrapper=null,e.call(this)}return Qt(t,e),t.prototype.schedule=function(e,t){return this._scheduler.schedule(e,this._wrap(t))},t.prototype._scheduleFuture=function(e,t,n){return this._scheduler.schedule(e,t,this._wrap(n))},t.prototype.now=function(){return this._scheduler.now()},t.prototype._clone=function(e){return new t(e,this._handler)},t.prototype._wrap=function(e){var t=this;return function(n,r){var i=rt(e)(t._getRecursiveWrapper(n),r);return i===nt?(t._handler(i.e)||c(i.e),cn):pn(i)}},t.prototype._getRecursiveWrapper=function(e){if(this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},t.prototype.schedulePeriodic=function(e,t,n){var r=this,i=!1,o=new fn;return o.setDisposable(this._scheduler.schedulePeriodic(e,t,function(e){if(i)return null;var t=rt(n)(e);return t===nt?(i=!0,r._handler(t.e)||c(t.e),o.dispose(),null):t})),o},t}(_n),In=qe.Notification=function(){function e(){}return e.prototype._accept=function(e,t,n){throw new ft},e.prototype._acceptObserver=function(e,t,n){throw new ft},e.prototype.accept=function(e,t,n){return e&&"object"==typeof e?this._acceptObserver(e):this._accept(e,t,n)},e.prototype.toObservable=function(e){var t=this;return xn(e)||(e=Cn),new Ps(function(n){return e.schedule(t,function(e,t){t._acceptObserver(n),"N"===t.kind&&n.onCompleted()})})},e}(),kn=function(e){function t(e){this.value=e,this.kind="N"}return Qt(t,e),t.prototype._accept=function(e){return e(this.value)},t.prototype._acceptObserver=function(e){return e.onNext(this.value)},t.prototype.toString=function(){return"OnNext("+this.value+")"},t}(In),jn=function(e){function t(e){this.error=e,this.kind="E"}return Qt(t,e),t.prototype._accept=function(e,t){return t(this.error)},t.prototype._acceptObserver=function(e){return e.onError(this.error)},t.prototype.toString=function(){return"OnError("+this.error+")"},t}(In),Fn=function(e){function t(){this.kind="C"}return Qt(t,e),t.prototype._accept=function(e,t,n){return n()},t.prototype._acceptObserver=function(e){return e.onCompleted()},t.prototype.toString=function(){return"OnCompleted()"},t}(In),Bn=In.createOnNext=function(e){return new kn(e)},Vn=In.createOnError=function(e){return new jn(e)},Un=In.createOnCompleted=function(){return new Fn},Gn=qe.Observer=function(){};Gn.prototype.toNotifier=function(){var e=this;return function(t){return t.accept(e)}},Gn.prototype.asObserver=function(){var e=this;return new Wn(function(t){e.onNext(t)},function(t){e.onError(t)},function(){e.onCompleted()})},Gn.prototype.checked=function(){return new qn(this)};var zn=Gn.create=function(e,t,n){return e||(e=Xe),t||(t=Qe),n||(n=Xe),new Wn(e,t,n)};Gn.fromNotifier=function(e,t){var n=_t(e,t,1);return new Wn(function(e){return n(Bn(e))},function(e){return n(Vn(e))},function(){return n(Un())})},Gn.prototype.notifyOn=function(e){return new Yn(e,this)},Gn.prototype.makeSafe=function(e){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,e)};var Hn,$n=qe.internals.AbstractObserver=function(e){function t(){this.isStopped=!1}return Qt(t,e),t.prototype.next=dt,t.prototype.error=dt,t.prototype.completed=dt,t.prototype.onNext=function(e){!this.isStopped&&this.next(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.error(e),!0)},t}(Gn),Wn=qe.AnonymousObserver=function(e){function t(t,n,r){e.call(this),this._onNext=t,this._onError=n,this._onCompleted=r}return Qt(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}($n),qn=function(e){function t(t){e.call(this),this._observer=t,this._state=0}Qt(t,e);var n=t.prototype;return n.onNext=function(e){this.checkAccess();var t=rt(this._observer.onNext).call(this._observer,e);this._state=0,t===nt&&c(t.e)},n.onError=function(e){this.checkAccess();var t=rt(this._observer.onError).call(this._observer,e);this._state=2,t===nt&&c(t.e)},n.onCompleted=function(){this.checkAccess();var e=rt(this._observer.onCompleted).call(this._observer);this._state=2,e===nt&&c(e.e)},n.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}(Gn),Xn=qe.internals.ScheduledObserver=function(e){function t(t,n){e.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new dn}function n(e,t){return function(){e.onNext(t)}}function r(e,t){return function(){e.onError(t)}}function i(e){return function(){e.onCompleted()}}function o(e,t){var n;if(!(e.queue.length>0))return void(e.isAcquired=!1);n=e.queue.shift();var r=rt(n)();return r===nt?(e.queue=[],e.hasFaulted=!0,c(r.e)):void t(e)}return Qt(t,e),t.prototype.next=function(e){this.queue.push(n(this.observer,e))},t.prototype.error=function(e){this.queue.push(r(this.observer,e))},t.prototype.completed=function(){this.queue.push(i(this.observer))},t.prototype.ensureActive=function(){var e=!1;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(this,o))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}($n),Yn=function(e){function t(t,n,r){e.call(this,t,n),this._cancel=r}return Qt(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}(Xn),Kn=qe.Observable=function(){function e(e,t){return function(n){var r=n.onError;return n.onError=function(t){h(t,e),r.call(n,t)},t.call(e,n)}}function t(){if(qe.config.longStackSupport&&it){var t=this._subscribe,n=rt(c)(new Error).e;this.stack=n.stack.substring(n.stack.indexOf("\n")+1),this._subscribe=e(this,t)}}return Hn=t.prototype,t.isObservable=function(e){return e&&tt(e.subscribe)},Hn.subscribe=Hn.forEach=function(e,t,n){return this._subscribe("object"==typeof e?e:zn(e,t,n))},Hn.subscribeOnNext=function(e,t){return this._subscribe(zn("undefined"!=typeof t?function(n){e.call(t,n)}:e))},Hn.subscribeOnError=function(e,t){return this._subscribe(zn(null,"undefined"!=typeof t?function(n){e.call(t,n)}:e))},Hn.subscribeOnCompleted=function(e,t){return this._subscribe(zn(null,null,"undefined"!=typeof t?function(){e.call(t)}:e))},t}(),Zn=qe.ObservableBase=function(e){function t(e){return e&&tt(e.dispose)?e:tt(e)?un(e):cn}function n(e,n){var r=n[0],i=n[1],o=rt(i.subscribeCore).call(i,r);o!==nt||r.fail(nt.e)||c(nt.e),r.setDisposable(t(o))}function r(){e.call(this)}return Qt(r,e),r.prototype._subscribe=function(e){var t=new Os(e),r=[t,this];return An.scheduleRequired()?An.schedule(r,n):n(null,r),t},r.prototype.subscribeCore=dt,r}(Kn),Jn=qe.FlatMapObservable=function(e){function t(t,n,r,i){this.resultSelector=tt(r)?r:null,this.selector=_t(tt(n)?n:function(){return n},i,3),this.source=t,e.call(this)}function n(e,t,n,r){this.i=0,this.selector=t,this.resultSelector=n,this.source=r,this.o=e,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.selector,this.resultSelector,this))},Qt(n,$n),n.prototype._wrapResult=function(e,t,n){return this.resultSelector?e.map(function(e,r){return this.resultSelector(t,e,n,r)},this):e},n.prototype.next=function(e){var t=this.i++,n=rt(this.selector)(e,t,this.source);return n===nt?this.o.onError(n.e):(et(n)&&(n=cr(n)),(yt(n)||gt(n))&&(n=Kn.from(n)),void this.o.onNext(this._wrapResult(n,e,t)))},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.o.onCompleted()},t}(Zn),Qn=qe.internals.Enumerable=function(){};P.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.isDisposed=!0)};var er=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(!e.isDisposed){var n=rt(e.e.next).call(e.e);if(n===nt)return e.o.onError(n.e);if(n.done)return e.o.onCompleted();var i=n.value;et(i)&&(i=cr(i));var o=new fn;e.subscription.setDisposable(o),o.setDisposable(i.subscribe(new r(e,t)))}}function r(e,t){this._state=e,this._recurse=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r={isDisposed:!1,o:e,subscription:t,e:this.sources[mt]()},i=An.scheduleRecursive(r,n);return new vn([t,i,new P(r)])},Qt(r,$n),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.o.onError(e)},r.prototype.completed=function(){this._recurse(this._state)},t}(Zn);Qn.prototype.concat=function(){return new er(this)};var tr=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(!e.isDisposed){var n=rt(e.e.next).call(e.e);if(n===nt)return e.o.onError(n.e);if(n.done)return null!==e.lastError?e.o.onError(e.lastError):e.o.onCompleted();var i=n.value;et(i)&&(i=cr(i));var o=new fn;e.subscription.setDisposable(o),o.setDisposable(i.subscribe(new r(e,t)))}}function r(e,t){this._state=e,this._recurse=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r={isDisposed:!1,e:this.sources[mt](),subscription:t,lastError:null,o:e},i=An.scheduleRecursive(r,n);return new vn([t,i,new P(r)])},Qt(r,$n),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.lastError=e,this._recurse(this._state)},r.prototype.completed=function(){this._state.o.onCompleted()},t}(Zn);Qn.prototype.catchError=function(){return new tr(this)};var nr=function(e){function t(e,t){this.v=e,this.c=null==t?-1:t}function n(e){this.v=e.v,this.l=e.c}return Qt(t,e),t.prototype[mt]=function(){return new n(this)},n.prototype.next=function(){return 0===this.l?vt:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(Qn),rr=Qn.repeat=function(e,t){return new nr(e,t)},ir=function(e){function t(e,t,n){this.s=e,this.fn=t?_t(t,n,3):null}function n(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return Qt(t,e),t.prototype[mt]=function(){return new n(this)},n.prototype.next=function(){return++this.i<this.l?{done:!1,value:this.fn?this.fn(this.s[this.i],this.i,this.s):this.s[this.i]}:vt},t}(Qn),or=Qn.of=function(e,t,n){return new ir(e,t,n)},sr=function(e){function t(t,n){this.source=t,this._s=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Yn(this._s,e))},t}(Zn);Hn.observeOn=function(e){return new sr(this,e)};var ar=function(e){function t(t,n){this.source=t,this._s=n,e.call(this)}function n(e,t){var n=t[0],r=t[1],i=t[2];r.setDisposable(new T(e,n.subscribe(i)))}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn,r=new dn;return r.setDisposable(t),t.setDisposable(this._s.schedule([this.source,r,e],n)),r},t}(Zn);Hn.subscribeOn=function(e){return new ar(this,e)};var ur=function(e){function t(t,n){this._p=t,this._s=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];n.onNext(r),n.onCompleted()}function r(e,t){var n=t[0],r=t[1];n.onError(r)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn,i=this,o=this._p;return tt(o)&&(o=rt(o)(),o===nt)?(e.onError(o.e),t):(o.then(function(r){t.setDisposable(i._s.schedule([e,r],n))},function(n){t.setDisposable(i._s.schedule([e,n],r))}),t)},t}(Zn),cr=Kn.fromPromise=function(e,t){return t||(t=Nn),new ur(e,t)};Hn.toPromise=function(e){if(e||(e=qe.config.Promise),!e)throw new pt("Promise type not provided nor in Rx.config.Promise");var t=this;return new e(function(e,n){var r;t.subscribe(function(e){r=e},n,function(){e(r)})})};var hr=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.a=[],$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},Qt(n,$n),n.prototype.next=function(e){this.a.push(e)},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.o.onNext(this.a),this.o.onCompleted()},t}(Zn);Hn.toArray=function(){return new hr(this)},Kn.create=function(e,t){return new Ps(e,t)};var lr=function(e){function t(t){this._f=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=rt(this._f)();return t===nt?Or(t.e).subscribe(e):(et(t)&&(t=cr(t)),t.subscribe(e))},t}(Zn),pr=Kn.defer=function(e){return new lr(e)},fr=function(e){function t(t){this.scheduler=t,e.call(this)}function n(e,t){this.observer=e,this.scheduler=t}function r(e,t){return t.onCompleted(),cn}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new n(e,this.scheduler);return t.run()},n.prototype.run=function(){var e=this.observer;return this.scheduler===Cn?r(null,e):this.scheduler.schedule(e,r)},t}(Zn),dr=new fr(Cn),mr=Kn.empty=function(e){return xn(e)||(e=Cn),e===Cn?dr:new fr(e)},vr=function(e){function t(t,n,r){this._iterable=t,this._fn=n,this._scheduler=r,e.call(this)}function n(e,t,n){return function(r,i){var o=rt(t.next).call(t);if(o===nt)return e.onError(o.e);if(o.done)return e.onCompleted();var s=o.value;return tt(n)&&(s=rt(n)(s,r),s===nt)?e.onError(s.e):(e.onNext(s),void i(r+1))}}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=Object(this._iterable),r=I(t);return this._scheduler.scheduleRecursive(0,n(e,r,this._fn))},t}(Zn),gr=Math.pow(2,53)-1;O.prototype[mt]=function(){return new L(this._s)},L.prototype[mt]=function(){return this},L.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:vt},R.prototype[mt]=function(){return new N(this._a)},N.prototype[mt]=function(){return this},N.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:vt};var yr=Kn.from=function(e,t,n,r){if(null==e)throw new Error("iterable cannot be null.");if(t&&!tt(t))throw new Error("mapFn when provided must be a function");if(t)var i=_t(t,n,2);return xn(r)||(r=An),new vr(e,i,r)},_r=function(e){function t(t,n){this._args=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t.length;return function(r,i){n>r?(e.onNext(t[r]),i(r+1)):e.onCompleted()}}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._scheduler.scheduleRecursive(0,n(e,this._args))},t}(Zn),br=Kn.fromArray=function(e,t){return xn(t)||(t=An),new _r(e,t)},xr=function(e){function t(t,n,r,i,o){this._initialState=t,this._cndFn=n,this._itrFn=r,this._resFn=i,this._s=o,e.call(this)}function n(e,t){if(e.first)e.first=!1;else if(e.newState=rt(e.self._itrFn)(e.newState),e.newState===nt)return e.o.onError(e.newState.e);var n=rt(e.self._cndFn)(e.newState);if(n===nt)return e.o.onError(n.e);if(n){var r=rt(e.self._resFn)(e.newState);if(r===nt)return e.o.onError(r.e);e.o.onNext(r),t(e)}else e.o.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,self:this,first:!0,newState:this._initialState};return this._s.scheduleRecursive(t,n)},t}(Zn);Kn.generate=function(e,t,n,r,i){return xn(i)||(i=An),new xr(e,t,n,r,i)},Kn.of=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return new _r(t,An)},Kn.ofWithScheduler=function(e){for(var t=arguments.length,n=new Array(t-1),r=1;t>r;r++)n[r-1]=arguments[r];return new _r(n,e)},Kn.ofArrayChanges=function(e){if(!Array.isArray(e))throw new TypeError("Array.observe only accepts arrays.");if("function"!=typeof Array.observe&&"function"!=typeof Array.unobserve)throw new TypeError("Array.observe is not supported on your platform");return new Ps(function(t){function n(e){for(var n=0,r=e.length;r>n;n++)t.onNext(e[n])}return Array.observe(e,n),function(){Array.unobserve(e,n)}})},Kn.ofObjectChanges=function(e){if(null==e)throw new TypeError("object must not be null or undefined.");if("function"!=typeof Object.observe&&"function"!=typeof Object.unobserve)throw new TypeError("Object.observe is not supported on your platform");return new Ps(function(t){function n(e){for(var n=0,r=e.length;r>n;n++)t.onNext(e[n])}return Object.observe(e,n),function(){Object.unobserve(e,n)}})};var wr=function(e){function t(){e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return cn},t}(Zn),Sr=new wr,Mr=Kn.never=function(){return Sr},Er=function(e){function t(t,n){this._o=t,this._keys=Object.keys(t),this._scheduler=n,e.call(this)}function n(e,t,n){return function(r,i){if(r<n.length){var o=n[r];e.onNext([o,t[o]]),i(r+1)}else e.onCompleted()}}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._scheduler.scheduleRecursive(0,n(e,this._o,this._keys))},t}(Zn);Kn.pairs=function(e,t){return t||(t=An),new Er(e,t)};var Cr=function(e){function t(t,n,r){this.start=t,this.rangeCount=n,this.scheduler=r,e.call(this)}function n(e,t,n){return function(r,i){t>r?(n.onNext(e+r),i(r+1)):n.onCompleted()}}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.scheduler.scheduleRecursive(0,n(this.start,this.rangeCount,e))},t}(Zn);Kn.range=function(e,t,n){return xn(n)||(n=An),new Cr(e,t,n)};var Tr=function(e){function t(t,n,r){this.value=t,this.repeatCount=null==n?-1:n,this.scheduler=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new B(e,this);return t.run()},t}(Zn);B.prototype.run=function(){function e(e,r){return(-1===e||e>0)&&(t.onNext(n),e>0&&e--),0===e?t.onCompleted():void r(e)}var t=this.observer,n=this.parent.value;return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount,e)},Kn.repeat=function(e,t,n){return xn(n)||(n=An),new Tr(e,t,n)};var Ar=function(e){function t(t,n){this._value=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];return r.onNext(n),r.onCompleted(),cn}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=[this._value,e];return this._scheduler===Cn?n(null,t):this._scheduler.schedule(t,n)},t}(Zn),Pr=(Kn["return"]=Kn.just=function(e,t){return xn(t)||(t=Cn),new Ar(e,t)},function(e){function t(t,n){this._error=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];return r.onError(n),cn}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=[this._error,e];return this._scheduler===Cn?n(null,t):this._scheduler.schedule(t,n)},t}(Zn)),Or=Kn["throw"]=function(e,t){return xn(t)||(t=Cn),new Pr(e,t)},Lr=function(e){function t(t,n){this._resFn=t,this._obsFn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=cn,n=rt(this._resFn)();if(n===nt)return new mn(Or(n.e).subscribe(e),t);n&&(t=n);var r=rt(this._obsFn)(n);return r===nt?new mn(Or(r.e).subscribe(e),t):new mn(r.subscribe(e),t)},t}(Zn);Kn.using=function(e,t){return new Lr(e,t)},Hn.amb=function(e){var t=this;return new Ps(function(n){function r(){o||(o=s,c.dispose())}function i(){o||(o=a,u.dispose())}var o,s="L",a="R",u=new fn,c=new fn;et(e)&&(e=cr(e));var h=zn(function(e){r(),o===s&&n.onNext(e)},function(e){r(),o===s&&n.onError(e)},function(){r(),o===s&&n.onCompleted()}),l=zn(function(e){i(),o===a&&n.onNext(e)},function(e){i(),o===a&&n.onError(e)},function(){i(),o===a&&n.onCompleted()});return u.setDisposable(t.subscribe(h)),c.setDisposable(e.subscribe(l)),new mn(u,c)})},Kn.amb=function(){var e,t=Mr();if(Array.isArray(arguments[0]))e=arguments[0];else{var n=arguments.length;e=new Array(e);for(var r=0;n>r;r++)e[r]=arguments[r]}for(var r=0,n=e.length;n>r;r++)t=V(t,e[r]);return t};var Rr=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn,n=new dn;return n.setDisposable(t),t.setDisposable(this.source.subscribe(new Nr(e,n,this._fn))),n},t}(Zn),Nr=function(e){function t(t,n,r){this._o=t,this._s=n,this._fn=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._o.onNext(e)},t.prototype.completed=function(){return this._o.onCompleted()},t.prototype.error=function(e){var t=rt(this._fn)(e);if(t===nt)return this._o.onError(t.e);et(t)&&(t=cr(t));var n=new fn;this._s.setDisposable(n),n.setDisposable(t.subscribe(this._o))},t}($n);Hn["catch"]=function(e){return tt(e)?new Rr(this,e):Dr([this,e])};var Dr=Kn["catch"]=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return or(e).catchError()};Hn.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),jr.apply(this,t)};var Ir=function(e){function t(t,n){this._params=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this._params.length,n=new Array(t),r={hasValue:E(t,U),hasValueAll:!1,isDone:E(t,U),values:new Array(t)},i=0;t>i;i++){var o=this._params[i],s=new fn;n[i]=s,et(o)&&(o=cr(o)),s.setDisposable(o.subscribe(new kr(e,i,this._cb,r)))}return new vn(n)},t}(Zn),kr=function(e){function t(t,n,r,i){this._o=t,this._i=n,this._cb=r,this._state=i,e.call(this)}function n(e){return function(t,n){return n!==e}}return Qt(t,e),t.prototype.next=function(e){if(this._state.values[this._i]=e,this._state.hasValue[this._i]=!0,this._state.hasValueAll||(this._state.hasValueAll=this._state.hasValue.every(Ye))){var t=rt(this._cb).apply(null,this._state.values);if(t===nt)return this._o.onError(t.e);this._o.onNext(t)}else this._state.isDone.filter(n(this._i)).every(Ye)&&this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._state.isDone[this._i]=!0,this._state.isDone.every(Ye)&&this._o.onCompleted()},t}($n),jr=Kn.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;return Array.isArray(t[0])&&(t=t[0]),new Ir(t,r)};Hn.concat=function(){for(var e=[],t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return e.unshift(this),Vr.apply(null,e)};var Fr=function(e){function t(t,n){this._s=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.o.onNext(e)},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.i++,this._fn(this._s)},t}($n),Br=function(e){function t(t){this._sources=t,e.call(this)}function n(e,t){if(!e.disposable.isDisposed){if(e.i===e.sources.length)return e.o.onCompleted();var n=e.sources[e.i];et(n)&&(n=cr(n));var r=new fn;e.subscription.setDisposable(r),r.setDisposable(n.subscribe(new Fr(e,t)))}}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r=un(Xe),i={o:e,i:0,subscription:t,disposable:r,sources:this._sources},o=Cn.scheduleRecursive(i,n);return new vn([t,r,o])},t}(Zn),Vr=Kn.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,n=arguments.length;n>t;t++)e[t]=arguments[t]}return new Br(e)};Hn.concatAll=function(){return this.merge(1)};var Ur=function(e){function t(t,n){this.source=t,this.maxConcurrent=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new on;return t.add(this.source.subscribe(new Gr(e,this.maxConcurrent,t))),t},t}(Zn),Gr=function(e){function t(t,n,r){this.o=t,this.max=n,this.g=r,this.done=!1,this.q=[],this.activeCount=0,e.call(this)}function n(t,n){this.parent=t,this.sad=n,e.call(this)}return Qt(t,e),t.prototype.handleSubscribe=function(e){var t=new fn;this.g.add(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new n(this,t)))},t.prototype.next=function(e){this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(e)):this.q.push(e)},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.done=!0,0===this.activeCount&&this.o.onCompleted()},Qt(n,e),n.prototype.next=function(e){this.parent.o.onNext(e)},n.prototype.error=function(e){this.parent.o.onError(e)},n.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.q.length>0?this.parent.handleSubscribe(this.parent.q.shift()):(this.parent.activeCount--,this.parent.done&&0===this.parent.activeCount&&this.parent.o.onCompleted())},t}($n);Hn.merge=function(e){return"number"!=typeof e?zr(this,e):new Ur(this,e)};var zr=Kn.merge=function(){var e,t,n=[],r=arguments.length;if(arguments[0])if(xn(arguments[0]))for(e=arguments[0],t=1;r>t;t++)n.push(arguments[t]);else for(e=Cn,t=0;r>t;t++)n.push(arguments[t]);else for(e=Cn,t=1;r>t;t++)n.push(arguments[t]);return Array.isArray(n[0])&&(n=n[0]),F(e,n).mergeAll()},Hr=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new on,n=new fn;return t.add(n),n.setDisposable(this.source.subscribe(new $r(e,t))),t},t}(Zn),$r=function(e){function t(t,n){this.o=t,this.g=n,this.done=!1,e.call(this)}function n(t,n){this.parent=t,this.sad=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=new fn;this.g.add(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new n(this,t)))},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.done=!0,1===this.g.length&&this.o.onCompleted()},Qt(n,e),n.prototype.next=function(e){this.parent.o.onNext(e)},n.prototype.error=function(e){this.parent.o.onError(e)},n.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.done&&1===this.parent.g.length&&this.parent.o.onCompleted()},t}($n);Hn.mergeAll=function(){return new Hr(this)};var Wr=qe.CompositeError=function(e){this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};Wr.prototype=Object.create(Error.prototype),Wr.prototype.name="CompositeError";var qr=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new on,n=new fn,r={isStopped:!1,errors:[],o:e};return t.add(n),n.setDisposable(this.source.subscribe(new Xr(t,r))),t},t}(Zn),Xr=function(e){function t(t,n){this._group=t,this._state=n,e.call(this)}function n(e,t){0===t.length?e.onCompleted():1===t.length?e.onError(t[0]):e.onError(new Wr(t))}function r(t,n,r){this._inner=t,this._group=n,this._state=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=new fn;this._group.add(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new r(t,this._group,this._state)))},t.prototype.error=function(e){this._state.errors.push(e),this._state.isStopped=!0,1===this._group.length&&n(this._state.o,this._state.errors)},t.prototype.completed=function(){this._state.isStopped=!0,1===this._group.length&&n(this._state.o,this._state.errors)},Qt(r,e),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.errors.push(e),this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&n(this._state.o,this._state.errors)},r.prototype.completed=function(){this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&n(this._state.o,this._state.errors)},t}($n);Kn.mergeDelayError=function(){
|
||
var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}var r=F(null,e);return new qr(r)},Hn.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return Zr([this,e])};var Yr=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(e.pos<e.sources.length){var n=e.sources[e.pos++];et(n)&&(n=cr(n));var r=new fn;e.subscription.setDisposable(r),r.setDisposable(n.subscribe(new Kr(e,t)))}else e.o.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r={pos:0,subscription:t,o:e,sources:this.sources},i=Cn.scheduleRecursive(r,n);return new mn(t,i)},t}(Zn),Kr=function(e){function t(t,n){this._state=t,this._recurse=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._state.o.onNext(e)},t.prototype.error=function(){this._recurse(this._state)},t.prototype.completed=function(){this._recurse(this._state)},t}($n),Zr=Kn.onErrorResumeNext=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new Yr(e)},Jr=function(e){function t(t,n){this._s=t,this._o=et(n)?cr(n):n,this._open=!1,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn;t.setDisposable(this._s.subscribe(new Qr(e,this))),et(this._o)&&(this._o=cr(this._o));var n=new fn;return n.setDisposable(this._o.subscribe(new ei(e,this,n))),new mn(t,n)},t}(Zn),Qr=function(e){function t(t,n){this._o=t,this._p=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._p._open&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=function(){this._p._open&&this._o.onCompleted()},t}($n),ei=function(e){function t(t,n,r){this._o=t,this._p=n,this._r=r,e.call(this)}return Qt(t,e),t.prototype.next=function(){this._p._open=!0,this._r.dispose()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=function(){this._r.dispose()},t}($n);Hn.skipUntil=function(e){return new Jr(this,e)};var ti=function(e){function t(t){this.source=t,e.call(this)}function n(e,t){this.o=e,this.inner=t,this.stopped=!1,this.latest=0,this.hasLatest=!1,$n.call(this)}function r(e,t){this.parent=e,this.id=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn,r=this.source.subscribe(new n(e,t));return new mn(r,t)},Qt(n,$n),n.prototype.next=function(e){var t=new fn,n=++this.latest;this.hasLatest=!0,this.inner.setDisposable(t),et(e)&&(e=cr(e)),t.setDisposable(e.subscribe(new r(this,n)))},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.stopped=!0,!this.hasLatest&&this.o.onCompleted()},Qt(r,$n),r.prototype.next=function(e){this.parent.latest===this.id&&this.parent.o.onNext(e)},r.prototype.error=function(e){this.parent.latest===this.id&&this.parent.o.onError(e)},r.prototype.completed=function(){this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.stopped&&this.parent.o.onCompleted())},t}(Zn);Hn["switch"]=Hn.switchLatest=function(){return new ti(this)};var ni=function(e){function t(t,n){this.source=t,this.other=et(n)?cr(n):n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this.source.subscribe(e),this.other.subscribe(new ri(e)))},t}(Zn),ri=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(){this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=Xe,t}($n);Hn.takeUntil=function(e){return new ni(this,e)};var ii=function(e){function t(t,n,r){this._s=t,this._ss=n,this._cb=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this._ss.length,n={hasValue:E(t,U),hasValueAll:!1,values:new Array(t)},r=this._ss.length,i=new Array(r+1),o=0;r>o;o++){var s=this._ss[o],a=new fn;et(s)&&(s=cr(s)),a.setDisposable(s.subscribe(new oi(e,o,n))),i[o]=a}var u=new fn;return u.setDisposable(this._s.subscribe(new si(e,this._cb,n))),i[r]=u,new vn(i)},t}(Zn),oi=function(e){function t(t,n,r){this._o=t,this._i=n,this._state=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._state.values[this._i]=e,this._state.hasValue[this._i]=!0,this._state.hasValueAll=this._state.hasValue.every(Ye)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=Xe,t}($n),si=function(e){function t(t,n,r){this._o=t,this._cb=n,this._state=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=[e].concat(this._state.values);if(this._state.hasValueAll){var n=rt(this._cb).apply(null,t);return n===nt?this._o.onError(n.e):void this._o.onNext(n)}},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.withLatestFrom=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;return Array.isArray(t[0])&&(t=t[0]),new ii(this,t,r)};var ai=function(e){function t(t,n){this._s=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this._s.length,n=new Array(t),r=E(t,U),i=E(t,z),o=0;t>o;o++){var s=this._s[o],a=new fn;n[o]=a,et(s)&&(s=cr(s)),a.setDisposable(s.subscribe(new ui(e,o,this,i,r)))}return new vn(n)},t}(Zn),ui=function(e){function t(t,n,r,i,o){this._o=t,this._i=n,this._p=r,this._q=i,this._d=o,e.call(this)}function n(e){return e.length>0}function r(e){return e.shift()}function i(e){return function(t,n){return n!==e}}return Qt(t,e),t.prototype.next=function(e){if(this._q[this._i].push(e),this._q.every(n)){var t=this._q.map(r),o=rt(this._p._cb).apply(null,t);if(o===nt)return this._o.onError(o.e);this._o.onNext(o)}else this._d.filter(i(this._i)).every(Ye)&&this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._d[this._i]=!0,this._d.every(Ye)&&this._o.onCompleted()},t}($n);Hn.zip=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;Array.isArray(t[0])&&(t=t[0]);var i=this;return t.unshift(i),new ai(t,r)},Kn.zip=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];Array.isArray(t[0])&&(t=tt(t[1])?t[0].concat(t[1]):t[0]);var r=t.shift();return r.zip.apply(r,t)};var ci=function(e){function t(t,n){this.sources=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){for(var t=this.sources,n=t.length,r=new Array(n),i={q:E(n,z),done:E(n,U),cb:this._cb,o:e},o=0;n>o;o++)!function(e){var n=t[e],o=new fn;(yt(n)||gt(n))&&(n=yr(n)),r[e]=o,o.setDisposable(n.subscribe(new hi(i,e)))}(o);return new vn(r)},t}(Zn),hi=function(e){function t(t,n){this._s=t,this._i=n,e.call(this)}function n(e){return e.length>0}function r(e){return e.shift()}function i(e){return function(t,n){return n!==e}}return Qt(t,e),t.prototype.next=function(e){if(this._s.q[this._i].push(e),this._s.q.every(n)){var t=this._s.q.map(r),o=rt(this._s.cb).apply(null,t);if(o===nt)return this._s.o.onError(o.e);this._s.o.onNext(o)}else this._s.done.filter(i(this._i)).every(Ye)&&this._s.o.onCompleted()},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.done[this._i]=!0,this._s.done.every(Ye)&&this._s.o.onCompleted()},t}($n);Hn.zipIterable=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G,i=this;return t.unshift(i),new ci(t,r)},Hn.asObservable=function(){return new Ps(H(this),this)},Hn.bufferWithCount=Hn.bufferCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).flatMap($).filter(W)};var li=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new pi(e))},t}(Zn),pi=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(e){e.accept(this._o)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.dematerialize=function(){return new li(this)};var fi=function(e){function t(t,n,r){this.source=t,this.keyFn=n,this.comparer=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new di(e,this.keyFn,this.comparer))},t}(Zn),di=function(e){function t(t,n,r){this.o=t,this.keyFn=n,this.comparer=r,this.hasCurrentKey=!1,this.currentKey=null,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t,n=e;return tt(this.keyFn)&&(n=rt(this.keyFn)(e),n===nt)?this.o.onError(n.e):this.hasCurrentKey&&(t=rt(this.comparer)(this.currentKey,n),t===nt)?this.o.onError(t.e):void(this.hasCurrentKey&&t||(this.hasCurrentKey=!0,this.currentKey=n,this.o.onNext(e)))},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.o.onCompleted()},t}($n);Hn.distinctUntilChanged=function(e,t){return t||(t=Ze),new fi(this,e,t)};var mi=function(e){function t(t,n,r,i){this.source=t,this._oN=n,this._oE=r,this._oC=i,e.call(this)}function n(e,t){this.o=e,this.t=!t._oN||tt(t._oN)?zn(t._oN||Xe,t._oE||Xe,t._oC||Xe):t._oN,this.isStopped=!1,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this))},Qt(n,$n),n.prototype.next=function(e){var t=rt(this.t.onNext).call(this.t,e);t===nt&&this.o.onError(t.e),this.o.onNext(e)},n.prototype.error=function(e){var t=rt(this.t.onError).call(this.t,e);return t===nt?this.o.onError(t.e):void this.o.onError(e)},n.prototype.completed=function(){var e=rt(this.t.onCompleted).call(this.t);return e===nt?this.o.onError(e.e):void this.o.onCompleted()},t}(Zn);Hn["do"]=Hn.tap=Hn.doAction=function(e,t,n){return new mi(this,e,t,n)},Hn.doOnNext=Hn.tapOnNext=function(e,t){return this.tap("undefined"!=typeof t?function(n){e.call(t,n)}:e)},Hn.doOnError=Hn.tapOnError=function(e,t){return this.tap(Xe,"undefined"!=typeof t?function(n){e.call(t,n)}:e)},Hn.doOnCompleted=Hn.tapOnCompleted=function(e,t){return this.tap(Xe,null,"undefined"!=typeof t?function(){e.call(t)}:e)};var vi=function(e){function t(t,n,r){this.source=t,this._fn=_t(n,r,0),e.call(this)}function n(e,t){this.isDisposed=!1,this._s=e,this._fn=t}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=rt(this.source.subscribe).call(this.source,e);return t===nt&&(this._fn(),c(t.e)),new n(t,this._fn)},n.prototype.dispose=function(){if(!this.isDisposed){var e=rt(this._s.dispose).call(this._s);this._fn(),e===nt&&c(e.e)}},t}(Zn);Hn["finally"]=function(e,t){return new vi(this,e,t)};var gi=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.isStopped=!1}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},n.prototype.onNext=Xe,n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},t}(Zn);Hn.ignoreElements=function(){return new gi(this)};var yi=function(e){function t(t,n){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new _i(e))},t}(Zn),_i=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._o.onNext(Bn(e))},t.prototype.error=function(e){this._o.onNext(Vn(e)),this._o.onCompleted()},t.prototype.completed=function(){this._o.onNext(Un()),this._o.onCompleted()},t}($n);Hn.materialize=function(){return new yi(this)},Hn.repeat=function(e){return rr(this,e).concat()},Hn.retry=function(e){return rr(this,e).catchError()};var bi=function(e){function t(e){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,e.isDisposed=!0)}}}function n(t,n){this.source=t,this._notifier=n,e.call(this)}return Qt(n,e),n.prototype.subscribeCore=function(e){var n,r=new Ns,i=new Ns,o=this._notifier(r),s=o.subscribe(i),a=this.source["@@iterator"](),u={isDisposed:!1},c=new dn,h=An.scheduleRecursive(null,function(t,o){if(!u.isDisposed){var s=a.next();if(s.done)return void(n?e.onError(n):e.onCompleted());var h=s.value;et(h)&&(h=cr(h));var l=new fn,p=new fn;c.setDisposable(new mn(p,l)),l.setDisposable(h.subscribe(function(t){e.onNext(t)},function(t){p.setDisposable(i.subscribe(o,function(t){e.onError(t)},function(){e.onCompleted()})),r.onNext(t),l.dispose()},function(){e.onCompleted()}))}});return new vn([s,c,h,t(u)])},n}(Zn);Hn.retryWhen=function(e){return new bi(q(this),e)};var xi=function(e){function t(e){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,e.isDisposed=!0)}}}function n(t,n){this.source=t,this._notifier=n,e.call(this)}return Qt(n,e),n.prototype.subscribeCore=function(e){var n,r=new Ns,i=new Ns,o=this._notifier(r),s=o.subscribe(i),a=this.source["@@iterator"](),u={isDisposed:!1},c=new dn,h=An.scheduleRecursive(null,function(t,o){if(!u.isDisposed){var s=a.next();if(s.done)return void(n?e.onError(n):e.onCompleted());var h=s.value;et(h)&&(h=cr(h));var l=new fn,p=new fn;c.setDisposable(new mn(p,l)),l.setDisposable(h.subscribe(function(t){e.onNext(t)},function(t){e.onError(t)},function(){p.setDisposable(i.subscribe(o,function(t){e.onError(t)},function(){e.onCompleted()})),r.onNext(null),l.dispose()}))}});return new vn([s,c,h,t(u)])},n}(Zn);Hn.repeatWhen=function(e){return new xi(q(this),e)};var wi=function(e){function t(t,n,r,i){this.source=t,this.accumulator=n,this.hasSeed=r,this.seed=i,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Si(e,this))},t}(Zn),Si=function(e){function t(t,n){this._o=t,this._p=n,this._fn=n.accumulator,this._hs=n.hasSeed,this._s=n.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){return!this._hv&&(this._hv=!0),this._ha?this._a=rt(this._fn)(this._a,e,this._i,this._p):(this._a=this._hs?rt(this._fn)(this._s,e,this._i,this._p):e,this._ha=!0),this._a===nt?this._o.onError(this._a.e):(this._o.onNext(this._a),void this._i++)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){!this._hv&&this._hs&&this._o.onNext(this._s),this._o.onCompleted()},t}($n);Hn.scan=function(){var e,t=!1,n=arguments[0];return 2===arguments.length&&(t=!0,e=arguments[1]),new wi(this,n,t,e)};var Mi=function(e){function t(t,n){this.source=t,this._c=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Ei(e,this._c))},t}(Zn),Ei=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._o.onNext(this._q.shift())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipLast=function(e){if(0>e)throw new lt;return new Mi(this,e)},Hn.startWith=function(){var e,t=0;arguments.length&&xn(arguments[0])?(e=arguments[0],t=1):e=Cn;for(var n=[],r=t,i=arguments.length;i>r;r++)n.push(arguments[r]);return Vr.apply(null,[br(n,e),this])};var Ci=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._q.shift()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){for(;this._q.length>0;)this._o.onNext(this._q.shift());this._o.onCompleted()},t}($n);Hn.takeLast=function(e){if(0>e)throw new lt;var t=this;return new Ps(function(n){return t.subscribe(new Ci(n,e))},t)};var Ti=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._q.shift()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},t}($n);Hn.takeLastBuffer=function(e){if(0>e)throw new lt;var t=this;return new Ps(function(n){return t.subscribe(new Ti(n,e))},t)},Hn.windowWithCount=Hn.windowCount=function(e,t){var n=this;if(+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new lt;if(null==t&&(t=e),+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new lt;return new Ps(function(r){function i(){var e=new Ns;u.push(e),r.onNext(tn(e,s))}var o=new fn,s=new gn(o),a=0,u=[];return i(),o.setDisposable(n.subscribe(function(n){for(var r=0,o=u.length;o>r;r++)u[r].onNext(n);var s=a-e+1;s>=0&&s%t===0&&u.shift().onCompleted(),++a%t===0&&i()},function(e){for(;u.length>0;)u.shift().onError(e);r.onError(e)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),s},n)},Hn.selectConcat=Hn.concatMap=function(e,t,n){return tt(e)&&tt(t)?this.concatMap(function(n,r){var i=e(n,r);return et(i)&&(i=cr(i)),(yt(i)||gt(i))&&(i=yr(i)),i.map(function(e,i){return t(n,e,r,i)})}):tt(e)?X(this,e,n):X(this,function(){return e})},Hn.concatMapObserver=Hn.selectConcatObserver=function(e,t,n,r){var i=this,o=_t(e,r,2),s=_t(t,r,1),a=_t(n,r,0);return new Ps(function(e){var t=0;return i.subscribe(function(n){var r;try{r=o(n,t++)}catch(i){return void e.onError(i)}et(r)&&(r=cr(r)),e.onNext(r)},function(t){var n;try{n=s(t)}catch(r){return void e.onError(r)}et(n)&&(n=cr(n)),e.onNext(n),e.onCompleted()},function(){var t;try{t=a()}catch(n){return void e.onError(n)}et(t)&&(t=cr(t)),e.onNext(t),e.onCompleted()})},this).concatAll()};var Ai=function(e){function t(t,n){this._o=t,this._d=n,this._f=!1,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._f=!0,this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},t}($n);Hn.defaultIfEmpty=function(e){var t=this;return e===o&&(e=null),new Ps(function(n){return t.subscribe(new Ai(n,e))},t)},K.prototype.push=function(e){var t=-1===Y(this.set,e,this.comparer);return t&&this.set.push(e),t};var Pi=function(e){function t(t,n,r){this.source=t,this._keyFn=n,this._cmpFn=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Oi(e,this._keyFn,this._cmpFn))},t}(Zn),Oi=function(e){function t(t,n,r){this._o=t,this._keyFn=n,this._h=new K(r),e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=e;return tt(this._keyFn)&&(t=rt(this._keyFn)(e),t===nt)?this._o.onError(t.e):void(this._h.push(t)&&this._o.onNext(e))},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.distinct=function(e,t){return t||(t=Ze),new Pi(this,e,t)},Hn.groupBy=function(e,t){return this.groupByUntil(e,t,Mr)},Hn.groupByUntil=function(e,t,n){var r=this;return new Ps(function(i){var s=new Wo,a=new on,u=new gn(a),c=function(e){return function(t){t.onError(e)}};return a.add(r.subscribe(function(r){var h=rt(e)(r);if(h===nt)return s.forEach(c(h.e)),i.onError(h.e);var l=!1,p=s.get(h);if(p===o&&(p=new Ns,s.set(h,p),l=!0),l){var f=new Rs(h,p,u),d=new Rs(h,p),m=rt(n)(d);if(m===nt)return s.forEach(c(m.e)),i.onError(m.e);i.onNext(f);var v=new fn;a.add(v),v.setDisposable(m.take(1).subscribe(Xe,function(e){s.forEach(c(e)),i.onError(e)},function(){s["delete"](h)&&p.onCompleted(),a.remove(v)}))}var g=r;return tt(t)&&(g=rt(t)(r),g===nt)?(s.forEach(c(g.e)),i.onError(g.e)):void p.onNext(g)},function(e){s.forEach(c(e)),i.onError(e)},function(){s.forEach(function(e){e.onCompleted()}),i.onCompleted()})),u},r)};var Li=function(e){function t(t,n,r){this.source=t,this.selector=_t(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return e.call(this,t.selector(n,r,i),r,i)}}function r(e,t,n){this.o=e,this.selector=t,this.source=n,this.i=0,$n.call(this)}return Qt(t,e),t.prototype.internalMap=function(e,r){return new t(this.source,n(e,this),r)},t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.selector,this))},Qt(r,$n),r.prototype.next=function(e){var t=rt(this.selector)(e,this.i++,this.source);return t===nt?this.o.onError(t.e):void this.o.onNext(t)},r.prototype.error=function(e){this.o.onError(e)},r.prototype.completed=function(){this.o.onCompleted()},t}(Zn);Hn.map=Hn.select=function(e,t){var n="function"==typeof e?e:function(){return e};return this instanceof Li?this.internalMap(n,t):new Li(this,n,t)},Hn.pluck=function(){var e=arguments.length,t=new Array(e);if(0===e)throw new Error("List of properties cannot be empty.");for(var n=0;e>n;n++)t[n]=arguments[n];return this.map(Z(t,e))},Hn.flatMap=Hn.selectMany=Hn.mergeMap=function(e,t,n){return new Jn(this,e,t,n).mergeAll()},Hn.flatMapObserver=Hn.selectManyObserver=function(e,t,n,r){var i=this;return new Ps(function(o){var s=0;return i.subscribe(function(t){var n;try{n=e.call(r,t,s++)}catch(i){return void o.onError(i)}et(n)&&(n=cr(n)),o.onNext(n)},function(e){var n;try{n=t.call(r,e)}catch(i){return void o.onError(i)}et(n)&&(n=cr(n)),o.onNext(n),o.onCompleted()},function(){var e;try{e=n.call(r)}catch(t){return void o.onError(t)}et(e)&&(e=cr(e)),o.onNext(e),o.onCompleted()})},i).mergeAll()},Hn.flatMapLatest=Hn.switchMap=function(e,t,n){return new Jn(this,e,t,n).switchLatest()};var Ri=function(e){function t(t,n){this.source=t,this._count=n,e.call(this)}function n(e,t){this._o=e,this._r=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this._count))},Qt(n,$n),n.prototype.next=function(e){this._r<=0?this._o.onNext(e):this._r--},n.prototype.error=function(e){this._o.onError(e)},n.prototype.completed=function(){this._o.onCompleted()},t}(Zn);Hn.skip=function(e){if(0>e)throw new lt;return new Ri(this,e)};var Ni=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Di(e,this))},t}(Zn),Di=function(e){function t(t,n){this._o=t,this._p=n,this._i=0,this._r=!1,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(!this._r){var t=rt(this._p._fn)(e,this._i++,this._p);if(t===nt)return this._o.onError(t.e);this._r=!t}this._r&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipWhile=function(e,t){var n=_t(e,t,3);return new Ni(this,n)};var Ii=function(e){function t(t,n){this.source=t,this._count=n,e.call(this)}function n(e,t){this._o=e,this._c=t,this._r=t,$n.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this._count))},Qt(n,$n),n.prototype.next=function(e){this._r-- >0&&(this._o.onNext(e),this._r<=0&&this._o.onCompleted())},n.prototype.error=function(e){this._o.onError(e)},n.prototype.completed=function(){this._o.onCompleted()},t}(Zn);Hn.take=function(e,t){if(0>e)throw new lt;return 0===e?mr(t):new Ii(this,e)};var ki=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new ji(e,this))},t}(Zn),ji=function(e){function t(t,n){this._o=t,this._p=n,this._i=0,this._r=!0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){return this._r&&(this._r=rt(this._p._fn)(e,this._i++,this._p),this._r===nt)?this._o.onError(this._r.e):void(this._r?this._o.onNext(e):this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.takeWhile=function(e,t){var n=_t(e,t,3);return new ki(this,n)};var Fi=function(e){function t(t,n,r){this.source=t,this.predicate=_t(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return t.predicate(n,r,i)&&e.call(this,n,r,i)}}function r(e,t,n){this.o=e,this.predicate=t,this.source=n,this.i=0,$n.call(this)}return Qt(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,n(e,this),r)},Qt(r,$n),r.prototype.next=function(e){var t=rt(this.predicate)(e,this.i++,this.source);return t===nt?this.o.onError(t.e):void(t&&this.o.onNext(e))},r.prototype.error=function(e){this.o.onError(e)},r.prototype.completed=function(){this.o.onCompleted()},t}(Zn);Hn.filter=Hn.where=function(e,t){return this instanceof Fi?this.internalFilter(e,t):new Fi(this,e,t)};var Bi=function(e){function t(t,n,r){this.source=t,this._k=n,this._c=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Vi(e,this._k,this._c))},t}(Zn),Vi=function(e){function t(t,n,r){this._o=t,this._k=n,this._c=r,this._v=null,this._hv=!1,this._l=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._k)(e);if(t===nt)return this._o.onError(t.e);var n=0;if(this._hv){if(n=rt(this._c)(t,this._v),n===nt)return this._o.onError(n.e)}else this._hv=!0,this._v=t;n>0&&(this._v=t,this._l=[]),n>=0&&this._l.push(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._l),this._o.onCompleted()},t}($n),Ui=function(e){function t(t,n,r,i){this.source=t,this.accumulator=n,this.hasSeed=r,this.seed=i,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Gi(e,this))},t}(Zn),Gi=function(e){function t(t,n){this._o=t,this._p=n,this._fn=n.accumulator,this._hs=n.hasSeed,this._s=n.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){return!this._hv&&(this._hv=!0),this._ha?this._a=rt(this._fn)(this._a,e,this._i,this._p):(this._a=this._hs?rt(this._fn)(this._s,e,this._i,this._p):e,this._ha=!0),this._a===nt?this._o.onError(this._a.e):void this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv&&this._o.onNext(this._a),!this._hv&&this._hs&&this._o.onNext(this._s),!this._hv&&!this._hs&&this._o.onError(new ct),this._o.onCompleted()},t}($n);Hn.reduce=function(){var e,t=!1,n=arguments[0];return 2===arguments.length&&(t=!0,e=arguments[1]),new Ui(this,n,t,e)};var zi=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Hi(e,this._fn,this.source))},t}(Zn),Hi=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._fn)(e,this._i++,this._s);return t===nt?this._o.onError(t.e):void(Boolean(t)&&(this._o.onNext(!0),this._o.onCompleted()))},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},t}($n);Hn.some=function(e,t){var n=_t(e,t,3);return new zi(this,n)};var $i=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Wi(e))},t}(Zn),Wi=function(e){function t(t){this._o=t,e.call(this)}return Qt(t,e),t.prototype.next=function(){this._o.onNext(!1),this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},t}($n);Hn.isEmpty=function(){return new $i(this)};var qi=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Xi(e,this._fn,this.source))},t}(Zn),Xi=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._fn)(e,this._i++,this._s);return t===nt?this._o.onError(t.e):void(Boolean(t)||(this._o.onNext(!1),this._o.onCompleted()))},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},t}($n);Hn.every=function(e,t){var n=_t(e,t,3);return new qi(this,n)};var Yi=function(e){function t(t,n,r){var i=+r||0;Math.abs(i)===1/0&&(i=0),this.source=t,this._elem=n,this._n=i,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._n<0?(e.onNext(!1),e.onCompleted(),cn):this.source.subscribe(new Ki(e,this._elem,this._n))},t}(Zn),Ki=function(e){function t(t,n,r){this._o=t,this._elem=n,this._n=r,this._i=0,e.call(this)}function n(e,t){return 0===e&&0===t||e===t||isNaN(e)&&isNaN(t)}return Qt(t,e),t.prototype.next=function(e){this._i++>=this._n&&n(e,this._elem)&&(this._o.onNext(!0),this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},t}($n);Hn.includes=function(e,t){return new Yi(this,e,t)};var Zi=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Ji(e,this._fn,this.source))},t}(Zn),Ji=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,this._c=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._fn){var t=rt(this._fn)(e,this._i++,this._s);if(t===nt)return this._o.onError(t.e);Boolean(t)&&this._c++}else this._c++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},t}($n);Hn.count=function(e,t){var n=_t(e,t,3);return new Zi(this,n)};var Qi=function(e){function t(t,n,r){this.source=t,this._e=n,this._n=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._n<0?(e.onNext(-1),e.onCompleted(),cn):this.source.subscribe(new eo(e,this._e,this._n))},t}(Zn),eo=function(e){function t(t,n,r){this._o=t,this._e=n,this._n=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._i>=this._n&&e===this._e&&(this._o.onNext(this._i),this._o.onCompleted()),this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(-1),this._o.onCompleted()},t}($n);Hn.indexOf=function(e,t){var n=+t||0;return Math.abs(n)===1/0&&(n=0),new Qi(this,e,n)};var to=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new no(e,this._fn,this.source))},t}(Zn),no=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._i=0,this._c=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._fn){var t=rt(this._fn)(e,this._i++,this._s);if(t===nt)return this._o.onError(t.e);this._c+=t}else this._c+=e},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},t}($n);Hn.sum=function(e,t){var n=_t(e,t,3);return new to(this,n)},Hn.minBy=function(e,t){return t||(t=Je),new Bi(this,e,function(e,n){return-1*t(e,n)})},Hn.min=function(e){return this.minBy(Ye,e).map(J)},Hn.maxBy=function(e,t){return t||(t=Je),new Bi(this,e,t)},Hn.max=function(e){return this.maxBy(Ye,e).map(J)};var ro=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new io(e,this._fn,this.source))},t}(Zn),io=function(e){function t(t,n,r){this._o=t,this._fn=n,this._s=r,this._c=0,this._t=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._fn){var t=rt(this._fn)(e,this._c++,this._s);if(t===nt)return this._o.onError(t.e);this._t+=t}else this._c++,this._t+=e},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){return 0===this._c?this._o.onError(new ct):(this._o.onNext(this._t/this._c),void this._o.onCompleted())},t}($n);Hn.average=function(e,t){var n,r=this;return tt(e)&&(n=_t(e,t,3)),new ro(r,n)},Hn.sequenceEqual=function(e,t){var n=this;return t||(t=Ze),new Ps(function(r){var i=!1,o=!1,s=[],a=[],u=n.subscribe(function(e){if(a.length>0){var n=a.shift(),i=rt(t)(n,e);if(i===nt)return r.onError(i.e);i||(r.onNext(!1),r.onCompleted())}else o?(r.onNext(!1),r.onCompleted()):s.push(e)},function(e){r.onError(e)},function(){i=!0,0===s.length&&(a.length>0?(r.onNext(!1),r.onCompleted()):o&&(r.onNext(!0),r.onCompleted()));
|
||
});(yt(e)||gt(e))&&(e=yr(e)),et(e)&&(e=cr(e));var c=e.subscribe(function(e){if(s.length>0){var n=s.shift(),o=rt(t)(n,e);if(o===nt)return r.onError(o.e);o||(r.onNext(!1),r.onCompleted())}else i?(r.onNext(!1),r.onCompleted()):a.push(e)},function(e){r.onError(e)},function(){o=!0,0===a.length&&(s.length>0?(r.onNext(!1),r.onCompleted()):i&&(r.onNext(!0),r.onCompleted()))});return new mn(u,c)},n)};var oo=function(e){function t(t,n,r){this.source=t,this._i=n,this._d=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new so(e,this._i,this._d))},t}(Zn),so=function(e){function t(t,n,r){this._o=t,this._i=n,this._d=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){0===this._i--&&(this._o.onNext(e),this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._d===o?this._o.onError(new lt):(this._o.onNext(this._d),this._o.onCompleted())},t}($n);Hn.elementAt=function(e,t){if(0>e)throw new lt;return new oo(this,e,t)};var ao=function(e){function t(t,n,r){this._o=t,this._obj=n,this._s=r,this._i=0,this._hv=!1,this._v=null,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=!1;if(this._obj.predicate){var n=rt(this._obj.predicate)(e,this._i++,this._s);if(n===nt)return this._o.onError(n.e);Boolean(n)&&(t=!0)}else this._obj.predicate||(t=!0);if(t){if(this._hv)return this._o.onError(new Error("Sequence contains more than one matching element"));this._hv=!0,this._v=e}},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===o?this._o.onError(new ct):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},t}($n);Hn.single=function(e,t){var n={},r=this;if(n="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},tt(n.predicate)){var i=n.predicate;n.predicate=_t(i,n.thisArg,3)}return new Ps(function(e){return r.subscribe(new ao(e,n,r))},r)};var uo=function(e){function t(t,n){this.source=t,this._obj=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new co(e,this._obj,this.source))},t}(Zn),co=function(e){function t(t,n,r){this._o=t,this._obj=n,this._s=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(this._obj.predicate){var t=rt(this._obj.predicate)(e,this._i++,this._s);if(t===nt)return this._o.onError(t.e);Boolean(t)&&(this._o.onNext(e),this._o.onCompleted())}else this._obj.predicate||(this._o.onNext(e),this._o.onCompleted())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._obj.defaultValue===o?this._o.onError(new ct):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},t}($n);Hn.first=function(){var e={};if(e="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},tt(e.predicate)){var t=e.predicate;e.predicate=_t(t,e.thisArg,3)}return new uo(this,e)};var ho=function(e){function t(t,n){this.source=t,this._obj=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new lo(e,this._obj,this.source))},t}(Zn),lo=function(e){function t(t,n,r){this._o=t,this._obj=n,this._s=r,this._i=0,this._hv=!1,this._v=null,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=!1;if(this._obj.predicate){var n=rt(this._obj.predicate)(e,this._i++,this._s);if(n===nt)return this._o.onError(n.e);Boolean(n)&&(t=!0)}else this._obj.predicate||(t=!0);t&&(this._hv=!0,this._v=e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===o?this._o.onError(new ct):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},t}($n);Hn.last=function(){var e={};if(e="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},tt(e.predicate)){var t=e.predicate;e.predicate=_t(t,e.thisArg,3)}return new ho(this,e)};var po=function(e){function t(t,n,r,i){this._o=t,this._s=n,this._cb=r,this._y=i,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._cb)(e,this._i,this._s);return t===nt?this._o.onError(t.e):void(t?(this._o.onNext(this._y?this._i:e),this._o.onCompleted()):this._i++)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._y&&this._o.onNext(-1),this._o.onCompleted()},t}($n);Hn.find=function(e,t){return Q(this,e,t,!1)},Hn.findIndex=function(e,t){return Q(this,e,t,!0)};var fo=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new mo(e))},t}(Zn),mo=function(e){function t(t){this._o=t,this._s=new We.Set,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.add(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._s),this._o.onCompleted()},t}($n);Hn.toSet=function(){if("undefined"==typeof We.Set)throw new TypeError;return new fo(this)};var vo=function(e){function t(t,n,r){this.source=t,this._k=n,this._e=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new go(e,this._k,this._e))},t}(Zn),go=function(e){function t(t,n,r){this._o=t,this._k=n,this._e=r,this._m=new We.Map,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._k)(e);if(t===nt)return this._o.onError(t.e);var n=e;return this._e&&(n=rt(this._e)(e),n===nt)?this._o.onError(n.e):void this._m.set(t,n)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onNext(this._m),this._o.onCompleted()},t}($n);Hn.toMap=function(e,t){if("undefined"==typeof We.Map)throw new TypeError;return new vo(this,e,t)};var yo=function(e){function t(t,n,r){this.source=t,this._b=n,this._e=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new _o(e,this._b,this._e))},t}(Zn),_o=function(e){function t(t,n,r){this._o=t,this._b=n,this._e=r,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._i>=this._b&&(this._e===this._i?this._o.onCompleted():this._o.onNext(e)),this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.slice=function(e,t){var n=e||0;if(0>n)throw new qe.ArgumentOutOfRangeError;if("number"==typeof t&&n>t)throw new qe.ArgumentOutOfRangeError;return new yo(this,n,t)};var bo=function(e){function t(t,n,r){this.source=t,this._e=n,this._n=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._n<0?(e.onNext(-1),e.onCompleted(),cn):this.source.subscribe(new xo(e,this._e,this._n))},t}(Zn),xo=function(e){function t(t,n,r){this._o=t,this._e=n,this._n=r,this._v=0,this._hv=!1,this._i=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._i>=this._n&&e===this._e&&(this._hv=!0,this._v=this._i),this._i++},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._hv?this._o.onNext(this._v):this._o.onNext(-1),this._o.onCompleted()},t}($n);Hn.lastIndexOf=function(e,t){var n=+t||0;return Math.abs(n)===1/0&&(n=0),new bo(this,e,n)},Kn.wrap=function(e){function t(){return Kn.spawn.call(this,e.apply(this,arguments))}return t.__generatorFunction__=e,t};var wo=Kn.spawn=function(){for(var e=arguments[0],t=this,n=[],r=1,i=arguments.length;i>r;r++)n.push(arguments[r]);return new Ps(function(r){function i(t){var n=rt(e.next).call(e,t);return n===nt?r.onError(n.e):void s(n)}function o(t){var n=rt(e.next).call(e,t);return n===nt?r.onError(n.e):void s(n)}function s(e){if(e.done)return r.onNext(e.value),void r.onCompleted();var n=ee.call(t,e.value),s=null,u=!1;Kn.isObservable(n)?a.add(n.subscribe(function(e){u=!0,s=e},o,function(){u&&i(s)})):o(new TypeError("type not supported"))}var a=new on;return tt(e)&&(e=e.apply(t,n)),e&&tt(e.next)?(i(),a):(r.onNext(e),r.onCompleted())})};Kn.start=function(e,t,n){return So(e,t,n)()};var So=Kn.toAsync=function(e,t,n){return xn(n)||(n=Nn),function(){var r=arguments,i=new Ds;return n.schedule(null,function(){var n;try{n=e.apply(t,r)}catch(o){return void i.onError(o)}i.onNext(n),i.onCompleted()}),i.asObservable()}};Kn.fromCallback=function(e,t,n){return function(){"undefined"==typeof t&&(t=this);for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];return ae(e,t,n,i)}},Kn.fromNodeCallback=function(e,t,n){return function(){"undefined"==typeof t&&(t=this);for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];return ce(e,t,n,i)}},pe.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},qe.config.useNativeEvents=!1;var Mo=function(e){function t(t,n,r){this._el=t,this._n=n,this._fn=r,e.call(this)}function n(e,t){return function(){var n=arguments[0];return tt(t)&&(n=rt(t).apply(null,arguments),n===nt)?e.onError(n.e):void e.onNext(n)}}return Qt(t,e),t.prototype.subscribeCore=function(e){return fe(this._el,this._n,n(e,this._fn))},t}(Zn);Kn.fromEvent=function(e,t,n){return e.addListener?Co(function(n){e.addListener(t,n)},function(n){e.removeListener(t,n)},n):qe.config.useNativeEvents||"function"!=typeof e.on||"function"!=typeof e.off?new Mo(e,t,n).publish().refCount():Co(function(n){e.on(t,n)},function(n){e.off(t,n)},n)};var Eo=function(e){function t(t,n,r){this._add=t,this._del=n,this._fn=r,e.call(this)}function n(e,t){return function(){var n=arguments[0];return tt(t)&&(n=rt(t).apply(null,arguments),n===nt)?e.onError(n.e):void e.onNext(n)}}function r(e,t,n){this._del=e,this._fn=t,this._ret=n,this.isDisposed=!1}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=n(e,this._fn),i=this._add(t);return new r(this._del,t,i)},r.prototype.dispose=function(){this.isDisposed||(tt(this._del)&&this._del(this._fn,this._ret),this.isDisposed=!0)},t}(Zn),Co=Kn.fromEventPattern=function(e,t,n){return new Eo(e,t,n).publish().refCount()};Kn.startAsync=function(e){var t=rt(e)();return t===nt?Or(t.e):cr(t)};var To=function(e){function t(t,n){this.source=t,this.controller=new Ns,this.paused=!0,n&&n.subscribe?this.pauser=this.controller.merge(n):this.pauser=this.controller,e.call(this)}return Qt(t,e),t.prototype._subscribe=function(e){var t=this.source.publish(),n=t.subscribe(e),r=cn,i=this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function(e){e?r=t.connect():(r.dispose(),r=cn)});return new vn([n,r,i])},t.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},t.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},t}(Kn);Hn.pausable=function(e){return new To(this,e)};var Ao=function(e){function t(t,n){this.source=t,this.controller=new Ns,this.paused=!0,n&&n.subscribe?this.pauser=this.controller.merge(n):this.pauser=this.controller,e.call(this)}return Qt(t,e),t.prototype._subscribe=function(e){function t(){for(;r.length>0;)e.onNext(r.shift())}var n,r=[],i=de(this.source,this.pauser.startWith(!this.paused).distinctUntilChanged(),function(e,t){return{data:e,shouldFire:t}}).subscribe(function(i){n!==o&&i.shouldFire!==n?(n=i.shouldFire,i.shouldFire&&t()):(n=i.shouldFire,i.shouldFire?e.onNext(i.data):r.push(i.data))},function(n){t(),e.onError(n)},function(){t(),e.onCompleted()});return i},t.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},t.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},t}(Kn);Hn.pausableBuffered=function(e){return new Ao(this,e)};var Po=function(e){function t(t,n,r){e.call(this),this.subject=new Oo(n,r),this.source=t.multicast(this.subject).refCount()}return Qt(t,e),t.prototype._subscribe=function(e){return this.source.subscribe(e)},t.prototype.request=function(e){return this.subject.request(null==e?-1:e)},t}(Kn),Oo=function(e){function t(t,n){null==t&&(t=!0),e.call(this),this.subject=new Ns,this.enableQueue=t,this.queue=t?[]:null,this.requestedCount=0,this.requestedDisposable=null,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=n||An}return Qt(t,e),en(t.prototype,Gn,{_subscribe:function(e){return this.subject.subscribe(e)},onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(In.createOnCompleted()):(this.subject.onCompleted(),this.disposeCurrentRequest())},onError:function(e){this.hasFailed=!0,this.error=e,this.enableQueue&&0!==this.queue.length?this.queue.push(In.createOnError(e)):(this.subject.onError(e),this.disposeCurrentRequest())},onNext:function(e){this.requestedCount<=0?this.enableQueue&&this.queue.push(In.createOnNext(e)):(0===this.requestedCount--&&this.disposeCurrentRequest(),this.subject.onNext(e))},_processRequest:function(e){if(this.enableQueue)for(;this.queue.length>0&&(e>0||"N"!==this.queue[0].kind);){var t=this.queue.shift();t.accept(this.subject),"N"===t.kind?e--:(this.disposeCurrentRequest(),this.queue=[])}return e},request:function(e){this.disposeCurrentRequest();var t=this;return this.requestedDisposable=this.scheduler.schedule(e,function(e,n){var r=t._processRequest(n),i=t.hasCompleted||t.hasFailed;return!i&&r>0?(t.requestedCount=r,un(function(){t.requestedCount=0})):void 0}),this.requestedDisposable},disposeCurrentRequest:function(){this.requestedDisposable&&(this.requestedDisposable.dispose(),this.requestedDisposable=null)}}),t}(Kn);Hn.controlled=function(e,t){return e&&xn(e)&&(t=e,e=!0),null==e&&(e=!0),new Po(this,e,t)};var Lo=function(e){function t(t){e.call(this),this.source=t}function n(e,t){return t.source.request(1)}Qt(t,e),t.prototype._subscribe=function(e){return this.subscription=this.source.subscribe(new r(e,this,this.subscription)),new mn(this.subscription,Nn.schedule(this,n))};var r=function(e){function t(t,n,r){e.call(this),this.observer=t,this.observable=n,this.cancel=r,this.scheduleDisposable=null}function n(e,t){return t.observable.source.request(1)}return Qt(t,e),t.prototype.completed=function(){this.observer.onCompleted(),this.dispose()},t.prototype.error=function(e){this.observer.onError(e),this.dispose()},t.prototype.next=function(e){this.observer.onNext(e),this.scheduleDisposable=Nn.schedule(this,n)},t.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),this.scheduleDisposable&&(this.scheduleDisposable.dispose(),this.scheduleDisposable=null),e.prototype.dispose.call(this)},t}($n);return t}(Kn);Po.prototype.stopAndWait=function(){return new Lo(this)};var Ro=function(e){function t(t,n){e.call(this),this.source=t,this.windowSize=n}function n(e,t){return t.source.request(t.windowSize)}Qt(t,e),t.prototype._subscribe=function(e){return this.subscription=this.source.subscribe(new r(e,this,this.subscription)),new mn(this.subscription,Nn.schedule(this,n))};var r=function(e){function t(t,n,r){this.observer=t,this.observable=n,this.cancel=r,this.received=0,this.scheduleDisposable=null,e.call(this)}function n(e,t){return t.observable.source.request(t.observable.windowSize)}return Qt(t,e),t.prototype.completed=function(){this.observer.onCompleted(),this.dispose()},t.prototype.error=function(e){this.observer.onError(e),this.dispose()},t.prototype.next=function(e){this.observer.onNext(e),this.received=++this.received%this.observable.windowSize,0===this.received&&(this.scheduleDisposable=Nn.schedule(this,n))},t.prototype.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),this.scheduleDisposable&&(this.scheduleDisposable.dispose(),this.scheduleDisposable=null),e.prototype.dispose.call(this)},t}($n);return t}(Kn);Po.prototype.windowed=function(e){return new Ro(this,e)},Hn.pipe=function(e){function t(){n.resume()}var n=this.pausableBuffered();return e.addListener("drain",t),n.subscribe(function(t){!e.write(t)&&n.pause()},function(t){e.emit("error",t)},function(){!e._isStdio&&e.end(),e.removeListener("drain",t)}),n.resume(),e};var No=function(e){function t(t,n,r){this.source=t,this._fn1=n,this._fn2=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=this.source.multicast(this._fn1());return new mn(this._fn2(t).subscribe(e),t.connect())},t}(Zn);Hn.multicast=function(e,t){return tt(e)?new No(this,e,t):new ko(this,e)},Hn.publish=function(e){return e&&tt(e)?this.multicast(function(){return new Ns},e):this.multicast(new Ns)},Hn.share=function(){return this.publish().refCount()},Hn.publishLast=function(e){return e&&tt(e)?this.multicast(function(){return new Ds},e):this.multicast(new Ds)},Hn.publishValue=function(e,t){return 2===arguments.length?this.multicast(function(){return new Is(t)},e):this.multicast(new Is(e))},Hn.shareValue=function(e){return this.publishValue(e).refCount()},Hn.replay=function(e,t,n,r){return e&&tt(e)?this.multicast(function(){return new ks(t,n,r)},e):this.multicast(new ks(t,n,r))},Hn.shareReplay=function(e,t,n){return this.replay(null,e,t,n).refCount()};var Do=function(e,t){this._s=e,this._o=t};Do.prototype.dispose=function(){if(!this._s.isDisposed&&null!==this._o){var e=this._s.observers.indexOf(this._o);this._s.observers.splice(e,1),this._o=null}};var Io=function(e){function t(t){this.source=t,this._count=0,this._connectableSubscription=null,e.call(this)}function n(e,t){this._p=e,this._s=t,this.isDisposed=!1}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=this.source.subscribe(e);return 1===++this._count&&(this._connectableSubscription=this.source.connect()),new n(this,t)},n.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.dispose(),0===--this._p._count&&this._p._connectableSubscription.dispose())},t}(Zn),ko=qe.ConnectableObservable=function(e){function t(t,n){this.source=t,this._connection=null,this._source=t.asObservable(),this._subject=n,e.call(this)}function n(e,t){this._p=e,this._s=t}return Qt(t,e),n.prototype.dispose=function(){this._s&&(this._s.dispose(),this._s=null,this._p._connection=null)},t.prototype.connect=function(){if(!this._connection){if(this._subject.isStopped)return cn;var e=this._source.subscribe(this._subject);this._connection=new n(this,e)}return this._connection},t.prototype._subscribe=function(e){return this._subject.subscribe(e)},t.prototype.refCount=function(){return new Io(this)},t}(Kn);Hn.singleInstance=function(){function e(){return r||(r=!0,t=n["finally"](function(){r=!1}).publish().refCount()),t}var t,n=this,r=!1;return new Ps(function(t){return e().subscribe(t)})},Hn.join=function(e,t,n,r){var i=this;return new Ps(function(o){var s=new on,a=!1,u=!1,c=0,h=0,l=new Wo,p=new Wo,f=function(e){o.onError(e)};return s.add(i.subscribe(function(e){var n=c++,i=new fn;l.set(n,e),s.add(i);var u=rt(t)(e);return u===nt?o.onError(u.e):(i.setDisposable(u.take(1).subscribe(Xe,f,function(){l["delete"](n)&&0===l.size&&a&&o.onCompleted(),s.remove(i)})),void p.forEach(function(t){var n=rt(r)(e,t);return n===nt?o.onError(n.e):void o.onNext(n)}))},f,function(){a=!0,(u||0===l.size)&&o.onCompleted()})),s.add(e.subscribe(function(e){var t=h++,i=new fn;p.set(t,e),s.add(i);var a=rt(n)(e);return a===nt?o.onError(a.e):(i.setDisposable(a.take(1).subscribe(Xe,f,function(){p["delete"](t)&&0===p.size&&u&&o.onCompleted(),s.remove(i)})),void l.forEach(function(t){var n=rt(r)(t,e);return n===nt?o.onError(n.e):void o.onNext(n)}))},f,function(){u=!0,(a||0===p.size)&&o.onCompleted()})),s},i)},Hn.groupJoin=function(e,t,n,r){var i=this;return new Ps(function(o){function s(e){}var a=new on,u=new gn(a),c=new Wo,h=new Wo,l=0,p=0,s=function(e){return function(t){t.onError(e)}};return a.add(i.subscribe(function(e){var n=new Ns,i=l++;c.set(i,n);var p=rt(r)(e,tn(n,u));if(p===nt)return c.forEach(s(p.e)),o.onError(p.e);o.onNext(p),h.forEach(function(e){n.onNext(e)});var f=new fn;a.add(f);var d=rt(t)(e);return d===nt?(c.forEach(s(d.e)),o.onError(d.e)):void f.setDisposable(d.take(1).subscribe(Xe,function(e){c.forEach(s(e)),o.onError(e)},function(){c["delete"](i)&&n.onCompleted(),a.remove(f)}))},function(e){c.forEach(s(e)),o.onError(e)},function(){o.onCompleted()})),a.add(e.subscribe(function(e){var t=p++;h.set(t,e);var r=new fn;a.add(r);var i=rt(n)(e);return i===nt?(c.forEach(s(i.e)),o.onError(i.e)):(r.setDisposable(i.take(1).subscribe(Xe,function(e){c.forEach(s(e)),o.onError(e)},function(){h["delete"](t),a.remove(r)})),void c.forEach(function(t){t.onNext(e)}))},function(e){c.forEach(s(e)),o.onError(e)})),u},i)},Hn.buffer=function(){return this.window.apply(this,arguments).flatMap($)},Hn.window=function(e,t){return 1===arguments.length&&"function"!=typeof arguments[0]?ve.call(this,e):"function"==typeof e?ge.call(this,e):me.call(this,e,t)};var jo=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Fo(e))},t}(Zn),Fo=function(e){function t(t){this._o=t,this._p=null,this._hp=!1,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._hp?this._o.onNext([this._p,e]):this._hp=!0,this._p=e},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.pairwise=function(){return new jo(this)},Hn.partition=function(e,t){var n=_t(e,t,3);return[this.filter(e,t),this.filter(function(e,t,r){return!n(e,t,r)})]};var Bo=function(e){function t(e,t){this.c=e,this.s=t}return Qt(t,e),t.prototype[mt]=function(){var e=this;return{next:function(){return e.c()?{done:!1,value:e.s}:{done:!0,value:void 0}}}},t}(Qn);Hn.letBind=Hn.let=function(e){return e(this)},Kn["if"]=function(e,t,n){return pr(function(){return n||(n=mr()),et(t)&&(t=cr(t)),et(n)&&(n=cr(n)),"function"==typeof n.now&&(n=mr(n)),e()?t:n})},Kn["for"]=Kn.forIn=function(e,t,n){return or(e,t,n).concat()};var Vo=Kn["while"]=Kn.whileDo=function(e,t){return et(t)&&(t=cr(t)),ye(e,t).concat()};Hn.doWhile=function(e){return Vr([this,Vo(e,this)])},Kn["case"]=function(e,t,n){return pr(function(){et(n)&&(n=cr(n)),n||(n=mr()),xn(n)&&(n=mr(n));var r=t[e()];return et(r)&&(r=cr(r)),r||n})};var Uo=function(e){function t(t,n,r){this.source=t,this._fn=n,this._scheduler=r,e.call(this)}function n(e,t){var n,r=e[0],i=e[1];if(!(r.q.length>0))return void(r.isAcquired=!1);n=r.q.shift();var o=new fn;r.d.add(o),o.setDisposable(n.subscribe(new Go(r,i,o))),t([r,i])}return Qt(t,e),t.prototype._ensureActive=function(e){var t=!1;e.q.length>0&&(t=!e.isAcquired,e.isAcquired=!0),t&&e.m.setDisposable(this._scheduler.scheduleRecursive([e,this],n))},t.prototype.subscribeCore=function(e){var t=new dn,n=new on(t),r={q:[],m:t,d:n,activeCount:0,isAcquired:!1,o:e};return r.q.push(this.source),r.activeCount++,this._ensureActive(r),n},t}(Zn),Go=function(e){function t(t,n,r){this._s=t,this._p=n,this._m1=r,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.o.onNext(e);var t=rt(this._p._fn)(e);return t===nt?this._s.o.onError(t.e):(this._s.q.push(t),this._s.activeCount++,void this._p._ensureActive(this._s))},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.d.remove(this._m1),this._s.activeCount--,0===this._s.activeCount&&this._s.o.onCompleted()},t}($n);Hn.expand=function(e,t){return xn(t)||(t=An),new Uo(this,e,t)};var zo=function(e){function t(t,n){this._sources=t,this._cb=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){if(0===this._sources.length)return e.onCompleted(),cn;for(var t=this._sources.length,n={finished:!1,hasResults:new Array(t),hasCompleted:new Array(t),results:new Array(t)},r=new on,i=0,o=this._sources.length;o>i;i++){var s=this._sources[i];et(s)&&(s=cr(s)),r.add(s.subscribe(new Ho(e,n,i,this._cb,r)))}return r},t}(Zn),Ho=function(e){function t(t,n,r,i,o){this._o=t,this._s=n,this._i=r,this._cb=i,this._subs=o,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.finished||(this._s.hasResults[this._i]=!0,this._s.results[this._i]=e)},t.prototype.error=function(e){this._s.finished=!0,this._o.onError(e),this._subs.dispose()},t.prototype.completed=function(){if(!this._s.finished){if(!this._s.hasResults[this._i])return this._o.onCompleted();this._s.hasCompleted[this._i]=!0;for(var e=0;e<this._s.results.length;e++)if(!this._s.hasCompleted[e])return;this._s.finished=!0;var t=rt(this._cb).apply(null,this._s.results);if(t===nt)return this._o.onError(t.e);this._o.onNext(t),this._o.onCompleted()}},t}($n);Kn.forkJoin=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=tt(t[e-1])?t.pop():G;return Array.isArray(t[0])&&(t=t[0]),new zo(t,r)},Hn.forkJoin=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Kn.forkJoin.apply(null,t)},Hn.manySelect=Hn.extend=function(e,t){xn(t)||(t=qe.Scheduler.immediate);var n=this;return pr(function(){var r;return n.map(function(e){var t=new $o(e);return r&&r.onNext(e),r=t,t}).tap(Xe,function(e){r&&r.onError(e)},function(){r&&r.onCompleted()}).observeOn(t).map(e)},n)};var $o=function(e){function t(t){e.call(this),this.head=t,this.tail=new Ds}return Qt(t,e),en(t.prototype,Gn,{_subscribe:function(e){var t=new on;return t.add(An.schedule(this,function(n,r){e.onNext(r.head),t.add(r.tail.mergeAll().subscribe(e))})),t},onCompleted:function(){this.onNext(Kn.empty())},onError:function(e){this.onNext(Kn["throw"](e))},onNext:function(e){this.tail.onNext(e),this.tail.onCompleted()}}),t}(Kn),Wo=We.Map||function(){function e(){this.size=0,this._values=[],this._keys=[]}return e.prototype["delete"]=function(e){var t=this._keys.indexOf(e);return-1===t?!1:(this._values.splice(t,1),this._keys.splice(t,1),this.size--,!0)},e.prototype.get=function(e){var t=this._keys.indexOf(e);return-1===t?o:this._values[t]},e.prototype.set=function(e,t){var n=this._keys.indexOf(e);return-1===n?(this._keys.push(e),this._values.push(t),this.size++):this._values[n]=t,this},e.prototype.forEach=function(e,t){for(var n=0;n<this.size;n++)e.call(t,this._values[n],this._keys[n])},e}();_e.prototype.and=function(e){return new _e(this.patterns.concat(e))},_e.prototype.thenDo=function(e){return new be(this,e)},be.prototype.activate=function(e,t,n){for(var r=[],i=xe(t),o=0,s=this.expression.patterns.length;s>o;o++)r.push(Se(e,this.expression.patterns[o],i));var a=new Me(r,we(this,t),function(){for(var e=0,t=r.length;t>e;e++)r[e].removeActivePlan(a);n(a)});for(o=0,s=r.length;s>o;o++)r[o].addActivePlan(a);return a},Me.prototype.dequeue=function(){this.joinObservers.forEach(function(e){e.queue.shift()})},Me.prototype.match=function(){var e,t,n=!0;for(e=0,t=this.joinObserverArray.length;t>e;e++)if(0===this.joinObserverArray[e].queue.length){n=!1;break}if(n){var r=[],i=!1;for(e=0,t=this.joinObserverArray.length;t>e;e++)r.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(i=!0);if(i)this.onCompleted();else{this.dequeue();var o=[];for(e=0,t=r.length;e<r.length;e++)o.push(r[e].value);this.onNext.apply(this,o)}}};var qo=function(e){function t(t,n){e.call(this),this.source=t,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new fn,this.isDisposed=!1}Qt(t,e);var n=t.prototype;return n.next=function(e){if(!this.isDisposed){if("E"===e.kind)return this.onError(e.error);this.queue.push(e);for(var t=this.activePlans.slice(0),n=0,r=t.length;r>n;n++)t[n].match()}},n.error=Xe,n.completed=Xe,n.addActivePlan=function(e){this.activePlans.push(e)},n.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},n.removeActivePlan=function(e){this.activePlans.splice(this.activePlans.indexOf(e),1),0===this.activePlans.length&&this.dispose()},n.dispose=function(){e.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},t}($n);Hn.and=function(e){return new _e([this,e])},Hn.thenDo=function(e){return new _e([this]).thenDo(e)},Kn.when=function(){var e,t=arguments.length;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new Ps(function(t){var n=[],r=new Wo,i=zn(function(e){t.onNext(e)},function(e){r.forEach(function(t){t.onError(e)}),t.onError(e)},function(e){t.onCompleted()});try{for(var o=0,s=e.length;s>o;o++)n.push(e[o].activate(r,i,function(e){var r=n.indexOf(e);n.splice(r,1),0===n.length&&t.onCompleted()}))}catch(a){return Or(a).subscribe(t)}var u=new on;return r.forEach(function(e){e.subscribe(),u.add(e)}),u})};var Xo=function(e){function t(t,n){this._dt=t,this._s=n,e.call(this)}function n(e,t){t.onNext(0),t.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._s.scheduleFuture(e,this._dt,n)},t}(Zn),Yo=Kn.interval=function(e,t){return Te(e,e,xn(t)?t:Nn)};Kn.timer=function(e,t,n){var r;return xn(n)||(n=Nn),null!=t&&"number"==typeof t?r=t:xn(t)&&(n=t),(e instanceof Date||"number"==typeof e)&&r===o?Ee(e,n):e instanceof Date&&r!==o?Ce(e,t,n):Te(e,r,n)},Hn.delay=function(){var e=arguments[0];if("number"==typeof e||e instanceof Date){var t=e,n=arguments[1];return xn(n)||(n=Nn),t instanceof Date?Pe(this,t,n):Ae(this,t,n)}if(Kn.isObservable(e)||tt(e))return Oe(this,e,arguments[1]);throw new Error("Invalid arguments")};var Ko=function(e){function t(t,n,r){xn(r)||(r=Nn),this.source=t,this._dt=n,this._s=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn;return new mn(this.source.subscribe(new Zo(e,this._dt,this._s,t)),t)},t}(Zn),Zo=function(e){function t(t,n,r,i){this._o=t,this._d=n,this._scheduler=r,this._c=i,this._v=null,this._hv=!1,this._id=0,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._hv=!0,this._v=e;var t=++this._id,n=new fn;this._c.setDisposable(n),n.setDisposable(this._scheduler.scheduleFuture(this,this._d,function(n,r){r._hv&&r._id===t&&r._o.onNext(e),r._hv=!1}))},t.prototype.error=function(e){this._c.dispose(),this._o.onError(e),this._hv=!1,this._id++},t.prototype.completed=function(){this._c.dispose(),this._hv&&this._o.onNext(this._v),this._o.onCompleted(),this._hv=!1,this._id++},t}($n);Hn.debounce=function(){if(tt(arguments[0]))return Le(this,arguments[0]);if("number"==typeof arguments[0])return new Ko(this,arguments[0],arguments[1]);throw new Error("Invalid arguments")},Hn.windowWithTime=Hn.windowTime=function(e,t,n){var r,i=this;return null==t&&(r=e),xn(n)||(n=Nn),"number"==typeof t?r=t:xn(t)&&(r=e,n=t),new Ps(function(t){function o(){var e=new fn,i=!1,s=!1;l.setDisposable(e),c===u?(i=!0,s=!0):u>c?i=!0:s=!0;var f=i?c:u,d=f-p;p=f,i&&(c+=r),s&&(u+=r),e.setDisposable(n.scheduleFuture(null,d,function(){if(s){var e=new Ns;h.push(e),t.onNext(tn(e,a))}i&&h.shift().onCompleted(),o()}))}var s,a,u=r,c=e,h=[],l=new dn,p=0;return s=new on(l),a=new gn(s),h.push(new Ns),t.onNext(tn(h[0],a)),o(),s.add(i.subscribe(function(e){for(var t=0,n=h.length;n>t;t++)h[t].onNext(e)},function(e){for(var n=0,r=h.length;r>n;n++)h[n].onError(e);t.onError(e)},function(){for(var e=0,n=h.length;n>e;e++)h[e].onCompleted();t.onCompleted()})),a},i)},Hn.windowWithTimeOrCount=Hn.windowTimeOrCount=function(e,t,n){var r=this;return xn(n)||(n=Nn),new Ps(function(i){function o(t){var r=new fn;s.setDisposable(r),r.setDisposable(n.scheduleFuture(null,e,function(){if(t===h){c=0;var e=++h;l.onCompleted(),l=new Ns,i.onNext(tn(l,u)),o(e)}}))}var s=new dn,a=new on(s),u=new gn(a),c=0,h=0,l=new Ns;return i.onNext(tn(l,u)),o(0),a.add(r.subscribe(function(e){var n=0,r=!1;l.onNext(e),++c===t&&(r=!0,c=0,n=++h,l.onCompleted(),l=new Ns,i.onNext(tn(l,u))),r&&o(n)},function(e){l.onError(e),i.onError(e)},function(){l.onCompleted(),i.onCompleted()})),u},r)},Hn.bufferWithTime=Hn.bufferTime=function(e,t,n){return this.windowWithTime(e,t,n).flatMap($)},Hn.bufferWithTimeOrCount=Hn.bufferTimeOrCount=function(e,t,n){return this.windowWithTimeOrCount(e,t,n).flatMap($)};var Jo=function(e){function t(t,n){this.source=t,this._s=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Qo(e,this._s))},t}(Zn),Qo=function(e){function t(t,n){this._o=t,this._s=n,this._l=n.now(),e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=this._s.now(),n=t-this._l;this._l=t,this._o.onNext({
|
||
value:e,interval:n})},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.timeInterval=function(e){return xn(e)||(e=Nn),new Jo(this,e)};var es=function(e){function t(t,n){this.source=t,this._s=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new ts(e,this._s))},t}(Zn),ts=function(e){function t(t,n){this._o=t,this._s=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._o.onNext({value:e,timestamp:this._s.now()})},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.timestamp=function(e){return xn(e)||(e=Nn),new es(this,e)};var ns=function(e){function t(t,n){this.source=t,this._sampler=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,atEnd:!1,value:null,hasValue:!1,sourceSubscription:new fn};return t.sourceSubscription.setDisposable(this.source.subscribe(new is(t))),new mn(t.sourceSubscription,this._sampler.subscribe(new rs(t)))},t}(Zn),rs=function(e){function t(t){this._s=t,e.call(this)}return Qt(t,e),t.prototype._handleMessage=function(){this._s.hasValue&&(this._s.hasValue=!1,this._s.o.onNext(this._s.value)),this._s.atEnd&&this._s.o.onCompleted()},t.prototype.next=function(){this._handleMessage()},t.prototype.error=function(e){this._s.onError(e)},t.prototype.completed=function(){this._handleMessage()},t}($n),is=function(e){function t(t){this._s=t,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._s.hasValue=!0,this._s.value=e},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.atEnd=!0,this._s.sourceSubscription.dispose()},t}($n);Hn.sample=function(e,t){return xn(t)||(t=Nn),"number"==typeof e?new ns(this,Yo(e,t)):new ns(this,e)};var os=qe.TimeoutError=function(e){this.message=e||"Timeout has occurred",this.name="TimeoutError",Error.call(this)};os.prototype=Object.create(Error.prototype),Hn.timeout=function(){var e=arguments[0];if(e instanceof Date||"number"==typeof e)return Ne(this,e,arguments[1],arguments[2]);if(Kn.isObservable(e)||tt(e))return Re(this,e,arguments[1],arguments[2]);throw new Error("Invalid arguments")};var ss=function(e){function t(t,n,r,i,o,s){this._state=t,this._cndFn=n,this._itrFn=r,this._resFn=i,this._timeFn=o,this._s=s,e.call(this)}function n(e,t){if(e.hasResult&&e.o.onNext(e.result),e.first)e.first=!1;else if(e.newState=rt(e.self._itrFn)(e.newState),e.newState===nt)return e.o.onError(e.newState.e);if(e.hasResult=rt(e.self._cndFn)(e.newState),e.hasResult===nt)return e.o.onError(e.hasResult.e);if(e.hasResult){if(e.result=rt(e.self._resFn)(e.newState),e.result===nt)return e.o.onError(e.result.e);var n=rt(e.self._timeFn)(e.newState);if(n===nt)return e.o.onError(n.e);t(e,n)}else e.o.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(t,new Date(this._s.now()),n)},t}(Zn);Kn.generateWithAbsoluteTime=function(e,t,n,r,i,o){return xn(o)||(o=Nn),new ss(e,t,n,r,i,o)};var as=function(e){function t(t,n,r,i,o,s){this._state=t,this._cndFn=n,this._itrFn=r,this._resFn=i,this._timeFn=o,this._s=s,e.call(this)}function n(e,t){if(e.hasResult&&e.o.onNext(e.result),e.first)e.first=!1;else if(e.newState=rt(e.self._itrFn)(e.newState),e.newState===nt)return e.o.onError(e.newState.e);if(e.hasResult=rt(e.self._cndFn)(e.newState),e.hasResult===nt)return e.o.onError(e.hasResult.e);if(e.hasResult){if(e.result=rt(e.self._resFn)(e.newState),e.result===nt)return e.o.onError(e.result.e);var n=rt(e.self._timeFn)(e.newState);if(n===nt)return e.o.onError(n.e);t(e,n)}else e.o.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){var t={o:e,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(t,0,n)},t}(Zn);Kn.generateWithRelativeTime=function(e,t,n,r,i,o){return xn(o)||(o=Nn),new as(e,t,n,r,i,o)};var us=function(e){function t(t,n,r){this.source=t,this._dt=n,this._s=r,e.call(this)}function n(e,t){var n=t[0],r=t[1],i=t[2];i.setDisposable(n.subscribe(r))}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new dn;return t.setDisposable(this._s.scheduleFuture([this.source,e,t],this._dt,n)),t},t}(Zn);Hn.delaySubscription=function(e,t){return xn(t)||(t=Nn),new us(this,e,t)};var cs=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new hs(e,this))},t}(Zn),hs=function(e){function t(t,n){this._o=t,this._s=n._s,this._d=n._d,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=this._s.now();for(this._q.push({interval:t,value:e});this._q.length>0&&t-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){for(var e=this._s.now();this._q.length>0&&e-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value);this._o.onCompleted()},t}($n);Hn.skipLastWithTime=function(e,t){return xn(t)||(t=Nn),new cs(this,e,t)};var ls=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new ps(e,this._d,this._s))},t}(Zn),ps=function(e){function t(t,n,r){this._o=t,this._d=n,this._s=r,this._q=[],e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=this._s.now();for(this._q.push({interval:t,value:e});this._q.length>0&&t-this._q[0].interval>=this._d;)this._q.shift()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){for(var e=this._s.now();this._q.length>0;){var t=this._q.shift();e-t.interval<=this._d&&this._o.onNext(t.value)}this._o.onCompleted()},t}($n);Hn.takeLastWithTime=function(e,t){return xn(t)||(t=Nn),new ls(this,e,t)},Hn.takeLastBufferWithTime=function(e,t){var n=this;return xn(t)||(t=Nn),new Ps(function(r){var i=[];return n.subscribe(function(n){var r=t.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=e;)i.shift()},function(e){r.onError(e)},function(){for(var n=t.now(),o=[];i.length>0;){var s=i.shift();n-s.interval<=e&&o.push(s.value)}r.onNext(o),r.onCompleted()})},n)};var fs=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,e.call(this)}function n(e,t){t.onCompleted()}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this._s.scheduleFuture(e,this._d,n),this.source.subscribe(e))},t}(Zn);Hn.takeWithTime=function(e,t){return xn(t)||(t=Nn),new fs(this,e,t)};var ds=function(e){function t(t,n,r){this.source=t,this._d=n,this._s=r,this._open=!1,e.call(this)}function n(e,t){t._open=!0}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this._s.scheduleFuture(this,this._d,n),this.source.subscribe(new ms(e,this)))},t}(Zn),ms=function(e){function t(t,n){this._o=t,this._p=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._p._open&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipWithTime=function(e,t){return xn(t)||(t=Nn),new ds(this,e,t)};var vs=function(e){function t(t,n,r){this.source=t,this._st=n,this._s=r,e.call(this)}function n(e,t){t._open=!0}return Qt(t,e),t.prototype.subscribeCore=function(e){return this._open=!1,new mn(this._s.scheduleFuture(this,this._st,n),this.source.subscribe(new gs(e,this)))},t}(Zn),gs=function(e){function t(t,n){this._o=t,this._p=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){this._p._open&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}($n);Hn.skipUntilWithTime=function(e,t){return xn(t)||(t=Nn),new vs(this,e,t)},Hn.takeUntilWithTime=function(e,t){xn(t)||(t=Nn);var n=this;return new Ps(function(r){return new mn(t.scheduleFuture(r,e,function(e,t){t.onCompleted()}),n.subscribe(r))},n)},Hn.throttle=function(e,t){xn(t)||(t=Nn);var n=+e||0;if(0>=n)throw new RangeError("windowDuration cannot be less or equal zero.");var r=this;return new Ps(function(e){var i=0;return r.subscribe(function(r){var o=t.now();(0===i||o-i>=n)&&(i=o,e.onNext(r))},function(t){e.onError(t)},function(){e.onCompleted()})},r)};var ys=function(e){function t(t,n){this._o=t,this._xform=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){var t=rt(this._xform["@@transducer/step"]).call(this._xform,this._o,e);t===nt&&this._o.onError(t.e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._xform["@@transducer/result"](this._o)},t}($n);Hn.transduce=function(e){var t=this;return new Ps(function(n){var r=e(De(n));return t.subscribe(new ys(n,r))},t)};var _s=function(e){function t(t){this.source=t,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){var t=new fn,n=new on,r={hasCurrent:!1,isStopped:!1,o:e,g:n};return n.add(t),t.setDisposable(this.source.subscribe(new bs(r))),n},t}(Zn),bs=function(e){function t(t){this._s=t,e.call(this)}function n(t,n){this._s=t,this._i=n,e.call(this)}return Qt(t,e),t.prototype.next=function(e){if(!this._s.hasCurrent){this._s.hasCurrent=!0,et(e)&&(e=cr(e));var t=new fn;this._s.g.add(t),t.setDisposable(e.subscribe(new n(this._s,t)))}},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.isStopped=!0,!this._s.hasCurrent&&1===this._s.g.length&&this._s.o.onCompleted()},Qt(n,e),n.prototype.next=function(e){this._s.o.onNext(e)},n.prototype.error=function(e){this._s.o.onError(e)},n.prototype.completed=function(){this._s.g.remove(this._i),this._s.hasCurrent=!1,this._s.isStopped&&1===this._s.g.length&&this._s.o.onCompleted()},t}($n);Hn.switchFirst=function(){return new _s(this)},Hn.flatMapFirst=Hn.exhaustMap=function(e,t,n){return new Jn(this,e,t,n).switchFirst()},Hn.flatMapWithMaxConcurrent=Hn.flatMapMaxConcurrent=function(e,t,n,r){return new Jn(this,t,n,r).merge(e)};var xs=qe.VirtualTimeScheduler=function(e){function t(t,n){this.clock=t,this.comparer=n,this.isEnabled=!1,this.queue=new nn(1024),e.call(this)}Qt(t,e);var n=t.prototype;return n.now=function(){return this.toAbsoluteTime(this.clock)},n.schedule=function(e,t){return this.scheduleAbsolute(e,this.clock,t)},n.scheduleFuture=function(e,t,n){var r=t instanceof Date?this.toRelativeTime(t-this.now()):this.toRelativeTime(t);return this.scheduleRelative(e,r,n)},n.add=dt,n.toAbsoluteTime=dt,n.toRelativeTime=dt,n.schedulePeriodic=function(e,t,n){var r=new Mn(this,e,t,n);return r.start()},n.scheduleRelative=function(e,t,n){var r=this.add(this.clock,t);return this.scheduleAbsolute(e,r,n)},n.start=function(){if(!this.isEnabled){this.isEnabled=!0;do{var e=this.getNext();null!==e?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1}while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(e){var t=this.comparer(this.clock,e);if(this.comparer(this.clock,e)>0)throw new lt;if(0!==t&&!this.isEnabled){this.isEnabled=!0;do{var n=this.getNext();null!==n&&this.comparer(n.dueTime,e)<=0?(this.comparer(n.dueTime,this.clock)>0&&(this.clock=n.dueTime),n.invoke()):this.isEnabled=!1}while(this.isEnabled);this.clock=e}},n.advanceBy=function(e){var t=this.add(this.clock,e),n=this.comparer(this.clock,t);if(n>0)throw new lt;0!==n&&this.advanceTo(t)},n.sleep=function(e){var t=this.add(this.clock,e);if(this.comparer(this.clock,t)>=0)throw new lt;this.clock=t},n.getNext=function(){for(;this.queue.length>0;){var e=this.queue.peek();if(!e.isCancelled())return e;this.queue.dequeue()}return null},n.scheduleAbsolute=function(e,t,n){function r(e,t){return i.queue.remove(o),n(e,t)}var i=this,o=new yn(this,e,r,t,this.comparer);return this.queue.enqueue(o),o.disposable},t}(_n);qe.HistoricalScheduler=function(e){function t(t,n){var r=null==t?0:t,i=n||Je;e.call(this,r,i)}Qt(t,e);var n=t.prototype;return n.add=function(e,t){return e+t},n.toAbsoluteTime=function(e){return new Date(e).getTime()},n.toRelativeTime=function(e){return e},t}(qe.VirtualTimeScheduler),Ie.prototype.equals=function(e){return e===this?!0:null==e?!1:"N"!==e.kind?!1:this.predicate(e.value)},ke.prototype.equals=function(e){return e===this?!0:null==e?!1:"E"!==e.kind?!1:this.predicate(e.error)};var ws=qe.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(e,t){return"function"==typeof t?new Ss(e,new Ie(t)):new Ss(e,In.createOnNext(t))},onError:function(e,t){return"function"==typeof t?new Ss(e,new ke(t)):new Ss(e,In.createOnError(t))},onCompleted:function(e){return new Ss(e,In.createOnCompleted())},subscribe:function(e,t){return new Ms(e,t)}},Ss=qe.Recorded=function(e,t,n){this.time=e,this.value=t,this.comparer=n||Ze};Ss.prototype.equals=function(e){return this.time===e.time&&this.comparer(this.value,e.value)},Ss.prototype.toString=function(){return this.value.toString()+"@"+this.time};var Ms=qe.Subscription=function(e,t){this.subscribe=e,this.unsubscribe=t||Number.MAX_VALUE};Ms.prototype.equals=function(e){return this.subscribe===e.subscribe&&this.unsubscribe===e.unsubscribe},Ms.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var Es=qe.MockDisposable=function(e){this.scheduler=e,this.disposes=[],this.disposes.push(this.scheduler.clock)};Es.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var Cs=function(e){function t(t){e.call(this),this.scheduler=t,this.messages=[]}Qt(t,e);var n=t.prototype;return n.onNext=function(e){this.messages.push(new Ss(this.scheduler.clock,In.createOnNext(e)))},n.onError=function(e){this.messages.push(new Ss(this.scheduler.clock,In.createOnError(e)))},n.onCompleted=function(){this.messages.push(new Ss(this.scheduler.clock,In.createOnCompleted()))},t}(Gn);je.prototype.then=function(e,t){var n=this;this.subscriptions.push(new Ms(this.scheduler.clock));var r,i=this.subscriptions.length-1,s=qe.Observer.create(function(t){var a=e(t);if(a&&"function"==typeof a.then)r=a;else{var u=n.scheduler.clock;r=new je(n.scheduler,[qe.ReactiveTest.onNext(u,o),qe.ReactiveTest.onCompleted(u)])}var c=n.observers.indexOf(s);n.observers.splice(c,1),n.subscriptions[i]=new Ms(n.subscriptions[i].subscribe,n.scheduler.clock)},function(e){t(e);var r=n.observers.indexOf(s);n.observers.splice(r,1),n.subscriptions[i]=new Ms(n.subscriptions[i].subscribe,n.scheduler.clock)});return this.observers.push(s),r||new je(this.scheduler,this.messages)};var Ts=function(e){function t(t,n){e.call(this);var r,i,o=this;this.scheduler=t,this.messages=n,this.subscriptions=[],this.observers=[];for(var s=0,a=this.messages.length;a>s;s++)r=this.messages[s],i=r.value,function(e){t.scheduleAbsolute(null,r.time,function(){for(var t=o.observers.slice(0),n=0,r=t.length;r>n;n++)e.accept(t[n]);return cn})}(i)}return Qt(t,e),t.prototype._subscribe=function(e){var t=this;this.observers.push(e),this.subscriptions.push(new Ms(this.scheduler.clock));var n=this.subscriptions.length-1;return un(function(){var r=t.observers.indexOf(e);t.observers.splice(r,1),t.subscriptions[n]=new Ms(t.subscriptions[n].subscribe,t.scheduler.clock)})},t}(Kn),As=function(e){function t(t,n){e.call(this),this.scheduler=t,this.messages=n,this.subscriptions=[]}return Qt(t,e),t.prototype._subscribe=function(e){var t,n,r=this;this.subscriptions.push(new Ms(this.scheduler.clock));for(var i=this.subscriptions.length-1,o=new on,s=0,a=this.messages.length;a>s;s++)t=this.messages[s],n=t.value,function(n){o.add(r.scheduler.scheduleRelative(null,t.time,function(){return n.accept(e),cn}))}(n);return un(function(){r.subscriptions[i]=new Ms(r.subscriptions[i].subscribe,r.scheduler.clock),o.dispose()})},t}(Kn);qe.TestScheduler=function(e){function t(e,t){return e>t?1:t>e?-1:0}function n(){e.call(this,0,t)}return Qt(n,e),n.prototype.scheduleAbsolute=function(t,n,r){return n<=this.clock&&(n=this.clock+1),e.prototype.scheduleAbsolute.call(this,t,n,r)},n.prototype.add=function(e,t){return e+t},n.prototype.toAbsoluteTime=function(e){return new Date(e).getTime()},n.prototype.toRelativeTime=function(e){return e},n.prototype.startScheduler=function(e,t){t||(t={}),null==t.created&&(t.created=ws.created),null==t.subscribed&&(t.subscribed=ws.subscribed),null==t.disposed&&(t.disposed=ws.disposed);var n,r,i=this.createObserver();return this.scheduleAbsolute(null,t.created,function(){return n=e(),cn}),this.scheduleAbsolute(null,t.subscribed,function(){return r=n.subscribe(i),cn}),this.scheduleAbsolute(null,t.disposed,function(){return r.dispose(),cn}),this.start(),i},n.prototype.createHotObservable=function(){var e,t=arguments.length;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new Ts(this,e)},n.prototype.createColdObservable=function(){var e,t=arguments.length;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new As(this,e)},n.prototype.createResolvedPromise=function(e,t){return new je(this,[qe.ReactiveTest.onNext(e,t),qe.ReactiveTest.onCompleted(e)])},n.prototype.createRejectedPromise=function(e,t){return new je(this,[qe.ReactiveTest.onError(e,t)])},n.prototype.createObserver=function(){return new Cs(this)},n}(xs);var Ps=qe.AnonymousObservable=function(e){function t(e){return e&&tt(e.dispose)?e:tt(e)?un(e):cn}function n(e,n){var r=n[0],i=n[1],o=rt(i.__subscribe).call(i,r);o!==nt||r.fail(nt.e)||c(nt.e),r.setDisposable(t(o))}function r(t,n){this.source=n,this.__subscribe=t,e.call(this)}return Qt(r,e),r.prototype._subscribe=function(e){var t=new Os(e),r=[t,this];return An.scheduleRequired()?An.schedule(r,n):n(null,r),t},r}(Kn),Os=function(e){function t(t){e.call(this),this.observer=t,this.m=new fn}Qt(t,e);var n=t.prototype;return n.next=function(e){var t=rt(this.observer.onNext).call(this.observer,e);t===nt&&(this.dispose(),c(t.e))},n.error=function(e){var t=rt(this.observer.onError).call(this.observer,e);this.dispose(),t===nt&&c(t.e)},n.completed=function(){var e=rt(this.observer.onCompleted).call(this.observer);this.dispose(),e===nt&&c(e.e)},n.setDisposable=function(e){this.m.setDisposable(e)},n.getDisposable=function(){return this.m.getDisposable()},n.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}($n),Ls=function(e){function t(t,n){this._m=t,this._u=n,e.call(this)}return Qt(t,e),t.prototype.subscribeCore=function(e){return new mn(this._m.getDisposable(),this._u.subscribe(e))},t}(Zn),Rs=function(e){function t(t,n,r){e.call(this),this.key=t,this.underlyingObservable=r?new Ls(r,n):n}return Qt(t,e),t.prototype._subscribe=function(e){return this.underlyingObservable.subscribe(e)},t}(Kn),Ns=qe.Subject=function(e){function t(){e.call(this),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return ln(this),this.isStopped?this.hasError?(e.onError(this.error),cn):(e.onCompleted(),cn):(this.observers.push(e),new Do(this,e))},hasObservers:function(){return ln(this),this.observers.length>0},onCompleted:function(){if(ln(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=a(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(ln(this),!this.isStopped)for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),t.create=function(e,t){return new js(e,t)},t}(Kn),Ds=qe.AsyncSubject=function(e){function t(){e.call(this),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return ln(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),cn):(this.observers.push(e),new Do(this,e))},hasObservers:function(){return ln(this),this.observers.length>0},onCompleted:function(){var e,t;if(ln(this),!this.isStopped){this.isStopped=!0;var n=a(this.observers),t=n.length;if(this.hasValue)for(e=0;t>e;e++){var r=n[e];r.onNext(this.value),r.onCompleted()}else for(e=0;t>e;e++)n[e].onCompleted();this.observers.length=0}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){ln(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.error=null,this.value=null}}),t}(Kn),Is=qe.BehaviorSubject=function(e){function t(t){e.call(this),this.value=t,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return ln(this),this.isStopped?(this.hasError?e.onError(this.error):e.onCompleted(),cn):(this.observers.push(e),e.onNext(this.value),new Do(this,e))},getValue:function(){return ln(this),this.hasError&&c(this.error),this.value},hasObservers:function(){return ln(this),this.observers.length>0},onCompleted:function(){if(ln(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=a(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(ln(this),!this.isStopped){this.value=e;for(var t=0,n=a(this.observers),r=n.length;r>t;t++)n[t].onNext(e)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.error=null}}),t}(Kn),ks=qe.ReplaySubject=function(e){function t(e,t){return un(function(){t.dispose(),!e.isDisposed&&e.observers.splice(e.observers.indexOf(t),1)})}function n(t,n,i){this.bufferSize=null==t?r:t,this.windowSize=null==n?r:n,this.scheduler=i||An,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,e.call(this)}var r=Math.pow(2,53)-1;return Qt(n,e),en(n.prototype,Gn.prototype,{_subscribe:function(e){ln(this);var n=new Xn(this.scheduler,e),r=t(this,n);this._trim(this.scheduler.now()),this.observers.push(n);for(var i=0,o=this.q.length;o>i;i++)n.onNext(this.q[i].value);return this.hasError?n.onError(this.error):this.isStopped&&n.onCompleted(),n.ensureActive(),r},hasObservers:function(){return ln(this),this.observers.length>0},_trim:function(e){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&e-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(e){if(ln(this),!this.isStopped){var t=this.scheduler.now();this.q.push({interval:t,value:e}),this._trim(t);for(var n=0,r=a(this.observers),i=r.length;i>n;n++){var o=r[n];o.onNext(e),o.ensureActive()}}},onError:function(e){if(ln(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;var t=this.scheduler.now();this._trim(t);for(var n=0,r=a(this.observers),i=r.length;i>n;n++){var o=r[n];o.onError(e),o.ensureActive()}this.observers.length=0}},onCompleted:function(){if(ln(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var t=0,n=a(this.observers),r=n.length;r>t;t++){var i=n[t];i.onCompleted(),i.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),n}(Kn),js=qe.AnonymousSubject=function(e){function t(t,n){this.observer=t,this.observable=n,e.call(this)}return Qt(t,e),en(t.prototype,Gn.prototype,{_subscribe:function(e){return this.observable.subscribe(e)},onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),t}(Kn);qe.Pauser=function(e){function t(){e.call(this)}return Qt(t,e),t.prototype.pause=function(){this.onNext(!1)},t.prototype.resume=function(){this.onNext(!0)},t}(Ns),"function"==typeof e&&"object"==typeof e.amd&&e.amd?(We.Rx=qe,e(function(){return qe})):Be&&Ve?He?(Ve.exports=qe).Rx=qe:Be.Rx=qe:We.Rx=qe;var Fs=d()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:6}],220:[function(t,n,r){var i={REVISION:"76"};"function"==typeof e&&e.amd?e("three",i):"undefined"!=typeof r&&"undefined"!=typeof n&&(n.exports=i),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1,r=arguments.length;n!==r;++n){var i=arguments[n];if(void 0!==i&&null!==i)for(var i=Object(i),o=Object.keys(i),s=0,a=o.length;s!==a;++s){var u=o[s],c=Object.getOwnPropertyDescriptor(i,u);void 0!==c&&c.enumerable&&(t[u]=i[u])}}return t}}),i.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},i.CullFaceNone=0,i.CullFaceBack=1,i.CullFaceFront=2,i.CullFaceFrontBack=3,i.FrontFaceDirectionCW=0,i.FrontFaceDirectionCCW=1,i.BasicShadowMap=0,i.PCFShadowMap=1,i.PCFSoftShadowMap=2,i.FrontSide=0,i.BackSide=1,i.DoubleSide=2,i.FlatShading=1,i.SmoothShading=2,i.NoColors=0,i.FaceColors=1,i.VertexColors=2,i.NoBlending=0,i.NormalBlending=1,i.AdditiveBlending=2,i.SubtractiveBlending=3,i.MultiplyBlending=4,i.CustomBlending=5,i.AddEquation=100,i.SubtractEquation=101,i.ReverseSubtractEquation=102,i.MinEquation=103,i.MaxEquation=104,i.ZeroFactor=200,i.OneFactor=201,i.SrcColorFactor=202,i.OneMinusSrcColorFactor=203,i.SrcAlphaFactor=204,i.OneMinusSrcAlphaFactor=205,i.DstAlphaFactor=206,i.OneMinusDstAlphaFactor=207,i.DstColorFactor=208,i.OneMinusDstColorFactor=209,i.SrcAlphaSaturateFactor=210,i.NeverDepth=0,i.AlwaysDepth=1,i.LessDepth=2,i.LessEqualDepth=3,i.EqualDepth=4,i.GreaterEqualDepth=5,i.GreaterDepth=6,i.NotEqualDepth=7,i.MultiplyOperation=0,i.MixOperation=1,i.AddOperation=2,i.NoToneMapping=0,i.LinearToneMapping=1,i.ReinhardToneMapping=2,i.Uncharted2ToneMapping=3,i.CineonToneMapping=4,i.UVMapping=300,i.CubeReflectionMapping=301,i.CubeRefractionMapping=302,i.EquirectangularReflectionMapping=303,i.EquirectangularRefractionMapping=304,i.SphericalReflectionMapping=305,i.CubeUVReflectionMapping=306,i.CubeUVRefractionMapping=307,i.RepeatWrapping=1e3,i.ClampToEdgeWrapping=1001,i.MirroredRepeatWrapping=1002,i.NearestFilter=1003,i.NearestMipMapNearestFilter=1004,i.NearestMipMapLinearFilter=1005,i.LinearFilter=1006,i.LinearMipMapNearestFilter=1007,i.LinearMipMapLinearFilter=1008,i.UnsignedByteType=1009,i.ByteType=1010,i.ShortType=1011,i.UnsignedShortType=1012,i.IntType=1013,i.UnsignedIntType=1014,i.FloatType=1015,i.HalfFloatType=1025,i.UnsignedShort4444Type=1016,i.UnsignedShort5551Type=1017,i.UnsignedShort565Type=1018,i.AlphaFormat=1019,i.RGBFormat=1020,i.RGBAFormat=1021,i.LuminanceFormat=1022,i.LuminanceAlphaFormat=1023,i.RGBEFormat=i.RGBAFormat,i.DepthFormat=1026,i.RGB_S3TC_DXT1_Format=2001,i.RGBA_S3TC_DXT1_Format=2002,i.RGBA_S3TC_DXT3_Format=2003,i.RGBA_S3TC_DXT5_Format=2004,i.RGB_PVRTC_4BPPV1_Format=2100,i.RGB_PVRTC_2BPPV1_Format=2101,i.RGBA_PVRTC_4BPPV1_Format=2102,i.RGBA_PVRTC_2BPPV1_Format=2103,i.RGB_ETC1_Format=2151,i.LoopOnce=2200,i.LoopRepeat=2201,i.LoopPingPong=2202,i.InterpolateDiscrete=2300,i.InterpolateLinear=2301,i.InterpolateSmooth=2302,i.ZeroCurvatureEnding=2400,i.ZeroSlopeEnding=2401,i.WrapAroundEnding=2402,i.TrianglesDrawMode=0,i.TriangleStripDrawMode=1,i.TriangleFanDrawMode=2,i.LinearEncoding=3e3,i.sRGBEncoding=3001,i.GammaEncoding=3007,i.RGBEEncoding=3002,i.LogLuvEncoding=3003,i.RGBM7Encoding=3004,i.RGBM16Encoding=3005,i.RGBDEncoding=3006,i.BasicDepthPacking=3200,i.RGBADepthPacking=3201,i.Color=function(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},i.Color.prototype={constructor:i.Color,r:1,g:1,b:1,set:function(e){return e instanceof i.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.b=this.g=this.r=e},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,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?e+6*(t-e)*n:.5>n?t:2/3>n?e+6*(t-e)*(2/3-n):e}return function(t,n,r){return t=i.Math.euclideanModulo(t,1),n=i.Math.clamp(n,0,1),r=i.Math.clamp(r,0,1),0===n?this.r=this.g=this.b=r:(n=.5>=r?r*(1+n):r+n-r*n,r=2*r-n,this.r=e(r,n,t+1/3),this.g=e(r,n,t),this.b=e(r,n,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 n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r=n[2];switch(n[1]){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){var r=parseFloat(n[1])/360,o=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(r,o,s)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){if(n=n[1],r=n.length,3===r)return this.r=parseInt(n.charAt(0)+n.charAt(0),16)/255,this.g=parseInt(n.charAt(1)+n.charAt(1),16)/255,this.b=parseInt(n.charAt(2)+n.charAt(2),16)/255,this;if(6===r)return this.r=parseInt(n.charAt(0)+n.charAt(1),16)/255,this.g=parseInt(n.charAt(2)+n.charAt(3),16)/255,this.b=parseInt(n.charAt(4)+n.charAt(5),16)/255,this}return e&&0<e.length&&(n=i.ColorKeywords[e],void 0!==n?this.setHex(n):console.warn("THREE.Color: Unknown color "+e)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e=e||{h:0,s:0,l:0};var t,n=this.r,r=this.g,i=this.b,o=Math.max(n,r,i),s=Math.min(n,r,i),a=(s+o)/2;if(s===o)s=t=0;else{var u=o-s,s=.5>=a?u/(o+s):u/(2-o-s);switch(o){case n:t=(r-i)/u+(i>r?6:0);break;case r:t=(i-n)/u+2;break;case i:t=(n-r)/u+4}t/=6}return e.h=t,e.s=s,e.l=a,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){var r=this.getHSL();return r.h+=e,r.s+=t,r.l+=n,this.setHSL(r.h,r.s,r.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,
|
||
this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},i.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},i.Quaternion=function(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1},i.Quaternion.prototype={constructor:i.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,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(!1==e instanceof i.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=Math.cos(e._x/2),r=Math.cos(e._y/2),o=Math.cos(e._z/2),s=Math.sin(e._x/2),a=Math.sin(e._y/2),u=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(this._x=s*r*o+n*a*u,this._y=n*a*o-s*r*u,this._z=n*r*u+s*a*o,this._w=n*r*o-s*a*u):"YXZ"===c?(this._x=s*r*o+n*a*u,this._y=n*a*o-s*r*u,this._z=n*r*u-s*a*o,this._w=n*r*o+s*a*u):"ZXY"===c?(this._x=s*r*o-n*a*u,this._y=n*a*o+s*r*u,this._z=n*r*u+s*a*o,this._w=n*r*o-s*a*u):"ZYX"===c?(this._x=s*r*o-n*a*u,this._y=n*a*o+s*r*u,this._z=n*r*u-s*a*o,this._w=n*r*o+s*a*u):"YZX"===c?(this._x=s*r*o+n*a*u,this._y=n*a*o+s*r*u,this._z=n*r*u-s*a*o,this._w=n*r*o-s*a*u):"XZY"===c&&(this._x=s*r*o-n*a*u,this._y=n*a*o-s*r*u,this._z=n*r*u+s*a*o,this._w=n*r*o+s*a*u),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0];e=t[4];var r=t[8],i=t[1],o=t[5],s=t[9],a=t[2],u=t[6],t=t[10],c=n+o+t;return c>0?(n=.5/Math.sqrt(c+1),this._w=.25/n,this._x=(u-s)*n,this._y=(r-a)*n,this._z=(i-e)*n):n>o&&n>t?(n=2*Math.sqrt(1+n-o-t),this._w=(u-s)/n,this._x=.25*n,this._y=(e+i)/n,this._z=(r+a)/n):o>t?(n=2*Math.sqrt(1+o-n-t),this._w=(r-a)/n,this._x=(e+i)/n,this._y=.25*n,this._z=(s+u)/n):(n=2*Math.sqrt(1+t-n-o),this._w=(i-e)/n,this._x=(r+a)/n,this._y=(s+u)/n,this._z=.25*n),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t;return function(n,r){return void 0===e&&(e=new i.Vector3),t=n.dot(r)+1,1e-6>t?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},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)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,o=e._w,s=t._x,a=t._y,u=t._z,c=t._w;return this._x=n*c+o*s+r*u-i*a,this._y=r*c+o*a+i*s-n*u,this._z=i*c+o*u+n*a-r*s,this._w=o*c-n*s-r*a-i*u,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,o=this._w,s=o*e._w+n*e._x+r*e._y+i*e._z;if(0>s?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var a=Math.sqrt(1-s*s);if(.001>Math.abs(a))return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var u=Math.atan2(a,s),s=Math.sin((1-t)*u)/a,a=Math.sin(t*u)/a;return this._w=o*s+this._w*a,this._x=n*s+this._x*a,this._y=r*s+this._y*a,this._z=i*s+this._z*a,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(i.Quaternion,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,o,s){var a=n[r+0],u=n[r+1],c=n[r+2];n=n[r+3],r=i[o+0];var h=i[o+1],l=i[o+2];if(i=i[o+3],n!==i||a!==r||u!==h||c!==l){o=1-s;var p=a*r+u*h+c*l+n*i,f=p>=0?1:-1,d=1-p*p;d>Number.EPSILON&&(d=Math.sqrt(d),p=Math.atan2(d,p*f),o=Math.sin(o*p)/d,s=Math.sin(s*p)/d),f*=s,a=a*o+r*f,u=u*o+h*f,c=c*o+l*f,n=n*o+i*f,o===1-s&&(s=1/Math.sqrt(a*a+u*u+c*c+n*n),a*=s,u*=s,c*=s,n*=s)}e[t]=a,e[t+1]=u,e[t+2]=c,e[t+3]=n}}),i.Vector2=function(e,t){this.x=e||0,this.y=t||0},i.Vector2.prototype={constructor:i.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},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)}},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 isFinite(e)?(this.x*=e,this.y*=e):this.y=this.x=0,this},divide:function(e){return this.x/=e.x,this.y/=e.y,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},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,t;return function(n,r){return void 0===e&&(e=new i.Vector2,t=new i.Vector2),e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n),this},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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},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},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},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},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}},i.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},i.Vector3.prototype={constructor:i.Vector3,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,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)}},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 isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):this.z=this.y=this.x=0,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;return function(t){return!1==t instanceof i.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,n)),this}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[3]*n+e[6]*r,this.y=e[1]*t+e[4]*n+e[7]*r,this.z=e[2]*t+e[5]*n+e[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r+e[12],this.y=e[1]*t+e[5]*n+e[9]*r+e[13],this.z=e[2]*t+e[6]*n+e[10]*r+e[14],this},applyProjection:function(e){var t=this.x,n=this.y,r=this.z;e=e.elements;var i=1/(e[3]*t+e[7]*n+e[11]*r+e[15]);return this.x=(e[0]*t+e[4]*n+e[8]*r+e[12])*i,this.y=(e[1]*t+e[5]*n+e[9]*r+e[13])*i,this.z=(e[2]*t+e[6]*n+e[10]*r+e[14])*i,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,s=e.z;e=e.w;var a=e*t+o*r-s*n,u=e*n+s*t-i*r,c=e*r+i*n-o*t,t=-i*t-o*n-s*r;return this.x=a*e+t*-i+u*-s-c*-o,this.y=u*e+t*-o+c*-i-a*-s,this.z=c*e+t*-s+a*-o-u*-i,this},project:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r,this.y=e[1]*t+e[5]*n+e[9]*r,this.z=e[2]*t+e[6]*n+e[10]*r,this.normalize(),this},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,t;return function(n,r){return void 0===e&&(e=new i.Vector3,t=new i.Vector3),e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,n))/n),this},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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},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,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var n=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-n*e.z,this.z=n*e.y-r*e.x,this},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,o=t.x,s=t.y,a=t.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this},projectOnVector:function(){var e,t;return function(n){return void 0===e&&(e=new i.Vector3),e.copy(n).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),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(i.Math.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return e=this.z-e.z,t*t+n*n+e*e},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},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length();return e=this.setFromMatrixColumn(e,2).length(),this.x=t,this.y=n,this.z=e,this},setFromMatrixColumn:function(e,t){return"number"==typeof e&&(console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."),t=e=t),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},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},i.Vector4=function(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1},i.Vector4.prototype={constructor:i.Vector4,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,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)}},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 isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r+e[12]*i,this.y=e[1]*t+e[5]*n+e[9]*r+e[13]*i,this.z=e[2]*t+e[6]*n+e[10]*r+e[14]*i,this.w=e[3]*t+e[7]*n+e[11]*r+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,n,r;e=e.elements;var i=e[0];r=e[4];var o=e[8],s=e[1],a=e[5],u=e[9];n=e[2],t=e[6];var c=e[10];return.01>Math.abs(r-s)&&.01>Math.abs(o-n)&&.01>Math.abs(u-t)?.1>Math.abs(r+s)&&.1>Math.abs(o+n)&&.1>Math.abs(u+t)&&.1>Math.abs(i+a+c-3)?(this.set(1,0,0,0),this):(e=Math.PI,i=(i+1)/2,a=(a+1)/2,c=(c+1)/2,r=(r+s)/4,o=(o+n)/4,u=(u+t)/4,i>a&&i>c?.01>i?(t=0,r=n=.707106781):(t=Math.sqrt(i),n=r/t,r=o/t):a>c?.01>a?(t=.707106781,n=0,r=.707106781):(n=Math.sqrt(a),t=r/n,r=u/n):.01>c?(n=t=.707106781,r=0):(r=Math.sqrt(c),t=o/r,n=u/r),this.set(t,n,r,e),this):(e=Math.sqrt((t-u)*(t-u)+(o-n)*(o-n)+(s-r)*(s-r)),.001>Math.abs(e)&&(e=1),this.x=(t-u)/e,this.y=(o-n)/e,this.z=(s-r)/e,this.w=Math.acos((i+a+c-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(n,r){return void 0===e&&(e=new i.Vector4,t=new i.Vector4),e.set(n,n,n,n),t.set(r,r,r,r),this.clamp(e,t)}}(),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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},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,n){return this.subVectors(t,e).multiplyScalar(n).add(e),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},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},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},i.Euler=function(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||i.Euler.DefaultOrder},i.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),i.Euler.DefaultOrder="XYZ",i.Euler.prototype={constructor:i.Euler,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||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,n){var r=i.Math.clamp,o=e.elements;e=o[0];var s=o[4],a=o[8],u=o[1],c=o[5],h=o[9],l=o[2],p=o[6],o=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(r(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,o),this._z=Math.atan2(-s,e)):(this._x=Math.atan2(p,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(a,o),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-l,e),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(-l,o),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,e))):"ZYX"===t?(this._y=Math.asin(-r(l,-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(p,o),this._z=Math.atan2(u,e)):(this._x=0,this._z=Math.atan2(-s,c))):"YZX"===t?(this._z=Math.asin(r(u,-1,1)),.99999>Math.abs(u)?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-l,e)):(this._x=0,this._y=Math.atan2(a,o))):"XZY"===t?(this._z=Math.asin(-r(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,e)):(this._x=Math.atan2(-h,o),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,r),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new i.Quaternion;return function(t){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 i.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},i.Line3=function(e,t){this.start=void 0!==e?e:new i.Vector3,this.end=void 0!==t?t:new i.Vector3},i.Line3.prototype={constructor:i.Line3,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},center:function(e){return(e||new i.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new i.Vector3).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){var n=t||new i.Vector3;return this.delta(n).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new i.Vector3,t=new i.Vector3;return function(n,r){e.subVectors(n,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),o=t.dot(e)/o;return r&&(o=i.Math.clamp(o,0,1)),o}}(),closestPointToPoint:function(e,t,n){return e=this.closestPointToPointParameter(e,t),n=n||new i.Vector3,this.delta(n).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)}},i.Box2=function(e,t){this.min=void 0!==e?e:new i.Vector2(1/0,1/0),this.max=void 0!==t?t:new i.Vector2(-(1/0),-(1/0))},i.Box2.prototype={constructor:i.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;n>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector2;return function(t,n){var r=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){return(e||new i.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new i.Vector2).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new i.Vector2).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return(t||new i.Vector2).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector2;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);
|
||
}},i.Box3=function(e,t){this.min=void 0!==e?e:new i.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new i.Vector3(-(1/0),-(1/0),-(1/0))},i.Box3.prototype={constructor:i.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-(1/0),o=-(1/0),s=-(1/0),a=0,u=e.length;u>a;a+=3){var c=e[a],h=e[a+1],l=e[a+2];t>c&&(t=c),n>h&&(n=h),r>l&&(r=l),c>i&&(i=c),h>o&&(o=h),l>s&&(s=l)}this.min.set(t,n,r),this.max.set(i,o,s)},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;n>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector3;return function(t,n){var r=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),setFromObject:function(){var e=new i.Vector3;return function(t){var n=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var r=t.geometry;if(void 0!==r)if(r instanceof i.Geometry)for(var o=r.vertices,r=0,s=o.length;s>r;r++)e.copy(o[r]),e.applyMatrix4(t.matrixWorld),n.expandByPoint(e);else if(r instanceof i.BufferGeometry&&void 0!==r.attributes.position)for(o=r.attributes.position.array,r=0,s=o.length;s>r;r+=3)e.fromArray(o,r),e.applyMatrix4(t.matrixWorld),n.expandByPoint(e)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){return(e||new i.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new i.Vector3).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new i.Vector3).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,n;return 0<e.normal.x?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new i.Vector3).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new i.Vector3;return function(t){return t=t||new i.Sphere,t.center=this.center(),t.radius=.5*this.size(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 i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3];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)}},i.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},i.Matrix3.prototype={constructor:i.Matrix3,set:function(e,t,n,r,i,o,s,a,u){var c=this.elements;return c[0]=e,c[1]=r,c[2]=s,c[3]=t,c[4]=i,c[5]=a,c[6]=n,c[7]=o,c[8]=u,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){return e=e.elements,this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],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},applyToVector3Array:function(){var e;return function(t,n,r){void 0===e&&(e=new i.Vector3),void 0===n&&(n=0),void 0===r&&(r=t.length);for(var o=0;r>o;o+=3,n+=3)e.fromArray(t,n),e.applyMatrix3(this),e.toArray(t,n);return t}}(),applyToBuffer:function(){var e;return function(t,n,r){void 0===e&&(e=new i.Vector3),void 0===n&&(n=0),void 0===r&&(r=t.length/t.itemSize);for(var o=0;r>o;o++,n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],u=e[7],e=e[8];return t*o*e-t*s*u-n*i*e+n*s*a+r*i*u-r*o*a},getInverse:function(e,t){e instanceof i.Matrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=e.elements,r=this.elements,o=n[0],s=n[1],a=n[2],u=n[3],c=n[4],h=n[5],l=n[6],p=n[7],n=n[8],f=n*c-h*p,d=h*l-n*u,m=p*u-c*l,v=o*f+s*d+a*m;if(0===v){if(t)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return r[0]=f,r[1]=a*p-n*s,r[2]=h*s-a*c,r[3]=d,r[4]=n*o-a*l,r[5]=a*u-h*o,r[6]=m,r[7]=s*l-p*o,r[8]=c*o-s*u,this.multiplyScalar(1/v)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},i.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},i.Matrix4.prototype={constructor:i.Matrix4,set:function(e,t,n,r,i,o,s,a,u,c,h,l,p,f,d,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=o,v[9]=s,v[13]=a,v[2]=u,v[6]=c,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 i.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new i.Vector3);var n=this.elements,r=t.elements,o=1/e.setFromMatrixColumn(t,0).length(),s=1/e.setFromMatrixColumn(t,1).length();return t=1/e.setFromMatrixColumn(t,2).length(),n[0]=r[0]*o,n[1]=r[1]*o,n[2]=r[2]*o,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[8]=r[8]*t,n[9]=r[9]*t,n[10]=r[10]*t,this}}(),makeRotationFromEuler:function(e){!1==e instanceof i.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,o=e.z,s=Math.cos(n),n=Math.sin(n),a=Math.cos(r),r=Math.sin(r),u=Math.cos(o),o=Math.sin(o);if("XYZ"===e.order){e=s*u;var c=s*o,h=n*u,l=n*o;t[0]=a*u,t[4]=-a*o,t[8]=r,t[1]=c+h*r,t[5]=e-l*r,t[9]=-n*a,t[2]=l-e*r,t[6]=h+c*r,t[10]=s*a}else"YXZ"===e.order?(e=a*u,c=a*o,h=r*u,l=r*o,t[0]=e+l*n,t[4]=h*n-c,t[8]=s*r,t[1]=s*o,t[5]=s*u,t[9]=-n,t[2]=c*n-h,t[6]=l+e*n,t[10]=s*a):"ZXY"===e.order?(e=a*u,c=a*o,h=r*u,l=r*o,t[0]=e-l*n,t[4]=-s*o,t[8]=h+c*n,t[1]=c+h*n,t[5]=s*u,t[9]=l-e*n,t[2]=-s*r,t[6]=n,t[10]=s*a):"ZYX"===e.order?(e=s*u,c=s*o,h=n*u,l=n*o,t[0]=a*u,t[4]=h*r-c,t[8]=e*r+l,t[1]=a*o,t[5]=l*r+e,t[9]=c*r-h,t[2]=-r,t[6]=n*a,t[10]=s*a):"YZX"===e.order?(e=s*a,c=s*r,h=n*a,l=n*r,t[0]=a*u,t[4]=l-e*o,t[8]=h*o+c,t[1]=o,t[5]=s*u,t[9]=-n*u,t[2]=-r*u,t[6]=c*o+h,t[10]=e-l*o):"XZY"===e.order&&(e=s*a,c=s*r,h=n*a,l=n*r,t[0]=a*u,t[4]=-o,t[8]=r*u,t[1]=e*o+l,t[5]=s*u,t[9]=c*o-h,t[2]=h*o-c,t[6]=n*u,t[10]=l*o+e);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,o=e.w,s=n+n,a=r+r,u=i+i;e=n*s;var c=n*a,n=n*u,h=r*a,r=r*u,i=i*u,s=o*s,a=o*a,o=o*u;return t[0]=1-(h+i),t[4]=c-o,t[8]=n+a,t[1]=c+o,t[5]=1-(e+i),t[9]=r-s,t[2]=n-a,t[6]=r+s,t[10]=1-(e+h),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,t,n;return function(r,o,s){void 0===e&&(e=new i.Vector3),void 0===t&&(t=new i.Vector3),void 0===n&&(n=new i.Vector3);var a=this.elements;return n.subVectors(r,o).normalize(),0===n.lengthSq()&&(n.z=1),e.crossVectors(s,n).normalize(),0===e.lengthSq()&&(n.x+=1e-4,e.crossVectors(s,n).normalize()),t.crossVectors(n,e),a[0]=e.x,a[4]=t.x,a[8]=n.x,a[1]=e.y,a[5]=t.y,a[9]=n.y,a[2]=e.z,a[6]=t.z,a[10]=n.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 n=e.elements,r=t.elements,i=this.elements,o=n[0],s=n[4],a=n[8],u=n[12],c=n[1],h=n[5],l=n[9],p=n[13],f=n[2],d=n[6],m=n[10],v=n[14],g=n[3],y=n[7],_=n[11],n=n[15],b=r[0],x=r[4],w=r[8],S=r[12],M=r[1],E=r[5],C=r[9],T=r[13],A=r[2],P=r[6],O=r[10],L=r[14],R=r[3],N=r[7],D=r[11],r=r[15];return i[0]=o*b+s*M+a*A+u*R,i[4]=o*x+s*E+a*P+u*N,i[8]=o*w+s*C+a*O+u*D,i[12]=o*S+s*T+a*L+u*r,i[1]=c*b+h*M+l*A+p*R,i[5]=c*x+h*E+l*P+p*N,i[9]=c*w+h*C+l*O+p*D,i[13]=c*S+h*T+l*L+p*r,i[2]=f*b+d*M+m*A+v*R,i[6]=f*x+d*E+m*P+v*N,i[10]=f*w+d*C+m*O+v*D,i[14]=f*S+d*T+m*L+v*r,i[3]=g*b+y*M+_*A+n*R,i[7]=g*x+y*E+_*P+n*N,i[11]=g*w+y*C+_*O+n*D,i[15]=g*S+y*T+_*L+n*r,this},multiplyToArray:function(e,t,n){var r=this.elements;return this.multiplyMatrices(e,t),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],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},applyToVector3Array:function(){var e;return function(t,n,r){void 0===e&&(e=new i.Vector3),void 0===n&&(n=0),void 0===r&&(r=t.length);for(var o=0;r>o;o+=3,n+=3)e.fromArray(t,n),e.applyMatrix4(this),e.toArray(t,n);return t}}(),applyToBuffer:function(){var e;return function(t,n,r){void 0===e&&(e=new i.Vector3),void 0===n&&(n=0),void 0===r&&(r=t.length/t.itemSize);for(var o=0;r>o;o++,n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],s=e[5],a=e[9],u=e[13],c=e[2],h=e[6],l=e[10],p=e[14];return e[3]*(+i*a*h-r*u*h-i*s*l+n*u*l+r*s*p-n*a*p)+e[7]*(+t*a*p-t*u*l+i*o*l-r*o*p+r*u*c-i*a*c)+e[11]*(+t*u*h-t*s*p-i*o*h+n*o*p+i*s*c-n*u*c)+e[15]*(-r*s*c-t*a*h+t*s*l+r*o*h-n*o*l+n*a*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getPosition:function(){var e;return function(){return void 0===e&&(e=new i.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var n=this.elements,r=e.elements,i=r[0],o=r[1],s=r[2],a=r[3],u=r[4],c=r[5],h=r[6],l=r[7],p=r[8],f=r[9],d=r[10],m=r[11],v=r[12],g=r[13],y=r[14],r=r[15],_=f*y*l-g*d*l+g*h*m-c*y*m-f*h*r+c*d*r,b=v*d*l-p*y*l-v*h*m+u*y*m+p*h*r-u*d*r,x=p*g*l-v*f*l+v*c*m-u*g*m-p*c*r+u*f*r,w=v*f*h-p*g*h-v*c*d+u*g*d+p*c*y-u*f*y,S=i*_+o*b+s*x+a*w;if(0===S){if(t)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return n[0]=_,n[1]=g*d*a-f*y*a-g*s*m+o*y*m+f*s*r-o*d*r,n[2]=c*y*a-g*h*a+g*s*l-o*y*l-c*s*r+o*h*r,n[3]=f*h*a-c*d*a-f*s*l+o*d*l+c*s*m-o*h*m,n[4]=b,n[5]=p*y*a-v*d*a+v*s*m-i*y*m-p*s*r+i*d*r,n[6]=v*h*a-u*y*a-v*s*l+i*y*l+u*s*r-i*h*r,n[7]=u*d*a-p*h*a+p*s*l-i*d*l-u*s*m+i*h*m,n[8]=x,n[9]=v*f*a-p*g*a-v*o*m+i*g*m+p*o*r-i*f*r,n[10]=u*g*a-v*c*a+v*o*l-i*g*l-u*o*r+i*c*r,n[11]=p*c*a-u*f*a-p*o*l+i*f*l+u*o*m-i*c*m,n[12]=w,n[13]=p*g*s-v*f*s+v*o*d-i*g*d-p*o*y+i*f*y,n[14]=v*c*s-u*g*s-v*o*h+i*g*h+u*o*y-i*c*y,n[15]=u*f*s-p*c*s+p*o*h-i*f*h-u*o*d+i*c*d,this.multiplyScalar(1/S)},scale:function(e){var t=this.elements,n=e.x,r=e.y;return e=e.z,t[0]*=n,t[4]*=r,t[8]*=e,t[1]*=n,t[5]*=r,t[9]*=e,t[2]*=n,t[6]*=r,t[10]*=e,t[3]*=n,t[7]*=r,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,s=e.y,a=e.z,u=i*o,c=i*s;return this.set(u*o+n,u*s-r*a,u*a+r*s,0,u*s+r*a,c*s+n,c*a-r*o,0,u*a-r*s,c*a+r*o,i*a*a+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},compose:function(e,t,n){return this.makeRotationFromQuaternion(t),this.scale(n),this.setPosition(e),this},decompose:function(){var e,t;return function(n,r,o){void 0===e&&(e=new i.Vector3),void 0===t&&(t=new i.Matrix4);var s=this.elements,a=e.set(s[0],s[1],s[2]).length(),u=e.set(s[4],s[5],s[6]).length(),c=e.set(s[8],s[9],s[10]).length();0>this.determinant()&&(a=-a),n.x=s[12],n.y=s[13],n.z=s[14],t.elements.set(this.elements),n=1/a;var s=1/u,h=1/c;return t.elements[0]*=n,t.elements[1]*=n,t.elements[2]*=n,t.elements[4]*=s,t.elements[5]*=s,t.elements[6]*=s,t.elements[8]*=h,t.elements[9]*=h,t.elements[10]*=h,r.setFromRotationMatrix(t),o.x=a,o.y=u,o.z=c,this}}(),makeFrustum:function(e,t,n,r,i,o){var s=this.elements;return s[0]=2*i/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*i/(r-n),s[9]=(r+n)/(r-n),s[13]=0,s[2]=0,s[6]=0,s[10]=-(o+i)/(o-i),s[14]=-2*o*i/(o-i),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this},makePerspective:function(e,t,n,r){e=n*Math.tan(i.Math.DEG2RAD*e*.5);var o=-e;return this.makeFrustum(o*t,e*t,o,e,n,r)},makeOrthographic:function(e,t,n,r,i,o){var s=this.elements,a=1/(t-e),u=1/(n-r),c=1/(o-i);return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-((t+e)*a),s[1]=0,s[5]=2*u,s[9]=0,s[13]=-((n+r)*u),s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-((o+i)*c),s[3]=0,s[7]=0,s[11]=0,s[15]=1,this},equals:function(e){var t=this.elements;e=e.elements;for(var n=0;16>n;n++)if(t[n]!==e[n])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},i.Ray=function(e,t){this.origin=void 0!==e?e:new i.Vector3,this.direction=void 0!==t?t:new i.Vector3},i.Ray.prototype={constructor:i.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new i.Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){this.direction.copy(e).sub(this.origin).normalize()},recast:function(){var e=new i.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var n=t||new i.Vector3;n.subVectors(e,this.origin);var r=n.dot(this.direction);return 0>r?n.copy(this.origin):n.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new i.Vector3;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return 0>n?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Vector3;return function(r,i,o,s){e.copy(r).add(i).multiplyScalar(.5),t.copy(i).sub(r).normalize(),n.copy(this.origin).sub(e);var a,u=.5*r.distanceTo(i),c=-this.direction.dot(t),h=n.dot(this.direction),l=-n.dot(t),p=n.lengthSq(),f=Math.abs(1-c*c);return f>0?(r=c*l-h,i=c*h-l,a=u*f,r>=0?i>=-a?a>=i?(u=1/f,r*=u,i*=u,c=r*(r+c*i+2*h)+i*(c*r+i+2*l)+p):(i=u,r=Math.max(0,-(c*i+h)),c=-r*r+i*(i+2*l)+p):(i=-u,r=Math.max(0,-(c*i+h)),c=-r*r+i*(i+2*l)+p):-a>=i?(r=Math.max(0,-(-c*u+h)),i=r>0?-u:Math.min(Math.max(-u,-l),u),c=-r*r+i*(i+2*l)+p):a>=i?(r=0,i=Math.min(Math.max(-u,-l),u),c=i*(i+2*l)+p):(r=Math.max(0,-(c*u+h)),i=r>0?u:Math.min(Math.max(-u,-l),u),c=-r*r+i*(i+2*l)+p)):(i=c>0?-u:u,r=Math.max(0,-(c*i+h)),c=-r*r+i*(i+2*l)+p),o&&o.copy(this.direction).multiplyScalar(r).add(this.origin),s&&s.copy(t).multiplyScalar(i).add(e),c}}(),intersectSphere:function(){var e=new i.Vector3;return function(t,n){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),i=e.dot(e)-r*r,o=t.radius*t.radius;return i>o?null:(o=Math.sqrt(o-i),i=r-o,r+=o,0>i&&0>r?null:0>i?this.at(r,n):this.at(i,n))}}(),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:(e=-(this.origin.dot(e.normal)+e.constant)/t,e>=0?e:null)},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,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 n,r,i,o,s;r=1/this.direction.x,o=1/this.direction.y,s=1/this.direction.z;var a=this.origin;return r>=0?(n=(e.min.x-a.x)*r,r*=e.max.x-a.x):(n=(e.max.x-a.x)*r,r*=e.min.x-a.x),o>=0?(i=(e.min.y-a.y)*o,o*=e.max.y-a.y):(i=(e.max.y-a.y)*o,o*=e.min.y-a.y),n>o||i>r?null:((i>n||n!==n)&&(n=i),(r>o||r!==r)&&(r=o),s>=0?(i=(e.min.z-a.z)*s,s*=e.max.z-a.z):(i=(e.max.z-a.z)*s,s*=e.min.z-a.z),n>s||i>r?null:((i>n||n!==n)&&(n=i),(r>s||r!==r)&&(r=s),0>r?null:this.at(n>=0?n:r,t)))},intersectsBox:function(){var e=new i.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Vector3,r=new i.Vector3;return function(i,o,s,a,u){if(t.subVectors(o,i),n.subVectors(s,i),r.crossVectors(t,n),o=this.direction.dot(r),o>0){if(a)return null;a=1}else{if(!(0>o))return null;a=-1,o=-o}return e.subVectors(this.origin,i),i=a*this.direction.dot(n.crossVectors(e,n)),0>i?null:(s=a*this.direction.dot(t.cross(e)),0>s||i+s>o?null:(i=-a*e.dot(r),0>i?null:this.at(i/o,u)))}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},i.Sphere=function(e,t){this.center=void 0!==e?e:new i.Vector3,this.radius=void 0!==t?t:0},i.Sphere.prototype={constructor:i.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new i.Box3;return function(t,n){var r=this.center;void 0!==n?r.copy(n):e.setFromPoints(t).center(r);for(var i=0,o=0,s=t.length;s>o;o++)i=Math.max(i,r.distanceToSquared(t[o]));return this.radius=Math.sqrt(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return 0>=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(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e),r=t||new i.Vector3;return r.copy(e),n>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){return e=e||new i.Box3,e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},i.Frustum=function(e,t,n,r,o,s){this.planes=[void 0!==e?e:new i.Plane,void 0!==t?t:new i.Plane,void 0!==n?n:new i.Plane,void 0!==r?r:new i.Plane,void 0!==o?o:new i.Plane,void 0!==s?s:new i.Plane]},i.Frustum.prototype={constructor:i.Frustum,set:function(e,t,n,r,i,o){var s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;6>n;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements;e=n[0];var r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],u=n[6],c=n[7],h=n[8],l=n[9],p=n[10],f=n[11],d=n[12],m=n[13],v=n[14],n=n[15];return t[0].setComponents(o-e,c-s,f-h,n-d).normalize(),t[1].setComponents(o+e,c+s,f+h,n+d).normalize(),t[2].setComponents(o+r,c+a,f+l,n+m).normalize(),t[3].setComponents(o-r,c-a,f-l,n-m).normalize(),t[4].setComponents(o-i,c-u,f-p,n-v).normalize(),t[5].setComponents(o+i,c+u,f+p,n+v).normalize(),this},intersectsObject:function(){var e=new i.Sphere;return function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),e.copy(n.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){var t=this.planes,n=e.center;e=-e.radius;for(var r=0;6>r;r++)if(t[r].distanceToPoint(n)<e)return!1;return!0},intersectsBox:function(){var e=new i.Vector3,t=new i.Vector3;return function(n){for(var r=this.planes,i=0;6>i;i++){var o=r[i];e.x=0<o.normal.x?n.min.x:n.max.x,t.x=0<o.normal.x?n.max.x:n.min.x,e.y=0<o.normal.y?n.min.y:n.max.y,t.y=0<o.normal.y?n.max.y:n.min.y,e.z=0<o.normal.z?n.min.z:n.max.z,t.z=0<o.normal.z?n.max.z:n.min.z;var s=o.distanceToPoint(e),o=o.distanceToPoint(t);if(0>s&&0>o)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;6>n;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}},i.Plane=function(e,t){this.normal=void 0!==e?e:new i.Vector3(1,0,0),this.constant=void 0!==t?t:0},i.Plane.prototype={constructor:i.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new i.Vector3,t=new i.Vector3;return function(n,r,i){return r=e.subVectors(i,r).cross(t.subVectors(n,r)).normalize(),this.setFromNormalAndCoplanarPoint(r,n),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 this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var n=this.distanceToPoint(e);return(t||new i.Vector3).copy(this.normal).multiplyScalar(n)},intersectLine:function(){var e=new i.Vector3;return function(t,n){var r=n||new i.Vector3,o=t.delta(e),s=this.normal.dot(o);return 0!==s?(s=-(t.start.dot(this.normal)+this.constant)/s,0>s||s>1?void 0:r.copy(o).multiplyScalar(s).add(t.start)):0===this.distanceToPoint(t.start)?r.copy(t.start):void 0}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start);return e=this.distanceToPoint(e.end),0>t&&e>0||0>e&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new i.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new i.Vector3,t=new i.Matrix3;return function(n,r){var i=this.coplanarPoint(e).applyMatrix4(n),o=r||t.getNormalMatrix(n),o=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(o),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},i.Spherical=function(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this},i.Spherical.prototype={constructor:i.Spherical,set:function(e,t,n){this.radius=e,this.phi=t,this.theta=n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius.copy(e.radius),this.phi.copy(e.phi),this.theta.copy(e.theta),this},makeSafe:function(){this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi))},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(i.Math.clamp(e.y/this.radius,-1,1))),this}},i.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=Array(36),r=0;return function(){for(var i=0;36>i;i++)8===i||13===i||18===i||23===i?n[i]="-":14===i?n[i]="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,n[i]=t[19===i?3&e|8:e]);return n.join("")}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},smoothstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},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*i.Math.DEG2RAD},radToDeg:function(e){return e*i.Math.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},i.Spline=function(e){function t(e,t,n,r,i,o,s){return e=.5*(n-e),r=.5*(r-t),(2*(t-n)+e+r)*s+(-3*(t-n)-2*e-r)*o+e*i+t}this.points=e;var n,r,o,s,a,u,c,h,l,p=[],f={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return n=(this.points.length-1)*e,r=Math.floor(n),o=n-r,p[0]=0===r?r:r-1,p[1]=r,p[2]=r>this.points.length-2?this.points.length-1:r+1,p[3]=r>this.points.length-3?this.points.length-1:r+2,u=this.points[p[0]],c=this.points[p[1]],h=this.points[p[2]],l=this.points[p[3]],s=o*o,a=o*s,f.x=t(u.x,c.x,h.x,l.x,o,s,a),f.y=t(u.y,c.y,h.y,l.y,o,s,a),f.z=t(u.z,c.z,h.z,l.z,o,s,a),f},this.getControlPointsArray=function(){var e,t,n=this.points.length,r=[];for(e=0;n>e;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(e){var t,n,r,o=t=t=0,s=new i.Vector3,a=new i.Vector3,u=[],c=0;for(u[0]=0,e||(e=100),n=this.points.length*e,s.copy(this.points[0]),e=1;n>e;e++)t=e/n,r=this.getPoint(t),a.copy(r),c+=a.distanceTo(s),s.copy(r),t*=this.points.length-1,t=Math.floor(t),t!==o&&(u[t]=c,o=t);return u[u.length]=c,{chunks:u,total:c}},this.reparametrizeByArcLength=function(e){var t,n,r,o,s,a,u=[],c=new i.Vector3,h=this.getLength();for(u.push(c.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(n=h.chunks[t]-h.chunks[t-1],a=Math.ceil(e*n/h.total),o=(t-1)/(this.points.length-1),s=t/(this.points.length-1),n=1;a-1>n;n++)r=o+1/a*n*(s-o),r=this.getPoint(r),u.push(c.copy(r).clone());u.push(c.copy(this.points[t]).clone())}this.points=u}},i.Triangle=function(e,t,n){this.a=void 0!==e?e:new i.Vector3,this.b=void 0!==t?t:new i.Vector3,this.c=void 0!==n?n:new i.Vector3},i.Triangle.normal=function(){var e=new i.Vector3;return function(t,n,r,o){return o=o||new i.Vector3,o.subVectors(r,n),e.subVectors(t,n),o.cross(e),t=o.lengthSq(),t>0?o.multiplyScalar(1/Math.sqrt(t)):o.set(0,0,0)}}(),i.Triangle.barycoordFromPoint=function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Vector3;return function(r,o,s,a,u){e.subVectors(a,o),t.subVectors(s,o),n.subVectors(r,o),r=e.dot(e),o=e.dot(t),s=e.dot(n);var c=t.dot(t);a=t.dot(n);var h=r*c-o*o;return u=u||new i.Vector3,0===h?u.set(-2,-1,-1):(h=1/h,c=(c*s-o*a)*h,r=(r*a-o*s)*h,u.set(1-c-r,r,c))}}(),i.Triangle.containsPoint=function(){var e=new i.Vector3;return function(t,n,r,o){return t=i.Triangle.barycoordFromPoint(t,n,r,o,e),0<=t.x&&0<=t.y&&1>=t.x+t.y}}(),i.Triangle.prototype={constructor:i.Triangle,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),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 i.Vector3,t=new i.Vector3;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 i.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return i.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new i.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return i.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return i.Triangle.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,n,r;return function(o,s){void 0===e&&(e=new i.Plane,t=[new i.Line3,new i.Line3,new i.Line3],n=new i.Vector3,r=new i.Vector3);var a=s||new i.Vector3,u=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(o,n),!0===this.containsPoint(n))a.copy(n);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var c=0;c<t.length;c++){t[c].closestPointToPoint(n,!0,r);var h=n.distanceToSquared(r);u>h&&(u=h,a.copy(r))}}return a}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},i.Interpolant=function(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n},i.Interpolant.prototype={constructor:i.Interpolant,evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{n:{r:if(!(r>e)){for(var o=n+2;;){if(void 0===r){if(i>e)break r;return this._cachedIndex=n=t.length,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],r>e)break t}r=t.length;break n}if(e>=i)break e;for(o=t[1],o>e&&(n=2,i=o),o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}r=n,n=0}for(;r>n;)i=n+r>>>1,e<t[i]?r=i:n=i+1;if(r=t[n],i=t[n-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return this._cachedIndex=n=t.length,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize;e*=r;for(var i=0;i!==r;++i)t[i]=n[e+i];return t},interpolate_:function(e,t,n,r){throw Error("call to abstract method")},intervalChanged_:function(e,t,n){}},Object.assign(i.Interpolant.prototype,{beforeStart_:i.Interpolant.prototype.copySampleValue_,afterEnd_:i.Interpolant.prototype.copySampleValue_}),i.CubicInterpolant=function(e,t,n,r){i.Interpolant.call(this,e,t,n,r),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0},i.CubicInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.CubicInterpolant,DefaultSettings_:{endingStart:i.ZeroCurvatureEnding,endingEnd:i.ZeroCurvatureEnding},intervalChanged_:function(e,t,n){var r=this.parameterPositions,o=e-2,s=e+1,a=r[o],u=r[s];if(void 0===a)switch(this.getSettings_().endingStart){case i.ZeroSlopeEnding:o=e,a=2*t-n;break;case i.WrapAroundEnding:o=r.length-2,a=t+r[o]-r[o+1];break;default:o=e,a=n}if(void 0===u)switch(this.getSettings_().endingEnd){case i.ZeroSlopeEnding:s=e,u=2*n-t;break;case i.WrapAroundEnding:s=1,u=n+r[1]-r[0];break;default:s=e-1,u=t}e=.5*(n-t),r=this.valueSize,this._weightPrev=e/(t-a),this._weightNext=e/(u-n),this._offsetPrev=o*r,this._offsetNext=s*r},interpolate_:function(e,t,n,r){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize;e*=s;var a=e-s,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,l=this._weightNext,p=(n-t)/(r-t);for(n=p*p,r=n*p,t=-h*r+2*h*n-h*p,h=(1+h)*r+(-1.5-2*h)*n+(-.5+h)*p+1,p=(-1-l)*r+(1.5+l)*n+.5*p,l=l*r-l*n,n=0;n!==s;++n)i[n]=t*o[u+n]+h*o[a+n]+p*o[e+n]+l*o[c+n];return i}}),i.DiscreteInterpolant=function(e,t,n,r){i.Interpolant.call(this,e,t,n,r)},i.DiscreteInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.DiscreteInterpolant,interpolate_:function(e,t,n,r){return this.copySampleValue_(e-1)}}),i.LinearInterpolant=function(e,t,n,r){i.Interpolant.call(this,e,t,n,r)},i.LinearInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.LinearInterpolant,interpolate_:function(e,t,n,r){var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize;e*=s;var a=e-s;for(t=(n-t)/(r-t),n=1-t,r=0;r!==s;++r)i[r]=o[a+r]*n+o[e+r]*t;return i}}),i.QuaternionLinearInterpolant=function(e,t,n,r){i.Interpolant.call(this,e,t,n,r)},i.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.QuaternionLinearInterpolant,interpolate_:function(e,t,n,r){var o=this.resultBuffer,s=this.sampleValues,a=this.valueSize;for(e*=a,t=(n-t)/(r-t),n=e+a;e!==n;e+=4)i.Quaternion.slerpFlat(o,0,s,e-a,s,e,t);return o}}),i.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},i.Clock.prototype={constructor:i.Clock,start:function(){this.oldTime=this.startTime=(performance||Date).now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=(performance||Date).now(),e=(t-this.oldTime)/1e3;this.oldTime=t,this.elapsedTime+=e}return e}},i.EventDispatcher=function(){},i.EventDispatcher.prototype={constructor:i.EventDispatcher,apply:function(e){e.addEventListener=i.EventDispatcher.prototype.addEventListener,e.hasEventListener=i.EventDispatcher.prototype.hasEventListener,e.removeEventListener=i.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=i.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=[],r=t.length,i=0;r>i;i++)n[i]=t[i];for(i=0;r>i;i++)n[i].call(this,e)}}}},i.Layers=function(){this.mask=1},i.Layers.prototype={constructor:i.Layers,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}},function(e){function t(e,t){return e.distance-t.distance}function n(e,t,r,i){if(!1!==e.visible&&(e.raycast(t,r),!0===i)){e=e.children,i=0;for(var o=e.length;o>i;i++)n(e[i],t,r,!0)}}e.Raycaster=function(t,n,r,i){this.ray=new e.Ray(t,n),this.near=r||0,this.far=i||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}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,n){n instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(n).sub(this.ray.origin).normalize()):n instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,r){var i=[];return n(e,this,i,r),i.sort(t),i},intersectObjects:function(e,r){var i=[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var o=0,s=e.length;s>o;o++)n(e[o],this,i,r);return i.sort(t),i}}}(i),i.Object3D=function(){Object.defineProperty(this,"id",{value:i.Object3DIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.Object3D.DefaultUp.clone();var e=new i.Vector3,t=new i.Euler,n=new i.Quaternion,r=new i.Vector3(1,1,1);t.onChange(function(){n.setFromEuler(t,!1)}),n.onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:r},modelViewMatrix:{value:new i.Matrix4},normalMatrix:{value:new i.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new i.Matrix4,this.matrixWorld=new i.Matrix4,this.matrixAutoUpdate=i.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new i.Layers,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},i.Object3D.DefaultUp=new i.Vector3(0,1,0),i.Object3D.DefaultMatrixAutoUpdate=!0,i.Object3D.prototype={constructor:i.Object3D,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new i.Quaternion;return function(t,n){return e.setFromAxisAngle(t,n),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new i.Vector3;return function(t,n){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(n)),this}}(),translateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new i.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new i.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof i.Object3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(1<arguments.length)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);t=this.children.indexOf(e),-1!==t&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(t,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;r>n;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return e=e||new i.Vector3,this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new i.Vector3,t=new i.Vector3;return function(n){return n=n||new i.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldRotation:function(){var e=new i.Quaternion;return function(t){return t=t||new i.Euler,this.getWorldQuaternion(e),t.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new i.Vector3,t=new i.Quaternion;return function(n){return n=n||new i.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new i.Quaternion;return function(t){return t=t||new i.Vector3,this.getWorldQuaternion(e),t.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;r>n;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;r>n;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==e||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,n=this.children.length;n>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t,n=[];for(t in e){var r=e[t];delete r.metadata,n.push(r)}return n}var n=void 0===e||""===e,r={};n&&(e={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),i.material=this.material.uuid),0<this.children.length){i.children=[];for(var o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(n){var n=t(e.geometries),o=t(e.materials),s=t(e.textures);e=t(e.images),0<n.length&&(r.geometries=n),0<o.length&&(r.materials=o),0<s.length&&(r.textures=s),0<e.length&&(r.images=e)}return r.object=i,r},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.rotationAutoUpdate=e.rotationAutoUpdate,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++)this.add(e.children[n].clone());return this}},i.EventDispatcher.prototype.apply(i.Object3D.prototype),i.Object3DIdCount=0,i.Face3=function(e,t,n,r,o,s){this.a=e,this.b=t,this.c=n,this.normal=r instanceof i.Vector3?r:new i.Vector3,this.vertexNormals=Array.isArray(r)?r:[],this.color=o instanceof i.Color?o:new i.Color,this.vertexColors=Array.isArray(o)?o:[],this.materialIndex=void 0!==s?s:0},i.Face3.prototype={constructor:i.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;n>t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;n>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},i.BufferAttribute=function(e,t,n){this.uuid=i.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0,this.normalized=!0===n},i.BufferAttribute.prototype={constructor:i.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;i>r;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),s=new i.Color),t[n++]=s.r,t[n++]=s.g,t[n++]=s.b}return this},copyIndicesArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;i>r;r++){var o=e[r];t[n++]=o.a,t[n++]=o.b,t[n++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),s=new i.Vector2),t[n++]=s.x,t[n++]=s.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),s=new i.Vector3),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,o=e.length;o>r;r++){var s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),s=new i.Vector4),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z,t[n++]=s.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},clone:function(){return(new this.constructor).copy(this)}},i.Int8Attribute=function(e,t){return new i.BufferAttribute(new Int8Array(e),t)},i.Uint8Attribute=function(e,t){return new i.BufferAttribute(new Uint8Array(e),t)},i.Uint8ClampedAttribute=function(e,t){return new i.BufferAttribute(new Uint8ClampedArray(e),t)},i.Int16Attribute=function(e,t){return new i.BufferAttribute(new Int16Array(e),t)},i.Uint16Attribute=function(e,t){return new i.BufferAttribute(new Uint16Array(e),t)},i.Int32Attribute=function(e,t){return new i.BufferAttribute(new Int32Array(e),t)},i.Uint32Attribute=function(e,t){return new i.BufferAttribute(new Uint32Array(e),t)},i.Float32Attribute=function(e,t){return new i.BufferAttribute(new Float32Array(e),t)},i.Float64Attribute=function(e,t){return new i.BufferAttribute(new Float64Array(e),t)},i.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new i.BufferAttribute(e,t).setDynamic(!0)},i.InstancedBufferAttribute=function(e,t,n){i.BufferAttribute.call(this,e,t),this.meshPerAttribute=n||1},i.InstancedBufferAttribute.prototype=Object.create(i.BufferAttribute.prototype),i.InstancedBufferAttribute.prototype.constructor=i.InstancedBufferAttribute,i.InstancedBufferAttribute.prototype.copy=function(e){return i.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBuffer=function(e,t){this.uuid=i.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},i.InterleavedBuffer.prototype={constructor:i.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;i>r;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},i.InstancedInterleavedBuffer=function(e,t,n){i.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=n||1},i.InstancedInterleavedBuffer.prototype=Object.create(i.InterleavedBuffer.prototype),i.InstancedInterleavedBuffer.prototype.constructor=i.InstancedInterleavedBuffer,i.InstancedInterleavedBuffer.prototype.copy=function(e){return i.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBufferAttribute=function(e,t,n){this.uuid=i.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=n},i.InterleavedBufferAttribute.prototype={constructor:i.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}},i.Geometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},i.Geometry.prototype={constructor:i.Geometry,applyMatrix:function(e){for(var t=(new i.Matrix3).getNormalMatrix(e),n=0,r=this.vertices.length;r>n;n++)this.vertices[n].applyMatrix4(e);for(n=0,r=this.faces.length;r>n;n++){e=this.faces[n],e.normal.applyMatrix3(t).normalize();for(var o=0,s=e.vertexNormals.length;s>o;o++)e.vertexNormals[o].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,r,o){var s=void 0!==a?[l[e].clone(),l[t].clone(),l[r].clone()]:[],d=void 0!==u?[n.colors[e].clone(),n.colors[t].clone(),n.colors[r].clone()]:[];o=new i.Face3(e,t,r,s,d,o),n.faces.push(o),void 0!==c&&n.faceVertexUvs[0].push([p[e].clone(),p[t].clone(),p[r].clone()]),void 0!==h&&n.faceVertexUvs[1].push([f[e].clone(),f[t].clone(),f[r].clone()])}var n=this,r=null!==e.index?e.index.array:void 0,o=e.attributes,s=o.position.array,a=void 0!==o.normal?o.normal.array:void 0,u=void 0!==o.color?o.color.array:void 0,c=void 0!==o.uv?o.uv.array:void 0,h=void 0!==o.uv2?o.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var l=[],p=[],f=[],d=o=0;o<s.length;o+=3,d+=2)n.vertices.push(new i.Vector3(s[o],s[o+1],s[o+2])),void 0!==a&&l.push(new i.Vector3(a[o],a[o+1],a[o+2])),void 0!==u&&n.colors.push(new i.Color(u[o],u[o+1],u[o+2])),void 0!==c&&p.push(new i.Vector2(c[d],c[d+1])),void 0!==h&&f.push(new i.Vector2(h[d],h[d+1]));if(void 0!==r)if(s=e.groups,0<s.length)for(o=0;o<s.length;o++)for(var m=s[o],v=m.start,g=m.count,d=v,v=v+g;v>d;d+=3)t(r[d],r[d+1],r[d+2],m.materialIndex);else for(o=0;o<r.length;o+=3)t(r[o],r[o+1],r[o+2]);else for(o=0;o<s.length/3;o+=3)t(o,o+1,o+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,t=0===t?1:1/t,n=new i.Matrix4;return n.set(t,0,0,-t*e.x,0,t,0,-t*e.y,0,0,t,-t*e.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var e=new i.Vector3,t=new i.Vector3,n=0,r=this.faces.length;r>n;n++){var o=this.faces[n],s=this.vertices[o.a],a=this.vertices[o.b];e.subVectors(this.vertices[o.c],a),t.subVectors(s,a),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,n,r;for(r=Array(this.vertices.length),t=0,n=this.vertices.length;n>t;t++)r[t]=new i.Vector3;if(e){var o,s,a,u=new i.Vector3,c=new i.Vector3;for(e=0,t=this.faces.length;t>e;e++)n=this.faces[e],o=this.vertices[n.a],s=this.vertices[n.b],a=this.vertices[n.c],u.subVectors(a,s),c.subVectors(o,s),u.cross(c),r[n.a].add(u),r[n.b].add(u),r[n.c].add(u)}else for(e=0,t=this.faces.length;t>e;e++)n=this.faces[e],r[n.a].add(n.normal),r[n.b].add(n.normal),r[n.c].add(n.normal);for(t=0,n=this.vertices.length;n>t;t++)r[t].normalize();for(e=0,t=this.faces.length;t>e;e++)n=this.faces[e],o=n.vertexNormals,3===o.length?(o[0].copy(r[n.a]),o[1].copy(r[n.b]),o[2].copy(r[n.c])):(o[0]=r[n.a].clone(),o[1]=r[n.b].clone(),o[2]=r[n.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,o;for(n=0,r=this.faces.length;r>n;n++)for(o=this.faces[n],o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),e=0,t=o.vertexNormals.length;t>e;e++)o.__originalVertexNormals[e]?o.__originalVertexNormals[e].copy(o.vertexNormals[e]):o.__originalVertexNormals[e]=o.vertexNormals[e].clone();var s=new i.Geometry;for(s.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[],o=this.morphNormals[e].faceNormals;var a,u,c=this.morphNormals[e].vertexNormals;for(n=0,r=this.faces.length;r>n;n++)a=new i.Vector3,u={a:new i.Vector3,b:new i.Vector3,c:new i.Vector3},o.push(a),c.push(u)}for(c=this.morphNormals[e],s.vertices=this.morphTargets[e].vertices,s.computeFaceNormals(),s.computeVertexNormals(),n=0,r=this.faces.length;r>n;n++)o=this.faces[n],a=c.faceNormals[n],u=c.vertexNormals[n],a.copy(o.normal),u.a.copy(o.vertexNormals[0]),u.b.copy(o.vertexNormals[1]),u.c.copy(o.vertexNormals[2])}for(n=0,r=this.faces.length;r>n;n++)o=this.faces[n],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,n=0,r=t.length;r>n;n++)n>0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new i.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!1==e instanceof i.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);else{var r,o=this.vertices.length,s=this.vertices,a=e.vertices,u=this.faces,c=e.faces,h=this.faceVertexUvs[0];e=e.faceVertexUvs[0],void 0===n&&(n=0),void 0!==t&&(r=(new i.Matrix3).getNormalMatrix(t));for(var l=0,p=a.length;p>l;l++){var f=a[l].clone();void 0!==t&&f.applyMatrix4(t),s.push(f)}for(l=0,p=c.length;p>l;l++){var d,a=c[l],m=a.vertexNormals,v=a.vertexColors,f=new i.Face3(a.a+o,a.b+o,a.c+o);for(f.normal.copy(a.normal),void 0!==r&&f.normal.applyMatrix3(r).normalize(),t=0,s=m.length;s>t;t++)d=m[t].clone(),void 0!==r&&d.applyMatrix3(r).normalize(),f.vertexNormals.push(d);for(f.color.copy(a.color),t=0,s=v.length;s>t;t++)d=v[t],f.vertexColors.push(d.clone());f.materialIndex=a.materialIndex+n,u.push(f)}for(l=0,p=e.length;p>l;l++)if(n=e[l],r=[],void 0!==n){for(t=0,s=n.length;s>t;t++)r.push(n[t].clone());h.push(r)}}},mergeMesh:function(e){!1==e instanceof i.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,n,r={},i=[],o=[],s=Math.pow(10,4);for(t=0,n=this.vertices.length;n>t;t++)e=this.vertices[t],e=Math.round(e.x*s)+"_"+Math.round(e.y*s)+"_"+Math.round(e.z*s),void 0===r[e]?(r[e]=t,i.push(this.vertices[t]),o[t]=i.length-1):o[t]=o[r[e]];for(r=[],t=0,n=this.faces.length;n>t;t++)for(s=this.faces[t],s.a=o[s.a],s.b=o[s.b],s.c=o[s.c],s=[s.a,s.b,s.c],e=0;3>e;e++)if(s[e]===s[(e+1)%3]){r.push(t);break}for(t=r.length-1;t>=0;t--)for(s=r[t],this.faces.splice(s,1),o=0,n=this.faceVertexUvs.length;n>o;o++)this.faceVertexUvs[o].splice(s,1);return t=this.vertices.length-i.length,this.vertices=i,t},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;t>n;n++)e[n]._id=n;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var r,i,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];for(o&&o.length===t&&(r=[]),s&&s.length===t&&(i=[]),n=0;t>n;n++){var a=e[n]._id;r&&r.push(o[a]),i&&i.push(s[a])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){function e(e,t,n){return n?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]?c[t]:(c[t]=u.length/3,u.push(e.x,e.y,e.z),c[t])}function n(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==l[t]?l[t]:(l[t]=h.length,h.push(e.getHex()),l[t])}function r(e){var t=e.x.toString()+e.y.toString();
|
||
return void 0!==f[t]?f[t]:(f[t]=p.length/2,p.push(e.x,e.y),f[t])}var i={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),void 0!==this.parameters){var o,s=this.parameters;for(o in s)void 0!==s[o]&&(i[o]=s[o]);return i}for(s=[],o=0;o<this.vertices.length;o++){var a=this.vertices[o];s.push(a.x,a.y,a.z)}var a=[],u=[],c={},h=[],l={},p=[],f={};for(o=0;o<this.faces.length;o++){var d=this.faces[o],m=void 0!==this.faceVertexUvs[0][o],v=0<d.normal.length(),g=0<d.vertexNormals.length,y=1!==d.color.r||1!==d.color.g||1!==d.color.b,_=0<d.vertexColors.length,b=0,b=e(b,0,0),b=e(b,1,!0),b=e(b,2,!1),b=e(b,3,m),b=e(b,4,v),b=e(b,5,g),b=e(b,6,y),b=e(b,7,_);a.push(b),a.push(d.a,d.b,d.c),a.push(d.materialIndex),m&&(m=this.faceVertexUvs[0][o],a.push(r(m[0]),r(m[1]),r(m[2]))),v&&a.push(t(d.normal)),g&&(v=d.vertexNormals,a.push(t(v[0]),t(v[1]),t(v[2]))),y&&a.push(n(d.color)),_&&(d=d.vertexColors,a.push(n(d[0]),n(d[1]),n(d[2])))}return i.data={},i.data.vertices=s,i.data.normals=u,0<h.length&&(i.data.colors=h),0<p.length&&(i.data.uvs=[p]),i.data.faces=a,i},clone:function(){return(new i.Geometry).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,n=0,r=t.length;r>n;n++)this.vertices.push(t[n].clone());for(t=e.faces,n=0,r=t.length;r>n;n++)this.faces.push(t[n].clone());for(n=0,r=e.faceVertexUvs.length;r>n;n++){t=e.faceVertexUvs[n],void 0===this.faceVertexUvs[n]&&(this.faceVertexUvs[n]=[]);for(var i=0,o=t.length;o>i;i++){for(var s=t[i],a=[],u=0,c=s.length;c>u;u++)a.push(s[u].clone());this.faceVertexUvs[n].push(a)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.Geometry.prototype),i.GeometryIdCount=0,i.DirectGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},i.DirectGeometry.prototype={constructor:i.DirectGeometry,computeBoundingBox:i.Geometry.prototype.computeBoundingBox,computeBoundingSphere:i.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){var t,n,r=[];e=e.faces;for(var i=0;i<e.length;i++){var o=e[i];o.materialIndex!==n&&(n=o.materialIndex,void 0!==t&&(t.count=3*i-t.start,r.push(t)),t={start:3*i,materialIndex:n})}void 0!==t&&(t.count=3*i-t.start,r.push(t)),this.groups=r},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,o=e.faceVertexUvs,s=o[0]&&0<o[0].length,a=o[1]&&0<o[1].length,u=e.morphTargets,c=u.length;if(c>0){t=[];for(var h=0;c>h;h++)t[h]=[];this.morphTargets.position=t}var l,p=e.morphNormals,f=p.length;if(f>0){for(l=[],h=0;f>h;h++)l[h]=[];this.morphTargets.normal=l}for(var d=e.skinIndices,m=e.skinWeights,v=d.length===r.length,g=m.length===r.length,h=0;h<n.length;h++){var y=n[h];this.vertices.push(r[y.a],r[y.b],r[y.c]);var _=y.vertexNormals;for(3===_.length?this.normals.push(_[0],_[1],_[2]):(_=y.normal,this.normals.push(_,_,_)),_=y.vertexColors,3===_.length?this.colors.push(_[0],_[1],_[2]):(_=y.color,this.colors.push(_,_,_)),!0===s&&(_=o[0][h],void 0!==_?this.uvs.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new i.Vector2,new i.Vector2,new i.Vector2))),!0===a&&(_=o[1][h],void 0!==_?this.uvs2.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new i.Vector2,new i.Vector2,new i.Vector2))),_=0;c>_;_++){var b=u[_].vertices;t[_].push(b[y.a],b[y.b],b[y.c])}for(_=0;f>_;_++)b=p[_].vertexNormals[h],l[_].push(b.a,b.b,b.c);v&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.DirectGeometry.prototype),i.BufferGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.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}},i.BufferGeometry.prototype={constructor:i.BufferGeometry,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t,n){if(!1==t instanceof i.BufferAttribute&&!1==t instanceof i.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new i.BufferAttribute(t,n));else{if("index"!==e)return this.attributes[e]=t,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)}},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;return void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0),t=this.attributes.normal,void 0!==t&&((new i.Matrix3).getNormalMatrix(e).applyToVector3Array(t.array),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,n,r){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof i.Points||e instanceof i.Line){e=new i.Float32Attribute(3*t.vertices.length,3);var n=new i.Float32Attribute(3*t.colors.length,3);this.addAttribute("position",e.copyVector3sArray(t.vertices)),this.addAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length&&(e=new i.Float32Attribute(t.lineDistances.length,1),this.addAttribute("lineDistance",e.copyArray(t.lineDistances))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof i.Mesh&&t instanceof i.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof i.Mesh){var n=t.__directGeometry;if(void 0===n)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}return!0===t.verticesNeedUpdate&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(t.vertices),n.needsUpdate=!0),t.verticesNeedUpdate=!1),!0===t.normalsNeedUpdate&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(t.normals),n.needsUpdate=!0),t.normalsNeedUpdate=!1),!0===t.colorsNeedUpdate&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(t.colors),n.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(t.uvs),n.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(t.lineDistances),n.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new i.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);this.addAttribute("position",new i.BufferAttribute(t,3).copyVector3sArray(e.vertices)),0<e.normals.length&&(t=new Float32Array(3*e.normals.length),this.addAttribute("normal",new i.BufferAttribute(t,3).copyVector3sArray(e.normals))),0<e.colors.length&&(t=new Float32Array(3*e.colors.length),this.addAttribute("color",new i.BufferAttribute(t,3).copyColorsArray(e.colors))),0<e.uvs.length&&(t=new Float32Array(2*e.uvs.length),this.addAttribute("uv",new i.BufferAttribute(t,2).copyVector2sArray(e.uvs))),0<e.uvs2.length&&(t=new Float32Array(2*e.uvs2.length),this.addAttribute("uv2",new i.BufferAttribute(t,2).copyVector2sArray(e.uvs2))),0<e.indices.length&&(t=new(65535<e.vertices.length?Uint32Array:Uint16Array)(3*e.indices.length),this.setIndex(new i.BufferAttribute(t,1).copyIndicesArray(e.indices))),this.groups=e.groups;for(var n in e.morphTargets){for(var t=[],r=e.morphTargets[n],o=0,s=r.length;s>o;o++){var a=r[o],u=new i.Float32Attribute(3*a.length,3);t.push(u.copyVector3sArray(a))}this.morphAttributes[n]=t}return 0<e.skinIndices.length&&(n=new i.Float32Attribute(4*e.skinIndices.length,4),this.addAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))),0<e.skinWeights.length&&(n=new i.Float32Attribute(4*e.skinWeights.length,4),this.addAttribute("skinWeight",n.copyVector4sArray(e.skinWeights))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new i.Box3);var e=this.attributes.position.array;void 0!==e?this.boundingBox.setFromArray(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var e=new i.Box3,t=new i.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere);var n=this.attributes.position.array;if(n){var r=this.boundingSphere.center;e.setFromArray(n),e.center(r);for(var o=0,s=0,a=n.length;a>s;s+=3)t.fromArray(n,s),o=Math.max(o,r.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,n=this.groups;if(t.position){var r=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new i.BufferAttribute(new Float32Array(r.length),3));else for(var o=t.normal.array,s=0,a=o.length;a>s;s++)o[s]=0;var u,c,h,o=t.normal.array,l=new i.Vector3,p=new i.Vector3,f=new i.Vector3,d=new i.Vector3,m=new i.Vector3;if(e){e=e.array,0===n.length&&this.addGroup(0,e.length);for(var v=0,g=n.length;g>v;++v)for(s=n[v],a=s.start,u=s.count,s=a,a+=u;a>s;s+=3)u=3*e[s+0],c=3*e[s+1],h=3*e[s+2],l.fromArray(r,u),p.fromArray(r,c),f.fromArray(r,h),d.subVectors(f,p),m.subVectors(l,p),d.cross(m),o[u]+=d.x,o[u+1]+=d.y,o[u+2]+=d.z,o[c]+=d.x,o[c+1]+=d.y,o[c+2]+=d.z,o[h]+=d.x,o[h+1]+=d.y,o[h+2]+=d.z}else for(s=0,a=r.length;a>s;s+=9)l.fromArray(r,s),p.fromArray(r,s+3),f.fromArray(r,s+6),d.subVectors(f,p),m.subVectors(l,p),d.cross(m),o[s]=d.x,o[s+1]=d.y,o[s+2]=d.z,o[s+3]=d.x,o[s+4]=d.y,o[s+5]=d.z,o[s+6]=d.x,o[s+7]=d.y,o[s+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!1!=e instanceof i.BufferGeometry){void 0===t&&(t=0);var n,r=this.attributes;for(n in r)if(void 0!==e.attributes[n])for(var o=r[n].array,s=e.attributes[n],a=s.array,u=0,s=s.itemSize*t;u<a.length;u++,s++)o[s]=a[u];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e,t,n,r=this.attributes.normal.array,i=0,o=r.length;o>i;i+=3)e=r[i],t=r[i+1],n=r[i+2],e=1/Math.sqrt(e*e+t*t+n*n),r[i]*=e,r[i+1]*=e,r[i+2]*=e},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e,t=new i.BufferGeometry,n=this.index.array,r=this.attributes;for(e in r){for(var o=r[e],s=o.array,o=o.itemSize,a=new s.constructor(n.length*o),u=0,c=0,h=0,l=n.length;l>h;h++)for(var u=n[h]*o,p=0;o>p;p++)a[c++]=s[u++];t.addAttribute(e,new i.BufferAttribute(a,o))}return t},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t,n=this.parameters;for(t in n)void 0!==n[t]&&(e[t]=n[t]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(n=Array.prototype.slice.call(r.array),e.data.index={type:r.array.constructor.name,array:n}),r=this.attributes;for(t in r){var i=r[t],n=Array.prototype.slice.call(i.array);e.data.attributes[t]={itemSize:i.itemSize,type:i.array.constructor.name,array:n,normalized:i.normalized}}return t=this.groups,0<t.length&&(e.data.groups=JSON.parse(JSON.stringify(t))),t=this.boundingSphere,null!==t&&(e.data.boundingSphere={center:t.center.toArray(),radius:t.radius}),e},clone:function(){return(new i.BufferGeometry).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var n,t=e.attributes;for(n in t)this.addAttribute(n,t[n].clone());for(e=e.groups,n=0,t=e.length;t>n;n++){var r=e[n];this.addGroup(r.start,r.count,r.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.BufferGeometry.prototype),i.BufferGeometry.MaxIndex=65535,i.InstancedBufferGeometry=function(){i.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},i.InstancedBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.InstancedBufferGeometry.prototype.constructor=i.InstancedBufferGeometry,i.InstancedBufferGeometry.prototype.addGroup=function(e,t,n){this.groups.push({start:e,count:t,instances:n})},i.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var n,t=e.attributes;for(n in t)this.addAttribute(n,t[n].clone());for(e=e.groups,n=0,t=e.length;t>n;n++){var r=e[n];this.addGroup(r.start,r.count,r.instances)}return this},i.EventDispatcher.prototype.apply(i.InstancedBufferGeometry.prototype),i.Uniform=function(e,t){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=t),this.value=e,this.dynamic=!1},i.Uniform.prototype={constructor:i.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},i.AnimationClip=function(e,t,n){this.name=e||i.Math.generateUUID(),this.tracks=n,this.duration=void 0!==t?t:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},i.AnimationClip.prototype={constructor:i.AnimationClip,resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t)var r=this.tracks[t],e=Math.max(e,r.times[r.times.length-1]);this.duration=e},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(i.AnimationClip,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),o=0,s=n.length;o!==s;++o)t.push(i.KeyframeTrack.parse(n[o]).scale(r));return new i.AnimationClip(e.name,e.duration,t)},toJSON:function(e){var t=[],n=e.tracks;e={name:e.name,duration:e.duration,tracks:t};for(var r=0,o=n.length;r!==o;++r)t.push(i.KeyframeTrack.toJSON(n[r]));return e},CreateFromMorphTargetSequence:function(e,t,n,r){for(var o=t.length,s=[],a=0;o>a;a++){var u=[],c=[];u.push((a+o-1)%o,a,(a+1)%o),c.push(0,1,0);var h=i.AnimationUtils.getKeyframeOrder(u),u=i.AnimationUtils.sortedArray(u,1,h),c=i.AnimationUtils.sortedArray(c,1,h);r||0!==u[0]||(u.push(o),c.push(c[0])),s.push(new i.NumberKeyframeTrack(".morphTargetInfluences["+t[a].name+"]",u,c).scale(1/n))}return new i.AnimationClip(e,-1,s)},findByName:function(e,t){for(var n=0;n<e.length;n++)if(e[n].name===t)return e[n];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},o=/^([\w-]*?)([\d]+)$/,s=0,a=e.length;a>s;s++){var u=e[s],c=u.name.match(o);if(c&&1<c.length){var h=c[1];(c=r[h])||(r[h]=c=[]),c.push(u)}}e=[];for(h in r)e.push(i.AnimationClip.CreateFromMorphTargetSequence(h,r[h],t,n));return e},parseAnimation:function(e,t,n){if(!e)return console.error(" no animation in JSONLoader data"),null;n=function(e,t,n,r,o){if(0!==n.length){var s=[],a=[];i.AnimationUtils.flattenJSON(n,s,a,r),0!==s.length&&o.push(new e(t,s,a))}};var r=[],o=e.name||"default",s=e.length||-1,a=e.fps||30;e=e.hierarchy||[];for(var u=0;u<e.length;u++){var c=e[u].keys;if(c&&0!=c.length)if(c[0].morphTargets){for(var s={},h=0;h<c.length;h++)if(c[h].morphTargets)for(var l=0;l<c[h].morphTargets.length;l++)s[c[h].morphTargets[l]]=-1;for(var p in s){for(var f=[],d=[],l=0;l!==c[h].morphTargets.length;++l){var m=c[h];f.push(m.time),d.push(m.morphTarget===p?1:0)}r.push(new i.NumberKeyframeTrack(".morphTargetInfluence["+p+"]",f,d))}s=s.length*(a||1)}else h=".bones["+t[u].name+"]",n(i.VectorKeyframeTrack,h+".position",c,"pos",r),n(i.QuaternionKeyframeTrack,h+".quaternion",c,"rot",r),n(i.VectorKeyframeTrack,h+".scale",c,"scl",r)}return 0===r.length?null:new i.AnimationClip(o,s,r)}}),i.AnimationMixer=function(e){this._root=e,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1},i.AnimationMixer.prototype={constructor:i.AnimationMixer,clipAction:function(e,t){var n,r=(t||this._root).uuid,o="string"==typeof e?e:e.name,s=e!==o?e:null,a=this._actionsByClip[o];if(void 0!==a){if(n=a.actionByRoot[r],void 0!==n)return n;if(n=a.knownActions[0],s=n._clip,e!==o&&e!==s)throw Error("Different clips with the same name detected!")}return null===s?null:(a=new i.AnimationMixer._Action(this,s,t),this._bindAction(a,n),this._addInactiveAction(a,o,r),a)},existingAction:function(e,t){var n=(t||this._root).uuid,r=this._actionsByClip["string"==typeof e?e:e.name];return void 0!==r?r.actionByRoot[n]||null:null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions,n=this._bindings,r=this._nActiveBindings,i=this._nActiveBindings=this._nActiveActions=0;i!==t;++i)e[i].reset();for(i=0;i!==r;++i)n[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1,s=0;s!==n;++s){var a=t[s];a.enabled&&a._update(r,e,i,o)}for(e=this._bindings,t=this._nActiveBindings,s=0;s!==t;++s)e[s].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions;e=e.name;var n=this._actionsByClip,r=n[e];if(void 0!==r){for(var r=r.knownActions,i=0,o=r.length;i!==o;++i){var s=r[i];this._deactivateAction(s);var a=s._cacheIndex,u=t[t.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,u._cacheIndex=a,t[a]=u,t.pop(),this._removeInactiveBindingsForAction(s)}delete n[e]}},uncacheRoot:function(e){e=e.uuid;var t,n=this._actionsByClip;for(t in n){var r=n[t].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}if(t=this._bindingsByRootAndName[e],void 0!==t)for(var i in t)e=t[i],e.restoreOriginalState(),this._removeInactiveBinding(e)},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},i.EventDispatcher.prototype.apply(i.AnimationMixer.prototype),i.AnimationMixer._Action=function(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null,e=t.tracks,t=e.length,n=Array(t);for(var r={endingStart:i.ZeroCurvatureEnding,endingEnd:i.ZeroCurvatureEnding},o=0;o!==t;++o){var s=e[o].createInterpolant(null);n[o]=s,s.settings=r}this._interpolantSettings=r,this._interpolants=n,this._propertyBindings=Array(t),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=i.LoopRepeat,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},i.AnimationMixer._Action.prototype={constructor:i.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){n=this._clip.duration;var r=e._clip.duration,i=n/r;e.warp(1,r/n,t),this.warp(i,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._currentTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,o=this._timeScaleInterpolant,s=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=r._lendControlInterpolant()),r=o.parameterPositions,o=o.sampleValues,r[0]=i,r[1]=i+n,o[0]=e/s,o[1]=t/s,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){var i=this._startTime;if(null!==i){if(t=(e-i)*n,0>t||0===n)return;this._startTime=null,t*=n}if(t*=this._updateTimeScale(e),n=this._updateTime(t),e=this._updateWeight(e),e>0){t=this._interpolants;for(var i=this._propertyBindings,o=0,s=t.length;o!==s;++o)t[o].evaluate(n),i[o].accumulate(r,e)}},_updateWeight:function(e){var t=0;if(this.enabled){var t=this.weight,n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0],t=t*r;e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){var t=this.timeScale,n=this._timeScaleInterpolant;if(null!==n){var r=n.evaluate(e)[0],t=t*r;e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.pause=!0:this.timeScale=t)}}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,r=this.loop,o=this._loopCount,s=!1;switch(r){case i.LoopOnce:if(-1===o&&(this.loopCount=0,this._setEndings(!0,!0,!1)),t>=n)t=n;else{if(!(0>t))break;t=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1});break;case i.LoopPingPong:s=!0;case i.LoopRepeat:if(-1===o&&(e>0?(o=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),t>=n||0>t){var a=Math.floor(t/n),t=t-n*a,o=o+Math.abs(a),u=this.repetitions-o;if(0>u){this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});break}0===u?(e=0>e,this._setEndings(e,!e,s)):this._setEndings(!1,!1,s),this._loopCount=o,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}if(r===i.LoopPingPong&&1===(1&o))return this.time=t,n-t}return this.time=t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=i.ZeroSlopeEnding,r.endingEnd=i.ZeroSlopeEnding):(r.endingStart=e?this.zeroSlopeAtStart?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:i.WrapAroundEnding,r.endingEnd=t?this.zeroSlopeAtEnd?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:i.WrapAroundEnding)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=r._lendControlInterpolant()),r=o.parameterPositions,o=o.sampleValues,r[0]=i,o[0]=t,r[1]=i+e,o[1]=n,this}},Object.assign(i.AnimationMixer.prototype,{_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,o=r.length,s=e._propertyBindings,a=e._interpolants,u=n.uuid,c=this._bindingsByRootAndName,h=c[u];for(void 0===h&&(h={},c[u]=h),c=0;c!==o;++c){var l=r[c],p=l.name,f=h[p];if(void 0===f){if(f=s[c],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,u,p));continue}f=new i.PropertyMixer(i.PropertyBinding.create(n,p,t&&t._propertyBindings[c].binding.parsedPath),l.ValueTypeName,l.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,u,p)}s[c]=f,a[c].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.name,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];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 e=e._cacheIndex,null!==e&&e<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,o=i[t];void 0===o?(o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o):(t=o.knownActions,e._byClipCacheIndex=t.length,t.push(e)),e._cacheIndex=r.length,r.push(e),o.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var n=e._clip.name,r=this._actionsByClip,i=r[n],o=i.knownActions,s=o[o.length-1],a=e._byClipCacheIndex;s._byClipCacheIndex=a,o[a]=s,o.pop(),e._byClipCacheIndex=null,delete i.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete r[n],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){e=e._propertyBindings;for(var t=0,n=e.length;t!==n;++t){var r=e[t];0===--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],o=this._bindings;void 0===i&&(i={},r[t]=i),i[n]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,n=n.path,i=this._bindingsByRootAndName,o=i[r],s=t[t.length-1];e=e._cacheIndex,s._cacheIndex=e,t[e]=s,t.pop(),delete o[n];e:{for(var a in o)break e;delete i[r]}},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&(n=new i.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1)}),i.AnimationObjectGroup=function(e){this.uuid=i.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var o=this;this.stats={objects:{get total(){return o._objects.length},get inUse(){return this.total-o.nCachedObjects_}},get bindingsPerObject(){return o._bindings.length}}},i.AnimationObjectGroup.prototype={constructor:i.AnimationObjectGroup,add:function(e){for(var t=this._objects,n=t.length,r=this.nCachedObjects_,o=this._indicesByUUID,s=this._paths,a=this._parsedPaths,u=this._bindings,c=u.length,h=0,l=arguments.length;h!==l;++h){var p=arguments[h],f=p.uuid,d=o[f];if(void 0===d){d=n++,o[f]=d,t.push(p);for(var f=0,m=c;f!==m;++f)u[f].push(new i.PropertyBinding(p,s[f],a[f]))}else if(r>d){var v=t[d],g=--r,m=t[g];for(o[m.uuid]=d,t[d]=m,o[f]=g,t[g]=p,f=0,m=c;f!==m;++f){var y=u[f],_=y[d];y[d]=y[g],void 0===_&&(_=new i.PropertyBinding(p,s[f],a[f])),y[g]=_}}else t[d]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=r},remove:function(e){for(var t=this._objects,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,o=i.length,s=0,a=arguments.length;s!==a;++s){var u=arguments[s],c=u.uuid,h=r[c];if(void 0!==h&&h>=n){var l=n++,p=t[l];for(r[p.uuid]=h,t[h]=p,r[c]=l,t[l]=u,u=0,c=o;u!==c;++u){var p=i[u],f=p[h];p[h]=p[l],p[l]=f}}}this.nCachedObjects_=n},uncache:function(e){
|
||
for(var t=this._objects,n=t.length,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,s=o.length,a=0,u=arguments.length;a!==u;++a){var c=arguments[a].uuid,h=i[c];if(void 0!==h)if(delete i[c],r>h){var c=--r,l=t[c],p=--n,f=t[p];for(i[l.uuid]=h,t[h]=l,i[f.uuid]=c,t[c]=f,t.pop(),l=0,f=s;l!==f;++l){var d=o[l],m=d[p];d[h]=d[c],d[c]=m,d.pop()}}else for(p=--n,f=t[p],i[f.uuid]=h,t[h]=f,t.pop(),l=0,f=s;l!==f;++l)d=o[l],d[h]=d[p],d.pop()}this.nCachedObjects_=r},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],o=this._bindings;if(void 0!==r)return o[r];var s=this._paths,a=this._parsedPaths,u=this._objects,c=this.nCachedObjects_,h=Array(u.length),r=o.length;for(n[e]=r,s.push(e),a.push(t),o.push(h),n=c,r=u.length;n!==r;++n)h[n]=new i.PropertyBinding(u[n],e,t);return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];t[e[s]]=n,o[n]=a,o.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}},i.AnimationUtils={arraySlice:function(e,t,n){return i.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=Array(t),r=0;r!==t;++r)n[r]=r;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),o=0,s=0;s!==r;++o)for(var a=n[o]*t,u=0;u!==t;++u)i[s++]=e[a+u];return i},flattenJSON:function(e,t,n,r){for(var i=1,o=e[0];void 0!==o&&void 0===o[r];)o=e[i++];if(void 0!==o){var s=o[r];if(void 0!==s)if(Array.isArray(s)){do s=o[r],void 0!==s&&(t.push(o.time),n.push.apply(n,s)),o=e[i++];while(void 0!==o)}else if(void 0!==s.toArray){do s=o[r],void 0!==s&&(t.push(o.time),s.toArray(n,n.length)),o=e[i++];while(void 0!==o)}else do s=o[r],void 0!==s&&(t.push(o.time),n.push(s)),o=e[i++];while(void 0!==o)}}},i.KeyframeTrack=function(e,t,n,r){if(void 0===e)throw Error("track name is undefined");if(void 0===t||0===t.length)throw Error("no keyframes in track named "+e);this.name=e,this.times=i.AnimationUtils.convertArray(t,this.TimeBufferType),this.values=i.AnimationUtils.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()},i.KeyframeTrack.prototype={constructor:i.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(e){return new i.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new i.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new i.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t=void 0;switch(e){case i.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case i.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case i.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){if(t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw Error(t);this.setInterpolation(this.DefaultInterpolation)}console.warn(t)}else this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return i.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return i.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return i.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,o=0,s=r-1;o!==r&&n[o]<e;)++o;for(;-1!==s&&n[s]>t;)--s;return++s,0===o&&s===r||(o>=s&&(s=Math.max(s,1),o=s-1),r=this.getValueSize(),this.times=i.AnimationUtils.arraySlice(n,o,s),this.values=i.AnimationUtils.arraySlice(this.values,o*r,s*r)),this},validate:function(){var e=!0,t=this.getValueSize();0!==t-Math.floor(t)&&(console.error("invalid value size in track",this),e=!1);var n=this.times,t=this.values,r=n.length;0===r&&(console.error("track is empty",this),e=!1);for(var o=null,s=0;s!==r;s++){var a=n[s];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,s,a),e=!1;break}if(null!==o&&o>a){console.error("out of order keys",this,s,a,o),e=!1;break}o=a}if(void 0!==t&&i.AnimationUtils.isTypedArray(t))for(s=0,n=t.length;s!==n;++s)if(r=t[s],isNaN(r)){console.error("value is not a valid number",this,s,r),e=!1;break}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=1,o=1,s=e.length-1;s>=o;++o){var a=!1,u=e[o];if(u!==e[o+1]&&(1!==o||u!==u[0]))for(var c=o*n,h=c-n,l=c+n,u=0;u!==n;++u){var p=t[c+u];if(p!==t[h+u]||p!==t[l+u]){a=!0;break}}if(a){if(o!==r)for(e[r]=e[o],a=o*n,c=r*n,u=0;u!==n;++u)t[c+u]=t[a+u];++r}}return r!==e.length&&(this.times=i.AnimationUtils.arraySlice(e,0,r),this.values=i.AnimationUtils.arraySlice(t,0,r*n)),this}},Object.assign(i.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw Error("track type undefined, can not parse");var t=i.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){console.warn("legacy JSON format detected, converting");var n=[],r=[];i.AnimationUtils.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t=e.constructor;if(void 0!==t.toJSON)t=t.toJSON(e);else{var t={name:e.name,times:i.AnimationUtils.convertArray(e.times,Array),values:i.AnimationUtils.convertArray(e.values,Array)},n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return i.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return i.VectorKeyframeTrack;case"color":return i.ColorKeyframeTrack;case"quaternion":return i.QuaternionKeyframeTrack;case"bool":case"boolean":return i.BooleanKeyframeTrack;case"string":return i.StringKeyframeTrack}throw Error("Unsupported typeName: "+e)}}),i.PropertyBinding=function(e,t,n){this.path=t,this.parsedPath=n||i.PropertyBinding.parseTrackName(t),this.node=i.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},i.PropertyBinding.prototype={constructor:i.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,o=t.propertyIndex;if(e||(this.node=e=i.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var s=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);for(e=e.skeleton.bones,n=0;n<e.length;n++)if(e[n].name===s){s=n;break}break;default:if(void 0===e[n])return void console.error(" can not bind to objectName of node, undefined",this);e=e[n]}if(void 0!==s){if(void 0===e[s])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[s]}}if(s=e[r]){if(t=this.Versioning.None,void 0!==e.needsUpdate?(t=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(t=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e),n=this.BindingType.Direct,void 0!==o){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(n=0;n<this.node.geometry.morphTargets.length;n++)if(e.geometry.morphTargets[n].name===o){o=n;break}}n=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=o}else void 0!==s.fromArray&&void 0!==s.toArray?(n=this.BindingType.HasFromToArray,this.resolvedProperty=s):void 0!==s.length?(n=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[n],this.setValue=this.SetterByBindingTypeAndVersioning[n][t]}else console.error(" trying to update property for track: "+t.nodeName+"."+r+" but it wasn't found.",e)}else console.error(" trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(i.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:i.PropertyBinding.prototype.getValue,_setValue_unbound:i.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),i.PropertyBinding.Composite=function(e,t,n){n=n||i.PropertyBinding.parseTrackName(t),this._targetGroup=e,this._bindings=e.subscribe_(t,n)},i.PropertyBinding.Composite.prototype={constructor:i.PropertyBinding.Composite,getValue:function(e,t){this.bind();var n=this._bindings[this._targetGroup.nCachedObjects_];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},i.PropertyBinding.create=function(e,t,n){return e instanceof i.AnimationObjectGroup?new i.PropertyBinding.Composite(e,t,n):new i.PropertyBinding(e,t,n)},i.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_.:\- ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,n=t.exec(e);if(!n)throw Error("cannot parse trackName at all: "+e);if(n.index===t.lastIndex&&t.lastIndex++,t={nodeName:n[3],objectName:n[5],objectIndex:n[7],propertyName:n[9],propertyIndex:n[11]},null===t.propertyName||0===t.propertyName.length)throw Error("can not parse propertyName from trackName: "+e);return t},i.PropertyBinding.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=function(e){for(var n=0;n<e.bones.length;n++){var r=e.bones[n];if(r.name===t)return r}return null}(e.skeleton);if(n)return n}if(e.children){var r=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i.name===t||i.uuid===t||(i=r(i.children)))return i}return null};if(n=r(e.children))return n}return null},i.PropertyMixer=function(e,t,n){switch(this.binding=e,this.valueSize=n,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*n),this._mixBufferRegion=t,this.referenceCount=this.useCount=this.cumulativeWeight=0},i.PropertyMixer.prototype={constructor:i.PropertyMixer,accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,o=this.cumulativeWeight;if(0===o){for(o=0;o!==r;++o)n[i+o]=n[o];o=t}else o+=t,this._mixBufferRegion(n,i,0,t/o,r);this.cumulativeWeight=o},apply:function(e){var t=this.valueSize,n=this.buffer;e=e*t+t;var r=this.cumulativeWeight,i=this.binding;this.cumulativeWeight=0,1>r&&this._mixBufferRegion(n,e,3*t,1-r,t);for(var r=t,o=t+t;r!==o;++r)if(n[r]!==n[r+t]){i.setValue(n,e);break}},saveOriginalState:function(){var e=this.buffer,t=this.valueSize,n=3*t;this.binding.getValue(e,n);for(var r=t;r!==n;++r)e[r]=e[n+r%t];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(e,t,n,r,i){if(r>=.5)for(r=0;r!==i;++r)e[t+r]=e[n+r]},_slerp:function(e,t,n,r,o){i.Quaternion.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var o=1-r,s=0;s!==i;++s){var a=t+s;e[a]=e[a]*o+e[n+s]*r}}},i.BooleanKeyframeTrack=function(e,t,n){i.KeyframeTrack.call(this,e,t,n)},i.BooleanKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:i.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.ColorKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.ColorKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.ColorKeyframeTrack,ValueTypeName:"color"}),i.NumberKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.NumberKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.NumberKeyframeTrack,ValueTypeName:"number"}),i.QuaternionKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new i.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),i.StringKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.StringKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:i.InterpolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.VectorKeyframeTrack=function(e,t,n,r){i.KeyframeTrack.call(this,e,t,n,r)},i.VectorKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.VectorKeyframeTrack,ValueTypeName:"vector"}),i.Audio=function(e){i.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},i.Audio.prototype=Object.create(i.Object3D.prototype),i.Audio.prototype.constructor=i.Audio,i.Audio.prototype.getOutput=function(){return this.gain},i.Audio.prototype.setNodeSource=function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},i.Audio.prototype.setBuffer=function(e){return this.source.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},i.Audio.prototype.play=function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,this.connect()}},i.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)},i.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)},i.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},i.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},i.Audio.prototype.getFilter=function(){return this.filter},i.Audio.prototype.setFilter=function(e){void 0===e&&(e=null),!0===this.isPlaying?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},i.Audio.prototype.setPlaybackRate=function(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))},i.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},i.Audio.prototype.onEnded=function(){this.isPlaying=!1},i.Audio.prototype.setLoop=function(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=e},i.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},i.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},i.Audio.prototype.getVolume=function(){return this.gain.gain.value},i.AudioAnalyser=function(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)},i.AudioAnalyser.prototype={constructor:i.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},Object.defineProperty(i,"AudioContext",{get:function(){var e;return function(){return void 0===e&&(e=new(window.AudioContext||window.webkitAudioContext)),e}}()}),i.PositionalAudio=function(e){i.Audio.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},i.PositionalAudio.prototype=Object.create(i.Audio.prototype),i.PositionalAudio.prototype.constructor=i.PositionalAudio,i.PositionalAudio.prototype.getOutput=function(){return this.panner},i.PositionalAudio.prototype.setRefDistance=function(e){this.panner.refDistance=e},i.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},i.PositionalAudio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},i.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},i.PositionalAudio.prototype.setDistanceModel=function(e){this.panner.distanceModel=e},i.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},i.PositionalAudio.prototype.setMaxDistance=function(e){this.panner.maxDistance=e},i.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},i.PositionalAudio.prototype.updateMatrixWorld=function(){var e=new i.Vector3;return function(t){i.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),i.AudioListener=function(){i.Object3D.call(this),this.type="AudioListener",this.context=i.AudioContext,this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},i.AudioListener.prototype=Object.create(i.Object3D.prototype),i.AudioListener.prototype.constructor=i.AudioListener,i.AudioListener.prototype.getInput=function(){return this.gain},i.AudioListener.prototype.removeFilter=function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},i.AudioListener.prototype.setFilter=function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},i.AudioListener.prototype.getFilter=function(){return this.filter},i.AudioListener.prototype.setMasterVolume=function(e){this.gain.gain.value=e},i.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},i.AudioListener.prototype.updateMatrixWorld=function(){var e=new i.Vector3,t=new i.Quaternion,n=new i.Vector3,r=new i.Vector3;return function(o){i.Object3D.prototype.updateMatrixWorld.call(this,o),o=this.context.listener;var s=this.up;this.matrixWorld.decompose(e,t,n),r.set(0,0,-1).applyQuaternion(t),o.setPosition(e.x,e.y,e.z),o.setOrientation(r.x,r.y,r.z,s.x,s.y,s.z)}}(),i.Camera=function(){i.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new i.Matrix4,this.projectionMatrix=new i.Matrix4},i.Camera.prototype=Object.create(i.Object3D.prototype),i.Camera.prototype.constructor=i.Camera,i.Camera.prototype.getWorldDirection=function(){var e=new i.Quaternion;return function(t){return t=t||new i.Vector3,this.getWorldQuaternion(e),t.set(0,0,-1).applyQuaternion(e)}}(),i.Camera.prototype.lookAt=function(){var e=new i.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),i.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},i.Camera.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},i.CubeCamera=function(e,t,n){i.Object3D.call(this),this.type="CubeCamera";var r=new i.PerspectiveCamera(90,1,e,t);r.up.set(0,-1,0),r.lookAt(new i.Vector3(1,0,0)),this.add(r);var o=new i.PerspectiveCamera(90,1,e,t);o.up.set(0,-1,0),o.lookAt(new i.Vector3(-1,0,0)),this.add(o);var s=new i.PerspectiveCamera(90,1,e,t);s.up.set(0,0,1),s.lookAt(new i.Vector3(0,1,0)),this.add(s);var a=new i.PerspectiveCamera(90,1,e,t);a.up.set(0,0,-1),a.lookAt(new i.Vector3(0,-1,0)),this.add(a);var u=new i.PerspectiveCamera(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new i.Vector3(0,0,1)),this.add(u);var c=new i.PerspectiveCamera(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new i.Vector3(0,0,-1)),this.add(c),this.renderTarget=new i.WebGLRenderTargetCube(n,n,{format:i.RGBFormat,magFilter:i.LinearFilter,minFilter:i.LinearFilter}),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,i=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,r,n),n.activeCubeFace=1,e.render(t,o,n),n.activeCubeFace=2,e.render(t,s,n),n.activeCubeFace=3,e.render(t,a,n),n.activeCubeFace=4,e.render(t,u,n),n.texture.generateMipmaps=i,n.activeCubeFace=5,e.render(t,c,n),e.setRenderTarget(null)}},i.CubeCamera.prototype=Object.create(i.Object3D.prototype),i.CubeCamera.prototype.constructor=i.CubeCamera,i.OrthographicCamera=function(e,t,n,r,o,s){i.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=void 0!==o?o:.1,this.far=void 0!==s?s:2e3,this.updateProjectionMatrix()},i.OrthographicCamera.prototype=Object.create(i.Camera.prototype),i.OrthographicCamera.prototype.constructor=i.OrthographicCamera,i.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(n-e,n+e,r+t,r-t,this.near,this.far)},i.OrthographicCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},i.OrthographicCamera.prototype.toJSON=function(e){return e=i.Object3D.prototype.toJSON.call(this,e),e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,e},i.PerspectiveCamera=function(e,t,n,r){i.Camera.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()},i.PerspectiveCamera.prototype=Object.create(i.Camera.prototype),i.PerspectiveCamera.prototype.constructor=i.PerspectiveCamera,i.PerspectiveCamera.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},i.PerspectiveCamera.prototype.setFocalLength=function(e){e=.5*this.getFilmHeight()/e,this.fov=2*i.Math.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.getFocalLength=function(){var e=Math.tan(.5*i.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},i.PerspectiveCamera.prototype.getEffectiveFOV=function(){return 2*i.Math.RAD2DEG*Math.atan(Math.tan(.5*i.Math.DEG2RAD*this.fov)/this.zoom)},i.PerspectiveCamera.prototype.getFilmWidth=function(){return this.filmGauge*Math.min(this.aspect,1)},i.PerspectiveCamera.prototype.getFilmHeight=function(){return this.filmGauge/Math.max(this.aspect,1)},i.PerspectiveCamera.prototype.setViewOffset=function(e,t,n,r,i,o){this.aspect=e/t,this.view={fullWidth:e,fullHeight:t,offsetX:n,offsetY:r,width:i,height:o},this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=this.near,t=e*Math.tan(.5*i.Math.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,o=-.5*r,s=this.view;if(null!==s)var a=s.fullWidth,u=s.fullHeight,o=o+s.offsetX*r/a,t=t-s.offsetY*n/u,r=s.width/a*r,n=s.height/u*n;s=this.filmOffset,0!==s&&(o+=e*s/this.getFilmWidth()),this.projectionMatrix.makeFrustum(o,o+r,t-n,t,e,this.far)},i.PerspectiveCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},i.PerspectiveCamera.prototype.toJSON=function(e){return e=i.Object3D.prototype.toJSON.call(this,e),e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e},i.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new i.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new i.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},i.StereoCamera.prototype={constructor:i.StereoCamera,update:function(){var e,t,n,r,o,s=new i.Matrix4,a=new i.Matrix4;return function(u){if(e!==u.focus||t!==u.fov||n!==u.aspect*this.aspect||r!==u.near||o!==u.far){e=u.focus,t=u.fov,n=u.aspect*this.aspect,r=u.near,o=u.far;var c,h,l=u.projectionMatrix.clone(),p=.032*r/e,f=r*Math.tan(i.Math.DEG2RAD*t*.5);a.elements[12]=-.032,s.elements[12]=.032,c=-f*n+p,h=f*n+p,l.elements[0]=2*r/(h-c),l.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(l),c=-f*n-p,h=f*n-p,l.elements[0]=2*r/(h-c),l.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(u.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(u.matrixWorld).multiply(s)}}()},i.Light=function(e,t){i.Object3D.call(this),this.type="Light",this.color=new i.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},i.Light.prototype=Object.create(i.Object3D.prototype),i.Light.prototype.constructor=i.Light,i.Light.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},i.Light.prototype.toJSON=function(e){return e=i.Object3D.prototype.toJSON.call(this,e),e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),e},i.LightShadow=function(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new i.Vector2(512,512),this.map=null,this.matrix=new i.Matrix4},i.LightShadow.prototype={constructor:i.LightShadow,copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},i.AmbientLight=function(e,t){i.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},i.AmbientLight.prototype=Object.create(i.Light.prototype),i.AmbientLight.prototype.constructor=i.AmbientLight,i.DirectionalLight=function(e,t){i.Light.call(this,e,t),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.shadow=new i.DirectionalLightShadow},i.DirectionalLight.prototype=Object.create(i.Light.prototype),i.DirectionalLight.prototype.constructor=i.DirectionalLight,i.DirectionalLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.DirectionalLightShadow=function(e){i.LightShadow.call(this,new i.OrthographicCamera(-5,5,5,-5,.5,500))},i.DirectionalLightShadow.prototype=Object.create(i.LightShadow.prototype),i.DirectionalLightShadow.prototype.constructor=i.DirectionalLightShadow,i.HemisphereLight=function(e,t,n){i.Light.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new i.Color(t)},i.HemisphereLight.prototype=Object.create(i.Light.prototype),i.HemisphereLight.prototype.constructor=i.HemisphereLight,i.HemisphereLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this},i.PointLight=function(e,t,n,r){i.Light.call(this,e,t),this.type="PointLight",this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new i.LightShadow(new i.PerspectiveCamera(90,1,.5,500))},i.PointLight.prototype=Object.create(i.Light.prototype),i.PointLight.prototype.constructor=i.PointLight,Object.defineProperty(i.PointLight.prototype,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI);
|
||
}}),i.PointLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},i.SpotLight=function(e,t,n,r,o,s){i.Light.call(this,e,t),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==o?o:0,this.decay=void 0!==s?s:1,this.shadow=new i.SpotLightShadow},i.SpotLight.prototype=Object.create(i.Light.prototype),i.SpotLight.prototype.constructor=i.SpotLight,Object.defineProperty(i.SpotLight.prototype,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),i.SpotLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.SpotLightShadow=function(){i.LightShadow.call(this,new i.PerspectiveCamera(50,1,.5,500))},i.SpotLightShadow.prototype=Object.create(i.LightShadow.prototype),i.SpotLightShadow.prototype.constructor=i.SpotLightShadow,i.SpotLightShadow.prototype.update=function(e){var t=2*i.Math.RAD2DEG*e.angle,n=this.mapSize.width/this.mapSize.height;e=e.distance||500;var r=this.camera;t===r.fov&&n===r.aspect&&e===r.far||(r.fov=t,r.aspect=n,r.far=e,r.updateProjectionMatrix())},i.AudioLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.AudioLoader.prototype={constructor:i.AudioLoader,load:function(e,t,n,r){var o=new i.XHRLoader(this.manager);o.setResponseType("arraybuffer"),o.load(e,function(e){i.AudioContext.decodeAudioData(e,function(e){t(e)})},n,r)}},i.Cache={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){return!1!==this.enabled?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},i.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},i.Loader.prototype={constructor:i.Loader,crossOrigin:void 0,extractUrlBase:function(e){return e=e.split("/"),1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:function(){var e,t,n;return function(r,o,s){function a(e,n,r,a,u){e=o+e;var h=i.Loader.Handlers.get(e);return null!==h?e=h.load(e):(t.setCrossOrigin(s),e=t.load(e)),void 0!==n&&(e.repeat.fromArray(n),1!==n[0]&&(e.wrapS=i.RepeatWrapping),1!==n[1]&&(e.wrapT=i.RepeatWrapping)),void 0!==r&&e.offset.fromArray(r),void 0!==a&&("repeat"===a[0]&&(e.wrapS=i.RepeatWrapping),"mirror"===a[0]&&(e.wrapS=i.MirroredRepeatWrapping),"repeat"===a[1]&&(e.wrapT=i.RepeatWrapping),"mirror"===a[1]&&(e.wrapT=i.MirroredRepeatWrapping)),void 0!==u&&(e.anisotropy=u),n=i.Math.generateUUID(),c[n]=e,n}void 0===e&&(e=new i.Color),void 0===t&&(t=new i.TextureLoader),void 0===n&&(n=new i.MaterialLoader);var u,c={},h={uuid:i.Math.generateUUID(),type:"MeshLambertMaterial"};for(u in r){var l=r[u];switch(u){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=l;break;case"blending":h.blending=i[l];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",u,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(l).getHex();break;case"colorSpecular":h.specular=e.fromArray(l).getHex();break;case"colorEmissive":h.emissive=e.fromArray(l).getHex();break;case"specularCoef":h.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(h.type="MeshPhongMaterial");break;case"mapDiffuse":h.map=a(l,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":h.lightMap=a(l,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=a(l,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=a(l,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=a(l,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=a(l,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":h.alphaMap=a(l,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=i.BackSide;break;case"doubleSided":h.side=i.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[u]=l;break;case"vertexColors":!0===l&&(h.vertexColors=i.VertexColors),"face"===l&&(h.vertexColors=i.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",u,l)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,1>h.opacity&&(h.transparent=!0),n.setTextures(c),n.parse(h)}}()},i.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;r>n;n+=2){var i=t[n+1];if(t[n].test(e))return i}return null}},i.XHRLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.XHRLoader.prototype={constructor:i.XHRLoader,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e);var o=this,s=i.Cache.get(e);if(void 0!==s)return t&&setTimeout(function(){t(s)},0),s;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",e,!0),a.addEventListener("load",function(n){var s=n.target.response;i.Cache.add(e,s),200===this.status?(t&&t(s),o.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(s),o.manager.itemEnd(e)):(r&&r(n),o.manager.itemError(e))},!1),void 0!==n&&a.addEventListener("progress",function(e){n(e)},!1),a.addEventListener("error",function(t){r&&r(t),o.manager.itemError(e)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),o.manager.itemStart(e),a},setPath:function(e){this.path=e},setResponseType:function(e){this.responseType=e},setWithCredentials:function(e){this.withCredentials=e}},i.FontLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.FontLoader.prototype={constructor:i.FontLoader,load:function(e,t,n,r){new i.XHRLoader(this.manager).load(e,function(e){t(new i.Font(JSON.parse(e.substring(65,e.length-2))))},n,r)}},i.ImageLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.ImageLoader.prototype={constructor:i.ImageLoader,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e);var o=this,s=i.Cache.get(e);if(void 0!==s)return o.manager.itemStart(e),t?setTimeout(function(){t(s),o.manager.itemEnd(e)},0):o.manager.itemEnd(e),s;var a=document.createElement("img");return a.addEventListener("load",function(n){i.Cache.add(e,this),t&&t(this),o.manager.itemEnd(e)},!1),void 0!==n&&a.addEventListener("progress",function(e){n(e)},!1),a.addEventListener("error",function(t){r&&r(t),o.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),o.manager.itemStart(e),a.src=e,a},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:i.DefaultLoadingManager,this.withCredentials=!1},i.JSONLoader.prototype={constructor:i.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(e,t,n,r){var o=this,s=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:i.Loader.prototype.extractUrlBase(e),a=new i.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(e,function(n){n=JSON.parse(n);var r=n.metadata;if(void 0!==r&&(r=r.type,void 0!==r)){if("object"===r.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===r.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}n=o.parse(n,s),t(n.geometry,n.materials)},n,r)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){var n=new i.Geometry,r=void 0!==e.scale?1/e.scale:1;return function(t){var r,o,s,a,u,c,h,l,p,f,d,m,v,g=e.faces;c=e.vertices;var y=e.normals,_=e.colors,b=0;if(void 0!==e.uvs){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&b++;for(r=0;b>r;r++)n.faceVertexUvs[r]=[]}for(a=0,u=c.length;u>a;)r=new i.Vector3,r.x=c[a++]*t,r.y=c[a++]*t,r.z=c[a++]*t,n.vertices.push(r);for(a=0,u=g.length;u>a;)if(t=g[a++],p=1&t,s=2&t,r=8&t,h=16&t,f=32&t,c=64&t,t&=128,p){if(p=new i.Face3,p.a=g[a],p.b=g[a+1],p.c=g[a+3],d=new i.Face3,d.a=g[a+1],d.b=g[a+2],d.c=g[a+3],a+=4,s&&(s=g[a++],p.materialIndex=s,d.materialIndex=s),s=n.faces.length,r)for(r=0;b>r;r++)for(m=e.uvs[r],n.faceVertexUvs[r][s]=[],n.faceVertexUvs[r][s+1]=[],o=0;4>o;o++)l=g[a++],v=m[2*l],l=m[2*l+1],v=new i.Vector2(v,l),2!==o&&n.faceVertexUvs[r][s].push(v),0!==o&&n.faceVertexUvs[r][s+1].push(v);if(h&&(h=3*g[a++],p.normal.set(y[h++],y[h++],y[h]),d.normal.copy(p.normal)),f)for(r=0;4>r;r++)h=3*g[a++],f=new i.Vector3(y[h++],y[h++],y[h]),2!==r&&p.vertexNormals.push(f),0!==r&&d.vertexNormals.push(f);if(c&&(c=g[a++],c=_[c],p.color.setHex(c),d.color.setHex(c)),t)for(r=0;4>r;r++)c=g[a++],c=_[c],2!==r&&p.vertexColors.push(new i.Color(c)),0!==r&&d.vertexColors.push(new i.Color(c));n.faces.push(p),n.faces.push(d)}else{if(p=new i.Face3,p.a=g[a++],p.b=g[a++],p.c=g[a++],s&&(s=g[a++],p.materialIndex=s),s=n.faces.length,r)for(r=0;b>r;r++)for(m=e.uvs[r],n.faceVertexUvs[r][s]=[],o=0;3>o;o++)l=g[a++],v=m[2*l],l=m[2*l+1],v=new i.Vector2(v,l),n.faceVertexUvs[r][s].push(v);if(h&&(h=3*g[a++],p.normal.set(y[h++],y[h++],y[h])),f)for(r=0;3>r;r++)h=3*g[a++],f=new i.Vector3(y[h++],y[h++],y[h]),p.vertexNormals.push(f);if(c&&(c=g[a++],p.color.setHex(_[c])),t)for(r=0;3>r;r++)c=g[a++],p.vertexColors.push(new i.Color(_[c]));n.faces.push(p)}}(r),function(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,o=e.skinWeights.length;o>r;r+=t)n.skinWeights.push(new i.Vector4(e.skinWeights[r],t>1?e.skinWeights[r+1]:0,t>2?e.skinWeights[r+2]:0,t>3?e.skinWeights[r+3]:0));if(e.skinIndices)for(r=0,o=e.skinIndices.length;o>r;r+=t)n.skinIndices.push(new i.Vector4(e.skinIndices[r],t>1?e.skinIndices[r+1]:0,t>2?e.skinIndices[r+2]:0,t>3?e.skinIndices[r+3]:0));n.bones=e.bones,n.bones&&0<n.bones.length&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)&&console.warn("When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}(),function(t){if(void 0!==e.morphTargets)for(var r=0,o=e.morphTargets.length;o>r;r++){n.morphTargets[r]={},n.morphTargets[r].name=e.morphTargets[r].name,n.morphTargets[r].vertices=[];for(var s=n.morphTargets[r].vertices,a=e.morphTargets[r].vertices,u=0,c=a.length;c>u;u+=3){var h=new i.Vector3;h.x=a[u]*t,h.y=a[u+1]*t,h.z=a[u+2]*t,s.push(h)}}if(void 0!==e.morphColors&&0<e.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),t=n.faces,s=e.morphColors[0].colors,r=0,o=t.length;o>r;r++)t[r].color.fromArray(s,3*r)}(r),function(){var t=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var o=0;o<r.length;o++){var s=i.AnimationClip.parseAnimation(r[o],n.bones);s&&t.push(s)}n.morphTargets&&(r=i.AnimationClip.CreateClipsFromMorphTargetSequences(n.morphTargets,10),t=t.concat(r)),0<t.length&&(n.animations=t)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:n}:(r=i.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin),{geometry:n,materials:r})}},i.LoadingManager=function(e,t,n){var r=this,i=!1,o=0,s=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){s++,!1===i&&void 0!==r.onStart&&r.onStart(e,o,s),i=!0},this.itemEnd=function(e){o++,void 0!==r.onProgress&&r.onProgress(e,o,s),o===s&&(i=!1,void 0!==r.onLoad)&&r.onLoad()},this.itemError=function(e){void 0!==r.onError&&r.onError(e)}},i.DefaultLoadingManager=new i.LoadingManager,i.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.BufferGeometryLoader.prototype={constructor:i.BufferGeometryLoader,load:function(e,t,n,r){var o=this;new i.XHRLoader(o.manager).load(e,function(e){t(o.parse(JSON.parse(e)))},n,r)},parse:function(e){var t=new i.BufferGeometry,n=e.data.index,r={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==n&&(n=new r[n.type](n.array),t.setIndex(new i.BufferAttribute(n,1)));var o,s=e.data.attributes;for(o in s){var a=s[o],n=new r[a.type](a.array);t.addAttribute(o,new i.BufferAttribute(n,a.itemSize,a.normalized))}if(r=e.data.groups||e.data.drawcalls||e.data.offsets,void 0!==r)for(o=0,n=r.length;o!==n;++o)s=r[o],t.addGroup(s.start,s.count,s.materialIndex);return e=e.data.boundingSphere,void 0!==e&&(r=new i.Vector3,void 0!==e.center&&r.fromArray(e.center),t.boundingSphere=new i.Sphere(r,e.radius)),t}},i.MaterialLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this.textures={}},i.MaterialLoader.prototype={constructor:i.MaterialLoader,load:function(e,t,n,r){var o=this;new i.XHRLoader(o.manager).load(e,function(e){t(o.parse(JSON.parse(e)))},n,r)},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new i[e.type];if(void 0!==e.uuid&&(t.uuid=e.uuid),void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(t.colorWrite=e.colorWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),void 0!==e.normalScale){var n=e.normalScale;!1===Array.isArray(n)&&(n=[n,n]),t.normalScale=(new i.Vector2).fromArray(n)}if(void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(t.roughnessMap=this.getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(t.metalnessMap=this.getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(t.emissiveMap=this.getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(t.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=i.MultiplyOperation),e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var n=0,r=e.materials.length;r>n;n++)t.materials.push(this.parse(e.materials[n]));return t}},i.ObjectLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this.texturePath=""},i.ObjectLoader.prototype={constructor:i.ObjectLoader,load:function(e,t,n,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var o=this;new i.XHRLoader(o.manager).load(e,function(e){o.parse(JSON.parse(e),t)},n,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),r=this.parseImages(e.images,function(){void 0!==t&&t(i)}),r=this.parseTextures(e.textures,r),r=this.parseMaterials(e.materials,r),i=this.parseObject(e.object,n,r);return e.animations&&(i.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0===t||t(i),i},parseGeometries:function(e){var t={};if(void 0!==e)for(var n=new i.JSONLoader,r=new i.BufferGeometryLoader,o=0,s=e.length;s>o;o++){var a,u=e[o];switch(u.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new i[u.type](u.width,u.height,u.widthSegments,u.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new i[u.type](u.width,u.height,u.depth,u.widthSegments,u.heightSegments,u.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new i[u.type](u.radius,u.segments,u.thetaStart,u.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new i[u.type](u.radiusTop,u.radiusBottom,u.height,u.radialSegments,u.heightSegments,u.openEnded,u.thetaStart,u.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new i[u.type](u.radius,u.widthSegments,u.heightSegments,u.phiStart,u.phiLength,u.thetaStart,u.thetaLength);break;case"DodecahedronGeometry":a=new i.DodecahedronGeometry(u.radius,u.detail);break;case"IcosahedronGeometry":a=new i.IcosahedronGeometry(u.radius,u.detail);break;case"OctahedronGeometry":a=new i.OctahedronGeometry(u.radius,u.detail);break;case"TetrahedronGeometry":a=new i.TetrahedronGeometry(u.radius,u.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new i[u.type](u.innerRadius,u.outerRadius,u.thetaSegments,u.phiSegments,u.thetaStart,u.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new i[u.type](u.radius,u.tube,u.radialSegments,u.tubularSegments,u.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new i[u.type](u.radius,u.tube,u.tubularSegments,u.radialSegments,u.p,u.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new i[u.type](u.points,u.segments,u.phiStart,u.phiLength);break;case"BufferGeometry":a=r.parse(u);break;case"Geometry":a=n.parse(u.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+u.type+'"');continue}a.uuid=u.uuid,void 0!==u.name&&(a.name=u.name),t[u.uuid]=a}return t},parseMaterials:function(e,t){var n={};if(void 0!==e){var r=new i.MaterialLoader;r.setTextures(t);for(var o=0,s=e.length;s>o;o++){var a=r.parse(e[o]);n[a.uuid]=a}}return n},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=i.AnimationClip.parse(e[n]);t.push(r)}return t},parseImages:function(e,t){function n(e){return r.manager.itemStart(e),a.load(e,function(){r.manager.itemEnd(e)})}var r=this,o={};if(void 0!==e&&0<e.length){var s=new i.LoadingManager(t),a=new i.ImageLoader(s);a.setCrossOrigin(this.crossOrigin);for(var s=0,u=e.length;u>s;s++){var c=e[s],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:r.texturePath+c.url;o[c.uuid]=n(h)}}return o},parseTextures:function(e,t){function n(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),i[e])}var r={};if(void 0!==e)for(var o=0,s=e.length;s>o;o++){var a=e[o];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var u=new i.Texture(t[a.image]);u.needsUpdate=!0,u.uuid=a.uuid,void 0!==a.name&&(u.name=a.name),void 0!==a.mapping&&(u.mapping=n(a.mapping)),void 0!==a.offset&&(u.offset=new i.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(u.repeat=new i.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(u.minFilter=n(a.minFilter)),void 0!==a.magFilter&&(u.magFilter=n(a.magFilter)),void 0!==a.anisotropy&&(u.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(u.wrapS=n(a.wrap[0]),u.wrapT=n(a.wrap[1])),r[a.uuid]=u}return r},parseObject:function(){var e=new i.Matrix4;return function(t,n,r){function o(e){return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),n[e]}function s(e){return void 0!==e?(void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e]):void 0}var a;switch(t.type){case"Scene":a=new i.Scene;break;case"PerspectiveCamera":a=new i.PerspectiveCamera(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(a.focus=t.focus),void 0!==t.zoom&&(a.zoom=t.zoom),void 0!==t.filmGauge&&(a.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(a.filmOffset=t.filmOffset),void 0!==t.view&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new i.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":a=new i.AmbientLight(t.color,t.intensity);break;case"DirectionalLight":a=new i.DirectionalLight(t.color,t.intensity);break;case"PointLight":a=new i.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":a=new i.SpotLight(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new i.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":a=o(t.geometry);var u=s(t.material);a=a.bones&&0<a.bones.length?new i.SkinnedMesh(a,u):new i.Mesh(a,u);break;case"LOD":a=new i.LOD;break;case"Line":a=new i.Line(o(t.geometry),s(t.material),t.mode);break;case"PointCloud":case"Points":a=new i.Points(o(t.geometry),s(t.material));break;case"Sprite":a=new i.Sprite(s(t.material));break;case"Group":a=new i.Group;break;default:a=new i.Object3D}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.children)for(var c in t.children)a.add(this.parseObject(t.children[c],n,r));if("LOD"===t.type)for(t=t.levels,u=0;u<t.length;u++){var h=t[u];c=a.getObjectByProperty("uuid",h.object),void 0!==c&&a.addLevel(c,h.distance)}return a}}()},i.TextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.TextureLoader.prototype={constructor:i.TextureLoader,load:function(e,t,n,r){var o=new i.Texture,s=new i.ImageLoader(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(e){o.image=e,o.needsUpdate=!0,void 0!==t&&t(o)},n,r),o},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.CubeTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.CubeTextureLoader.prototype={constructor:i.CubeTextureLoader,load:function(e,t,n,r){function o(n){a.load(e[n],function(e){s.images[n]=e,u++,6===u&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}var s=new i.CubeTexture,a=new i.ImageLoader(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var u=0;for(n=0;n<e.length;++n)o(n);return s},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.DataTextureLoader=i.BinaryTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this._parser=null},i.BinaryTextureLoader.prototype={constructor:i.BinaryTextureLoader,load:function(e,t,n,r){var o=this,s=new i.DataTexture,a=new i.XHRLoader(this.manager);return a.setResponseType("arraybuffer"),a.load(e,function(e){(e=o._parser(e))&&(void 0!==e.image?s.image=e.image:void 0!==e.data&&(s.image.width=e.width,s.image.height=e.height,s.image.data=e.data),s.wrapS=void 0!==e.wrapS?e.wrapS:i.ClampToEdgeWrapping,s.wrapT=void 0!==e.wrapT?e.wrapT:i.ClampToEdgeWrapping,s.magFilter=void 0!==e.magFilter?e.magFilter:i.LinearFilter,s.minFilter=void 0!==e.minFilter?e.minFilter:i.LinearMipMapLinearFilter,s.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(s.format=e.format),void 0!==e.type&&(s.type=e.type),void 0!==e.mipmaps&&(s.mipmaps=e.mipmaps),1===e.mipmapCount&&(s.minFilter=i.LinearFilter),s.needsUpdate=!0,t&&t(s,e))},n,r),s}},i.CompressedTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this._parser=null},i.CompressedTextureLoader.prototype={constructor:i.CompressedTextureLoader,load:function(e,t,n,r){function o(o){c.load(e[o],function(e){e=s._parser(e,!0),a[o]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},h+=1,6===h&&(1===e.mipmapCount&&(u.minFilter=i.LinearFilter),u.format=e.format,u.needsUpdate=!0,t&&t(u))},n,r)}var s=this,a=[],u=new i.CompressedTexture;u.image=a;var c=new i.XHRLoader(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(e))for(var h=0,l=0,p=e.length;p>l;++l)o(l);else c.load(e,function(e){if(e=s._parser(e,!0),e.isCubemap)for(var n=e.mipmaps.length/e.mipmapCount,r=0;n>r;r++){a[r]={mipmaps:[]};for(var o=0;o<e.mipmapCount;o++)a[r].mipmaps.push(e.mipmaps[r*e.mipmapCount+o]),a[r].format=e.format,a[r].width=e.width,a[r].height=e.height}else u.image.width=e.width,u.image.height=e.height,u.mipmaps=e.mipmaps;1===e.mipmapCount&&(u.minFilter=i.LinearFilter),u.format=e.format,u.needsUpdate=!0,t&&t(u)},n,r);return u},setPath:function(e){this.path=e}},i.Material=function(){Object.defineProperty(this,"id",{value:i.MaterialIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Material",this.side=i.FrontSide,this.opacity=1,this.transparent=!1,this.blending=i.NormalBlending,this.blendSrc=i.SrcAlphaFactor,this.blendDst=i.OneMinusSrcAlphaFactor,this.blendEquation=i.AddEquation,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=i.LessEqualDepth,this.depthWrite=this.depthTest=!0,this.clippingPlanes=null,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.premultipliedAlpha=!1,this.overdraw=0,this._needsUpdate=this.visible=!0},i.Material.prototype={constructor:i.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0===n)console.warn("THREE.Material: '"+t+"' parameter is undefined.");else{var r=this[t];void 0===r?console.warn("THREE."+this.type+": '"+t+"' is not a property of this material."):r instanceof i.Color?r.set(n):r instanceof i.Vector3&&n instanceof i.Vector3?r.copy(n):this[t]="overdraw"===t?Number(n):n}}},toJSON:function(e){function t(e){var t,n=[];for(t in e){var r=e[t];delete r.metadata,n.push(r)}return n}var n=void 0===e;n&&(e={textures:{},images:{}});var r={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color instanceof i.Color&&(r.color=this.color.getHex()),.5!==this.roughness&&(r.roughness=this.roughness),.5!==this.metalness&&(r.metalness=this.metalness),this.emissive instanceof i.Color&&(r.emissive=this.emissive.getHex()),this.specular instanceof i.Color&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),this.map instanceof i.Texture&&(r.map=this.map.toJSON(e).uuid),this.alphaMap instanceof i.Texture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap instanceof i.Texture&&(r.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap instanceof i.Texture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap instanceof i.Texture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap instanceof i.Texture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap instanceof i.Texture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap instanceof i.Texture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap instanceof i.Texture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap instanceof i.Texture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.envMap instanceof i.Texture&&(r.envMap=this.envMap.toJSON(e).uuid,r.reflectivity=this.reflectivity),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==i.NoColors&&(r.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==i.SmoothShading&&(r.shading=this.shading),void 0!==this.blending&&this.blending!==i.NormalBlending&&(r.blending=this.blending),void 0!==this.side&&this.side!==i.FrontSide&&(r.side=this.side),1>this.opacity&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),0<this.alphaTest&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),1<this.wireframeLinewidth&&(r.wireframeLinewidth=this.wireframeLinewidth),n&&(n=t(e.textures),e=t(e.images),0<n.length&&(r.textures=n),0<e.length&&(r.images=e)),r},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.side=e.side,this.opacity=e.opacity,this.transparent=e.transparent,this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,
|
||
this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows,e=e.clippingPlanes;var t=null;if(null!==e)for(var n=e.length,t=Array(n),r=0;r!==n;++r)t[r]=e[r].clone();return this.clippingPlanes=t,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.Material.prototype),i.MaterialIdCount=0,i.LineBasicMaterial=function(e){i.Material.call(this),this.type="LineBasicMaterial",this.color=new i.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.blending=i.NormalBlending,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.LineBasicMaterial.prototype=Object.create(i.Material.prototype),i.LineBasicMaterial.prototype.constructor=i.LineBasicMaterial,i.LineBasicMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.LineDashedMaterial=function(e){i.Material.call(this),this.type="LineDashedMaterial",this.color=new i.Color(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.blending=i.NormalBlending,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.LineDashedMaterial.prototype=Object.create(i.Material.prototype),i.LineDashedMaterial.prototype.constructor=i.LineDashedMaterial,i.LineDashedMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.MeshBasicMaterial=function(e){i.Material.call(this),this.type="MeshBasicMaterial",this.color=new i.Color(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=i.NoColors,this.morphTargets=this.skinning=!1,this.setValues(e)},i.MeshBasicMaterial.prototype=Object.create(i.Material.prototype),i.MeshBasicMaterial.prototype.constructor=i.MeshBasicMaterial,i.MeshBasicMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},i.MeshDepthMaterial=function(e){i.Material.call(this),this.type="MeshDepthMaterial",this.depthPacking=i.BasicDepthPacking,this.morphTargets=this.skinning=!1,this.displacementMap=this.alphaMap=this.map=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},i.MeshDepthMaterial.prototype=Object.create(i.Material.prototype),i.MeshDepthMaterial.prototype.constructor=i.MeshDepthMaterial,i.MeshDepthMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},i.MeshLambertMaterial=function(e){i.Material.call(this),this.type="MeshLambertMaterial",this.color=new i.Color(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new i.Color(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=i.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},i.MeshLambertMaterial.prototype=Object.create(i.Material.prototype),i.MeshLambertMaterial.prototype.constructor=i.MeshLambertMaterial,i.MeshLambertMaterial.prototype.copy=function(e){return i.Material.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.fog=e.fog,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshNormalMaterial=function(e){i.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},i.MeshNormalMaterial.prototype=Object.create(i.Material.prototype),i.MeshNormalMaterial.prototype.constructor=i.MeshNormalMaterial,i.MeshNormalMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},i.MeshPhongMaterial=function(e){i.Material.call(this),this.type="MeshPhongMaterial",this.color=new i.Color(16777215),this.specular=new i.Color(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new i.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=i.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},i.MeshPhongMaterial.prototype=Object.create(i.Material.prototype),i.MeshPhongMaterial.prototype.constructor=i.MeshPhongMaterial,i.MeshPhongMaterial.prototype.copy=function(e){return i.Material.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.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshStandardMaterial=function(e){i.Material.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new i.Color(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new i.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.blending=i.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=i.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(e)},i.MeshStandardMaterial.prototype=Object.create(i.Material.prototype),i.MeshStandardMaterial.prototype.constructor=i.MeshStandardMaterial,i.MeshStandardMaterial.prototype.copy=function(e){return i.Material.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.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshPhysicalMaterial=function(e){i.MeshStandardMaterial.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.setValues(e)},i.MeshPhysicalMaterial.prototype=Object.create(i.MeshStandardMaterial.prototype),i.MeshPhysicalMaterial.prototype.constructor=i.MeshPhysicalMaterial,i.MeshPhysicalMaterial.prototype.copy=function(e){return i.MeshStandardMaterial.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this},i.MultiMaterial=function(e){this.uuid=i.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},i.MultiMaterial.prototype={constructor:i.MultiMaterial,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},n=this.materials,r=0,i=n.length;i>r;r++){var o=n[r].toJSON(e);delete o.metadata,t.materials.push(o)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},i.PointsMaterial=function(e){i.Material.call(this),this.type="PointsMaterial",this.color=new i.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.blending=i.NormalBlending,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.PointsMaterial.prototype=Object.create(i.Material.prototype),i.PointsMaterial.prototype.constructor=i.PointsMaterial,i.PointsMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.ShaderMaterial=function(e){i.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=i.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.clipping=this.lights=this.fog=!1,this.vertexColors=i.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))},i.ShaderMaterial.prototype=Object.create(i.Material.prototype),i.ShaderMaterial.prototype.constructor=i.ShaderMaterial,i.ShaderMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=i.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},i.ShaderMaterial.prototype.toJSON=function(e){return e=i.Material.prototype.toJSON.call(this,e),e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},i.RawShaderMaterial=function(e){i.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},i.RawShaderMaterial.prototype=Object.create(i.ShaderMaterial.prototype),i.RawShaderMaterial.prototype.constructor=i.RawShaderMaterial,i.SpriteMaterial=function(e){i.Material.call(this),this.type="SpriteMaterial",this.color=new i.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},i.SpriteMaterial.prototype=Object.create(i.Material.prototype),i.SpriteMaterial.prototype.constructor=i.SpriteMaterial,i.SpriteMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.fog=e.fog,this},i.Texture=function(e,t,n,r,o,s,a,u,c,h){Object.defineProperty(this,"id",{value:i.TextureIdCount++}),this.uuid=i.Math.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==e?e:i.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:i.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:i.ClampToEdgeWrapping,this.wrapT=void 0!==r?r:i.ClampToEdgeWrapping,this.magFilter=void 0!==o?o:i.LinearFilter,this.minFilter=void 0!==s?s:i.LinearMipMapLinearFilter,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:i.RGBAFormat,this.type=void 0!==u?u:i.UnsignedByteType,this.offset=new i.Vector2(0,0),this.repeat=new i.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:i.LinearEncoding,this.version=0,this.onUpdate=null},i.Texture.DEFAULT_IMAGE=void 0,i.Texture.DEFAULT_MAPPING=i.UVMapping,i.Texture.prototype={constructor:i.Texture,set needsUpdate(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return 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.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=i.Math.generateUUID()),void 0===e.images[n.uuid]){var r,o=e.images,s=n.uuid,a=n.uuid;void 0!==n.toDataURL?r=n:(r=document.createElement("canvas"),r.width=n.width,r.height=n.height,r.getContext("2d").drawImage(n,0,0,n.width,n.height)),r=2048<r.width||2048<r.height?r.toDataURL("image/jpeg",.6):r.toDataURL("image/png"),o[s]={uuid:a,url:r}}t.image=n.uuid}return e.textures[this.uuid]=t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===i.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),0>e.x||1<e.x)switch(this.wrapS){case i.RepeatWrapping:e.x-=Math.floor(e.x);break;case i.ClampToEdgeWrapping:e.x=0>e.x?0:1;break;case i.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(0>e.y||1<e.y)switch(this.wrapT){case i.RepeatWrapping:e.y-=Math.floor(e.y);break;case i.ClampToEdgeWrapping:e.y=0>e.y?0:1;break;case i.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},i.EventDispatcher.prototype.apply(i.Texture.prototype),i.TextureIdCount=0,i.DepthTexture=function(e,t,n,r,o,s,a,u,c){i.Texture.call(this,null,r,o,s,a,u,i.DepthFormat,n,c),this.image={width:e,height:t},this.type=void 0!==n?n:i.UnsignedShortType,this.magFilter=void 0!==a?a:i.NearestFilter,this.minFilter=void 0!==u?u:i.NearestFilter,this.generateMipmaps=this.flipY=!1},i.DepthTexture.prototype=Object.create(i.Texture.prototype),i.DepthTexture.prototype.constructor=i.DepthTexture,i.CanvasTexture=function(e,t,n,r,o,s,a,u,c){i.Texture.call(this,e,t,n,r,o,s,a,u,c),this.needsUpdate=!0},i.CanvasTexture.prototype=Object.create(i.Texture.prototype),i.CanvasTexture.prototype.constructor=i.CanvasTexture,i.CubeTexture=function(e,t,n,r,o,s,a,u,c,h){e=void 0!==e?e:[],t=void 0!==t?t:i.CubeReflectionMapping,i.Texture.call(this,e,t,n,r,o,s,a,u,c,h),this.flipY=!1},i.CubeTexture.prototype=Object.create(i.Texture.prototype),i.CubeTexture.prototype.constructor=i.CubeTexture,Object.defineProperty(i.CubeTexture.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),i.CompressedTexture=function(e,t,n,r,o,s,a,u,c,h,l,p){i.Texture.call(this,null,s,a,u,c,h,r,o,l,p),this.image={width:t,height:n},this.mipmaps=e,this.generateMipmaps=this.flipY=!1},i.CompressedTexture.prototype=Object.create(i.Texture.prototype),i.CompressedTexture.prototype.constructor=i.CompressedTexture,i.DataTexture=function(e,t,n,r,o,s,a,u,c,h,l,p){i.Texture.call(this,null,s,a,u,c,h,r,o,l,p),this.image={data:e,width:t,height:n},this.magFilter=void 0!==c?c:i.NearestFilter,this.minFilter=void 0!==h?h:i.NearestFilter,this.generateMipmaps=this.flipY=!1},i.DataTexture.prototype=Object.create(i.Texture.prototype),i.DataTexture.prototype.constructor=i.DataTexture,i.VideoTexture=function(e,t,n,r,o,s,a,u,c){function h(){requestAnimationFrame(h),e.readyState>=e.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}i.Texture.call(this,e,t,n,r,o,s,a,u,c),this.generateMipmaps=!1;var l=this;h()},i.VideoTexture.prototype=Object.create(i.Texture.prototype),i.VideoTexture.prototype.constructor=i.VideoTexture,i.Group=function(){i.Object3D.call(this),this.type="Group"},i.Group.prototype=Object.create(i.Object3D.prototype),i.Group.prototype.constructor=i.Group,i.Points=function(e,t){i.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.PointsMaterial({color:16777215*Math.random()})},i.Points.prototype=Object.create(i.Object3D.prototype),i.Points.prototype.constructor=i.Points,i.Points.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,n=new i.Sphere;return function(r,o){function s(e,n){var i=t.distanceSqToPoint(e);if(l>i){var s=t.closestPointToPoint(e);s.applyMatrix4(c);var u=r.ray.origin.distanceTo(s);u<r.near||u>r.far||o.push({distance:u,distanceToRay:Math.sqrt(i),point:s.clone(),index:n,face:null,object:a})}}var a=this,u=this.geometry,c=this.matrixWorld,h=r.params.Points.threshold;if(null===u.boundingSphere&&u.computeBoundingSphere(),n.copy(u.boundingSphere),n.applyMatrix4(c),!1!==r.ray.intersectsSphere(n)){e.getInverse(c),t.copy(r.ray).applyMatrix4(e);var h=h/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,h=new i.Vector3;if(u instanceof i.BufferGeometry){var p=u.index,u=u.attributes.position.array;if(null!==p)for(var f=p.array,p=0,d=f.length;d>p;p++){var m=f[p];h.fromArray(u,3*m),s(h,m)}else for(p=0,f=u.length/3;f>p;p++)h.fromArray(u,3*p),s(h,p)}else for(h=u.vertices,p=0,f=h.length;f>p;p++)s(h[p],p)}}}(),i.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Line=function(e,t,n){return 1===n?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new i.LineSegments(e,t)):(i.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new i.Geometry,void(this.material=void 0!==t?t:new i.LineBasicMaterial({color:16777215*Math.random()})))},i.Line.prototype=Object.create(i.Object3D.prototype),i.Line.prototype.constructor=i.Line,i.Line.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,n=new i.Sphere;return function(r,o){var s=r.linePrecision,s=s*s,a=this.geometry,u=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),n.copy(a.boundingSphere),n.applyMatrix4(u),!1!==r.ray.intersectsSphere(n)){e.getInverse(u),t.copy(r.ray).applyMatrix4(e);var c=new i.Vector3,h=new i.Vector3,u=new i.Vector3,l=new i.Vector3,p=this instanceof i.LineSegments?2:1;if(a instanceof i.BufferGeometry){var f=a.index,d=a.attributes.position.array;if(null!==f)for(var f=f.array,a=0,m=f.length-1;m>a;a+=p){var v=f[a+1];c.fromArray(d,3*f[a]),h.fromArray(d,3*v),v=t.distanceSqToSegment(c,h,l,u),v>s||(l.applyMatrix4(this.matrixWorld),v=r.ray.origin.distanceTo(l),v<r.near||v>r.far||o.push({distance:v,point:u.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,m=d.length/3-1;m>a;a+=p)c.fromArray(d,3*a),h.fromArray(d,3*a+3),v=t.distanceSqToSegment(c,h,l,u),v>s||(l.applyMatrix4(this.matrixWorld),v=r.ray.origin.distanceTo(l),v<r.near||v>r.far||o.push({distance:v,point:u.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a instanceof i.Geometry)for(c=a.vertices,h=c.length,a=0;h-1>a;a+=p)v=t.distanceSqToSegment(c[a],c[a+1],l,u),v>s||(l.applyMatrix4(this.matrixWorld),v=r.ray.origin.distanceTo(l),v<r.near||v>r.far||o.push({distance:v,point:u.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),i.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.LineStrip=0,i.LinePieces=1,i.LineSegments=function(e,t){i.Line.call(this,e,t),this.type="LineSegments"},i.LineSegments.prototype=Object.create(i.Line.prototype),i.LineSegments.prototype.constructor=i.LineSegments,i.Mesh=function(e,t){i.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=i.TrianglesDrawMode,this.updateMorphTargets()},i.Mesh.prototype=Object.create(i.Object3D.prototype),i.Mesh.prototype.constructor=i.Mesh,i.Mesh.prototype.setDrawMode=function(e){this.drawMode=e},i.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},i.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},i.Mesh.prototype.raycast=function(){function e(e,t,n,r,o,s,a){return i.Triangle.barycoordFromPoint(e,t,n,r,v),o.multiplyScalar(v.x),s.multiplyScalar(v.y),a.multiplyScalar(v.z),o.add(s).add(a),o.clone()}function t(e,t,n,r,o,s,a){var u=e.material;return null===(u.side===i.BackSide?n.intersectTriangle(s,o,r,!0,a):n.intersectTriangle(r,o,s,u.side!==i.DoubleSide,a))?null:(y.copy(a),y.applyMatrix4(e.matrixWorld),n=t.ray.origin.distanceTo(y),n<t.near||n>t.far?null:{distance:n,point:y.clone(),object:e})}function n(n,r,o,s,h,l,p,v){return a.fromArray(s,3*l),u.fromArray(s,3*p),c.fromArray(s,3*v),(n=t(n,r,o,a,u,c,g))&&(h&&(f.fromArray(h,2*l),d.fromArray(h,2*p),m.fromArray(h,2*v),n.uv=e(g,a,u,c,f,d,m)),n.face=new i.Face3(l,p,v,i.Triangle.normal(a,u,c)),n.faceIndex=l),n}var r=new i.Matrix4,o=new i.Ray,s=new i.Sphere,a=new i.Vector3,u=new i.Vector3,c=new i.Vector3,h=new i.Vector3,l=new i.Vector3,p=new i.Vector3,f=new i.Vector2,d=new i.Vector2,m=new i.Vector2,v=new i.Vector3,g=new i.Vector3,y=new i.Vector3;return function(v,y){var _=this.geometry,b=this.material,x=this.matrixWorld;if(void 0!==b&&(null===_.boundingSphere&&_.computeBoundingSphere(),s.copy(_.boundingSphere),s.applyMatrix4(x),!1!==v.ray.intersectsSphere(s)&&(r.getInverse(x),o.copy(v.ray).applyMatrix4(r),null===_.boundingBox||!1!==o.intersectsBox(_.boundingBox)))){var w,S;if(_ instanceof i.BufferGeometry){var M,E,b=_.index,x=_.attributes,_=x.position.array;if(void 0!==x.uv&&(w=x.uv.array),null!==b)for(var x=b.array,C=0,T=x.length;T>C;C+=3)b=x[C],M=x[C+1],E=x[C+2],(S=n(this,v,o,_,w,b,M,E))&&(S.faceIndex=Math.floor(C/3),y.push(S));else for(C=0,T=_.length;T>C;C+=9)b=C/3,M=b+1,E=b+2,(S=n(this,v,o,_,w,b,M,E))&&(S.index=b,y.push(S))}else if(_ instanceof i.Geometry){var A,P,x=b instanceof i.MultiMaterial,C=!0===x?b.materials:null,T=_.vertices;M=_.faces,E=_.faceVertexUvs[0],0<E.length&&(w=E);for(var O=0,L=M.length;L>O;O++){var R=M[O];if(S=!0===x?C[R.materialIndex]:b,void 0!==S){if(E=T[R.a],A=T[R.b],P=T[R.c],!0===S.morphTargets){S=_.morphTargets;var N=this.morphTargetInfluences;a.set(0,0,0),u.set(0,0,0),c.set(0,0,0);for(var D=0,I=S.length;I>D;D++){var k=N[D];if(0!==k){var j=S[D].vertices;a.addScaledVector(h.subVectors(j[R.a],E),k),u.addScaledVector(l.subVectors(j[R.b],A),k),c.addScaledVector(p.subVectors(j[R.c],P),k)}}a.add(E),u.add(A),c.add(P),E=a,A=u,P=c}(S=t(this,v,o,E,A,P,g))&&(w&&(N=w[O],f.copy(N[0]),d.copy(N[1]),m.copy(N[2]),S.uv=e(g,E,A,P,f,d,m)),S.face=R,S.faceIndex=O,y.push(S))}}}}}}(),i.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Bone=function(e){i.Object3D.call(this),this.type="Bone",this.skin=e},i.Bone.prototype=Object.create(i.Object3D.prototype),i.Bone.prototype.constructor=i.Bone,i.Bone.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},i.Skeleton=function(e,t,n){if(this.useVertexTexture=void 0!==n?n:!0,this.identityMatrix=new i.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture?(e=Math.sqrt(4*this.bones.length),e=i.Math.nextPowerOfTwo(Math.ceil(e)),this.boneTextureHeight=this.boneTextureWidth=e=Math.max(e,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new i.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,i.RGBAFormat,i.FloatType)):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 bonInverses is the wrong length."),this.boneInverses=[],t=0,e=this.bones.length;e>t;t++)this.boneInverses.push(new i.Matrix4)},i.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var n=new i.Matrix4;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},i.Skeleton.prototype.pose=function(){for(var e,t=0,n=this.bones.length;n>t;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;n>t;t++)(e=this.bones[t])&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},i.Skeleton.prototype.update=function(){var e=new i.Matrix4;return function(){for(var t=0,n=this.bones.length;n>t;t++)e.multiplyMatrices(this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix,this.boneInverses[t]),e.toArray(this.boneMatrices,16*t);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),i.Skeleton.prototype.clone=function(){return new i.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},i.SkinnedMesh=function(e,t,n){if(i.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new i.Matrix4,this.bindMatrixInverse=new i.Matrix4,e=[],this.geometry&&void 0!==this.geometry.bones){for(var r,o=0,s=this.geometry.bones.length;s>o;++o)r=this.geometry.bones[o],t=new i.Bone(this),e.push(t),t.name=r.name,t.position.fromArray(r.pos),t.quaternion.fromArray(r.rotq),void 0!==r.scl&&t.scale.fromArray(r.scl);for(o=0,s=this.geometry.bones.length;s>o;++o)r=this.geometry.bones[o],-1!==r.parent&&null!==r.parent&&void 0!==e[r.parent]?e[r.parent].add(e[o]):this.add(e[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new i.Skeleton(e,void 0,n),this.matrixWorld)},i.SkinnedMesh.prototype=Object.create(i.Mesh.prototype),i.SkinnedMesh.prototype.constructor=i.SkinnedMesh,i.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},i.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},i.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof i.Geometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],n=1/t.lengthManhattan();1/0!==n?t.multiplyScalar(n):t.set(1,0,0,0)}else if(this.geometry instanceof i.BufferGeometry)for(var t=new i.Vector4,r=this.geometry.attributes.skinWeight,e=0;e<r.count;e++)t.x=r.getX(e),t.y=r.getY(e),t.z=r.getZ(e),t.w=r.getW(e),n=1/t.lengthManhattan(),1/0!==n?t.multiplyScalar(n):t.set(1,0,0,0),r.setXYZW(e,t.x,t.y,t.z,t.w)},i.SkinnedMesh.prototype.updateMatrixWorld=function(e){i.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},i.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},i.LOD=function(){i.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})},i.LOD.prototype=Object.create(i.Object3D.prototype),i.LOD.prototype.constructor=i.LOD,i.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);n.splice(r,0,{distance:t,object:e}),this.add(e)},i.LOD.prototype.getObjectForDistance=function(e){for(var t=this.levels,n=1,r=t.length;r>n&&!(e<t[n].distance);n++);return t[n-1].object},i.LOD.prototype.raycast=function(){var e=new i.Vector3;return function(t,n){e.setFromMatrixPosition(this.matrixWorld);var r=t.ray.origin.distanceTo(e);this.getObjectForDistance(r).raycast(t,n)}}(),i.LOD.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3;return function(n){var r=this.levels;
|
||
if(1<r.length){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld),n=e.distanceTo(t),r[0].object.visible=!0;for(var i=1,o=r.length;o>i&&n>=r[i].distance;i++)r[i-1].object.visible=!1,r[i].object.visible=!0;for(;o>i;i++)r[i].object.visible=!1}}}(),i.LOD.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e,!1),e=e.levels;for(var t=0,n=e.length;n>t;t++){var r=e[t];this.addLevel(r.object.clone(),r.distance)}return this},i.LOD.prototype.toJSON=function(e){e=i.Object3D.prototype.toJSON.call(this,e),e.object.levels=[];for(var t=this.levels,n=0,r=t.length;r>n;n++){var o=t[n];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e},i.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),n=new Float32Array([0,0,1,0,1,1,0,1]),r=new i.BufferGeometry;return r.setIndex(new i.BufferAttribute(e,1)),r.addAttribute("position",new i.BufferAttribute(t,3)),r.addAttribute("uv",new i.BufferAttribute(n,2)),function(e){i.Object3D.call(this),this.type="Sprite",this.geometry=r,this.material=void 0!==e?e:new i.SpriteMaterial}}(),i.Sprite.prototype=Object.create(i.Object3D.prototype),i.Sprite.prototype.constructor=i.Sprite,i.Sprite.prototype.raycast=function(){var e=new i.Vector3;return function(t,n){e.setFromMatrixPosition(this.matrixWorld);var r=t.ray.distanceSqToPoint(e);r>this.scale.x*this.scale.y/4||n.push({distance:Math.sqrt(r),point:this.position,face:null,object:this})}}(),i.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},i.Particle=i.Sprite,i.LensFlare=function(e,t,n,r,o){i.Object3D.call(this),this.lensFlares=[],this.positionScreen=new i.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,r,o)},i.LensFlare.prototype=Object.create(i.Object3D.prototype),i.LensFlare.prototype.constructor=i.LensFlare,i.LensFlare.prototype.add=function(e,t,n,r,o,s){void 0===t&&(t=-1),void 0===n&&(n=0),void 0===s&&(s=1),void 0===o&&(o=new i.Color(16777215)),void 0===r&&(r=i.NormalBlending),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:e,size:t,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:s,color:o,blending:r})},i.LensFlare.prototype.updateLensFlares=function(){var e,t,n=this.lensFlares.length,r=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(e=0;n>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+r*t.distance,t.y=this.positionScreen.y+i*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},i.LensFlare.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,n=e.lensFlares.length;n>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},i.Scene=function(){i.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},i.Scene.prototype=Object.create(i.Object3D.prototype),i.Scene.prototype.constructor=i.Scene,i.Scene.prototype.copy=function(e,t){return i.Object3D.prototype.copy.call(this,e,t),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},i.Fog=function(e,t,n){this.name="",this.color=new i.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3},i.Fog.prototype.clone=function(){return new i.Fog(this.color.getHex(),this.near,this.far)},i.FogExp2=function(e,t){this.name="",this.color=new i.Color(e),this.density=void 0!==t?t:25e-5},i.FogExp2.prototype.clone=function(){return new i.FogExp2(this.color.getHex(),this.density)},i.ShaderChunk={},i.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",i.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif\n",i.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",i.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( PHYSICAL )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif\n",i.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",i.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",i.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",i.ShaderChunk.bsdfs="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n return any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n if( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n return distanceFalloff * maxDistanceCutoffFactor;\n#else\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n }\n return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return 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 float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return 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 vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",i.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n",i.ShaderChunk.clipping_planes_fragment="#if NUM_CLIPPING_PLANES > 0\n for ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n vec4 plane = clippingPlanes[ i ];\n if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n }\n#endif\n",i.ShaderChunk.clipping_planes_pars_fragment="#if NUM_CLIPPING_PLANES > 0\n #if ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n #endif\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",i.ShaderChunk.clipping_planes_pars_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n varying vec3 vViewPosition;\n#endif\n",i.ShaderChunk.clipping_planes_vertex="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n vViewPosition = - mvPosition.xyz;\n#endif\n",i.ShaderChunk.color_fragment="#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",i.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif\n",i.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",i.ShaderChunk.color_vertex="#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",i.ShaderChunk.common="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",i.ShaderChunk.cube_uv_reflection_fragment="#ifdef ENVMAP_TYPE_CUBE_UV\nconst float cubeUV_textureSize = 1024.0;\nint getFaceFromDirection(vec3 direction) {\n vec3 absDirection = abs(direction);\n int face = -1;\n if( absDirection.x > absDirection.z ) {\n if(absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0 : 3;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n else {\n if(absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2 : 5;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n return face;\n}\nfloat cubeUV_maxLods1 = log2(cubeUV_textureSize*0.25) - 1.0;\nfloat cubeUV_rangeClamp = exp2((6.0 - 1.0) * 2.0);\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n float dxRoughness = dFdx(roughness);\n float dyRoughness = dFdy(roughness);\n vec3 dx = dFdx( vec * scale * dxRoughness );\n vec3 dy = dFdy( vec * scale * dyRoughness );\n float d = max( dot( dx, dx ), dot( dy, dy ) );\n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\nfloat cubeUV_maxLods2 = log2(cubeUV_textureSize*0.25) - 2.0;\nconst float cubeUV_rcpTextureSize = 1.0 / cubeUV_textureSize;\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n float powScale = exp2_packed.x * exp2_packed.y;\n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 r;\n vec2 offset;\n int face = getFaceFromDirection(direction);\n float rcpPowScale = 1.0 / powScale;\n if( face == 0) {\n r = vec3(direction.x, -direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 1) {\n r = vec3(direction.y, direction.x, direction.z);\n offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 2) {\n r = vec3(direction.z, direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 3) {\n r = vec3(direction.x, direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else if( face == 4) {\n r = vec3(direction.y, direction.x, -direction.z);\n offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else {\n r = vec3(direction.z, -direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n r = normalize(r);\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n vec2 base = offset + vec2( texelOffset );\n return base + s * ( scale - 2.0 * texelOffset );\n}\nfloat cubeUV_maxLods3 = log2(cubeUV_textureSize*0.25) - 3.0;\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n float roughnessVal = roughness* cubeUV_maxLods3;\n float r1 = floor(roughnessVal);\n float r2 = r1 + 1.0;\n float t = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n float s = mipInfo.y;\n float level0 = mipInfo.x;\n float level1 = level0 + 1.0;\n level1 = level1 > 5.0 ? 5.0 : level1;\n level0 += min( floor( s + 0.5 ), 5.0 );\n vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n vec4 result = mix(color10, color20, t);\n return vec4(result.rgb, 1.0);\n}\n#endif\n",i.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n objectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",i.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",i.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif\n",i.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",i.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif\n",i.ShaderChunk.encodings_pars_fragment="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",i.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",i.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n envColor = envMapTexelToLinear( envColor );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif\n",i.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n uniform float reflectivity;\n uniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n #if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n varying vec3 vWorldPosition;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif\n",i.ShaderChunk.envmap_pars_vertex="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif\n",i.ShaderChunk.envmap_vertex="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif\n",i.ShaderChunk.fog_fragment="#ifdef USE_FOG\n #ifdef USE_LOGDEPTHBUF_EXT\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n #else\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n #endif\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",i.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n uniform vec3 fogColor;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",i.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",i.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",i.ShaderChunk.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 vLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n#endif\n",i.ShaderChunk.lights_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n if ( testLightInRange( lightDistance, pointLight.distance ) ) {\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n vec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n #else\n vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n",
|
||
i.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",i.ShaderChunk.lights_phong_pars_fragment="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)\n",i.ShaderChunk.lights_physical_fragment="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.16 * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#endif\n",i.ShaderChunk.lights_physical_pars_fragment="struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n #ifndef STANDARD\n #endif\n};\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",i.ShaderChunk.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 PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #endif\n #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n irradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n #endif\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n RE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",i.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",i.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n#endif\n",i.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n uniform float logDepthBufFC;\n#endif",i.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n #endif\n#endif\n",i.ShaderChunk.map_fragment="#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif\n",i.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n",i.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",i.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n#endif\n",i.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.r;\n#endif\n",i.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",i.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",i.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif",i.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n #endif\n#endif\n",i.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #endif\n#endif\n#ifdef USE_NORMALMAP\n normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",i.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n }\n#endif\n",i.ShaderChunk.packing="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nvec4 packDepthToRGBA( const in float value ) {\n const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n vec4 res = mod( value * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n res -= res.xxyz * bit_mask;\n return res;\n}\nfloat unpackRGBAToDepth( const in vec4 rgba ) {\n const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n return dot( rgba, bitSh );\n}\nfloat viewZToOrthoDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat OrthoDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",i.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",i.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n vec4 mvPosition = modelViewMatrix * skinned;\n#else\n vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",i.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.r;\n#endif\n",i.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",i.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n const vec2 offset = vec2( 0.0, 1.0 );\n vec2 texelSize = vec2( 1.0 ) / size;\n vec2 centroidUV = floor( uv * size + 0.5 ) / size;\n float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n vec2 f = fract( uv * size + 0.5 );\n float a = mix( lb, lt, f.y );\n float b = mix( rb, rt, f.y );\n float c = mix( a, b, f.x );\n return c;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return 1.0;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif\n",i.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n#endif\n",i.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #endif\n#endif\n",i.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #endif\n return shadow;\n}\n",i.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",i.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif\n",i.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n#endif\n",i.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",i.ShaderChunk.specularmap_fragment="float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",i.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",i.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",i.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",i.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif",i.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",i.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = uv2;\n#endif",i.ShaderChunk.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 varying vec2 vUv;\n#endif",i.ShaderChunk.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 varying vec2 vUv;\n uniform vec4 offsetRepeat;\n#endif\n",i.ShaderChunk.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 vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",i.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n #ifdef USE_SKINNING\n vec4 worldPosition = modelMatrix * skinned;\n #else\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n#endif\n",i.UniformsUtils={merge:function(e){for(var t={},n=0;n<e.length;n++){var r,i=this.clone(e[n]);for(r in i)t[r]=i[r]}return t},clone:function(e){var t,n={};for(t in e){n[t]={};for(var r in e[t]){var o=e[t][r];o instanceof i.Color||o instanceof i.Vector2||o instanceof i.Vector3||o instanceof i.Vector4||o instanceof i.Matrix3||o instanceof i.Matrix4||o instanceof i.Texture?n[t][r]=o.clone():Array.isArray(o)?n[t][r]=o.slice():n[t][r]=o}}return n}},i.UniformsLib={common:{diffuse:{type:"c",value:new i.Color(15658734)},opacity:{type:"1f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new i.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"1f",value:-1},reflectivity:{type:"1f",value:1},refractionRatio:{type:"1f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"1f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"1f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"1f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new i.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"1f",value:1},displacementBias:{type:"1f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"1f",value:25e-5},fogNear:{type:"1f",value:1},fogFar:{type:"1f",value:2e3},fogColor:{type:"c",value:new i.Color(16777215)}},lights:{ambientLightColor:{type:"3fv",value:[]},directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"1i"},shadowBias:{type:"1f"},shadowRadius:{type:"1f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"1f"},coneCos:{type:"1f"},penumbraCos:{type:"1f"},decay:{type:"1f"},shadow:{type:"1i"},shadowBias:{type:"1f"},shadowRadius:{type:"1f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"1f"},distance:{type:"1f"},shadow:{type:"1i"},shadowBias:{type:"1f"},shadowRadius:{type:"1f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new i.Color(15658734)},opacity:{type:"1f",value:1},size:{type:"1f",value:1},scale:{type:"1f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new i.Vector4(0,0,1,1)}}},i.ShaderChunk.cube_frag="uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n #include <logdepthbuf_fragment>\n}\n",i.ShaderChunk.cube_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",i.ShaderChunk.depth_frag="#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n #endif\n}\n",i.ShaderChunk.depth_vert="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",i.ShaderChunk.distanceRGBA_frag="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",i.ShaderChunk.distanceRGBA_vert="varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition;\n}\n",
|
||
i.ShaderChunk.equirect_frag="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 direction = normalize( vWorldPosition );\n vec2 sampleUV;\n sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <logdepthbuf_fragment>\n}\n",i.ShaderChunk.equirect_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",i.ShaderChunk.linedashed_frag="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",i.ShaderChunk.linedashed_vert="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",i.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight;\n reflectedLight.directDiffuse = vec3( 0.0 );\n reflectedLight.directSpecular = vec3( 0.0 );\n reflectedLight.indirectDiffuse = diffuseColor.rgb;\n reflectedLight.indirectSpecular = vec3( 0.0 );\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",i.ShaderChunk.meshbasic_vert="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n}\n",i.ShaderChunk.meshlambert_frag="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",i.ShaderChunk.meshlambert_vert="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n}\n",i.ShaderChunk.meshphong_frag="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",i.ShaderChunk.meshphong_vert="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n}\n",i.ShaderChunk.meshphysical_frag="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",i.ShaderChunk.meshphysical_vert="#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n}\n",i.ShaderChunk.normal_frag="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n gl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n #include <logdepthbuf_fragment>\n}\n",i.ShaderChunk.normal_vert="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vNormal = normalize( normalMatrix * normal );\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",i.ShaderChunk.points_frag="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",i.ShaderChunk.points_vert="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <project_vertex>\n #ifdef USE_SIZEATTENUATION\n gl_PointSize = size * ( scale / - mvPosition.z );\n #else\n gl_PointSize = size;\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n}\n",i.ShaderLib={basic:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.fog]),vertexShader:i.ShaderChunk.meshbasic_vert,fragmentShader:i.ShaderChunk.meshbasic_frag},lambert:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.fog,i.UniformsLib.lights,{emissive:{type:"c",value:new i.Color(0)}}]),vertexShader:i.ShaderChunk.meshlambert_vert,fragmentShader:i.ShaderChunk.meshlambert_frag},phong:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.displacementmap,i.UniformsLib.fog,i.UniformsLib.lights,{emissive:{type:"c",value:new i.Color(0)},specular:{type:"c",value:new i.Color(1118481)},shininess:{type:"1f",value:30}}]),vertexShader:i.ShaderChunk.meshphong_vert,fragmentShader:i.ShaderChunk.meshphong_frag},standard:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.displacementmap,i.UniformsLib.roughnessmap,i.UniformsLib.metalnessmap,i.UniformsLib.fog,i.UniformsLib.lights,{emissive:{type:"c",value:new i.Color(0)},roughness:{type:"1f",value:.5},metalness:{type:"1f",value:0},envMapIntensity:{type:"1f",value:1}}]),vertexShader:i.ShaderChunk.meshphysical_vert,fragmentShader:i.ShaderChunk.meshphysical_frag},points:{uniforms:i.UniformsUtils.merge([i.UniformsLib.points,i.UniformsLib.fog]),vertexShader:i.ShaderChunk.points_vert,fragmentShader:i.ShaderChunk.points_frag},dashed:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,{scale:{type:"1f",value:1},dashSize:{type:"1f",value:1},totalSize:{type:"1f",value:2}}]),vertexShader:i.ShaderChunk.linedashed_vert,fragmentShader:i.ShaderChunk.linedashed_frag},depth:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.displacementmap]),vertexShader:i.ShaderChunk.depth_vert,fragmentShader:i.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{type:"1f",value:1}},vertexShader:i.ShaderChunk.normal_vert,fragmentShader:i.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"1f",value:-1}},vertexShader:i.ShaderChunk.cube_vert,fragmentShader:i.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"1f",value:-1}},vertexShader:i.ShaderChunk.equirect_vert,fragmentShader:i.ShaderChunk.equirect_frag},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new i.Vector3}},vertexShader:i.ShaderChunk.distanceRGBA_vert,fragmentShader:i.ShaderChunk.distanceRGBA_frag}},i.ShaderLib.physical={uniforms:i.UniformsUtils.merge([i.ShaderLib.standard.uniforms,{}]),vertexShader:i.ShaderChunk.meshphysical_vert,fragmentShader:i.ShaderChunk.meshphysical_frag},i.WebGLRenderer=function(e){function t(e,t,n,r){!0===k&&(e*=r,t*=r,n*=r),Re.clearColor(e,t,n,r)}function n(){Re.init(),Re.scissor(Q.copy(ue).multiplyScalar(ae)),Re.viewport(te.copy(he).multiplyScalar(ae)),t(re.r,re.g,re.b,ie)}function r(){J=q=null,Z="",K=-1,Re.reset()}function o(e){e.preventDefault(),r(),n(),Ne.clear()}function s(e){e=e.target,e.removeEventListener("dispose",s);e:{var t=Ne.get(e);if(e.image&&t.__image__webglTextureCube)Te.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)break e;Te.deleteTexture(t.__webglTexture)}Ne["delete"](e)}Ee.textures--}function a(e){e=e.target,e.removeEventListener("dispose",a);var t=Ne.get(e),n=Ne.get(e.texture);if(e){if(void 0!==n.__webglTexture&&Te.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e instanceof i.WebGLRenderTargetCube)for(n=0;6>n;n++)Te.deleteFramebuffer(t.__webglFramebuffer[n]),t.__webglDepthbuffer&&Te.deleteRenderbuffer(t.__webglDepthbuffer[n]);else Te.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&Te.deleteRenderbuffer(t.__webglDepthbuffer);Ne["delete"](e.texture),Ne["delete"](e)}Ee.textures--}function u(e){e=e.target,e.removeEventListener("dispose",u),c(e),Ne["delete"](e)}function c(e){var t=Ne.get(e).program;e.program=void 0,void 0!==t&&Ie.releaseProgram(t)}function h(e,t){return Math.abs(t[0])-Math.abs(e[0])}function l(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function p(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function f(e,t,n,r,i){var o;n.transparent?(r=U,o=++G):(r=B,o=++V),o=r[o],void 0!==o?(o.id=e.id,o.object=e,o.geometry=t,o.material=n,o.z=Se.z,o.group=i):(o={id:e.id,object:e,geometry:t,material:n,z:Se.z,group:i},r.push(o))}function d(e){var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere();var n=be.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);if(!le.intersectsSphere(n))return!1;if(0===me)return!0;e=W.clippingPlanes;var t=n.center,n=-n.radius,r=0;do if(e[r].distanceToPoint(t)<n)return!1;while(++r!==me);return!0}function m(e,t){if(!1!==e.visible){if(e.layers.test(t.layers))if(e instanceof i.Light)F.push(e);else if(e instanceof i.Sprite)!1!==e.frustumCulled&&!0!==d(e)||H.push(e);else if(e instanceof i.LensFlare)$.push(e);else if(e instanceof i.ImmediateRenderObject)!0===W.sortObjects&&(Se.setFromMatrixPosition(e.matrixWorld),Se.applyProjection(we)),f(e,null,e.material,Se.z,null);else if((e instanceof i.Mesh||e instanceof i.Line||e instanceof i.Points)&&(e instanceof i.SkinnedMesh&&e.skeleton.update(),!1===e.frustumCulled||!0===d(e))){var n=e.material;if(!0===n.visible){!0===W.sortObjects&&(Se.setFromMatrixPosition(e.matrixWorld),Se.applyProjection(we));var r=De.update(e);if(n instanceof i.MultiMaterial)for(var o=r.groups,s=n.materials,n=0,a=o.length;a>n;n++){var u=o[n],c=s[u.materialIndex];!0===c.visible&&f(e,r,c,Se.z,u)}else f(e,r,n,Se.z,null)}}for(r=e.children,n=0,a=r.length;a>n;n++)m(r[n],t)}}function v(e,t,n,r){for(var o=0,s=e.length;s>o;o++){var a=e[o],u=a.object,c=a.geometry,h=void 0===r?a.material:r,a=a.group;if(u.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,u.matrixWorld),u.normalMatrix.getNormalMatrix(u.modelViewMatrix),u instanceof i.ImmediateRenderObject){g(h);var l=y(t,n,h,u);Z="",u.render(function(e){W.renderBufferImmediate(e,l,h)})}else W.renderBufferDirect(t,n,c,h,u,a)}}function g(e){e.side!==i.DoubleSide?Re.enable(Te.CULL_FACE):Re.disable(Te.CULL_FACE),Re.setFlipSided(e.side===i.BackSide),!0===e.transparent?Re.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):Re.setBlending(i.NoBlending),Re.setDepthFunc(e.depthFunc),Re.setDepthTest(e.depthTest),Re.setDepthWrite(e.depthWrite),Re.setColorWrite(e.colorWrite),Re.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function y(e,t,n,r){ne=0;var o=Ne.get(n);if(pe){if(fe||e!==J){var s=n.clippingPlanes,a=e===J&&n.id===K;if(!fe||null===s||0===s.length||de&&!n.clipShadows)de?b(null):x();else{var h=de?0:ye,l=4*h,p=o.clippingState||null;for(ve.value=p,p=b(s,e,l,a),s=0;s!==l;++s)p[s]=ge[s];o.clippingState=p,me+=h}}void 0!==o.numClippingPlanes&&o.numClippingPlanes!==me&&(n.needsUpdate=!0)}if(void 0===o.program&&(n.needsUpdate=!0),void 0!==o.lightsHash&&o.lightsHash!==Me.hash&&(n.needsUpdate=!0),n.needsUpdate){e:{if(h=Ne.get(n),l=Ie.getParameters(n,Me,t,me,r),p=Ie.getProgramCode(n,l),s=h.program,a=!0,void 0===s)n.addEventListener("dispose",u);else if(s.code!==p)c(n);else{if(void 0!==l.shaderID)break e;a=!1}if(a&&(l.shaderID?(s=i.ShaderLib[l.shaderID],h.__webglShader={name:n.type,uniforms:i.UniformsUtils.clone(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}):h.__webglShader={name:n.type,uniforms:n.uniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader},n.__webglShader=h.__webglShader,s=Ie.acquireProgram(n,l,p),h.program=s,n.program=s),l=s.getAttributes(),n.morphTargets)for(p=n.numSupportedMorphTargets=0;p<W.maxMorphTargets;p++)0<=l["morphTarget"+p]&&n.numSupportedMorphTargets++;if(n.morphNormals)for(p=n.numSupportedMorphNormals=0;p<W.maxMorphNormals;p++)0<=l["morphNormal"+p]&&n.numSupportedMorphNormals++;l=h.__webglShader.uniforms,(n instanceof i.ShaderMaterial||n instanceof i.RawShaderMaterial)&&!0!==n.clipping||(h.numClippingPlanes=me,l.clippingPlanes=ve),(n instanceof i.MeshPhongMaterial||n instanceof i.MeshLambertMaterial||n instanceof i.MeshStandardMaterial||n.lights)&&(h.lightsHash=Me.hash,l.ambientLightColor.value=Me.ambient,l.directionalLights.value=Me.directional,l.spotLights.value=Me.spot,l.pointLights.value=Me.point,l.hemisphereLights.value=Me.hemi,l.directionalShadowMap.value=Me.directionalShadowMap,l.directionalShadowMatrix.value=Me.directionalShadowMatrix,l.spotShadowMap.value=Me.spotShadowMap,l.spotShadowMatrix.value=Me.spotShadowMatrix,l.pointShadowMap.value=Me.pointShadowMap,l.pointShadowMatrix.value=Me.pointShadowMatrix),p=h.program.getUniforms(),p=i.WebGLUniforms.seqWithValue(p.seq,l),h.uniformsList=p,h.dynamicUniforms=i.WebGLUniforms.splitDynamic(p,l)}n.needsUpdate=!1}var f=!1,a=s=!1,h=o.program,p=h.getUniforms(),l=o.__webglShader.uniforms;if(h.id!==q&&(Te.useProgram(h.program),q=h.id,a=s=f=!0),n.id!==K&&(K=n.id,s=!0),(f||e!==J)&&(p.set(Te,e,"projectionMatrix"),Le.logarithmicDepthBuffer&&p.setValue(Te,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==J&&(J=e,a=s=!0),(n instanceof i.ShaderMaterial||n instanceof i.MeshPhongMaterial||n instanceof i.MeshStandardMaterial||n.envMap)&&(f=p.map.cameraPosition,void 0!==f&&f.setValue(Te,Se.setFromMatrixPosition(e.matrixWorld))),(n instanceof i.MeshPhongMaterial||n instanceof i.MeshLambertMaterial||n instanceof i.MeshBasicMaterial||n instanceof i.MeshStandardMaterial||n instanceof i.ShaderMaterial||n.skinning)&&p.setValue(Te,"viewMatrix",e.matrixWorldInverse),p.set(Te,W,"toneMappingExposure"),p.set(Te,W,"toneMappingWhitePoint")),n.skinning&&(p.setOptional(Te,r,"bindMatrix"),p.setOptional(Te,r,"bindMatrixInverse"),f=r.skeleton)&&(Le.floatVertexTextures&&f.useVertexTexture?(p.set(Te,f,"boneTexture"),p.set(Te,f,"boneTextureWidth"),p.set(Te,f,"boneTextureHeight")):p.setOptional(Te,f,"boneMatrices")),s){if((n instanceof i.MeshPhongMaterial||n instanceof i.MeshLambertMaterial||n instanceof i.MeshStandardMaterial||n.lights)&&(s=a,l.ambientLightColor.needsUpdate=s,l.directionalLights.needsUpdate=s,l.pointLights.needsUpdate=s,l.spotLights.needsUpdate=s,l.hemisphereLights.needsUpdate=s),t&&n.fog&&(l.fogColor.value=t.color,t instanceof i.Fog?(l.fogNear.value=t.near,l.fogFar.value=t.far):t instanceof i.FogExp2&&(l.fogDensity.value=t.density)),n instanceof i.MeshBasicMaterial||n instanceof i.MeshLambertMaterial||n instanceof i.MeshPhongMaterial||n instanceof i.MeshStandardMaterial||n instanceof i.MeshDepthMaterial){l.opacity.value=n.opacity,l.diffuse.value=n.color,n.emissive&&l.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),l.map.value=n.map,l.specularMap.value=n.specularMap,l.alphaMap.value=n.alphaMap,n.aoMap&&(l.aoMap.value=n.aoMap,l.aoMapIntensity.value=n.aoMapIntensity);var d;n.map?d=n.map:n.specularMap?d=n.specularMap:n.displacementMap?d=n.displacementMap:n.normalMap?d=n.normalMap:n.bumpMap?d=n.bumpMap:n.roughnessMap?d=n.roughnessMap:n.metalnessMap?d=n.metalnessMap:n.alphaMap?d=n.alphaMap:n.emissiveMap&&(d=n.emissiveMap),void 0!==d&&(d instanceof i.WebGLRenderTarget&&(d=d.texture),t=d.offset,d=d.repeat,l.offsetRepeat.value.set(t.x,t.y,d.x,d.y)),l.envMap.value=n.envMap,l.flipEnvMap.value=n.envMap instanceof i.WebGLRenderTargetCube?1:-1,l.reflectivity.value=n.reflectivity,l.refractionRatio.value=n.refractionRatio}n instanceof i.LineBasicMaterial?(l.diffuse.value=n.color,l.opacity.value=n.opacity):n instanceof i.LineDashedMaterial?(l.diffuse.value=n.color,l.opacity.value=n.opacity,l.dashSize.value=n.dashSize,l.totalSize.value=n.dashSize+n.gapSize,l.scale.value=n.scale):n instanceof i.PointsMaterial?(l.diffuse.value=n.color,l.opacity.value=n.opacity,l.size.value=n.size*ae,l.scale.value=.5*O.clientHeight,l.map.value=n.map,null!==n.map&&(d=n.map.offset,n=n.map.repeat,l.offsetRepeat.value.set(d.x,d.y,n.x,n.y))):n instanceof i.MeshLambertMaterial?(n.lightMap&&(l.lightMap.value=n.lightMap,l.lightMapIntensity.value=n.lightMapIntensity),n.emissiveMap&&(l.emissiveMap.value=n.emissiveMap)):n instanceof i.MeshPhongMaterial?(l.specular.value=n.specular,l.shininess.value=Math.max(n.shininess,1e-4),n.lightMap&&(l.lightMap.value=n.lightMap,l.lightMapIntensity.value=n.lightMapIntensity),n.emissiveMap&&(l.emissiveMap.value=n.emissiveMap),n.bumpMap&&(l.bumpMap.value=n.bumpMap,l.bumpScale.value=n.bumpScale),n.normalMap&&(l.normalMap.value=n.normalMap,l.normalScale.value.copy(n.normalScale)),n.displacementMap&&(l.displacementMap.value=n.displacementMap,l.displacementScale.value=n.displacementScale,l.displacementBias.value=n.displacementBias)):n instanceof i.MeshPhysicalMaterial?_(l,n):n instanceof i.MeshStandardMaterial?_(l,n):n instanceof i.MeshDepthMaterial?n.displacementMap&&(l.displacementMap.value=n.displacementMap,l.displacementScale.value=n.displacementScale,l.displacementBias.value=n.displacementBias):n instanceof i.MeshNormalMaterial&&(l.opacity.value=n.opacity),i.WebGLUniforms.upload(Te,o.uniformsList,l,W)}return p.set(Te,r,"modelViewMatrix"),p.set(Te,r,"normalMatrix"),p.setValue(Te,"modelMatrix",r.matrixWorld),o=o.dynamicUniforms,null!==o&&(i.WebGLUniforms.evalDynamic(o,l,r,e),i.WebGLUniforms.upload(Te,o,l,W)),h}function _(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function b(e,t,n,r){var i=null!==e?e.length:0,o=null;if(0!==i){if(o=ve.value,!0!==r||null===o){var s=n+4*i;for(t=t.matrixWorldInverse,r=_e.getNormalMatrix(t),(null===o||o.length<s)&&(o=new Float32Array(s)),s=0;s!==i;++s,n+=4){var a=xe.copy(e[s]).applyMatrix4(t,r);a.normal.toArray(o,n),o[n+3]=a.constant}}ve.value=o,ve.needsUpdate=!0}return me=i,o}function x(){ve.value!==ge&&(ve.value=ge,ve.needsUpdate=ye>0),me=ye}function w(e,t,n){n?(Te.texParameteri(e,Te.TEXTURE_WRAP_S,P(t.wrapS)),Te.texParameteri(e,Te.TEXTURE_WRAP_T,P(t.wrapT)),Te.texParameteri(e,Te.TEXTURE_MAG_FILTER,P(t.magFilter)),Te.texParameteri(e,Te.TEXTURE_MIN_FILTER,P(t.minFilter))):(Te.texParameteri(e,Te.TEXTURE_WRAP_S,Te.CLAMP_TO_EDGE),Te.texParameteri(e,Te.TEXTURE_WRAP_T,Te.CLAMP_TO_EDGE),t.wrapS===i.ClampToEdgeWrapping&&t.wrapT===i.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),Te.texParameteri(e,Te.TEXTURE_MAG_FILTER,A(t.magFilter)),Te.texParameteri(e,Te.TEXTURE_MIN_FILTER,A(t.minFilter)),t.minFilter!==i.NearestFilter&&t.minFilter!==i.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),!(n=Oe.get("EXT_texture_filter_anisotropic"))||t.type===i.FloatType&&null===Oe.get("OES_texture_float_linear")||t.type===i.HalfFloatType&&null===Oe.get("OES_texture_half_float_linear")||!(1<t.anisotropy||Ne.get(t).__currentAnisotropy)||(Te.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,W.getMaxAnisotropy())),Ne.get(t).__currentAnisotropy=t.anisotropy)}function S(e,t){e instanceof i.WebGLRenderTarget&&(e=e.texture);var n=Ne.get(e);if(0<e.version&&n.__version!==e.version){var r=e.image;if(void 0===r)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else if(!1===r.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e);else{
|
||
r=e,void 0===n.__webglInit&&(n.__webglInit=!0,r.addEventListener("dispose",s),n.__webglTexture=Te.createTexture(),Ee.textures++),Re.activeTexture(Te.TEXTURE0+t),Re.bindTexture(Te.TEXTURE_2D,n.__webglTexture),Te.pixelStorei(Te.UNPACK_FLIP_Y_WEBGL,r.flipY),Te.pixelStorei(Te.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),Te.pixelStorei(Te.UNPACK_ALIGNMENT,r.unpackAlignment);var o=M(r.image,Le.maxTextureSize);if((r.wrapS!==i.ClampToEdgeWrapping||r.wrapT!==i.ClampToEdgeWrapping||r.minFilter!==i.NearestFilter&&r.minFilter!==i.LinearFilter)&&!1===E(o)){var a=o;if(a instanceof HTMLImageElement||a instanceof HTMLCanvasElement){var u=document.createElement("canvas");u.width=i.Math.nearestPowerOfTwo(a.width),u.height=i.Math.nearestPowerOfTwo(a.height),u.getContext("2d").drawImage(a,0,0,u.width,u.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+a.width+"x"+a.height+"). Resized to "+u.width+"x"+u.height,a),o=u}else o=a}var a=E(o),u=P(r.format),c=P(r.type);w(Te.TEXTURE_2D,r,a);var h=r.mipmaps;if(r instanceof i.DepthTexture){if(h=Te.DEPTH_COMPONENT,r.type===i.FloatType){if(!Pe)throw Error("Float Depth Texture only supported in WebGL2.0");h=Te.DEPTH_COMPONENT32F}else Pe&&(h=Te.DEPTH_COMPONENT16);Re.texImage2D(Te.TEXTURE_2D,0,h,o.width,o.height,0,u,c,null)}else if(r instanceof i.DataTexture)if(0<h.length&&a){for(var l=0,p=h.length;p>l;l++)o=h[l],Re.texImage2D(Te.TEXTURE_2D,l,u,o.width,o.height,0,u,c,o.data);r.generateMipmaps=!1}else Re.texImage2D(Te.TEXTURE_2D,0,u,o.width,o.height,0,u,c,o.data);else if(r instanceof i.CompressedTexture)for(l=0,p=h.length;p>l;l++)o=h[l],r.format!==i.RGBAFormat&&r.format!==i.RGBFormat?-1<Re.getCompressedTextureFormats().indexOf(u)?Re.compressedTexImage2D(Te.TEXTURE_2D,l,u,o.width,o.height,0,o.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Re.texImage2D(Te.TEXTURE_2D,l,u,o.width,o.height,0,u,c,o.data);else if(0<h.length&&a){for(l=0,p=h.length;p>l;l++)o=h[l],Re.texImage2D(Te.TEXTURE_2D,l,u,u,c,o);r.generateMipmaps=!1}else Re.texImage2D(Te.TEXTURE_2D,0,u,u,c,o);r.generateMipmaps&&a&&Te.generateMipmap(Te.TEXTURE_2D),n.__version=r.version,r.onUpdate&&r.onUpdate(r)}}else Re.activeTexture(Te.TEXTURE0+t),Re.bindTexture(Te.TEXTURE_2D,n.__webglTexture)}function M(e,t){if(e.width>t||e.height>t){var n=t/Math.max(e.width,e.height),r=document.createElement("canvas");return r.width=Math.floor(e.width*n),r.height=Math.floor(e.height*n),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 E(e){return i.Math.isPowerOfTwo(e.width)&&i.Math.isPowerOfTwo(e.height)}function C(e,t,n,r){var i=P(t.texture.format),o=P(t.texture.type);Re.texImage2D(r,0,i,t.width,t.height,0,i,o,null),Te.bindFramebuffer(Te.FRAMEBUFFER,e),Te.framebufferTexture2D(Te.FRAMEBUFFER,n,r,Ne.get(t.texture).__webglTexture,0),Te.bindFramebuffer(Te.FRAMEBUFFER,null)}function T(e,t){Te.bindRenderbuffer(Te.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Te.renderbufferStorage(Te.RENDERBUFFER,Te.DEPTH_COMPONENT16,t.width,t.height),Te.framebufferRenderbuffer(Te.FRAMEBUFFER,Te.DEPTH_ATTACHMENT,Te.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Te.renderbufferStorage(Te.RENDERBUFFER,Te.DEPTH_STENCIL,t.width,t.height),Te.framebufferRenderbuffer(Te.FRAMEBUFFER,Te.DEPTH_STENCIL_ATTACHMENT,Te.RENDERBUFFER,e)):Te.renderbufferStorage(Te.RENDERBUFFER,Te.RGBA4,t.width,t.height),Te.bindRenderbuffer(Te.RENDERBUFFER,null)}function A(e){return e===i.NearestFilter||e===i.NearestMipMapNearestFilter||e===i.NearestMipMapLinearFilter?Te.NEAREST:Te.LINEAR}function P(e){var t;if(e===i.RepeatWrapping)return Te.REPEAT;if(e===i.ClampToEdgeWrapping)return Te.CLAMP_TO_EDGE;if(e===i.MirroredRepeatWrapping)return Te.MIRRORED_REPEAT;if(e===i.NearestFilter)return Te.NEAREST;if(e===i.NearestMipMapNearestFilter)return Te.NEAREST_MIPMAP_NEAREST;if(e===i.NearestMipMapLinearFilter)return Te.NEAREST_MIPMAP_LINEAR;if(e===i.LinearFilter)return Te.LINEAR;if(e===i.LinearMipMapNearestFilter)return Te.LINEAR_MIPMAP_NEAREST;if(e===i.LinearMipMapLinearFilter)return Te.LINEAR_MIPMAP_LINEAR;if(e===i.UnsignedByteType)return Te.UNSIGNED_BYTE;if(e===i.UnsignedShort4444Type)return Te.UNSIGNED_SHORT_4_4_4_4;if(e===i.UnsignedShort5551Type)return Te.UNSIGNED_SHORT_5_5_5_1;if(e===i.UnsignedShort565Type)return Te.UNSIGNED_SHORT_5_6_5;if(e===i.ByteType)return Te.BYTE;if(e===i.ShortType)return Te.SHORT;if(e===i.UnsignedShortType)return Te.UNSIGNED_SHORT;if(e===i.IntType)return Te.INT;if(e===i.UnsignedIntType)return Te.UNSIGNED_INT;if(e===i.FloatType)return Te.FLOAT;if(t=Oe.get("OES_texture_half_float"),null!==t&&e===i.HalfFloatType)return t.HALF_FLOAT_OES;if(e===i.AlphaFormat)return Te.ALPHA;if(e===i.RGBFormat)return Te.RGB;if(e===i.RGBAFormat)return Te.RGBA;if(e===i.LuminanceFormat)return Te.LUMINANCE;if(e===i.LuminanceAlphaFormat)return Te.LUMINANCE_ALPHA;if(e===i.DepthFormat)return Te.DEPTH_COMPONENT;if(e===i.AddEquation)return Te.FUNC_ADD;if(e===i.SubtractEquation)return Te.FUNC_SUBTRACT;if(e===i.ReverseSubtractEquation)return Te.FUNC_REVERSE_SUBTRACT;if(e===i.ZeroFactor)return Te.ZERO;if(e===i.OneFactor)return Te.ONE;if(e===i.SrcColorFactor)return Te.SRC_COLOR;if(e===i.OneMinusSrcColorFactor)return Te.ONE_MINUS_SRC_COLOR;if(e===i.SrcAlphaFactor)return Te.SRC_ALPHA;if(e===i.OneMinusSrcAlphaFactor)return Te.ONE_MINUS_SRC_ALPHA;if(e===i.DstAlphaFactor)return Te.DST_ALPHA;if(e===i.OneMinusDstAlphaFactor)return Te.ONE_MINUS_DST_ALPHA;if(e===i.DstColorFactor)return Te.DST_COLOR;if(e===i.OneMinusDstColorFactor)return Te.ONE_MINUS_DST_COLOR;if(e===i.SrcAlphaSaturateFactor)return Te.SRC_ALPHA_SATURATE;if(t=Oe.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===i.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===i.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===i.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===i.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=Oe.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===i.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===i.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===i.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===i.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=Oe.get("WEBGL_compressed_texture_etc1"),null!==t&&e===i.RGB_ETC1_Format)return t.COMPRESSED_RGB_ETC1_WEBGL;if(t=Oe.get("EXT_blend_minmax"),null!==t){if(e===i.MinEquation)return t.MIN_EXT;if(e===i.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",i.REVISION),e=e||{};var O=void 0!==e.canvas?e.canvas:document.createElement("canvas"),L=void 0!==e.context?e.context:null,R=void 0!==e.alpha?e.alpha:!1,N=void 0!==e.depth?e.depth:!0,D=void 0!==e.stencil?e.stencil:!0,I=void 0!==e.antialias?e.antialias:!1,k=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,j=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,F=[],B=[],V=-1,U=[],G=-1,z=new Float32Array(8),H=[],$=[];this.domElement=O,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1,this.toneMapping=i.LinearToneMapping,this.toneMappingWhitePoint=this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var W=this,q=null,X=null,Y=null,K=-1,Z="",J=null,Q=new i.Vector4,ee=null,te=new i.Vector4,ne=0,re=new i.Color(0),ie=0,oe=O.width,se=O.height,ae=1,ue=new i.Vector4(0,0,oe,se),ce=!1,he=new i.Vector4(0,0,oe,se),le=new i.Frustum,pe=!1,fe=!1,de=!1,me=0,ve={type:"4fv",value:null,needsUpdate:!1},ge=null,ye=0,_e=new i.Matrix3,be=new i.Sphere,xe=new i.Plane,we=new i.Matrix4,Se=new i.Vector3,Me={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ee={geometries:0,textures:0},Ce={calls:0,vertices:0,faces:0,points:0};this.info={render:Ce,memory:Ee,programs:null};var Te;try{if(R={alpha:R,depth:N,stencil:D,antialias:I,premultipliedAlpha:k,preserveDrawingBuffer:j},Te=L||O.getContext("webgl",R)||O.getContext("experimental-webgl",R),null===Te){if(null!==O.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}void 0===Te.getShaderPrecisionFormat&&(Te.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),O.addEventListener("webglcontextlost",o,!1)}catch(Ae){console.error("THREE.WebGLRenderer: "+Ae)}var Pe="undefined"!=typeof WebGL2RenderingContext&&Te instanceof WebGL2RenderingContext,Oe=new i.WebGLExtensions(Te);Oe.get("WEBGL_depth_texture"),Oe.get("OES_texture_float"),Oe.get("OES_texture_float_linear"),Oe.get("OES_texture_half_float"),Oe.get("OES_texture_half_float_linear"),Oe.get("OES_standard_derivatives"),Oe.get("ANGLE_instanced_arrays"),Oe.get("OES_element_index_uint")&&(i.BufferGeometry.MaxIndex=4294967296);var Le=new i.WebGLCapabilities(Te,Oe,e),Re=new i.WebGLState(Te,Oe,P),Ne=new i.WebGLProperties,De=new i.WebGLObjects(Te,Ne,this.info),Ie=new i.WebGLPrograms(this,Le),ke=new i.WebGLLights;this.info.programs=Ie.programs;var je=new i.WebGLBufferRenderer(Te,Oe,Ce),Fe=new i.WebGLIndexedBufferRenderer(Te,Oe,Ce);n(),this.context=Te,this.capabilities=Le,this.extensions=Oe,this.properties=Ne,this.state=Re;var Be=new i.WebGLShadowMap(this,Me,De);this.shadowMap=Be;var Ve=new i.SpritePlugin(this,H),Ue=new i.LensFlarePlugin(this,$);this.getContext=function(){return Te},this.getContextAttributes=function(){return Te.getContextAttributes()},this.forceContextLoss=function(){Oe.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=Oe.get("EXT_texture_filter_anisotropic");return e=null!==t?Te.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return Le.precision},this.getPixelRatio=function(){return ae},this.setPixelRatio=function(e){void 0!==e&&(ae=e,this.setSize(he.z,he.w,!1))},this.getSize=function(){return{width:oe,height:se}},this.setSize=function(e,t,n){oe=e,se=t,O.width=e*ae,O.height=t*ae,!1!==n&&(O.style.width=e+"px",O.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,n,r){Re.viewport(he.set(e,t,n,r))},this.setScissor=function(e,t,n,r){Re.scissor(ue.set(e,t,n,r))},this.setScissorTest=function(e){Re.setScissorTest(ce=e)},this.getClearColor=function(){return re},this.setClearColor=function(e,n){re.set(e),ie=void 0!==n?n:1,t(re.r,re.g,re.b,ie)},this.getClearAlpha=function(){return ie},this.setClearAlpha=function(e){ie=e,t(re.r,re.g,re.b,ie)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=Te.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=Te.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Te.STENCIL_BUFFER_BIT),Te.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,n,r){this.setRenderTarget(e),this.clear(t,n,r)},this.resetGLState=r,this.dispose=function(){O.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(e,t,n){Re.initAttributes();var r=Ne.get(e);if(e.hasPositions&&!r.position&&(r.position=Te.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=Te.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=Te.createBuffer()),e.hasColors&&!r.color&&(r.color=Te.createBuffer()),t=t.getAttributes(),e.hasPositions&&(Te.bindBuffer(Te.ARRAY_BUFFER,r.position),Te.bufferData(Te.ARRAY_BUFFER,e.positionArray,Te.DYNAMIC_DRAW),Re.enableAttribute(t.position),Te.vertexAttribPointer(t.position,3,Te.FLOAT,!1,0,0)),e.hasNormals){if(Te.bindBuffer(Te.ARRAY_BUFFER,r.normal),"MeshPhongMaterial"!==n.type&&"MeshStandardMaterial"!==n.type&&"MeshPhysicalMaterial"!==n.type&&n.shading===i.FlatShading)for(var o=0,s=3*e.count;s>o;o+=9){var a=e.normalArray,u=(a[o+0]+a[o+3]+a[o+6])/3,c=(a[o+1]+a[o+4]+a[o+7])/3,h=(a[o+2]+a[o+5]+a[o+8])/3;a[o+0]=u,a[o+1]=c,a[o+2]=h,a[o+3]=u,a[o+4]=c,a[o+5]=h,a[o+6]=u,a[o+7]=c,a[o+8]=h}Te.bufferData(Te.ARRAY_BUFFER,e.normalArray,Te.DYNAMIC_DRAW),Re.enableAttribute(t.normal),Te.vertexAttribPointer(t.normal,3,Te.FLOAT,!1,0,0)}e.hasUvs&&n.map&&(Te.bindBuffer(Te.ARRAY_BUFFER,r.uv),Te.bufferData(Te.ARRAY_BUFFER,e.uvArray,Te.DYNAMIC_DRAW),Re.enableAttribute(t.uv),Te.vertexAttribPointer(t.uv,2,Te.FLOAT,!1,0,0)),e.hasColors&&n.vertexColors!==i.NoColors&&(Te.bindBuffer(Te.ARRAY_BUFFER,r.color),Te.bufferData(Te.ARRAY_BUFFER,e.colorArray,Te.DYNAMIC_DRAW),Re.enableAttribute(t.color),Te.vertexAttribPointer(t.color,3,Te.FLOAT,!1,0,0)),Re.disableUnusedAttributes(),Te.drawArrays(Te.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,o,s){g(r);var a=y(e,t,r,o),u=!1;if(e=n.id+"_"+a.id+"_"+r.wireframe,e!==Z&&(Z=e,u=!0),t=o.morphTargetInfluences,void 0!==t){e=[];for(var c=0,u=t.length;u>c;c++){var l=t[c];e.push([l,c])}e.sort(h),8<e.length&&(e.length=8);for(var p=n.morphAttributes,c=0,u=e.length;u>c;c++)l=e[c],z[c]=l[0],0!==l[0]?(t=l[1],!0===r.morphTargets&&p.position&&n.addAttribute("morphTarget"+c,p.position[t]),!0===r.morphNormals&&p.normal&&n.addAttribute("morphNormal"+c,p.normal[t])):(!0===r.morphTargets&&n.removeAttribute("morphTarget"+c),!0===r.morphNormals&&n.removeAttribute("morphNormal"+c));a.getUniforms().setValue(Te,"morphTargetInfluences",z),u=!0}if(t=n.index,c=n.attributes.position,!0===r.wireframe&&(t=De.getWireframeAttribute(n)),null!==t?(e=Fe,e.setIndex(t)):e=je,u){var f,u=void 0;if(n instanceof i.InstancedBufferGeometry&&(f=Oe.get("ANGLE_instanced_arrays"),null===f))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===u&&(u=0),Re.initAttributes();var d,l=n.attributes,a=a.getAttributes(),p=r.defaultAttributeValues;for(d in a){var m=a[d];if(m>=0){var v=l[d];if(void 0!==v){var _=Te.FLOAT,b=v.array,x=v.normalized;b instanceof Float32Array?_=Te.FLOAT:b instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):b instanceof Uint16Array?_=Te.UNSIGNED_SHORT:b instanceof Int16Array?_=Te.SHORT:b instanceof Uint32Array?_=Te.UNSIGNED_INT:b instanceof Int32Array?_=Te.INT:b instanceof Int8Array?_=Te.BYTE:b instanceof Uint8Array&&(_=Te.UNSIGNED_BYTE);var b=v.itemSize,w=De.getAttributeBuffer(v);if(v instanceof i.InterleavedBufferAttribute){var S=v.data,M=S.stride,v=v.offset;S instanceof i.InstancedInterleavedBuffer?(Re.enableAttributeAndDivisor(m,S.meshPerAttribute,f),void 0===n.maxInstancedCount&&(n.maxInstancedCount=S.meshPerAttribute*S.count)):Re.enableAttribute(m),Te.bindBuffer(Te.ARRAY_BUFFER,w),Te.vertexAttribPointer(m,b,_,x,M*S.array.BYTES_PER_ELEMENT,(u*M+v)*S.array.BYTES_PER_ELEMENT)}else v instanceof i.InstancedBufferAttribute?(Re.enableAttributeAndDivisor(m,v.meshPerAttribute,f),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):Re.enableAttribute(m),Te.bindBuffer(Te.ARRAY_BUFFER,w),Te.vertexAttribPointer(m,b,_,x,0,u*b*v.array.BYTES_PER_ELEMENT)}else if(void 0!==p&&(_=p[d],void 0!==_))switch(_.length){case 2:Te.vertexAttrib2fv(m,_);break;case 3:Te.vertexAttrib3fv(m,_);break;case 4:Te.vertexAttrib4fv(m,_);break;default:Te.vertexAttrib1fv(m,_)}}}Re.disableUnusedAttributes()}null!==t&&Te.bindBuffer(Te.ELEMENT_ARRAY_BUFFER,De.getAttributeBuffer(t))}if(f=1/0,null!==t?f=t.count:void 0!==c&&(f=c.count),d=n.drawRange.start,t=n.drawRange.count,c=null!==s?s.start:0,u=null!==s?s.count:1/0,s=Math.max(0,d,c),f=Math.min(0+f,d+t,c+u)-1,f=Math.max(0,f-s+1),o instanceof i.Mesh)if(!0===r.wireframe)Re.setLineWidth(r.wireframeLinewidth*(null===X?ae:1)),e.setMode(Te.LINES);else switch(o.drawMode){case i.TrianglesDrawMode:e.setMode(Te.TRIANGLES);break;case i.TriangleStripDrawMode:e.setMode(Te.TRIANGLE_STRIP);break;case i.TriangleFanDrawMode:e.setMode(Te.TRIANGLE_FAN)}else o instanceof i.Line?(r=r.linewidth,void 0===r&&(r=1),Re.setLineWidth(r*(null===X?ae:1)),o instanceof i.LineSegments?e.setMode(Te.LINES):e.setMode(Te.LINE_STRIP)):o instanceof i.Points&&e.setMode(Te.POINTS);n instanceof i.InstancedBufferGeometry?0<n.maxInstancedCount&&e.renderInstances(n,s,f):e.render(s,f)},this.render=function(e,t,n,r){if(!1==t instanceof i.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var o=e.fog;Z="",K=-1,J=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),we.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),le.setFromMatrix(we),F.length=0,G=V=-1,H.length=0,$.length=0;var s=this.clippingPlanes;pe=0!==W.clippingPlanes.length||W.localClippingEnabled||0!==ye||fe,fe=W.localClippingEnabled,ge=b(s,t,0),ye=null!==s?s.length:0,m(e,t),B.length=V+1,U.length=G+1,!0===W.sortObjects&&(B.sort(l),U.sort(p)),pe&&(de=!0,b(null));for(var s=F,a=0,u=0,c=s.length;c>u;u++){var h=s[u];h.castShadow&&(Me.shadows[a++]=h)}Me.shadows.length=a,Be.render(e,t);for(var f,d,g,s=F,y=h=0,_=0,w=t.matrixWorldInverse,S=0,M=0,C=0,T=0,a=0,u=s.length;u>a;a++)if(c=s[a],f=c.color,d=c.intensity,g=c.distance,c instanceof i.AmbientLight)h+=f.r*d,y+=f.g*d,_+=f.b*d;else if(c instanceof i.DirectionalLight){var A=ke.get(c);A.color.copy(c.color).multiplyScalar(c.intensity),A.direction.setFromMatrixPosition(c.matrixWorld),Se.setFromMatrixPosition(c.target.matrixWorld),A.direction.sub(Se),A.direction.transformDirection(w),(A.shadow=c.castShadow)&&(A.shadowBias=c.shadow.bias,A.shadowRadius=c.shadow.radius,A.shadowMapSize=c.shadow.mapSize),Me.directionalShadowMap[S]=c.shadow.map,Me.directionalShadowMatrix[S]=c.shadow.matrix,Me.directional[S++]=A}else c instanceof i.SpotLight?(A=ke.get(c),A.position.setFromMatrixPosition(c.matrixWorld),A.position.applyMatrix4(w),A.color.copy(f).multiplyScalar(d),A.distance=g,A.direction.setFromMatrixPosition(c.matrixWorld),Se.setFromMatrixPosition(c.target.matrixWorld),A.direction.sub(Se),A.direction.transformDirection(w),A.coneCos=Math.cos(c.angle),A.penumbraCos=Math.cos(c.angle*(1-c.penumbra)),A.decay=0===c.distance?0:c.decay,(A.shadow=c.castShadow)&&(A.shadowBias=c.shadow.bias,A.shadowRadius=c.shadow.radius,A.shadowMapSize=c.shadow.mapSize),Me.spotShadowMap[C]=c.shadow.map,Me.spotShadowMatrix[C]=c.shadow.matrix,Me.spot[C++]=A):c instanceof i.PointLight?(A=ke.get(c),A.position.setFromMatrixPosition(c.matrixWorld),A.position.applyMatrix4(w),A.color.copy(c.color).multiplyScalar(c.intensity),A.distance=c.distance,A.decay=0===c.distance?0:c.decay,(A.shadow=c.castShadow)&&(A.shadowBias=c.shadow.bias,A.shadowRadius=c.shadow.radius,A.shadowMapSize=c.shadow.mapSize),Me.pointShadowMap[M]=c.shadow.map,void 0===Me.pointShadowMatrix[M]&&(Me.pointShadowMatrix[M]=new i.Matrix4),Se.setFromMatrixPosition(c.matrixWorld).negate(),Me.pointShadowMatrix[M].identity().setPosition(Se),Me.point[M++]=A):c instanceof i.HemisphereLight&&(A=ke.get(c),A.direction.setFromMatrixPosition(c.matrixWorld),A.direction.transformDirection(w),A.direction.normalize(),A.skyColor.copy(c.color).multiplyScalar(d),A.groundColor.copy(c.groundColor).multiplyScalar(d),Me.hemi[T++]=A);Me.ambient[0]=h,Me.ambient[1]=y,Me.ambient[2]=_,Me.directional.length=S,Me.spot.length=C,Me.point.length=M,Me.hemi.length=T,Me.hash=S+","+M+","+C+","+T+","+Me.shadows.length,pe&&(de=!1,x()),Ce.calls=0,Ce.vertices=0,Ce.faces=0,Ce.points=0,void 0===n&&(n=null),this.setRenderTarget(n),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial?(r=e.overrideMaterial,v(B,t,o,r),v(U,t,o,r)):(Re.setBlending(i.NoBlending),v(B,t,o),v(U,t,o)),Ve.render(e,t),Ue.render(e,t,te),n&&(e=n.texture,e.generateMipmaps&&E(n)&&e.minFilter!==i.NearestFilter&&e.minFilter!==i.LinearFilter&&(e=n instanceof i.WebGLRenderTargetCube?Te.TEXTURE_CUBE_MAP:Te.TEXTURE_2D,n=Ne.get(n.texture).__webglTexture,Re.bindTexture(e,n),Te.generateMipmap(e),Re.bindTexture(e,null))),Re.setDepthTest(!0),Re.setDepthWrite(!0),Re.setColorWrite(!0)}},this.setFaceCulling=function(e,t){e===i.CullFaceNone?Re.disable(Te.CULL_FACE):(t===i.FrontFaceDirectionCW?Te.frontFace(Te.CW):Te.frontFace(Te.CCW),e===i.CullFaceBack?Te.cullFace(Te.BACK):e===i.CullFaceFront?Te.cullFace(Te.FRONT):Te.cullFace(Te.FRONT_AND_BACK),Re.enable(Te.CULL_FACE))};var Ge=!1;this.setTexture=function(e,t){Ge||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),Ge=!0),S(e,t)},this.allocTextureUnit=function(){var e=ne;return e>=Le.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Le.maxTextures),ne+=1,e},this.setTexture2D=S,this.setTextureCube=function(e,t){if(e instanceof i.CubeTexture||Array.isArray(e.image)&&6===e.image.length){var n=Ne.get(e);if(6===e.image.length)if(0<e.version&&n.__version!==e.version){n.__image__webglTextureCube||(e.addEventListener("dispose",s),n.__image__webglTextureCube=Te.createTexture(),Ee.textures++),Re.activeTexture(Te.TEXTURE0+t),Re.bindTexture(Te.TEXTURE_CUBE_MAP,n.__image__webglTextureCube),Te.pixelStorei(Te.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var r=e instanceof i.CompressedTexture,o=e.image[0]instanceof i.DataTexture,a=[],u=0;6>u;u++)a[u]=!W.autoScaleCubemaps||r||o?o?e.image[u].image:e.image[u]:M(e.image[u],Le.maxCubemapSize);var c=E(a[0]),h=P(e.format),l=P(e.type);for(w(Te.TEXTURE_CUBE_MAP,e,c),u=0;6>u;u++)if(r)for(var p,f=a[u].mipmaps,d=0,m=f.length;m>d;d++)p=f[d],e.format!==i.RGBAFormat&&e.format!==i.RGBFormat?-1<Re.getCompressedTextureFormats().indexOf(h)?Re.compressedTexImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X+u,d,h,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):Re.texImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X+u,d,h,p.width,p.height,0,h,l,p.data);else o?Re.texImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,h,a[u].width,a[u].height,0,h,l,a[u].data):Re.texImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,h,h,l,a[u]);e.generateMipmaps&&c&&Te.generateMipmap(Te.TEXTURE_CUBE_MAP),n.__version=e.version,e.onUpdate&&e.onUpdate(e)}else Re.activeTexture(Te.TEXTURE0+t),Re.bindTexture(Te.TEXTURE_CUBE_MAP,n.__image__webglTextureCube)}else n=e.texture,Re.activeTexture(Te.TEXTURE0+t),Re.bindTexture(Te.TEXTURE_CUBE_MAP,Ne.get(n).__webglTexture)},this.getCurrentRenderTarget=function(){return X},this.setRenderTarget=function(e){if((X=e)&&void 0===Ne.get(e).__webglFramebuffer){var t=Ne.get(e),n=Ne.get(e.texture);e.addEventListener("dispose",a),n.__webglTexture=Te.createTexture(),Ee.textures++;var r=e instanceof i.WebGLRenderTargetCube,o=i.Math.isPowerOfTwo(e.width)&&i.Math.isPowerOfTwo(e.height);if(r){t.__webglFramebuffer=[];for(var s=0;6>s;s++)t.__webglFramebuffer[s]=Te.createFramebuffer()}else t.__webglFramebuffer=Te.createFramebuffer();if(r){for(Re.bindTexture(Te.TEXTURE_CUBE_MAP,n.__webglTexture),w(Te.TEXTURE_CUBE_MAP,e.texture,o),s=0;6>s;s++)C(t.__webglFramebuffer[s],e,Te.COLOR_ATTACHMENT0,Te.TEXTURE_CUBE_MAP_POSITIVE_X+s);e.texture.generateMipmaps&&o&&Te.generateMipmap(Te.TEXTURE_CUBE_MAP),Re.bindTexture(Te.TEXTURE_CUBE_MAP,null)}else Re.bindTexture(Te.TEXTURE_2D,n.__webglTexture),w(Te.TEXTURE_2D,e.texture,o),C(t.__webglFramebuffer,e,Te.COLOR_ATTACHMENT0,Te.TEXTURE_2D),e.texture.generateMipmaps&&o&&Te.generateMipmap(Te.TEXTURE_2D),Re.bindTexture(Te.TEXTURE_2D,null);if(e.depthBuffer){if(t=Ne.get(e),n=e instanceof i.WebGLRenderTargetCube,e.depthTexture){if(n)throw Error("target.depthTexture not supported in Cube render targets");if(e instanceof i.WebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");if(Te.bindFramebuffer(Te.FRAMEBUFFER,t.__webglFramebuffer),!(e.depthTexture instanceof i.DepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");Ne.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),W.setTexture(e.depthTexture,0),t=Ne.get(e.depthTexture).__webglTexture,Te.framebufferTexture2D(Te.FRAMEBUFFER,Te.DEPTH_ATTACHMENT,Te.TEXTURE_2D,t,0)}else if(n)for(t.__webglDepthbuffer=[],n=0;6>n;n++)Te.bindFramebuffer(Te.FRAMEBUFFER,t.__webglFramebuffer[n]),t.__webglDepthbuffer[n]=Te.createRenderbuffer(),T(t.__webglDepthbuffer[n],e);else Te.bindFramebuffer(Te.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=Te.createRenderbuffer(),T(t.__webglDepthbuffer,e);Te.bindFramebuffer(Te.FRAMEBUFFER,null)}}t=e instanceof i.WebGLRenderTargetCube,e?(n=Ne.get(e),n=t?n.__webglFramebuffer[e.activeCubeFace]:n.__webglFramebuffer,Q.copy(e.scissor),ee=e.scissorTest,te.copy(e.viewport)):(n=null,Q.copy(ue).multiplyScalar(ae),ee=ce,te.copy(he).multiplyScalar(ae)),Y!==n&&(Te.bindFramebuffer(Te.FRAMEBUFFER,n),Y=n),Re.scissor(Q),Re.setScissorTest(ee),Re.viewport(te),t&&(t=Ne.get(e.texture),Te.framebufferTexture2D(Te.FRAMEBUFFER,Te.COLOR_ATTACHMENT0,Te.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,t.__webglTexture,e.activeMipMapLevel))},this.readRenderTargetPixels=function(e,t,n,r,o,s){if(!1==e instanceof i.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=Ne.get(e).__webglFramebuffer;if(a){var u=!1;a!==Y&&(Te.bindFramebuffer(Te.FRAMEBUFFER,a),u=!0);try{var c=e.texture;c.format!==i.RGBAFormat&&P(c.format)!==Te.getParameter(Te.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):c.type===i.UnsignedByteType||P(c.type)===Te.getParameter(Te.IMPLEMENTATION_COLOR_READ_TYPE)||c.type===i.FloatType&&Oe.get("WEBGL_color_buffer_float")||c.type===i.HalfFloatType&&Oe.get("EXT_color_buffer_half_float")?Te.checkFramebufferStatus(Te.FRAMEBUFFER)===Te.FRAMEBUFFER_COMPLETE?t>0&&t<=e.width-r&&n>0&&n<=e.height-o&&Te.readPixels(t,n,r,o,P(c.format),P(c.type),s):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{u&&Te.bindFramebuffer(Te.FRAMEBUFFER,Y)}}}}},i.WebGLRenderTarget=function(e,t,n){this.uuid=i.Math.generateUUID(),this.width=e,this.height=t,this.scissor=new i.Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new i.Vector4(0,0,e,t),n=n||{},void 0===n.minFilter&&(n.minFilter=i.LinearFilter),this.texture=new i.Texture(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0!==n.depthBuffer?n.depthBuffer:!0,this.stencilBuffer=void 0!==n.stencilBuffer?n.stencilBuffer:!0,this.depthTexture=null},i.WebGLRenderTarget.prototype={constructor:i.WebGLRenderTarget,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"})}},i.EventDispatcher.prototype.apply(i.WebGLRenderTarget.prototype),i.WebGLRenderTargetCube=function(e,t,n){i.WebGLRenderTarget.call(this,e,t,n),this.activeMipMapLevel=this.activeCubeFace=0},i.WebGLRenderTargetCube.prototype=Object.create(i.WebGLRenderTarget.prototype),i.WebGLRenderTargetCube.prototype.constructor=i.WebGLRenderTargetCube,i.WebGLBufferRenderer=function(e,t,n){var r;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.calls++,n.vertices+=i,r===e.TRIANGLES&&(n.faces+=i/3)},this.renderInstances=function(o){var s=t.get("ANGLE_instanced_arrays");if(null===s)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var a=o.attributes.position,u=0,u=a instanceof i.InterleavedBufferAttribute?a.data.count:a.count;s.drawArraysInstancedANGLE(r,0,u,o.maxInstancedCount),n.calls++,n.vertices+=u*o.maxInstancedCount,r===e.TRIANGLES&&(n.faces+=o.maxInstancedCount*u/3)}}},i.WebGLIndexedBufferRenderer=function(e,t,n){var r,i,o;this.setMode=function(e){r=e},this.setIndex=function(n){n.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(i=e.UNSIGNED_INT,o=4):(i=e.UNSIGNED_SHORT,o=2)},this.render=function(t,s){e.drawElements(r,s,i,t*o),n.calls++,n.vertices+=s,r===e.TRIANGLES&&(n.faces+=s/3)},this.renderInstances=function(s,a,u){var c=t.get("ANGLE_instanced_arrays");null===c?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(c.drawElementsInstancedANGLE(r,u,i,a*o,s.maxInstancedCount),n.calls++,n.vertices+=u*s.maxInstancedCount,r===e.TRIANGLES&&(n.faces+=s.maxInstancedCount*u/3))}},i.WebGLExtensions=function(e){var t={};this.get=function(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=e.getExtension("WEBGL_compressed_texture_etc1");break;default:r=e.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r}},i.WebGLCapabilities=function(e,t,n){function r(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision?"mediump":"lowp"}this.getMaxPrecision=r,this.precision=void 0!==n.precision?n.precision:"highp",this.logarithmicDepthBuffer=void 0!==n.logarithmicDepthBuffer?n.logarithmicDepthBuffer:!1,this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubemapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=e.getParameter(e.MAX_VARYING_VECTORS),this.maxFragmentUniforms=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=0<this.maxVertexTextures,this.floatFragmentTextures=!!t.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures,n=r(this.precision),n!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",n,"instead."),this.precision=n),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!t.get("EXT_frag_depth"))},i.WebGLGeometries=function(e,t,n){function r(e){var i=e.target;e=s[i.id],null!==e.index&&o(e.index);var a,u=e.attributes;for(a in u)o(u[a]);i.removeEventListener("dispose",r),
|
||
delete s[i.id],a=t.get(i),a.wireframe&&o(a.wireframe),t["delete"](i),i=t.get(e),i.wireframe&&o(i.wireframe),t["delete"](e),n.memory.geometries--}function o(n){var r;r=n instanceof i.InterleavedBufferAttribute?t.get(n.data).__webglBuffer:t.get(n).__webglBuffer,void 0!==r&&(e.deleteBuffer(r),n instanceof i.InterleavedBufferAttribute?t["delete"](n.data):t["delete"](n))}var s={};this.get=function(e){var t=e.geometry;if(void 0!==s[t.id])return s[t.id];t.addEventListener("dispose",r);var o;return t instanceof i.BufferGeometry?o=t:t instanceof i.Geometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new i.BufferGeometry).setFromObject(e)),o=t._bufferGeometry),s[t.id]=o,n.memory.geometries++,o}},i.WebGLLights=function(){var e={};this.get=function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new i.Vector3,color:new i.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i.Vector2};break;case"SpotLight":n={position:new i.Vector3,direction:new i.Vector3,color:new i.Color,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i.Vector2};break;case"PointLight":n={position:new i.Vector3,color:new i.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i.Vector2};break;case"HemisphereLight":n={direction:new i.Vector3,skyColor:new i.Color,groundColor:new i.Color}}return e[t.id]=n}},i.WebGLObjects=function(e,t,n){function r(n,r){var o=n instanceof i.InterleavedBufferAttribute?n.data:n,s=t.get(o);void 0===s.__webglBuffer?(s.__webglBuffer=e.createBuffer(),e.bindBuffer(r,s.__webglBuffer),e.bufferData(r,o.array,o.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW),s.version=o.version):s.version!==o.version&&(e.bindBuffer(r,s.__webglBuffer),!1===o.dynamic||-1===o.updateRange.count?e.bufferSubData(r,0,o.array):0===o.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(r,o.updateRange.offset*o.array.BYTES_PER_ELEMENT,o.array.subarray(o.updateRange.offset,o.updateRange.offset+o.updateRange.count)),o.updateRange.count=0),s.version=o.version)}function o(e,t,n){if(t>n){var r=t;t=n,n=r}return r=e[t],void 0===r?(e[t]=[n],!0):-1===r.indexOf(n)?(r.push(n),!0):!1}var s=new i.WebGLGeometries(e,t,n);this.getAttributeBuffer=function(e){return e instanceof i.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer},this.getWireframeAttribute=function(n){var s=t.get(n);if(void 0!==s.wireframe)return s.wireframe;var a=[],u=n.index,c=n.attributes;if(n=c.position,null!==u)for(var c={},u=u.array,h=0,l=u.length;l>h;h+=3){var p=u[h+0],f=u[h+1],d=u[h+2];o(c,p,f)&&a.push(p,f),o(c,f,d)&&a.push(f,d),o(c,d,p)&&a.push(d,p)}else for(u=c.position.array,h=0,l=u.length/3-1;l>h;h+=3)p=h+0,f=h+1,d=h+2,a.push(p,f,f,d,d,p);return a=new i.BufferAttribute(new(65535<n.count?Uint32Array:Uint16Array)(a),1),r(a,e.ELEMENT_ARRAY_BUFFER),s.wireframe=a},this.update=function(t){var n=s.get(t);t.geometry instanceof i.Geometry&&n.updateFromObject(t),t=n.index;var o=n.attributes;null!==t&&r(t,e.ELEMENT_ARRAY_BUFFER);for(var a in o)r(o[a],e.ARRAY_BUFFER);t=n.morphAttributes;for(a in t)for(var o=t[a],u=0,c=o.length;c>u;u++)r(o[u],e.ARRAY_BUFFER);return n}},i.WebGLProgram=function(){function e(e){switch(e){case i.LinearEncoding:return["Linear","( value )"];case i.sRGBEncoding:return["sRGB","( value )"];case i.RGBEEncoding:return["RGBE","( value )"];case i.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case i.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case i.RGBDEncoding:return["RGBD","( value, 256.0 )"];case i.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+e)}}function t(t,n){var r=e(n);return"vec4 "+t+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function n(t,n){var r=e(n);return"vec4 "+t+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function r(e,t){var n;switch(t){case i.LinearToneMapping:n="Linear";break;case i.ReinhardToneMapping:n="Reinhard";break;case i.Uncharted2ToneMapping:n="Uncharted2";break;case i.CineonToneMapping:n="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function o(e,t,n){return e=e||{},[e.derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(a).join("\n")}function s(e){var t,n=[];for(t in e){var r=e[t];!1!==r&&n.push("#define "+t+" "+r)}return n.join("\n")}function a(e){return""!==e}function u(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function c(e){return e.replace(/#include +<([\w\d.]+)>/g,function(e,t){var n=i.ShaderChunk[t];if(void 0===n)throw Error("Can not resolve #include <"+t+">");return c(n)})}function h(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,n,r){for(e="",t=parseInt(t);t<parseInt(n);t++)e+=r.replace(/\[ i \]/g,"[ "+t+" ]");return e})}var l=0;return function(e,p,f,d){var m=e.context,v=f.extensions,g=f.defines,y=f.__webglShader.vertexShader,_=f.__webglShader.fragmentShader,b="SHADOWMAP_TYPE_BASIC";d.shadowMapType===i.PCFShadowMap?b="SHADOWMAP_TYPE_PCF":d.shadowMapType===i.PCFSoftShadowMap&&(b="SHADOWMAP_TYPE_PCF_SOFT");var x="ENVMAP_TYPE_CUBE",w="ENVMAP_MODE_REFLECTION",S="ENVMAP_BLENDING_MULTIPLY";if(d.envMap){switch(f.envMap.mapping){case i.CubeReflectionMapping:case i.CubeRefractionMapping:x="ENVMAP_TYPE_CUBE";break;case i.CubeUVReflectionMapping:case i.CubeUVRefractionMapping:x="ENVMAP_TYPE_CUBE_UV";break;case i.EquirectangularReflectionMapping:case i.EquirectangularRefractionMapping:x="ENVMAP_TYPE_EQUIREC";break;case i.SphericalReflectionMapping:x="ENVMAP_TYPE_SPHERE"}switch(f.envMap.mapping){case i.CubeRefractionMapping:case i.EquirectangularRefractionMapping:w="ENVMAP_MODE_REFRACTION"}switch(f.combine){case i.MultiplyOperation:S="ENVMAP_BLENDING_MULTIPLY";break;case i.MixOperation:S="ENVMAP_BLENDING_MIX";break;case i.AddOperation:S="ENVMAP_BLENDING_ADD"}}var M=0<e.gammaFactor?e.gammaFactor:1,v=o(v,d,e.extensions),E=s(g),C=m.createProgram();f instanceof i.RawShaderMaterial?b=g="":(g=["precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+f.__webglShader.name,E,d.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+M,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+w:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.displacementMap&&d.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",d.specularMap?"#define USE_SPECULARMAP":"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR":"",d.flatShading?"#define FLAT_SHADED":"",d.skinning?"#define USE_SKINNING":"",d.useVertexTexture?"#define BONE_TEXTURE":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.morphNormals&&!1===d.flatShading?"#define USE_MORPHNORMALS":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+d.numClippingPlanes,d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+b:"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(a).join("\n"),b=[v,"precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+f.__webglShader.name,E,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"","#define GAMMA_FACTOR "+M,d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fogExp?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+x:"",d.envMap?"#define "+w:"",d.envMap?"#define "+S:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.specularMap?"#define USE_SPECULARMAP":"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR":"",d.flatShading?"#define FLAT_SHADED":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+d.numClippingPlanes,d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+b:"",d.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",d.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",d.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",d.toneMapping!==i.NoToneMapping?"#define TONE_MAPPING":"",d.toneMapping!==i.NoToneMapping?i.ShaderChunk.tonemapping_pars_fragment:"",d.toneMapping!==i.NoToneMapping?r("toneMapping",d.toneMapping):"",d.outputEncoding||d.mapEncoding||d.envMapEncoding||d.emissiveMapEncoding?i.ShaderChunk.encodings_pars_fragment:"",d.mapEncoding?t("mapTexelToLinear",d.mapEncoding):"",d.envMapEncoding?t("envMapTexelToLinear",d.envMapEncoding):"",d.emissiveMapEncoding?t("emissiveMapTexelToLinear",d.emissiveMapEncoding):"",d.outputEncoding?n("linearToOutputTexel",d.outputEncoding):"",d.depthPacking?"#define DEPTH_PACKING "+f.depthPacking:"","\n"].filter(a).join("\n")),y=c(y,d),y=u(y,d),_=c(_,d),_=u(_,d),!1==f instanceof i.ShaderMaterial&&(y=h(y),_=h(_)),_=b+_,y=i.WebGLShader(m,m.VERTEX_SHADER,g+y),_=i.WebGLShader(m,m.FRAGMENT_SHADER,_),m.attachShader(C,y),m.attachShader(C,_),void 0!==f.index0AttributeName?m.bindAttribLocation(C,0,f.index0AttributeName):!0===d.morphTargets&&m.bindAttribLocation(C,0,"position"),m.linkProgram(C),d=m.getProgramInfoLog(C),x=m.getShaderInfoLog(y),w=m.getShaderInfoLog(_),M=S=!0,!1===m.getProgramParameter(C,m.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",m.getError(),"gl.VALIDATE_STATUS",m.getProgramParameter(C,m.VALIDATE_STATUS),"gl.getProgramInfoLog",d,x,w)):""!==d?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",d):""!==x&&""!==w||(M=!1),M&&(this.diagnostics={runnable:S,material:f,programLog:d,vertexShader:{log:x,prefix:g},fragmentShader:{log:w,prefix:b}}),m.deleteShader(y),m.deleteShader(_);var T;this.getUniforms=function(){return void 0===T&&(T=new i.WebGLUniforms(m,C,e)),T};var A;return this.getAttributes=function(){if(void 0===A){for(var e={},t=m.getProgramParameter(C,m.ACTIVE_ATTRIBUTES),n=0;t>n;n++){var r=m.getActiveAttrib(C,n).name;e[r]=m.getAttribLocation(C,r)}A=e}return A},this.destroy=function(){m.deleteProgram(C),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=l++,this.code=p,this.usedTimes=1,this.program=C,this.vertexShader=y,this.fragmentShader=_,this}}(),i.WebGLPrograms=function(e,t){function n(e,t){var n;return e?e instanceof i.Texture?n=e.encoding:e instanceof i.WebGLRenderTarget&&(n=e.texture.encoding):n=i.LinearEncoding,n===i.LinearEncoding&&t&&(n=i.GammaEncoding),n}var r=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},s="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes depthPacking".split(" ");this.getParameters=function(r,s,a,u,c){var h,l=o[r.type];t.floatVertexTextures&&c&&c.skeleton&&c.skeleton.useVertexTexture?h=1024:(h=Math.floor((t.maxVertexUniforms-20)/4),void 0!==c&&c instanceof i.SkinnedMesh&&(h=Math.min(c.skeleton.bones.length,h),h<c.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+c.skeleton.bones.length+", this GPU supports just "+h+" (try OpenGL instead of ANGLE)")));var p=e.getPrecision();return null!==r.precision&&(p=t.getMaxPrecision(r.precision),p!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead.")),{shaderID:l,precision:p,supportsVertexTextures:t.vertexTextures,outputEncoding:n(e.getCurrentRenderTarget(),e.gammaOutput),map:!!r.map,mapEncoding:n(r.map,e.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:n(r.envMap,e.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===i.CubeUVReflectionMapping||r.envMap.mapping===i.CubeUVRefractionMapping),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:n(r.emissiveMap,e.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:a,useFog:r.fog,fogExp:a instanceof i.FogExp2,flatShading:r.shading===i.FlatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:r.skinning,maxBones:h,useVertexTexture:t.floatVertexTextures&&c&&c.skeleton&&c.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numHemiLights:s.hemi.length,numClippingPlanes:u,shadowMapEnabled:e.shadowMap.enabled&&c.receiveShadow&&0<s.shadows.length,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===i.DoubleSide,flipSided:r.side===i.BackSide,depthPacking:void 0!==r.depthPacking?r.depthPacking:!1}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(r=0;r<s.length;r++)n.push(t[s[r]]);return n.join()},this.acquireProgram=function(t,n,o){for(var s,a=0,u=r.length;u>a;a++){var c=r[a];if(c.code===o){s=c,++s.usedTimes;break}}return void 0===s&&(s=new i.WebGLProgram(e,o,t,n),r.push(s)),s},this.releaseProgram=function(e){if(0===--e.usedTimes){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r},i.WebGLProperties=function(){var e={};this.get=function(t){t=t.uuid;var n=e[t];return void 0===n&&(n={},e[t]=n),n},this["delete"]=function(t){delete e[t.uuid]},this.clear=function(){e={}}},i.WebGLShader=function(){function e(e){e=e.split("\n");for(var t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}return function(t,n,r){var i=t.createShader(n);return t.shaderSource(i,r),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",n===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),e(r)),i}}(),i.WebGLShadowMap=function(e,t,n){function r(t,n,r,o){var s=t.geometry,a=null,a=m,u=t.customDepthMaterial;return r&&(a=v,u=t.customDistanceMaterial),u?a=u:(t=t instanceof i.SkinnedMesh&&n.skinning,u=0,void 0!==s.morphTargets&&0<s.morphTargets.length&&n.morphTargets&&(u|=1),t&&(u|=2),a=a[u]),e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length&&(u=a.uuid,s=n.uuid,t=g[u],void 0===t&&(t={},g[u]=t),u=t[s],void 0===u&&(u=a.clone(),t[s]=u),a=u),a.visible=n.visible,a.wireframe=n.wireframe,a.side=n.side,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(o),a}function o(e,t,n){if(!1!==e.visible){e.layers.test(t.layers)&&(e instanceof i.Mesh||e instanceof i.Line||e instanceof i.Points)&&e.castShadow&&(!1===e.frustumCulled||!0===u.intersectsObject(e))&&!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),d.push(e)),e=e.children;for(var r=0,s=e.length;s>r;r++)o(e[r],t,n)}}var s=e.context,a=e.state,u=new i.Frustum,c=new i.Matrix4,h=t.shadows,l=new i.Vector2,p=new i.Vector3,f=new i.Vector3,d=[],m=Array(4),v=Array(4),g={},y=[new i.Vector3(1,0,0),new i.Vector3(-1,0,0),new i.Vector3(0,0,1),new i.Vector3(0,0,-1),new i.Vector3(0,1,0),new i.Vector3(0,-1,0)],_=[new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,0,1),new i.Vector3(0,0,-1)],b=[new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4];t=new i.MeshDepthMaterial,t.depthPacking=i.RGBADepthPacking,t.clipping=!0;for(var x=i.ShaderLib.distanceRGBA,w=i.UniformsUtils.clone(x.uniforms),S=0;4!==S;++S){var M=0!==(1&S),E=0!==(2&S),C=t.clone();C.morphTargets=M,C.skinning=E,m[S]=C,M=new i.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:w,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,morphTargets:M,skinning:E,clipping:!0}),v[S]=M}var T=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i.PCFShadowMap,this.cullFace=i.CullFaceFront,this.render=function(t,m){if(!1!==T.enabled&&(!1!==T.autoUpdate||!1!==T.needsUpdate)&&0!==h.length){a.clearColor(1,1,1,1),a.disable(s.BLEND),a.enable(s.CULL_FACE),s.frontFace(s.CCW),s.cullFace(T.cullFace===i.CullFaceFront?s.FRONT:s.BACK),a.setDepthTest(!0),a.setScissorTest(!1);for(var v,g,x=0,w=h.length;w>x;x++){var S=h[x],M=S.shadow,E=M.camera;if(l.copy(M.mapSize),S instanceof i.PointLight){v=6,g=!0;var C=l.x,A=l.y;b[0].set(2*C,A,C,A),b[1].set(0,A,C,A),b[2].set(3*C,A,C,A),b[3].set(C,A,C,A),b[4].set(3*C,0,C,A),b[5].set(C,0,C,A),l.x*=4,l.y*=2}else v=1,g=!1;for(null===M.map&&(M.map=new i.WebGLRenderTarget(l.x,l.y,{minFilter:i.NearestFilter,magFilter:i.NearestFilter,format:i.RGBAFormat}),E.updateProjectionMatrix()),M instanceof i.SpotLightShadow&&M.update(S),C=M.map,M=M.matrix,f.setFromMatrixPosition(S.matrixWorld),E.position.copy(f),e.setRenderTarget(C),e.clear(),C=0;v>C;C++){g?(p.copy(E.position),p.add(y[C]),E.up.copy(_[C]),E.lookAt(p),a.viewport(b[C])):(p.setFromMatrixPosition(S.target.matrixWorld),E.lookAt(p)),E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),M.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),M.multiply(E.projectionMatrix),M.multiply(E.matrixWorldInverse),c.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),u.setFromMatrix(c),d.length=0,o(t,m,E);for(var A=0,P=d.length;P>A;A++){var O=d[A],L=n.update(O),R=O.material;if(R instanceof i.MultiMaterial)for(var N=L.groups,R=R.materials,D=0,I=N.length;I>D;D++){var k=N[D],j=R[k.materialIndex];!0===j.visible&&(j=r(O,j,g,f),e.renderBufferDirect(E,null,L,j,O,k))}else j=r(O,R,g,f),e.renderBufferDirect(E,null,L,j,O,null)}}}v=e.getClearColor(),g=e.getClearAlpha(),e.setClearColor(v,g),a.enable(s.BLEND),T.cullFace===i.CullFaceFront&&s.cullFace(s.BACK),T.needsUpdate=!1}}},i.WebGLState=function(e,t,n){var r=this,o=new i.Vector4,s=e.getParameter(e.MAX_VERTEX_ATTRIBS),a=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(s),h={},l=null,p=null,f=null,d=null,m=null,v=null,g=null,y=null,_=!1,b=null,x=null,w=null,S=null,M=null,E=null,C=null,T=null,A=null,P=null,O=null,L=null,R=null,N=null,D=null,I=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),k=void 0,j={},F=new i.Vector4,B=null,V=null,U=new i.Vector4,G=new i.Vector4;this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.frontFace(e.CCW),e.cullFace(e.BACK),this.enable(e.CULL_FACE),this.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var e=0,t=a.length;t>e;e++)a[e]=0},this.enableAttribute=function(n){a[n]=1,0===u[n]&&(e.enableVertexAttribArray(n),u[n]=1),0!==c[n]&&(t.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),c[n]=0)},this.enableAttributeAndDivisor=function(t,n,r){a[t]=1,0===u[t]&&(e.enableVertexAttribArray(t),u[t]=1),c[t]!==n&&(r.vertexAttribDivisorANGLE(t,n),c[t]=n)},this.disableUnusedAttributes=function(){for(var t=0,n=u.length;n>t;t++)u[t]!==a[t]&&(e.disableVertexAttribArray(t),u[t]=0)},this.enable=function(t){!0!==h[t]&&(e.enable(t),h[t]=!0)},this.disable=function(t){!1!==h[t]&&(e.disable(t),h[t]=!1)},this.getCompressedTextureFormats=function(){if(null===l&&(l=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var n=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),r=0;r<n.length;r++)l.push(n[r]);return l},this.setBlending=function(t,r,o,s,a,u,c,h){t===i.NoBlending?this.disable(e.BLEND):this.enable(e.BLEND),t===p&&h===_||(t===i.AdditiveBlending?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===i.SubtractiveBlending?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===i.MultiplyBlending?h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.SRC_COLOR,e.SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):h?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),p=t,_=h),t===i.CustomBlending?(a=a||r,u=u||o,c=c||s,r===f&&a===v||(e.blendEquationSeparate(n(r),n(a)),f=r,v=a),o===d&&s===m&&u===g&&c===y||(e.blendFuncSeparate(n(o),n(s),n(u),n(c)),d=o,m=s,g=u,y=c)):y=g=v=m=d=f=null},this.setDepthFunc=function(t){if(b!==t){if(t)switch(t){case i.NeverDepth:e.depthFunc(e.NEVER);break;case i.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case i.LessDepth:e.depthFunc(e.LESS);break;case i.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case i.EqualDepth:e.depthFunc(e.EQUAL);break;case i.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case i.GreaterDepth:e.depthFunc(e.GREATER);break;case i.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);b=t}},this.setDepthTest=function(t){t?this.enable(e.DEPTH_TEST):this.disable(e.DEPTH_TEST)},this.setDepthWrite=function(t){x!==t&&(e.depthMask(t),x=t)},this.setColorWrite=function(t){w!==t&&(e.colorMask(t,t,t,t),w=t)},this.setStencilFunc=function(t,n,r){M===t&&E===n&&C===r||(e.stencilFunc(t,n,r),M=t,E=n,C=r)},this.setStencilOp=function(t,n,r){T===t&&A===n&&P===r||(e.stencilOp(t,n,r),T=t,A=n,P=r)},this.setStencilTest=function(t){t?this.enable(e.STENCIL_TEST):this.disable(e.STENCIL_TEST)},this.setStencilWrite=function(t){S!==t&&(e.stencilMask(t),S=t)},this.setFlipSided=function(t){O!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),O=t)},this.setLineWidth=function(t){t!==L&&(e.lineWidth(t),L=t)},this.setPolygonOffset=function(t,n,r){t?this.enable(e.POLYGON_OFFSET_FILL):this.disable(e.POLYGON_OFFSET_FILL),!t||R===n&&N===r||(e.polygonOffset(n,r),R=n,N=r)},this.getScissorTest=function(){return D},this.setScissorTest=function(t){(D=t)?this.enable(e.SCISSOR_TEST):this.disable(e.SCISSOR_TEST)},this.activeTexture=function(t){void 0===t&&(t=e.TEXTURE0+I-1),k!==t&&(e.activeTexture(t),k=t)},this.bindTexture=function(t,n){void 0===k&&r.activeTexture();var i=j[k];void 0===i&&(i={type:void 0,texture:void 0},j[k]=i),i.type===t&&i.texture===n||(e.bindTexture(t,n),i.type=t,i.texture=n)},this.compressedTexImage2D=function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.clearColor=function(t,n,r,i){o.set(t,n,r,i),!1===F.equals(o)&&(e.clearColor(t,n,r,i),F.copy(o))},this.clearDepth=function(t){B!==t&&(e.clearDepth(t),B=t)},this.clearStencil=function(t){V!==t&&(e.clearStencil(t),V=t)},this.scissor=function(t){!1===U.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),U.copy(t))},this.viewport=function(t){!1===G.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),G.copy(t))},this.reset=function(){for(var t=0;t<u.length;t++)1===u[t]&&(e.disableVertexAttribArray(t),u[t]=0);h={},l=null,k=void 0,j={},O=S=x=w=p=null}},i.WebGLUniforms=function(){var e=[],t=[],n=function(t,n,r){var i=t[0];if(0>=i||i>0)return t;var o=n*r,s=e[o];if(void 0===s&&(s=new Float32Array(o),e[o]=s),0!==n)for(i.toArray(s,0),i=1,o=0;i!==n;++i)o+=r,t[i].toArray(s,o);return s},r=function(e,n){var r=t[n];void 0===r&&(r=new Int32Array(n),t[n]=r);for(var i=0;i!==n;++i)r[i]=e.allocTextureUnit();return r},i=function(e,t){e.uniform1f(this.addr,t)},o=function(e,t){e.uniform1i(this.addr,t)},s=function(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)},a=function(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)},u=function(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)},c=function(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)},h=function(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)},l=function(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)},p=function(e,t,n){var r=n.allocTextureUnit();e.uniform1i(this.addr,r),t&&n.setTexture2D(t,r)},f=function(e,t,n){var r=n.allocTextureUnit();e.uniform1i(this.addr,r),t&&n.setTextureCube(t,r)},d=function(e,t){e.uniform2iv(this.addr,t)},m=function(e,t){e.uniform3iv(this.addr,t)},v=function(e,t){e.uniform4iv(this.addr,t)},g=function(e){switch(e){case 5126:return i;case 35664:return s;case 35665:return a;case 35666:return u;case 35674:return c;case 35675:return h;case 35676:return l;case 35678:return p;case 35680:return f;case 5124:case 35670:return o;case 35667:case 35671:return d;case 35668:case 35672:return m;case 35669:case 35673:return v}},y=function(e,t){e.uniform1fv(this.addr,t)},_=function(e,t){e.uniform1iv(this.addr,t)},b=function(e,t){e.uniform2fv(this.addr,n(t,this.size,2))},x=function(e,t){e.uniform3fv(this.addr,n(t,this.size,3))},w=function(e,t){e.uniform4fv(this.addr,n(t,this.size,4))},S=function(e,t){e.uniformMatrix2fv(this.addr,!1,n(t,this.size,4))},M=function(e,t){e.uniformMatrix3fv(this.addr,!1,n(t,this.size,9))},E=function(e,t){e.uniformMatrix4fv(this.addr,!1,n(t,this.size,16))},C=function(e,t,n){var i=t.length,o=r(n,i);for(e.uniform1iv(this.addr,o),e=0;e!==i;++e){var s=t[e];s&&n.setTexture2D(s,o[e])}},T=function(e,t,n){var i=t.length,o=r(n,i);for(e.uniform1iv(this.addr,o),e=0;e!==i;++e){var s=t[e];s&&n.setTextureCube(s,o[e])}},A=function(e){switch(e){case 5126:return y;case 35664:return b;case 35665:return x;case 35666:return w;case 35674:return S;case 35675:return M;case 35676:return E;case 35678:return C;case 35680:return T;case 5124:case 35670:return _;case 35667:case 35671:return d;case 35668:case 35672:return m;case 35669:case 35673:return v}},P=function(e,t,n){this.id=e,this.addr=n,this.setValue=g(t.type)},O=function(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=A(t.type)},L=function(e){this.id=e,this.seq=[],this.map={}};L.prototype.setValue=function(e,t){for(var n=this.seq,r=0,i=n.length;r!==i;++r){var o=n[r];o.setValue(e,t[o.id])}};var R=/([\w\d_]+)(\])?(\[|\.)?/g,N=function(e,t,n){this.seq=[],this.map={},this.renderer=n,n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(var r=0;r!==n;++r){var i=e.getActiveUniform(t,r),o=e.getUniformLocation(t,i.name),s=this,a=i.name,u=a.length;for(R.lastIndex=0;;){var c=R.exec(a),h=R.lastIndex,l=c[1],p=c[3];if("]"===c[2]&&(l|=0),void 0===p||"["===p&&h+2===u){a=s,i=void 0===p?new P(l,i,o):new O(l,i,o),a.seq.push(i),a.map[i.id]=i;break}p=s.map[l],void 0===p&&(p=new L(l),l=s,s=p,l.seq.push(s),l.map[s.id]=s),s=p}}};return N.prototype.setValue=function(e,t,n){t=this.map[t],void 0!==t&&t.setValue(e,n,this.renderer)},N.prototype.set=function(e,t,n){var r=this.map[n];void 0!==r&&r.setValue(e,t[n],this.renderer)},N.prototype.setOptional=function(e,t,n){t=t[n],void 0!==t&&this.setValue(e,n,t)},N.upload=function(e,t,n,r){for(var i=0,o=t.length;i!==o;++i){var s=t[i],a=n[s.id];!1!==a.needsUpdate&&s.setValue(e,a.value,r)}},N.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var o=e[r];o.id in t&&n.push(o)}return n},N.splitDynamic=function(e,t){for(var n=null,r=e.length,i=0,o=0;o!==r;++o){var s=e[o],a=t[s.id];a&&!0===a.dynamic?(null===n&&(n=[]),n.push(s)):(o>i&&(e[i]=s),++i)}return r>i&&(e.length=i),n},N.evalDynamic=function(e,t,n,r){for(var i=0,o=e.length;i!==o;++i){var s=t[e[i].id],a=s.onUpdateCallback;void 0!==a&&a.call(s,n,r)}},N}(),i.LensFlarePlugin=function(e,t){var n,r,o,s,a,u,c,h,l,p,f,d,m,v,g,y,_=e.context,b=e.state;this.render=function(x,w,S){if(0!==t.length){x=new i.Vector3;var M=S.w/S.z,E=.5*S.z,C=.5*S.w,T=16/S.w,A=new i.Vector2(T*M,T),P=new i.Vector3(1,1,0),O=new i.Vector2(1,1),L=new i.Box2;if(L.min.set(0,0),L.max.set(S.z-16,S.w-16),void 0===v){var T=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),R=new Uint16Array([0,1,2,0,2,3]);f=_.createBuffer(),d=_.createBuffer(),_.bindBuffer(_.ARRAY_BUFFER,f),_.bufferData(_.ARRAY_BUFFER,T,_.STATIC_DRAW),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,d),_.bufferData(_.ELEMENT_ARRAY_BUFFER,R,_.STATIC_DRAW),g=_.createTexture(),y=_.createTexture(),b.bindTexture(_.TEXTURE_2D,g),_.texImage2D(_.TEXTURE_2D,0,_.RGB,16,16,0,_.RGB,_.UNSIGNED_BYTE,null),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.NEAREST),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.NEAREST),
|
||
b.bindTexture(_.TEXTURE_2D,y),_.texImage2D(_.TEXTURE_2D,0,_.RGBA,16,16,0,_.RGBA,_.UNSIGNED_BYTE,null),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.NEAREST),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.NEAREST);var T=m={vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},R=_.createProgram(),N=_.createShader(_.FRAGMENT_SHADER),D=_.createShader(_.VERTEX_SHADER),I="precision "+e.getPrecision()+" float;\n";_.shaderSource(N,I+T.fragmentShader),_.shaderSource(D,I+T.vertexShader),_.compileShader(N),_.compileShader(D),_.attachShader(R,N),_.attachShader(R,D),_.linkProgram(R),v=R,l=_.getAttribLocation(v,"position"),p=_.getAttribLocation(v,"uv"),n=_.getUniformLocation(v,"renderType"),r=_.getUniformLocation(v,"map"),o=_.getUniformLocation(v,"occlusionMap"),s=_.getUniformLocation(v,"opacity"),a=_.getUniformLocation(v,"color"),u=_.getUniformLocation(v,"scale"),c=_.getUniformLocation(v,"rotation"),h=_.getUniformLocation(v,"screenPosition")}for(_.useProgram(v),b.initAttributes(),b.enableAttribute(l),b.enableAttribute(p),b.disableUnusedAttributes(),_.uniform1i(o,0),_.uniform1i(r,1),_.bindBuffer(_.ARRAY_BUFFER,f),_.vertexAttribPointer(l,2,_.FLOAT,!1,16,0),_.vertexAttribPointer(p,2,_.FLOAT,!1,16,8),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,d),b.disable(_.CULL_FACE),b.setDepthWrite(!1),R=0,N=t.length;N>R;R++)if(T=16/S.w,A.set(T*M,T),D=t[R],x.set(D.matrixWorld.elements[12],D.matrixWorld.elements[13],D.matrixWorld.elements[14]),x.applyMatrix4(w.matrixWorldInverse),x.applyProjection(w.projectionMatrix),P.copy(x),O.x=S.x+P.x*E+E-8,O.y=S.y+P.y*C+C-8,!0===L.containsPoint(O)){b.activeTexture(_.TEXTURE0),b.bindTexture(_.TEXTURE_2D,null),b.activeTexture(_.TEXTURE1),b.bindTexture(_.TEXTURE_2D,g),_.copyTexImage2D(_.TEXTURE_2D,0,_.RGB,O.x,O.y,16,16,0),_.uniform1i(n,0),_.uniform2f(u,A.x,A.y),_.uniform3f(h,P.x,P.y,P.z),b.disable(_.BLEND),b.enable(_.DEPTH_TEST),_.drawElements(_.TRIANGLES,6,_.UNSIGNED_SHORT,0),b.activeTexture(_.TEXTURE0),b.bindTexture(_.TEXTURE_2D,y),_.copyTexImage2D(_.TEXTURE_2D,0,_.RGBA,O.x,O.y,16,16,0),_.uniform1i(n,1),b.disable(_.DEPTH_TEST),b.activeTexture(_.TEXTURE1),b.bindTexture(_.TEXTURE_2D,g),_.drawElements(_.TRIANGLES,6,_.UNSIGNED_SHORT,0),D.positionScreen.copy(P),D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares(),_.uniform1i(n,2),b.enable(_.BLEND);for(var I=0,k=D.lensFlares.length;k>I;I++){var j=D.lensFlares[I];.001<j.opacity&&.001<j.scale&&(P.x=j.x,P.y=j.y,P.z=j.z,T=j.size*j.scale/S.w,A.x=T*M,A.y=T,_.uniform3f(h,P.x,P.y,P.z),_.uniform2f(u,A.x,A.y),_.uniform1f(c,j.rotation),_.uniform1f(s,j.opacity),_.uniform3f(a,j.color.r,j.color.g,j.color.b),b.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst),e.setTexture2D(j.texture,1),_.drawElements(_.TRIANGLES,6,_.UNSIGNED_SHORT,0))}}b.enable(_.CULL_FACE),b.enable(_.DEPTH_TEST),b.setDepthWrite(!0),e.resetGLState()}}},i.SpritePlugin=function(e,t){function n(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var r,o,s,a,u,c,h,l,p,f,d,m,v,g,y,_,b,x,w,S,M,E=e.context,C=e.state,T=new i.Vector3,A=new i.Quaternion,P=new i.Vector3;this.render=function(O,L){if(0!==t.length){if(void 0===S){var R=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),N=new Uint16Array([0,1,2,0,2,3]);x=E.createBuffer(),w=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,x),E.bufferData(E.ARRAY_BUFFER,R,E.STATIC_DRAW),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,w),E.bufferData(E.ELEMENT_ARRAY_BUFFER,N,E.STATIC_DRAW);var R=E.createProgram(),N=E.createShader(E.VERTEX_SHADER),D=E.createShader(E.FRAGMENT_SHADER);E.shaderSource(N,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),E.shaderSource(D,["precision "+e.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),E.compileShader(N),E.compileShader(D),E.attachShader(R,N),E.attachShader(R,D),E.linkProgram(R),S=R,_=E.getAttribLocation(S,"position"),b=E.getAttribLocation(S,"uv"),r=E.getUniformLocation(S,"uvOffset"),o=E.getUniformLocation(S,"uvScale"),s=E.getUniformLocation(S,"rotation"),a=E.getUniformLocation(S,"scale"),u=E.getUniformLocation(S,"color"),c=E.getUniformLocation(S,"map"),h=E.getUniformLocation(S,"opacity"),l=E.getUniformLocation(S,"modelViewMatrix"),p=E.getUniformLocation(S,"projectionMatrix"),f=E.getUniformLocation(S,"fogType"),d=E.getUniformLocation(S,"fogDensity"),m=E.getUniformLocation(S,"fogNear"),v=E.getUniformLocation(S,"fogFar"),g=E.getUniformLocation(S,"fogColor"),y=E.getUniformLocation(S,"alphaTest"),R=document.createElement("canvas"),R.width=8,R.height=8,N=R.getContext("2d"),N.fillStyle="white",N.fillRect(0,0,8,8),M=new i.Texture(R),M.needsUpdate=!0}E.useProgram(S),C.initAttributes(),C.enableAttribute(_),C.enableAttribute(b),C.disableUnusedAttributes(),C.disable(E.CULL_FACE),C.enable(E.BLEND),E.bindBuffer(E.ARRAY_BUFFER,x),E.vertexAttribPointer(_,2,E.FLOAT,!1,16,0),E.vertexAttribPointer(b,2,E.FLOAT,!1,16,8),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,w),E.uniformMatrix4fv(p,!1,L.projectionMatrix.elements),C.activeTexture(E.TEXTURE0),E.uniform1i(c,0),N=R=0,(D=O.fog)?(E.uniform3f(g,D.color.r,D.color.g,D.color.b),D instanceof i.Fog?(E.uniform1f(m,D.near),E.uniform1f(v,D.far),E.uniform1i(f,1),N=R=1):D instanceof i.FogExp2&&(E.uniform1f(d,D.density),E.uniform1i(f,2),N=R=2)):(E.uniform1i(f,0),N=R=0);for(var D=0,I=t.length;I>D;D++){var k=t[D];k.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,k.matrixWorld),k.z=-k.modelViewMatrix.elements[14]}t.sort(n);for(var j=[],D=0,I=t.length;I>D;D++){var k=t[D],F=k.material;E.uniform1f(y,F.alphaTest),E.uniformMatrix4fv(l,!1,k.modelViewMatrix.elements),k.matrixWorld.decompose(T,A,P),j[0]=P.x,j[1]=P.y,k=0,O.fog&&F.fog&&(k=N),R!==k&&(E.uniform1i(f,k),R=k),null!==F.map?(E.uniform2f(r,F.map.offset.x,F.map.offset.y),E.uniform2f(o,F.map.repeat.x,F.map.repeat.y)):(E.uniform2f(r,0,0),E.uniform2f(o,1,1)),E.uniform1f(h,F.opacity),E.uniform3f(u,F.color.r,F.color.g,F.color.b),E.uniform1f(s,F.rotation),E.uniform2fv(a,j),C.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),C.setDepthTest(F.depthTest),C.setDepthWrite(F.depthWrite),F.map?e.setTexture2D(F.map,0):e.setTexture2D(M,0),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0)}C.enable(E.CULL_FACE),e.resetGLState()}}},Object.defineProperties(i.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}}}),Object.defineProperties(i.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(i.Matrix3.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}}}),Object.defineProperties(i.Matrix4.prototype,{extractPosition:{value:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)}},setRotationFromQuaternion:{value:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)}},multiplyVector3:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)}},multiplyVector4:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}},rotateAxis:{value:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)}},crossVector:{value:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},translate:{value:function(e){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(e){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(e){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(e){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(e,t){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(i.Plane.prototype,{isIntersectionLine:{value:function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)}}}),Object.defineProperties(i.Quaternion.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)}}}),Object.defineProperties(i.Ray.prototype,{isIntersectionBox:{value:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionPlane:{value:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(i.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)}},getScaleFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)}},getColumnFromMatrix:{value:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}}),i.Face4=function(e,t,n,r,o,s,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new i.Face3(e,t,n,o,s,a)},i.Vertex=function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new i.Vector3(e,t,n)},Object.defineProperties(i.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},getChildByName:{value:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)}},renderDepth:{set:function(e){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(i,{PointCloud:{value:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new i.Points(e,t)}},ParticleSystem:{value:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new i.Points(e,t)}}}),Object.defineProperties(i.Light.prototype,{onlyShadow:{set:function(e){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(e){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(e){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(i.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(i.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)}},addDrawCall:{value:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(i.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(e){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new i.Color}}}),Object.defineProperties(i,{PointCloudMaterial:{value:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}},ParticleBasicMaterial:{value:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}},ParticleSystemMaterial:{value:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}}}),Object.defineProperties(i.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(e){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(i.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.defineProperties(i.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(i.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(i.Audio.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var t=this;return(new i.AudioLoader).load(e,function(e){t.setBuffer(e)}),this}}}),i.GeometryUtils={merge:function(e,t,n){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var r;t instanceof i.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},i.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var o=new i.TextureLoader;return o.setCrossOrigin(this.crossOrigin),e=o.load(e,n,void 0,r),t&&(e.mapping=t),e},loadTextureCube:function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var o=new i.CubeTextureLoader;return o.setCrossOrigin(this.crossOrigin),e=o.load(e,n,void 0,r),t&&(e.mapping=t),e},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},i.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},i.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},i.MeshFaceMaterial=i.MultiMaterial,Object.defineProperties(i.LOD.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),i.CurveUtils={tangentQuadraticBezier:function(e,t,n,r){return 2*(1-e)*(n-t)+2*e*(r-n)},tangentCubicBezier:function(e,t,n,r,i){return-3*t*(1-e)*(1-e)+3*n*(1-e)*(1-e)-6*e*n*(1-e)+6*e*r*(1-e)-3*e*e*r+3*e*e*i},tangentSpline:function(e,t,n,r,i){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},interpolate:function(e,t,n,r,i){e=.5*(n-e),r=.5*(r-t);var o=i*i;return(2*t-2*n+e+r)*i*o+(-3*t+3*n-2*e-r)*o+e*i+t}},i.SceneUtils={createMultiMaterialObject:function(e,t){for(var n=new i.Group,r=0,o=t.length;o>r;r++)n.add(new i.Mesh(e,t[r]));return n},detach:function(e,t,n){e.applyMatrix(t.matrixWorld),t.remove(e),n.add(e)},attach:function(e,t,n){var r=new i.Matrix4;r.getInverse(n.matrixWorld),e.applyMatrix(r),t.remove(e),n.add(e)}},i.ShapeUtils={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;t>i;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},triangulate:function(){return function(e,t){var n=e.length;if(3>n)return null;var r,o,s,a=[],u=[],c=[];if(0<i.ShapeUtils.area(e))for(o=0;n>o;o++)u[o]=o;else for(o=0;n>o;o++)u[o]=n-1-o;var h=2*n;for(o=n-1;n>2;){if(0>=h--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r=o,r>=n&&(r=0),o=r+1,o>=n&&(o=0),s=o+1,s>=n&&(s=0);var l;e:{var p=l=void 0,f=void 0,d=void 0,m=void 0,v=void 0,g=void 0,y=void 0,_=void 0,p=e[u[r]].x,f=e[u[r]].y,d=e[u[o]].x,m=e[u[o]].y,v=e[u[s]].x,g=e[u[s]].y;if(Number.EPSILON>(d-p)*(g-f)-(m-f)*(v-p))l=!1;else{var b=void 0,x=void 0,w=void 0,S=void 0,M=void 0,E=void 0,C=void 0,T=void 0,A=void 0,P=void 0,A=T=C=_=y=void 0,b=v-d,x=g-m,w=p-v,S=f-g,M=d-p,E=m-f;for(l=0;n>l;l++)if(y=e[u[l]].x,_=e[u[l]].y,!(y===p&&_===f||y===d&&_===m||y===v&&_===g)&&(C=y-p,T=_-f,A=y-d,P=_-m,y-=v,_-=g,A=b*P-x*A,C=M*T-E*C,T=w*_-S*y,A>=-Number.EPSILON&&T>=-Number.EPSILON&&C>=-Number.EPSILON)){l=!1;break e}l=!0}}if(l){for(a.push([e[u[r]],e[u[o]],e[u[s]]]),c.push([u[r],u[o],u[s]]),r=o,s=o+1;n>s;r++,s++)u[r]=u[s];n--,h=2*n}}return t?c:a}}(),triangulateShape:function(e,t){function n(e,t,n){return e.x!==t.x?e.x<t.x?e.x<=n.x&&n.x<=t.x:t.x<=n.x&&n.x<=e.x:e.y<t.y?e.y<=n.y&&n.y<=t.y:t.y<=n.y&&n.y<=e.y}function r(e,t,r,i,o){var s=t.x-e.x,a=t.y-e.y,u=i.x-r.x,c=i.y-r.y,h=e.x-r.x,l=e.y-r.y,p=a*u-s*c,f=a*h-s*l;if(Math.abs(p)>Number.EPSILON){if(p>0){if(0>f||f>p)return[];if(u=c*h-u*l,0>u||u>p)return[]}else{if(f>0||p>f)return[];if(u=c*h-u*l,u>0||p>u)return[]}return 0===u?!o||0!==f&&f!==p?[e]:[]:u===p?!o||0!==f&&f!==p?[t]:[]:0===f?[r]:f===p?[i]:(o=u/p,[{x:e.x+o*s,y:e.y+o*a}])}return 0!==f||c*h!==u*l?[]:(a=0===s&&0===a,u=0===u&&0===c,a&&u?e.x!==r.x||e.y!==r.y?[]:[e]:a?n(r,i,e)?[e]:[]:u?n(e,t,r)?[r]:[]:(0!==s?(e.x<t.x?(s=e,u=e.x,a=t,e=t.x):(s=t,u=t.x,a=e,e=e.x),r.x<i.x?(t=r,p=r.x,c=i,r=i.x):(t=i,p=i.x,c=r,r=r.x)):(e.y<t.y?(s=e,u=e.y,a=t,e=t.y):(s=t,u=t.y,a=e,e=e.y),r.y<i.y?(t=r,p=r.y,c=i,r=i.y):(t=i,p=i.y,c=r,r=r.y)),p>=u?p>e?[]:e===p?o?[]:[t]:r>=e?[t,a]:[t,c]:u>r?[]:u===r?o?[]:[s]:r>=e?[s,a]:[s,c]))}function o(e,t,n,r){var i=t.x-e.x,o=t.y-e.y;t=n.x-e.x,n=n.y-e.y;var s=r.x-e.x;return r=r.y-e.y,e=i*n-o*t,i=i*r-o*s,Math.abs(e)>Number.EPSILON?(t=s*n-r*t,e>0?i>=0&&t>=0:i>=0||t>=0):i>0}var s,a,u,c,h,l={};for(u=e.concat(),s=0,a=t.length;a>s;s++)Array.prototype.push.apply(u,t[s]);for(s=0,a=u.length;a>s;s++)h=u[s].x+":"+u[s].y,void 0!==l[h]&&console.warn("THREE.Shape: Duplicate point",h),l[h]=s;s=function(e,t){function n(e,t){var n=v.length-1,r=e-1;0>r&&(r=n);var i=e+1;return i>n&&(i=0),(n=o(v[e],v[r],v[i],a[t]))?(n=a.length-1,r=t-1,0>r&&(r=n),i=t+1,i>n&&(i=0),!!(n=o(a[t],a[r],a[i],v[e]))):!1}function i(e,t){var n,i;for(n=0;n<v.length;n++)if(i=n+1,i%=v.length,i=r(e,t,v[n],v[i],!0),0<i.length)return!0;return!1}function s(e,n){var i,o,s,a;for(i=0;i<g.length;i++)for(o=t[g[i]],s=0;s<o.length;s++)if(a=s+1,a%=o.length,a=r(e,n,o[s],o[a],!0),0<a.length)return!0;return!1}var a,u,c,h,l,p,f,d,m,v=e.concat(),g=[],y=[],_=0;for(u=t.length;u>_;_++)g.push(_);
|
||
f=0;for(var b=2*g.length;0<g.length;){if(b--,0>b){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(c=f;c<v.length;c++){for(h=v[c],u=-1,_=0;_<g.length;_++)if(l=g[_],p=h.x+":"+h.y+":"+l,void 0===y[p]){for(a=t[l],d=0;d<a.length;d++)if(l=a[d],n(c,d)&&!i(h,l)&&!s(h,l)){u=d,g.splice(_,1),f=v.slice(0,c+1),l=v.slice(c),d=a.slice(u),m=a.slice(0,u+1),v=f.concat(d).concat(m).concat(l),f=c;break}if(u>=0)break;y[p]=!0}if(u>=0)break}}return v}(e,t);var p=i.ShapeUtils.triangulate(s,!1);for(s=0,a=p.length;a>s;s++)for(c=p[s],u=0;3>u;u++)h=c[u].x+":"+c[u].y,h=l[h],void 0!==h&&(c[u]=h);return p.concat()},isClockWise:function(e){return 0>i.ShapeUtils.area(e)},b2:function(){return function(e,t,n,r){var i=1-e;return i*i*t+2*(1-e)*e*n+e*e*r}}(),b3:function(){return function(e,t,n,r,i){var o=1-e,s=1-e;return o*o*o*t+3*s*s*e*n+3*(1-e)*e*e*r+e*e*e*i}}()},i.Curve=function(){},i.Curve.prototype={constructor:i.Curve,getPoint:function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){return e=this.getUtoTmapping(e),this.getPoint(e)},getPoints:function(e){e||(e=5);var t,n=[];for(t=0;e>=t;t++)n.push(this.getPoint(t/e));return n},getSpacedPoints:function(e){e||(e=5);var t,n=[];for(t=0;e>=t;t++)n.push(this.getPointAt(t/e));return n},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],i=this.getPoint(0),o=0;for(r.push(0),n=1;e>=n;n++)t=this.getPoint(n/e),o+=t.distanceTo(i),r.push(o),i=t;return this.cacheArcLengths=r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,o=r.length;n=t?t:e*r[o-1];for(var s,a=0,u=o-1;u>=a;)if(i=Math.floor(a+(u-a)/2),s=r[i]-n,0>s)a=i+1;else{if(!(s>0)){u=i;break}u=i-1}return i=u,r[i]===n?i/(o-1):(a=r[i],r=(i+(n-a)/(r[i+1]-a))/(o-1))},getTangent:function(e){var t=e-1e-4;return e+=1e-4,0>t&&(t=0),e>1&&(e=1),t=this.getPoint(t),this.getPoint(e).clone().sub(t).normalize()},getTangentAt:function(e){return e=this.getUtoTmapping(e),this.getTangent(e)}},i.Curve.create=function(e,t){return e.prototype=Object.create(i.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},i.CurvePath=function(){this.curves=[],this.autoClose=!1},i.CurvePath.prototype=Object.create(i.Curve.prototype),i.CurvePath.prototype.constructor=i.CurvePath,i.CurvePath.prototype.add=function(e){this.curves.push(e)},i.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new i.LineCurve(t,e))},i.CurvePath.prototype.getPoint=function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t)return e=this.curves[r],t=1-(n[r]-t)/e.getLength(),e.getPointAt(t);r++}return null},i.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},i.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;r>n;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e},i.CurvePath.prototype.createPointsGeometry=function(e){return e=this.getPoints(e),this.createGeometry(e)},i.CurvePath.prototype.createSpacedPointsGeometry=function(e){return e=this.getSpacedPoints(e),this.createGeometry(e)},i.CurvePath.prototype.createGeometry=function(e){for(var t=new i.Geometry,n=0,r=e.length;r>n;n++){var o=e[n];t.vertices.push(new i.Vector3(o.x,o.y,o.z||0))}return t},i.Font=function(e){this.data=e},i.Font.prototype={constructor:i.Font,generateShapes:function(e,t,n){void 0===t&&(t=100),void 0===n&&(n=4);var r=this.data;e=String(e).split("");var o=t/r.resolution,s=0;t=[];for(var a=0;a<e.length;a++){var u;u=o;var c=s,h=r.glyphs[e[a]]||r.glyphs["?"];if(h){var l=new i.Path,p=[],f=i.ShapeUtils.b2,d=i.ShapeUtils.b3,m=void 0,v=void 0,g=v=m=void 0,y=void 0,_=void 0,b=void 0,x=void 0,w=void 0,y=void 0;if(h.o)for(var S=h._cachedOutline||(h._cachedOutline=h.o.split(" ")),M=0,E=S.length;E>M;)switch(S[M++]){case"m":m=S[M++]*u+c,v=S[M++]*u,l.moveTo(m,v);break;case"l":m=S[M++]*u+c,v=S[M++]*u,l.lineTo(m,v);break;case"q":if(m=S[M++]*u+c,v=S[M++]*u,_=S[M++]*u+c,b=S[M++]*u,l.quadraticCurveTo(_,b,m,v),y=p[p.length-1])for(var g=y.x,y=y.y,C=1;n>=C;C++){var T=C/n;f(T,g,_,m),f(T,y,b,v)}break;case"b":if(m=S[M++]*u+c,v=S[M++]*u,_=S[M++]*u+c,b=S[M++]*u,x=S[M++]*u+c,w=S[M++]*u,l.bezierCurveTo(_,b,x,w,m,v),y=p[p.length-1])for(g=y.x,y=y.y,C=1;n>=C;C++)T=C/n,d(T,g,_,x,m),d(T,y,b,w,v)}u={offset:h.ha*u,path:l}}else u=void 0;s+=u.offset,t.push(u.path)}for(n=[],r=0,e=t.length;e>r;r++)Array.prototype.push.apply(n,t[r].toShapes());return n}},i.Path=function(e){i.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},i.Path.prototype=Object.create(i.CurvePath.prototype),i.Path.prototype.constructor=i.Path,i.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;n>t;t++)this.lineTo(e[t].x,e[t].y)},i.Path.prototype.moveTo=function(e,t){this.actions.push({action:"moveTo",args:[e,t]})},i.Path.prototype.lineTo=function(e,t){var n=this.actions[this.actions.length-1].args,n=new i.LineCurve(new i.Vector2(n[n.length-2],n[n.length-1]),new i.Vector2(e,t));this.curves.push(n),this.actions.push({action:"lineTo",args:[e,t]})},i.Path.prototype.quadraticCurveTo=function(e,t,n,r){var o=this.actions[this.actions.length-1].args,o=new i.QuadraticBezierCurve(new i.Vector2(o[o.length-2],o[o.length-1]),new i.Vector2(e,t),new i.Vector2(n,r));this.curves.push(o),this.actions.push({action:"quadraticCurveTo",args:[e,t,n,r]})},i.Path.prototype.bezierCurveTo=function(e,t,n,r,o,s){var a=this.actions[this.actions.length-1].args,a=new i.CubicBezierCurve(new i.Vector2(a[a.length-2],a[a.length-1]),new i.Vector2(e,t),new i.Vector2(n,r),new i.Vector2(o,s));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[e,t,n,r,o,s]})},i.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args,n=[new i.Vector2(n[n.length-2],n[n.length-1])];Array.prototype.push.apply(n,e),n=new i.SplineCurve(n),this.curves.push(n),this.actions.push({action:"splineThru",args:t})},i.Path.prototype.arc=function(e,t,n,r,i,o){var s=this.actions[this.actions.length-1].args;this.absarc(e+s[s.length-2],t+s[s.length-1],n,r,i,o)},i.Path.prototype.absarc=function(e,t,n,r,i,o){this.absellipse(e,t,n,n,r,i,o)},i.Path.prototype.ellipse=function(e,t,n,r,i,o,s,a){var u=this.actions[this.actions.length-1].args;this.absellipse(e+u[u.length-2],t+u[u.length-1],n,r,i,o,s,a)},i.Path.prototype.absellipse=function(e,t,n,r,o,s,a,u){var c=[e,t,n,r,o,s,a,u||0];e=new i.EllipseCurve(e,t,n,r,o,s,a,u),this.curves.push(e),e=e.getPoint(1),c.push(e.x),c.push(e.y),this.actions.push({action:"ellipse",args:c})},i.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],n=0;e>n;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},i.Path.prototype.getPoints=function(e){e=e||12;for(var t,n,r,o,s,a,u,c,h,l,p=i.ShapeUtils.b2,f=i.ShapeUtils.b3,d=[],m=0,v=this.actions.length;v>m;m++){h=this.actions[m];var g=h.args;switch(h.action){case"moveTo":d.push(new i.Vector2(g[0],g[1]));break;case"lineTo":d.push(new i.Vector2(g[0],g[1]));break;case"quadraticCurveTo":for(t=g[2],n=g[3],s=g[0],a=g[1],0<d.length?(h=d[d.length-1],u=h.x,c=h.y):(h=this.actions[m-1].args,u=h[h.length-2],c=h[h.length-1]),g=1;e>=g;g++)l=g/e,h=p(l,u,s,t),l=p(l,c,a,n),d.push(new i.Vector2(h,l));break;case"bezierCurveTo":for(t=g[4],n=g[5],s=g[0],a=g[1],r=g[2],o=g[3],0<d.length?(h=d[d.length-1],u=h.x,c=h.y):(h=this.actions[m-1].args,u=h[h.length-2],c=h[h.length-1]),g=1;e>=g;g++)l=g/e,h=f(l,u,s,r,t),l=f(l,c,a,o,n),d.push(new i.Vector2(h,l));break;case"splineThru":for(h=this.actions[m-1].args,l=[new i.Vector2(h[h.length-2],h[h.length-1])],h=e*g[0].length,l=l.concat(g[0]),l=new i.SplineCurve(l),g=1;h>=g;g++)d.push(l.getPointAt(g/h));break;case"arc":for(t=g[0],n=g[1],a=g[2],r=g[3],h=g[4],s=!!g[5],u=h-r,c=2*e,g=1;c>=g;g++)l=g/c,s||(l=1-l),l=r+l*u,h=t+a*Math.cos(l),l=n+a*Math.sin(l),d.push(new i.Vector2(h,l));break;case"ellipse":t=g[0],n=g[1],a=g[2],o=g[3],r=g[4],h=g[5],s=!!g[6];var y=g[7];u=h-r,c=2*e;var _,b;for(0!==y&&(_=Math.cos(y),b=Math.sin(y)),g=1;c>=g;g++){if(l=g/c,s||(l=1-l),l=r+l*u,h=t+a*Math.cos(l),l=n+o*Math.sin(l),0!==y){var x=h;h=(x-t)*_-(l-n)*b+t,l=(x-t)*b+(l-n)*_+n}d.push(new i.Vector2(h,l))}}}return e=d[d.length-1],Math.abs(e.x-d[0].x)<Number.EPSILON&&Math.abs(e.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1),this.autoClose&&d.push(d[0]),d},i.Path.prototype.toShapes=function(e,t){function n(e){for(var t=[],n=0,r=e.length;r>n;n++){var o=e[n],s=new i.Shape;s.actions=o.actions,s.curves=o.curves,t.push(s)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,o=0;n>o;i=o++){var s=t[i],a=t[o],u=a.x-s.x,c=a.y-s.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(s=t[o],u=-u,a=t[i],c=-c),!(e.y<s.y||e.y>a.y))if(e.y===s.y){if(e.x===s.x)return!0}else{if(i=c*(e.x-s.x)-u*(e.y-s.y),0===i)return!0;0>i||(r=!r)}}else if(e.y===s.y&&(a.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=a.x))return!0}return r}var o=i.ShapeUtils.isClockWise,s=function(e){for(var t=[],n=new i.Path,r=0,o=e.length;o>r;r++){var s=e[r],a=s.args,s=s.action;"moveTo"===s&&0!==n.actions.length&&(t.push(n),n=new i.Path),n[s].apply(n,a)}return 0!==n.actions.length&&t.push(n),t}(this.actions);if(0===s.length)return[];if(!0===t)return n(s);var a,u,c,h=[];if(1===s.length)return u=s[0],c=new i.Shape,c.actions=u.actions,c.curves=u.curves,h.push(c),h;var l=!o(s[0].getPoints()),l=e?!l:l;c=[];var p,f=[],d=[],m=0;f[m]=void 0,d[m]=[];for(var v=0,g=s.length;g>v;v++)u=s[v],p=u.getPoints(),a=o(p),(a=e?!a:a)?(!l&&f[m]&&m++,f[m]={s:new i.Shape,p:p},f[m].s.actions=u.actions,f[m].s.curves=u.curves,l&&m++,d[m]=[]):d[m].push({h:u,p:p[0]});if(!f[0])return n(s);if(1<f.length){for(v=!1,u=[],o=0,s=f.length;s>o;o++)c[o]=[];for(o=0,s=f.length;s>o;o++)for(a=d[o],l=0;l<a.length;l++){for(m=a[l],p=!0,g=0;g<f.length;g++)r(m.p,f[g].p)&&(o!==g&&u.push({froms:o,tos:g,hole:l}),p?(p=!1,c[g].push(m)):v=!0);p&&c[o].push(m)}0<u.length&&(v||(d=c))}for(v=0,o=f.length;o>v;v++)for(c=f[v].s,h.push(c),u=d[v],s=0,a=u.length;a>s;s++)c.holes.push(u[s].h);return h},i.Shape=function(){i.Path.apply(this,arguments),this.holes=[]},i.Shape.prototype=Object.create(i.Path.prototype),i.Shape.prototype.constructor=i.Shape,i.Shape.prototype.extrude=function(e){return new i.ExtrudeGeometry(this,e)},i.Shape.prototype.makeGeometry=function(e){return new i.ShapeGeometry(this,e)},i.Shape.prototype.getPointsHoles=function(e){for(var t=[],n=0,r=this.holes.length;r>n;n++)t[n]=this.holes[n].getPoints(e);return t},i.Shape.prototype.extractAllPoints=function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},i.Shape.prototype.extractPoints=function(e){return this.extractAllPoints(e)},i.LineCurve=function(e,t){this.v1=e,this.v2=t},i.LineCurve.prototype=Object.create(i.Curve.prototype),i.LineCurve.prototype.constructor=i.LineCurve,i.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},i.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},i.LineCurve.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},i.QuadraticBezierCurve=function(e,t,n){this.v0=e,this.v1=t,this.v2=n},i.QuadraticBezierCurve.prototype=Object.create(i.Curve.prototype),i.QuadraticBezierCurve.prototype.constructor=i.QuadraticBezierCurve,i.QuadraticBezierCurve.prototype.getPoint=function(e){var t=i.ShapeUtils.b2;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},i.QuadraticBezierCurve.prototype.getTangent=function(e){var t=i.CurveUtils.tangentQuadraticBezier;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()},i.CubicBezierCurve=function(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r},i.CubicBezierCurve.prototype=Object.create(i.Curve.prototype),i.CubicBezierCurve.prototype.constructor=i.CubicBezierCurve,i.CubicBezierCurve.prototype.getPoint=function(e){var t=i.ShapeUtils.b3;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},i.CubicBezierCurve.prototype.getTangent=function(e){var t=i.CurveUtils.tangentCubicBezier;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},i.SplineCurve=function(e){this.points=void 0==e?[]:e},i.SplineCurve.prototype=Object.create(i.Curve.prototype),i.SplineCurve.prototype.constructor=i.SplineCurve,i.SplineCurve.prototype.getPoint=function(e){var t=this.points;e*=t.length-1;var n=Math.floor(e);e-=n;var r=t[0===n?n:n-1],o=t[n],s=t[n>t.length-2?t.length-1:n+1],t=t[n>t.length-3?t.length-1:n+2],n=i.CurveUtils.interpolate;return new i.Vector2(n(r.x,o.x,s.x,t.x,e),n(r.y,o.y,s.y,t.y,e))},i.EllipseCurve=function(e,t,n,r,i,o,s,a){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a||0},i.EllipseCurve.prototype=Object.create(i.Curve.prototype),i.EllipseCurve.prototype.constructor=i.EllipseCurve,i.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI),t=!0===this.aClockwise?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t,e=this.aX+this.xRadius*Math.cos(t);var n=this.aY+this.yRadius*Math.sin(t);if(0!==this.aRotation){var t=Math.cos(this.aRotation),r=Math.sin(this.aRotation),o=e;e=(o-this.aX)*t-(n-this.aY)*r+this.aX,n=(o-this.aX)*r+(n-this.aY)*t+this.aY}return new i.Vector2(e,n)},i.ArcCurve=function(e,t,n,r,o,s){i.EllipseCurve.call(this,e,t,n,n,r,o,s)},i.ArcCurve.prototype=Object.create(i.EllipseCurve.prototype),i.ArcCurve.prototype.constructor=i.ArcCurve,i.LineCurve3=i.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new i.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),i.QuadraticBezierCurve3=i.Curve.create(function(e,t,n){this.v0=e,this.v1=t,this.v2=n},function(e){var t=i.ShapeUtils.b2;return new i.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),i.CubicBezierCurve3=i.Curve.create(function(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r},function(e){var t=i.ShapeUtils.b3;return new i.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),i.SplineCurve3=i.Curve.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==e?[]:e},function(e){var t=this.points;e*=t.length-1;var n=Math.floor(e);e-=n;var r=t[0==n?n:n-1],o=t[n],s=t[n>t.length-2?t.length-1:n+1],t=t[n>t.length-3?t.length-1:n+2],n=i.CurveUtils.interpolate;return new i.Vector3(n(r.x,o.x,s.x,t.x,e),n(r.y,o.y,s.y,t.y,e),n(r.z,o.z,s.z,t.z,e))}),i.CatmullRomCurve3=function(){function e(){}var t=new i.Vector3,n=new e,r=new e,o=new e;return e.prototype.init=function(e,t,n,r){this.c0=e,this.c1=n,this.c2=-3*e+3*t-2*n-r,this.c3=2*e-2*t+n+r},e.prototype.initNonuniformCatmullRom=function(e,t,n,r,i,o,s){e=((t-e)/i-(n-e)/(i+o)+(n-t)/o)*o,r=((n-t)/o-(r-t)/(o+s)+(r-n)/s)*o,this.init(t,n,e,r)},e.prototype.initCatmullRom=function(e,t,n,r,i){this.init(t,n,i*(n-e),i*(r-t))},e.prototype.calc=function(e){var t=e*e;return this.c0+this.c1*e+this.c2*t+this.c3*t*e},i.Curve.create(function(e){this.points=e||[],this.closed=!1},function(e){var s,a,u=this.points;a=u.length,2>a&&console.log("duh, you need at least 2 points"),e*=a-(this.closed?0:1),s=Math.floor(e),e-=s,this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/u.length)+1)*u.length:0===e&&s===a-1&&(s=a-2,e=1);var c,h,l;if(this.closed||s>0?c=u[(s-1)%a]:(t.subVectors(u[0],u[1]).add(u[0]),c=t),h=u[s%a],l=u[(s+1)%a],this.closed||a>s+2?u=u[(s+2)%a]:(t.subVectors(u[a-1],u[a-2]).add(u[a-1]),u=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var p="chordal"===this.type?.5:.25;a=Math.pow(c.distanceToSquared(h),p),s=Math.pow(h.distanceToSquared(l),p),p=Math.pow(l.distanceToSquared(u),p),1e-4>s&&(s=1),1e-4>a&&(a=s),1e-4>p&&(p=s),n.initNonuniformCatmullRom(c.x,h.x,l.x,u.x,a,s,p),r.initNonuniformCatmullRom(c.y,h.y,l.y,u.y,a,s,p),o.initNonuniformCatmullRom(c.z,h.z,l.z,u.z,a,s,p)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,n.initCatmullRom(c.x,h.x,l.x,u.x,a),r.initCatmullRom(c.y,h.y,l.y,u.y,a),o.initCatmullRom(c.z,h.z,l.z,u.z,a));return new i.Vector3(n.calc(e),r.calc(e),o.calc(e))})}(),i.ClosedSplineCurve3=function(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),i.CatmullRomCurve3.call(this,e),this.type="catmullrom",this.closed=!0},i.ClosedSplineCurve3.prototype=Object.create(i.CatmullRomCurve3.prototype),i.BoxGeometry=function(e,t,n,r,o,s){i.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:o,depthSegments:s},this.fromBufferGeometry(new i.BoxBufferGeometry(e,t,n,r,o,s)),this.mergeVertices()},i.BoxGeometry.prototype=Object.create(i.Geometry.prototype),i.BoxGeometry.prototype.constructor=i.BoxGeometry,i.CubeGeometry=i.BoxGeometry,i.BoxBufferGeometry=function(e,t,n,r,o,s){function a(e,t,n,r,o,s,a,c,h,b,x){var w=s/h,S=a/b,M=s/2,E=a/2,C=c/2;a=h+1;for(var T=b+1,A=s=0,P=new i.Vector3,O=0;T>O;O++)for(var L=O*S-E,R=0;a>R;R++)P[e]=(R*w-M)*r,P[t]=L*o,P[n]=C,p[m]=P.x,p[m+1]=P.y,p[m+2]=P.z,P[e]=0,P[t]=0,P[n]=c>0?1:-1,f[m]=P.x,f[m+1]=P.y,f[m+2]=P.z,d[v]=R/h,d[v+1]=1-O/b,m+=3,v+=2,s+=1;for(O=0;b>O;O++)for(R=0;h>R;R++)e=y+R+a*(O+1),t=y+(R+1)+a*(O+1),n=y+(R+1)+a*O,l[g]=y+R+a*O,l[g+1]=e,l[g+2]=n,l[g+3]=e,l[g+4]=t,l[g+5]=n,g+=6,A+=6;u.addGroup(_,A,x),_+=A,y+=s}i.BufferGeometry.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:o,depthSegments:s};var u=this;r=Math.floor(r)||1,o=Math.floor(o)||1,s=Math.floor(s)||1;var c=function(e,t,n){return e=0+e*t*2+e*n*2,e+=n*t*2,4*e}(r,o,s),h=c/4*6,l=new(h>65535?Uint32Array:Uint16Array)(h),p=new Float32Array(3*c),f=new Float32Array(3*c),d=new Float32Array(2*c),m=0,v=0,g=0,y=0,_=0;a("z","y","x",-1,-1,n,t,e,s,o,0),a("z","y","x",1,-1,n,t,-e,s,o,1),a("x","z","y",1,1,e,n,t,r,s,2),a("x","z","y",1,-1,e,n,-t,r,s,3),a("x","y","z",1,-1,e,t,n,r,o,4),a("x","y","z",-1,-1,e,t,-n,r,o,5),this.setIndex(new i.BufferAttribute(l,1)),this.addAttribute("position",new i.BufferAttribute(p,3)),this.addAttribute("normal",new i.BufferAttribute(f,3)),this.addAttribute("uv",new i.BufferAttribute(d,2))},i.BoxBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.BoxBufferGeometry.prototype.constructor=i.BoxBufferGeometry,i.CircleGeometry=function(e,t,n,r){i.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new i.CircleBufferGeometry(e,t,n,r))},i.CircleGeometry.prototype=Object.create(i.Geometry.prototype),i.CircleGeometry.prototype.constructor=i.CircleGeometry,i.CircleBufferGeometry=function(e,t,n,r){i.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||50,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o=t+2,s=new Float32Array(3*o),a=new Float32Array(3*o),o=new Float32Array(2*o);a[2]=1,o[0]=.5,o[1]=.5;for(var u=0,c=3,h=2;t>=u;u++,c+=3,h+=2){var l=n+u/t*r;s[c]=e*Math.cos(l),s[c+1]=e*Math.sin(l),a[c+2]=1,o[h]=(s[c]/e+1)/2,o[h+1]=(s[c+1]/e+1)/2}for(n=[],c=1;t>=c;c++)n.push(c,c+1,0);this.setIndex(new i.BufferAttribute(new Uint16Array(n),1)),this.addAttribute("position",new i.BufferAttribute(s,3)),this.addAttribute("normal",new i.BufferAttribute(a,3)),this.addAttribute("uv",new i.BufferAttribute(o,2)),this.boundingSphere=new i.Sphere(new i.Vector3,e)},i.CircleBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.CircleBufferGeometry.prototype.constructor=i.CircleBufferGeometry,i.CylinderBufferGeometry=function(e,t,n,r,o,s,a,u){function c(n){var o,s,c;c=new i.Vector2;var l=new i.Vector3,p=0,_=!0===n?e:t,w=!0===n?1:-1;for(s=g,o=1;r>=o;o++)d.setXYZ(g,0,b*w,0),m.setXYZ(g,0,w,0),!0===n?(c.x=o/r,c.y=0):(c.x=(o-1)/r,c.y=1),v.setXY(g,c.x,c.y),g++;for(c=g,o=0;r>=o;o++){var S=o/r;l.x=_*Math.sin(S*u+a),l.y=b*w,l.z=_*Math.cos(S*u+a),d.setXYZ(g,l.x,l.y,l.z),m.setXYZ(g,0,w,0),v.setXY(g,S,!0===n?1:0),g++}for(o=0;r>o;o++)l=s+o,_=c+o,!0===n?(f.setX(y,_),y++,f.setX(y,_+1)):(f.setX(y,_+1),y++,f.setX(y,_)),y++,f.setX(y,l),y++,p+=3;h.addGroup(x,p,!0===n?1:2),x+=p}i.BufferGeometry.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:o,openEnded:s,thetaStart:a,thetaLength:u};var h=this;e=void 0!==e?e:20,t=void 0!==t?t:20,n=void 0!==n?n:100,r=Math.floor(r)||8,o=Math.floor(o)||1,s=void 0!==s?s:!1,a=void 0!==a?a:0,u=void 0!==u?u:2*Math.PI;var l=function(){var e=(r+1)*(o+1);return!1===s&&(e+=2*(r+1)+2*r),e}(),p=function(){var e=r*o*6;return!1===s&&(e+=6*r),e}(),f=new i.BufferAttribute(new(p>65535?Uint32Array:Uint16Array)(p),1),d=new i.BufferAttribute(new Float32Array(3*l),3),m=new i.BufferAttribute(new Float32Array(3*l),3),v=new i.BufferAttribute(new Float32Array(2*l),2),g=0,y=0,_=[],b=n/2,x=0;!function(){var s,c,l=new i.Vector3,p=new i.Vector3,w=0,S=(t-e)/n;for(c=0;o>=c;c++){var M=[],E=c/o,C=E*(t-e)+e;for(s=0;r>=s;s++){var T=s/r;p.x=C*Math.sin(T*u+a),p.y=-E*n+b,p.z=C*Math.cos(T*u+a),d.setXYZ(g,p.x,p.y,p.z),l.copy(p),(0===e&&0===c||0===t&&c===o)&&(l.x=Math.sin(T*u+a),l.z=Math.cos(T*u+a)),l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*S).normalize(),m.setXYZ(g,l.x,l.y,l.z),v.setXY(g,T,1-E),M.push(g),g++}_.push(M)}for(s=0;r>s;s++)for(c=0;o>c;c++)l=_[c+1][s],p=_[c+1][s+1],S=_[c][s+1],f.setX(y,_[c][s]),y++,f.setX(y,l),y++,f.setX(y,S),y++,f.setX(y,l),y++,f.setX(y,p),y++,f.setX(y,S),y++,w+=6;h.addGroup(x,w,0),x+=w}(),!1===s&&(e>0&&c(!0),t>0&&c(!1)),this.setIndex(f),this.addAttribute("position",d),this.addAttribute("normal",m),this.addAttribute("uv",v)},i.CylinderBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.CylinderBufferGeometry.prototype.constructor=i.CylinderBufferGeometry,i.CylinderGeometry=function(e,t,n,r,o,s,a,u){i.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:o,openEnded:s,thetaStart:a,thetaLength:u},this.fromBufferGeometry(new i.CylinderBufferGeometry(e,t,n,r,o,s,a,u)),this.mergeVertices()},i.CylinderGeometry.prototype=Object.create(i.Geometry.prototype),i.CylinderGeometry.prototype.constructor=i.CylinderGeometry,i.EdgesGeometry=function(e,t){function n(e,t){return e-t}i.BufferGeometry.call(this);var r,o=Math.cos(i.Math.DEG2RAD*(void 0!==t?t:1)),s=[0,0],a={},u=["a","b","c"];e instanceof i.BufferGeometry?(r=new i.Geometry,r.fromBufferGeometry(e)):r=e.clone(),r.mergeVertices(),r.computeFaceNormals();var c=r.vertices;r=r.faces;for(var h=0,l=r.length;l>h;h++)for(var p=r[h],f=0;3>f;f++){s[0]=p[u[f]],s[1]=p[u[(f+1)%3]],s.sort(n);var d=s.toString();void 0===a[d]?a[d]={vert1:s[0],vert2:s[1],face1:h,face2:void 0}:a[d].face2=h}s=[];for(d in a)u=a[d],(void 0===u.face2||r[u.face1].normal.dot(r[u.face2].normal)<=o)&&(h=c[u.vert1],s.push(h.x),s.push(h.y),s.push(h.z),h=c[u.vert2],s.push(h.x),s.push(h.y),s.push(h.z));this.addAttribute("position",new i.BufferAttribute(new Float32Array(s),3))},i.EdgesGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.EdgesGeometry.prototype.constructor=i.EdgesGeometry,i.ExtrudeGeometry=function(e,t){"undefined"!=typeof e&&(i.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),this.computeFaceNormals())},i.ExtrudeGeometry.prototype=Object.create(i.Geometry.prototype),i.ExtrudeGeometry.prototype.constructor=i.ExtrudeGeometry,i.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var n=e.length,r=0;n>r;r++)this.addShape(e[r],t)},i.ExtrudeGeometry.prototype.addShape=function(e,t){function n(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}function r(e,t,n){var r=1,r=e.x-t.x,o=e.y-t.y,s=n.x-e.x,a=n.y-e.y,u=r*r+o*o;if(Math.abs(r*a-o*s)>Number.EPSILON){var c=Math.sqrt(u),h=Math.sqrt(s*s+a*a),u=t.x-o/c;if(t=t.y+r/c,s=((n.x-a/h-u)*a-(n.y+s/h-t)*s)/(r*a-o*s),n=u+r*s-e.x,e=t+o*s-e.y,r=n*n+e*e,2>=r)return new i.Vector2(n,e);r=Math.sqrt(r/2)}else e=!1,r>Number.EPSILON?s>Number.EPSILON&&(e=!0):r<-Number.EPSILON?s<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(a)&&(e=!0),e?(n=-o,e=r,r=Math.sqrt(u)):(n=r,e=o,r=Math.sqrt(u/2));return new i.Vector2(n/r,e/r)}function o(e,t){var n,r;for(B=e.length;0<=--B;){n=B,r=B-1,0>r&&(r=e.length-1);for(var o=0,s=_+2*v,o=0;s>o;o++){var a=j*o,u=j*(o+1),c=t+n+a,a=t+r+a,h=t+r+u,u=t+n+u,c=c+T,a=a+T,h=h+T,u=u+T;C.faces.push(new i.Face3(c,a,u,null,null,1)),C.faces.push(new i.Face3(a,h,u,null,null,1)),c=w.generateSideWallUV(C,c,a,h,u),C.faceVertexUvs[0].push([c[0],c[1],c[3]]),C.faceVertexUvs[0].push([c[1],c[2],c[3]])}}}function s(e,t,n){C.vertices.push(new i.Vector3(e,t,n))}function a(e,t,n){e+=T,t+=T,n+=T,C.faces.push(new i.Face3(e,t,n,null,null,0)),e=w.generateTopUV(C,e,t,n),C.faceVertexUvs[0].push(e)}var u,c,h,l,p,f=void 0!==t.amount?t.amount:100,d=void 0!==t.bevelThickness?t.bevelThickness:6,m=void 0!==t.bevelSize?t.bevelSize:d-2,v=void 0!==t.bevelSegments?t.bevelSegments:3,g=void 0!==t.bevelEnabled?t.bevelEnabled:!0,y=void 0!==t.curveSegments?t.curveSegments:12,_=void 0!==t.steps?t.steps:1,b=t.extrudePath,x=!1,w=void 0!==t.UVGenerator?t.UVGenerator:i.ExtrudeGeometry.WorldUVGenerator;b&&(u=b.getSpacedPoints(_),x=!0,g=!1,c=void 0!==t.frames?t.frames:new i.TubeGeometry.FrenetFrames(b,_,!1),h=new i.Vector3,l=new i.Vector3,p=new i.Vector3),g||(m=d=v=0);var S,M,E,C=this,T=this.vertices.length,b=e.extractPoints(y),y=b.shape,A=b.holes;if(b=!i.ShapeUtils.isClockWise(y)){for(y=y.reverse(),M=0,E=A.length;E>M;M++)S=A[M],i.ShapeUtils.isClockWise(S)&&(A[M]=S.reverse());b=!1}var P=i.ShapeUtils.triangulateShape(y,A),O=y;for(M=0,E=A.length;E>M;M++)S=A[M],y=y.concat(S);var L,R,N,D,I,k,j=y.length,F=P.length,b=[],B=0;for(N=O.length,L=N-1,R=B+1;N>B;B++,L++,R++)L===N&&(L=0),R===N&&(R=0),b[B]=r(O[B],O[L],O[R]);var V,U=[],G=b.concat();for(M=0,E=A.length;E>M;M++){for(S=A[M],V=[],B=0,N=S.length,L=N-1,R=B+1;N>B;B++,L++,R++)L===N&&(L=0),R===N&&(R=0),V[B]=r(S[B],S[L],S[R]);U.push(V),G=G.concat(V)}for(L=0;v>L;L++){for(N=L/v,D=d*(1-N),R=m*Math.sin(N*Math.PI/2),B=0,N=O.length;N>B;B++)I=n(O[B],b[B],R),s(I.x,I.y,-D);for(M=0,E=A.length;E>M;M++)for(S=A[M],V=U[M],B=0,N=S.length;N>B;B++)I=n(S[B],V[B],R),s(I.x,I.y,-D)}for(R=m,B=0;j>B;B++)I=g?n(y[B],G[B],R):y[B],x?(l.copy(c.normals[0]).multiplyScalar(I.x),h.copy(c.binormals[0]).multiplyScalar(I.y),p.copy(u[0]).add(l).add(h),s(p.x,p.y,p.z)):s(I.x,I.y,0);for(N=1;_>=N;N++)for(B=0;j>B;B++)I=g?n(y[B],G[B],R):y[B],x?(l.copy(c.normals[N]).multiplyScalar(I.x),h.copy(c.binormals[N]).multiplyScalar(I.y),p.copy(u[N]).add(l).add(h),s(p.x,p.y,p.z)):s(I.x,I.y,f/_*N);for(L=v-1;L>=0;L--){for(N=L/v,D=d*(1-N),R=m*Math.sin(N*Math.PI/2),B=0,N=O.length;N>B;B++)I=n(O[B],b[B],R),s(I.x,I.y,f+D);for(M=0,E=A.length;E>M;M++)for(S=A[M],V=U[M],B=0,N=S.length;N>B;B++)I=n(S[B],V[B],R),x?s(I.x,I.y+u[_-1].y,u[_-1].x+D):s(I.x,I.y,f+D)}!function(){if(g){var e;for(e=0*j,B=0;F>B;B++)k=P[B],a(k[2]+e,k[1]+e,k[0]+e);for(e=_+2*v,e*=j,B=0;F>B;B++)k=P[B],a(k[0]+e,k[1]+e,k[2]+e)}else{for(B=0;F>B;B++)k=P[B],a(k[2],k[1],k[0]);for(B=0;F>B;B++)k=P[B],a(k[0]+j*_,k[1]+j*_,k[2]+j*_)}}(),function(){var e=0;for(o(O,e),e+=O.length,M=0,E=A.length;E>M;M++)S=A[M],o(S,e),e+=S.length}()},i.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,n,r){return e=e.vertices,t=e[t],n=e[n],r=e[r],[new i.Vector2(t.x,t.y),new i.Vector2(n.x,n.y),new i.Vector2(r.x,r.y)]},generateSideWallUV:function(e,t,n,r,o){return e=e.vertices,t=e[t],n=e[n],r=e[r],o=e[o],.01>Math.abs(t.y-n.y)?[new i.Vector2(t.x,1-t.z),new i.Vector2(n.x,1-n.z),new i.Vector2(r.x,1-r.z),new i.Vector2(o.x,1-o.z)]:[new i.Vector2(t.y,1-t.z),new i.Vector2(n.y,1-n.z),new i.Vector2(r.y,1-r.z),new i.Vector2(o.y,1-o.z)]}},i.ShapeGeometry=function(e,t){i.Geometry.call(this),this.type="ShapeGeometry",!1===Array.isArray(e)&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},i.ShapeGeometry.prototype=Object.create(i.Geometry.prototype),i.ShapeGeometry.prototype.constructor=i.ShapeGeometry,i.ShapeGeometry.prototype.addShapeList=function(e,t){for(var n=0,r=e.length;r>n;n++)this.addShape(e[n],t);return this},i.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var n,r,o,s=t.material,a=void 0===t.UVGenerator?i.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,u=this.vertices.length;n=e.extractPoints(void 0!==t.curveSegments?t.curveSegments:12);var c=n.shape,h=n.holes;if(!i.ShapeUtils.isClockWise(c))for(c=c.reverse(),n=0,r=h.length;r>n;n++)o=h[n],i.ShapeUtils.isClockWise(o)&&(h[n]=o.reverse());var l=i.ShapeUtils.triangulateShape(c,h);for(n=0,r=h.length;r>n;n++)o=h[n],c=c.concat(o);for(h=c.length,r=l.length,n=0;h>n;n++)o=c[n],this.vertices.push(new i.Vector3(o.x,o.y,0));for(n=0;r>n;n++)h=l[n],c=h[0]+u,o=h[1]+u,h=h[2]+u,this.faces.push(new i.Face3(c,o,h,null,null,s)),this.faceVertexUvs[0].push(a.generateTopUV(this,c,o,h))},i.LatheBufferGeometry=function(e,t,n,r){i.BufferGeometry.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||2*Math.PI,r=i.Math.clamp(r,0,2*Math.PI);for(var o=(t+1)*e.length,s=t*e.length*6,a=new i.BufferAttribute(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new i.BufferAttribute(new Float32Array(3*o),3),c=new i.BufferAttribute(new Float32Array(2*o),2),h=0,l=0,p=1/t,f=new i.Vector3,d=new i.Vector2,o=0;t>=o;o++)for(var s=n+o*p*r,m=Math.sin(s),v=Math.cos(s),s=0;s<=e.length-1;s++)f.x=e[s].x*m,f.y=e[s].y,f.z=e[s].x*v,u.setXYZ(h,f.x,f.y,f.z),d.x=o/t,d.y=s/(e.length-1),c.setXY(h,d.x,d.y),h++;for(o=0;t>o;o++)for(s=0;s<e.length-1;s++)n=s+o*e.length,h=n+e.length,p=n+e.length+1,f=n+1,a.setX(l,n),l++,a.setX(l,h),l++,a.setX(l,f),l++,a.setX(l,h),l++,a.setX(l,p),l++,a.setX(l,f),l++;if(this.setIndex(a),this.addAttribute("position",u),this.addAttribute("uv",c),this.computeVertexNormals(),r===2*Math.PI)for(r=this.attributes.normal.array,a=new i.Vector3,u=new i.Vector3,c=new i.Vector3,n=t*e.length*3,s=o=0;o<e.length;o++,s+=3)a.x=r[s+0],a.y=r[s+1],a.z=r[s+2],u.x=r[n+s+0],u.y=r[n+s+1],u.z=r[n+s+2],c.addVectors(a,u).normalize(),r[s+0]=r[n+s+0]=c.x,r[s+1]=r[n+s+1]=c.y,r[s+2]=r[n+s+2]=c.z},i.LatheBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.LatheBufferGeometry.prototype.constructor=i.LatheBufferGeometry,i.LatheGeometry=function(e,t,n,r){i.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new i.LatheBufferGeometry(e,t,n,r)),this.mergeVertices()},i.LatheGeometry.prototype=Object.create(i.Geometry.prototype),i.LatheGeometry.prototype.constructor=i.LatheGeometry,i.PlaneGeometry=function(e,t,n,r){i.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new i.PlaneBufferGeometry(e,t,n,r))},i.PlaneGeometry.prototype=Object.create(i.Geometry.prototype),i.PlaneGeometry.prototype.constructor=i.PlaneGeometry,i.PlaneBufferGeometry=function(e,t,n,r){i.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};var o=e/2,s=t/2;n=Math.floor(n)||1,r=Math.floor(r)||1;var a=n+1,u=r+1,c=e/n,h=t/r;t=new Float32Array(a*u*3),e=new Float32Array(a*u*3);for(var l=new Float32Array(a*u*2),p=0,f=0,d=0;u>d;d++)for(var m=d*h-s,v=0;a>v;v++)t[p]=v*c-o,t[p+1]=-m,e[p+2]=1,l[f]=v/n,
|
||
l[f+1]=1-d/r,p+=3,f+=2;for(p=0,o=new(65535<t.length/3?Uint32Array:Uint16Array)(n*r*6),d=0;r>d;d++)for(v=0;n>v;v++)s=v+a*(d+1),u=v+1+a*(d+1),c=v+1+a*d,o[p]=v+a*d,o[p+1]=s,o[p+2]=c,o[p+3]=s,o[p+4]=u,o[p+5]=c,p+=6;this.setIndex(new i.BufferAttribute(o,1)),this.addAttribute("position",new i.BufferAttribute(t,3)),this.addAttribute("normal",new i.BufferAttribute(e,3)),this.addAttribute("uv",new i.BufferAttribute(l,2))},i.PlaneBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.PlaneBufferGeometry.prototype.constructor=i.PlaneBufferGeometry,i.RingBufferGeometry=function(e,t,n,r,o,s){i.BufferGeometry.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:o,thetaLength:s},e=e||20,t=t||50,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var a,u,c=(n+1)*(r+1),h=n*r*6,h=new i.BufferAttribute(new(h>65535?Uint32Array:Uint16Array)(h),1),l=new i.BufferAttribute(new Float32Array(3*c),3),p=new i.BufferAttribute(new Float32Array(3*c),3),c=new i.BufferAttribute(new Float32Array(2*c),2),f=0,d=0,m=e,v=(t-e)/r,g=new i.Vector3,y=new i.Vector2;for(e=0;r>=e;e++){for(u=0;n>=u;u++)a=o+u/n*s,g.x=m*Math.cos(a),g.y=m*Math.sin(a),l.setXYZ(f,g.x,g.y,g.z),p.setXYZ(f,0,0,1),y.x=(g.x/t+1)/2,y.y=(g.y/t+1)/2,c.setXY(f,y.x,y.y),f++;m+=v}for(e=0;r>e;e++)for(t=e*(n+1),u=0;n>u;u++)o=a=u+t,s=a+n+1,f=a+n+2,a+=1,h.setX(d,o),d++,h.setX(d,s),d++,h.setX(d,f),d++,h.setX(d,o),d++,h.setX(d,f),d++,h.setX(d,a),d++;this.setIndex(h),this.addAttribute("position",l),this.addAttribute("normal",p),this.addAttribute("uv",c)},i.RingBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.RingBufferGeometry.prototype.constructor=i.RingBufferGeometry,i.RingGeometry=function(e,t,n,r,o,s){i.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new i.RingBufferGeometry(e,t,n,r,o,s))},i.RingGeometry.prototype=Object.create(i.Geometry.prototype),i.RingGeometry.prototype.constructor=i.RingGeometry,i.SphereGeometry=function(e,t,n,r,o,s,a){i.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new i.SphereBufferGeometry(e,t,n,r,o,s,a))},i.SphereGeometry.prototype=Object.create(i.Geometry.prototype),i.SphereGeometry.prototype.constructor=i.SphereGeometry,i.SphereBufferGeometry=function(e,t,n,r,o,s,a){i.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:o,thetaStart:s,thetaLength:a},e=e||50,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,s=void 0!==s?s:0,a=void 0!==a?a:Math.PI;for(var u=s+a,c=(t+1)*(n+1),h=new i.BufferAttribute(new Float32Array(3*c),3),l=new i.BufferAttribute(new Float32Array(3*c),3),c=new i.BufferAttribute(new Float32Array(2*c),2),p=0,f=[],d=new i.Vector3,m=0;n>=m;m++){for(var v=[],g=m/n,y=0;t>=y;y++){var _=y/t,b=-e*Math.cos(r+_*o)*Math.sin(s+g*a),x=e*Math.cos(s+g*a),w=e*Math.sin(r+_*o)*Math.sin(s+g*a);d.set(b,x,w).normalize(),h.setXYZ(p,b,x,w),l.setXYZ(p,d.x,d.y,d.z),c.setXY(p,_,1-g),v.push(p),p++}f.push(v)}for(r=[],m=0;n>m;m++)for(y=0;t>y;y++)o=f[m][y+1],a=f[m][y],p=f[m+1][y],d=f[m+1][y+1],(0!==m||s>0)&&r.push(o,a,d),(m!==n-1||u<Math.PI)&&r.push(a,p,d);this.setIndex(new(65535<h.count?i.Uint32Attribute:i.Uint16Attribute)(r,1)),this.addAttribute("position",h),this.addAttribute("normal",l),this.addAttribute("uv",c),this.boundingSphere=new i.Sphere(new i.Vector3,e)},i.SphereBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.SphereBufferGeometry.prototype.constructor=i.SphereBufferGeometry,i.TextGeometry=function(e,t){t=t||{};var n=t.font;return!1==n instanceof i.Font?(console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new i.Geometry):(n=n.generateShapes(e,t.size,t.curveSegments),t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),i.ExtrudeGeometry.call(this,n,t),void(this.type="TextGeometry"))},i.TextGeometry.prototype=Object.create(i.ExtrudeGeometry.prototype),i.TextGeometry.prototype.constructor=i.TextGeometry,i.TorusBufferGeometry=function(e,t,n,r,o){i.BufferGeometry.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:o},e=e||100,t=t||40,n=Math.floor(n)||8,r=Math.floor(r)||6,o=o||2*Math.PI;var s,a,u=(n+1)*(r+1),c=n*r*6,c=new(c>65535?Uint32Array:Uint16Array)(c),h=new Float32Array(3*u),l=new Float32Array(3*u),u=new Float32Array(2*u),p=0,f=0,d=0,m=new i.Vector3,v=new i.Vector3,g=new i.Vector3;for(s=0;n>=s;s++)for(a=0;r>=a;a++){var y=a/r*o,_=s/n*Math.PI*2;v.x=(e+t*Math.cos(_))*Math.cos(y),v.y=(e+t*Math.cos(_))*Math.sin(y),v.z=t*Math.sin(_),h[p]=v.x,h[p+1]=v.y,h[p+2]=v.z,m.x=e*Math.cos(y),m.y=e*Math.sin(y),g.subVectors(v,m).normalize(),l[p]=g.x,l[p+1]=g.y,l[p+2]=g.z,u[f]=a/r,u[f+1]=s/n,p+=3,f+=2}for(s=1;n>=s;s++)for(a=1;r>=a;a++)e=(r+1)*(s-1)+a-1,t=(r+1)*(s-1)+a,o=(r+1)*s+a,c[d]=(r+1)*s+a-1,c[d+1]=e,c[d+2]=o,c[d+3]=e,c[d+4]=t,c[d+5]=o,d+=6;this.setIndex(new i.BufferAttribute(c,1)),this.addAttribute("position",new i.BufferAttribute(h,3)),this.addAttribute("normal",new i.BufferAttribute(l,3)),this.addAttribute("uv",new i.BufferAttribute(u,2))},i.TorusBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.TorusBufferGeometry.prototype.constructor=i.TorusBufferGeometry,i.TorusGeometry=function(e,t,n,r,o){i.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:o},this.fromBufferGeometry(new i.TorusBufferGeometry(e,t,n,r,o))},i.TorusGeometry.prototype=Object.create(i.Geometry.prototype),i.TorusGeometry.prototype.constructor=i.TorusGeometry,i.TorusKnotBufferGeometry=function(e,t,n,r,o,s){function a(e,t,n,r,i){var o=Math.cos(e),s=Math.sin(e);e*=n/t,t=Math.cos(e),i.x=r*(2+t)*.5*o,i.y=r*(2+t)*s*.5,i.z=r*Math.sin(e)*.5}i.BufferGeometry.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:o,q:s},e=e||100,t=t||40,n=Math.floor(n)||64,r=Math.floor(r)||8,o=o||2,s=s||3;var u,c,h=(r+1)*(n+1),l=r*n*6,l=new i.BufferAttribute(new(l>65535?Uint32Array:Uint16Array)(l),1),p=new i.BufferAttribute(new Float32Array(3*h),3),f=new i.BufferAttribute(new Float32Array(3*h),3),h=new i.BufferAttribute(new Float32Array(2*h),2),d=0,m=0,v=new i.Vector3,g=new i.Vector3,y=new i.Vector2,_=new i.Vector3,b=new i.Vector3,x=new i.Vector3,w=new i.Vector3,S=new i.Vector3;for(u=0;n>=u;++u)for(c=u/n*o*Math.PI*2,a(c,o,s,e,_),a(c+.01,o,s,e,b),w.subVectors(b,_),S.addVectors(b,_),x.crossVectors(w,S),S.crossVectors(x,w),x.normalize(),S.normalize(),c=0;r>=c;++c){var M=c/r*Math.PI*2,E=-t*Math.cos(M),M=t*Math.sin(M);v.x=_.x+(E*S.x+M*x.x),v.y=_.y+(E*S.y+M*x.y),v.z=_.z+(E*S.z+M*x.z),p.setXYZ(d,v.x,v.y,v.z),g.subVectors(v,_).normalize(),f.setXYZ(d,g.x,g.y,g.z),y.x=u/n,y.y=c/r,h.setXY(d,y.x,y.y),d++}for(c=1;n>=c;c++)for(u=1;r>=u;u++)e=(r+1)*c+(u-1),t=(r+1)*c+u,o=(r+1)*(c-1)+u,l.setX(m,(r+1)*(c-1)+(u-1)),m++,l.setX(m,e),m++,l.setX(m,o),m++,l.setX(m,e),m++,l.setX(m,t),m++,l.setX(m,o),m++;this.setIndex(l),this.addAttribute("position",p),this.addAttribute("normal",f),this.addAttribute("uv",h)},i.TorusKnotBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.TorusKnotBufferGeometry.prototype.constructor=i.TorusKnotBufferGeometry,i.TorusKnotGeometry=function(e,t,n,r,o,s,a){i.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:o,q:s},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new i.TorusKnotBufferGeometry(e,t,n,r,o,s)),this.mergeVertices()},i.TorusKnotGeometry.prototype=Object.create(i.Geometry.prototype),i.TorusKnotGeometry.prototype.constructor=i.TorusKnotGeometry,i.TubeGeometry=function(e,t,n,r,o,s){i.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:n,radialSegments:r,closed:o,taper:s},t=t||64,n=n||1,r=r||8,o=o||!1,s=s||i.TubeGeometry.NoTaper;var a,u,c,h,l,p,f,d,m,v,g=[],y=t+1,_=new i.Vector3;for(d=new i.TubeGeometry.FrenetFrames(e,t,o),m=d.normals,v=d.binormals,this.tangents=d.tangents,this.normals=m,this.binormals=v,d=0;y>d;d++)for(g[d]=[],c=d/(y-1),f=e.getPointAt(c),a=m[d],u=v[d],l=n*s(c),c=0;r>c;c++)h=c/r*2*Math.PI,p=-l*Math.cos(h),h=l*Math.sin(h),_.copy(f),_.x+=p*a.x+h*u.x,_.y+=p*a.y+h*u.y,_.z+=p*a.z+h*u.z,g[d][c]=this.vertices.push(new i.Vector3(_.x,_.y,_.z))-1;for(d=0;t>d;d++)for(c=0;r>c;c++)s=o?(d+1)%t:d+1,y=(c+1)%r,e=g[d][c],n=g[s][c],s=g[s][y],y=g[d][y],_=new i.Vector2(d/t,c/r),m=new i.Vector2((d+1)/t,c/r),v=new i.Vector2((d+1)/t,(c+1)/r),a=new i.Vector2(d/t,(c+1)/r),this.faces.push(new i.Face3(e,n,y)),this.faceVertexUvs[0].push([_,m,a]),this.faces.push(new i.Face3(n,s,y)),this.faceVertexUvs[0].push([m.clone(),v,a.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},i.TubeGeometry.prototype=Object.create(i.Geometry.prototype),i.TubeGeometry.prototype.constructor=i.TubeGeometry,i.TubeGeometry.NoTaper=function(e){return 1},i.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},i.TubeGeometry.FrenetFrames=function(e,t,n){var r=new i.Vector3,o=[],s=[],a=[],u=new i.Vector3,c=new i.Matrix4;t+=1;var h,l,p;for(this.tangents=o,this.normals=s,this.binormals=a,h=0;t>h;h++)l=h/(t-1),o[h]=e.getTangentAt(l),o[h].normalize();for(s[0]=new i.Vector3,a[0]=new i.Vector3,e=Number.MAX_VALUE,h=Math.abs(o[0].x),l=Math.abs(o[0].y),p=Math.abs(o[0].z),e>=h&&(e=h,r.set(1,0,0)),e>=l&&(e=l,r.set(0,1,0)),e>=p&&r.set(0,0,1),u.crossVectors(o[0],r).normalize(),s[0].crossVectors(o[0],u),a[0].crossVectors(o[0],s[0]),h=1;t>h;h++)s[h]=s[h-1].clone(),a[h]=a[h-1].clone(),u.crossVectors(o[h-1],o[h]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(i.Math.clamp(o[h-1].dot(o[h]),-1,1)),s[h].applyMatrix4(c.makeRotationAxis(u,r))),a[h].crossVectors(o[h],s[h]);if(n)for(r=Math.acos(i.Math.clamp(s[0].dot(s[t-1]),-1,1)),r/=t-1,0<o[0].dot(u.crossVectors(s[0],s[t-1]))&&(r=-r),h=1;t>h;h++)s[h].applyMatrix4(c.makeRotationAxis(o[h],r*h)),a[h].crossVectors(o[h],s[h])},i.PolyhedronGeometry=function(e,t,n,r){function o(e){var t=e.normalize().clone();t.index=c.vertices.push(t)-1;var n=Math.atan2(e.z,-e.x)/2/Math.PI+.5;return e=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5,t.uv=new i.Vector2(n,1-e),t}function s(e,t,n,r){r=new i.Face3(e.index,t.index,n.index,[e.clone(),t.clone(),n.clone()],void 0,r),c.faces.push(r),g.copy(e).add(t).add(n).divideScalar(3),r=Math.atan2(g.z,-g.x),c.faceVertexUvs[0].push([u(e.uv,e,r),u(t.uv,t,r),u(n.uv,n,r)])}function a(e,t){for(var n=Math.pow(2,t),r=o(c.vertices[e.a]),i=o(c.vertices[e.b]),a=o(c.vertices[e.c]),u=[],h=e.materialIndex,l=0;n>=l;l++){u[l]=[];for(var p=o(r.clone().lerp(a,l/n)),f=o(i.clone().lerp(a,l/n)),d=n-l,m=0;d>=m;m++)u[l][m]=0===m&&l===n?p:o(p.clone().lerp(f,m/d))}for(l=0;n>l;l++)for(m=0;2*(n-l)-1>m;m++)r=Math.floor(m/2),0===m%2?s(u[l][r+1],u[l+1][r],u[l][r],h):s(u[l][r+1],u[l+1][r+1],u[l+1][r],h)}function u(e,t,n){return 0>n&&1===e.x&&(e=new i.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new i.Vector2(n/2/Math.PI+.5,e.y)),e.clone()}i.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;for(var c=this,h=0,l=e.length;l>h;h+=3)o(new i.Vector3(e[h],e[h+1],e[h+2]));e=this.vertices;for(var p=[],f=h=0,l=t.length;l>h;h+=3,f++){var d=e[t[h]],m=e[t[h+1]],v=e[t[h+2]];p[f]=new i.Face3(d.index,m.index,v.index,[d.clone(),m.clone(),v.clone()],void 0,f)}for(var g=new i.Vector3,h=0,l=p.length;l>h;h++)a(p[h],r);for(h=0,l=this.faceVertexUvs[0].length;l>h;h++)t=this.faceVertexUvs[0][h],r=t[0].x,e=t[1].x,p=t[2].x,f=Math.max(r,e,p),d=Math.min(r,e,p),f>.9&&.1>d&&(.2>r&&(t[0].x+=1),.2>e&&(t[1].x+=1),.2>p&&(t[2].x+=1));for(h=0,l=this.vertices.length;l>h;h++)this.vertices[h].multiplyScalar(n);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new i.Sphere(new i.Vector3,n)},i.PolyhedronGeometry.prototype=Object.create(i.Geometry.prototype),i.PolyhedronGeometry.prototype.constructor=i.PolyhedronGeometry,i.DodecahedronGeometry=function(e,t){var n=(1+Math.sqrt(5))/2,r=1/n;i.PolyhedronGeometry.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,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[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="DodecahedronGeometry",this.parameters={radius:e,detail:t}},i.DodecahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.DodecahedronGeometry.prototype.constructor=i.DodecahedronGeometry,i.IcosahedronGeometry=function(e,t){var n=(1+Math.sqrt(5))/2;i.PolyhedronGeometry.call(this,[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,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="IcosahedronGeometry",this.parameters={radius:e,detail:t}},i.IcosahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.IcosahedronGeometry.prototype.constructor=i.IcosahedronGeometry,i.OctahedronGeometry=function(e,t){i.PolyhedronGeometry.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="OctahedronGeometry",this.parameters={radius:e,detail:t}},i.OctahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.OctahedronGeometry.prototype.constructor=i.OctahedronGeometry,i.TetrahedronGeometry=function(e,t){i.PolyhedronGeometry.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="TetrahedronGeometry",this.parameters={radius:e,detail:t}},i.TetrahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.TetrahedronGeometry.prototype.constructor=i.TetrahedronGeometry,i.ParametricGeometry=function(e,t,n){i.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n};var r,o,s,a,u=this.vertices,c=this.faces,h=this.faceVertexUvs[0],l=t+1;for(r=0;n>=r;r++)for(a=r/n,o=0;t>=o;o++)s=o/t,s=e(s,a),u.push(s);var p,f,d,m;for(r=0;n>r;r++)for(o=0;t>o;o++)e=r*l+o,u=r*l+o+1,a=(r+1)*l+o+1,s=(r+1)*l+o,p=new i.Vector2(o/t,r/n),f=new i.Vector2((o+1)/t,r/n),d=new i.Vector2((o+1)/t,(r+1)/n),m=new i.Vector2(o/t,(r+1)/n),c.push(new i.Face3(e,u,s)),h.push([p,f,m]),c.push(new i.Face3(u,a,s)),h.push([f.clone(),d,m.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},i.ParametricGeometry.prototype=Object.create(i.Geometry.prototype),i.ParametricGeometry.prototype.constructor=i.ParametricGeometry,i.WireframeGeometry=function(e){function t(e,t){return e-t}i.BufferGeometry.call(this);var n=[0,0],r={},o=["a","b","c"];if(e instanceof i.Geometry){var s=e.vertices,a=e.faces,u=0,c=new Uint32Array(6*a.length);e=0;for(var h=a.length;h>e;e++)for(var l=a[e],p=0;3>p;p++){n[0]=l[o[p]],n[1]=l[o[(p+1)%3]],n.sort(t);var f=n.toString();void 0===r[f]&&(c[2*u]=n[0],c[2*u+1]=n[1],r[f]=!0,u++)}for(n=new Float32Array(6*u),e=0,h=u;h>e;e++)for(p=0;2>p;p++)r=s[c[2*e+p]],u=6*e+3*p,n[u+0]=r.x,n[u+1]=r.y,n[u+2]=r.z;this.addAttribute("position",new i.BufferAttribute(n,3))}else if(e instanceof i.BufferGeometry){if(null!==e.index){for(h=e.index.array,s=e.attributes.position,o=e.groups,u=0,0===o.length&&e.addGroup(0,h.length),c=new Uint32Array(2*h.length),a=0,l=o.length;l>a;++a){e=o[a],p=e.start,f=e.count,e=p;for(var d=p+f;d>e;e+=3)for(p=0;3>p;p++)n[0]=h[e+p],n[1]=h[e+(p+1)%3],n.sort(t),f=n.toString(),void 0===r[f]&&(c[2*u]=n[0],c[2*u+1]=n[1],r[f]=!0,u++)}for(n=new Float32Array(6*u),e=0,h=u;h>e;e++)for(p=0;2>p;p++)u=6*e+3*p,r=c[2*e+p],n[u+0]=s.getX(r),n[u+1]=s.getY(r),n[u+2]=s.getZ(r)}else for(s=e.attributes.position.array,u=s.length/3,c=u/3,n=new Float32Array(6*u),e=0,h=c;h>e;e++)for(p=0;3>p;p++)u=18*e+6*p,c=9*e+3*p,n[u+0]=s[c],n[u+1]=s[c+1],n[u+2]=s[c+2],r=9*e+(p+1)%3*3,n[u+3]=s[r],n[u+4]=s[r+1],n[u+5]=s[r+2];this.addAttribute("position",new i.BufferAttribute(n,3))}},i.WireframeGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.WireframeGeometry.prototype.constructor=i.WireframeGeometry,i.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),n=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);e=new i.BufferGeometry,e.addAttribute("position",new i.BufferAttribute(t,3)),e.addAttribute("color",new i.BufferAttribute(n,3)),t=new i.LineBasicMaterial({vertexColors:i.VertexColors}),i.LineSegments.call(this,e,t)},i.AxisHelper.prototype=Object.create(i.LineSegments.prototype),i.AxisHelper.prototype.constructor=i.AxisHelper,i.ArrowHelper=function(){var e=new i.Geometry;e.vertices.push(new i.Vector3(0,0,0),new i.Vector3(0,1,0));var t=new i.CylinderGeometry(0,.5,1,5,1);return t.translate(0,-.5,0),function(n,r,o,s,a,u){i.Object3D.call(this),void 0===s&&(s=16776960),void 0===o&&(o=1),void 0===a&&(a=.2*o),void 0===u&&(u=.2*a),this.position.copy(r),this.line=new i.Line(e,new i.LineBasicMaterial({color:s})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new i.Mesh(t,new i.MeshBasicMaterial({color:s})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(n),this.setLength(o,a,u)}}(),i.ArrowHelper.prototype=Object.create(i.Object3D.prototype),i.ArrowHelper.prototype.constructor=i.ArrowHelper,i.ArrowHelper.prototype.setDirection=function(){var e,t=new i.Vector3;return function(n){.99999<n.y?this.quaternion.set(0,0,0,1):-.99999>n.y?this.quaternion.set(1,0,0,0):(t.set(n.z,0,-n.x).normalize(),e=Math.acos(n.y),this.quaternion.setFromAxisAngle(t,e))}}(),i.ArrowHelper.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},i.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},i.BoxHelper=function(e){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new i.BufferGeometry;r.setIndex(new i.BufferAttribute(t,1)),r.addAttribute("position",new i.BufferAttribute(n,3)),i.LineSegments.call(this,r,new i.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},i.BoxHelper.prototype=Object.create(i.LineSegments.prototype),i.BoxHelper.prototype.constructor=i.BoxHelper,i.BoxHelper.prototype.update=function(){var e=new i.Box3;return function(t){if(t instanceof i.Box3?e.copy(t):e.setFromObject(t),!e.isEmpty()){t=e.min;var n=e.max,r=this.geometry.attributes.position,o=r.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=t.x,o[4]=n.y,o[5]=n.z,o[6]=t.x,o[7]=t.y,o[8]=n.z,o[9]=n.x,o[10]=t.y,o[11]=n.z,o[12]=n.x,o[13]=n.y,o[14]=t.z,o[15]=t.x,o[16]=n.y,o[17]=t.z,o[18]=t.x,o[19]=t.y,o[20]=t.z,o[21]=n.x,o[22]=t.y,o[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),i.BoundingBoxHelper=function(e,t){var n=void 0!==t?t:8947848;this.object=e,this.box=new i.Box3,i.Mesh.call(this,new i.BoxGeometry(1,1,1),new i.MeshBasicMaterial({color:n,wireframe:!0}))},i.BoundingBoxHelper.prototype=Object.create(i.Mesh.prototype),i.BoundingBoxHelper.prototype.constructor=i.BoundingBoxHelper,i.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},i.CameraHelper=function(e){function t(e,t,r){n(e,r),n(t,r)}function n(e,t){r.vertices.push(new i.Vector3),r.colors.push(new i.Color(t)),void 0===s[e]&&(s[e]=[]),s[e].push(r.vertices.length-1)}var r=new i.Geometry,o=new i.LineBasicMaterial({color:16777215,vertexColors:i.FaceColors}),s={};t("n1","n2",16755200),t("n2","n4",16755200),t("n4","n3",16755200),t("n3","n1",16755200),t("f1","f2",16755200),t("f2","f4",16755200),t("f4","f3",16755200),t("f3","f1",16755200),t("n1","f1",16755200),t("n2","f2",16755200),t("n3","f3",16755200),t("n4","f4",16755200),t("p","n1",16711680),t("p","n2",16711680),t("p","n3",16711680),t("p","n4",16711680),t("u1","u2",43775),t("u2","u3",43775),t("u3","u1",43775),t("c","t",16777215),t("p","c",3355443),t("cn1","cn2",3355443),t("cn3","cn4",3355443),t("cf1","cf2",3355443),t("cf3","cf4",3355443),i.LineSegments.call(this,r,o),this.camera=e,this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()},i.CameraHelper.prototype=Object.create(i.LineSegments.prototype),i.CameraHelper.prototype.constructor=i.CameraHelper,i.CameraHelper.prototype.update=function(){function e(e,i,s,a){if(r.set(i,s,a).unproject(o),e=n[e],void 0!==e)for(i=0,s=e.length;s>i;i++)t.vertices[e[i]].copy(r)}var t,n,r=new i.Vector3,o=new i.Camera;return function(){t=this.geometry,n=this.pointMap,o.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-1,-1,-1),e("n2",1,-1,-1),e("n3",-1,1,-1),e("n4",1,1,-1),e("f1",-1,-1,1),e("f2",1,-1,1),e("f3",-1,1,1),e("f4",1,1,1),e("u1",.7,1.1,-1),e("u2",-.7,1.1,-1),e("u3",0,2,-1),e("cf1",-1,0,1),e("cf2",1,0,1),e("cf3",0,-1,1),e("cf4",0,1,1),e("cn1",-1,0,-1),e("cn2",1,0,-1),e("cn3",0,-1,-1),e("cn4",0,1,-1),t.verticesNeedUpdate=!0}}(),i.DirectionalLightHelper=function(e,t){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var n=new i.Geometry;n.vertices.push(new i.Vector3(-t,t,0),new i.Vector3(t,t,0),new i.Vector3(t,-t,0),new i.Vector3(-t,-t,0),new i.Vector3(-t,t,0));var r=new i.LineBasicMaterial({fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new i.Line(n,r),this.add(this.lightPlane),n=new i.Geometry,n.vertices.push(new i.Vector3,new i.Vector3),r=new i.LineBasicMaterial({fog:!1}),r.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new i.Line(n,r),this.add(this.targetLine),this.update()},i.DirectionalLightHelper.prototype=Object.create(i.Object3D.prototype),i.DirectionalLightHelper.prototype.constructor=i.DirectionalLightHelper,i.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},i.DirectionalLightHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(t,e),this.lightPlane.lookAt(n),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(n),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),i.EdgesHelper=function(e,t,n){t=void 0!==t?t:16777215,i.LineSegments.call(this,new i.EdgesGeometry(e.geometry,n),new i.LineBasicMaterial({color:t})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},i.EdgesHelper.prototype=Object.create(i.LineSegments.prototype),i.EdgesHelper.prototype.constructor=i.EdgesHelper,i.FaceNormalsHelper=function(e,t,n,r){this.object=e,this.size=void 0!==t?t:1,e=void 0!==n?n:16776960,r=void 0!==r?r:1,t=0,n=this.object.geometry,n instanceof i.Geometry?t=n.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),n=new i.BufferGeometry,t=new i.Float32Attribute(6*t,3),n.addAttribute("position",t),i.LineSegments.call(this,n,new i.LineBasicMaterial({color:e,linewidth:r})),this.matrixAutoUpdate=!1,this.update()},i.FaceNormalsHelper.prototype=Object.create(i.LineSegments.prototype),i.FaceNormalsHelper.prototype.constructor=i.FaceNormalsHelper,i.FaceNormalsHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Matrix3;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var r=this.object.matrixWorld,i=this.geometry.attributes.position,o=this.object.geometry,s=o.vertices,o=o.faces,a=0,u=0,c=o.length;c>u;u++){var h=o[u],l=h.normal;e.copy(s[h.a]).add(s[h.b]).add(s[h.c]).divideScalar(3).applyMatrix4(r),t.copy(l).applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),i.setXYZ(a,e.x,e.y,e.z),a+=1,i.setXYZ(a,t.x,t.y,t.z),a+=1}return i.needsUpdate=!0,this}}(),i.GridHelper=function(e,t){var n=new i.Geometry,r=new i.LineBasicMaterial({vertexColors:i.VertexColors});this.color1=new i.Color(4473924),this.color2=new i.Color(8947848);for(var o=-e;e>=o;o+=t){n.vertices.push(new i.Vector3(-e,0,o),new i.Vector3(e,0,o),new i.Vector3(o,0,-e),new i.Vector3(o,0,e));var s=0===o?this.color1:this.color2;n.colors.push(s,s,s,s)}i.LineSegments.call(this,n,r)},i.GridHelper.prototype=Object.create(i.LineSegments.prototype),i.GridHelper.prototype.constructor=i.GridHelper,i.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},i.HemisphereLightHelper=function(e,t){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new i.Color,new i.Color];var n=new i.SphereGeometry(t,4,2);n.rotateX(-Math.PI/2);for(var r=0;8>r;r++)n.faces[r].color=this.colors[4>r?0:1];r=new i.MeshBasicMaterial({vertexColors:i.FaceColors,wireframe:!0}),this.lightSphere=new i.Mesh(n,r),this.add(this.lightSphere),this.update()},i.HemisphereLightHelper.prototype=Object.create(i.Object3D.prototype),i.HemisphereLightHelper.prototype.constructor=i.HemisphereLightHelper,i.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},i.HemisphereLightHelper.prototype.update=function(){var e=new i.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),i.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var n=new i.SphereGeometry(t,4,2),r=new i.MeshBasicMaterial({wireframe:!0,fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),i.Mesh.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},i.PointLightHelper.prototype=Object.create(i.Mesh.prototype),i.PointLightHelper.prototype.constructor=i.PointLightHelper,i.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},i.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},i.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new i.Geometry,n=0;n<this.bones.length;n++)this.bones[n].parent instanceof i.Bone&&(t.vertices.push(new i.Vector3),t.vertices.push(new i.Vector3),t.colors.push(new i.Color(0,0,1)),t.colors.push(new i.Color(0,1,0)));t.dynamic=!0,n=new i.LineBasicMaterial({vertexColors:i.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),i.LineSegments.call(this,t,n),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()},i.SkeletonHelper.prototype=Object.create(i.LineSegments.prototype),i.SkeletonHelper.prototype.constructor=i.SkeletonHelper,i.SkeletonHelper.prototype.getBoneList=function(e){var t=[];e instanceof i.Bone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,this.getBoneList(e.children[n]));return t},i.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(new i.Matrix4).getInverse(this.root.matrixWorld),n=new i.Matrix4,r=0,o=0;o<this.bones.length;o++){var s=this.bones[o];s.parent instanceof i.Bone&&(n.multiplyMatrices(t,s.matrixWorld),e.vertices[r].setFromMatrixPosition(n),n.multiplyMatrices(t,s.parent.matrixWorld),e.vertices[r+1].setFromMatrixPosition(n),r+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},i.SpotLightHelper=function(e){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,e=new i.BufferGeometry;for(var t=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,r=1;32>n;n++,r++){var o=n/32*Math.PI*2,s=r/32*Math.PI*2;t.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}e.addAttribute("position",new i.Float32Attribute(t,3)),t=new i.LineBasicMaterial({fog:!1}),this.cone=new i.LineSegments(e,t),this.add(this.cone),this.update()},i.SpotLightHelper.prototype=Object.create(i.Object3D.prototype),i.SpotLightHelper.prototype.constructor=i.SpotLightHelper,i.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},i.SpotLightHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3;return function(){var n=this.light.distance?this.light.distance:1e3,r=n*Math.tan(this.light.angle);this.cone.scale.set(r,r,n),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),i.VertexNormalsHelper=function(e,t,n,r){this.object=e,this.size=void 0!==t?t:1,e=void 0!==n?n:16711680,r=void 0!==r?r:1,t=0,n=this.object.geometry,n instanceof i.Geometry?t=3*n.faces.length:n instanceof i.BufferGeometry&&(t=n.attributes.normal.count),n=new i.BufferGeometry,t=new i.Float32Attribute(6*t,3),n.addAttribute("position",t),i.LineSegments.call(this,n,new i.LineBasicMaterial({color:e,linewidth:r})),this.matrixAutoUpdate=!1,this.update()},i.VertexNormalsHelper.prototype=Object.create(i.LineSegments.prototype),i.VertexNormalsHelper.prototype.constructor=i.VertexNormalsHelper,i.VertexNormalsHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,n=new i.Matrix3;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var o=this.object.matrixWorld,s=this.geometry.attributes.position,a=this.object.geometry;if(a instanceof i.Geometry)for(var u=a.vertices,c=a.faces,h=a=0,l=c.length;l>h;h++)for(var p=c[h],f=0,d=p.vertexNormals.length;d>f;f++){var m=p.vertexNormals[f];e.copy(u[p[r[f]]]).applyMatrix4(o),t.copy(m).applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),s.setXYZ(a,e.x,e.y,e.z),a+=1,s.setXYZ(a,t.x,t.y,t.z),a+=1}else if(a instanceof i.BufferGeometry)for(r=a.attributes.position,u=a.attributes.normal,f=a=0,d=r.count;d>f;f++)e.set(r.getX(f),r.getY(f),r.getZ(f)).applyMatrix4(o),t.set(u.getX(f),u.getY(f),u.getZ(f)),t.applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),s.setXYZ(a,e.x,e.y,e.z),a+=1,s.setXYZ(a,t.x,t.y,t.z),a+=1;return s.needsUpdate=!0,this}}(),i.WireframeHelper=function(e,t){var n=void 0!==t?t:16777215;i.LineSegments.call(this,new i.WireframeGeometry(e.geometry),new i.LineBasicMaterial({color:n})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},i.WireframeHelper.prototype=Object.create(i.LineSegments.prototype),i.WireframeHelper.prototype.constructor=i.WireframeHelper,i.ImmediateRenderObject=function(e){i.Object3D.call(this),this.material=e,this.render=function(e){}},i.ImmediateRenderObject.prototype=Object.create(i.Object3D.prototype),i.ImmediateRenderObject.prototype.constructor=i.ImmediateRenderObject,i.MorphBlendMesh=function(e,t){i.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length;this.createAnimation("__default",0,n-1,n/1),this.setAnimationWeight("__default",1)},i.MorphBlendMesh.prototype=Object.create(i.Mesh.prototype),i.MorphBlendMesh.prototype.constructor=i.MorphBlendMesh,
|
||
i.MorphBlendMesh.prototype.createAnimation=function(e,t,n,r){t={start:t,end:n,length:n-t+1,fps:r,duration:(n-t)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[e]=t,this.animationsList.push(t)},i.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,n=/([a-z]+)_?(\d+)/i,r={},i=this.geometry,o=0,s=i.morphTargets.length;s>o;o++){var a=i.morphTargets[o].name.match(n);if(a&&1<a.length){var u=a[1];r[u]||(r[u]={start:1/0,end:-(1/0)}),a=r[u],o<a.start&&(a.start=o),o>a.end&&(a.end=o),t||(t=u)}}for(u in r)a=r[u],this.createAnimation(u,a.start,a.end,e);this.firstAnimation=t},i.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){(e=this.animationsMap[e])&&(e.direction=1,e.directionBackwards=!1)},i.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){(e=this.animationsMap[e])&&(e.direction=-1,e.directionBackwards=!0)},i.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},i.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},i.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},i.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},i.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0;return(e=this.animationsMap[e])&&(t=e.time),t},i.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1;return(e=this.animationsMap[e])&&(t=e.duration),t},i.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},i.MorphBlendMesh.prototype.stopAnimation=function(e){(e=this.animationsMap[e])&&(e.active=!1)},i.MorphBlendMesh.prototype.update=function(e){for(var t=0,n=this.animationsList.length;n>t;t++){var r=this.animationsList[t];if(r.active){var o=r.duration/r.length;r.time+=r.direction*e,r.mirroredLoop?(r.time>r.duration||0>r.time)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),0>r.time&&(r.time=0,r.directionBackwards=!1)):(r.time%=r.duration,0>r.time&&(r.time+=r.duration));var s=r.start+i.Math.clamp(Math.floor(r.time/o),0,r.length-1),a=r.weight;s!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*a,this.morphTargetInfluences[s]=0,r.lastFrame=r.currentFrame,r.currentFrame=s),o=r.time%o/o,r.directionBackwards&&(o=1-o),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=o*a,this.morphTargetInfluences[r.lastFrame]=(1-o)*a):this.morphTargetInfluences[r.currentFrame]=a}}},"undefined"!=typeof r?("undefined"!=typeof n&&n.exports&&(r=n.exports=i),r.THREE=i):this.THREE=i},{}],221:[function(t,n,r){(function(){function t(e){function t(t,n,r,i,o,s){for(;o>=0&&s>o;o+=e){var a=i?i[o]:o;r=n(r,t[a],a,t)}return r}return function(n,r,i,o){r=w(r,o,4);var s=!P(n)&&x.keys(n),a=(s||n).length,u=e>0?0:a-1;return arguments.length<3&&(i=n[s?s[u]:u],u+=e),t(n,r,i,s,u,a)}}function i(e){return function(t,n,r){n=S(n,r);for(var i=A(t),o=e>0?0:i-1;o>=0&&i>o;o+=e)if(n(t[o],o,t))return o;return-1}}function o(e,t,n){return function(r,i,o){var s=0,a=A(r);if("number"==typeof o)e>0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(n&&o&&a)return o=n(r,i),r[o]===i?o:-1;if(i!==i)return o=t(f.call(r,s,a),x.isNaN),o>=0?o+s:-1;for(o=e>0?s:a-1;o>=0&&a>o;o+=e)if(r[o]===i)return o;return-1}}function s(e,t){var n=D.length,r=e.constructor,i=x.isFunction(r)&&r.prototype||h,o="constructor";for(x.has(e,o)&&!x.contains(t,o)&&t.push(o);n--;)o=D[n],o in e&&e[o]!==i[o]&&!x.contains(t,o)&&t.push(o)}var a=this,u=a._,c=Array.prototype,h=Object.prototype,l=Function.prototype,p=c.push,f=c.slice,d=h.toString,m=h.hasOwnProperty,v=Array.isArray,g=Object.keys,y=l.bind,_=Object.create,b=function(){},x=function(e){return e instanceof x?e:this instanceof x?void(this._wrapped=e):new x(e)};"undefined"!=typeof r?("undefined"!=typeof n&&n.exports&&(r=n.exports=x),r._=x):a._=x,x.VERSION="1.8.3";var w=function(e,t,n){if(void 0===t)return e;switch(null==n?3:n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)}}return function(){return e.apply(t,arguments)}},S=function(e,t,n){return null==e?x.identity:x.isFunction(e)?w(e,t,n):x.isObject(e)?x.matcher(e):x.property(e)};x.iteratee=function(e,t){return S(e,t,1/0)};var M=function(e,t){return function(n){var r=arguments.length;if(2>r||null==n)return n;for(var i=1;r>i;i++)for(var o=arguments[i],s=e(o),a=s.length,u=0;a>u;u++){var c=s[u];t&&void 0!==n[c]||(n[c]=o[c])}return n}},E=function(e){if(!x.isObject(e))return{};if(_)return _(e);b.prototype=e;var t=new b;return b.prototype=null,t},C=function(e){return function(t){return null==t?void 0:t[e]}},T=Math.pow(2,53)-1,A=C("length"),P=function(e){var t=A(e);return"number"==typeof t&&t>=0&&T>=t};x.each=x.forEach=function(e,t,n){t=w(t,n);var r,i;if(P(e))for(r=0,i=e.length;i>r;r++)t(e[r],r,e);else{var o=x.keys(e);for(r=0,i=o.length;i>r;r++)t(e[o[r]],o[r],e)}return e},x.map=x.collect=function(e,t,n){t=S(t,n);for(var r=!P(e)&&x.keys(e),i=(r||e).length,o=Array(i),s=0;i>s;s++){var a=r?r[s]:s;o[s]=t(e[a],a,e)}return o},x.reduce=x.foldl=x.inject=t(1),x.reduceRight=x.foldr=t(-1),x.find=x.detect=function(e,t,n){var r;return r=P(e)?x.findIndex(e,t,n):x.findKey(e,t,n),void 0!==r&&-1!==r?e[r]:void 0},x.filter=x.select=function(e,t,n){var r=[];return t=S(t,n),x.each(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r},x.reject=function(e,t,n){return x.filter(e,x.negate(S(t)),n)},x.every=x.all=function(e,t,n){t=S(t,n);for(var r=!P(e)&&x.keys(e),i=(r||e).length,o=0;i>o;o++){var s=r?r[o]:o;if(!t(e[s],s,e))return!1}return!0},x.some=x.any=function(e,t,n){t=S(t,n);for(var r=!P(e)&&x.keys(e),i=(r||e).length,o=0;i>o;o++){var s=r?r[o]:o;if(t(e[s],s,e))return!0}return!1},x.contains=x.includes=x.include=function(e,t,n,r){return P(e)||(e=x.values(e)),("number"!=typeof n||r)&&(n=0),x.indexOf(e,t,n)>=0},x.invoke=function(e,t){var n=f.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){var i=r?t:e[t];return null==i?i:i.apply(e,n)})},x.pluck=function(e,t){return x.map(e,x.property(t))},x.where=function(e,t){return x.filter(e,x.matcher(t))},x.findWhere=function(e,t){return x.find(e,x.matcher(t))},x.max=function(e,t,n){var r,i,o=-(1/0),s=-(1/0);if(null==t&&null!=e){e=P(e)?e:x.values(e);for(var a=0,u=e.length;u>a;a++)r=e[a],r>o&&(o=r)}else t=S(t,n),x.each(e,function(e,n,r){i=t(e,n,r),(i>s||i===-(1/0)&&o===-(1/0))&&(o=e,s=i)});return o},x.min=function(e,t,n){var r,i,o=1/0,s=1/0;if(null==t&&null!=e){e=P(e)?e:x.values(e);for(var a=0,u=e.length;u>a;a++)r=e[a],o>r&&(o=r)}else t=S(t,n),x.each(e,function(e,n,r){i=t(e,n,r),(s>i||i===1/0&&o===1/0)&&(o=e,s=i)});return o},x.shuffle=function(e){for(var t,n=P(e)?e:x.values(e),r=n.length,i=Array(r),o=0;r>o;o++)t=x.random(0,o),t!==o&&(i[o]=i[t]),i[t]=n[o];return i},x.sample=function(e,t,n){return null==t||n?(P(e)||(e=x.values(e)),e[x.random(e.length-1)]):x.shuffle(e).slice(0,Math.max(0,t))},x.sortBy=function(e,t,n){return t=S(t,n),x.pluck(x.map(e,function(e,n,r){return{value:e,index:n,criteria:t(e,n,r)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(r>n||void 0===r)return-1}return e.index-t.index}),"value")};var O=function(e){return function(t,n,r){var i={};return n=S(n,r),x.each(t,function(r,o){var s=n(r,o,t);e(i,r,s)}),i}};x.groupBy=O(function(e,t,n){x.has(e,n)?e[n].push(t):e[n]=[t]}),x.indexBy=O(function(e,t,n){e[n]=t}),x.countBy=O(function(e,t,n){x.has(e,n)?e[n]++:e[n]=1}),x.toArray=function(e){return e?x.isArray(e)?f.call(e):P(e)?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return null==e?0:P(e)?e.length:x.keys(e).length},x.partition=function(e,t,n){t=S(t,n);var r=[],i=[];return x.each(e,function(e,n,o){(t(e,n,o)?r:i).push(e)}),[r,i]},x.first=x.head=x.take=function(e,t,n){return null!=e?null==t||n?e[0]:x.initial(e,e.length-t):void 0},x.initial=function(e,t,n){return f.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))},x.last=function(e,t,n){return null!=e?null==t||n?e[e.length-1]:x.rest(e,Math.max(0,e.length-t)):void 0},x.rest=x.tail=x.drop=function(e,t,n){return f.call(e,null==t||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var L=function(e,t,n,r){for(var i=[],o=0,s=r||0,a=A(e);a>s;s++){var u=e[s];if(P(u)&&(x.isArray(u)||x.isArguments(u))){t||(u=L(u,t,n));var c=0,h=u.length;for(i.length+=h;h>c;)i[o++]=u[c++]}else n||(i[o++]=u)}return i};x.flatten=function(e,t){return L(e,t,!1)},x.without=function(e){return x.difference(e,f.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isBoolean(t)||(r=n,n=t,t=!1),null!=n&&(n=S(n,r));for(var i=[],o=[],s=0,a=A(e);a>s;s++){var u=e[s],c=n?n(u,s,e):u;t?(s&&o===c||i.push(u),o=c):n?x.contains(o,c)||(o.push(c),i.push(u)):x.contains(i,u)||i.push(u)}return i},x.union=function(){return x.uniq(L(arguments,!0,!0))},x.intersection=function(e){for(var t=[],n=arguments.length,r=0,i=A(e);i>r;r++){var o=e[r];if(!x.contains(t,o)){for(var s=1;n>s&&x.contains(arguments[s],o);s++);s===n&&t.push(o)}}return t},x.difference=function(e){var t=L(arguments,!0,!0,1);return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){return x.unzip(arguments)},x.unzip=function(e){for(var t=e&&x.max(e,A).length||0,n=Array(t),r=0;t>r;r++)n[r]=x.pluck(e,r);return n},x.object=function(e,t){for(var n={},r=0,i=A(e);i>r;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.findIndex=i(1),x.findLastIndex=i(-1),x.sortedIndex=function(e,t,n,r){n=S(n,r,1);for(var i=n(t),o=0,s=A(e);s>o;){var a=Math.floor((o+s)/2);n(e[a])<i?o=a+1:s=a}return o},x.indexOf=o(1,x.findIndex,x.sortedIndex),x.lastIndexOf=o(-1,x.findLastIndex),x.range=function(e,t,n){null==t&&(t=e||0,e=0),n=n||1;for(var r=Math.max(Math.ceil((t-e)/n),0),i=Array(r),o=0;r>o;o++,e+=n)i[o]=e;return i};var R=function(e,t,n,r,i){if(!(r instanceof t))return e.apply(n,i);var o=E(e.prototype),s=e.apply(o,i);return x.isObject(s)?s:o};x.bind=function(e,t){if(y&&e.bind===y)return y.apply(e,f.call(arguments,1));if(!x.isFunction(e))throw new TypeError("Bind must be called on a function");var n=f.call(arguments,2),r=function(){return R(e,r,t,this,n.concat(f.call(arguments)))};return r},x.partial=function(e){var t=f.call(arguments,1),n=function(){for(var r=0,i=t.length,o=Array(i),s=0;i>s;s++)o[s]=t[s]===x?arguments[r++]:t[s];for(;r<arguments.length;)o.push(arguments[r++]);return R(e,n,this,this,o)};return n},x.bindAll=function(e){var t,n,r=arguments.length;if(1>=r)throw new Error("bindAll must be passed function names");for(t=1;r>t;t++)n=arguments[t],e[n]=x.bind(e[n],e);return e},x.memoize=function(e,t){var n=function(r){var i=n.cache,o=""+(t?t.apply(this,arguments):r);return x.has(i,o)||(i[o]=e.apply(this,arguments)),i[o]};return n.cache={},n},x.delay=function(e,t){var n=f.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=x.partial(x.delay,x,1),x.throttle=function(e,t,n){var r,i,o,s=null,a=0;n||(n={});var u=function(){a=n.leading===!1?0:x.now(),s=null,o=e.apply(r,i),s||(r=i=null)};return function(){var c=x.now();a||n.leading!==!1||(a=c);var h=t-(c-a);return r=this,i=arguments,0>=h||h>t?(s&&(clearTimeout(s),s=null),a=c,o=e.apply(r,i),s||(r=i=null)):s||n.trailing===!1||(s=setTimeout(u,h)),o}},x.debounce=function(e,t,n){var r,i,o,s,a,u=function(){var c=x.now()-s;t>c&&c>=0?r=setTimeout(u,t-c):(r=null,n||(a=e.apply(o,i),r||(o=i=null)))};return function(){o=this,i=arguments,s=x.now();var c=n&&!r;return r||(r=setTimeout(u,t)),c&&(a=e.apply(o,i),o=i=null),a}},x.wrap=function(e,t){return x.partial(t,e)},x.negate=function(e){return function(){return!e.apply(this,arguments)}},x.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}},x.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},x.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),1>=e&&(t=null),n}},x.once=x.partial(x.before,2);var N=!{toString:null}.propertyIsEnumerable("toString"),D=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];x.keys=function(e){if(!x.isObject(e))return[];if(g)return g(e);var t=[];for(var n in e)x.has(e,n)&&t.push(n);return N&&s(e,t),t},x.allKeys=function(e){if(!x.isObject(e))return[];var t=[];for(var n in e)t.push(n);return N&&s(e,t),t},x.values=function(e){for(var t=x.keys(e),n=t.length,r=Array(n),i=0;n>i;i++)r[i]=e[t[i]];return r},x.mapObject=function(e,t,n){t=S(t,n);for(var r,i=x.keys(e),o=i.length,s={},a=0;o>a;a++)r=i[a],s[r]=t(e[r],r,e);return s},x.pairs=function(e){for(var t=x.keys(e),n=t.length,r=Array(n),i=0;n>i;i++)r[i]=[t[i],e[t[i]]];return r},x.invert=function(e){for(var t={},n=x.keys(e),r=0,i=n.length;i>r;r++)t[e[n[r]]]=n[r];return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=M(x.allKeys),x.extendOwn=x.assign=M(x.keys),x.findKey=function(e,t,n){t=S(t,n);for(var r,i=x.keys(e),o=0,s=i.length;s>o;o++)if(r=i[o],t(e[r],r,e))return r},x.pick=function(e,t,n){var r,i,o={},s=e;if(null==s)return o;x.isFunction(t)?(i=x.allKeys(s),r=w(t,n)):(i=L(arguments,!1,!1,1),r=function(e,t,n){return t in n},s=Object(s));for(var a=0,u=i.length;u>a;a++){var c=i[a],h=s[c];r(h,c,s)&&(o[c]=h)}return o},x.omit=function(e,t,n){if(x.isFunction(t))t=x.negate(t);else{var r=x.map(L(arguments,!1,!1,1),String);t=function(e,t){return!x.contains(r,t)}}return x.pick(e,t,n)},x.defaults=M(x.allKeys,!0),x.create=function(e,t){var n=E(e);return t&&x.extendOwn(n,t),n},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e},x.isMatch=function(e,t){var n=x.keys(t),r=n.length;if(null==e)return!r;for(var i=Object(e),o=0;r>o;o++){var s=n[o];if(t[s]!==i[s]||!(s in i))return!1}return!0};var I=function(e,t,n,r){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=d.call(e);if(i!==d.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var o="[object Array]"===i;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,a=t.constructor;if(s!==a&&!(x.isFunction(s)&&s instanceof s&&x.isFunction(a)&&a instanceof a)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],r=r||[];for(var u=n.length;u--;)if(n[u]===e)return r[u]===t;if(n.push(e),r.push(t),o){if(u=e.length,u!==t.length)return!1;for(;u--;)if(!I(e[u],t[u],n,r))return!1}else{var c,h=x.keys(e);if(u=h.length,x.keys(t).length!==u)return!1;for(;u--;)if(c=h[u],!x.has(t,c)||!I(e[c],t[c],n,r))return!1}return n.pop(),r.pop(),!0};x.isEqual=function(e,t){return I(e,t)},x.isEmpty=function(e){return null==e?!0:P(e)&&(x.isArray(e)||x.isString(e)||x.isArguments(e))?0===e.length:0===x.keys(e).length},x.isElement=function(e){return!(!e||1!==e.nodeType)},x.isArray=v||function(e){return"[object Array]"===d.call(e)},x.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},x.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){x["is"+e]=function(t){return d.call(t)==="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return x.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(x.isFunction=function(e){return"function"==typeof e||!1}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!==+e},x.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===d.call(e)},x.isNull=function(e){return null===e},x.isUndefined=function(e){return void 0===e},x.has=function(e,t){return null!=e&&m.call(e,t)},x.noConflict=function(){return a._=u,this},x.identity=function(e){return e},x.constant=function(e){return function(){return e}},x.noop=function(){},x.property=C,x.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},x.matcher=x.matches=function(e){return e=x.extendOwn({},e),function(t){return x.isMatch(t,e)}},x.times=function(e,t,n){var r=Array(Math.max(0,e));t=w(t,n,1);for(var i=0;e>i;i++)r[i]=t(i);return r},x.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},x.now=Date.now||function(){return(new Date).getTime()};var k={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},j=x.invert(k),F=function(e){var t=function(t){return e[t]},n="(?:"+x.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(i,t):e}};x.escape=F(k),x.unescape=F(j),x.result=function(e,t,n){var r=null==e?void 0:e[t];return void 0===r&&(r=n),x.isFunction(r)?r.call(e):r};var B=0;x.uniqueId=function(e){var t=++B+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var V=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},G=/\\|'|\r|\n|\u2028|\u2029/g,z=function(e){return"\\"+U[e]};x.template=function(e,t,n){!t&&n&&(t=n),t=x.defaults({},t,x.templateSettings);var r=RegExp([(t.escape||V).source,(t.interpolate||V).source,(t.evaluate||V).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(r,function(t,n,r,s,a){return o+=e.slice(i,a).replace(G,z),i=a+t.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\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 s=new Function(t.variable||"obj","_",o)}catch(a){throw a.source=o,a}var u=function(e){return s.call(this,e,x)},c=t.variable||"obj";return u.source="function("+c+"){\n"+o+"}",u},x.chain=function(e){var t=x(e);return t._chain=!0,t};var H=function(e,t){return e._chain?x(t).chain():t};x.mixin=function(e){x.each(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return p.apply(e,arguments),H(this,n.apply(x,e))}})},x.mixin(x),x.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=c[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],H(this,n)}}),x.each(["concat","join","slice"],function(e){var t=c[e];x.prototype[e]=function(){return H(this,t.apply(this._wrapped,arguments))}}),x.prototype.value=function(){return this._wrapped},x.prototype.valueOf=x.prototype.toJSON=x.prototype.value,x.prototype.toString=function(){return""+this._wrapped},"function"==typeof e&&e.amd&&e("underscore",[],function(){return x})}).call(this)},{}],222:[function(e,t,n){function r(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=r}t.exports=r,r.prototype.sampleCurveX=function(e){return((this.ax*e+this.bx)*e+this.cx)*e},r.prototype.sampleCurveY=function(e){return((this.ay*e+this.by)*e+this.cy)*e},r.prototype.sampleCurveDerivativeX=function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},r.prototype.solveCurveX=function(e,t){"undefined"==typeof t&&(t=1e-6);var n,r,i,o,s;for(i=e,s=0;8>s;s++){if(o=this.sampleCurveX(i)-e,Math.abs(o)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=o/a}if(n=0,r=1,i=e,n>i)return n;if(i>r)return r;for(;r>n;){if(o=this.sampleCurveX(i),Math.abs(o-e)<t)return i;e>o?n=i:r=i,i=.5*(r-n)+n}return i},r.prototype.solve=function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},{}],223:[function(e,t,n){var r=e("./vdom/create-element.js");t.exports=r},{"./vdom/create-element.js":229}],224:[function(e,t,n){var r=e("./vtree/diff.js");t.exports=r},{"./vtree/diff.js":249}],225:[function(e,t,n){var r=e("./virtual-hyperscript/index.js");t.exports=r},{"./virtual-hyperscript/index.js":236}],226:[function(e,t,n){var r=e("./diff.js"),i=e("./patch.js"),o=e("./h.js"),s=e("./create-element.js"),a=e("./vnode/vnode.js"),u=e("./vnode/vtext.js");t.exports={diff:r,patch:i,h:o,create:s,VNode:a,VText:u}},{"./create-element.js":223,"./diff.js":224,"./h.js":225,"./patch.js":227,"./vnode/vnode.js":245,"./vnode/vtext.js":247}],227:[function(e,t,n){var r=e("./vdom/patch.js");t.exports=r},{"./vdom/patch.js":232}],228:[function(e,t,n){function r(e,t,n){for(var r in t){var s=t[r];void 0===s?i(e,r,s,n):u(s)?(i(e,r,s,n),s.hook&&s.hook(e,r,n?n[r]:void 0)):a(s)?o(e,t,n,r,s):e[r]=s}}function i(e,t,n,r){if(r){var i=r[t];if(u(i))i.unhook&&i.unhook(e,t,n);else if("attributes"===t)for(var o in i)e.removeAttribute(o);else if("style"===t)for(var s in i)e.style[s]="";else"string"==typeof i?e[t]="":e[t]=null}}function o(e,t,n,r,i){var o=n?n[r]:void 0;if("attributes"!==r){if(o&&a(o)&&s(o)!==s(i))return void(e[r]=i);a(e[r])||(e[r]={});var u="style"===r?"":void 0;for(var c in i){var h=i[c];e[r][c]=void 0===h?u:h}}else for(var l in i){var p=i[l];void 0===p?e.removeAttribute(l):e.setAttribute(l,p)}}function s(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}var a=e("is-object"),u=e("../vnode/is-vhook.js");t.exports=r},{"../vnode/is-vhook.js":240,"is-object":181}],229:[function(e,t,n){function r(e,t){var n=t?t.document||i:i,h=t?t.warn:null;if(e=c(e).a,u(e))return e.init();if(a(e))return n.createTextNode(e.text);if(!s(e))return h&&h("Item is not a valid virtual dom node",e),null;var l=null===e.namespace?n.createElement(e.tagName):n.createElementNS(e.namespace,e.tagName),p=e.properties;o(l,p);for(var f=e.children,d=0;d<f.length;d++){var m=r(f[d],t);m&&l.appendChild(m)}return l}var i=e("global/document"),o=e("./apply-properties"),s=e("../vnode/is-vnode.js"),a=e("../vnode/is-vtext.js"),u=e("../vnode/is-widget.js"),c=e("../vnode/handle-thunk.js");t.exports=r},{"../vnode/handle-thunk.js":238,"../vnode/is-vnode.js":241,"../vnode/is-vtext.js":242,"../vnode/is-widget.js":243,"./apply-properties":228,"global/document":157}],230:[function(e,t,n){function r(e,t,n,r){return n&&0!==n.length?(n.sort(s),i(e,t,n,r,0)):{}}function i(e,t,n,r,s){if(r=r||{},e){o(n,s,s)&&(r[s]=e);var u=t.children;if(u)for(var c=e.childNodes,h=0;h<t.children.length;h++){s+=1;var l=u[h]||a,p=s+(l.count||0);o(n,s,p)&&i(c[h],l,n,r,s),s=p}}return r}function o(e,t,n){if(0===e.length)return!1;for(var r,i,o=0,s=e.length-1;s>=o;){if(r=(s+o)/2>>0,i=e[r],o===s)return i>=t&&n>=i;if(t>i)o=r+1;else{if(!(i>n))return!0;s=r-1}}return!1}function s(e,t){return e>t?1:-1}var a={};t.exports=r},{}],231:[function(e,t,n){function r(e,t,n){var r=e.type,c=e.vNode,f=e.patch;switch(r){case d.REMOVE:return i(t,c);case d.INSERT:return o(t,f,n);case d.VTEXT:return s(t,c,f,n);case d.WIDGET:return a(t,c,f,n);case d.VNODE:return u(t,c,f,n);case d.ORDER:return h(t,f),t;case d.PROPS:return p(t,f,c.properties),t;case d.THUNK:return l(t,n.patch(t,f,n));default:return t}}function i(e,t){var n=e.parentNode;return n&&n.removeChild(e),c(e,t),null}function o(e,t,n){var r=n.render(t,n);return e&&e.appendChild(r),e}function s(e,t,n,r){var i;if(3===e.nodeType)e.replaceData(0,e.length,n.text),i=e;else{var o=e.parentNode;i=r.render(n,r),o&&i!==e&&o.replaceChild(i,e)}return i}function a(e,t,n,r){var i,o=m(t,n);i=o?n.update(t,e)||e:r.render(n,r);var s=e.parentNode;return s&&i!==e&&s.replaceChild(i,e),o||c(e,t),i}function u(e,t,n,r){var i=e.parentNode,o=r.render(n,r);return i&&o!==e&&i.replaceChild(o,e),o}function c(e,t){"function"==typeof t.destroy&&f(t)&&t.destroy(e)}function h(e,t){for(var n,r,i,o=e.childNodes,s={},a=0;a<t.removes.length;a++)r=t.removes[a],n=o[r.from],r.key&&(s[r.key]=n),e.removeChild(n);for(var u=o.length,c=0;c<t.inserts.length;c++)i=t.inserts[c],n=s[i.key],e.insertBefore(n,i.to>=u++?null:o[i.to])}function l(e,t){return e&&t&&e!==t&&e.parentNode&&e.parentNode.replaceChild(t,e),t}var p=e("./apply-properties"),f=e("../vnode/is-widget.js"),d=e("../vnode/vpatch.js"),m=e("./update-widget");t.exports=r},{"../vnode/is-widget.js":243,"../vnode/vpatch.js":246,"./apply-properties":228,"./update-widget":233}],232:[function(e,t,n){function r(e,t,n){return n=n||{},n.patch=n.patch&&n.patch!==r?n.patch:i,n.render=n.render||c,n.patch(e,t,n)}function i(e,t,n){var r=s(t);if(0===r.length)return e;var i=h(e,t.a,r),u=e.ownerDocument;n.document||u===a||(n.document=u);for(var c=0;c<r.length;c++){var l=r[c];e=o(e,i[l],t[l],n)}return e}function o(e,t,n,r){if(!t)return e;var i;if(u(n))for(var o=0;o<n.length;o++)i=l(n[o],t,r),t===e&&(e=i);else i=l(n,t,r),t===e&&(e=i);return e}function s(e){var t=[];for(var n in e)"a"!==n&&t.push(Number(n));return t}var a=e("global/document"),u=e("x-is-array"),c=e("./create-element"),h=e("./dom-index"),l=e("./patch-op");t.exports=r},{"./create-element":229,"./dom-index":230,"./patch-op":231,"global/document":157,"x-is-array":268}],233:[function(e,t,n){function r(e,t){return i(e)&&i(t)?"name"in e&&"name"in t?e.id===t.id:e.init===t.init:!1}var i=e("../vnode/is-widget.js");t.exports=r},{"../vnode/is-widget.js":243}],234:[function(e,t,n){"use strict";function r(e){return this instanceof r?void(this.value=e):new r(e)}var i=e("ev-store");t.exports=r,r.prototype.hook=function(e,t){var n=i(e),r=t.substr(3);n[r]=this.value},r.prototype.unhook=function(e,t){var n=i(e),r=t.substr(3);n[r]=void 0}},{"ev-store":8}],235:[function(e,t,n){"use strict";function r(e){return this instanceof r?void(this.value=e):new r(e)}t.exports=r,r.prototype.hook=function(e,t){e[t]!==this.value&&(e[t]=this.value)}},{}],236:[function(e,t,n){"use strict";function r(e,t,n){var r,s,u,c,h=[];return!n&&a(t)&&(n=t,s={}),s=s||t||{},r=y(e,s),s.hasOwnProperty("key")&&(u=s.key,s.key=void 0),s.hasOwnProperty("namespace")&&(c=s.namespace,s.namespace=void 0),"INPUT"!==r||c||!s.hasOwnProperty("value")||void 0===s.value||v(s.value)||(s.value=_(s.value)),o(s),void 0!==n&&null!==n&&i(n,h,r,s),new l(r,s,h,u,c)}function i(e,t,n,r){if("string"==typeof e)t.push(new p(e));else if("number"==typeof e)t.push(new p(String(e)));else if(s(e))t.push(e);else{if(!h(e)){if(null===e||void 0===e)return;throw u({foreignObject:e,parentVnode:{tagName:n,properties:r}})}for(var o=0;o<e.length;o++)i(e[o],t,n,r)}}function o(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];if(v(n))continue;"ev-"===t.substr(0,3)&&(e[t]=b(n))}}function s(e){return f(e)||d(e)||m(e)||g(e)}function a(e){return"string"==typeof e||h(e)||s(e)}function u(e){var t=new Error;return t.type="virtual-hyperscript.unexpected.virtual-element",t.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+c(e.foreignObject)+".\nThe parent vnode is:\n"+c(e.parentVnode),t.foreignObject=e.foreignObject,t.parentVnode=e.parentVnode,t}function c(e){try{return JSON.stringify(e,null," ")}catch(t){return String(e)}}var h=e("x-is-array"),l=e("../vnode/vnode.js"),p=e("../vnode/vtext.js"),f=e("../vnode/is-vnode"),d=e("../vnode/is-vtext"),m=e("../vnode/is-widget"),v=e("../vnode/is-vhook"),g=e("../vnode/is-thunk"),y=e("./parse-tag.js"),_=e("./hooks/soft-set-hook.js"),b=e("./hooks/ev-hook.js");t.exports=r},{"../vnode/is-thunk":239,"../vnode/is-vhook":240,"../vnode/is-vnode":241,"../vnode/is-vtext":242,"../vnode/is-widget":243,"../vnode/vnode.js":245,"../vnode/vtext.js":247,"./hooks/ev-hook.js":234,"./hooks/soft-set-hook.js":235,"./parse-tag.js":237,"x-is-array":268}],237:[function(e,t,n){"use strict";function r(e,t){if(!e)return"DIV";var n=!t.hasOwnProperty("id"),r=i(e,o),a=null;s.test(r[1])&&(a="DIV");var u,c,h,l;for(l=0;l<r.length;l++)c=r[l],c&&(h=c.charAt(0),a?"."===h?(u=u||[],u.push(c.substring(1,c.length))):"#"===h&&n&&(t.id=c.substring(1,c.length)):a=c);return u&&(t.className&&u.push(t.className),t.className=u.join(" ")),t.namespace?a:a.toUpperCase()}var i=e("browser-split"),o=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,s=/^\.|#/;t.exports=r},{"browser-split":5}],238:[function(e,t,n){function r(e,t){var n=e,r=t;return u(t)&&(r=i(t,e)),u(e)&&(n=i(e,null)),{a:n,b:r}}function i(e,t){var n=e.vnode;if(n||(n=e.vnode=e.render(t)),!(o(n)||s(n)||a(n)))throw new Error("thunk did not return a valid node");return n}var o=e("./is-vnode"),s=e("./is-vtext"),a=e("./is-widget"),u=e("./is-thunk");t.exports=r},{"./is-thunk":239,"./is-vnode":241,"./is-vtext":242,"./is-widget":243}],239:[function(e,t,n){function r(e){return e&&"Thunk"===e.type}t.exports=r},{}],240:[function(e,t,n){function r(e){return e&&("function"==typeof e.hook&&!e.hasOwnProperty("hook")||"function"==typeof e.unhook&&!e.hasOwnProperty("unhook"))}t.exports=r},{}],241:[function(e,t,n){function r(e){return e&&"VirtualNode"===e.type&&e.version===i}var i=e("./version");t.exports=r},{"./version":244}],242:[function(e,t,n){function r(e){return e&&"VirtualText"===e.type&&e.version===i}var i=e("./version");t.exports=r},{"./version":244}],243:[function(e,t,n){function r(e){return e&&"Widget"===e.type}t.exports=r},{}],244:[function(e,t,n){t.exports="2"},{}],245:[function(e,t,n){function r(e,t,n,r,i){this.tagName=e,this.properties=t||c,this.children=n||h,this.key=null!=r?String(r):void 0,this.namespace="string"==typeof i?i:null;var l,p=n&&n.length||0,f=0,d=!1,m=!1,v=!1;for(var g in t)if(t.hasOwnProperty(g)){var y=t[g];u(y)&&y.unhook&&(l||(l={}),l[g]=y)}for(var _=0;p>_;_++){var b=n[_];o(b)?(f+=b.count||0,!d&&b.hasWidgets&&(d=!0),!m&&b.hasThunks&&(m=!0),v||!b.hooks&&!b.descendantHooks||(v=!0)):!d&&s(b)?"function"==typeof b.destroy&&(d=!0):!m&&a(b)&&(m=!0)}this.count=p+f,this.hasWidgets=d,this.hasThunks=m,this.hooks=l,this.descendantHooks=v}var i=e("./version"),o=e("./is-vnode"),s=e("./is-widget"),a=e("./is-thunk"),u=e("./is-vhook");t.exports=r;var c={},h=[];r.prototype.version=i,r.prototype.type="VirtualNode"},{"./is-thunk":239,"./is-vhook":240,"./is-vnode":241,"./is-widget":243,"./version":244}],246:[function(e,t,n){function r(e,t,n){this.type=Number(e),this.vNode=t,this.patch=n}var i=e("./version");r.NONE=0,r.VTEXT=1,r.VNODE=2,r.WIDGET=3,r.PROPS=4,r.ORDER=5,r.INSERT=6,r.REMOVE=7,r.THUNK=8,t.exports=r,r.prototype.version=i,r.prototype.type="VirtualPatch"},{"./version":244}],247:[function(e,t,n){function r(e){this.text=String(e)}var i=e("./version");t.exports=r,r.prototype.version=i,r.prototype.type="VirtualText"},{"./version":244}],248:[function(e,t,n){function r(e,t){var n;for(var a in e){a in t||(n=n||{},n[a]=void 0);var u=e[a],c=t[a];if(u!==c)if(o(u)&&o(c))if(i(c)!==i(u))n=n||{},n[a]=c;else if(s(c))n=n||{},n[a]=c;else{var h=r(u,c);h&&(n=n||{},n[a]=h)}else n=n||{},n[a]=c}for(var l in t)l in e||(n=n||{},n[l]=t[l]);return n}function i(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}var o=e("is-object"),s=e("../vnode/is-vhook");t.exports=r},{"../vnode/is-vhook":240,"is-object":181}],249:[function(e,t,n){function r(e,t){var n={a:e};return i(e,t,n,0),n}function i(e,t,n,r){if(e!==t){var i=n[r],a=!1;if(x(e)||x(t))u(e,t,n,r);else if(null==t)b(e)||(s(e,n,r),i=n[r]),i=m(i,new g(g.REMOVE,e,t));else if(y(t))if(y(e))if(e.tagName===t.tagName&&e.namespace===t.namespace&&e.key===t.key){var c=S(e.properties,t.properties);c&&(i=m(i,new g(g.PROPS,e,c))),i=o(e,t,n,i,r)}else i=m(i,new g(g.VNODE,e,t)),a=!0;else i=m(i,new g(g.VNODE,e,t)),a=!0;else _(t)?_(e)?e.text!==t.text&&(i=m(i,new g(g.VTEXT,e,t))):(i=m(i,new g(g.VTEXT,e,t)),a=!0):b(t)&&(b(e)||(a=!0),i=m(i,new g(g.WIDGET,e,t)));i&&(n[r]=i),a&&s(e,n,r)}}function o(e,t,n,r,o){for(var s=e.children,a=p(s,t.children),u=a.children,c=s.length,h=u.length,l=c>h?c:h,f=0;l>f;f++){var d=s[f],v=u[f];o+=1,d?i(d,v,n,o):v&&(r=m(r,new g(g.INSERT,null,v))),y(d)&&d.count&&(o+=d.count)}return a.moves&&(r=m(r,new g(g.ORDER,e,a.moves))),
|
||
r}function s(e,t,n){h(e,t,n),a(e,t,n)}function a(e,t,n){if(b(e))"function"==typeof e.destroy&&(t[n]=m(t[n],new g(g.REMOVE,e,null)));else if(y(e)&&(e.hasWidgets||e.hasThunks))for(var r=e.children,i=r.length,o=0;i>o;o++){var s=r[o];n+=1,a(s,t,n),y(s)&&s.count&&(n+=s.count)}else x(e)&&u(e,null,t,n)}function u(e,t,n,i){var o=w(e,t),s=r(o.a,o.b);c(s)&&(n[i]=new g(g.THUNK,null,s))}function c(e){for(var t in e)if("a"!==t)return!0;return!1}function h(e,t,n){if(y(e)){if(e.hooks&&(t[n]=m(t[n],new g(g.PROPS,e,l(e.hooks)))),e.descendantHooks||e.hasThunks)for(var r=e.children,i=r.length,o=0;i>o;o++){var s=r[o];n+=1,h(s,t,n),y(s)&&s.count&&(n+=s.count)}}else x(e)&&u(e,null,t,n)}function l(e){var t={};for(var n in e)t[n]=void 0;return t}function p(e,t){var n=d(t),r=n.keys,i=n.free;if(i.length===t.length)return{children:t,moves:null};var o=d(e),s=o.keys,a=o.free;if(a.length===e.length)return{children:t,moves:null};for(var u=[],c=0,h=i.length,l=0,p=0;p<e.length;p++){var m,v=e[p];v.key?r.hasOwnProperty(v.key)?(m=r[v.key],u.push(t[m])):(m=p-l++,u.push(null)):h>c?(m=i[c++],u.push(t[m])):(m=p-l++,u.push(null))}for(var g=c>=i.length?t.length:i[c],y=0;y<t.length;y++){var _=t[y];_.key?s.hasOwnProperty(_.key)||u.push(_):y>=g&&u.push(_)}for(var b,x=u.slice(),w=0,S=[],M=[],E=0;E<t.length;){var C=t[E];for(b=x[w];null===b&&x.length;)S.push(f(x,w,null)),b=x[w];b&&b.key===C.key?(w++,E++):C.key?(b&&b.key&&r[b.key]!==E+1?(S.push(f(x,w,b.key)),b=x[w],b&&b.key===C.key?w++:M.push({key:C.key,to:E})):M.push({key:C.key,to:E}),E++):b&&b.key&&S.push(f(x,w,b.key))}for(;w<x.length;)b=x[w],S.push(f(x,w,b&&b.key));return S.length!==l||M.length?{children:u,moves:{removes:S,inserts:M}}:{children:u,moves:null}}function f(e,t,n){return e.splice(t,1),{from:t,key:n}}function d(e){for(var t={},n=[],r=e.length,i=0;r>i;i++){var o=e[i];o.key?t[o.key]=i:n.push(i)}return{keys:t,free:n}}function m(e,t){return e?(v(e)?e.push(t):e=[e,t],e):t}var v=e("x-is-array"),g=e("../vnode/vpatch"),y=e("../vnode/is-vnode"),_=e("../vnode/is-vtext"),b=e("../vnode/is-widget"),x=e("../vnode/is-thunk"),w=e("../vnode/handle-thunk"),S=e("./diff-props");t.exports=r},{"../vnode/handle-thunk":238,"../vnode/is-thunk":239,"../vnode/is-vnode":241,"../vnode/is-vtext":242,"../vnode/is-widget":243,"../vnode/vpatch":246,"./diff-props":248,"x-is-array":268}],250:[function(t,n,r){!function(e){"use strict";e(function(e){var t=e("./makePromise"),n=e("./Scheduler"),r=e("./env").asap;return t({scheduler:new n(r)})})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./Scheduler":251,"./env":263,"./makePromise":265}],251:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){this._async=e,this._running=!1,this._queue=this,this._queueLen=0,this._afterQueue={},this._afterQueueLen=0;var t=this;this.drain=function(){t._drain()}}return e.prototype.enqueue=function(e){this._queue[this._queueLen++]=e,this.run()},e.prototype.afterQueue=function(e){this._afterQueue[this._afterQueueLen++]=e,this.run()},e.prototype.run=function(){this._running||(this._running=!0,this._async(this.drain))},e.prototype._drain=function(){for(var e=0;e<this._queueLen;++e)this._queue[e].run(),this._queue[e]=void 0;for(this._queueLen=0,this._running=!1,e=0;e<this._afterQueueLen;++e)this._afterQueue[e].run(),this._afterQueue[e]=void 0;this._afterQueueLen=0},e})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],252:[function(t,n,r){!function(e){"use strict";e(function(){function e(t){Error.call(this),this.message=t,this.name=e.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],253:[function(t,n,r){!function(e){"use strict";e(function(){function e(e,n){function r(t,r,o){var s=e._defer(),a=o.length,u=new Array(a);return i({f:t,thisArg:r,args:o,params:u,i:a-1,call:n},s._handler),s}function i(t,r){if(t.i<0)return n(t.f,t.thisArg,t.params,r);var i=e._handler(t.args[t.i]);i.fold(o,t,void 0,r)}function o(e,t,n){e.params[e.i]=t,e.i-=1,i(e,n)}return arguments.length<2&&(n=t),r}function t(e,t,n,r){try{r.resolve(e.apply(t,n))}catch(i){r.reject(i)}}return e.tryCatchResolve=t,e})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],254:[function(t,n,r){!function(e){"use strict";e(function(e){var t=e("../state"),n=e("../apply");return function(e){function r(t){function n(e){h=null,this.resolve(e)}function r(e){this.resolved||(h.push(e),0===--c&&this.reject(h))}for(var i,o,s=e._defer(),a=s._handler,u=t.length>>>0,c=u,h=[],l=0;u>l;++l)if(o=t[l],void 0!==o||l in t){if(i=e._handler(o),i.state()>0){a.become(i),e._visitRemaining(t,l,i);break}i.visit(a,n,r)}else--c;return 0===c&&a.reject(new RangeError("any(): array must not be empty")),s}function i(t,n){function r(e){this.resolved||(h.push(e),0===--f&&(l=null,this.resolve(h)))}function i(e){this.resolved||(l.push(e),0===--o&&(h=null,this.reject(l)))}var o,s,a,u=e._defer(),c=u._handler,h=[],l=[],p=t.length>>>0,f=0;for(a=0;p>a;++a)s=t[a],(void 0!==s||a in t)&&++f;for(n=Math.max(n,0),o=f-n+1,f=Math.min(n,f),n>f?c.reject(new RangeError("some(): array must contain at least "+n+" item(s), but had "+f)):0===f&&c.resolve(h),a=0;p>a;++a)s=t[a],(void 0!==s||a in t)&&e._handler(s).visit(c,r,i,c.notify);return u}function o(t,n){return e._traverse(n,t)}function s(t,n){var r=y.call(t);return e._traverse(n,r).then(function(e){return a(r,e)})}function a(t,n){for(var r=n.length,i=new Array(r),o=0,s=0;r>o;++o)n[o]&&(i[s++]=e._handler(t[o]).value);return i.length=s,i}function u(e){return m(e.map(c))}function c(n){var r=e._handler(n);return 0===r.state()?d(n).then(t.fulfilled,t.rejected):(r._unreport(),t.inspect(r))}function h(e,t){return arguments.length>2?v.call(e,p(t),arguments[2]):v.call(e,p(t))}function l(e,t){return arguments.length>2?g.call(e,p(t),arguments[2]):g.call(e,p(t))}function p(e){return function(t,n,r){return f(e,void 0,[t,n,r])}}var f=n(e),d=e.resolve,m=e.all,v=Array.prototype.reduce,g=Array.prototype.reduceRight,y=Array.prototype.slice;return e.any=r,e.some=i,e.settle=u,e.map=o,e.filter=s,e.reduce=h,e.reduceRight=l,e.prototype.spread=function(e){return this.then(m).then(function(t){return e.apply(this,t)})},e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../apply":253,"../state":266}],255:[function(t,n,r){!function(e){"use strict";e(function(){function e(){throw new TypeError("catch predicate must be a function")}function t(e,t){return n(t)?e instanceof t:t(e)}function n(e){return e===Error||null!=e&&e.prototype instanceof Error}function r(e){return("object"==typeof e||"function"==typeof e)&&null!==e}function i(e){return e}return function(n){function o(e,n){return function(r){return t(r,n)?e.call(this,r):c(r)}}function s(e,t,n,i){var o=e.call(t);return r(o)?a(o,n,i):n(i)}function a(e,t,n){return u(e).then(function(){return t(n)})}var u=n.resolve,c=n.reject,h=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(t){return arguments.length<2?h.call(this,t):"function"!=typeof t?this.ensure(e):h.call(this,o(arguments[1],t))},n.prototype["finally"]=n.prototype.ensure=function(e){return"function"!=typeof e?this:this.then(function(t){return s(e,this,i,t)},function(t){return s(e,this,c,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"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],256:[function(t,n,r){!function(e){"use strict";e(function(){return function(e){return e.prototype.fold=function(t,n){var r=this._beget();return this._handler.fold(function(n,r,i){e._handler(n).fold(function(e,n,r){r.resolve(t.call(this,n,e))},r,this,i)},n,r._handler.receiver,r._handler),r},e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],257:[function(t,n,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"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../state":266}],258:[function(t,n,r){!function(e){"use strict";e(function(){return function(e){function t(e,t,r,i){return n(function(t){return[t,e(t)]},t,r,i)}function n(e,t,i,o){function s(o,s){return r(i(o)).then(function(){return n(e,t,i,s)})}return r(o).then(function(n){return r(t(n)).then(function(t){return t?n:r(e(n)).spread(s)})})}var r=e.resolve;return e.iterate=t,e.unfold=n,e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],259:[function(t,n,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"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],260:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t,r,i){return n.setTimer(function(){e(r,i,t)},t)}var n=e("../env"),r=e("../TimeoutError");return function(e){function i(e,n,r){t(o,e,n,r)}function o(e,t){t.resolve(e)}function s(e,t,n){var i="undefined"==typeof e?new r("timed out after "+n+"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,r){var i=this._beget(),o=i._handler,a=t(s,e,r,i._handler);return this._handler.visit(o,function(e){n.clearTimer(a),this.resolve(e)},function(e){n.clearTimer(a),this.reject(e)},o.notify),i},e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../TimeoutError":252,"../env":263}],261:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e){throw e}function n(){}var r=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 s(e){var t=f.indexOf(e);t>=0&&(f.splice(t,1),l("Handled previous rejection ["+e.id+"] "+i.formatObject(e.value)))}function a(e,t){p.push(e,t),null===d&&(d=r(u,0))}function u(){for(d=null;p.length>0;)p.shift()(p.shift())}var c,h=n,l=n;"undefined"!=typeof console&&(c=console,h="undefined"!=typeof c.error?function(e){c.error(e)}:function(e){c.log(e)},l="undefined"!=typeof c.info?function(e){c.info(e)}:function(e){c.log(e)}),e.onPotentiallyUnhandledRejection=function(e){a(o,e)},e.onPotentiallyUnhandledRejectionHandled=function(e){a(s,e)},e.onFatalRejection=function(e){a(t,e.value)};var p=[],f=[],d=null;return e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"../env":263,"../format":264}],262:[function(t,n,r){!function(e){"use strict";e(function(){return function(e){return e.prototype["with"]=e.prototype.withThis=function(e){var t=this._beget(),n=t._handler;return n.receiver=e,this._handler.chain(n,e),t},e}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],263:[function(t,n,r){(function(r){!function(e){"use strict";e(function(e){function t(){return"undefined"!=typeof r&&"[object process]"===Object.prototype.toString.call(r)}function n(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function i(e){function t(){var e=n;n=void 0,e()}var n,r=document.createTextNode(""),i=new e(t);i.observe(r,{characterData:!0});var o=0;return function(e){n=e,r.data=o^=1}}var o,s="undefined"!=typeof setTimeout&&setTimeout,a=function(e,t){return setTimeout(e,t)},u=function(e){return clearTimeout(e)},c=function(e){return s(e,0)};if(t())c=function(e){return r.nextTick(e)};else if(o=n())c=i(o);else if(!s){var h=e,l=h("vertx");a=function(e,t){return l.setTimer(t,e)},u=l.cancelTimer,c=l.runOnLoop||l.runOnContext}return{setTimer:a,clearTimer:u,asap:c}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})}).call(this,t("_process"))},{_process:6}],264:[function(t,n,r){!function(e){"use strict";e(function(){function e(e){var n="object"==typeof e&&null!==e&&(e.stack||e.message)?e.stack||e.message:t(e);return e instanceof Error?n:n+" (WARNING: non-Error used)"}function t(e){var t=String(e);return"[object Object]"===t&&"undefined"!=typeof JSON&&(t=n(e,t)),t}function n(e,t){try{return JSON.stringify(e)}catch(n){return t}}return{formatError:e,formatObject:t,tryStringify:n}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],265:[function(t,n,r){(function(t){!function(e){"use strict";e(function(){return function(e){function n(e,t){this._handler=e===b?t:r(e)}function r(e){function t(e){i.resolve(e)}function n(e){i.reject(e)}function r(e){i.notify(e)}var i=new w;try{e(t,n,r)}catch(o){n(o)}return i}function i(e){return I(e)?e:new n(b,new S(g(e)))}function o(e){return new n(b,new S(new C(e)))}function s(){return ee}function a(){return new n(b,new w)}function u(e,t){var n=new w(e.receiver,e.join().context);return new t(b,n)}function c(e){return l($,null,e)}function h(e,t){return l(V,e,t)}function l(e,t,r){function i(n,i,s){s.resolved||p(r,o,n,e(t,i,n),s)}function o(e,t,n){h[e]=t,0===--c&&n.become(new E(h))}for(var s,a="function"==typeof t?i:o,u=new w,c=r.length>>>0,h=new Array(c),l=0;l<r.length&&!u.resolved;++l)s=r[l],void 0!==s||l in r?p(r,a,l,s,u):--c;return 0===c&&u.become(new E(h)),new n(b,u)}function p(e,t,n,r,i){if(k(r)){var o=y(r),s=o.state();0===s?o.fold(t,n,void 0,i):s>0?t(n,o.value,i):(i.become(o),f(e,n+1,o))}else t(n,r,i)}function f(e,t,n){for(var r=t;r<e.length;++r)d(g(e[r]),n)}function d(e,t){if(e!==t){var n=e.state();0===n?e.visit(e,void 0,e._unreport):0>n&&e._unreport()}}function m(e){return"object"!=typeof e||null===e?o(new TypeError("non-iterable passed to race()")):0===e.length?s():1===e.length?i(e[0]):v(e)}function v(e){var t,r,i,o=new w;for(t=0;t<e.length;++t)if(r=e[t],void 0!==r||t in e){if(i=g(r),0!==i.state()){o.become(i),f(e,t+1,i);break}i.visit(o,o.resolve,o.reject)}return new n(b,o)}function g(e){return I(e)?e._handler.join():k(e)?_(e):new E(e)}function y(e){return I(e)?e._handler.join():_(e)}function _(e){try{var t=e.then;return"function"==typeof t?new M(t,e):new E(e)}catch(n){return new C(n)}}function b(){}function x(){}function w(e,t){n.createContext(this,t),this.consumers=void 0,this.receiver=e,this.handler=void 0,this.resolved=!1}function S(e){this.handler=e}function M(e,t){w.call(this),X.enqueue(new R(e,t,this))}function E(e){n.createContext(this),this.value=e}function C(e){n.createContext(this),this.id=++J,this.value=e,this.handled=!1,this.reported=!1,this._report()}function T(e,t){this.rejection=e,this.context=t}function A(e){this.rejection=e}function P(){return new C(new TypeError("Promise cycle"))}function O(e,t){this.continuation=e,this.handler=t}function L(e,t){this.handler=t,this.value=e}function R(e,t,n){this._then=e,this.thenable=t,this.resolver=n}function N(e,t,n,r,i){try{e.call(t,n,r,i)}catch(o){r(o)}}function D(e,t,n,r){this.f=e,this.z=t,this.c=n,this.to=r,this.resolver=Z,this.receiver=this}function I(e){return e instanceof n}function k(e){return("object"==typeof e||"function"==typeof e)&&null!==e}function j(e,t,r,i){return"function"!=typeof e?i.become(t):(n.enterContext(t),U(e,t.value,r,i),void n.exitContext())}function F(e,t,r,i,o){return"function"!=typeof e?o.become(r):(n.enterContext(r),G(e,t,r.value,i,o),void n.exitContext())}function B(e,t,r,i,o){return"function"!=typeof e?o.notify(t):(n.enterContext(r),z(e,t,i,o),void n.exitContext())}function V(e,t,n){try{return e(t,n)}catch(r){return o(r)}}function U(e,t,n,r){try{r.become(g(e.call(n,t)))}catch(i){r.become(new C(i))}}function G(e,t,n,r,i){try{e.call(r,t,n,i)}catch(o){i.become(new C(o))}}function z(e,t,n,r){try{r.notify(e.call(n,t))}catch(i){r.notify(i)}}function H(e,t){t.prototype=K(e.prototype),t.prototype.constructor=t}function $(e,t){return t}function W(){}function q(){return"undefined"!=typeof t&&null!==t&&"function"==typeof t.emit?function(e,n){return"unhandledRejection"===e?t.emit(e,n.value,n):t.emit(e,n)}:"undefined"!=typeof self&&"function"==typeof CustomEvent?function(e,t,n){var r=!1;try{var i=new n("unhandledRejection");r=i instanceof n}catch(o){}return r?function(e,r){var i=new n(e,{detail:{reason:r.value,key:r},bubbles:!1,cancelable:!0});return!t.dispatchEvent(i)}:e}(W,self,CustomEvent):W}var X=e.scheduler,Y=q(),K=Object.create||function(e){function t(){}return t.prototype=e,new t};n.resolve=i,n.reject=o,n.never=s,n._defer=a,n._handler=g,n.prototype.then=function(e,t,n){var r=this._handler,i=r.join().state();if("function"!=typeof e&&i>0||"function"!=typeof t&&0>i)return new this.constructor(b,r);var o=this._beget(),s=o._handler;return r.chain(s,r.receiver,e,t,n),o},n.prototype["catch"]=function(e){return this.then(void 0,e)},n.prototype._beget=function(){return u(this._handler,this.constructor)},n.all=c,n.race=m,n._traverse=h,n._visitRemaining=f,b.prototype.when=b.prototype.become=b.prototype.notify=b.prototype.fail=b.prototype._unreport=b.prototype._report=W,b.prototype._state=0,b.prototype.state=function(){return this._state},b.prototype.join=function(){for(var e=this;void 0!==e.handler;)e=e.handler;return e},b.prototype.chain=function(e,t,n,r,i){this.when({resolver:e,receiver:t,fulfilled:n,rejected:r,progress:i})},b.prototype.visit=function(e,t,n,r){this.chain(Z,e,t,n,r)},b.prototype.fold=function(e,t,n,r){this.when(new D(e,t,n,r))},H(b,x),x.prototype.become=function(e){e.fail()};var Z=new x;H(b,w),w.prototype._state=0,w.prototype.resolve=function(e){this.become(g(e))},w.prototype.reject=function(e){this.resolved||this.become(new C(e))},w.prototype.join=function(){if(!this.resolved)return this;for(var e=this;void 0!==e.handler;)if(e=e.handler,e===this)return this.handler=P();return e},w.prototype.run=function(){var e=this.consumers,t=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n<e.length;++n)t.when(e[n])},w.prototype.become=function(e){this.resolved||(this.resolved=!0,this.handler=e,void 0!==this.consumers&&X.enqueue(this),void 0!==this.context&&e._report(this.context))},w.prototype.when=function(e){this.resolved?X.enqueue(new O(e,this.handler)):void 0===this.consumers?this.consumers=[e]:this.consumers.push(e)},w.prototype.notify=function(e){this.resolved||X.enqueue(new L(e,this))},w.prototype.fail=function(e){var t="undefined"==typeof e?this.context:e;this.resolved&&this.handler.join().fail(t)},w.prototype._report=function(e){this.resolved&&this.handler.join()._report(e)},w.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},H(b,S),S.prototype.when=function(e){X.enqueue(new O(e,this))},S.prototype._report=function(e){this.join()._report(e)},S.prototype._unreport=function(){this.join()._unreport()},H(w,M),H(b,E),E.prototype._state=1,E.prototype.fold=function(e,t,n,r){F(e,t,this,n,r)},E.prototype.when=function(e){j(e.fulfilled,this,e.receiver,e.resolver)};var J=0;H(b,C),C.prototype._state=-1,C.prototype.fold=function(e,t,n,r){r.become(this)},C.prototype.when=function(e){"function"==typeof e.rejected&&this._unreport(),j(e.rejected,this,e.receiver,e.resolver)},C.prototype._report=function(e){X.afterQueue(new T(this,e))},C.prototype._unreport=function(){this.handled||(this.handled=!0,X.afterQueue(new A(this)))},C.prototype.fail=function(e){this.reported=!0,Y("unhandledRejection",this),n.onFatalRejection(this,void 0===e?this.context:e)},T.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,Y("unhandledRejection",this.rejection)||n.onPotentiallyUnhandledRejection(this.rejection,this.context))},A.prototype.run=function(){this.rejection.reported&&(Y("rejectionHandled",this.rejection)||n.onPotentiallyUnhandledRejectionHandled(this.rejection))},n.createContext=n.enterContext=n.exitContext=n.onPotentiallyUnhandledRejection=n.onPotentiallyUnhandledRejectionHandled=n.onFatalRejection=W;var Q=new b,ee=new n(b,Q);return O.prototype.run=function(){this.handler.join().when(this.continuation)},L.prototype.run=function(){var e=this.handler.consumers;if(void 0!==e)for(var t,n=0;n<e.length;++n)t=e[n],B(t.progress,this.value,this.handler,t.receiver,t.resolver)},R.prototype.run=function(){function e(e){r.resolve(e)}function t(e){r.reject(e)}function n(e){r.notify(e)}var r=this.resolver;N(this._then,this.thenable,e,t,n)},D.prototype.fulfilled=function(e){this.f.call(this.c,this.z,e,this.to)},D.prototype.rejected=function(e){this.to.reject(e)},D.prototype.progress=function(e){this.to.notify(e)},n}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})}).call(this,t("_process"))},{_process:6}],266:[function(t,n,r){!function(e){"use strict";e(function(){function e(){return{state:"pending"}}function t(e){return{state:"rejected",reason:e}}function n(e){return{state:"fulfilled",value:e}}function r(r){var i=r.state();return 0===i?e():i>0?n(r.value):t(r.value)}return{pending:e,fulfilled:n,rejected:t,inspect:r}})}("function"==typeof e&&e.amd?e:function(e){n.exports=e()})},{}],267:[function(t,n,r){!function(e){"use strict";e(function(e){function t(e,t,n,r){var i=S.resolve(e);return arguments.length<2?i:i.then(t,n,r)}function n(e){return new S(e)}function r(e){return function(){for(var t=0,n=arguments.length,r=new Array(n);n>t;++t)r[t]=arguments[t];return M(e,this,r)}}function i(e){for(var t=0,n=arguments.length-1,r=new Array(n);n>t;++t)r[t]=arguments[t+1];return M(e,this,r)}function o(){return new s}function s(){function e(e){r._handler.resolve(e)}function t(e){r._handler.reject(e)}function n(e){r._handler.notify(e)}var r=S._defer();this.promise=r,this.resolve=e,this.reject=t,this.notify=n,this.resolver={resolve:e,reject:t,notify:n}}function a(e){return e&&"function"==typeof e.then}function u(){return S.all(arguments)}function c(e){return t(e,S.all)}function h(e){return t(e,S.settle)}function l(e,n){return t(e,function(e){return S.map(e,n)})}function p(e,n){return t(e,function(e){return S.filter(e,n)})}var f=e("./lib/decorators/timed"),d=e("./lib/decorators/array"),m=e("./lib/decorators/flow"),v=e("./lib/decorators/fold"),g=e("./lib/decorators/inspect"),y=e("./lib/decorators/iterate"),_=e("./lib/decorators/progress"),b=e("./lib/decorators/with"),x=e("./lib/decorators/unhandledRejection"),w=e("./lib/TimeoutError"),S=[d,m,v,y,_,g,b,f,x].reduce(function(e,t){return t(e)},e("./lib/Promise")),M=e("./lib/apply")(S);return t.promise=n,t.resolve=S.resolve,t.reject=S.reject,t.lift=r,t["try"]=i,t.attempt=i,t.iterate=S.iterate,t.unfold=S.unfold,t.join=u,t.all=c,t.settle=h,t.any=r(S.any),t.some=r(S.some),t.race=r(S.race),t.map=l,t.filter=p,t.reduce=r(S.reduce),t.reduceRight=r(S.reduceRight),t.isPromiseLike=a,t.Promise=S,t.defer=o,t.TimeoutError=w,t})}("function"==typeof e&&e.amd?e:function(e){n.exports=e(t)})},{"./lib/Promise":250,"./lib/TimeoutError":252,"./lib/apply":253,"./lib/decorators/array":254,"./lib/decorators/flow":255,"./lib/decorators/fold":256,"./lib/decorators/inspect":257,"./lib/decorators/iterate":258,"./lib/decorators/progress":259,"./lib/decorators/timed":260,"./lib/decorators/unhandledRejection":261,"./lib/decorators/with":262}],268:[function(e,t,n){function r(e){return"[object Array]"===o.call(e)}var i=Array.isArray,o=Object.prototype.toString;t.exports=i||r},{}],269:[function(e,t,n){"use strict";var r=e("./api/APIv2Call");n.APIv2Call=r.APIv2Call;var i=e("./api/APIv2");n.APIv2=i.APIv2;var o=e("./api/APIv3");n.APIv3=o.APIv3},{"./api/APIv2":285,"./api/APIv2Call":286,"./api/APIv3":287}],270:[function(e,t,n){"use strict";var r=e("./component/Component");n.Component=r.Component;var i=e("./component/ComponentService");n.ComponentService=i.ComponentService;var o=e("./component/AttributionComponent");n.AttributionComponent=o.AttributionComponent;var s=e("./component/BackgroundComponent");n.BackgroundComponent=s.BackgroundComponent;var a=e("./component/CacheComponent");n.CacheComponent=a.CacheComponent;var u=e("./component/CoverComponent");n.CoverComponent=u.CoverComponent;var c=e("./component/DebugComponent");n.DebugComponent=c.DebugComponent;var h=e("./component/DetectionComponent");n.DetectionComponent=h.DetectionComponent;var l=e("./component/DirectionComponent");n.DirectionComponent=l.DirectionComponent;var p=e("./component/ImageComponent");n.ImageComponent=p.ImageComponent;var f=e("./component/KeyboardComponent");n.KeyboardComponent=f.KeyboardComponent;var d=e("./component/LoadingComponent");n.LoadingComponent=d.LoadingComponent;var m=e("./component/marker/Marker");n.Marker=m.Marker;var v=e("./component/marker/MarkerComponent");n.MarkerComponent=v.MarkerComponent;var g=e("./component/MouseComponent");n.MouseComponent=g.MouseComponent;var y=e("./component/NavigationComponent");n.NavigationComponent=y.NavigationComponent;var _=e("./component/NoneComponent");n.NoneComponent=_.NoneComponent;var b=e("./component/PlayerComponent");n.PlayerComponent=b.PlayerComponent;var x=e("./component/RouteComponent");n.RouteComponent=x.RouteComponent;var w=e("./component/SequenceComponent");n.SequenceComponent=w.SequenceComponent;var S=e("./component/SphereComponent");n.SphereComponent=S.SphereComponent;var M=e("./component/imageplane/ImagePlaneComponent");n.ImagePlaneComponent=M.ImagePlaneComponent;var E=e("./component/imageplane/ImagePlaneFactory");n.ImagePlaneFactory=E.ImagePlaneFactory;var C=e("./component/imageplane/ImagePlaneGLRenderer");n.ImagePlaneGLRenderer=C.ImagePlaneGLRenderer;var T=e("./component/imageplane/ImagePlaneScene");n.ImagePlaneScene=T.ImagePlaneScene;var A=e("./component/imageplane/ImagePlaneShaders");n.ImagePlaneShaders=A.ImagePlaneShaders;var P=e("./component/marker/SimpleMarker");n.SimpleMarker=P.SimpleMarker;var O=e("./component/imageplane/SliderComponent");n.SliderComponent=O.SliderComponent;var L=e("./component/tag/tag/Tag");n.Tag=L.Tag;var R=e("./component/tag/tag/OutlineTag");n.OutlineTag=R.OutlineTag;var N=e("./component/tag/tag/OutlineCreateTag");n.OutlineCreateTag=N.OutlineCreateTag;var D=e("./component/tag/tag/SpotTag");n.SpotTag=D.SpotTag;var I=e("./component/tag/TagComponent");n.TagComponent=I.TagComponent;var k=e("./component/tag/TagCreator");n.TagCreator=k.TagCreator;var j=e("./component/tag/TagDOMRenderer");n.TagDOMRenderer=j.TagDOMRenderer;var F=e("./component/tag/TagGLRenderer");n.TagGLRenderer=F.TagGLRenderer;var B=e("./component/tag/TagOperation");n.TagOperation=B.TagOperation;var V=e("./component/tag/TagSet");n.TagSet=V.TagSet;var U=e("./component/tag/geometry/Geometry");n.Geometry=U.Geometry;var G=e("./component/tag/geometry/VertexGeometry");n.VertexGeometry=G.VertexGeometry;var z=e("./component/tag/geometry/RectGeometry");n.RectGeometry=z.RectGeometry;var H=e("./component/tag/geometry/PointGeometry");n.PointGeometry=H.PointGeometry;var $=e("./component/tag/geometry/PolygonGeometry");n.PolygonGeometry=$.PolygonGeometry;var W=e("./component/tag/error/GeometryTagError");n.GeometryTagError=W.GeometryTagError;var q=e("./component/imageplane/TextureLoader");n.TextureLoader=q.TextureLoader},{"./component/AttributionComponent":288,"./component/BackgroundComponent":289,"./component/CacheComponent":290,"./component/Component":291,"./component/ComponentService":292,"./component/CoverComponent":293,"./component/DebugComponent":294,"./component/DetectionComponent":295,"./component/DirectionComponent":296,"./component/ImageComponent":297,"./component/KeyboardComponent":298,"./component/LoadingComponent":299,"./component/MouseComponent":300,"./component/NavigationComponent":301,"./component/NoneComponent":302,"./component/PlayerComponent":303,"./component/RouteComponent":304,"./component/SequenceComponent":305,"./component/SphereComponent":306,"./component/imageplane/ImagePlaneComponent":307,"./component/imageplane/ImagePlaneFactory":308,"./component/imageplane/ImagePlaneGLRenderer":309,"./component/imageplane/ImagePlaneScene":310,"./component/imageplane/ImagePlaneShaders":311,"./component/imageplane/SliderComponent":312,"./component/imageplane/TextureLoader":313,"./component/marker/Marker":314,"./component/marker/MarkerComponent":315,"./component/marker/SimpleMarker":316,"./component/tag/TagComponent":318,"./component/tag/TagCreator":319,"./component/tag/TagDOMRenderer":320,"./component/tag/TagGLRenderer":321,"./component/tag/TagOperation":322,"./component/tag/TagSet":323,"./component/tag/error/GeometryTagError":324,"./component/tag/geometry/Geometry":325,"./component/tag/geometry/PointGeometry":326,"./component/tag/geometry/PolygonGeometry":327,"./component/tag/geometry/RectGeometry":328,"./component/tag/geometry/VertexGeometry":329,"./component/tag/tag/OutlineCreateTag":330,"./component/tag/tag/OutlineTag":331,"./component/tag/tag/SpotTag":332,"./component/tag/tag/Tag":333}],271:[function(e,t,n){"use strict";var r=e("./graph/edge/EdgeDirection");n.EdgeDirection=r.EdgeDirection;var i=e("./graph/edge/EdgeCalculatorSettings");n.EdgeCalculatorSettings=i.EdgeCalculatorSettings;var o=e("./graph/edge/EdgeCalculatorDirections");n.EdgeCalculatorDirections=o.EdgeCalculatorDirections;var s=e("./graph/edge/EdgeCalculatorCoefficients");n.EdgeCalculatorCoefficients=s.EdgeCalculatorCoefficients;var a=e("./graph/edge/EdgeCalculator");n.EdgeCalculator=a.EdgeCalculator},{"./graph/edge/EdgeCalculator":354,"./graph/edge/EdgeCalculatorCoefficients":355,"./graph/edge/EdgeCalculatorDirections":356,"./graph/edge/EdgeCalculatorSettings":357,"./graph/edge/EdgeDirection":358}],272:[function(e,t,n){"use strict";var r=e("./error/MapillaryError");n.MapillaryError=r.MapillaryError;var i=e("./error/MoveTypeMapillaryError");n.MoveTypeMapillaryError=i.MoveTypeMapillaryError;var o=e("./error/NotImplementedMapillaryError");n.NotImplementedMapillaryError=o.NotImplementedMapillaryError;var s=e("./error/ParameterMapillaryError");n.ParameterMapillaryError=s.ParameterMapillaryError;var a=e("./error/InitializationMapillaryError");n.InitializationMapillaryError=a.InitializationMapillaryError},{"./error/InitializationMapillaryError":334,"./error/MapillaryError":335,"./error/MoveTypeMapillaryError":336,"./error/NotImplementedMapillaryError":337,"./error/ParameterMapillaryError":338}],273:[function(e,t,n){"use strict";var r=e("./geo/GeoCoords");n.GeoCoords=r.GeoCoords;var i=e("./geo/WebMercator");n.WebMercator=i.WebMercator;var o=e("./geo/Spatial");n.Spatial=o.Spatial;var s=e("./geo/Transform");n.Transform=s.Transform;var a=e("./geo/Camera");n.Camera=a.Camera},{"./geo/Camera":339,"./geo/GeoCoords":340,"./geo/Spatial":341,"./geo/Transform":342,"./geo/WebMercator":343}],274:[function(e,t,n){"use strict";var r=e("./graph/Graph");n.Graph=r.Graph;var i=e("./graph/GraphService");n.GraphService=i.GraphService;var o=e("./graph/ImageLoadingService");n.ImageLoadingService=o.ImageLoadingService;var s=e("./graph/MapillaryObject");n.MapillaryObject=s.MapillaryObject;var a=e("./graph/MapillaryRect");n.MapillaryRect=a.MapillaryRect;var u=e("./graph/MeshReader");n.MeshReader=u.MeshReader;var c=e("./graph/Node");n.Node=c.Node;var h=e("./graph/Sequence");n.Sequence=h.Sequence;var l=e("./graph/TilesService");n.TilesService=l.TilesService;var p=e("./graph/VectorTilesService");n.VectorTilesService=p.VectorTilesService},{"./graph/Graph":344,"./graph/GraphService":345,"./graph/ImageLoadingService":346,"./graph/MapillaryObject":347,"./graph/MapillaryRect":348,"./graph/MeshReader":349,"./graph/Node":350,"./graph/Sequence":351,"./graph/TilesService":352,"./graph/VectorTilesService":353}],275:[function(e,t,n){"use strict";var r=e("./Edge");n.EdgeDirection=r.EdgeDirection;var i=e("./Render");n.RenderMode=i.RenderMode;var o=e("./Viewer");n.ImageSize=o.ImageSize,n.Viewer=o.Viewer;var s=e("./component/tag/Tag");n.TagComponent=s},{"./Edge":271,"./Render":276,"./Viewer":279,"./component/tag/Tag":317}],276:[function(e,t,n){"use strict";var r=e("./render/DOMRenderer");n.DOMRenderer=r.DOMRenderer;var i=e("./render/GLRenderer");n.GLRenderer=i.GLRenderer;var o=e("./render/GLRenderStage");n.GLRenderStage=o.GLRenderStage;var s=e("./render/RenderCamera");n.RenderCamera=s.RenderCamera;var a=e("./render/RenderMode");n.RenderMode=a.RenderMode;var u=e("./render/RenderService");
|
||
n.RenderService=u.RenderService},{"./render/DOMRenderer":359,"./render/GLRenderStage":360,"./render/GLRenderer":361,"./render/RenderCamera":362,"./render/RenderMode":363,"./render/RenderService":364}],277:[function(e,t,n){"use strict";var r=e("./state/FrameGenerator");n.FrameGenerator=r.FrameGenerator;var i=e("./state/StateService");n.StateService=i.StateService;var o=e("./state/StateContext");n.StateContext=o.StateContext;var s=e("./state/State");n.State=s.State;var a=e("./state/states/StateBase");n.StateBase=a.StateBase;var u=e("./state/states/TraversingState");n.TraversingState=u.TraversingState;var c=e("./state/states/WaitingState");n.WaitingState=c.WaitingState},{"./state/FrameGenerator":365,"./state/State":366,"./state/StateContext":367,"./state/StateService":368,"./state/states/StateBase":369,"./state/states/TraversingState":370,"./state/states/WaitingState":371}],278:[function(e,t,n){"use strict";var r=e("./utils/EventEmitter");n.EventEmitter=r.EventEmitter;var i=e("./utils/Settings");n.Settings=i.Settings;var o=e("./utils/Urls");n.Urls=o.Urls},{"./utils/EventEmitter":372,"./utils/Settings":373,"./utils/Urls":374}],279:[function(e,t,n){"use strict";var r=e("./viewer/Container");n.Container=r.Container;var i=e("./viewer/EventLauncher");n.EventLauncher=i.EventLauncher;var o=e("./viewer/ImageSize");n.ImageSize=o.ImageSize;var s=e("./viewer/LoadingService");n.LoadingService=s.LoadingService;var a=e("./viewer/MouseService");n.MouseService=a.MouseService;var u=e("./viewer/Navigator");n.Navigator=u.Navigator;var c=e("./viewer/ComponentController");n.ComponentController=c.ComponentController;var h=e("./viewer/SpriteAlignment");n.SpriteAlignment=h.SpriteAlignment;var l=e("./viewer/SpriteService");n.SpriteService=l.SpriteService;var p=e("./viewer/TouchService");n.TouchService=p.TouchService,n.TouchMove=p.TouchMove;var f=e("./viewer/Viewer");n.Viewer=f.Viewer},{"./viewer/ComponentController":375,"./viewer/Container":376,"./viewer/EventLauncher":377,"./viewer/ImageSize":378,"./viewer/LoadingService":379,"./viewer/MouseService":380,"./viewer/Navigator":381,"./viewer/SpriteAlignment":382,"./viewer/SpriteService":383,"./viewer/TouchService":384,"./viewer/Viewer":385}],280:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../API"),o=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.callOr=function(e){return this.callApi("im/"+e+"/or")},t}(i.APIv2Call);n.APIIm=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../API":269}],281:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../API"),o=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.callNav=function(e){return this.callApi("nav/"+e)},t.prototype.h=function(e){return this.callNav("h/"+e)},t.prototype.im=function(e){return this.callNav("im/"+e)},t}(i.APIv2Call);n.APINav=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../API":269}],282:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../API"),o=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.callS=function(e){return this.callApi("s/"+e)},t.prototype.get=function(e){return this.callS(e)},t}(i.APIv2Call);n.APIS=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../API":269}],283:[function(e,t,n){"use strict";var r=e("./APISearchIm"),i=function(){function e(e){this._clientId=e,this.im=new r["default"](e)}return e}();n.APISearch=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{"./APISearchIm":284}],284:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../API"),o=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.callSearchIm=function(e){return this.callApi("search/im/"+e)},t.prototype.close2=function(e,t){return this.callSearchIm("close2?lat="+e+"&lon="+t)},t}(i.APIv2Call);n.APISearchIm=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../API":269}],285:[function(e,t,n){"use strict";var r=e("./APIIm"),i=e("./APINav"),o=e("./APISearch"),s=e("./APIS"),a=function(){function e(e){this._clientId=e,this.im=new r["default"](e),this.nav=new i["default"](e),this.s=new s["default"](e),this.search=new o["default"](e)}return e}();n.APIv2=a,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"./APIIm":280,"./APINav":281,"./APIS":282,"./APISearch":283}],286:[function(e,t,n){"use strict";var r=e("rest"),i=e("rest/interceptor/mime"),o=function(){function e(e){this._clientId=e,this._httpsUrl="https://a.mapillary.com/v2/",this._client=r.wrap(i)}return e.prototype.callApi=function(e){var t=this._httpsUrl+e;return t+=e.indexOf("?")>-1?"&client_id="+this._clientId:"?client_id="+this._clientId,this._client(t).entity()},e}();n.APIv2Call=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{rest:197,"rest/interceptor/mime":202}],287:[function(e,t,n){"use strict";var r=e("falcor"),i=e("falcor-http-datasource"),o=e("../Utils"),s=function(){function e(e){this._clientId=e,this._model=new r.Model({source:new i(o.Urls.falcorModel(e),{crossDomain:!0,withCredentials:!1})})}return Object.defineProperty(e.prototype,"model",{get:function(){return this._model},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clientId",{get:function(){return this._clientId},enumerable:!0,configurable:!0}),e}();n.APIv3=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Utils":278,falcor:64,"falcor-http-datasource":9}],288:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Component"),s=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e=this;this._disposable=this._navigator.stateService.currentNode$.map(function(t){return{name:e._name,vnode:e._getAttributionNode(t.user,t.key)}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.dispose()},t.prototype._getAttributionNode=function(e,t){return i.h("div.Attribution",{},[i.h("a",{href:"https://www.mapillary.com/profile/"+e,target:"_blank",textContent:"@"+e},[]),i.h("span",{textContent:"|"},[]),i.h("a",{href:"https://www.mapillary.com/map/im/"+t+"/photo",target:"_blank",textContent:"mapillary.com"},[])])},t.componentName="attribution",t}(o.Component);n.AttributionComponent=s,o.ComponentService.register(s),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Component":270,"virtual-dom":226}],289:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Component"),s=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){this._container.domRenderer.render$.onNext({name:this._name,vnode:this._getBackgroundNode("The viewer can't display the given photo.")})},t.prototype._deactivate=function(){},t.prototype._getBackgroundNode=function(e){return i.h("div.BackgroundWrapper",{},[i.h("p",{textContent:e},[])])},t.componentName="background",t}(o.Component);n.BackgroundComponent=s,o.ComponentService.register(s),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Component":270,"virtual-dom":226}],290:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("rx"),o=e("../Edge"),s=e("../Component"),a=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),Object.defineProperty(t.prototype,"defaultConfiguration",{get:function(){return{depth:{pano:1,sequence:2,step:1,turn:0}}},enumerable:!0,configurable:!0}),t.prototype.setDepth=function(e){this.configure({depth:e})},t.prototype._activate=function(){var e=this;this._cacheSubscription=i.Observable.combineLatest(this._navigator.stateService.currentNode$,this._configuration$,function(e,t){return[e,t]}).flatMapLatest(function(t){var n=t[0],r=t[1],s=r.depth,a=Math.max(0,Math.min(4,s.sequence)),u=Math.max(0,Math.min(2,s.pano)),c=n.pano?0:Math.max(0,Math.min(3,s.step)),h=n.pano?0:Math.max(0,Math.min(1,s.turn)),l=e._cache$(n,o.EdgeDirection.Next,a),p=e._cache$(n,o.EdgeDirection.Prev,a),f=e._cache$(n,o.EdgeDirection.Pano,u),d=e._cache$(n,o.EdgeDirection.StepForward,c),m=e._cache$(n,o.EdgeDirection.StepBackward,c),v=e._cache$(n,o.EdgeDirection.StepLeft,c),g=e._cache$(n,o.EdgeDirection.StepRight,c),y=e._cache$(n,o.EdgeDirection.TurnLeft,h),_=e._cache$(n,o.EdgeDirection.TurnRight,h),b=e._cache$(n,o.EdgeDirection.TurnU,h);return i.Observable.merge([l,p,d,m,v,g,f,y,_,b]).distinct(function(e){return e.key})}).subscribe(function(e){},function(e){console.error(e)})},t.prototype._deactivate=function(){this._cacheSubscription.dispose()},t.prototype._cache$=function(e,t,n){var r=this;return i.Observable.just([e,n]).expand(function(e){var n=e[0],o=e[1],s=[i.Observable.empty()];if(o>0)for(var a=0,u=n.edges;a<u.length;a++){var c=u[a];c.data.direction===t&&s.push(i.Observable.zip(r._navigator.graphService.node$(c.to),i.Observable.just(o-1)))}return i.Observable.merge(s)}).skip(1).map(function(e){return e[0]})},t.componentName="cache",t}(s.Component);n.CacheComponent=a,s.ComponentService.register(a),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Component":270,"../Edge":271,rx:219}],291:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../Utils"),o=e("rx"),s=function(e){function t(t,n,r){e.call(this),this._activated$=new o.BehaviorSubject(!1),this._configurationSubject$=new o.Subject,this._navigator=r,this._container=n,this._activated=!1,this._name=t,this._configuration$=this._configurationSubject$.startWith(this.defaultConfiguration).scan(function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}).shareReplay(1),this._configuration$.subscribe()}return r(t,e),t.prototype.activate=function(e){this._activated||(void 0!==e&&this._configurationSubject$.onNext(e),this._activate(),this._activated=!0,this._activated$.onNext(!0))},t.prototype.deactivate=function(){this._activated&&(this._container.domRenderer.clear(this._name),this._container.glRenderer.clear(this._name),this._deactivate(),this._activated=!1,this._activated$.onNext(!1))},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}),t.prototype.configure=function(e){this._configurationSubject$.onNext(e)},Object.defineProperty(t.prototype,"defaultConfiguration",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"configuration$",{get:function(){return this._configuration$},enumerable:!0,configurable:!0}),t.componentName="not_worthy",t}(i.EventEmitter);n.Component=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Utils":278,rx:219}],292:[function(e,t,n){"use strict";var r=e("../Error"),i=e("underscore"),o=function(){function e(t,n){this._components={},this._container=t,this._navigator=n;for(var r=0,o=i.values(e.registeredComponents);r<o.length;r++){var s=o[r];this._components[s.componentName]={active:!1,component:new s(s.componentName,t,n)}}this._coverComponent=new e.registeredCoverComponent("cover",t,n),this._coverComponent.activate(),this._coverActivated=!0}return e.register=function(t){void 0===e.registeredComponents[t.componentName]&&(e.registeredComponents[t.componentName]=t)},e.registerCover=function(t){e.registeredCoverComponent=t},e.prototype.activateCover=function(){if(!this._coverActivated){this._coverActivated=!0;for(var e=0,t=i.values(this._components);e<t.length;e++){var n=t[e];n.active&&n.component.deactivate()}}},e.prototype.deactivateCover=function(){if(this._coverActivated){this._coverActivated=!1;for(var e=0,t=i.values(this._components);e<t.length;e++){var n=t[e];n.active&&n.component.activate()}}},e.prototype.activate=function(e){this._checkName(e),this._components[e].active=!0,this._coverActivated||this.get(e).activate()},e.prototype.configure=function(e,t){this._checkName(e),this.get(e).configure(t)},e.prototype.deactivate=function(e){this._checkName(e),this._components[e].active=!1,this._coverActivated||this.get(e).deactivate()},e.prototype.get=function(e){return this._components[e].component},e.prototype.getCover=function(){return this._coverComponent},e.prototype._checkName=function(e){if(!(e in this._components))throw new r.ParameterMapillaryError("Component does not exist: "+e)},e.registeredComponents={},e}();n.ComponentService=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../Error":272,underscore:221}],293:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Component"),s=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e=this;this._keyDisposable=this._navigator.stateService.currentNode$.withLatestFrom(this._configuration$,function(e,t){return[e,t]}).filter(function(e){return e[0].key!==e[1].key}).map(function(e){return e[0]}).map(function(e){return{key:e.key,src:e.image.src}}).subscribe(this._configurationSubject$),this._disposable=this._configuration$.map(function(t){return t.key?t.visible?{name:e._name,vnode:e._getCoverButtonVNode(t)}:{name:e._name,vnode:i.h("div.Cover.CoverDone",[e._getCoverBackgroundVNode(t)])}:{name:e._name,vnode:i.h("div",[])}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.dispose(),this._keyDisposable.dispose()},Object.defineProperty(t.prototype,"defaultConfiguration",{get:function(){return{loading:!1,visible:!0}},enumerable:!0,configurable:!0}),t.prototype._getCoverButtonVNode=function(e){var t=this,n="span.CoverButtonIcon",r=[];return e.loading&&(n="div.uil-ripple-css",r.push(i.h("div",{},[]))),i.h("div.Cover",[this._getCoverBackgroundVNode(e),i.h("button.CoverButton",{onclick:function(){t.configure({loading:!0})}},[i.h(n,{},r)])])},t.prototype._getCoverBackgroundVNode=function(e){var t=null!=e.src?"url("+e.src+")":"url(https://d1cuyjsrcm0gby.cloudfront.net/"+e.key+"/thumb-320.jpg)";return i.h("div.CoverBackground",{style:{backgroundImage:t}},[])},t.componentName="cover",t}(o.Component);n.CoverComponent=s,o.ComponentService.registerCover(s),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Component":270,"virtual-dom":226}],294:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("underscore"),o=e("rx"),s=e("virtual-dom"),a=e("../Component"),u=function(e){function t(t,n,r){e.call(this,t,n,r),this._open$=new o.BehaviorSubject(!1),this._displaying=!1}return r(t,e),t.prototype._activate=function(){var e=this;this._disposable=this._navigator.stateService.currentState$.combineLatest(this._open$,this._navigator.graphService.imageLoadingService.loadstatus$,function(t,n,r){return{name:e._name,vnode:e._getDebugVNode(n,e._getDebugInfo(t,r))}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.dispose()},t.prototype._getDebugInfo=function(e,t){var n=[];n.push(s.h("h2","Node")),e.state.currentNode&&n.push(s.h("p","currentNode: "+e.state.currentNode.key)),e.state.previousNode&&n.push(s.h("p","previousNode: "+e.state.previousNode.key)),n.push(s.h("h2","Loading"));for(var r=0,o=0,a=0,u=0,c=i.values(t);u<c.length;u++){var h=c[u];r+=h.loaded,h.loaded!==h.total?a++:o++}return n.push(s.h("p","Loaded Images: "+o)),n.push(s.h("p","Loading Images: "+a)),n.push(s.h("p","Total bytes loaded: "+r)),n.push(s.h("h2","Camera")),n.push(s.h("p","camera.position.x: "+e.state.camera.position.x)),n.push(s.h("p","camera.position.y: "+e.state.camera.position.y)),n.push(s.h("p","camera.position.z: "+e.state.camera.position.z)),n.push(s.h("p","camera.lookat.x: "+e.state.camera.lookat.x)),n.push(s.h("p","camera.lookat.y: "+e.state.camera.lookat.y)),n.push(s.h("p","camera.lookat.z: "+e.state.camera.lookat.z)),n.push(s.h("p","camera.up.x: "+e.state.camera.up.x)),n.push(s.h("p","camera.up.y: "+e.state.camera.up.y)),n.push(s.h("p","camera.up.z: "+e.state.camera.up.z)),n},t.prototype._getDebugVNode=function(e,t){return e?s.h("div.Debug",{},[s.h("h2",{},["Debug"]),this._getDebugVNodeButton(e),s.h("pre",{},t)]):this._getDebugVNodeButton(e)},t.prototype._getDebugVNodeButton=function(e){var t=e?"Disable Debug":"D",n=e?"":".DebugButtonFixed";return e?s.h("button.DebugButton"+n,{onclick:this._closeDebugElement.bind(this)},[t]):s.h("button.DebugButton"+n,{onclick:this._openDebugElement.bind(this)},[t])},t.prototype._closeDebugElement=function(e){this._open$.onNext(!1)},t.prototype._openDebugElement=function(){this._open$.onNext(!0)},t.componentName="debug",t}(a.Component);n.DebugComponent=u,a.ComponentService.register(u),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../Component":270,rx:219,underscore:221,"virtual-dom":226}],295:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Component"),s=function(e){function t(t,n,r){e.call(this,t,n,r),this._apiV3=r.apiV3}return r(t,e),t.prototype._activate=function(){var e=this;this._disposable=this._navigator.stateService.currentNode$.flatMap(function(t){return e._apiV3.model.get(["imageByKey",t.key,"ors",{from:0,to:20},["key","obj","rect","value","package","score"]])}).map(function(t){var n=[];delete t.json.imageByKey.$__path,t=t.json.imageByKey[Object.keys(t.json.imageByKey)[0]].ors,delete t.$__path;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(!i)continue;var o=[];o[0]=i.rect.geometry.coordinates[1][0],o[1]=i.rect.geometry.coordinates[1][1],o[2]=i.rect.geometry.coordinates[3][0],o[3]=i.rect.geometry.coordinates[3][1];var s={key:i.key,object:i.obj,"package":i["package"],rect:o,score:i.score,value:i.value};n.push(s)}return{name:e._name,vnode:e._getRects(n)}}).subscribe(this._container.domRenderer.renderAdaptive$)},t.prototype._deactivate=function(){this._disposable.dispose()},t.prototype._getRects=function(e){var t=this,n=[];return e.forEach(function(e){var r=t._coordsToCss(e.rect),o=r.map(function(e){return 100*e+"%"}),s={style:{bottom:o[3],left:o[0],right:o[2],top:o[1]}};n.push(i.h("div.Rect",s,[i.h("span",{style:{color:"red"},textContent:e.value},[])]))}),i.h("div.rectContainer",{},n)},t.prototype._coordsToCss=function(e){var t=e.concat();return t[2]=1-t[2],t[3]=1-t[3],t},t.componentName="detection",t}(o.Component);n.DetectionComponent=s,o.ComponentService.register(s),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Component":270,"virtual-dom":226}],296:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Edge"),s=e("../Geo"),a=e("../Component"),u=function(e){function t(t,n,r){e.call(this,t,n,r),this._offsetScale=1,this._arrowOffset=62,this._innerArrowOffset=25,this._dropShadowOffset=3,this._steps=[o.EdgeDirection.StepForward,o.EdgeDirection.StepBackward,o.EdgeDirection.StepLeft,o.EdgeDirection.StepRight],this._turns=[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"}return r(t,e),Object.defineProperty(t.prototype,"defaultConfiguration",{get:function(){return{offsetScale:1}},enumerable:!0,configurable:!0}),t.prototype._activate=function(){var e=this;this._spatial=new s.Spatial,this._currentKey=null,this._currentPlaneRotation=0,this._currentUpRotation=0,this._rotationEpsilon=.5*Math.PI/180,this._configurationSubscription=this._configuration$.subscribe(function(t){e._offsetScale=Math.max(1,t.offsetScale)}),this._stateSubscription=this._navigator.stateService.currentState$.map(function(t){var n=t.state.currentNode,r=t.state.camera,i=r.lookat.clone().sub(r.position),o=Math.atan2(i.y,i.x),s=e._spatial.angleToPlane(i.toArray(),[0,0,1]);if(null==n||n.key===e._currentKey&&Math.abs(e._currentPlaneRotation-o)<e._rotationEpsilon/e._offsetScale&&Math.abs(e._currentUpRotation-s)<e._rotationEpsilon/e._offsetScale)return null;e._currentKey=n.key,e._currentPlaneRotation=o,e._currentUpRotation=s;var a=e._rotationFromCamera(t.state.camera),u=15*Math.PI/32-a.theta,c=Math.min(.8,Math.max(.6,-1.8*u/Math.PI+.8)),h=[],l=[];return n.pano?h=h.concat(e._createPanoArrows(n,a,c)):(h=h.concat(e._createPerspectiveToPanoArrows(n,a,c)),h=h.concat(e._createStepArrows(n,a,c)),l=l.concat(e._createTurnArrows(n))),{name:e._name,vnode:e._getVNodeContainer(h,l,a,n.pano)}}).filter(function(e){return null!=e}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._stateSubscription.dispose(),this._configurationSubscription.dispose()},t.prototype._createStepArrows=function(e,t,n){for(var r=[],i=0,o=e.edges;i<o.length;i++){var s=o[i],a=s.data.direction;-1!==this._steps.indexOf(a)&&r.push(this._createVNodeByDirection(s.data.worldMotionAzimuth,t,n,a))}return r},t.prototype._createPerspectiveToPanoArrows=function(e,t,n){for(var r=[],i=0,s=e.edges;i<s.length;i++){var a=s[i];a.data.direction===o.EdgeDirection.Pano&&r.push(this._createVNodeByKey(a.data.worldMotionAzimuth,t,n,this._innerArrowOffset,a.to,"DirectionsArrowPano"))}return r},t.prototype._createPanoArrows=function(e,t,n){for(var r=[],i=0,s=e.edges;i<s.length;i++){var a=s[i],u=a.data.direction;u===o.EdgeDirection.Pano?r.push(this._createVNodeByKey(a.data.worldMotionAzimuth,t,n,this._arrowOffset,a.to,"DirectionsArrowPano")):this._steps.indexOf(u)>-1&&r.push(this._createPanoToPerspectiveArrow(a.data.worldMotionAzimuth,t,n,u,a.to))}return r},t.prototype._createTurnArrows=function(e){for(var t=[],n=0,r=e.edges;n<r.length;n++){var i=r[n],o=i.data.direction,s=this._turnNames[o];-1!==this._turns.indexOf(o)&&t.push(this._createVNodeByTurn(s,o))}return t},t.prototype._createPanoToPerspectiveArrow=function(e,t,n,r,i){var s=Math.PI/8,a=t.phi;switch(r){case o.EdgeDirection.StepBackward:a=t.phi-Math.PI;break;case o.EdgeDirection.StepLeft:a=t.phi+Math.PI/2;break;case o.EdgeDirection.StepRight:a=t.phi-Math.PI/2}return Math.abs(this._spatial.wrapAngle(e-a))<s?this._createVNodeByKey(e,t,n,this._arrowOffset,i,"DirectionsArrowStep"):this._createVNodeDisabled(e,t)},t.prototype._rotationFromCamera=function(e){var t=e.lookat.clone().sub(e.position),n=t.clone().dot(e.up),r=t.clone().sub(e.up.clone().multiplyScalar(n)),i=Math.atan2(r.y,r.x),o=Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1]);return{phi:i,theta:o}},t.prototype._calcTranslation=function(e){return[Math.cos(e),Math.sin(e)]},t.prototype._calcShadowTranslation=function(e,t){var n=this._spatial.wrapAngle(e-t);return this._calcTranslation(n)},t.prototype._createVNodeByKey=function(e,t,n,r,i,o){var s=this,a=function(e){s._navigator.moveToKey(i).subscribe()};return this._createVNode(e,t,n,r,o,a)},t.prototype._createVNodeDisabled=function(e,t){return this._createVNode(e,t,.2,this._arrowOffset,"DirectionsArrowDisabled")},t.prototype._createVNodeByDirection=function(e,t,n,r){var i=this,o=function(e){i._navigator.moveDir(r).subscribe()};return this._createVNode(e,t,n,this._arrowOffset,"DirectionsArrowStep",o)},t.prototype._createVNodeByTurn=function(e,t){var n=this,r=function(e){n._navigator.moveDir(t).subscribe()};return i.h("div."+e,{onclick:r},[])},t.prototype._createVNode=function(e,t,n,r,o,s){var a=this._calcTranslation(e),u=-this._offsetScale*r*a[1],c=-this._offsetScale*r*a[0],h=this._calcShadowTranslation(e,t.phi),l=-this._offsetScale*this._dropShadowOffset*h[1],p=this._offsetScale*this._dropShadowOffset*h[0],f=-this._spatial.radToDeg(e),d="drop-shadow("+l+"px "+p+"px 1px rgba(0,0,0,0.8))",m="translate("+u+"px, "+c+"px) rotate("+f+"deg)",v={style:{"-webkit-filter":d,filter:d,opacity:""+n,transform:m}};return null!=s&&(v.onclick=s),i.h("div."+o,v,[])},t.prototype._getVNodePanoIndication=function(e){return e?i.h("div.PanoIndication",{},[]):void 0},t.prototype._getVNodeContainer=function(e,t,n,r){var o=325+175*(this._offsetScale-1),s=this._spatial.radToDeg(n.phi),a={transform:"perspective("+o+"px) rotateX(60deg) rotateZ("+s+"deg)"};return i.h("div",{},[this._getVNodePanoIndication(r),i.h("div.DirectionsWrapper",{},[t,i.h("div.Directions",{style:a},e)])])},t.componentName="direction",t}(a.Component);n.DirectionComponent=u,a.ComponentService.register(u),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../Component":270,"../Edge":271,"../Geo":273,"virtual-dom":226}],297:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Component"),s=function(e){function t(t,n,r){e.call(this,t,n,r),this._canvasId=n.id+"-"+this._name}return r(t,e),t.prototype._activate=function(){var e=this;this._disposable=this._container.domRenderer.element$.combineLatest(this._navigator.stateService.currentNode$,function(t,n){var r=document.getElementById(e._canvasId);return{canvas:r,node:n}}).subscribe(function(e){var t=e.canvas,n=e.node;if(!n||!t)return null;var r=t.getContext("2d"),i=t.clientWidth,o=t.clientHeight,s=t.parentElement;t.width=s.offsetWidth,t.height=s.offsetHeight,r.drawImage(n.image,0,0,i,o)}),this._container.domRenderer.renderAdaptive$.onNext({name:this._name,vnode:i.h("canvas#"+this._canvasId,[])})},t.prototype._deactivate=function(){this._disposable.dispose()},t.componentName="image",t}(o.Component);n.ImageComponent=s,o.ComponentService.register(s),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Component":270,"virtual-dom":226}],298:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("rx"),o=e("../Edge"),s=e("../Component"),a=e("../Geo"),u=function(e){function t(t,n,r){e.call(this,t,n,r),this._spatial=new a.Spatial,this._perspectiveDirections=[o.EdgeDirection.StepForward,o.EdgeDirection.StepBackward,o.EdgeDirection.StepLeft,o.EdgeDirection.StepRight,o.EdgeDirection.TurnLeft,o.EdgeDirection.TurnRight,o.EdgeDirection.TurnU]}return r(t,e),t.prototype._activate=function(){var e=this;this._disposable=i.Observable.fromEvent(document,"keydown").withLatestFrom(this._navigator.stateService.currentState$,function(e,t){return{event:e,frame:t}}).subscribe(function(t){t.frame.state.currentNode.pano?e._navigatePanorama(t.event,t.frame.state.currentNode,t.frame.state.camera):e._navigatePerspective(t.event,t.frame.state.currentNode)})},t.prototype._deactivate=function(){this._disposable.dispose()},t.prototype._navigatePanorama=function(e,t,n){var r=0,i=null,s=null,a=this._rotationFromCamera(n).phi;switch(e.keyCode){case 37:r=Math.PI/2+a,i=o.EdgeDirection.StepLeft;break;case 38:if(e.altKey){s=o.EdgeDirection.Next;break}r=a,i=o.EdgeDirection.StepForward;break;case 39:r=-Math.PI/2+a,i=o.EdgeDirection.StepRight;break;case 40:if(e.altKey){s=o.EdgeDirection.Prev;break}r=Math.PI+a,i=o.EdgeDirection.StepBackward;break;default:return}if(e.preventDefault(),null!=s)return void this._moveDir(s,t);r=this._spatial.wrapAngle(r);for(var u=Math.PI/4,c=t.edges.filter(function(e){return e.data.direction===o.EdgeDirection.Pano||e.data.direction===i}),h=Number.MAX_VALUE,l=null,p=0,f=c;p<f.length;p++){var d=f[p],m=Math.abs(this._spatial.wrapAngle(d.data.worldMotionAzimuth-r));m<Math.min(h,u)&&(h=m,l=d.to)}null!=l&&this._navigator.moveToKey(l).subscribe(function(e){},function(e){console.error(e)})},t.prototype._rotationFromCamera=function(e){var t=e.lookat.clone().sub(e.position),n=t.clone().dot(e.up),r=t.clone().sub(e.up.clone().multiplyScalar(n)),i=Math.atan2(r.y,r.x),o=Math.PI/2-this._spatial.angleToPlane(t.toArray(),[0,0,1]);return{phi:i,theta:o}},t.prototype._navigatePerspective=function(e,t){var n=null;switch(e.keyCode){case 37:n=e.shiftKey?o.EdgeDirection.TurnLeft:o.EdgeDirection.StepLeft;break;case 38:if(e.altKey){n=o.EdgeDirection.Next;break}n=e.shiftKey?o.EdgeDirection.Pano:o.EdgeDirection.StepForward;break;case 39:n=e.shiftKey?o.EdgeDirection.TurnRight:o.EdgeDirection.StepRight;break;case 40:if(e.altKey){n=o.EdgeDirection.Prev;break}n=e.shiftKey?o.EdgeDirection.TurnU:o.EdgeDirection.StepBackward;break;default:return}e.preventDefault(),this._moveDir(n,t)},t.prototype._moveDir=function(e,t){var n=t.edges.some(function(t){return t.data.direction===e});n&&this._navigator.moveDir(e).subscribe(function(e){},function(e){console.error(e)})},t.componentName="keyboard",t}(s.Component);n.KeyboardComponent=u,s.ComponentService.register(u),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../Component":270,"../Edge":271,"../Geo":273,rx:219}],299:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("underscore"),o=e("virtual-dom"),s=e("../Component"),a=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e=this;this._disposable=this._navigator.loadingService.loading$.combineLatest(this._navigator.graphService.imageLoadingService.loadstatus$,function(t,n){if(!t)return{name:"loading",vnode:e._getBarVNode(100)};for(var r=0,o=0,s=0,a=i.values(n);s<a.length;s++){var u=a[s];u.loaded!==u.total&&(o+=u.loaded,r+=u.total)}var c=100;return 0!==r&&(c=o/r*100),{name:e._name,vnode:e._getBarVNode(c)}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.dispose()},t.prototype._getBarVNode=function(e){var t={},n={};return 100!==e?(t.width=e.toFixed(0)+"%",t.opacity="1"):(t.width="100%",t.opacity="0"),o.h("div.Loading",{style:n},[o.h("div.LoadingBar",{style:t},[])])},t.componentName="loading",t}(s.Component);n.LoadingComponent=a,s.ComponentService.register(a),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Component":270,underscore:221,"virtual-dom":226}],300:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,
|
||
new n)},i=e("rx"),o=e("three"),s=e("../Component"),a=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e=this,t=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).map(function(e){return{clientX:e.clientX,clientY:e.clientY,movementX:e.movementX,movementY:e.movementY}}),n=this._container.touchService.singleTouchMove$.map(function(e){return{clientX:e.clientX,clientY:e.clientY,movementX:e.movementX,movementY:e.movementY}});this._movementSubscription=i.Observable.merge(t,n).withLatestFrom(this._navigator.stateService.currentNode$,function(e,t){return[e,t]}).filter(function(e){return e[1].fullPano}).map(function(e){return e[0]}).withLatestFrom(this._container.renderService.renderCamera$,function(e,t){return[e,t]}).subscribe(function(t){var n=t[0],r=t[1],i=e._container.element,o=i.offsetWidth,s=i.offsetHeight,a=i.getBoundingClientRect(),u=n.clientX-a.left,c=n.clientY-a.top,h=e._unproject(u,c,o,s,r.perspective),l=e._unproject(u-n.movementX,c,o,s,r.perspective),p=e._unproject(u,c-n.movementY,o,s,r.perspective),f=(n.movementX>0?1:-1)*l.angleTo(h),d=(n.movementY>0?-1:1)*p.angleTo(h);e._navigator.stateService.rotate({phi:f,theta:d})}),this._container.mouseService.mouseWheel$.withLatestFrom(this._navigator.stateService.currentNode$,function(e,t){return[e,t]}).filter(function(e){return e[1].fullPano}).map(function(e){return e[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,n){return[e,t,n]}).subscribe(function(t){var n=t[0],r=t[1],i=t[2],o=e._container.element,s=o.offsetWidth,a=o.offsetHeight,u=o.getBoundingClientRect(),c=n.clientX-u.left,h=n.clientY-u.top,l=e._unproject(c,h,s,a,r.perspective),p=i.projectBasic(l.toArray()),f=-3*n.deltaY/a;e._navigator.stateService.zoomIn(f,p)}),this._container.touchService.pinch$.withLatestFrom(this._navigator.stateService.currentNode$,function(e,t){return[e,t]}).filter(function(e){return e[1].fullPano}).map(function(e){return e[0]}).withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,n){return[e,t,n]}).subscribe(function(t){var n=t[0],r=t[1],i=t[2],o=e._container.element,s=o.offsetWidth,a=o.offsetHeight,u=o.getBoundingClientRect(),c=e._unproject(n.centerClientX-u.left,n.centerClientY-u.top,s,a,r.perspective),h=i.projectBasic(c.toArray()),l=3*n.distanceChange/Math.min(a,s);e._navigator.stateService.zoomIn(l,h)}),this._container.mouseService.claimMouse(this._name,0)},t.prototype._deactivate=function(){this._container.mouseService.unclaimMouse(this._name),this._movementSubscription.dispose()},t.prototype._unproject=function(e,t,n,r,i){var s=2*e/n-1,a=1-2*t/r;return new o.Vector3(s,a,1).unproject(i)},t.componentName="mouse",t}(s.Component);n.MouseComponent=a,s.ComponentService.register(a),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Component":270,rx:219,three:220}],301:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Edge"),s=e("../Component"),a=function(e){function t(t,n,r){e.call(this,t,n,r),this._dirNames={},this._dirNames[o.EdgeDirection.StepForward]="Forward",this._dirNames[o.EdgeDirection.StepBackward]="Backward",this._dirNames[o.EdgeDirection.StepLeft]="Left",this._dirNames[o.EdgeDirection.StepRight]="Right",this._dirNames[o.EdgeDirection.TurnLeft]="Turnleft",this._dirNames[o.EdgeDirection.TurnRight]="Turnright",this._dirNames[o.EdgeDirection.TurnU]="Turnaround"}return r(t,e),t.prototype._activate=function(){var e=this;this._disposable=this._navigator.stateService.currentNode$.map(function(t){for(var n=[],r=0,o=t.edges;r<o.length;r++){var s=o[r],a=s.data.direction,u=e._dirNames[a];null!=u&&n.push(e._createVNode(a,u))}return{name:e._name,vnode:i.h("div.NavigationComponent",n)}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.dispose()},t.prototype._createVNode=function(e,t){var n=this;return i.h("span.Direction.Direction"+t,{onclick:function(t){n._navigator.moveDir(e).first().subscribe()}},[])},t.componentName="navigation",t}(s.Component);n.NavigationComponent=a,s.ComponentService.register(a),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Component":270,"../Edge":271,"virtual-dom":226}],302:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../Component"),o=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype._activate=function(){},t.prototype._deactivate=function(){},t.componentName="none",t}(i.Component);n.NoneComponent=o,i.ComponentService.register(o),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../Component":270}],303:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("rx"),o=e("../Edge"),s=e("../Component"),a=function(e){function t(t,n,r){e.call(this,t,n,r),this._configurationOperation$=new i.Subject,this._stop$=new i.Subject,this._nodesAhead=5}return r(t,e),t.prototype._activate=function(){var e=this;this._configurationSubscription=this._configurationOperation$.scan(function(e,t){return t(e)},{playing:!1})["finally"](function(){null!=e._playingSubscription&&(e._navigator.stateService.cutNodes(),e._stop())}).subscribe(),this._configuration$.map(function(t){return function(n){return t.playing!==n.playing&&(e._navigator.stateService.cutNodes(),t.playing?e._play():e._stop()),n.playing=t.playing,n}}).subscribe(this._configurationOperation$),this._stop$.map(function(){return function(t){return t.playing&&e._stop(),t.playing=!1,t}}).subscribe(this._configurationOperation$)},t.prototype._deactivate=function(){this.stop(),this._configurationSubscription.dispose()},Object.defineProperty(t.prototype,"defaultConfiguration",{get:function(){return{direction:o.EdgeDirection.Next,playing:!1}},enumerable:!0,configurable:!0}),t.prototype.play=function(){this.configure({playing:!0})},t.prototype.stop=function(){this.configure({playing:!1})},t.prototype.setDirection=function(e){this.configure({direction:e})},t.prototype._play=function(){var e=this;this._playingSubscription=this._navigator.stateService.currentState$.filter(function(t){return t.state.nodesAhead<e._nodesAhead}).map(function(e){return e.state.lastNode}).distinctUntilChanged(function(e){return e.key}).withLatestFrom(this._configuration$,function(e,t){return[e,t.direction]}).flatMapLatest(function(t){return e._navigator.graphService.nextNode$(t[0],t[1])}).subscribe(function(t){e._navigator.stateService.appendNodes([t])},function(t){e._stop$.onNext(null)}),this.fire(t.playingchanged,!0)},t.prototype._stop=function(){this._playingSubscription.dispose(),this._playingSubscription=null,this.fire(t.playingchanged,!1)},t.componentName="player",t.playingchanged="playingchanged",t}(s.Component);n.PlayerComponent=a,s.ComponentService.register(a),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Component":270,"../Edge":271,rx:219}],304:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("underscore"),o=e("rx"),s=e("virtual-dom"),a=e("../Component"),u=function(){function e(){}return e}(),c=function(){function e(){}return e}(),h=function(){function e(){this.nodeInstructions=[],this.nodeInstructionsOrdered=[]}return e}(),l=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e,t=this;e=this._navigator.stateService.currentState$.filter(function(e){return e.id%2===0}).filter(function(e){return e.state.nodesAhead<15}).distinctUntilChanged(function(e){return e.state.lastNode.key});var n;n=this.configuration$.selectMany(function(e){return o.Observable.from(e.paths)}).distinct(function(e){return e.sequenceKey}).flatMap(function(e){return o.Observable.fromPromise(t._navigator.apiV2.s.get(e.sequenceKey))}).combineLatest(this.configuration$,function(e,t){for(var n=0,r=[],i=0,o=t.paths;i<o.length;i++){var s=o[i];if(s.sequenceKey===e.key){for(var a=[],u=!1,c=0,h=e.keys;c<h.length;c++){var l=h[c];if(s.startKey===l&&(u=!0),u){for(var p=null,f=0,d=s.infoKeys;f<d.length;f++){var m=d[f];m.key===l&&(p=m.description)}a.push({description:p,key:l})}s.stopKey===l&&(u=!1)}r.push({nodeInstructions:a,place:n})}n++}return r}).scan(function(e,t){for(var n=0,r=t;n<r.length;n++){var o=r[n];e.nodeInstructionsOrdered[o.place]=o.nodeInstructions}return e.nodeInstructions=i.flatten(e.nodeInstructionsOrdered),e},new h),this._disposable=e.combineLatest(n,this.configuration$,function(e,t,n){return{conf:n,frame:e,routeTrack:t}}).scan(function(e,n){return void 0===n.conf.playing||n.conf.playing?(e.routeTrack=n.routeTrack,e.currentNode=n.frame.state.currentNode,e.lastNode=n.frame.state.lastNode,e.playing=!0):(t._navigator.stateService.cutNodes(),e.playing=!1),e},new c).filter(function(e){return e.playing}).filter(function(e){for(var t=0,n=e.routeTrack.nodeInstructions;t<n.length;t++){var r=n[t];if(r&&r.key===e.lastNode.key)return!0}return!1}).distinctUntilChanged(function(e){return e.lastNode.key}).selectMany(function(e){for(var n=0,r=0,i=e.routeTrack.nodeInstructions;r<i.length;r++){var s=i[r];if(s.key===e.lastNode.key)break;n++}var a=e.routeTrack.nodeInstructions[n+1];return a?t._navigator.graphService.node$(a.key):o.Observable.just(null)}).combineLatest(this.configuration$,function(e,t){return{conf:t,node:e}}).filter(function(e){return null!==e.node&&e.conf.playing}).pluck("node").subscribe(this._navigator.stateService.appendNode$),this._disposableDescription=this._navigator.stateService.currentNode$.combineLatest(n,this.configuration$,function(e,t,n){if(void 0!==n.playing&&!n.playing)return"quit";for(var r=null,i=0,o=t.nodeInstructions;i<o.length;i++){var s=o[i];if(s.key===e.key){r=s.description;break}}return r}).scan(function(e,t){return t!==e.description&&null!==t?(e.description=t,e.showsLeft=6):e.showsLeft--,"quit"===t&&(e.description=null),e},new u).map(function(e){return e.showsLeft>0&&e.description?{name:t._name,vnode:t._getRouteAnnotationNode(e.description)}:{name:t._name,vnode:s.h("div",[])}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._disposable.dispose(),this._disposableDescription.dispose()},t.prototype.play=function(){this.configure({playing:!0})},t.prototype.stop=function(){this.configure({playing:!1})},t.prototype._getRouteAnnotationNode=function(e){return s.h("div.RouteFrame",{},[s.h("p",{textContent:e},[])])},t.componentName="route",t}(a.Component);n.RouteComponent=l,a.ComponentService.register(l),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=l},{"../Component":270,rx:219,underscore:221,"virtual-dom":226}],305:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../Component"),s=e("../Edge"),a=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e=this;this._nodeSubscription=this._navigator.stateService.currentNode$.map(function(t){var n=e._createSequenceArrows(t);return{name:e._name,vnode:e._getVNodeContainer(n)}}).subscribe(this._container.domRenderer.render$)},t.prototype._deactivate=function(){this._nodeSubscription.dispose()},t.prototype._createSequenceArrows=function(e){for(var t=this,n=!1,r=!1,o=0,a=e.edges;o<a.length;o++){var u=a[o];u.data.direction===s.EdgeDirection.Next&&(n=!0),u.data.direction===s.EdgeDirection.Prev&&(r=!0)}var c="div.NextInSeq"+(n?"":".InSeqDisabled"),h="div.PrevInSeq"+(r?"":".InSeqDisabled"),l=n?{onclick:function(e){t._navigator.moveDir(s.EdgeDirection.Next).subscribe()}}:{},p=r?{onclick:function(e){t._navigator.moveDir(s.EdgeDirection.Prev).subscribe()}}:{};return[i.h(c,l,[]),i.h(h,p,[])]},t.prototype._getVNodeContainer=function(e){return i.h("div",{},[i.h("div.InSeq",{},e)])},t.componentName="sequence",t}(o.Component);n.SequenceComponent=a,o.ComponentService.register(a),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Component":270,"../Edge":271,"virtual-dom":226}],306:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("three"),o=e("../Component"),s=e("../Geo"),a=e("../Render"),u=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e=this;this._scene=new i.Scene,this._key="",this._alpha=0,this._camera=new s.Camera;var t=this._render.bind(this);this._disposable=this._navigator.stateService.currentState$.map(function(n){var r=n.state,i=e._updateAlpha(r.alpha);return i=e._updateSphere(r.camera,r.currentNode)||i,{name:e._name,render:{frameId:n.id,needsRender:i,render:t,stage:a.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$)},t.prototype._deactivate=function(){this._disposeSphere(),this._disposable.dispose()},t.prototype._updateAlpha=function(e){return e===this._alpha?!1:(this._alpha=e,!0)},t.prototype._updateSphere=function(e,t){if(null==t||t.key===this._key)return!1;this._key=t.key,this._disposeSphere();var n=e.lookat.clone().sub(e.position).normalize().multiplyScalar(10).add(e.lookat);this._sphere=this._createSphere(),this._sphere.position.copy(n),this._scene.add(this._sphere)},t.prototype._render=function(e,t){null!=this._sphere&&(this._sphere.material.opacity=this._alpha>.5?this._alpha:1-this._alpha),t.render(this._scene,e)},t.prototype._createSphere=function(){var e=new i.SphereGeometry(1.5,32,32),t=new i.Color(Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())),n=new i.MeshBasicMaterial({color:t.getHex(),depthWrite:!0,transparent:!0}),r=new i.Mesh(e,n);return r},t.prototype._disposeSphere=function(){null!=this._sphere&&(this._scene.remove(this._sphere),this._sphere.geometry.dispose(),this._sphere.material.dispose(),this._sphere=null)},t.componentName="sphere",t}(o.Component);n.SphereComponent=u,o.ComponentService.register(u),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../Component":270,"../Geo":273,"../Render":276,three:220}],307:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("rx"),o=e("../../Component"),s=e("../../Render"),a=e("../../Utils"),u=function(e){function t(t,n,r){e.call(this,t,n,r),this._rendererOperation$=new i.Subject,this._rendererCreator$=new i.Subject,this._rendererDisposer$=new i.Subject,this._renderer$=this._rendererOperation$.scan(function(e,t){return t(e)},null).filter(function(e){return null!=e}).distinctUntilChanged(function(e){return e.frameId}),this._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 o.ImagePlaneGLRenderer}}).subscribe(this._rendererOperation$),this._rendererDisposer$.map(function(){return function(e){return e.dispose(),null}}).subscribe(this._rendererOperation$)}return r(t,e),t.prototype._activate=function(){var e=this;this._rendererSubscription=this._renderer$.map(function(t){var n={name:e._name,render:{frameId:t.frameId,needsRender:t.needsRender,render:t.render.bind(t),stage:s.GLRenderStage.Background}};return t.clearNeedsRender(),n}).subscribe(this._container.glRenderer.render$),this._rendererCreator$.onNext(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(e){return function(t){return t.updateFrame(e),t}}).subscribe(this._rendererOperation$),this._nodeSubscription=this._navigator.stateService.currentNode$.filter(function(e){return e.pano?a.Settings.maxImageSize>a.Settings.basePanoramaSize:a.Settings.maxImageSize>a.Settings.baseImageSize}).flatMapLatest(function(e){return i.Observable.just(null).delay(2e3).flatMap(function(){var t=new o.TextureLoader;return t.load(e.key,a.Settings.maxImageSize)}).zip(i.Observable.just(e),function(e,t){return[e,t]})}).map(function(e){return function(t){return t.updateTexture(e[0],e[1]),t}}).subscribe(this._rendererOperation$)},t.prototype._deactivate=function(){this._rendererDisposer$.onNext(null),this._rendererSubscription.dispose(),this._stateSubscription.dispose(),this._nodeSubscription.dispose()},t.componentName="imageplane",t}(o.Component);n.ImagePlaneComponent=u,o.ComponentService.register(u),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../../Component":270,"../../Render":276,"../../Utils":278,rx:219}],308:[function(e,t,n){"use strict";var r=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){var n=e.pano?this._createImageSphere(e,t):this._createImagePlane(e,t);return n},e.prototype._createImageSphere=function(e,t){var n=this._createTexture(e.image),i=this._createSphereMaterialParameters(t,n),o=new r.ShaderMaterial(i),s=this._useMesh(t,e)?new r.Mesh(this._getImageSphereGeo(t,e),o):new r.Mesh(this._getFlatImageSphereGeo(t),o);return s},e.prototype._createImagePlane=function(e,t){var n=this._createTexture(e.image),i=this._createPlaneMaterialParameters(t,n),o=new r.ShaderMaterial(i),s=this._useMesh(t,e)?this._getImagePlaneGeo(t,e):this._getFlatImagePlaneGeo(t);return new r.Mesh(s,o)},e.prototype._createSphereMaterialParameters=function(e,t){var n=e.gpano,o=2*Math.PI*n.CroppedAreaImageWidthPixels/n.FullPanoWidthPixels,s=Math.PI*n.CroppedAreaImageHeightPixels/n.FullPanoHeightPixels,a={depthWrite:!1,fragmentShader:i.ImagePlaneShaders.equirectangular.fragment,side:r.DoubleSide,transparent:!0,uniforms:{opacity:{type:"f",value:1},phiLength:{type:"f",value:o},projectorMat:{type:"m4",value:e.rt},projectorTex:{type:"t",value:t},thetaLength:{type:"f",value:s}},vertexShader:i.ImagePlaneShaders.equirectangular.vertex};return a},e.prototype._createPlaneMaterialParameters=function(e,t){var n={depthWrite:!1,fragmentShader:i.ImagePlaneShaders.perspective.fragment,side:r.DoubleSide,transparent:!0,uniforms:{bbox:{type:"v4",value:new r.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};return n},e.prototype._createTexture=function(e){var t=new r.Texture(e);return t.minFilter=r.LinearFilter,t.needsUpdate=!0,t},e.prototype._useMesh=function(e,t){return t.mesh.vertices.length&&e.scale>.01&&e.scale<50},e.prototype._getImageSphereGeo=function(e,t){for(var n=(new r.Matrix4).getInverse(e.srt),i=5*e.scale,o=this._imageSphereRadius*e.scale,s=t.mesh.vertices,a=s.length/3,u=new Float32Array(s.length),c=0;a>c;++c){var h=3*c,l=s[h+0],p=s[h+1],f=s[h+2],d=Math.sqrt(l*l+p*p+f*f),m=Math.max(i,Math.min(d,o)),v=m/d,g=new r.Vector3(l*v,p*v,f*v);g.applyMatrix4(n),u[h+0]=g.x,u[h+1]=g.y,u[h+2]=g.z}for(var y=t.mesh.faces,_=new Uint16Array(y.length),c=0;c<y.length;++c)_[c]=y[c];var b=new r.BufferGeometry;return b.addAttribute("position",new r.BufferAttribute(u,3)),b.setIndex(new r.BufferAttribute(_,1)),b},e.prototype._getImagePlaneGeo=function(e,t){for(var n=(new r.Matrix4).getInverse(e.srt),i=5*e.scale,o=this._imagePlaneDepth*e.scale,s=t.mesh.vertices,a=s.length/3,u=new Float32Array(s.length),c=0;a>c;++c){var h=3*c,l=s[h+0],p=s[h+1],f=s[h+2],d=Math.max(i,Math.min(f,o)),m=d/f,v=new r.Vector3(l*m,p*m,d);v.applyMatrix4(n),u[h+0]=v.x,u[h+1]=v.y,u[h+2]=v.z}for(var g=t.mesh.faces,y=new Uint16Array(g.length),c=0;c<g.length;++c)y[c]=g[c];var _=new r.BufferGeometry;return _.addAttribute("position",new r.BufferAttribute(u,3)),_.setIndex(new r.BufferAttribute(y,1)),_},e.prototype._getFlatImageSphereGeo=function(e){var t=e.gpano,n=2*Math.PI*t.CroppedAreaLeftPixels/t.FullPanoWidthPixels,i=2*Math.PI*t.CroppedAreaImageWidthPixels/t.FullPanoWidthPixels,o=Math.PI*t.CroppedAreaTopPixels/t.FullPanoHeightPixels,s=Math.PI*t.CroppedAreaImageHeightPixels/t.FullPanoHeightPixels,a=new r.SphereGeometry(this._imageSphereRadius,20,40,n-Math.PI/2,i,o,s);return a.applyMatrix((new r.Matrix4).getInverse(e.rt)),a},e.prototype._getFlatImagePlaneGeo=function(e){var t=e.width,n=e.height,i=Math.max(t,n),o=t/2/i,s=n/2/i,a=[];a.push(e.pixelToVertex(-o,-s,this._imagePlaneDepth)),a.push(e.pixelToVertex(o,-s,this._imagePlaneDepth)),a.push(e.pixelToVertex(o,s,this._imagePlaneDepth)),a.push(e.pixelToVertex(-o,s,this._imagePlaneDepth));for(var u=new Float32Array(12),c=0;c<a.length;c++){var h=3*c;u[h+0]=a[c].x,u[h+1]=a[c].y,u[h+2]=a[c].z}var l=new Uint16Array(6);l[0]=0,l[1]=1,l[2]=3,l[3]=1,l[4]=2,l[5]=3;var p=new r.BufferGeometry;return p.addAttribute("position",new r.BufferAttribute(u,3)),p.setIndex(new r.BufferAttribute(l,1)),p},e}();n.ImagePlaneFactory=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../../Component":270,three:220}],309:[function(e,t,n){"use strict";var r=e("../../Component"),i=e("../../Geo"),o=function(){function e(){this._imagePlaneFactory=new r.ImagePlaneFactory,this._imagePlaneScene=new r.ImagePlaneScene,this._alpha=0,this._alphaOld=0,this._fadeOutSpeed=.05,this._lastCamera=new i.Camera,this._epsilon=1e-6,this._currentKey=null,this._previousKey=null,this._frameId=0,this._needsRender=!1}return Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.updateFrame=function(e){this._updateFrameId(e.id),this._needsRender=this._updateAlpha(e.state.alpha)||this._needsRender,this._needsRender=this._updateAlphaOld(e.state.alpha)||this._needsRender,this._needsRender=this._updateImagePlanes(e.state)||this._needsRender},e.prototype.updateTexture=function(e,t){if(this._currentKey===t.key){this._needsRender=!0;for(var n=0,r=this._imagePlaneScene.imagePlanes;n<r.length;n++){var i=r[n],o=i.material,s=o.uniforms.projectorTex.value;null!=s&&s.dispose(),o.uniforms.projectorTex.value=e}}},e.prototype.render=function(e,t){for(var n=this._imagePlaneScene.imagePlanesOld.length?1:this._alpha,r=0,i=this._imagePlaneScene.imagePlanes;r<i.length;r++){var o=i[r];o.material.uniforms.opacity.value=n}for(var s=0,a=this._imagePlaneScene.imagePlanesOld;s<a.length;s++){var o=a[s];o.material.uniforms.opacity.value=this._alphaOld}t.render(this._imagePlaneScene.scene,e),t.render(this._imagePlaneScene.sceneOld,e);for(var u=0,c=this._imagePlaneScene.imagePlanes;u<c.length;u++){var o=c[u];o.material.uniforms.opacity.value=this._alpha}t.render(this._imagePlaneScene.scene,e)},e.prototype.clearNeedsRender=function(){this._needsRender=!1},e.prototype.dispose=function(){this._imagePlaneScene.clear()},e.prototype._updateFrameId=function(e){this._frameId=e},e.prototype._updateAlpha=function(e){return e===this._alpha?!1:(this._alpha=e,!0)},e.prototype._updateAlphaOld=function(e){return 1>e||0===this._alphaOld?!1:(this._alphaOld=Math.max(0,this._alphaOld-this._fadeOutSpeed),!0)},e.prototype._updateImagePlanes=function(e){if(null==e.currentNode||e.currentNode.key===this._currentKey)return!1;if(this._previousKey=null!=e.previousNode?e.previousNode.key:null,null!=this._previousKey&&this._previousKey!==this._currentKey){var t=this._imagePlaneFactory.createMesh(e.previousNode,e.previousTransform);this._imagePlaneScene.updateImagePlanes([t])}this._currentKey=e.currentNode.key;var n=this._imagePlaneFactory.createMesh(e.currentNode,e.currentTransform);return this._imagePlaneScene.updateImagePlanes([n]),this._alphaOld=1,!0},e}();n.ImagePlaneGLRenderer=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../../Component":270,"../../Geo":273}],310:[function(e,t,n){"use strict";var r=e("three"),i=function(){function e(){this.scene=new r.Scene,this.sceneOld=new r.Scene,this.imagePlanes=[],this.imagePlanesOld=[]}return e.prototype.updateImagePlanes=function(e){this._dispose(this.imagePlanesOld,this.sceneOld);for(var t=0,n=this.imagePlanes;t<n.length;t++){var r=n[t];this.scene.remove(r),this.sceneOld.add(r)}for(var i=0,o=e;i<o.length;i++){var r=o[i];this.scene.add(r)}this.imagePlanesOld=this.imagePlanes,this.imagePlanes=e},e.prototype.addImagePlanes=function(e){for(var t=0,n=e;t<n.length;t++){var r=n[t];this.scene.add(r),this.imagePlanes.push(r)}},e.prototype.addImagePlanesOld=function(e){for(var t=0,n=e;t<n.length;t++){var r=n[t];this.sceneOld.add(r),this.imagePlanesOld.push(r)}},e.prototype.setImagePlanes=function(e){this._clear(),this.addImagePlanes(e)},e.prototype.setImagePlanesOld=function(e){this._clearOld(),this.addImagePlanesOld(e)},e.prototype.clear=function(){this._clear(),this._clearOld()},e.prototype._clear=function(){this._dispose(this.imagePlanes,this.scene),this.imagePlanes.length=0},e.prototype._clearOld=function(){this._dispose(this.imagePlanesOld,this.sceneOld),this.imagePlanesOld.length=0},e.prototype._dispose=function(e,t){for(var n=0,r=e;n<r.length;n++){var i=r[n];t.remove(i),i.geometry.dispose(),i.material.dispose();var o=i.material.uniforms.projectorTex.value;null!=o&&o.dispose()}},e}();n.ImagePlaneScene=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{three:220}],311:[function(e,t,n){"use strict";var r=(e("path"),function(){function e(){}return e.equirectangular={fragment:"#ifdef GL_ES\nprecision highp float;\n#endif\n\n#define tau 6.28318530718\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float phiLength;\nuniform float thetaLength;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vec3 b = normalize(vRstq.xyz);\n float lat = -asin(b.y);\n float lon = atan(b.x, b.z);\n float x = lon / phiLength + 0.5;\n float y = lat / thetaLength + 0.5;\n vec4 baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},e.perspective={fragment:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform vec4 bbox;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float x = vRstq.x / vRstq.w;\n float y = vRstq.y / vRstq.w;\n\n vec4 baseColor;\n if (x > bbox[0] && y > bbox[1] && x < bbox[2] && y < bbox[3]) {\n baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}",vertex:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"},e}());n.ImagePlaneShaders=r},{path:185}],312:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("rx"),o=e("virtual-dom"),s=e("../../State"),a=e("../../Render"),u=e("../../Utils"),c=e("../../Component"),h=function(){function e(){this._imagePlaneFactory=new c.ImagePlaneFactory,this._imagePlaneScene=new c.ImagePlaneScene,this._currentKey=null,this._previousKey=null,this._currentPano=!1,this._frameId=0,this._glNeedsRender=!1,this._domNeedsRender=!0,this._motionless=!1,this._curtain=1}return Object.defineProperty(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._motionless||this._currentPano},enumerable:!0,configurable:!0}),e.prototype.update=function(e){this._updateFrameId(e.id);var t=this._updateImagePlanes(e.state);t=this._updateCurtain(e.state.alpha)||t,this._glNeedsRender=t||this._glNeedsRender,this._domNeedsRender=t||this._domNeedsRender},e.prototype.updateTexture=function(e,t){var n=t.key===this._currentKey?this._imagePlaneScene.imagePlanes:t.key===this._previousKey?this._imagePlaneScene.imagePlanesOld:[];if(0!==n.length){this._glNeedsRender=!0;for(var r=0,i=n;r<i.length;r++){var o=i[r],s=o.material.uniforms.projectorTex.value;null!=s&&s.dispose(),o.material.uniforms.projectorTex.value=e}}},e.prototype.render=function(e,t){this.disabled||t.render(this._imagePlaneScene.sceneOld,e),t.render(this._imagePlaneScene.scene,e)},e.prototype.dispose=function(){this._imagePlaneScene.clear()},e.prototype.clearGLNeedsRender=function(){this._glNeedsRender=!1},e.prototype.clearDomNeedsRender=function(){this._domNeedsRender=!1},e.prototype._updateFrameId=function(e){this._frameId=e},e.prototype._updateImagePlanes=function(e){if(null!=e.currentNode){var t=!1;return null!=e.previousNode&&this._previousKey!==e.previousNode.key&&(t=!0,this._previousKey=e.previousNode.key,this._motionless=e.motionless,this._imagePlaneScene.setImagePlanesOld([this._imagePlaneFactory.createMesh(e.previousNode,e.previousTransform)])),this._currentKey!==e.currentNode.key&&(t=!0,this._currentKey=e.currentNode.key,this._currentPano=e.currentNode.pano,this._motionless=e.motionless,this._imagePlaneScene.setImagePlanes([this._imagePlaneFactory.createMesh(e.currentNode,e.currentTransform)])),t}},e.prototype._updateCurtain=function(e){if(this.disabled||Math.abs(this._curtain-e)<.001)return!1;this._curtain=e;for(var t=0,n=this._imagePlaneScene.imagePlanes;t<n.length;t++){var r=n[t],i=r.material,o=i.uniforms.bbox.value;o.z=this._curtain}return!0},e}(),l=function(e){function t(t,n,r){e.call(this,t,n,r),this._sliderStateOperation$=new i.Subject,this._sliderStateCreator$=new i.Subject,this._sliderStateDisposer$=new i.Subject,this._sliderState$=this._sliderStateOperation$.scan(function(e,t){return t(e)},null).filter(function(e){return null!=e}).distinctUntilChanged(function(e){return e.frameId}),this._sliderStateCreator$.map(function(){return function(e){if(null!=e)throw new Error("Multiple slider states can not be created at the same time");return new h}}).subscribe(this._sliderStateOperation$),this._sliderStateDisposer$.map(function(){return function(e){return e.dispose(),null}}).subscribe(this._sliderStateOperation$)}return r(t,e),t.prototype.setKeys=function(e){this.configure({keys:e})},t.prototype.setInitialPosition=function(e){this.configure({initialPosition:e})},t.prototype.setSliderVisible=function(e){this.configure({sliderVisible:e})},t.prototype._activate=function(){var e=this;this._container.mouseService.preventDefaultMouseDown$.onNext(!1),this._container.touchService.preventDefaultTouchMove$.onNext(!1),
|
||
i.Observable.combineLatest(this._navigator.stateService.state$,this._configuration$,function(e,t){return[e,t]}).first().subscribe(function(t){if(t[0]===s.State.Traversing){e._navigator.stateService.wait();var n=t[1].initialPosition;e._navigator.stateService.moveTo(null!=n?n:1)}}),this._glRenderSubscription=this._sliderState$.map(function(t){var n={name:e._name,render:{frameId:t.frameId,needsRender:t.glNeedsRender,render:t.render.bind(t),stage:a.GLRenderStage.Background}};return t.clearGLNeedsRender(),n}).subscribe(this._container.glRenderer.render$),this._domRenderSubscription=this._sliderState$.filter(function(e){return e.domNeedsRender}).map(function(t){var n=o.h("input.SliderControl",{max:1e3,min:0,type:"range",value:1e3*t.curtain},[]),r=t.disabled||!t.sliderVisible?null:o.h("div.SliderWrapper",{},[n]),i={name:e._name,vnode:r};return t.clearDomNeedsRender(),i}).subscribe(this._container.domRenderer.render$),this._elementSubscription=this._container.domRenderer.element$.map(function(e){var t=e.getElementsByClassName("SliderControl"),n=t.length>0?t[0]:null;return n}).filter(function(e){return null!=e}).flatMapLatest(function(e){return i.Observable.fromEvent(e,"input")}).map(function(e){return Number(e.target.value)/1e3}).subscribe(function(t){e._navigator.stateService.moveTo(t)}),this._sliderStateCreator$.onNext(null),this._stateSubscription=this._navigator.stateService.currentState$.map(function(e){return function(t){return t.update(e),t}}).subscribe(this._sliderStateOperation$),this._setSliderVisibleSubscription=this._configuration$.map(function(e){return null==e.sliderVisible||e.sliderVisible}).distinctUntilChanged().map(function(e){return function(t){return t.sliderVisible=e,t}}).subscribe(this._sliderStateOperation$),this._setKeysSubscription=this._configuration$.filter(function(e){return null!=e.keys}).flatMapLatest(function(t){return i.Observable.zip(e._navigator.graphService.node$(t.keys.background),e._navigator.graphService.node$(t.keys.foreground),function(e,t){return{background:e,foreground:t}}).withLatestFrom(e._navigator.stateService.currentState$,function(e,t){return{nodes:e,state:t.state}})}).subscribe(function(t){if(null==t.state.currentNode||null==t.state.previousNode||t.state.currentNode.key!==t.nodes.foreground.key||t.state.previousNode.key!==t.nodes.background.key){if(t.state.currentNode.key===t.nodes.background.key)return void e._navigator.stateService.setNodes([t.nodes.foreground]);if(t.state.currentNode.key===t.nodes.foreground.key&&1===t.state.trajectory.length)return void e._navigator.stateService.prependNodes([t.nodes.background]);e._navigator.stateService.setNodes([t.nodes.background]),e._navigator.stateService.setNodes([t.nodes.foreground])}},function(e){console.log(e)});var t=this._navigator.stateService.currentState$.map(function(e){return e.state.previousNode}).filter(function(e){return null!=e}).distinctUntilChanged(function(e){return e.key});this._nodeSubscription=i.Observable.merge(t,this._navigator.stateService.currentNode$).filter(function(e){return e.pano?u.Settings.maxImageSize>u.Settings.basePanoramaSize:u.Settings.maxImageSize>u.Settings.baseImageSize}).flatMap(function(e){var t=new c.TextureLoader;return t.load(e.key,u.Settings.maxImageSize).zip(i.Observable.just(e),function(e,t){return[e,t]})}).map(function(e){return function(t){return t.updateTexture(e[0],e[1]),t}}).subscribe(this._sliderStateOperation$)},t.prototype._deactivate=function(){var e=this;this._container.mouseService.preventDefaultMouseDown$.onNext(!0),this._container.touchService.preventDefaultTouchMove$.onNext(!0),this._navigator.stateService.state$.first().subscribe(function(t){t===s.State.Waiting&&e._navigator.stateService.traverse()}),this._sliderStateDisposer$.onNext(null),this._setKeysSubscription.dispose(),this._setSliderVisibleSubscription.dispose(),this._elementSubscription.dispose(),this._stateSubscription.dispose(),this._glRenderSubscription.dispose(),this._domRenderSubscription.dispose(),this._nodeSubscription.dispose(),this.configure({keys:null})},t.componentName="slider",t}(c.Component);n.SliderComponent=l,c.ComponentService.register(l),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=l},{"../../Component":270,"../../Render":276,"../../State":277,"../../Utils":278,rx:219,"virtual-dom":226}],313:[function(e,t,n){"use strict";var r=e("rx"),i=e("three"),o=e("../../Utils"),s=function(){function e(){}return e.prototype.load=function(e,t){var n=new i.TextureLoader;n.setCrossOrigin("Anonymous");var s=r.Observable.fromCallback(n.load,n),a=s(o.Urls.image(e,t))["do"](function(e){e.minFilter=i.LinearFilter,e.needsUpdate=!0});return a},e}();n.TextureLoader=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../../Utils":278,rx:219,three:220}],314:[function(e,t,n){"use strict";var r=function(){function e(e,t){this.visibleInKeys=[],this._id=t.id,this._latLonAlt=e,this._markerOptions=t,this._type=t.type}return Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"latLonAlt",{get:function(){return this._latLonAlt},enumerable:!0,configurable:!0}),e}();n.Marker=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],315:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("underscore"),o=e("three"),s=e("rbush"),a=e("rx"),u=e("../../Component"),c=e("../../Render"),h=e("../../Geo"),l=function(){function e(){this._create$=new a.Subject,this._remove$=new a.Subject,this._update$=new a.Subject,this._markers$=this._update$.scan(function(e,t){return t(e)},{hash:{},spatial:s(2e4,[".lon",".lat",".lon",".lat"])}).map(function(e){return e.spatial}).shareReplay(1),this._create$.map(function(e){return function(t){t.hash[e.id]&&t.spatial.remove(t.hash[e.id]);var n={id:e.id,lat:e.latLonAlt.lat,lon:e.latLonAlt.lon,marker:e};return t.spatial.insert(n),t.hash[e.id]=n,t}}).subscribe(this._update$),this._remove$.map(function(e){return function(t){var n=t.hash[e];return t.spatial.remove(n),delete t.hash[e],t}}).subscribe(this._update$)}return e.prototype.addMarker=function(e){this._create$.onNext(e)},e.prototype.removeMarker=function(e){this._remove$.onNext(e)},Object.defineProperty(e.prototype,"markers$",{get:function(){return this._markers$},enumerable:!0,configurable:!0}),e}();n.MarkerSet=l;var p=function(e){function t(t,n,r){e.call(this,t,n,r)}return r(t,e),t.prototype._activate=function(){var e=this;this._scene=new o.Scene,this._markerSet=new l,this._markerObjects={},this._disposable=a.Observable.combineLatest(this._navigator.stateService.currentState$,this._markerSet.markers$,function(e,t){return{frame:e,markers:t}}).distinctUntilChanged(function(e){return e.frame.id}).map(function(t){return e._renderHash(t)}).subscribe(this._container.glRenderer.render$),this._disposableConfiguration=this.configuration$.filter(function(e){return e.mapillaryObjects}).flatMapLatest(function(t){return e._navigator.graphService.vectorTilesService.mapillaryObjects$.map(function(t){var n=i.map(t.rects,function(e){return e.image_key}),r={alt:t.alt,lat:t.latLon.lat,lon:t.latLon.lon},o={id:"mapillary-object-"+t.key,style:{ballColor:"#00FF00",ballOpacity:1,color:"#FF0000",opacity:.2},type:"marker"},s=e.createMarker(r,o);return s.visibleInKeys=n,s})}).subscribe(function(t){e.addMarker(t)})},t.prototype._deactivate=function(){this._disposeScene(),this._disposable.dispose(),this._disposableConfiguration.dispose()},t.prototype.createMarker=function(e,t){return"marker"===t.type?new u.SimpleMarker(e,t):null},t.prototype.addMarker=function(e){this._markerSet.addMarker(e)},Object.defineProperty(t.prototype,"markers$",{get:function(){return this._markerSet.markers$},enumerable:!0,configurable:!0}),t.prototype.removeMarker=function(e){this._markerSet.removeMarker(e)},t.prototype._renderHash=function(e){var t=this._updateScene(e);return{name:this._name,render:{frameId:e.frame.id,needsRender:t,render:this._render.bind(this),stage:c.GLRenderStage.Foreground}}},t.prototype._updateScene=function(e){if(!e.frame||!e.markers||!e.frame.state.currentNode)return!1;var t=!1,n=this._markerObjects,r=e.frame.state.currentNode;this._markerObjects={};for(var o=.001,s=r.latLon.lon-o/2,a=r.latLon.lat-o/2,u=r.latLon.lon+o/2,c=r.latLon.lat+o/2,l=i.map(e.markers.search([s,a,u,c]),function(e){return e.marker}).filter(function(e){return 0===e.visibleInKeys.length||i.contains(e.visibleInKeys,r.key)}),p=0,f=l;p<f.length;p++){var d=f[p];if(d.id in n)this._markerObjects[d.id]=n[d.id],delete n[d.id];else{var m=e.frame.state.reference,v=(new h.GeoCoords).geodeticToEnu(d.latLonAlt.lat,d.latLonAlt.lon,d.latLonAlt.alt,m.lat,m.lon,m.alt),g=d.createGeometry();g.position.set(v[0],v[1],v[2]),this._scene.add(g),this._markerObjects[d.id]=g,t=!0}}for(var y in n)n.hasOwnProperty(y)&&(this._disposeObject(n[y]),t=!0);return t},t.prototype._render=function(e,t){t.render(this._scene,e)},t.prototype._disposeObject=function(e){this._scene.remove(e);for(var t=0;t<e.children.length;++t){var n=e.children[t];n.geometry.dispose(),n.material.dispose()}},t.prototype._disposeScene=function(){for(var e in this._markerObjects)this._markerObjects.hasOwnProperty(e)&&this._disposeObject(this._markerObjects[e]);this._markerObjects={}},t.componentName="marker",t}(u.Component);n.MarkerComponent=p,u.ComponentService.register(p),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=p},{"../../Component":270,"../../Geo":273,"../../Render":276,rbush:195,rx:219,three:220,underscore:221}],316:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("three"),o=e("../../Component"),s=function(e){function t(t,n){e.call(this,t,n),this._circleToRayAngle=2,this._simpleMarkerStyle=n.style}return r(t,e),t.prototype.createGeometry=function(){var e=2,t=new i.Mesh(this._markerGeometry(e,16,8),new i.MeshBasicMaterial({color:this._stringToRBG(this._simpleMarkerStyle.color),depthWrite:!1,opacity:this._simpleMarkerStyle.opacity,shading:i.SmoothShading,transparent:!0})),n=new i.Mesh(new i.SphereGeometry(e/2,16,8),new i.MeshBasicMaterial({color:this._stringToRBG(this._simpleMarkerStyle.ballColor),depthWrite:!1,opacity:this._simpleMarkerStyle.ballOpacity,shading:i.SmoothShading,transparent:!0}));n.position.z=this._markerHeight(e);var r=new i.Object3D;return r.add(n),r.add(t),r},t.prototype._markerHeight=function(e){var t=Math.tan(Math.PI-this._circleToRayAngle);return e*Math.sqrt(1+t*t)},t.prototype._markerGeometry=function(e,t,n){var r=new i.Geometry;t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6);for(var o=this._markerHeight(e),s=[],a=0;n>=a;++a){for(var u=[],c=0;t>=c;++c){var h=c/t*Math.PI*2,l=a/n*Math.PI,p=void 0;if(l<this._circleToRayAngle)p=e;else{var f=Math.tan(l-this._circleToRayAngle);p=e*Math.sqrt(1+f*f)}var d=new i.Vector3;d.x=p*Math.cos(h)*Math.sin(l),d.y=p*Math.sin(h)*Math.sin(l),d.z=p*Math.cos(l)+o,r.vertices.push(d),u.push(r.vertices.length-1)}s.push(u)}for(var a=0;n>a;++a)for(var c=0;t>c;++c){var m=s[a][c+1],v=s[a][c],g=s[a+1][c],y=s[a+1][c+1],_=r.vertices[m].clone().normalize(),b=r.vertices[v].clone().normalize(),x=r.vertices[g].clone().normalize(),w=r.vertices[y].clone().normalize();r.faces.push(new i.Face3(m,v,y,[_,b,w])),r.faces.push(new i.Face3(v,g,y,[b.clone(),x,w.clone()]))}return r.computeFaceNormals(),r.boundingSphere=new i.Sphere(new i.Vector3,e+o),r},t.prototype._stringToRBG=function(e){for(var t=0,n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return t},t}(o.Marker);n.SimpleMarker=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../../Component":270,three:220}],317:[function(e,t,n){"use strict";var r=e("./error/GeometryTagError");n.GeometryTagError=r.GeometryTagError;var i=e("./geometry/PointGeometry");n.PointGeometry=i.PointGeometry;var o=e("./geometry/RectGeometry");n.RectGeometry=o.RectGeometry;var s=e("./tag/OutlineTag");n.OutlineTag=s.OutlineTag;var a=e("./tag/SpotTag");n.SpotTag=a.SpotTag;var u=e("./TagComponent");n.TagComponent=u.TagComponent},{"./TagComponent":318,"./error/GeometryTagError":324,"./geometry/PointGeometry":326,"./geometry/RectGeometry":328,"./tag/OutlineTag":331,"./tag/SpotTag":332}],318:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("rx"),o=e("three"),s=e("../../Component"),a=e("../../Render"),u=function(e){function t(n,r,o){var a=this;e.call(this,n,r,o),this._tagDomRenderer=new s.TagDOMRenderer,this._tagSet=new s.TagSet,this._tagCreator=new s.TagCreator,this._tagGlRendererOperation$=new i.Subject,this._tagGlRenderer$=this._tagGlRendererOperation$.startWith(function(e){return e}).scan(function(e,t){return t(e)},new s.TagGLRenderer),this._tags$=this._tagSet.tagData$.map(function(e){for(var t=[],n=0,r=Object.keys(e).sort();n<r.length;n++){var i=r[n];t.push(e[i])}return t}).share(),this._tagChanged$=this._tags$.flatMapLatest(function(e){return i.Observable.fromArray(e).flatMap(function(e){return i.Observable.merge(e.changed$,e.geometryChanged$)})}).share(),this._tagInterationInitiated$=this._tags$.flatMapLatest(function(e){return i.Observable.fromArray(e).flatMap(function(e){return e.interact$.map(function(e){return e.tag.id})})}).share(),this._tagInteractionAbort$=this._tags$.flatMapLatest(function(e){return i.Observable.fromArray(e).flatMap(function(e){return e.abort$})}).share(),this._activeTag$=this._tags$.flatMapLatest(function(e){return i.Observable.fromArray(e).flatMap(function(e){return e.interact$})}).share(),this._createGeometryChanged$=this._tagCreator.tag$.flatMapLatest(function(e){return null!=e?e.geometryChanged$:i.Observable.empty()}).share(),this._tagCreated$=this._tagCreator.tag$.flatMapLatest(function(e){return null!=e?e.created$:i.Observable.empty()}).share(),this._vertexGeometryCreated$=this._tagCreated$.map(function(e){return e.geometry}).share(),this._pointGeometryCreated$=new i.Subject,this._geometryCreated$=i.Observable.merge(this._vertexGeometryCreated$,this._pointGeometryCreated$).share(),this._basicClick$=this._container.mouseService.staticClick$.withLatestFrom(this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,n){return[e,t,n]}).map(function(e){var t=e[0],n=e[1],r=e[2],i=a._mouseEventToBasic(t,a._container.element,n,r);return i}).share(),this._validBasicClick$=this._basicClick$.filter(function(e){var t=e[0],n=e[1];return t>=0&&1>=t&&n>=0&&1>=n}).share(),this._creatingConfiguration$=this._configuration$.distinctUntilChanged(function(e){return e.creating}).share(),this._creating$=this._creatingConfiguration$.map(function(e){return e.creating}).share(),this._creating$.subscribe(function(e){a.fire(t.creatingchanged,e)}),this._tagInteractionAbort$.subscribe()}return r(t,e),Object.defineProperty(t.prototype,"tags$",{get:function(){return this._tags$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"geometryCreated$",{get:function(){return this._geometryCreated$},enumerable:!0,configurable:!0}),t.prototype.setTags=function(e){this._tagSet.set$.onNext(e)},t.prototype.startCreate=function(e){this.configure({createType:null,creating:!1}),this.configure({createType:e,creating:!0})},t.prototype.stopCreate=function(){this.configure({createType:null,creating:!1})},t.prototype._activate=function(){var e=this;this._geometryCreatedEventSubscription=this._geometryCreated$.subscribe(function(n){e.fire(t.geometrycreated,n)}),this._tagsChangedEventSubscription=this._tags$.subscribe(function(n){e.fire(t.tagschanged,n)});var n=this.configuration$.flatMapLatest(function(t){return t.creating?e._navigator.stateService.currentNode$.skip(1).take(1).map(function(e){return null}):i.Observable.empty()}),r=this._tagCreator.tag$.flatMapLatest(function(e){return null!=e?e.aborted$.map(function(e){return null}):i.Observable.empty()}),o=this._tagCreated$.map(function(e){return null}),u=this._pointGeometryCreated$.map(function(e){return null});this._stopCreateSubscription=i.Observable.merge(n,r,o,u).subscribe(function(){e.stopCreate()}),this._geometryTypeSubscription=this._configuration$.map(function(e){return e.createType}).subscribe(this._tagCreator.geometryType$),this._createSubscription=this._creatingConfiguration$.flatMapLatest(function(t){return t.creating&&"rect"===t.createType?e._validBasicClick$.take(1):i.Observable.empty()}).subscribe(this._tagCreator.create$),this._createPointSubscription=this._creatingConfiguration$.flatMapLatest(function(t){return t.creating&&"point"===t.createType?e._validBasicClick$.take(1):i.Observable.empty()}).map(function(e){return new s.PointGeometry(e)}).subscribe(this._pointGeometryCreated$),this._setCreateVertexSubscription=i.Observable.combineLatest(this._container.mouseService.mouseMove$,this._tagCreator.tag$,this._container.renderService.renderCamera$,function(e,t,n){return[e,t,n]}).filter(function(e){return null!=e[1]}).withLatestFrom(this._navigator.stateService.currentTransform$,function(e,t){return[e[0],e[1],e[2],t]}).subscribe(function(t){var n=t[0],r=t[1],i=t[2],o=t[3],s=e._mouseEventToBasic(n,e._container.element,i,o);r.geometry.setVertex2d(3,s,o)}),this._addPointSubscription=this._creating$.flatMapLatest(function(t){return t?e._basicClick$.skipUntil(e._validBasicClick$):i.Observable.empty()}).withLatestFrom(this._tagCreator.tag$,function(e,t){return[e,t]}).subscribe(function(e){var t=e[0],n=e[1];n.addPoint(t)}),this._deleteCreatedSubscription=this._creating$.filter(function(e){return!e}).subscribe(function(t){e._tagCreator.delete$.onNext(null)}),this._setGLCreateTagSubscription=i.Observable.merge(this._tagCreator.tag$,this._createGeometryChanged$).withLatestFrom(this._navigator.stateService.currentTransform$,function(e,t){return[e,t]}).map(function(e){return function(t){var n=e[0],r=e[1];return null==n?t.removeCreateTag():t.setCreateTag(n,r),t}}).subscribe(this._tagGlRendererOperation$),this._claimMouseSubscription=this._tagInterationInitiated$.flatMapLatest(function(t){return e._container.mouseService.mouseMove$.takeUntil(e._tagInteractionAbort$).take(1)}).subscribe(function(t){e._container.mouseService.claimMouse(e._name,1)}),this._mouseDragSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDrag$).withLatestFrom(this._activeTag$,this._container.renderService.renderCamera$,this._navigator.stateService.currentTransform$,function(e,t,n,r){return[e,t,n,r]}).subscribe(function(t){var n=t[0],r=t[1],i=t[2],o=t[3];if(r.operation!==s.TagOperation.None){var a=e._mouseEventToBasic(n,e._container.element,i,o,r.offsetX,r.offsetY);if(r.operation===s.TagOperation.Centroid)r.tag.geometry.setCentroid2d(a,o);else if(r.operation===s.TagOperation.Vertex){var u=r.tag.geometry;u.setVertex2d(r.vertexIndex,a,o)}}}),this._unclaimMouseSubscription=this._container.mouseService.filtered$(this._name,this._container.mouseService.mouseDragEnd$).subscribe(function(t){e._container.mouseService.unclaimMouse(e._name)}),this._setTagsSubscription=this._tags$.withLatestFrom(this._navigator.stateService.currentTransform$,function(e,t){return[e,t]}).map(function(e){return function(t){return t.setTags(e[0],e[1]),t}}).subscribe(this._tagGlRendererOperation$),this._updateTagSubscription=this._tagChanged$.withLatestFrom(this._navigator.stateService.currentTransform$,function(e,t){return[e,t]}).map(function(e){return function(t){return t.updateTag(e[0],e[1]),t}}).subscribe(this._tagGlRendererOperation$),this._domSubscription=i.Observable.combineLatest(this._container.renderService.renderCamera$,this._container.spriteService.spriteAtlas$,this._tags$.startWith([]),this._tagChanged$.startWith(null),this._tagCreator.tag$.startWith(null),function(e,t,n,r,i){return[e,t,n,r,i]}).withLatestFrom(this._navigator.stateService.currentTransform$,function(e,t){return[e[0],e[1],e[2],e[3],e[4],t]}).map(function(t){return{name:e._name,vnode:e._tagDomRenderer.render(t[2],t[4],t[1],t[0].perspective,t[5])}}).subscribe(this._container.domRenderer.render$),this._glSubscription=this._navigator.stateService.currentState$.withLatestFrom(this._tagGlRenderer$,function(e,t){return[e,t]}).map(function(t){var n=t[0],r=t[1];return{name:e._name,render:{frameId:n.id,needsRender:r.needsRender,render:r.render.bind(r),stage:a.GLRenderStage.Foreground}}}).subscribe(this._container.glRenderer.render$)},t.prototype._deactivate=function(){this._tagGlRendererOperation$.onNext(function(e){return e.dispose(),e}),this._tagSet.set$.onNext([]),this._tagCreator.delete$.onNext(null),this._claimMouseSubscription.dispose(),this._mouseDragSubscription.dispose(),this._unclaimMouseSubscription.dispose(),this._setTagsSubscription.dispose(),this._updateTagSubscription.dispose(),this._stopCreateSubscription.dispose(),this._geometryTypeSubscription.dispose(),this._createSubscription.dispose(),this._createPointSubscription.dispose(),this._setCreateVertexSubscription.dispose(),this._addPointSubscription.dispose(),this._deleteCreatedSubscription.dispose(),this._setGLCreateTagSubscription.dispose(),this._domSubscription.dispose(),this._glSubscription.dispose(),this._geometryCreatedEventSubscription.dispose(),this._tagsChangedEventSubscription.dispose()},t.prototype._mouseEventToBasic=function(e,t,n,r,i,s){i=null!=i?i:0,s=null!=s?s:0;var a=t.getBoundingClientRect(),u=e.clientX-a.left-i,c=e.clientY-a.top-s,h=2*u/t.offsetWidth-1,l=1-2*c/t.offsetHeight,p=new o.Vector3(h,l,1).unproject(n.perspective),f=r.projectBasic(p.toArray());return f},t.componentName="tag",t.creatingchanged="creatingchanged",t.geometrycreated="geometrycreated",t.tagschanged="tagschanged",t}(s.Component);n.TagComponent=u,s.ComponentService.register(u),Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../../Component":270,"../../Render":276,rx:219,three:220}],319:[function(e,t,n){"use strict";var r=e("rx"),i=e("../../Component"),o=function(){function e(){this._tagOperation$=new r.Subject,this._create$=new r.Subject,this._delete$=new r.Subject,this._geometryType$=new r.Subject,this._tag$=this._tagOperation$.scan(function(e,t){return t(e)},null).share(),this._create$.withLatestFrom(this._geometryType$,function(e,t){return[e,t]}).map(function(e){return function(t){var n=e[0],r=e[1];if("rect"===r){var o=new i.RectGeometry([n[0],n[1],n[0],n[1]]);return new i.OutlineCreateTag(o)}return null}}).subscribe(this._tagOperation$),this._delete$.map(function(){return function(e){return null}}).subscribe(this._tagOperation$)}return Object.defineProperty(e.prototype,"create$",{get:function(){return this._create$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delete$",{get:function(){return this._delete$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometryType$",{get:function(){return this._geometryType$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tag$",{get:function(){return this._tag$},enumerable:!0,configurable:!0}),e}();n.TagCreator=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../../Component":270,rx:219}],320:[function(e,t,n){"use strict";var r=e("three"),i=e("virtual-dom"),o=function(){function e(){}return e.prototype.render=function(e,t,n,o,s){for(var a=(new r.Matrix4).getInverse(o.matrixWorld),u=o.projectionMatrix,c=[],h=0,l=e;h<l.length;h++){var p=l[h];c=c.concat(p.getDOMObjects(s,n,a,u))}return null!=t&&(c=c.concat(t.getDOMObjects(s,a,u))),i.h("div.TagContainer",{},c)},e}();n.TagDOMRenderer=o},{three:220,"virtual-dom":226}],321:[function(e,t,n){"use strict";var r=e("three"),i=function(){function e(){this._scene=new r.Scene,this._tags={},this._createTag=null,this._needsRender=!1}return Object.defineProperty(e.prototype,"needsRender",{get:function(){return this._needsRender},enumerable:!0,configurable:!0}),e.prototype.render=function(e,t){t.render(this._scene,e),this._needsRender=!1},e.prototype.setCreateTag=function(e,t){this._disposeCreateTag(),this._addCreateTag(e,t),this._needsRender=!0},e.prototype.removeCreateTag=function(){this._disposeCreateTag(),this._needsRender=!0},e.prototype.setTags=function(e,t){this._disposeTags();for(var n=0,r=e;n<r.length;n++){var i=r[n];this._addTag(i,t)}this._needsRender=!0},e.prototype.updateTag=function(e,t){this._disposeTag(e.id),this._addTag(e,t),this._needsRender=!0},e.prototype.dispose=function(){this._disposeTags(),this._disposeCreateTag(),this._needsRender=!1},e.prototype._addTag=function(e,t){var n=e.getGLObjects(t);this._tags[e.id]=[];for(var r=0,i=n;r<i.length;r++){var o=i[r];this._tags[e.id].push(o),this._scene.add(o)}},e.prototype._addCreateTag=function(e,t){var n=e.getGLObject(t);this._createTag=n,this._scene.add(n)},e.prototype._disposeTags=function(){for(var e=0,t=Object.keys(this._tags);e<t.length;e++){var n=t[e];this._disposeTag(n)}},e.prototype._disposeTag=function(e){for(var t=this._tags[e],n=0,r=t;n<r.length;n++){var i=r[n],o=i;this._scene.remove(o),o.geometry.dispose(),o.material.dispose()}delete this._tags[e]},e.prototype._disposeCreateTag=function(){if(null!=this._createTag){var e=this._createTag;this._scene.remove(e),e.geometry.dispose(),e.material.dispose(),this._createTag=null}},e}();n.TagGLRenderer=i},{three:220}],322:[function(e,t,n){"use strict";!function(e){e[e.None=0]="None",e[e.Centroid=1]="Centroid",e[e.Vertex=2]="Vertex"}(n.TagOperation||(n.TagOperation={}));var r=n.TagOperation;Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],323:[function(e,t,n){"use strict";var r=e("rx"),i=function(){function e(){this._tagDataOperation$=new r.Subject,this._set$=new r.Subject,this._tagData$=this._tagDataOperation$.scan(function(e,t){return t(e)},{}).share(),this._set$.map(function(e){return function(t){for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];delete t[i]}for(var o=0,s=e;o<s.length;o++){var a=s[o];t[a.id]=a}return t}}).subscribe(this._tagDataOperation$)}return Object.defineProperty(e.prototype,"tagData$",{get:function(){return this._tagData$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"set$",{get:function(){return this._set$},enumerable:!0,configurable:!0}),e}();n.TagSet=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{rx:219}],324:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../../../Error"),o=function(e){function t(t){e.call(this),this.name="GeometryTagError",this.message=null!=t?t:"The provided geometry value is incorrect"}return r(t,e),t}(i.MapillaryError);n.GeometryTagError=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i.MapillaryError},{"../../../Error":272}],325:[function(e,t,n){"use strict";var r=e("rx"),i=function(){function e(){this._notifyChanged$=new r.Subject}return Object.defineProperty(e.prototype,"changed$",{get:function(){return this._notifyChanged$},enumerable:!0,configurable:!0}),e}();n.Geometry=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{rx:219}],326:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../../../Component"),o=function(e){function t(t){e.call(this);var n=t[0],r=t[1];if(0>n||n>1||0>r||r>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].");this._point=t.slice()}return r(t,e),Object.defineProperty(t.prototype,"point",{get:function(){return this._point},enumerable:!0,configurable:!0}),t.prototype.getCentroid3d=function(e){return e.unprojectBasic(this._point,200)},t.prototype.setCentroid2d=function(e,t){var n=[Math.max(0,Math.min(1,e[0])),Math.max(0,Math.min(1,e[1]))];this._point[0]=n[0],this._point[1]=n[1],this._notifyChanged$.onNext(this)},t}(i.Geometry);n.PointGeometry=o},{"../../../Component":270}],327:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../../../Component"),o=function(e){function t(t){e.call(this),this._vertices2d=[];for(var n=0,r=t;n<r.length;n++){var i=r[n];this._vertices2d.push(i.slice())}}return r(t,e),t.prototype.setVertex2d=function(e,t,n){0===e||e===this._vertices2d.length-1?(this._vertices2d[0]=t.slice(),this._vertices2d[this._vertices2d.length-1]=t.slice()):this._vertices2d[e]=t.slice(),this._notifyChanged$.onNext(this)},t.prototype.setCentroid2d=function(e,t){for(var n=this._vertices2d.map(function(e){return e[0]}),r=this._vertices2d.map(function(e){return e[1]}),i=Math.min.apply(Math,n),o=Math.max.apply(Math,n),s=Math.min.apply(Math,r),a=Math.max.apply(Math,r),u=this._getCentroid2d(),c=-i,h=1-o,l=-s,p=1-a,f=Math.max(c,Math.min(h,e[0]-u[0])),d=Math.max(l,Math.min(p,e[1]-u[1])),m=0,v=this._vertices2d;m<v.length;m++){var g=v[m];g[0]+=f,g[1]+=d}this._notifyChanged$.onNext(this)},t.prototype.getPoints3d=function(e){return this.getVertices3d(e)},t.prototype.getVertices3d=function(e){return this._vertices2d.map(function(t){return e.unprojectBasic(t,200)})},t.prototype.getCentroid3d=function(e){var t=this._getCentroid2d();return e.unprojectBasic(t,200)},t.prototype._getCentroid2d=function(){for(var e=this._vertices2d,t=0,n=0,r=0,i=0;i<e.length-1;i++){var o=e[i][0],s=e[i][1],a=e[i+1][0],u=e[i+1][1],c=o*u-a*s;t+=c,n+=(o+a)*c,r+=(s+u)*c}return t/=2,n/=6*t,r/=6*t,[n,r]},t}(i.VertexGeometry);n.PolygonGeometry=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../../../Component":270}],328:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../../../Component"),o=function(e){function t(t){if(e.call(this),t[1]>t[3])throw new i.GeometryTagError("Basic Y coordinate values can not be inverted.");for(var n=0,r=t;n<r.length;n++){var o=r[n];if(0>o||o>1)throw new i.GeometryTagError("Basic coordinates must be on the interval [0, 1].")}this._rect=t.slice(0,4),this._rect[0]>this._rect[2]&&(this._inverted=!0)}return r(t,e),Object.defineProperty(t.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),t.prototype.setVertex2d=function(e,t,n){var r=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]=r[1],o[2]=r[2],o[3]=i[1]):1===e?(o[0]=i[0],o[1]=i[1],o[2]=r[2],o[3]=r[3]):2===e?(o[0]=r[0],o[1]=i[1],o[2]=i[0],o[3]=r[3]):3===e&&(o[0]=r[0],o[1]=r[1],o[2]=i[0],o[3]=i[1]),n.gpano){var s=2>e&&i[0]>.75&&r[0]<.25||e>=2&&this._inverted&&i[0]>.75&&r[2]<.25,a=2>e&&this._inverted&&i[0]<.25&&r[0]>.75||e>=2&&i[0]<.25&&r[2]>.75;s||a?this._inverted=!this._inverted:(o[0]-r[0]<-.25&&(o[0]=r[0]),o[2]-r[2]>.25&&(o[2]=r[2])),(!this._inverted&&o[0]>o[2]||this._inverted&&o[0]<o[2])&&(o[0]=r[0],o[2]=r[2])}else o[0]>o[2]&&(o[0]=r[0],o[2]=r[2]);o[1]>o[3]&&(o[1]=r[1],o[3]=r[3]),this._rect[0]=o[0],this._rect[1]=o[1],this._rect[2]=o[2],this._rect[3]=o[3],this._notifyChanged$.onNext(this)},t.prototype.setCentroid2d=function(e,t){var n=this._rect.slice(),r=n[0],i=this._inverted?n[2]+1:n[2],o=n[1],s=n[3],a=r+(i-r)/2,u=o+(s-o)/2,c=0;if(t.gpano)c=this._inverted?e[0]+1-a:e[0]-a;else{var h=-r,l=1-i;c=Math.max(h,Math.min(l,e[0]-a))}var p=-o,f=1-s,d=Math.max(p,Math.min(f,e[1]-u));this._rect[0]=n[0]+c,this._rect[1]=n[1]+d,this._rect[2]=n[2]+c,this._rect[3]=n[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$.onNext(this)},t.prototype.getPoints3d=function(e){for(var t=this._rectToVertices2d(this._rect),n=t.length-1,r=10,i=[],o=0;n>o;++o)for(var s=t[o][0],a=t[o][1],u=t[o+1][0],c=t[o+1][1],h=(u-s)/(r-1),l=(c-a)/(r-1),p=0;r>p;++p){var f=[s+p*h,a+p*l];i.push(f)}return i.map(function(t){return e.unprojectBasic(t,200)})},t.prototype.getVertices3d=function(e){return this._rectToVertices2d(this._rect).map(function(t){return e.unprojectBasic(t,200)})},t.prototype.getCentroid3d=function(e){var t=this._rect,n=t[0],r=this._inverted?t[2]+1:t[2],i=t[1],o=t[3],s=n+(r-n)/2,a=i+(o-i)/2;return e.unprojectBasic([s,a],200)},t.prototype.validate=function(e){var t=this._rect;return!(!this._inverted&&e[0]<t[0]||e[0]-t[2]>.25||e[1]<t[1])},t.prototype._rectToVertices2d=function(e){return[[e[0],e[3]],[e[0],e[1]],[this._inverted?e[2]+1:e[2],e[1]],[this._inverted?e[2]+1:e[2],e[3]],[e[0],e[3]]]},t}(i.VertexGeometry);n.RectGeometry=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../../../Component":270}],329:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../../../Component"),o=function(e){function t(){e.call(this)}return r(t,e),t}(i.Geometry);n.VertexGeometry=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../../../Component":270}],330:[function(e,t,n){"use strict";var r=e("rx"),i=e("three"),o=e("virtual-dom"),s=function(){function e(e){this._geometry=e,this._created$=new r.Subject,this._aborted$=new r.Subject}return Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"created$",{get:function(){return this._created$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aborted$",{get:function(){return this._aborted$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"geometryChanged$",{get:function(){var e=this;return this._geometry.changed$.map(function(t){return e})},enumerable:!0,configurable:!0}),e.prototype.getGLObject=function(e){var t=this._geometry.getPoints3d(e),n=this._getPositions(t),r=new i.BufferGeometry;r.addAttribute("position",new i.BufferAttribute(n,3));var o=new i.LineBasicMaterial({color:16777215,linewidth:2});return new i.Line(r,o)},e.prototype.getDOMObjects=function(e,t,n){var r=this,i=[],s=this._geometry.getVertices3d(e),a=function(e){r._aborted$.onNext(r)},u=this._convertToCameraSpace(s[1],t);if(u.z<0){var c=this._projectToCanvas(u,n),h=c.map(function(e){return 100*e+"%"}),l={style:{background:"#FFFFFF",left:h[0],position:"absolute",top:h[1]}},p={onclick:a,style:{left:h[0],position:"absolute",top:h[1]}};i.push(o.h("div.TagInteractor",p,[])),i.push(o.h("div.TagVertex",l,[]))}return i},e.prototype.addPoint=function(e){var t=this._geometry;t.validate(e)&&this._created$.onNext(this)},e.prototype._getPositions=function(e){for(var t=e.length,n=new Float32Array(3*t),r=0;t>r;++r){var i=3*r,o=e[r];n[i]=o[0],n[i+1]=o[1],n[i+2]=o[2]}return n},e.prototype._projectToCanvas=function(e,t){var n=new i.Vector3(e.x,e.y,e.z).applyProjection(t);return[(n.x+1)/2,(-n.y+1)/2]},e.prototype._convertToCameraSpace=function(e,t){return new i.Vector3(e[0],e[1],e[2]).applyMatrix4(t)},e}();n.OutlineCreateTag=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{rx:219,three:220,"virtual-dom":226}],331:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("three"),o=e("virtual-dom"),s=e("../../../Component"),a=function(e){function t(t,n,r){e.call(this,t,n),this._editable=r.editable?r.editable:!1,this._icon=r.icon?r.icon:null,this._lineColor=r.lineColor?r.lineColor:16777215,this._lineWidth=r.lineWidth?r.lineWidth:1,this._text=r.text?r.text:null,this._textColor=r.textColor?r.textColor:16777215}return r(t,e),Object.defineProperty(t.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineColor",{get:function(){return this._lineColor},set:function(e){this._lineColor=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),t.prototype.getGLObjects=function(e){var t=this._geometry.getPoints3d(e),n=this._getPositions(t),r=new i.BufferGeometry;r.addAttribute("position",new i.BufferAttribute(n,3));var o=new i.LineBasicMaterial({color:this._lineColor,linewidth:this._lineWidth});return[new i.Line(r,o)]},t.prototype.getDOMObjects=function(e,t,n,r){var i=this,a=[],u=this._geometry.getVertices3d(e),c=function(e){i._abort$.onNext(i._id)},h=this._convertToCameraSpace(u[3],n);if(h.z<0){var l=function(e){i._interact$.onNext({offsetX:0,offsetY:0,operation:s.TagOperation.None,tag:i})};if(null!=this._icon){if(t.loaded){var p=t.getDOMSprite(this._icon),f=this._projectToCanvas(h,r),d=f.map(function(e){return 100*e+"%"}),m={onmousedown:l,onmouseup:c,style:{left:d[0],pointerEvents:"all",position:"absolute",top:d[1]}};a.push(o.h("div",m,[p]))}}else if(null!=this._text){var f=this._projectToCanvas(h,r),d=f.map(function(e){return 100*e+"%"}),m={onmousedown:l,onmouseup:c,style:{color:"#"+("000000"+this._textColor.toString(16)).substr(-6),left:d[0],pointerEvents:"all",position:"absolute",top:d[1]},textContent:this._text};a.push(o.h("span.TagSymbol",m,[]))}}if(!this._editable)return a;for(var v="#"+("000000"+this._lineColor.toString(16)).substr(-6),g=0;g<u.length-1;g++){var y=this._convertToCameraSpace(u[g],n);if(!(y.z>0)){var l=this._interact(s.TagOperation.Vertex,g),_=this._projectToCanvas(y,r),b=_.map(function(e){return 100*e+"%"}),m={onmousedown:l,onmouseup:c,style:{background:v,left:b[0],position:"absolute",top:b[1]}};a.push(o.h("div.TagResizer",m,[]))}}var x=this._geometry.getCentroid3d(e),w=this._convertToCameraSpace(x,n);if(w.z<0){var l=this._interact(s.TagOperation.Centroid),S=this._projectToCanvas(w,r),M=S.map(function(e){return 100*e+"%"}),m={onmousedown:l,onmouseup:c,style:{background:v,left:M[0],position:"absolute",top:M[1]}};a.push(o.h("div.TagMover",m,[]))}return a},t.prototype._interact=function(e,t){var n=this;return function(r){var i=r.offsetX-r.target.offsetWidth/2,o=r.offsetY-r.target.offsetHeight/2;n._interact$.onNext({offsetX:i,offsetY:o,operation:e,tag:n,vertexIndex:t})}},t.prototype._getPositions=function(e){for(var t=e.length,n=new Float32Array(3*t),r=0;t>r;++r){var i=3*r,o=e[r];n[i]=o[0],n[i+1]=o[1],n[i+2]=o[2]}return n},t}(s.Tag);n.OutlineTag=a,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../../../Component":270,three:220,"virtual-dom":226}],332:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("virtual-dom"),o=e("../../../Component"),s=e("../../../Viewer"),a=function(e){function t(t,n,r){e.call(this,t,n),this._color=r.color?r.color:16777215,this._editable=r.editable?r.editable:!1,this._icon=r.icon?r.icon:null,this._text=r.text?r.text:null,this._textColor=r.textColor?r.textColor:16777215}return r(t,e),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(e){this._color=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textColor",{get:function(){return this._textColor},set:function(e){this._textColor=e,this._notifyChanged$.onNext(this)},enumerable:!0,configurable:!0}),t.prototype.getGLObjects=function(e){return[]},t.prototype.getDOMObjects=function(e,t,n,r){var a=this,u=[],c=function(e){a._abort$.onNext(a._id)},h=this._geometry.getCentroid3d(e),l=this._convertToCameraSpace(h,n);if(l.z<0){var p=this._projectToCanvas(l,r),f=p.map(function(e){return 100*e+"%"}),d=function(e){a._interact$.onNext({offsetX:0,offsetY:0,operation:o.TagOperation.None,tag:a})};if(null!=this._icon){if(t.loaded){var m=t.getDOMSprite(this._icon,s.SpriteAlignment.Center,s.SpriteAlignment.End),v={onmousedown:d,onmouseup:c,style:{bottom:100*(1-p[1])+"%",left:f[0],pointerEvents:"all",position:"absolute",transform:"translate(0px, -8px)"}};u.push(i.h("div",v,[m]))}}else if(null!=this._text){var v={onmousedown:d,onmouseup:c,style:{bottom:100*(1-p[1])+"%",color:"#"+("000000"+this._textColor.toString(16)).substr(-6),left:f[0],pointerEvents:"all",position:"absolute",transform:"translate(-50%, -7px)"},textContent:this._text};u.push(i.h("span.TagSymbol",v,[]))}var g=this._interact(o.TagOperation.Centroid),y="#"+("000000"+this.color.toString(16)).substr(-6);if(this._editable){var _={onmousedown:g,onmouseup:c,style:{background:y,left:f[0],pointerEvents:"all",position:"absolute",top:f[1]}};u.push(i.h("div.TagSpotInteractor",_,[]))}var b={style:{background:y,left:f[0],position:"absolute",top:f[1]}};u.push(i.h("div.TagVertex",b,[]))}return u},t.prototype._interact=function(e,t){var n=this;return function(r){var i=r.offsetX-r.target.offsetWidth/2,o=r.offsetY-r.target.offsetHeight/2;n._interact$.onNext({offsetX:i,offsetY:o,operation:e,tag:n,vertexIndex:t})}},t}(o.Tag);n.SpotTag=a,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../../../Component":270,"../../../Viewer":279,"virtual-dom":226}],333:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("rx"),o=e("three"),s=e("../../../Utils"),a=function(e){function t(n,r){var o=this;e.call(this),this._id=n,this._geometry=r,this._abort$=new i.Subject,this._interact$=new i.Subject,this._notifyChanged$=new i.Subject,this.changed$.subscribe(function(e){o.fire(t.changed,o)}),this._geometry.changed$.subscribe(function(e){o.fire(t.geometrychanged,o)})}return r(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,"interact$",{get:function(){return this._interact$},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"abort$",{get:function(){return this._abort$},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.prototype._projectToCanvas=function(e,t){var n=new o.Vector3(e.x,e.y,e.z).applyProjection(t);return[(n.x+1)/2,(-n.y+1)/2]},t.prototype._convertToCameraSpace=function(e,t){return new o.Vector3(e[0],e[1],e[2]).applyMatrix4(t)},t.changed="changed",t.geometrychanged="geometrychanged",t}(s.EventEmitter);n.Tag=a,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../../../Utils":278,rx:219,three:220}],334:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("./MapillaryError"),o=function(e){function t(){e.call(this),this.name="InitializationMapillaryError",this.message="Could not initialize"}return r(t,e),t}(i.MapillaryError);n.InitializationMapillaryError=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./MapillaryError":335}],335:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=function(e){function t(){e.call(this)}return r(t,e),t}(Error);n.MapillaryError=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{}],336:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("./MapillaryError"),o=function(e){function t(){e.call(this),this.name="MoveTypeMapillaryError",this.message="The type of ui you use does not support this move"}return r(t,e),t}(i.MapillaryError);n.MoveTypeMapillaryError=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./MapillaryError":335}],337:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("./MapillaryError"),o=function(e){function t(){e.call(this),this.name="NotImplementedMapillaryError",this.message="This function has not yet been implemented"}return r(t,e),t}(i.MapillaryError);n.NotImplementedMapillaryError=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./MapillaryError":335}],338:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("./MapillaryError"),o=function(e){function t(t){e.call(this),this.name="ParameterMapillaryError",this.message=null!=t?t:"The function was not called with correct parameters"}return r(t,e),t}(i.MapillaryError);n.ParameterMapillaryError=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./MapillaryError":335}],339:[function(e,t,n){"use strict";var r=e("three"),i=function(){function e(e){null!=e?(this._position=e.pixelToVertex(0,0,0),this._lookat=e.pixelToVertex(0,0,10),this._up=e.upVector(),this._focal=this._getFocal(e)):(this._position=new r.Vector3(0,0,0),this._lookat=new r.Vector3(0,0,1),this._up=new r.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,n){this._position.subVectors(t.position,e.position).multiplyScalar(n).add(e.position),this._lookat.subVectors(t.lookat,e.lookat).multiplyScalar(n).add(e.lookat),this._up.subVectors(t.up,e.up).multiplyScalar(n).add(e.up),this._focal=(1-n)*e.focal+n*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),n=this._lookat.distanceToSquared(e.lookat),r=this._up.distanceToSquared(e.up),i=100*Math.abs(this._focal-e.focal);return Math.max(t,n,r,i)},e.prototype._getFocal=function(e){if(null!=e.gpano)return.5;var t=Math.max(e.width,e.height);return e.orientation>4?e.focal/t*e.height:e.focal/t*e.width},e}();n.Camera=i},{three:220}],340:[function(e,t,n){"use strict";var r=function(){function e(){this._wgs84a=6378137,this._wgs84b=6356752.31424518}return e.prototype.geodeticToEnu=function(e,t,n,r,i,o){var s=this.geodeticToEcef(e,t,n);return this.ecefToEnu(s[0],s[1],s[2],r,i,o)},e.prototype.enuToGeodetic=function(e,t,n,r,i,o){var s=this.enuToEcef(e,t,n,r,i,o);return this.ecefToGeodetic(s[0],s[1],s[2])},e.prototype.ecefToEnu=function(e,t,n,r,i,o){var s=this.geodeticToEcef(r,i,o),a=[e-s[0],t-s[1],n-s[2]];r=r*Math.PI/180,i=i*Math.PI/180;var u=Math.cos(r),c=Math.sin(r),h=Math.cos(i),l=Math.sin(i),p=-l*a[0]+h*a[1],f=-c*h*a[0]-c*l*a[1]+u*a[2],d=u*h*a[0]+u*l*a[1]+c*a[2];return[p,f,d]},e.prototype.enuToEcef=function(e,t,n,r,i,o){var s=this.geodeticToEcef(r,i,o);r=r*Math.PI/180,i=i*Math.PI/180;var a=Math.cos(r),u=Math.sin(r),c=Math.cos(i),h=Math.sin(i),l=-h*e-u*c*t+a*c*n+s[0],p=c*e-u*h*t+a*h*n+s[1],f=a*t+u*n+s[2];return[l,p,f]},e.prototype.geodeticToEcef=function(e,t,n){var r=this._wgs84a,i=this._wgs84b;e=e*Math.PI/180,t=t*Math.PI/180;var o=Math.cos(e),s=Math.sin(e),a=Math.cos(t),u=Math.sin(t),c=r*r,h=i*i,l=1/Math.sqrt(c*o*o+h*s*s),p=(c*l+n)*o,f=p*a,d=p*u,m=(h*l+n)*s;return[f,d,m]},e.prototype.ecefToGeodetic=function(e,t,n){var r=this._wgs84a,i=this._wgs84b,o=r*r,s=i*i,a=o-s,u=Math.sqrt(a/o),c=Math.sqrt(a/s),h=Math.sqrt(e*e+t*t),l=Math.atan2(n*r,h*i),p=Math.sin(l),f=Math.cos(l),d=Math.atan2(t,e),m=Math.atan2(n+c*c*i*p*p*p,h-u*u*r*f*f*f),v=Math.sin(m),g=Math.cos(m),y=r/Math.sqrt(1-u*u*v*v),_=h/g-y;return[180*m/Math.PI,180*d/Math.PI,_]},e}();n.GeoCoords=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],341:[function(e,t,n){"use strict";var r=e("three"),i=function(){function e(){this._epsilon=1e-9}return 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 r.Vector3(e[0],e[1],e[2]),n=t.length();return t.normalize(),(new r.Matrix4).makeRotationAxis(t,n)},e.prototype.rotate=function(e,t){var n=new r.Vector3(e[0],e[1],e[2]),i=this.rotationMatrix(t);return n.applyMatrix4(i),n},e.prototype.opticalCenter=function(e,t){var n=[-e[0],-e[1],-e[2]],r=[-t[0],-t[1],-t[2]];return this.rotate(r,n)},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,n){if(t>n)throw new Error("Invalid arguments: max must be larger than min.");for(var r=n-t;e>n||t>e;)e>n?e-=r:t>e&&(e+=r);return e},e.prototype.wrapAngle=function(e){return this.wrap(e,-Math.PI,Math.PI)},e.prototype.angleBetweenVector2=function(e,t,n,r){var i=Math.atan2(r,n)-Math.atan2(t,e);return this.wrapAngle(i)},e.prototype.angleDifference=function(e,t){var n=t-e;return this.wrapAngle(n)},e.prototype.relativeRotationAngle=function(e,t){var n=this.rotationMatrix([-e[0],-e[1],-e[2]]),r=this.rotationMatrix(t),i=n.multiply(r),o=i.elements,s=Math.acos((o[0]+o[5]+o[10]-1)/2);return s},e.prototype.angleToPlane=function(e,t){var n=(new r.Vector3).fromArray(e),i=n.length();if(i<this._epsilon)return 0;var o=n.dot((new r.Vector3).fromArray(t));return Math.asin(o/i)},e.prototype.distanceFromLatLon=function(e,t,n,r){var i=6371e3,o=this.degToRad(n-e),s=this.degToRad(r-t),a=Math.sin(o/2)*Math.sin(o/2)+Math.cos(e)*Math.cos(n)*Math.sin(s/2)*Math.sin(s/2),u=2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return u},e}();n.Spatial=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{three:220}],342:[function(e,t,n){"use strict";var r=e("three"),i=function(){function e(e,t){this._width=this._getValue(e.apiNavImIm.width,4),this._height=this._getValue(e.apiNavImIm.height,3),this._focal=this._getValue(e.apiNavImIm.cfocal,1),this._orientation=this._getValue(e.apiNavImIm.orientation,1),this._scale=this._getValue(e.apiNavImIm.atomic_scale,1),this._aspect=this._orientation<5?this._width/this._height:this._height/this._width,this._gpano=e.apiNavImIm.gpano?e.apiNavImIm.gpano:null,this._rt=this._getRt(e,t),this._srt=this._getSrt(this._rt,this._scale)}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focal",{get:function(){return this._focal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this._scale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspect",{get:function(){return this._aspect},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gpano",{get:function(){return this._gpano},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rt",{get:function(){return this._rt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srt",{get:function(){return this._srt},enumerable:!0,configurable:!0}),e.prototype.pixelToVertex=function(e,t,n){var i=new r.Vector4(e/this._focal*n,t/this._focal*n,n,1);return i.applyMatrix4((new r.Matrix4).getInverse(this._rt)),new r.Vector3(i.x/i.w,i.y/i.w,i.z/i.w)},e.prototype.upVector=function(){var e=this._rt.elements;switch(this._orientation){case 1:return new r.Vector3(-e[1],-e[5],-e[9]);case 3:return new r.Vector3(e[1],e[5],e[9]);case 6:return new r.Vector3(-e[0],-e[4],-e[8]);case 8:return new r.Vector3(e[0],e[4],e[8]);default:return new r.Vector3(-e[1],-e[5],-e[9])}},e.prototype.projectorMatrix=function(){var e=this._normalizedToTextureMatrix(),t=this._focal,n=(new r.Matrix4).set(t,0,0,0,0,t,0,0,0,0,0,0,0,0,1,0);return e.multiply(n),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 n=this._basicToSfm(e);return this.unprojectSfM(n,t)},e.prototype.projectSfM=function(e){var t=new r.Vector4(e[0],e[1],e[2],1);return t.applyMatrix4(this._rt),this._bearingToPixel([t.x,t.y,t.z])},e.prototype.unprojectSfM=function(e,t){var n=this._pixelToBearing(e),i=new r.Vector4(t*n[0],t*n[1],t*n[2],1);return i.applyMatrix4((new r.Matrix4).getInverse(this._rt)),[i.x/i.w,i.y/i.w,i.z/i.w]},e.prototype._pixelToBearing=function(e){if(this._gpano){var t=2*e[0]*Math.PI,n=2*-e[1]*Math.PI,i=Math.cos(n)*Math.sin(t),o=-Math.sin(n),s=Math.cos(n)*Math.cos(t);return[i,o,s]}var a=new r.Vector3(e[0],e[1],this._focal);return a.normalize(),[a.x,a.y,a.z]},e.prototype._bearingToPixel=function(e){if(this._gpano){var t=e[0],n=e[1],r=e[2],i=Math.atan2(t,r),o=Math.atan2(-n,Math.sqrt(t*t+r*r));return[i/(2*Math.PI),-o/(2*Math.PI)]}return[e[0]*this._focal/e[2],e[1]*this._focal/e[2]]},e.prototype._basicToSfm=function(e){var t,n;switch(this._orientation){case 1:t=e[0],n=e[1];break;case 3:t=1-e[0],n=1-e[1];break;case 6:t=e[1],n=1-e[0];break;case 8:t=1-e[1],n=e[0];break;default:t=e[0],n=e[1]}var r=this._width,i=this._height,o=Math.max(r,i),s=t*r/o-r/o/2,a=n*i/o-i/o/2;return[s,a]},e.prototype._sfmToBasic=function(e){var t,n,r=this._width,i=this._height,o=Math.max(r,i),s=(e[0]+r/o/2)/r*o,a=(e[1]+i/o/2)/i*o;switch(this._orientation){case 1:t=s,n=a;break;case 3:t=1-s,n=1-a;break;case 6:n=s,t=1-a;break;case 8:n=1-s,t=a;break;default:t=s,n=a}return[t,n]},e.prototype._getValue=function(e,t){return null!=e&&e>0?e:t},e.prototype._getRt=function(e,t){var n=new r.Vector3(e.apiNavImIm.rotation[0],e.apiNavImIm.rotation[1],e.apiNavImIm.rotation[2]),i=n.length();n.normalize();var o=new r.Matrix4;return o.makeRotationAxis(n,i),o.setPosition(new r.Vector3(t[0],t[1],t[2])),o},e.prototype._getSrt=function(e,t){var n=e.clone(),i=n.elements;return i[12]=t*i[12],i[13]=t*i[13],i[14]=t*i[14],n.scale(new r.Vector3(t,t,t)),n},e.prototype._normalizedToTextureMatrix=function(){var e=Math.max(this._width,this._height),t=e/this._width,n=e/this._height;switch(this._orientation){case 1:return(new r.Matrix4).set(t,0,0,.5,0,-n,0,.5,0,0,1,0,0,0,0,1);case 3:return(new r.Matrix4).set(-t,0,0,.5,0,n,0,.5,0,0,1,0,0,0,0,1);case 6:return(new r.Matrix4).set(0,-n,0,.5,-t,0,0,.5,0,0,1,0,0,0,0,1);case 8:return(new r.Matrix4).set(0,n,0,.5,t,0,0,.5,0,0,1,0,0,0,0,1);default:return(new r.Matrix4).set(t,0,0,.5,0,-n,0,.5,0,0,1,0,0,0,0,1)}},e}();n.Transform=i},{three:220}],343:[function(e,t,n){"use strict";var r=e("../Geo"),i=function(){function e(){this._spatial=new r.Spatial,this._tileSize=256}return e.prototype.getTile=function(e,t){var n=Math.pow(2,t),r=this._latLonToPoint(e);return{x:Math.floor(n*r.x/this._tileSize),y:Math.floor(n*r.y/this._tileSize),z:t}},e.prototype.getBounds=function(e){e=this._normalize(e);var t=Math.pow(2,e.z),n=this._tileSize/t,r={x:e.x*n,y:e.y*n+n},i={x:e.x*n+n,y:e.y*n};return{ne:this._pointToLatLon(i),sw:this._pointToLatLon(r)}},e.prototype._normalize=function(e){var t=Math.pow(2,e.z);return e.x=(e.x%t+t)%t,e.y=(e.y%t+t)%t,e},e.prototype._latLonToPoint=function(e){var t=Math.sin(this._spatial.degToRad(e.lat));return{x:this._tileSize*(.5+e.lon/360),y:this._tileSize*(.5-Math.log((1+t)/(1-t))/(4*Math.PI))}},e.prototype._pointToLatLon=function(e){return{lat:this._spatial.radToDeg(2*Math.atan(Math.exp(2*Math.PI*(.5-e.y/this._tileSize))))-90,lon:360*(e.x/this._tileSize-.5)}},e}();n.WebMercator=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{"../Geo":273}],344:[function(e,t,n){"use strict";var r=e("underscore"),i=e("graphlib"),o=e("rbush"),s=e("three"),a=e("latlon-geohash"),u=e("../Edge"),c=e("../Geo"),h=e("../Graph"),l=function(){function e(){}return e.n="n",e.nw="nw",e.w="w",e.sw="sw",e.s="s",e.se="se",e.e="e",e.ne="ne",e}(),p=function(){function e(){this._boxWidth=.001,this._defaultAlt=2,this._sequences={},this._sequenceHashes={},this._nodeIndex=o(2e4,[".lon",".lat",".lon",".lat"]),this._graph=new i.Graph({multigraph:!0}),this._cachedNodes={},this._unWorthyNodes={},this._edgeCalculator=new u.EdgeCalculator,this._spatial=new c.Spatial,this._geoCoords=new c.GeoCoords}return e.prototype.addNodesFromAPI=function(e,t){var n=this;if(void 0!==e){for(var i=e.hs[0],o=a.bounds(i),s=a.neighbours(i),u=[],c=0,l=e.ss;c<l.length;c++){var p=l[c],f=p.key;if(f in this._sequences)u.push(this._sequenceHashes[f]);else{var d=new h.Sequence(p);this._sequences[f]=d;for(var m={},v=0,g=p.keys;v<g.length;v++){var y=g[v];m[y]=d}this._sequenceHashes[f]=m,u.push(m)}}var _=r.map(e.ims,function(e){var t=e.lat;null!=e.clat&&(t=e.clat);var r=e.lon;null!=e.clon&&(r=e.clon);var a=e.ca;null!=e.cca&&(a=e.cca),null==e.calt&&(e.calt=n._defaultAlt);var c={lat:t,lon:r};null==e.rotation&&(e.rotation=n._computeRotation(e.ca,e.orientation));for(var l=n._computeHs(c,o.sw,o.ne,i,s),p=null,f=0,d=u;f<d.length;f++){var m=d[f];if(e.key in m){p=m[e.key];break}}var v=new h.Node(a,c,!1,p,e,l);return n._unWorthyNodes[e.key]=!0,v});this.insertNodes(_),this.makeNodesWorthy(t)}},e.prototype.makeNodesWorthy=function(e){var t,n=[];for(var i in this._unWorthyNodes)if(this._unWorthyNodes.hasOwnProperty(i))if(this._unWorthyNodes[i]){var o=this.getNode(i),s=o.hs;t=!0,r.each(s,function(n){t=t&&!!e[n]}),t&&(o.worthy=!0,this._unWorthyNodes[i]=!1,n.push(i))}else n.push(i);for(var a=0,u=n;a<u.length;a++){var i=u[a];delete this._unWorthyNodes[i]}},e.prototype.getNode=function(e){return this._graph.node(e)},e.prototype.getEdges=function(e){var t=this,n=this._graph.outEdges(e.key);return r.map(n,function(e){var n=t._graph.edge(e);return{data:n,from:e.v,to:e.w}})},e.prototype.cacheNode=function(e){this.computeEdges(e),e.cached=!0,e.lastUsed=(new Date).getTime(),this._cachedNodes[e.key]=!0},e.prototype.evictNodeCache=function(){Object.keys(this._cachedNodes).length<30},e.prototype.unCacheNode=function(e){delete this._cachedNodes[e.key],e.lastCacheEvict=(new Date).getTime()},e.prototype.computeEdges=function(e){if(!e.worthy)return!1;var t=this._edgeCalculator.computeSequenceEdges(e),n=r.map(t,function(e){return e.to}),i=e.latLon.lon-this._boxWidth/2,o=e.latLon.lat-this._boxWidth/2,s=e.latLon.lon+this._boxWidth/2,a=e.latLon.lat+this._boxWidth/2,u=r.map(this._nodeIndex.search([i,o,s,a]),function(e){return e.node}),c=this._edgeCalculator.getPotentialEdges(e,u,n);return t=t.concat(this._edgeCalculator.computeStepEdges(e,c,e.findPrevKeyInSequence(),e.findNextKeyInSequence())),t=t.concat(this._edgeCalculator.computeTurnEdges(e,c)),t=t.concat(this._edgeCalculator.computePanoEdges(e,c)),t=t.concat(this._edgeCalculator.computePerspectiveToPanoEdges(e,c)),this._addEdgesToNode(e,t),e.edges=this.getEdges(e),!0},e.prototype.insertNodes=function(e){var t=this;r.each(e,function(e){t.insertNode(e)})},e.prototype.insertNode=function(e){null==this.getNode(e.key)&&(this._nodeIndex.insert({lat:e.latLon.lat,lon:e.latLon.lon,node:e}),this._graph.setNode(e.key,e))},e.prototype.nextNode=function(e,t){var n=this.nextKey(e,t);return null==n?null:this.getNode(n)},e.prototype.nextKey=function(e,t){for(var n=this._graph.outEdges(e.key),r=0,i=n;r<i.length;r++){var o=i[r],s=this._graph.edge(o);if(s.direction===t)return o.w}return null},e.prototype._computeHs=function(e,t,n,r,i){var o=[r],s=[0,0,0],a=this._geoCoords.geodeticToEnu(n.lat,n.lon,0,t.lat,t.lon,0),u=this._geoCoords.geodeticToEnu(e.lat,e.lon,0,t.lat,t.lon,0),c=u[0]-s[0],h=a[0]-u[0],p=u[1]-s[1],f=a[1]-u[1],d=20>c,m=20>h,v=20>p,g=20>f;return g&&o.push(i[l.n]),g&&d&&o.push(i[l.nw]),d&&o.push(i[l.w]),d&&v&&o.push(i[l.sw]),v&&o.push(i[l.s]),v&&m&&o.push(i[l.se]),m&&o.push(i[l.e]),m&&g&&o.push(i[l.ne]),o},e.prototype._computeRotation=function(e,t){var n=0,r=0,i=0;switch(t){case 1:n=Math.PI/2;break;case 3:n=-Math.PI/2,i=Math.PI;break;case 6:r=-Math.PI/2,i=-Math.PI/2;break;case 8:r=Math.PI/2,i=Math.PI/2}var o=(new s.Matrix4).makeRotationZ(i),a=new s.Euler(n,r,e*Math.PI/180,"XYZ"),u=(new s.Matrix4).makeRotationFromEuler(a),c=(new s.Vector4).setAxisAngleFromRotationMatrix(u.multiply(o));return c.multiplyScalar(c.w).toArray().slice(0,3)},e.prototype._addEdgesToNode=function(e,t){var n=this._graph.outEdges(e.key);for(var r in n)if(n.hasOwnProperty(r)){var i=n[r];this._graph.removeEdge(i)}for(var o=0,s=t;o<s.length;o++){var a=s[o];this._graph.setEdge(e.key,a.to,a.data,e.key+a.to+a.data.direction)}},e}();n.Graph=p,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=p},{"../Edge":271,"../Geo":273,"../Graph":274,graphlib:158,"latlon-geohash":183,rbush:195,three:220,underscore:221}],345:[function(e,t,n){"use strict";var r=e("rx"),i=e("../Graph"),o=function(){function e(e,t){this._updates$=new r.Subject,this._cache$=new r.Subject,this._tilesService=new i.TilesService(e),this._vectorTilesService=new i.VectorTilesService(t),this._imageLoadingService=new i.ImageLoadingService,this._graph$=this._updates$.scan(function(e,t){var n=t(e);return n.evictNodeCache(),n},new i.Graph).shareReplay(1),this._graph$.subscribe(),this._updates$.onNext(function(e){return e}),this._loadingNode$=this._cache$.distinct(function(e){return e.key+e.lastCacheEvict}).flatMap(function(e){return e.cacheAssets();
|
||
}).publish(),this._loadingNode$.connect(),this._loadingNode$.subscribe(this._imageLoadingService.loadnode$),this._cachedNode$=this._loadingNode$.filter(function(e){return!!e.image&&!!e.mesh}).publish(),this._cachedNode$.connect(),this._cachedNode$.subscribe(this._vectorTilesService.cacheNode$),this._cachedNode$.map(function(e){return function(t){return t.cacheNode(e),t}}).subscribe(this._updates$);var n;this._tilesService.tiles$.combineLatest(this._tilesService.cachedTiles$,function(e,t){return function(r){return n===e?r:(n=e,r.addNodesFromAPI(e,t),r)}}).subscribe(this._updates$)}return Object.defineProperty(e.prototype,"graph$",{get:function(){return this._graph$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageLoadingService",{get:function(){return this._imageLoadingService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vectorTilesService",{get:function(){return this._vectorTilesService},enumerable:!0,configurable:!0}),e.prototype.node$=function(e){var t=this;return this._graph$.skipWhile(function(n){var r=n.getNode(e);return null==r?(t._tilesService.cacheIm$.onNext(e),!0):r.worthy?r.cached?!1:(t._cache$.onNext(r),!0):(t._tilesService.cacheNodeH$.onNext(r),!0)}).map(function(t){return t.getNode(e)}).take(1)},e.prototype.nextNode$=function(e,t){var n=this;return e.cached||r.Observable["throw"](new Error("node is not yet cached")),this._graph$.map(function(n){return n.nextKey(e,t)}).distinct().flatMap(function(e){return null==e?r.Observable["throw"](new Error("no Image in direction")):n.node$(e)})},e}();n.GraphService=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../Graph":274,rx:219}],346:[function(e,t,n){"use strict";var r=e("rx"),i=function(){function e(){this._loadnode$=new r.Subject,this._loadstatus$=this._loadnode$.scan(function(e,t){return e[t.key]=t.loadStatus,e},{}).shareReplay(1),this._loadstatus$.subscribe()}return Object.defineProperty(e.prototype,"loadnode$",{get:function(){return this._loadnode$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loadstatus$",{get:function(){return this._loadstatus$},enumerable:!0,configurable:!0}),e}();n.ImageLoadingService=i},{rx:219}],347:[function(e,t,n){"use strict";var r=function(){function e(e,t,n,r,i,o,s,a){this._alt=e,this._firstSeenAt=t,this._latLon=n,this._key=r,this._lastSeenAt=i,this._rects=o,this._dPackage=s,this._value=a}return Object.defineProperty(e.prototype,"alt",{get:function(){return this._alt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstSeenAt",{get:function(){return this._firstSeenAt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"latLon",{get:function(){return this._latLon},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastSeenAt",{get:function(){return this._lastSeenAt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rects",{get:function(){return this._rects},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dPackage",{get:function(){return this._dPackage},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),e}();n.MapillaryObject=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],348:[function(e,t,n){"use strict";var r=function(){function e(e,t,n){this._capturedAt=e,this._imageKey=t,this._rectKey=n}return Object.defineProperty(e.prototype,"capturedAt",{get:function(){return this._capturedAt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageKey",{get:function(){return this._imageKey},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rectKey",{get:function(){return this._rectKey},enumerable:!0,configurable:!0}),e}();n.MapillaryRect=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],349:[function(e,t,n){"use strict";var r=e("pbf"),i=function(){function e(){}return e.read=function(t){var n=new r(t);return n.readFields(e._readMeshField,{faces:[],vertices:[]})},e._readMeshField=function(e,t,n){1===e?t.vertices.push(n.readFloat()):2===e&&t.faces.push(n.readVarint())},e}();n.MeshReader=i},{pbf:187}],350:[function(e,t,n){(function(t,r){"use strict";var i=e("rx"),o=e("../Graph"),s=e("../Utils"),a=function(){function e(e,t,n,r,i,o){this._apiNavImIm=i,this._key=i.key,this._ca=e,this._latLon=t,this._sequence=r,this._hs=o,this._image=null,this._mesh=null,this._edges=null,this.worthy=n,this.cached=!1,this.lastCacheEvict=0,this.lastUsed=(new Date).getTime(),this._loadStatus={loaded:0,total:100}}return Object.defineProperty(e.prototype,"apiNavImIm",{get:function(){return this._apiNavImIm},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"user",{get:function(){return this._apiNavImIm.user},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"capturedAt",{get:function(){return this._apiNavImIm.captured_at},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ca",{get:function(){return this._ca},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"latLon",{get:function(){return this._latLon},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sequence",{get:function(){return this._sequence},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hs",{get:function(){return this._hs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"image",{get:function(){return this._image},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"edges",{get:function(){return this._edges},set:function(e){this._edges=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loadStatus",{get:function(){return this._loadStatus},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loaded",{get:function(){return this.cached&&null!=this._image},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"merged",{get:function(){return null!=this.apiNavImIm&&null!=this.apiNavImIm.merge_version&&this.apiNavImIm.merge_version>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pano",{get:function(){return null!=this.apiNavImIm.gpano&&null!=this.apiNavImIm.gpano.FullPanoWidthPixels},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fullPano",{get:function(){return null!=this.apiNavImIm.gpano&&0===this.apiNavImIm.gpano.CroppedAreaLeftPixels&&0===this.apiNavImIm.gpano.CroppedAreaTopPixels&&this.apiNavImIm.gpano.CroppedAreaImageWidthPixels===this.apiNavImIm.gpano.FullPanoWidthPixels&&this.apiNavImIm.gpano.CroppedAreaImageHeightPixels===this.apiNavImIm.gpano.FullPanoHeightPixels},enumerable:!0,configurable:!0}),e.prototype.findNextKeyInSequence=function(){return void 0===this.sequence?null:this.sequence.findNextKey(this.key)},e.prototype.findPrevKeyInSequence=function(){return void 0===this.sequence?null:this.sequence.findPrevKey(this.key)},e.prototype.cacheAssets=function(){var e=this;return this.cacheImage().combineLatest(this.cacheMesh(),function(t,n){return e._loadStatus.loaded=0,e._loadStatus.total=0,n&&(e._mesh=n.object,e._loadStatus.loaded+=n.loaded.loaded,e._loadStatus.total+=n.loaded.total),t&&(e._image=t.object,e._loadStatus.loaded+=t.loaded.loaded,e._loadStatus.total+=t.loaded.total),e})},e.prototype.cacheImage=function(){var e=this;return i.Observable.create(function(n){var r=new Image;if(r.crossOrigin="Anonymous","development"===t.env.MAPENV)return n.onNext({loaded:{loaded:1,total:1},object:e._image}),void n.onCompleted();var i=new XMLHttpRequest,o=e.fullPano?s.Settings.basePanoramaSize:s.Settings.baseImageSize;i.open("GET",s.Urls.image(e.key,o),!0),i.responseType="arraybuffer",i.onload=function(e){r.onload=function(){n.onNext({loaded:{loaded:e.loaded,total:e.total},object:r}),n.onCompleted()},r.onerror=function(e){n.onError(e)};var t=new Blob([i.response]);r.src=window.URL.createObjectURL(t)},i.onprogress=function(e){n.onNext({loaded:{loaded:e.loaded,total:e.total},object:null})},i.send()})},e.prototype.cacheMesh=function(){var e=this;return i.Observable.create(function(n){if("development"===t.env.MAPENV)return n.onNext({loaded:{loaded:1,total:1},object:{faces:[[-1]],vertices:[[-1]]}}),void n.onCompleted();if(!e.merged){var i={faces:[],vertices:[]};return n.onNext({loaded:{loaded:0,total:0},object:i}),void n.onCompleted()}var a=new XMLHttpRequest;a.open("GET",s.Urls.proto_mesh(e.key),!0),a.responseType="arraybuffer",a.onload=function(e){var t;t=200===a.status?o.MeshReader.read(new r(a.response)):{faces:[],vertices:[]},n.onNext({loaded:{loaded:e.loaded,total:e.total},object:t}),n.onCompleted()},a.onprogress=function(e){n.onNext({loaded:{loaded:e.loaded,total:e.total},object:null})},a.send(null)})},e}();n.Node=a,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a}).call(this,e("_process"),e("buffer").Buffer)},{"../Graph":274,"../Utils":278,_process:6,buffer:7,rx:219}],351:[function(e,t,n){"use strict";var r=e("underscore"),i=function(){function e(e){this._response=e,this.key=e.key,this.keys=e.keys,this.path=e.path}return e.prototype.findNextKey=function(e){var t=r.indexOf(this.keys,e);return t+1>=this.keys.length||-1===t?null:this.keys[t+1]},e.prototype.findPrevKey=function(e){var t=r.indexOf(this.keys,e);return 0===t||-1===t?null:this.keys[t-1]},e}();n.Sequence=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{underscore:221}],352:[function(e,t,n){"use strict";var r=e("underscore"),i=e("latlon-geohash"),o=e("rx"),s=e("../Geo"),a=function(){function e(e){var t=this;this._updates$=new o.Subject,this._cacheH$=new o.Subject,this._cacheNodeH$=new o.Subject,this._cacheIm$=new o.Subject,this._cacheNode$=new o.Subject,this._spatialLib=new s.Spatial,this._apiV2=e,this._cachedTiles$=this._updates$.scan(function(e,t){return t(e)},{}).shareReplay(1),this._imTiles$=this._cacheIm$.distinct().flatMap(function(e){return o.Observable.fromPromise(t._apiV2.nav.im(e))}),this._hTiles$=this._cacheH$.distinct().flatMap(function(e){return o.Observable.fromPromise(t._apiV2.nav.h(e))}),this._cacheNodeH$.distinct(function(e){return e.key}).flatMap(function(e){return o.Observable.from(e.hs)}).subscribe(this._cacheH$),this._tiles$=this._imTiles$.merge(this._hTiles$).publish(),this._tiles$.connect(),this._tiles$.map(function(e){return function(t){return void 0!==e&&r.each(e.hs,function(e){t[e]=!0}),t}}).subscribe(this._updates$),this._cacheNode$.flatMap(function(e){var t=[],n=i.encode(e.latLon.lat,e.latLon.lon,7);return t.push(n),r.each(i.neighbours(n),function(e){t.push(e)}),o.Observable.from(t)}).subscribe(this._cacheH$)}return Object.defineProperty(e.prototype,"cacheH$",{get:function(){return this._cacheH$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheNodeH$",{get:function(){return this._cacheNodeH$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheIm$",{get:function(){return this._cacheIm$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheNode$",{get:function(){return this._cacheNode$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cachedTiles$",{get:function(){return this._cachedTiles$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tiles$",{get:function(){return this._tiles$},enumerable:!0,configurable:!0}),e}();n.TilesService=a,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Geo":273,"latlon-geohash":183,rx:219,underscore:221}],353:[function(e,t,n){"use strict";var r=e("rx"),i=e("../Geo"),o=e("../Graph"),s=function(){function e(e){var t=this;this._cacheNode$=new r.Subject,this._apiV3=e,this._webMercator=new i.WebMercator,this._mapillaryObjects$=this._cacheNode$.map(function(e){return t._webMercator.getTile(e.latLon,17)}).distinct(function(e){return e.z+"-"+e.x+"-"+e.y}).flatMap(function(e){return t._apiV3.model.get(["tile","all",e.z,e.x,e.y,"objects",{from:0,to:100},["key","value","package","l","alt","rects","last_seen_at","first_seen_at"]])}).flatMap(function(e){var t=parseInt(Object.keys(e.json.tile.all)[0],10),n=parseInt(Object.keys(e.json.tile.all[t])[0],10),i=parseInt(Object.keys(e.json.tile.all[t][n])[0],10),s=e.json.tile.all[t][n][i].objects,a=[];for(var u in s)if(s.hasOwnProperty(u)){var c=s[u];if(delete c.$__path,c.rects&&c.rects.length>1){var h=[];for(var l in c.rects)if(c.rects.hasOwnProperty(l)){var p=c.rects[l],f=new o.MapillaryRect(p.capturedAt,p.imageKey,p.rectKey);h.push(f)}var d=new o.MapillaryObject(c.alt,c.first_seen_at,c.l,c.key,c.lastSeenAt,c.rects,c.dPackage,c.value);a.push(d)}}return r.Observable.from(a)}).shareReplay(1)}return Object.defineProperty(e.prototype,"cacheNode$",{get:function(){return this._cacheNode$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mapillaryObjects$",{get:function(){return this._mapillaryObjects$},enumerable:!0,configurable:!0}),e}();n.VectorTilesService=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Geo":273,"../Graph":274,rx:219}],354:[function(e,t,n){"use strict";var r=e("three"),i=e("../../Edge"),o=e("../../Geo"),s=function(){function e(e,t,n){this._spatial=new o.Spatial,this._geoCoords=new o.GeoCoords,this._settings=null!=e?e:new i.EdgeCalculatorSettings,this._directions=null!=t?t:new i.EdgeCalculatorDirections,this._coefficients=null!=n?n:new i.EdgeCalculatorCoefficients}return e.prototype.getPotentialEdges=function(e,t,n){if(!e.worthy||!e.merged)return[];for(var i=this._spatial.viewingDirection(e.apiNavImIm.rotation),o=this._spatial.angleToPlane(i.toArray(),[0,0,1]),s=[],a=0,u=t;a<u.length;a++){var c=u[a];if(c.merged&&c.key!==e.key){var h=this._geoCoords.geodeticToEnu(c.latLon.lat,c.latLon.lon,c.apiNavImIm.calt,e.latLon.lat,e.latLon.lon,e.apiNavImIm.calt),l=new r.Vector3(h[0],h[1],h[2]),p=l.length();if(!(p>this._settings.maxDistance&&n.indexOf(c.key)<0)){var f=this._spatial.angleBetweenVector2(i.x,i.y,l.x,l.y),d=this._spatial.angleToPlane(l.toArray(),[0,0,1]),m=this._spatial.viewingDirection(c.apiNavImIm.rotation),v=this._spatial.angleBetweenVector2(i.x,i.y,m.x,m.y),g=this._spatial.angleToPlane(m.toArray(),[0,0,1]),y=g-o,_=this._spatial.relativeRotationAngle(e.apiNavImIm.rotation,c.apiNavImIm.rotation),b=this._spatial.angleBetweenVector2(1,0,l.x,l.y),x=null!=c.sequence&&null!=e.sequence&&c.sequence.key===e.sequence.key,w=null==c.apiNavImIm.merge_cc&&null==e.apiNavImIm.merge_cc||c.apiNavImIm.merge_cc===e.apiNavImIm.merge_cc,S={apiNavImIm:c.apiNavImIm,directionChange:v,distance:p,fullPano:c.fullPano,motionChange:f,rotation:_,sameMergeCc:w,sameSequence:x,verticalDirectionChange:y,verticalMotion:d,worldMotionAzimuth:b};s.push(S)}}}return s},e.prototype.computeSequenceEdges=function(e){if(!e.worthy)return[];var t=[],n=e.findNextKeyInSequence();null!=n&&t.push({data:{direction:i.EdgeDirection.Next,worldMotionAzimuth:Number.NaN},from:e.apiNavImIm.key,to:n});var r=e.findPrevKeyInSequence();return null!=r&&t.push({data:{direction:i.EdgeDirection.Prev,worldMotionAzimuth:Number.NaN},from:e.apiNavImIm.key,to:r}),t},e.prototype.computeStepEdges=function(e,t,n,r){var i=[];if(e.fullPano)return i;for(var o in this._directions.steps)if(this._directions.steps.hasOwnProperty(o)){for(var s=this._directions.steps[o],a=Number.MAX_VALUE,u=null,c=null,h=0,l=t;h<l.length;h++){var p=l[h];if(!(p.fullPano||Math.abs(p.directionChange)>this._settings.stepMaxDirectionChange)){var f=this._spatial.angleDifference(s.motionChange,p.motionChange),d=this._spatial.angleDifference(p.directionChange,f),m=Math.max(Math.abs(f),Math.abs(d));if(!(Math.abs(m)>this._settings.stepMaxDrift)){var v=p.apiNavImIm.key;if(!s.useFallback||v!==n&&v!==r||(c=p),!(p.distance>this._settings.stepMaxDistance)){f=Math.sqrt(f*f+p.verticalMotion*p.verticalMotion);var g=this._coefficients.stepPreferredDistance*Math.abs(p.distance-this._settings.stepPreferredDistance)/this._settings.stepMaxDistance+this._coefficients.stepMotion*f/this._settings.stepMaxDrift+this._coefficients.stepRotation*p.rotation/this._settings.stepMaxDirectionChange+this._coefficients.stepSequencePenalty*(p.sameSequence?0:1)+this._coefficients.stepMergeCcPenalty*(p.sameMergeCc?0:1);a>g&&(a=g,u=p)}}}}u=null==u?c:u,null!=u&&i.push({data:{direction:s.direction,worldMotionAzimuth:u.worldMotionAzimuth},from:e.key,to:u.apiNavImIm.key})}return i},e.prototype.computeTurnEdges=function(e,t){var n=[];if(e.fullPano)return n;for(var r in this._directions.turns)if(this._directions.turns.hasOwnProperty(r)){for(var o=this._directions.turns[r],s=Number.MAX_VALUE,a=null,u=0,c=t;u<c.length;u++){var h=c[u];if(!(h.fullPano||h.distance>this._settings.turnMaxDistance)){var l=o.direction!==i.EdgeDirection.TurnU&&h.distance<this._settings.turnMaxRigDistance&&Math.abs(h.directionChange)>this._settings.turnMinRigDirectionChange,p=this._spatial.angleDifference(o.directionChange,h.directionChange),f=void 0;if(l&&h.directionChange*o.directionChange>0&&Math.abs(h.directionChange)<Math.abs(o.directionChange))f=-Math.PI/2+Math.abs(h.directionChange);else{if(Math.abs(p)>this._settings.turnMaxDirectionChange)continue;var d=o.motionChange?this._spatial.angleDifference(o.motionChange,h.motionChange):0;d=Math.sqrt(d*d+h.verticalMotion*h.verticalMotion),f=this._coefficients.turnDistance*h.distance/this._settings.turnMaxDistance+this._coefficients.turnMotion*d/Math.PI+this._coefficients.turnSequencePenalty*(h.sameSequence?0:1)+this._coefficients.turnMergeCcPenalty*(h.sameMergeCc?0:1)}s>f&&(s=f,a=h)}}null!=a&&n.push({data:{direction:o.direction,worldMotionAzimuth:a.worldMotionAzimuth},from:e.key,to:a.apiNavImIm.key})}return n},e.prototype.computePerspectiveToPanoEdges=function(e,t){if(e.fullPano)return[];for(var n=Number.MAX_VALUE,r=null,o=0,s=t;o<s.length;o++){var a=s[o];if(a.fullPano){var u=this._coefficients.panoPreferredDistance*Math.abs(a.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(a.motionChange)/Math.PI+this._coefficients.panoMergeCcPenalty*(a.sameMergeCc?0:1);n>u&&(n=u,r=a)}}return null==r?[]:[{data:{direction:i.EdgeDirection.Pano,worldMotionAzimuth:r.worldMotionAzimuth},from:e.key,to:r.apiNavImIm.key}]},e.prototype.computeRotationEdges=function(e,t){var n=[];if(e.fullPano)return n;for(var r in this._directions.rotations)if(this._directions.rotations.hasOwnProperty(r)){for(var i=this._directions.rotations[r],o=Number.MAX_VALUE,s=null,a=0,u=t;a<u.length;a++){var c=u[a];if(!c.fullPano&&!(c.distance>this._settings.rotationMaxDistance||c.directionChange*i.directionChangeSign<0||Math.abs(c.directionChange)>this._settings.rotationMaxDirectionChange||Math.abs(c.verticalDirectionChange)>this._settings.rotationMaxVerticalDirectionChange)){var h=Math.abs(c.directionChange);o>h&&(o=h,s=c)}}null!=s&&n.push({data:{direction:i.direction,worldMotionAzimuth:s.worldMotionAzimuth},from:e.key,to:s.apiNavImIm.key})}return n},e.prototype.computePanoEdges=function(e,t){if(!e.fullPano)return[];for(var n=[],r=[],o=[],s=0,a=t;s<a.length;s++){var u=a[s];if(!(u.distance>this._settings.panoMaxDistance))if(u.fullPano){if(u.distance<this._settings.panoMinDistance)continue;r.push(u)}else for(var c in this._directions.panos)if(this._directions.panos.hasOwnProperty(c)){var h=this._directions.panos[c],l=this._spatial.angleDifference(u.directionChange,u.motionChange),p=this._spatial.angleDifference(h.directionChange,l);if(!(Math.abs(p)>this._settings.panoMaxStepTurnChange)){o.push([h.direction,u]);break}}}for(var f=Math.PI/this._settings.panoMaxItems,d=[],m=[],v=0;v<this._settings.panoMaxItems;v++){for(var g=v/this._settings.panoMaxItems*2*Math.PI,y=Number.MAX_VALUE,_=null,b=0,x=r;b<x.length;b++){var u=x[b],w=this._spatial.angleDifference(g,u.motionChange);if(!(Math.abs(w)>f)){for(var S=Number.MAX_VALUE,M=0,E=d;M<E.length;M++){var C=E[M],T=Math.abs(this._spatial.angleDifference(C,u.motionChange));S>T&&(S=T)}if(!(f>=S)){var A=this._coefficients.panoPreferredDistance*Math.abs(u.distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(w)/f+this._coefficients.panoSequencePenalty*(u.sameSequence?0:1)+this._coefficients.panoMergeCcPenalty*(u.sameMergeCc?0:1);y>A&&(y=A,_=u)}}}null!=_?(d.push(_.motionChange),n.push({data:{direction:i.EdgeDirection.Pano,worldMotionAzimuth:_.worldMotionAzimuth},from:e.key,to:_.apiNavImIm.key})):m.push(g)}var P={};P[i.EdgeDirection.Pano]=d,P[i.EdgeDirection.StepForward]=[],P[i.EdgeDirection.StepLeft]=[],P[i.EdgeDirection.StepBackward]=[],P[i.EdgeDirection.StepRight]=[];for(var O=0,L=m;O<L.length;O++){var R=L[O],N=[];for(var c in this._directions.panos)if(this._directions.panos.hasOwnProperty(c)){for(var h=this._directions.panos[c],D=P[i.EdgeDirection.Pano].concat(P[h.direction]).concat(P[h.prev]).concat(P[h.next]),y=Number.MAX_VALUE,_=null,I=0,k=o;I<k.length;I++){var u=k[I];if(u[0]===h.direction){var j=this._spatial.angleDifference(R,u[1].motionChange);if(!(Math.abs(j)>f)){for(var F=Number.MAX_VALUE,B=0,V=D;B<V.length;B++){var C=V[B],S=Math.abs(this._spatial.angleDifference(C,u[1].motionChange));F>S&&(F=S)}if(!(f>=F)){var A=this._coefficients.panoPreferredDistance*Math.abs(u[1].distance-this._settings.panoPreferredDistance)/this._settings.panoMaxDistance+this._coefficients.panoMotion*Math.abs(j)/f+this._coefficients.panoMergeCcPenalty*(u[1].sameMergeCc?0:1);y>A&&(y=A,_=u)}}}}null!=_&&(N.push(_),n.push({data:{direction:_[0],worldMotionAzimuth:_[1].worldMotionAzimuth},from:e.key,to:_[1].apiNavImIm.key}))}for(var U=0,G=N;U<G.length;U++){var z=G[U];P[z[0]].push(z[1].motionChange)}}return n},e}();n.EdgeCalculator=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../../Edge":271,"../../Geo":273,three:220}],355:[function(e,t,n){"use strict";var r=function(){function e(){this.stepPreferredDistance=4,this.stepMotion=3,this.stepRotation=4,this.stepSequencePenalty=2,this.stepMergeCcPenalty=6,this.turnDistance=4,this.turnMotion=2,this.turnSequencePenalty=1,this.turnMergeCcPenalty=4,this.panoPreferredDistance=2,this.panoMotion=2,this.panoSequencePenalty=1,this.panoMergeCcPenalty=4}return e}();n.EdgeCalculatorCoefficients=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],356:[function(e,t,n){"use strict";var r=e("../../Edge"),i=function(){function e(){this.steps={},this.turns={},this.panos={},this.rotations={},this.steps[r.EdgeDirection.StepForward]={direction:r.EdgeDirection.StepForward,motionChange:0,useFallback:!0},this.steps[r.EdgeDirection.StepBackward]={direction:r.EdgeDirection.StepBackward,motionChange:Math.PI,useFallback:!0},this.steps[r.EdgeDirection.StepLeft]={direction:r.EdgeDirection.StepLeft,motionChange:Math.PI/2,useFallback:!1},this.steps[r.EdgeDirection.StepRight]={direction:r.EdgeDirection.StepRight,motionChange:-Math.PI/2,useFallback:!1},this.turns[r.EdgeDirection.TurnLeft]={direction:r.EdgeDirection.TurnLeft,directionChange:Math.PI/2,motionChange:Math.PI/4},this.turns[r.EdgeDirection.TurnRight]={direction:r.EdgeDirection.TurnRight,directionChange:-Math.PI/2,motionChange:-Math.PI/4},this.turns[r.EdgeDirection.TurnU]={direction:r.EdgeDirection.TurnU,directionChange:Math.PI,motionChange:null},this.panos[r.EdgeDirection.StepForward]={direction:r.EdgeDirection.StepForward,directionChange:0,next:r.EdgeDirection.StepLeft,prev:r.EdgeDirection.StepRight},this.panos[r.EdgeDirection.StepBackward]={direction:r.EdgeDirection.StepBackward,directionChange:Math.PI,next:r.EdgeDirection.StepRight,prev:r.EdgeDirection.StepLeft},this.panos[r.EdgeDirection.StepLeft]={direction:r.EdgeDirection.StepLeft,directionChange:Math.PI/2,next:r.EdgeDirection.StepBackward,prev:r.EdgeDirection.StepForward},this.panos[r.EdgeDirection.StepRight]={direction:r.EdgeDirection.StepRight,directionChange:-Math.PI/2,next:r.EdgeDirection.StepForward,prev:r.EdgeDirection.StepBackward},this.rotations[r.EdgeDirection.RotateLeft]={direction:r.EdgeDirection.RotateLeft,directionChangeSign:1},this.rotations[r.EdgeDirection.RotateRight]={direction:r.EdgeDirection.RotateRight,directionChangeSign:-1}}return e}();n.EdgeCalculatorDirections=i},{"../../Edge":271}],357:[function(e,t,n){"use strict";var r=function(){function e(){this.stepMaxDistance=20,this.stepMaxDirectionChange=Math.PI/6,this.stepMaxDrift=Math.PI/6,this.stepPreferredDistance=4,this.turnMaxDistance=15,this.turnMaxDirectionChange=2*Math.PI/9,this.turnMaxRigDistance=.65,this.turnMinRigDirectionChange=Math.PI/6,this.panoMinDistance=.1,this.panoMaxDistance=20,this.panoPreferredDistance=5,this.panoMaxItems=4,this.panoMaxStepTurnChange=Math.PI/8,this.rotationMaxDistance=this.turnMaxRigDistance,this.rotationMaxDirectionChange=Math.PI/6,this.rotationMaxVerticalDirectionChange=Math.PI/8}return Object.defineProperty(e.prototype,"maxDistance",{get:function(){return Math.max(this.panoMaxDistance,Math.max(this.stepMaxDistance,this.turnMaxDistance))},enumerable:!0,configurable:!0}),e}();n.EdgeCalculatorSettings=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],358:[function(e,t,n){"use strict";!function(e){e[e.Next=0]="Next",e[e.Prev=1]="Prev",e[e.StepLeft=2]="StepLeft",e[e.StepRight=3]="StepRight",e[e.StepForward=4]="StepForward",e[e.StepBackward=5]="StepBackward",e[e.TurnLeft=6]="TurnLeft",e[e.TurnRight=7]="TurnRight",e[e.TurnU=8]="TurnU",e[e.RotateLeft=9]="RotateLeft",e[e.RotateRight=10]="RotateRight",e[e.Pano=11]="Pano"}(n.EdgeDirection||(n.EdgeDirection={}));n.EdgeDirection},{}],359:[function(e,t,n){"use strict";var r=e("underscore"),i=e("rx"),o=e("virtual-dom"),s=e("../Render"),a=function(){function e(e,t,n){this._adaptiveOperation$=new i.Subject,this._render$=new i.Subject,this._renderAdaptive$=new i.Subject,this._renderService=t,this._currentFrame$=n;var a=o.create(o.h("div.domRenderer",[]));e.appendChild(a),this._offset$=this._adaptiveOperation$.scan(function(e,t){return t(e)},{elementHeight:e.offsetHeight,elementWidth:e.offsetWidth,imageAspect:0,renderMode:s.RenderMode.Letterbox}).filter(function(e){return e.imageAspect>0&&e.elementWidth>0&&e.elementHeight>0}).map(function(e){var t=e.elementWidth/e.elementHeight,n=e.imageAspect/t,r=0,i=0;return e.renderMode===s.RenderMode.Letterbox?e.imageAspect>t?r=e.elementHeight*(1-1/n)/2:i=e.elementWidth*(1-n)/2:e.imageAspect>t?i=-e.elementWidth*(n-1)/2:r=-e.elementHeight*(1/n-1)/2,{bottom:r,left:i,right:i,top:r}}),this._currentFrame$.filter(function(e){return null!=e.state.currentNode}).distinctUntilChanged(function(e){return e.state.currentNode.key}).map(function(e){return e.state.currentTransform.aspect}).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$,function(e,t){return[e,t]}).map(function(e){var t=r.values(e[0]),n=e[1],i={style:{bottom:n.bottom+"px",left:n.left+"px",position:"absolute",right:n.right+"px",top:n.top+"px",zIndex:-1}};return{name:"adaptiveDomRenderer",vnode:o.h("div.adaptiveDomRenderer",i,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=r.values(e);return o.h("div.domRenderer",t)}),this._vPatch$=this._vNode$.scan(function(e,t){return e.vpatch=o.diff(e.vnode,t),e.vnode=t,e},{vnode:o.h("div.domRenderer",[]),vpatch:null}).pluck("vpatch"),this._element$=this._vPatch$.scan(function(e,t){return o.patch(e,t)},a).shareReplay(1),this._element$.subscribe(),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$.onNext({name:e,vnode:null}),this._render$.onNext({name:e,vnode:null})},e}();n.DOMRenderer=a,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=a},{"../Render":276,rx:219,underscore:221,"virtual-dom":226}],360:[function(e,t,n){"use strict";!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground"}(n.GLRenderStage||(n.GLRenderStage={}));var r=n.GLRenderStage;Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],361:[function(e,t,n){"use strict";var r=e("rx"),i=e("three"),o=e("../Render"),s=function(){function e(e){var t=this;this._renderFrame$=new r.Subject,this._renderCameraOperation$=new r.Subject,this._render$=new r.Subject,this._clear$=new r.Subject,this._renderOperation$=new r.Subject,this._rendererOperation$=new r.Subject,this._eraserOperation$=new r.Subject,this._renderService=e,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}),r.Observable.combineLatest(this._renderer$,this._renderCollection$,this._renderCamera$,this._eraser$,function(e,t,n,r){var i=Object.keys(t).map(function(e){return t[e]});return{camera:n,eraser:r,renderer:e,renders:i}}).filter(function(e){for(var t=e.renderer.needsRender||e.camera.needsRender||e.eraser.needsRender,n=e.camera.frameId,r=0,i=e.renders;r<i.length;r++){var o=i[r];if(o.frameId!==n)return!1;t=t||o.needsRender}return t}).distinctUntilChanged(function(e){return e.eraser.needsRender?-1:e.camera.frameId}).subscribe(function(e){e.renderer.needsRender=!1,e.camera.needsRender=!1,e.eraser.needsRender=!1;for(var t=e.camera.perspective,n=[],r=[],i=0,s=e.renders;i<s.length;i++){var a=s[i];a.stage===o.GLRenderStage.Background?n.push(a.render):a.stage===o.GLRenderStage.Foreground&&r.push(a.render)}var u=e.renderer.renderer;u.autoClear=!1,u.clear();for(var c=0,h=n;c<h.length;c++){var a=h[c];a(t,u)}u.clearDepth();for(var l=0,p=r;l<p.length;l++){var a=p[l];a(t,u)}}),this._renderFrame$.map(function(e){return function(t){return t.frameId=e.frameId,t.perspective=e.perspective,e.changed===!0&&(t.needsRender=!0),t}}).subscribe(this._renderCameraOperation$),this._renderFrameSubscribe();var n=this._render$.map(function(e){return function(t){return t[e.name]=e.render,t}}),s=this._clear$.map(function(e){return function(t){return delete t[e],t}});r.Observable.merge(n,s).subscribe(this._renderOperation$);var a=this._render$.first().map(function(t){return function(t){var n=new i.WebGLRenderer,r=e.element;return n.setSize(r.offsetWidth,r.offsetHeight),n.setClearColor(new i.Color(2105376),1),n.sortObjects=!1,n.domElement.style.width="100%",n.domElement.style.height="100%",r.appendChild(n.domElement),t.needsRender=!0,t.renderer=n,t}}),u=this._renderService.size$.map(function(e){return function(t){return null==t.renderer?t:(t.renderer.setSize(e.width,e.height),t.needsRender=!0,t)}}),c=this._clear$.map(function(e){return function(e){return null==e.renderer?e:(e.needsRender=!0,e)}});r.Observable.merge(a,u,c).subscribe(this._rendererOperation$);var h=this._renderCollection$.filter(function(e){return 0===Object.keys(e).length}).share();h.subscribe(function(e){null!=t._renderFrameSubscription&&(t._renderFrameSubscription.dispose(),t._renderFrameSubscription=null,t._renderFrameSubscribe())}),
|
||
h.map(function(e){return function(e){return e.needsRender=!0,e}}).subscribe(this._eraserOperation$)}return Object.defineProperty(e.prototype,"render$",{get:function(){return this._render$},enumerable:!0,configurable:!0}),e.prototype.clear=function(e){this._clear$.onNext(e)},e.prototype._renderFrameSubscribe=function(){var e=this;this._render$.first().map(function(e){return function(e){return e.needsRender=!0,e}}).subscribe(function(t){e._renderCameraOperation$.onNext(t)}),this._renderFrameSubscription=this._render$.first().flatMap(function(t){return e._renderService.renderCameraFrame$}).subscribe(this._renderFrame$)},e}();n.GLRenderer=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Render":276,rx:219,three:220}],362:[function(e,t,n){"use strict";var r=e("three"),i=e("../Geo"),o=e("../Render"),s=function(){function e(e,t){this.alpha=-1,this._frameId=-1,this._changed=!1,this._changedForFrame=-1,this.currentAspect=1,this.currentOrientation=1,this.currentPano=!1,this.previousAspect=1,this.previousOrientation=1,this.previousPano=!1,this.renderMode=t,this._camera=new i.Camera,this._perspective=new r.PerspectiveCamera(50,e,.4,1e4)}return Object.defineProperty(e.prototype,"perspective",{get:function(){return this._perspective},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"changed",{get:function(){return this.frameId===this._changedForFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frameId",{get:function(){return this._frameId},set:function(e){this._frameId=e,this._changed&&(this._changed=!1,this._changedForFrame=e)},enumerable:!0,configurable:!0}),e.prototype.updateProjection=function(){var e=this._getAspect(this.currentAspect,this.currentOrientation,this.currentPano,this.perspective.aspect),t=this._getAspect(this.previousAspect,this.previousOrientation,this.previousPano,this.perspective.aspect),n=(1-this.alpha)*t+this.alpha*e,r=this._getVerticalFov(n,this._camera.focal,this.zoom);this._perspective.fov=r,this._perspective.updateProjectionMatrix(),this._changed=!0},e.prototype.updatePerspective=function(e){this._perspective.up.copy(e.up),this._perspective.position.copy(e.position),this._perspective.lookAt(e.lookat),this._changed=!0},e.prototype._getVerticalFov=function(e,t,n){return Math.pow(2,1-n)*Math.atan(.5/e/t)*180/Math.PI},e.prototype._getAspect=function(e,t,n,r){if(n)return 1;var i=5>t?1:1/e/e,s=this.renderMode===o.RenderMode.Letterbox?e>r:r>e,a=s?i*r:i*e;return a},e}();n.RenderCamera=s,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=s},{"../Geo":273,"../Render":276,three:220}],363:[function(e,t,n){"use strict";!function(e){e[e.Letterbox=0]="Letterbox",e[e.Fill=1]="Fill"}(n.RenderMode||(n.RenderMode={}));var r=n.RenderMode;Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],364:[function(e,t,n){"use strict";var r=e("rx"),i=e("../Render"),o=function(){function e(e,t,n){var o=this;this._element=e,this._currentFrame$=t,n=null!=n?n:i.RenderMode.Letterbox,this._resize$=new r.Subject,this._renderCameraOperation$=new r.Subject,this._size$=new r.BehaviorSubject({height:this._element.offsetHeight,width:this._element.offsetWidth}),this._renderMode$=new r.BehaviorSubject(n),this._resize$.map(function(){return{height:o._element.offsetHeight,width:o._element.offsetWidth}}).subscribe(this._size$),this._renderCameraFrame$=this._renderCameraOperation$.scan(function(e,t){return t(e)},new i.RenderCamera(this._element.offsetWidth/this._element.offsetHeight,n)).distinctUntilChanged(function(e){return e.frameId}).shareReplay(1),this._renderCamera$=this._renderCameraFrame$.filter(function(e){return e.changed}).shareReplay(1),this._currentFrame$.map(function(e){return function(t){var n=e.state.camera;if(t.alpha!==e.state.alpha||t.zoom!==e.state.zoom||t.camera.diff(n)>1e-5){var r=e.state.currentTransform,i=e.state.previousTransform;null==i&&(i=e.state.currentTransform),t.currentAspect=r.aspect,t.currentOrientation=r.orientation,t.currentPano=e.state.currentNode.fullPano,t.previousAspect=i.aspect,t.previousOrientation=i.orientation,t.previousPano=null!=e.state.previousNode&&e.state.previousNode.fullPano,t.alpha=e.state.alpha,t.zoom=e.state.zoom,t.camera.copy(n),t.updatePerspective(n),t.updateProjection()}return t.frameId=e.id,t}}).subscribe(this._renderCameraOperation$),this._size$.skip(1).map(function(e){return function(t){return t.perspective.aspect=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$)}return 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}();n.RenderService=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../Render":276,rx:219}],365:[function(e,t,n){"use strict";var r=function(){function e(){window.requestAnimationFrame?(this._requestAnimationFrame=window.requestAnimationFrame,this._cancelAnimationFrame=window.cancelAnimationFrame):window.mozRequestAnimationFrame?(this._requestAnimationFrame=window.mozRequestAnimationFrame,this._cancelAnimationFrame=window.mozCancelAnimationFrame):window.webkitRequestAnimationFrame?(this._requestAnimationFrame=window.webkitRequestAnimationFrame,this._cancelAnimationFrame=window.webkitCancelAnimationFrame):window.msRequestAnimationFrame?(this._requestAnimationFrame=window.msRequestAnimationFrame,this._cancelAnimationFrame=window.msCancelRequestAnimationFrame):window.oRequestAnimationFrame?(this._requestAnimationFrame=window.oRequestAnimationFrame,this._cancelAnimationFrame=window.oCancelAnimationFrame):(this._requestAnimationFrame=function(e){return window.setTimeout(e,1e3/60)},this._cancelAnimationFrame=window.clearTimeout)}return e.prototype.requestAnimationFrame=function(e){return this._requestAnimationFrame.call(window,e)},e.prototype.cancelAnimationFrame=function(e){this._cancelAnimationFrame.call(window,e)},e}();n.FrameGenerator=r},{}],366:[function(e,t,n){"use strict";!function(e){e[e.Traversing=0]="Traversing",e[e.Waiting=1]="Waiting"}(n.State||(n.State={}));var r=n.State;Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],367:[function(e,t,n){"use strict";var r=e("../State"),i=e("../Geo"),o=function(){function e(){this._state=new r.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 r.TraversingState)return r.State.Traversing;if(this._state instanceof r.WaitingState)return r.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,"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.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.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.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}();n.StateContext=o},{"../Geo":273,"../State":277}],368:[function(e,t,n){"use strict";var r=e("rx"),i=e("../State"),o=function(){function e(){var e=this;this._appendNode$=new r.Subject,this._frame$=new r.Subject,this._fpsSampleRate=30,this._contextOperation$=new r.BehaviorSubject(function(e){return e}),this._context$=this._contextOperation$.scan(function(e,t){return t(e)},new i.StateContext).shareReplay(1),this._state$=this._context$.map(function(e){return e.state}).distinctUntilChanged().shareReplay(1),this._fps$=this._frame$.filter(function(t){return t%e._fpsSampleRate===0}).scan(function(t,n){var r=(new Date).getTime();return[r,e._fpsSampleRate/(r-t[0])*1e3]},[(new Date).getTime(),60]).map(function(e){return Math.max(20,e[1])}).startWith(60),this._currentState$=this._frame$.withLatestFrom(this._fps$,this._context$,function(e,t,n){return[e,t,n]})["do"](function(e){e[2].update(e[1])}).map(function(e){return{fps:e[1],id:e[0],state:e[2]}}).share();var t=this._currentState$.filter(function(e){return null!=e.state.currentNode}).distinctUntilChanged(function(e){return e.state.currentNode.key}).shareReplay(1);this._currentNode$=t.map(function(e){return e.state.currentNode}).shareReplay(1),this._currentTransform$=t.map(function(e){return e.state.currentTransform}).shareReplay(1),this._reference$=t.map(function(e){return e.state.reference}).distinctUntilChanged(function(e){return e.lat*e.lon}).shareReplay(1),this._appendNode$.map(function(e){return function(t){return t.append([e]),t}}).subscribe(this._contextOperation$),this._state$.subscribe(),this._currentNode$.subscribe(),this._currentTransform$.subscribe(),this._reference$.subscribe(),this._frameId=null,this._frameGenerator=new i.FrameGenerator}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,"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,"appendNode$",{get:function(){return this._appendNode$},enumerable:!0,configurable:!0}),e.prototype.traverse=function(){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.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._invokeContextOperation(function(t){t.rotate(e)})},e.prototype.move=function(e){this._invokeContextOperation(function(t){t.move(e)})},e.prototype.moveTo=function(e){this._invokeContextOperation(function(t){t.moveTo(e)})},e.prototype.zoomIn=function(e,t){this._invokeContextOperation(function(n){n.zoomIn(e,t)})},e.prototype.start=function(){null==this._frameId&&(this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)))},e.prototype.stop=function(){null!=this._frameId&&(this._frameGenerator.cancelAnimationFrame(this._frameId),this._frameId=null)},e.prototype._invokeContextOperation=function(e){this._contextOperation$.onNext(function(t){return e(t),t})},e.prototype._frame=function(e){this._frameId=this._frameGenerator.requestAnimationFrame(this._frame.bind(this)),this._frame$.onNext(this._frameId)},e}();n.StateService=o},{"../State":277,rx:219}],369:[function(e,t,n){"use strict";var r=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,n=this._trajectory;t<n.length;t++){var r=n[t],o=this._nodeToTranslation(r),s=new i.Transform(r,o);this._trajectoryTransforms.push(s),this._trajectoryCameras.push(new i.Camera(s))}this._currentNode=this._trajectory.length>0?this._trajectory[this._currentIndex]:null,this._previousNode=this._trajectory.length>1&&this.currentIndex>0?this._trajectory[this._currentIndex-1]:null,this._currentCamera=this._trajectoryCameras.length>0?this._trajectoryCameras[this._currentIndex].clone():new i.Camera,this._previousCamera=this._trajectoryCameras.length>1&&this.currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone()}return Object.defineProperty(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,"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();var t=this._setReference(this._currentNode);t?this._setTrajectories():this._prependToTrajectories(e),this._setCurrentCamera()},e.prototype.remove=function(e){if(0>e)throw Error("n must be a positive integer");var t=this._trajectory.length;if(t-(this._currentIndex+1)<e)throw Error("Current node can not be removed");for(var n=0;e>n;n++)this._trajectory.pop(),this._trajectoryTransforms.pop(),this._trajectoryCameras.pop()},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._setCurrent=function(){this._setCurrentNode();var e=this._setReference(this._currentNode);e&&this._setTrajectories(),this._setCurrentCamera()},e.prototype._motionlessTransition=function(){var e=null==this._currentNode||null==this._previousNode;return e||!(this._currentNode.merged&&this._previousNode.merged&&this._withinOriginalDistance()&&this._sameConnectedComponent())},e.prototype._setReference=function(e){return Math.abs(e.latLon.lat-this.reference.lat)<this._referenceThreshold&&Math.abs(e.latLon.lon-this.reference.lon)<this._referenceThreshold?!1:null==this._previousNode||this._motionlessTransition()?(this._reference.lat=e.latLon.lat,this._reference.lon=e.latLon.lon,this._reference.alt=e.apiNavImIm.calt,!0):!1},e.prototype._setCurrentNode=function(){this._currentNode=this._trajectory.length>0?this._trajectory[this._currentIndex]:null,this._previousNode=this._currentIndex>0?this._trajectory[this._currentIndex-1]:null},e.prototype._setCurrentCamera=function(){if(this._currentCamera=this._trajectoryCameras[this._currentIndex].clone(),this._previousCamera=this._currentIndex>0?this._trajectoryCameras[this._currentIndex-1].clone():this._currentCamera.clone(),null!=this._previousNode){var e=this._camera.lookat.clone().sub(this._camera.position);this._previousCamera.lookat.copy(e.clone().add(this._previousCamera.position)),this._currentNode.pano&&this._currentCamera.lookat.copy(e.clone().add(this._currentCamera.position))}},e.prototype._setTrajectory=function(e){if(e.length<1)throw new r.ParameterMapillaryError("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,n=e;t<n.length;t++){var o=n[t];if(!o.loaded)throw new r.ParameterMapillaryError("Node must be loaded when added to trajectory");var s=this._nodeToTranslation(o),a=new i.Transform(o,s);this._trajectoryTransforms.push(a),this._trajectoryCameras.push(new i.Camera(a))}},e.prototype._prependToTrajectories=function(e){for(var t=0,n=e.reverse();t<n.length;t++){var o=n[t];if(!o.loaded)throw new r.ParameterMapillaryError("Node must be loaded when added to trajectory");var s=this._nodeToTranslation(o),a=new i.Transform(o,s);this._trajectoryTransforms.unshift(a),this._trajectoryCameras.unshift(new i.Camera(a))}},e.prototype._nodeToTranslation=function(e){var t=this._geoCoords.geodeticToEnu(e.latLon.lat,e.latLon.lon,e.apiNavImIm.calt,this._reference.lat,this._reference.lon,this._reference.alt),n=this._spatial.rotate(t,e.apiNavImIm.rotation);return[-n.x,-n.y,-n.z]},e.prototype._sameConnectedComponent=function(){var e=this._currentNode,t=this._previousNode;return e&&e.apiNavImIm.merge_cc&&t&&t.apiNavImIm.merge_cc?e.apiNavImIm.merge_cc===t.apiNavImIm.merge_cc:!0},e.prototype._withinOriginalDistance=function(){var e=this._currentNode,t=this._previousNode;if(!e||!t)return!0;var n=this._spatial.distanceFromLatLon(e.apiNavImIm.lat,e.apiNavImIm.lon,t.apiNavImIm.lat,t.apiNavImIm.lon);return 25>n},e}();n.StateBase=o},{"../../Error":272,"../../Geo":273}],370:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("three"),o=e("unitbezier"),s=e("../../State"),a=function(){function e(e,t){this._phi=e,this._theta=t}return Object.defineProperty(e.prototype,"phi",{get:function(){return this._phi},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"theta",{get:function(){return this._theta},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isZero",{get:function(){return 0===this._phi&&0===this._theta},enumerable:!0,configurable:!0}),e.prototype.copy=function(e){this._phi=e.phi,this._theta=e.theta},e.prototype.lerp=function(e,t){this._phi=(1-t)*this._phi+t*e.phi,this._theta=(1-t)*this._theta+t*e.theta},e.prototype.multiply=function(e){this._phi*=e,this._theta*=e},e.prototype.threshold=function(e){this._phi=Math.abs(this._phi)>e?this._phi:0,this._theta=Math.abs(this._theta)>e?this._theta:0},e.prototype.lengthSquared=function(){return this._phi*this._phi+this._theta*this._theta},e.prototype.reset=function(){this._phi=0,this._theta=0},e}(),u=function(e){function t(t){e.call(this,t),this._motionless=this._motionlessTransition(),this._baseAlpha=this._alpha,this._animationSpeed=.025,this._unitBezier=new o(.74,.67,.38,.96),this._useBezier=!1,this._rotationDelta=new a(0,0),this._requestedRotationDelta=null,this._rotationAcceleration=.86,this._rotationIncreaseAlpha=.97,this._rotationDecreaseAlpha=.9,this._rotationThreshold=.001,this._desiredZoom=t.zoom,this._minZoom=0,this._maxZoom=3,this._desiredLookat=new i.Vector3}return r(t,e),t.prototype.traverse=function(){throw new Error("Not implemented")},t.prototype.wait=function(){return new s.WaitingState(this)},t.prototype.append=function(t){0===this._trajectory.length&&this._resetTransition(),e.prototype.append.call(this,t)},t.prototype.prepend=function(t){0===this._trajectory.length&&this._resetTransition(),e.prototype.prepend.call(this,t)},t.prototype.set=function(t){e.prototype.set.call(this,t),this._desiredZoom=this._currentNode.fullPano?this._zoom:0,this._desiredLookat=null,this._resetTransition(),this._clearRotation(),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._requestedRotationDelta=new a(e.phi,e.theta))},t.prototype.zoomIn=function(e,t){if(null!=this._currentNode){t[0]=Math.max(0,Math.min(1,t[0])),t[1]=Math.max(0,Math.min(1,t[1])),this._desiredZoom=Math.max(this._minZoom,Math.min(this._maxZoom,this._desiredZoom+e));var n=this.currentTransform.projectBasic(this._currentCamera.lookat.toArray()),r=n[0],o=n[1],s=Math.pow(2,this._zoom),a=Math.pow(2,this._desiredZoom),u=t[0],c=t[1];u-r>.5?u-=1:r-u>.5&&(u=1+u);var h=this._spatial.wrap(u-s/a*(u-r),0,1),l=c-s/a*(c-o);if(!this._currentNode.fullPano){var p=Math.pow(.5,this._desiredZoom+1);h=Math.max(p,Math.min(1-p,h)),l=Math.max(p,Math.min(1-p,l))}this._desiredLookat=(new i.Vector3).fromArray(this.currentTransform.unprojectBasic([h,l],10))}},t.prototype.update=function(e){1===this._alpha&&this._currentIndex+this._alpha<this._trajectory.length&&(this._currentIndex+=1,this._useBezier=this._trajectory.length<3&&this._currentIndex+1===this._trajectory.length,this._setCurrent(),this._resetTransition(),this._clearRotation(),this._desiredZoom=this._currentNode.fullPano?this._zoom:0,this._desiredLookat=null);var t=this._animationSpeed*(60/e);this._baseAlpha=Math.min(1,this._baseAlpha+t),this._useBezier?this._alpha=this._unitBezier.solve(this._baseAlpha):this._alpha=this._baseAlpha,this._updateRotation(),this._rotationDelta.isZero||(this._applyRotation(this._previousCamera),this._applyRotation(this._currentCamera)),this._updateZoom(t),this._updateLookat(t),this._camera.lerpCameras(this._previousCamera,this._currentCamera,this.alpha)},t.prototype._getAlpha=function(){return this._motionless?Math.ceil(this._alpha):this._alpha},t.prototype._resetTransition=function(){this._alpha=0,this._baseAlpha=0,this._motionless=this._motionlessTransition()},t.prototype._applyRotation=function(e){if(null!=e){var t=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,0,1)),n=t.clone().inverse(),r=new i.Vector3;r.copy(e.lookat).sub(e.position),r.applyQuaternion(t);var o=r.length(),s=Math.atan2(r.y,r.x);s+=this._rotationDelta.phi;var a=Math.atan2(Math.sqrt(r.x*r.x+r.y*r.y),r.z);a+=this._rotationDelta.theta,a=Math.max(.1,Math.min(Math.PI-.1,a)),r.x=Math.sin(a)*Math.cos(s),r.y=Math.sin(a)*Math.sin(s),r.z=Math.cos(a),r.applyQuaternion(n),e.lookat.copy(e.position).add(r.multiplyScalar(o))}},t.prototype._updateZoom=function(e){var t=this._desiredZoom-this._zoom;0!==t&&(Math.abs(t)<1e-4?this._zoom=this._desiredZoom:this._zoom+=5*e*t)},t.prototype._updateLookat=function(e){if(null!==this._desiredLookat){var t=this._desiredLookat.distanceToSquared(this._currentCamera.lookat);Math.abs(t)<1e-5?(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(),t=this._requestedRotationDelta.lengthSquared();return t>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._clearRotation=function(){this._currentNode.pano||(null!=this._requestedRotationDelta&&(this._requestedRotationDelta=null),this._rotationDelta.isZero||this._rotationDelta.reset())},t}(s.StateBase);n.TraversingState=u},{"../../State":277,three:220,unitbezier:222}],371:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../../State"),o=function(e){function t(t){e.call(this,t),this._motionless=this._motionlessTransition()}return r(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.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._getAlpha=function(){return this._motionless?Math.ceil(this._alpha):this._alpha},t}(i.StateBase);n.WaitingState=o},{"../../State":277}],372:[function(e,t,n){"use strict";var r=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)return void(this._events={});if(this._listens(e))delete this._events[e];else{var n=this._events[e].indexOf(t);n>=0&&this._events[e].splice(n,1),this._events[e].length&&delete this._events[e]}},e.prototype.fire=function(e,t){if(this._listens(e))for(var n=0,r=this._events[e];n<r.length;n++){var i=r[n];i.call(this,t)}},e.prototype._listens=function(e){return!(!this._events||!this._events[e])},e}();n.EventEmitter=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],373:[function(e,t,n){"use strict";var r=e("../Viewer"),i=function(){function e(){}return e.setOptions=function(t){e._baseImageSize=null!=t.baseImageSize?t.baseImageSize:r.ImageSize.Size640,e._basePanoramaSize=null!=t.basePanoramaSize?t.basePanoramaSize:r.ImageSize.Size2048,e._maxImageSize=null!=t.maxImageSize?t.maxImageSize:r.ImageSize.Size2048},Object.defineProperty(e,"baseImageSize",{get:function(){return e._baseImageSize},enumerable:!0,configurable:!0}),Object.defineProperty(e,"basePanoramaSize",{get:function(){return e._basePanoramaSize},enumerable:!0,configurable:!0}),Object.defineProperty(e,"maxImageSize",{get:function(){return e._maxImageSize},enumerable:!0,configurable:!0}),e}();n.Settings=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{"../Viewer":279}],374:[function(e,t,n){"use strict";var r=function(){function e(){}return e.image=function(e,t){return"https://d1cuyjsrcm0gby.cloudfront.net/"+e+"/thumb-"+t+".jpg?origin=mapillary.webgl"},e.falcorModel=function(e){return"http://mapillary-vector.mapillary.io/v3/model.json?client_id="+e},e.mesh=function(e){return"https://d1cuyjsrcm0gby.cloudfront.net/"+e+"/sfm/v1.0/atomic_mesh.json"},e.proto_mesh=function(e){return"https://d1brzeo354iq2l.cloudfront.net/v2/mesh/"+e},e}();n.Urls=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],375:[function(e,t,n){"use strict";var r=e("../Component"),i=function(){function e(e,t,n,i){var o=this;this._container=e,this._navigator=t,this._options=i,this._key=n,this._componentService=new r.ComponentService(this._container,this._navigator),n?this._initializeComponents():this._navigator.loadingService.loading$.filter(function(e){return e}).first().subscribe(function(e){o._navigator.stateService.start(),o._navigator.stateService.currentNode$.first().subscribe(function(e){o._key=e.key,o._initializeComponents()})})}return e.prototype.activateCover=function(){this._coverComponent.configure({loading:!1,visible:!0})},e.prototype.deactivateCover=function(){this._coverComponent.configure({loading:!0,visible:!0})},e.prototype.activate=function(e){this._componentService.activate(e)},e.prototype.deactivate=function(e){this._componentService.deactivate(e)},e.prototype.get=function(e){return this._componentService.get(e)},e.prototype._initializeComponents=function(){var e=this,t=this._options;this._uFalse(t.background,"background"),this._uFalse(t.debug,"debug"),this._uFalse(t.detection,"detection"),this._uFalse(t.tag,"tag"),this._uFalse(t.image,"image"),this._uFalse(t.marker,"marker"),this._uFalse(t.navigation,"navigation"),this._uFalse(t.player,"player"),this._uFalse(t.route,"route"),this._uFalse(t.slider,"slider"),this._uTrue(t.attribution,"attribution"),this._uTrue(t.cache,"cache"),this._uTrue(t.direction,"direction"),this._uTrue(t.imageplane,"imageplane"),this._uTrue(t.keyboard,"keyboard"),this._uTrue(t.loading,"loading"),this._uTrue(t.mouse,"mouse"),this._uTrue(t.sequence,"sequence"),this._coverComponent=this._componentService.getCover(),this._coverComponent.configure({key:this._key}),void 0===t.cover||t.cover?this.activateCover():this.deactivateCover(),this._coverComponent.configuration$.subscribe(function(t){t.loading?e._navigator.moveToKey(t.key).subscribe(function(t){
|
||
e._navigator.stateService.start(),e._coverComponent.configure({loading:!1,visible:!1}),e._componentService.deactivateCover()}):t.visible&&(e._navigator.stateService.stop(),e._componentService.activateCover())})},e.prototype._uFalse=function(e,t){return void 0===e?void this._componentService.deactivate(t):"boolean"==typeof e?void(e?this._componentService.activate(t):this._componentService.deactivate(t)):(this._componentService.configure(t,e),void this._componentService.activate(t))},e.prototype._uTrue=function(e,t){return void 0===e?void this._componentService.activate(t):"boolean"==typeof e?void(e?this._componentService.activate(t):this._componentService.deactivate(t)):(this._componentService.configure(t,e),void this._componentService.activate(t))},e}();n.ComponentController=i},{"../Component":270}],376:[function(e,t,n){"use strict";var r=e("../Render"),i=e("../Viewer"),o=function(){function e(e,t,n){this.id=e,this.element=document.getElementById(e),this.element.classList.add("mapillary-js"),this.renderService=new r.RenderService(this.element,t.currentState$,n.renderMode),this.glRenderer=new r.GLRenderer(this.renderService),this.domRenderer=new r.DOMRenderer(this.element,this.renderService,t.currentState$),this.mouseService=new i.MouseService(this.element),this.touchService=new i.TouchService(this.element),this.spriteService=new i.SpriteService(n.sprite)}return e}();n.Container=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"../Render":276,"../Viewer":279}],377:[function(e,t,n){"use strict";var r=function(){function e(e,t){var n=this;this._eventEmitter=e,this._navigator=t,this._loadingSubscription=this._navigator.loadingService.loading$.subscribe(function(e){n._eventEmitter.fire("loadingchanged",e)}),this._stateSubscription=this._navigator.stateService.currentNode$.subscribe(function(e){n._eventEmitter.fire("nodechanged",e)})}return e.prototype.dispose=function(){this._loadingSubscription.dispose(),this._stateSubscription.dispose()},e}();n.EventLauncher=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],378:[function(e,t,n){"use strict";!function(e){e[e.Size320=320]="Size320",e[e.Size640=640]="Size640",e[e.Size1024=1024]="Size1024",e[e.Size2048=2048]="Size2048"}(n.ImageSize||(n.ImageSize={}));n.ImageSize},{}],379:[function(e,t,n){"use strict";var r=e("underscore"),i=e("rx"),o=function(){function e(){this._loadersSubject$=new i.Subject,this._loaders$=this._loadersSubject$.scan(function(e,t){return void 0!==t.task&&(e[t.task]=t.loading),e},{}).startWith({}).shareReplay(1)}return Object.defineProperty(e.prototype,"loading$",{get:function(){return this._loaders$.map(function(e){return r.reduce(e,function(e,t){return e||t},!1)}).debounce(100).distinctUntilChanged()},enumerable:!0,configurable:!0}),e.prototype.taskLoading$=function(e){return this._loaders$.map(function(t){return!!t[e]}).debounce(100).distinctUntilChanged()},e.prototype.startLoading=function(e){this._loadersSubject$.onNext({loading:!0,task:e})},e.prototype.stopLoading=function(e){this._loadersSubject$.onNext({loading:!1,task:e})},e}();n.LoadingService=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{rx:219,underscore:221}],380:[function(e,t,n){"use strict";var r=e("rx"),i=function(){function e(e){var t=this;this._element=e,this._preventMouseDownOperation$=new r.Subject,this._preventMouseDown$=new r.Subject,this._mouseMoveOperation$=new r.Subject,this._claimMouse$=new r.Subject,this._mouseDown$=r.Observable.fromEvent(e,"mousedown"),this._mouseLeave$=r.Observable.fromEvent(e,"mouseleave"),this._mouseUp$=r.Observable.fromEvent(e,"mouseup"),this._mouseOver$=r.Observable.fromEvent(e,"mouseover"),this._click$=r.Observable.fromEvent(e,"click"),this._mouseWheel$=r.Observable.fromEvent(e,"wheel"),this._mouseWheel$.subscribe(function(e){e.preventDefault()}),this._preventMouseDownOperation$.scan(function(e,t){return t(e)},!0).subscribe(),this._preventMouseDown$.map(function(e){return function(t){return e}}).subscribe(this._preventMouseDownOperation$),this._mouseDown$.map(function(e){return function(t){return t&&e.preventDefault(),t}}).subscribe(this._preventMouseDownOperation$),this._mouseMove$=this._mouseMoveOperation$.scan(function(e,t){return t(e)},new MouseEvent("mousemove")),r.Observable.fromEvent(e,"mousemove").map(function(e){return function(t){return null==e.movementX&&(e.movementX=e.offsetX-t.offsetX),null==e.movementY&&(e.movementY=e.offsetY-t.offsetY),e}}).subscribe(this._mouseMoveOperation$);var n=r.Observable.merge([this._mouseLeave$,this._mouseUp$]);this._mouseDragStart$=this._mouseDown$.selectMany(function(e){return t._mouseMove$.takeUntil(n).take(1)}),this._mouseDrag$=this._mouseDown$.selectMany(function(e){return t._mouseMove$.skip(1).takeUntil(n)}),this._mouseDragEnd$=this._mouseDragStart$.selectMany(function(e){return n.first()}),this._staticClick$=this._mouseDown$.flatMapLatest(function(e){return t._click$.takeUntil(t._mouseMove$).take(1)}),this._mouseOwner$=this._claimMouse$.scan(function(e,t){return null==t.zindex?delete e[t.name]:e[t.name]=t.zindex,e},{}).map(function(e){var t=null,n=-1;for(var r in e)e.hasOwnProperty(r)&&e[r]>n&&(n=e[r],t=r);return t}).shareReplay(1)}return e.prototype.claimMouse=function(e,t){this._claimMouse$.onNext({name:e,zindex:t})},e.prototype.unclaimMouse=function(e){this._claimMouse$.onNext({name:e,zindex:null})},e.prototype.filtered$=function(e,t){return t.withLatestFrom(this.mouseOwner$,function(e,t){return[e,t]}).filter(function(t){return t[1]===e}).map(function(e){return e[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,"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,"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,"staticClick$",{get:function(){return this._staticClick$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preventDefaultMouseDown$",{get:function(){return this._preventMouseDown$},enumerable:!0,configurable:!0}),e}();n.MouseService=i,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=i},{rx:219}],381:[function(e,t,n){"use strict";var r=e("rx"),i=e("../API"),o=e("../Graph"),s=e("../State"),a=e("../Viewer"),u=function(){function e(e){this._keyRequested$=new r.BehaviorSubject(null),this._dirRequested$=new r.BehaviorSubject(null),this._latLonRequested$=new r.BehaviorSubject(null),this.apiV2=new i.APIv2(e),this.apiV3=new i.APIv3(e),this.graphService=new o.GraphService(this.apiV2,this.apiV3),this.stateService=new s.StateService,this.loadingService=new a.LoadingService}return e.prototype.moveToKey=function(e){var t=this;return this.loadingService.startLoading("navigator"),this._keyRequested$.onNext(e),this.graphService.node$(e).map(function(e){return t.loadingService.stopLoading("navigator"),t.stateService.setNodes([e]),e}).first()},e.prototype.moveDir=function(e){var t=this;return this.loadingService.startLoading("navigator"),this._dirRequested$.onNext(e),this.stateService.currentNode$.first().flatMap(function(n){return t.graphService.nextNode$(n,e).flatMap(function(e){return null==e?r.Observable.just(null):t.moveToKey(e.key)})}).first()},e.prototype.moveCloseTo=function(e,t){var n=this;return this.loadingService.startLoading("navigator"),this._latLonRequested$.onNext({lat:e,lon:t}),r.Observable.fromPromise(this.apiV2.search.im.close2(e,t)).flatMap(function(e){return null==e.key?r.Observable["throw"](new Error("no Image found")):n.moveToKey(e.key)}).first()},Object.defineProperty(e.prototype,"keyRequested$",{get:function(){return this._keyRequested$},enumerable:!0,configurable:!0}),e}();n.Navigator=u,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../API":269,"../Graph":274,"../State":277,"../Viewer":279,rx:219}],382:[function(e,t,n){"use strict";!function(e){e[e.Center=0]="Center",e[e.Start=1]="Start",e[e.End=2]="End"}(n.SpriteAlignment||(n.SpriteAlignment={}));var r=n.SpriteAlignment;Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}],383:[function(e,t,n){"use strict";var r=e("rx"),i=e("three"),o=e("virtual-dom"),s=e("../Viewer"),a=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 i.Texture(this._image),this._texture.minFilter=i.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 i.Object3D;var n=this._texture.clone();n.needsUpdate=!0;var r=this._image.width,o=this._image.height;n.offset.x=t.x/r,n.offset.y=(o-t.y-t.height)/o,n.repeat.x=t.width/r,n.repeat.y=t.height/o;var s=new i.SpriteMaterial({map:n});return new i.Sprite(s)},e.prototype.getDOMSprite=function(e,t,n){if(!this.loaded)throw new Error("Sprites cannot be retrieved before the atlas is loaded.");null==t&&(t=s.SpriteAlignment.Start),null==n&&(n=s.SpriteAlignment.Start);var r=this._json[e];if(!r)return console.warn("Sprite with key"+e+"does not exist in sprite definition."),o.h("div",{},[]);var i=r.y,a=r.x+r.width,u=r.y+r.height,c=r.x,h=-r.x,l=-r.y;switch(t){case s.SpriteAlignment.Center:h-=r.width/2;break;case s.SpriteAlignment.End:h-=r.width;break;case s.SpriteAlignment.Start:}switch(n){case s.SpriteAlignment.Center:l-=r.height/2;break;case s.SpriteAlignment.End:l-=r.height;break;case s.SpriteAlignment.Start:}var p={src:this._image.src,style:{clip:"rect("+i+"px, "+a+"px, "+u+"px, "+c+"px)",left:h+"px",position:"absolute",top:l+"px"}};return o.h("img",p,[])},e}(),u=function(){function e(e){var t=this;if(this._spriteAtlasOperation$=new r.Subject,this._spriteAtlas$=this._spriteAtlasOperation$.startWith(function(e){return e}).scan(function(e,t){return t(e)},new a).shareReplay(1),this._spriteAtlas$.subscribe(),null!=e){var n=window.devicePixelRatio>1?"@2x":"",i=new XMLHttpRequest;i.open("GET",e+n+".png",!0),i.responseType="arraybuffer",i.onload=function(){var e=new Image;e.onload=function(){t._spriteAtlasOperation$.onNext(function(t){return t.image=e,t})};var n=new Blob([i.response]);e.src=window.URL.createObjectURL(n)},i.send();var o=new XMLHttpRequest;o.open("GET",e+n+".json",!0),o.responseType="text",o.onload=function(){var e=JSON.parse(o.response);t._spriteAtlasOperation$.onNext(function(t){return t.json=e,t})},o.send()}}return Object.defineProperty(e.prototype,"spriteAtlas$",{get:function(){return this._spriteAtlas$},enumerable:!0,configurable:!0}),e}();n.SpriteService=u,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=u},{"../Viewer":279,rx:219,three:220,"virtual-dom":226}],384:[function(e,t,n){"use strict";var r=e("rx"),i=function(){function e(e){this.movementX=0,this.movementY=0,null!=e&&(this.identifier=e.identifier,this.clientX=e.clientX,this.clientY=e.clientY,this.pageX=e.pageX,this.pageY=e.pageY,this.screenX=e.screenX,this.screenY=e.screenY,this.target=e.target)}return e}();n.TouchMove=i;var o=function(){function e(e){var t=this;this._element=e,this._touchStart$=r.Observable.fromEvent(e,"touchstart"),this._touchMove$=r.Observable.fromEvent(e,"touchmove"),this._touchEnd$=r.Observable.fromEvent(e,"touchend"),this._touchCancel$=r.Observable.fromEvent(e,"touchcancel"),this._preventTouchMoveOperation$=new r.Subject,this._preventTouchMove$=new r.Subject,this._preventTouchMoveOperation$.scan(function(e,t){return t(e)},!0).subscribe(),this._preventTouchMove$.map(function(e){return function(t){return e}}).subscribe(this._preventTouchMoveOperation$),this._touchMove$.map(function(e){return function(t){return t&&e.preventDefault(),t}}).subscribe(this._preventTouchMoveOperation$),this._singleTouchMoveOperation$=new r.Subject,this._singleTouchMove$=this._singleTouchMoveOperation$.scan(function(e,t){return t(e)},new i),this._touchMove$.filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}).map(function(e){return function(t){var n=e.touches[0],r=new i(n);return r.movementX=n.pageX-t.pageX,r.movementY=n.pageY-t.pageY,r}}).subscribe(this._singleTouchMoveOperation$);var n=r.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(e){return 1===e.touches.length&&1===e.targetTouches.length}),o=r.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$).filter(function(e){return e.touches.length>=1}),s=r.Observable.merge(this._touchEnd$,this._touchCancel$).filter(function(e){return 0===e.touches.length});this._singleTouch$=n.flatMapLatest(function(e){return t._singleTouchMove$.skip(1).takeUntil(r.Observable.merge(o,s))});var a=r.Observable.merge(this._touchStart$,this._touchEnd$,this._touchCancel$),u=a.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length}),c=a.filter(function(e){return 2!==e.touches.length||2!==e.targetTouches.length});this._pinchOperation$=new r.Subject,this._pinch$=this._pinchOperation$.scan(function(e,t){return t(e)},{centerClientX:0,centerClientY:0,centerPageX:0,centerPageY:0,centerScreenX:0,centerScreenY:0,changeX:0,changeY:0,distance:0,distanceChange:0,distanceX:0,distanceY:0,touch1:null,touch2:null}),this._touchMove$.filter(function(e){return 2===e.touches.length&&2===e.targetTouches.length}).map(function(e){return function(t){var n=e.touches[0],r=e.touches[1],i=Math.min(n.clientX,r.clientX),o=Math.max(n.clientX,r.clientX),s=Math.min(n.clientY,r.clientY),a=Math.max(n.clientY,r.clientY),u=i+(o-i)/2,c=s+(a-s)/2,h=u+n.pageX-n.clientX,l=c+n.pageY-n.clientY,p=u+n.screenX-n.clientX,f=c+n.screenY-n.clientY,d=Math.abs(n.clientX-r.clientX),m=Math.abs(n.clientY-r.clientY),v=Math.sqrt(d*d+m*m),g=v-t.distance,y=d-t.distanceX,_=m-t.distanceY,b={centerClientX:u,centerClientY:c,centerPageX:h,centerPageY:l,centerScreenX:p,centerScreenY:f,changeX:y,changeY:_,distance:v,distanceChange:g,distanceX:d,distanceY:m,touch1:n,touch2:r};return b}}).subscribe(this._pinchOperation$),this._pinchChange$=u.flatMapLatest(function(e){return t._pinch$.skip(1).takeUntil(c)})}return 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,"singleTouchMove$",{get:function(){return this._singleTouch$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pinch$",{get:function(){return this._pinchChange$},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preventDefaultTouchMove$",{get:function(){return this._preventTouchMove$},enumerable:!0,configurable:!0}),e}();n.TouchService=o},{rx:219}],385:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=e("../Viewer"),o=e("../Utils"),s=e("when"),a=function(e){function t(t,n,r,s){e.call(this),void 0===s&&(s={}),o.Settings.setOptions(s),this._navigator=new i.Navigator(n),this._container=new i.Container(t,this._navigator.stateService,s),this._componentController=new i.ComponentController(this._container,this._navigator,r,s),this._eventLauncher=new i.EventLauncher(this,this._navigator)}return r(t,e),t.prototype.moveToKey=function(e){var t=this;return s.promise(function(n,r){t._navigator.moveToKey(e).subscribe(function(e){n(e)},function(e){r(e)})})},t.prototype.moveDir=function(e){var t=this;return s.promise(function(n,r){t._navigator.moveDir(e).subscribe(function(e){n(e)},function(e){r(e)})})},t.prototype.moveCloseTo=function(e,t){var n=this;return s.promise(function(r,i){n._navigator.moveCloseTo(e,t).subscribe(function(e){r(e)},function(e){i(e)})})},t.prototype.resize=function(){this._container.renderService.resize$.onNext(null)},t.prototype.setRenderMode=function(e){this._container.renderService.renderMode$.onNext(e)},t.prototype.activateComponent=function(e){this._componentController.activate(e)},t.prototype.deactivateComponent=function(e){this._componentController.deactivate(e)},t.prototype.getComponent=function(e){return this._componentController.get(e)},t.prototype.activateCover=function(){this._componentController.activateCover()},t.prototype.deactivateCover=function(){this._componentController.deactivateCover()},t.nodechanged="nodechanged",t.loadingchanged="loadingchanged",t}(o.EventEmitter);n.Viewer=a},{"../Utils":278,"../Viewer":279,when:267}]},{},[275])(275)});
|
||
//# sourceMappingURL=mapillary-js.min.js.map
|