!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=161)}([function(t,e,n){"use strict";t.exports=n(159)},function(t,e,n){t.exports=n(151)()},function(t,e,n){"use strict";e.__esModule=!0;var r,i=n(35),o=(r=i)&&r.__esModule?r:{default:r};e.default=o.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){var r;
/*!
  Copyright (c) 2016 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
/*!
  Copyright (c) 2016 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var t=[],e=0;e<arguments.length;e++){var r=arguments[e];if(r){var o=typeof r;if("string"===o||"number"===o)t.push(r);else if(Array.isArray(r))t.push(i.apply(null,r));else if("object"===o)for(var a in r)n.call(r,a)&&r[a]&&t.push(a)}}return t.join(" ")}void 0!==t&&t.exports?t.exports=i:void 0===(r=function(){return i}.apply(e,[]))||(t.exports=r)}()},function(t,e,n){"use strict";var r=n(73),i=n(146),o=Object.prototype.toString;function a(t){return"[object Array]"===o.call(t)}function s(t){return null!==t&&"object"==typeof t}function c(t){return"[object Function]"===o.call(t)}function u(t,e){if(null!==t&&void 0!==t)if("object"!=typeof t&&(t=[t]),a(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}t.exports={isArray:a,isArrayBuffer:function(t){return"[object ArrayBuffer]"===o.call(t)},isBuffer:i,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===o.call(t)},isFile:function(t){return"[object File]"===o.call(t)},isBlob:function(t){return"[object Blob]"===o.call(t)},isFunction:c,isStream:function(t){return s(t)&&c(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:u,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,i=arguments.length;r<i;r++)u(arguments[r],n);return e},extend:function(t,e,n){return u(e,function(e,i){t[i]=n&&"function"==typeof e?r(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){var n=t.exports={version:"2.5.6"};"number"==typeof __e&&(__e=n)},function(t,e,n){"use strict";e.__esModule=!0;var r,i=n(116),o=(r=i)&&r.__esModule?r:{default:r};e.default=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,o.default)(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}()},function(t,e,n){"use strict";e.__esModule=!0;var r,i=n(58),o=(r=i)&&r.__esModule?r:{default:r};e.default=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":(0,o.default)(e))&&"function"!=typeof e?t:e}},function(t,e,n){(function(e,n){
/*!
 * @overview es6-promise - a tiny implementation of Promises/A+.
 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
 * @license   Licensed under MIT license
 *            See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
 * @version   v4.2.4+314e4831
 */var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,o=void 0,a=void 0,s=function(t,e){f[i]=t,f[i+1]=e,2===(i+=2)&&(a?a(m):x())};var c="undefined"!=typeof window?window:void 0,u=c||{},l=u.MutationObserver||u.WebKitMutationObserver,h="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(m,1)}}var f=new Array(1e3);function m(){for(var t=0;t<i;t+=2){(0,f[t])(f[t+1]),f[t]=void 0,f[t+1]=void 0}i=0}var g,v,y,b,x=void 0;function _(t,e){var n=this,r=new this.constructor(C);void 0===r[S]&&B(r);var i=n._state;if(i){var o=arguments[i-1];s(function(){return z(i,r,o,n._result)})}else N(n,r,t,e);return r}function w(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(C);return R(e,t),e}h?x=function(){return e.nextTick(m)}:l?(v=0,y=new l(m),b=document.createTextNode(""),y.observe(b,{characterData:!0}),x=function(){b.data=v=++v%2}):p?((g=new MessageChannel).port1.onmessage=m,x=function(){return g.port2.postMessage(0)}):x=void 0===c?function(){try{var t=Function("return this")().require("vertx");return void 0!==(o=t.runOnLoop||t.runOnContext)?function(){o(m)}:d()}catch(t){return d()}}():d();var S=Math.random().toString(36).substring(2);function C(){}var A=void 0,E=1,M=2,T={error:null};function P(t){try{return t.then}catch(t){return T.error=t,T}}function I(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===w?function(t,e){e._state===E?L(t,e._result):e._state===M?k(t,e._result):N(e,void 0,function(e){return R(t,e)},function(e){return k(t,e)})}(e,n):r===T?(k(e,T.error),T.error=null):void 0===r?L(e,n):t(r)?function(t,e,n){s(function(t){var r=!1,i=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?R(t,n):L(t,n))},function(e){r||(r=!0,k(t,e))},t._label);!r&&i&&(r=!0,k(t,i))},t)}(e,n,r):L(e,n)}function R(t,e){var n,r;t===e?k(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(n=e),null===n||"object"!==r&&"function"!==r?L(t,e):I(t,e,P(e)))}function O(t){t._onerror&&t._onerror(t._result),D(t)}function L(t,e){t._state===A&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(D,t))}function k(t,e){t._state===A&&(t._state=M,t._result=e,s(O,t))}function N(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+E]=n,i[o+M]=r,0===o&&t._state&&s(D,t)}function D(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,i=void 0,o=t._result,a=0;a<e.length;a+=3)r=e[a],i=e[a+n],r?z(n,r,i,o):i(o);t._subscribers.length=0}}function z(e,n,r,i){var o=t(r),a=void 0,s=void 0,c=void 0,u=void 0;if(o){if((a=function(t,e){try{return t(e)}catch(t){return T.error=t,T}}(r,i))===T?(u=!0,s=a.error,a.error=null):c=!0,n===a)return void k(n,new TypeError("A promises callback cannot return that same promise."))}else a=i,c=!0;n._state!==A||(o&&c?R(n,a):u?k(n,s):e===E?L(n,a):e===M&&k(n,a))}var F=0;function B(t){t[S]=F++,t._state=void 0,t._result=void 0,t._subscribers=[]}var U=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(C),this.promise[S]||B(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?L(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&L(this.promise,this._result))):k(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===A&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===w){var i=P(t);if(i===_&&t._state!==A)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===j){var o=new n(C);I(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===A&&(this._remaining--,t===M?k(r,n):this._result[e]=n),0===this._remaining&&L(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;N(t,void 0,function(t){return n._settledAt(E,e,t)},function(t){return n._settledAt(M,e,t)})},t}();var j=function(){function t(e){this[S]=F++,this._result=this._state=void 0,this._subscribers=[],C!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e(function(e){R(t,e)},function(e){k(t,e)})}catch(e){k(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},t}();return j.prototype.then=_,j.all=function(t){return new U(this,t).promise},j.race=function(t){var e=this;return r(t)?new e(function(n,r){for(var i=t.length,o=0;o<i;o++)e.resolve(t[o]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},j.resolve=w,j.reject=function(t){var e=new this(C);return k(e,t),e},j._setScheduler=function(t){a=t},j._setAsap=function(t){s=t},j._asap=s,j.polyfill=function(){var t=void 0;if(void 0!==n)t=n;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=j},j.Promise=j,j},t.exports=r()}).call(this,n(48),n(21))},function(t,e,n){t.exports=n(147)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,a,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),c=1;c<arguments.length;c++){for(var u in n=Object(arguments[c]))i.call(n,u)&&(s[u]=n[u]);if(r){a=r(n);for(var l=0;l<a.length;l++)o.call(n,a[l])&&(s[a[l]]=n[a[l]])}}return s}},function(t,e,n){"use strict";e.__esModule=!0;var r=a(n(92)),i=a(n(88)),o=a(n(58));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":(0,o.default)(e)));t.prototype=(0,i.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(r.default?(0,r.default)(t,e):t.__proto__=e)}},function(t,e,n){t.exports={default:n(118),__esModule:!0}},function(t,e,n){"use strict";t.exports=function(t,e,n,r,i,o,a,s){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,i,o,a,s],l=0;(c=new Error(e.replace(/%s/g,function(){return u[l++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){t.exports=!n(25)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(29),i=n(65),o=n(47),a=Object.defineProperty;e.f=n(18)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(12),i=n(7),o=n(66),a=n(27),s=n(17),c=function(t,e,n){var u,l,h,p=t&c.F,d=t&c.G,f=t&c.S,m=t&c.P,g=t&c.B,v=t&c.W,y=d?i:i[e]||(i[e]={}),b=y.prototype,x=d?r:f?r[e]:(r[e]||{}).prototype;for(u in d&&(n=e),n)(l=!p&&x&&void 0!==x[u])&&s(y,u)||(h=l?x[u]:n[u],y[u]=d&&"function"!=typeof x[u]?n[u]:g&&l?o(h,r):v&&x[u]==h?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(h):m&&"function"==typeof h?o(Function.call,h):h,m&&((y.virtual||(y.virtual={}))[u]=h,t&c.R&&b&&!b[u]&&a(b,u,h)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";!function t(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(t){console.error(t)}}(),t.exports=n(158)},function(t,e,n){var r=n(43)("wks"),i=n(32),o=n(12).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},function(t,e,n){var r=n(62),i=n(46);t.exports=function(t){return r(i(t))}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(19),i=n(34);t.exports=n(18)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(63),i=n(42);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){var r=n(26);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){var r=n(46);t.exports=function(t){return Object(r(t))}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports=!0},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){t.exports={default:n(125),__esModule:!0}},function(t,e,n){var r=n(12),i=n(7),o=n(33),a=n(37),s=n(19).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},function(t,e,n){e.f=n(23)},function(t,e,n){var r=n(19).f,i=n(17),o=n(23)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){var r=n(29),i=n(108),o=n(42),a=n(44)("IE_PROTO"),s=function(){},c=function(){var t,e=n(64)("iframe"),r=o.length;for(e.style.display="none",n(107).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),c=t.F;r--;)delete c.prototype[o[r]];return c()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=c(),void 0===e?n:i(n,e)}},function(t,e){t.exports={}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(7),i=n(12),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(33)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(43)("keys"),i=n(32);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on  "+t);return t}},function(t,e,n){var r=n(26);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var c,u=[],l=!1,h=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):h=-1,u.length&&d())}function d(){if(!l){var t=s(p);l=!0;for(var e=u.length;e;){for(c=u,u=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new f(t,e)),1!==u.length||l||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";(function(e){var r=n(5),i=n(144),o={"Content-Type":"application/x-www-form-urlencoded"};function a(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var s,c={adapter:("undefined"!=typeof XMLHttpRequest?s=n(72):void 0!==e&&(s=n(72)),s),transformRequest:[function(t,e){return i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(a(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(a(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){c.headers[t]={}}),r.forEach(["post","put","patch"],function(t){c.headers[t]=r.merge(o)}),t.exports=c}).call(this,n(48))},function(t,e,n){"use strict";function r(t){return function(){return t}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(t){return t},t.exports=i},function(t,e,n){"use strict";var r=function(t){};t.exports=function(t,e,n,i,o,a,s,c){if(r(e),!t){var u;if(void 0===e)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,i,o,a,s,c],h=0;(u=new Error(e.replace(/%s/g,function(){return l[h++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(t,e,n){t.exports={default:n(84),__esModule:!0}},function(t,e,n){"use strict";(function(t,r){var i,o=n(80);i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:r;var a=Object(o.a)(i);e.a=a}).call(this,n(21),n(149)(t))},function(t,e,n){var r=n(31),i=n(34),o=n(24),a=n(47),s=n(17),c=n(65),u=Object.getOwnPropertyDescriptor;e.f=n(18)?u:function(t,e){if(t=o(t),e=a(e,!0),c)try{return u(t,e)}catch(t){}if(s(t,e))return i(!r.f.call(t,e),t[e])}},function(t,e,n){var r=n(63),i=n(42).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e,n){t.exports=n(27)},function(t,e,n){"use strict";var r=n(33),i=n(20),o=n(56),a=n(27),s=n(40),c=n(109),u=n(38),l=n(60),h=n(23)("iterator"),p=!([].keys&&"next"in[].keys()),d=function(){return this};t.exports=function(t,e,n,f,m,g,v){c(n,e,f);var y,b,x,_=function(t){if(!p&&t in A)return A[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},w=e+" Iterator",S="values"==m,C=!1,A=t.prototype,E=A[h]||A["@@iterator"]||m&&A[m],M=E||_(m),T=m?S?_("entries"):M:void 0,P="Array"==e&&A.entries||E;if(P&&(x=l(P.call(new t)))!==Object.prototype&&x.next&&(u(x,w,!0),r||"function"==typeof x[h]||a(x,h,d)),S&&E&&"values"!==E.name&&(C=!0,M=function(){return E.call(this)}),r&&!v||!p&&!C&&A[h]||a(A,h,M),s[e]=M,s[w]=d,m)if(y={values:S?M:_("values"),keys:g?M:_("keys"),entries:T},v)for(b in y)b in A||o(A,b,y[b]);else i(i.P+i.F*(p||C),e,y);return y}},function(t,e,n){"use strict";e.__esModule=!0;var r=a(n(113)),i=a(n(102)),o="function"==typeof i.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof i.default&&t.constructor===i.default&&t!==i.default.prototype?"symbol":typeof t};function a(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof i.default&&"symbol"===o(r.default)?function(t){return void 0===t?"undefined":o(t)}:function(t){return t&&"function"==typeof i.default&&t.constructor===i.default&&t!==i.default.prototype?"symbol":void 0===t?"undefined":o(t)}},function(t,e,n){var r=n(20),i=n(7),o=n(25);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*o(function(){n(1)}),"Object",a)}},function(t,e,n){var r=n(17),i=n(30),o=n(44)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(61);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(17),i=n(24),o=n(121)(!1),a=n(44)("IE_PROTO");t.exports=function(t,e){var n,s=i(t),c=0,u=[];for(n in s)n!=a&&r(s,n)&&u.push(n);for(;e.length>c;)r(s,n=e[c++])&&(~o(u,n)||u.push(n));return u}},function(t,e,n){var r=n(26),i=n(12).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,n){t.exports=!n(18)&&!n(25)(function(){return 7!=Object.defineProperty(n(64)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(123);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){"use strict";var r=String.prototype.replace,i=/%20/g;t.exports={default:"RFC3986",formatters:{RFC1738:function(t){return r.call(t,i,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),o=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},r=0;r<t.length;++r)void 0!==t[r]&&(n[r]=t[r]);return n};t.exports={arrayToObject:o,assign:function(t,e){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},t)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],r=0;r<e.length;++r)for(var i=e[r],o=i.obj[i.prop],a=Object.keys(o),s=0;s<a.length;++s){var c=a[s],u=o[c];"object"==typeof u&&null!==u&&-1===n.indexOf(u)&&(e.push({obj:o,prop:c}),n.push(u))}return function(t){for(var e;t.length;){var n=t.pop();if(e=n.obj[n.prop],Array.isArray(e)){for(var r=[],i=0;i<e.length;++i)void 0!==e[i]&&r.push(e[i]);n.obj[n.prop]=r}}return e}(e)},decode:function(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t}},encode:function(t){if(0===t.length)return t;for(var e="string"==typeof t?t:String(t),n="",r=0;r<e.length;++r){var o=e.charCodeAt(r);45===o||46===o||95===o||126===o||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?n+=e.charAt(r):o<128?n+=i[o]:o<2048?n+=i[192|o>>6]+i[128|63&o]:o<55296||o>=57344?n+=i[224|o>>12]+i[128|o>>6&63]+i[128|63&o]:(r+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(r)),n+=i[240|o>>18]+i[128|o>>12&63]+i[128|o>>6&63]+i[128|63&o])}return n},isBuffer:function(t){return null!==t&&void 0!==t&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},merge:function t(e,n,i){if(!n)return e;if("object"!=typeof n){if(Array.isArray(e))e.push(n);else{if("object"!=typeof e)return[e,n];(i.plainObjects||i.allowPrototypes||!r.call(Object.prototype,n))&&(e[n]=!0)}return e}if("object"!=typeof e)return[e].concat(n);var a=e;return Array.isArray(e)&&!Array.isArray(n)&&(a=o(e,i)),Array.isArray(e)&&Array.isArray(n)?(n.forEach(function(n,o){r.call(e,o)?e[o]&&"object"==typeof e[o]?e[o]=t(e[o],n,i):e.push(n):e[o]=n}),e):Object.keys(n).reduce(function(e,o){var a=n[o];return r.call(e,o)?e[o]=t(e[o],a,i):e[o]=a,e},a)}}},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";var r=n(142);t.exports=function(t,e,n,i,o){var a=new Error(t);return r(a,e,n,i,o)}},function(t,e,n){"use strict";var r=n(5),i=n(143),o=n(141),a=n(140),s=n(139),c=n(71),u="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(138);t.exports=function(t){return new Promise(function(e,l){var h=t.data,p=t.headers;r.isFormData(h)&&delete p["Content-Type"];var d=new XMLHttpRequest,f="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in d||s(t.url)||(d=new window.XDomainRequest,f="onload",m=!0,d.onprogress=function(){},d.ontimeout=function(){}),t.auth){var g=t.auth.username||"",v=t.auth.password||"";p.Authorization="Basic "+u(g+":"+v)}if(d.open(t.method.toUpperCase(),o(t.url,t.params,t.paramsSerializer),!0),d.timeout=t.timeout,d[f]=function(){if(d&&(4===d.readyState||m)&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?a(d.getAllResponseHeaders()):null,r={data:t.responseType&&"text"!==t.responseType?d.response:d.responseText,status:1223===d.status?204:d.status,statusText:1223===d.status?"No Content":d.statusText,headers:n,config:t,request:d};i(e,l,r),d=null}},d.onerror=function(){l(c("Network Error",t,null,d)),d=null},d.ontimeout=function(){l(c("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",d)),d=null},r.isStandardBrowserEnv()){var y=n(137),b=(t.withCredentials||s(t.url))&&t.xsrfCookieName?y.read(t.xsrfCookieName):void 0;b&&(p[t.xsrfHeaderName]=b)}if("setRequestHeader"in d&&r.forEach(p,function(t,e){void 0===h&&"content-type"===e.toLowerCase()?delete p[e]:d.setRequestHeader(e,t)}),t.withCredentials&&(d.withCredentials=!0),t.responseType)try{d.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&d.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){d&&(d.abort(),l(t),d=null)}),void 0===h&&(h=null),d.send(h)})}},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}},function(t,e,n){"use strict";function r(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);null!==t&&void 0!==t&&this.setState(t)}function i(t){var e=this.constructor.getDerivedStateFromProps(t,this.state);null!==e&&void 0!==e&&this.setState(e)}function o(t,e){try{var n=this.props,r=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}r.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,t.exports=function(t){if(!t.prototype||!t.prototype.isReactComponent)throw new Error("Can only polyfill class components");if("function"==typeof t.getDerivedStateFromProps){if("function"==typeof t.prototype.componentWillMount)throw new Error("Cannot polyfill getDerivedStateFromProps() for components that define componentWillMount()");if("function"==typeof t.prototype.componentWillReceiveProps)throw new Error("Cannot polyfill getDerivedStateFromProps() for components that define componentWillReceiveProps()");t.prototype.componentWillMount=r,t.prototype.componentWillReceiveProps=i}if("function"==typeof t.prototype.getSnapshotBeforeUpdate){if("function"==typeof t.prototype.componentWillUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that define componentWillUpdate()");if("function"!=typeof t.prototype.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.prototype.componentWillUpdate=o;var e=t.prototype.componentDidUpdate;t.prototype.componentDidUpdate=function(t,n,r){var i=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:r;e.call(this,t,n,i)}}return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if((!a&&0!==a||t)&&o.default){var e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e),a=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return a};var r,i=n(85),o=(r=i)&&r.__esModule?r:{default:r};var a=void 0;t.exports=e.default},function(t,e,n){"use strict";(function(t){var r,i,o,a,s;n.d(e,"a",function(){return Dg}),"undefined"!=typeof window&&function(){window.console=window.console||{};for(var t,e,n=window.console,r={},i=function(){},o="memory".split(","),a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=o.pop();)n[t]||(n[t]=r);for(;e=a.pop();)n[e]||(n[e]=i)}(),void 0===window.HTMLCanvasElement||window.HTMLCanvasElement.prototype.toBlob||Object.defineProperty(window.HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,n){for(var r=window.atob(this.toDataURL(e,n).split(",")[1]),i=r.length,o=i>>2,a=new Uint8Array(i),s=new Uint32Array(a.buffer,0,o),c=0,u=0;c<o;c++)s[c]=r.charCodeAt(u++)|r.charCodeAt(u++)<<8|r.charCodeAt(u++)<<16|r.charCodeAt(u++)<<24;for(var l=3&i;l--;)a[u]=r.charCodeAt(u++);t(new window.Blob([a],{type:e||"image/png"}))}}),Math.cbrt=Math.cbrt||function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},Math.sign||(Math.sign=function(t){return 0===(t=+t)||isNaN(t)?Number(t):t>0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&t>-9007199254740992&&t<9007199254740992&&Math.floor(t)===t}),Number.isNaN||(Number.isNaN=function(t){return t!=t}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var e=arguments;if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var n,r=Object(t),i=!1,o=1;o<arguments.length;o++){var a=e[o];if(void 0!==a&&null!==a){for(var s=Object.keys(Object(a)),c=0,u=s.length;c<u;c++){var l=s[c];try{var h=Object.getOwnPropertyDescriptor(a,l);void 0!==h&&h.enumerable&&(r[l]=a[l])}catch(t){i||(i=!0,n=t)}}if(i)throw n}}return r}}),String.prototype.startsWith||
/*! https://mths.be/startswith v0.2.0 by @mathias */
function(){var t=function(){var t;try{var e={},n=Object.defineProperty;t=n(e,e,e)&&n}catch(t){}return t}(),e={}.toString,n=function(t){if(null===this)throw TypeError();var n=String(this);if(t&&"[object RegExp]"===e.call(t))throw TypeError();var r=n.length,i=String(t),o=i.length,a=arguments.length>1?arguments[1]:void 0,s=a?Number(a):0;Number.isNaN(s)&&(s=0);var c=Math.min(Math.max(s,0),r);if(o+c>r)return!1;for(var u=-1;++u<o;)if(n.charCodeAt(c+u)!==i.charCodeAt(u))return!1;return!0};t?t(String.prototype,"startsWith",{value:n,configurable:!0,writable:!0}):String.prototype.startsWith=n}(),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var n=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>n.length)&&(e=n.length),e-=t.length;var r=n.indexOf(t,e);return-1!==r&&r===e}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.includes||(Array.prototype.includes=function(t){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),n=parseInt(e.length,10)||0;if(0===n)return!1;var r,i,o=parseInt(arguments[1],10)||0;for(o>=0?r=o:(r=n+o)<0&&(r=0);r<n;){if(t===(i=e[r])||Number.isNaN(t)&&Number.isNaN(i))return!0;r++}return!1}),Array.from||(Array.from=(r=Object.prototype.toString,i=function(t){return"function"==typeof t||"[object Function]"===r.call(t)},o=Math.pow(2,53)-1,a=function(t){var e=function(t){var e=Number(t);return isNaN(e)?0:0!==e&&isFinite(e)?(e>0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),o)},function(t){var e=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!i(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}for(var o,s=a(e.length),c=i(this)?Object(new this(s)):new Array(s),u=0;u<s;)o=e[u],c[u]=r?void 0===n?r(o,u):r.call(n,o,u):o,u+=1;return c.length=s,c})),"undefined"!=typeof window&&function(){for(var t=0,e=["ms","moz","webkit","o"],n=0;n<e.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[e[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[n]+"CancelAnimationFrame"]||window[e[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var n=(new Date).getTime(),r=Math.max(0,16-(n-t)),i=window.setTimeout(function(){e(n+r)},r);return t=n+r,i}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}(),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]}}),"undefined"!=typeof window&&(void 0===window.performance&&(self.performance={}),void 0===window.performance.now&&(s=Date.now(),window.performance.now=function(){return Date.now()-s}));var c=setTimeout;function u(){}var l="function"==typeof t&&t||function(t){c(t,0)},h=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};function p(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],v(t,this)}function d(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,l(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void m(e.promise,t)}f(e.promise,r)}else(1===t._state?f:m)(e.promise,t._value)})):t._deferreds.push(e)}function f(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof p)return t._state=3,t._value=e,void g(t);if("function"==typeof n)return void v((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,g(t)}catch(e){m(t,e)}var r,i}function m(t,e){t._state=2,t._value=e,g(t)}function g(t){2===t._state&&0===t._deferreds.length&&l(function(){t._handled||h(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)d(t,t._deferreds[e]);t._deferreds=null}function v(t,e){var n=!1;try{t(function(t){n||(n=!0,f(e,t))},function(t){n||(n=!0,m(e,t))})}catch(t){if(n)return;n=!0,m(e,t)}}function y(){}p.prototype.catch=function(t){return this.then(null,t)},p.prototype.then=function(t,e){var n=new this.constructor(u);return d(this,new function(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}(t,e,n)),n},p.all=function(t){var e=Array.prototype.slice.call(t);return new p(function(t,n){if(0===e.length)return t([]);var r=e.length;function i(o,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){i(o,t)},n)}e[o]=a,0==--r&&t(e)}catch(t){n(t)}}for(var o=0;o<e.length;o++)i(o,e[o])})},p.resolve=function(t){return t&&"object"==typeof t&&t.constructor===p?t:new p(function(e){e(t)})},p.reject=function(t){return new p(function(e,n){n(t)})},p.race=function(t){return new p(function(e,n){for(var r=0,i=t.length;r<i;r++)t[r].then(e,n)})},p._setImmediateFn=function(t){l=t},p._setUnhandledRejectionFn=function(t){h=t},void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){var e=arguments;if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t),r=1;r<arguments.length;r++){var i=e[r];if(void 0!==i&&null!==i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n}),Object.assign(y.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,t)}}}});var b="86",x=0,_=1,w=2,S=0,C=1,A=2,E=0,M=1,T=2,P=1,I=2,R=0,O=1,L=2,k=0,N=1,D=2,z=3,F=4,B=5,U=100,j=101,G=102,V=103,H=104,$=200,W=201,q=202,X=203,Y=204,K=205,Z=206,Q=207,J=208,tt=209,et=210,nt=0,rt=1,it=2,ot=3,at=4,st=5,ct=6,ut=7,lt=0,ht=1,pt=2,dt=0,ft=1,mt=2,gt=3,vt=4,yt=301,bt=302,xt=303,_t=304,wt=305,St=306,Ct=307,At=1e3,Et=1001,Mt=1002,Tt=1003,Pt=1004,It=1005,Rt=1006,Ot=1007,Lt=1008,kt=1009,Nt=1010,Dt=1011,zt=1012,Ft=1013,Bt=1014,Ut=1015,jt=1016,Gt=1017,Vt=1018,Ht=1019,$t=1020,Wt=1021,qt=1022,Xt=1023,Yt=1024,Kt=1025,Zt=1026,Qt=1027,Jt=2001,te=2002,ee=2003,ne=2004,re=2100,ie=2101,oe=2102,ae=2103,se=2151,ce=2201,ue=2400,le=0,he=1,pe=2,de=3e3,fe=3001,me=3007,ge=3002,ve=3004,ye=3005,be=3006,xe=3200,_e=3201,we={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),r=0;return function(){for(var i=0;i<36;i++)8===i||13===i||18===i||23===i?n[i]="-":14===i?n[i]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),t=15&r,r>>=4,n[i]=e[19===i?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*we.DEG2RAD},radToDeg:function(t){return t*we.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};function Se(t,e){this.x=t||0,this.y=e||0}Object.defineProperties(Se.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(Se.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new Se,e=new Se;return function(n,r){return t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}});var Ce,Ae,Ee,Me,Te,Pe,Ie=0;function Re(t,e,n,r,i,o,a,s,c,u){Object.defineProperty(this,"id",{value:Ie++}),this.uuid=we.generateUUID(),this.name="",this.image=void 0!==t?t:Re.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Re.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Et,this.wrapT=void 0!==r?r:Et,this.magFilter=void 0!==i?i:Rt,this.minFilter=void 0!==o?o:Lt,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:Xt,this.type=void 0!==s?s:kt,this.offset=new Se(0,0),this.repeat=new Se(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:de,this.version=0,this.onUpdate=null}function Oe(t,e,n,r){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==r?r:1}function Le(t,e,n){this.uuid=we.generateUUID(),this.width=t,this.height=e,this.scissor=new Oe(0,0,t,e),this.scissorTest=!1,this.viewport=new Oe(0,0,t,e),void 0===(n=n||{}).minFilter&&(n.minFilter=Rt),this.texture=new Re(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,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function ke(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1}function Ne(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function De(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function ze(t,e,n,r,i,o,a,s,c,u,l,h){Re.call(this,null,o,a,s,c,u,r,i,l,h),this.image={data:t,width:e,height:n},this.magFilter=void 0!==c?c:Tt,this.minFilter=void 0!==u?u:Tt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function Fe(t,e,n,r,i,o,a,s,c,u){t=void 0!==t?t:[],e=void 0!==e?e:yt,Re.call(this,t,e,n,r,i,o,a,s,c,u),this.flipY=!1}Re.DEFAULT_IMAGE=void 0,Re.DEFAULT_MAPPING=300,Object.defineProperty(Re.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Re.prototype,y.prototype,{constructor:Re,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=we.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:((e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case At:t.x=t.x-Math.floor(t.x);break;case Et:t.x=t.x<0?0:1;break;case Mt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case At:t.y=t.y-Math.floor(t.y);break;case Et:t.y=t.y<0?0:1;break;case Mt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(Oe.prototype,{isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,o=t.elements,a=o[0],s=o[4],c=o[8],u=o[1],l=o[5],h=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(s-u)<.01&&Math.abs(c-p)<.01&&Math.abs(h-d)<.01){if(Math.abs(s+u)<.1&&Math.abs(c+p)<.1&&Math.abs(h+d)<.1&&Math.abs(a+l+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(l+1)/2,v=(f+1)/2,y=(s+u)/4,b=(c+p)/4,x=(h+d)/4;return m>g&&m>v?m<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(m)),i=b/n):g>v?g<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(g)),i=x/r):v<.01?(n=.707106781,r=.707106781,i=0):(n=b/(i=Math.sqrt(v)),r=x/i),this.set(n,r,i,e),this}var _=Math.sqrt((d-h)*(d-h)+(c-p)*(c-p)+(u-s)*(u-s));return Math.abs(_)<.001&&(_=1),this.x=(d-h)/_,this.y=(c-p)/_,this.z=(u-s)/_,this.w=Math.acos((a+l+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new Oe,e=new Oe),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(Le.prototype,y.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.assign(ke,{slerp:function(t,e,n,r){return n.copy(t).slerp(e,r)},slerpFlat:function(t,e,n,r,i,o,a){var s=n[r+0],c=n[r+1],u=n[r+2],l=n[r+3],h=i[o+0],p=i[o+1],d=i[o+2],f=i[o+3];if(l!==f||s!==h||c!==p||u!==d){var m=1-a,g=s*h+c*p+u*d+l*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*v;if(s=s*m+h*_,c=c*m+p*_,u=u*m+d*_,l=l*m+f*_,m===1-a){var w=1/Math.sqrt(s*s+c*c+u*u+l*l);s*=w,c*=w,u*=w,l*=w}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=l}}),Object.defineProperties(ke.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(ke.prototype,{set:function(t,e,n,r){return this._x=t,this._y=e,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(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(n/2),u=a(r/2),l=a(i/2),h=s(n/2),p=s(r/2),d=s(i/2);return"XYZ"===o?(this._x=h*u*l+c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l-h*p*d):"YXZ"===o?(this._x=h*u*l+c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l+h*p*d):"ZXY"===o?(this._x=h*u*l-c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l-h*p*d):"ZYX"===o?(this._x=h*u*l-c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l+h*p*d):"YZX"===o?(this._x=h*u*l+c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l-h*p*d):"XZY"===o&&(this._x=h*u*l-c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l+h*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],c=n[9],u=n[2],l=n[6],h=n[10],p=r+s+h;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-c)*e,this._y=(o-u)*e,this._z=(a-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(l-c)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(o+u)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(o-u)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(a-i)/e,this._x=(o+u)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:(Ae=new Ne,function(t,e){return void 0===Ae&&(Ae=new Ne),(Ce=t.dot(e)+1)<1e-6?(Ce=0,Math.abs(t.x)>Math.abs(t.z)?Ae.set(-t.y,t.x,0):Ae.set(0,-t.z,t.y)):Ae.crossVectors(t,e),this._x=Ae.x,this._y=Ae.y,this._z=Ae.z,this._w=Ce,this.normalize()}),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=n*u+o*a+r*c-i*s,this._y=r*u+o*s+i*a-n*c,this._z=i*u+o*c+n*s-r*a,this._w=o*u-n*a-r*s-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)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 c=Math.atan2(s,a),u=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=o*u+this._w*l,this._x=n*u+this._x*l,this._y=r*u+this._y*l,this._z=i*u+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(Ne.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(Ee=new ke,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Ee.setFromEuler(t))}),applyAxisAngle:function(){var t=new ke;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*r-a*n,u=s*n+a*e-i*r,l=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=c*s+h*-i+u*-a-l*-o,this.y=u*s+h*-o+l*-i-c*-a,this.z=l*s+h*-a+c*-o-u*-i,this},project:function(){var t=new De;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new De;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new Ne,e=new Ne;return function(n,r){return t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-n*t.z,this.z=n*t.y-r*t.x,this},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new Ne;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new Ne;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(we.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(De.prototype,{isMatrix4:!0,set:function(t,e,n,r,i,o,a,s,c,u,l,h,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=u,g[10]=l,g[14]=h,g[3]=p,g[7]=d,g[11]=f,g[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 De).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new Ne;return function(e){var n=this.elements,r=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),c=Math.sin(r),u=Math.cos(i),l=Math.sin(i);if("XYZ"===t.order){var h=o*u,p=o*l,d=a*u,f=a*l;e[0]=s*u,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=h-f*c,e[9]=-a*s,e[2]=f-h*c,e[6]=d+p*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*u,g=s*l,v=c*u,y=c*l;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*l,e[5]=o*u,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){m=s*u,g=s*l,v=c*u,y=c*l;e[0]=m-y*a,e[4]=-o*l,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*u,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){h=o*u,p=o*l,d=a*u,f=a*l;e[0]=s*u,e[4]=d*c-p,e[8]=h*c+f,e[1]=s*l,e[5]=f*c+h,e[9]=p*c-d,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=w-b*l,e[8]=_*l+x,e[1]=l,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=x*l+_,e[10]=b-w*l}else if("XZY"===t.order){b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=-l,e[8]=c*u,e[1]=b*l+w,e[5]=o*u,e[9]=x*l-_,e[2]=_*l-x,e[6]=a*u,e[10]=w*l+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,r=t._y,i=t._z,o=t._w,a=n+n,s=r+r,c=i+i,u=n*a,l=n*s,h=n*c,p=r*s,d=r*c,f=i*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(p+f),e[4]=l-v,e[8]=h+g,e[1]=l+v,e[5]=1-(u+f),e[9]=d-m,e[2]=h-g,e[6]=d+m,e[10]=1-(u+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:(Me=new Ne,Te=new Ne,Pe=new Ne,function(t,e,n){var r=this.elements;return Pe.subVectors(t,e),0===Pe.lengthSq()&&(Pe.z=1),Pe.normalize(),Me.crossVectors(n,Pe),0===Me.lengthSq()&&(1===Math.abs(n.z)?Pe.x+=1e-4:Pe.z+=1e-4,Pe.normalize(),Me.crossVectors(n,Pe)),Me.normalize(),Te.crossVectors(Pe,Me),r[0]=Me.x,r[4]=Te.x,r[8]=Pe.x,r[1]=Me.y,r[5]=Te.y,r[9]=Pe.y,r[2]=Me.z,r[6]=Te.z,r[10]=Pe.z,this}),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],u=n[1],l=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],_=r[0],w=r[4],S=r[8],C=r[12],A=r[1],E=r[5],M=r[9],T=r[13],P=r[2],I=r[6],R=r[10],O=r[14],L=r[3],k=r[7],N=r[11],D=r[15];return i[0]=o*_+a*A+s*P+c*L,i[4]=o*w+a*E+s*I+c*k,i[8]=o*S+a*M+s*R+c*N,i[12]=o*C+a*T+s*O+c*D,i[1]=u*_+l*A+h*P+p*L,i[5]=u*w+l*E+h*I+p*k,i[9]=u*S+l*M+h*R+p*N,i[13]=u*C+l*T+h*O+p*D,i[2]=d*_+f*A+m*P+g*L,i[6]=d*w+f*E+m*I+g*k,i[10]=d*S+f*M+m*R+g*N,i[14]=d*C+f*T+m*O+g*D,i[3]=v*_+y*A+b*P+x*L,i[7]=v*w+y*E+b*I+x*k,i[11]=v*S+y*M+b*R+x*N,i[15]=v*C+y*T+b*O+x*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new Ne;return function(e){for(var n=0,r=e.count;n<r;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix4(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],o=t[1],a=t[5],s=t[9],c=t[13],u=t[2],l=t[6],h=t[10],p=t[14];return t[3]*(+i*s*l-r*c*l-i*a*h+n*c*h+r*a*p-n*s*p)+t[7]*(+e*s*p-e*c*h+i*o*h-r*o*p+r*c*u-i*s*u)+t[11]*(+e*c*l-e*a*p-i*o*l+n*o*p+i*a*u-n*c*u)+t[15]*(-r*a*u-e*s*l+e*a*h+r*o*l-n*o*h+n*s*u)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var n=this.elements,r=t.elements,i=r[0],o=r[1],a=r[2],s=r[3],c=r[4],u=r[5],l=r[6],h=r[7],p=r[8],d=r[9],f=r[10],m=r[11],g=r[12],v=r[13],y=r[14],b=r[15],x=d*y*h-v*f*h+v*l*m-u*y*m-d*l*b+u*f*b,_=g*f*h-p*y*h-g*l*m+c*y*m+p*l*b-c*f*b,w=p*v*h-g*d*h+g*u*m-c*v*m-p*u*b+c*d*b,S=g*d*l-p*v*l-g*u*f+c*v*f+p*u*y-c*d*y,C=i*x+o*_+a*w+s*S;if(0===C){var A="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(A);return console.warn(A),this.identity()}var E=1/C;return n[0]=x*E,n[1]=(v*f*s-d*y*s-v*a*m+o*y*m+d*a*b-o*f*b)*E,n[2]=(u*y*s-v*l*s+v*a*h-o*y*h-u*a*b+o*l*b)*E,n[3]=(d*l*s-u*f*s-d*a*h+o*f*h+u*a*m-o*l*m)*E,n[4]=_*E,n[5]=(p*y*s-g*f*s+g*a*m-i*y*m-p*a*b+i*f*b)*E,n[6]=(g*l*s-c*y*s-g*a*h+i*y*h+c*a*b-i*l*b)*E,n[7]=(c*f*s-p*l*s+p*a*h-i*f*h-c*a*m+i*l*m)*E,n[8]=w*E,n[9]=(g*d*s-p*v*s-g*o*m+i*v*m+p*o*b-i*d*b)*E,n[10]=(c*v*s-g*u*s+g*o*h-i*v*h-c*o*b+i*u*b)*E,n[11]=(p*u*s-c*d*s-p*o*h+i*d*h+c*o*m-i*u*m)*E,n[12]=S*E,n[13]=(p*v*a-g*d*a+g*o*f-i*v*f-p*o*y+i*d*y)*E,n[14]=(g*u*a-c*v*a-g*o*l+i*v*l+c*o*y-i*u*y)*E,n[15]=(c*d*a-p*u*a+p*o*l-i*d*l-c*o*f+i*u*f)*E,this},scale:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,a=t.y,s=t.z,c=i*o,u=i*a;return this.set(c*o+n,c*a-r*s,c*s+r*a,0,c*a+r*s,u*a+n,u*s-r*o,0,c*s-r*a,u*s+r*o,i*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t=new Ne,e=new De;return function(n,r,i){var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),c=t.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),n.x=o[12],n.y=o[13],n.z=o[14],e.copy(this);var u=1/a,l=1/s,h=1/c;return e.elements[0]*=u,e.elements[1]*=u,e.elements[2]*=u,e.elements[4]*=l,e.elements[5]*=l,e.elements[6]*=l,e.elements[8]*=h,e.elements[9]*=h,e.elements[10]*=h,r.setFromRotationMatrix(e),i.x=a,i.y=s,i.z=c,this}}(),makePerspective:function(t,e,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*i/(e-t),c=2*i/(n-r),u=(e+t)/(e-t),l=(n+r)/(n-r),h=-(o+i)/(o-i),p=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,n,r,i,o){var a=this.elements,s=1/(e-t),c=1/(n-r),u=1/(o-i),l=(e+t)*s,h=(n+r)*c,p=(o+i)*u;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}),ze.prototype=Object.create(Re.prototype),ze.prototype.constructor=ze,ze.prototype.isDataTexture=!0,Fe.prototype=Object.create(Re.prototype),Fe.prototype.constructor=Fe,Fe.prototype.isCubeTexture=!0,Object.defineProperty(Fe.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Be=new Re,Ue=new Fe;function je(){this.seq=[],this.map={}}var Ge=[],Ve=[],He=new Float32Array(16),$e=new Float32Array(9);function We(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,o=Ge[i];if(void 0===o&&(o=new Float32Array(i),Ge[i]=o),0!==e){r.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function qe(t,e){var n=Ve[e];void 0===n&&(n=new Int32Array(e),Ve[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n}function Xe(t,e){t.uniform1f(this.addr,e)}function Ye(t,e){t.uniform1i(this.addr,e)}function Ke(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function Ze(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function Qe(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function Je(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function tn(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):($e.set(e.elements),t.uniformMatrix3fv(this.addr,!1,$e))}function en(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(He.set(e.elements),t.uniformMatrix4fv(this.addr,!1,He))}function nn(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTexture2D(e||Be,r)}function rn(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(e||Ue,r)}function on(t,e){t.uniform2iv(this.addr,e)}function an(t,e){t.uniform3iv(this.addr,e)}function sn(t,e){t.uniform4iv(this.addr,e)}function cn(t,e){t.uniform1fv(this.addr,e)}function un(t,e){t.uniform1iv(this.addr,e)}function ln(t,e){t.uniform2fv(this.addr,We(e,this.size,2))}function hn(t,e){t.uniform3fv(this.addr,We(e,this.size,3))}function pn(t,e){t.uniform4fv(this.addr,We(e,this.size,4))}function dn(t,e){t.uniformMatrix2fv(this.addr,!1,We(e,this.size,4))}function fn(t,e){t.uniformMatrix3fv(this.addr,!1,We(e,this.size,9))}function mn(t,e){t.uniformMatrix4fv(this.addr,!1,We(e,this.size,16))}function gn(t,e,n){var r=e.length,i=qe(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(e[o]||Be,i[o])}function vn(t,e,n){var r=e.length,i=qe(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(e[o]||Ue,i[o])}function yn(t,e,n){this.id=t,this.addr=n,this.setValue=function(t){switch(t){case 5126:return Xe;case 35664:return Ke;case 35665:return Ze;case 35666:return Qe;case 35674:return Je;case 35675:return tn;case 35676:return en;case 35678:case 36198:return nn;case 35680:return rn;case 5124:case 35670:return Ye;case 35667:case 35671:return on;case 35668:case 35672:return an;case 35669:case 35673:return sn}}(e.type)}function bn(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return cn;case 35664:return ln;case 35665:return hn;case 35666:return pn;case 35674:return dn;case 35675:return fn;case 35676:return mn;case 35678:return gn;case 35680:return vn;case 5124:case 35670:return un;case 35667:case 35671:return on;case 35668:case 35672:return an;case 35669:case 35673:return sn}}(e.type)}function xn(t){this.id=t,je.call(this)}xn.prototype.setValue=function(t,e){for(var n=this.seq,r=0,i=n.length;r!==i;++r){var o=n[r];o.setValue(t,e[o.id])}};var _n=/([\w\d_]+)(\])?(\[|\.)?/g;function wn(t,e){t.seq.push(e),t.map[e.id]=e}function Sn(t,e,n){var r=t.name,i=r.length;for(_n.lastIndex=0;;){var o=_n.exec(r),a=_n.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s|=0),void 0===u||"["===u&&a+2===i){wn(n,void 0===u?new yn(s,t,e):new bn(s,t,e));break}var l=n.map[s];void 0===l&&wn(n,l=new xn(s)),n=l}}function Cn(t,e,n){je.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i<r;++i){var o=t.getActiveUniform(e,i),a=o.name;Sn(o,t.getUniformLocation(e,a),this)}}Cn.prototype.setValue=function(t,e,n){var r=this.map[e];void 0!==r&&r.setValue(t,n,this.renderer)},Cn.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},Cn.upload=function(t,e,n,r){for(var i=0,o=e.length;i!==o;++i){var a=e[i],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,r)}},Cn.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var o=t[r];o.id in e&&n.push(o)}return n};var An={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};function En(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}Object.assign(En.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,r){if(e=we.euclideanModulo(e,1),n=we.clamp(n,0,1),r=we.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u,l=(u=n[1]).length;if(3===l)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}t&&t.length>0&&(void 0!==(u=An[t])?this.setHex(u):console.warn("THREE.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,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(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),c=Math.min(i,o,a),u=(c+s)/2;if(c===s)e=0,n=0;else{var l=s-c;switch(n=u<=.5?l/(s+c):l/(2-s-c),s){case i:e=(o-a)/l+(o<a?6:0);break;case o:e=(a-i)/l+2;break;case a:e=(i-o)/l+4}e/=6}return r.h=e,r.s=n,r.l=u,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var r=this.getHSL();return r.h+=t,r.s+=e,r.l+=n,this.setHSL(r.h,r.s,r.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Mn={common:{diffuse:{value:new En(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new Oe(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Se(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new En(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new En(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new Oe(0,0,1,1)}}},Tn={merge:function(t){for(var e={},n=0;n<t.length;n++){var r=this.clone(t[n]);for(var i in r)e[i]=r[i]}return e},clone:function(t){var e={};for(var n in t)for(var r in e[n]={},t[n]){var i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}return e}},Pn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE  = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS  = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:"  gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM            = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D      = max( maxRange / maxRGB, 1.0 );\n\tD            = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = asin( flipNormal * reflectVec.y ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n  varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3(   1,   0, t.y ),\n\t\t\tvec3(   0, t.z,   0 ),\n\t\t\tvec3( t.w,   0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n  gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},In={basic:{uniforms:Tn.merge([Mn.common,Mn.aomap,Mn.lightmap,Mn.fog]),vertexShader:Pn.meshbasic_vert,fragmentShader:Pn.meshbasic_frag},lambert:{uniforms:Tn.merge([Mn.common,Mn.aomap,Mn.lightmap,Mn.emissivemap,Mn.fog,Mn.lights,{emissive:{value:new En(0)}}]),vertexShader:Pn.meshlambert_vert,fragmentShader:Pn.meshlambert_frag},phong:{uniforms:Tn.merge([Mn.common,Mn.aomap,Mn.lightmap,Mn.emissivemap,Mn.bumpmap,Mn.normalmap,Mn.displacementmap,Mn.gradientmap,Mn.fog,Mn.lights,{emissive:{value:new En(0)},specular:{value:new En(1118481)},shininess:{value:30}}]),vertexShader:Pn.meshphong_vert,fragmentShader:Pn.meshphong_frag},standard:{uniforms:Tn.merge([Mn.common,Mn.aomap,Mn.lightmap,Mn.emissivemap,Mn.bumpmap,Mn.normalmap,Mn.displacementmap,Mn.roughnessmap,Mn.metalnessmap,Mn.fog,Mn.lights,{emissive:{value:new En(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag},points:{uniforms:Tn.merge([Mn.points,Mn.fog]),vertexShader:Pn.points_vert,fragmentShader:Pn.points_frag},dashed:{uniforms:Tn.merge([Mn.common,Mn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pn.linedashed_vert,fragmentShader:Pn.linedashed_frag},depth:{uniforms:Tn.merge([Mn.common,Mn.displacementmap]),vertexShader:Pn.depth_vert,fragmentShader:Pn.depth_frag},normal:{uniforms:Tn.merge([Mn.common,Mn.bumpmap,Mn.normalmap,Mn.displacementmap,{opacity:{value:1}}]),vertexShader:Pn.normal_vert,fragmentShader:Pn.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Pn.cube_vert,fragmentShader:Pn.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Pn.equirect_vert,fragmentShader:Pn.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new Ne}},vertexShader:Pn.distanceRGBA_vert,fragmentShader:Pn.distanceRGBA_frag}};function Rn(t,e){this.min=void 0!==t?t:new Se(1/0,1/0),this.max=void 0!==e?e:new Se(-1/0,-1/0)}function On(t,e){var n,r,i,o,a,s,c,u,l=t.context,h=t.state;function p(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),p=new Uint16Array([0,1,2,0,2,3]);n=l.createBuffer(),r=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,n),l.bufferData(l.ARRAY_BUFFER,e,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r),l.bufferData(l.ELEMENT_ARRAY_BUFFER,p,l.STATIC_DRAW),c=l.createTexture(),u=l.createTexture(),h.bindTexture(l.TEXTURE_2D,c),l.texImage2D(l.TEXTURE_2D,0,l.RGB,16,16,0,l.RGB,l.UNSIGNED_BYTE,null),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST),h.bindTexture(l.TEXTURE_2D,u),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,16,16,0,l.RGBA,l.UNSIGNED_BYTE,null),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST),i={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility =        visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *=       visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},o=function(e){var n=l.createProgram(),r=l.createShader(l.FRAGMENT_SHADER),i=l.createShader(l.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return l.shaderSource(r,o+e.fragmentShader),l.shaderSource(i,o+e.vertexShader),l.compileShader(r),l.compileShader(i),l.attachShader(n,r),l.attachShader(n,i),l.linkProgram(n),n}(i),a={vertex:l.getAttribLocation(o,"position"),uv:l.getAttribLocation(o,"uv")},s={renderType:l.getUniformLocation(o,"renderType"),map:l.getUniformLocation(o,"map"),occlusionMap:l.getUniformLocation(o,"occlusionMap"),opacity:l.getUniformLocation(o,"opacity"),color:l.getUniformLocation(o,"color"),scale:l.getUniformLocation(o,"scale"),rotation:l.getUniformLocation(o,"rotation"),screenPosition:l.getUniformLocation(o,"screenPosition")}}this.render=function(i,d,f){if(0!==e.length){var m=new Ne,g=f.w/f.z,v=.5*f.z,y=.5*f.w,b=16/f.w,x=new Se(b*g,b),_=new Ne(1,1,0),w=new Se(1,1),S=new Rn;S.min.set(f.x,f.y),S.max.set(f.x+(f.z-16),f.y+(f.w-16)),void 0===o&&p(),l.useProgram(o),h.initAttributes(),h.enableAttribute(a.vertex),h.enableAttribute(a.uv),h.disableUnusedAttributes(),l.uniform1i(s.occlusionMap,0),l.uniform1i(s.map,1),l.bindBuffer(l.ARRAY_BUFFER,n),l.vertexAttribPointer(a.vertex,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(a.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r),h.disable(l.CULL_FACE),h.buffers.depth.setMask(!1);for(var C=0,A=e.length;C<A;C++){b=16/f.w,x.set(b*g,b);var E=e[C];if(m.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),m.applyMatrix4(d.matrixWorldInverse),m.applyMatrix4(d.projectionMatrix),_.copy(m),w.x=f.x+_.x*v+v-8,w.y=f.y+_.y*y+y-8,!0===S.containsPoint(w)){h.activeTexture(l.TEXTURE0),h.bindTexture(l.TEXTURE_2D,null),h.activeTexture(l.TEXTURE1),h.bindTexture(l.TEXTURE_2D,c),l.copyTexImage2D(l.TEXTURE_2D,0,l.RGB,w.x,w.y,16,16,0),l.uniform1i(s.renderType,0),l.uniform2f(s.scale,x.x,x.y),l.uniform3f(s.screenPosition,_.x,_.y,_.z),h.disable(l.BLEND),h.enable(l.DEPTH_TEST),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0),h.activeTexture(l.TEXTURE0),h.bindTexture(l.TEXTURE_2D,u),l.copyTexImage2D(l.TEXTURE_2D,0,l.RGBA,w.x,w.y,16,16,0),l.uniform1i(s.renderType,1),h.disable(l.DEPTH_TEST),h.activeTexture(l.TEXTURE1),h.bindTexture(l.TEXTURE_2D,c),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0),E.positionScreen.copy(_),E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares(),l.uniform1i(s.renderType,2),h.enable(l.BLEND);for(var M=0,T=E.lensFlares.length;M<T;M++){var P=E.lensFlares[M];P.opacity>.001&&P.scale>.001&&(_.x=P.x,_.y=P.y,_.z=P.z,b=P.size*P.scale/f.w,x.x=b*g,x.y=b,l.uniform3f(s.screenPosition,_.x,_.y,_.z),l.uniform2f(s.scale,x.x,x.y),l.uniform1f(s.rotation,P.rotation),l.uniform1f(s.opacity,P.opacity),l.uniform3f(s.color,P.color.r,P.color.g,P.color.b),h.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),t.setTexture2D(P.texture,1),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0))}}}h.enable(l.CULL_FACE),h.enable(l.DEPTH_TEST),h.buffers.depth.setMask(!0),t.resetGLState()}}}function Ln(t,e){var n,r,i,o,a,s,c=t.context,u=t.state,l=new Ne,h=new ke,p=new Ne;function d(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),u=new Uint16Array([0,1,2,0,2,3]);n=c.createBuffer(),r=c.createBuffer(),c.bindBuffer(c.ARRAY_BUFFER,n),c.bufferData(c.ARRAY_BUFFER,e,c.STATIC_DRAW),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r),c.bufferData(c.ELEMENT_ARRAY_BUFFER,u,c.STATIC_DRAW),i=function(){var e=c.createProgram(),n=c.createShader(c.VERTEX_SHADER),r=c.createShader(c.FRAGMENT_SHADER);return c.shaderSource(n,["precision "+t.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),c.shaderSource(r,["precision "+t.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),c.compileShader(n),c.compileShader(r),c.attachShader(e,n),c.attachShader(e,r),c.linkProgram(e),e}(),o={position:c.getAttribLocation(i,"position"),uv:c.getAttribLocation(i,"uv")},a={uvOffset:c.getUniformLocation(i,"uvOffset"),uvScale:c.getUniformLocation(i,"uvScale"),rotation:c.getUniformLocation(i,"rotation"),scale:c.getUniformLocation(i,"scale"),color:c.getUniformLocation(i,"color"),map:c.getUniformLocation(i,"map"),opacity:c.getUniformLocation(i,"opacity"),modelViewMatrix:c.getUniformLocation(i,"modelViewMatrix"),projectionMatrix:c.getUniformLocation(i,"projectionMatrix"),fogType:c.getUniformLocation(i,"fogType"),fogDensity:c.getUniformLocation(i,"fogDensity"),fogNear:c.getUniformLocation(i,"fogNear"),fogFar:c.getUniformLocation(i,"fogFar"),fogColor:c.getUniformLocation(i,"fogColor"),alphaTest:c.getUniformLocation(i,"alphaTest")};var l=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");l.width=8,l.height=8;var h=l.getContext("2d");h.fillStyle="white",h.fillRect(0,0,8,8),(s=new Re(l)).needsUpdate=!0}function f(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(m,g){if(0!==e.length){void 0===i&&d(),c.useProgram(i),u.initAttributes(),u.enableAttribute(o.position),u.enableAttribute(o.uv),u.disableUnusedAttributes(),u.disable(c.CULL_FACE),u.enable(c.BLEND),c.bindBuffer(c.ARRAY_BUFFER,n),c.vertexAttribPointer(o.position,2,c.FLOAT,!1,16,0),c.vertexAttribPointer(o.uv,2,c.FLOAT,!1,16,8),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r),c.uniformMatrix4fv(a.projectionMatrix,!1,g.projectionMatrix.elements),u.activeTexture(c.TEXTURE0),c.uniform1i(a.map,0);var v=0,y=0,b=m.fog;b?(c.uniform3f(a.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(c.uniform1f(a.fogNear,b.near),c.uniform1f(a.fogFar,b.far),c.uniform1i(a.fogType,1),v=1,y=1):b.isFogExp2&&(c.uniform1f(a.fogDensity,b.density),c.uniform1i(a.fogType,2),v=2,y=2)):(c.uniform1i(a.fogType,0),v=0,y=0);for(var x=0,_=e.length;x<_;x++){(S=e[x]).modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,S.matrixWorld),S.z=-S.modelViewMatrix.elements[14]}e.sort(f);var w=[];for(x=0,_=e.length;x<_;x++){var S,C=(S=e[x]).material;if(!1!==C.visible){S.onBeforeRender(t,m,g,void 0,C,void 0),c.uniform1f(a.alphaTest,C.alphaTest),c.uniformMatrix4fv(a.modelViewMatrix,!1,S.modelViewMatrix.elements),S.matrixWorld.decompose(l,h,p),w[0]=p.x,w[1]=p.y;var A=0;m.fog&&C.fog&&(A=y),v!==A&&(c.uniform1i(a.fogType,A),v=A),null!==C.map?(c.uniform2f(a.uvOffset,C.map.offset.x,C.map.offset.y),c.uniform2f(a.uvScale,C.map.repeat.x,C.map.repeat.y)):(c.uniform2f(a.uvOffset,0,0),c.uniform2f(a.uvScale,1,1)),c.uniform1f(a.opacity,C.opacity),c.uniform3f(a.color,C.color.r,C.color.g,C.color.b),c.uniform1f(a.rotation,C.rotation),c.uniform2fv(a.scale,w),u.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst,C.blendEquationAlpha,C.blendSrcAlpha,C.blendDstAlpha,C.premultipliedAlpha),u.buffers.depth.setTest(C.depthTest),u.buffers.depth.setMask(C.depthWrite),C.map?t.setTexture2D(C.map,0):t.setTexture2D(s,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0),S.onAfterRender(t,m,g,void 0,C,void 0)}}u.enable(c.CULL_FACE),t.resetGLState()}}}In.physical={uniforms:Tn.merge([In.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag},Object.assign(Rn.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new Se;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new Se;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new Se;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new Se).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new Se).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new Se;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var kn,Nn,Dn,zn,Fn,Bn,Un=0;function jn(){Object.defineProperty(this,"id",{value:Un++}),this.uuid=we.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=N,this.side=E,this.shading=I,this.vertexColors=R,this.opacity=1,this.transparent=!1,this.blendSrc=Y,this.blendDst=K,this.blendEquation=U,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ot,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function Gn(t){jn.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function Vn(t){jn.call(this),this.type="MeshDepthMaterial",this.depthPacking=xe,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function Hn(t,e){this.min=void 0!==t?t:new Ne(1/0,1/0,1/0),this.max=void 0!==e?e:new Ne(-1/0,-1/0,-1/0)}function $n(t,e){this.center=void 0!==t?t:new Ne,this.radius=void 0!==e?e:0}function Wn(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function qn(t,e){this.normal=void 0!==t?t:new Ne(1,0,0),this.constant=void 0!==e?e:0}function Xn(t,e,n,r,i,o){this.planes=[void 0!==t?t:new qn,void 0!==e?e:new qn,void 0!==n?n:new qn,void 0!==r?r:new qn,void 0!==i?i:new qn,void 0!==o?o:new qn]}function Yn(t,e,n,r){var i=t.context,o=t.state,a=new Xn,s=new De,c=e.shadows,u=new Se,l=new Se(r.maxTextureSize,r.maxTextureSize),h=new Ne,p=new Ne,d=1,f=2,m=1+(d|f),g=new Array(m),v=new Array(m),y={},b=[new Ne(1,0,0),new Ne(-1,0,0),new Ne(0,0,1),new Ne(0,0,-1),new Ne(0,1,0),new Ne(0,-1,0)],x=[new Ne(0,1,0),new Ne(0,1,0),new Ne(0,1,0),new Ne(0,1,0),new Ne(0,0,1),new Ne(0,0,-1)],_=[new Oe,new Oe,new Oe,new Oe,new Oe,new Oe],w=new Vn;w.depthPacking=_e,w.clipping=!0;for(var S=In.distanceRGBA,A=Tn.clone(S.uniforms),P=0;P!==m;++P){var I=0!=(P&d),R=0!=(P&f),O=w.clone();O.morphTargets=I,O.skinning=R,g[P]=O;var L=new Gn({defines:{USE_SHADOWMAP:""},uniforms:A,vertexShader:S.vertexShader,fragmentShader:S.fragmentShader,morphTargets:I,skinning:R,clipping:!0});v[P]=L}var k=this;function N(e,n,r,i){var o=e.geometry,a=null,s=g,c=e.customDepthMaterial;if(r&&(s=v,c=e.customDistanceMaterial),c)a=c;else{var u=!1;n.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var l=e.isSkinnedMesh&&n.skinning,h=0;u&&(h|=d),l&&(h|=f),a=s[h]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var p=a.uuid,m=n.uuid,b=y[p];void 0===b&&(b={},y[p]=b);var x=b[m];void 0===x&&(x=a.clone(),b[m]=x),a=x}a.visible=n.visible,a.wireframe=n.wireframe;var _=n.side;return k.renderSingleSided&&_==T&&(_=E),k.renderReverseSided&&(_===E?_=M:_===M&&(_=E)),a.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(i),a}function D(e,r,i,o){if(!1!==e.visible){if(e.layers.test(r.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||a.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld);var s=n.update(e),c=e.material;if(Array.isArray(c))for(var u=s.groups,l=0,h=u.length;l<h;l++){var d=u[l],f=c[d.materialIndex];if(f&&f.visible){var m=N(e,f,o,p);t.renderBufferDirect(i,null,s,m,e,d)}}else if(c.visible){m=N(e,c,o,p);t.renderBufferDirect(i,null,s,m,e,null)}}for(var g=e.children,v=0,y=g.length;v<y;v++)D(g[v],r,i,o)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=C,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,n){if(!1!==k.enabled&&(!1!==k.autoUpdate||!1!==k.needsUpdate)&&0!==c.length){var r;o.disable(i.BLEND),o.buffers.color.setClear(1,1,1,1),o.buffers.depth.setTest(!0),o.setScissorTest(!1);for(var d=0,f=c.length;d<f;d++){var m=c[d],g=m.shadow,v=m&&m.isPointLight;if(void 0!==g){var y=g.camera;if(u.copy(g.mapSize),u.min(l),v){var w=u.x,S=u.y;_[0].set(2*w,S,w,S),_[1].set(0,S,w,S),_[2].set(3*w,S,w,S),_[3].set(w,S,w,S),_[4].set(3*w,0,w,S),_[5].set(w,0,w,S),u.x*=4,u.y*=2}if(null===g.map){var C={minFilter:Tt,magFilter:Tt,format:Xt};g.map=new Le(u.x,u.y,C),g.map.texture.name=m.name+".shadowMap",y.updateProjectionMatrix()}g.isSpotLightShadow&&g.update(m);var A=g.map,E=g.matrix;p.setFromMatrixPosition(m.matrixWorld),y.position.copy(p),v?(r=6,E.makeTranslation(-p.x,-p.y,-p.z)):(r=1,h.setFromMatrixPosition(m.target.matrixWorld),y.lookAt(h),y.updateMatrixWorld(),E.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),E.multiply(y.projectionMatrix),E.multiply(y.matrixWorldInverse)),t.setRenderTarget(A),t.clear();for(var M=0;M<r;M++){if(v){h.copy(y.position),h.add(b[M]),y.up.copy(x[M]),y.lookAt(h),y.updateMatrixWorld();var T=_[M];o.viewport(T)}s.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),a.setFromMatrix(s),D(e,n,y,v)}}else console.warn("THREE.WebGLShadowMap:",m,"has no shadow.")}var P=t.getClearColor(),I=t.getClearAlpha();t.setClearColor(P,I),k.needsUpdate=!1}}}function Kn(t){var e={};return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e[t.uuid]},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var r=e[n.uuid];r&&(t.deleteBuffer(r.buffer),delete e[n.uuid])},update:function(n,r){n.isInterleavedBufferAttribute&&(n=n.data);var i=e[n.uuid];void 0===i?e[n.uuid]=function(e,n){var r=e.array,i=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,o=t.createBuffer();t.bindBuffer(n,o),t.bufferData(n,r,i),e.onUploadCallback();var a=t.FLOAT;return r instanceof Float32Array?a=t.FLOAT:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?a=t.UNSIGNED_SHORT:r instanceof Int16Array?a=t.SHORT:r instanceof Uint32Array?a=t.UNSIGNED_INT:r instanceof Int32Array?a=t.INT:r instanceof Int8Array?a=t.BYTE:r instanceof Uint8Array&&(a=t.UNSIGNED_BYTE),{buffer:o,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(n,r):i.version<n.version&&(function(e,n,r){var i=n.array,o=n.updateRange;t.bindBuffer(r,e),!1===n.dynamic?t.bufferData(r,i,t.STATIC_DRAW):-1===o.count?t.bufferSubData(r,0,i):0===o.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(r,o.offset*i.BYTES_PER_ELEMENT,i.subarray(o.offset,o.offset+o.count)),o.count=-1)}(i.buffer,n,r),i.version=n.version)}}}function Zn(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._order=r||Zn.DefaultOrder}function Qn(){this.mask=1}Object.assign(jn.prototype,y.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==N&&(n.blending=this.blending),this.shading!==I&&(n.shading=this.shading),this.side!==E&&(n.side=this.side),this.vertexColors!==R&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,n.dithering=this.dithering,e){var i=r(t.textures),o=r(t.images);i.length>0&&(n.textures=i),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Gn.prototype=Object.create(jn.prototype),Gn.prototype.constructor=Gn,Gn.prototype.isShaderMaterial=!0,Gn.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Tn.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Gn.prototype.toJSON=function(t){var e=jn.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},Vn.prototype=Object.create(jn.prototype),Vn.prototype.constructor=Vn,Vn.prototype.isMeshDepthMaterial=!0,Vn.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(Hn.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var u=t[s],l=t[s+1],h=t[s+2];u<e&&(e=u),l<n&&(n=l),h<r&&(r=h),u>i&&(i=u),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;s<c;s++){var u=t.getX(s),l=t.getY(s),h=t.getZ(s);u<e&&(e=u),l<n&&(n=l),h<r&&(r=h),u>i&&(i=u),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new Ne;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new Ne;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new Ne;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new Ne;return function(e){var n=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var r,i,o=e.geometry;if(void 0!==o)if(o.isGeometry){var a=o.vertices;for(r=0,i=a.length;r<i;r++)t.copy(a[r]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}else if(o.isBufferGeometry){var s=o.attributes.position;if(void 0!==s)for(r=0,i=s.count;r<i;r++)t.fromBufferAttribute(s,r).applyMatrix4(e.matrixWorld),n.expandByPoint(t)}}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new Ne).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:(Nn=new Ne,function(t){return this.clampPoint(t.center,Nn),Nn.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new Ne).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new Ne;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new Ne;return function(e){var n=e||new $n;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(kn=[new Ne,new Ne,new Ne,new Ne,new Ne,new Ne,new Ne,new Ne],function(t){return this.isEmpty()?this:(kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(kn),this)}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign($n.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(Dn=new Hn,function(t,e){var n=this.center;void 0!==e?n.copy(e):Dn.setFromPoints(t).getCenter(n);for(var r=0,i=0,o=t.length;i<o;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t),r=e||new Ne;return r.copy(t),n>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new Hn;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(Wn.prototype,{isMatrix3:!0,set:function(t,e,n,r,i,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=r,u[2]=a,u[3]=e,u[4]=i,u[5]=s,u[6]=n,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new Ne;return function(e){for(var n=0,r=e.count;n<r;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix3(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[3],s=n[6],c=n[1],u=n[4],l=n[7],h=n[2],p=n[5],d=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],b=r[7],x=r[2],_=r[5],w=r[8];return i[0]=o*f+a*v+s*x,i[3]=o*m+a*y+s*_,i[6]=o*g+a*b+s*w,i[1]=c*f+u*v+l*x,i[4]=c*m+u*y+l*_,i[7]=c*g+u*b+l*w,i[2]=h*f+p*v+d*x,i[5]=h*m+p*y+d*_,i[8]=h*g+p*b+d*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-n*i*u+n*a*s+r*i*c-r*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=t.elements,r=this.elements,i=n[0],o=n[1],a=n[2],s=n[3],c=n[4],u=n[5],l=n[6],h=n[7],p=n[8],d=p*c-u*h,f=u*l-p*s,m=h*s-c*l,g=i*d+o*f+a*m;if(0===g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return r[0]=d*y,r[1]=(a*h-p*o)*y,r[2]=(u*o-a*c)*y,r[3]=f*y,r[4]=(p*i-a*l)*y,r[5]=(a*s-u*i)*y,r[6]=m*y,r[7]=(o*l-h*i)*y,r[8]=(c*i-o*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}}),Object.assign(qn.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new Ne,e=new Ne;return function(n,r,i){var o=t.subVectors(i,r).cross(e.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t);return(e||new Ne).copy(this.normal).multiplyScalar(n)},intersectLine:function(){var t=new Ne;return function(e,n){var r=n||new Ne,i=e.delta(t),o=this.normal.dot(i);if(0===o)return 0===this.distanceToPoint(e.start)?r.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/o;return a<0||a>1?void 0:r.copy(i).multiplyScalar(a).add(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new Ne).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new Ne,e=new Wn;return function(n,r){var i=this.coplanarPoint(t).applyMatrix4(n),o=r||e.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-i.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(Xn.prototype,{set:function(t,e,n,r,i,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],c=n[5],u=n[6],l=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-r,l-s,f-h,y-m).normalize(),e[1].setComponents(a+r,l+s,f+h,y+m).normalize(),e[2].setComponents(a+i,l+c,f+p,y+g).normalize(),e[3].setComponents(a-i,l-c,f-p,y-g).normalize(),e[4].setComponents(a-o,l-u,f-d,y-v).normalize(),e[5].setComponents(a+o,l+u,f+d,y+v).normalize(),this},intersectsObject:(Bn=new $n,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Bn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Bn)}),intersectsSprite:function(){var t=new $n;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)<r)return!1}return!0},intersectsBox:(zn=new Ne,Fn=new Ne,function(t){for(var e=this.planes,n=0;n<6;n++){var r=e[n];zn.x=r.normal.x>0?t.min.x:t.max.x,Fn.x=r.normal.x>0?t.max.x:t.min.x,zn.y=r.normal.y>0?t.min.y:t.max.y,Fn.y=r.normal.y>0?t.max.y:t.min.y,zn.z=r.normal.z>0?t.min.z:t.max.z,Fn.z=r.normal.z>0?t.max.z:t.min.z;var i=r.distanceToPoint(zn),o=r.distanceToPoint(Fn);if(i<0&&o<0)return!1}return!0}),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}}),Zn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Zn.DefaultOrder="XYZ",Object.defineProperties(Zn.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(Zn.prototype,{isEuler:!0,set:function(t,e,n,r){return this._x=t,this._y=e,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(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var r=we.clamp,i=t.elements,o=i[0],a=i[4],s=i[8],c=i[1],u=i[5],l=i[9],h=i[2],p=i[6],d=i[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,u),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-h,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===e?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(p,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new De;return function(e,n,r){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new ke;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new Ne(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(Qn.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Jn,tr,er=0;function nr(){Object.defineProperty(this,"id",{value:er++}),this.uuid=we.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nr.DefaultUp.clone();var t=new Ne,e=new Zn,n=new ke,r=new Ne(1,1,1);e.onChange(function(){n.setFromEuler(e,!1)}),n.onChange(function(){e.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:r},modelViewMatrix:{value:new De},normalMatrix:{value:new Wn}}),this.matrix=new De,this.matrixWorld=new De,this.matrixAutoUpdate=nr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Qn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function rr(){nr.call(this),this.type="Camera",this.matrixWorldInverse=new De,this.projectionMatrix=new De}function ir(t,e,n,r,i,o){rr.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=void 0!==i?i:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function or(t,e,n,r){rr.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t: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!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ar(t,e,n,r,i,o){this.a=t,this.b=e,this.c=n,this.normal=r&&r.isVector3?r:new Ne,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new En,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0}nr.DefaultUp=new Ne(0,1,0),nr.DefaultMatrixAutoUpdate=!0,Object.assign(nr.prototype,y.prototype,{isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:(tr=new ke,function(t,e){return tr.setFromAxisAngle(t,e),this.quaternion.multiply(tr),this}),rotateX:function(){var t=new Ne(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new Ne(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new Ne(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new Ne;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new Ne(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new Ne(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new Ne(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:(Jn=new De,function(t){return t.applyMatrix4(Jn.getInverse(this.matrixWorld))}),lookAt:function(){var t=new De;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){var e=arguments;if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(e[n]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){var e=arguments;if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.remove(e[n]);return this}var r=this.children.indexOf(t);return-1!==r&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(r,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}},getWorldPosition:function(t){var e=t||new Ne;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new Ne,e=new Ne;return function(n){var r=n||new ke;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new ke;return function(e){var n=e||new Zn;return this.getWorldQuaternion(t),n.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new Ne,e=new ke;return function(n){var r=n||new Ne;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new ke;return function(e){var n=e||new Ne;return this.getWorldQuaternion(t),n.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)},toJSON:function(t){var e=void 0===t||""===t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(r.geometry=i(t.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var o=[],a=0,s=this.material.length;a<s;a++)o.push(i(t.materials,this.material[a]));r.material=o}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(t).object)}if(e){var c=p(t.geometries),u=p(t.materials),l=p(t.textures),h=p(t.images);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),l.length>0&&(n.textures=l),h.length>0&&(n.images=h)}return n.object=r,n;function p(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var r=t.children[n];this.add(r.clone())}return this}}),rr.prototype=Object.assign(Object.create(nr.prototype),{constructor:rr,isCamera:!0,copy:function(t,e){return nr.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new ke;return function(e){var n=e||new Ne;return this.getWorldQuaternion(t),n.set(0,0,-1).applyQuaternion(t)}}(),updateMatrixWorld:function(t){nr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),ir.prototype=Object.assign(Object.create(rr.prototype),{constructor:ir,isOrthographicCamera:!0,copy:function(t,e){return rr.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,r,i,o){this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:r,width:i,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-t,o=n+t,a=r+e,s=r-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),u=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;o=(i+=l*(this.view.offsetX/c))+l*(this.view.width/c),s=(a-=h*(this.view.offsetY/u))-h*(this.view.height/u)}this.projectionMatrix.makeOrthographic(i,o,a,s,this.near,this.far)},toJSON:function(t){var e=nr.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),or.prototype=Object.assign(Object.create(rr.prototype),{constructor:or,isPerspectiveCamera:!0,copy:function(t,e){return rr.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*we.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*we.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*we.RAD2DEG*Math.atan(Math.tan(.5*we.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,o){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:r,width:i,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*we.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r,o=this.view;if(null!==o){var a=o.fullWidth,s=o.fullHeight;i+=o.offsetX*r/a,e-=o.offsetY*n/s,r*=o.width/a,n*=o.height/s}var c=this.filmOffset;0!==c&&(i+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far)},toJSON:function(t){var e=nr.prototype.toJSON.call(this,t);return 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}}),Object.assign(ar.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var sr,cr,ur,lr,hr,pr,dr,fr,mr=0;function gr(){return mr++}function vr(){Object.defineProperty(this,"id",{value:gr()}),this.uuid=we.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.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function yr(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=we.generateUUID(),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function br(t,e){yr.call(this,new Uint16Array(t),e)}function xr(t,e){yr.call(this,new Uint32Array(t),e)}function _r(t,e){yr.call(this,new Float32Array(t),e)}function wr(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Sr(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}function Cr(){Object.defineProperty(this,"id",{value:gr()}),this.uuid=we.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Ar(t,e,n,r,i,o){vr.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Er(t,e,n,r,i,o)),this.mergeVertices()}function Er(t,e,n,r,i,o){Cr.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};var a=this;r=Math.floor(r)||1,i=Math.floor(i)||1;var s=[],c=[],u=[],l=[],h=0,p=0;function d(t,e,n,r,i,o,d,f,m,g,v){var y,b,x=o/m,_=d/g,w=o/2,S=d/2,C=f/2,A=m+1,E=g+1,M=0,T=0,P=new Ne;for(b=0;b<E;b++){var I=b*_-S;for(y=0;y<A;y++){var R=y*x-w;P[t]=R*r,P[e]=I*i,P[n]=C,c.push(P.x,P.y,P.z),P[t]=0,P[e]=0,P[n]=f>0?1:-1,u.push(P.x,P.y,P.z),l.push(y/m),l.push(1-b/g),M+=1}}for(b=0;b<g;b++)for(y=0;y<m;y++){var O=h+y+A*b,L=h+y+A*(b+1),k=h+(y+1)+A*(b+1),N=h+(y+1)+A*b;s.push(O,L,N),s.push(L,k,N),T+=6}a.addGroup(p,T,v),p+=T,h+=M}d("z","y","x",-1,-1,n,e,t,o=Math.floor(o)||1,i,0),d("z","y","x",1,-1,n,e,-t,o,i,1),d("x","z","y",1,1,t,n,e,r,o,2),d("x","z","y",1,-1,t,n,-e,r,o,3),d("x","y","z",1,-1,t,e,n,r,i,4),d("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(s),this.addAttribute("position",new _r(c,3)),this.addAttribute("normal",new _r(u,3)),this.addAttribute("uv",new _r(l,2))}function Mr(t,e,n,r){vr.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Tr(t,e,n,r)),this.mergeVertices()}function Tr(t,e,n,r){Cr.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};var i,o,a=t/2,s=e/2,c=Math.floor(n)||1,u=Math.floor(r)||1,l=c+1,h=u+1,p=t/c,d=e/u,f=[],m=[],g=[],v=[];for(o=0;o<h;o++){var y=o*d-s;for(i=0;i<l;i++){var b=i*p-a;m.push(b,-y,0),g.push(0,0,1),v.push(i/c),v.push(1-o/u)}}for(o=0;o<u;o++)for(i=0;i<c;i++){var x=i+l*o,_=i+l*(o+1),w=i+1+l*(o+1),S=i+1+l*o;f.push(x,_,S),f.push(_,w,S)}this.setIndex(f),this.addAttribute("position",new _r(m,3)),this.addAttribute("normal",new _r(g,3)),this.addAttribute("uv",new _r(v,2))}function Pr(t){jn.call(this),this.type="MeshBasicMaterial",this.color=new En(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=lt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Ir(t,e){this.origin=void 0!==t?t:new Ne,this.direction=void 0!==e?e:new Ne}function Rr(t,e){this.start=void 0!==t?t:new Ne,this.end=void 0!==e?e:new Ne}function Or(t,e,n){this.a=void 0!==t?t:new Ne,this.b=void 0!==e?e:new Ne,this.c=void 0!==n?n:new Ne}function Lr(t,e){nr.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Cr,this.material=void 0!==e?e:new Pr({color:16777215*Math.random()}),this.drawMode=le,this.updateMorphTargets()}function kr(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Nr(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Dr(){var t={};return{get:function(e,n){var r=e.id+","+n.id,i=t[r];return void 0===i&&(i=new function(){var t=[],e=-1,n=[],r=-1;return{opaque:t,transparent:n,init:function(){e=-1,r=-1},push:function(i,o,a,s,c){var u,l;a.transparent?(u=n,l=++r):(u=t,l=++e);var h=u[l];h?(h.id=i.id,h.object=i,h.geometry=o,h.material=a,h.program=a.program,h.renderOrder=i.renderOrder,h.z=s,h.group=c):(h={id:i.id,object:i,geometry:o,material:a,program:a.program,renderOrder:i.renderOrder,z:s,group:c},u.push(h))},finish:function(){t.length=e+1,n.length=r+1},sort:function(){t.sort(kr),n.sort(Nr)}}},t[r]=i),i},dispose:function(){t={}}}}function zr(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),!1===t.getShaderParameter(r,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(r),function(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}(n)),r}Object.assign(vr.prototype,y.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new Wn).getNormalMatrix(t),n=0,r=this.vertices.length;n<r;n++){this.vertices[n].applyMatrix4(t)}for(n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(e).normalize();for(var o=0,a=i.vertexNormals.length;o<a;o++)i.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t=new De;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new De;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new De;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new De;return function(e,n,r){return t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t=new De;return function(e,n,r){return t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:(sr=new nr,function(t){sr.lookAt(t),sr.updateMatrix(),this.applyMatrix(sr.matrix)}),fromBufferGeometry:function(t){var e=this,n=null!==t.index?t.index.array:void 0,r=t.attributes,i=r.position.array,o=void 0!==r.normal?r.normal.array:void 0,a=void 0!==r.color?r.color.array:void 0,s=void 0!==r.uv?r.uv.array:void 0,c=void 0!==r.uv2?r.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var u=[],l=[],h=[],p=0,d=0;p<i.length;p+=3,d+=2)e.vertices.push(new Ne(i[p],i[p+1],i[p+2])),void 0!==o&&u.push(new Ne(o[p],o[p+1],o[p+2])),void 0!==a&&e.colors.push(new En(a[p],a[p+1],a[p+2])),void 0!==s&&l.push(new Se(s[d],s[d+1])),void 0!==c&&h.push(new Se(c[d],c[d+1]));function f(t,n,r,i){var p=new ar(t,n,r,void 0!==o?[u[t].clone(),u[n].clone(),u[r].clone()]:[],void 0!==a?[e.colors[t].clone(),e.colors[n].clone(),e.colors[r].clone()]:[],i);e.faces.push(p),void 0!==s&&e.faceVertexUvs[0].push([l[t].clone(),l[n].clone(),l[r].clone()]),void 0!==c&&e.faceVertexUvs[1].push([h[t].clone(),h[n].clone(),h[r].clone()])}var m=t.groups;if(m.length>0)for(p=0;p<m.length;p++)for(var g=m[p],v=g.start,y=(d=v,v+g.count);d<y;d+=3)void 0!==n?f(n[d],n[d+1],n[d+2],g.materialIndex):f(d,d+1,d+2,g.materialIndex);else if(void 0!==n)for(p=0;p<n.length;p+=3)f(n[p],n[p+1],n[p+2]);else for(p=0;p<i.length/3;p+=3)f(p,p+1,p+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,r=new De;return r.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new Ne,e=new Ne,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],o=this.vertices[i.a],a=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,a),e.subVectors(o,a),t.cross(e),t.normalize(),i.normal.copy(t)}},computeVertexNormals:function(t){var e,n,r,i,o,a;for(void 0===t&&(t=!0),a=new Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)a[e]=new Ne;if(t){var s,c,u,l=new Ne,h=new Ne;for(r=0,i=this.faces.length;r<i;r++)o=this.faces[r],s=this.vertices[o.a],c=this.vertices[o.b],u=this.vertices[o.c],l.subVectors(u,c),h.subVectors(s,c),l.cross(h),a[o.a].add(l),a[o.b].add(l),a[o.c].add(l)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a[(o=this.faces[r]).a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(e=0,n=this.vertices.length;e<n;e++)a[e].normalize();for(r=0,i=this.faces.length;r<i;r++){var p=(o=this.faces[r]).vertexNormals;3===p.length?(p[0].copy(a[o.a]),p[1].copy(a[o.b]),p[2].copy(a[o.c])):(p[0]=a[o.a].clone(),p[1]=a[o.b].clone(),p[2]=a[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var r=(n=this.faces[t]).vertexNormals;3===r.length?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for((i=this.faces[n]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;t<e;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var o=new vr;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var a=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)c=new Ne,u={a:new Ne,b:new Ne,c:new Ne},a.push(c),s.push(u)}var c,u,l=this.morphNormals[t];for(o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=l.faceNormals[n],u=l.vertexNormals[n],c.copy(i.normal),u.a.copy(i.vertexNormals[0]),u.b.copy(i.vertexNormals[1]),u.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,n=0,r=e.length;n<r;n++)n>0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Hn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new $n),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(t&&t.isGeometry){var r,i=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],l=t.faceVertexUvs[0],h=this.colors,p=t.colors;void 0===n&&(n=0),void 0!==e&&(r=(new Wn).getNormalMatrix(e));for(var d=0,f=a.length;d<f;d++){var m=a[d].clone();void 0!==e&&m.applyMatrix4(e),o.push(m)}for(d=0,f=p.length;d<f;d++)h.push(p[d].clone());for(d=0,f=c.length;d<f;d++){var g,v,y,b=c[d],x=b.vertexNormals,_=b.vertexColors;(g=new ar(b.a+i,b.b+i,b.c+i)).normal.copy(b.normal),void 0!==r&&g.normal.applyMatrix3(r).normalize();for(var w=0,S=x.length;w<S;w++)v=x[w].clone(),void 0!==r&&v.applyMatrix3(r).normalize(),g.vertexNormals.push(v);g.color.copy(b.color);for(w=0,S=_.length;w<S;w++)y=_[w],g.vertexColors.push(y.clone());g.materialIndex=b.materialIndex+n,s.push(g)}for(d=0,f=l.length;d<f;d++){var C=l[d],A=[];if(void 0!==C){for(w=0,S=C.length;w<S;w++)A.push(C[w].clone());u.push(A)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,n,r,i,o,a,s,c={},u=[],l=[],h=Math.pow(10,4);for(n=0,r=this.vertices.length;n<r;n++)t=this.vertices[n],void 0===c[e=Math.round(t.x*h)+"_"+Math.round(t.y*h)+"_"+Math.round(t.z*h)]?(c[e]=n,u.push(this.vertices[n]),l[n]=u.length-1):l[n]=l[c[e]];var p=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=l[i.a],i.b=l[i.b],i.c=l[i.c],o=[i.a,i.b,i.c];for(var d=0;d<3;d++)if(o[d]===o[(d+1)%3]){p.push(n);break}}for(n=p.length-1;n>=0;n--){var f=p[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(f,1)}var m=this.vertices.length-u.length;return this.vertices=u,m},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,n=0;n<e;n++)t[n]._id=n;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var r,i,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];o&&o.length===e&&(r=[]),a&&a.length===e&&(i=[]);for(n=0;n<e;n++){var s=t[n]._id;r&&r.push(o[s]),i&&i.push(a[s])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}for(var r=[],i=0;i<this.vertices.length;i++){var o=this.vertices[i];r.push(o.x,o.y,o.z)}var a=[],s=[],c={},u=[],l={},h=[],p={};for(i=0;i<this.faces.length;i++){var d=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=d.normal.length()>0,g=d.vertexNormals.length>0,v=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,b=0;if(b=S(b=S(b=S(b=S(b=S(b=S(b=S(b=S(b,0,0),1,!0),2,!1),3,f),4,m),5,g),6,v),7,y),a.push(b),a.push(d.a,d.b,d.c),a.push(d.materialIndex),f){var x=this.faceVertexUvs[0][i];a.push(E(x[0]),E(x[1]),E(x[2]))}if(m&&a.push(C(d.normal)),g){var _=d.vertexNormals;a.push(C(_[0]),C(_[1]),C(_[2]))}if(v&&a.push(A(d.color)),y){var w=d.vertexColors;a.push(A(w[0]),A(w[1]),A(w[2]))}}function S(t,e,n){return n?t|1<<e:t&~(1<<e)}function C(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]?c[e]:(c[e]=s.length/3,s.push(t.x,t.y,t.z),c[e])}function A(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==l[e]?l[e]:(l[e]=u.length,u.push(t.getHex()),l[e])}function E(t){var e=t.x.toString()+t.y.toString();return void 0!==p[e]?p[e]:(p[e]=h.length/2,h.push(t.x,t.y),p[e])}return t.data={},t.data.vertices=r,t.data.normals=s,u.length>0&&(t.data.colors=u),h.length>0&&(t.data.uvs=[h]),t.data.faces=a,t},clone:function(){return(new vr).copy(this)},copy:function(t){var e,n,r,i,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e<n;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,n=c.length;e<n;e++)this.colors.push(c[e].clone());var u=t.faces;for(e=0,n=u.length;e<n;e++)this.faces.push(u[e].clone());for(e=0,n=t.faceVertexUvs.length;e<n;e++){var l=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),r=0,i=l.length;r<i;r++){var h=l[r],p=[];for(o=0,a=h.length;o<a;o++){var d=h[o];p.push(d.clone())}this.faceVertexUvs[e].push(p)}}var f=t.morphTargets;for(e=0,n=f.length;e<n;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],r=0,i=f[e].vertices.length;r<i;r++)m.vertices.push(f[e].vertices[r].clone());if(void 0!==f[e].normals)for(m.normals=[],r=0,i=f[e].normals.length;r<i;r++)m.normals.push(f[e].normals[r].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(e=0,n=g.length;e<n;e++){var v={};if(void 0!==g[e].vertexNormals)for(v.vertexNormals=[],r=0,i=g[e].vertexNormals.length;r<i;r++){var y=g[e].vertexNormals[r],b={};b.a=y.a.clone(),b.b=y.b.clone(),b.c=y.c.clone(),v.vertexNormals.push(b)}if(void 0!==g[e].faceNormals)for(v.faceNormals=[],r=0,i=g[e].faceNormals.length;r<i;r++)v.faceNormals.push(g[e].faceNormals[r].clone());this.morphNormals.push(v)}var x=t.skinWeights;for(e=0,n=x.length;e<n;e++)this.skinWeights.push(x[e].clone());var _=t.skinIndices;for(e=0,n=_.length;e<n;e++)this.skinIndices.push(_[e].clone());var w=t.lineDistances;for(e=0,n=w.length;e<n;e++)this.lineDistances.push(w[e]);var S=t.boundingBox;null!==S&&(this.boundingBox=S.clone());var C=t.boundingSphere;return null!==C&&(this.boundingSphere=C.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(yr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(yr.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),o=new En),e[n++]=o.r,e[n++]=o.g,e[n++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];e[n++]=o.a,e[n++]=o.b,e[n++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new Se),e[n++]=o.x,e[n++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),o=new Ne),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),o=new Oe),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z,e[n++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),br.prototype=Object.create(yr.prototype),br.prototype.constructor=br,xr.prototype=Object.create(yr.prototype),xr.prototype.constructor=xr,_r.prototype=Object.create(yr.prototype),_r.prototype.constructor=_r,Object.assign(wr.prototype,{computeGroups:function(t){for(var e,n=[],r=void 0,i=t.faces,o=0;o<i.length;o++){var a=i[o];a.materialIndex!==r&&(r=a.materialIndex,void 0!==e&&(e.count=3*o-e.start,n.push(e)),e={start:3*o,materialIndex:r})}void 0!==e&&(e.count=3*o-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,n=t.faces,r=t.vertices,i=t.faceVertexUvs,o=i[0]&&i[0].length>0,a=i[1]&&i[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var u=0;u<c;u++)e[u]=[];this.morphTargets.position=e}var l,h=t.morphNormals,p=h.length;if(p>0){l=[];for(u=0;u<p;u++)l[u]=[];this.morphTargets.normal=l}var d=t.skinIndices,f=t.skinWeights,m=d.length===r.length,g=f.length===r.length;for(u=0;u<n.length;u++){var v=n[u];this.vertices.push(r[v.a],r[v.b],r[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var b=v.normal;this.normals.push(b,b,b)}var x,_=v.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var w=v.color;this.colors.push(w,w,w)}if(!0===o)void 0!==(x=i[0][u])?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",u),this.uvs.push(new Se,new Se,new Se));if(!0===a)void 0!==(x=i[1][u])?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",u),this.uvs2.push(new Se,new Se,new Se));for(var S=0;S<c;S++){var C=s[S].vertices;e[S].push(C[v.a],C[v.b],C[v.c])}for(S=0;S<p;S++){var A=h[S].vertexNormals[u];l[S].push(A.a,A.b,A.c)}m&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}}),Cr.MaxIndex=65535,Object.assign(Cr.prototype,y.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(Sr(t)>65535?xr:br)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new yr(arguments[1],arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new Wn).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new De;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new De;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new De;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new De;return function(e,n,r){return t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t=new De;return function(e,n,r){return t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:function(){var t=new nr;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new _r(3*e.vertices.length,3),r=new _r(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new _r(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e,n=t.geometry;if(t.isMesh){var r=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(r=void 0,n.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(n);r.verticesNeedUpdate=n.verticesNeedUpdate,r.normalsNeedUpdate=n.normalsNeedUpdate,r.colorsNeedUpdate=n.colorsNeedUpdate,r.uvsNeedUpdate=n.uvsNeedUpdate,r.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=r}return!0===n.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(n.vertices),e.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(n.normals),e.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(n.colors),e.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(n.uvs),e.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(n.lineDistances),e.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(t.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new wr).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new yr(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new yr(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new yr(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new yr(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new yr(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=new(Sr(t.indices)>65535?Uint32Array:Uint16Array)(3*t.indices.length);this.setIndex(new yr(a,1).copyIndicesArray(t.indices))}for(var s in this.groups=t.groups,t.morphTargets){for(var c=[],u=t.morphTargets[s],l=0,h=u.length;l<h;l++){var p=u[l],d=new _r(3*p.length,3);c.push(d.copyVector3sArray(p))}this.morphAttributes[s]=c}if(t.skinIndices.length>0){var f=new _r(4*t.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var m=new _r(4*t.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Hn);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new Hn,e=new Ne;return function(){null===this.boundingSphere&&(this.boundingSphere=new $n);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(r);for(var i=0,o=0,a=n.count;o<a;o++)e.x=n.getX(o),e.y=n.getY(o),e.z=n.getZ(o),i=Math.max(i,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,n=this.groups;if(e.position){var r=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new yr(new Float32Array(r.length),3));else for(var i=e.normal.array,o=0,a=i.length;o<a;o++)i[o]=0;var s,c,u,l=e.normal.array,h=new Ne,p=new Ne,d=new Ne,f=new Ne,m=new Ne;if(t){var g=t.array;0===n.length&&this.addGroup(0,g.length);for(var v=0,y=n.length;v<y;++v){var b=n[v],x=b.start;for(o=x,a=x+b.count;o<a;o+=3)s=3*g[o+0],c=3*g[o+1],u=3*g[o+2],h.fromArray(r,s),p.fromArray(r,c),d.fromArray(r,u),f.subVectors(d,p),m.subVectors(h,p),f.cross(m),l[s]+=f.x,l[s+1]+=f.y,l[s+2]+=f.z,l[c]+=f.x,l[c+1]+=f.y,l[c+2]+=f.z,l[u]+=f.x,l[u+1]+=f.y,l[u+2]+=f.z}}else for(o=0,a=r.length;o<a;o+=9)h.fromArray(r,o),p.fromArray(r,o+3),d.fromArray(r,o+6),f.subVectors(d,p),m.subVectors(h,p),f.cross(m),l[o]=f.x,l[o+1]=f.y,l[o+2]=f.z,l[o+3]=f.x,l[o+4]=f.y,l[o+5]=f.z,l[o+6]=f.x,l[o+7]=f.y,l[o+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0);var n=this.attributes;for(var r in n)if(void 0!==t.attributes[r])for(var i=n[r].array,o=t.attributes[r],a=o.array,s=0,c=o.itemSize*e;s<a.length;s++,c++)i[c]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,n,r,i=this.attributes.normal,o=0,a=i.count;o<a;o++)t=i.getX(o),e=i.getY(o),n=i.getZ(o),r=1/Math.sqrt(t*t+e*e+n*n),i.setXYZ(o,t*r,e*r,n*r)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Cr,e=this.index.array,n=this.attributes;for(var r in n){for(var i=n[r],o=i.array,a=i.itemSize,s=new o.constructor(e.length*a),c=0,u=0,l=0,h=e.length;l<h;l++){c=e[l]*a;for(var p=0;p<a;p++)s[u++]=o[c++]}t.addAttribute(r,new yr(s,a))}return t},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;if(null!==r){var i=Array.prototype.slice.call(r.array);t.data.index={type:r.array.constructor.name,array:i}}var o=this.attributes;for(var n in o){var a=o[n];i=Array.prototype.slice.call(a.array);t.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:i,normalized:a.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Cr).copy(this)},copy:function(t){var e,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var c=[],u=s[e];for(n=0,r=u.length;n<r;n++)c.push(u[n].clone());this.morphAttributes[e]=c}var l=t.groups;for(n=0,r=l.length;n<r;n++){var h=l[n];this.addGroup(h.start,h.count,h.materialIndex)}var p=t.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=t.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ar.prototype=Object.create(vr.prototype),Ar.prototype.constructor=Ar,Er.prototype=Object.create(Cr.prototype),Er.prototype.constructor=Er,Mr.prototype=Object.create(vr.prototype),Mr.prototype.constructor=Mr,Tr.prototype=Object.create(Cr.prototype),Tr.prototype.constructor=Tr,Pr.prototype=Object.create(jn.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isMeshBasicMaterial=!0,Pr.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.assign(Ir.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new Ne).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new Ne;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new Ne;n.subVectors(t,this.origin);var r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new Ne;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:(ur=new Ne,lr=new Ne,hr=new Ne,function(t,e,n,r){ur.copy(t).add(e).multiplyScalar(.5),lr.copy(e).sub(t).normalize(),hr.copy(this.origin).sub(ur);var i,o,a,s,c=.5*t.distanceTo(e),u=-this.direction.dot(lr),l=hr.dot(this.direction),h=-hr.dot(lr),p=hr.lengthSq(),d=Math.abs(1-u*u);if(d>0)if(o=u*l-h,s=c*d,(i=u*h-l)>=0)if(o>=-s)if(o<=s){var f=1/d;a=(i*=f)*(i+u*(o*=f)+2*l)+o*(u*i+o+2*h)+p}else o=c,a=-(i=Math.max(0,-(u*o+l)))*i+o*(o+2*h)+p;else o=-c,a=-(i=Math.max(0,-(u*o+l)))*i+o*(o+2*h)+p;else o<=-s?a=-(i=Math.max(0,-(-u*c+l)))*i+(o=i>0?-c:Math.min(Math.max(-c,-h),c))*(o+2*h)+p:o<=s?(i=0,a=(o=Math.min(Math.max(-c,-h),c))*(o+2*h)+p):a=-(i=Math.max(0,-(u*c+l)))*i+(o=i>0?c:Math.min(Math.max(-c,-h),c))*(o+2*h)+p;else o=u>0?-c:c,a=-(i=Math.max(0,-(u*o+l)))*i+o*(o+2*h)+p;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(lr).multiplyScalar(o).add(ur),a}),intersectSphere:function(){var t=new Ne;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,o=e.radius*e.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,c=r+a;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,r,i,o,a,s,c=1/this.direction.x,u=1/this.direction.y,l=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,r=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,r=(t.min.x-h.x)*c),u>=0?(i=(t.min.y-h.y)*u,o=(t.max.y-h.y)*u):(i=(t.max.y-h.y)*u,o=(t.min.y-h.y)*u),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),l>=0?(a=(t.min.z-h.z)*l,s=(t.max.z-h.z)*l):(a=(t.max.z-h.z)*l,s=(t.min.z-h.z)*l),n>s||a>r?null:((a>n||n!=n)&&(n=a),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))},intersectsBox:(cr=new Ne,function(t){return null!==this.intersectBox(t,cr)}),intersectTriangle:function(){var t=new Ne,e=new Ne,n=new Ne,r=new Ne;return function(i,o,a,s,c){e.subVectors(o,i),n.subVectors(a,i),r.crossVectors(e,n);var u,l=this.direction.dot(r);if(l>0){if(s)return null;u=1}else{if(!(l<0))return null;u=-1,l=-l}t.subVectors(this.origin,i);var h=u*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var p=u*this.direction.dot(e.cross(t));if(p<0)return null;if(h+p>l)return null;var d=-u*t.dot(r);return d<0?null:this.at(d/l,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(Rr.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new Ne).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new Ne).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var n=e||new Ne;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(pr=new Ne,dr=new Ne,function(t,e){pr.subVectors(t,this.start),dr.subVectors(this.end,this.start);var n=dr.dot(dr),r=dr.dot(pr)/n;return e&&(r=we.clamp(r,0,1)),r}),closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e),i=n||new Ne;return this.delta(i).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(Or,{normal:(fr=new Ne,function(t,e,n,r){var i=r||new Ne;i.subVectors(n,e),fr.subVectors(t,e),i.cross(fr);var o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}),barycoordFromPoint:function(){var t=new Ne,e=new Ne,n=new Ne;return function(r,i,o,a,s){t.subVectors(a,i),e.subVectors(o,i),n.subVectors(r,i);var c=t.dot(t),u=t.dot(e),l=t.dot(n),h=e.dot(e),p=e.dot(n),d=c*h-u*u,f=s||new Ne;if(0===d)return f.set(-2,-1,-1);var m=1/d,g=(h*l-u*p)*m,v=(c*p-u*l)*m;return f.set(1-g-v,v,g)}}(),containsPoint:function(){var t=new Ne;return function(e,n,r,i){var o=Or.barycoordFromPoint(e,n,r,i,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(Or.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new Ne,e=new Ne;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new Ne).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return Or.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new qn).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return Or.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return Or.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new qn,e=[new Rr,new Rr,new Rr],n=new Ne,r=new Ne;return function(i,o){var a=o||new Ne,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,n),!0===this.containsPoint(n))a.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c<e.length;c++){e[c].closestPointToPoint(n,!0,r);var u=n.distanceToSquared(r);u<s&&(s=u,a.copy(r))}}return a}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Lr.prototype=Object.assign(Object.create(nr.prototype),{constructor:Lr,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return nr.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t,e,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,o=Object.keys(i);if(o.length>0){var a=i[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=a.length;t<e;t++)n=a[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}else{var s=r.morphTargets;if(void 0!==s&&s.length>0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;t<e;t++)n=s[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}},raycast:function(){var t=new De,e=new Ir,n=new $n,r=new Ne,i=new Ne,o=new Ne,a=new Ne,s=new Ne,c=new Ne,u=new Se,l=new Se,h=new Se,p=new Ne,d=new Ne,f=new Ne;function m(t,e,n,r,i,o,a){return Or.barycoordFromPoint(t,e,n,r,p),i.multiplyScalar(p.x),o.multiplyScalar(p.y),a.multiplyScalar(p.z),i.add(o).add(a),i.clone()}function g(t,e,n,r,i,o,a){var s=t.material;if(null===(s.side===M?n.intersectTriangle(o,i,r,!0,a):n.intersectTriangle(r,i,o,s.side!==T,a)))return null;f.copy(a),f.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(f);return c<e.near||c>e.far?null:{distance:c,point:f.clone(),object:t}}function v(t,e,n,a,s,c,p,f){r.fromBufferAttribute(a,c),i.fromBufferAttribute(a,p),o.fromBufferAttribute(a,f);var v=g(t,e,n,r,i,o,d);return v&&(s&&(u.fromBufferAttribute(s,c),l.fromBufferAttribute(s,p),h.fromBufferAttribute(s,f),v.uv=m(d,r,i,o,u,l,h)),v.face=new ar(c,p,f,Or.normal(r,i,o)),v.faceIndex=c),v}return function(p,f){var y,b=this.geometry,x=this.material,_=this.matrixWorld;if(void 0!==x&&(null===b.boundingSphere&&b.computeBoundingSphere(),n.copy(b.boundingSphere),n.applyMatrix4(_),!1!==p.ray.intersectsSphere(n)&&(t.getInverse(_),e.copy(p.ray).applyMatrix4(t),null===b.boundingBox||!1!==e.intersectsBox(b.boundingBox))))if(b.isBufferGeometry){var w,S,C,A,E,M=b.index,T=b.attributes.position,P=b.attributes.uv;if(null!==M)for(A=0,E=M.count;A<E;A+=3)w=M.getX(A),S=M.getX(A+1),C=M.getX(A+2),(y=v(this,p,e,T,P,w,S,C))&&(y.faceIndex=Math.floor(A/3),f.push(y));else for(A=0,E=T.count;A<E;A+=3)(y=v(this,p,e,T,P,w=A,S=A+1,C=A+2))&&(y.index=w,f.push(y))}else if(b.isGeometry){var I,R,O,L,k=Array.isArray(x),N=b.vertices,D=b.faces,z=b.faceVertexUvs[0];z.length>0&&(L=z);for(var F=0,B=D.length;F<B;F++){var U=D[F],j=k?x[U.materialIndex]:x;if(void 0!==j){if(I=N[U.a],R=N[U.b],O=N[U.c],!0===j.morphTargets){var G=b.morphTargets,V=this.morphTargetInfluences;r.set(0,0,0),i.set(0,0,0),o.set(0,0,0);for(var H=0,$=G.length;H<$;H++){var W=V[H];if(0!==W){var q=G[H].vertices;r.addScaledVector(a.subVectors(q[U.a],I),W),i.addScaledVector(s.subVectors(q[U.b],R),W),o.addScaledVector(c.subVectors(q[U.c],O),W)}}r.add(I),i.add(R),o.add(O),I=r,R=i,O=o}if(y=g(this,p,e,I,R,O,d)){if(L&&L[F]){var X=L[F];u.copy(X[0]),l.copy(X[1]),h.copy(X[2]),y.uv=m(d,I,R,O,u,l,h)}y.face=U,y.faceIndex=F,f.push(y)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Fr,Br,Ur,jr,Gr,Vr,Hr=0;function $r(t){switch(t){case de:return["Linear","( value )"];case fe:return["sRGB","( value )"];case ge:return["RGBE","( value )"];case ve:return["RGBM","( value, 7.0 )"];case ye:return["RGBM","( value, 16.0 )"];case be:return["RGBD","( value, 256.0 )"];case me:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Wr(t,e){var n=$r(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function qr(t){return""!==t}function Xr(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function Yr(t){return t.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,function(t,e){var n=Pn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Yr(n)})}function Kr(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,n,r){for(var i="",o=parseInt(e);o<parseInt(n);o++)i+=r.replace(/\[ i \]/g,"[ "+o+" ]");return i})}function Zr(t,e,n,r,i){var o=t.context,a=n.extensions,s=n.defines,c=r.vertexShader,u=r.fragmentShader,l="SHADOWMAP_TYPE_BASIC";i.shadowMapType===C?l="SHADOWMAP_TYPE_PCF":i.shadowMapType===A&&(l="SHADOWMAP_TYPE_PCF_SOFT");var h="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(n.envMap.mapping){case yt:case bt:h="ENVMAP_TYPE_CUBE";break;case St:case Ct:h="ENVMAP_TYPE_CUBE_UV";break;case xt:case _t:h="ENVMAP_TYPE_EQUIREC";break;case wt:h="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case bt:case _t:p="ENVMAP_MODE_REFRACTION"}switch(n.combine){case lt:d="ENVMAP_BLENDING_MULTIPLY";break;case ht:d="ENVMAP_BLENDING_MIX";break;case pt:d="ENVMAP_BLENDING_ADD"}}var f,m,g,v,y,b=t.gammaFactor>0?t.gammaFactor:1,x=function(t,e,n){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(qr).join("\n")}(a,i,t.extensions),_=function(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(s),w=o.createProgram();n.isRawShaderMaterial?(f=[_,"\n"].filter(qr).join("\n"),m=[x,_,"\n"].filter(qr).join("\n")):(f=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+r.name,_,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(qr).join("\n"),m=[x,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+r.name,_,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+b,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+p:"",i.envMap?"#define "+d:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==dt?"#define TONE_MAPPING":"",i.toneMapping!==dt?Pn.tonemapping_pars_fragment:"",i.toneMapping!==dt?function(t,e){var n;switch(e){case ft:n="Linear";break;case mt:n="Reinhard";break;case gt:n="Uncharted2";break;case vt:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?Pn.encodings_pars_fragment:"",i.mapEncoding?Wr("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?Wr("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?Wr("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?(g="linearToOutputTexel",v=i.outputEncoding,y=$r(v),"vec4 "+g+"( vec4 value ) { return LinearTo"+y[0]+y[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(qr).join("\n")),c=Xr(c=Yr(c),i),u=Xr(u=Yr(u),i),n.isShaderMaterial||(c=Kr(c),u=Kr(u));var S=f+c,E=m+u,M=zr(o,o.VERTEX_SHADER,S),T=zr(o,o.FRAGMENT_SHADER,E);o.attachShader(w,M),o.attachShader(w,T),void 0!==n.index0AttributeName?o.bindAttribLocation(w,0,n.index0AttributeName):!0===i.morphTargets&&o.bindAttribLocation(w,0,"position"),o.linkProgram(w);var P,I,R=o.getProgramInfoLog(w),O=o.getShaderInfoLog(M),L=o.getShaderInfoLog(T),k=!0,N=!0;return!1===o.getProgramParameter(w,o.LINK_STATUS)?(k=!1,console.error("THREE.WebGLProgram: shader error: ",o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(w,o.VALIDATE_STATUS),"gl.getProgramInfoLog",R,O,L)):""!==R?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",R):""!==O&&""!==L||(N=!1),N&&(this.diagnostics={runnable:k,material:n,programLog:R,vertexShader:{log:O,prefix:f},fragmentShader:{log:L,prefix:m}}),o.deleteShader(M),o.deleteShader(T),this.getUniforms=function(){return void 0===P&&(P=new Cn(o,w,t)),P},this.getAttributes=function(){return void 0===I&&(I=function(t,e,n){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<i;o++){var a=t.getActiveAttrib(e,o).name;r[a]=t.getAttribLocation(e,a)}return r}(o,w)),I},this.destroy=function(){o.deleteProgram(w),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=Hr++,this.code=e,this.usedTimes=1,this.program=w,this.vertexShader=M,this.fragmentShader=T,this}function Qr(t,e){var n=[],r={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},i=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function o(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=de,n===de&&e&&(n=me),n}this.getParameters=function(n,i,a,s,c,u){var l=r[n.type],h=u.isSkinnedMesh?function(t){var n=t.skeleton.bones;if(e.floatVertexTextures)return 1024;var r=e.maxVertexUniforms,i=Math.floor((r-20)/4),o=Math.min(i,n.length);return o<n.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+n.length+" bones. This GPU supports "+o+"."),0):o}(u):0,p=t.getPrecision();null!==n.precision&&(p=e.getMaxPrecision(n.precision))!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",p,"instead.");var d=t.getRenderTarget();return{shaderID:l,precision:p,supportsVertexTextures:e.vertexTextures,outputEncoding:o(d?d.texture:null,t.gammaOutput),map:!!n.map,mapEncoding:o(n.map,t.gammaInput),envMap:!!n.envMap,envMapMode:n.envMap&&n.envMap.mapping,envMapEncoding:o(n.envMap,t.gammaInput),envMapCubeUV:!!n.envMap&&(n.envMap.mapping===St||n.envMap.mapping===Ct),lightMap:!!n.lightMap,aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:o(n.emissiveMap,t.gammaInput),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,combine:n.combine,vertexColors:n.vertexColors,fog:!!a,useFog:n.fog,fogExp:a&&a.isFogExp2,flatShading:n.shading===P,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:n.skinning&&h>0,maxBones:h,useVertexTexture:e.floatVertexTextures,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:i.directional.length,numPointLights:i.point.length,numSpotLights:i.spot.length,numRectAreaLights:i.rectArea.length,numHemiLights:i.hemi.length,numClippingPlanes:s,numClipIntersection:c,dithering:n.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.receiveShadow&&i.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===T,flipSided:n.side===M,depthPacking:void 0!==n.depthPacking&&n.depthPacking}},this.getProgramCode=function(e,n){var r=[];if(n.shaderID?r.push(n.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var o in e.defines)r.push(o),r.push(e.defines[o]);for(var a=0;a<i.length;a++)r.push(n[i[a]]);return r.push(e.onBeforeCompile.toString()),r.push(t.gammaOutput),r.join()},this.acquireProgram=function(e,r,i,o){for(var a,s=0,c=n.length;s<c;s++){var u=n[s];if(u.code===o){++(a=u).usedTimes;break}}return void 0===a&&(a=new Zr(t,o,e,r,i),n.push(a)),a},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=n.indexOf(t);n[e]=n[n.length-1],n.pop(),t.destroy()}},this.programs=n}function Jr(t,e,n,r,i,o,a){var s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;function c(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n),r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function u(t){return we.isPowerOfTwo(t.width)&&we.isPowerOfTwo(t.height)}function l(t,e){return t.generateMipmaps&&e&&t.minFilter!==Tt&&t.minFilter!==Rt}function h(e){return e===Tt||e===Pt||e===It?t.NEAREST:t.LINEAR}function p(e){var n=e.target;n.removeEventListener("dispose",p),function(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r.remove(e)}(n),a.textures--}function d(e){var n=e.target;n.removeEventListener("dispose",d),function(e){var n=r.get(e),i=r.get(e.texture);if(!e)return;void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r.remove(e.texture),r.remove(e)}(n),a.textures--}function f(e,h){var d=r.get(e);if(e.version>0&&d.__version!==e.version){var f=e.image;if(void 0===f)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==f.complete)return void function(e,r,h){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),a.textures++);n.activeTexture(t.TEXTURE0+h),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var d=c(r.image,i.maxTextureSize);(function(t){return t.wrapS!==Et||t.wrapT!==Et||t.minFilter!==Tt&&t.minFilter!==Rt})(r)&&!1===u(d)&&(d=function(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.width=we.nearestPowerOfTwo(t.width),e.height=we.nearestPowerOfTwo(t.height),e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}(d));var f=u(d),g=o(r.format),v=o(r.type);m(t.TEXTURE_2D,r,f);var y,b=r.mipmaps;if(r.isDepthTexture){var x=t.DEPTH_COMPONENT;if(r.type===Ut){if(!s)throw new Error("Float Depth Texture only supported in WebGL2.0");x=t.DEPTH_COMPONENT32F}else s&&(x=t.DEPTH_COMPONENT16);r.format===Zt&&x===t.DEPTH_COMPONENT&&r.type!==zt&&r.type!==Bt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=zt,v=o(r.type)),r.format===Qt&&(x=t.DEPTH_STENCIL,r.type!==$t&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=$t,v=o(r.type))),n.texImage2D(t.TEXTURE_2D,0,x,d.width,d.height,0,g,v,null)}else if(r.isDataTexture)if(b.length>0&&f){for(var _=0,w=b.length;_<w;_++)y=b[_],n.texImage2D(t.TEXTURE_2D,_,g,y.width,y.height,0,g,v,y.data);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,g,d.width,d.height,0,g,v,d.data);else if(r.isCompressedTexture)for(var _=0,w=b.length;_<w;_++)y=b[_],r.format!==Xt&&r.format!==qt?n.getCompressedTextureFormats().indexOf(g)>-1?n.compressedTexImage2D(t.TEXTURE_2D,_,g,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,_,g,y.width,y.height,0,g,v,y.data);else if(b.length>0&&f){for(var _=0,w=b.length;_<w;_++)y=b[_],n.texImage2D(t.TEXTURE_2D,_,g,g,v,y);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,g,g,v,d);l(r,f)&&t.generateMipmap(t.TEXTURE_2D);e.__version=r.version,r.onUpdate&&r.onUpdate(r)}(d,e,h);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+h),n.bindTexture(t.TEXTURE_2D,d.__webglTexture)}function m(n,a,s){var c;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===Et&&a.wrapT===Et||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,h(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,h(a.minFilter)),a.minFilter!==Tt&&a.minFilter!==Rt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===Ut&&null===e.get("OES_texture_float_linear"))return;if(a.type===jt&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function g(e,i,a,s){var c=o(i.texture.format),u=o(i.texture.type);n.texImage2D(s,0,c,i.width,i.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function v(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function y(e){var n=r.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),f(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Zt)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(n.depthTexture.format!==Qt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),v(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),v(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}this.setTexture2D=f,this.setTextureCube=function(e,s){var h=r.get(e);if(6===e.image.length)if(e.version>0&&h.__version!==e.version){h.__image__webglTextureCube||(e.addEventListener("dispose",p),h.__image__webglTextureCube=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var d=e&&e.isCompressedTexture,f=e.image[0]&&e.image[0].isDataTexture,g=[],v=0;v<6;v++)g[v]=d||f?f?e.image[v].image:e.image[v]:c(e.image[v],i.maxCubemapSize);var y=u(g[0]),b=o(e.format),x=o(e.type);for(m(t.TEXTURE_CUBE_MAP,e,y),v=0;v<6;v++)if(d)for(var _,w=g[v].mipmaps,S=0,C=w.length;S<C;S++)_=w[S],e.format!==Xt&&e.format!==qt?n.getCompressedTextureFormats().indexOf(b)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,S,b,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,S,b,_.width,_.height,0,b,x,_.data);else f?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,b,g[v].width,g[v].height,0,b,x,g[v].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,b,b,x,g[v]);l(e,y)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),h.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)},this.setupRenderTarget=function(e){var i=r.get(e),o=r.get(e.texture);e.addEventListener("dispose",d),o.__webglTexture=t.createTexture(),a.textures++;var s=!0===e.isWebGLRenderTargetCube,c=u(e);if(s){i.__webglFramebuffer=[];for(var h=0;h<6;h++)i.__webglFramebuffer[h]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(s){for(n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),m(t.TEXTURE_CUBE_MAP,e.texture,c),h=0;h<6;h++)g(i.__webglFramebuffer[h],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+h);l(e.texture,c)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),m(t.TEXTURE_2D,e.texture,c),g(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),l(e.texture,c)&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&y(e)},this.updateRenderTargetMipmap=function(e){var i=e.texture;if(l(i,u(e))){var o=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}}function ti(t){or.call(this),this.cameras=t||[]}function ei(t){console.log("THREE.WebGLRenderer",b);var e=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,u=[],l=null,h=new Float32Array(8),p=[],d=[];this.domElement=e,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=ft,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var f,m=this,g=null,v=null,y=null,C=-1,A="",E=null,I=null,O=new Oe,L=null,lt=new Oe,ht=0,pt=e.width,dt=e.height,mt=1,gt=new Oe(0,0,pt,dt),vt=!1,yt=new Oe(0,0,pt,dt),bt=new Xn,xt=new function(){var t=this,e=null,n=0,r=!1,i=!1,o=new qn,a=new Wn,s={value:null,needsUpdate:!1};function c(){s.value!==e&&(s.value=e,s.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function u(e,n,r,i){var c=null!==e?e.length:0,u=null;if(0!==c){if(u=s.value,!0!==i||null===u){var l=r+4*c,h=n.matrixWorldInverse;a.getNormalMatrix(h),(null===u||u.length<l)&&(u=new Float32Array(l));for(var p=0,d=r;p!==c;++p,d+=4)o.copy(e[p]).applyMatrix4(h,a),o.normal.toArray(u,d),u[d+3]=o.constant}s.value=u,s.needsUpdate=!0}return t.numPlanes=c,u}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(t,i,o){var a=0!==t.length||i||0!==n||r;return r=i,e=u(t,o,0),n=t.length,a},this.beginShadows=function(){i=!0,u(null)},this.endShadows=function(){i=!1,c()},this.setState=function(t,o,a,l,h,p){if(!r||null===t||0===t.length||i&&!a)i?u(null):c();else{var d=i?0:n,f=4*d,m=h.clippingState||null;s.value=m,m=u(t,l,f,p);for(var g=0;g!==f;++g)m[g]=e[g];h.clippingState=m,this.numIntersection=o?this.numPlanes:0,this.numPlanes+=d}}},_t=!1,wt=!1,St=new De,Ct=new Ne,ce=new De,ue=new De,de={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},fe={geometries:0,textures:0},me={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:me,memory:fe,programs:null};try{var ge={alpha:r,depth:i,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:c};if(null===(f=n||e.getContext("webgl",ge)||e.getContext("experimental-webgl",ge)))throw null!==e.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===f.getShaderPrecisionFormat&&(f.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),e.addEventListener("webglcontextlost",$e,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var ve=new function(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}}}(f);ve.get("WEBGL_depth_texture"),ve.get("OES_texture_float"),ve.get("OES_texture_float_linear"),ve.get("OES_texture_half_float"),ve.get("OES_texture_half_float_linear"),ve.get("OES_standard_derivatives"),ve.get("ANGLE_instanced_arrays"),ve.get("OES_element_index_uint")&&(Cr.MaxIndex=4294967296);var ye=new function(t,e,n){var r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==n.precision?n.precision:"highp",a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_TEXTURE_SIZE),h=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),d=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),f=t.getParameter(t.MAX_VARYING_VECTORS),m=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=u>0,v=!!e.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==r)return r;var n=e.get("EXT_texture_filter_anisotropic");return r=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:u,maxTextureSize:l,maxCubemapSize:h,maxAttributes:p,maxVertexUniforms:d,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}(f,ve,t),be=new function(t,e,n){var r=new function(){var e=!1,n=new Oe,r=null,i=new Oe;return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(0,0,0,1)}}},i=new function(){var e=!1,n=null,r=null,i=null;return{setTest:function(e){e?W(t.DEPTH_TEST):q(t.DEPTH_TEST)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case nt:t.depthFunc(t.NEVER);break;case rt:t.depthFunc(t.ALWAYS);break;case it:t.depthFunc(t.LESS);break;case ot:t.depthFunc(t.LEQUAL);break;case at:t.depthFunc(t.EQUAL);break;case st:t.depthFunc(t.GEQUAL);break;case ct:t.depthFunc(t.GREATER);break;case ut:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},o=new function(){var e=!1,n=null,r=null,i=null,o=null,a=null,s=null,c=null,u=null;return{setTest:function(e){e?W(t.STENCIL_TEST):q(t.STENCIL_TEST)},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&c===r||(t.stencilOp(e,n,r),a=e,s=n,c=r)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,c=null,u=null}}},a=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),c=new Uint8Array(a),u=new Uint8Array(a),l={},h=null,p=null,d=null,f=null,m=null,g=null,v=null,y=null,b=!1,S=null,C=null,A=null,E=null,P=null,I=null,R=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),O=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),L=parseFloat(O)>=1,U=null,j={},G=new Oe,V=new Oe;function H(e,n,r){var i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a<r;a++)t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i);return o}var $={};function W(e){!0!==l[e]&&(t.enable(e),l[e]=!0)}function q(e){!1!==l[e]&&(t.disable(e),l[e]=!1)}function X(e,r,i,o,a,s,c,u){e!==k?W(t.BLEND):q(t.BLEND),e===B||e===p&&u===b||(e===D?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===z?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===F?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),p=e,b=u),e===B?(a=a||r,s=s||i,c=c||o,r===d&&a===g||(t.blendEquationSeparate(n(r),n(a)),d=r,g=a),i===f&&o===m&&s===v&&c===y||(t.blendFuncSeparate(n(i),n(o),n(s),n(c)),f=i,m=o,v=s,y=c)):(d=null,f=null,m=null,g=null,v=null,y=null)}function Y(e){S!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),S=e)}function K(e){e!==x?(W(t.CULL_FACE),e!==C&&(e===_?t.cullFace(t.BACK):e===w?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):q(t.CULL_FACE),C=e}function Z(e,n,r){e?(W(t.POLYGON_OFFSET_FILL),E===n&&P===r||(t.polygonOffset(n,r),E=n,P=r)):q(t.POLYGON_OFFSET_FILL)}function Q(e){void 0===e&&(e=t.TEXTURE0+R-1),U!==e&&(t.activeTexture(e),U=e)}return $[t.TEXTURE_2D]=H(t.TEXTURE_2D,t.TEXTURE_2D,1),$[t.TEXTURE_CUBE_MAP]=H(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:r,depth:i,stencil:o},init:function(){r.setClear(0,0,0,1),i.setClear(1),o.setClear(0),W(t.DEPTH_TEST),i.setFunc(ot),Y(!1),K(_),W(t.CULL_FACE),W(t.BLEND),X(N)},initAttributes:function(){for(var t=0,e=s.length;t<e;t++)s[t]=0},enableAttribute:function(n){s[n]=1,0===c[n]&&(t.enableVertexAttribArray(n),c[n]=1),0!==u[n]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),u[n]=0)},enableAttributeAndDivisor:function(n,r){s[n]=1,0===c[n]&&(t.enableVertexAttribArray(n),c[n]=1),u[n]!==r&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,r),u[n]=r)},disableUnusedAttributes:function(){for(var e=0,n=c.length;e!==n;++e)c[e]!==s[e]&&(t.disableVertexAttribArray(e),c[e]=0)},enable:W,disable:q,getCompressedTextureFormats:function(){if(null===h&&(h=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),r=0;r<n.length;r++)h.push(n[r]);return h},setBlending:X,setMaterial:function(e){e.side===T?q(t.CULL_FACE):W(t.CULL_FACE),Y(e.side===M),!0===e.transparent?X(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):X(k),i.setFunc(e.depthFunc),i.setTest(e.depthTest),i.setMask(e.depthWrite),r.setMask(e.colorWrite),Z(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:Y,setCullFace:K,setLineWidth:function(e){e!==A&&(L&&t.lineWidth(e),A=e)},setPolygonOffset:Z,getScissorTest:function(){return I},setScissorTest:function(e){I=e,e?W(t.SCISSOR_TEST):q(t.SCISSOR_TEST)},activeTexture:Q,bindTexture:function(e,n){null===U&&Q();var r=j[U];void 0===r&&(r={type:void 0,texture:void 0},j[U]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||$[e]),r.type=e,r.texture=n)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===G.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),G.copy(e))},viewport:function(e){!1===V.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),V.copy(e))},reset:function(){for(var e=0;e<c.length;e++)1===c[e]&&(t.disableVertexAttribArray(e),c[e]=0);l={},h=null,U=null,j={},p=null,S=null,C=null,r.reset(),i.reset(),o.reset()}}}(f,ve,rn),xe=new function(){var t={};return{get:function(e){var n=e.uuid,r=t[n];return void 0===r&&(r={},t[n]=r),r},remove:function(e){delete t[e.uuid]},clear:function(){t={}}}},_e=new Jr(f,ve,be,xe,ye,rn,fe),Ce=new Kn(f),Ae=new function(t,e,n){var r={},i={};function o(t){var a=t.target,s=r[a.id];for(var c in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[c]);a.removeEventListener("dispose",o),delete r[a.id];var u=i[a.id];u&&(e.remove(u),delete i[a.id]),(u=i[s.id])&&(e.remove(u),delete i[s.id]),n.geometries--}return{get:function(t,e){var i=r[e.id];return i||(e.addEventListener("dispose",o),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Cr).setFromObject(t)),i=e._bufferGeometry),r[e.id]=i,n.geometries++,i)},update:function(n){var r=n.index,i=n.attributes;for(var o in null!==r&&e.update(r,t.ELEMENT_ARRAY_BUFFER),i)e.update(i[o],t.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],c=0,u=s.length;c<u;c++)e.update(s[c],t.ARRAY_BUFFER)},getWireframeAttribute:function(n){var r=i[n.id];if(r)return r;var o,a=[],s=n.index,c=n.attributes;if(null!==s)for(var u=0,l=(o=s.array).length;u<l;u+=3){var h=o[u+0],p=o[u+1],d=o[u+2];a.push(h,p,p,d,d,h)}else for(u=0,l=(o=c.position.array).length/3-1;u<l;u+=3)h=u+0,p=u+1,d=u+2,a.push(h,p,p,d,d,h);return r=new(Sr(a)>65535?xr:br)(a,1),e.update(r,t.ELEMENT_ARRAY_BUFFER),i[n.id]=r,r}}}(f,Ce,fe),Ee=new function(t,e,n){var r={};return{update:function(t){var i=n.frame,o=t.geometry,a=e.get(t,o);return r[a.id]!==i&&(o.isGeometry&&a.updateFromObject(t),e.update(a),r[a.id]=i),a},clear:function(){r={}}}}(f,Ae,me),Me=new Qr(this,ye),Te=new function(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Ne,color:new En,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Se};break;case"SpotLight":n={position:new Ne,direction:new Ne,color:new En,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Se};break;case"PointLight":n={position:new Ne,color:new En,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Se};break;case"HemisphereLight":n={direction:new Ne,skyColor:new En,groundColor:new En};break;case"RectAreaLight":n={color:new En,position:new Ne,halfWidth:new Ne,halfHeight:new Ne}}return t[e.id]=n,n}}},Pe=new Dr,Ie=new function(t,e,n,r){var i,o,a,s,c=new En(0),u=0;function l(t,n){e.buffers.color.setClear(t.r,t.g,t.b,n,r)}return{getClearColor:function(){return c},setClearColor:function(t,e){c.set(t),l(c,u=void 0!==e?e:1)},getClearAlpha:function(){return u},setClearAlpha:function(t){l(c,u=t)},render:function(e,r,h){var p=e.background;null===p?l(c,u):p&&p.isColor&&(l(p,1),h=!0),(t.autoClear||h)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),p&&p.isCubeTexture?(void 0===a&&(a=new or,s=new Lr(new Er(5,5,5),new Gn({uniforms:In.cube.uniforms,vertexShader:In.cube.vertexShader,fragmentShader:In.cube.fragmentShader,side:M,depthTest:!1,depthWrite:!1,fog:!1}))),a.projectionMatrix.copy(r.projectionMatrix),a.matrixWorld.extractRotation(r.matrixWorld),a.matrixWorldInverse.getInverse(a.matrixWorld),s.material.uniforms.tCube.value=p,s.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,s.matrixWorld),n.update(s),t.renderBufferDirect(a,null,s.geometry,s.material,s,null)):p&&p.isTexture&&(void 0===i&&(i=new ir(-1,1,1,-1,0,1),o=new Lr(new Tr(2,2),new Pr({depthTest:!1,depthWrite:!1,fog:!1}))),o.material.map=p,n.update(o),t.renderBufferDirect(i,null,o.geometry,o.material,o,null))}}}(this,be,Ee,s),Re=new function(t){var e=this,n=null,r=null;"VRFrameData"in window&&(r=new window.VRFrameData);var i=new De,o=new De,a=new De,s=new or;s.bounds=new Oe(0,0,.5,1),s.layers.enable(1);var c=new or;c.bounds=new Oe(.5,0,.5,1),c.layers.enable(2);var u,l,h=new ti([s,c]);h.layers.enable(1),h.layers.enable(2),window.addEventListener("vrdisplaypresentchange",function(){if(n.isPresenting){var r=n.getEyeParameters("left"),i=r.renderWidth,o=r.renderHeight;l=t.getPixelRatio(),u=t.getSize(),t.setDrawingBufferSize(2*i,o,1)}else e.enabled&&t.setDrawingBufferSize(u.width,u.height,l)},!1),this.enabled=!1,this.standing=!1,this.getDevice=function(){return n},this.setDevice=function(t){void 0!==t&&(n=t)},this.getCamera=function(t){if(null===n)return t;n.depthNear=t.near,n.depthFar=t.far,n.getFrameData(r);var e=r.pose;null!==e.position?t.position.fromArray(e.position):t.position.set(0,0,0),null!==e.orientation&&t.quaternion.fromArray(e.orientation),t.updateMatrixWorld();var u=n.stageParameters;if(this.standing&&u&&(o.fromArray(u.sittingToStandingTransform),a.getInverse(o),t.matrixWorld.multiply(o),t.matrixWorldInverse.multiply(a)),!1===n.isPresenting)return t;h.matrixWorld.copy(t.matrixWorld),h.matrixWorldInverse.copy(t.matrixWorldInverse),s.matrixWorldInverse.fromArray(r.leftViewMatrix),c.matrixWorldInverse.fromArray(r.rightViewMatrix),this.standing&&u&&(s.matrixWorldInverse.multiply(a),c.matrixWorldInverse.multiply(a));var l=t.parent;null!==l&&(i.getInverse(l.matrixWorld),s.matrixWorldInverse.multiply(i),c.matrixWorldInverse.multiply(i)),s.matrixWorld.getInverse(s.matrixWorldInverse),c.matrixWorld.getInverse(c.matrixWorldInverse),s.projectionMatrix.fromArray(r.leftProjectionMatrix),c.projectionMatrix.fromArray(r.rightProjectionMatrix),h.projectionMatrix.copy(s.projectionMatrix);var p=n.getLayers();if(p.length){var d=p[0];null!==d.leftBounds&&4===d.leftBounds.length&&s.bounds.fromArray(d.leftBounds),null!==d.rightBounds&&4===d.rightBounds.length&&c.bounds.fromArray(d.rightBounds)}return h},this.getStandingMatrix=function(){return o},this.submitFrame=function(){n&&n.isPresenting&&n.submitFrame()}}(this);this.info.programs=Me.programs;var Le=new function(t,e,n){var r;this.setMode=function(t){r=t},this.render=function(e,i){t.drawArrays(r,e,i),n.calls++,n.vertices+=i,r===t.TRIANGLES&&(n.faces+=i/3)},this.renderInstances=function(i,o,a){var s=e.get("ANGLE_instanced_arrays");if(null!==s){var c=i.attributes.position;c.isInterleavedBufferAttribute?(a=c.data.count,s.drawArraysInstancedANGLE(r,0,a,i.maxInstancedCount)):s.drawArraysInstancedANGLE(r,o,a,i.maxInstancedCount),n.calls++,n.vertices+=a*i.maxInstancedCount,r===t.TRIANGLES&&(n.faces+=i.maxInstancedCount*a/3)}else console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}(f,ve,me),ke=new function(t,e,n){var r,i,o;this.setMode=function(t){r=t},this.setIndex=function(t){i=t.type,o=t.bytesPerElement},this.render=function(e,a){t.drawElements(r,a,i,e*o),n.calls++,n.vertices+=a,r===t.TRIANGLES&&(n.faces+=a/3)},this.renderInstances=function(a,s,c){var u=e.get("ANGLE_instanced_arrays");null!==u?(u.drawElementsInstancedANGLE(r,c,i,s*o,a.maxInstancedCount),n.calls++,n.vertices+=c*a.maxInstancedCount,r===t.TRIANGLES&&(n.faces+=a.maxInstancedCount*c/3)):console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}(f,ve,me);function Fe(){return null===v?mt:1}function Be(){be.init(),be.scissor(O.copy(gt).multiplyScalar(mt)),be.viewport(lt.copy(yt).multiplyScalar(mt))}function Ue(){g=null,E=null,A="",C=-1,be.reset()}Be(),this.context=f,this.capabilities=ye,this.extensions=ve,this.properties=xe,this.renderLists=Pe,this.state=be,this.vr=Re;var je=new Yn(this,de,Ee,ye);this.shadowMap=je;var Ge,Ve=new Ln(this,p),He=new On(this,d);function $e(t){t.preventDefault(),Ue(),Be(),xe.clear(),Ee.clear()}function We(t){var e=t.target;e.removeEventListener("dispose",We),function(t){qe(t),xe.remove(t)}(e)}function qe(t){var e=xe.get(t).program;t.program=void 0,void 0!==e&&Me.releaseProgram(e)}function Xe(t,e){return Math.abs(e[0])-Math.abs(t[0])}function Ye(t,e,n,r){for(var i=0,o=t.length;i<o;i++){var a=t[i],s=a.object,c=a.geometry,u=void 0===r?a.material:r,l=a.group;if(n.isArrayCamera){I=n;for(var h=n.cameras,p=0,d=h.length;p<d;p++){var f=h[p];if(s.layers.test(f.layers)){var g=f.bounds,v=g.x*pt,y=g.y*dt,b=g.z*pt,x=g.w*dt;m.setViewport(v,y,b,x),m.setScissor(v,y,b,x),m.setScissorTest(!0),Ke(s,e,f,c,u,l)}}}else I=null,Ke(s,e,n,c,u,l)}}function Ke(t,e,n,r,i,o){if(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.onBeforeRender(m,e,n,r,i,o),t.isImmediateRenderObject){be.setMaterial(i);var a=Qe(n,e.fog,i,t);A="",function(t,e,n){t.render(function(t){m.renderBufferImmediate(t,e,n)})}(t,a,i)}else m.renderBufferDirect(n,e.fog,r,i,t,o);t.onAfterRender(m,e,n,r,i,o)}function Ze(t,e,n){var r=xe.get(t),i=Me.getParameters(t,de,e,xt.numPlanes,xt.numIntersection,n),o=Me.getProgramCode(t,i),a=r.program,s=!0;if(void 0===a)t.addEventListener("dispose",We);else if(a.code!==o)qe(t);else{if(void 0!==i.shaderID)return;s=!1}if(s){if(i.shaderID){var c=In[i.shaderID];r.shader={name:t.type,uniforms:Tn.clone(c.uniforms),vertexShader:c.vertexShader,fragmentShader:c.fragmentShader}}else r.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.onBeforeCompile(r.shader),a=Me.acquireProgram(t,r.shader,i,o),r.program=a,t.program=a}var u=a.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var l=0;l<m.maxMorphTargets;l++)u["morphTarget"+l]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(l=0;l<m.maxMorphNormals;l++)u["morphNormal"+l]>=0&&t.numSupportedMorphNormals++}var h=r.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=xt.numPlanes,r.numIntersection=xt.numIntersection,h.clippingPlanes=xt.uniform),r.fog=e,r.lightsHash=de.hash,t.lights&&(h.ambientLightColor.value=de.ambient,h.directionalLights.value=de.directional,h.spotLights.value=de.spot,h.rectAreaLights.value=de.rectArea,h.pointLights.value=de.point,h.hemisphereLights.value=de.hemi,h.directionalShadowMap.value=de.directionalShadowMap,h.directionalShadowMatrix.value=de.directionalShadowMatrix,h.spotShadowMap.value=de.spotShadowMap,h.spotShadowMatrix.value=de.spotShadowMatrix,h.pointShadowMap.value=de.pointShadowMap,h.pointShadowMatrix.value=de.pointShadowMatrix);var p=r.program.getUniforms(),d=Cn.seqWithValue(p.seq,h);r.uniformsList=d}function Qe(t,e,n,r){ht=0;var i=xe.get(n);if(_t&&(wt||t!==E)){var o=t===E&&n.id===C;xt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,o)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:n.lights&&i.lightsHash!==de.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===xt.numPlanes&&i.numIntersection===xt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(Ze(n,e,r),n.needsUpdate=!1);var a,s,c=!1,u=!1,l=!1,h=i.program,p=h.getUniforms(),d=i.shader.uniforms;if(h.id!==g&&(f.useProgram(h.program),g=h.id,c=!0,u=!0,l=!0),n.id!==C&&(C=n.id,u=!0),c||t!==E){if(p.setValue(f,"projectionMatrix",t.projectionMatrix),ye.logarithmicDepthBuffer&&p.setValue(f,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),E!==(I||t)&&(E=I||t,u=!0,l=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var v=p.map.cameraPosition;void 0!==v&&v.setValue(f,Ct.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&p.setValue(f,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){p.setOptional(f,r,"bindMatrix"),p.setOptional(f,r,"bindMatrixInverse");var y=r.skeleton;if(y){var b=y.bones;if(ye.floatVertexTextures){if(void 0===y.boneTexture){var x=Math.sqrt(4*b.length);x=we.nextPowerOfTwo(Math.ceil(x)),x=Math.max(x,4);var _=new Float32Array(x*x*4);_.set(y.boneMatrices);var w=new ze(_,x,x,Xt,Ut);y.boneMatrices=_,y.boneTexture=w,y.boneTextureSize=x}p.setValue(f,"boneTexture",y.boneTexture),p.setValue(f,"boneTextureSize",y.boneTextureSize)}else p.setOptional(f,y,"boneMatrices")}}return u&&(p.setValue(f,"toneMappingExposure",m.toneMappingExposure),p.setValue(f,"toneMappingWhitePoint",m.toneMappingWhitePoint),n.lights&&(s=l,(a=d).ambientLightColor.needsUpdate=s,a.directionalLights.needsUpdate=s,a.pointLights.needsUpdate=s,a.spotLights.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),e&&n.fog&&function(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(d,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&function(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity);t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity);e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap);if(void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}(d,n),n.isLineBasicMaterial?Je(d,n):n.isLineDashedMaterial?(Je(d,n),function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(d,n)):n.isPointsMaterial?function(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*mt,t.scale.value=.5*dt,t.map.value=e.map,null!==e.map){var n=e.map.offset,r=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}(d,n):n.isMeshLambertMaterial?function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(d,n):n.isMeshToonMaterial?function(t,e){tn(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(d,n):n.isMeshPhongMaterial?tn(d,n):n.isMeshPhysicalMaterial?function(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,en(t,e)}(d,n):n.isMeshStandardMaterial?en(d,n):n.isMeshDepthMaterial?n.displacementMap&&(d.displacementMap.value=n.displacementMap,d.displacementScale.value=n.displacementScale,d.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale);e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale));e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(d,n),void 0!==d.ltcMat&&(d.ltcMat.value=Mn.LTC_MAT_TEXTURE),void 0!==d.ltcMag&&(d.ltcMag.value=Mn.LTC_MAG_TEXTURE),Cn.upload(f,i.uniformsList,d,m)),p.setValue(f,"modelViewMatrix",r.modelViewMatrix),p.setValue(f,"normalMatrix",r.normalMatrix),p.setValue(f,"modelMatrix",r.matrixWorld),h}function Je(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function tn(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function en(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function nn(t,e){var n,r,i,o,a,s,c,u,l=0,h=0,p=0,d=e.matrixWorldInverse,f=0,m=0,g=0,v=0,y=0;for(n=0,r=t.length;n<r;n++)if(a=(i=t[n]).color,s=i.intensity,c=i.distance,u=i.shadow&&i.shadow.map?i.shadow.map.texture:null,i.isAmbientLight)l+=a.r*s,h+=a.g*s,p+=a.b*s;else if(i.isDirectionalLight){(b=Te.get(i)).color.copy(i.color).multiplyScalar(i.intensity),b.direction.setFromMatrixPosition(i.matrixWorld),Ct.setFromMatrixPosition(i.target.matrixWorld),b.direction.sub(Ct),b.direction.transformDirection(d),b.shadow=i.castShadow,i.castShadow&&(o=i.shadow,b.shadowBias=o.bias,b.shadowRadius=o.radius,b.shadowMapSize=o.mapSize),de.directionalShadowMap[f]=u,de.directionalShadowMatrix[f]=i.shadow.matrix,de.directional[f]=b,f++}else if(i.isSpotLight){(b=Te.get(i)).position.setFromMatrixPosition(i.matrixWorld),b.position.applyMatrix4(d),b.color.copy(a).multiplyScalar(s),b.distance=c,b.direction.setFromMatrixPosition(i.matrixWorld),Ct.setFromMatrixPosition(i.target.matrixWorld),b.direction.sub(Ct),b.direction.transformDirection(d),b.coneCos=Math.cos(i.angle),b.penumbraCos=Math.cos(i.angle*(1-i.penumbra)),b.decay=0===i.distance?0:i.decay,b.shadow=i.castShadow,i.castShadow&&(o=i.shadow,b.shadowBias=o.bias,b.shadowRadius=o.radius,b.shadowMapSize=o.mapSize),de.spotShadowMap[g]=u,de.spotShadowMatrix[g]=i.shadow.matrix,de.spot[g]=b,g++}else if(i.isRectAreaLight){(b=Te.get(i)).color.copy(a).multiplyScalar(s/(i.width*i.height)),b.position.setFromMatrixPosition(i.matrixWorld),b.position.applyMatrix4(d),ue.identity(),ce.copy(i.matrixWorld),ce.premultiply(d),ue.extractRotation(ce),b.halfWidth.set(.5*i.width,0,0),b.halfHeight.set(0,.5*i.height,0),b.halfWidth.applyMatrix4(ue),b.halfHeight.applyMatrix4(ue),de.rectArea[v]=b,v++}else if(i.isPointLight){(b=Te.get(i)).position.setFromMatrixPosition(i.matrixWorld),b.position.applyMatrix4(d),b.color.copy(i.color).multiplyScalar(i.intensity),b.distance=i.distance,b.decay=0===i.distance?0:i.decay,b.shadow=i.castShadow,i.castShadow&&(o=i.shadow,b.shadowBias=o.bias,b.shadowRadius=o.radius,b.shadowMapSize=o.mapSize),de.pointShadowMap[m]=u,de.pointShadowMatrix[m]=i.shadow.matrix,de.point[m]=b,m++}else if(i.isHemisphereLight){var b;(b=Te.get(i)).direction.setFromMatrixPosition(i.matrixWorld),b.direction.transformDirection(d),b.direction.normalize(),b.skyColor.copy(i.color).multiplyScalar(s),b.groundColor.copy(i.groundColor).multiplyScalar(s),de.hemi[y]=b,y++}de.ambient[0]=l,de.ambient[1]=h,de.ambient[2]=p,de.directional.length=f,de.spot.length=g,de.rectArea.length=v,de.point.length=m,de.hemi.length=y,de.hash=f+","+m+","+g+","+v+","+y+","+de.shadows.length}function rn(t){var e;if(t===At)return f.REPEAT;if(t===Et)return f.CLAMP_TO_EDGE;if(t===Mt)return f.MIRRORED_REPEAT;if(t===Tt)return f.NEAREST;if(t===Pt)return f.NEAREST_MIPMAP_NEAREST;if(t===It)return f.NEAREST_MIPMAP_LINEAR;if(t===Rt)return f.LINEAR;if(t===Ot)return f.LINEAR_MIPMAP_NEAREST;if(t===Lt)return f.LINEAR_MIPMAP_LINEAR;if(t===kt)return f.UNSIGNED_BYTE;if(t===Gt)return f.UNSIGNED_SHORT_4_4_4_4;if(t===Vt)return f.UNSIGNED_SHORT_5_5_5_1;if(t===Ht)return f.UNSIGNED_SHORT_5_6_5;if(t===Nt)return f.BYTE;if(t===Dt)return f.SHORT;if(t===zt)return f.UNSIGNED_SHORT;if(t===Ft)return f.INT;if(t===Bt)return f.UNSIGNED_INT;if(t===Ut)return f.FLOAT;if(t===jt&&null!==(e=ve.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Wt)return f.ALPHA;if(t===qt)return f.RGB;if(t===Xt)return f.RGBA;if(t===Yt)return f.LUMINANCE;if(t===Kt)return f.LUMINANCE_ALPHA;if(t===Zt)return f.DEPTH_COMPONENT;if(t===Qt)return f.DEPTH_STENCIL;if(t===U)return f.FUNC_ADD;if(t===j)return f.FUNC_SUBTRACT;if(t===G)return f.FUNC_REVERSE_SUBTRACT;if(t===$)return f.ZERO;if(t===W)return f.ONE;if(t===q)return f.SRC_COLOR;if(t===X)return f.ONE_MINUS_SRC_COLOR;if(t===Y)return f.SRC_ALPHA;if(t===K)return f.ONE_MINUS_SRC_ALPHA;if(t===Z)return f.DST_ALPHA;if(t===Q)return f.ONE_MINUS_DST_ALPHA;if(t===J)return f.DST_COLOR;if(t===tt)return f.ONE_MINUS_DST_COLOR;if(t===et)return f.SRC_ALPHA_SATURATE;if((t===Jt||t===te||t===ee||t===ne)&&null!==(e=ve.get("WEBGL_compressed_texture_s3tc"))){if(t===Jt)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===te)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===ee)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===ne)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===re||t===ie||t===oe||t===ae)&&null!==(e=ve.get("WEBGL_compressed_texture_pvrtc"))){if(t===re)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ie)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===oe)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ae)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===se&&null!==(e=ve.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===V||t===H)&&null!==(e=ve.get("EXT_blend_minmax"))){if(t===V)return e.MIN_EXT;if(t===H)return e.MAX_EXT}return t===$t&&null!==(e=ve.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}this.getContext=function(){return f},this.getContextAttributes=function(){return f.getContextAttributes()},this.forceContextLoss=function(){var t=ve.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return ye.getMaxAnisotropy()},this.getPrecision=function(){return ye.precision},this.getPixelRatio=function(){return mt},this.setPixelRatio=function(t){void 0!==t&&(mt=t,this.setSize(pt,dt,!1))},this.getSize=function(){return{width:pt,height:dt}},this.setSize=function(t,n,r){var i=Re.getDevice();i&&i.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(pt=t,dt=n,e.width=t*mt,e.height=n*mt,!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(){return{width:pt*mt,height:dt*mt}},this.setDrawingBufferSize=function(t,n,r){pt=t,dt=n,mt=r,e.width=t*r,e.height=n*r,this.setViewport(0,0,t,n)},this.setViewport=function(t,e,n,r){yt.set(t,dt-e-r,n,r),be.viewport(lt.copy(yt).multiplyScalar(mt))},this.setScissor=function(t,e,n,r){gt.set(t,dt-e-r,n,r),be.scissor(O.copy(gt).multiplyScalar(mt))},this.setScissorTest=function(t){be.setScissorTest(vt=t)},this.getClearColor=Ie.getClearColor,this.setClearColor=Ie.setClearColor,this.getClearAlpha=Ie.getClearAlpha,this.setClearAlpha=Ie.setClearAlpha,this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=f.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=f.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=f.STENCIL_BUFFER_BIT),f.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(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.resetGLState=Ue,this.dispose=function(){e.removeEventListener("webglcontextlost",$e,!1),Pe.dispose()},this.renderBufferImmediate=function(t,e,n){be.initAttributes();var r=xe.get(t);t.hasPositions&&!r.position&&(r.position=f.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=f.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=f.createBuffer()),t.hasColors&&!r.color&&(r.color=f.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(f.bindBuffer(f.ARRAY_BUFFER,r.position),f.bufferData(f.ARRAY_BUFFER,t.positionArray,f.DYNAMIC_DRAW),be.enableAttribute(i.position),f.vertexAttribPointer(i.position,3,f.FLOAT,!1,0,0)),t.hasNormals){if(f.bindBuffer(f.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===P)for(var o=0,a=3*t.count;o<a;o+=9){var s=t.normalArray,c=(s[o+0]+s[o+3]+s[o+6])/3,u=(s[o+1]+s[o+4]+s[o+7])/3,l=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=c,s[o+1]=u,s[o+2]=l,s[o+3]=c,s[o+4]=u,s[o+5]=l,s[o+6]=c,s[o+7]=u,s[o+8]=l}f.bufferData(f.ARRAY_BUFFER,t.normalArray,f.DYNAMIC_DRAW),be.enableAttribute(i.normal),f.vertexAttribPointer(i.normal,3,f.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(f.bindBuffer(f.ARRAY_BUFFER,r.uv),f.bufferData(f.ARRAY_BUFFER,t.uvArray,f.DYNAMIC_DRAW),be.enableAttribute(i.uv),f.vertexAttribPointer(Ce.uv,2,f.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==R&&(f.bindBuffer(f.ARRAY_BUFFER,r.color),f.bufferData(f.ARRAY_BUFFER,t.colorArray,f.DYNAMIC_DRAW),be.enableAttribute(i.color),f.vertexAttribPointer(i.color,3,f.FLOAT,!1,0,0)),be.disableUnusedAttributes(),f.drawArrays(f.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,r,i,o){be.setMaterial(r);var a=Qe(t,e,r,i),s=n.id+"_"+a.id+"_"+(!0===r.wireframe),c=!1;s!==A&&(A=s,c=!0);var u=i.morphTargetInfluences;if(void 0!==u){for(var l=[],p=0,d=u.length;p<d;p++){var m=u[p];l.push([m,p])}l.sort(Xe),l.length>8&&(l.length=8);var g=n.morphAttributes;for(p=0,d=l.length;p<d;p++){m=l[p];if(h[p]=m[0],0!==m[0]){var v=m[1];!0===r.morphTargets&&g.position&&n.addAttribute("morphTarget"+p,g.position[v]),!0===r.morphNormals&&g.normal&&n.addAttribute("morphNormal"+p,g.normal[v])}else!0===r.morphTargets&&n.removeAttribute("morphTarget"+p),!0===r.morphNormals&&n.removeAttribute("morphNormal"+p)}p=l.length;for(var y=h.length;p<y;p++)h[p]=0;a.getUniforms().setValue(f,"morphTargetInfluences",h),c=!0}v=n.index;var b,x=n.attributes.position,_=1;!0===r.wireframe&&(v=Ae.getWireframeAttribute(n),_=2);var w=Le;null!==v&&(b=Ce.get(v),(w=ke).setIndex(b)),c&&(!function(t,e,n,r){if(n&&n.isInstancedBufferGeometry&&null===ve.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===r&&(r=0);be.initAttributes();var i=n.attributes,o=e.getAttributes(),a=t.defaultAttributeValues;for(var s in o){var c=o[s];if(c>=0){var u=i[s];if(void 0!==u){var l=u.normalized,h=u.itemSize,p=Ce.get(u),d=p.buffer,m=p.type,g=p.bytesPerElement;if(u.isInterleavedBufferAttribute){var v=u.data,y=v.stride,b=u.offset;v&&v.isInstancedInterleavedBuffer?(be.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):be.enableAttribute(c),f.bindBuffer(f.ARRAY_BUFFER,d),f.vertexAttribPointer(c,h,m,l,y*g,(r*y+b)*g)}else u.isInstancedBufferAttribute?(be.enableAttributeAndDivisor(c,u.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=u.meshPerAttribute*u.count)):be.enableAttribute(c),f.bindBuffer(f.ARRAY_BUFFER,d),f.vertexAttribPointer(c,h,m,l,0,r*h*g)}else if(void 0!==a){var x=a[s];if(void 0!==x)switch(x.length){case 2:f.vertexAttrib2fv(c,x);break;case 3:f.vertexAttrib3fv(c,x);break;case 4:f.vertexAttrib4fv(c,x);break;default:f.vertexAttrib1fv(c,x)}}}}be.disableUnusedAttributes()}(r,a,n),null!==v&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,b.buffer));var S=0;null!==v?S=v.count:void 0!==x&&(S=x.count);var C=n.drawRange.start*_,E=n.drawRange.count*_,M=null!==o?o.start*_:0,T=null!==o?o.count*_:1/0,P=Math.max(C,M),I=Math.min(S,C+E,M+T)-1,R=Math.max(0,I-P+1);if(0!==R){if(i.isMesh)if(!0===r.wireframe)be.setLineWidth(r.wireframeLinewidth*Fe()),w.setMode(f.LINES);else switch(i.drawMode){case le:w.setMode(f.TRIANGLES);break;case he:w.setMode(f.TRIANGLE_STRIP);break;case pe:w.setMode(f.TRIANGLE_FAN)}else if(i.isLine){var O=r.linewidth;void 0===O&&(O=1),be.setLineWidth(O*Fe()),i.isLineSegments?w.setMode(f.LINES):i.isLineLoop?w.setMode(f.LINE_LOOP):w.setMode(f.LINE_STRIP)}else i.isPoints&&w.setMode(f.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&w.renderInstances(n,P,R):w.render(P,R)}},this.compile=function(t,e){u=[],t.traverse(function(t){t.isLight&&u.push(t)}),nn(u,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n<e.material.length;n++)Ze(e.material[n],t.fog,e);else Ze(e.material,t.fog,e)})},this.animate=function(t){(Re.getDevice()||window).requestAnimationFrame(function e(){t(),(Re.getDevice()||window).requestAnimationFrame(e)})},this.render=function(t,e,n,r){if(e&&e.isCamera){A="",C=-1,E=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),Re.enabled&&(e=Re.getCamera(e)),St.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),bt.setFromMatrix(St),u.length=0,p.length=0,d.length=0,wt=this.localClippingEnabled,_t=xt.init(this.clippingPlanes,wt,e),(l=Pe.get(t,e)).init(),function t(e,n,r){if(!e.visible)return;var i=e.layers.test(n.layers);if(i)if(e.isLight)u.push(e);else if(e.isSprite)e.frustumCulled&&!bt.intersectsSprite(e)||p.push(e);else if(e.isLensFlare)d.push(e);else if(e.isImmediateRenderObject)r&&Ct.setFromMatrixPosition(e.matrixWorld).applyMatrix4(St),l.push(e,null,e.material,Ct.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||bt.intersectsObject(e))){r&&Ct.setFromMatrixPosition(e.matrixWorld).applyMatrix4(St);var o=Ee.update(e),a=e.material;if(Array.isArray(a))for(var s=o.groups,c=0,h=s.length;c<h;c++){var f=s[c],m=a[f.materialIndex];m&&m.visible&&l.push(e,o,m,Ct.z,f)}else a.visible&&l.push(e,o,a,Ct.z,null)}var g=e.children;for(var c=0,h=g.length;c<h;c++)t(g[c],n,r)}(t,e,m.sortObjects),l.finish(),!0===m.sortObjects&&l.sort(),_t&&xt.beginShadows(),function(t){for(var e=0,n=0,r=t.length;n<r;n++){var i=t[n];i.castShadow&&(de.shadows[e]=i,e++)}de.shadows.length=e}(u),je.render(t,e),nn(u,e),_t&&xt.endShadows(),me.frame++,me.calls=0,me.vertices=0,me.faces=0,me.points=0,void 0===n&&(n=null),this.setRenderTarget(n),Ie.render(t,e,r);var i=l.opaque,o=l.transparent;if(t.overrideMaterial){var a=t.overrideMaterial;i.length&&Ye(i,t,e,a),o.length&&Ye(o,t,e,a)}else i.length&&Ye(i,t,e),o.length&&Ye(o,t,e);Ve.render(t,e),He.render(t,e,lt),n&&_e.updateRenderTargetMipmap(n),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),e.isArrayCamera&&m.setScissorTest(!1),Re.enabled&&Re.submitFrame()}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(t,e){be.setCullFace(t),be.setFlipSided(e===S)},this.allocTextureUnit=function(){var t=ht;return t>=ye.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+ye.maxTextures),ht+=1,t},this.setTexture2D=(Ge=!1,function(t,e){t&&t.isWebGLRenderTarget&&(Ge||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Ge=!0),t=t.texture),_e.setTexture2D(t,e)}),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),_e.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?_e.setTextureCube(e,n):_e.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return v},this.setRenderTarget=function(t){v=t,t&&void 0===xe.get(t).__webglFramebuffer&&_e.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var r=xe.get(t);e=n?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,O.copy(t.scissor),L=t.scissorTest,lt.copy(t.viewport)}else e=null,O.copy(gt).multiplyScalar(mt),L=vt,lt.copy(yt).multiplyScalar(mt);if(y!==e&&(f.bindFramebuffer(f.FRAMEBUFFER,e),y=e),be.scissor(O),be.setScissorTest(L),be.viewport(lt),n){var i=xe.get(t.texture);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,r,i,o){if(t&&t.isWebGLRenderTarget){var a=xe.get(t).__webglFramebuffer;if(a){var s=!1;a!==y&&(f.bindFramebuffer(f.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,l=c.type;if(u!==Xt&&rn(u)!==f.getParameter(f.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===kt||rn(l)===f.getParameter(f.IMPLEMENTATION_COLOR_READ_TYPE)||l===Ut&&(ve.get("OES_texture_float")||ve.get("WEBGL_color_buffer_float"))||l===jt&&ve.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");f.checkFramebufferStatus(f.FRAMEBUFFER)===f.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&f.readPixels(e,n,r,i,rn(u),rn(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&f.bindFramebuffer(f.FRAMEBUFFER,y)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function ni(t,e){this.name="",this.color=new En(t),this.density=void 0!==e?e:25e-5}function ri(t,e,n){this.name="",this.color=new En(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function ii(){nr.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function oi(t,e,n,r,i){nr.call(this),this.lensFlares=[],this.positionScreen=new Ne,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)}function ai(t){jn.call(this),this.type="SpriteMaterial",this.color=new En(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function si(t){nr.call(this),this.type="Sprite",this.material=void 0!==t?t:new ai}function ci(){nr.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ui(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new De)}}function li(){nr.call(this),this.type="Bone"}function hi(t,e){Lr.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new De,this.bindMatrixInverse=new De;var n=new ui(this.initBones());this.bind(n,this.matrixWorld),this.normalizeSkinWeights()}function pi(t){jn.call(this),this.type="LineBasicMaterial",this.color=new En(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function di(t,e,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new fi(t,e);nr.call(this),this.type="Line",this.geometry=void 0!==t?t:new Cr,this.material=void 0!==e?e:new pi({color:16777215*Math.random()})}function fi(t,e){di.call(this,t,e),this.type="LineSegments"}function mi(t,e){di.call(this,t,e),this.type="LineLoop"}function gi(t){jn.call(this),this.type="PointsMaterial",this.color=new En(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function vi(t,e){nr.call(this),this.type="Points",this.geometry=void 0!==t?t:new Cr,this.material=void 0!==e?e:new gi({color:16777215*Math.random()})}function yi(){nr.call(this),this.type="Group"}function bi(t,e,n,r,i,o,a,s,c,u,l,h){Re.call(this,null,o,a,s,c,u,r,i,l,h),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function xi(t,e,n,r,i,o,a,s,c){Re.call(this,t,e,n,r,i,o,a,s,c),this.needsUpdate=!0}function _i(t){Cr.call(this),this.type="WireframeGeometry";var e,n,r,i,o,a,s,c,u,l,h=[],p=[0,0],d={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,r=m.length;e<r;e++){var g=m[e];for(n=0;n<3;n++)s=g[f[n]],c=g[f[(n+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[u=p[0]+","+p[1]]&&(d[u]={index1:p[0],index2:p[1]})}for(u in d)a=d[u],l=t.vertices[a.index1],h.push(l.x,l.y,l.z),l=t.vertices[a.index2],h.push(l.x,l.y,l.z)}else if(t&&t.isBufferGeometry){var v,y,b,x,_,w,S;if(l=new Ne,null!==t.index){for(v=t.attributes.position,y=t.index,0===(b=t.groups).length&&(b=[{start:0,count:y.count,materialIndex:0}]),i=0,o=b.length;i<o;++i)for(e=_=(x=b[i]).start,r=_+x.count;e<r;e+=3)for(n=0;n<3;n++)s=y.getX(e+n),c=y.getX(e+(n+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[u=p[0]+","+p[1]]&&(d[u]={index1:p[0],index2:p[1]});for(u in d)a=d[u],l.fromBufferAttribute(v,a.index1),h.push(l.x,l.y,l.z),l.fromBufferAttribute(v,a.index2),h.push(l.x,l.y,l.z)}else for(e=0,r=(v=t.attributes.position).count/3;e<r;e++)for(n=0;n<3;n++)w=3*e+n,l.fromBufferAttribute(v,w),h.push(l.x,l.y,l.z),S=3*e+(n+1)%3,l.fromBufferAttribute(v,S),h.push(l.x,l.y,l.z)}this.addAttribute("position",new _r(h,3))}function wi(t,e,n){vr.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new Si(t,e,n)),this.mergeVertices()}function Si(t,e,n){Cr.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var r,i,o=[],a=[],s=[],c=[],u=new Ne,l=new Ne,h=new Ne,p=new Ne,d=new Ne,f=e+1;for(r=0;r<=n;r++){var m=r/n;for(i=0;i<=e;i++){var g=i/e;l=t(g,m,l),a.push(l.x,l.y,l.z),g-1e-5>=0?(h=t(g-1e-5,m,h),p.subVectors(l,h)):(h=t(g+1e-5,m,h),p.subVectors(h,l)),m-1e-5>=0?(h=t(g,m-1e-5,h),d.subVectors(l,h)):(h=t(g,m+1e-5,h),d.subVectors(h,l)),u.crossVectors(p,d).normalize(),s.push(u.x,u.y,u.z),c.push(g,m)}}for(r=0;r<n;r++)for(i=0;i<e;i++){var v=r*f+i,y=r*f+i+1,b=(r+1)*f+i+1,x=(r+1)*f+i;o.push(v,y,x),o.push(y,b,x)}this.setIndex(o),this.addAttribute("position",new _r(a,3)),this.addAttribute("normal",new _r(s,3)),this.addAttribute("uv",new _r(c,2))}function Ci(t,e,n,r){vr.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},this.fromBufferGeometry(new Ai(t,e,n,r)),this.mergeVertices()}function Ai(t,e,n,r){Cr.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1;var i=[],o=[];function a(t,e,n,r){var i,o,a=Math.pow(2,r),c=[];for(i=0;i<=a;i++){c[i]=[];var u=t.clone().lerp(n,i/a),l=e.clone().lerp(n,i/a),h=a-i;for(o=0;o<=h;o++)c[i][o]=0===o&&i===a?u:u.clone().lerp(l,o/h)}for(i=0;i<a;i++)for(o=0;o<2*(a-i)-1;o++){var p=Math.floor(o/2);o%2==0?(s(c[i][p+1]),s(c[i+1][p]),s(c[i][p])):(s(c[i][p+1]),s(c[i+1][p+1]),s(c[i+1][p]))}}function s(t){i.push(t.x,t.y,t.z)}function c(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function u(t,e,n,r){r<0&&1===t.x&&(o[e]=t.x-1),0===n.x&&0===n.z&&(o[e]=r/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}!function(t){for(var n=new Ne,r=new Ne,i=new Ne,o=0;o<e.length;o+=3)c(e[o+0],n),c(e[o+1],r),c(e[o+2],i),a(n,r,i,t)}(r=r||0),function(t){for(var e=new Ne,n=0;n<i.length;n+=3)e.x=i[n+0],e.y=i[n+1],e.z=i[n+2],e.normalize().multiplyScalar(t),i[n+0]=e.x,i[n+1]=e.y,i[n+2]=e.z}(n),function(){for(var t=new Ne,e=0;e<i.length;e+=3){t.x=i[e+0],t.y=i[e+1],t.z=i[e+2];var n=l(t)/2/Math.PI+.5,r=(a=t,Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5);o.push(n,1-r)}var a;(function(){for(var t=new Ne,e=new Ne,n=new Ne,r=new Ne,a=new Se,s=new Se,c=new Se,h=0,p=0;h<i.length;h+=9,p+=6){t.set(i[h+0],i[h+1],i[h+2]),e.set(i[h+3],i[h+4],i[h+5]),n.set(i[h+6],i[h+7],i[h+8]),a.set(o[p+0],o[p+1]),s.set(o[p+2],o[p+3]),c.set(o[p+4],o[p+5]),r.copy(t).add(e).add(n).divideScalar(3);var d=l(r);u(a,p+0,t,d),u(s,p+2,e,d),u(c,p+4,n,d)}})(),function(){for(var t=0;t<o.length;t+=6){var e=o[t+0],n=o[t+2],r=o[t+4],i=Math.max(e,n,r),a=Math.min(e,n,r);i>.9&&a<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),r<.2&&(o[t+4]+=1))}}()}(),this.addAttribute("position",new _r(i,3)),this.addAttribute("normal",new _r(i.slice(),3)),this.addAttribute("uv",new _r(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Ei(t,e){vr.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Mi(t,e)),this.mergeVertices()}function Mi(t,e){Ai.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ti(t,e){vr.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Pi(t,e)),this.mergeVertices()}function Pi(t,e){Ai.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ii(t,e){vr.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ri(t,e)),this.mergeVertices()}function Ri(t,e){var n=(1+Math.sqrt(5))/2,r=[-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];Ai.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Oi(t,e){vr.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Li(t,e)),this.mergeVertices()}function Li(t,e){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-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];Ai.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ki(t,e,n,r,i,o){vr.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Ni(t,e,n,r,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Ni(t,e,n,r,i){Cr.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},e=e||64,n=n||1,r=r||8,i=i||!1;var o=t.computeFrenetFrames(e,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new Ne,u=new Ne,l=new Se,h=[],p=[],d=[],f=[];function m(i){var a=t.getPointAt(i/e),l=o.normals[i],d=o.binormals[i];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);u.x=g*l.x+m*d.x,u.y=g*l.y+m*d.y,u.z=g*l.z+m*d.z,u.normalize(),p.push(u.x,u.y,u.z),c.x=a.x+n*u.x,c.y=a.y+n*u.y,c.z=a.z+n*u.z,h.push(c.x,c.y,c.z)}}!function(){for(a=0;a<e;a++)m(a);m(!1===i?e:0),function(){for(a=0;a<=e;a++)for(s=0;s<=r;s++)l.x=a/e,l.y=s/r,d.push(l.x,l.y)}(),function(){for(s=1;s<=e;s++)for(a=1;a<=r;a++){var t=(r+1)*(s-1)+(a-1),n=(r+1)*s+(a-1),i=(r+1)*s+a,o=(r+1)*(s-1)+a;f.push(t,n,o),f.push(n,i,o)}}()}(),this.setIndex(f),this.addAttribute("position",new _r(h,3)),this.addAttribute("normal",new _r(p,3)),this.addAttribute("uv",new _r(d,2))}function Di(t,e,n,r,i,o,a){vr.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new zi(t,e,n,r,i,o)),this.mergeVertices()}function zi(t,e,n,r,i,o){Cr.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},t=t||100,e=e||40,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,o=o||3;var a,s,c=[],u=[],l=[],h=[],p=new Ne,d=new Ne,f=new Ne,m=new Ne,g=new Ne,v=new Ne,y=new Ne;for(a=0;a<=n;++a){var b=a/n*i*Math.PI*2;for(M(b,i,o,t,f),M(b+.01,i,o,t,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=r;++s){var x=s/r*Math.PI*2,_=-e*Math.cos(x),w=e*Math.sin(x);p.x=f.x+(_*y.x+w*g.x),p.y=f.y+(_*y.y+w*g.y),p.z=f.z+(_*y.z+w*g.z),u.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),l.push(d.x,d.y,d.z),h.push(a/n),h.push(s/r)}}for(s=1;s<=n;s++)for(a=1;a<=r;a++){var S=(r+1)*(s-1)+(a-1),C=(r+1)*s+(a-1),A=(r+1)*s+a,E=(r+1)*(s-1)+a;c.push(S,C,E),c.push(C,A,E)}function M(t,e,n,r,i){var o=Math.cos(t),a=Math.sin(t),s=n/e*t,c=Math.cos(s);i.x=r*(2+c)*.5*o,i.y=r*(2+c)*a*.5,i.z=r*Math.sin(s)*.5}this.setIndex(c),this.addAttribute("position",new _r(u,3)),this.addAttribute("normal",new _r(l,3)),this.addAttribute("uv",new _r(h,2))}function Fi(t,e,n,r,i){vr.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Bi(t,e,n,r,i)),this.mergeVertices()}function Bi(t,e,n,r,i){Cr.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},t=t||100,e=e||40,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var o,a,s=[],c=[],u=[],l=[],h=new Ne,p=new Ne,d=new Ne;for(o=0;o<=n;o++)for(a=0;a<=r;a++){var f=a/r*i,m=o/n*Math.PI*2;p.x=(t+e*Math.cos(m))*Math.cos(f),p.y=(t+e*Math.cos(m))*Math.sin(f),p.z=e*Math.sin(m),c.push(p.x,p.y,p.z),h.x=t*Math.cos(f),h.y=t*Math.sin(f),d.subVectors(p,h).normalize(),u.push(d.x,d.y,d.z),l.push(a/r),l.push(o/n)}for(o=1;o<=n;o++)for(a=1;a<=r;a++){var g=(r+1)*o+a-1,v=(r+1)*(o-1)+a-1,y=(r+1)*(o-1)+a,b=(r+1)*o+a;s.push(g,v,b),s.push(v,y,b)}this.setIndex(s),this.addAttribute("position",new _r(c,3)),this.addAttribute("normal",new _r(u,3)),this.addAttribute("uv",new _r(l,2))}ti.prototype=Object.assign(Object.create(or.prototype),{constructor:ti,isArrayCamera:!0}),ni.prototype.isFogExp2=!0,ni.prototype.clone=function(){return new ni(this.color.getHex(),this.density)},ni.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},ri.prototype.isFog=!0,ri.prototype.clone=function(){return new ri(this.color.getHex(),this.near,this.far)},ri.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ii.prototype=Object.assign(Object.create(nr.prototype),{constructor:ii,copy:function(t,e){return nr.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=nr.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),oi.prototype=Object.assign(Object.create(nr.prototype),{constructor:oi,isLensFlare:!0,copy:function(t){nr.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,n=t.lensFlares.length;e<n;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,n,r,i,o){void 0===e&&(e=-1),void 0===n&&(n=0),void 0===o&&(o=1),void 0===i&&(i=new En(16777215)),void 0===r&&(r=N),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:t,size:e,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:i,blending:r})},updateLensFlares:function(){var t,e,n=this.lensFlares.length,r=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(t=0;t<n;t++)(e=this.lensFlares[t]).x=this.positionScreen.x+r*e.distance,e.y=this.positionScreen.y+i*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),ai.prototype=Object.create(jn.prototype),ai.prototype.constructor=ai,ai.prototype.isSpriteMaterial=!0,ai.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},si.prototype=Object.assign(Object.create(nr.prototype),{constructor:si,isSprite:!0,raycast:(Fr=new Ne,Br=new Ne,Ur=new Ne,function(t,e){Br.setFromMatrixPosition(this.matrixWorld),t.ray.closestPointToPoint(Br,Fr),Ur.setFromMatrixScale(this.matrixWorld);var n=Ur.x*Ur.y/4;if(!(Br.distanceToSquared(Fr)>n)){var r=t.ray.origin.distanceTo(Fr);r<t.near||r>t.far||e.push({distance:r,point:Fr.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)}}),ci.prototype=Object.assign(Object.create(nr.prototype),{constructor:ci,copy:function(t){nr.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n<r;n++){var i=e[n];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=this.levels,r=0;r<n.length&&!(e<n[r].distance);r++);n.splice(r,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object},raycast:(jr=new Ne,function(t,e){jr.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(jr);this.getObjectForDistance(n).raycast(t,e)}),update:function(){var t=new Ne,e=new Ne;return function(n){var r=this.levels;if(r.length>1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var i=t.distanceTo(e);r[0].object.visible=!0;for(var o=1,a=r.length;o<a&&i>=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;o<a;o++)r[o].object.visible=!1}}}(),toJSON:function(t){var e=nr.prototype.toJSON.call(this,t);e.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var o=n[r];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),Object.assign(ui.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var n=new De;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},pose:function(){var t,e,n;for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:(Gr=new De,Vr=new De,function(){for(var t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,o=t.length;i<o;i++){var a=t[i]?t[i].matrixWorld:Vr;Gr.multiplyMatrices(a,e[i]),Gr.toArray(n,16*i)}void 0!==r&&(r.needsUpdate=!0)}),clone:function(){return new ui(this.bones,this.boneInverses)}}),li.prototype=Object.assign(Object.create(nr.prototype),{constructor:li,isBone:!0}),hi.prototype=Object.assign(Object.create(Lr.prototype),{constructor:hi,isSkinnedMesh:!0,initBones:function(){var t,e,n,r,i=[];if(this.geometry&&void 0!==this.geometry.bones){for(n=0,r=this.geometry.bones.length;n<r;n++)e=this.geometry.bones[n],t=new li,i.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(n=0,r=this.geometry.bones.length;n<r;n++)-1!==(e=this.geometry.bones[n]).parent&&null!==e.parent&&void 0!==i[e.parent]?i[e.parent].add(i[n]):this.add(i[n])}return this.updateMatrixWorld(!0),i},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var n=this.geometry.skinWeights[e];(t=1/n.lengthManhattan())!==1/0?n.multiplyScalar(t):n.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var r=new Oe,i=this.geometry.attributes.skinWeight;for(e=0;e<i.count;e++)r.x=i.getX(e),r.y=i.getY(e),r.z=i.getZ(e),r.w=i.getW(e),(t=1/r.lengthManhattan())!==1/0?r.multiplyScalar(t):r.set(1,0,0,0),i.setXYZW(e,r.x,r.y,r.z,r.w)}},updateMatrixWorld:function(t){Lr.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),pi.prototype=Object.create(jn.prototype),pi.prototype.constructor=pi,pi.prototype.isLineBasicMaterial=!0,pi.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},di.prototype=Object.assign(Object.create(nr.prototype),{constructor:di,isLine:!0,raycast:function(){var t=new De,e=new Ir,n=new $n;return function(r,i){var o=r.linePrecision,a=o*o,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),!1!==r.ray.intersectsSphere(n)){t.getInverse(c),e.copy(r.ray).applyMatrix4(t);var u=new Ne,l=new Ne,h=new Ne,p=new Ne,d=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var f=s.index,m=s.attributes.position.array;if(null!==f)for(var g=f.array,v=0,y=g.length-1;v<y;v+=d){var b=g[v],x=g[v+1];if(u.fromArray(m,3*b),l.fromArray(m,3*x),!(e.distanceSqToSegment(u,l,p,h)>a))p.applyMatrix4(this.matrixWorld),(S=r.ray.origin.distanceTo(p))<r.near||S>r.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}else for(v=0,y=m.length/3-1;v<y;v+=d){if(u.fromArray(m,3*v),l.fromArray(m,3*v+3),!(e.distanceSqToSegment(u,l,p,h)>a))p.applyMatrix4(this.matrixWorld),(S=r.ray.origin.distanceTo(p))<r.near||S>r.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var _=s.vertices,w=_.length;for(v=0;v<w-1;v+=d){var S;if(!(e.distanceSqToSegment(_[v],_[v+1],p,h)>a))p.applyMatrix4(this.matrixWorld),(S=r.ray.origin.distanceTo(p))<r.near||S>r.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),fi.prototype=Object.assign(Object.create(di.prototype),{constructor:fi,isLineSegments:!0}),mi.prototype=Object.assign(Object.create(di.prototype),{constructor:mi,isLineLoop:!0}),gi.prototype=Object.create(jn.prototype),gi.prototype.constructor=gi,gi.prototype.isPointsMaterial=!0,gi.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},vi.prototype=Object.assign(Object.create(nr.prototype),{constructor:vi,isPoints:!0,raycast:function(){var t=new De,e=new Ir,n=new $n;return function(r,i){var o=this,a=this.geometry,s=this.matrixWorld,c=r.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),n.copy(a.boundingSphere),n.applyMatrix4(s),n.radius+=c,!1!==r.ray.intersectsSphere(n)){t.getInverse(s),e.copy(r.ray).applyMatrix4(t);var u=c/((this.scale.x+this.scale.y+this.scale.z)/3),l=u*u,h=new Ne;if(a.isBufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var f=p.array,m=0,g=f.length;m<g;m++){var v=f[m];h.fromArray(d,3*v),x(h,v)}else{m=0;for(var y=d.length/3;m<y;m++)h.fromArray(d,3*m),x(h,m)}}else{var b=a.vertices;for(m=0,y=b.length;m<y;m++)x(b[m],m)}}function x(t,n){var a=e.distanceSqToPoint(t);if(a<l){var c=e.closestPointToPoint(t);c.applyMatrix4(s);var u=r.ray.origin.distanceTo(c);if(u<r.near||u>r.far)return;i.push({distance:u,distanceToRay:Math.sqrt(a),point:c.clone(),index:n,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),yi.prototype=Object.assign(Object.create(nr.prototype),{constructor:yi}),bi.prototype=Object.create(Re.prototype),bi.prototype.constructor=bi,bi.prototype.isCompressedTexture=!0,xi.prototype=Object.create(Re.prototype),xi.prototype.constructor=xi,_i.prototype=Object.create(Cr.prototype),_i.prototype.constructor=_i,wi.prototype=Object.create(vr.prototype),wi.prototype.constructor=wi,Si.prototype=Object.create(Cr.prototype),Si.prototype.constructor=Si,Ci.prototype=Object.create(vr.prototype),Ci.prototype.constructor=Ci,Ai.prototype=Object.create(Cr.prototype),Ai.prototype.constructor=Ai,Ei.prototype=Object.create(vr.prototype),Ei.prototype.constructor=Ei,Mi.prototype=Object.create(Ai.prototype),Mi.prototype.constructor=Mi,Ti.prototype=Object.create(vr.prototype),Ti.prototype.constructor=Ti,Pi.prototype=Object.create(Ai.prototype),Pi.prototype.constructor=Pi,Ii.prototype=Object.create(vr.prototype),Ii.prototype.constructor=Ii,Ri.prototype=Object.create(Ai.prototype),Ri.prototype.constructor=Ri,Oi.prototype=Object.create(vr.prototype),Oi.prototype.constructor=Oi,Li.prototype=Object.create(Ai.prototype),Li.prototype.constructor=Li,ki.prototype=Object.create(vr.prototype),ki.prototype.constructor=ki,Ni.prototype=Object.create(Cr.prototype),Ni.prototype.constructor=Ni,Di.prototype=Object.create(vr.prototype),Di.prototype.constructor=Di,zi.prototype=Object.create(Cr.prototype),zi.prototype.constructor=zi,Fi.prototype=Object.create(vr.prototype),Fi.prototype.constructor=Fi,Bi.prototype=Object.create(Cr.prototype),Bi.prototype.constructor=Bi;var Ui={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n},triangulate:function(){function t(t,e,n,r,i,o){var a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w;if(s=t[o[e]].x,c=t[o[e]].y,u=t[o[n]].x,l=t[o[n]].y,h=t[o[r]].x,(u-s)*((p=t[o[r]].y)-c)-(l-c)*(h-s)<=0)return!1;for(m=h-u,g=p-l,v=s-h,y=c-p,b=u-s,x=l-c,a=0;a<i;a++)if(d=t[o[a]].x,f=t[o[a]].y,!(d===s&&f===c||d===u&&f===l||d===h&&f===p)&&(_=b*(f-c)-x*(d-s),w=v*(f-p)-y*(d-h),m*(f-l)-g*(d-u)>=-Number.EPSILON&&w>=-Number.EPSILON&&_>=-Number.EPSILON))return!1;return!0}return function(e,n){var r=e.length;if(r<3)return null;var i,o,a,s=[],c=[],u=[];if(Ui.area(e)>0)for(o=0;o<r;o++)c[o]=o;else for(o=0;o<r;o++)c[o]=r-1-o;var l=r,h=2*l;for(o=l-1;l>2;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?u:s;if(l<=(i=o)&&(i=0),l<=(o=i+1)&&(o=0),l<=(a=o+1)&&(a=0),t(e,i,o,a,l,c)){var p,d,f,m,g;for(p=c[i],d=c[o],f=c[a],s.push([e[p],e[d],e[f]]),u.push([c[i],c[o],c[a]]),m=o,g=o+1;g<l;m++,g++)c[m]=c[g];h=2*--l}}return n?u:s}}(),triangulateShape:function(t,e){function n(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function r(t,e,n){return t.x!==e.x?t.x<e.x?t.x<=n.x&&n.x<=e.x:e.x<=n.x&&n.x<=t.x:t.y<e.y?t.y<=n.y&&n.y<=e.y:e.y<=n.y&&n.y<=t.y}function i(t,e,n,i,o){var a=e.x-t.x,s=e.y-t.y,c=i.x-n.x,u=i.y-n.y,l=t.x-n.x,h=t.y-n.y,p=s*c-a*u,d=s*l-a*h;if(Math.abs(p)>Number.EPSILON){var f;if(p>0){if(d<0||d>p)return[];if((f=u*l-c*h)<0||f>p)return[]}else{if(d>0||d<p)return[];if((f=u*l-c*h)>0||f<p)return[]}if(0===f)return!o||0!==d&&d!==p?[t]:[];if(f===p)return!o||0!==d&&d!==p?[e]:[];if(0===d)return[n];if(d===p)return[i];var m=f/p;return[{x:t.x+m*a,y:t.y+m*s}]}if(0!==d||u*l!=c*h)return[];var g,v,y,b,x,_,w,S,C=0===a&&0===s,A=0===c&&0===u;return C&&A?t.x!==n.x||t.y!==n.y?[]:[t]:C?r(n,i,t)?[t]:[]:A?r(t,e,n)?[n]:[]:(0!==a?(t.x<e.x?(g=t,y=t.x,v=e,b=e.x):(g=e,y=e.x,v=t,b=t.x),n.x<i.x?(x=n,w=n.x,_=i,S=i.x):(x=i,w=i.x,_=n,S=n.x)):(t.y<e.y?(g=t,y=t.y,v=e,b=e.y):(g=e,y=e.y,v=t,b=t.y),n.y<i.y?(x=n,w=n.y,_=i,S=i.y):(x=i,w=i.y,_=n,S=n.y)),y<=w?b<w?[]:b===w?o?[]:[x]:b<=S?[x,v]:[x,_]:y>S?[]:y===S?o?[]:[g]:b<=S?[g,v]:[g,_])}function o(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,c=r.x-t.x,u=r.y-t.y,l=i*s-o*a,h=i*u-o*c;if(Math.abs(l)>Number.EPSILON){var p=c*s-u*a;return l>0?h>=0&&p>=0:h>=0||p>=0}return h>0}n(t),e.forEach(n);for(var a,s,c,u,l,h,p={},d=t.concat(),f=0,m=e.length;f<m;f++)Array.prototype.push.apply(d,e[f]);for(a=0,s=d.length;a<s;a++)void 0!==p[l=d[a].x+":"+d[a].y]&&console.warn("THREE.ShapeUtils: Duplicate point",l,a),p[l]=a;var g=function(t,e){var n,r=t.concat();function a(t,e){var i=r.length-1,a=t-1;a<0&&(a=i);var s=t+1;s>i&&(s=0);var c=o(r[t],r[a],r[s],n[e]);if(!c)return!1;var u=n.length-1,l=e-1;l<0&&(l=u);var h=e+1;return h>u&&(h=0),!!(c=o(n[e],n[l],n[h],r[t]))}function s(t,e){var n,o;for(n=0;n<r.length;n++)if(o=n+1,o%=r.length,i(t,e,r[n],r[o],!0).length>0)return!0;return!1}var c=[];function u(t,n){var r,o,a,s;for(r=0;r<c.length;r++)for(o=e[c[r]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,i(t,n,o[a],o[s],!0).length>0)return!0;return!1}for(var l,h,p,d,f,m,g,v,y,b,x=[],_=0,w=e.length;_<w;_++)c.push(_);for(var S=0,C=2*c.length;c.length>0;){if(--C<0){console.log("Infinite Loop! Holes left:"+c.length+", Probably Hole outside Shape!");break}for(h=S;h<r.length;h++){for(p=r[h],l=-1,_=0;_<c.length;_++)if(f=c[_],void 0===x[m=p.x+":"+p.y+":"+f]){n=e[f];for(var A=0;A<n.length;A++)if(d=n[A],a(h,A)&&!s(p,d)&&!u(p,d)){l=A,c.splice(_,1),g=r.slice(0,h+1),v=r.slice(h),y=n.slice(l),b=n.slice(0,l+1),r=g.concat(y).concat(b).concat(v),S=h;break}if(l>=0)break;x[m]=!0}if(l>=0)break}}return r}(t,e),v=Ui.triangulate(g,!1);for(a=0,s=v.length;a<s;a++)for(u=v[a],c=0;c<3;c++)void 0!==(h=p[l=u[c].x+":"+u[c].y])&&(u[c]=h);return v.concat()},isClockWise:function(t){return Ui.area(t)<0}};function ji(t,e){vr.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new Gi(t,e)),this.mergeVertices()}function Gi(t,e){void 0!==t&&(Cr.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals())}function Vi(t,e){vr.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new Hi(t,e)),this.mergeVertices()}function Hi(t,e){var n=(e=e||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new vr;var r=n.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),Gi.call(this,r,e),this.type="TextBufferGeometry"}function $i(t,e,n,r,i,o,a){vr.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Wi(t,e,n,r,i,o,a)),this.mergeVertices()}function Wi(t,e,n,r,i,o,a){Cr.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var s,c,u=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),l=0,h=[],p=new Ne,d=new Ne,f=[],m=[],g=[],v=[];for(c=0;c<=n;c++){var y=[],b=c/n;for(s=0;s<=e;s++){var x=s/e;p.x=-t*Math.cos(r+x*i)*Math.sin(o+b*a),p.y=t*Math.cos(o+b*a),p.z=t*Math.sin(r+x*i)*Math.sin(o+b*a),m.push(p.x,p.y,p.z),d.set(p.x,p.y,p.z).normalize(),g.push(d.x,d.y,d.z),v.push(x,1-b),y.push(l++)}h.push(y)}for(c=0;c<n;c++)for(s=0;s<e;s++){var _=h[c][s+1],w=h[c][s],S=h[c+1][s],C=h[c+1][s+1];(0!==c||o>0)&&f.push(_,w,C),(c!==n-1||u<Math.PI)&&f.push(w,S,C)}this.setIndex(f),this.addAttribute("position",new _r(m,3)),this.addAttribute("normal",new _r(g,3)),this.addAttribute("uv",new _r(v,2))}function qi(t,e,n,r,i,o){vr.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new Xi(t,e,n,r,i,o)),this.mergeVertices()}function Xi(t,e,n,r,i,o){Cr.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},t=t||20,e=e||50,i=void 0!==i?i:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var a,s,c,u=[],l=[],h=[],p=[],d=t,f=(e-t)/(r=void 0!==r?Math.max(1,r):1),m=new Ne,g=new Se;for(s=0;s<=r;s++){for(c=0;c<=n;c++)a=i+c/n*o,m.x=d*Math.cos(a),m.y=d*Math.sin(a),l.push(m.x,m.y,m.z),h.push(0,0,1),g.x=(m.x/e+1)/2,g.y=(m.y/e+1)/2,p.push(g.x,g.y);d+=f}for(s=0;s<r;s++){var v=s*(n+1);for(c=0;c<n;c++){var y=a=c+v,b=a+n+1,x=a+n+2,_=a+1;u.push(y,b,_),u.push(b,x,_)}}this.setIndex(u),this.addAttribute("position",new _r(l,3)),this.addAttribute("normal",new _r(h,3)),this.addAttribute("uv",new _r(p,2))}function Yi(t,e,n,r){vr.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},this.fromBufferGeometry(new Ki(t,e,n,r)),this.mergeVertices()}function Ki(t,e,n,r){Cr.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e)||12,n=n||0,r=r||2*Math.PI,r=we.clamp(r,0,2*Math.PI);var i,o,a,s=[],c=[],u=[],l=1/e,h=new Ne,p=new Se;for(o=0;o<=e;o++){var d=n+o*l*r,f=Math.sin(d),m=Math.cos(d);for(a=0;a<=t.length-1;a++)h.x=t[a].x*f,h.y=t[a].y,h.z=t[a].x*m,c.push(h.x,h.y,h.z),p.x=o/e,p.y=a/(t.length-1),u.push(p.x,p.y)}for(o=0;o<e;o++)for(a=0;a<t.length-1;a++){var g=i=a+o*t.length,v=i+t.length,y=i+t.length+1,b=i+1;s.push(g,v,b),s.push(v,y,b)}if(this.setIndex(s),this.addAttribute("position",new _r(c,3)),this.addAttribute("uv",new _r(u,2)),this.computeVertexNormals(),r===2*Math.PI){var x=this.attributes.normal.array,_=new Ne,w=new Ne,S=new Ne;for(i=e*t.length*3,o=0,a=0;o<t.length;o++,a+=3)_.x=x[a+0],_.y=x[a+1],_.z=x[a+2],w.x=x[i+a+0],w.y=x[i+a+1],w.z=x[i+a+2],S.addVectors(_,w).normalize(),x[a+0]=x[i+a+0]=S.x,x[a+1]=x[i+a+1]=S.y,x[a+2]=x[i+a+2]=S.z}}function Zi(t,e){vr.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new Qi(t,e)),this.mergeVertices()}function Qi(t,e){Cr.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var n=[],r=[],i=[],o=[],a=0,s=0;if(!1===Array.isArray(t))u(t);else for(var c=0;c<t.length;c++)u(t[c]),this.addGroup(a,s,c),a+=s,s=0;function u(t){var a,c,u,l=r.length/3,h=t.extractPoints(e),p=h.shape,d=h.holes;if(!1===Ui.isClockWise(p))for(p=p.reverse(),a=0,c=d.length;a<c;a++)u=d[a],!0===Ui.isClockWise(u)&&(d[a]=u.reverse());var f=Ui.triangulateShape(p,d);for(a=0,c=d.length;a<c;a++)u=d[a],p=p.concat(u);for(a=0,c=p.length;a<c;a++){var m=p[a];r.push(m.x,m.y,0),i.push(0,0,1),o.push(m.x,m.y)}for(a=0,c=f.length;a<c;a++){var g=f[a],v=g[0]+l,y=g[1]+l,b=g[2]+l;n.push(v,y,b),s+=3}}this.setIndex(n),this.addAttribute("position",new _r(r,3)),this.addAttribute("normal",new _r(i,3)),this.addAttribute("uv",new _r(o,2))}function Ji(t,e){Cr.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var n,r,i,o,a=[],s=Math.cos(we.DEG2RAD*e),c=[0,0],u={},l=["a","b","c"];t.isBufferGeometry?(o=new vr).fromBufferGeometry(t):o=t.clone(),o.mergeVertices(),o.computeFaceNormals();for(var h=o.vertices,p=o.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],g=0;g<3;g++)n=m[l[g]],r=m[l[(g+1)%3]],c[0]=Math.min(n,r),c[1]=Math.max(n,r),void 0===u[i=c[0]+","+c[1]]?u[i]={index1:c[0],index2:c[1],face1:d,face2:void 0}:u[i].face2=d;for(i in u){var v=u[i];if(void 0===v.face2||p[v.face1].normal.dot(p[v.face2].normal)<=s){var y=h[v.index1];a.push(y.x,y.y,y.z),y=h[v.index2],a.push(y.x,y.y,y.z)}}this.addAttribute("position",new _r(a,3))}function to(t,e,n,r,i,o,a,s){vr.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new eo(t,e,n,r,i,o,a,s)),this.mergeVertices()}function eo(t,e,n,r,i,o,a,s){Cr.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s};var c=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,r=Math.floor(r)||8,i=Math.floor(i)||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var u=[],l=[],h=[],p=[],d=0,f=[],m=n/2,g=0;function v(n){var i,o,f,v=new Se,y=new Ne,b=0,x=!0===n?t:e,_=!0===n?1:-1;for(o=d,i=1;i<=r;i++)l.push(0,m*_,0),h.push(0,_,0),p.push(.5,.5),d++;for(f=d,i=0;i<=r;i++){var w=i/r*s+a,S=Math.cos(w),C=Math.sin(w);y.x=x*C,y.y=m*_,y.z=x*S,l.push(y.x,y.y,y.z),h.push(0,_,0),v.x=.5*S+.5,v.y=.5*C*_+.5,p.push(v.x,v.y),d++}for(i=0;i<r;i++){var A=o+i,E=f+i;!0===n?u.push(E,E+1,A):u.push(E+1,E,A),b+=3}c.addGroup(g,b,!0===n?1:2),g+=b}!function(){var o,v,y=new Ne,b=new Ne,x=0,_=(e-t)/n;for(v=0;v<=i;v++){var w=[],S=v/i,C=S*(e-t)+t;for(o=0;o<=r;o++){var A=o/r,E=A*s+a,M=Math.sin(E),T=Math.cos(E);b.x=C*M,b.y=-S*n+m,b.z=C*T,l.push(b.x,b.y,b.z),y.set(M,_,T).normalize(),h.push(y.x,y.y,y.z),p.push(A,1-S),w.push(d++)}f.push(w)}for(o=0;o<r;o++)for(v=0;v<i;v++){var P=f[v][o],I=f[v+1][o],R=f[v+1][o+1],O=f[v][o+1];u.push(P,I,O),u.push(I,R,O),x+=6}c.addGroup(g,x,0),g+=x}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(u),this.addAttribute("position",new _r(l,3)),this.addAttribute("normal",new _r(h,3)),this.addAttribute("uv",new _r(p,2))}function no(t,e,n,r,i,o,a){to.call(this,0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function ro(t,e,n,r,i,o,a){eo.call(this,0,t,e,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function io(t,e,n,r){vr.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new oo(t,e,n,r)),this.mergeVertices()}function oo(t,e,n,r){Cr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,o,a=[],s=[],c=[],u=[],l=new Ne,h=new Se;for(s.push(0,0,0),c.push(0,0,1),u.push(.5,.5),o=0,i=3;o<=e;o++,i+=3){var p=n+o/e*r;l.x=t*Math.cos(p),l.y=t*Math.sin(p),s.push(l.x,l.y,l.z),c.push(0,0,1),h.x=(s[i]/t+1)/2,h.y=(s[i+1]/t+1)/2,u.push(h.x,h.y)}for(i=1;i<=e;i++)a.push(i,i+1,0);this.setIndex(a),this.addAttribute("position",new _r(s,3)),this.addAttribute("normal",new _r(c,3)),this.addAttribute("uv",new _r(u,2))}ji.prototype=Object.create(vr.prototype),ji.prototype.constructor=ji,Gi.prototype=Object.create(Cr.prototype),Gi.prototype.constructor=Gi,Gi.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],n=this.getAttribute("uv"),r=n?Array.prototype.slice.call(n.array):[],i=this.index;return{position:e,uv:r,index:i?Array.prototype.slice.call(i.array):[]}},Gi.prototype.addShapeList=function(t,e){var n=t.length;e.arrays=this.getArrays();for(var r=0;r<n;r++){var i=t[r];this.addShape(i,e)}this.setIndex(e.arrays.index),this.addAttribute("position",new _r(e.arrays.position,3)),this.addAttribute("uv",new _r(e.arrays.uv,2))},Gi.prototype.addShape=function(t,e){var n,r,i,o,a,s,c,u,l=e.arrays?e.arrays:this.getArrays(),h=l.position,p=l.index,d=l.uv,f=[],m=void 0!==e.amount?e.amount:100,g=void 0!==e.bevelThickness?e.bevelThickness:6,v=void 0!==e.bevelSize?e.bevelSize:g-2,y=void 0!==e.bevelSegments?e.bevelSegments:3,b=void 0===e.bevelEnabled||e.bevelEnabled,x=void 0!==e.curveSegments?e.curveSegments:12,_=void 0!==e.steps?e.steps:1,w=e.extrudePath,S=!1,C=void 0!==e.UVGenerator?e.UVGenerator:ji.WorldUVGenerator;w&&(n=w.getSpacedPoints(_),S=!0,b=!1,r=void 0!==e.frames?e.frames:w.computeFrenetFrames(_,!1),i=new Ne,o=new Ne,a=new Ne),b||(y=0,g=0,v=0);var A=this,E=t.extractPoints(x),M=E.shape,T=E.holes;if(!Ui.isClockWise(M))for(M=M.reverse(),c=0,u=T.length;c<u;c++)s=T[c],Ui.isClockWise(s)&&(T[c]=s.reverse());var P=Ui.triangulateShape(M,T),I=M;for(c=0,u=T.length;c<u;c++)s=T[c],M=M.concat(s);function R(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}var O,L,k,N,D,z,F=M.length,B=P.length;function U(t,e,n){var r,i,o,a=t.x-e.x,s=t.y-e.y,c=n.x-t.x,u=n.y-t.y,l=a*a+s*s,h=a*u-s*c;if(Math.abs(h)>Number.EPSILON){var p=Math.sqrt(l),d=Math.sqrt(c*c+u*u),f=e.x-s/p,m=e.y+a/p,g=((n.x-u/d-f)*u-(n.y+c/d-m)*c)/(a*u-s*c),v=(r=f+a*g-t.x)*r+(i=m+s*g-t.y)*i;if(v<=2)return new Se(r,i);o=Math.sqrt(v/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=a,o=Math.sqrt(l)):(r=a,i=s,o=Math.sqrt(l/2))}return new Se(r/o,i/o)}for(var j=[],G=0,V=I.length,H=V-1,$=G+1;G<V;G++,H++,$++)H===V&&(H=0),$===V&&($=0),j[G]=U(I[G],I[H],I[$]);var W,q,X=[],Y=j.concat();for(c=0,u=T.length;c<u;c++){for(s=T[c],W=[],G=0,H=(V=s.length)-1,$=G+1;G<V;G++,H++,$++)H===V&&(H=0),$===V&&($=0),W[G]=U(s[G],s[H],s[$]);X.push(W),Y=Y.concat(W)}for(O=0;O<y;O++){for(k=O/y,N=g*Math.cos(k*Math.PI/2),L=v*Math.sin(k*Math.PI/2),G=0,V=I.length;G<V;G++)Z((D=R(I[G],j[G],L)).x,D.y,-N);for(c=0,u=T.length;c<u;c++)for(s=T[c],W=X[c],G=0,V=s.length;G<V;G++)Z((D=R(s[G],W[G],L)).x,D.y,-N)}for(L=v,G=0;G<F;G++)D=b?R(M[G],Y[G],L):M[G],S?(o.copy(r.normals[0]).multiplyScalar(D.x),i.copy(r.binormals[0]).multiplyScalar(D.y),a.copy(n[0]).add(o).add(i),Z(a.x,a.y,a.z)):Z(D.x,D.y,0);for(q=1;q<=_;q++)for(G=0;G<F;G++)D=b?R(M[G],Y[G],L):M[G],S?(o.copy(r.normals[q]).multiplyScalar(D.x),i.copy(r.binormals[q]).multiplyScalar(D.y),a.copy(n[q]).add(o).add(i),Z(a.x,a.y,a.z)):Z(D.x,D.y,m/_*q);for(O=y-1;O>=0;O--){for(k=O/y,N=g*Math.cos(k*Math.PI/2),L=v*Math.sin(k*Math.PI/2),G=0,V=I.length;G<V;G++)Z((D=R(I[G],j[G],L)).x,D.y,m+N);for(c=0,u=T.length;c<u;c++)for(s=T[c],W=X[c],G=0,V=s.length;G<V;G++)D=R(s[G],W[G],L),S?Z(D.x,D.y+n[_-1].y,n[_-1].x+N):Z(D.x,D.y,m+N)}function K(t,e){var n,r;for(G=t.length;--G>=0;){n=G,(r=G-1)<0&&(r=t.length-1);var i=0,o=_+2*y;for(i=0;i<o;i++){var a=F*i,s=F*(i+1);J(e+n+a,e+r+a,e+r+s,e+n+s,t,i,o,n,r)}}}function Z(t,e,n){f.push(t),f.push(e),f.push(n)}function Q(t,e,n){tt(t),tt(e),tt(n);var r=h.length/3,i=C.generateTopUV(A,h,r-3,r-2,r-1);et(i[0]),et(i[1]),et(i[2])}function J(t,e,n,r,i,o,a,s,c){tt(t),tt(e),tt(r),tt(e),tt(n),tt(r);var u=h.length/3,l=C.generateSideWallUV(A,h,u-6,u-3,u-2,u-1);et(l[0]),et(l[1]),et(l[3]),et(l[1]),et(l[2]),et(l[3])}function tt(t){p.push(h.length/3),h.push(f[3*t+0]),h.push(f[3*t+1]),h.push(f[3*t+2])}function et(t){d.push(t.x),d.push(t.y)}!function(){var t=h.length/3;if(b){var n=0,r=F*n;for(G=0;G<B;G++)Q((z=P[G])[2]+r,z[1]+r,z[0]+r);for(r=F*(n=_+2*y),G=0;G<B;G++)Q((z=P[G])[0]+r,z[1]+r,z[2]+r)}else{for(G=0;G<B;G++)Q((z=P[G])[2],z[1],z[0]);for(G=0;G<B;G++)Q((z=P[G])[0]+F*_,z[1]+F*_,z[2]+F*_)}A.addGroup(t,h.length/3-t,void 0!==e.material?e.material:0)}(),function(){var t=h.length/3,n=0;for(K(I,n),n+=I.length,c=0,u=T.length;c<u;c++)K(s=T[c],n),n+=s.length;A.addGroup(t,h.length/3-t,void 0!==e.extrudeMaterial?e.extrudeMaterial:1)}(),e.arrays||(this.setIndex(p),this.addAttribute("position",new _r(h,3)),this.addAttribute("uv",new _r(e.arrays.uv,2)))},ji.WorldUVGenerator={generateTopUV:function(t,e,n,r,i){var o=e[3*n],a=e[3*n+1],s=e[3*r],c=e[3*r+1],u=e[3*i],l=e[3*i+1];return[new Se(o,a),new Se(s,c),new Se(u,l)]},generateSideWallUV:function(t,e,n,r,i,o){var a=e[3*n],s=e[3*n+1],c=e[3*n+2],u=e[3*r],l=e[3*r+1],h=e[3*r+2],p=e[3*i],d=e[3*i+1],f=e[3*i+2],m=e[3*o],g=e[3*o+1],v=e[3*o+2];return Math.abs(s-l)<.01?[new Se(a,1-c),new Se(u,1-h),new Se(p,1-f),new Se(m,1-v)]:[new Se(s,1-c),new Se(l,1-h),new Se(d,1-f),new Se(g,1-v)]}},Vi.prototype=Object.create(vr.prototype),Vi.prototype.constructor=Vi,Hi.prototype=Object.create(Gi.prototype),Hi.prototype.constructor=Hi,$i.prototype=Object.create(vr.prototype),$i.prototype.constructor=$i,Wi.prototype=Object.create(Cr.prototype),Wi.prototype.constructor=Wi,qi.prototype=Object.create(vr.prototype),qi.prototype.constructor=qi,Xi.prototype=Object.create(Cr.prototype),Xi.prototype.constructor=Xi,Yi.prototype=Object.create(vr.prototype),Yi.prototype.constructor=Yi,Ki.prototype=Object.create(Cr.prototype),Ki.prototype.constructor=Ki,Zi.prototype=Object.create(vr.prototype),Zi.prototype.constructor=Zi,Qi.prototype=Object.create(Cr.prototype),Qi.prototype.constructor=Qi,Ji.prototype=Object.create(Cr.prototype),Ji.prototype.constructor=Ji,to.prototype=Object.create(vr.prototype),to.prototype.constructor=to,eo.prototype=Object.create(Cr.prototype),eo.prototype.constructor=eo,no.prototype=Object.create(to.prototype),no.prototype.constructor=no,ro.prototype=Object.create(eo.prototype),ro.prototype.constructor=ro,io.prototype=Object.create(vr.prototype),io.prototype.constructor=io,oo.prototype=Object.create(Cr.prototype),oo.prototype.constructor=oo;var ao=Object.freeze({WireframeGeometry:_i,ParametricGeometry:wi,ParametricBufferGeometry:Si,TetrahedronGeometry:Ei,TetrahedronBufferGeometry:Mi,OctahedronGeometry:Ti,OctahedronBufferGeometry:Pi,IcosahedronGeometry:Ii,IcosahedronBufferGeometry:Ri,DodecahedronGeometry:Oi,DodecahedronBufferGeometry:Li,PolyhedronGeometry:Ci,PolyhedronBufferGeometry:Ai,TubeGeometry:ki,TubeBufferGeometry:Ni,TorusKnotGeometry:Di,TorusKnotBufferGeometry:zi,TorusGeometry:Fi,TorusBufferGeometry:Bi,TextGeometry:Vi,TextBufferGeometry:Hi,SphereGeometry:$i,SphereBufferGeometry:Wi,RingGeometry:qi,RingBufferGeometry:Xi,PlaneGeometry:Mr,PlaneBufferGeometry:Tr,LatheGeometry:Yi,LatheBufferGeometry:Ki,ShapeGeometry:Zi,ShapeBufferGeometry:Qi,ExtrudeGeometry:ji,ExtrudeBufferGeometry:Gi,EdgesGeometry:Ji,ConeGeometry:no,ConeBufferGeometry:ro,CylinderGeometry:to,CylinderBufferGeometry:eo,CircleGeometry:io,CircleBufferGeometry:oo,BoxGeometry:Ar,BoxBufferGeometry:Er});function so(t){Gn.call(this,{uniforms:Tn.merge([Mn.lights,{opacity:{value:1}}]),vertexShader:Pn.shadow_vert,fragmentShader:Pn.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function co(t){Gn.call(this,t),this.type="RawShaderMaterial"}function uo(t){jn.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new En(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new En(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function lo(t){uo.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function ho(t){jn.call(this),this.type="MeshPhongMaterial",this.color=new En(16777215),this.specular=new En(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new En(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=lt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function po(t){ho.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function fo(t){jn.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function mo(t){jn.call(this),this.type="MeshLambertMaterial",this.color=new En(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new En(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=lt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function go(t){jn.call(this),this.type="LineDashedMaterial",this.color=new En(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}so.prototype=Object.create(Gn.prototype),so.prototype.constructor=so,so.prototype.isShadowMaterial=!0,co.prototype=Object.create(Gn.prototype),co.prototype.constructor=co,co.prototype.isRawShaderMaterial=!0,uo.prototype=Object.create(jn.prototype),uo.prototype.constructor=uo,uo.prototype.isMeshStandardMaterial=!0,uo.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},lo.prototype=Object.create(uo.prototype),lo.prototype.constructor=lo,lo.prototype.isMeshPhysicalMaterial=!0,lo.prototype.copy=function(t){return uo.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},ho.prototype=Object.create(jn.prototype),ho.prototype.constructor=ho,ho.prototype.isMeshPhongMaterial=!0,ho.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},po.prototype=Object.create(ho.prototype),po.prototype.constructor=po,po.prototype.isMeshToonMaterial=!0,po.prototype.copy=function(t){return ho.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},fo.prototype=Object.create(jn.prototype),fo.prototype.constructor=fo,fo.prototype.isMeshNormalMaterial=!0,fo.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},mo.prototype=Object.create(jn.prototype),mo.prototype.constructor=mo,mo.prototype.isMeshLambertMaterial=!0,mo.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},go.prototype=Object.create(jn.prototype),go.prototype.constructor=go,go.prototype.isLineDashedMaterial=!0,go.prototype.copy=function(t){return jn.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var vo=Object.freeze({ShadowMaterial:so,SpriteMaterial:ai,RawShaderMaterial:co,ShaderMaterial:Gn,PointsMaterial:gi,MeshPhysicalMaterial:lo,MeshStandardMaterial:uo,MeshPhongMaterial:ho,MeshToonMaterial:po,MeshNormalMaterial:fo,MeshLambertMaterial:mo,MeshDepthMaterial:Vn,MeshBasicMaterial:Pr,LineDashedMaterial:go,LineBasicMaterial:pi,Material:jn}),yo={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function bo(t,e,n){var r=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===i&&void 0!==r.onStart&&r.onStart(t,o,a),i=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)}}var xo=new bo;function _o(t){this.manager=void 0!==t?t:xo}function wo(t){this.manager=void 0!==t?t:xo}function So(t){this.manager=void 0!==t?t:xo}function Co(t,e){nr.call(this),this.type="Light",this.color=new En(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Ao(t,e,n){Co.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(nr.DefaultUp),this.updateMatrix(),this.groundColor=new En(e)}function Eo(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new Se(512,512),this.map=null,this.matrix=new De}function Mo(){Eo.call(this,new or(50,1,.5,500))}function To(t,e,n,r,i,o){Co.call(this,t,e),this.type="SpotLight",this.position.copy(nr.DefaultUp),this.updateMatrix(),this.target=new nr,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Mo}function Po(t,e,n,r){Co.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new Eo(new or(90,1,.5,500))}function Io(){Eo.call(this,new ir(-5,5,5,-5,.5,500))}function Ro(t,e){Co.call(this,t,e),this.type="DirectionalLight",this.position.copy(nr.DefaultUp),this.updateMatrix(),this.target=new nr,this.shadow=new Io}function Oo(t,e){Co.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Lo(t,e,n,r){Co.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}Object.assign(_o.prototype,{load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,o=yo.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){e&&e(o),i.manager.itemEnd(t)},0),o;var a=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){var s=a[1],c=!!a[2],u=a[3];u=window.decodeURIComponent(u),c&&(u=window.atob(u));try{var l,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":l=new ArrayBuffer(u.length);for(var p=new Uint8Array(l),d=0;d<u.length;d++)p[d]=u.charCodeAt(d);"blob"===h&&(l=new Blob([l],{type:s}));break;case"document":var f=new DOMParser;l=f.parseFromString(u,s);break;case"json":l=JSON.parse(u);break;default:l=u}window.setTimeout(function(){e&&e(l),i.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){r&&r(e),i.manager.itemEnd(t),i.manager.itemError(t)},0)}}else{var m=new XMLHttpRequest;for(var g in m.open("GET",t,!0),m.addEventListener("load",function(n){var o=n.target.response;yo.add(t,o),200===this.status?(e&&e(o),i.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(o),i.manager.itemEnd(t)):(r&&r(n),i.manager.itemEnd(t),i.manager.itemError(t))},!1),void 0!==n&&m.addEventListener("progress",function(t){n(t)},!1),m.addEventListener("error",function(e){r&&r(e),i.manager.itemEnd(t),i.manager.itemError(t)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return i.manager.itemStart(t),m},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(function(t){this.manager=void 0!==t?t:xo,this._parser=null}.prototype,{load:function(t,e,n,r){var i=this,o=[],a=new bi;a.image=o;var s=new _o(this.manager);function c(c){s.load(t[c],function(t){var n=i._parser(t,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(u+=1)&&(1===n.mipmapCount&&(a.minFilter=Rt),a.format=n.format,a.needsUpdate=!0,e&&e(a))},n,r)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var u=0,l=0,h=t.length;l<h;++l)c(l);else s.load(t,function(t){var n=i._parser(t,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){o[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)o[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),o[s].format=n.format,o[s].width=n.width,o[s].height=n.height}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=Rt),a.format=n.format,a.needsUpdate=!0,e&&e(a)},n,r);return a},setPath:function(t){return this.path=t,this}}),Object.assign(function(t){this.manager=void 0!==t?t:xo,this._parser=null}.prototype,{load:function(t,e,n,r){var i=this,o=new ze,a=new _o(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){var n=i._parser(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:Et,o.wrapT=void 0!==n.wrapT?n.wrapT:Et,o.magFilter=void 0!==n.magFilter?n.magFilter:Rt,o.minFilter=void 0!==n.minFilter?n.minFilter:Lt,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps),1===n.mipmapCount&&(o.minFilter=Rt),o.needsUpdate=!0,e&&e(o,n))},n,r),o}}),Object.assign(wo.prototype,{load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,o=yo.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout(function(){e&&e(o),i.manager.itemEnd(t)},0),o;var a=document.createElementNS("http://www.w3.org/1999/xhtml","img");return a.addEventListener("load",function(){yo.add(t,this),e&&e(this),i.manager.itemEnd(t)},!1),a.addEventListener("error",function(e){r&&r(e),i.manager.itemEnd(t),i.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),i.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(function(t){this.manager=void 0!==t?t:xo}.prototype,{load:function(t,e,n,r){var i=new Fe,o=new wo(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;function s(n){o.load(t[n],function(t){i.images[n]=t,6===++a&&(i.needsUpdate=!0,e&&e(i))},void 0,r)}for(var c=0;c<t.length;++c)s(c);return i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(So.prototype,{load:function(t,e,n,r){var i=new wo(this.manager);i.setCrossOrigin(this.crossOrigin),i.setPath(this.path);var o=new Re;return o.image=i.load(t,function(){var n=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);o.format=n?qt:Xt,o.needsUpdate=!0,void 0!==e&&e(o)},n,r),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Co.prototype=Object.assign(Object.create(nr.prototype),{constructor:Co,isLight:!0,copy:function(t){return nr.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=nr.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Ao.prototype=Object.assign(Object.create(Co.prototype),{constructor:Ao,isHemisphereLight:!0,copy:function(t){return Co.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Eo.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Mo.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Mo,isSpotLightShadow:!0,update:function(t){var e=this.camera,n=2*we.RAD2DEG*t.angle,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix())}}),To.prototype=Object.assign(Object.create(Co.prototype),{constructor:To,isSpotLight:!0,copy:function(t){return Co.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Po.prototype=Object.assign(Object.create(Co.prototype),{constructor:Po,isPointLight:!0,copy:function(t){return Co.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Io.prototype=Object.assign(Object.create(Eo.prototype),{constructor:Io}),Ro.prototype=Object.assign(Object.create(Co.prototype),{constructor:Ro,isDirectionalLight:!0,copy:function(t){return Co.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Oo.prototype=Object.assign(Object.create(Co.prototype),{constructor:Oo,isAmbientLight:!0}),Lo.prototype=Object.assign(Object.create(Co.prototype),{constructor:Lo,isRectAreaLight:!0,copy:function(t){return Co.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Co.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var ko,No={arraySlice:function(t,e,n){return No.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,n=new Array(e),r=0;r!==e;++r)n[r]=r;return n.sort(function(e,n){return t[e]-t[n]}),n},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),o=0,a=0;a!==r;++o)for(var s=n[o]*e,c=0;c!==e;++c)i[a++]=t[s+c];return i},flattenJSON:function(t,e,n,r){for(var i=1,o=t[0];void 0!==o&&void 0===o[r];)o=t[i++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[r])&&(e.push(o.time),n.push.apply(n,a)),o=t[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[r])&&(e.push(o.time),a.toArray(n,n.length)),o=t[i++]}while(void 0!==o);else do{void 0!==(a=o[r])&&(e.push(o.time),n.push(a)),o=t[i++]}while(void 0!==o)}}};function Do(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function zo(t,e,n,r){Do.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Fo(t,e,n,r){Do.call(this,t,e,n,r)}function Bo(t,e,n,r){Do.call(this,t,e,n,r)}function Uo(t,e,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=No.convertArray(e,this.TimeBufferType),this.values=No.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function jo(t,e,n,r){Uo.call(this,t,e,n,r)}function Go(t,e,n,r){Do.call(this,t,e,n,r)}function Vo(t,e,n,r){Uo.call(this,t,e,n,r)}function Ho(t,e,n,r){Uo.call(this,t,e,n,r)}function $o(t,e,n,r){Uo.call(this,t,e,n,r)}function Wo(t,e,n){Uo.call(this,t,e,n)}function qo(t,e,n,r){Uo.call(this,t,e,n,r)}function Xo(t,e,n,r){Uo.apply(this,arguments)}function Yo(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=we.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Ko(t){this.manager=void 0!==t?t:xo,this.textures={}}function Zo(t){this.manager=void 0!==t?t:xo}Object.assign(Do.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var o;n:{r:if(!(t<r)){for(var a=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===a)break;if(i=r,t<(r=e[++n]))break e}o=e.length;break n}if(t>=i)break t;var s=e[1];t<s&&(n=2,i=s);for(a=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===a)break;if(r=i,t>=(i=e[--n-1]))break e}o=n,n=0}for(;n<o;){var c=n+o>>>1;t<e[c]?o=c:n=c+1}if(r=e[n],void 0===(i=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r,o=0;o!==r;++o)e[o]=n[i+o];return e},interpolate_:function(t,e,n,r){throw new Error("call to abstract method")},intervalChanged_:function(t,e,n){}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Do.prototype,{beforeStart_:Do.prototype.copySampleValue_,afterEnd_:Do.prototype.copySampleValue_}),zo.prototype=Object.assign(Object.create(Do.prototype),{constructor:zo,DefaultSettings_:{endingStart:ue,endingEnd:ue},intervalChanged_:function(t,e,n){var r=this.parameterPositions,i=t-2,o=t+1,a=r[i],s=r[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:i=t,a=2*e-n;break;case 2402:a=e+r[i=r.length-2]-r[i+1];break;default:i=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=t,s=2*n-e;break;case 2402:o=1,s=n+r[1]-r[0];break;default:o=t-1,s=e}var c=.5*(n-e),u=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-n),this._offsetPrev=i*u,this._offsetNext=o*u},interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,u=this._offsetPrev,l=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(n-e)/(r-e),f=d*d,m=f*d,g=-h*m+2*h*f-h*d,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,b=p*m-p*f,x=0;x!==a;++x)i[x]=g*o[u+x]+v*o[c+x]+y*o[s+x]+b*o[l+x];return i}}),Fo.prototype=Object.assign(Object.create(Do.prototype),{constructor:Fo,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,u=(n-e)/(r-e),l=1-u,h=0;h!==a;++h)i[h]=o[c+h]*l+o[s+h]*u;return i}}),Bo.prototype=Object.assign(Object.create(Do.prototype),{constructor:Bo,interpolate_:function(t,e,n,r){return this.copySampleValue_(t-1)}}),ko={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Bo(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Fo(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new zo(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0!==e)this.createInterpolant=e;else{var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrackPrototype:",n)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,r=n.length,i=0,o=r-1;i!==r&&n[i]<t;)++i;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==i||o!==r){i>=o&&(i=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=No.arraySlice(n,i,o),this.values=No.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),t=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==r&&No.isTypedArray(r)){a=0;for(var c=r.length;a!==c;++a){var u=r[a];if(isNaN(u)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,a,u),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),r=2302===this.getInterpolation(),i=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(r)s=!0;else for(var u=a*n,l=u-n,h=u+n,p=0;p!==n;++p){var d=e[u+p];if(d!==e[l+p]||d!==e[h+p]){s=!0;break}}if(s){if(a!==i){t[i]=t[a];var f=a*n,m=i*n;for(p=0;p!==n;++p)e[m+p]=e[f+p]}++i}}if(o>0){t[i]=t[o];for(f=o*n,m=i*n,p=0;p!==n;++p)e[m+p]=e[f+p];++i}return i!==t.length&&(this.times=No.arraySlice(t,0,i),this.values=No.arraySlice(e,0,i*n)),this}},jo.prototype=Object.assign(Object.create(ko),{constructor:jo,ValueTypeName:"vector"}),Go.prototype=Object.assign(Object.create(Do.prototype),{constructor:Go,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(n-e)/(r-e),u=s+a;s!==u;s+=4)ke.slerpFlat(i,0,o,s-a,o,s,c);return i}}),Vo.prototype=Object.assign(Object.create(ko),{constructor:Vo,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Go(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Ho.prototype=Object.assign(Object.create(ko),{constructor:Ho,ValueTypeName:"number"}),$o.prototype=Object.assign(Object.create(ko),{constructor:$o,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Wo.prototype=Object.assign(Object.create(ko),{constructor:Wo,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),qo.prototype=Object.assign(Object.create(ko),{constructor:qo,ValueTypeName:"color"}),Xo.prototype=ko,ko.constructor=Xo,Object.assign(Xo,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Xo._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],r=[];No.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:No.convertArray(t.times,Array),values:No.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ho;case"vector":case"vector2":case"vector3":case"vector4":return jo;case"color":return qo;case"quaternion":return Vo;case"bool":case"boolean":return Wo;case"string":return $o}throw new Error("Unsupported typeName: "+t)}}),Object.assign(Yo,{parse:function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,o=n.length;i!==o;++i)e.push(Xo.parse(n[i]).scale(r));return new Yo(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e},i=0,o=n.length;i!==o;++i)e.push(Xo.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(t,e,n,r){for(var i=e.length,o=[],a=0;a<i;a++){var s=[],c=[];s.push((a+i-1)%i,a,(a+1)%i),c.push(0,1,0);var u=No.getKeyframeOrder(s);s=No.sortedArray(s,1,u),c=No.sortedArray(c,1,u),r||0!==s[0]||(s.push(i),c.push(c[0])),o.push(new Ho(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/n))}return new Yo(t,-1,o)},findByName:function(t,e){var n=t;if(!Array.isArray(t)){var r=t;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,o=0,a=t.length;o<a;o++){var s=t[o],c=s.name.match(i);if(c&&c.length>1){var u=r[h=c[1]];u||(r[h]=u=[]),u.push(s)}}var l=[];for(var h in r)l.push(Yo.CreateFromMorphTargetSequence(h,r[h],e,n));return l},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var o=[],a=[];No.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var u=s[c].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var l={},h=0;h<u.length;h++)if(u[h].morphTargets)for(var p=0;p<u[h].morphTargets.length;p++)l[u[h].morphTargets[p]]=-1;for(var d in l){var f=[],m=[];for(p=0;p!==u[h].morphTargets.length;++p){var g=u[h];f.push(g.time),m.push(g.morphTarget===d?1:0)}r.push(new Ho(".morphTargetInfluence["+d+"]",f,m))}o=l.length*(a||1)}else{var v=".bones["+e[c].name+"]";n(jo,v+".position",u,"pos",r),n(Vo,v+".quaternion",u,"rot",r),n(jo,v+".scale",u,"scl",r)}}return 0===r.length?null:new Yo(i,o,r)}}),Object.assign(Yo.prototype,{resetDuration:function(){for(var t=0,e=0,n=this.tracks.length;e!==n;++e){var r=this.tracks[e];t=Math.max(t,r.times[r.times.length-1])}this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(Ko.prototype,{load:function(t,e,n,r){var i=this;new _o(i.manager).load(t,function(t){e(i.parse(JSON.parse(t)))},n,r)},setTextures:function(t){this.textures=t},parse:function(t){var e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var r=new vo[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearCoat&&(r.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(r.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(r.uniforms=t.uniforms),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(r.vertexColors=t.vertexColors),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.shading&&(r.shading=t.shading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap),r.transparent=!0),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalScale){var i=t.normalScale;!1===Array.isArray(i)&&(i=[i,i]),r.normalScale=(new Se).fromArray(i)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),r}}),Object.assign(Zo.prototype,{load:function(t,e,n,r){var i=this;new _o(i.manager).load(t,function(t){e(i.parse(JSON.parse(t)))},n,r)},parse:function(t){var e=new Cr,n=t.data.index;if(void 0!==n){var r=new na[n.type](n.array);e.setIndex(new yr(r,1))}var i=t.data.attributes;for(var o in i){var a=i[o];r=new na[a.type](a.array);e.addAttribute(o,new yr(r,a.itemSize,a.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,u=s.length;c!==u;++c){var l=s[c];e.addGroup(l.start,l.count,l.materialIndex)}var h=t.data.boundingSphere;if(void 0!==h){var p=new Ne;void 0!==h.center&&p.fromArray(h.center),e.boundingSphere=new $n(p,h.radius)}return e}});var Qo,Jo,ta,ea,na={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ra(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function ia(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:xo,this.withCredentials=!1}ra.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,n=0,r=e.length;n<r;n+=2){var i=e[n],o=e[n+1];if(i.test(t))return o}return null}},Object.assign(ra.prototype,{crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,n){for(var r=[],i=0;i<t.length;++i)r[i]=this.createMaterial(t[i],e,n);return r},createMaterial:(Qo={NoBlending:k,NormalBlending:N,AdditiveBlending:D,SubtractiveBlending:z,MultiplyBlending:F,CustomBlending:B},Jo=new En,ta=new So,ea=new Ko,function(t,e,n){var r={};function i(t,i,o,a,s){var c,u=e+t,l=ra.Handlers.get(u);null!==l?c=l.load(u):(ta.setCrossOrigin(n),c=ta.load(u)),void 0!==i&&(c.repeat.fromArray(i),1!==i[0]&&(c.wrapS=At),1!==i[1]&&(c.wrapT=At)),void 0!==o&&c.offset.fromArray(o),void 0!==a&&("repeat"===a[0]&&(c.wrapS=At),"mirror"===a[0]&&(c.wrapS=Mt),"repeat"===a[1]&&(c.wrapT=At),"mirror"===a[1]&&(c.wrapT=Mt)),void 0!==s&&(c.anisotropy=s);var h=we.generateUUID();return r[h]=c,h}var o={uuid:we.generateUUID(),type:"MeshLambertMaterial"};for(var a in t){var s=t[a];switch(a){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":o.name=s;break;case"blending":o.blending=Qo[s];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",a,"is no longer supported.");break;case"colorDiffuse":o.color=Jo.fromArray(s).getHex();break;case"colorSpecular":o.specular=Jo.fromArray(s).getHex();break;case"colorEmissive":o.emissive=Jo.fromArray(s).getHex();break;case"specularCoef":o.shininess=s;break;case"shading":"basic"===s.toLowerCase()&&(o.type="MeshBasicMaterial"),"phong"===s.toLowerCase()&&(o.type="MeshPhongMaterial"),"standard"===s.toLowerCase()&&(o.type="MeshStandardMaterial");break;case"mapDiffuse":o.map=i(s,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":o.emissiveMap=i(s,t.mapEmissiveRepeat,t.mapEmissiveOffset,t.mapEmissiveWrap,t.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":o.lightMap=i(s,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":o.aoMap=i(s,t.mapAORepeat,t.mapAOOffset,t.mapAOWrap,t.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":o.bumpMap=i(s,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy);break;case"mapBumpScale":o.bumpScale=s;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":o.normalMap=i(s,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy);break;case"mapNormalFactor":o.normalScale=[s,s];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":o.specularMap=i(s,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":o.metalnessMap=i(s,t.mapMetalnessRepeat,t.mapMetalnessOffset,t.mapMetalnessWrap,t.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":o.roughnessMap=i(s,t.mapRoughnessRepeat,t.mapRoughnessOffset,t.mapRoughnessWrap,t.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":o.alphaMap=i(s,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":o.side=M;break;case"doubleSided":o.side=T;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),o.opacity=s;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":o[a]=s;break;case"vertexColors":!0===s&&(o.vertexColors=L),"face"===s&&(o.vertexColors=O);break;default:console.error("THREE.Loader.createMaterial: Unsupported",a,s)}}return"MeshBasicMaterial"===o.type&&delete o.emissive,"MeshPhongMaterial"!==o.type&&delete o.specular,o.opacity<1&&(o.transparent=!0),ea.setTextures(r),ea.parse(o)})}),Object.assign(ia.prototype,{load:function(t,e,n,r){var i=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:ra.prototype.extractUrlBase(t),a=new _o(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(n){var r=JSON.parse(n),a=r.metadata;if(void 0!==a){var s=a.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var c=i.parse(r,o);e(c.geometry,c.materials)},n,r)},setTexturePath:function(t){this.texturePath=t},parse:function(){return function(t,e){void 0!==t.data&&(t=t.data),void 0!==t.scale?t.scale=1/t.scale:t.scale=1;var n=new vr;return function(t,e){function n(t,e){return t&1<<e}var r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E,M,T=t.faces,P=t.vertices,I=t.normals,R=t.colors,O=t.scale,L=0;if(void 0!==t.uvs){for(r=0;r<t.uvs.length;r++)t.uvs[r].length&&L++;for(r=0;r<L;r++)e.faceVertexUvs[r]=[]}for(a=0,s=P.length;a<s;)(x=new Ne).x=P[a++]*O,x.y=P[a++]*O,x.z=P[a++]*O,e.vertices.push(x);for(a=0,s=T.length;a<s;)if(d=n(p=T[a++],0),f=n(p,1),m=n(p,3),g=n(p,4),v=n(p,5),y=n(p,6),b=n(p,7),d){if((w=new ar).a=T[a],w.b=T[a+1],w.c=T[a+3],(S=new ar).a=T[a+1],S.b=T[a+2],S.c=T[a+3],a+=4,f&&(h=T[a++],w.materialIndex=h,S.materialIndex=h),o=e.faces.length,m)for(r=0;r<L;r++)for(E=t.uvs[r],e.faceVertexUvs[r][o]=[],e.faceVertexUvs[r][o+1]=[],i=0;i<4;i++)M=new Se(E[2*(l=T[a++])],E[2*l+1]),2!==i&&e.faceVertexUvs[r][o].push(M),0!==i&&e.faceVertexUvs[r][o+1].push(M);if(g&&(u=3*T[a++],w.normal.set(I[u++],I[u++],I[u]),S.normal.copy(w.normal)),v)for(r=0;r<4;r++)u=3*T[a++],A=new Ne(I[u++],I[u++],I[u]),2!==r&&w.vertexNormals.push(A),0!==r&&S.vertexNormals.push(A);if(y&&(C=R[c=T[a++]],w.color.setHex(C),S.color.setHex(C)),b)for(r=0;r<4;r++)C=R[c=T[a++]],2!==r&&w.vertexColors.push(new En(C)),0!==r&&S.vertexColors.push(new En(C));e.faces.push(w),e.faces.push(S)}else{if((_=new ar).a=T[a++],_.b=T[a++],_.c=T[a++],f&&(h=T[a++],_.materialIndex=h),o=e.faces.length,m)for(r=0;r<L;r++)for(E=t.uvs[r],e.faceVertexUvs[r][o]=[],i=0;i<3;i++)M=new Se(E[2*(l=T[a++])],E[2*l+1]),e.faceVertexUvs[r][o].push(M);if(g&&(u=3*T[a++],_.normal.set(I[u++],I[u++],I[u])),v)for(r=0;r<3;r++)u=3*T[a++],A=new Ne(I[u++],I[u++],I[u]),_.vertexNormals.push(A);if(y&&(c=T[a++],_.color.setHex(R[c])),b)for(r=0;r<3;r++)c=T[a++],_.vertexColors.push(new En(R[c]));e.faces.push(_)}}(t,n),function(t,e){var n=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var r=0,i=t.skinWeights.length;r<i;r+=n){var o=t.skinWeights[r],a=n>1?t.skinWeights[r+1]:0,s=n>2?t.skinWeights[r+2]:0,c=n>3?t.skinWeights[r+3]:0;e.skinWeights.push(new Oe(o,a,s,c))}if(t.skinIndices)for(r=0,i=t.skinIndices.length;r<i;r+=n){var u=t.skinIndices[r],l=n>1?t.skinIndices[r+1]:0,h=n>2?t.skinIndices[r+2]:0,p=n>3?t.skinIndices[r+3]:0;e.skinIndices.push(new Oe(u,l,h,p))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}(t,n),function(t,e){var n=t.scale;if(void 0!==t.morphTargets)for(var r=0,i=t.morphTargets.length;r<i;r++){e.morphTargets[r]={},e.morphTargets[r].name=t.morphTargets[r].name,e.morphTargets[r].vertices=[];for(var o=e.morphTargets[r].vertices,a=t.morphTargets[r].vertices,s=0,c=a.length;s<c;s+=3){var u=new Ne;u.x=a[s]*n,u.y=a[s+1]*n,u.z=a[s+2]*n,o.push(u)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var l=e.faces,h=t.morphColors[0].colors;for(r=0,i=l.length;r<i;r++)l[r].color.fromArray(h,3*r)}}(t,n),function(t,e){var n=[],r=[];void 0!==t.animation&&r.push(t.animation),void 0!==t.animations&&(t.animations.length?r=r.concat(t.animations):r.push(t.animations));for(var i=0;i<r.length;i++){var o=Yo.parseAnimation(r[i],e.bones);o&&n.push(o)}if(e.morphTargets){var a=Yo.CreateClipsFromMorphTargetSequences(e.morphTargets,10);n=n.concat(a)}n.length>0&&(e.animations=n)}(t,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:n}:{geometry:n,materials:ra.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}()}),Object.assign(function(t){this.manager=void 0!==t?t:xo,this.texturePath=""}.prototype,{load:function(t,e,n,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this;new _o(i.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?i.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.")},n,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),r=this.parseImages(t.images,function(){void 0!==e&&e(a)}),i=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,i),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new ia,r=new Zo,i=0,o=t.length;i<o;i++){var a,s=t[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new ao[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new ao[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new ao[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new ao[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new ao[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new ao[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":a=new ao[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new ao[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new ao[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new ao[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new ao[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=r.parse(s);break;case"Geometry":a=n.parse(s,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var n={};if(void 0!==t){var r=new Ko;r.setTextures(e);for(var i=0,o=t.length;i<o;i++){var a=t[i];if("MultiMaterial"===a.type){for(var s=[],c=0;c<a.materials.length;c++)s.push(r.parse(a.materials[c]));n[a.uuid]=s}else n[a.uuid]=r.parse(a)}}return n},parseAnimations:function(t){for(var e=[],n=0;n<t.length;n++){var r=Yo.parse(t[n]);e.push(r)}return e},parseImages:function(t,e){var n=this,r={};function i(t){return n.manager.itemStart(t),o.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemEnd(t),n.manager.itemError(t)})}if(void 0!==t&&t.length>0){var o=new wo(new bo(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a<s;a++){var c=t[a],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.texturePath+c.url;r[c.uuid]=i(u)}}return r},parseTextures:function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var r={};if(void 0!==t)for(var i=0,o=t.length;i<o;i++){var a=t[i];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new Re(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=n(a.mapping,oa)),void 0!==a.offset&&s.offset.fromArray(a.offset),void 0!==a.repeat&&s.repeat.fromArray(a.repeat),void 0!==a.wrap&&(s.wrapS=n(a.wrap[0],aa),s.wrapT=n(a.wrap[1],aa)),void 0!==a.minFilter&&(s.minFilter=n(a.minFilter,sa)),void 0!==a.magFilter&&(s.magFilter=n(a.magFilter,sa)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),void 0!==a.flipY&&(s.flipY=a.flipY),r[a.uuid]=s}return r},parseObject:function(){var t=new De;return function(e,n,r){var i;function o(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),n[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],n=0,i=t.length;n<i;n++){var o=t[n];void 0===r[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),e.push(r[o])}return e}return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),r[t]}}switch(e.type){case"Scene":i=new ii,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new En(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new ri(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new ni(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new or(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new ir(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":i=new Oo(e.color,e.intensity);break;case"DirectionalLight":i=new Ro(e.color,e.intensity);break;case"PointLight":i=new Po(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new Lo(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new To(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new Ao(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var s=o(e.geometry),c=a(e.material);i=s.bones&&s.bones.length>0?new hi(s,c):new Lr(s,c);break;case"LOD":i=new ci;break;case"Line":i=new di(o(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new mi(o(e.geometry),a(e.material));break;case"LineSegments":i=new fi(o(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new vi(o(e.geometry),a(e.material));break;case"Sprite":i=new si(a(e.material));break;case"Group":i=new yi;break;default:i=new nr}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.children)for(var u in e.children)i.add(this.parseObject(e.children[u],n,r));if("LOD"===e.type)for(var l=e.levels,h=0;h<l.length;h++){var p=l[h];void 0!==(u=i.getObjectByProperty("uuid",p.object))&&i.addLevel(u,p.distance)}return i}}()});var oa={UVMapping:300,CubeReflectionMapping:yt,CubeRefractionMapping:bt,EquirectangularReflectionMapping:xt,EquirectangularRefractionMapping:_t,SphericalReflectionMapping:wt,CubeUVReflectionMapping:St,CubeUVRefractionMapping:Ct},aa={RepeatWrapping:At,ClampToEdgeWrapping:Et,MirroredRepeatWrapping:Mt},sa={NearestFilter:Tt,NearestMipMapNearestFilter:Pt,NearestMipMapLinearFilter:It,LinearFilter:Rt,LinearMipMapNearestFilter:Ot,LinearMipMapLinearFilter:Lt};function ca(t,e,n,r,i){var o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function ua(t,e,n,r){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function la(t,e,n,r,i){return function(t,e){var n=1-t;return n*n*n*e}(t,e)+function(t,e){var n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}function ha(){this.arcLengthDivisions=200}function pa(t,e){ha.call(this),this.v1=t,this.v2=e}function da(){ha.call(this),this.curves=[],this.autoClose=!1}function fa(t,e,n,r,i,o,a,s){ha.call(this),this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function ma(t){ha.call(this),this.points=void 0===t?[]:t}function ga(t,e,n,r){ha.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=r}function va(t,e,n){ha.call(this),this.v0=t,this.v1=e,this.v2=n}Object.assign(ha.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,r=[],i=this.getPoint(0),o=0;for(r.push(0),n=1;n<=t;n++)o+=(e=this.getPoint(n/t)).distanceTo(i),r.push(o),i=e;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,r=this.getLengths(),i=0,o=r.length;n=e||t*r[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=r[i=Math.floor(s+(c-s)/2)]-n)<0)s=i+1;else{if(!(a>0)){c=i;break}c=i-1}if(r[i=c]===n)return i/(o-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var r=this.getPoint(e);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,i,o=new Ne,a=[],s=[],c=[],u=new Ne,l=new De;for(n=0;n<=t;n++)r=n/t,a[n]=this.getTangentAt(r),a[n].normalize();s[0]=new Ne,c[0]=new Ne;var h=Number.MAX_VALUE,p=Math.abs(a[0].x),d=Math.abs(a[0].y),f=Math.abs(a[0].z);for(p<=h&&(h=p,o.set(1,0,0)),d<=h&&(h=d,o.set(0,1,0)),f<=h&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),i=Math.acos(we.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(l.makeRotationAxis(u,i))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(i=Math.acos(we.clamp(s[0].dot(s[t]),-1,1)),i/=t,a[0].dot(u.crossVectors(s[0],s[t]))>0&&(i=-i),n=1;n<=t;n++)s[n].applyMatrix4(l.makeRotationAxis(a[n],i*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}}}),pa.prototype=Object.create(ha.prototype),pa.prototype.constructor=pa,pa.prototype.isLineCurve=!0,pa.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},pa.prototype.getPointAt=function(t){return this.getPoint(t)},pa.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},da.prototype=Object.assign(Object.create(ha.prototype),{constructor:da,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new pa(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=e){var i=n[r]-e,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,n=[],r=0,i=this.curves;r<i.length;r++)for(var o=i[r],a=o&&o.isEllipseCurve?2*t:o&&o.isLineCurve?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a),c=0;c<s.length;c++){var u=s[c];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new vr,n=0,r=t.length;n<r;n++){var i=t[n];e.vertices.push(new Ne(i.x,i.y,i.z||0))}return e}}),fa.prototype=Object.create(ha.prototype),fa.prototype.constructor=fa,fa.prototype.isEllipseCurve=!0,fa.prototype.getPoint=function(t){for(var e=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;n<0;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(n=r?0:e),!0!==this.aClockwise||r||(n===e?n=-e:n-=e);var i=this.aStartAngle+t*n,o=this.aX+this.xRadius*Math.cos(i),a=this.aY+this.yRadius*Math.sin(i);if(0!==this.aRotation){var s=Math.cos(this.aRotation),c=Math.sin(this.aRotation),u=o-this.aX,l=a-this.aY;o=u*s-l*c+this.aX,a=u*c+l*s+this.aY}return new Se(o,a)},ma.prototype=Object.create(ha.prototype),ma.prototype.constructor=ma,ma.prototype.isSplineCurve=!0,ma.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,r=Math.floor(n),i=n-r,o=e[0===r?r:r-1],a=e[r],s=e[r>e.length-2?e.length-1:r+1],c=e[r>e.length-3?e.length-1:r+2];return new Se(ca(i,o.x,a.x,s.x,c.x),ca(i,o.y,a.y,s.y,c.y))},ga.prototype=Object.create(ha.prototype),ga.prototype.constructor=ga,ga.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2,i=this.v3;return new Se(la(t,e.x,n.x,r.x,i.x),la(t,e.y,n.y,r.y,i.y))},va.prototype=Object.create(ha.prototype),va.prototype.constructor=va,va.prototype.getPoint=function(t){var e=this.v0,n=this.v1,r=this.v2;return new Se(ua(t,e.x,n.x,r.x),ua(t,e.y,n.y,r.y))};var ya,ba=Object.assign(Object.create(da.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var n=new pa(this.currentPoint.clone(),new Se(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,r){var i=new va(this.currentPoint.clone(),new Se(t,e),new Se(n,r));this.curves.push(i),this.currentPoint.set(n,r)},bezierCurveTo:function(t,e,n,r,i,o){var a=new ga(this.currentPoint.clone(),new Se(t,e),new Se(n,r),new Se(i,o));this.curves.push(a),this.currentPoint.set(i,o)},splineThru:function(t){var e=new ma([this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,n,r,i,o){var a=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+a,e+s,n,r,i,o)},absarc:function(t,e,n,r,i,o){this.absellipse(t,e,n,n,r,i,o)},ellipse:function(t,e,n,r,i,o,a,s){var c=this.currentPoint.x,u=this.currentPoint.y;this.absellipse(t+c,e+u,n,r,i,o,a,s)},absellipse:function(t,e,n,r,i,o,a,s){var c=new fa(t,e,n,r,i,o,a,s);if(this.curves.length>0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)}});function xa(t){da.call(this),this.currentPoint=new Se,t&&this.fromPoints(t)}function _a(){xa.apply(this,arguments),this.holes=[]}function wa(){this.subPaths=[],this.currentPath=null}function Sa(t){this.data=t}xa.prototype=ba,ba.constructor=xa,_a.prototype=Object.assign(Object.create(ba),{constructor:_a,getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),Object.assign(wa.prototype,{moveTo:function(t,e){this.currentPath=new xa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,n,r){this.currentPath.quadraticCurveTo(t,e,n,r)},bezierCurveTo:function(t,e,n,r,i,o){this.currentPath.bezierCurveTo(t,e,n,r,i,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function n(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n],o=new _a;o.curves=i.curves,e.push(o)}return e}function r(t,e){for(var n=e.length,r=!1,i=n-1,o=0;o<n;i=o++){var a=e[i],s=e[o],c=s.x-a.x,u=s.y-a.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(a=e[o],c=-c,s=e[i],u=-u),t.y<a.y||t.y>s.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var l=u*(t.x-a.x)-c*(t.y-a.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return r}var i=Ui.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,c,u=[];if(1===o.length)return s=o[0],(c=new _a).curves=s.curves,u.push(c),u;var l=!i(o[0].getPoints());l=t?!l:l;var h,p,d=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v<y;v++)a=i(h=(s=o[v]).getPoints()),(a=t?!a:a)?(!l&&f[g]&&g++,f[g]={s:new _a,p:h},f[g].s.curves=s.curves,l&&g++,m[g]=[]):m[g].push({h:s,p:h[0]});if(!f[0])return n(o);if(f.length>1){for(var b=!1,x=[],_=0,w=f.length;_<w;_++)d[_]=[];for(_=0,w=f.length;_<w;_++)for(var S=m[_],C=0;C<S.length;C++){for(var A=S[C],E=!0,M=0;M<f.length;M++)r(A.p,f[M].p)&&(_!==M&&x.push({froms:_,tos:M,hole:C}),E?(E=!1,d[M].push(A)):b=!0);E&&d[_].push(A)}x.length>0&&(b||(m=d))}v=0;for(var T=f.length;v<T;v++){c=f[v].s,u.push(c);for(var P=0,I=(p=m[v]).length;P<I;P++)c.holes.push(p[P].h)}return u}}),Object.assign(Sa.prototype,{isFont:!0,generateShapes:function(t,e,n){function r(t,e,r,o){var a=i.glyphs[t]||i.glyphs["?"];if(a){var s,c,u,l,h,p,d,f,m,g,v,y=new wa,b=[];if(a.o)for(var x=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),_=0,w=x.length;_<w;){switch(x[_++]){case"m":s=x[_++]*e+r,c=x[_++]*e+o,y.moveTo(s,c);break;case"l":s=x[_++]*e+r,c=x[_++]*e+o,y.lineTo(s,c);break;case"q":if(u=x[_++]*e+r,l=x[_++]*e+o,d=x[_++]*e+r,f=x[_++]*e+o,y.quadraticCurveTo(d,f,u,l),v=b[b.length-1]){h=v.x,p=v.y;for(var S=1;S<=n;S++){ua(C=S/n,h,d,u),ua(C,p,f,l)}}break;case"b":if(u=x[_++]*e+r,l=x[_++]*e+o,d=x[_++]*e+r,f=x[_++]*e+o,m=x[_++]*e+r,g=x[_++]*e+o,y.bezierCurveTo(d,f,m,g,u,l),v=b[b.length-1]){h=v.x,p=v.y;for(S=1;S<=n;S++){var C;la(C=S/n,h,d,m,u),la(C,p,f,g,l)}}}}return{offsetX:a.ha*e,path:y}}}void 0===e&&(e=100),void 0===n&&(n=4);for(var i=this.data,o=function(t){for(var n=String(t).split(""),o=e/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*o,s=0,c=0,u=[],l=0;l<n.length;l++){var h=n[l];if("\n"===h)s=0,c-=a;else{var p=r(h,o,s,c);s+=p.offsetX,u.push(p.path)}}return u}(t),a=[],s=0,c=o.length;s<c;s++)Array.prototype.push.apply(a,o[s].toShapes());return a}}),Object.assign(function(t){this.manager=void 0!==t?t:xo}.prototype,{load:function(t,e,n,r){var i=this;new _o(this.manager).load(t,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var r=i.parse(n);e&&e(r)},n,r)},parse:function(t){return new Sa(t)}});var Ca,Aa,Ea,Ma,Ta,Pa,Ia,Ra,Oa,La,ka,Na,Da,za,Fa,Ba,Ua={getContext:function(){return void 0===ya&&(ya=new(window.AudioContext||window.webkitAudioContext)),ya},setContext:function(t){ya=t}};function ja(t){this.manager=void 0!==t?t:xo}function Ga(){nr.call(this),this.type="AudioListener",this.context=Ua.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Va(t){nr.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Ha(t){Va.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function $a(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Wa(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function qa(t,e,n){var r=n||Xa.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Xa(t,e,n){this.path=e,this.parsedPath=n||Xa.parseTrackName(e),this.node=Xa.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Ya(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),a={endingStart:ue,endingEnd:ue},s=0;s!==i;++s){var c=r[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ce,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Ka(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Za(){Cr.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Qa(t,e,n,r){this.uuid=we.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function Ja(t,e){this.uuid=we.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function ts(t,e,n){Ja.call(this,t,e),this.meshPerAttribute=n||1}function es(t,e,n){yr.call(this,t,e),this.meshPerAttribute=n||1}function ns(t,e){return t.distance-e.distance}function rs(t,e,n,r){if(!1!==t.visible&&(t.raycast(e,n),!0===r))for(var i=t.children,o=0,a=i.length;o<a;o++)rs(i[o],e,n,!0)}function is(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16711680,o=void 0!==r?r:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count);var c=new Cr,u=new _r(2*a*3,3);c.addAttribute("position",u),fi.call(this,c,new pi({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function os(t){for(var e=function t(e){var n=[];e&&e.isBone&&n.push(e);for(var r=0;r<e.children.length;r++)n.push.apply(n,t(e.children[r]));return n}(t),n=new Cr,r=[],i=[],o=new En(0,0,1),a=new En(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(o.r,o.g,o.b),i.push(a.r,a.g,a.b))}n.addAttribute("position",new _r(r,3)),n.addAttribute("color",new _r(i,3));var u=new pi({vertexColors:L,depthTest:!1,depthWrite:!1,transparent:!0});fi.call(this,n,u),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.onBeforeRender()}function as(t,e){nr.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var n=new Pi(e);n.rotateY(.5*Math.PI);var r=new Pr({vertexColors:L,wireframe:!0}),i=n.getAttribute("position"),o=new Float32Array(3*i.count);n.addAttribute("color",new yr(o,3)),this.add(new Lr(n,r)),this.update()}function ss(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16776960,o=void 0!==r?r:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Cr,u=new _r(2*a*3,3);c.addAttribute("position",u),fi.call(this,c,new pi({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function cs(t){var e=new Cr,n=new pi({color:16777215,vertexColors:O}),r=[],i=[],o={},a=new En(16755200),s=new En(16711680),c=new En(43775),u=new En(16777215),l=new En(3355443);function h(t,e,n){p(t,n),p(e,n)}function p(t,e){r.push(0,0,0),i.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(r.length/3-1)}h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",u),h("p","c",l),h("cn1","cn2",l),h("cn3","cn4",l),h("cf1","cf2",l),h("cf3","cf4",l),e.addAttribute("position",new _r(r,3)),e.addAttribute("color",new _r(i,3)),fi.call(this,e,n),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}function us(){var t=0,e=0,n=0,r=0;function i(i,o,a,s){t=i,e=a,n=-3*i+3*o-2*a-s,r=2*i-2*o+a+s}return{initCatmullRom:function(t,e,n,r,o){i(e,n,o*(n-t),o*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,o,a,s){var c=(e-t)/o-(n-t)/(o+a)+(n-e)/a,u=(n-e)/a-(r-e)/(a+s)+(r-n)/s;i(e,n,c*=a,u*=a)},calc:function(i){var o=i*i;return t+e*i+n*o+r*(o*i)}}}Object.assign(ja.prototype,{load:function(t,e,n,r){var i=new _o(this.manager);i.setResponseType("arraybuffer"),i.load(t,function(t){Ua.getContext().decodeAudioData(t,function(t){e(t)})},n,r)}}),Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new or,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new or,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}.prototype,{update:(Oa=new De,La=new De,function(t){if(Ca!==this||Aa!==t.focus||Ea!==t.fov||Ma!==t.aspect*this.aspect||Ta!==t.near||Pa!==t.far||Ia!==t.zoom||Ra!==this.eyeSep){Ca=this,Aa=t.focus,Ea=t.fov,Ma=t.aspect*this.aspect,Ta=t.near,Pa=t.far,Ia=t.zoom;var e,n,r=t.projectionMatrix.clone(),i=(Ra=this.eyeSep/2)*Ta/Aa,o=Ta*Math.tan(we.DEG2RAD*Ea*.5)/Ia;La.elements[12]=-Ra,Oa.elements[12]=Ra,e=-o*Ma+i,n=o*Ma+i,r.elements[0]=2*Ta/(n-e),r.elements[8]=(n+e)/(n-e),this.cameraL.projectionMatrix.copy(r),e=-o*Ma-i,n=o*Ma-i,r.elements[0]=2*Ta/(n-e),r.elements[8]=(n+e)/(n-e),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(La),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Oa)})}),Ga.prototype=Object.assign(Object.create(nr.prototype),{constructor:Ga,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new Ne,e=new ke,n=new Ne,r=new Ne;return function(i){nr.prototype.updateMatrixWorld.call(this,i);var o=this.context.listener,a=this.up;this.matrixWorld.decompose(t,e,n),r.set(0,0,-1).applyQuaternion(e),o.positionX?(o.positionX.setValueAtTime(t.x,this.context.currentTime),o.positionY.setValueAtTime(t.y,this.context.currentTime),o.positionZ.setValueAtTime(t.z,this.context.currentTime),o.forwardX.setValueAtTime(r.x,this.context.currentTime),o.forwardY.setValueAtTime(r.y,this.context.currentTime),o.forwardZ.setValueAtTime(r.z,this.context.currentTime),o.upX.setValueAtTime(a.x,this.context.currentTime),o.upY.setValueAtTime(a.y,this.context.currentTime),o.upZ.setValueAtTime(a.z,this.context.currentTime)):(o.setPosition(t.x,t.y,t.z),o.setOrientation(r.x,r.y,r.z,a.x,a.y,a.z))}}()}),Va.prototype=Object.assign(Object.create(nr.prototype),{constructor:Va,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),Ha.prototype=Object.assign(Object.create(Va.prototype),{constructor:Ha,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:(ka=new Ne,function(t){nr.prototype.updateMatrixWorld.call(this,t),ka.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(ka.x,ka.y,ka.z)})}),Object.assign($a.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length}}),Object.assign(Wa.prototype,{accumulate:function(t,e){var n=this.buffer,r=this.valueSize,i=t*r+r,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==r;++a)n[i+a]=n[a];o=e}else{var s=e/(o+=e);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,i<1){var a=3*e;this._mixBufferRegion(n,r,a,1-i,e)}for(var s=e,c=e+e;s!==c;++s)if(n[s]!==n[s+e]){o.setValue(n,r);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,n=this.valueSize,r=3*n;t.getValue(e,r);for(var i=n,o=r;i!==o;++i)e[i]=e[r+i%n];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,n,r,i){if(r>=.5)for(var o=0;o!==i;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,r){ke.slerpFlat(t,e,t,e,t,n,r)},_lerp:function(t,e,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*r}}}),Object.assign(qa.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Xa,{Composite:qa,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Xa.Composite(t,e,n):new Xa(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:(Na=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),Da=["material","materials","bones"],function(t){var e=Na.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==Da.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=function(t){for(var n=0;n<t.bones.length;n++){var r=t.bones[n];if(r.name===e)return r}return null}(t.skeleton);if(n)return n}if(t.children){var r=function(t){for(var n=0;n<t.length;n++){var i=t[n];if(i.name===e||i.uuid===e)return i;var o=r(i.children);if(o)return o}return null},i=r(t.children);if(i)return i}return null}}),Object.assign(Xa.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)t[e++]=n[r]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,i=e.propertyIndex;if(t||(t=Xa.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(n){var o=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var a=0;a<t.length;a++)if(t[a].name===o){o=a;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var s=t[r];if(void 0!==s){var c=this.Versioning.None;void 0!==t.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var u=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(a=0;a<this.node.geometry.morphAttributes.position.length;a++)if(t.geometry.morphAttributes.position[a].name===i){i=a;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(a=0;a<this.node.geometry.morphTargets.length;a++)if(t.geometry.morphTargets[a].name===i){i=a;break}}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}else{var l=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+r+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Xa.prototype,{_getValue_unbound:Xa.prototype.getValue,_setValue_unbound:Xa.prototype.setValue}),Object.assign(function(t){var e=arguments;this.uuid=we.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var n={};this._indicesByUUID=n;for(var r=0,i=arguments.length;r!==i;++r)n[e[r].uuid]=r;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}}}.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=arguments,n=this._objects,r=n.length,i=this.nCachedObjects_,o=this._indicesByUUID,a=this._paths,s=this._parsedPaths,c=this._bindings,u=c.length,l=0,h=arguments.length;l!==h;++l){var p=e[l],d=p.uuid,f=o[d],m=void 0;if(void 0===f){f=r++,o[d]=f,n.push(p);for(var g=0,v=u;g!==v;++g)c[g].push(new Xa(p,a[g],s[g]))}else if(f<i){m=n[f];var y=--i,b=n[y];o[b.uuid]=f,n[f]=b,o[d]=y,n[y]=p;for(g=0,v=u;g!==v;++g){var x=c[g],_=x[y],w=x[f];x[f]=_,void 0===w&&(w=new Xa(p,a[g],s[g])),x[y]=w}}else n[f]!==m&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=i},remove:function(t){for(var e=arguments,n=this._objects,r=this.nCachedObjects_,i=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var u=e[s],l=u.uuid,h=i[l];if(void 0!==h&&h>=r){var p=r++,d=n[p];i[d.uuid]=h,n[h]=d,i[l]=p,n[p]=u;for(var f=0,m=a;f!==m;++f){var g=o[f],v=g[p],y=g[h];g[h]=v,g[p]=y}}}this.nCachedObjects_=r},uncache:function(t){for(var e=arguments,n=this._objects,r=n.length,i=this.nCachedObjects_,o=this._indicesByUUID,a=this._bindings,s=a.length,c=0,u=arguments.length;c!==u;++c){var l=e[c].uuid,h=o[l];if(void 0!==h)if(delete o[l],h<i){var p=--i,d=n[p],f=n[b=--r];o[d.uuid]=h,n[h]=d,o[f.uuid]=p,n[p]=f,n.pop();for(var m=0,g=s;m!==g;++m){var v=(x=a[m])[p],y=x[b];x[h]=v,x[p]=y,x.pop()}}else{var b;o[(f=n[b=--r]).uuid]=h,n[h]=f,n.pop();for(m=0,g=s;m!==g;++m){var x;(x=a[m])[h]=x[b],x.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,r=n[t],i=this._bindings;if(void 0!==r)return i[r];var o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,l=new Array(c);r=i.length,n[t]=r,o.push(t),a.push(e),i.push(l);for(var h=u,p=s.length;h!==p;++h){var d=s[h];l[h]=new Xa(d,t,e)}return l},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var r=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),i[n]=i[a],i.pop(),r[n]=r[a],r.pop()}}}),Object.assign(Ya.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var r=this._clip.duration,i=t._clip.duration,o=i/r,a=r/i;t.warp(1,o,e),this.warp(a,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,n){var r=this._mixer,i=r.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=i,s[1]=i+n,c[0]=t/a,c[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var o=(t-i)*n;if(o<0||0===n)return;this._startTime=null,e=n*o}e*=this._updateTimeScale(t);var a=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,u=this._propertyBindings,l=0,h=c.length;l!==h;++l)c[l].evaluate(a),u[l].accumulate(r,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(2200===r){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=2202===r;if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&i))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=t?this.zeroSlopeAtStart?2401:ue:2402,r.endingEnd=e?this.zeroSlopeAtEnd?2401:ue:2402)},_scheduleFading:function(t,e,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}}),Object.assign(function(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}.prototype,y.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var l=0;l!==i;++l){var h=r[l],p=h.name,d=u[p];if(void 0!==d)o[l]=d;else{if(void 0!==(d=o[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;++(d=new Wa(Xa.create(n,p,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[l]=d}a[l].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var r=this._actions,i=this._actionsByClip,o=i[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=o;else{var a=o.knownActions;t._byClipCacheIndex=a.length,a.push(t)}t._cacheIndex=r.length,r.push(t),o.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,o=this._actionsByClip,a=o[i],s=a.knownActions,c=s[s.length-1],u=t._byClipCacheIndex;c._byClipCacheIndex=u,s[u]=c,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[i],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_addInactiveBinding:function(t,e,n){var r=this._bindingsByRootAndName,i=r[e],o=this._bindings;void 0===i&&(i={},r[e]=i),i[n]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,a=o[r],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete a[i];t:{for(var u in a)break t;delete o[r]}},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new Fo(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?Yo.findByName(n,t):t,o=null!==i?i.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[r];if(void 0!==c)return c;s=a.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var u=new Ya(this,i,e);return this._bindAction(u,s),this._addInactiveAction(u,o,r),u},existingAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?Yo.findByName(n,t):t,o=i?i.uuid:t,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[r]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==e;++i)t[i].reset();for(i=0;i!==r;++i)n[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a){e[a]._update(r,t,i,o)}var s=this._bindings,c=this._nActiveBindings;for(a=0;a!==c;++a)s[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var o=i.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var u=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=u,e[u]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var o=this._bindingsByRootAndName[e];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),Ka.prototype.clone=function(){return new Ka(void 0===this.value.clone?this.value:this.value.clone())},Za.prototype=Object.assign(Object.create(Cr.prototype),{constructor:Za,isInstancedBufferGeometry:!0,addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:n})},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var r in n){var i=n[r];this.addAttribute(r,i.clone())}for(var o=t.groups,a=0,s=o.length;a<s;a++){var c=o[a];this.addGroup(c.start,c.count,c.materialIndex)}return this}}),Object.defineProperties(Qa.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Qa.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}}),Object.defineProperty(Ja.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Ja.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),ts.prototype=Object.assign(Object.create(Ja.prototype),{constructor:ts,isInstancedInterleavedBuffer:!0,copy:function(t){return Ja.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),es.prototype=Object.assign(Object.create(yr.prototype),{constructor:es,isInstancedBufferAttribute:!0,copy:function(t){return yr.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(function(t,e,n,r){this.ray=new Ir(t,e),this.near=n||0,this.far=r||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}}})}.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var n=[];return rs(t,this,n,e),n.sort(ns),n},intersectObjects:function(t,e){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var r=0,i=t.length;r<i;r++)rs(t[r],this,n,e);return n.sort(ns),n}}),Object.assign(function(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(function(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}.prototype,{set:function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(we.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(function(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}.prototype,{set:function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),is.prototype=Object.create(fi.prototype),is.prototype.constructor=is,is.prototype.update=function(){var t=new Ne,e=new Ne,n=new Wn;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,u=0,l=0,h=c.length;l<h;l++)for(var p=c[l],d=0,f=p.vertexNormals.length;d<f;d++){var m=s[p[r[d]]],g=p.vertexNormals[d];t.copy(m).applyMatrix4(i),e.copy(g).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(u,t.x,t.y,t.z),u+=1,o.setXYZ(u,e.x,e.y,e.z),u+=1}else if(a&&a.isBufferGeometry){var v=a.attributes.position,y=a.attributes.normal;for(u=0,d=0,f=v.count;d<f;d++)t.set(v.getX(d),v.getY(d),v.getZ(d)).applyMatrix4(i),e.set(y.getX(d),y.getY(d),y.getZ(d)),e.applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(u,t.x,t.y,t.z),u+=1,o.setXYZ(u,e.x,e.y,e.z),u+=1}o.needsUpdate=!0}}(),os.prototype=Object.create(fi.prototype),os.prototype.constructor=os,os.prototype.onBeforeRender=(za=new Ne,Fa=new De,Ba=new De,function(){var t=this.bones,e=this.geometry,n=e.getAttribute("position");Ba.getInverse(this.root.matrixWorld);for(var r=0,i=0;r<t.length;r++){var o=t[r];o.parent&&o.parent.isBone&&(Fa.multiplyMatrices(Ba,o.matrixWorld),za.setFromMatrixPosition(Fa),n.setXYZ(i,za.x,za.y,za.z),Fa.multiplyMatrices(Ba,o.parent.matrixWorld),za.setFromMatrixPosition(Fa),n.setXYZ(i+1,za.x,za.y,za.z),i+=2)}e.getAttribute("position").needsUpdate=!0}),as.prototype=Object.create(nr.prototype),as.prototype.constructor=as,as.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},as.prototype.update=function(){var t=new Ne,e=new En,n=new En;return function(){var r=this.children[0],i=r.geometry.getAttribute("color");e.copy(this.light.color),n.copy(this.light.groundColor);for(var o=0,a=i.count;o<a;o++){var s=o<a/2?e:n;i.setXYZ(o,s.r,s.g,s.b)}r.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),i.needsUpdate=!0}}(),ss.prototype=Object.create(fi.prototype),ss.prototype.constructor=ss,ss.prototype.update=function(){var t=new Ne,e=new Ne,n=new Wn;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,a=o.vertices,s=o.faces,c=0,u=0,l=s.length;u<l;u++){var h=s[u],p=h.normal;t.copy(a[h.a]).add(a[h.b]).add(a[h.c]).divideScalar(3).applyMatrix4(r),e.copy(p).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),i.setXYZ(c,t.x,t.y,t.z),c+=1,i.setXYZ(c,e.x,e.y,e.z),c+=1}i.needsUpdate=!0}}(),cs.prototype=Object.create(fi.prototype),cs.prototype.constructor=cs,cs.prototype.update=function(){var t,e,n=new Ne,r=new rr;function i(i,o,a,s){n.set(o,a,s).unproject(r);var c=e[i];if(void 0!==c)for(var u=t.getAttribute("position"),l=0,h=c.length;l<h;l++)u.setXYZ(c[l],n.x,n.y,n.z)}return function(){t=this.geometry,e=this.pointMap;r.projectionMatrix.copy(this.camera.projectionMatrix),i("c",0,0,-1),i("t",0,0,1),i("n1",-1,-1,-1),i("n2",1,-1,-1),i("n3",-1,1,-1),i("n4",1,1,-1),i("f1",-1,-1,1),i("f2",1,-1,1),i("f3",-1,1,1),i("f4",1,1,1),i("u1",.7,1.1,-1),i("u2",-.7,1.1,-1),i("u3",0,2,-1),i("cf1",-1,0,1),i("cf2",1,0,1),i("cf3",0,-1,1),i("cf4",0,1,1),i("cn1",-1,0,-1),i("cn2",1,0,-1),i("cn3",0,-1,-1),i("cn4",0,1,-1),t.getAttribute("position").needsUpdate=!0}}();var ls=new Ne,hs=new us,ps=new us,ds=new us;function fs(t){ha.call(this),t.length<2&&console.warn("THREE.CatmullRomCurve3: Points array needs at least two entries."),this.points=t||[],this.closed=!1}function ms(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),fs.call(this,t),this.type="catmullrom"}function gs(t,e){return void 0!==t?t:e}function vs(){var t=window.location.protocol;return null===t.match(/http(s)?:/gi)?"http:":t}function ys(){if("undefined"==typeof window)return!1;var t=window.navigator.userAgent;return/Opera|OPR/.test(t)?"Opera":/Chrome/i.test(t)?"Chrome":/Firefox/i.test(t)?"Firefox":/Mobile(\/.*)? Safari/i.test(t)?"Mobile Safari":/MSIE/i.test(t)?"Internet Explorer":!!/Safari/i.test(t)&&"Safari"}function bs(t){var e,n,r,i=(e="undefined"!=typeof window&&t instanceof window.File||"undefined"!=typeof window&&t instanceof window.Blob?t.name||"":t).lastIndexOf("?"),o=(e=e.substring(0,-1===i?e.length:i)).replace(/^.*[\\/]/,""),a=o.substring(0,o.lastIndexOf(".")),s=o.split("."),c=s.length>1?s.pop().toLowerCase():"",u=e.match(/^(.+):\/\/(.+)$/);u&&(r=u[1].toLowerCase(),e=u[2]);var l=e.substring(0,e.lastIndexOf("/")+1);if(["gz"].includes(c)){n=c;var h=e.length-c.length-1;c=e.substr(0,h).split(".").pop().toLowerCase();var p=a.length-c.length-1;a=a.substr(0,p)}else n=!1;return{path:e,name:o,ext:c,base:a,dir:l,compressed:n,protocol:r,src:t}}function xs(t,e){return t<e?-1:t>e?1:0}function _s(t,e,n){void 0===n&&(n=xs);for(var r=0,i=t.length-1;r<=i;){var o=r+i>>1,a=n(e,t[o]);if(a>0)r=o+1;else{if(!(a<0))return o;i=o-1}}return-r-1}function ws(t,e,n){var r=function(t,e){var n=t.length-1;if(t[n]<e)return-1;for(var r=0;r<=n;){var i=r+n>>1;t[i]>=e?n=i-1:r=i+1}return n+1}(t,e),i=function(t,e){if(t[0]>e)return-1;for(var n=0,r=t.length-1;n<=r;){var i=n+r>>1;t[i]>e?r=i-1:n=i+1}return n-1}(t,n);return-1===r||-1===i||r>i?0:i-r+1}function Ss(t){return t.sort().filter(function(t,e,n){return 0===e||t!==n[e-1]})}function Cs(t){if(t.length>28672){for(var e=[],n=0;n<t.length;n+=28672)e.push(String.fromCharCode.apply(null,t.subarray(n,n+28672)));return e.join("")}return String.fromCharCode.apply(null,t)}function As(t,e){switch(t){case"int8":return new Int8Array(e);case"int16":return new Int16Array(e);case"int32":return new Int32Array(e);case"uint8":return new Uint8Array(e);case"uint16":return new Uint16Array(e);case"uint32":return new Uint32Array(e);case"float32":return new Float32Array(e);default:throw new Error("arrayType unknown: "+t)}}function Es(t,e){return new(e>65535?Uint32Array:Uint16Array)(t)}function Ms(t,e){return void 0===t?t=new e:Array.isArray(t)&&(t=(new e).fromArray(t)),t}function Ts(t){return Ms(t,Ne)}function Ps(t){return Ms(t,De)}function Is(t){return Ms(t,ke)}function Rs(t){return e=t,n=Float32Array,e instanceof n?e:new n(e);var e,n}function Os(t){return gs(t,"").toString().toLowerCase()}fs.prototype=Object.create(ha.prototype),fs.prototype.constructor=fs,fs.prototype.getPoint=function(t){var e,n,r,i,o=this.points,a=o.length,s=(a-(this.closed?0:1))*t,c=Math.floor(s),u=s-c;if(this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/o.length)+1)*o.length:0===u&&c===a-1&&(c=a-2,u=1),this.closed||c>0?e=o[(c-1)%a]:(ls.subVectors(o[0],o[1]).add(o[0]),e=ls),n=o[c%a],r=o[(c+1)%a],this.closed||c+2<a?i=o[(c+2)%a]:(ls.subVectors(o[a-1],o[a-2]).add(o[a-1]),i=ls),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var l="chordal"===this.type?.5:.25,h=Math.pow(e.distanceToSquared(n),l),p=Math.pow(n.distanceToSquared(r),l),d=Math.pow(r.distanceToSquared(i),l);p<1e-4&&(p=1),h<1e-4&&(h=p),d<1e-4&&(d=p),hs.initNonuniformCatmullRom(e.x,n.x,r.x,i.x,h,p,d),ps.initNonuniformCatmullRom(e.y,n.y,r.y,i.y,h,p,d),ds.initNonuniformCatmullRom(e.z,n.z,r.z,i.z,h,p,d)}else if("catmullrom"===this.type){var f=void 0!==this.tension?this.tension:.5;hs.initCatmullRom(e.x,n.x,r.x,i.x,f),ps.initCatmullRom(e.y,n.y,r.y,i.y,f),ds.initCatmullRom(e.z,n.z,r.z,i.z,f)}return new Ne(hs.calc(u),ps.calc(u),ds.calc(u))},ha.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(ha.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},ms.prototype=Object.create(fs.prototype),Object.assign(ms.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),os.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Rn.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Hn.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Rr.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},we.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(Wn.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,n){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(De.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new Ne),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,n){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,r,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,o)}}),qn.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},ke.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Ir.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(_a.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ji(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Zi(this,t)}}),Object.assign(Se.prototype,{fromAttribute:function(t,e,n){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Object.assign(Ne.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Object.assign(Oe.prototype,{fromAttribute:function(t,e,n){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),vr.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(nr.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(nr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(ci.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ui.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(ha.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),or.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Co.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(yr.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Cr.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Cr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Ka.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(jn.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new En}}}),Object.defineProperties(ho.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Gn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(ei.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(ei.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(Yn.prototype,{cullFace:{get:function(){return this.renderReverseSided?w:_},set:function(t){var e=t!==_;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(Le.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Va.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new ja).load(t,function(t){e.setBuffer(t)}),this},$a.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var Ls=function(t){this.name=t,this._dict={}},ks={names:{}};function Ns(t){return Ss(function t(e){var n=e;return e.forEach(function(e){e.__deps&&Array.prototype.push.apply(n,t(e.__deps))}),n}(t)).map(function(t){return t.toString()}).join("\n\n\n")}function Ds(t,e){var n="'use strict';\n\n"+Ns(e);return n+="\n\n\nself.func = "+t.toString()+";",n+="\n\n\nself.onmessage = "+function(t){var e=t.data.__name,n=t.data.__postId;void 0===e?console.error("message __name undefined"):void 0===self.func?console.error("worker func undefined",e):self.func(t,function(t,e){t=t||{},void 0!==n&&(t.__postId=n);try{self.postMessage(t,e)}catch(e){console.error("self.postMessage:",e),self.postMessage(t)}})}.toString()+";",new window.Blob([n],{type:"application/javascript"})}Ls.prototype.add=function(t,e){this._dict[Os(t)]=e},Ls.prototype.get=function(t){return this._dict[Os(t)]},ks.names.get=function(){return Object.keys(this._dict)},Object.defineProperties(Ls.prototype,ks);var zs=function(){this.activeWorkerCount=0,this._funcDict={},this._depsDict={},this._blobDict={}};function Fs(t){return.01745*t}function Bs(t){return 57.29578*t}zs.prototype.add=function(t,e,n){this._funcDict[t]=e,this._depsDict[t]=n},zs.prototype.get=function(t){return this._blobDict[t]||(this._blobDict[t]=Ds(this._funcDict[t],this._depsDict[t])),this._blobDict[t]};var Us,js,Gs,Vs,Hs,$s,Ws,qs,Xs,Ys,Ks,Zs,Qs,Js,tc,ec,nc,rc,ic,oc,ac,sc,cc,uc,lc,hc,pc,dc,fc,mc,gc,vc,yc,bc,xc,_c,wc,Sc,Cc,Ac,Ec,Mc,Tc,Pc,Ic,Rc,Oc,Lc,kc,Nc,Dc,zc,Fc,Bc,Uc,jc,Gc,Vc,Hc,$c,Wc,qc,Xc,Yc,Kc,Zc,Qc,Jc,tu,eu,nu,ru,iu,ou,au,su,cu,uu,lu="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),hu=new Array(36);function pu(){for(var t,e=0,n=0;n<36;n++)8===n||13===n||18===n||23===n?hu[n]="-":14===n?hu[n]="4":(e<=2&&(e=33554432+16777216*Math.random()|0),t=15&e,e>>=4,hu[n]=lu[19===n?3&t|8:t]);return hu.join("")}function du(t,e,n){return Math.max(e,Math.min(n,t))}function fu(t){return du(t,0,100)}function mu(t,e,n){return t+(e-t)*n}function gu(t,e,n,r,i,o){var a=(n-t)*o,s=(r-e)*o,c=i*i;return(2*e-2*n+a+s)*(i*c)+(-3*e+3*n-2*a-s)*c+a*i+e}function vu(t,e,n){return(n=du(function(t,e,n){return(t-e)/(n-e)}(n,t,e),0,1))*n*(3-2*n)}var yu=[].slice;ou=function(){var t,e,n,r,i;for(t={},r=0,e=(i="Boolean Number String Function Array Date RegExp Undefined Null".split(" ")).length;r<e;r++)n=i[r],t["[object "+n+"]"]=n.toLowerCase();return function(e){var n;return n=Object.prototype.toString.call(e),t[n]||"object"}}(),Ic=function(t,e,n){return null==e&&(e=0),null==n&&(n=1),t<e&&(t=e),t>n&&(t=n),t},au=function(t){return t.length>=3?[].slice.call(t):t[0]},oc=function(t){var e,n;for(t._clipped=!1,t._unclipped=t.slice(0),e=n=0;n<3;e=++n)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]<0&&(t[e]=0),t[e]>255&&(t[e]=255)):3===e&&(t[e]<0&&(t[e]=0),t[e]>1&&(t[e]=1));return t._clipped||delete t._unclipped,t},Vs=Math.PI,tu=Math.round,sc=Math.cos,pc=Math.floor,Fc=Math.pow,Rc=Math.log,nu=Math.sin,ru=Math.sqrt,Qs=Math.atan2,kc=Math.max,Zs=Math.abs,Ws=2*Vs,Hs=Vs/3,js=Vs/180,$s=180/Vs,Ks=[],(ic=function(){return arguments[0]instanceof Us?arguments[0]:function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,arguments,function(){})}).version="1.3.3",Ys={},qs=[],Xs=!1,Us=function(){function t(){var t,e,n,r,i,o,a,s,c,u=arguments;for(o=this,e=[],s=0,r=arguments.length;s<r;s++)null!=(t=u[s])&&e.push(t);if(a=e[e.length-1],null!=Ys[a])o._rgb=oc(Ys[a](au(e.slice(0,-1))));else{for(Xs||(qs=qs.sort(function(t,e){return e.p-t.p}),Xs=!0),c=0,i=qs.length;c<i&&!(a=(n=qs[c]).test.apply(n,e));c++);a&&(o._rgb=oc(Ys[a].apply(Ys,e)))}null==o._rgb&&console.warn("unknown format: "+e),null==o._rgb&&(o._rgb=[0,0,0]),3===o._rgb.length&&o._rgb.push(1)}return t.prototype.toString=function(){return this.hex()},t}(),ic._input=Ys,
/**
    ColorBrewer colors for chroma.js

    Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The
    Pennsylvania State University.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed
    under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    CONDITIONS OF ANY KIND, either express or implied. See the License for the
    specific language governing permissions and limitations under the License.

      @preserve
   */
ic.brewer=nc={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},function(){var t,e;for(t in e=[],nc)e.push(nc[t.toLowerCase()]=nc[t])}(),ic.colors=su={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Ac=function(){var t,e,n,r,i,o,a;return r=(e=au(arguments))[0],t=e[1],n=e[2],o=(r+16)/116,i=isNaN(t)?o:o+t/500,a=isNaN(n)?o:o-n/200,o=Gs.Yn*Ec(o),i=Gs.Xn*Ec(i),a=Gs.Zn*Ec(a),[uu(3.2404542*i-1.5371385*o-.4985314*a),uu(-.969266*i+1.8760108*o+.041556*a),n=uu(.0556434*i-.2040259*o+1.0572252*a),e.length>3?e[3]:1]},uu=function(t){return 255*(t<=.00304?12.92*t:1.055*Fc(t,1/2.4)-.055)},Ec=function(t){return t>Gs.t1?t*t*t:Gs.t2*(t-Gs.t0)},Gs={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Wc=function(){var t,e,n,r,i,o,a;return n=(r=au(arguments))[0],e=r[1],t=r[2],o=(i=Zc(n,e,t))[0],[116*(a=i[1])-16,500*(o-a),200*(a-i[2])]},Qc=function(t){return(t/=255)<=.04045?t/12.92:Fc((t+.055)/1.055,2.4)},cu=function(t){return t>Gs.t3?Fc(t,1/3):t/Gs.t2+Gs.t0},Zc=function(){var t,e,n,r;return n=(r=au(arguments))[0],e=r[1],t=r[2],n=Qc(n),e=Qc(e),t=Qc(t),[cu((.4124564*n+.3575761*e+.1804375*t)/Gs.Xn),cu((.2126729*n+.7151522*e+.072175*t)/Gs.Yn),cu((.0193339*n+.119192*e+.9503041*t)/Gs.Zn)]},ic.lab=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["lab"]),function(){})},Ys.lab=Ac,Us.prototype.lab=function(){return Wc(this._rgb)},Js=function(t){var e,n,r,i,o,a,s,c,u,l,h;return 2===(t=function(){var e,n,r;for(r=[],n=0,e=t.length;n<e;n++)i=t[n],r.push(ic(i));return r}()).length?(u=function(){var e,n,r;for(r=[],n=0,e=t.length;n<e;n++)i=t[n],r.push(i.lab());return r}(),o=u[0],a=u[1],e=function(t){var e,n;return n=function(){var n,r;for(r=[],e=n=0;n<=2;e=++n)r.push(o[e]+t*(a[e]-o[e]));return r}(),ic.lab.apply(ic,n)}):3===t.length?(l=function(){var e,n,r;for(r=[],n=0,e=t.length;n<e;n++)i=t[n],r.push(i.lab());return r}(),o=l[0],a=l[1],s=l[2],e=function(t){var e,n;return n=function(){var n,r;for(r=[],e=n=0;n<=2;e=++n)r.push((1-t)*(1-t)*o[e]+2*(1-t)*t*a[e]+t*t*s[e]);return r}(),ic.lab.apply(ic,n)}):4===t.length?(h=function(){var e,n,r;for(r=[],n=0,e=t.length;n<e;n++)i=t[n],r.push(i.lab());return r}(),o=h[0],a=h[1],s=h[2],c=h[3],e=function(t){var e,n;return n=function(){var n,r;for(r=[],e=n=0;n<=2;e=++n)r.push((1-t)*(1-t)*(1-t)*o[e]+3*(1-t)*(1-t)*t*a[e]+3*(1-t)*t*t*s[e]+t*t*t*c[e]);return r}(),ic.lab.apply(ic,n)}):5===t.length&&(n=Js(t.slice(0,3)),r=Js(t.slice(2,5)),e=function(t){return t<.5?n(2*t):r(2*(t-.5))}),e},ic.bezier=function(t){var e;return(e=Js(t)).scale=function(){return ic.scale(e)},e},ic.cubehelix=function(t,e,n,r,i){var o,a,s;return null==t&&(t=300),null==e&&(e=-1.5),null==n&&(n=1),null==r&&(r=1),null==i&&(i=[0,1]),o=0,"array"===ou(i)?a=i[1]-i[0]:(a=0,i=[i,i]),(s=function(s){var c,u,l,h,p;return c=Ws*((t+120)/360+e*s),h=Fc(i[0]+a*s,r),u=(0!==o?n[0]+s*o:n)*h*(1-h)/2,l=sc(c),p=nu(c),ic(oc([255*(h+u*(-.14861*l+1.78277*p)),255*(h+u*(-.29227*l-.90649*p)),255*(h+u*(1.97294*l))]))}).start=function(e){return null==e?t:(t=e,s)},s.rotations=function(t){return null==t?e:(e=t,s)},s.gamma=function(t){return null==t?r:(r=t,s)},s.hue=function(t){return null==t?n:("array"===ou(n=t)?0===(o=n[1]-n[0])&&(n=n[1]):o=0,s)},s.lightness=function(t){return null==t?i:("array"===ou(t)?(i=t,a=t[1]-t[0]):(i=[t,t],a=0),s)},s.scale=function(){return ic.scale(s)},s.hue(n),s},ic.random=function(){var t,e;for("0123456789abcdef",t="#",e=0;e<6;++e)t+="0123456789abcdef".charAt(pc(16*Math.random()));return new Us(t)},ic.average=function(t,e){var n,r,i,o,a,s,c,u,l,h,p,d,f;for(u in null==e&&(e="rgb"),l=t.length,o=[],a=0,s=0,d=(c=(t=t.map(function(t){return ic(t)})).splice(0,1)[0]).get(e))d[u]=d[u]||0,o.push(isNaN(d[u])?0:1),"h"!==e.charAt(u)||isNaN(d[u])||(n=d[u]/180*Vs,a+=sc(n),s+=nu(n));for(r=c.alpha(),p=0,h=t.length;p<h;p++)for(u in f=(i=t[p]).get(e),r+=i.alpha(),d)isNaN(f[u])||(d[u]+=f[u],o[u]+=1,"h"===e.charAt(u)&&(n=d[u]/180*Vs,a+=sc(n),s+=nu(n)));for(u in d)if(d[u]=d[u]/o[u],"h"===e.charAt(u)){for(n=Qs(s/o[u],a/o[u])/Vs*180;n<0;)n+=360;for(;n>=360;)n-=360;d[u]=n}return ic(d,e).alpha(r/l)},Ys.rgb=function(){var t,e,n,r;for(t in n=[],e=au(arguments))r=e[t],n.push(r);return n},ic.rgb=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["rgb"]),function(){})},Us.prototype.rgb=function(t){return null==t&&(t=!0),t?this._rgb.map(Math.round).slice(0,3):this._rgb.slice(0,3)},Us.prototype.rgba=function(t){return null==t&&(t=!0),t?[Math.round(this._rgb[0]),Math.round(this._rgb[1]),Math.round(this._rgb[2]),this._rgb[3]]:this._rgb.slice(0)},qs.push({p:3,test:function(t){var e;return e=au(arguments),"array"===ou(e)&&3===e.length?"rgb":4===e.length&&"number"===ou(e[3])&&e[3]>=0&&e[3]<=1?"rgb":void 0}}),fc=function(t){var e,n;if(t.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return 4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]),[(n=parseInt(t,16))>>16,n>>8&255,255&n,1];if(t.match(/^#?([A-Fa-f0-9]{8})$/))return 9===t.length&&(t=t.substr(1)),[(n=parseInt(t,16))>>24&255,n>>16&255,n>>8&255,tu((255&n)/255*100)/100];if(null!=Ys.css&&(e=Ys.css(t)))return e;throw"unknown color: "+t},Gc=function(t,e){var n,r,i,o,a,s;return null==e&&(e="rgb"),a=t[0],i=t[1],r=t[2],n=t[3],a=Math.round(a),i=Math.round(i),r=Math.round(r),s=(s="000000"+(a<<16|i<<8|r).toString(16)).substr(s.length-6),o=(o="0"+tu(255*n).toString(16)).substr(o.length-2),"#"+function(){switch(e.toLowerCase()){case"rgba":return s+o;case"argb":return o+s;default:return s}}()},Ys.hex=function(t){return fc(t)},ic.hex=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["hex"]),function(){})},Us.prototype.hex=function(t){return null==t&&(t="rgb"),Gc(this._rgb,t)},qs.push({p:4,test:function(t){if(1===arguments.length&&"string"===ou(t))return"hex"}}),vc=function(){var t,e,n,r,i,o,a,s,c,u,l,h,p,d;if(i=(t=au(arguments))[0],l=t[1],a=t[2],0===l)c=r=e=255*a;else{for(d=[0,0,0],n=[0,0,0],h=2*a-(p=a<.5?a*(1+l):a+l-a*l),i/=360,d[0]=i+1/3,d[1]=i,d[2]=i-1/3,o=s=0;s<=2;o=++s)d[o]<0&&(d[o]+=1),d[o]>1&&(d[o]-=1),6*d[o]<1?n[o]=h+6*(p-h)*d[o]:2*d[o]<1?n[o]=p:3*d[o]<2?n[o]=h+(p-h)*(2/3-d[o])*6:n[o]=h;c=(u=[tu(255*n[0]),tu(255*n[1]),tu(255*n[2])])[0],r=u[1],e=u[2]}return t.length>3?[c,r,e,t[3]]:[c,r,e]},Hc=function(t,e,n){var r,i,o,a,s;return void 0!==t&&t.length>=3&&(t=(a=t)[0],e=a[1],n=a[2]),t/=255,e/=255,n/=255,o=Math.min(t,e,n),i=((kc=Math.max(t,e,n))+o)/2,kc===o?(s=0,r=Number.NaN):s=i<.5?(kc-o)/(kc+o):(kc-o)/(2-kc-o),t===kc?r=(e-n)/(kc-o):e===kc?r=2+(n-t)/(kc-o):n===kc&&(r=4+(t-e)/(kc-o)),(r*=60)<0&&(r+=360),[r,s,i]},ic.hsl=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["hsl"]),function(){})},Ys.hsl=vc,Us.prototype.hsl=function(){return Hc(this._rgb)},yc=function(){var t,e,n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v;if(i=(t=au(arguments))[0],m=t[1],v=t[2],v*=255,0===m)c=r=e=v;else switch(360===i&&(i=0),i>360&&(i-=360),i<0&&(i+=360),a=v*(1-m),s=v*(1-m*(n=(i/=60)-(o=pc(i)))),g=v*(1-m*(1-n)),o){case 0:c=(u=[v,g,a])[0],r=u[1],e=u[2];break;case 1:c=(l=[s,v,a])[0],r=l[1],e=l[2];break;case 2:c=(h=[a,v,g])[0],r=h[1],e=h[2];break;case 3:c=(p=[a,s,v])[0],r=p[1],e=p[2];break;case 4:c=(d=[g,a,v])[0],r=d[1],e=d[2];break;case 5:c=(f=[v,a,s])[0],r=f[1],e=f[2]}return[c,r,e,t.length>3?t[3]:1]},$c=function(){var t,e,n,r,i,o,a,s,c;return o=(a=au(arguments))[0],n=a[1],t=a[2],i=Math.min(o,n,t),e=(kc=Math.max(o,n,t))-i,c=kc/255,0===kc?(r=Number.NaN,s=0):(s=e/kc,o===kc&&(r=(n-t)/e),n===kc&&(r=2+(t-o)/e),t===kc&&(r=4+(o-n)/e),(r*=60)<0&&(r+=360)),[r,s,c]},ic.hsv=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["hsv"]),function(){})},Ys.hsv=yc,Us.prototype.hsv=function(){return $c(this._rgb)},Dc=function(t){return"number"===ou(t)&&t>=0&&t<=16777215?[t>>16,t>>8&255,255&t,1]:(console.warn("unknown num color: "+t),[0,0,0,1])},Yc=function(){var t;return((t=au(arguments))[0]<<16)+(t[1]<<8)+t[2]},ic.num=function(t){return new Us(t,"num")},Us.prototype.num=function(t){return null==t&&(t="rgb"),Yc(this._rgb,t)},Ys.num=Dc,qs.push({p:1,test:function(t){if(1===arguments.length&&"number"===ou(t)&&t>=0&&t<=16777215)return"num"}}),dc=function(){var t,e,n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b;if(s=(n=au(arguments))[0],i=n[1],e=n[2],a=a/100*255,t=255*(i/=100),0===i)h=a=r=e;else switch(360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360),l=(u=e*(1-i))+t*(1-(o=(s/=60)-(c=pc(s)))),y=u+t*o,b=u+t,c){case 0:h=(p=[b,y,u])[0],a=p[1],r=p[2];break;case 1:h=(d=[l,b,u])[0],a=d[1],r=d[2];break;case 2:h=(f=[u,b,y])[0],a=f[1],r=f[2];break;case 3:h=(m=[u,l,b])[0],a=m[1],r=m[2];break;case 4:h=(g=[y,u,b])[0],a=g[1],r=g[2];break;case 5:h=(v=[b,u,l])[0],a=v[1],r=v[2]}return[h,a,r,n.length>3?n[3]:1]},jc=function(){var t,e,n,r,i,o,a,s,c;return s=(c=au(arguments))[0],i=c[1],e=c[2],a=Math.min(s,i,e),n=100*(r=(kc=Math.max(s,i,e))-a)/255,t=a/(255-r)*100,0===r?o=Number.NaN:(s===kc&&(o=(i-e)/r),i===kc&&(o=2+(e-s)/r),e===kc&&(o=4+(s-i)/r),(o*=60)<0&&(o+=360)),[o,n,t]},ic.hcg=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["hcg"]),function(){})},Ys.hcg=dc,Us.prototype.hcg=function(){return jc(this._rgb)},cc=function(t){var e,n,r,i,o,a,s,c;if(t=t.toLowerCase(),null!=ic.colors&&ic.colors[t])return fc(ic.colors[t]);if(o=t.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(s=o.slice(1,4),i=a=0;a<=2;i=++a)s[i]=+s[i];s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(s=o.slice(1,5),i=c=0;c<=3;i=++c)s[i]=+s[i];else if(o=t.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(s=o.slice(1,4),i=e=0;e<=2;i=++e)s[i]=tu(2.55*s[i]);s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(s=o.slice(1,5),i=n=0;n<=2;i=++n)s[i]=tu(2.55*s[i]);s[3]=+s[3]}else(o=t.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?((r=o.slice(1,4))[1]*=.01,r[2]*=.01,(s=vc(r))[3]=1):(o=t.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&((r=o.slice(1,4))[1]*=.01,r[2]*=.01,(s=vc(r))[3]=+o[4]);return s},Uc=function(t){var e;return"rgb"===(e=t[3]<1?"rgba":"rgb")?e+"("+t.slice(0,3).map(tu).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(tu).join(",")+","+t[3]+")":void 0},Jc=function(t){return tu(100*t)/100},gc=function(t,e){var n;return n=e<1?"hsla":"hsl",t[0]=Jc(t[0]||0),t[1]=Jc(100*t[1])+"%",t[2]=Jc(100*t[2])+"%","hsla"===n&&(t[3]=e),n+"("+t.join(",")+")"},Ys.css=function(t){return cc(t)},ic.css=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["css"]),function(){})},Us.prototype.css=function(t){return null==t&&(t="rgb"),"rgb"===t.slice(0,3)?Uc(this._rgb):"hsl"===t.slice(0,3)?gc(this.hsl(),this.alpha()):void 0},Ys.named=function(t){return fc(su[t])},qs.push({p:5,test:function(t){if(1===arguments.length&&null!=su[t])return"named"}}),Us.prototype.name=function(t){var e,n;for(n in arguments.length&&(su[t]&&(this._rgb=fc(su[t])),this._rgb[3]=1),e=this.hex(),su)if(e===su[n])return n;return e},Mc=function(){var t,e,n,r;return n=(r=au(arguments))[0],t=r[1],e=r[2],[n,sc(e*=js)*t,nu(e)*t]},Tc=function(){var t,e,n,r,i,o,a,s,c;return a=(n=au(arguments))[0],i=n[1],o=n[2],t=(s=Mc(a,i,o))[0],e=s[1],r=s[2],[(c=Ac(t,e,r))[0],c[1],r=c[2],n.length>3?n[3]:1]},Cc=function(){var t,e,n,r,i,o;return i=(o=au(arguments))[0],t=o[1],e=o[2],n=ru(t*t+e*e),r=(Qs(e,t)*$s+360)%360,0===tu(1e4*n)&&(r=Number.NaN),[i,n,r]},qc=function(){var t,e,n,r,i,o,a;return i=(o=au(arguments))[0],n=o[1],e=o[2],r=(a=Wc(i,n,e))[0],t=a[1],e=a[2],Cc(r,t,e)},ic.lch=function(){var t;return t=au(arguments),new Us(t,"lch")},ic.hcl=function(){var t;return t=au(arguments),new Us(t,"hcl")},Ys.lch=Tc,Ys.hcl=function(){var t,e,n,r;return e=(r=au(arguments))[0],t=r[1],n=r[2],Tc([n,t,e])},Us.prototype.lch=function(){return qc(this._rgb)},Us.prototype.hcl=function(){return qc(this._rgb).reverse()},Bc=function(t){var e,n,r,i,o,a;return null==t&&(t="rgb"),o=(a=au(arguments))[0],r=a[1],e=a[2],r/=255,e/=255,[(1-(o/=255)-(i=1-Math.max(o,Math.max(r,e))))*(n=i<1?1/(1-i):0),(1-r-i)*n,(1-e-i)*n,i]},ac=function(){var t,e,n,r,i,o;return n=(e=au(arguments))[0],i=e[1],o=e[2],r=e[3],t=e.length>4?e[4]:1,1===r?[0,0,0,t]:[n>=1?0:255*(1-n)*(1-r),i>=1?0:255*(1-i)*(1-r),o>=1?0:255*(1-o)*(1-r),t]},Ys.cmyk=function(){return ac(au(arguments))},ic.cmyk=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["cmyk"]),function(){})},Us.prototype.cmyk=function(){return Bc(this._rgb)},Ys.gl=function(){var t,e,n,r,i;for(r=function(){var t,n;for(e in n=[],t=au(arguments))i=t[e],n.push(i);return n}.apply(this,arguments),t=n=0;n<=2;t=++n)r[t]*=255;return r},ic.gl=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["gl"]),function(){})},Us.prototype.gl=function(){var t;return[(t=this._rgb)[0]/255,t[1]/255,t[2]/255,t[3]]},Xc=function(t,e,n){var r;return t=(r=au(arguments))[0],e=r[1],n=r[2],.2126*(t=Oc(t))+.7152*(e=Oc(e))+.0722*(n=Oc(n))},Oc=function(t){return(t/=255)<=.03928?t/12.92:Fc((t+.055)/1.055,2.4)},Ks=[],ic.interpolate=bc=function(t,e,n,r){var i,o,a,s;for(null==n&&(n=.5),null==r&&(r="rgb"),"object"!==ou(t)&&(t=ic(t)),"object"!==ou(e)&&(e=ic(e)),a=0,o=Ks.length;a<o;a++)if(r===(i=Ks[a])[0]){s=i[1](t,e,n,r);break}if(null==s)throw"color mode "+r+" is not supported";return s.alpha(t.alpha()+n*(e.alpha()-t.alpha()))},Us.prototype.interpolate=function(t,e,n){return bc(this,t,e,n)},ic.mix=bc,Us.prototype.mix=Us.prototype.interpolate,Sc=function(t,e,n,r){var i,o;return i=t._rgb,o=e._rgb,new Us(i[0]+n*(o[0]-i[0]),i[1]+n*(o[1]-i[1]),i[2]+n*(o[2]-i[2]),r)},Ks.push(["rgb",Sc]),Us.prototype.luminance=function(t,e){var n,r,i,o;return null==e&&(e="rgb"),arguments.length?(0===t?this._rgb=[0,0,0,this._rgb[3]]:1===t?this._rgb=[255,255,255,this._rgb[3]]:(r=1e-7,i=20,o=function(n,a){var s,c;return s=(c=n.interpolate(a,.5,e)).luminance(),Math.abs(t-s)<r||!i--?c:s>t?o(n,c):o(c,a)},n=Xc(this._rgb),this._rgb=(n>t?o(ic("black"),this):o(this,ic("white"))).rgba()),this):Xc(this._rgb)},iu=function(t){var e,n,r,i;return(i=t/100)<66?(r=255,n=-155.25485562709179-.44596950469579133*(n=i-2)+104.49216199393888*Rc(n),e=i<20?0:.8274096064007395*(e=i-10)-254.76935184120902+115.67994401066147*Rc(e)):(r=351.97690566805693+.114206453784165*(r=i-55)-40.25366309332127*Rc(r),n=325.4494125711974+.07943456536662342*(n=i-50)-28.0852963507957*Rc(n),e=255),[r,n,e]},Kc=function(){var t,e,n,r,i,o,a;for(r=(i=au(arguments))[0],i[1],t=i[2],n=1e3,e=4e4,.4;e-n>.4;)(o=iu(a=.5*(e+n)))[2]/o[0]>=t/r?e=a:n=a;return tu(a)},ic.temperature=ic.kelvin=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["temperature"]),function(){})},Ys.temperature=Ys.kelvin=Ys.K=iu,Us.prototype.temperature=function(){return Kc(this._rgb)},Us.prototype.kelvin=Us.prototype.temperature,ic.contrast=function(t,e){var n,r,i,o;return"string"!==(i=ou(t))&&"number"!==i||(t=new Us(t)),"string"!==(o=ou(e))&&"number"!==o||(e=new Us(e)),(n=t.luminance())>(r=e.luminance())?(n+.05)/(r+.05):(r+.05)/(n+.05)},ic.distance=function(t,e,n){var r,i,o,a,s,c,u;for(i in null==n&&(n="lab"),"string"!==(s=ou(t))&&"number"!==s||(t=new Us(t)),"string"!==(c=ou(e))&&"number"!==c||(e=new Us(e)),o=t.get(n),a=e.get(n),u=0,o)u+=(r=(o[i]||0)-(a[i]||0))*r;return Math.sqrt(u)},ic.deltaE=function(t,e,n,r){var i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E,M;for(null==n&&(n=1),null==r&&(r=1),"string"!==(y=ou(t))&&"number"!==y||(t=new Us(t)),"string"!==(b=ou(e))&&"number"!==b||(e=new Us(e)),i=(x=t.lab())[0],a=x[1],c=x[2],o=(_=e.lab())[0],s=_[1],u=_[2],l=ru(a*a+c*c),h=ru(s*s+u*u),S=i<16?.511:.040975*i/(1+.01765*i),w=.0638*l/(1+.0131*l)+.638,v=l<1e-6?0:180*Qs(c,a)/Vs;v<0;)v+=360;for(;v>=360;)v-=360;return C=v>=164&&v<=345?.56+Zs(.2*sc(Vs*(v+168)/180)):.36+Zs(.4*sc(Vs*(v+35)/180)),g=ru((p=l*l*l*l)/(p+1900)),ru((A=(i-o)/(n*S))*A+(E=(m=l-h)/(r*w))*E+((d=a-s)*d+(f=c-u)*f-m*m)/((M=w*(g*C+1-g))*M))},Us.prototype.get=function(t){var e,n,r,i,o;return this,r=(i=t.split("."))[0],e=i[1],o=this[r](),e?(n=r.indexOf(e))>-1?o[n]:console.warn("unknown channel "+e+" in mode "+r):o},Us.prototype.set=function(t,e){var n,r,i,o,a;if(this,i=(o=t.split("."))[0],n=o[1])if(a=this[i](),(r=i.indexOf(n))>-1)if("string"===ou(e))switch(e.charAt(0)){case"+":case"-":a[r]+=+e;break;case"*":a[r]*=+e.substr(1);break;case"/":a[r]/=+e.substr(1);break;default:a[r]=+e}else a[r]=e;else console.warn("unknown channel "+n+" in mode "+i);else a=e;return ic(a,i).alpha(this.alpha())},Us.prototype.clipped=function(){return this._rgb._clipped||!1},Us.prototype.alpha=function(t){return arguments.length?ic.rgb([this._rgb[0],this._rgb[1],this._rgb[2],t]):this._rgb[3]},Us.prototype.darken=function(t){var e;return null==t&&(t=1),this,(e=this.lab())[0]-=Gs.Kn*t,ic.lab(e).alpha(this.alpha())},Us.prototype.brighten=function(t){return null==t&&(t=1),this.darken(-t)},Us.prototype.darker=Us.prototype.darken,Us.prototype.brighter=Us.prototype.brighten,Us.prototype.saturate=function(t){var e;return null==t&&(t=1),this,(e=this.lch())[1]+=t*Gs.Kn,e[1]<0&&(e[1]=0),ic.lch(e).alpha(this.alpha())},Us.prototype.desaturate=function(t){return null==t&&(t=1),this.saturate(-t)},Us.prototype.premultiply=function(){var t,e;return e=this.rgb(),t=this.alpha(),ic(e[0]*t,e[1]*t,e[2]*t,t)},Nc=function(t,e){return t*e/255},uc=function(t,e){return t>e?e:t},Pc=function(t,e){return t>e?t:e},eu=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},zc=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},rc=function(t,e){return 255*(1-(1-e/255)/(t/255))},lc=function(t,e){return 255===t?255:(t=e/255*255/(1-t/255))>255?255:t},(tc=function(t,e,n){if(!tc[n])throw"unknown blend mode "+n;return tc[n](t,e)}).normal=(ec=function(t){return function(e,n){var r,i;return r=ic(n).rgb(),i=ic(e).rgb(),ic(t(r,i),"rgb")}})((hc=function(t){return function(e,n){var r,i,o;for(o=[],r=i=0;i<=3;r=++i)o[r]=t(e[r],n[r]);return o}})(function(t,e){return t})),tc.multiply=ec(hc(Nc)),tc.screen=ec(hc(eu)),tc.overlay=ec(hc(zc)),tc.darken=ec(hc(uc)),tc.lighten=ec(hc(Pc)),tc.dodge=ec(hc(lc)),tc.burn=ec(hc(rc)),ic.blend=tc,ic.analyze=function(t){var e,n,r,i;for(r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},n=0,e=t.length;n<e;n++)null==(i=t[n])||isNaN(i)||(r.values.push(i),r.sum+=i,i<r.min&&(r.min=i),i>r.max&&(r.max=i),r.count+=1);return r.domain=[r.min,r.max],r.limits=function(t,e){return ic.limits(r,t,e)},r},ic.scale=function(t,e){var n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_;return u="rgb",l=ic("#ccc"),f=0,!1,a=[0,1],d=[],p=[0,0],n=!1,i=[],h=!1,c=0,s=1,o=!1,r={},m=!0,x=function(t){var e,n,r,o,a,s;if(null==t&&(t=["#fff","#000"]),null!=t&&"string"===ou(t)&&null!=ic.brewer&&(t=ic.brewer[t]||ic.brewer[t.toLowerCase()]||t),"array"===ou(t)){for(e=r=0,o=(t=t.slice(0)).length-1;0<=o?r<=o:r>=o;e=0<=o?++r:--r)n=t[e],"string"===ou(n)&&(t[e]=ic(n));for(d.length=0,e=s=0,a=t.length-1;0<=a?s<=a:s>=a;e=0<=a?++s:--s)d.push(e/(t.length-1))}return b(),i=t},v=function(t){var e,r;if(null!=n){for(r=n.length-1,e=0;e<r&&t>=n[e];)e++;return e-1}return 0},_=function(t){return t},function(t){var e,r,i,o,a;return a=t,n.length>2&&(o=n.length-1,e=v(t),i=n[0]+(n[1]-n[0])*(0+.5*f),r=n[o-1]+(n[o]-n[o-1])*(1-.5*f),a=c+(n[e]+.5*(n[e+1]-n[e])-i)/(r-i)*(s-c)),a},y=function(t,e){var o,a,h,f,g,y,b;if(null==e&&(e=!1),isNaN(t))return l;if(e?b=t:n&&n.length>2?(b=v(t)/(n.length-2),b=p[0]+b*(1-p[0]-p[1])):s!==c?(b=(t-c)/(s-c),b=p[0]+b*(1-p[0]-p[1]),b=Math.min(1,Math.max(0,b))):b=1,e||(b=_(b)),h=Math.floor(1e4*b),m&&r[h])o=r[h];else{if("array"===ou(i))for(a=f=0,y=d.length-1;0<=y?f<=y:f>=y;a=0<=y?++f:--f){if(b<=(g=d[a])){o=i[a];break}if(b>=g&&a===d.length-1){o=i[a];break}if(b>g&&b<d[a+1]){b=(b-g)/(d[a+1]-g),o=ic.interpolate(i[a],i[a+1],b,u);break}}else"function"===ou(i)&&(o=i(b));m&&(r[h]=o)}return o},b=function(){return r={}},x(t),(g=function(t){var e;return e=ic(y(t)),h&&e[h]?e[h]():e}).classes=function(t){var e;return null!=t?("array"===ou(t)?(n=t,a=[t[0],t[t.length-1]]):(e=ic.analyze(a),n=0===t?[e.min,e.max]:ic.limits(e,"e",t)),g):n},g.domain=function(t){var e,n,r,o,u,l,h;if(!arguments.length)return a;if(c=t[0],s=t[t.length-1],d=[],r=i.length,t.length===r&&c!==s)for(u=0,o=t.length;u<o;u++)n=t[u],d.push((n-c)/(s-c));else for(e=h=0,l=r-1;0<=l?h<=l:h>=l;e=0<=l?++h:--h)d.push(e/(r-1));return a=[c,s],g},g.mode=function(t){return arguments.length?(u=t,b(),g):u},g.range=function(t,e){return x(t),g},g.out=function(t){return h=t,g},g.spread=function(t){return arguments.length?(f=t,g):f},g.correctLightness=function(t){return null==t&&(t=!0),o=t,b(),_=o?function(t){var e,n,r,i,o,a,s,c,u;for(e=y(0,!0).lab()[0],n=y(1,!0).lab()[0],s=e>n,r=y(t,!0).lab()[0],i=r-(o=e+(n-e)*t),c=0,u=1,a=20;Math.abs(i)>.01&&a-- >0;)s&&(i*=-1),i<0?(c=t,t+=.5*(u-t)):(u=t,t+=.5*(c-t)),r=y(t,!0).lab()[0],i=r-o;return t}:function(t){return t},g},g.padding=function(t){return null!=t?("number"===ou(t)&&(t=[t,t]),p=t,g):p},g.colors=function(e,r){var o,s,c,u,l,h,p;if(null==r&&(r="hex"),0===arguments.length)return i.map(function(t){return t[r]()});if(e)return 1===e?g(.5)[r]():(s=a[0],o=a[1]-s,function(){l=[];for(var t=0;0<=e?t<e:t>e;0<=e?t++:t--)l.push(t);return l}.apply(this).map(function(t){return g(s+t/(e-1)*o)[r]()}));if(t=[],h=[],n&&n.length>2)for(c=p=1,u=n.length;1<=u?p<u:p>u;c=1<=u?++p:--p)h.push(.5*(n[c-1]+n[c]));else h=a;return h.map(function(t){return g(t)[r]()})},g.cache=function(t){return null!=t?m=t:m},g},null==ic.scales&&(ic.scales={}),ic.scales.cool=function(){return ic.scale([ic.hsl(180,1,.9),ic.hsl(250,.7,.4)])},ic.scales.hot=function(){return ic.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},ic.analyze=function(t,e,n){var r,i,o,a,s,c;if(s={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},null==n&&(n=function(){return!0}),r=function(t){null==t||isNaN(t)||(s.values.push(t),s.sum+=t,t<s.min&&(s.min=t),t>s.max&&(s.max=t),s.count+=1)},c=function(t,i){if(n(t,i))return null!=e&&"function"===ou(e)?r(e(t)):null!=e&&"string"===ou(e)||"number"===ou(e)?r(t[e]):r(t)},"array"===ou(t))for(a=0,o=t.length;a<o;a++)c(t[a]);else for(i in t)c(t[i],i);return s.domain=[s.min,s.max],s.limits=function(t,e){return ic.limits(s,t,e)},s},ic.limits=function(t,e,n){var r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E,M,T,P,I,R,O,L,k,N,D,z,F,B,U,j,G,V,H,$,W,q,X,Y,K,Z,Q,J,tt,et,nt,rt;if(null==e&&(e="equal"),null==n&&(n=7),"array"===ou(t)&&(t=ic.analyze(t)),M=t.min,kc=t.max,t.sum,nt=t.values.sort(function(t,e){return t-e}),1===n)return[M,kc];if(A=[],"c"===e.substr(0,1)&&(A.push(M),A.push(kc)),"e"===e.substr(0,1)){for(A.push(M),w=L=1,z=n-1;1<=z?L<=z:L>=z;w=1<=z?++L:--L)A.push(M+w/n*(kc-M));A.push(kc)}else if("l"===e.substr(0,1)){if(M<=0)throw"Logarithmic scales are only possible for values > 0";for(T=Math.LOG10E*Rc(M),E=Math.LOG10E*Rc(kc),A.push(M),w=rt=1,F=n-1;1<=F?rt<=F:rt>=F;w=1<=F?++rt:--rt)A.push(Fc(10,T+w/n*(E-T)));A.push(kc)}else if("q"===e.substr(0,1)){for(A.push(M),w=r=1,H=n-1;1<=H?r<=H:r>=H;w=1<=H?++r:--r)k=(nt.length-1)*w/n,(N=pc(k))===k?A.push(nt[N]):(D=k-N,A.push(nt[N]*(1-D)+nt[N+1]*D));A.push(kc)}else if("k"===e.substr(0,1)){for(I=nt.length,g=new Array(I),x=new Array(n),Q=!0,R=0,y=null,(y=[]).push(M),w=i=1,$=n-1;1<=$?i<=$:i>=$;w=1<=$?++i:--i)y.push(M+w/n*(kc-M));for(y.push(kc);Q;){for(S=o=0,W=n-1;0<=W?o<=W:o>=W;S=0<=W?++o:--o)x[S]=0;for(w=a=0,q=I-1;0<=q?a<=q:a>=q;w=0<=q?++a:--a){for(et=nt[w],P=Number.MAX_VALUE,S=s=0,X=n-1;0<=X?s<=X:s>=X;S=0<=X?++s:--s)(_=Zs(y[S]-et))<P&&(P=_,v=S);x[v]++,g[w]=v}for(O=new Array(n),S=c=0,Y=n-1;0<=Y?c<=Y:c>=Y;S=0<=Y?++c:--c)O[S]=null;for(w=u=0,K=I-1;0<=K?u<=K:u>=K;w=0<=K?++u:--u)null===O[b=g[w]]?O[b]=nt[w]:O[b]+=nt[w];for(S=l=0,Z=n-1;0<=Z?l<=Z:l>=Z;S=0<=Z?++l:--l)O[S]*=1/x[S];for(Q=!1,S=h=0,B=n-1;0<=B?h<=B:h>=B;S=0<=B?++h:--h)if(O[S]!==y[w]){Q=!0;break}y=O,++R>200&&(Q=!1)}for(C={},S=p=0,U=n-1;0<=U?p<=U:p>=U;S=0<=U?++p:--p)C[S]=[];for(w=d=0,j=I-1;0<=j?d<=j:d>=j;w=0<=j?++d:--d)C[b=g[w]].push(nt[w]);for(J=[],S=f=0,G=n-1;0<=G?f<=G:f>=G;S=0<=G?++f:--f)J.push(C[S][0]),J.push(C[S][C[S].length-1]);for(J=J.sort(function(t,e){return t-e}),A.push(J[0]),w=m=1,V=J.length-1;m<=V;w=m+=2)tt=J[w],isNaN(tt)||-1!==A.indexOf(tt)||A.push(tt)}return A},mc=function(t,e,n){var r,i,o,a;return t=(r=au(arguments))[0],e=r[1],n=r[2],isNaN(t)&&(t=0),(t/=360)<1/3?o=1-((i=(1-e)/3)+(a=(1+e*sc(Ws*t)/sc(Hs-Ws*t))/3)):t<2/3?i=1-((a=(1-e)/3)+(o=(1+e*sc(Ws*(t-=1/3))/sc(Hs-Ws*t))/3)):a=1-((o=(1-e)/3)+(i=(1+e*sc(Ws*(t-=2/3))/sc(Hs-Ws*t))/3)),[255*(a=Ic(n*a*3)),255*(o=Ic(n*o*3)),255*(i=Ic(n*i*3)),r.length>3?r[3]:1]},Vc=function(){var t,e,n,r,i,o,a;return i=(o=au(arguments))[0],e=o[1],t=o[2],Ws=2*Math.PI,i/=255,e/=255,t/=255,0===(a=1-Math.min(i,e,t)/(r=(i+e+t)/3))?n=0:(n=(i-e+(i-t))/2,n/=Math.sqrt((i-e)*(i-e)+(i-t)*(e-t)),n=Math.acos(n),t>e&&(n=Ws-n),n/=Ws),[360*n,a,r]},ic.hsi=function(){return function(t,e,n){n.prototype=t.prototype;var r=new n,i=t.apply(r,e);return Object(i)===i?i:r}(Us,yu.call(arguments).concat(["hsi"]),function(){})},Ys.hsi=mc,Us.prototype.hsi=function(){return Vc(this._rgb)},xc=function(t,e,n,r){var i,o,a,s,c,u,l,h,p,d;return"hsl"===r?(p=t.hsl(),d=e.hsl()):"hsv"===r?(p=t.hsv(),d=e.hsv()):"hcg"===r?(p=t.hcg(),d=e.hcg()):"hsi"===r?(p=t.hsi(),d=e.hsi()):"lch"!==r&&"hcl"!==r||(r="hcl",p=t.hcl(),d=e.hcl()),"h"===r.substr(0,1)&&(o=p[0],l=p[1],s=p[2],a=d[0],h=d[1],c=d[2]),isNaN(o)||isNaN(a)?isNaN(o)?isNaN(a)?i=Number.NaN:(i=a,1!==s&&0!==s||"hsv"===r||(u=h)):(i=o,1!==c&&0!==c||"hsv"===r||(u=l)):i=o+n*(a>o&&a-o>180?a-(o+360):a<o&&o-a>180?a+360-o:a-o),null==u&&(u=l+n*(h-l)),ic[r](i,u,s+n*(c-s))},wc=function(t,e,n,r){var i,o;return i=t.num(),o=e.num(),ic.num(i+(o-i)*n,"num")},(Ks=Ks.concat(function(){var t,e,n,r;for(r=[],e=0,t=(n=["hsv","hsl","hsi","hcl","lch","hcg"]).length;e<t;e++)Lc=n[e],r.push([Lc,xc]);return r}())).push(["num",wc]),_c=function(t,e,n,r){var i,o;return i=t.lab(),o=e.lab(),new Us(i[0]+n*(o[0]-i[0]),i[1]+n*(o[1]-i[1]),i[2]+n*(o[2]-i[2]),r)},Ks.push(["lab",_c]);var bu=ic,xu=function(t){var e=t||{};this.scale=gs(e.scale,"uniform"),this.mode=gs(e.mode,"hcl"),this.domain=gs(e.domain,[0,1]),this.value=new En(gs(e.value,16777215)).getHex(),this.reverse=gs(e.reverse,!1),this.structure=e.structure,this.volume=e.volume,this.surface=e.surface,this.structure&&(this.atomProxy=this.structure.getAtomProxy())};
/** @license
 * JS Signals <http://millermedeiros.github.com/js-signals/>
 * Released under the MIT license
 * Author: Miller Medeiros
 * Version: 1.0.0 - Build: 268 (2012/11/29 05:48 PM)
 */
function _u(t,e,n,r,i){this._listener=e,this._isOnce=n,this.context=r,this._signal=t,this._priority=i||0}function wu(t,e){if("function"!=typeof t)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",e))}function Su(){this._bindings=[],this._prevParams=null;var t=this;this.dispatch=function(){Su.prototype.dispatch.apply(t,arguments)}}xu.prototype.getScale=function(t){var e=t||{},n=gs(e.scale,this.scale);"rainbow"===n?n=["red","orange","yellow","green","blue"]:"rwb"===n&&(n=["red","white","blue"]);var r=gs(e.domain,this.domain);return this.reverse&&(r=r.slice().reverse()),bu.scale(n).mode(gs(e.mode,this.mode)).domain(r).out("num")},xu.prototype.colorToArray=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=0),e[n+0]=(t>>16&255)/255,e[n+1]=(t>>8&255)/255,e[n+2]=(255&t)/255,e},xu.prototype.atomColorToArray=function(t,e,n){return this.colorToArray(this.atomColor(t),e,n)},xu.prototype.bondColor=function(t,e){return this.atomProxy.index=e?t.atomIndex1:t.atomIndex2,this.atomColor(this.atomProxy)},xu.prototype.bondColorToArray=function(t,e,n,r){return this.colorToArray(this.bondColor(t,e),n,r)},xu.prototype.volumeColorToArray=function(t,e,n){return this.colorToArray(this.volumeColor(t),e,n)},xu.prototype.positionColorToArray=function(t,e,n){return this.colorToArray(this.positionColor(t),e,n)},_u.prototype={active:!0,params:null,execute:function(t){var e,n;return this.active&&this._listener&&(n=this.params?this.params.concat(t):t,e=this._listener.apply(this.context,n),this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},Su.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(t,e,n,r){var i,o=this._indexOfListener(t,n);if(-1!==o){if((i=this._bindings[o]).isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else i=new _u(this,t,e,n,r),this._addBinding(i);return this.memorize&&this._prevParams&&i.execute(this._prevParams),i},_addBinding:function(t){var e=this._bindings.length;do{--e}while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){for(var n,r=this._bindings.length;r--;)if((n=this._bindings[r])._listener===t&&n.context===e)return r;return-1},has:function(t,e){return-1!==this._indexOfListener(t,e)},add:function(t,e,n){return wu(t,"add"),this._registerListener(t,!1,e,n)},addOnce:function(t,e,n){return wu(t,"addOnce"),this._registerListener(t,!0,e,n)},remove:function(t,e){wu(t,"remove");var n=this._indexOfListener(t,e);return-1!==n&&(this._bindings[n]._destroy(),this._bindings.splice(n,1)),t},removeAll:function(){for(var t=this._bindings.length;t--;)this._bindings[t]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(t){if(this.active){var e,n=Array.prototype.slice.call(arguments),r=this._bindings.length;if(this.memorize&&(this._prevParams=n),r){e=this._bindings.slice(),this._shouldPropagate=!0;do{r--}while(e[r]&&this._shouldPropagate&&!1!==e[r].execute(n))}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var Cu={PROTEIN:1,NUCLEIC:2,RNA:3,DNA:4,POLYMER:5,WATER:6,HELIX:7,SHEET:8,TURN:9,BACKBONE:10,SIDECHAIN:11,ALL:12,HETERO:13,ION:14,SACCHARIDE:15,SUGAR:15,BONDED:16,RING:17},Au=["*","","ALL"],Eu=[Cu.BACKBONE,Cu.SIDECHAIN,Cu.BONDED,Cu.RING],Mu=[Cu.POLYMER,Cu.WATER],Tu=["ALA","GLY","SER"],Pu=["CYS","SER","THR"],Iu=["ALA","ILE","LEU","MET","PHE","PRO","TRP","VAL"],Ru=["PHE","TRP","TYR","HIS"],Ou=["ASN","GLN"],Lu=["ASP","GLU"],ku=["ARG","HIS","LYS"],Nu=["ARG","ASP","GLU","HIS","LYS"],Du=["ASN","ARG","ASP","CYS","GLY","GLN","GLU","HIS","LYS","SER","THR","TYR"],zu=["ALA","ILE","LEU","MET","PHE","PRO","TRP","VAL"],Fu=["HIS","PHE","PRO","TRP","TYR"],Bu=["ALA","GLY","ILE","LEU","VAL"];function Uu(t,e){if(void 0===e.atomname&&void 0===e.element&&void 0===e.altloc&&void 0===e.atomindex&&void 0===e.keyword&&void 0===e.inscode&&void 0===e.resname&&void 0===e.sstruc&&void 0===e.resno&&void 0===e.chainname&&void 0===e.model)return-1;if(void 0!==e.keyword){if(e.keyword===Cu.BACKBONE&&!t.isBackbone())return!1;if(e.keyword===Cu.SIDECHAIN&&!t.isSidechain())return!1;if(e.keyword===Cu.BONDED&&!t.isBonded())return!1;if(e.keyword===Cu.RING&&!t.isRing())return!1;if(e.keyword===Cu.HETERO&&!t.isHetero())return!1;if(e.keyword===Cu.PROTEIN&&!t.isProtein())return!1;if(e.keyword===Cu.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===Cu.RNA&&!t.isRna())return!1;if(e.keyword===Cu.DNA&&!t.isDna())return!1;if(e.keyword===Cu.POLYMER&&!t.isPolymer())return!1;if(e.keyword===Cu.WATER&&!t.isWater())return!1;if(e.keyword===Cu.HELIX&&!t.isHelix())return!1;if(e.keyword===Cu.SHEET&&!t.isSheet())return!1;if(e.keyword===Cu.TURN&&!t.isTurn())return!1;if(e.keyword===Cu.ION&&!t.isIon())return!1;if(e.keyword===Cu.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomname&&e.atomname!==t.atomname)return!1;if(void 0!==e.element&&e.element!==t.element)return!1;if(void 0!==e.altloc&&e.altloc!==t.altloc)return!1;if(void 0!==e.atomindex&&_s(e.atomindex,t.index)<0)return!1;if(void 0!==e.resname)if(Array.isArray(e.resname)){if(!e.resname.includes(t.resname))return!1}else if(e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]<t.resno)return!1}else if(e.resno!==t.resno)return!1;return(void 0===e.inscode||e.inscode===t.inscode)&&((void 0===e.chainname||e.chainname===t.chainname)&&(void 0===e.model||e.model===t.modelIndex))}function ju(t,e){if(void 0===e.resname&&void 0===e.resno&&void 0===e.inscode&&void 0===e.sstruc&&void 0===e.model&&void 0===e.chainname&&void 0===e.atomindex&&(void 0===e.keyword||Eu.includes(e.keyword)))return-1;if(void 0!==e.keyword){if(e.keyword===Cu.HETERO&&!t.isHetero())return!1;if(e.keyword===Cu.PROTEIN&&!t.isProtein())return!1;if(e.keyword===Cu.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===Cu.RNA&&!t.isRna())return!1;if(e.keyword===Cu.DNA&&!t.isDna())return!1;if(e.keyword===Cu.POLYMER&&!t.isPolymer())return!1;if(e.keyword===Cu.WATER&&!t.isWater())return!1;if(e.keyword===Cu.HELIX&&!t.isHelix())return!1;if(e.keyword===Cu.SHEET&&!t.isSheet())return!1;if(e.keyword===Cu.TURN&&!t.isTurn())return!1;if(e.keyword===Cu.ION&&!t.isIon())return!1;if(e.keyword===Cu.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomindex&&0===ws(e.atomindex,t.atomOffset,t.atomEnd))return!1;if(void 0!==e.resname)if(Array.isArray(e.resname)){if(!e.resname.includes(t.resname))return!1}else if(e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]<t.resno)return!1}else if(e.resno!==t.resno)return!1;return(void 0===e.inscode||e.inscode===t.inscode)&&((void 0===e.chainname||e.chainname===t.chainname)&&(void 0===e.model||e.model===t.modelIndex))}function Gu(t,e){if(!(void 0!==e.chainname||void 0!==e.model||void 0!==e.atomindex||void 0!==e.keyword&&Mu.includes(e.keyword)&&t.entity))return-1;if(void 0!==e.keyword){if(e.keyword===Cu.POLYMER&&!t.entity.isPolymer())return!1;if(e.keyword===Cu.WATER&&!t.entity.isWater())return!1}return(void 0===e.atomindex||0!==ws(e.atomindex,t.atomOffset,t.atomEnd))&&((void 0===e.chainname||e.chainname===t.chainname)&&(void 0===e.model||e.model===t.modelIndex))}function Vu(t,e){return void 0===e.model&&void 0===e.atomindex?-1:(void 0===e.atomindex||0!==ws(e.atomindex,t.atomOffset,t.atomEnd))&&(void 0===e.model||e.model===t.index)}var Hu=function(t){this.signals={stringChanged:new Su},this.setString(t)},$u={type:{}};$u.type.get=function(){return"selection"},Hu.prototype.setString=function(t,e){if(void 0===t&&(t=this.string||""),t!==this.string){try{this.parse(t)}catch(t){this.selection={error:t.message}}this.string=t,this.test=this.makeAtomTest(),this.residueTest=this.makeResidueTest(),this.chainTest=this.makeChainTest(),this.modelTest=this.makeModelTest(),this.atomOnlyTest=this.makeAtomTest(!0),this.residueOnlyTest=this.makeResidueTest(!0),this.chainOnlyTest=this.makeChainTest(!0),this.modelOnlyTest=this.makeModelTest(!0),e||this.signals.stringChanged.dispatch(this.string)}},Hu.prototype.parse=function(t){var e=this;if(this.selection={operator:void 0,rules:[]},t){var n,r,i=this.selection,o=[];"("===(t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").trim()).charAt(0)&&")"===t.substr(-1)&&(t=t.slice(1,-1).trim());for(var a,s=t.split(/\s+/),c=function(t){n={operator:t,rules:[]},void 0===i?(i=n,e.selection=n):(i.rules.push(n),o.push(i),i=n)},u=function(t){r=i,void 0===(i=o.pop())&&(c(t),l(r))},l=function(t){i.rules.push(t)},h=0;h<s.length;++h){var p=s[h],d=p.toUpperCase();if("("!==p)if(")"!==p){if(a>0)if("NOT"===d)a=1;else if(1===a)a=2;else{if(2!==a)throw new Error("something went wrong with 'not'");a=!1,u()}if("AND"!==d)if("OR"!==d)if("NOT"!==p.toUpperCase()){var f=Cu[d];if(void 0===f)if("HYDROGEN"!==d)if("SMALL"!==d)if("NUCLEOPHILIC"!==d)if("HYDROPHOBIC"!==d)if("AROMATIC"!==d)if("AMIDE"!==d)if("ACIDIC"!==d)if("BASIC"!==d)if("CHARGED"!==d)if("POLAR"!==d)if("NONPOLAR"!==d)if("CYCLIC"!==d)if("ALIPHATIC"!==d)if("SIDECHAINATTACHED"!==d)if("LIGAND"!==d)if(-1===Au.indexOf(d))if("@"!==p.charAt(0))if("#"!==p.charAt(0))if("_"!==p.charAt(0))if("["!==p[0]||"]"!==p[p.length-1])if(p.length>=1&&p.length<=4&&"^"!==p[0]&&":"!==p[0]&&"."!==p[0]&&"%"!==p[0]&&"/"!==p[0]&&isNaN(parseInt(p)))l({resname:d});else{var m={operator:"AND",rules:[]},g=p.split("/");if(g.length>1&&g[1]){if(isNaN(parseInt(g[1])))throw new Error("model must be an integer");m.rules.push({model:parseInt(g[1])})}var v=g[0].split("%");v.length>1&&m.rules.push({altloc:v[1]});var y=v[0].split(".");if(y.length>1&&y[1]){if(y[1].length>4)throw new Error("atomname must be one to four characters");m.rules.push({atomname:y[1].substring(0,4).toUpperCase()})}var b=y[0].split(":");b.length>1&&b[1]&&m.rules.push({chainname:b[1]});var x=b[0].split("^");if(x.length>1&&m.rules.push({inscode:x[1]}),x[0]){var _=void 0,w=void 0;"-"===x[0][0]&&(x[0]=x[0].substr(1),_=!0),x[0].includes("--")&&(x[0]=x[0].replace("--","-"),w=!0);var S=x[0].split("-");if(1===S.length){if(S=parseInt(S[0]),isNaN(S))throw new Error("resi must be an integer");_&&(S*=-1),m.rules.push({resno:S})}else{if(2!==S.length)throw new Error("resi range must contain one '-'");_&&(S[0]*=-1),w&&(S[1]*=-1),m.rules.push({resno:[parseInt(S[0]),parseInt(S[1])]})}}if(1===m.rules.length)l(m.rules[0]);else{if(!(m.rules.length>1))throw new Error("empty selection chunk");l(m)}}else{var C=d.substr(1,p.length-2).split(","),A=C.length>1?C:C[0];l({resname:A})}else l({element:d.substr(1)});else console.error("# for element selection deprecated, use _"),l({element:d.substr(1)});else{for(var E=p.substr(1).split(","),M=0,T=E.length;M<T;++M)E[M]=parseInt(E[M]);E.sort(function(t,e){return t-e}),l({atomindex:E})}else l({keyword:Cu.ALL});else l({operator:"AND",rules:[{operator:"OR",rules:[{keyword:Cu.HETERO},{negate:!0,operator:void 0,rules:[{keyword:Cu.POLYMER}]}]},{negate:!0,operator:void 0,rules:[{operator:"OR",rules:[{keyword:Cu.WATER},{keyword:Cu.ION}]}]}]});else l({operator:"OR",rules:[{keyword:Cu.SIDECHAIN},{operator:"AND",negate:!1,rules:[{keyword:Cu.PROTEIN},{operator:"OR",negate:!1,rules:[{atomname:"CA"},{atomname:"BB"}]}]},{operator:"AND",negate:!1,rules:[{resname:"PRO"},{atomname:"N"}]},{operator:"AND",negate:!1,rules:[{keyword:Cu.NUCLEIC},{operator:"OR",negate:!0,rules:[{atomname:"P"},{atomname:"OP1"},{atomname:"OP2"},{atomname:"O3'"},{atomname:"O3*"},{atomname:"O5'"},{atomname:"O5*"},{atomname:"C5'"},{atomname:"C5*"}]}]}]});else l({resname:Bu});else l({resname:Fu});else l({resname:zu});else l({resname:Du});else l({resname:Nu});else l({resname:ku});else l({resname:Lu});else l({resname:Ou});else l({resname:Ru});else l({resname:Iu});else l({resname:Pu});else l({resname:Tu});else l({element:"H"});else l({keyword:f})}else a=1,c(),i.negate=!0;else"AND"===i.operator?u("OR"):i.operator="OR";else if("OR"===i.operator){var P=i.rules.pop();c("AND"),l(P)}else i.operator="AND"}else u(),i.negate&&u();else a=!1,c()}void 0===this.selection.operator&&1===this.selection.rules.length&&this.selection.rules[0].hasOwnProperty("operator")&&(this.selection=this.selection.rules[0])}},Hu.prototype._makeTest=function(t,e){if(void 0===e&&(e=this.selection),null===e)return!1;if(e.error)return!1;var n=e.rules.length;if(0===n)return!1;for(var r=!e.negate,i=!!e.negate,o=[],a=0;a<n;++a){var s=e.rules[a];s.hasOwnProperty("operator")&&(o[a]=this._makeTest(t,s))}return function(a){for(var s="AND"===e.operator,c=!1,u=0;u<n;++u){var l=e.rules[u],h=void 0;if(l.hasOwnProperty("operator")){if(-1===(h=o[u]?o[u](a):-1)){c=!0;continue}if(!0===h){if(s)continue;return r}if(s)return i}else{if(l.keyword===Cu.ALL){if(s)continue;return r}if(-1!==(h=t(a,l))){if(!0===h){if(s)continue;return r}if(s)return i}else c=!0}}return c?-1:s?r:i}},Hu.prototype._filter=function(t,e){if(void 0===e&&(e=this.selection),e.error)return e;var n=e.rules.length;if(0===n)return e;var r={operator:e.operator,rules:[]};e.hasOwnProperty("negate")&&(r.negate=e.negate);for(var i=0;i<n;++i){var o=e.rules[i];if(o.hasOwnProperty("operator")){var a=this._filter(t,o);null!==a&&r.rules.push(a)}else t(o)||r.rules.push(o)}return r.rules.length>0?e:null},Hu.prototype.makeAtomTest=function(t){var e;return e=t?this._filter(function(t){return void 0!==t.keyword&&!Eu.includes(t.keyword)||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||void 0!==t.sstruc))))}):this.selection,this._makeTest(Uu,e)},Hu.prototype.makeResidueTest=function(t){var e;return e=t?this._filter(function(t){return!(void 0===t.keyword||!Eu.includes(t.keyword))||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.atomname||(void 0!==t.element||void 0!==t.altloc))))}):this.selection,this._makeTest(ju,e)},Hu.prototype.makeChainTest=function(t){var e;return e=t?this._filter(function(t){return void 0!==t.keyword&&!Mu.includes(t.keyword)||(void 0!==t.resname||(void 0!==t.resno||(void 0!==t.atomname||(void 0!==t.element||(void 0!==t.altloc||(void 0!==t.sstruc||void 0!==t.inscode))))))}):this.selection,this._makeTest(Gu,e)},Hu.prototype.makeModelTest=function(t){var e;return e=t?this._filter(function(t){return void 0!==t.keyword||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||(void 0!==t.atomname||(void 0!==t.element||(void 0!==t.altloc||(void 0!==t.sstruc||void 0!==t.inscode)))))))}):this.selection,this._makeTest(Vu,e)},Object.defineProperties(Hu.prototype,$u);var Wu=function(t){function e(e){var n=this;t.call(this,e);var r=e.dataList||[];this.colormakerList=[],this.selectionList=[],r.forEach(function(t){var e=t[0],r=t[1],i=t[2];void 0===i&&(i={}),ol.hasScheme(e)?Object.assign(i,{scheme:e,structure:n.structure}):Object.assign(i,{scheme:"uniform",value:new En(e).getHex()}),n.colormakerList.push(ol.getScheme(i)),n.selectionList.push(new Hu(r))})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){for(var e=0,n=this.selectionList.length;e<n;++e)if(this.selectionList[e].test(t))return this.colormakerList[e].atomColor(t);return 16777215},e}(xu),qu={"":"",OrRd:"[S] Orange-Red",PuBu:"[S] Purple-Blue",BuPu:"[S] Blue-Purple",Oranges:"[S] Oranges",BuGn:"[S] Blue-Green",YlOrBr:"[S] Yellow-Orange-Brown",YlGn:"[S] Yellow-Green",Reds:"[S] Reds",RdPu:"[S] Red-Purple",Greens:"[S] Greens",YlGnBu:"[S] Yellow-Green-Blue",Purples:"[S] Purples",GnBu:"[S] Green-Blue",Greys:"[S] Greys",YlOrRd:"[S] Yellow-Orange-Red",PuRd:"[S] Purple-Red",Blues:"[S] Blues",PuBuGn:"[S] Purple-Blue-Green",Viridis:"[D] Viridis",Spectral:"[D] Spectral",RdYlGn:"[D] Red-Yellow-Green",RdBu:"[D] Red-Blue",PiYG:"[D] Pink-Yellowgreen",PRGn:"[D] Purplered-Green",RdYlBu:"[D] Red-Yellow-Blue",BrBG:"[D] Brown-Bluegreen",RdGy:"[D] Red-Grey",PuOr:"[D] Purple-Orange",Set1:"[Q] Set1",Set2:"[Q] Set2",Set3:"[Q] Set3",Dark2:"[Q] Dark2",Paired:"[Q] Paired",Pastel1:"[Q] Pastel1",Pastel2:"[Q] Pastel2",Accent:"[Q] Accent",rainbow:"[?] Rainbow",rwb:"[?] Red-White-Blue"},Xu={"":"",rgb:"Red Green Blue",hsv:"Hue Saturation Value",hsl:"Hue Saturation Lightness",hsi:"Hue Saturation Intensity",lab:"CIE L*a*b*",hcl:"Hue Chroma Lightness"},Yu=function(){this.schemes={},this.userSchemes={}};Yu.prototype.getScheme=function(t){var e=(t||{}).scheme||"";return new(e in this.schemes?this.schemes[e]:e in this.userSchemes?this.userSchemes[e]:xu)(t)},Yu.prototype.getSchemes=function(){var t={};return Object.keys(this.schemes).forEach(function(e){t[e]=e}),Object.keys(this.userSchemes).forEach(function(e){t[e]=e.split("|")[1]}),t},Yu.prototype.getScales=function(){return qu},Yu.prototype.getModes=function(){return Xu},Yu.prototype.add=function(t,e){this.schemes[t]=e},Yu.prototype.addScheme=function(t,e){return t instanceof xu||(t=this._createScheme(t,e)),this._addUserScheme(t,e)},Yu.prototype._addUserScheme=function(t,e){e=e||"";var n=pu()+"|"+e;return this.userSchemes[n]=t,n},Yu.prototype.removeScheme=function(t){delete this.userSchemes[t]},Yu.prototype._createScheme=function(t,e){var n=function(n){xu.call(this,n),this.label=e||"",t.call(this,n)};return(n.prototype=xu.prototype).constructor=xu,n},Yu.prototype.addSelectionScheme=function(t,e){var n=function(e){function n(n){e.call(this,Object.assign({dataList:t},n))}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n}(Wu);return this._addUserScheme(n,e)},Yu.prototype.hasScheme=function(t){return t in this.schemes||t in this.userSchemes};var Ku=ys(),Zu="undefined"!=typeof window&&void 0!==window.orientation,Qu=!1;var Ju=!1;var tl,el={log:Function.prototype.bind.call(console.log,console),info:Function.prototype.bind.call(console.info,console),warn:Function.prototype.bind.call(console.warn,console),error:Function.prototype.bind.call(console.error,console),time:Function.prototype.bind.call(console.time,console),timeEnd:Function.prototype.bind.call(console.timeEnd,console)},nl=!!(tl=function(t){if("undefined"!=typeof window){var e=new RegExp(t+"=([^&#=]*)").exec(window.location.search);return e?decodeURIComponent(e[1]):void 0}}("debug"))&&("string"!=typeof tl||/^1|true|t|yes|y$/i.test(tl));var rl='<div style="display:flex;align-items:center;justify-content:center;height:100%;"><p style="padding:15px;text-align:center;">Your browser/graphics card does not seem to support <a target="_blank" href="https://en.wikipedia.org/wiki/WebGL">WebGL</a>.<br/><br/>Find out how to get it <a target="_blank" href="http://get.webgl.org/">here</a>.</p></div>',il=new zs,ol=new Yu,al=new Ls("datasource"),sl=new Ls("representatation"),cl=new Ls("parser"),ul=new Ls("shader"),ll=new Ls("decompressor"),hl=new Ls("component"),pl=function(t,e){var n=e||{};this.compressed=gs(n.compressed,!1),this.binary=gs(n.binary,!1),this.json=gs(n.json,!1),this.xml=gs(n.xml,!1),this.src=t,this.chunkSize=10485760,this.newline="\n",this.__pointer=0,this.__partialLine="",this.__srcName&&(this[this.__srcName]=t)},dl={type:{},__srcName:{}};dl.type.get=function(){return""},dl.__srcName.get=function(){},pl.prototype.isBinary=function(){return this.binary||this.compressed},pl.prototype.onload=function(){},pl.prototype.onprogress=function(){},pl.prototype.onerror=function(){},pl.prototype.read=function(){var t=this;return new Promise(function(e,n){try{t._read(function(n){var r=ll.get(t.compressed);t.compressed&&r?t.data=r(n):((t.binary||t.compressed)&&n instanceof ArrayBuffer&&(n=new Uint8Array(n)),t.data=n),e(t.data)})}catch(t){n(t)}})},pl.prototype._read=function(t){t(this.src)},pl.prototype._chunk=function(t,e){return e=Math.min(this.data.length,e),0===t&&this.data.length===e?this.data:this.isBinary()?this.data.subarray(t,e):this.data.substring(t,e)},pl.prototype.chunk=function(t){var e=t+this.chunkSize;return this._chunk(t,e)},pl.prototype.peekLines=function(t){var e,n=this.data,r=n.length,i=this.isBinary()?this.newline.charCodeAt(0):this.newline,o=0;for(e=0;e<r&&(n[e]===i&&++o,o!==t);++e);var a=this._chunk(0,e+1);return this.chunkToLines(a,"",e>r).lines},pl.prototype.chunkCount=function(){return Math.floor(this.data.length/this.chunkSize)+1},pl.prototype.asText=function(){return this.isBinary()?Cs(this.data):this.data},pl.prototype.chunkToLines=function(t,e,n){var r=this.newline;if(!this.isBinary()&&t.length===this.data.length)return{lines:t.split(r),partialLine:""};var i=[],o=this.isBinary()?Cs(t):t,a=o.lastIndexOf(r);if(-1===a)e+=o;else{var s=e+o.substr(0,a);i=i.concat(s.split(r)),e=a===o.length-r.length?"":o.substr(a+r.length)}return n&&""!==e&&i.push(e),{lines:i,partialLine:e}},pl.prototype.nextChunk=function(){var t=this.__pointer;if(!(t>this.data.length))return this.__pointer+=this.chunkSize,this.chunk(t)},pl.prototype.nextChunkOfLines=function(){var t=this.nextChunk();if(void 0!==t){var e=this.__pointer>this.data.length,n=this.chunkToLines(t,this.__partialLine,e);return this.__partialLine=n.partialLine,n.lines}},pl.prototype.eachChunk=function(t){for(var e=this.chunkSize,n=this.data.length,r=this.chunkCount(),i=0;i<n;i+=e){t(this.chunk(i),Math.round(i/e),r)}},pl.prototype.eachChunkOfLines=function(t){var e=this;this.eachChunk(function(n,r,i){var o=r===i+1,a=e.chunkToLines(n,e.__partialLine,o);e.__partialLine=a.partialLine,t(a.lines,r,i)})},pl.prototype.dispose=function(){delete this.src,this.__srcName&&delete this[this.__srcName]},Object.defineProperties(pl.prototype,dl);var fl=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__srcName:{}};return n.type.get=function(){return"file"},n.__srcName.get=function(){return"file"},e.prototype._read=function(t){var e,n,r=this;"function"==typeof importScripts?(e=new window.FileReaderSync,n=this.binary||this.compressed?e.readAsArrayBuffer(this.file):e.readAsText(this.file),t(n)):((e=new window.FileReader).onload=function(e){t(e.target.result)},"function"==typeof this.onprogress&&(e.onprogress=function(t){r.onprogress(t)}),"function"==typeof this.onerror&&(e.onerror=function(t){r.onerror(t)}),this.binary||this.compressed?e.readAsArrayBuffer(this.file):e.readAsText(this.file))},Object.defineProperties(e.prototype,n),e}(pl),ml=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__srcName:{}};return n.type.get=function(){return"network"},n.__srcName.get=function(){return"url"},e.prototype._read=function(t){var e=this.src;"function"==typeof importScripts&&"../"===e.substr(0,3)&&(e="../"+e);var n=new window.XMLHttpRequest;n.open("GET",e,!0),n.addEventListener("load",function(){if(200!==n.status&&304!==n.status&&0!==n.status)throw"function"==typeof this.onerror&&this.onerror(n.status),new Error("NetworkStreamer._read: status code "+n.status);try{t(n.response)}catch(t){this.onerror(t)}}.bind(this),!1),"function"==typeof this.onerror&&n.addEventListener("error",function(t){this.onerror(t)}.bind(this),!1),this.isBinary()?n.responseType="arraybuffer":this.json?n.responseType="json":this.xml?n.responseType="document":n.responseType="text",n.send(null)},Object.defineProperties(e.prototype,n),e}(pl),gl=["mmtf","dcd","mrc","ccp4","map","dsn6","brix","dxbin"],vl=["json"],yl=["xml","validation"],bl=function(t,e){var n=Object.assign({},e),r=gl.includes(n.ext);this.compressed=gs(n.compressed,!1),this.binary=gs(n.binary,r),this.name=gs(n.name,""),this.ext=gs(n.ext,""),this.dir=gs(n.dir,""),this.path=gs(n.path,""),this.protocol=gs(n.protocol,""),this.params=e;var i={compressed:this.compressed,binary:this.binary,json:vl.includes(this.ext),xml:yl.includes(this.ext)};"undefined"!=typeof File&&t instanceof window.File||"undefined"!=typeof Blob&&t instanceof window.Blob?this.streamer=new fl(t,i):this.streamer=new ml(t,i),"function"==typeof n.onProgress&&(this.streamer.onprogress=n.onprogress)};bl.prototype.load=function(){return Promise.reject(new Error("not implemented"))};var xl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){return new(cl.get(this.ext))(this.streamer,this.params).parse()},e}(bl),_l=function(t,e,n){this.signals={elementAdded:new Su,elementRemoved:new Su,nameChanged:new Su},this.name=e,this.path=n,this.dir=n.substring(0,n.lastIndexOf("/")+1);try{this.fn=new Function("stage","panel","__name__","__path__","__dir__",t)}catch(t){el.error("Script compilation failed",t),this.fn=function(){}}},wl={type:{}};wl.type.get=function(){return"Script"},_l.prototype.call=function(t){var e=this,n={add:function(){this.signals.elementAdded.dispatch(arguments)}.bind(this),remove:function(){this.signals.elementRemoved.dispatch(arguments)}.bind(this),setName:function(t){this.signals.nameChanged.dispatch(t)}.bind(this)};return new Promise(function(r,i){var o=[t,n,e.name,e.path,e.dir];try{e.fn.apply(null,o),r()}catch(t){el.error("Script.fn",t),i(t)}})},Object.defineProperties(_l.prototype,wl);var Sl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){var t=this;return this.streamer.read().then(function(){return new _l(t.streamer.asText(),t.name,t.path)})},e}(bl),Cl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){var t,e=this;return t=this.protocol?this.protocol+"://"+this.dir:this.dir,this.streamer.read().then(function(){var n=JSON.parse(e.streamer.asText()),r=[];return n.files.map(function(e){r.push(Al(t+e,{ext:"text",useWorker:!1}))}),Promise.all(r).then(function(t){var r=t.reduce(function(t,e){return t+"\n\n"+e.data},"");return r+=n.source||"",new _l(r,e.name,e.path)})})},e}(bl);function Al(t,e){var n,r,i,o,a=Object.assign((r=bs(n=t),(i=al.get(r.protocol))&&!(r=bs(i.getUrl(r.src))).ext&&i.getExt&&(r.ext=i.getExt(n)),r),e);return cl.names.includes(a.ext)?o=xl:["ngl","js"].includes(a.ext)?o=Sl:"plugin"===a.ext&&(o=Cl),o?new o(a.src,a).load():Promise.reject(new Error("autoLoad: ext '"+a.ext+"' unknown"))}
/*! sprintf-js v1.0.3 | Copyright (c) 2007-present, Alexandru Marasteanu <hello@alexei.ro> | BSD-3-Clause */var El={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/bcdiefguxX/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function Ml(){var t=arguments[0],e=Ml.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=Ml.parse(t)),Ml.format.call(null,e[t],arguments)}function Tl(t){return"number"==typeof t?"number":"string"==typeof t?"string":Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}Ml.format=function(t,e){var n,r,i,o,a,s,c,u=1,l=t.length,h="",p=[],d=!0,f="";for(r=0;r<l;r++)if("string"===(h=Tl(t[r])))p[p.length]=t[r];else if("array"===h){if((o=t[r])[2])for(n=e[u],i=0;i<o[2].length;i++){if(!n.hasOwnProperty(o[2][i]))throw new Error(Ml('[sprintf] property "%s" does not exist',o[2][i]));n=n[o[2][i]]}else n=o[1]?e[o[1]]:e[u++];if(El.not_type.test(o[8])&&El.not_primitive.test(o[8])&&"function"==Tl(n)&&(n=n()),El.numeric_arg.test(o[8])&&"number"!=Tl(n)&&isNaN(n))throw new TypeError(Ml("[sprintf] expecting number but found %s",Tl(n)));switch(El.number.test(o[8])&&(d=n>=0),o[8]){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,o[6]?parseInt(o[6]):0);break;case"e":n=o[7]?parseFloat(n).toExponential(o[7]):parseFloat(n).toExponential();break;case"f":n=o[7]?parseFloat(n).toFixed(o[7]):parseFloat(n);break;case"g":n=o[7]?parseFloat(n).toPrecision(o[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=String(n),n=o[7]?n.substring(0,o[7]):n;break;case"t":n=String(!!n),n=o[7]?n.substring(0,o[7]):n;break;case"T":n=Tl(n),n=o[7]?n.substring(0,o[7]):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=o[7]?n.substring(0,o[7]):n;break;case"x":n=parseInt(n,10).toString(16);break;case"X":n=parseInt(n,10).toString(16).toUpperCase()}El.json.test(o[8])?p[p.length]=n:(!El.number.test(o[8])||d&&!o[3]?f="":(f=d?"+":"-",n=n.toString().replace(El.sign,"")),s=o[4]?"0"===o[4]?"0":o[4].charAt(1):" ",c=o[6]-(f+n).length,a=o[6]&&c>0?Il(s,c):"",p[p.length]=o[5]?f+n+a:"0"===s?f+a+n:a+f+n)}return p.join("")},Ml.cache={},Ml.parse=function(t){for(var e=t,n=[],r=[],i=0;e;){if(null!==(n=El.text.exec(e)))r[r.length]=n[0];else if(null!==(n=El.modulo.exec(e)))r[r.length]="%";else{if(null===(n=El.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(n[2]){i|=1;var o=[],a=n[2],s=[];if(null===(s=El.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=s[1];""!==(a=a.substring(s[0].length));)if(null!==(s=El.key_access.exec(a)))o[o.length]=s[1];else{if(null===(s=El.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=s[1]}n[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r[r.length]=n}e=e.substring(n[0].length)}return r};var Pl={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," ","  ","   ","    ","     ","      ","       "],_:["","_","__","___","____","_____","______","_______"]};function Il(t,e){return e>=0&&e<=7&&Pl[t]?Pl[t][e]:Array(e+1).join(t)}var Rl=function(){this.count=0,this.signals={countChanged:new Su}};function Ol(){this.signals={updated:new Su},this.begin(),this.maxDuration=-1/0,this.minDuration=1/0,this.avgDuration=14,this.lastDuration=1/0,this.prevFpsTime=0,this.lastFps=1/0,this.lastFrames=1,this.frames=0,this.count=0}Rl.prototype.clear=function(){this.change(-this.count)},Rl.prototype.change=function(t){this.count+=t,this.signals.countChanged.dispatch(t,this.count),this.count<0&&el.warn("Counter.count below zero",this.count)},Rl.prototype.increment=function(){this.change(1)},Rl.prototype.decrement=function(){this.change(-1)},Rl.prototype.listen=function(t){this.change(t.count),t.signals.countChanged.add(this.change,this)},Rl.prototype.unlisten=function(t){var e=t.signals.countChanged;e.has(this.change,this)&&e.remove(this.change,this)},Rl.prototype.onZeroOnce=function(t,e){if(0===this.count)t.call(e,0,0);else{var n=function(){0===this.count&&(this.signals.countChanged.remove(n,this),t.apply(e,arguments))};this.signals.countChanged.add(n,this)}},Rl.prototype.dispose=function(){this.clear(),this.signals.countChanged.dispose()},ul.add("shader/BasicLine.vert","void main(){\n#include begin_vertex\n#include project_vertex\n}"),ul.add("shader/BasicLine.frag","uniform vec3 uColor;\n#include common\n#include fog_pars_fragment\nvoid main(){\ngl_FragColor = vec4( uColor, 1.0 );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),ul.add("shader/Quad.vert","varying vec2 vUv;\nvoid main() {\nvUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"),ul.add("shader/Quad.frag","varying vec2 vUv;\nuniform sampler2D tForeground;\nuniform float scale;\nvoid main() {\nvec4 foreground = texture2D( tForeground, vUv );\ngl_FragColor = foreground * scale;\n}"),Ol.prototype={update:function(){this.startTime=this.end(),this.currentTime=this.startTime,this.signals.updated.dispatch()},begin:function(){this.startTime=window.performance.now(),this.lastFrames=this.frames},end:function(){var t=window.performance.now();return this.count+=1,this.frames+=1,this.lastDuration=t-this.startTime,this.minDuration=Math.min(this.minDuration,this.lastDuration),this.maxDuration=Math.max(this.maxDuration,this.lastDuration),this.avgDuration-=this.avgDuration/30,this.avgDuration+=this.lastDuration/30,t>this.prevFpsTime+1e3&&(this.lastFps=this.frames,this.prevFpsTime=t,this.frames=0),t}},ul.add("shader/chunk/dull_interior_fragment.glsl","#ifdef DULL_INTERIOR\nif( gl_FrontFacing == false ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#endif"),ul.add("shader/chunk/fog_fragment.glsl","#ifdef USE_FOG\nfloat depth = length( vViewPosition );\n#ifdef FOG_EXP2\nfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"),ul.add("shader/chunk/matrix_scale.glsl","float matrixScale( in mat4 m ){\nvec4 r = m[ 0 ];\nreturn sqrt( r[ 0 ] * r[ 0 ] + r[ 1 ] * r[ 1 ] + r[ 2 ] * r[ 2 ] );\n}"),ul.add("shader/chunk/nearclip_vertex.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip - 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),ul.add("shader/chunk/nearclip_fragment.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip )\ndiscard;\n#endif"),ul.add("shader/chunk/opaque_back_fragment.glsl","#ifdef OPAQUE_BACK\n#ifdef FLIP_SIDED\nif( gl_FrontFacing == true ){\ngl_FragColor.a = 1.0;\n}\n#else\nif( gl_FrontFacing == false ){\ngl_FragColor.a = 1.0;\n}\n#endif\n#endif"),ul.add("shader/chunk/radiusclip_vertex.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius + 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),ul.add("shader/chunk/radiusclip_fragment.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius )\ndiscard;\n#endif"),ul.add("shader/chunk/unpack_color.glsl","vec3 unpackColor(float f) {\nvec3 color;\ncolor.r = floor(f / 256.0 / 256.0);\ncolor.g = floor((f - color.r * 256.0 * 256.0) / 256.0);\ncolor.b = floor(f - color.r * 256.0 * 256.0 - color.g * 256.0);\nreturn color / 255.0;\n}");var Ll=/^(?!\/\/)\s*#include\s+(\S+)/gim,kl={};function Nl(t,e){e=e||{};var n=t+"|";for(var r in e)n+=r+":"+e[r];if(!kl[n]){var i=function(t){if(void 0===t)return"";var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")+"\n"}(e),o=ul.get("shader/"+t);if(!o)throw new Error("empty shader, '"+t+"'");o=o.replace(Ll,function(t,e){var n="shader/chunk/"+e+".glsl";return ul.get(n)||Pn[e]||""}),kl[n]=i+o}return kl[n]}if("undefined"!=typeof window&&window.WebGLRenderingContext){var Dl=window.WebGLRenderingContext.prototype,zl=Dl.getShaderParameter;Dl.getShaderParameter=function(){return!nl||zl.apply(this,arguments)};var Fl=Dl.getShaderInfoLog;Dl.getShaderInfoLog=function(){return nl?Fl.apply(this,arguments):""};var Bl=Dl.getProgramParameter;Dl.getProgramParameter=function(t,e){return!nl&&e===Dl.LINK_STATUS||Bl.apply(this,arguments)};var Ul=Dl.getProgramInfoLog;Dl.getProgramInfoLog=function(){return nl?Ul.apply(this,arguments):""}}var jl=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];function Gl(t,e,n,r){var i=r||{},o=void 0!==i.factor?i.factor:2,a=void 0!==i.antialias&&i.antialias,s=i.onProgress,c=i.onFinish;a&&(o*=2);var u=o*o,l=document.createElement("canvas"),h=n.width,p=n.height;a?(l.width=h*o/2,l.height=p*o/2):(l.width=h*o,l.height=p*o);var d=l.getContext("2d"),f=n.sampleLevel;function m(e){var r=e%o,i=Math.floor(e/o),c=r*h,l=i*p;n.camera.setViewOffset(h*o,p*o,c,l,h,p),n.render(),a?d.drawImage(t.domElement,Math.floor(c/2),Math.floor(l/2),Math.ceil(h/2),Math.ceil(p/2)):d.drawImage(t.domElement,Math.floor(c),Math.floor(l),Math.ceil(h),Math.ceil(p)),"function"==typeof s&&s(e+1,u,!1)}function g(){n.setSampling(f),n.camera.view=null,"function"==typeof c&&c(u+1,u,!1)}n.setSampling(-1),this.render=function(){for(var t=0;t<=u;++t)t===u?g():m(t)},this.renderAsync=function(){var t=0;function e(){t===u?g():m(t),t+=1}for(var n=0;n<=u;++n)setTimeout(e,0,n)},this.canvas=l}jl.forEach(function(t){t.forEach(function(t){t[0]*=.0625,t[1]*=.0625})}),Gl.prototype.constructor=Gl;var Vl=2*Math.PI;function Hl(t,e,n,r,i){n=n||1,r=r||0;var o,a,s=i?i.length:t.length/n,c=0,u=0;if(i)for(a=0;a<s;++a)o=(t[i[a]*n+r]+e)%e/e*Vl-Math.PI,c+=Math.cos(o),u+=Math.sin(o);else for(a=r;a<s;a+=n)o=(t[a]+e)%e/e*Vl-Math.PI,c+=Math.cos(o),u+=Math.sin(o);return c/=s,u/=s,(Math.atan2(u,c)+Math.PI)/Vl*e}function $l(t,e,n,r){var i=t.length;n=n||new Float32Array(i),r=r||0;for(var o=0;o<i;o+=3)n[r+o+0]=(t[o+0]+e[o+0])/2,n[r+o+1]=(t[o+1]+e[o+1])/2,n[r+o+2]=(t[o+2]+e[o+2])/2;return n}function Wl(t,e,n){for(var r=n||new Float32Array(t),i=0;i<t;++i)r[i]=e;return r}function ql(t,e,n,r,i){for(var o,a=i||new Float32Array(3*t),s=0;s<t;++s)a[(o=3*s)+0]=e,a[o+1]=n,a[o+2]=r;return a}function Xl(t){for(var e=new Float32Array(t),n=0;n<t;++n)e[n]=n;return e}function Yl(t,e,n,r){void 0===n&&(n=0);for(var i=r||new Float32Array(t*e),o=0;o<t;++o)for(var a=n+o*e,s=0;s<e;++s)i[a+s]=o;return i}function Kl(t,e,n,r,i){for(var o=0;o<i;++o)e[r+o]=t[n+o]}function Zl(t,e,n,r){Kl(t,t,e,n,r)}new Float32Array(4),new Float32Array(4);function Ql(t){for(var e=t.length,n=0,r=0;r<e;++r)n+=t[r];return n}function Jl(t,e){var n=e||{},r=gs(n.trim,!1),i=gs(n.factor,1),o=gs(n.antialias,!1),a=gs(n.transparent,!1),s=t.renderer,c=t.camera,u=s.getClearAlpha(),l=s.getClearColor();function h(e){var n=i;o&&(n*=2),e&&(n=1/n),t.scene.traverse(function(t){var e=t.material;e&&e.linewidth&&(e.linewidth*=n),e&&e.uniforms&&e.uniforms.size&&void 0===e.uniforms.size.__seen&&(e.uniforms.size.value*=n,e.uniforms.size.__seen=!0)}),t.scene.traverse(function(t){var e=t.material;e&&e.uniforms&&e.uniforms.size&&delete e.uniforms.size.__seen})}function p(t){if(r){var e=l;return function(t,e,n,r,i){var o,a,s,c,u=t.height,l=t.width,h=t.getContext("2d").getImageData(0,0,l,u).data;for(s=!1,a=0;a<u;a++){for(o=0;o<l;o++)if(h[c=4*(a*l+o)]!==e||h[c+1]!==n||h[c+2]!==r||h[c+3]!==i){s=!0;break}if(s)break}var p=a;for(s=!1,o=0;o<l;o++){for(a=0;a<u;a++)if(h[c=4*(a*l+o)]!==e||h[c+1]!==n||h[c+2]!==r||h[c+3]!==i){s=!0;break}if(s)break}var d=o;for(s=!1,a=u-1;a>=0;a--){for(o=l-1;o>=0;o--)if(h[c=4*(a*l+o)]!==e||h[c+1]!==n||h[c+2]!==r||h[c+3]!==i){s=!0;break}if(s)break}var f=a;for(s=!1,o=l-1;o>=0;o--){for(a=u-1;a>=0;a--)if(h[c=4*(a*l+o)]!==e||h[c+1]!==n||h[c+2]!==r||h[c+3]!==i){s=!0;break}if(s)break}var m=o,g=document.createElement("canvas");return g.width=m-d,g.height=f-p,g.getContext("2d").drawImage(t,d,p,g.width,g.height,0,0,g.width,g.height),g}(t,a?0:255*e.r,a?0:255*e.g,a?0:255*e.b,a?0:255)}return t}function d(t,e,r){"function"==typeof n.onProgress&&n.onProgress(t,e,r)}return new Promise(function(e){var n=new Gl(s,c,t,{factor:i,antialias:o,onProgress:d,onFinish:function(r,i){p(n.canvas).toBlob(function(n){s.setClearAlpha(u),h(!0),t.requestRender(),d(i,i,!0),e(n)},"image/png")}});s.setClearAlpha(a?0:1),h(),n.renderAsync()})}var th=new Ne,eh=new De,nh=new De;var rh=new De,ih=new De;var oh=new Float32Array(4),ah=new Uint8Array(4),sh=new De;function ch(t,e,n,r,i){var o=i.uniforms,a=[];if(o.objectId&&(o.objectId.value=Qu?this.id:this.id/255,a.push("objectId")),(o.modelViewMatrixInverse||o.modelViewMatrixInverseTranspose||o.modelViewProjectionMatrix||o.modelViewProjectionMatrixInverse)&&this.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,this.matrixWorld),o.modelViewMatrixInverse&&(o.modelViewMatrixInverse.value.getInverse(this.modelViewMatrix),a.push("modelViewMatrixInverse")),o.modelViewMatrixInverseTranspose&&(o.modelViewMatrixInverse?o.modelViewMatrixInverseTranspose.value.copy(o.modelViewMatrixInverse.value).transpose():o.modelViewMatrixInverseTranspose.value.getInverse(this.modelViewMatrix).transpose(),a.push("modelViewMatrixInverseTranspose")),o.modelViewProjectionMatrix&&(n.updateProjectionMatrix(),o.modelViewProjectionMatrix.value.multiplyMatrices(n.projectionMatrix,this.modelViewMatrix),a.push("modelViewProjectionMatrix")),o.modelViewProjectionMatrixInverse&&(o.modelViewProjectionMatrix?(sh.copy(o.modelViewProjectionMatrix.value),o.modelViewProjectionMatrixInverse.value.getInverse(sh)):(n.updateProjectionMatrix(),sh.multiplyMatrices(n.projectionMatrix,this.modelViewMatrix),o.modelViewProjectionMatrixInverse.value.getInverse(sh)),a.push("modelViewProjectionMatrixInverse")),a.length){var s=t.properties.get(i);if(s.program){var c=t.getContext(),u=s.program;c.useProgram(u.program);var l=u.getUniforms();a.forEach(function(t){l.setValue(c,t,o[t].value)})}}}function uh(t){var e,n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E,M,T,P,I,R,O,L,k,N={ticked:new Su};if((e="string"==typeof t?document.getElementById(t):t instanceof window.Element?t:document.createElement("div"))===document.body)n=window.innerWidth||1,r=window.innerHeight||1;else{var z=e.getBoundingClientRect();n=z.width||1,r=z.height||1}if(h={fogColor:new En(0),fogNear:50,fogFar:100,backgroundColor:new En(0),cameraType:"perspective",cameraFov:40,cameraZ:-80,clipNear:0,clipFar:100,clipDist:10,lightColor:new En(14540253),lightIntensity:1,ambientColor:new En(14540253),ambientIntensity:.2,sampleLevel:0},p=new Ol,function(){var t=new Ne(0,0,0);(d=new or(h.cameraFov,n/r)).position.z=h.cameraZ,d.lookAt(t),(f=new ir(n/-2,n/2,r/2,r/-2)).position.z=h.cameraZ,f.lookAt(t),m="orthographic"===h.cameraType?f:d;m.updateProjectionMatrix()}(),V(),!1===function(){var t=window.devicePixelRatio;try{A=new ei({preserveDrawingBuffer:!0,alpha:!0,antialias:!0})}catch(t){return e.innerHTML=rl,!1}A.setPixelRatio(t),A.setSize(n,r),A.autoClear=!1,A.sortObjects=!0,i=A.extensions.get("EXT_frag_depth"),Ju=i,A.extensions.get("OES_element_index_uint"),function(t){Qu=t}(A.extensions.get("OES_texture_float")&&A.extensions.get("WEBGL_color_buffer_float")||"Chrome"===Ku&&A.extensions.get("OES_texture_float")),e.appendChild(A.domElement);var i;var o=n*t,a=r*t;A.extensions.get("OES_texture_float"),E=A.extensions.get("OES_texture_half_float"),A.extensions.get("WEBGL_color_buffer_float"),(M=new Le(o,a,{minFilter:Tt,magFilter:Tt,stencilBuffer:!1,format:Xt,type:Qu?Ut:kt})).texture.generateMipmaps=!1,T=new Le(o,a,{minFilter:Rt,magFilter:Rt,format:Xt}),P=new Le(o,a,{minFilter:Tt,magFilter:Tt,format:Xt,type:Zu?kt:E?jt:Qu?Ut:kt}),R=new Gn({uniforms:I={tForeground:{type:"t",value:null},scale:{type:"f",value:1}},vertexShader:Nl("Quad.vert"),fragmentShader:Nl("Quad.frag"),premultipliedAlpha:!0,transparent:!0,blending:D,depthTest:!1,depthWrite:!1}),O=new ir(-1,1,1,-1,0,1),L=(new ii).add(new Lr(new Mr(2,2),R))}())return this.container=e,void el.error("Viewer: could not initialize renderer");var F=new Hn,B=new Ne,U=0;!function(){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]),e=new Float32Array(24),n=new Cr;n.setIndex(new yr(t,1)),n.addAttribute("position",new yr(e,3));var r=new Gn({uniforms:{uColor:{value:new En("skyblue")}},vertexShader:Nl("BasicLine.vert"),fragmentShader:Nl("BasicLine.frag"),linewidth:2});k=new fi(n,r),C.add(k)}(),Y(),X();var j=new Ne,G={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};function V(){g||(g=new ii),(b=new yi).name="rotationGroup",g.add(b),(x=new yi).name="translationGroup",b.add(x),(_=new yi).name="modelGroup",x.add(_),(w=new yi).name="pickingGroup",x.add(w),(S=new yi).name="backgroundGroup",x.add(S),(C=new yi).name="helperGroup",x.add(C),g.fog=new ri,v=new To(h.lightColor,h.lightIntensity),g.add(v),y=new Oo(h.ambientLight,h.ambientIntensity),g.add(y)}function H(){var t=k.geometry.attributes.position,e=t.array,n=F.min,r=F.max;e[0]=r.x,e[1]=r.y,e[2]=r.z,e[3]=n.x,e[4]=r.y,e[5]=r.z,e[6]=n.x,e[7]=n.y,e[8]=r.z,e[9]=r.x,e[10]=n.y,e[11]=r.z,e[12]=r.x,e[13]=r.y,e[14]=n.z,e[15]=n.x,e[16]=r.y,e[17]=n.z,e[18]=n.x,e[19]=n.y,e[20]=n.z,e[21]=r.x,e[22]=n.y,e[23]=n.z,t.needsUpdate=!0,F.isEmpty()||k.geometry.computeBoundingSphere()}function $(t,e){function n(r){r instanceof yi?r.children.forEach(n):(r.userData.buffer=t,r.userData.instance=e,r.onBeforeRender=ch)}var r=t.getMesh();e&&r.applyMatrix(e.matrix),n(r),t.group.add(r);var i=t.getWireframeMesh();if(e&&(i.matrix.copy(r.matrix),i.position.copy(r.position),i.quaternion.copy(r.quaternion),i.scale.copy(r.scale)),n(i),t.wireframeGroup.add(i),t.pickable){var o=t.getPickingMesh();e&&(o.matrix.copy(r.matrix),o.position.copy(r.position),o.quaternion.copy(r.quaternion),o.scale.copy(r.scale)),n(o),t.pickingGroup.add(o)}e?W(t.geometry,t.matrix,e.matrix):W(t.geometry,t.matrix)}function W(t,e,n){function r(t,e,n){t.boundingBox||t.computeBoundingBox();var r=t.boundingBox.clone();e&&r.applyMatrix4(e),n&&r.applyMatrix4(n),r.min.equals(r.max)&&r.expandByScalar(5),F.union(r)}function i(t){var e,n;void 0!==t.geometry&&(t.userData.buffer&&(e=t.userData.buffer.matrix),t.userData.instance&&(n=t.userData.instance.matrix),r(t.geometry,e,n))}t?r(t,e,n):(F.makeEmpty(),_.traverse(i),S.traverse(i)),F.getSize(B),U=B.length()}function q(){var t=n*r*4,e=Qu?new Float32Array(t):new Uint8Array(t);return rt(!0),A.readRenderTargetPixels(M,0,0,n,r,e),e}function X(t,e,n){var r=h;void 0!==t&&r.fogColor.set(t),void 0!==e&&(r.fogNear=e),void 0!==n&&(r.fogFar=n),Q()}function Y(t){var e=h;t&&e.backgroundColor.set(t),X(e.backgroundColor),A.setClearColor(e.backgroundColor,0),A.domElement.style.backgroundColor=e.backgroundColor.getStyle(),Q()}function K(t,e){n=t||1,r=e||1,d.aspect=n/r,f.left=-n/2,f.right=n/2,f.top=r/2,f.bottom=-r/2,m.updateProjectionMatrix();var i=window.devicePixelRatio;A.setPixelRatio(i),A.setSize(n,r);var o=n*i,a=r*i;M.setSize(o,a),T.setSize(o,a),P.setSize(o,a),Q()}function Z(t){var e=G.memory,n=G.render;if(t)e.programs=0,e.geometries=0,e.textures=0,n.calls=0,n.vertices=0,n.faces=0,n.points=0;else{var r=A.info,i=r.memory,o=r.render;e.programs=i.programs,e.geometries=i.geometries,e.textures=i.textures,n.calls+=o.calls,n.vertices+=o.vertices,n.faces+=o.faces,n.points+=o.points}}function Q(){o||(window.performance.now()-p.startTime>22&&(p.begin(),s=!1),o=!0,window.requestAnimationFrame(function(){rt(),p.update()}))}function J(){var t=Fs(d.fov),e=2*Math.tan(t/2)*-m.position.z;f.zoom=r/e}function tt(){m.updateMatrix(),m.updateMatrixWorld(!0),m.matrixWorldInverse.getInverse(m.matrixWorld),m.updateProjectionMatrix(),function(t,e,n,r,i){var o=n.getSize().height,a=n.getPixelRatio(),s="OrthographicCamera"===e.type;rh.getInverse(e.projectionMatrix),ih.copy(e.projectionMatrix).transpose(),t.traverse(function(t){var e=t.material;if(e){var n=t.material.uniforms;if(n){if(e.clipNear){var c=(50-e.clipNear)/50,u=r-i*c;n.nearClip.value=u}n.canvasHeight&&(n.canvasHeight.value=o),n.pixelRatio&&(n.pixelRatio.value=a),n.projectionMatrixInverse&&n.projectionMatrixInverse.value.copy(rh),n.projectionMatrixTranspose&&n.projectionMatrixTranspose.value.copy(ih),n.ortho&&(n.ortho.value=s)}}})}(g,m,A,u,l),function(t,e){t.traverseVisible(function(t){if(t instanceof vi&&t.sortParticles){var n=t.geometry.attributes,r=n.position.count;if(0!==r){var i,o,a,s,c,u,l;eh.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),nh.multiplyMatrices(e.projectionMatrix,eh),t.userData.sortData?(i=t.userData.sortData,a=i.__zArray,o=i.__sortArray,s=i.__cmpFn):(a=new Float32Array(r),o=new Uint32Array(r),i={__zArray:a,__sortArray:o,__cmpFn:s=function(t,e){var n=a[t],r=a[e];return n>r?1:n<r?-1:0}},t.userData.sortData=i);for(var h=0;h<r;++h)th.fromArray(n.position.array,3*h),th.applyMatrix4(nh),a[h]=-th.z,o[h]=h;for(var p in function(t,e,n,r){e=e||function(t,e){return t>e?1:t<e?-1:0};var i,o,a=[],s=-1,c=n=n||0,u=r=(r||t.length)-1,l=0,h=0;function p(e,n){h=t[e],t[e]=t[n],t[n]=h}for(;;)if(u-c<=25){for(o=c+1;o<=u;++o){for(l=t[o],i=o-1;i>=c&&e(t[i],l)>0;)t[i+1]=t[i],--i;t[i+1]=l}if(-1===s)break;u=a[s--],c=a[s--]}else{for(o=u,p(c+u>>1,i=c+1),e(t[c],t[u])>0&&p(c,u),e(t[i],t[u])>0&&p(i,u),e(t[c],t[i])>0&&p(c,i),l=t[i];;){do{i++}while(e(t[i],l)<0);do{o--}while(e(t[o],l)>0);if(o<i)break;p(i,o)}t[c+1]=t[o],t[o]=l,u-i+1>=o-c?(a[++s]=i,a[++s]=u,u=o-1):(a[++s]=c,a[++s]=o-1,c=i)}}(o,s),n){var d=n[p],f=d.array,m=d.itemSize;i[p]||(i[p]=new Float32Array(m*r)),l=i[p],i[p]=f;for(var g=0;g<r;++g){c=o[g];for(var v=0;v<m;++v)u=c*m+v,l[g*m+v]=f[u]}n[p].array=l,n[p].needsUpdate=!0}}}})}(g,m)}function et(t,e,n,r){_.visible=t,w.visible=e,S.visible=n,C.visible=r}function nt(t){t?A.clearTarget(t):A.clear(),et(!1,!1,!0,!1),A.render(g,m,t),t?A.clearTarget(t,!1,!0,!1):A.clearDepth(),Z(),et(!0,!1,!1,nl),A.render(g,m,t),Z()}function rt(t){i?el.warn("tried to call 'render' from within 'render'"):(i=!0,function(){var t=h;(u=j.copy(m.position).length())||(m.position.set(0,0,t.cameraZ),u=Math.abs(t.cameraZ)),l=Math.max(10,.5*U),((l+=F.getCenter(j).length())===1/0||l===-1/0||isNaN(l))&&(l=50);var e=(50-t.clipNear)/50,n=-(50-t.clipFar)/50;m.near=u-l*e,m.far=u+l*n;var r=(50-t.fogNear)/50,i=-(50-t.fogFar)/50,o=g.fog;o.color.set(t.fogColor),o.near=u-l*r,o.far=u+l*i,"PerspectiveCamera"===m.type?(m.near=Math.max(.1,t.clipDist,m.near),m.far=Math.max(1,m.far),o.near=Math.max(.1,o.near),o.far=Math.max(1,o.far)):"OrthographicCamera"===m.type&&0===t.clipNear&&t.clipDist>0&&u+m.zoom>2*-t.clipDist&&(m.near+=m.zoom+t.clipDist)}(),tt(),j.copy(m.position).setLength(100*U),v.position.copy(m.position).add(j),v.color.set(h.lightColor),v.intensity=h.lightIntensity,y.color.set(h.ambientColor),y.intensity=h.ambientIntensity,Z(!0),t?a||(A.clearTarget(M),et(!1,!0,!1,!1),A.render(g,m,M),Z(),A.setRenderTarget(null)):c>0?function(){var t=jl[Math.max(0,Math.min(c,5))],e=1/t.length;I.tForeground.value=T.texture;for(var n=T.width,r=T.height,i=0;i<t.length;++i){var o=t[i];m.setViewOffset(n,r,o[0],o[1],n,r),tt();var a=e;a+=1/32*((i+.5)/t.length-.5),I.scale.value=a,nt(T),A.render(L,O,P,0===i)}I.scale.value=1,I.tForeground.value=P.texture,A.render(L,O,null,!0),m.view=null}():nt(),a=t,i=!1,o=!1)}this.container=e,this.stats=p,this.signals=N,this.rotationGroup=b,this.translationGroup=x,this.add=function(t,e){e?e.forEach(function(e){$(t,e)}):$(t),t.background?(S.add(t.group),S.add(t.wireframeGroup)):(_.add(t.group),_.add(t.wireframeGroup)),t.pickable&&w.add(t.pickingGroup),nl&&H()},this.remove=function(t){x.children.forEach(function(e){e.remove(t.group),e.remove(t.wireframeGroup)}),t.pickable&&w.remove(t.pickingGroup),W(),nl&&H()},this.clear=function(){el.log("scene cleared"),g.remove(b),V(),A.clear()},this.getPickingPixels=q,this.getImage=function(t){return new Promise(function(e){if(t){var i=n*r*4,o=q();if(Qu){for(var a=new Uint8Array(i),s=0;s<i;++s)a[s]=Math.round(255*o[s]);o=a}var c=document.createElement("canvas");c.width=n,c.height=r;var u=c.getContext("2d"),l=u.getImageData(0,0,n,r);l.data.set(o),u.putImageData(l,0,0),c.toBlob(e,"image/png")}else A.domElement.toBlob(e,"image/png")})},this.makeImage=function(t){return Jl(this,t)},this.setLight=function(t,e,n,r){var i=h;void 0!==t&&i.lightColor.set(t),void 0!==e&&(i.lightIntensity=e),void 0!==n&&i.ambientColor.set(n),void 0!==r&&(i.ambientIntensity=r),Q()},this.setFog=X,this.setBackground=Y,this.setSampling=function(t){void 0!==t&&(h.sampleLevel=t,c=t),Q()},this.setCamera=function(t,e){var n=h;t&&(n.cameraType=t),e&&(n.cameraFov=e),"orthographic"===n.cameraType?m!==f&&((m=f).position.copy(d.position),m.up.copy(d.up),J()):m!==d&&((m=d).position.copy(f.position),m.up.copy(f.up)),d.fov=n.cameraFov,m.updateProjectionMatrix(),Q()},this.setClip=function(t,e,n){var r=h;void 0!==t&&(r.clipNear=t),void 0!==e&&(r.clipFar=e),void 0!==n&&(r.clipDist=n),Q()},this.setSize=K,this.handleResize=function(){if(e===document.body)K(window.innerWidth,window.innerHeight);else{var t=e.getBoundingClientRect();K(t.width,t.height)}},this.pick=function(t,e){var n,r,i;t*=window.devicePixelRatio,e*=window.devicePixelRatio;var o=Qu?oh:ah;rt(!0),A.readRenderTargetPixels(M,t,e,1,1,o),n=Qu?Math.round(255*o[0])<<16&16711680|Math.round(255*o[1])<<8&65280|255&Math.round(255*o[2]):o[0]<<16|o[1]<<8|o[2];var a=Math.round(o[3]),s=w.getObjectById(a);return s&&(r=s.userData.instance,i=s.userData.buffer.picking),{pid:n,instance:r,picker:i}},this.requestRender=Q,this.render=rt,this.animate=function t(){if(N.ticked.dispatch(p),window.performance.now()-p.startTime>500&&!s&&c<3&&-1!==c){var e=c;c=3,o=!0,rt(),s=!0,c=e,nl&&el.log("rendered still frame")}window.requestAnimationFrame(t)},this.updateZoom=J,this.updateHelper=H,this.renderer=A,this.scene=g,this.perspectiveCamera=d,this.boundingBox=F,this.updateBoundingBox=function(){W(),nl&&H()},Object.defineProperties(this,{camera:{get:function(){return m}},width:{get:function(){return n}},height:{get:function(){return r}},sampleLevel:{get:function(){return c}}})}uh.prototype.constructor=uh;function lh(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY;return Math.sqrt(e*e+n*n)}var hh=function(t,e){this.signals={moved:new Su,scrolled:new Su,dragged:new Su,dropped:new Su,clicked:new Su,hovered:new Su};var n=Object.assign({},e);this.hoverTimeout=gs(n.hoverTimeout,50),this.handleScroll=gs(n.handleScroll,!0),this.domElement=t,this.position=new Se,this.prevPosition=new Se,this.down=new Se,this.canvasPosition=new Se,this.moving=!1,this.hovering=!0,this.scrolled=!1,this.lastMoved=1/0,this.which=void 0,this.buttons=void 0,this.pressed=void 0,this.altKey=void 0,this.ctrlKey=void 0,this.metaKey=void 0,this.shiftKey=void 0,this._listen=this._listen.bind(this),this._onMousewheel=this._onMousewheel.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMousedown=this._onMousedown.bind(this),this._onMouseup=this._onMouseup.bind(this),this._onContextmenu=this._onContextmenu.bind(this),this._onTouchstart=this._onTouchstart.bind(this),this._onTouchend=this._onTouchend.bind(this),this._onTouchmove=this._onTouchmove.bind(this),this._listen(),document.addEventListener("mousewheel",this._onMousewheel),document.addEventListener("wheel",this._onMousewheel),document.addEventListener("MozMousePixelScroll",this._onMousewheel),document.addEventListener("mousemove",this._onMousemove),document.addEventListener("mousedown",this._onMousedown),document.addEventListener("mouseup",this._onMouseup),document.addEventListener("contextmenu",this._onContextmenu),document.addEventListener("touchstart",this._onTouchstart),document.addEventListener("touchend",this._onTouchend),document.addEventListener("touchmove",this._onTouchmove)},ph={key:{}};ph.key.get=function(){var t=0;return this.altKey&&(t+=1),this.ctrlKey&&(t+=2),this.metaKey&&(t+=4),this.shiftKey&&(t+=8),t},hh.prototype.setParameters=function(t){var e=Object.assign({},t);this.hoverTimeout=gs(e.hoverTimeout,this.hoverTimeout)},hh.prototype._listen=function(){if(window.performance.now()-this.lastMoved>this.hoverTimeout&&(this.moving=!1),(this.scrolled||!this.moving&&!this.hovering)&&(this.scrolled=!1,-1!==this.hoverTimeout&&this.overElement)){this.hovering=!0;var t=this.canvasPosition;this.signals.hovered.dispatch(t.x,t.y)}window.requestAnimationFrame(this._listen)},hh.prototype._onMousewheel=function(t){var e=this;if(t.target===this.domElement&&this.handleScroll){t.preventDefault(),this._setKeys(t);var n=0;n=t.wheelDelta?t.wheelDelta/40:t.detail?-t.detail/3:-t.deltaY/(t.deltaMode?.33:30),this.signals.scrolled.dispatch(n),setTimeout(function(){e.scrolled=!0},this.hoverTimeout)}},hh.prototype._onMousemove=function(t){t.target===this.domElement?(t.preventDefault(),this.overElement=!0):this.overElement=!1,this._setKeys(t),this.moving=!0,this.hovering=!1,this.lastMoved=window.performance.now(),this.prevPosition.copy(this.position),this.position.set(t.clientX,t.clientY),this._setCanvasPosition(t);var e=this.prevPosition.x-this.position.x,n=this.prevPosition.y-this.position.y;this.signals.moved.dispatch(e,n),this.pressed&&this.signals.dragged.dispatch(e,n)},hh.prototype._onMousedown=function(t){t.target===this.domElement&&(t.preventDefault(),this._setKeys(t),this.moving=!1,this.hovering=!1,this.down.set(t.clientX,t.clientY),this.position.set(t.clientX,t.clientY),this.which=t.which,this.buttons=function(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<<e-1}else if("button"in t){var n=t.button;if(1===n)return 4;if(2===n)return 2;if(n>=0)return 1<<n}}return 0}(t),this.pressed=!0,this._setCanvasPosition(t))},hh.prototype._onMouseup=function(t){t.target===this.domElement&&t.preventDefault(),this._setKeys(t);var e=this.canvasPosition;this.signals.clicked.dispatch(e.x,e.y),this.which=void 0,this.buttons=void 0,this.pressed=void 0},hh.prototype._onContextmenu=function(t){t.target===this.domElement&&t.preventDefault()},hh.prototype._onTouchstart=function(t){if(t.target===this.domElement)switch(t.preventDefault(),this.pressed=!0,t.touches.length){case 1:this.moving=!1,this.hovering=!1,this.down.set(t.touches[0].pageX,t.touches[0].pageY),this.position.set(t.touches[0].pageX,t.touches[0].pageY),this._setCanvasPosition(t.touches[0]);break;case 2:this.down.set((t.touches[0].pageX+t.touches[1].pageX)/2,(t.touches[0].pageY+t.touches[1].pageY)/2),this.position.set((t.touches[0].pageX+t.touches[1].pageX)/2,(t.touches[0].pageY+t.touches[1].pageY)/2),this.lastTouchDistance=lh(t)}},hh.prototype._onTouchend=function(t){t.target===this.domElement&&t.preventDefault(),this.pressed=!1},hh.prototype._onTouchmove=function(t){switch(t.target===this.domElement?(t.preventDefault(),this.overElement=!0):this.overElement=!1,t.touches.length){case 1:this._setKeys(t),this.which=void 0,this.buttons=void 0,this.moving=!0,this.hovering=!1,this.lastMoved=window.performance.now(),this.prevPosition.copy(this.position),this.position.set(t.touches[0].pageX,t.touches[0].pageY),this._setCanvasPosition(t.touches[0]);var e=this.prevPosition.x-this.position.x,n=this.prevPosition.y-this.position.y;this.signals.moved.dispatch(e,n),this.pressed&&this.signals.dragged.dispatch(e,n);break;case 2:this.which=3,this.buttons=2;var r=lh(t),i=r-this.lastTouchDistance;if(this.lastTouchDistance=r,Math.abs(i)>1)this.signals.scrolled.dispatch(i/2);else{this.prevPosition.copy(this.position),this.position.set((t.touches[0].pageX+t.touches[1].pageX)/2,(t.touches[0].pageY+t.touches[1].pageY)/2);var o=this.prevPosition.x-this.position.x,a=this.prevPosition.y-this.position.y;this.signals.moved.dispatch(o,a),this.pressed&&this.signals.dragged.dispatch(o,a)}}},hh.prototype._distance=function(){return this.position.distanceTo(this.down)},hh.prototype._setCanvasPosition=function(t){var e,n,r=this.domElement.getBoundingClientRect();"offsetX"in t&&"offsetY"in t?(e=t.offsetX,n=t.offsetY):(e=t.clientX-r.left,n=t.clientY-r.top),this.canvasPosition.set(e,r.height-n)},hh.prototype._setKeys=function(t){this.altKey=t.altKey,this.ctrlKey=t.ctrlKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey},hh.prototype.dispose=function(){document.removeEventListener("mousewheel",this._onMousewheel),document.removeEventListener("wheel",this._onMousewheel),document.removeEventListener("MozMousePixelScroll",this._onMousewheel),document.removeEventListener("mousemove",this._onMousemove),document.removeEventListener("mousedown",this._onMousedown),document.removeEventListener("mouseup",this._onMouseup),document.removeEventListener("contextmenu",this._onContextmenu),document.removeEventListener("touchstart",this._onTouchstart),document.removeEventListener("touchend",this._onTouchend),document.removeEventListener("touchmove",this._onTouchmove)},Object.defineProperties(hh.prototype,ph);var dh=new De,fh=new De,mh=new De,gh=new Ne,vh=new ke,yh=new De,bh=new Ne,xh=function(t,e){var n=e||{};this.rotateSpeed=gs(n.rotateSpeed,2),this.zoomSpeed=gs(n.zoomSpeed,1.2),this.panSpeed=gs(n.panSpeed,1),this.stage=t,this.viewer=t.viewer,this.mouse=t.mouseObserver,this.controls=t.viewerControls},_h={component:{}};_h.component.get=function(){return this.stage.transformComponent},xh.prototype._setPanVector=function(t,e){var n,r=this.viewer.camera;if("OrthographicCamera"===r.type)n=1/r.zoom;else{var i=Fs(r.fov);n=-2*r.position.z*Math.tan(i/2)/this.viewer.height}bh.set(t,e,0),bh.multiplyScalar(this.panSpeed*n)},xh.prototype._getRotateXY=function(t,e){return[this.rotateSpeed*-t*.01,this.rotateSpeed*e*.01]},xh.prototype.zoom=function(t){this.controls.zoom(this.zoomSpeed*t*.02)},xh.prototype.pan=function(t,e){this._setPanVector(t,e),yh.getInverse(this.viewer.rotationGroup.matrix),bh.applyMatrix4(yh),this.controls.translate(bh)},xh.prototype.panComponent=function(t,e){this.component&&(this._setPanVector(t,e),yh.extractRotation(this.component.transform),yh.premultiply(this.viewer.rotationGroup.matrix),yh.getInverse(yh),bh.applyMatrix4(yh),this.component.position.add(bh),this.component.updateMatrix())},xh.prototype.rotate=function(t,e){var n=this._getRotateXY(t,e),r=n[0],i=n[1];dh.makeRotationX(i),fh.makeRotationY(r),dh.multiply(fh),this.controls.applyMatrix(dh)},xh.prototype.rotateComponent=function(t,e){if(this.component){var n=this._getRotateXY(t,e),r=n[0],i=n[1];mh.extractRotation(this.component.transform),mh.premultiply(this.viewer.rotationGroup.matrix),mh.getInverse(mh),gh.set(1,0,0),gh.applyMatrix4(mh),dh.makeRotationAxis(gh,i),gh.set(0,1,0),gh.applyMatrix4(mh),fh.makeRotationAxis(gh,r),dh.multiply(fh),vh.setFromRotationMatrix(dh),this.component.quaternion.premultiply(vh),this.component.updateMatrix()}},Object.defineProperties(xh.prototype,_h);var wh=function(t,e){this.pid=t.pid,this.picker=t.picker,this.instance=t.instance,this.stage=e,this.controls=e.viewerControls,this.mouse=e.mouseObserver},Sh={type:{},altKey:{},ctrlKey:{},metaKey:{},shiftKey:{},canvasPosition:{},component:{},object:{},position:{},closestBondAtom:{},arrow:{},atom:{},axes:{},bond:{},cone:{},clash:{},contact:{},cylinder:{},distance:{},ellipsoid:{},mesh:{},slice:{},sphere:{},surface:{},unitcell:{},unknown:{},volume:{}};Sh.type.get=function(){return this.picker.type},Sh.altKey.get=function(){return this.mouse.altKey},Sh.ctrlKey.get=function(){return this.mouse.ctrlKey},Sh.metaKey.get=function(){return this.mouse.metaKey},Sh.shiftKey.get=function(){return this.mouse.shiftKey},Sh.canvasPosition.get=function(){return this.mouse.canvasPosition},Sh.component.get=function(){return this.stage.getComponentsByObject(this.picker.data).list[0]},Sh.object.get=function(){return this.picker.getObject(this.pid)},Sh.position.get=function(){return this.picker.getPosition(this.pid,this.instance,this.component)},Sh.closestBondAtom.get=function(){if("bond"===this.type){var t,e,n,r=this.bond,i=this.controls,o=this.canvasPosition,a=i.getPositionOnCanvas(r.atom1),s=i.getPositionOnCanvas(r.atom2);return e=a,n=s,(t=o).distanceTo(e)<t.distanceTo(n)?r.atom1:r.atom2}},Sh.arrow.get=function(){return this._objectIfType("arrow")},Sh.atom.get=function(){return this._objectIfType("atom")},Sh.axes.get=function(){return this._objectIfType("axes")},Sh.bond.get=function(){return this._objectIfType("bond")},Sh.cone.get=function(){return this._objectIfType("cone")},Sh.clash.get=function(){return this._objectIfType("clash")},Sh.contact.get=function(){return this._objectIfType("contact")},Sh.cylinder.get=function(){return this._objectIfType("cylinder")},Sh.distance.get=function(){return this._objectIfType("distance")},Sh.ellipsoid.get=function(){return this._objectIfType("ellipsoid")},Sh.mesh.get=function(){return this._objectIfType("mesh")},Sh.slice.get=function(){return this._objectIfType("slice")},Sh.sphere.get=function(){return this._objectIfType("sphere")},Sh.surface.get=function(){return this._objectIfType("surface")},Sh.unitcell.get=function(){return this._objectIfType("unitcell")},Sh.unknown.get=function(){return this._objectIfType("unknown")},Sh.volume.get=function(){return this._objectIfType("volume")},wh.prototype._objectIfType=function(t){return this.type===t?this.object:void 0},wh.prototype.getLabel=function(){var t="nothing";return this.arrow?t="arrow: "+(this.arrow.name||this.pid)+" ("+this.arrow.shape.name+")":this.atom?t="atom: "+this.atom.qualifiedName()+" ("+this.atom.structure.name+")":this.axes?t="axes":this.bond?t="bond: "+this.bond.atom1.qualifiedName()+" - "+this.bond.atom2.qualifiedName()+" ("+this.bond.structure.name+")":this.cone?t="cone: "+(this.cone.name||this.pid)+" ("+this.cone.shape.name+")":this.clash?t="clash: "+this.clash.clash.sele1+" - "+this.clash.clash.sele2:this.contact?t="contact: "+this.contact.atom1.qualifiedName()+" - "+this.contact.atom2.qualifiedName()+" ("+this.contact.structure.name+")":this.cylinder?t="cylinder: "+(this.cylinder.name||this.pid)+" ("+this.cylinder.shape.name+")":this.distance?t="distance: "+this.distance.atom1.qualifiedName()+" - "+this.distance.atom2.qualifiedName()+" ("+this.distance.structure.name+")":this.ellipsoid?t="ellipsoid: "+(this.ellipsoid.name||this.pid)+" ("+this.ellipsoid.shape.name+")":this.mesh?t="mesh: "+(this.mesh.name||this.mesh.serial)+" ("+this.mesh.shape.name+")":this.slice?t="slice: "+this.slice.value.toPrecision(3)+" ("+this.slice.volume.name+")":this.sphere?t="sphere: "+(this.sphere.name||this.pid)+" ("+this.sphere.shape.name+")":this.surface?t="surface: "+this.surface.surface.name:this.unitcell?t="unitcell: "+this.unitcell.unitcell.spacegroup+" ("+this.unitcell.structure.name+")":this.unknown?t="unknown":this.volume&&(t="volume: "+this.volume.value.toPrecision(3)+" ("+this.volume.volume.name+")"),t},Object.defineProperties(wh.prototype,Sh);var Ch=function(t){this.stage=t,this.viewer=t.viewer};Ch.prototype.pick=function(t,e){var n=this.viewer.pick(t,e);if(n.picker&&"ignore"!==n.picker.type&&void 0!==n.pid){var r=n.picker.array;if(!(r&&n.pid>=r.length))return new wh(n,this.stage);console.error("pid >= picker.array.length")}};var Ah=new ke,Eh=new Ne,Mh=new Ne,Th=new Ne,Ph=new Ne,Ih=new De,Rh=new Ne,Oh=new De,Lh=function(t){this.stage=t,this.viewer=t.viewer,this.signals={changed:new Su}},kh={position:{},rotation:{}};kh.position.get=function(){return this.viewer.translationGroup.position},kh.rotation.get=function(){return this.viewer.rotationGroup.quaternion},Lh.prototype.changed=function(){this.viewer.requestRender(),this.signals.changed.dispatch()},Lh.prototype.getPositionOnCanvas=function(t,e){var n=Ms(e,Se),r=this.viewer;return Th.copy(t).add(r.translationGroup.position).applyMatrix4(r.rotationGroup.matrix).project(r.camera),n.set((Th.x+1)*r.width/2,(Th.y+1)*r.height/2)},Lh.prototype.getOrientation=function(t){var e=Ps(t);e.copy(this.viewer.rotationGroup.matrix);var n=-this.viewer.camera.position.z;return e.scale(Ph.set(n,n,n)),e.setPosition(this.viewer.translationGroup.position),e},Lh.prototype.orient=function(t){Ps(t).decompose(Eh,Ah,Mh);var e=this.viewer;e.rotationGroup.setRotationFromQuaternion(Ah),e.translationGroup.position.copy(Eh),e.camera.position.z=-Mh.z,e.updateZoom(),this.changed()},Lh.prototype.translate=function(t){this.viewer.translationGroup.position.add(Ts(t)),this.changed()},Lh.prototype.center=function(t){this.viewer.translationGroup.position.copy(Ts(t)).negate(),this.changed()},Lh.prototype.zoom=function(t){this.distance(this.viewer.camera.position.z*(1-t))},Lh.prototype.distance=function(t){this.viewer.camera.position.z=t,this.viewer.updateZoom(),this.changed()},Lh.prototype.spin=function(t,e){Ih.getInverse(this.viewer.rotationGroup.matrix),Rh.copy(Ts(t)).applyMatrix4(Ih),this.viewer.rotationGroup.rotateOnAxis(Rh,e),this.changed()},Lh.prototype.rotate=function(t){this.viewer.rotationGroup.setRotationFromQuaternion(Is(t)),this.changed()},Lh.prototype.align=function(t){Oh.getInverse(Ps(t)),this.viewer.rotationGroup.setRotationFromMatrix(Oh),this.changed()},Lh.prototype.applyMatrix=function(t){this.viewer.rotationGroup.applyMatrix(Ps(t)),this.changed()},Object.defineProperties(Lh.prototype,kh);var Nh=function(t,e){for(var n,r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];this.duration=gs(t,1e3),this.controls=e,this.startTime=window.performance.now(),this.pausedTime=-1,this.elapsedDuration=0,this.pausedDuration=0,this.ignoreGlobalToggle=!1,this._paused=!1,this._resolveList=[],(n=this)._init.apply(n,r)},Dh={done:{},paused:{}};Dh.done.get=function(){return 1===this.alpha},Dh.paused.get=function(){return this._paused},Nh.prototype._init=function(){},Nh.prototype._tick=function(){},Nh.prototype.tick=function(t){if(!this._paused)return this.elapsedDuration=t.currentTime-this.startTime-this.pausedDuration,0===this.duration?this.alpha=1:this.alpha=vu(0,1,this.elapsedDuration/this.duration),this._tick(t),this.done&&this._resolveList.forEach(function(t){return t()}),this.done},Nh.prototype.pause=function(t){t&&(this._hold=!0),-1===this.pausedTime&&(this.pausedTime=window.performance.now()),this._paused=!0},Nh.prototype.resume=function(t){!t&&this._hold||(this.pausedDuration+=window.performance.now()-this.pausedTime,this._paused=!1,this._hold=!1,this.pausedTime=-1)},Nh.prototype.toggle=function(){this._paused?this.resume():this.pause()},Nh.prototype.then=function(t){var e=this;return(this.done?Promise.resolve():new Promise(function(t){return e._resolveList.push(t)})).then(t)},Object.defineProperties(Nh.prototype,Dh);var zh=function(t){function e(e){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];t.apply(this,[gs(e,1/0)].concat(n))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){Array.isArray(t)?this.axis=(new Ne).fromArray(t):this.axis=gs(t,new Ne(0,1,0)),this.angle=gs(e,.01)},e.prototype._tick=function(t){this.axis&&this.angle&&this.controls.spin(this.axis,this.angle*t.lastDuration/16)},e}(Nh),Fh=function(t){function e(e){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];t.apply(this,[gs(e,1/0)].concat(n))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e,n){Array.isArray(t)?this.axis=(new Ne).fromArray(t):this.axis=gs(t,new Ne(0,1,0)),this.angleStep=gs(e,.01),this.angleEnd=gs(n,.2),this.angleSum=0,this.direction=1},e.prototype._tick=function(t){if(this.axis&&this.angleStep&&this.angleEnd){var e=vu(0,1,Math.abs(this.angleSum)/this.angleEnd),n=this.angleStep*this.direction*(1.1-e);this.controls.spin(this.axis,n*t.lastDuration/16),this.angleSum+=this.angleStep,this.angleSum>=this.angleEnd&&(this.direction*=-1,this.angleSum=-this.angleEnd)}},e}(Nh),Bh=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){this.moveFrom=Ts(gs(t,new Ne)),this.moveTo=Ts(gs(e,new Ne))},e.prototype._tick=function(){this.controls.position.lerpVectors(this.moveFrom,this.moveTo,this.alpha).negate(),this.controls.changed()},e}(Nh),Uh=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){this.zoomFrom=t,this.zoomTo=e},e.prototype._tick=function(){this.controls.distance(mu(this.zoomFrom,this.zoomTo,this.alpha))},e}(Nh),jh=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e){this.rotateFrom=Is(t),this.rotateTo=Is(e),this._currentRotation=new ke},e.prototype._tick=function(){this._currentRotation.copy(this.rotateFrom).slerp(this.rotateTo,this.alpha),this.controls.rotate(this._currentRotation)},e}(Nh),Gh=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t,e,n){this.valueFrom=t,this.valueTo=e,this.callback=n},e.prototype._tick=function(){this.callback(mu(this.valueFrom,this.valueTo,this.alpha))},e}(Nh),Vh=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._init=function(t){this.callback=t},e.prototype._tick=function(){1===this.alpha&&this.callback()},e}(Nh),Hh=function(t){this._list=t||[],this._resolveList=[]},$h={done:{}};$h.done.get=function(){return this._list.every(function(t){return t.done})},Hh.prototype.then=function(t){var e=this;return(this.done?Promise.resolve():new Promise(function(t){e._resolveList.push(t),e._list.forEach(function(t){t.then(function(){e._resolveList.forEach(function(t){t()}),e._resolveList.length=0})})})).then(t)},Object.defineProperties(Hh.prototype,$h);var Wh=function(t){this.stage=t,this.viewer=t.viewer,this.controls=t.viewerControls,this.animationList=[],this.finishedList=[]},qh={paused:{}};qh.paused.get=function(){return this.animationList.every(function(t){return t.paused})},Wh.prototype.add=function(t){return 0===t.duration?t.tick(this.viewer.stats):this.animationList.push(t),t},Wh.prototype.remove=function(t){var e=this.animationList,n=e.indexOf(t);n>-1&&e.splice(n,1)},Wh.prototype.run=function(t){for(var e=this.finishedList,n=this.animationList,r=n.length,i=0;i<r;++i){var o=n[i];o.tick(t)&&e.push(o)}var a=e.length;if(a){for(var s=0;s<a;++s)this.remove(e[s]);e.length=0}},Wh.prototype.spin=function(t,e,n){return this.add(new zh(n,this.controls,t,e))},Wh.prototype.rock=function(t,e,n,r){return this.add(new Fh(r,this.controls,t,e,n))},Wh.prototype.rotate=function(t,e){var n=this.viewer.rotationGroup.quaternion.clone();return this.add(new jh(e,this.controls,n,t))},Wh.prototype.move=function(t,e){var n=this.controls.position.clone().negate();return this.add(new Bh(e,this.controls,n,t))},Wh.prototype.zoom=function(t,e){var n=this.viewer.camera.position.z;return this.add(new Uh(e,this.controls,n,t))},Wh.prototype.zoomMove=function(t,e,n){return new Hh([this.move(t,n),this.zoom(e,n)])},Wh.prototype.orient=function(t,e){var n=new Ne,r=new ke,i=new Ne;return Ps(t).decompose(n,r,i),new Hh([this.move(n.negate(),e),this.rotate(r,e),this.zoom(-i.x,e)])},Wh.prototype.value=function(t,e,n,r){return this.add(new Gh(r,this.controls,t,e,n))},Wh.prototype.timeout=function(t,e){return this.add(new Vh(e,this.controls,t))},Wh.prototype.spinComponent=function(t,e,n,r){return this.add(new zh(r,t.controls,e,n))},Wh.prototype.rockComponent=function(t,e,n,r,i){return this.add(new Fh(i,t.controls,e,n,r))},Wh.prototype.moveComponent=function(t,e,n){var r=t.controls.position.clone().negate();return this.add(new Bh(n,t.controls,r,e))},Wh.prototype.pause=function(){this.animationList.forEach(function(t){return t.pause()})},Wh.prototype.resume=function(){this.animationList.forEach(function(t){return t.resume()})},Wh.prototype.toggle=function(){this.paused?this.resume():this.pause()},Wh.prototype.clear=function(){this.animationList.length=0},Wh.prototype.dispose=function(){this.clear()},Object.defineProperties(Wh.prototype,qh);var Xh=function(){};Xh.zoomScroll=function(t,e){t.trackballControls.zoom(e)},Xh.clipNearScroll=function(t,e){var n=t.getParameters();t.setParameters({clipNear:n.clipNear+e/10})},Xh.focusScroll=function(t,e){var n=2*t.getParameters().clipNear,r=Math.sign(e)*function(t,e,n){if(t>e)return t;var r=t/e;return((2*n-e)*r+(2*e-3*n))*r*r+n}
/**
 * @license
 *
 * chroma.js - JavaScript library for color conversions
 *
 * Copyright (c) 2011-2015, Gregor Aisch
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. The name Gregor Aisch may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */((100-n)/10,5,.2);t.setFocus(n+r)},Xh.isolevelScroll=function(t,e){var n=Math.sign(e)/5;t.eachRepresentation(function(t){if("surface"===t.repr.type){var e=t.getParameters().isolevel;t.setParameters({isolevel:e+n})}},"volume")},Xh.panDrag=function(t,e,n){t.trackballControls.pan(e,n)},Xh.rotateDrag=function(t,e,n){t.trackballControls.rotate(e,n)},Xh.zoomDrag=function(t,e,n){t.trackballControls.zoom((e+n)/-2)},Xh.zoomFocusDrag=function(t,e,n){t.trackballControls.zoom((e+n)/-2);var r=t.viewer.camera.position.z;t.setFocus(100-Math.abs(r/8))};var Yh={default:[["scroll",Xh.zoomScroll],["scroll-ctrl",Xh.clipNearScroll],["scroll-shift",Xh.focusScroll],["scroll-alt",Xh.isolevelScroll],["drag-right",Xh.panDrag],["drag-left",Xh.rotateDrag],["drag-middle",Xh.zoomDrag],["drag-shift-right",Xh.zoomDrag],["drag-left+right",Xh.zoomDrag],["drag-ctrl-right",Xh.panComponentDrag=function(t,e,n){t.trackballControls.panComponent(e,n)}],["drag-ctrl-left",Xh.rotateComponentDrag=function(t,e,n){t.trackballControls.rotateComponent(e,n)}],["clickPick-middle",Xh.movePick=function(t,e){e&&t.animationControls.move(e.position.clone())}],["hoverPick",Xh.tooltipPick=function(t,e){var n=t.tooltip;if(t.getParameters().tooltip&&e){var r=e.mouse.position;n.innerText=e.getLabel(),n.style.bottom=window.innerHeight-r.y+3+"px",n.style.left=r.x+3+"px",n.style.display="block"}else n.style.display="none"}]],pymol:[["drag-left",Xh.rotateDrag],["drag-middle",Xh.panDrag],["drag-right",Xh.zoomDrag],["drag-shift-right",Xh.focusScroll],["clickPick-ctrl+shift-middle",Xh.movePick],["hoverPick",Xh.tooltipPick]],coot:[["scroll",Xh.isolevelScroll],["drag-left",Xh.rotateDrag],["drag-middle",Xh.panDrag],["drag-ctrl-left",Xh.panDrag],["drag-right",Xh.zoomFocusDrag],["drag-ctrl-right",Xh.focusScroll],["clickPick-middle",Xh.movePick],["hoverPick",Xh.tooltipPick]]};function Kh(t){var e=t.split(/[-+]/),n="";e.includes("scroll")&&(n="scroll"),e.includes("drag")&&(n="drag"),e.includes("click")&&(n="click"),e.includes("hover")&&(n="hover"),e.includes("clickPick")&&(n="clickPick"),e.includes("hoverPick")&&(n="hoverPick");var r=0;e.includes("alt")&&(r+=1),e.includes("ctrl")&&(r+=2),e.includes("meta")&&(r+=4),e.includes("shift")&&(r+=8);var i=0;return e.includes("left")&&(i+=1),e.includes("right")&&(i+=2),e.includes("middle")&&(i+=4),[n,r,i]}var Zh=function(t,e){var n=e||{};this.stage=t,this.mouse=t.mouseObserver,this.actionList=[],this.preset(n.preset||"default")};Zh.prototype.run=function(t){for(var e=this,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];var i=this.mouse.key||0,o=this.mouse.buttons||0;this.actionList.forEach(function(r){r.type===t&&r.key===i&&r.button===o&&r.callback.apply(r,[e.stage].concat(n))})},Zh.prototype.add=function(t,e){var n=Kh(t),r=n[0],i=n[1],o=n[2];this.actionList.push({type:r,key:i,button:o,callback:e})},Zh.prototype.remove=function(t,e){var n=t.includes("*"),r=Kh(t),i=r[0],o=r[1],a=r[2],s=this.actionList.filter(function(t){return!((t.type===i||n&&""===i)&&(t.key===o||n&&0===o)&&(t.button===a||n&&0===a)&&(t.callback===e||void 0===e))});this.actionList=s},Zh.prototype.preset=function(t){var e=this;this.clear(),(Yh[t]||[]).forEach(function(t){var n;(n=e).add.apply(n,t)})},Zh.prototype.clear=function(){this.actionList.length=0};var Qh=function(t){this.stage=t,this.mouse=t.mouseObserver,this.controls=t.mouseControls,this.mouse.signals.clicked.add(this._onClick,this),this.mouse.signals.hovered.add(this._onHover,this)};Qh.prototype._onClick=function(t,e){var n=this.stage.pickingControls.pick(t,e);this.stage.signals.clicked.dispatch(n),this.controls.run("clickPick",n)},Qh.prototype._onHover=function(t,e){var n=this.stage.pickingControls.pick(t,e);n&&this.mouse.down.equals(this.mouse.position)&&(this.stage.transformComponent=n.component),this.stage.signals.hovered.dispatch(n),this.controls.run("hoverPick",n)},Qh.prototype.dispose=function(){this.mouse.signals.clicked.remove(this._onClick,this),this.mouse.signals.hovered.remove(this._onHover,this)};var Jh=function(t){this.stage=t,this.mouse=t.mouseObserver,this.controls=t.mouseControls,this.mouse.signals.moved.add(this._onMove,this),this.mouse.signals.scrolled.add(this._onScroll,this),this.mouse.signals.dragged.add(this._onDrag,this),this.mouse.signals.clicked.add(this._onClick,this),this.mouse.signals.hovered.add(this._onHover,this)};Jh.prototype._onMove=function(){this.stage.tooltip.style.display="none"},Jh.prototype._onScroll=function(t){this.controls.run("scroll",t)},Jh.prototype._onDrag=function(t,e){this.controls.run("drag",t,e)},Jh.prototype._onClick=function(t,e){this.controls.run("click",t,e)},Jh.prototype._onHover=function(t,e){this.controls.run("hover",t,e)},Jh.prototype.dispose=function(){this.mouse.signals.moved.remove(this._onMove,this),this.mouse.signals.scrolled.remove(this._onScroll,this),this.mouse.signals.dragged.remove(this._onDrag,this),this.mouse.signals.clicked.remove(this._onClick,this),this.mouse.signals.hovered.remove(this._onHover,this)};var tp=function(t){this.viewer=t.viewer,this.animationControls=t.animationControls,this.viewer.signals.ticked.add(this._onTick,this)};tp.prototype._onTick=function(t){this.animationControls.run(t)},tp.prototype.dispose=function(){this.viewer.signals.ticked.remove(this._onTick,this)};var ep=function(t){this.stage=t,this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this),this._onKeypress=this._onKeypress.bind(this),document.addEventListener("keydown",this._onKeydown),document.addEventListener("keyup",this._onKeyup),document.addEventListener("keypress",this._onKeypress)};ep.prototype._onKeydown=function(){},ep.prototype._onKeyup=function(){},ep.prototype._onKeypress=function(t){switch(t.keyCode){case 73:case 105:this.stage.toggleSpin();break;case 75:case 107:this.stage.toggleRock();break;case 80:case 112:this.stage.animationControls.toggle()}},ep.prototype.dispose=function(){document.removeEventListener("keydown",this._onKeypress),document.removeEventListener("keyup",this._onKeypress),document.removeEventListener("keypress",this._onKeypress)};var np=function(t,e,n,r){var i=r||{};this.offsetX=gs(i.offsetX,0),this.offsetY=gs(i.offsetY,0),this.visible=gs(i.visible,!0),this.component=t,this.stage=t.stage,this.viewer=this.stage.viewer,this.position=e,this._viewerPosition=new Ne,this._updateViewerPosition(),this._canvasPosition=new Ne,this._cameraPosition=new Ne,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"block",position:"fixed",zIndex:1+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif",left:"-10000px"}),this.viewer.container.appendChild(this.element),this.setContent(n),this.updateVisibility(),this.viewer.signals.ticked.add(this._update,this),this.component.signals.matrixChanged.add(this._updateViewerPosition,this)};np.prototype.setContent=function(t){var e=this.element.style.display;"none"===e&&(this.element.style.left="-10000px",this.element.style.display="block"),t instanceof window.Element?(this.element.innerHTML="",this.element.appendChild(t)):this.element.innerHTML=t,this._clientRect=this.element.getBoundingClientRect(),"none"===e&&(this.element.style.display=e)},np.prototype.setVisibility=function(t){this.visible=t,this.updateVisibility()},np.prototype.getVisibility=function(){return this.visible&&this.component.visible},np.prototype.updateVisibility=function(){this.element.style.display=this.getVisibility()?"block":"none"},np.prototype._updateViewerPosition=function(){this._viewerPosition.copy(this.position).applyMatrix4(this.component.matrix)},np.prototype._update=function(){if(this.getVisibility()){var t=this.element.style,e=this._canvasPosition,n=this._viewerPosition,r=this._clientRect;this._cameraPosition.copy(n).add(this.viewer.translationGroup.position).applyMatrix4(this.viewer.rotationGroup.matrix).sub(this.viewer.camera.position),this._cameraPosition.z<0?t.display="none":(t.display="block",t.opacity=1-vu(this.viewer.scene.fog.near,this.viewer.scene.fog.far,this._cameraPosition.length()),this.stage.viewerControls.getPositionOnCanvas(n,e),t.bottom=this.offsetX+e.y+r.height/2+"px",t.left=this.offsetY+e.x-r.width/2+"px")}},np.prototype.dispose=function(){this.viewer.container.removeChild(this.element),this.viewer.signals.ticked.remove(this._update,this),this.component.signals.matrixChanged.remove(this._updateViewerPosition,this)};var rp=new De,ip=new Ne,op=new ke,ap=function(t){this.component=t,this.stage=t.stage,this.viewer=t.stage.viewer,this.signals={changed:new Su}},sp={position:{},rotation:{}};function cp(t){var e,n=t.length,r=t.length/3,i=0,o=0,a=0;for(e=0;e<n;e+=3)i+=t[e+0],o+=t[e+1],a+=t[e+2];return new Ne(i/r,o/r,a/r)}function up(t,e,n){return n?t.sub(n).projectOnVector(e).add(n):t.projectOnVector(e),t}function lp(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var u=t[s],l=t[s+1],h=t[s+2];u<e&&(e=u),l<n&&(n=l),h<r&&(r=h),u>i&&(i=u),l>o&&(o=l),h>a&&(a=h)}return[fp([e,n,r]),fp([i,o,a])]}function hp(t,e){for(var n=0,r=e.length;n<r;n+=3){var i=e[n],o=e[n+1],a=e[n+2];e[n]=t[0]*i+t[4]*o+t[8]*a+t[12],e[n+1]=t[1]*i+t[5]*o+t[9]*a+t[13],e[n+2]=t[2]*i+t[6]*o+t[10]*a+t[14]}}function pp(t,e){for(var n=0,r=e.length;n<r;n+=3){var i=e[n],o=e[n+1],a=e[n+2];e[n]=t[0]*i+t[3]*o+t[6]*a,e[n+1]=t[1]*i+t[4]*o+t[7]*a,e[n+2]=t[2]*i+t[5]*o+t[8]*a}}function dp(t){for(var e=0,n=t.length;e<n;e+=3){var r=t[e],i=t[e+1],o=t[e+2],a=1/Math.sqrt(r*r+i*i+o*o);t[e]=r*a,t[e+1]=i*a,t[e+2]=o*a}}function fp(t){return new Float32Array(t||3)}function mp(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],c=n[2];t[0]=i*c-o*s,t[1]=o*a-r*c,t[2]=r*s-i*a}function gp(t,e,n){t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2]}function vp(t,e,n){t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2]}function yp(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}function bp(t,e,n){xp(t,e,1/n)}function xp(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}function _p(t,e){xp(t,e,1/yp(e))}function wp(t,e,n){t[0]=e[0]-n,t[1]=e[1]-n,t[2]=e[2]-n}function Sp(t,e,n){t[0]=e[0]+n,t[1]=e[1]+n,t[2]=e[2]+n}function Cp(t,e){t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2])}function Ap(t,e){t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2])}function Ep(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2]}sp.position.get=function(){return this.component.position},sp.rotation.get=function(){return this.component.quaternion},ap.prototype.changed=function(){this.component.updateMatrix(),this.viewer.requestRender(),this.signals.changed.dispatch()},ap.prototype.spin=function(t,e){rp.getInverse(this.viewer.rotationGroup.matrix),ip.copy(Ts(t)).applyMatrix4(rp),rp.extractRotation(this.component.transform),rp.premultiply(this.viewer.rotationGroup.matrix),rp.getInverse(rp),ip.copy(Ts(t)),ip.applyMatrix4(rp),rp.makeRotationAxis(ip,e),op.setFromRotationMatrix(rp),this.component.quaternion.premultiply(op),this.changed()},Object.defineProperties(ap.prototype,sp),bp.__deps=[xp],_p.__deps=[xp,yp];var Mp=function(t){this.array=t};Mp.prototype.getIndex=function(t){return this.array?this.array[t]:t},Mp.prototype.getObject=function(){return{}},Mp.prototype._applyTransformations=function(t,e,n){return e&&t.applyMatrix4(e.matrix),n&&t.applyMatrix4(n.matrix),t},Mp.prototype._getPosition=function(){return new Ne},Mp.prototype.getPosition=function(t,e,n){return this._applyTransformations(this._getPosition(t),e,n)};var Tp=function(t){function e(e){t.call(this),this.shape=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={data:{}};return n.data.get=function(){return this.shape},Object.defineProperties(e.prototype,n),e}(Mp),Pp=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"cylinder"},e.prototype.getObject=function(t){var e=this.shape;return{shape:e,color:(new En).fromArray(e.cylinderColor,3*t),radius:e.cylinderRadius[t],position1:(new Ne).fromArray(e.cylinderPosition1,3*t),position2:(new Ne).fromArray(e.cylinderPosition2,3*t),name:e.cylinderName[t]}},e.prototype._getPosition=function(t){var e=this.shape,n=(new Ne).fromArray(e.cylinderPosition1,3*t),r=(new Ne).fromArray(e.cylinderPosition2,3*t);return n.add(r).multiplyScalar(.5)},Object.defineProperties(e.prototype,n),e}(Tp),Ip=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"arrow"},e.prototype.getObject=function(t){var e=this.shape;return{shape:e,position:this._getPosition(t),position1:(new Ne).fromArray(e.arrowPosition1,3*t),position2:(new Ne).fromArray(e.arrowPosition2,3*t),color:(new En).fromArray(e.arrowColor,3*t),radius:e.arrowRadius[t],name:e.arrowName[t]}},e.prototype._getPosition=function(t){var e=this.shape,n=(new Ne).fromArray(e.arrowPosition1,3*t),r=(new Ne).fromArray(e.arrowPosition2,3*t);return n.add(r).multiplyScalar(.5)},Object.defineProperties(e.prototype,n),e}(Tp),Rp=function(t){function e(e,n){t.call(this,e),this.structure=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},data:{}};return n.type.get=function(){return"atom"},n.data.get=function(){return this.structure},e.prototype.getObject=function(t){return this.structure.getAtomProxy(this.getIndex(t))},e.prototype._getPosition=function(t){return(new Ne).copy(this.getObject(t))},Object.defineProperties(e.prototype,n),e}(Mp),Op=function(t){function e(e){t.call(this),this.axes=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},data:{}};return n.type.get=function(){return"axes"},n.data.get=function(){return this.axes},e.prototype.getObject=function(){return{axes:this.axes}},e.prototype._getPosition=function(){return this.axes.center.clone()},Object.defineProperties(e.prototype,n),e}(Mp),Lp=function(t){function e(e,n,r){t.call(this,e),this.structure=n,this.bondStore=r||n.bondStore}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},data:{}};return n.type.get=function(){return"bond"},n.data.get=function(){return this.structure},e.prototype.getObject=function(t){var e=this.structure.getBondProxy(this.getIndex(t));return e.bondStore=this.bondStore,e},e.prototype._getPosition=function(t){var e=this.getObject(t);return(new Ne).copy(e.atom1).add(e.atom2).multiplyScalar(.5)},Object.defineProperties(e.prototype,n),e}(Mp),kp=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"contact"},Object.defineProperties(e.prototype,n),e}(Lp),Np=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"cone"},e.prototype.getObject=function(t){var e=this.shape;return{shape:e,position:this._getPosition(t),position1:(new Ne).fromArray(e.conePosition1,3*t),position2:(new Ne).fromArray(e.conePosition2,3*t),color:(new En).fromArray(e.coneColor,3*t),radius:e.coneRadius[t],name:e.coneName[t]}},e.prototype._getPosition=function(t){var e=this.shape,n=(new Ne).fromArray(e.conePosition1,3*t),r=(new Ne).fromArray(e.conePosition2,3*t);return n.add(r).multiplyScalar(.5)},Object.defineProperties(e.prototype,n),e}(Tp),Dp=function(t){function e(e,n,r){t.call(this,e),this.validation=n,this.structure=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},data:{}};return n.type.get=function(){return"clash"},n.data.get=function(){return this.validation},e.prototype.getObject=function(t){var e=this.validation,n=this.getIndex(t);return{validation:e,index:n,clash:e.clashArray[n]}},e.prototype._getAtomProxyFromSele=function(t){var e=new Hu(t),n=this.structure.getAtomIndices(e)[0];return this.structure.getAtomProxy(n)},e.prototype._getPosition=function(t){var e=this.getObject(t).clash,n=this._getAtomProxyFromSele(e.sele1),r=this._getAtomProxyFromSele(e.sele2);return(new Ne).copy(n).add(r).multiplyScalar(.5)},Object.defineProperties(e.prototype,n),e}(Mp),zp=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"distance"},Object.defineProperties(e.prototype,n),e}(Lp),Fp=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"ellipsoid"},e.prototype.getObject=function(t){var e=this.shape;return{shape:e,position:this._getPosition(t),color:(new En).fromArray(e.ellipsoidColor,3*t),radius:e.ellipsoidRadius[t],majorAxis:(new Ne).fromArray(e.ellipsoidMajorAxis,3*t),minorAxis:(new Ne).fromArray(e.ellipsoidMinorAxis,3*t),name:e.ellipsoidName[t]}},e.prototype._getPosition=function(t){return(new Ne).fromArray(this.shape.ellipsoidPosition,3*t)},Object.defineProperties(e.prototype,n),e}(Tp),Bp=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"ignore"},Object.defineProperties(e.prototype,n),e}(Mp),Up=function(t){function e(e,n){t.call(this,e),this.mesh=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"mesh"},e.prototype.getObject=function(){var t=this.mesh;return{shape:this.shape,name:t.name,serial:t.serial}},e.prototype._getPosition=function(){return this.__position||(this.__position=cp(this.mesh.position)),this.__position},Object.defineProperties(e.prototype,n),e}(Tp),jp=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"sphere"},e.prototype.getObject=function(t){var e=this.shape;return{shape:e,position:this._getPosition(t),color:(new En).fromArray(e.sphereColor,3*t),radius:e.sphereRadius[t],name:e.sphereName[t]}},e.prototype._getPosition=function(t){return(new Ne).fromArray(this.shape.spherePosition,3*t)},Object.defineProperties(e.prototype,n),e}(Tp),Gp=function(t){function e(e,n){t.call(this,e),this.surface=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},data:{}};return n.type.get=function(){return"surface"},n.data.get=function(){return this.surface},e.prototype.getObject=function(t){return{surface:this.surface,index:this.getIndex(t)}},e.prototype._getPosition=function(){return this.surface.center.clone()},Object.defineProperties(e.prototype,n),e}(Mp),Vp=function(t){function e(e,n){t.call(this),this.unitcell=e,this.structure=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},data:{}};return n.type.get=function(){return"unitcell"},n.data.get=function(){return this.unitcell},e.prototype.getObject=function(){return{unitcell:this.unitcell,structure:this.structure}},e.prototype._getPosition=function(){return this.unitcell.getCenter(this.structure)},Object.defineProperties(e.prototype,n),e}(Mp),Hp=(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};n.type.get=function(){return"unknown"},Object.defineProperties(e.prototype,n)}(Mp),function(t){function e(e,n){t.call(this,e),this.volume=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},data:{}};return n.type.get=function(){return"volume"},n.data.get=function(){return this.volume},e.prototype.getObject=function(t){var e=this.volume,n=this.getIndex(t);return{volume:e,index:n,value:e.data[n]}},e.prototype._getPosition=function(t){var e=this.volume.position,n=this.getIndex(t);return new Ne(e[3*n],e[3*n+1],e[3*n+2])},Object.defineProperties(e.prototype,n),e}(Mp)),$p=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"slice"},Object.defineProperties(e.prototype,n),e}(Hp);function Wp(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}var qp=function(t,e){this.length=t,this._words=new Uint32Array(t+32>>>5),!0===e&&this.setAll()};qp.prototype.get=function(t){return 0!=(this._words[t>>>5]&1<<t)},qp.prototype.set=function(t){this._words[t>>>5]|=1<<t},qp.prototype.clear=function(t){this._words[t>>>5]&=~(1<<t)},qp.prototype.flip=function(t){this._words[t>>>5]^=1<<t},qp.prototype._assignRange=function(t,e,n){for(var r=this._words,i=!0===n?4294967295:0,o=t>>>5,a=e>>>5,s=o;s<a;++s)r[s]=i;var c=o<<5,u=a<<5;if(!0===n)if(e-t<32)for(var l=t,h=e+1;l<h;++l)r[l>>>5]|=1<<l;else{for(var p=t,d=c;p<d;++p)r[p>>>5]|=1<<p;for(var f=u,m=e+1;f<m;++f)r[f>>>5]|=1<<f}else if(e-t<32)for(var g=t,v=e+1;g<v;++g)r[g>>>5]&=~(1<<g);else{for(var y=t,b=c;y<b;++y)r[y>>>5]&=~(1<<y);for(var x=u,_=e+1;x<_;++x)r[x>>>5]&=~(1<<x)}return this},qp.prototype.setRange=function(t,e){return this._assignRange(t,e,!0)},qp.prototype.clearRange=function(t,e){return this._assignRange(t,e,!1)},qp.prototype.setBits=function(){for(var t=arguments,e=this._words,n=arguments.length,r=0;r<n;++r){var i=t[r];e[i>>>5]|=1<<i}return this},qp.prototype.clearBits=function(){for(var t=arguments,e=this._words,n=arguments.length,r=0;r<n;++r){var i=t[r];e[i>>>5]&=~(1<<i)}return this},qp.prototype.setAll=function(){return this._assignRange(0,this.length-1,!0)},qp.prototype.clearAll=function(){return this._assignRange(0,this.length-1,!1)},qp.prototype.flipAll=function(){for(var t=this._words.length,e=this._words,n=32-this.length%32,r=0;r<t-1;++r)e[r]=~e[r];return e[t-1]=~(e[t-1]<<n)>>>n,this},qp.prototype._isRangeValue=function(t,e,n){for(var r=this._words,i=!0===n?4294967295:0,o=t>>>5,a=e>>>5,s=o;s<a;++s)if(r[s]!==i)return!1;if(e-t<32){for(var c=t,u=e+1;c<u;++c)if(!!(r[c>>>5]&1<<c)!==n)return!1}else{for(var l=a<<5,h=t,p=o<<5<<5;h<p;++h)if(!!(r[h>>>5]&1<<h)!==n)return!1;for(var d=l,f=e+1;d<f;++d)if(!!(r[d>>>5]&1<<d)!==n)return!1}return!0},qp.prototype.isRangeSet=function(t,e){return this._isRangeValue(t,e,!0)},qp.prototype.isRangeClear=function(t,e){return this._isRangeValue(t,e,!1)},qp.prototype.isAllSet=function(){return this._isRangeValue(0,this.length-1,!0)},qp.prototype.isAllClear=function(){return this._isRangeValue(0,this.length-1,!1)},qp.prototype.isSet=function(){for(var t=arguments,e=this._words,n=arguments.length,r=0;r<n;++r){var i=t[r];if(0==(e[i>>>5]&1<<i))return!1}return!0},qp.prototype.isClear=function(){for(var t=arguments,e=this._words,n=arguments.length,r=0;r<n;++r){var i=t[r];if(0!=(e[i>>>5]&1<<i))return!1}return!0},qp.prototype.isEqualTo=function(t){for(var e=this._words,n=t._words,r=Math.min(e.length,n.length),i=0;i<r;++i)if(e[i]!==n[i])return!1;return!0},qp.prototype.getSize=function(){for(var t=this._words.length,e=this._words,n=0,r=0;r<t;++r)n+=Wp(e[r]);return n},qp.prototype.difference=function(t){for(var e=this._words,n=t._words,r=Math.min(e.length,n.length),i=0;i<r;++i)e[i]=e[i]&~n[i];for(var o=e.length;o<r;++o)e[o]=0;return this},qp.prototype.union=function(t){for(var e=this._words,n=t._words,r=Math.min(e.length,n.length),i=0;i<r;++i)e[i]|=n[i];for(var o=e.length;o<r;++o)e[o]=0;return this},qp.prototype.intersection=function(t){for(var e=this._words,n=t._words,r=Math.min(e.length,n.length),i=0;i<r;++i)e[i]&=n[i];for(var o=e.length;o<r;++o)e[o]=0;return this},qp.prototype.intersects=function(t){for(var e=this._words,n=t._words,r=Math.min(e.length,n.length),i=0;i<r;++i)if(0!=(e[i]&n[i]))return!0;return!1},qp.prototype.getIntersectionSize=function(t){for(var e=this._words,n=t._words,r=Math.min(e.length,n.length),i=0,o=0;o<r;++o)i+=Wp(e[o]&n[o]);return i},qp.prototype.makeIntersection=function(t){var e=this._words,n=t._words,r=Math.min(e.length,n.length),i=new Uint32Array(r),o=Object.create(qp.prototype);o._words=i,o.length=Math.min(this.length,t.length);for(var a=0;a<r;++a)i[a]=e[a]&n[a];return o},qp.prototype.forEach=function(t){for(var e=this._words.length,n=this._words,r=0,i=0;i<e;++i)for(var o=n[i];0!==o;){var a=o&-o;t((i<<5)+Wp(a-1),r),o^=a,++r}},qp.prototype.toArray=function(){for(var t=this._words,e=new Array(this.getSize()),n=this._words.length,r=0,i=0;i<n;++i)for(var o=t[i];0!==o;){var a=o&-o;e[r++]=(i<<5)+Wp(a-1),o^=a}return e},qp.prototype.toString=function(){return"{"+this.toArray().join(",")+"}"},qp.prototype.toSeleString=function(){var t=this.toArray().join(",");return t?"@"+t:"NONE"},qp.prototype.clone=function(){var t=Object.create(qp.prototype);return t.length=this.length,t._words=new Uint32Array(this._words),t};var Xp=0,Yp=1,Kp=2,Zp=3,Qp=4,Jp=0,td=["D-BETA-PEPTIDE, C-GAMMA LINKING","D-GAMMA-PEPTIDE, C-DELTA LINKING","D-PEPTIDE COOH CARBOXY TERMINUS","D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING","L-GAMMA-PEPTIDE, C-DELTA LINKING","L-PEPTIDE COOH CARBOXY TERMINUS","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE LINKING","PEPTIDE LINKING","PEPTIDE-LIKE"],ed=["RNA OH 3 PRIME TERMINUS","RNA OH 5 PRIME TERMINUS","RNA LINKING"],nd=["DNA OH 3 PRIME TERMINUS","DNA OH 5 PRIME TERMINUS","DNA LINKING","L-DNA LINKING","L-RNA LINKING"],rd=["D-SACCHARIDE","D-SACCHARIDE 1,4 AND 1,4 LINKING","D-SACCHARIDE 1,4 AND 1,6 LINKING","L-SACCHARIDE","L-SACCHARIDE 1,4 AND 1,4 LINKING","L-SACCHARIDE 1,4 AND 1,6 LINKING","SACCHARIDE"],id=["NON-POLYMER"].concat(["OTHER"],rd),od=["h","g","i"],ad=["e","b"],sd=["s","t","l",""],cd={H:1.1,HE:1.4,LI:1.81,BE:1.53,B:1.92,C:1.7,N:1.55,O:1.52,F:1.47,NE:1.54,NA:2.27,MG:1.73,AL:1.84,SI:2.1,P:1.8,S:1.8,CL:1.75,AR:1.88,K:2.75,CA:2.31,SC:2.3,TI:2.15,V:2.05,CR:2.05,MN:2.05,FE:2.05,CO:2,NI:2,CU:2,ZN:2.1,GA:1.87,GE:2.11,AS:1.85,SE:1.9,BR:1.83,KR:2.02,RB:3.03,SR:2.49,Y:2.4,ZR:2.3,NB:2.15,MO:2.1,TC:2.05,RU:2.05,RH:2,PD:2.05,AG:2.1,CD:2.2,IN:2.2,SN:1.93,SB:2.17,TE:2.06,I:1.98,XE:2.16,CS:3.43,BA:2.68,LA:2.5,CE:2.48,PR:2.47,ND:2.45,PM:2.43,SM:2.42,EU:2.4,GD:2.38,TB:2.37,DY:2.35,HO:2.33,ER:2.32,TM:2.3,YB:2.28,LU:2.27,HF:2.25,TA:2.2,W:2.1,RE:2.05,OS:2,IR:2,PT:2.05,AU:2.1,HG:2.05,TL:1.96,PB:2.02,BI:2.07,PO:1.97,AT:2.02,RN:2.2,FR:3.48,RA:2.83,AC:2,TH:2.4,PA:2,U:2.3,NP:2,PU:2,AM:2,CM:2,BK:2,CF:2,ES:2,FM:2,MD:2,NO:2,LR:2,RF:2,DB:2,SG:2,BH:2,HS:2,MT:2,DS:2,RG:2,CN:2,UUT:2,FL:2,UUP:2,LV:2,UUH:2},ud={H:.31,HE:.28,LI:1.28,BE:.96,B:.84,C:.76,N:.71,O:.66,F:.57,NE:.58,NA:1.66,MG:1.41,AL:1.21,SI:1.11,P:1.07,S:1.05,CL:1.02,AR:1.06,K:2.03,CA:1.76,SC:1.7,TI:1.6,V:1.53,CR:1.39,MN:1.39,FE:1.32,CO:1.26,NI:1.24,CU:1.32,ZN:1.22,GA:1.22,GE:1.2,AS:1.19,SE:1.2,BR:1.2,KR:1.16,RB:2.2,SR:1.95,Y:1.9,ZR:1.75,NB:1.64,MO:1.54,TC:1.47,RU:1.46,RH:1.42,PD:1.39,AG:1.45,CD:1.44,IN:1.42,SN:1.39,SB:1.39,TE:1.38,I:1.39,XE:1.4,CS:2.44,BA:2.15,LA:2.07,CE:2.04,PR:2.03,ND:2.01,PM:1.99,SM:1.98,EU:1.98,GD:1.96,TB:1.94,DY:1.92,HO:1.92,ER:1.89,TM:1.9,YB:1.87,LU:1.87,HF:1.75,TA:1.7,W:1.62,RE:1.51,OS:1.44,IR:1.41,PT:1.36,AU:1.36,HG:1.32,TL:1.45,PB:1.46,BI:1.48,PO:1.4,AT:1.5,RN:1.5,FR:2.6,RA:2.21,AC:2.15,TH:2.06,PA:2,U:1.96,NP:1.9,PU:1.87,AM:1.8,CM:1.69,BK:1.6,CF:1.6,ES:1.6,FM:1.6,MD:1.6,NO:1.6,LR:1.6,RF:1.6,DB:1.6,SG:1.6,BH:1.6,HS:1.6,MT:1.6,DS:1.6,RG:1.6,CN:1.6,UUT:1.6,FL:1.6,UUP:1.6,LV:1.6,UUH:1.6},ld={ALA:[.17,.5,.33],ARG:[.81,1.81,1],ASN:[.42,.85,.43],ASP:[1.23,3.64,2.41],ASH:[-.07,.43,.5],CYS:[-.24,-.02,.22],GLN:[.58,.77,.19],GLU:[2.02,3.63,1.61],GLH:[-.01,.11,.12],GLY:[.01,1.15,1.14],HIS:[.17,.11,-.06],ILE:[-.31,-1.12,-.81],LEU:[-.56,-1.25,-.69],LYS:[.99,2.8,1.81],MET:[-.23,-.67,-.44],PHE:[-1.13,-1.71,-.58],PRO:[.45,.14,-.31],SER:[.13,.46,.33],THR:[.14,.25,.11],TRP:[-1.85,-2.09,-.24],TYR:[-.94,-.71,.23],VAL:[.07,-.46,-.53]},hd=[0,0,0],pd={HIS:"H",ARG:"R",LYS:"K",ILE:"I",PHE:"F",LEU:"L",TRP:"W",ALA:"A",MET:"M",PRO:"P",CYS:"C",ASN:"N",VAL:"V",GLY:"G",SER:"S",GLN:"Q",TYR:"Y",ASP:"D",GLU:"E",THR:"T",ASH:"D",GLH:"E",UNK:""},dd=Object.keys(pd),fd=["A","C","T","G","U"],md=["DA","DC","DT","DG","DU","TCY","MCY","5CM"],gd=["A","G","DA","DG"],vd=["SOL","WAT","HOH","H2O","W","DOD","D3O","TIP3","TIP4"],yd=["118","119","1AL","1CU","2FK","2HP","2OF","3CO","3MT","3NI","3OF","3P8","4MO","4PU","543","6MO","ACT","AG","AL","ALF","AM","ATH","AU","AU3","AUC","AZI","BA","BCT","BEF","BF4","BO4","BR","BS3","BSY","CA","CAC","CD","CD1","CD3","CD5","CE","CHT","CL","CO","CO3","CO5","CON","CR","CS","CSB","CU","CU1","CU3","CUA","CUZ","CYN","DME","DMI","DSC","DTI","DY","E4N","EDR","EMC","ER3","EU","EU3","F","FE","FE2","FPO","GA","GD3","GEP","HAI","HG","HGC","IN","IOD","IR","IR3","IRI","IUM","K","KO4","LA","LCO","LCP","LI","LU","MAC","MG","MH2","MH3","MLI","MLT","MMC","MN","MN3","MN5","MN6","MO1","MO2","MO3","MO4","MO5","MO6","MOO","MOS","MOW","MW1","MW2","MW3","NA","NA2","NA5","NA6","NAO","NAW","NCO","NET","NH4","NI","NI1","NI2","NI3","NO2","NO3","NRU","O4M","OAA","OC1","OC2","OC3","OC4","OC5","OC6","OC7","OC8","OCL","OCM","OCN","OCO","OF1","OF2","OF3","OH","OS","OS4","OXL","PB","PBM","PD","PDV","PER","PI","PO3","PO4","PR","PT","PT4","PTN","RB","RH3","RHD","RU","SB","SCN","SE4","SEK","SM","SMO","SO3","SO4","SR","T1A","TB","TBA","TCN","TEA","TH","THE","TL","TMA","TRA","UNX","V","VN3","VO4","W","WO5","Y1","YB","YB2","YH","YT3","ZCM","ZN","ZN2","ZN3","ZNO","ZO3","OHX"],bd=["045","0AT","0BD","0MK","0NZ","0TS","0V4","0XY","0YT","10M","147","149","14T","15L","16G","18T","18Y","1AR","1BW","1GL","1GN","1JB","1LL","1NA","1S3","26M","26Q","26R","26V","26W","26Y","27C","289","291","293","2DG","2F8","2FG","2FL","2FP","2GL","2M4","2M5","32O","34V","3CM","3DO","3DY","3FM","3LR","3MF","3MG","3SA","3ZW","46D","46M","46Z","48Z","4CQ","4GC","4NN","50A","5DI","5GF","5MM","5RP","5SA","5SP","64K","6PG","6SA","7JZ","7SA","A1Q","A2G","AAB","AAL","AAO","ABC","ABD","ABE","ABF","ABL","ACG","ACI","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AHR","AIG","ALL","ALX","AMU","AOG","AOS","ARA","ARB","ARE","ARI","ASG","ASO","AXP","AXR","B0D","B16","B2G","B4G","B6D","B8D","B9D","BBK","BCD","BDG","BDP","BDR","BEM","BFP","BGC","BGL","BGP","BGS","BHG","BMA","BMX","BNG","BNX","BOG","BRI","BXF","BXP","BXX","BXY","C3X","C4X","C5X","CAP","CBI","CBK","CBS","CDR","CEG","CGF","CHO","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D6G","DAF","DAG","DDA","DDB","DDL","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGS","DIG","DLF","DLG","DMU","DNO","DOM","DP5","DQQ","DQR","DR2","DR3","DR4","DRI","DSR","DT6","DVC","E4P","E5G","EAG","EBG","EBQ","EGA","EJT","EPG","ERE","ERI","F1P","F1X","F6P","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FIX","FMO","FRU","FSI","FU4","FUB","FUC","FUD","FUL","FXP","G16","G1P","G2F","G3I","G4D","G4S","G6D","G6P","G6S","GAC","GAD","GAL","GC1","GC4","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GCX","GE1","GFG","GFP","GIV","GL0","GL2","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GMH","GN1","GNX","GP1","GP4","GPH","GPM","GQ1","GQ2","GQ4","GS1","GS4","GSA","GSD","GTE","GTH","GTK","GTR","GTZ","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUP","GUZ","GYP","GYV","H2P","HDL","HMS","HS2","HSD","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","IAB","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IMK","IN1","IPT","ISL","KBG","KD2","KDA","KDM","KDO","KFN","KO1","KO2","KTU","L6S","LAG","LAI","LAK","LAO","LAT","LB2","LBT","LCN","LDY","LGC","LGU","LM2","LMT","LMU","LOG","LOX","LPK","LSM","LTM","LVZ","LXB","LXZ","M1F","M3M","M6P","M8C","MA1","MA2","MA3","MAB","MAG","MAL","MAN","MAT","MAV","MAW","MBG","MCU","MDA","MDM","MDP","MFA","MFB","MFU","MG5","MGA","MGL","MLB","MMA","MMN","MN0","MRP","MTT","MUG","MVP","MXY","N1L","N9S","NAA","NAG","NBG","NDG","NED","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGL","NGS","NGY","NHF","NM6","NM9","NTF","NTO","NTP","NXD","NYT","OPG","OPM","ORP","OX2","P3M","P53","P6P","PA5","PNA","PNG","PNW","PRP","PSJ","PSV","PTQ","QDK","QPS","QV4","R1P","R1X","R2B","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RIB","RIP","RNS","RNT","ROB","ROR","RPA","RST","RUB","RUU","RZM","S6P","S7P","SA0","SCR","SDD","SF6","SF9","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHG","SI3","SIO","SOE","SOL","SSG","SUC","SUP","SUS","T6P","T6T","TAG","TCB","TDG","TGK","TGY","TH1","TIA","TM5","TM6","TM9","TMR","TMX","TOA","TOC","TRE","TYV","UCD","UDC","VG1","X0X","X1X","X2F","X4S","X5S","X6X","XBP","XDN","XDP","XIF","XIM","XLF","XLS","XMM","XUL","XXR","XYP","XYS","YO5","Z3Q","Z6J","Z9M","ZDC","ZDM"],xd=["CA","C","N","O","O1","O2","OC1","OC2","OX1","OXT","H","H1","H2","H3","HA","BB"],_d=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],wd={};function Sd(t,e){this.type=t,this.scale=e||1,this.max=10}function Cd(t,e){this.cols=t,this.rows=e,this.size=this.cols*this.rows,this.data=new Float32Array(this.size)}function Ad(t,e){for(var n=0,r=0,i=e.rows,o=e.cols,a=0,s=0,c=0,u=e.data,l=t.data;n<i;s+=1,a+=o,n++)for(c=s,r=0;r<o;c+=i,r++)l[c]=u[a+r]}function Ed(t,e,n){for(var r=0,i=0,o=0,a=0,s=0,c=0,u=0,l=e.cols,h=e.rows,p=n.rows,d=e.data,f=n.data,m=t.data,g=0;r<h;a+=l,r++)for(c=0,i=0;i<p;u++,i++){for(s=a,g=0,o=0;o<l;s++,c++,o++)g+=d[s]*f[c];m[u]=g}}function Md(t,e,n){var r=t.data,i=e.data,o=n.data,a=i[0],s=i[1],c=i[2],u=i[3],l=i[4],h=i[5],p=i[6],d=i[7],f=i[8],m=o[0],g=o[1],v=o[2],y=o[3],b=o[4],x=o[5],_=o[6],w=o[7],S=o[8];r[0]=a*m+s*y+c*_,r[1]=a*g+s*b+c*w,r[2]=a*v+s*x+c*S,r[3]=u*m+l*y+h*_,r[4]=u*g+l*b+h*w,r[5]=u*v+l*x+h*S,r[6]=p*m+d*y+f*_,r[7]=p*g+d*b+f*w,r[8]=p*v+d*x+f*S}function Td(t){var e,n,r=0,i=t.rows,o=t.cols,a=t.data,s=new Array(o);for(n=0;n<o;++n)s[n]=0;for(e=0;e<i;++e)for(n=0;n<o;++n,++r)s[n]+=a[r];for(n=0;n<o;++n)s[n]/=i;return s}function Pd(t,e){var n,r,i=0,o=t.rows,a=t.cols,s=t.data;for(n=0;n<o;++n)for(r=0;r<a;++r,++i)s[i]-=e[r]}function Id(t,e,n,r){r=t[e],t[e]=t[n],t[n]=r}function Rd(t,e){return(t=Math.abs(t))>(e=Math.abs(e))?(e/=t,t*Math.sqrt(1+e*e)):e>0?(t/=e,e*Math.sqrt(1+t*t)):0}wd[1]={trace:"CA",direction1:"C",direction2:["O","OC1","O1","OX1","OXT"],backboneStart:"N",backboneEnd:"C"},wd[2]={trace:["C4'","C4*"],direction1:["C1'","C1*"],direction2:["C3'","C3*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},wd[3]={trace:["C3'","C3*"],direction1:["C2'","C2*"],direction2:["O4'","O4*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},wd[4]={trace:["CA","BB"],backboneStart:["CA","BB"],backboneEnd:["CA","BB"]},wd[5]={trace:["C4'","C4*","P"],backboneStart:["C4'","C4*","P"],backboneEnd:["C4'","C4*","P"]},wd[6]={trace:["C3'","C3*","C2'","P"],backboneStart:["C3'","C3*","C2'","P"],backboneEnd:["C3'","C3*","C2'","P"]},wd[Jp]={},Sd.prototype={constructor:Sd,atomRadius:function(t){var e,n=this.type,r=this.scale;switch(n){case"vdw":e=cd[t.element]||2;break;case"covalent":e=ud[t.element]||1.6;break;case"bfactor":e=t.bfactor||1;break;case"sstruc":var i=t.sstruc;e="h"===i?.25:"g"===i?.25:"i"===i?.25:"e"===i?.25:"b"===i?.25:_d.includes(t.atomname)?.4:.1;break;default:e=n||1}return Math.min(e*r,this.max)}},Sd.types={"":"",vdw:"by vdW radius",covalent:"by covalent radius",sstruc:"by secondary structure",bfactor:"by bfactor",size:"size"},Cd.prototype={copyTo:function(t){t.data.set(this.data)}};var Od=1.192092896e-7,Ld=1e-37;function kd(t,e,n,r){var i=0,o=0,a=t.rows,s=t.cols,c=a,u=s;c<u&&(i=1,o=c,c=u,u=o);var l=new Cd(c,c),h=new Cd(1,u),p=new Cd(u,u);if(0===i)Ad(l,t);else{for(o=0;o<s*a;o++)l.data[o]=t.data[o];for(;o<u*c;o++)l.data[o]=0}if(function(t,e,n,r,i,o,a,s){for(var c=2*Od,u=Ld,l=0,h=0,p=0,d=0,f=Math.max(o,30),m=0,g=0,v=0,y=0,b=0,x=0,_=0,w=0,S=0,C=0,A=0,E=0,M=0,T=0,P=0,I=0,R=0,O=4660,L=0,k=0,N=0,D=new Float64Array(a<<3);l<a;l++){for(p=0,A=0;p<o;p++)A+=(w=t[l*e+p])*w;if(D[l]=A,r){for(p=0;p<a;p++)r[l*i+p]=0;r[l*i+l]=1}}for(;d<f;d++){for(b=0,l=0;l<a-1;l++)for(h=l+1;h<a;h++){for(m=l*e|0,g=h*e|0,P=D[l],I=0,R=D[h],p=2,I+=t[m]*t[g],I+=t[m+1]*t[g+1];p<o;p++)I+=t[m+p]*t[g+p];if(!(Math.abs(I)<=c*Math.sqrt(P*R))){for(M=Rd(I*=2,E=P-R),E<0?(T=.5*(M-E),x=I/(M*(_=Math.sqrt(T/M))*2)):_=I/(M*(x=Math.sqrt((M+E)/(2*M)))*2),P=0,R=0,p=2,S=x*t[m]+_*t[g],C=-_*t[m]+x*t[g],t[m]=S,t[g]=C,P+=S*S,R+=C*C,S=x*t[m+1]+_*t[g+1],C=-_*t[m+1]+x*t[g+1],t[m+1]=S,t[g+1]=C,P+=S*S,R+=C*C;p<o;p++)S=x*t[m+p]+_*t[g+p],C=-_*t[m+p]+x*t[g+p],t[m+p]=S,t[g+p]=C,P+=S*S,R+=C*C;if(D[l]=P,D[h]=R,b=1,r)for(y=h*i|0,p=2,S=x*r[v=l*i|0]+_*r[y],C=-_*r[v]+x*r[y],r[v]=S,r[y]=C,S=x*r[v+1]+_*r[y+1],C=-_*r[v+1]+x*r[y+1],r[v+1]=S,r[y+1]=C;p<a;p++)S=x*r[v+p]+_*r[y+p],C=-_*r[v+p]+x*r[y+p],r[v+p]=S,r[y+p]=C}}if(0===b)break}for(l=0;l<a;l++){for(p=0,A=0;p<o;p++)A+=(w=t[l*e+p])*w;D[l]=Math.sqrt(A)}for(l=0;l<a-1;l++){for(h=l,p=l+1;p<a;p++)D[h]<D[p]&&(h=p);if(l!==h&&(Id(D,l,h,A),r)){for(p=0;p<o;p++)Id(t,l*e+p,h*e+p,w);for(p=0;p<a;p++)Id(r,l*i+p,h*i+p,w)}}for(l=0;l<a;l++)n[l]=D[l];if(r)for(l=0;l<s;l++){for(A=l<a?D[l]:0;A<=u;){for(k=1/o,p=0;p<o;p++)L=0!=(256&(O=214013*O+2531011)>>16)?k:-k,t[l*e+p]=L;for(d=0;d<2;d++)for(h=0;h<l;h++){for(A=0,p=0;p<o;p++)A+=t[l*e+p]*t[h*e+p];for(N=0,p=0;p<o;p++)w=t[l*e+p]-A*t[h*e+p],t[l*e+p]=w,N+=Math.abs(w);for(N=N?1/N:0,p=0;p<o;p++)t[l*e+p]*=N}for(A=0,p=0;p<o;p++)A+=(w=t[l*e+p])*w;A=Math.sqrt(A)}for(_=1/A,p=0;p<o;p++)t[l*e+p]*=_}}(l.data,c,h.data,p.data,u,c,u,c),e){for(o=0;o<u;o++)e.data[o]=h.data[o];for(;o<s;o++)e.data[o]=0}0===i?(n&&Ad(n,l),r&&Ad(r,p)):(n&&Ad(n,p),r&&Ad(r,l))}function Nd(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Dd(t,e,n,r,i,o,a,s,c,u,l,h,p,d,f,m,g){t[0]=e,t[4]=n,t[8]=r,t[12]=i,t[1]=o,t[5]=a,t[9]=s,t[13]=c,t[2]=u,t[6]=l,t[10]=h,t[14]=p,t[3]=d,t[7]=f,t[11]=m,t[15]=g}function zd(t,e,n){var r=e[0],i=e[4],o=e[8],a=e[12],s=e[1],c=e[5],u=e[9],l=e[13],h=e[2],p=e[6],d=e[10],f=e[14],m=e[3],g=e[7],v=e[11],y=e[15],b=n[0],x=n[4],_=n[8],w=n[12],S=n[1],C=n[5],A=n[9],E=n[13],M=n[2],T=n[6],P=n[10],I=n[14],R=n[3],O=n[7],L=n[11],k=n[15];t[0]=r*b+i*S+o*M+a*R,t[4]=r*x+i*C+o*T+a*O,t[8]=r*_+i*A+o*P+a*L,t[12]=r*w+i*E+o*I+a*k,t[1]=s*b+c*S+u*M+l*R,t[5]=s*x+c*C+u*T+l*O,t[9]=s*_+c*A+u*P+l*L,t[13]=s*w+c*E+u*I+l*k,t[2]=h*b+p*S+d*M+f*R,t[6]=h*x+p*C+d*T+f*O,t[10]=h*_+p*A+d*P+f*L,t[14]=h*w+p*E+d*I+f*k,t[3]=m*b+g*S+v*M+y*R,t[7]=m*x+g*C+v*T+y*O,t[11]=m*_+g*A+v*P+y*L,t[15]=m*w+g*E+v*I+y*k}function Fd(t,e,n,r){Dd(t,e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1)}function Bd(t,e,n,r){Dd(t,1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1)}function Ud(t,e){var n=Math.cos(e),r=Math.sin(e);Dd(t,n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1)}function jd(){return new Float32Array([1,0,0,0,1,0,0,0,1])}function Gd(t,e){var n=fp([e[0],e[1],e[2]]),r=fp([e[4],e[5],e[6]]),i=fp([e[8],e[9],e[10]]),o=fp();mp(o,r,i),t[0]=o[0],t[1]=o[1],t[2]=o[2],mp(o,i,n),t[3]=o[0],t[4]=o[1],t[5]=o[2],mp(o,n,r),t[6]=o[0],t[7]=o[1],t[8]=o[2]}Fd.__deps=[Dd],Bd.__deps=[Dd],Ud.__deps=[Dd],Gd.__deps=[fp,mp];var Vd=new Ne(-1,-1,-1),Hd=new De,$d=function(t){var e=t.rows,n=e/3,r=new Cd(e,3),i=new Cd(3,3),o=new Cd(1,3),a=new Cd(3,3),s=new Cd(3,3),c=Td(t);Pd(t,c),Ad(r,t),Ed(i,r,r),kd(i,o,a,s);var u=new Ne(c[0],c[1],c[2]),l=new Ne(a.data[0],a.data[3],a.data[6]),h=new Ne(a.data[1],a.data[4],a.data[7]),p=new Ne(a.data[2],a.data[5],a.data[8]),d=l.clone().multiplyScalar(Math.sqrt(o.data[0]/n)),f=h.clone().multiplyScalar(Math.sqrt(o.data[1]/n)),m=p.clone().multiplyScalar(Math.sqrt(o.data[2]/n));this.begA=u.clone().sub(d),this.endA=u.clone().add(d),this.begB=u.clone().sub(f),this.endB=u.clone().add(f),this.begC=u.clone().sub(m),this.endC=u.clone().add(m),this.center=u,this.vecA=d,this.vecB=f,this.vecC=m,this.normVecA=l,this.normVecB=h,this.normVecC=p};function Wd(t,e){var n,r,i=3,o=e,a=o.min.x,s=o.min.y,c=o.min.z,u=1+(o.max.x-a>>i),l=1+(o.max.y-s>>i),h=1+(o.max.z-c>>i),p=u*l*h,d=t.count,f=t.x,m=t.y,g=t.z,v=0,y=new Uint32Array(p),b=new Int32Array(d);for(n=0;n<d;++n){var x=f[n]-a>>i,_=m[n]-s>>i,w=g[n]-c>>i,S=(x*l+_)*h+w;1===(y[S]+=1)&&(v+=1),b[n]=S}var C=new Uint16Array(v);for(n=0,r=0;n<p;++n){var A=y[n];A>0&&(y[n]=r+1,C[r]=A,r+=1)}var E=new Uint32Array(v);for(n=1;n<v;++n)E[n]+=E[n-1]+C[n-1];var M=new Uint16Array(v),T=new Int32Array(d);for(n=0;n<d;++n){var P=y[b[n]];if(P>0){var I=P-1;T[E[I]+M[I]]=n,M[I]+=1}}this.within=function(t,e,n,r){for(var o=r*r,p=Math.max(0,t-r-a>>i),d=Math.max(0,e-r-s>>i),v=Math.max(0,n-r-c>>i),b=Math.min(u,t+r-a>>i),x=Math.min(l,e+r-s>>i),_=Math.min(h,n+r-c>>i),w=[],S=p;S<=b;++S)for(var A=d;A<=x;++A)for(var M=v;M<=_;++M){var P=y[(S*l+A)*h+M];if(P>0)for(var I=P-1,R=E[I],O=R+C[I],L=R;L<O;++L){var k=T[L],N=f[k]-t,D=m[k]-e,z=g[k]-n;N*N+D*D+z*z<=o&&w.push(k)}}return w}}function qd(t){var e=0,n=0,r={},i={},o=window.URL.createObjectURL(il.get(t)),a=new window.Worker(o);il.activeWorkerCount+=1,a.onmessage=function(n){e-=1;var o=n.data.__postId;nl&&el.timeEnd("Worker.postMessage "+t+" #"+o),r[o]&&r[o].call(a,n),delete r[o],delete i[o]},a.onerror=function(n){if(e-=1,n.data){var o=n.data.__postId;i[o]?i[o].call(a,n):el.error("Worker.onerror",o,t,n),delete r[o],delete i[o]}else el.error("Worker.onerror",t,n)},this.name=t,this.post=function(o,s,c,u){r[n]=c,i[n]=u,(o=o||{}).__name=t,o.__postId=n,o.__debug=nl,nl&&el.time("Worker.postMessage "+t+" #"+n);try{a.postMessage(o,s)}catch(t){el.error("worker.post:",t),a.postMessage(o)}return e+=1,n+=1,this},this.terminate=function(){a?(a.terminate(),window.URL.revokeObjectURL(o),il.activeWorkerCount-=1):el.log("no worker to terminate")},Object.defineProperties(this,{postCount:{get:function(){return n}},pending:{get:function(){return e}}})}function Xd(t,e){e=Math.min(8,e||2);var n=[],r=0;this.name=t,this.maxCount=e,this.post=function(t,e,n,r){return this.getNextWorker().post(t,e,n,r),this},this.terminate=function(){n.forEach(function(t){t.terminate()})},this.getNextWorker=function(){for(var i,o=1/0,a=0;a<e;++a){if(a>=r){i=new qd(t),n.push(i),r+=1;break}var s=n[a];if(0===s.pending){i=s;break}s.pending<o&&(o=s.pending,i=s)}return i},Object.defineProperties(this,{count:{get:function(){return r}}})}function Yd(){return new Uint32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0])}function Kd(){return new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}function Zd(){return[[0,4,4,4,2,0,0,0,2,2,0,0],[4,0,4,4,0,8,0,0,0,8,8,0],[4,4,0,4,0,0,8,0,0,0,8,8],[4,4,4,0,0,0,0,1,1,0,0,1],[2,0,0,0,0,8,8,8,2,2,0,0],[0,8,0,0,8,0,8,8,0,8,8,0],[0,0,8,0,8,8,0,8,0,0,8,8],[0,0,0,1,8,8,8,0,1,0,0,1],[2,0,0,1,2,0,0,1,0,2,0,1],[2,8,0,0,2,8,0,0,2,0,8,0],[0,8,8,0,0,8,8,0,0,8,0,8],[0,0,8,1,0,0,8,1,1,0,8,0]]}function Qd(t,e,n,r,i){var o,a,s,c,u,l,h,p=0,d=!1,f=!1,m=!1,g=e*n*r,v=e,y=e*n,b=new Int32Array(12),x=[],_=[],w=[],S=[],C=Yd(),A=Kd(),E=[[0,4,4,4,2,0,0,0,2,2,0,0],[4,0,4,4,0,8,0,0,0,8,8,0],[4,4,0,4,0,0,8,0,0,0,8,8],[4,4,4,0,0,0,0,1,1,0,0,1],[2,0,0,0,0,8,8,8,2,2,0,0],[0,8,0,0,8,0,8,8,0,8,8,0],[0,0,8,0,8,8,0,8,0,0,8,8],[0,0,0,1,8,8,8,0,1,0,0,1],[2,0,0,1,2,0,0,1,0,2,0,1],[2,8,0,0,2,8,0,0,2,0,8,0],[0,8,8,0,0,8,8,0,0,8,0,8],[0,0,8,1,0,0,8,1,1,0,8,0]];function M(t,e,n){return t+(e-t)*n}function T(t,i,o){return y*(o=(o+h)%r)+v*(i=(i+l)%n)+(t=(t+u)%e)}function P(t,e,n,r,c,u,l){var h=f?3*t:t;if(a[h]<0){var m=(p-u)/(l-u),g=o,v=3*s;if(x[v+0]=n+m,x[v+1]=r,x[v+2]=c,!d){var y=3*t;_[v]=-M(g[y],g[y+3],m),_[v+1]=-M(g[y+1],g[y+4],m),_[v+2]=-M(g[y+2],g[y+5],m)}i&&(S[s]=i[t+Math.round(m)]),a[h]=s,b[e]=s,s+=1}else b[e]=a[h]}function I(t,e,n,r,c,u,l){var h=f?3*t+1:t;if(a[h]<0){var m=(p-u)/(l-u),g=o,y=3*s;if(x[y]=n,x[y+1]=r+m,x[y+2]=c,!d){var w=3*t,C=w+3*v;_[y]=-M(g[w],g[C],m),_[y+1]=-M(g[w+1],g[C+1],m),_[y+2]=-M(g[w+2],g[C+2],m)}i&&(S[s]=i[t+Math.round(m)*v]),a[h]=s,b[e]=s,s+=1}else b[e]=a[h]}function R(t,e,n,r,c,u,l){var h=f?3*t+2:t;if(a[h]<0){var m=(p-u)/(l-u),g=o,v=3*s;if(x[v]=n,x[v+1]=r,x[v+2]=c+m,!d){var w=3*t,C=w+3*y;_[v]=-M(g[w],g[C],m),_[v+1]=-M(g[w+1],g[C+1],m),_[v+2]=-M(g[w+2],g[C+2],m)}i&&(S[s]=i[t+Math.round(m)*y]),a[h]=s,b[e]=s,s+=1}else b[e]=a[h]}function O(e){var n=3*e;0===o[n]&&(o[n]=t[(e-1+g)%g]-t[(e+1)%g],o[n+1]=t[(e-v+g)%g]-t[(e+v)%g],o[n+2]=t[(e-y+g)%g]-t[(e+y)%g])}function L(e,n,r,i,o){var a,s,u,l,h,g,x;m?(i=T(e,n,r),a=T(e+1,n,r),s=T(e,n+1,r),u=T(e,n,r+1),l=T(e+1,n+1,r),h=T(e+1,n,r+1),g=T(e,n+1,r+1),x=T(e+1,n+1,r+1)):(a=i+1,l=(s=i+v)+1,h=(u=i+y)+1,x=(g=s+y)+1);var _=0,S=t[i],M=t[a],L=t[s],k=t[l],N=t[u],D=t[h],z=t[g],F=t[x];S<p&&(_|=1),M<p&&(_|=2),L<p&&(_|=8),k<p&&(_|=4),N<p&&(_|=16),D<p&&(_|=32),z<p&&(_|=128),F<p&&(_|=64);var B=C[_];if(0===B)return 0;var U=e+1,j=n+1,G=r+1;1&B&&(d||(O(i),O(a)),P(i,0,e,n,r,S,M)),2&B&&(d||(O(a),O(l)),I(a,1,U,n,r,M,k)),4&B&&(d||(O(s),O(l)),P(s,2,e,j,r,L,k)),8&B&&(d||(O(i),O(s)),I(i,3,e,n,r,S,L)),16&B&&(d||(O(u),O(h)),P(u,4,e,n,G,N,D)),32&B&&(d||(O(h),O(x)),I(h,5,U,n,G,D,F)),64&B&&(d||(O(g),O(x)),P(g,6,e,j,G,z,F)),128&B&&(d||(O(u),O(g)),I(u,7,e,n,G,N,z)),256&B&&(d||(O(i),O(u)),R(i,8,e,n,r,S,N)),512&B&&(d||(O(a),O(h)),R(a,9,U,n,r,M,D)),1024&B&&(d||(O(l),O(x)),R(l,10,U,j,r,k,F)),2048&B&&(d||(O(s),O(g)),R(s,11,e,j,r,L,z));for(var V,H,$,W=_<<4,q=0;-1!==A[W+q];)V=A[W+q],H=A[W+q+1],$=A[W+q+2],f?(E[V][H]&o&&(w[c++]=b[V],w[c++]=b[H]),E[H][$]&o&&(w[c++]=b[H],w[c++]=b[$]),E[V][$]&o&&(w[c++]=b[V],w[c++]=b[$])):(w[c++]=b[H],w[c++]=b[V],w[c++]=b[$]),q+=3}function k(i,o,s,c,u,l){var h,g,b,x,_,w,S,C,A,E,M,P,I;if(i=void 0!==i?i:0,o=void 0!==o?o:0,s=void 0!==s?s:0,c=void 0!==c?c:e-1,u=void 0!==u?u:n-1,l=void 0!==l?l:r-1,m||(d?(i=Math.max(0,i),o=Math.max(0,o),s=Math.max(0,s),c=Math.min(e-1,c),u=Math.min(n-1,u),l=Math.min(r-1,l)):(i=Math.max(1,i),o=Math.max(1,o),s=Math.max(1,s),c=Math.min(e-2,c),u=Math.min(n-2,u),l=Math.min(r-2,l))),m)for(C=i-2,A=o-2,M=c+2,P=u+2,I=l+2,_=E=s-2;_<I;++_)for(x=A;x<P;++x)for(b=C;b<M;++b)f?(g=3*T(b,x,_),a[g]=-1,a[g+1]=-1,a[g+2]=-1):(h=T(b,x,_),a[h]=-1);else for(C=Math.max(0,i-2),A=Math.max(0,o-2),E=Math.max(0,s-2),M=Math.min(e,c+2),P=Math.min(n,u+2),I=Math.min(r,l+2),_=E;_<I;++_)for(S=y*_,x=A;x<P;++x)for(w=S+v*x,b=C;b<M;++b)f?(a[h=3*(w+b)]=-1,a[h+1]=-1,a[h+2]=-1):a[h=w+b]=-1;if(!m){var R,O=i,k=o,N=s,D=c,z=u,F=l;for(R=!1,_=s;_<l;++_){for(x=o;x<u;++x){for(b=i;b<c;++b)if(t[h=e*n*_+e*x+b]>=p){N=_,R=!0;break}if(R)break}if(R)break}for(R=!1,x=o;x<u;++x){for(_=N;_<l;++_){for(b=i;b<c;++b)if(t[h=e*n*_+e*x+b]>=p){k=x,R=!0;break}if(R)break}if(R)break}for(R=!1,b=i;b<c;++b){for(x=k;x<u;++x){for(_=N;_<l;++_)if(t[h=e*n*_+e*x+b]>=p){O=b,R=!0;break}if(R)break}if(R)break}for(R=!1,_=l;_>=s;--_){for(x=u;x>=o;--x){for(b=c;b>=i;--b)if(t[h=e*n*_+e*x+b]>=p){F=_,R=!0;break}if(R)break}if(R)break}for(R=!1,x=u;x>=o;--x){for(_=F;_>=s;--_){for(b=c;b>=i;--b)if(t[h=e*n*_+e*x+b]>=p){z=x,R=!0;break}if(R)break}if(R)break}for(R=!1,b=c;b>=i;--b){for(x=z;x>=o;--x){for(_=F;_>=s;--_)if(t[h=e*n*_+e*x+b]>=p){D=b,R=!0;break}if(R)break}if(R)break}d?(i=Math.max(0,O-1),o=Math.max(0,k-1),s=Math.max(0,N-1),c=Math.min(e-1,D+1),u=Math.min(n-1,z+1),l=Math.min(r-1,F+1)):(i=Math.max(1,O-1),o=Math.max(1,k-1),s=Math.max(1,N-1),c=Math.min(e-2,D+1),u=Math.min(n-2,z+1),l=Math.min(r-2,F+1))}var B=15;for(_=s;_<l;++_,B&=-5)for(S=y*_,B|=2,x=o;x<u;++x,B&=-3)for(w=S+v*x,B|=1,b=i;b<c;++b,B&=-2)L(b,x,_,h=w+b,B)}this.triangulate=function(t,v,y,b,C){p=t,f=b,m=C,(d=v||f)||o||(o=new Float32Array(3*g));var A=f?3*g:g;if(a&&a.length===A||(a=new Int32Array(A)),s=0,c=0,void 0!==y){var E=y[0].map(Math.round),M=y[1].map(Math.round);u=e*Math.ceil(Math.abs(E[0])/e),l=n*Math.ceil(Math.abs(E[1])/n),h=r*Math.ceil(Math.abs(E[2])/r),k(E[0],E[1],E[2],M[0],M[1],M[2])}else u=l=h=0,k();return x.length=3*s,d||(_.length=3*s),w.length=c,i&&(S.length=s),{position:new Float32Array(x),normal:d?void 0:new Float32Array(_),index:Es(w,x.length/3),atomindex:i?new Int32Array(S):void 0,contour:f}}}function Jd(t,e,n,r){n=n||1,r=r||!0;var i,o=t.length/3,a=e.length/3;r&&(i=new Float32Array(3*o));var s,c,u,l,h=new Float32Array(3*o),p=new Array(20);for(s=0;s<20;++s)p[s]=new Uint32Array(o);for(s=0;s<o;++s)p[0][s]=0;for(s=0;s<a;++s){var d=3*s,f=3*s+1,m=3*s+2;for(l=!0,c=0,u=p[0][e[d]];c<u;++c)if(e[f]===p[c+1][e[d]]){l=!1;break}for(l&&(p[0][e[d]]++,p[p[0][e[d]]][e[d]]=e[f]),l=!0,c=0,u=p[0][e[d]];c<u;++c)if(e[m]===p[c+1][e[d]]){l=!1;break}for(l&&(p[0][e[d]]++,p[p[0][e[d]]][e[d]]=e[m]),l=!0,c=0,u=p[0][e[f]];c<u;++c)if(e[d]===p[c+1][e[f]]){l=!1;break}for(l&&(p[0][e[f]]++,p[p[0][e[f]]][e[f]]=e[d]),l=!0,c=0,u=p[0][e[f]];c<u;++c)if(e[m]===p[c+1][e[f]]){l=!1;break}for(l&&(p[0][e[f]]++,p[p[0][e[f]]][e[f]]=e[m]),l=!0,c=0;c<p[0][e[m]];++c)if(e[d]===p[c+1][e[m]]){l=!1;break}for(l&&(p[0][e[m]]++,p[p[0][e[m]]][e[m]]=e[d]),l=!0,c=0,u=p[0][e[m]];c<u;++c)if(e[f]===p[c+1][e[m]]){l=!1;break}l&&(p[0][e[m]]++,p[p[0][e[m]]][e[m]]=e[f])}for(var g,v,y,b,x,_=0;_<n;++_){for(s=0;s<o;++s)if(g=3*s,(y=p[0][s])<3)h[g]=t[g],h[g+1]=t[g+1],h[g+2]=t[g+2];else if(3===y||4===y){for(h[g]=0,h[g+1]=0,h[g+2]=0,c=0;c<y;++c)v=3*p[c+1][s],h[g]+=t[v],h[g+1]+=t[v+1],h[g+2]+=t[v+2];h[g]+=.5*t[g],h[g+1]+=.5*t[g+1],h[g+2]+=.5*t[g+2],x=.5+y,h[g]/=x,h[g+1]/=x,h[g+2]/=x}else{for(h[g]=0,h[g+1]=0,h[g+2]=0,c=0;c<y;++c)v=3*p[c+1][s],h[g]+=t[v],h[g+1]+=t[v+1],h[g+2]+=t[v+2];h[g]+=1*t[g],h[g+1]+=1*t[g+1],h[g+2]+=1*t[g+2],b=1+y,h[g]/=b,h[g+1]/=b,h[g+2]/=b}if(t.set(h),r){tf(t,e,i);var w=3*o;for(g=0;g<w;g+=3)t[g]+=.75/4.5*-1*i[g],t[g+1]+=.75/4.5*-1*i[g+1],t[g+2]+=.75/4.5*-1*i[g+2]}}}function tf(t,e,n){var r,i;if(void 0===n)n=new Float32Array(t.length);else for(r=0,i=n.length;r<i;r++)n[r]=0;var o=new Float32Array(3),a=new Float32Array(3),s=new Float32Array(3),c=new Float32Array(3),u=new Float32Array(3);if(e)for(r=0,i=e.length;r<i;r+=3){var l=3*e[r],h=3*e[r+1],p=3*e[r+2];vp(o,t,l),vp(a,t,h),vp(s,t,p),gp(c,s,a),gp(u,o,a),mp(c,c,u),n[l]+=c[0],n[l+1]+=c[1],n[l+2]+=c[2],n[h]+=c[0],n[h+1]+=c[1],n[h+2]+=c[2],n[p]+=c[0],n[p+1]+=c[1],n[p+2]+=c[2]}else for(r=0,i=t.length;r<i;r+=9)vp(o,t,r),vp(a,t,r+3),vp(s,t,r+6),gp(c,s,a),gp(u,o,a),mp(c,c,u),n[r]=c[0],n[r+1]=c[1],n[r+2]=c[2],n[r+3]=c[0],n[r+4]=c[1],n[r+5]=c[2],n[r+6]=c[0],n[r+7]=c[1],n[r+8]=c[2];return dp(n),n}function ef(t){for(var e={},n=0,r=t.length;n<r;++n)e[t[n]]=!0;return e}function nf(t,e,n,r,i){var o=1/r*3;wp(t,t,i+(o+=n)),Sp(e,e,i+o),xp(t,t,r),Cp(t,t),bp(t,t,r),xp(e,e,r),Ap(e,e),bp(e,e,r);var a=new Float32Array(3);gp(a,e,t),xp(a,a,r),Ap(a,a),Sp(a,a,1);var s=256*Math.pow(10,6),c=a[0]*a[1]*a[2]*3;s<=c&&(xp(t,t,r*=Math.pow(s/c,1/3)),Cp(t,t),bp(t,t,r),xp(e,e,r),Ap(e,e),bp(e,e,r),gp(a,e,t),xp(a,a,r),Ap(a,a),Sp(a,a,1));var u=new Float32Array(t);Ep(u,u);var l=Nd(),h=Nd();Ud(h,Fs(90)),zd(l,l,h);var p=Nd();Fd(p,-1/r,1/r,1/r),zd(l,l,p);var d=Nd();return Bd(d,-r*u[2],-r*u[1],-r*u[0]),zd(l,l,d),{dim:a,tran:u,matrix:l,scaleFactor:r}}$d.prototype.getBasisMatrix=function(t){var e=t||new De;return e.makeBasis(this.normVecB,this.normVecA,this.normVecC),e.determinant()<0&&e.scale(Vd),e},$d.prototype.getRotationQuaternion=function(t){var e=t||new ke;return e.setFromRotationMatrix(this.getBasisMatrix(Hd)),e.inverse()},$d.prototype.getProjectedScaleForAtoms=function(t){var e=-1/0,n=-1/0,r=-1/0,i=-1/0,o=-1/0,a=-1/0,s=new Ne,c=new Ne,u=this.center,l=this.normVecA,h=this.normVecB,p=this.normVecC;return t.eachAtom(function(t){up(s.copy(t),l,u);var d=c.subVectors(s,u).normalize().dot(l),f=s.distanceTo(u);d>0?f>e&&(e=f):f>n&&(n=f),up(s.copy(t),h,u);var m=c.subVectors(s,u).normalize().dot(h),g=s.distanceTo(u);m>0?g>r&&(r=g):g>i&&(i=g),up(s.copy(t),p,u);var v=c.subVectors(s,u).normalize().dot(p),y=s.distanceTo(u);v>0?y>o&&(o=y):y>a&&(a=y)}),{d1a:e,d2a:r,d3a:o,d1b:-n,d2b:-i,d3b:-a}},qd.prototype.constructor=qd,Xd.prototype.constructor=Xd,Qd.__deps=[Yd,Kd,Zd,Es],Jd.__deps=[tf],tf.__deps=[gp,mp,vp,dp],nf.__deps=[Fs,wp,Sp,bp,xp,Cp,Ap,gp,Ep,Nd,zd,Bd,Fd,Ud];var rf=function(t,e,n){this.name=t||"",this.path=e||"",this.info={},this.center=new Ne,this.boundingBox=new Hn,n instanceof vr||n instanceof Cr||n instanceof yi?this.fromGeometry(n):n&&(this.set(n.position,n.index,n.normal,n.color,n.atomindex,n.contour),this.boundingBox.setFromArray(n.position),this.boundingBox.getCenter(this.center))},of={type:{}};function af(t,e,n,r,i){var o=new Qd(t,e,n,r,i);this.getSurface=function(t,e,n,r,i,a){var s=o.triangulate(t,e,n,i,a);if(e&&!i&&(Jd(s.position,s.index,e,!0),s.normal=tf(s.position,s.index)),r&&(hp(r,s.position),s.normal)){var c=jd();Gd(c,r),pp(c,s.normal)}return s}}of.type.get=function(){return"Surface"},rf.prototype.set=function(t,e,n,r,i,o){this.position=t,this.index=e,this.normal=n,this.color=r,this.atomindex=i,this.size=t.length/3,this.contour=o},rf.prototype.fromGeometry=function(t){var e,n,r,i;if(nl&&el.time("GeometrySurface.fromGeometry"),t instanceof vr?(t.computeVertexNormals(!0),e=(new Cr).fromGeometry(t)):e=t instanceof Cr?t:t[0],e.boundingBox||e.computeBoundingBox(),this.boundingBox.copy(e.boundingBox),this.boundingBox.getCenter(this.center),e instanceof Cr){var o=e.attributes,a=!!o.normal&&o.normal.array;(!a||0===a[0]&&0===a[1]&&0===a[2])&&e.computeVertexNormals(),n=o.position.array,r=o.index?o.index.array:null,i=o.normal.array}this.set(n,r,i,void 0,void 0),nl&&el.timeEnd("GeometrySurface.setGeometry")},rf.prototype.getPosition=function(){return this.position},rf.prototype.getColor=function(t){var e=t||{};e.surface=this;var n=this.size,r=new Float32Array(3*n),i=ol.getScheme(e);if(i.volumeColor||"random"===e.scheme)for(var o=0;o<n;++o)i.volumeColorToArray(o,r,3*o);else if(i.positionColor)for(var a=new Ne,s=this.position,c=0;c<n;++c){var u=3*c;a.set(s[u],s[u+1],s[u+2]),i.positionColorToArray(a,r,u)}else if(i.atomColor&&this.atomindex)for(var l=e.structure.getAtomProxy(),h=this.atomindex,p=0;p<n;++p)l.index=h[p],i.atomColorToArray(l,r,3*p);else{var d=new En(e.value);ql(n,d.r,d.g,d.b,r)}return r},rf.prototype.getPicking=function(t){return this.atomindex&&t?new Rp(this.atomindex,t):new Gp(Xl(this.size),this)},rf.prototype.getNormal=function(){return this.normal},rf.prototype.getSize=function(t,e){return Wl(this.size,t*e)},rf.prototype.getIndex=function(){return this.index},rf.prototype.getFilteredIndex=function(t,e){if(t&&this.atomindex){for(var n=new Hu(t),r=e.getAtomSet(n),i=[],o=this.atomindex,a=this.index,s=a.length,c=this.contour?2:3,u=0,l=0;l<s;l+=c){for(var h=!0,p=0;p<c;p++){var d=o[a[l+p]];if(!r.get(d)){h=!1;break}}if(h)for(var f=0;f<c;f++,u++)i[u]=a[l+f]}return Es(i,this.position.length/3)}return this.index},rf.prototype.getAtomindex=function(){return this.atomindex},rf.prototype.dispose=function(){},Object.defineProperties(rf.prototype,of),af.__deps=[Jd,tf,Qd,hp,pp,jd,Gd],il.add("surf",function(t,e){var n=t.data.args,r=t.data.params;if(n&&(self.volsurf=new af(n[0],n[1],n[2],n[3],n[4])),r){var i=self.volsurf.getSurface(r.isolevel,r.smooth,r.box,r.matrix,r.contour,r.wrap),o=[i.position.buffer,i.index.buffer];i.normal&&o.push(i.normal.buffer),i.atomindex&&o.push(i.atomindex.buffer),e({sd:i,p:r},o)}},[af]);var sf=function(t,e,n,r,i,o,a){this.name=t,this.path=e,this.matrix=new De,this.normalMatrix=new Wn,this.inverseMatrix=new De,this.center=new Ne,this.boundingBox=new Hn,this.setData(n,r,i,o,a)},cf={type:{},position:{},min:{},max:{},sum:{},mean:{},rms:{}};cf.type.get=function(){return"Volume"},sf.prototype.setData=function(t,e,n,r,i){this.nx=e||1,this.ny=n||1,this.nz=r||1,this.data=t||new Float32Array(1),this.setAtomindex(i),delete this._position,delete this._min,delete this._max,delete this._mean,delete this._rms,this.worker&&this.worker.terminate()},sf.prototype.setMatrix=function(t){this.matrix.copy(t);var e=this.boundingBox,n=this.center,r=this.nx-1,i=this.ny-1,o=this.nz-1;e.makeEmpty(),e.expandByPoint(n.set(r,i,o)),e.expandByPoint(n.set(r,i,0)),e.expandByPoint(n.set(r,0,o)),e.expandByPoint(n.set(r,0,0)),e.expandByPoint(n.set(0,i,o)),e.expandByPoint(n.set(0,0,o)),e.expandByPoint(n.set(0,i,0)),e.expandByPoint(n.set(0,0,0)),e.applyMatrix4(this.matrix),e.getCenter(this.center);var a=this.matrix.elements,s=new Ne(a[0],a[1],a[2]),c=new Ne(a[4],a[5],a[6]),u=new Ne(a[8],a[9],a[10]),l=new Ne,h=this.normalMatrix.elements;l.crossVectors(c,u),h[0]=l.x,h[1]=l.y,h[2]=l.z,l.crossVectors(u,s),h[3]=l.x,h[4]=l.y,h[5]=l.z,l.crossVectors(s,c),h[6]=l.x,h[7]=l.y,h[8]=l.z,this.inverseMatrix.getInverse(this.matrix)},sf.prototype.setAtomindex=function(t){this.atomindex=t},sf.prototype.getBox=function(t,e,n){return n||(n=new Hn),n.set(t,t),n.expandByScalar(e),n.applyMatrix4(this.inverseMatrix),n.min.round(),n.max.round(),n},sf.prototype._getBox=function(t,e){if(t&&e){this.__box||(this.__box=new Hn);var n=this.getBox(t,e,this.__box);return[n.min.toArray(),n.max.toArray()]}},sf.prototype._makeSurface=function(t,e,n){var r=this.name+"@"+e.toPrecision(2),i=new rf(r,"",t);return i.info.isolevel=e,i.info.smooth=n,i.info.volume=this,i},sf.prototype.getSurface=function(t,e,n,r,i,o){t=isNaN(t)?this.getValueForSigma(2):t,e=gs(e,0),void 0===this.volsurf&&(this.volsurf=new af(this.data,this.nx,this.ny,this.nz,this.atomindex));var a=this._getBox(n,r),s=this.volsurf.getSurface(t,e,a,this.matrix.elements,i,o);return this._makeSurface(s,t,e)},sf.prototype.getSurfaceWorker=function(t,e,n,r,i,o,a){var s=this;if(t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,window.Worker){void 0===this.workerPool&&(this.workerPool=new Xd("surf",2));var c={},u=this.workerPool.getNextWorker();0===u.postCount&&(c.args=[this.data,this.nx,this.ny,this.nz,this.atomindex]),c.params={isolevel:t,smooth:e,box:this._getBox(n,r),matrix:this.matrix.elements,contour:i,wrap:o},u.post(c,void 0,function(t){var e=t.data.sd,n=t.data.p;a(s._makeSurface(e,n.isolevel,n.smooth))},function(c){console.warn("Volume.getSurfaceWorker error - trying without worker",c);var u=s.getSurface(t,e,n,r,i,o);a(u)})}else{var l=this.getSurface(t,e,n,r,i,o);a(l)}},sf.prototype.getValueForSigma=function(t){return this.mean+gs(t,2)*this.rms},sf.prototype.getSigmaForValue=function(t){return(gs(t,0)-this.mean)/this.rms},cf.position.get=function(){if(!this._position){for(var t=this.nz,e=this.ny,n=this.nx,r=new Float32Array(n*e*t*3),i=0,o=0;o<t;++o)for(var a=0;a<e;++a)for(var s=0;s<n;++s)r[i+0]=s,r[i+1]=a,r[i+2]=o,i+=3;hp(this.matrix.elements,r),this._position=r}return this._position},sf.prototype.getDataAtomindex=function(){return this.atomindex},sf.prototype.getDataPosition=function(){return this.position},sf.prototype.getDataColor=function(t){var e=t||{};e.volume=this,e.scale=e.scale||"Spectral",e.domain=e.domain||[this.min,this.max];for(var n=ol.getScheme(e),r=this.position.length/3,i=new Float32Array(3*r),o=0;o<r;++o)n.volumeColorToArray(o,i,3*o);return i},sf.prototype.getDataPicking=function(){var t=Xl(this.position.length/3);return new Hp(t,this)},sf.prototype.getDataSize=function(t,e){var n,r=this.data,i=this.position.length/3;switch(t){case"value":n=new Float32Array(r);break;case"abs-value":n=new Float32Array(r);for(var o=0;o<i;++o)n[o]=Math.abs(n[o]);break;case"value-min":n=new Float32Array(r);for(var a=this.min,s=0;s<i;++s)n[s]-=a;break;case"deviation":n=new Float32Array(r);break;default:n=Wl(i,t)}if(1!==e)for(var c=0;c<i;++c)n[c]*=e;return n},cf.min.get=function(){return void 0===this._min&&(this._min=function(t){for(var e=1/0,n=0,r=t.length;n<r;++n)t[n]<e&&(e=t[n]);return e}(this.data)),this._min},cf.max.get=function(){return void 0===this._max&&(this._max=function(t){for(var e=-1/0,n=0,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}(this.data)),this._max},cf.sum.get=function(){return void 0===this._sum&&(this._sum=Ql(this.data)),this._sum},cf.mean.get=function(){var t;return void 0===this._mean&&(this._mean=Ql(t=this.data)/t.length),this._mean},cf.rms.get=function(){return void 0===this._rms&&(this._rms=function(t){for(var e=t.length,n=0,r=0;r<e;++r){var i=t[r];n+=i*i}return Math.sqrt(n/e)}(this.data)),this._rms},sf.prototype.clone=function(){var t=new sf(this.name,this.path,this.data,this.nx,this.ny,this.nz,this.atomindex);return t.matrix.copy(this.matrix),t.header=Object.assign({},this.header),t},sf.prototype.dispose=function(){this.workerPool&&this.workerPool.terminate()},Object.defineProperties(sf.prototype,cf);var uf=function(t,e,n,r){this.volume=t,this.setFilter(e,n,r)},lf={header:{},matrix:{},normalMatrix:{},inverseMatrix:{},center:{},boundingBox:{},min:{},max:{},mean:{},rms:{}};lf.header.get=function(){return this.volume.header},lf.matrix.get=function(){return this.volume.matrix},lf.normalMatrix.get=function(){return this.volume.normalMatrix},lf.inverseMatrix.get=function(){return this.volume.inverseMatrix},lf.center.get=function(){return this.volume.center},lf.boundingBox.get=function(){return this.volume.boundingBox},lf.min.get=function(){return this.volume.min},lf.max.get=function(){return this.volume.max},lf.mean.get=function(){return this.volume.mean},lf.rms.get=function(){return this.volume.rms},uf.prototype._getFilterHash=function(t,e,n){return JSON.stringify([t,e,n])},uf.prototype.setFilter=function(t,e,n){isNaN(t)&&this.header&&(t=this.header.DMEAN+2*this.header.ARMS),t=void 0===t||isNaN(t)?-1/0:t,e=gs(e,1/0),n=gs(n,!1);var r=this.volume.data,i=this.volume.position,o=this.volume.atomindex,a=this._getFilterHash(t,e,n);if(a!==this._filterHash){if(t===-1/0&&e===1/0)this.data=r,this.position=i,this.atomindex=o;else{var s=r.length;this._dataBuffer||(this._dataBuffer=new ArrayBuffer(4*s),this._positionBuffer=new ArrayBuffer(3*s*4),o&&(this._atomindexBuffer=new ArrayBuffer(4*s)));var c,u=new Float32Array(this._dataBuffer),l=new Float32Array(this._positionBuffer);o&&(c=new Uint32Array(this._atomindexBuffer));for(var h=0,p=0;p<s;++p){var d=3*p,f=r[p];if(!n&&f>=t&&f<=e||n&&(f<t||f>e)){var m=3*h;u[h]=f,l[m+0]=i[d+0],l[m+1]=i[d+1],l[m+2]=i[d+2],o&&(c[h]=o[p]),h+=1}}this.data=new Float32Array(this._dataBuffer,0,h),this.position=new Float32Array(this._positionBuffer,0,3*h),o&&(this.atomindex=new Float32Array(this._atomindexBuffer,0,h))}this._filterHash=a}},Object.defineProperties(uf.prototype,lf),uf.prototype.getValueForSigma=sf.prototype.getValueForSigma,uf.prototype.getSigmaForValue=sf.prototype.getSigmaForValue,uf.prototype.getDataAtomindex=sf.prototype.getDataAtomindex,uf.prototype.getDataPosition=sf.prototype.getDataPosition,uf.prototype.getDataColor=sf.prototype.getDataColor,uf.prototype.getDataPicking=sf.prototype.getDataPicking,uf.prototype.getDataSize=sf.prototype.getDataSize;var hf=function(t){Number.isInteger(t)?this._init(t):this._init(0)};hf.prototype._init=function(t){this.length=t,this.count=0;for(var e=0,n=this.__fields.length;e<n;++e){var r=this.__fields[e][0],i=this.__fields[e][1],o=this.__fields[e][2],a=this.length*i;this[r]=As(o,a)}},hf.prototype.resize=function(t){this.length=Math.round(t||0),this.count=Math.min(this.count,this.length);for(var e=0,n=this.__fields.length;e<n;++e){var r=this.__fields[e][0],i=this.__fields[e][1],o=this.length*i,a=new this[r].constructor(o);this[r].length>o?a.set(this[r].subarray(0,o)):a.set(this[r]),this[r]=a}},hf.prototype.growIfFull=function(){if(this.count>=this.length){var t=Math.round(1.5*this.length);this.resize(Math.max(256,t))}},hf.prototype.copyFrom=function(t,e,n,r){for(var i=0,o=this.__fields.length;i<o;++i)for(var a=this.__fields[i][0],s=this.__fields[i][1],c=this[a],u=t[a],l=0;l<r;++l)for(var h=s*(e+l),p=s*(n+l),d=0;d<s;++d)c[h+d]=u[p+d]},hf.prototype.copyWithin=function(t,e,n){for(var r=0,i=this.__fields.length;r<i;++r)for(var o=this.__fields[r][0],a=this.__fields[r][1],s=this[o],c=0;c<n;++c)for(var u=a*(t+c),l=a*(e+c),h=0;h<a;++h)s[u+h]=s[l+h]},hf.prototype.sort=function(t){el.time("Store.sort");var e=this,n=new this.constructor(1);!function r(i,o){if(i<o){var a=Math.floor((i+o)/2),s=i,c=o;do{for(;t(s,a)<0;)s+=1;for(;t(c,a)>0;)c-=1;s<=c&&(s===a?a=c:c===a&&(a=s),(u=s)!==(l=c)&&(n.copyFrom(e,0,u,1),e.copyWithin(u,l,1),e.copyFrom(n,l,0,1)),s+=1,c-=1)}while(s<=c);r(i,c),r(s,o)}var u,l}(0,this.count-1),el.timeEnd("Store.sort")},hf.prototype.clear=function(){this.count=0},hf.prototype.dispose=function(){delete this.length,delete this.count;for(var t=0,e=this.__fields.length;t<e;++t){delete this[this.__fields[t][0]]}};var pf,df=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={__fields:{}};return n.__fields.get=function(){return[["atomIndex1",1,"int32"],["atomIndex2",1,"int32"],["bondOrder",1,"int8"]]},e.prototype.addBond=function(t,e,n){this.growIfFull();var r=this.count,i=t.index,o=e.index;i<o?(this.atomIndex1[r]=i,this.atomIndex2[r]=o):(this.atomIndex2[r]=i,this.atomIndex1[r]=o),n&&(this.bondOrder[r]=n),this.count+=1},e.prototype.addBondIfConnected=function(t,e,n){return!!t.connectedTo(e)&&(this.addBond(t,e,n),!0)},Object.defineProperties(e.prototype,n),e}(hf),ff=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={__fields:{}};return n.__fields.get=function(){return[["residueIndex",1,"uint32"],["atomTypeId",1,"uint16"],["x",1,"float32"],["y",1,"float32"],["z",1,"float32"],["serial",1,"int32"],["bfactor",1,"float32"],["altloc",1,"uint8"],["occupancy",1,"float32"]]},e.prototype.setAltloc=function(t,e){this.altloc[t]=e.charCodeAt(0)},e.prototype.getAltloc=function(t){var e=this.altloc[t];return e?String.fromCharCode(e):""},Object.defineProperties(e.prototype,n),e}(hf),mf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={__fields:{}};return n.__fields.get=function(){return[["chainIndex",1,"uint32"],["atomOffset",1,"uint32"],["atomCount",1,"uint16"],["residueTypeId",1,"uint16"],["resno",1,"int32"],["sstruc",1,"uint8"],["inscode",1,"uint8"]]},e.prototype.setSstruc=function(t,e){this.sstruc[t]=e.charCodeAt(0)},e.prototype.getSstruc=function(t){var e=this.sstruc[t];return e?String.fromCharCode(e):""},e.prototype.setInscode=function(t,e){this.inscode[t]=e.charCodeAt(0)},e.prototype.getInscode=function(t){var e=this.inscode[t];return e?String.fromCharCode(e):""},Object.defineProperties(e.prototype,n),e}(hf),gf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={__fields:{}};return n.__fields.get=function(){return[["entityIndex",1,"uint16"],["modelIndex",1,"uint16"],["residueOffset",1,"uint32"],["residueCount",1,"uint32"],["chainname",4,"uint8"],["chainid",4,"uint8"]]},e.prototype.setChainname=function(t,e){var n=4*t;this.chainname[n]=e.charCodeAt(0),this.chainname[n+1]=e.charCodeAt(1),this.chainname[n+2]=e.charCodeAt(2),this.chainname[n+3]=e.charCodeAt(3)},e.prototype.getChainname=function(t){for(var e="",n=0;n<4;++n){var r=this.chainname[4*t+n];if(!r)break;e+=String.fromCharCode(r)}return e},e.prototype.setChainid=function(t,e){var n=4*t;this.chainid[n]=e.charCodeAt(0),this.chainid[n+1]=e.charCodeAt(1),this.chainid[n+2]=e.charCodeAt(2),this.chainid[n+3]=e.charCodeAt(3)},e.prototype.getChainid=function(t){for(var e="",n=0;n<4;++n){var r=this.chainid[4*t+n];if(!r)break;e+=String.fromCharCode(r)}return e},Object.defineProperties(e.prototype,n),e}(hf),vf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={__fields:{}};return n.__fields.get=function(){return[["chainOffset",1,"uint32"],["chainCount",1,"uint32"]]},Object.defineProperties(e.prototype,n),e}(hf);function yf(t){this.polymer=t,this.size=t.residueCount}function bf(t){this.polymer=t,this.helixorient=new yf(t),this.position=this.helixorient.getPosition()}function xf(t){this.content=[],this.scoreFunction=t}
/**
 * Kdtree
 * @class
 * @author Alexander Rose <alexander.rose@weirdbyte.de>, 2016
 * @author Roman Bolzern <roman.bolzern@fhnw.ch>, 2013
 * @author I4DS http://www.fhnw.ch/i4ds, 2013
 * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
 * @description
 * k-d Tree for typed arrays of 3d points (e.g. for Float32Array), in-place
 * provides fast nearest neighbour search
 *
 * Based on https://github.com/ubilabs/kd-tree-javascript by Ubilabs
 *
 * Further information (including mathematical properties)
 * http://en.wikipedia.org/wiki/Binary_tree
 * http://en.wikipedia.org/wiki/K-d_tree
 *
 * @example
 * points: [x, y, z, x, y, z, x, y, z, ...]
 * metric: function(a, b){
 *    return Math.pow(a[0]-b[0], 2) + Math.pow(a[1]-b[1], 2) + Math.pow(a[2]-b[2], 2);
 * }
 *
 * @param {Float32Array} points - points
 * @param {Function} metric - metric
 */
function _f(t,e){for(var n=t.length/3,r=0,i=new Uint32Array(n),o=0;o<n;++o)i[o]=o;var a=new Int32Array(4*n),s=0,c=0;var u=function e(n,o,u,l){n>r&&(r=n);var h=l-u;if(0===h)return-1;var p=4*s;if(s+=1,1===h)return a[p]=u,a[p+1]=-1,a[p+2]=-1,a[p+3]=o,p;var d,f,m,g,v,y=u+Math.floor(h/2);c=n%3;for(var b=u,x=l-1;x>b;){for(g=t[3*i[m=b+x>>1]+c],f=i[m],i[m]=i[x],i[x]=f,v=b,d=b;d<x;++d)t[3*i[d]+c]<g&&(f=i[v],i[v]=i[d],i[d]=f,++v);if(f=i[x],i[x]=i[v],i[v]=f,y===(m=v))break;y<m?x=m-1:b=m+1}return a[p]=y,a[p+1]=e(n+1,p,u,y),a[p+2]=e(n+1,p,y+1,l),a[p+3]=o,p}(0,-1,0,n);this.rootIndex=u,this.maxDepth=r,this.nearest=function(n,r,o){var s=new xf(function(t){return-t[1]});!function c(u){var l,h,p=function t(e){var n=a[e+3];return-1===n?0:t(n)+1}(u)%3,d=3*i[a[u]],f=[t[d+0],t[d+1],t[d+2]],m=e(n,f);function g(t,e){s.push([t,e]),s.size()>r&&s.pop()}var v=a[u+1],y=a[u+2];if(-1!==y||-1!==v){c(l=-1===y?v:-1===v?y:n[p]<=t[d+p]?v:y),(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m);for(var b=[],x=0;x<3;x+=1)b[x]=x===p?n[x]:t[d+x];var _=e(b,f);(s.size()<r||Math.abs(_)<s.peek()[1])&&Math.abs(_)<=o&&-1!==(h=l===v?y:v)&&c(h)}else(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m)}(u);for(var c=[],l=0,h=Math.min(s.size(),r);l<h;l+=1)c.push(s.content[l]);return c},this.indices=i,this.nodes=a,this.verify=function e(n,r){var o=1;if(void 0===n&&(n=u,r=0),-1===n)throw new Error("node is null");var s=r%3,c=a[n+1],l=a[n+2];if(-1!==c){if(t[3*i[a[c]]+s]>t[3*i[a[n]]+s])throw new Error("left child is > parent!");o+=e(c,r+1)}if(-1!==l){if(t[3*i[a[l]]+s]<t[3*i[a[n]]+s])throw new Error("right child is < parent!");o+=e(l,r+1)}return o}}function wf(t,e){var n;nl&&el.time("Kdtree build"),n=e?function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return n*n+r*r+i*i}:function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(n*n+r*r+i*i)};var r=new Float32Array(3*t.atomCount),i=new Uint32Array(t.atomCount),o=0;t.eachAtom(function(t){r[o+0]=t.x,r[o+1]=t.y,r[o+2]=t.z,i[o/3]=t.index,o+=3}),this.atomIndices=i,this.points=r,this.kdtree=new _f(r,n),nl&&el.timeEnd("Kdtree build")}yf.prototype={constructor:yf,getCenterIterator:function(t){var e=this.getPosition().center,n=e.length/3,r=0,i=-1,o=[new Ne,new Ne,new Ne,new Ne];return{size:n,next:function(){var t=this.get(i);return i+=1,t},get:function(i){i=Math.min(n-1,Math.max(0,i));var a=o[r%4],s=3*i;if(a.fromArray(e,s),t){var c,u,l,h=Math.min(t,i,n-i-1);for(u=1;u<=h;++u)c=3*u,l=(h+1-u)/(h+1),a.x+=l*e[s-c+0]+l*e[s+c+0],a.y+=l*e[s-c+1]+l*e[s+c+1],a.z+=l*e[s-c+2]+l*e[s+c+2];a.x/=h+1,a.y/=h+1,a.z/=h+1}return r+=1,a},reset:function(){r=0,i=-1}}},getColor:function(t){var e=this.polymer,n=e.structure,r=e.residueCount,i=e.residueIndexStart,o=new Float32Array(3*r),a=t||{};a.structure=n;for(var s=ol.getScheme(a),c=n.getResidueProxy(),u=n.getAtomProxy(),l=0;l<r;++l)c.index=i+l,u.index=c.traceAtomIndex,s.atomColorToArray(u,o,3*l);return{color:o}},getPicking:function(){for(var t=this.polymer,e=t.structure,n=t.residueCount,r=t.residueIndexStart,i=new Float32Array(n),o=e.getResidueProxy(),a=0;a<n;++a)o.index=r+a,i[a]=o.traceAtomIndex;return{picking:new Rp(i,e)}},getSize:function(t,e){for(var n=this.polymer,r=n.structure,i=n.residueCount,o=n.residueIndexStart,a=new Float32Array(i),s=new Sd(t,e),c=r.getResidueProxy(),u=r.getAtomProxy(),l=0;l<i;++l)c.index=o+l,u.index=c.traceAtomIndex,a[l]=s.atomRadius(u);return{size:a}},getPosition:function(){var t,e,n,r,i,o=this.polymer,a=o.structure,s=o.residueCount,c=s-3,u=new Float32Array(3*s),l=new Float32Array(3*s),h=new Float32Array(s),p=new Float32Array(s),d=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(3*s),g=new Ne,v=new Ne,y=new Ne,b=new Ne,x=new Ne,_=new Ne,w=new Ne,S=new Ne,C=new Ne,A=new Ne,E=new Ne,M=new Ne(0,0,0),T="trace",P=a.getAtomProxy(),I=a.getAtomProxy(o.getAtomIndexByType(0,T)),R=a.getAtomProxy(o.getAtomIndexByType(1,T)),O=a.getAtomProxy(o.getAtomIndexByType(2,T));for(n=0;n<c;++n)P.index=I.index,I.index=R.index,R.index=O.index,O.index=o.getAtomIndexByType(n+3,T),e=3*n,g.subVectors(I,P),v.subVectors(R,I),y.subVectors(O,R),b.subVectors(g,v),x.subVectors(v,y),C.crossVectors(b,x).normalize(),C.toArray(l,e),n>0&&(h[n]=C.angleTo(A)),t=Math.cos(b.angleTo(x)),f[n]=180/Math.PI*Math.acos(t),r=b.length(),i=x.length(),p[n]=Math.sqrt(i*r)/Math.max(2,2*(1-t)),d[n]=Math.abs(v.dot(C)),_.copy(b).multiplyScalar(p[n]/r),w.copy(x).multiplyScalar(p[n]/i),_.subVectors(I,_),w.subVectors(R,w),_.toArray(u,e+3),w.toArray(u,e+6),E.subVectors(P,M),E.toArray(m,e),A.copy(C),M.copy(_);for(_.fromArray(u,3),w.fromArray(u,6),C.subVectors(_,w).normalize(),P.index=o.getAtomIndexByType(0,T),M.copy(P),S.copy(P),up(S,C,_),S.toArray(u,0),E.subVectors(M,_),E.toArray(m,0),_.fromArray(u,3*s-6),w.fromArray(u,3*s-9),C.subVectors(_,w).normalize(),P.index=o.getAtomIndexByType(s-1,T),M.copy(P),S.copy(P),up(S,C,_),S.toArray(u,3*s-3),n=s-3;n<s;++n)_.fromArray(u,3*n),P.index=o.getAtomIndexByType(n,T),M.copy(P),E.subVectors(M,_),E.toArray(m,3*n);var L=new Float32Array(s),k=new Float32Array(s),N=new Float32Array(s),D=new Float32Array(s);for(L[1]=p[0],k[1]=f[0],N[1]=p[0],n=2;n<s-2;++n)L[n]=.5*(p[n-2]+p[n-1]),k[n]=.5*(f[n-2]+f[n-1]),N[n]=.5*(d[n-2]+d[n-1]),_.fromArray(l,3*(n-2)),w.fromArray(l,3*(n-1)),D[n]=180/Math.PI*Math.acos(Math.cos(_.angleTo(w)));L[s-2]=p[s-4],k[s-2]=f[s-4],N[s-2]=d[s-4];var z=new Float32Array(3*s);for(Kl(l,z,0,0,3),Kl(l,z,0,3,3),n=2;n<s-2;++n)_.fromArray(l,3*(n-2)),w.fromArray(l,3*(n-1)),C.addVectors(w,_).multiplyScalar(.5).normalize(),C.toArray(z,3*n);return Kl(l,z,3*s-12,3*s-6,3),Kl(l,z,3*s-12,3*s-3,3),{center:u,axis:z,bending:D,radius:L,rise:N,twist:k,resdir:m}}},bf.prototype={constructor:bf,getAxis:function(t,e,n,r,i,o){t=t||30,e=e||2.5,n=void 0!==n&&n;var a=this.polymer,s=a.structure,c=a.residueCount,u=a.residueIndexStart,l=this.position,h=r||{};h.structure=s;for(var p,d,f=ol.getScheme(h),m=new Sd(i,o),g=0,v=0,y=[],b=[],x=[],_=[],w=[],S=[],C=[],A=[],E=[],M=[],T=[],P=new Ne,I=new Ne,R=s.getResidueProxy(),O=s.getResidueProxy(),L=s.getAtomProxy(),k=new Ne,N=new Ne,D=!1,z=0;z<c;++z)if(R.index=u+z,k.fromArray(l.center,3*z),z===c-1?D=!0:(O.index=u+z+1,N.fromArray(l.center,3*z+3),n&&R.sstruc!==O.sstruc?D=!0:k.distanceTo(N)>e?D=!0:l.bending[z]>t&&(D=!0)),D){if(z-g<4){g=z,D=!1;continue}L.index=R.traceAtomIndex,M=l.axis.subarray(3*g+3,3*z),T=l.center.subarray(3*g,3*z+3),p=cp(M).normalize(),d=cp(T),P.fromArray(T),up(P,p,d),I.fromArray(T,T.length-3),up(I,p,d),p.subVectors(I,P),p.toArray(y,v),d.toArray(b,v),P.toArray(x,v),I.toArray(_,v),f.atomColorToArray(L,w,v),S.push(L.index),C.push(m.atomRadius(L)),A.push(u+g),E.push(u+z+1-g),v+=3,g=z,D=!1}var F=new Float32Array(S);return{axis:new Float32Array(y),center:new Float32Array(b),begin:new Float32Array(x),end:new Float32Array(_),color:new Float32Array(w),picking:new Rp(F,s),size:new Float32Array(C),residueOffset:A,residueCount:E}}},xf.prototype={push:function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t},peek:function(){return this.content[0]},remove:function(t){for(var e=this.content.length,n=0;n<e;n++)if(this.content[n]===t){var r=this.content.pop();return void(n!==e-1&&(this.content[n]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.bubbleUp(n):this.sinkDown(n)))}throw new Error("Node not found.")},size:function(){return this.content.length},bubbleUp:function(t){for(var e=this.content[t];t>0;){var n=Math.floor((t+1)/2)-1,r=this.content[n];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[n]=e,this.content[t]=r,t=n}},sinkDown:function(t){for(var e,n=this.content.length,r=this.content[t],i=this.scoreFunction(r);;){var o=2*(t+1),a=o-1,s=null;if(a<n){var c=this.content[a];(e=this.scoreFunction(c))<i&&(s=a)}if(o<n){var u=this.content[o];this.scoreFunction(u)<(null===s?i:e)&&(s=o)}if(null===s)break;this.content[t]=this.content[s],this.content[s]=r,t=s}}},wf.prototype={nearest:(pf=new Float32Array(3),function(t,e,n){t.toArray?t.toArray(pf):t.positionToArray&&t.positionToArray(pf);for(var r=this.kdtree.nearest(pf,e,n),i=this.kdtree.indices,o=this.kdtree.nodes,a=this.atomIndices,s=[],c=0,u=r.length;c<u;++c){var l=r[c],h=l[0],p=l[1];s.push({index:a[i[o[h]]],distance:p})}return s})};var Sf={" ":"X","!":"Y","#":"Z",$:"-X","%":"-Y","&":"-Z","'":"Y+1/2","(":"1/2+X",")":"1/2+Y","*":"1/2-X","+":"1/2+Z",",":"1/2-Y","-":"1/2-Z",".":"X+1/2","/":"Z+1/2",0:"-X+1/2",1:"-Y+1/2",2:"-Z+1/2",3:"1/4+X",4:"1/4-Y",5:"1/4+Z",6:"1/4-X",7:"1/4+Y",8:"3/4-Y",9:"3/4+Z",":":"3/4+Y",";":"3/4+X","<":"3/4-X","=":"1/4-Z",">":"3/4-Z","?":"X-Y","@":"Y-X",A:"Z+1/3",B:"Z+2/3",C:"X+2/3",D:"Y+1/3",E:"-Y+2/3",F:"X-Y+1/3",G:"Y-X+2/3",H:"-X+1/3",I:"X+1/3",J:"Y+2/3",K:"-Y+1/3",L:"X-Y+2/3",M:"Y-X+1/3",N:"-X+2/3",O:"2/3+X",P:"1/3+Y",Q:"1/3+Z",R:"2/3-Y",S:"1/3+X-Y",T:"2/3+Y-X",U:"1/3-X",V:"2/3-X",W:"1/3-Y",X:"1/3-Z",Y:"2/3+Y",Z:"1/3+Y-X","[":"2/3+X-Y","]":"1/3+X","^":"2/3+Z",_:"2/3-Z","`":"5/6+Z",a:"1/6+Z",b:"5/6-Z",c:"1/6-Z",d:"Z+5/6",e:"Z+1/6",f:"Z+1/4",g:"+Y"},Cf={"P 1":" !#","P -1":" !#$%&","P 1 2 1":" !#$!&","P 1 21 1":" !#$'&","C 1 2 1":" !#$!&()#*)&","P 1 m 1":" !# %#","P 1 c 1":" !# %+","C 1 m 1":" !# %#()#(,#","C 1 c 1":" !# %+()#(,+","P 1 2/m 1":" !# %#$!&$%&","P 1 21/m 1":" !#$)&$%& ,#","C 1 2/m 1":" !# %#$!&$%&()#(,#*)&*,&","P 1 2/c 1":" !#$!-$%& %+","P 1 21/c 1":" !#$%&$)- ,+","C 1 2/c 1":" !#$!-$%& %+()#*)-*,&(,+","P 2 2 2":" !#$%#$!& %&","P 2 2 21":" !#$%+$!- %&","P 21 21 2":" !#$%#*)&(,&","P 21 21 21":" !#*%+$)-(,&","C 2 2 21":" !#$%+$!- %&()#*,+*)-(,&","C 2 2 2":" !#$%#$!& %&()#*,#*)&(,&","F 2 2 2":" !#$%#$!& %& )+$,+$)- ,-(!+*%+*!-(%-()#*,#*)&(,&","I 2 2 2":" !#$%# %&$!&.'/01/.120'2","I 21 21 21":" !#*%+$)-(,&()+$,#*!& %-","P m m 2":" !#$%# %#$!#","P m c 21":" !#$%+ %+$!#","P c c 2":" !#$%# %+$!+","P m a 2":" !#$%#(%#*!#","P c a 21":" !#$%+(%#*!+","P n c 2":" !#$%# ,+$)+","P m n 21":" !#*%+(%+$!#","P b a 2":" !#$%#(,#*)#","P n a 21":" !#$%+(,#*)+","P n n 2":" !#$%#(,+*)+","C m m 2":" !#$%# %#$!#()#*,#(,#*)#","C m c 21":" !#$%+ %+$!#()#*,+(,+*)#","C c c 2":" !#$%# %+$!+()#*,#(,+*)+","A m m 2":" !#$%# %#$!# )+$,+ ,+$)+","A b m 2":" !#$%# ,#$)# )+$,+ %+$!+","A m a 2":" !#$%#(%#*!# )+$,+(,+*)+","A b a 2":" !#$%#(,#*)# )+$,+(%+*!+","F m m 2":" !#$%# %#$!# )+$,+ ,+$)+(!+*%+(%+*!+()#*,#(,#*)#","F d d 2":" !#$%#345675 )+$,+3896:9(!+*%+;49<79()#*,#;85<:5","I m m 2":" !#$%# %#$!#()+*,+(,+*)+","I b a 2":" !#$%#(,#*)#()+*,+ %+$!+","I m a 2":" !#$%#(%#*!#()+*,+ ,+$)+","P 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#","P 2/n 2/n 2/n":" !#$%#$!& %&*,-()-(,+*)+","P 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+","P 2/b 2/a 2/n":" !#$%#$!& %&*,&()&(,#*)#","P 21/m 2/m 2/a":" !#*%#$!&(%&$%&(!& %#*!#","P 2/n 21/n 2/a":" !#*%#*)- ,-$%&(!&(,+$)+","P 2/m 2/n 21/a":" !#*%+*!- %&$%&(!-(%+$!#","P 21/c 2/c 2/a":" !#*%#$!-(%-$%&(!& %+*!+","P 21/b 21/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#","P 21/c 21/c 2/n":" !#*,#$)-(%-$%&()& ,+*!+","P 2/b 21/c 21/m":" !#$%+$)- ,&$%& !- ,+$)#","P 21/n 21/n 2/m":" !#$%#*)-(,-$%& !&(,+*)+","P 21/m 21/m 2/n":" !#$%#*'&.,&*,&.'& %#$!#","P 21/b 2/c 21/n":" !#*,+$!-(,&$%&()- %+*)#","P 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#","P 21/n 21/m 21/a":" !#0%/$'&.12$%&.!2 1#0'/","C 2/m 2/c 21/m":" !#$%+$!- %&$%& !- %+$!#()#*,+*)-(,&*,&()-(,+*)#","C 2/m 2/c 21/a":" !#$,+$)- %&$%& )- ,+$!#()#*%+*!-(,&*,&(!-(%+*)#","C 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()#*,#*)&(,&*,&()&(,#*)#","C 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+()#*,#*)-(,-*,&()&(,+*)+","C 2/m 2/m 2/a":" !#$,#$)& %&$%& )& ,#$!#()#*%#*!&(,&*,&(!&(%#*)#","C 2/c 2/c 2/a":" !#*,#$!&(,&$,-(!- ,+*!+()#$%#*)& %&*%- )-(%+$)+","F 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!# )+$,+$)- ,-$,- )- ,+$)+(!+*%+*!-(%-*%-(!-(%+*!+()#*,#*)&(,&*,&()&(,#*)#","F 2/d 2/d 2/d":" !#$%#$!& %&64=37=345675 )+$,+$)- ,-68>3:>3896:9(!+*%+*!-(%-<4>;7>;49<79()#*,#*)&(,&<8=;:=;85<:5","I 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()+*,+*)-(,-*,-()-(,+*)+","I 2/b 2/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#()+*,+$!- %-*,-()- %+$!+","I 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#()+$,#*!& %-*,- )&(%#$!+","I 21/m 21/m 21/a":" !#$,#$)& %&$%& )& ,#$!#()+*%+*!-(,-*,-(!-(%+*)+","P 4":" !#$%#% #!$#","P 41":" !#$%+% 5!$9","P 42":" !#$%#% +!$+","P 43":" !#$%+% 9!$5","I 4":" !#$%#% #!$#()+*,+,(+)*+","I 41":" !#*,+%(5)$9()+$%#, 9!*5","P -4":" !#$%#!$&% &","I -4":" !#$%#!$&% &()+*,+)*-,(-","P 4/m":" !#$%#% #!$#$%& !&!$&% &","P 42/m":" !#$%#% +!$+$%& !&!$-% -","P 4/n":" !#$%#,(#)*#*,&()&!$&% &","P 42/n":" !#$%#,(+)*+*,-()-!$&% &","I 4/m":" !#$%#% #!$#$%& !&!$&% &()+*,+,(+)*+*,-()-)*-,(-","I 41/a":" !#*,+%(5)$9$,=(!>!$&,(-()+$%#, 9!*5*%> )=)*-% &","P 4 2 2":" !#$%#% #!$#$!& %&! &%$&","P 4 21 2":" !#$%#,(#)*#*)&(,&! &%$&","P 41 2 2":" !#$%+% 5!$9$!& %-! >%$=","P 41 21 2":" !#$%+,(5)*9*)=(,>! &%$-","P 42 2 2":" !#$%#% +!$+$!& %&! -%$-","P 42 21 2":" !#$%#,(+)*+*)-(,-! &%$&","P 43 2 2":" !#$%+% 9!$5$!& %-! =%$>","P 43 21 2":" !#$%+,(9)*5*)>(,=! &%$-","I 4 2 2":" !#$%#% #!$#$!& %&! &%$&()+*,+,(+)*+*)-(,-)(-,*-","I 41 2 2":" !#*,+%(5)$9*!> ,=)(-%$&()+$%#, 9!*5$)=(%>! &,*-","P 4 m m":" !#$%#% #!$# %#$!#%$#! #","P 4 b m":" !#$%#% #!$#(,#*)#,*#)(#","P 42 c m":" !#$%#% +!$+ %+$!+%$#! #","P 42 n m":" !#$%#,(+)*+(,+*)+%$#! #","P 4 c c":" !#$%#% #!$# %+$!+%$+! +","P 4 n c":" !#$%#% #!$#(,+*)+,*+)(+","P 42 m c":" !#$%#% +!$+ %#$!#%$+! +","P 42 b c":" !#$%#% +!$+(,#*)#,*+)(+","I 4 m m":" !#$%#% #!$# %#$!#%$#! #()+*,+,(+)*+(,+*)+,*+)(+","I 4 c m":" !#$%#% #!$# %+$!+%$+! +()+*,+,(+)*+(,#*)#,*#)(#","I 41 m d":" !#*,+%(5)$9 %#*)+%*5) 9()+$%#, 9!*5(,+$!#,$9!(5","I 41 c d":" !#*,+%(5)$9 %+*)#%*9) 5()+$%#, 9!*5(,#$!+,$5!(9","P -4 2 m":" !#$%#% &!$&$!& %&%$#! #","P -4 2 c":" !#$%#% &!$&$!- %-%$+! +","P -4 21 m":" !#$%#% &!$&*)&(,&,*#)(#","P -4 21 c":" !#$%#% &!$&*)-(,-,*+)(+","P -4 m 2":" !#$%#!$&% & %#$!#! &%$&","P -4 c 2":" !#$%#% &!$& %+$!+! -%$-","P -4 b 2":" !#$%#% &!$&(,#*)#)(&,*&","P -4 n 2":" !#$%#% &!$&(,+*)+)(-,*-","I -4 m 2":" !#$%#% &!$& %#$!#! &%$&()+*,+,(-)*-(,+*)+)(-,*-","I -4 c 2":" !#$%#% &!$& %+$!+! -%$-()+*,+,(-)*-(,#*)#)(&,*&","I -4 2 m":" !#$%#% &!$&$!& %&%$#! #()+*,+,(-)*-*)-(,-,*+)(+","I -4 2 d":" !#$%#% &!$&*!>(%>,$9) 9()+*,+,(-)*-$)= ,=%*5!(5","P 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #","P 4/m 2/c 2/c":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +","P 4/n 2/b 2/m":" !#$%#% #!$#$!& %&! &%$&*,&()&)*&,(&(,#*)#,*#)(#","P 4/n 2/n 2/c":" !#$%#% #!$#$!& %&! &%$&*,-()-)*-,(-(,+*)+,*+)(+","P 4/m 21/b 2/m":" !#$%#% #!$#*)&(,&)(&,*&$%& !&!$&% &(,#*)#,*#)(#","P 4/m 21/n 2/c":" !#$%#% #!$#*)-(,-)(-,*-$%& !&!$&% &(,+*)+,*+)(+","P 4/n 21/m 2/m":" !#$%#,(#)*#*)&(,&! &%$&*,&()&!$&% & %#$!#,*#)(#","P 4/n 2/c 2/c":" !#$%#,(#)*#*)-(,-! -%$-*,&()&!$&% & %+$!+,*+)(+","P 42/m 2/m 2/c":" !#$%#% +!$+$!& %&! -%$-$%& !&!$-% - %#$!#%$+! +","P 42/m 2/c 2/m":" !#$%#% +!$+$!- %-! &%$&$%& !&!$-% - %+$!+%$#! #","P 42/n 2/b 2/c":" !#$%#,(+)*+$!- %-)(&,*&*,-()-!$&% &(,#*)#%$+! +","P 42/n 2/n 2/m":" !#$%#,(+)*+$!& %&)(-,*-*,-()-!$&% &(,+*)+%$#! #","P 42/m 21/b 2/c":" !#$%#% +!$+*)&(,&)(-,*-$%& !&!$-% -(,#*)#,*+)(+","P 42/m 21/n 2/m":" !#$%#,./'*/*'-.,-! &%$&$%& !&'*-,.-.,/*'/%$#! #","P 42/n 21/m 2/c":" !#$%#,(+)*+*)-(,-! &%$&*,-()-!$&% & %#$!#,*+)(+","P 42/n 21/c 2/m":" !#$%#,(+)*+*)&(,&! -%$-*,-()-!$&% & %+$!+,*#)(#","I 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #()+*,+,(+)*+*)-(,-)(-,*-*,-()-)*-,(-(,+*)+,*+)(+","I 4/m 2/c 2/m":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +()+*,+,(+)*+*)&(,&)(&,*&*,-()-)*-,(-(,#*)#,*#)(#","I 41/a 2/m 2/d":" !#*,+%(5)$9*!> ,=)(-%$&$,=(!>!$&,(-(,+$!#,$9!(5()+$%#, 9!*5$)=(%>! &,*-*%> )=)*-% & %#*)+%*5) 9","I 41/a 2/c 2/d":" !#*,+%(5)$9*!= ,>)(&%$-$,=(!>!$&,(-(,#$!+,$5!(9()+$%#, 9!*5$)>(%=! -,*&*%> )=)*-% & %+*)#%*9) 5","P 3":" !#%?#@$#","P 31":" !#%?A@$B","P 32":" !#%?B@$A","H 3":" !#%?#@$#CDAEFAGHAIJBKLBMNB","R 3":" !## !!# ","P -3":" !#%?#@$#$%&!@&? &","H -3":" !#%?#@$#$%&!@&? &OPQRSQTUQVWXYZX[]X]Y^W[^ZV^UR_PT_SO_","R -3":" !## !!# $%&&$%%&$","P 3 1 2":" !#%?#@$#%$&@!& ?&","P 3 2 1":" !#%?#@$#! &?%&$@&","P 31 1 2":" !#%?Q@$^%$_@!X ?&","P 31 2 1":" !#%?A@$B! &?%_$@X","P 32 1 2":" !#%?^@$Q%$X@!_ ?&","P 32 2 1":" !#%?B@$A! &?%X$@_","H 3 2":" !#%?#@$#! &?%&$@&OPQRSQTUQY]X[WXVZX]Y^W[^ZV^PO_SR_UT_","R 3 2":" !## !!# %$&$&%&%$","P 3 m 1":" !#%?#@$#%$#@!# ?#","P 3 1 m":" !#%?#@$#! #?%#$@#","P 3 c 1":" !#%?#@$#%$+@!+ ?+","P 3 1 c":" !#%?#@$#! +?%+$@+","H 3 m":" !#%?#@$#%$#@!# ?#OPQRSQTUQRUQTPQOSQ]Y^W[^ZV^WV^ZY^][^","R 3 m":" !## !!# ! # #!#! ","H 3 c":" !#%?#@$#%$+@!+ ?+OPQRSQTUQRU`TP`OS`]Y^W[^ZV^WVaZYa][a","R 3 c":" !## !!# '././'/'.","P -3 1 2/m":" !#%?#@$#%$&@!& ?&$%&!@&? &! #?%#$@#","P -3 1 2/c":" !#%?#@$#%$-@!- ?-$%&!@&? &! +?%+$@+","P -3 2/m 1":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#","P -3 2/c 1":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+","H -3 2/m":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#OPQRSQTUQY]X[WXVZXVWXYZX[]XRUQTPQOSQ]Y^W[^ZV^PO_SR_UT_UR_PT_SO_WV^ZY^][^","R -3 2/m":" !## !!# %$&$&%&%$$%&&$%%&$! # #!#! ","H -3 2/c":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+OPQRSQTUQY]b[WbVZbVWXYZX[]XRU`TP`OS`]Y^W[^ZV^POcSRcUTcUR_PT_SO_WVaZYa][a","R -3 2/c":" !## !!# 102021210$%&&$%%&$'././'/'.","P 6":" !#%?#@$#$%#!@#? #","P 61":" !#%?A@$B$%/!@d? e","P 65":" !#%?B@$A$%/!@e? d","P 62":" !#%?^@$Q$%#!@^? Q","P 64":" !#%?Q@$^$%#!@Q? ^","P 63":" !#%?#@$#$%+!@+? +","P -6":" !#%?#@$# !&%?&@$&","P 6/m":" !#%?#@$#$%#!@#? #$%&!@&? & !&%?&@$&","P 63/m":" !#%?#@$#$%+!@+? +$%&!@&? & !-%?-@$-","P 6 2 2":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&","P 61 2 2":" !#%?Q@$^$%+!@`? a! X?%&$@_%$b@!- ?c","P 65 2 2":" !#%?^@$Q$%+!@a? `! _?%&$@X%$c@!- ?b","P 62 2 2":" !#%?^@$Q$%#!@^? Q! _?%&$@X%$_@!& ?X","P 64 2 2":" !#%?Q@$^$%#!@Q? ^! X?%&$@_%$X@!& ?_","P 63 2 2":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-","P 6 m m":" !#%?#@$#$%#!@#? #%$#@!# ?#! #?%#$@#","P 6 c c":" !#%?#@$#$%#!@#? #%$+@!+ ?+! +?%+$@+","P 63 c m":" !#%?#@$#$%+!@+? +%$+@!+ ?+! #?%#$@#","P 63 m c":" !#%?#@$#$%+!@+? +%$#@!# ?#! +?%+$@+","P -6 m 2":" !#%?#@$# !&%?&@$&%$#@!# ?#%$&@!& ?&","P -6 c 2":" !#%?#@$# !-%?-@$-%$+@!+ ?+%$&@!& ?&","P -6 2 m":" !#%?#@$# !&%?&@$&! &?%&$@&! #?%#$@#","P -6 2 c":" !#%?#@$# !-%?-@$-! &?%&$@&! +?%+$@+","P 6/m 2/m 2/m":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&$%&!@&? & !&@$&%?&%$#@!# ?#! #?%#$@#","P 6/m 2/c 2/c":" !#%?#@$#$%#!@#? #! -?%-$@-%$-@!- ?-$%&!@&? & !&@$&%?&%$+@!+ ?+! +?%+$@+","P 63/m 2/c 2/m":" !#%?#@$#$%+!@+? +! -?%-$@-%$&@!& ?&$%&!@&? & !-@$-%?-%$+@!+ ?+! #?%#$@#","P 63/m 2/m 2/c":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-$%&!@&? & !-@$-%?-%$#@!# ?#! +?%+$@+","P 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ","F 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%&  )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ","I 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(","P 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(","I 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- ","P 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$","P 2/n -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& *,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","F 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-($,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- *,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$","F 2/d -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& 64=37=345675=64=375345674=67=3453756 )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(68>3:>3896:9=<8=;:5;85<:4><7>;49;79<(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(<4>;7>;49<79>68>3:93896:8=<:=;85;:5<()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- <8=;:=;8f<:f><4>;79;49<78>6:>3893:96","I 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","P 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*","I 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*()+$,#*g& %-+()#$,&*!- %)+(,#$!&*%- *,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$","P 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$","P 42 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","F 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$","F 41 3 2":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46 )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<(!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86","I 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","P 43 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7;>46=:<5839398<5:6=4;>75:<983>7;=46","P 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<","I 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46","P -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ","F -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&%  )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(+%*+!*-%(- +)$+,$-) -,#)(#,*&)*&,((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() +,$+)$-, -(#)*#,*&)(&,+!(+%*-!*-%(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(#,*#)*&,(&(+!*+%*-!(-%+) +,$-)$-, ","I -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","P -4 3 n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","F -4 3 c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() #,$#)$&, &(#!*#%*&!(&%+! +%$-!$-% (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(#%*#!*&%(& +!$+%$-! -%#) #,$&)$&, ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! +%$+!$-% - #)$#,$&) &,#!(#%*&!*&%(","I -4 3 d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7354<9:6>8;=357<946>:;=857394<>:6=8;()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- :;98657<=43>;9:658<=73>49:;586=7<>43","P 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","P 4/n -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/m -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/n -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","F 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#!  )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*%*+!(+%(-!*-$-) -, +)$+,&,(&)*#,*#)((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%**%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*,$+) +, -)$-*&)(&,(#)*#,-%(-!*+%*+!(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$*,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$,*#)(#,(&)*&*-!(-%(+!*+%-, -)$+,$+) ","F 4/m -3 2/c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() &,$&)$#, #(#%*#!*&%(&!+!$+% -! -%$$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*,$#) #, &)$&*&!(&%(#!*#%-% -!$+%$+! (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(&%*&!*#%(# +%$+!$-% -!#)$#, &) &,$*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*%*#!(#%(&!*&$-! -% +!$+%&, &)$#,$#) ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! -%$-!$+% + #,$#)$&, &)#!*#%(&!(&%**,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$%$+! +% -!$-$&) &, #)$#,&%(&!*#%*#!(","F 41/d -3 2/m":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=4664=3:>;85<79=64>3:5;89<74=6:>385;79<,$+! #%(-)*&*&)(-% #!$+,-%(&)*+,$#!  )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<68>37=;49<:5=<8>;753496:4><:=;893756,*#!(+% &)$-*-!(&, +)$#%-, &!$+%*#)((!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<<4>;:=389675>68=379;45<:8=<7>;453:96%$#) +,(&!*-$&! -,(#)*+%&% -)$#,*+!(()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86<8=;7>3456:9><4=;:9385678>67=349;:5<%*+)(#, -!$&$-) &%(+!*#,&,(-!*#%$+) ","F 41/d -3 2/c":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46<8>;7=3496:5><8=;793456:8><7=;493:56%*#)(+, &!$-$-! &,(+)*#%&, -!$#%*+)( )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<<4=;:>385679>64=3:9;85<78=67>345;:9<%$+) #,(-!*&$&) -%(#!*+,&%(-)*#,$+! (!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<68=37>;45<:9=<4>;:5389674>6:=389;75<,*+!(#% -)$&*-)(&% +!$#,-,(&!*+%$#) ()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>8664>3:=;89<75=68>375;49<:4=<:>;853796,$#! +%(&)*-*&!(-, #)$+%-% &)$+,*#!(","I 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","I 41/a -3 2/d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<$%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*4<97358;=:6>6>:;=8357<94=8;>:694<573()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46*,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$865:;943>7<=<=73>4;9:658>43=7<5869:;","P 1 1 2":" !#$%#","P 1 1 21":" !#$%+","B 1 1 2":" !#$%#(g+*%+","A 1 2 1":" !#$!& )+$)-","C 1 21 1":" !#$)&()#*!&","I 1 2 1":" !#$!&.'/0'2","I 1 21 1":" !#$)&.'/0!-","P 1 1 m":" !# !&","P 1 1 b":" !# )&","B 1 1 m":" !# !&(!+(!-","B 1 1 b":" !# )&(!+()-","P 1 1 2/m":" !# !&$%#$%&","P 1 1 21/m":" !#$%+$%& !-","B 1 1 2/m":" !# !&$%#$%&(!+(!-*%+*%-","P 1 1 2/b":" !#$,#$%& )&","P 1 1 21/b":" !#$%&$,+ )-","B 1 1 2/b":" !#$,#$%& )&(!+*,+*%-()-","P 21 2 2":" !#$!&(%&*%#","P 2 21 2":" !# ,&$)&$%#","P 21 21 2 (a)":" !#*,#.%&$'&","P 21 2 21":" !#$!&(%-*%+","P 2 21 21":" !# %&$)-$,+","C 2 2 21a)":" !#*%+(,&$)-()#$,+ %&*!-","C 2 2 2a":" !#*,#.%&$'&()#$%# ,&*!&","F 2 2 2a":" !#*,#.%&$'& '/*%/.12$!2.!/$,/ %20'2.'#$%# 1&0!&","I 2 2 2a":" !#*,#.%&$'&()+$%+*!- ,-","P 21/m 21/m 2/n a":" !#*,#$)&(%&$%&.'& ,#*!#","P 42 21 2a":" !#*,#%.+'$+$'&.%&! -,*-","I 2 3a":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};function Af(t){var e="";return t.length>0&&(e=":"+Ss(t).join(" OR :")),new Hu(e)}var Ef=function(t){this.name=t||"",this.partList=[]},Mf={type:{}};Mf.type.get=function(){return"Assembly"},Ef.prototype.addPart=function(t,e){var n=new Tf(t,e);return this.partList.push(n),n},Ef.prototype._getCount=function(t,e){var n=0;return this.partList.forEach(function(r){n+=r[e](t)}),n},Ef.prototype.getAtomCount=function(t){return this._getCount(t,"getAtomCount")},Ef.prototype.getResidueCount=function(t){return this._getCount(t,"getResidueCount")},Ef.prototype.getInstanceCount=function(){var t=0;return this.partList.forEach(function(e){t+=e.matrixList.length}),t},Ef.prototype.isIdentity=function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;if(!(new De).equals(e.matrixList[0]))return!1;var n=[];return t.eachChain(function(t){n.push(t.chainname)}),n=Ss(n),e.chainList.length===n.length},Ef.prototype.getBoundingBox=function(t){var e=new Hn;return this.partList.forEach(function(n){var r=n.getBoundingBox(t);e.expandByPoint(r.min),e.expandByPoint(r.max)}),e},Ef.prototype.getCenter=function(t){return this.getBoundingBox(t).getCenter()},Ef.prototype.getSelection=function(){var t=[];return this.partList.forEach(function(e){t=t.concat(e.chainList)}),Af(t)},Object.defineProperties(Ef.prototype,Mf);var Tf=function(t,e){this.matrixList=t||[],this.chainList=e||[]},Pf={type:{}};function If(t,e){if(e){nl&&el.time("assignSecondaryStructure");var n=[];t.eachModel(function(t){t.eachChain(function(t){n.push(t.chainname)})});var r=n.slice().sort(),i=[];r.forEach(function(t){i.push(n.indexOf(t))});var o=e.helices;(o=o.filter(function(t){return _s(r,t[0])>=0})).sort(function(t,e){var n=t[0],o=e[0],a=t[1],s=e[1];if(n===o)return a===s?0:a<s?-1:1;var c=_s(r,n),u=_s(r,o);return i[c]<i[u]?-1:1});var a=t.residueStore;t.eachModel(function(t){var e=0,n=o.length;if(0!==n){var r=o[e],i=!1,s=!1;t.eachChain(function(t){var c=!1;if(t.chainname===r[0])for(var u=t.residueCount,l=t.residueOffset,h=l+u,p=l;p<h;++p)if(a.resno[p]===r[1]&&a.getInscode(p)===r[2]&&(i=!0),i&&(a.sstruc[p]=r[6],a.resno[p]===r[4]&&a.getInscode(p)===r[5]&&(i=!1,(e+=1)<n?(p=l-1,r=o[e],c=t.chainname!==r[0]):s=!0)),c||s)return})}});var s=e.sheets;(s=s.filter(function(t){return _s(r,t[0])>=0})).sort(function(t,e){var n=t[0],o=e[0];if(n===o)return 0;var a=_s(r,n),s=_s(r,o);return i[a]<i[s]?-1:1});var c="e".charCodeAt(0);t.eachModel(function(t){var e=0,n=s.length;if(0!==n){var r=s[e],i=!1,o=!1;t.eachChain(function(t){var u=!1;if(t.chainname===r[0])for(var l=t.residueCount,h=t.residueOffset,p=h+l,d=h;d<p;++d)if(a.resno[d]===r[1]&&a.getInscode(d)===r[2]&&(i=!0),i&&(a.sstruc[d]=c,a.resno[d]===r[4]&&a.getInscode(d)===r[5]&&(i=!1,(e+=1)<n?(d=h-1,r=s[e],u=t.chainname!==r[0]):o=!0)),u||o)return})}}),nl&&el.timeEnd("assignSecondaryStructure")}}Pf.type.get=function(){return"AssemblyPart"},Tf.prototype._getCount=function(t,e){var n=0,r=this.chainList;return t.eachChain(function(t){(0===r.length||r.includes(t.chainname))&&(n+=t[e])}),this.matrixList.length*n},Tf.prototype.getAtomCount=function(t){return this._getCount(t,"atomCount")},Tf.prototype.getResidueCount=function(t){return this._getCount(t,"residueCount")},Tf.prototype.getBoundingBox=function(t){var e=new Hn,n=new Hn,r=this.getSelection(),i=t.getBoundingBox(r);return this.matrixList.forEach(function(t){n.copy(i).applyMatrix4(t),e.expandByPoint(n.min),e.expandByPoint(n.max)}),e},Tf.prototype.getSelection=function(){return Af(this.chainList)},Tf.prototype.getView=function(t){var e=this.getSelection();return e?t.getView(e):t},Tf.prototype.getInstanceList=function(){for(var t=[],e=0,n=this.matrixList.length;e<n;++e)t.push({id:e+1,name:e,matrix:this.matrixList[e]});return t},Object.defineProperties(Tf.prototype,Pf);var Rf,Of,Lf,kf=(Rf=function(t,e,n,r){for(var i=t.structure,o=t.residueIndexStart,a=i.getResidueProxy(),s=i.getResidueProxy(),c=i.getAtomProxy(),u=i.getAtomProxy(),l=Math.max(0,e-2);l<=e;++l)for(var h=2;h<5;++h)if(!(l+h>=t.residueCount)){a.index=o+l,s.index=o+l+h,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var p=c.distanceTo(u);if(Math.abs(p-n[h-2])>r)return!1}return!0},Of=function(t,e){return Rf(t,e,[5.45,5.18,6.37],2.1)},Lf=function(t,e){return Rf(t,e,[6.1,10.4,13],1.42)},function(t){nl&&el.time("calculateSecondaryStructure"),t.eachPolymer(function(t){if(!(t.residueCount<4)){if(t.isCg())!function(t){for(var e=t.residueStore,n=t.residueIndexStart,r=new bf(t).position,i=new Ne,o=new Ne,a=0,s=t.residueCount;a<s;++a){i.fromArray(r.center,3*a),o.fromArray(r.center,3*a+3);var c=i.distanceTo(o);c<2&&c>1&&r.bending[a]<20&&(e.sstruc[n+a]="h".charCodeAt(0),e.sstruc[n+a+1]="h".charCodeAt(0))}}(t);else{if(!t.isProtein())return;!function(t){for(var e=t.residueStore,n=t.residueIndexStart,r=0,i=t.residueCount;r<i;++r){var o="c";Of(t,r)?o="h":Lf(t,r)&&(o="s"),e.sstruc[n+r]=o.charCodeAt(0)}}(t)}var e,n=0;t.eachResidue(function(t){t.sstruc===e?n+=1:(1===n&&(t.index-=1,t.sstruc="c"),n=1,e=t.sstruc)})}}),nl&&el.timeEnd("calculateSecondaryStructure")});function Nf(t){nl&&el.time("calculateChainnames");var e=!0;if(t.eachChain(function(t){t.chainname&&(e=!1)}),e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r=n.length,i=t.modelStore,o=t.chainStore,a=t.residueStore,s=function(t){for(var e=t,i=0,o=n[e%r];e>=r;)e=Math.floor(e/r),o+=n[e%r],i+=1;return i>=5&&el.warn("chainname overflow"),o},c=t.getAtomProxy(),u=t.getAtomProxy(),l=0,h=0,p=0,d=0,f=[];1===a.count?f.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):t.eachResidueN(2,function(t,e){var n=!1,r=t.backboneType,i=e.backboneType,o=Jp;d=t.index,t.modelIndex!==e.modelIndex?n=!0:t.moleculeType!==e.moleculeType?n=!0:r!==o&&r===i&&(c.index=t.backboneEndAtomIndex,u.index=e.backboneStartAtomIndex,c.connectedTo(u)||(n=!0)),n||e.index!==a.count-1||(n=!0,d=e.index),n&&(f.push({mIndex:h,chainname:s(l),rStart:p,rCount:d-p+1}),l+=1,t.modelIndex!==e.modelIndex&&(l=0,h+=1),e.index===a.count-1&&d!==e.index&&f.push({mIndex:h,chainname:s(l),rStart:a.count-1,rCount:1}),p=e.index,d=e.index)}),o.count=0,f.forEach(function(t){!function(t,e,n,r){for(var s=o.count,c=0;c<r;++c)a.chainIndex[n+c]=s;o.growIfFull(),o.modelIndex[s]=t,o.setChainname(s,e),o.setChainid(s,e),o.residueOffset[s]=n,o.residueCount[s]=r,o.count+=1,i.chainCount[t]+=1}(t.mIndex,t.chainname,t.rStart,t.rCount)});var m=0;t.eachModel(function(t){i.chainOffset[t.index]=m,i.chainCount[t.index]-=1,m+=i.chainCount[t.index]})}nl&&el.timeEnd("calculateChainnames")}function Df(t){nl&&el.time("calculateBonds"),zf(t),Ff(t),nl&&el.timeEnd("calculateBonds")}function zf(t,e){nl&&el.time("calculateBondsWithin");var n=t.bondStore,r=t.rungBondStore,i=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy(),s=t.getBondProxy(),c=e?null:function(t){nl&&el.time("calculateAtomBondMap");var e=[];return t.eachBond(function(t){var n=t.atomIndex1,r=t.atomIndex2;void 0===e[n]&&(e[n]=[]),e[n][r]=t.index}),nl&&el.timeEnd("calculateAtomBondMap"),e}(t);t.eachResidue(function(t){if(!e){var u=t.atomCount,l=t.atomOffset;if(u>500)return void el.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var h=t.getBonds(),p=h.atomIndices1,d=h.atomIndices2,f=h.bondOrders,m=p.length,g=0;g<m;++g){var v=p[g]+l,y=d[g]+l,b=c[v];if(void 0!==b&&void 0!==(b=b[y]))s.index=b,f[t.residueType.getBondIndex(v,y)]=s.bondOrder;else o.index=v,a.index=y,n.addBond(o,a,f[g])}}var x=t.residueType.traceAtomIndex,_=t.residueType.rungEndAtomIndex;-1!==x&&-1!==_&&(o.index=t.traceAtomIndex,a.index=t.rungEndAtomIndex,r.addBond(o,a),i.set(o.index),i.set(a.index))}),t.atomSetDict.rung=i,nl&&el.timeEnd("calculateBondsWithin")}function Ff(t,e){nl&&el.time("calculateBondsBetween");var n=t.bondStore,r=t.backboneBondStore,i=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy();function s(t,s){var c=t.backboneType,u=s.backboneType;c!==Jp&&c===u&&(o.index=t.backboneEndAtomIndex,a.index=s.backboneStartAtomIndex,o.connectedTo(a)&&(e||n.addBond(o,a,1),o.index=t.traceAtomIndex,a.index=s.traceAtomIndex,r.addBond(o,a),i.set(o.index),i.set(a.index)))}0===r.count&&r.resize(t.residueStore.count),t.eachResidueN(2,s);var c=t.getResidueProxy(),u=t.getResidueProxy();t.eachChain(function(t){0!==t.residueCount&&(c.index=t.residueOffset,u.index=t.residueOffset+t.residueCount-1,s(u,c))}),t.atomSetDict.backbone=i,nl&&el.timeEnd("calculateBondsBetween")}function Bf(t){if(t.unitcell){nl&&el.time("buildUnitcellAssembly");var e=t.unitcell,n=t.center.clone().applyMatrix4(e.cartToFrac),r=function(t){var e=Cf[t],n={};if(void 0===e)return console.warn("getSymmetryOperations: spacegroup '"+t+"' not found in symop library"),n;for(var r=[],i=0,o=e.length;i<o;i+=3){for(var a=[],s=0;s<3;++s)a.push(Sf[e[i+s]]);r.push(a)}var c=/^[1-9]$/;return r.forEach(function(t){var e=0,r=(new De).set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),i=r.elements;n[t]=r,t.forEach(function(t){for(var n=!1,r=!1,o=0,a=t.length;o<a;++o){var s=t[o];if("-"===s)n=!0;else if("+"===s)n=!1;else if("/"===s)r=!0;else if("X"===s)i[0+e]=n?-1:1;else if("Y"===s)i[4+e]=n?-1:1;else if("Z"===s)i[8+e]=n?-1:1;else if(c.test(s)){var u=parseInt(s);r?i[12+e]/=u:i[12+e]=u}else el.warn('getSymmetryOperations: unknown token "'+s+'"')}e+=1})}),n}(e.spacegroup),i=new Ne,o=new Ne,a=new Ne;n.x>1&&(i.x-=1),n.x<0&&(i.x+=1),n.y>1&&(i.y-=1),n.y<0&&(i.y+=1),n.z>1&&(i.z-=1),n.z<0&&(i.z+=1);var s,c=new Ef("UNITCELL"),u=m();if(t.biomolDict.NCS){s=[new De].concat(t.biomolDict.NCS.partList[0].matrixList);var l=[];u.forEach(function(t){s.forEach(function(e){l.push(t.clone().multiply(e))})}),c.addPart(l)}else c.addPart(u);var h=new Ne,p=new Ef("SUPERCELL"),d=Array.prototype.concat.call(m(h.set(1,0,0)),m(h.set(0,1,0)),m(h.set(0,0,1)),m(h.set(-1,0,0)),m(h.set(0,-1,0)),m(h.set(0,0,-1)),m(h.set(1,1,0)),m(h.set(1,0,1)),m(h.set(0,1,1)),m(h.set(-1,-1,0)),m(h.set(-1,0,-1)),m(h.set(0,-1,-1)),m(h.set(1,-1,-1)),m(h.set(1,1,-1)),m(h.set(1,-1,1)),m(h.set(-1,1,1)),m(h.set(-1,-1,1)),m(h.set(-1,1,-1)),m(h.set(0,1,-1)),m(h.set(0,-1,1)),m(h.set(1,0,-1)),m(h.set(-1,0,1)),m(h.set(1,-1,0)),m(h.set(-1,1,0)),m(),m(h.set(1,1,1)),m(h.set(-1,-1,-1)));if(t.biomolDict.NCS){var f=[];d.forEach(function(t){s.forEach(function(e){f.push(t.clone().multiply(e))})}),p.addPart(f)}else p.addPart(d);t.biomolDict.UNITCELL=c,t.biomolDict.SUPERCELL=p,nl&&el.timeEnd("buildUnitcellAssembly")}function m(t){var s=[];return Object.keys(r).forEach(function(c){var u=r[c].clone();o.copy(n).applyMatrix4(u),a.setFromMatrixPosition(u),a.sub(i),o.x>1&&(a.x-=1),o.x<0&&(a.x+=1),o.y>1&&(a.y-=1),o.y<0&&(a.y+=1),o.z>1&&(a.z-=1),o.z<0&&(a.z+=1),t&&a.add(t),u.setPosition(a),u.multiplyMatrices(e.fracToCart,u),u.multiply(e.cartToFrac),s.push(u)}),s}}var Uf=["H","C","O","N","S","P"],jf=["NA","CL","FE"];function Gf(t){var e=t.trim().toUpperCase();parseInt(e.charAt(0))&&(e=e.substr(1)),parseInt(e.charAt(0))&&(e=e.substr(1));var n=e.length;if(0===n)return"";if(1===n)return e;if(2===n){if(-1!==jf.indexOf(e))return e;if(-1!==Uf.indexOf(e[0]))return e[0]}return n>=3&&-1!==Uf.indexOf(e[0])?e[0]:""}function Vf(t){var e=t.bondHash,n=e.countArray,r=e.offsetArray,i=e.indexArray,o=t.getBondProxy();t.eachResidue(function(t){var e=t.residueType;if(void 0===e.bonds){var a=t.atomOffset,s=[],c=[],u=[],l={};t.eachAtom(function(t){for(var e=t.index,h=r[e],p=0,d=n[e];p<d;++p){o.index=i[h+p];var f=o.atomIndex1,m=o.atomIndex2;if(f>m){var g=m;m=f,f=g}var v=f+"|"+m;void 0===l[v]&&(l[v]=!0,s.push(f-a),c.push(m-a),u.push(o.bondOrder))}}),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}})}var Hf=function(t){this.structure=t,this.dict={},this.list=[]};Hf.prototype.add=function(t,e){var n=function(t,e){return t+"|"+e}(t=t.toUpperCase(),e=e?e.toUpperCase():Gf(t)),r=this.dict[n];if(void 0===r){var i=new function(t,e,n){this.structure=t,n=n||Gf(e),this.atomname=e,this.element=n,this.vdw=cd[n],this.covalent=ud[n]}(this.structure,t,e);r=this.list.length,this.dict[n]=r,this.list.push(i)}return r},Hf.prototype.get=function(t){return this.list[t]};var $f=function(t,e,n,r,i,o){this.structure=t,this.resname=e,this.atomTypeIdList=n,this.hetero=r?1:0,this.chemCompType=i,this.bonds=o,this.rings=void 0,this.atomCount=n.length,this.moleculeType=this.getMoleculeType(),this.backboneType=this.getBackboneType(0),this.backboneEndType=this.getBackboneType(-1),this.backboneStartType=this.getBackboneType(1),this.backboneIndexList=this.getBackboneIndexList();var a=wd[this.backboneType],s=wd[this.backboneStartType],c=wd[this.backboneEndType],u=this.getAtomIndexByName(a.trace);this.traceAtomIndex=void 0!==u?u:-1;var l=this.getAtomIndexByName(a.direction1);this.direction1AtomIndex=void 0!==l?l:-1;var h=this.getAtomIndexByName(a.direction2);this.direction2AtomIndex=void 0!==h?h:-1;var p=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==p?p:-1;var d,f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1,d=gd.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==d?d:-1,this.bondReferenceAtomIndices=[]};$f.prototype.getBackboneIndexList=function(){var t,e=[];switch(this.moleculeType){case 3:t=xd;break;case 4:case 5:t=_d;break;default:return e}for(var n=this.structure.atomMap,r=this.atomTypeIdList,i=0,o=this.atomCount;i<o;++i){var a=n.get(r[i]);t.includes(a.atomname)&&e.push(i)}return e},$f.prototype.getMoleculeType=function(){return this.isProtein()?3:this.isRna()?4:this.isDna()?5:this.isWater()?1:this.isIon()?2:this.isSaccharide()?6:0},$f.prototype.getBackboneType=function(t){return this.hasProteinBackbone(t)?1:this.hasRnaBackbone(t)?2:this.hasDnaBackbone(t)?3:this.hasCgProteinBackbone(t)?4:this.hasCgRnaBackbone(t)?5:this.hasCgDnaBackbone(t)?6:Jp},$f.prototype.isProtein=function(){return this.chemCompType?td.includes(this.chemCompType):this.hasAtomWithName("CA","C","N")||dd.includes(this.resname)},$f.prototype.isCg=function(){var t=this.backboneType;return 4===t||5===t||6===t},$f.prototype.isNucleic=function(){return this.isRna()||this.isDna()},$f.prototype.isRna=function(){return this.chemCompType?ed.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C4'","C4*"],["O2'","O2*","F2'","F2*"])||fd.includes(this.resname)&&this.hasAtomWithName(["O2'","O2*","F2'","F2*"])},$f.prototype.isDna=function(){return this.chemCompType?nd.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C3'","C3*"])&&!this.hasAtomWithName(["O2'","O2*","F2'","F2*"])||md.includes(this.resname)},$f.prototype.isHetero=function(){return 1===this.hetero},$f.prototype.isIon=function(){return yd.includes(this.resname)},$f.prototype.isWater=function(){return vd.includes(this.resname)},$f.prototype.isSaccharide=function(){return this.chemCompType?rd.includes(this.chemCompType):bd.includes(this.resname)},$f.prototype.hasBackboneAtoms=function(t,e){var n=wd[e];return-1===t?this.hasAtomWithName(n.trace,n.backboneEnd,n.direction1,n.direction2):0===t?this.hasAtomWithName(n.trace,n.direction1,n.direction2):1===t?this.hasAtomWithName(n.trace,n.backboneStart,n.direction1,n.direction2):this.hasAtomWithName(n.trace,n.backboneStart,n.backboneEnd,n.direction1,n.direction2)},$f.prototype.hasProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,1)},$f.prototype.hasRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,2)},$f.prototype.hasDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,3)},$f.prototype.hasCgProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,4)},$f.prototype.hasCgRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,5)},$f.prototype.hasCgDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,6)},$f.prototype.hasBackbone=function(t){return this.hasProteinBackbone(t)||this.hasRnaBackbone(t)||this.hasDnaBackbone(t)||this.hasCgProteinBackbone(t)||this.hasCgRnaBackbone(t)||this.hasCgDnaBackbone(t)},$f.prototype.getAtomIndexByName=function(t){var e=this.atomCount,n=this.structure.atomMap,r=this.atomTypeIdList;if(Array.isArray(t))for(var i=0;i<e;++i){var o=r[i];if(t.includes(n.get(o).atomname))return i}else for(var a=0;a<e;++a){var s=r[a];if(t===n.get(s).atomname)return a}},$f.prototype.hasAtomWithName=function(){for(var t=arguments,e=arguments.length,n=0;n<e;++n)if(void 0!==t[n]&&void 0===this.getAtomIndexByName(t[n]))return!1;return!0},$f.prototype.getBonds=function(t){return void 0===this.bonds&&(this.bonds=function(t){var e=t.structure,n=e.getAtomProxy(),r=e.getAtomProxy(),i=t.atomCount,o=t.atomOffset,a=o+i-1;if(!(i>500)){var s,c,u=[],l=[],h=[];if(i>50){var p=new wf(t,!0),d=t.isCg()?1.2:2.3;for(s=o;s<a;++s){n.index=s;var f=n.covalent+d+.3,m=p.nearest(n,1/0,f*f),g=m.length;for(c=0;c<g;++c)r.index=m[c].index,n.index<r.index&&n.connectedTo(r)&&(u.push(n.index-o),l.push(r.index-o),h.push(1))}}else for(s=o;s<a;++s)for(n.index=s,c=s+1;c<=a;++c)r.index=c,n.connectedTo(r)&&(u.push(s-o),l.push(c-o),h.push(1));return{atomIndices1:u,atomIndices2:l,bondOrders:h}}nl&&el.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName())}(t)),this.bonds},$f.prototype.getRings=function(){return void 0===this.rings&&this.calculateRings(),this.rings},$f.prototype.getBondGraph=function(){return void 0===this.bondGraph&&this.calculateBondGraph(),this.bondGraph},$f.prototype.calculateBondGraph=function(){for(var t=this.bondGraph={},e=this.getBonds(),n=e.atomIndices1.length,r=e.atomIndices1,i=e.atomIndices2,o=0;o<n;++o){var a=r[o],s=i[o];(t[a]=t[a]||[]).push(s),(t[s]=t[s]||[]).push(a)}},$f.prototype.calculateRings=function(){var t=this.getBondGraph(),e=new Int8Array(this.atomCount),n=new Int8Array(this.atomCount),r=[],i=[];function o(a,s,c){if(e[a])throw new Error("DFS revisited atom");e[a]=1,i.push(a);for(var u=s.length,l=0;l<u;++l){var h=s[l];if(0===e[h])t[h]&&t[h].length>=2?o(h,t[h],a):e[h]=2;else if(1===e[h]&&c&&c!==h){var p=[h];n[h]=1,r.push(p);for(var d=i.length-1;d>=0;--d){var f=i[d];if(f===h)break;p.push(f),n[f]=1}}}e[a]=2,i.pop()}for(var a=0;a<this.atomCount;++a)if(!e[a]){var s=t[a];!s||s.length<2?e[a]=2:(i.length=0,o(a,s))}this.rings={flags:n,rings:r}},$f.prototype.assignBondReferenceAtomIndices=function(){var t=this.getBondGraph(),e=this.getRings(),n=e.flags,r=e.rings,i=this.bonds.atomIndices1,o=this.bonds.atomIndices2,a=this.bonds.bondOrders,s=this.bondReferenceAtomIndices,c=this.bonds.atomIndices1.length;s.length=0;for(var u=0;u<c;++u)if(!(a[u]<=1)){var l=i[u],h=o[u];if(n[l]&&n[h]){for(var p=0;p<r.length&&void 0===s[u];++p)for(var d=r[p],f=null,m=!1,g=0;g<d.length;++g){var v=d[g];if(v===l||v===h?m=!0:f=v,m&&null!==f){s[u]=f;break}}if(void 0!==s[u])continue}if(t[l].length>1)for(var y=0;y<t[l].length;++y){var b=t[l][y];if(b!==h){s[u]=b;break}}else if(t[h].length>1)for(var x=0;x<t[h].length;++x){var _=t[h][x];if(_!==l){s[u]=_;break}}else;}},$f.prototype.getBondIndex=function(t,e){for(var n=this.bonds,r=n.atomIndices1,i=n.atomIndices2,o=r.indexOf(t),a=i.indexOf(e),s=a;-1!==o;){for(;-1!==a;){if(o===a)return o;a=i.indexOf(e,a+1)}o=r.indexOf(t,o+1),a=s}},$f.prototype.getBondReferenceAtomIndex=function(t,e){var n=this.getBondIndex(t,e);if(void 0!==n)return 0===this.bondReferenceAtomIndices.length&&this.assignBondReferenceAtomIndices(),this.bondReferenceAtomIndices[n]};var Wf=function(t){this.structure=t,this.dict={},this.list=[]};Wf.prototype.add=function(t,e,n,r,i){var o=function(t,e,n,r){return t+"|"+e.join(",")+"|"+(n?1:0)+"|"+(r||"")}(t=t.toUpperCase(),e,n,r),a=this.dict[o];if(void 0===a){var s=new $f(this.structure,t,e,n,r,i);a=this.list.length,this.dict[o]=a,this.list.push(s)}return a},Wf.prototype.get=function(t){return this.list[t]};var qf=function(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new Ne,this._v13=new Ne,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()},Xf={atom1:{},atom2:{},atomIndex1:{},atomIndex2:{},bondOrder:{}};Xf.atom1.get=function(){return this.structure.getAtomProxy(this.atomIndex1)},Xf.atom2.get=function(){return this.structure.getAtomProxy(this.atomIndex2)},Xf.atomIndex1.get=function(){return this.bondStore.atomIndex1[this.index]},Xf.atomIndex1.set=function(t){this.bondStore.atomIndex1[this.index]=t},Xf.atomIndex2.get=function(){return this.bondStore.atomIndex2[this.index]},Xf.atomIndex2.set=function(t){this.bondStore.atomIndex2[this.index]=t},Xf.bondOrder.get=function(){return this.bondStore.bondOrder[this.index]},Xf.bondOrder.set=function(t){this.bondStore.bondOrder[this.index]=t},qf.prototype.getReferenceAtomIndex=function(){var t=this._ap1,e=this._ap2;if(t.index=this.atomIndex1,e.index=this.atomIndex2,t.residueIndex===e.residueIndex){var n=t.index-t.residueAtomOffset,r=e.index-e.residueAtomOffset,i=t.residueType.getBondReferenceAtomIndex(n,r);if(void 0!==i)return i+t.residueAtomOffset;console.warn("No reference atom found",t.index,e.index)}},qf.prototype.calculateShiftDir=function(t){t||(t=new Ne);var e=this._ap1,n=this._ap2,r=this._ap3,i=this._v12,o=this._v13;e.index=this.atomIndex1,n.index=this.atomIndex2;var a=this.getReferenceAtomIndex();i.subVectors(e,n).normalize(),void 0!==a?(r.index=a,o.subVectors(e,r)):o.copy(e),o.normalize();var s=i.dot(o);return 1-Math.abs(s)<1e-5&&(o.set(1,0,0),s=i.dot(o),1-Math.abs(s)<1e-5&&(o.set(0,1,0),s=i.dot(o))),t.copy(o.sub(i.multiplyScalar(s))).normalize()},qf.prototype.qualifiedName=function(){return this.atomIndex1+"="+this.atomIndex2},qf.prototype.clone=function(){return new this.constructor(this.structure,this.index)},qf.prototype.toObject=function(){return{atomIndex1:this.atomIndex1,atomIndex2:this.atomIndex2,bondOrder:this.bondOrder}},Object.defineProperties(qf.prototype,Xf);var Yf=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e},Kf={bondHash:{},entity:{},entityIndex:{},modelIndex:{},chainIndex:{},residue:{},residueIndex:{},sstruc:{},inscode:{},resno:{},chainname:{},chainid:{},residueType:{},atomType:{},residueAtomOffset:{},resname:{},hetero:{},atomname:{},element:{},vdw:{},covalent:{},x:{},y:{},z:{},serial:{},bfactor:{},occupancy:{},altloc:{}};Kf.bondHash.get=function(){return this.structure.bondHash},Kf.entity.get=function(){return this.structure.entityList[this.entityIndex]},Kf.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},Kf.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},Kf.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndex]},Kf.residue.get=function(){return console.warn("residue - might be expensive"),this.structure.getResidueProxy(this.residueIndex)},Kf.residueIndex.get=function(){return this.atomStore.residueIndex[this.index]},Kf.residueIndex.set=function(t){this.atomStore.residueIndex[this.index]=t},Kf.sstruc.get=function(){return this.residueStore.getSstruc(this.residueIndex)},Kf.inscode.get=function(){return this.residueStore.getInscode(this.residueIndex)},Kf.resno.get=function(){return this.residueStore.resno[this.residueIndex]},Kf.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},Kf.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},Kf.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.residueIndex])},Kf.atomType.get=function(){return this.atomMap.get(this.atomStore.atomTypeId[this.index])},Kf.residueAtomOffset.get=function(){return this.residueStore.atomOffset[this.residueIndex]},Kf.resname.get=function(){return this.residueType.resname},Kf.hetero.get=function(){return this.residueType.hetero},Kf.atomname.get=function(){return this.atomType.atomname},Kf.element.get=function(){return this.atomType.element},Kf.vdw.get=function(){return this.atomType.vdw},Kf.covalent.get=function(){return this.atomType.covalent},Kf.x.get=function(){return this.atomStore.x[this.index]},Kf.x.set=function(t){this.atomStore.x[this.index]=t},Kf.y.get=function(){return this.atomStore.y[this.index]},Kf.y.set=function(t){this.atomStore.y[this.index]=t},Kf.z.get=function(){return this.atomStore.z[this.index]},Kf.z.set=function(t){this.atomStore.z[this.index]=t},Kf.serial.get=function(){return this.atomStore.serial[this.index]},Kf.serial.set=function(t){this.atomStore.serial[this.index]=t},Kf.bfactor.get=function(){return this.atomStore.bfactor[this.index]},Kf.bfactor.set=function(t){this.atomStore.bfactor[this.index]=t},Kf.occupancy.get=function(){return this.atomStore.occupancy[this.index]},Kf.occupancy.set=function(t){this.atomStore.occupancy[this.index]=t},Kf.altloc.get=function(){return this.atomStore.getAltloc(this.index)},Kf.altloc.set=function(t){this.atomStore.setAltloc(this.index,t)},Yf.prototype.eachBond=function(t,e){e=e||this.structure._bp;for(var n=this.index,r=this.bondHash,i=r.indexArray,o=r.countArray[n],a=r.offsetArray[n],s=0;s<o;++s)e.index=i[a+s],t(e)},Yf.prototype.eachBondedAtom=function(t,e){e=e||this.structure._ap;var n=this.index;this.eachBond(function(r){n!==r.atomIndex1?e.index=r.atomIndex1:e.index=r.atomIndex2,t(e)})},Yf.prototype.isBackbone=function(){var t=this.residueType.backboneIndexList;if(t.length>0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},Yf.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},Yf.prototype.isSidechain=function(){return this.isPolymer()&&!this.isBackbone()},Yf.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},Yf.prototype.isHetero=function(){return 1===this.residueType.hetero},Yf.prototype.isProtein=function(){return 3===this.residueType.moleculeType},Yf.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},Yf.prototype.isRna=function(){return 4===this.residueType.moleculeType},Yf.prototype.isDna=function(){return 5===this.residueType.moleculeType},Yf.prototype.isWater=function(){return 1===this.residueType.moleculeType},Yf.prototype.isIon=function(){return 2===this.residueType.moleculeType},Yf.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},Yf.prototype.isHelix=function(){return od.includes(this.sstruc)},Yf.prototype.isSheet=function(){return ad.includes(this.sstruc)},Yf.prototype.isTurn=function(){return sd.includes(this.sstruc)&&this.isProtein()},Yf.prototype.isBonded=function(){return 0!==this.bondHash.countArray[this.index]},Yf.prototype.isRing=function(){return 1===this.residueType.getRings().flags[this.index-this.residueAtomOffset]},Yf.prototype.distanceTo=function(t){var e=this.atomStore,n=t.atomStore,r=this.index,i=t.index,o=e.x[r]-n.x[i],a=e.y[r]-n.y[i],s=e.z[r]-n.z[i],c=o*o+a*a+s*s;return Math.sqrt(c)},Yf.prototype.connectedTo=function(t){var e=this.atomStore,n=t.atomStore,r=this.index,i=t.index;if(e.altloc&&n.altloc){var o=e.altloc[r],a=n.altloc[i];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[r]-n.x[i],c=e.y[r]-n.y[i],u=e.z[r]-n.z[i],l=s*s+c*c+u*u;if(l<64&&this.isCg())return!0;if(isNaN(l))return!1;var h=this.covalent+t.covalent,p=h+.3,d=h-.5;return l<p*p&&l>d*d},Yf.prototype.positionFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e+0],this.y=t[e+1],this.z=t[e+2],this},Yf.prototype.positionToArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.index,r=this.atomStore;return t[e+0]=r.x[n],t[e+1]=r.y[n],t[e+2]=r.z[n],t},Yf.prototype.positionToVector3=function(t){return void 0===t&&(t=new Ne),t.x=this.x,t.y=this.y,t.z=this.z,t},Yf.prototype.positionFromVector3=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},Yf.prototype.getResidueBonds=function(t){var e,n,r,i,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(i=[]),e=c.indexOf(a);-1!==e;){if(r=u[e]+o,t)return r;i.push(r),e=c.indexOf(a,e+1)}for(n=u.indexOf(a);-1!==n;){if(r=c[n]+o,t)return r;i.push(r),n=u.indexOf(a,n+1)}return i},Yf.prototype.qualifiedName=function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chainname&&(e+=":"+this.chainname),this.atomname&&(e+="."+this.atomname),this.altloc&&(e+="%"+this.altloc),this.structure.modelStore.count>1&&(e+="/"+this.modelIndex),e},Yf.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Yf.prototype.toObject=function(){return{index:this.index,residueIndex:this.residueIndex,atomno:this.atomno,resname:this.resname,x:this.x,y:this.y,z:this.z,element:this.element,chainname:this.chainname,resno:this.resno,serial:this.serial,vdw:this.vdw,covalent:this.covalent,hetero:this.hetero,bfactor:this.bfactor,altloc:this.altloc,atomname:this.atomname,modelindex:this.modelindex}},Object.defineProperties(Yf.prototype,Kf);var Zf=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e},Qf={entity:{},entityIndex:{},chain:{},chainIndex:{},atomOffset:{},atomCount:{},atomEnd:{},modelIndex:{},chainname:{},chainid:{},resno:{},sstruc:{},inscode:{},residueType:{},resname:{},hetero:{},moleculeType:{},backboneType:{},backboneStartType:{},backboneEndType:{},traceAtomIndex:{},direction1AtomIndex:{},direction2AtomIndex:{},backboneStartAtomIndex:{},backboneEndAtomIndex:{},rungEndAtomIndex:{}};Qf.entity.get=function(){return this.structure.entityList[this.entityIndex]},Qf.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},Qf.chain.get=function(){return this.structure.getChainProxy(this.chainIndex)},Qf.chainIndex.get=function(){return this.residueStore.chainIndex[this.index]},Qf.chainIndex.set=function(t){this.residueStore.chainIndex[this.index]=t},Qf.atomOffset.get=function(){return this.residueStore.atomOffset[this.index]},Qf.atomOffset.set=function(t){this.residueStore.atomOffset[this.index]=t},Qf.atomCount.get=function(){return this.residueStore.atomCount[this.index]},Qf.atomCount.set=function(t){this.residueStore.atomCount[this.index]=t},Qf.atomEnd.get=function(){return this.atomOffset+this.atomCount-1},Qf.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},Qf.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},Qf.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},Qf.resno.get=function(){return this.residueStore.resno[this.index]},Qf.resno.set=function(t){this.residueStore.resno[this.index]=t},Qf.sstruc.get=function(){return this.residueStore.getSstruc(this.index)},Qf.sstruc.set=function(t){this.residueStore.setSstruc(this.index,t)},Qf.inscode.get=function(){return this.residueStore.getInscode(this.index)},Qf.inscode.set=function(t){this.residueStore.getInscode(this.index,t)},Qf.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},Qf.resname.get=function(){return this.residueType.resname},Qf.hetero.get=function(){return this.residueType.hetero},Qf.moleculeType.get=function(){return this.residueType.moleculeType},Qf.backboneType.get=function(){return this.residueType.backboneType},Qf.backboneStartType.get=function(){return this.residueType.backboneStartType},Qf.backboneEndType.get=function(){return this.residueType.backboneEndType},Qf.traceAtomIndex.get=function(){return this.residueType.traceAtomIndex+this.atomOffset},Qf.direction1AtomIndex.get=function(){return this.residueType.direction1AtomIndex+this.atomOffset},Qf.direction2AtomIndex.get=function(){return this.residueType.direction2AtomIndex+this.atomOffset},Qf.backboneStartAtomIndex.get=function(){return this.residueType.backboneStartAtomIndex+this.atomOffset},Qf.backboneEndAtomIndex.get=function(){return this.residueType.backboneEndAtomIndex+this.atomOffset},Qf.rungEndAtomIndex.get=function(){return this.residueType.rungEndAtomIndex+this.atomOffset},Zf.prototype.eachAtom=function(t,e){var n,r=this.atomCount,i=this.atomOffset,o=this.structure._ap,a=i+r;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(n=i;n<a;++n)o.index=n,s(o)&&t(o)}else for(n=i;n<a;++n)o.index=n,t(o)},Zf.prototype.isProtein=function(){return 3===this.residueType.moleculeType},Zf.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},Zf.prototype.isRna=function(){return 4===this.residueType.moleculeType},Zf.prototype.isDna=function(){return 5===this.residueType.moleculeType},Zf.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},Zf.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},Zf.prototype.isHetero=function(){return 1===this.residueType.hetero},Zf.prototype.isWater=function(){return 1===this.residueType.moleculeType},Zf.prototype.isIon=function(){return 2===this.residueType.moleculeType},Zf.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},Zf.prototype.isHelix=function(){return od.includes(this.sstruc)},Zf.prototype.isSheet=function(){return ad.includes(this.sstruc)},Zf.prototype.isTurn=function(){return sd.includes(this.sstruc)&&this.isProtein()},Zf.prototype.getAtomType=function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},Zf.prototype.getResname1=function(){return pd[this.resname.toUpperCase()]||"X"},Zf.prototype.getBackboneType=function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},Zf.prototype.getAtomIndexByName=function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},Zf.prototype.getAtomByName=function(t){return this.residueType.getAtomByName(t)},Zf.prototype.hasAtomWithName=function(t){return this.residueType.hasAtomWithName(t)},Zf.prototype.getAtomnameList=function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,n=new Array(t),r=0;r<t;++r)n[r]=this.getAtomType(e+r).atomname;return n},Zf.prototype.connectedTo=function(t){var e=this.structure.getAtomProxy(this.backboneEndAtomIndex),n=this.structure.getAtomProxy(t.backboneStartAtomIndex);return!(!e||!n)&&e.connectedTo(n)},Zf.prototype.getNextConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.chainStore.residueCount[this.chainIndex],n=this.index+1;if(n<t+e){var r=this.structure.getResidueProxy(n);if(this.connectedTo(r))return r}else if(n===t+e){var i=this.structure.getResidueProxy(t);if(this.connectedTo(i))return i}},Zf.prototype.getPreviousConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.index-1;if(e>=t){var n=this.structure.getResidueProxy(e);if(n.connectedTo(this))return n}else if(e===t-1){var r=this.chainStore.residueCount[this.chainIndex],i=this.structure.getResidueProxy(t+r-1);if(i.connectedTo(this))return i}},Zf.prototype.getBonds=function(){return this.residueType.getBonds(this)},Zf.prototype.getRings=function(){return this.residueType.getRings()},Zf.prototype.qualifiedName=function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chain&&(e+=":"+this.chainname),e+="/"+this.modelIndex},Zf.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Zf.prototype.toObject=function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}},Object.defineProperties(Zf.prototype,Qf);var Jf=function(t,e,n){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueIndexStart=e,this.residueIndexEnd=n,this.residueCount=n-e+1;var r=this.structure.getResidueProxy(this.residueIndexStart),i=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==r.getPreviousConnectedResidue();var o=i.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=i.connectedTo(r),this.__residueProxy=this.structure.getResidueProxy()},tm={chainIndex:{},modelIndex:{},chainname:{}};tm.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndexStart]},tm.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},tm.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},Jf.prototype.isProtein=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},Jf.prototype.isCg=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},Jf.prototype.isNucleic=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},Jf.prototype.getMoleculeType=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},Jf.prototype.getBackboneType=function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},Jf.prototype.getAtomIndexByType=function(t,e){this.isCyclic?-1===t?t=this.residueCount-1:t===this.residueCount&&(t=0):(-1!==t||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var n,r=this.__residueProxy;switch(r.index=this.residueIndexStart+t,e){case"trace":n=r.traceAtomIndex;break;case"direction1":n=r.direction1AtomIndex;break;case"direction2":n=r.direction2AtomIndex;break;default:var i=r.getAtomByName(e);n=i?i.index:void 0}return n},Jf.prototype.eachAtom=function(t,e){this.eachResidue(function(n){n.eachAtom(t,e)},e)},Jf.prototype.eachAtomN=function(t,e,n){var r,i=this.residueCount,o=new Array(t);for(r=0;r<t;++r)o[r]=this.structure.getAtomProxy(this.getAtomIndexByType(r,n));e.apply(this,o);for(var a=t;a<i;++a){for(r=1;r<t;++r)o[r-1].index=o[r].index;o[t-1].index=this.getAtomIndexByType(a,n),e.apply(this,o)}},Jf.prototype.eachAtomN2=function(t,e,n){var r=this.atomOffset,i=this.atomCount,o=r+i;if(!(i<t)){for(var a=new Array(t),s=0;s<t;++s)a[s]=this.structure.getAtomProxy();var c=this.structure.atomSetCache["__"+n];void 0===c&&(el.warn("no precomputed atomSet for: "+n),c=this.structure.getAtomSet(!1),this.eachResidue(function(t){var e=t.getAtomByName(n);c.set(e.index)}));var u=0;c.forEach(function(n){if(n>=r&&n<o){for(var i=1;i<t;++i)a[i-1].index=a[i].index;a[t-1].index=n,(u+=1)>=t&&e.apply(this,a)}})}},Jf.prototype.eachResidue=function(t){for(var e=this.structure.getResidueProxy(),n=this.residueCount,r=this.residueIndexStart,i=0;i<n;++i)e.index=r+i,t(e)},Jf.prototype.qualifiedName=function(){var t=this.structure.getResidueProxy(this.residueIndexStart),e=this.structure.getResidueProxy(this.residueIndexEnd);return t.qualifiedName()+" - "+e.qualifiedName()},Object.defineProperties(Jf.prototype,tm);var em=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},nm={entity:{},model:{},entityIndex:{},modelIndex:{},residueOffset:{},residueCount:{},residueEnd:{},atomOffset:{},atomEnd:{},atomCount:{},chainname:{},chainid:{}};nm.entity.get=function(){return this.structure.entityList[this.entityIndex]},nm.model.get=function(){return this.structure.getModelProxy(this.modelIndex)},nm.entityIndex.get=function(){return this.chainStore.entityIndex[this.index]},nm.entityIndex.set=function(t){this.chainStore.entityIndex[this.index]=t},nm.modelIndex.get=function(){return this.chainStore.modelIndex[this.index]},nm.modelIndex.set=function(t){this.chainStore.modelIndex[this.index]=t},nm.residueOffset.get=function(){return this.chainStore.residueOffset[this.index]},nm.residueOffset.set=function(t){this.chainStore.residueOffset[this.index]=t},nm.residueCount.get=function(){return this.chainStore.residueCount[this.index]},nm.residueCount.set=function(t){this.chainStore.residueCount[this.index]=t},nm.residueEnd.get=function(){return this.residueOffset+this.residueCount-1},nm.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},nm.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},nm.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},nm.chainname.get=function(){return this.chainStore.getChainname(this.index)},nm.chainname.set=function(t){this.chainStore.setChainname(this.index,t)},nm.chainid.get=function(){return this.chainStore.getChainid(this.index)},nm.chainid.set=function(t){this.chainStore.setChainid(this.index,t)},em.prototype.eachAtom=function(t,e){this.eachResidue(function(n){n.eachAtom(t,e)},e)},em.prototype.eachResidue=function(t,e){var n,r=this.residueCount,i=this.residueOffset,o=this.structure._rp,a=i+r;if(e&&e.test){var s=e.residueOnlyTest;if(s)for(n=i;n<a;++n)o.index=n,s(o)&&t(o,e);else for(n=i;n<a;++n)o.index=n,t(o,e)}else for(n=i;n<a;++n)o.index=n,t(o)},em.prototype.eachResidueN=function(t,e){var n,r=this.residueCount,i=this.residueOffset,o=i+r;if(!(r<t)){var a=new Array(t);for(n=0;n<t;++n)a[n]=this.structure.getResidueProxy(i+n);e.apply(this,a);for(var s=i+t;s<o;++s){for(n=0;n<t;++n)a[n].index+=1;e.apply(this,a)}}},em.prototype.eachPolymer=function(t,e){for(var n,r,i=e?e.residueOnlyTest:void 0,o=this.model.structure,a=this.residueCount,s=this.residueOffset,c=s+a,u=this.structure.getResidueProxy(),l=this.structure.getResidueProxy(s),h=this.structure.getAtomProxy(),p=this.structure.getAtomProxy(),d=!0,f=s+1;f<c;++f){u.index=l.index,l.index=f,d&&(n=u.index,d=!1),r=l.index;var m=d?u.backboneEndType:u.backboneType,g=l.backboneType;m!==Jp&&m===g?(h.index=u.backboneEndAtomIndex,p.index=l.backboneStartAtomIndex,h&&p&&h.connectedTo(p)&&(!i||i(u)&&i(l))||(u.index-n>1&&t(new Jf(o,n,u.index)),n=r)):(m!==Jp&&u.index-n>1&&t(new Jf(o,n,u.index)),n=r)}r-n>1&&this.structure.getResidueProxy(n).backboneStartType&&t(new Jf(o,n,r))},em.prototype.qualifiedName=function(){return":"+this.chainname+"/"+this.modelIndex},em.prototype.clone=function(){return new this.constructor(this.structure,this.index)},em.prototype.toObject=function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}},Object.defineProperties(em.prototype,nm);var rm=function(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},im={chainOffset:{},chainCount:{},residueOffset:{},atomOffset:{},chainEnd:{},residueEnd:{},atomEnd:{},residueCount:{},atomCount:{}};im.chainOffset.get=function(){return this.modelStore.chainOffset[this.index]},im.chainOffset.set=function(t){this.modelStore.chainOffset[this.index]=t},im.chainCount.get=function(){return this.modelStore.chainCount[this.index]},im.chainCount.set=function(t){this.modelStore.chainCount[this.index]=t},im.residueOffset.get=function(){return this.chainStore.residueOffset[this.chainOffset]},im.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},im.chainEnd.get=function(){return this.chainOffset+this.chainCount-1},im.residueEnd.get=function(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},im.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},im.residueCount.get=function(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},im.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},rm.prototype.eachAtom=function(t,e){this.eachChain(function(n){n.eachAtom(t,e)},e)},rm.prototype.eachResidue=function(t,e){this.eachChain(function(n){n.eachResidue(t,e)},e)},rm.prototype.eachPolymer=function(t,e){if(e&&e.chainOnlyTest){var n=e.chainOnlyTest;this.eachChain(function(r){n(r)&&r.eachPolymer(t,e)})}else this.eachChain(function(n){n.eachPolymer(t,e)})},rm.prototype.eachChain=function(t,e){var n,r=this.chainCount,i=this.chainOffset,o=this.structure._cp,a=i+r;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(n=i;n<a;++n)o.index=n,s(o)&&t(o,e);else for(n=i;n<a;++n)o.index=n,t(o,e)}else for(n=i;n<a;++n)o.index=n,t(o)},rm.prototype.qualifiedName=function(){return"/"+this.index},rm.prototype.clone=function(){return new this.constructor(this.structure,this.index)},rm.prototype.toObject=function(){return{index:this.index,chainOffset:this.chainOffset,chainCount:this.chainCount}},Object.defineProperties(rm.prototype,im);var om=function(t,e){this.signals={refreshed:new Su},this.init(t,e)},am={type:{}};function sm(t,e){var n=[],r=!1;if(e){for(var i=0,o=e.length;i<o;++i)n.push(e[i]);a()}function a(){var e=n.shift();void 0!==e?(r=!0,setTimeout(function(){!function(e){t(e,a)}(e)})):r=!1}this.push=function(t){n.push(t),r||a()},this.kill=function(){n.length=0},this.length=function(){return n.length}}om.prototype.init=function(t,e){this.name=t,this.path=e,this.title="",this.id="",this.header={},this.extraData={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.validation=void 0,this.bondStore=new df(0),this.backboneBondStore=new df(0),this.rungBondStore=new df(0),this.atomStore=new ff(0),this.residueStore=new mf(0),this.chainStore=new gf(0),this.modelStore=new vf(0),this.atomMap=new Hf(this),this.residueMap=new Wf(this),this.bondHash=void 0,this.spatialHash=void 0,this.atomSet=void 0,this.bondSet=void 0,this.center=void 0,this.boundingBox=void 0,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy()},am.type.get=function(){return"Structure"},om.prototype.finalizeAtoms=function(){this.atomSet=this.getAtomSet(),this.atomCount=this.atomStore.count,this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),this.spatialHash=new Wd(this.atomStore,this.boundingBox)},om.prototype.finalizeBonds=function(){for(var t in this.bondSet=this.getBondSet(),this.bondCount=this.bondStore.count,this.bondHash=new function(t,e){nl&&el.time("BondHash init");for(var n=t.count,r=t.atomIndex1,i=t.atomIndex2,o=new Uint8Array(e),a=new Int32Array(e),s=0;s<n;++s)o[r[s]]+=1,o[i[s]]+=1;for(var c=1;c<e;++c)a[c]+=a[c-1]+o[c-1];for(var u=2*n,l=new Int32Array(u),h=0;h<u;++h)l[h]=-1;for(var p=0;p<n;++p){for(var d=r[p],f=i[p],m=a[d];-1!==l[m];)m+=1;l[m]=p;for(var g=a[f];-1!==l[g];)g+=1;l[g]=p}nl&&el.timeEnd("BondHash init"),this.countArray=o,this.offsetArray=a,this.indexArray=l}(this.bondStore,this.atomStore.count),this.atomSetCache={},this.atomSetDict.rung||(this.atomSetDict.rung=this.getAtomSet(!1)),this.atomSetDict)this.atomSetCache["__"+t]=this.atomSetDict[t].clone()},om.prototype.getBondProxy=function(t){return new qf(this,t)},om.prototype.getAtomProxy=function(t){return new Yf(this,t)},om.prototype.getResidueProxy=function(t){return new Zf(this,t)},om.prototype.getChainProxy=function(t){return new em(this,t)},om.prototype.getModelProxy=function(t){return new rm(this,t)},om.prototype.getBondSet=function(){var t=this.bondStore.count,e=new qp(t),n=this.atomSet;if(n)for(var r=this.getBondProxy(),i=0;i<t;++i)r.index=i,n.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index);else e.setAll();return e},om.prototype.getBackboneBondSet=function(){var t=this.backboneBondStore.count,e=new qp(t),n=this.atomSetCache.__backbone;if(n){var r=this.getBondProxy();r.bondStore=this.backboneBondStore;for(var i=0;i<t;++i)r.index=i,n.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},om.prototype.getRungBondSet=function(){var t=this.rungBondStore.count,e=new qp(t),n=this.atomSetCache.__rung;if(n){var r=this.getBondProxy();r.bondStore=this.rungBondStore;for(var i=0;i<t;++i)r.index=i,n.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},om.prototype.getAtomSet=function(t){var e,n=this.atomStore.count;if(t instanceof qp)e=t;else if(t&&t.test){var r=t.string;r in this.atomSetCache?e=this.atomSetCache[r]:(e=new qp(n),this.eachAtom(function(t){e.set(t.index)},t),this.atomSetCache[r]=e)}else e=!1===t?new qp(n):new qp(n,!0);return e},om.prototype.getAtomSetWithinSelection=function(t,e){var n=this.spatialHash,r=this.getAtomSet(!1),i=this.getAtomProxy();return this.getAtomSet(t).forEach(function(t){i.index=t,n.within(i.x,i.y,i.z,e).forEach(function(t){r.set(t)})}),r},om.prototype.getAtomSetWithinPoint=function(t,e){var n=t,r=this.getAtomSet(!1);return this.spatialHash.within(n.x,n.y,n.z,e).forEach(function(t){r.set(t)}),r},om.prototype.getAtomSetWithinVolume=function(t,e,n,r,i){for(var o=new uf(t,n,r,i),a=o.getDataPosition(),s=a.length,c=o.matrix.getMaxScaleOnAxis(),u=this.getAtomSet(!1),l=0;l<s;l+=3)this.spatialHash.within(a[l],a[l+1],a[l+2],c).forEach(function(t){u.set(t)});return u},om.prototype.getAtomSetWithinGroup=function(t){var e=this.atomStore.residueIndex,n=this.getAtomSet(!1),r=this.getResidueProxy();return this.getAtomSet(t).forEach(function(t){r.index=e[t];for(var i=r.atomOffset;i<=r.atomEnd;++i)n.set(i)}),n},om.prototype.getSelection=function(){return!1},om.prototype.getStructure=function(){return this},om.prototype.eachEntity=function(t,e){this.entityList.forEach(function(n){void 0!==e&&n.getEntityType()!==e||t(n)})},om.prototype.eachBond=function(t,e){var n,r=this.getBondProxy();if(e&&e.test&&(n=this.getBondSet(e),this.bondSet&&n.intersection(this.bondSet)),n)n.forEach(function(e){r.index=e,t(r)});else for(var i=this.bondStore.count,o=0;o<i;++o)r.index=o,t(r)},om.prototype.eachAtom=function(t,e){if(e&&e.test)this.eachModel(function(n){n.eachAtom(t,e)},e);else for(var n=this.atomStore.count,r=this.getAtomProxy(),i=0;i<n;++i)r.index=i,t(r)},om.prototype.eachResidue=function(t,e){var n;if(e&&e.test){var r=this.modelStore.count,i=this.getModelProxy(),o=e.modelOnlyTest;if(o)for(n=0;n<r;++n)i.index=n,o(i)&&i.eachResidue(t,e);else for(n=0;n<r;++n)i.index=n,i.eachResidue(t,e)}else{var a=this.residueStore.count,s=this.getResidueProxy();for(n=0;n<a;++n)s.index=n,t(s)}},om.prototype.eachResidueN=function(t,e){var n,r,i=this.residueStore.count;if(!(i<t)){var o=new Array(t);for(n=0;n<t;++n)o[n]=this.getResidueProxy(n);for(e.apply(this,o),r=t;r<i;++r){for(n=0;n<t;++n)o[n].index+=1;e.apply(this,o)}}},om.prototype.eachPolymer=function(t,e){if(e&&e.modelOnlyTest){var n=e.modelOnlyTest;this.eachModel(function(r){n(r)&&r.eachPolymer(t,e)})}else this.eachModel(function(n){n.eachPolymer(t,e)})},om.prototype.eachChain=function(t,e){if(e&&e.test)this.eachModel(function(n){n.eachChain(t,e)});else for(var n=this.chainStore.count,r=this.getChainProxy(),i=0;i<n;++i)r.index=i,t(r)},om.prototype.eachModel=function(t,e){var n,r=this.modelStore.count,i=this.getModelProxy();if(e&&e.test){var o=e.modelOnlyTest;if(o)for(n=0;n<r;++n)i.index=n,o(i)&&t(i,e);else for(n=0;n<r;++n)i.index=n,t(i,e)}else for(n=0;n<r;++n)i.index=n,t(i)},om.prototype.getAtomData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var n,r,i,o,a,s,c,u=e.what,l=gs(e.atomSet,this.atomSet),h={},p=this.getAtomProxy(),d=l.getSize();return u&&!u.position||(i=new Float32Array(3*d),h.position=i),u&&!u.color||(o=new Float32Array(3*d),h.color=o,r=ol.getScheme(e.colorParams)),u&&!u.picking||(a=new Float32Array(d),h.picking=new Rp(a,this.getStructure())),u&&!u.radius||(s=new Float32Array(d),h.radius=s,n=new Sd(e.radiusParams.radius,e.radiusParams.scale)),u&&!u.index||(c=new Float32Array(d),h.index=c),l.forEach(function(t,e){var u=3*e;p.index=t,i&&p.positionToArray(i,u),o&&r.atomColorToArray(p,o,u),a&&(a[e]=t),s&&(s[e]=n.atomRadius(p)),c&&(c[e]=t)}),h},om.prototype.getBondData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var n,r,i,o,a,s,c,u,l,h=e.what,p=gs(e.bondSet,this.bondSet),d=gs(e.multipleBond,"off"),f="off"!==d,m="offset"===d,g=gs(e.bondScale,.4),v=gs(e.bondSpacing,1),y={},b=this.getBondProxy();e.bondStore&&(b.bondStore=e.bondStore);var x,_=this.getAtomProxy(),w=this.getAtomProxy();if(f){var S=b.bondStore.bondOrder;x=0,p.forEach(function(t){x+=S[t]})}else x=p.getSize();h&&!h.position||(i=new Float32Array(3*x),o=new Float32Array(3*x),y.position1=i,y.position2=o),h&&!h.color||(a=new Float32Array(3*x),s=new Float32Array(3*x),y.color=a,y.color2=s,r=ol.getScheme(e.colorParams)),h&&!h.picking||(c=new Float32Array(x),y.picking=new Lp(c,this.getStructure(),e.bondStore)),(!h||h.radius||f&&h.position)&&(n=new Sd(e.radiusParams.radius,e.radiusParams.scale)),h&&!h.radius||(u=new Float32Array(x),y.radius=u,e.radius2&&(l=new Float32Array(x),y.radius2=l));var C,A,E,M,T,P,I,R=0,O=new Ne,L=new Ne,k=new Ne;return p.forEach(function(t){if(A=3*R,b.index=t,_.index=b.atomIndex1,w.index=b.atomIndex2,M=b.bondOrder,i&&(f&&M>1?(T=n.atomRadius(_),P=T*g/(.5*M),b.calculateShiftDir(k),m?(I=2*v*T,k.multiplyScalar(I),k.negate(),L.subVectors(w,_).multiplyScalar(Math.max(.1,I/1.88)),_.positionToArray(i,A),w.positionToArray(o,A),M>=2&&(O.addVectors(_,k).add(L).toArray(i,A+3),O.addVectors(w,k).sub(L).toArray(o,A+3),M>=3&&(O.subVectors(_,k).add(L).toArray(i,A+6),O.subVectors(w,k).sub(L).toArray(o,A+6)))):(I=(v-g)*T,k.multiplyScalar(I),2===M?(O.addVectors(_,k).toArray(i,A),O.subVectors(_,k).toArray(i,A+3),O.addVectors(w,k).toArray(o,A),O.subVectors(w,k).toArray(o,A+3)):3===M?(_.positionToArray(i,A),O.addVectors(_,k).toArray(i,A+3),O.subVectors(_,k).toArray(i,A+6),w.positionToArray(o,A),O.addVectors(w,k).toArray(o,A+3),O.subVectors(w,k).toArray(o,A+6)):(_.positionToArray(i,A),w.positionToArray(o,A)))):(_.positionToArray(i,A),w.positionToArray(o,A))),a&&(r.bondColorToArray(b,1,a,A),r.bondColorToArray(b,0,s,A),f&&M>1))for(C=1;C<M;++C)Zl(a,A,E=3*C+A,3),Zl(s,A,E,3);if(c&&(c[R]=t,f&&M>1))for(C=1;C<M;++C)c[R+C]=t;if(u&&(u[R]=n.atomRadius(_),f&&M>1))for(P=u[R]*g/(m?1:.5*M),C=m?1:0;C<M;++C)u[R+C]=P;if(l&&(l[R]=n.atomRadius(w),f&&M>1))for(P=l[R]*g/(m?1:.5*M),C=m?1:0;C<M;++C)l[R+C]=P;R+=f?M:1}),y},om.prototype.getBackboneAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__backbone},t),this.getAtomData(t)},om.prototype.getBackboneBondData=function(t){return t=Object.assign({bondSet:this.getBackboneBondSet(),bondStore:this.backboneBondStore},t),this.getBondData(t)},om.prototype.getRungAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__rung},t),this.getAtomData(t)},om.prototype.getRungBondData=function(t){return t=Object.assign({bondSet:this.getRungBondSet(),bondStore:this.rungBondStore},t),this.getBondData(t)},om.prototype.getBoundingBox=function(t,e){nl&&el.time("getBoundingBox"),e=e||new Hn;var n=1/0,r=1/0,i=1/0,o=-1/0,a=-1/0,s=-1/0;return this.eachAtom(function(t){var e=t.x,c=t.y,u=t.z;e<n&&(n=e),c<r&&(r=c),u<i&&(i=u),e>o&&(o=e),c>a&&(a=c),u>s&&(s=u)},t),e.min.set(n,r,i),e.max.set(o,a,s),nl&&el.timeEnd("getBoundingBox"),e},om.prototype.getPrincipalAxes=function(t){nl&&el.time("getPrincipalAxes");var e=0,n=new Cd(3,this.atomCount),r=n.data;return this.eachAtom(function(t){r[e+0]=t.x,r[e+1]=t.y,r[e+2]=t.z,e+=3},t),nl&&el.timeEnd("getPrincipalAxes"),new $d(n)},om.prototype.atomCenter=function(t){return t?this.getBoundingBox(t).getCenter():this.center.clone()},om.prototype.getSequence=function(t){var e=[],n=this.getResidueProxy();return this.eachAtom(function(t){n.index=t.residueIndex,t.index===n.traceAtomIndex&&e.push(n.getResname1())},t),e},om.prototype.getAtomIndices=function(t){var e;if(t&&t.string)e=[],this.eachAtom(function(t){e.push(t.index)},t);else{e=this.getAtomData({what:{index:!0}}).index}return e},om.prototype.getChainnameCount=function(t){var e=new Set;return this.eachChain(function(t){t.residueCount&&e.add(t.chainname)},t),e.size},om.prototype.updatePosition=function(t){var e=0;this.eachAtom(function(n){n.positionFromArray(t,e),e+=3})},om.prototype.refreshPosition=function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.getCenter(this.center),this.spatialHash=new Wd(this.atomStore,this.boundingBox)},om.prototype.dispose=function(){this.frames&&(this.frames.length=0),this.boxes&&(this.boxes.length=0),this.bondStore.dispose(),this.backboneBondStore.dispose(),this.rungBondStore.dispose(),this.atomStore.dispose(),this.residueStore.dispose(),this.chainStore.dispose(),this.modelStore.dispose(),delete this.bondStore,delete this.atomStore,delete this.residueStore,delete this.chainStore,delete this.modelStore,delete this.frames,delete this.boxes,delete this.cif,delete this.bondSet,delete this.atomSet},Object.defineProperties(om.prototype,am);var cm=function(t,e){var n;"function"==typeof t.eachAtom?n=t.atomCount:t instanceof Float32Array&&(n=t.length/3);var r=new Cd(3,n),i=new Cd(3,n);this.coords1t=new Cd(n,3),this.coords2t=new Cd(n,3),this.A=new Cd(3,3),this.W=new Cd(1,3),this.U=new Cd(3,3),this.V=new Cd(3,3),this.VH=new Cd(3,3),this.R=new Cd(3,3),this.tmp=new Cd(3,3),this.c=new Cd(3,3),this.c.data.set([1,0,0,0,1,0,0,0,-1]),this.prepCoords(t,r),this.prepCoords(e,i),this._superpose(r,i)};cm.prototype._superpose=function(t,e){var n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S;this.mean1=Td(t),this.mean2=Td(e),Pd(t,this.mean1),Pd(e,this.mean2),Ad(this.coords1t,t),Ad(this.coords2t,e),Ed(this.A,this.coords2t,this.coords1t),kd(this.A,this.W,this.U,this.V),n=this.V,r=this.VH,i=n.data,o=r.data,a=i[4],s=i[8],c=i[5],u=i[7],l=i[0],h=l*a,p=l*c,d=i[3],f=i[1],m=d*f,g=i[2],v=d*g,y=i[6],_=1/(h*s-p*u-m*s+v*u+(b=y*f)*c-(x=y*g)*a),o[0]=(a*s-c*u)*_,o[1]=-(f*s-g*u)*_,o[2]=-(-f*c+g*a)*_,o[3]=-(d*s-c*y)*_,o[4]=(l*s-x)*_,o[5]=-(p-v)*_,o[6]=-(-d*u+a*y)*_,o[7]=-(l*u-b)*_,o[8]=(h-m)*_,Md(this.R,this.U,this.VH),w=this.R,(S=w.data)[0]*S[4]*S[8]-S[0]*S[5]*S[7]-S[3]*S[1]*S[8]+S[3]*S[2]*S[7]+S[6]*S[1]*S[5]-S[6]*S[2]*S[4]<0&&(nl&&el.log("R not a right handed system"),Md(this.tmp,this.c,this.VH),Md(this.R,this.U,this.tmp))},cm.prototype.prepCoords=function(t,e){var n=0,r=e.data;"function"==typeof t.eachAtom?t.eachAtom(function(t){r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z,n+=3}):t instanceof Float32Array?r.set(t):el.warn("prepCoords: input type unknown")},cm.prototype.transform=function(t){var e;"function"==typeof t.eachAtom?e=t.atomCount:t instanceof Float32Array&&(e=t.length/3);var n=new Cd(3,e),r=new Cd(e,3);this.prepCoords(t,n),Pd(n,this.mean1),Ed(r,this.R,n),Ad(n,r),function(t,e){var n,r,i=0,o=t.rows,a=t.cols,s=t.data;for(n=0;n<o;++n)for(r=0;r<a;++r,++i)s[i]+=e[r]}(n,this.mean2);var i=0,o=n.data;"function"==typeof t.eachAtom?t.eachAtom(function(t){t.x=o[i+0],t.y=o[i+1],t.z=o[i+2],i+=3}):t instanceof Float32Array?t.set(o.subarray(0,3*e)):el.warn("transform: input type unknown")};var um=function(t,e){this.signals={startedRunning:new Su,haltedRunning:new Su};var n=Object.assign({},e);t.signals.playerChanged.add(function(t){t!==this&&this.pause()},this);var r=gs(t.numframes,1);this.traj=t,this.start=gs(n.start,0),this.end=Math.min(gs(n.end,r-1),r-1),this.step=gs(n.step,Math.ceil((r+1)/100)),this.timeout=gs(n.timeout,50),this.interpolateType=gs(n.interpolateType,""),this.interpolateStep=gs(n.interpolateStep,5),this.mode=gs(n.mode,"loop"),this.direction=gs(n.direction,"forward"),this._stopFlag=!1,this._running=!1,t.signals.gotNumframes.add(function(t){this.end=Math.min(gs(n.end,t-1),t-1)},this)};um.prototype._animate=function(){var t,e,n,r;(this._running=!0,this.traj.inProgress||this._stopFlag||(((t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step)>=this.end||t<this.start)&&("once"===this.mode?(this.pause(),t="forward"===this.direction?this.end:this.start):t="forward"===this.direction?this.start:this.end),this.interpolateType||this.traj.setFrame(t)),this._stopFlag)?this._running=!1:!this.traj.inProgress&&this.interpolateType?("forward"===this.direction?(e=Math.max(this.start,t-this.step),n=Math.max(this.start,t-2*this.step),r=Math.max(this.start,t-3*this.step)):(e=Math.min(this.end,t+this.step),n=Math.min(this.end,t+2*this.step),r=Math.min(this.end,t+3*this.step)),this._interpolate(t,e,n,r,1/this.interpolateStep,0)):setTimeout(this._animate.bind(this),this.timeout)},um.prototype._interpolate=function(t,e,n,r,i,o){if((o+=i)<=1){var a=Math.round(this.timeout*i);this.traj.setFrameInterpolated(t,e,n,r,o,this.interpolateType,function(){setTimeout(function(){this._interpolate(t,e,n,r,i,o)}.bind(this),a)}.bind(this))}else setTimeout(this._animate.bind(this),0)},um.prototype.toggle=function(){this._running?this.pause():this.play()},um.prototype.play=function(){if(!this._running){this.traj.player!==this&&this.traj.setPlayer(this);var t=this.traj.currentFrame,e=Math.ceil(t/this.step)*this.step;"forward"===this.direction&&t>=this.end?e=this.start:"backward"===this.direction&&t<=this.start&&(e=this.end),this.traj.setFrame(e),this._stopFlag=!1,this._animate(),this.signals.startedRunning.dispatch()}},um.prototype.pause=function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},um.prototype.stop=function(){this.traj.setFrame(this.start),this.pause()};var lm=function(t,e,n){this.signals={gotNumframes:new Su,frameChanged:new Su,selectionChanged:new Su,playerChanged:new Su};var r=n||{};r.centerPbc=gs(r.centerPbc,!0),r.removePbc=gs(r.removePbc,!0),r.superpose=gs(r.superpose,!0),this.setParameters(r),this.name=t.replace(/^.*[\\/]/,""),this.selection=new Hu(gs(r.sele,"backbone and not hydrogen")),this.selection.signals.stringChanged.add(function(){this.makeIndices(),this.resetCache()},this),this.setStructure(e),this.setPlayer(new um(this)),this.trajPath=t,this.numframes=void 0,this.getNumframes()};function hm(t){return"front"===t?E:"back"===t?M:T}lm.prototype.setStructure=function(t){this.structure=t,this.atomCount=t.atomCount,this.makeAtomIndices(),this.saveInitialStructure(),this.backboneIndices=this.getIndices(new Hu("backbone and not hydrogen")),this.makeIndices(),this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.currentFrame=-1},lm.prototype.saveInitialStructure=function(){var t=0,e=new Float32Array(3*this.atomCount);this.structure.eachAtom(function(n){e[t+0]=n.x,e[t+1]=n.y,e[t+2]=n.z,t+=3}),this.initialStructure=e},lm.prototype.setSelection=function(t){return this.selection.setString(t),this},lm.prototype.getIndices=function(t){var e;if(t&&t.test){var n=0,r=t.test;e=[],this.structure.eachAtom(function(t){r(t)&&e.push(n),n+=1})}else e=this.structure.getAtomIndices(this.selection);return e},lm.prototype.makeIndices=function(){var t,e;this.indices=this.getIndices(this.selection);var n=3*this.indices.length;this.coords1=new Float32Array(n),this.coords2=new Float32Array(n);var r=this.initialStructure,i=this.coords2;for(t=0;t<n;t+=3)e=3*this.indices[t/3],i[t+0]=r[e+0],i[t+1]=r[e+1],i[t+2]=r[e+2]},lm.prototype.makeAtomIndices=function(){el.error("Trajectory.makeAtomIndices not implemented")},lm.prototype.getNumframes=function(){el.error("Trajectory.loadFrame not implemented")},lm.prototype.resetCache=function(){return this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.setFrame(this.currentFrame),this},lm.prototype.setParameters=function(t){var e=t,n=!1;void 0!==e.centerPbc&&e.centerPbc!==this.centerPbc&&(this.centerPbc=e.centerPbc,n=!0),void 0!==e.removePbc&&e.removePbc!==this.removePbc&&(this.removePbc=e.removePbc,n=!0),void 0!==e.superpose&&e.superpose!==this.superpose&&(this.superpose=e.superpose,n=!0),n&&this.resetCache()},lm.prototype.setFrame=function(t,e){return void 0===t?this:(this.inProgress=!0,-1===(t=parseInt(t))||this.frameCache[t]?this.updateStructure(t,e):this.loadFrame(t,function(){this.updateStructure(t,e)}.bind(this)),this)},lm.prototype.interpolate=function(t,e,n,r,i,o,a){var s,c=this.frameCache,u=c[t],l=c[e],h=c[n],p=c[r],d=u.length,f=new Float32Array(d);if("spline"===o)for(s=0;s<d;s+=3)f[s+0]=gu(p[s+0],h[s+0],l[s+0],u[s+0],i,1),f[s+1]=gu(p[s+1],h[s+1],l[s+1],u[s+1],i,1),f[s+2]=gu(p[s+2],h[s+2],l[s+2],u[s+2],i,1);else for(s=0;s<d;s+=3)f[s+0]=mu(l[s+0],u[s+0],i),f[s+1]=mu(l[s+1],u[s+1],i),f[s+2]=mu(l[s+2],u[s+2],i);this.structure.updatePosition(f),this.currentFrame=t,this.signals.frameChanged.dispatch(t),"function"==typeof a&&a()},lm.prototype.setFrameInterpolated=function(t,e,n,r,i,o,a){if(void 0===t)return this;var s=this.frameCache,c=[];return s[r]||c.push(r),s[n]||c.push(n),s[e]||c.push(e),s[t]||c.push(t),c.length?this.loadFrame(c,function(){this.interpolate(t,e,n,r,i,o,a)}.bind(this)):this.interpolate(t,e,n,r,i,o,a),this},lm.prototype.loadFrame=function(t,e){if(Array.isArray(t)){var n,r=function(t,r){this._loadFrame(t,r),0===n.length()&&"function"==typeof e&&e()}.bind(this);n=new sm(r,t)}else this._loadFrame(t,e)},lm.prototype._loadFrame=function(t,e){el.error("Trajectory._loadFrame not implemented",t,e)},lm.prototype.updateStructure=function(t,e){this._disposed||(-1===t?this.structure.updatePosition(this.initialStructure):this.structure.updatePosition(this.frameCache[t]),this.structure.trajectory={name:this.trajPath,frame:t},"function"==typeof e&&e(),this.currentFrame=t,this.inProgress=!1,this.signals.frameChanged.dispatch(t))},lm.prototype.getCircularMean=function(t,e,n){return[Hl(e,n[0],3,0,t),Hl(e,n[1],3,1,t),Hl(e,n[2],3,2,t)]},lm.prototype.doSuperpose=function(t){var e,n,r=3*this.indices.length,i=this.coords1,o=this.coords2;for(e=0;e<r;e+=3)n=3*this.indices[e/3],i[e+0]=t[n+0],i[e+1]=t[n+1],i[e+2]=t[n+2];new cm(i,o).transform(t)},lm.prototype.process=function(t,e,n,r){if(this.setNumframes(r),e){if(this.backboneIndices.length>0&&this.centerPbc){var i=[e[0],e[4],e[8]];!function(t,e,n){if(0!==n[0]&&0!==n[8]&&0!==n[4]){var r,i=t.length,o=n[0],a=n[1],s=n[2],c=-e[0]+o+o/2,u=-e[1]+a+a/2,l=-e[2]+s+s/2;for(r=0;r<i;r+=3)t[r+0]=(t[r+0]+c)%o,t[r+1]=(t[r+1]+u)%a,t[r+2]=(t[r+2]+l)%s}}(n,this.getCircularMean(this.backboneIndices,n,i),i)}this.removePbc&&function(t,e){if(0!==e[0]&&0!==e[8]&&0!==e[4]){var n,r,i,o,a=t.length;for(n=3;n<a;n+=3)for(r=0;r<3;++r)if(o=t[n+r]-t[n-3+r],Math.abs(o)>.9*e[3*r+r])if(o>0)for(i=0;i<3;++i)t[n+i]-=e[3*r+i];else for(i=0;i<3;++i)t[n+i]+=e[3*r+i]}}(n,e)}this.indices.length>0&&this.superpose&&this.doSuperpose(n),this.frameCache[t]=n,this.boxCache[t]=e,this.frameCacheSize+=1},lm.prototype.setNumframes=function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},lm.prototype.dispose=function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},lm.prototype.setPlayer=function(t){this.player=t,this.signals.playerChanged.dispatch(t)},lm.prototype.getPath=function(t,e){el.error("Trajectory.getPath not implemented",t,e)},ul.add("shader/Mesh.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#elif defined( NOLIGHT )\nvColor = color;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),ul.add("shader/Mesh.frag","#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\nif( opacity < 0.7 )\ndiscard;\ngl_FragColor = vec4( vPickingColor, objectId );\n#elif defined( NOLIGHT )\ngl_FragColor = vec4( vColor, opacity );\n#else\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\n#include dull_interior_fragment\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#include opaque_back_fragment\n#endif\n}");var pm={f:1,v2:2,v3:3,c:3};function dm(t,e){t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0}var fm=function(t,e){var n=t||{},r=e||{};this.opaqueBack=gs(r.opaqueBack,!1),this.dullInterior=gs(r.dullInterior,!1),this.side=gs(r.side,"double"),this.opacity=gs(r.opacity,1),this.depthWrite=gs(r.depthWrite,!0),this.clipNear=gs(r.clipNear,0),this.clipRadius=gs(r.clipRadius,0),this.clipCenter=gs(r.clipCenter,new Ne),this.flatShaded=gs(r.flatShaded,!1),this.background=gs(r.background,!1),this.linewidth=gs(r.linewidth,1),this.wireframe=gs(r.wireframe,!1),this.wireframeLinewidth=gs(r.wireframeLinewidth,1),this.roughness=gs(r.roughness,.4),this.metalness=gs(r.metalness,0),this.diffuse=gs(r.diffuse,16777215),this.forceTransparent=gs(r.forceTransparent,!1),this.disablePicking=gs(r.disablePicking,!1),this.geometry=new Cr,this.indexVersion=0,this.wireframeIndexVersion=-1,this.uniforms=Tn.merge([Mn.common,{fogColor:{value:null},fogNear:{value:0},fogFar:{value:0},opacity:{value:this.opacity},nearClip:{value:0},clipRadius:{value:this.clipRadius},clipCenter:{value:this.clipCenter}},{emissive:{value:new En(0)},roughness:{value:this.roughness},metalness:{value:this.metalness}},Mn.ambient,Mn.lights]),this.uniforms.diffuse.value.set(this.diffuse),this.pickingUniforms={nearClip:{value:0},objectId:{value:0},opacity:{value:this.opacity}},this.group=new yi,this.wireframeGroup=new yi,this.pickingGroup=new yi,this.matrix=gs(r.matrix,new De);var i=n.position||n.position1;this._positionDataSize=i?i.length/3:0,this.addAttributes({position:{type:"v3",value:n.position},color:{type:"c",value:n.color},primitiveId:{type:"f",value:n.primitiveId}}),n.index&&this.initIndex(n.index),this.picking=n.picking,this.makeWireframeGeometry()},mm={parameters:{},matrix:{},transparent:{},size:{},attributeSize:{},pickable:{},dynamic:{},vertexShader:{},fragmentShader:{}};mm.parameters.get=function(){return{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},depthWrite:{property:!0},clipNear:{updateShader:!0,property:!0},clipRadius:{updateShader:!0,property:!0,uniform:!0},clipCenter:{uniform:!0},flatShaded:{updateShader:!0},background:{updateShader:!0},linewidth:{property:!0},wireframe:{updateVisibility:!0},roughness:{uniform:!0},metalness:{uniform:!0},diffuse:{uniform:!0},matrix:{}}},mm.matrix.set=function(t){this.setMatrix(t)},mm.matrix.get=function(){return this.group.matrix.clone()},mm.transparent.get=function(){return this.opacity<1||this.forceTransparent},mm.size.get=function(){return this._positionDataSize},mm.attributeSize.get=function(){return this.size},mm.pickable.get=function(){return!!this.picking&&!this.disablePicking},mm.dynamic.get=function(){return!0},mm.vertexShader.get=function(){},mm.fragmentShader.get=function(){},fm.prototype.setMatrix=function(t){dm(this.group,t),dm(this.wireframeGroup,t),dm(this.pickingGroup,t)},fm.prototype.initIndex=function(t){this.geometry.setIndex(new yr(t,1)),this.geometry.getIndex().setDynamic(this.dynamic)},fm.prototype.makeMaterial=function(){var t=hm(this.side),e=new Gn({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!0,fog:!0,side:t,linewidth:this.linewidth});e.vertexColors=L,e.extensions.derivatives=this.flatShaded,e.extensions.fragDepth=this.isImpostor,e.clipNear=this.clipNear;var n=new Gn({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!1,fog:!0,side:t,linewidth:this.linewidth});n.vertexColors=L,n.clipNear=this.clipNear;var r=new Gn({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:this.depthWrite,lights:!1,fog:!1,side:t,linewidth:this.linewidth,blending:k});r.vertexColors=L,r.extensions.fragDepth=this.isImpostor,r.clipNear=this.clipNear,this.material=e,this.wireframeMaterial=n,this.pickingMaterial=r,this.updateShader()},fm.prototype.makeWireframeGeometry=function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,n=new Cr;n.attributes=t.attributes,e&&(n.setIndex(new yr(e,1).setDynamic(this.dynamic)),n.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=n},fm.prototype.makeWireframeIndex=function(){var t=[];function e(e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];return void 0===i?(t[e]=[n],!0):!i.includes(n)&&(i.push(n),!0)}var n=this.geometry,r=n.index;if(this.wireframe)if(r){var i,o=r.array,a=o.length;if(n.drawRange.count!==1/0&&(a=n.drawRange.count),this.wireframeIndex&&this.wireframeIndex.length>2*a)i=this.wireframeIndex;else i=Es(2*a,n.attributes.position.count);var s=0;t.length=0;for(var c=0;c<a;c+=3){var u=o[c+0],l=o[c+1],h=o[c+2];e(u,l)&&(i[s+0]=u,i[s+1]=l,s+=2),e(l,h)&&(i[s+0]=l,i[s+1]=h,s+=2),e(h,u)&&(i[s+0]=h,i[s+1]=u,s+=2)}this.wireframeIndex=i,this.wireframeIndexCount=s,this.wireframeIndexVersion=this.indexVersion}else{var p,d=n.attributes.position.count;p=this.wireframeIndex&&this.wireframeIndex.length>2*d?this.wireframeIndex:Es(2*d,d);for(var f=0,m=0;f<d;f+=3)p[m+0]=f,p[m+1]=f+1,p[m+2]=f+1,p[m+3]=f+2,p[m+4]=f+2,p[m+5]=f,m+=6;this.wireframeIndex=p,this.wireframeIndexCount=2*d,this.wireframeIndexVersion=this.indexVersion}else this.wireframeIndex=new Uint16Array(0),this.wireframeIndexCount=0},fm.prototype.updateWireframeIndex=function(){if(this.wireframeGeometry.setDrawRange(0,1/0),this.wireframeIndexVersion<this.indexVersion&&this.makeWireframeIndex(),this.wireframeIndex.length>this.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new yr(this.wireframeIndex,1).setDynamic(this.dynamic));else{var t=this.wireframeGeometry.getIndex();t.set(this.wireframeIndex),t.needsUpdate=this.wireframeIndexCount>0,t.updateRange.count=this.wireframeIndexCount}this.wireframeGeometry.setDrawRange(0,this.wireframeIndexCount)},fm.prototype.getRenderOrder=function(){var t=0;return this.isText?t=1:this.transparent&&(t=this.isSurface?3:2),t},fm.prototype._getMesh=function(t){this.material||this.makeMaterial();var e,n=this.geometry,r=this[t];return this.isLine?e=new fi(n,r):this.isPoint?(e=new vi(n,r),this.sortParticles&&(e.sortParticles=!0)):e=new Lr(n,r),e.frustumCulled=!1,e.renderOrder=this.getRenderOrder(),e},fm.prototype.getMesh=function(){return this._getMesh("material")},fm.prototype.getWireframeMesh=function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),(t=new fi(this.wireframeGeometry,this.wireframeMaterial)).frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},fm.prototype.getPickingMesh=function(){return this._getMesh("pickingMaterial")},fm.prototype.getShader=function(t,e){return Nl(t,this.getDefines(e))},fm.prototype.getVertexShader=function(t){return this.getShader(this.vertexShader,t)},fm.prototype.getFragmentShader=function(t){return this.getShader(this.fragmentShader,t)},fm.prototype.getDefines=function(t){var e={};return this.clipNear&&(e.NEAR_CLIP=1),this.clipRadius&&(e.RADIUS_CLIP=1),"picking"===t?e.PICKING=1:(("background"===t||this.background)&&(e.NOLIGHT=1),this.flatShaded&&(e.FLAT_SHADED=1),this.opaqueBack&&(e.OPAQUE_BACK=1),this.dullInterior&&(e.DULL_INTERIOR=1)),e},fm.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},fm.prototype.addUniforms=function(t){this.uniforms=Tn.merge([this.uniforms,t]),this.pickingUniforms=Tn.merge([this.pickingUniforms,t])},fm.prototype.addAttributes=function(t){for(var e in t){var n=void 0,r=t[e],i=this.attributeSize*pm[r.type];r.value?(i!==r.value.length&&el.error("attribute value has wrong length",e),n=r.value):n=As("float32",i),this.geometry.addAttribute(e,new yr(n,pm[r.type]).setDynamic(this.dynamic))}},fm.prototype.updateRenderOrder=function(){var t=this.getRenderOrder();function e(e){e.renderOrder=t}this.group.children.forEach(e),this.pickingGroup&&this.pickingGroup.children.forEach(e)},fm.prototype.updateShader=function(){var t=this.material,e=this.wireframeMaterial,n=this.pickingMaterial;t.vertexShader=this.getVertexShader(),t.fragmentShader=this.getFragmentShader(),t.needsUpdate=!0,e.vertexShader=this.getShader("Line.vert"),e.fragmentShader=this.getShader("Line.frag"),e.needsUpdate=!0,n.vertexShader=this.getVertexShader("picking"),n.fragmentShader=this.getFragmentShader("picking"),n.needsUpdate=!0},fm.prototype.setParameters=function(t){if(t){var e=t,n=this.parameters,r={},i={},o=!1,a=!1;for(var s in e){var c=e[s];void 0!==c&&(void 0!==n[s]&&(this[s]=c,n[s].property&&(!0!==n[s].property?r[n[s].property]=c:r[s]=c),n[s].uniform&&(!0!==n[s].uniform?i[n[s].uniform]=c:i[s]=c),n[s].updateShader&&(o=!0),n[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&!0===c&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(r.transparent=this.transparent)))}this.setProperties(r),this.setUniforms(i),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},fm.prototype.setAttributes=function(t){var e=this.geometry,n=e.attributes;for(var r in t)if("picking"!==r){var i=t[r],o=i.length;if("index"===r){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new yr(i,1).setDynamic(this.dynamic)):(a.set(i),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=n[r];o>s.array.length?e.addAttribute(r,new yr(i,s.itemSize).setDynamic(this.dynamic)):(n[r].set(i),n[r].needsUpdate=o>0,n[r].updateRange.count=o)}}},fm.prototype.setUniforms=function(t){if(t){var e=this.material.uniforms,n=this.wireframeMaterial.uniforms,r=this.pickingMaterial.uniforms;for(var i in t)"opacity"===i&&this.setProperties({transparent:this.transparent}),void 0!==e[i]&&(e[i].value.isVector3?e[i].value.copy(t[i]):e[i].value.set?e[i].value.set(t[i]):e[i].value=t[i]),void 0!==n[i]&&(n[i].value.isVector3?n[i].value.copy(t[i]):n[i].value.set?n[i].value.set(t[i]):n[i].value=t[i]),void 0!==r[i]&&(r[i].value.isVector3?r[i].value.copy(t[i]):r[i].value.set?r[i].value.set(t[i]):r[i].value=t[i])}},fm.prototype.setProperties=function(t){if(t){var e=this.material,n=this.wireframeMaterial,r=this.pickingMaterial;for(var i in t){var o=t[i];"transparent"===i?this.updateRenderOrder():"side"===i&&(o=hm(o)),void 0!==e[i]&&(e[i]=o),void 0!==n[i]&&(n[i]=o),void 0!==r[i]&&(r[i]=o)}e.needsUpdate=!0,n.needsUpdate=!0,r.needsUpdate=!0}},fm.prototype.setVisibility=function(t){this.visible=t,this.wireframe?(this.group.visible=!1,this.wireframeGroup.visible=t,this.pickable&&(this.pickingGroup.visible=!1)):(this.group.visible=t,this.wireframeGroup.visible=!1,this.pickable&&(this.pickingGroup.visible=t))},fm.prototype.dispose=function(){this.material&&this.material.dispose(),this.wireframeMaterial&&this.wireframeMaterial.dispose(),this.pickingMaterial&&this.pickingMaterial.dispose(),this.geometry.dispose(),this.wireframeGeometry&&this.wireframeGeometry.dispose()},Object.defineProperties(fm.prototype,mm);var gm=function(t){function e(e,n){var r=e||{};!r.primitiveId&&r.position&&(r.primitiveId=Xl(r.position.length/3)),t.call(this,r,n),this.addAttributes({normal:{type:"v3",value:r.normal}}),void 0===r.normal&&this.geometry.computeVertexNormals()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={vertexShader:{},fragmentShader:{}};return n.vertexShader.get=function(){return"Mesh.vert"},n.fragmentShader.get=function(){return"Mesh.frag"},Object.defineProperties(e.prototype,n),e}(fm),vm=new De,ym=new Wn,bm=function(t){function e(e,n,r){var i,o=e||{},a=n||{},s=r.attributes.position.array,c=r.attributes.normal.array,u=r.index?r.index.array:void 0,l=o.position.length/3,h=s.length/3,p=l*h,d=new Float32Array(3*p),f=new Float32Array(3*p),m=new Float32Array(3*p);u&&(i=Es(l*u.length,p)),t.call(this,{position:d,color:m,index:i,normal:f,primitiveId:o.primitiveId||Yl(l,h),picking:o.picking},a),this.setAttributes(o),this.geoPosition=s,this.geoNormal=c,this.geoIndex=u,this.positionCount=l,this.geoPositionCount=h,this.transformedGeoPosition=new Float32Array(3*h),this.transformedGeoNormal=new Float32Array(3*h),this.meshPosition=d,this.meshColor=m,this.meshIndex=i,this.meshNormal=f,this.meshIndex=i,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={updateNormals:{}};return e.prototype.applyPositionTransform=function(){},e.prototype.setAttributes=function(t,e){var n,r,i,o,a,s,c,u,l,h=this.geometry.attributes,p=this.updateNormals;t.position&&(n=t.position,i=this.geoPosition,c=this.meshPosition,a=this.transformedGeoPosition,h.position.needsUpdate=!0,(p||e)&&(o=this.geoNormal,l=this.meshNormal,s=this.transformedGeoNormal,h.normal.needsUpdate=!0)),t.color&&(r=t.color,u=this.meshColor,h.color.needsUpdate=!0);for(var d=this.positionCount,f=this.geoPositionCount,m=0;m<d;++m){var g=void 0,v=void 0,y=m*f*3,b=3*m;if(n&&(a.set(i),vm.makeTranslation(n[b],n[b+1],n[b+2]),this.applyPositionTransform(vm,m,b),hp(vm.elements,a),c.set(a,y),p?(s.set(o),ym.getNormalMatrix(vm),pp(ym.elements,s),l.set(s,y)):e&&l.set(o,y)),r)for(g=0;g<f;++g)u[v=y+3*g]=r[b],u[v+1]=r[b+1],u[v+2]=r[b+2]}},e.prototype.makeIndex=function(){var t=this.geoIndex,e=this.meshIndex;if(t)for(var n=this.positionCount,r=this.geoPositionCount,i=3*(t.length/3),o=0;o<n;++o){var a=o*i,s=a+i;e.set(t,a);for(var c=a;c<s;++c)e[c]+=o*r}},n.updateNormals.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(gm),xm=new Ne,_m=function(t){function e(e,n){var r=n||{},i=new Ri(1,gs(r.sphereDetail,1));t.call(this,e,r,i),this.setAttributes(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyPositionTransform=function(t,e){var n=this._radius[e];xm.set(n,n,n),t.scale(xm)},e.prototype.setAttributes=function(e,n){e.radius&&(this._radius=e.radius),t.prototype.setAttributes.call(this,e,n)},e}(bm);ul.add("shader/SphereImpostor.vert","uniform mat4 projectionMatrixInverse;\nuniform float nearClip;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\nattribute vec2 mapping;\nattribute float radius;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include matrix_scale\nconst mat4 D = mat4(\n1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\n0.0, 0.0, 0.0, -1.0\n);\nmat4 transpose( in mat4 inMatrix ) {\nvec4 i0 = inMatrix[0];\nvec4 i1 = inMatrix[1];\nvec4 i2 = inMatrix[2];\nvec4 i3 = inMatrix[3];\nmat4 outMatrix = mat4(\nvec4(i0.x, i1.x, i2.x, i3.x),\nvec4(i0.y, i1.y, i2.y, i3.y),\nvec4(i0.z, i1.z, i2.z, i3.z),\nvec4(i0.w, i1.w, i2.w, i3.w)\n);\nreturn outMatrix;\n}\nvoid ComputePointSizeAndPositionInClipCoordSphere(){\nvec2 xbc;\nvec2 ybc;\nmat4 T = mat4(\nradius, 0.0, 0.0, 0.0,\n0.0, radius, 0.0, 0.0,\n0.0, 0.0, radius, 0.0,\nposition.x, position.y, position.z, 1.0\n);\nmat4 R = transpose( projectionMatrix * modelViewMatrix * T );\nfloat A = dot( R[ 3 ], D * R[ 3 ] );\nfloat B = -2.0 * dot( R[ 0 ], D * R[ 3 ] );\nfloat C = dot( R[ 0 ], D * R[ 0 ] );\nxbc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nxbc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sx = abs( xbc[ 0 ] - xbc[ 1 ] ) * 0.5;\nA = dot( R[ 3 ], D * R[ 3 ] );\nB = -2.0 * dot( R[ 1 ], D * R[ 3 ] );\nC = dot( R[ 1 ], D * R[ 1 ] );\nybc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nybc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sy = abs( ybc[ 0 ] - ybc[ 1 ] ) * 0.5;\ngl_Position.xy = vec2( 0.5 * ( xbc.x + xbc.y ), 0.5 * ( ybc.x + ybc.y ) );\ngl_Position.xy -= mapping * vec2( sx, sy );\ngl_Position.xy *= gl_Position.w;\n}\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\nvRadius = radius * matrixScale( modelViewMatrix );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nmvPosition.z -= vRadius;\ngl_Position = projectionMatrix * vec4( mvPosition.xyz, 1.0 );\nComputePointSizeAndPositionInClipCoordSphere();\nvRadiusSq = vRadius * vRadius;\nvec4 vPoint4 = projectionMatrixInverse * gl_Position;\nvPoint = vPoint4.xyz / vPoint4.w;\nvPointViewPosition = -mvPosition.xyz / mvPosition.w;\n}"),ul.add("shader/SphereImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform mat4 projectionMatrix;\nuniform float ortho;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool flag2 = false;\nbool interior = false;\nvec3 cameraPos;\nvec3 cameraNormal;\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nbool Impostor( out vec3 cameraPos, out vec3 cameraNormal ){\nvec3 cameraSpherePos = -vPointViewPosition;\ncameraSpherePos.z += vRadius;\nvec3 rayOrigin = mix( vec3( 0.0, 0.0, 0.0 ), vPoint, ortho );\nvec3 rayDirection = mix( normalize( vPoint ), vec3( 0.0, 0.0, 1.0 ), ortho );\nvec3 cameraSphereDir = mix( cameraSpherePos, rayOrigin - cameraSpherePos, ortho );\nfloat B = dot( rayDirection, cameraSphereDir );\nfloat det = B * B + vRadiusSq - dot( cameraSphereDir, cameraSphereDir );\nif( det < 0.0 ){\ndiscard;\nreturn false;\n}else{\nfloat sqrtDet = sqrt( det );\nfloat posT = mix( B + sqrtDet, B + sqrtDet, ortho );\nfloat negT = mix( B - sqrtDet, sqrtDet - B, ortho );\ncameraPos = rayDirection * negT + rayOrigin;\n#ifdef NEAR_CLIP\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else if( calcClip( cameraPos ) > 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nflag2 = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#else\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#endif\nreturn true;\n}\nreturn false;\n}\nvoid main(void){\nbool flag = Impostor( cameraPos, cameraNormal );\n#ifdef NEAR_CLIP\nif( calcClip( cameraPos ) > 0.0 )\ndiscard;\n#endif\ngl_FragDepthEXT = calcDepth( cameraPos );\nif( !flag ){\n#ifdef NEAR_CLIP\nif( flag2 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}else if( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#else\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#endif\n}\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vNormal = cameraNormal;\nvec3 vViewPosition = -cameraPos;\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var wm=function(t){function e(e,n){t.call(this,e,n),this.index=Es(this.indexSize,this.attributeSize),this.makeIndex(),this.initIndex(this.index,1),this.addAttributes({mapping:{type:this.mappingType,value:null}}),this.setAttributes({primitiveId:Xl(this.size)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={attributeSize:{},indexSize:{},mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return n.attributeSize.get=function(){return this.size*this.mappingSize},n.indexSize.get=function(){return this.size*this.mappingIndicesSize},n.mapping.get=function(){},n.mappingIndices.get=function(){},n.mappingIndicesSize.get=function(){},n.mappingType.get=function(){},n.mappingSize.get=function(){},n.mappingItemSize.get=function(){},e.prototype.addAttributes=function(e){var n={};for(var r in e){var i=e[r];n[r]={type:i.type,value:null}}t.prototype.addAttributes.call(this,n)},e.prototype.getAttributeIndex=function(t){return 3*t*this.mappingSize},e.prototype.setAttributes=function(t){t&&!t.position&&t.position1&&t.position2&&(t.position=$l(t.position1,t.position2));var e,n,r,i,o,a,s,c=this.size,u=this.mappingSize,l=this.geometry.attributes;for(var h in t)if("index"!==h&&"picking"!==h){n=t[h],r=(e=l[h]).itemSize,i=e.array;for(var p=0;p<c;++p){a=(o=p*r)*u;for(var d=0;d<u;++d){s=a+r*d;for(var f=0;f<r;++f)i[s+f]=n[o+f]}}e.needsUpdate=!0}},e.prototype.makeMapping=function(){for(var t=this.size,e=this.mapping,n=this.mappingSize,r=this.mappingItemSize,i=this.geometry.attributes.mapping.array,o=0;o<t;o++)i.set(e,o*r*n)},e.prototype.makeIndex=function(){for(var t,e,n=this.size,r=this.mappingSize,i=this.mappingIndices,o=this.mappingIndicesSize,a=this.index,s=0;s<n;s++){t=s*o,e=s*r,a.set(i,t);for(var c=0;c<o;++c)a[t+c]+=e}},Object.defineProperties(e.prototype,n),e}(fm),Sm=new Float32Array([-1,1,-1,-1,1,1,1,-1]),Cm=new Uint16Array([0,1,2,1,3,2]),Am=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return n.mapping.get=function(){return Sm},n.mappingIndices.get=function(){return Cm},n.mappingIndicesSize.get=function(){return 6},n.mappingType.get=function(){return"v2"},n.mappingSize.get=function(){return 4},n.mappingItemSize.get=function(){return 2},Object.defineProperties(e.prototype,n),e}(wm),Em=function(t){function e(e,n){t.call(this,e,n),this.addUniforms({projectionMatrixInverse:{value:new De},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isImpostor:{},vertexShader:{},fragmentShader:{}};return n.isImpostor.get=function(){return!0},n.vertexShader.get=function(){return"SphereImpostor.vert"},n.fragmentShader.get=function(){return"SphereImpostor.frag"},Object.defineProperties(e.prototype,n),e}(Am),Mm=function(t,e){return!Ju||e&&e.disableImpostor?new _m(t,e):new Em(t,e)},Tm=new Ne,Pm=new Ne,Im=new Ne,Rm=new Ne(0,0,0),Om=function(t){function e(e,n){var r=n||{},i=new Ri(1,gs(r.sphereDetail,2));t.call(this,e,r,i),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,n){Pm.fromArray(this._majorAxis,n),Im.fromArray(this._minorAxis,n),t.lookAt(Rm,Pm,Im),Tm.set(this._radius[e],Im.length(),Pm.length()),t.scale(Tm)},e.prototype.setAttributes=function(e,n){e.radius&&(this._radius=e.radius),e.majorAxis&&(this._majorAxis=e.majorAxis),e.minorAxis&&(this._minorAxis=e.minorAxis),t.prototype.setAttributes.call(this,e,n)},n.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(bm),Lm=new Ne,km=new Ne,Nm=new Ne,Dm=new Ne(0,1,0),zm=function(t){function e(e,n){var r=e||{},i=n||{},o=gs(i.radialSegments,10),a=gs(i.openEnded,!0),s=(new De).makeRotationX(Math.PI/2),c=new eo(1,1,1,o,1,a);c.applyMatrix(s);var u=r.position1.length,l=r.radius.length,h=c.attributes.position.array.length/3,p=u/3,d=new Float32Array(2*p*h);Yl(p,h,0,d),Yl(p,h,p*h,d);var f=new Float32Array(2*u),m=new Float32Array(2*u);t.call(this,{position:f,color:m,primitiveId:d,picking:r.picking},i,c),this.__center=new Float32Array(u),this._position=f,this._color=m,this._from=new Float32Array(2*u),this._to=new Float32Array(2*u),this._radius=new Float32Array(2*l),this.setAttributes(r,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,n){km.fromArray(this._from,n),Nm.fromArray(this._to,n),t.lookAt(km,Nm,Dm);var r=this._radius[e];Lm.set(r,r,km.distanceTo(Nm)),t.scale(Lm)},e.prototype.setAttributes=function(e,n){var r={};e.position1&&e.position2&&($l(e.position1,e.position2,this.__center),$l(e.position1,this.__center,this._position),$l(this.__center,e.position2,this._position,e.position1.length),this._from.set(e.position1),this._from.set(this.__center,e.position1.length),this._to.set(this.__center),this._to.set(e.position2,this.__center.length),r.position=this._position),e.color&&e.color2&&(this._color.set(e.color),this._color.set(e.color2,e.color.length),r.color=this._color),e.radius&&(this._radius.set(e.radius),this._radius.set(e.radius,e.radius.length),r.radius=this._radius),t.prototype.setAttributes.call(this,r,n)},n.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(bm);ul.add("shader/CylinderImpostor.vert","\nattribute vec3 mapping;\nattribute vec3 position1;\nattribute vec3 position2;\nattribute float radius;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform mat4 modelViewMatrixInverse;\nuniform float ortho;\n#include matrix_scale\nvoid main(){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nbase_radius.w = radius * matrixScale( modelViewMatrix );\nvec3 center = position;\nvec3 dir = normalize( position2 - position1 );\nfloat ext = length( position2 - position1 ) / 2.0;\nvec3 cam_dir;\nif( ortho == 0.0 ){\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 0, 1 ) ).xyz - center;\n}else{\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 1, 0 ) ).xyz;\n}\ncam_dir = normalize( cam_dir );\nvec3 ldir;\nfloat b = dot( cam_dir, dir );\nend_b.w = b;\nif( b < 0.0 )\nldir = -ext * dir;\nelse\nldir = ext * dir;\nvec3 left = normalize( cross( cam_dir, ldir ) );\nleft = radius * left;\nvec3 up = radius * normalize( cross( left, ldir ) );\naxis = normalize( normalMatrix * ldir );\nU = normalize( normalMatrix * up );\nV = normalize( normalMatrix * left );\nvec4 base4 = modelViewMatrix * vec4( center - ldir, 1.0 );\nbase_radius.xyz = base4.xyz / base4.w;\nvec4 top_position = modelViewMatrix * vec4( center + ldir, 1.0 );\nvec4 end4 = top_position;\nend_b.xyz = end4.xyz / end4.w;\nw = modelViewMatrix * vec4(\ncenter + mapping.x*ldir + mapping.y*left + mapping.z*up, 1.0\n);\ngl_Position = projectionMatrix * w;\ngl_Position.z = 0.99;\n}"),ul.add("shader/CylinderImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform mat4 projectionMatrix;\nuniform float ortho;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat distSq3( vec3 v3a, vec3 v3b ){\nreturn (\n( v3a.x - v3b.x ) * ( v3a.x - v3b.x ) +\n( v3a.y - v3b.y ) * ( v3a.y - v3b.y ) +\n( v3a.z - v3b.z ) * ( v3a.z - v3b.z )\n);\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nvoid main(){\nvec3 point = w.xyz / w.w;\nvec3 base = base_radius.xyz;\nfloat vRadius = base_radius.w;\nvec3 end = end_b.xyz;\nfloat b = end_b.w;\nvec3 end_cyl = end;\nvec3 surface_point = point;\nvec3 ray_target = surface_point;\nvec3 ray_origin = vec3(0.0);\nvec3 ray_direction = mix(normalize(ray_origin - ray_target), vec3(0.0, 0.0, 1.0), ortho);\nmat3 basis = mat3( U, V, axis );\nvec3 diff = ray_target - 0.5 * (base + end_cyl);\nvec3 P = diff * basis;\nfloat dz = dot( axis, ray_direction );\nfloat radius2 = vRadius*vRadius;\nvec3 D = vec3(dot(U, ray_direction),\ndot(V, ray_direction),\ndz);\nfloat a0 = P.x*P.x + P.y*P.y - radius2;\nfloat a1 = P.x*D.x + P.y*D.y;\nfloat a2 = D.x*D.x + D.y*D.y;\nfloat d = a1*a1 - a0*a2;\nif (d < 0.0)\ndiscard;\nfloat dist = (-a1 + sqrt(d)) / a2;\nvec3 new_point = ray_target + dist * ray_direction;\nvec3 tmp_point = new_point - base;\nvec3 _normal = normalize( tmp_point - axis * dot(tmp_point, axis) );\nray_origin = mix( ray_origin, surface_point, ortho );\nfloat front_cap_test = dot( tmp_point, axis );\nfloat end_cap_test = dot((new_point - end_cyl), axis);\n#ifndef CAP\nvec3 new_point2 = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\nvec3 tmp_point2 = new_point2 - base;\n#endif\nif (front_cap_test < 0.0)\n{\nfloat dNV = dot(-axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(-axis, (base)) / dNV;\nvec3 front_point = ray_direction * near + ray_origin;\nif (dot(front_point - base, front_point-base) > radius2)\ndiscard;\n#ifdef CAP\nnew_point = front_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(axis, end_cyl) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - end_cyl, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\nif( end_cap_test > 0.0 )\n{\nfloat dNV = dot(axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(axis, end_cyl) / dNV;\nvec3 end_point = ray_direction * near + ray_origin;\nif( dot(end_point - end_cyl, end_point-base) > radius2 )\ndiscard;\n#ifdef CAP\nnew_point = end_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(-axis, (base)) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - base, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\ngl_FragDepthEXT = calcDepth( new_point );\n#ifdef NEAR_CLIP\nif( calcClip( new_point ) > 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\nif( calcClip( new_point ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#endif\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vViewPosition = -new_point;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}else{\nif( b > 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var Fm=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),Bm=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),Um=function(t){function e(e,n){t.call(this,e,n);var r=n||{};this.openEnded=gs(r.openEnded,!1),this.addUniforms({modelViewMatrixInverse:{value:new De},ortho:{value:0}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return n.parameters.get=function(){return Object.assign.call(this,{openEnded:{updateShader:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var n=t.prototype.getDefines.call(this,e);return this.openEnded||(n.CAP=1),n},n.isImpostor.get=function(){return!0},n.vertexShader.get=function(){return"CylinderImpostor.vert"},n.fragmentShader.get=function(){return"CylinderImpostor.frag"},Object.defineProperties(e.prototype,n),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return n.mapping.get=function(){return Fm},n.mappingIndices.get=function(){return Bm},n.mappingIndicesSize.get=function(){return 12},n.mappingType.get=function(){return"v3"},n.mappingSize.get=function(){return 6},n.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,n),e}(wm)),jm=function(t,e){return!Ju||e&&e.disableImpostor?new zm(t,e):new Um(t,e)},Gm=new Ne,Vm=new Ne,Hm=new Ne,$m=new Ne(0,1,0),Wm=function(t){function e(e,n){var r=n||{},i=gs(r.radialSegments,60),o=gs(r.openEnded,!1),a=(new De).makeRotationX(-Math.PI/2),s=new ro(1,1,i,1,o);s.applyMatrix(a);var c=e.position1.length,u=e.radius.length,l=new Float32Array(c);t.call(this,{position:l,color:e.color,picking:e.picking},r,s),this._position=l,this._from=new Float32Array(c),this._to=new Float32Array(c),this._radius=new Float32Array(u),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,n){Vm.fromArray(this._from,n),Hm.fromArray(this._to,n),t.lookAt(Vm,Hm,$m);var r=this._radius[e];Gm.set(r,r,Vm.distanceTo(Hm)),t.scale(Gm)},e.prototype.setAttributes=function(e,n){var r={};e.position1&&e.position2&&($l(e.position1,e.position2,this._position),this._from.set(e.position1),this._to.set(e.position2),r.position=this._position),e.color&&(r.color=e.color),e.radius&&this._radius.set(e.radius),t.prototype.setAttributes.call(this,r,n)},n.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(bm),qm=function(t,e){return new Wm(t,e)},Xm=function(t){this.geometryList=t,this.boundingBox=null};Xm.prototype.computeBoundingBox=function(){var t=this;this.boundingBox?this.boundingBox.empty():this.boundingBox=new Hn,this.geometryList.forEach(function(e){e.boundingBox||e.computeBoundingBox(),t.boundingBox.union(e.boundingBox)})};var Ym=function(t,e){var n=t||{},r=e||{};this.aspectRatio=gs(r.aspectRatio,1.5),this.wireframe=gs(r.wireframe,!1),this.splitPosition=new Float32Array(n.position1.length),this.cylinderRadius=new Float32Array(n.radius.length);var i=this.makeAttributes(n),o={radialSegments:gs(r.radialSegments,50),openEnded:gs(r.openEnded,!1),disableImpostor:gs(r.disableImpostor,!1)};this.cylinderBuffer=new jm(i.cylinder,o),this.coneBuffer=new qm(i.cone,o),this.geometry=new Xm([this.cylinderBuffer.geometry,this.coneBuffer.geometry]),this.group=new yi,this.wireframeGroup=new yi,this.pickingGroup=new yi,this.matrix=gs(r.matrix,new De),this.picking=n.picking},Km={matrix:{},pickable:{}};Km.matrix.set=function(t){fm.prototype.setMatrix.call(this,t)},Km.matrix.get=function(){return this.group.matrix.clone()},Km.pickable.get=function(){return!!this.picking},Ym.prototype.makeAttributes=function(t){var e,n,r=this.splitPosition,i=this.cylinderRadius,o=this.aspectRatio,a={},s={};if(t.radius){for(e=0,n=i.length;e<n;++e)i[e]=t.radius[e]/o;a.radius=i,s.radius=t.radius}if(t.position1&&t.position2){var c=new Ne,u=new Ne,l=new Ne,h=new Ne;for(e=0,n=r.length;e<n;e+=3){c.fromArray(t.position1,e),u.fromArray(t.position2,e),l.subVectors(c,u);var p=l.length(),d=i[e/3]*o*2,f=Math.min(p,d);l.setLength(f),h.copy(u).add(l),h.toArray(r,e)}a.position1=t.position1,a.position2=r,s.position1=r,s.position2=t.position2}return t.color&&(a.color=t.color,a.color2=t.color,s.color=t.color),{cylinder:a,cone:s}},Ym.prototype.getMesh=function(t){return(new yi).add(this.cylinderBuffer.getMesh(t),this.coneBuffer.getMesh(t))},Ym.prototype.getWireframeMesh=function(){return(new yi).add(this.cylinderBuffer.getWireframeMesh(),this.coneBuffer.getWireframeMesh())},Ym.prototype.getPickingMesh=function(){return(new yi).add(this.cylinderBuffer.getPickingMesh(),this.coneBuffer.getPickingMesh())},Ym.prototype.setAttributes=function(t){var e=this.makeAttributes(t);this.cylinderBuffer.setAttributes(e.cylinder),this.coneBuffer.setAttributes(e.cone)},Ym.prototype.setParameters=function(t){(t=Object.assign({},t))&&void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,t&&void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),this.cylinderBuffer.setParameters(t),this.coneBuffer.setParameters(t)},Ym.prototype.setVisibility=function(){fm.prototype.setVisibility.apply(this,arguments)},Ym.prototype.dispose=function(){this.cylinderBuffer.dispose(),this.coneBuffer.dispose()},Object.defineProperties(Ym.prototype,Km),ul.add("shader/SDFFont.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float xOffset;\nuniform float yOffset;\nuniform float zOffset;\nuniform bool ortho;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include matrix_scale\n#include common\nvoid main(void){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\ntexCoord = inputTexCoord;\nfloat scale = matrixScale( modelViewMatrix );\nfloat _zOffset = zOffset * scale;\nif( texCoord.x == 10.0 ){\n_zOffset -= 0.001;\n}\nvec3 pos = position;\nif( ortho ){\npos += normalize( cameraPosition ) * _zOffset;\n}\nvec4 cameraPos = modelViewMatrix * vec4( pos, 1.0 );\nvec4 cameraCornerPos = vec4( cameraPos.xyz, 1.0 );\ncameraCornerPos.xy += mapping * inputSize * 0.01 * scale;\ncameraCornerPos.x += xOffset * scale;\ncameraCornerPos.y += yOffset * scale;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -cameraCornerPos.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),ul.add("shader/SDFFont.frag","uniform sampler2D fontTexture;\nuniform float opacity;\nuniform bool showBorder;\nuniform vec3 borderColor;\nuniform float borderWidth;\nuniform vec3 backgroundColor;\nuniform float backgroundOpacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\nconst vec3 vColor = vec3( 0.0 );\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\n#ifdef SDF\nconst float smoothness = 16.0;\n#else\nconst float smoothness = 256.0;\n#endif\nconst float gamma = 2.2;\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nif( texCoord.x > 1.0 ){\ngl_FragColor = vec4( backgroundColor, backgroundOpacity );\n}else{\nfloat sdf = texture2D( fontTexture, texCoord ).a;\nif( showBorder ) sdf += borderWidth;\nfloat w = clamp(\nsmoothness * ( abs( dFdx( texCoord.x ) ) + abs( dFdy( texCoord.y ) ) ),\n0.0,\n0.5\n);\nfloat a = smoothstep( 0.5 - w, 0.5 + w, sdf );\na = pow( a, 1.0 / gamma );\nif( a < 0.2 ) discard;\na *= opacity;\nvec3 outgoingLight = vColor;\nif( showBorder && sdf < ( 0.5 + borderWidth ) ){\noutgoingLight = borderColor;\n}\ngl_FragColor = vec4( outgoingLight, a );\n}\n#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var Zm={};var Qm=function(t){var e=Object.assign({},t);if(this.font=gs(e.font,["sans-serif"]),this.size=gs(e.size,36),this.style=gs(e.style,"normal"),this.variant=gs(e.variant,"normal"),this.weight=gs(e.weight,"normal"),this.outline=gs(e.outline,0),this.width=gs(e.width,2048),this.height=gs(e.height,2048),this.gamma=1,"undefined"!=typeof navigator){var n=navigator.userAgent;n.match(/Chrome/)&&n.match(/OS X/)&&(this.gamma=.5)}this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.build(),this.populate(),this.texture=new xi(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0};Qm.prototype.build=function(){var t=this.size+2*this.outline+Math.round(this.size/4),e=this.width/4,n=document.createElement("canvas");n.width=e,n.height=t;var r=n.getContext("2d");r.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,r.fillStyle="#FF0000",r.textAlign="left",r.textBaseline="bottom",r.lineJoin="round";for(var i=[],o=3*this.outline,a=0;a<o;++a){var s=("00"+Math.max(0,8*-a+128-8*!a).toString(16)).slice(-2);i.push("#"+s+s+s)}var c=new Uint8Array(e*t*2);this.canvas=n,this.context=r,this.lineHeight=t,this.maxWidth=e,this.colors=i,this.scratch=c,this.data=new Uint8Array(this.width*this.height*4),this.canvas2=document.createElement("canvas"),this.canvas2.width=this.width,this.canvas2.height=this.height,this.context2=this.canvas2.getContext("2d")},Qm.prototype.map=function(t){return void 0===this.mapped[t]&&(this.draw(t),this.currentX+this.scratchW>this.width&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>this.height&&console.warn("canvas to small"),this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH},this.context2.drawImage(this.canvas,0,0,this.scratchW,this.scratchH,this.currentX,this.currentY,this.scratchW,this.scratchH),this.currentX+=this.scratchW),this.mapped[t]},Qm.prototype.get=function(t){return this.mapped[t]||this.placeholder},Qm.prototype.draw=function(t){var e,n,r,i,o,a=this.lineHeight,s=this.outline,c=this.context,u=this.scratch,l=this.maxWidth,h=this.colors,p=s,d=a-this.outline,f=c.measureText(t),m=Math.min(l,Math.ceil(f.width+2*p+1));if(c.clearRect(0,0,m,a),0===this.outline)for(c.fillText(t,p,d),r=3,e=0,n=(o=(i=c.getImageData(0,0,m,a)).data).length/4;e<n;++e)u[e]=o[r],r+=4;else{for(c.globalCompositeOperation="source-over",e=s+1;e>0;--e)r=e>1?2*e-2:e,c.strokeStyle=h[r-1],c.lineWidth=r,c.strokeText(t,p,d);c.globalCompositeOperation="multiply",c.fillStyle="#FF00FF",c.fillText(t,p,d),o=(i=c.getImageData(0,0,m,a)).data,r=0;var g=this.gamma;for(e=0,n=o.length/4;e<n;++e){var v=o[r],y=v?o[r+1]/v:1;.5===g&&(y=Math.sqrt(y));var b=256-v,x=b+(v-b)*(y=Math.min(1,Math.max(0,y)));u[e]=Math.max(0,Math.min(255,x+2)),o[r+3]=u[e],r+=4}}c.putImageData(i,0,0),this.scratchW=m,this.scratchH=a},Qm.prototype.populate=function(){this.placeholder=this.map(String.fromCharCode(65533));for(var t=0;t<127;++t)this.map(String.fromCharCode(t));for(var e=128;e<255;++e)this.map(String.fromCharCode(e));for(var n=880;n<1023;++n)this.map(String.fromCharCode(n));for(var r=1024;r<1279;++r)this.map(String.fromCharCode(r));this.map(String.fromCharCode(8491))};var Jm=function(t){function e(e,n){var r=e||{},i=n||{};i.forceTransparent=!0;for(var o=r.position.length/3,a=0,s=0;s<o;++s)a+=r.text[s].length;var c=a;i.showBackground&&(c+=o),t.call(this,{position:new Float32Array(3*c),color:new Float32Array(3*c),picking:new Bp},i),this.fontFamily=gs(i.fontFamily,"sans-serif"),this.fontStyle=gs(i.fontStyle,"normal"),this.fontWeight=gs(i.fontWeight,"bold"),this.fontSize=gs(i.fontSize,48),this.sdf=gs(i.sdf,"Chrome"===Ku),this.xOffset=gs(i.xOffset,0),this.yOffset=gs(i.yOffset,0),this.zOffset=gs(i.zOffset,.5),this.attachment=gs(i.attachment,"bottom-left"),this.showBorder=gs(i.showBorder,!1),this.borderColor=gs(i.borderColor,"lightgrey"),this.borderWidth=gs(i.borderWidth,.15),this.showBackground=gs(i.showBackground,!1),this.backgroundColor=gs(i.backgroundColor,"lightgrey"),this.backgroundMargin=gs(i.backgroundMargin,.5),this.backgroundOpacity=gs(i.backgroundOpacity,1),this.text=r.text,this.positionCount=o,this.addUniforms({fontTexture:{value:null},xOffset:{value:this.xOffset},yOffset:{value:this.yOffset},zOffset:{value:this.zOffset},ortho:{value:!1},showBorder:{value:this.showBorder},borderColor:{value:new En(this.borderColor)},borderWidth:{value:this.borderWidth},backgroundColor:{value:new En(this.backgroundColor)},backgroundOpacity:{value:this.backgroundOpacity}}),this.addAttributes({inputTexCoord:{type:"v2",value:null},inputSize:{type:"f",value:null}}),this.setAttributes(e),this.makeTexture(),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={parameters:{},wireframe:{},isText:{},vertexShader:{},fragmentShader:{}};return n.parameters.get=function(){return Object.assign.call(this,{fontFamily:{uniform:!0},fontStyle:{uniform:!0},fontWeight:{uniform:!0},fontSize:{uniform:!0},sdf:{updateShader:!0,uniform:!0},xOffset:{uniform:!0},yOffset:{uniform:!0},zOffset:{uniform:!0},showBorder:{uniform:!0},borderColor:{uniform:!0},borderWidth:{uniform:!0},backgroundColor:{uniform:!0},backgroundOpacity:{uniform:!0}},t.prototype.parameters,{flatShaded:void 0})},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this);var e=this.texture,n=this.material;n.extensions.derivatives=!0,n.lights=!1,n.uniforms.fontTexture.value=e,n.needsUpdate=!0;var r=this.wireframeMaterial;r.extensions.derivatives=!0,r.lights=!1,r.uniforms.fontTexture.value=e,r.needsUpdate=!0;var i=this.pickingMaterial;i.extensions.derivatives=!0,i.lights=!1,i.uniforms.fontTexture.value=e,i.needsUpdate=!0},e.prototype.setAttributes=function(t){var e,n,r,i,o,a,s=this.text,c=this.geometry.attributes;t.position&&(e=t.position,i=c.position.array,c.position.needsUpdate=!0),t.size&&(n=t.size,o=c.inputSize.array,c.inputSize.needsUpdate=!0),t.color&&(r=t.color,a=c.color.array,c.color.needsUpdate=!0);for(var u,l,h,p,d=this.positionCount,f=0,m=0;m<d;++m)for(l=3*m,p=s[m].length,this.showBackground&&(p+=1),h=0;h<p;++h,++f)for(var g=0;g<4;g++)u=4*f*3+3*g,e&&(i[u]=e[l],i[u+1]=e[l+1],i[u+2]=e[l+2]),n&&(o[4*f+g]=n[m]),r&&(a[u]=r[l],a[u+1]=r[l+1],a[u+2]=r[l+2])},e.prototype.makeTexture=function(){var t,e;this.textAtlas=(t={font:[this.fontFamily],style:this.fontStyle,weight:this.fontWeight,size:this.fontSize,outline:this.sdf?5:0},e=JSON.stringify(t),void 0===Zm[e]&&(Zm[e]=new Qm(t)),Zm[e]),this.texture=this.textAtlas.texture},e.prototype.makeMapping=function(){for(var t,e,n,r,i,o,a,s,c=this.textAtlas,u=this.text,l=this.attachment,h=c.lineHeight*this.backgroundMargin*.1-10,p=this.geometry.attributes.inputTexCoord.array,d=this.geometry.attributes.mapping.array,f=this.positionCount,m=0,g=0;g<f;++g){for(r=0,o=(n=u[g]).length,i=0;i<o;++i)r+=(t=c.get(n[i])).w-2*c.outline;for(s=l.startsWith("top")?c.lineHeight/1.25:l.startsWith("middle")?c.lineHeight/2.5:0,a=l.endsWith("right")?r:l.endsWith("center")?r/2:0,a+=c.outline,s+=c.outline,this.showBackground&&(d[(e=2*m*4)+0]=-c.lineHeight/6-a-h,d[e+1]=c.lineHeight-s+h,d[e+2]=-c.lineHeight/6-a-h,d[e+3]=0-s-h,d[e+4]=r+c.lineHeight/6-a+2*c.outline+h,d[e+5]=c.lineHeight-s+h,d[e+6]=r+c.lineHeight/6-a+2*c.outline+h,d[e+7]=0-s-h,p[e+0]=10,p[e+2]=10,p[e+4]=10,p[e+6]=10,m+=1),r=0,i=0;i<o;++i,++m){t=c.get(n[i]),d[(e=2*m*4)+0]=r-a,d[e+1]=t.h-s,d[e+2]=r-a,d[e+3]=0-s,d[e+4]=r+t.w-a,d[e+5]=t.h-s,d[e+6]=r+t.w-a,d[e+7]=0-s;var v=c.width,y=c.height,b=[t.x/v,t.y/y,t.x/v,(t.y+t.h)/y,(t.x+t.w)/v,t.y/y,(t.x+t.w)/v,(t.y+t.h)/y];p.set(b,e),r+=t.w-2*c.outline}}this.geometry.attributes.inputTexCoord.needsUpdate=!0,this.geometry.attributes.mapping.needsUpdate=!0},e.prototype.getDefines=function(e){var n=t.prototype.getDefines.call(this,e);return this.sdf&&(n.SDF=1),n},e.prototype.setUniforms=function(e){!e||void 0===e.fontFamily&&void 0===e.fontStyle&&void 0===e.fontWeight&&void 0===e.fontSize&&void 0===e.sdf||(this.makeTexture(),this.makeMapping(),this.texture.needsUpdate=!0,e.fontTexture=this.texture),t.prototype.setUniforms.call(this,e)},n.wireframe.set=function(t){},n.wireframe.get=function(){return!1},n.isText.get=function(){return!0},n.vertexShader.get=function(){return"SDFFont.vert"},n.fragmentShader.get=function(){return"SDFFont.frag"},Object.defineProperties(e.prototype,n),e}(Am);function tg(t,e){void 0!==t.toArray?t=t.toArray():void 0!==t.x?t=[t.x,t.y,t.z]:void 0!==t.r&&(t=[t.r,t.g,t.b]),e.push.apply(e,t)}var eg=new Ne,ng=new Hn,rg=function(t,e){this.name=gs(t,"shape");var n=e||{};this.aspectRatio=gs(n.aspectRatio,1.5),this.sphereDetail=gs(n.sphereDetail,2),this.radialSegments=gs(n.radialSegments,50),this.disableImpostor=gs(n.disableImpostor,!1),this.openEnded=gs(n.openEnded,!1),this.labelParams=gs(n.labelParams,{}),this.boundingBox=new Hn,this.bufferList=[],this.meshCount=0,this.spherePosition=[],this.sphereColor=[],this.sphereRadius=[],this.sphereName=[],this.ellipsoidPosition=[],this.ellipsoidColor=[],this.ellipsoidRadius=[],this.ellipsoidMajorAxis=[],this.ellipsoidMinorAxis=[],this.ellipsoidName=[],this.cylinderPosition1=[],this.cylinderPosition2=[],this.cylinderColor=[],this.cylinderRadius=[],this.cylinderName=[],this.conePosition1=[],this.conePosition2=[],this.coneColor=[],this.coneRadius=[],this.coneName=[],this.arrowPosition1=[],this.arrowPosition2=[],this.arrowColor=[],this.arrowRadius=[],this.arrowName=[],this.labelPosition=[],this.labelColor=[],this.labelSize=[],this.labelText=[]},ig={center:{},type:{}};rg.prototype.addBuffer=function(t){this.bufferList.push(t);var e=t.geometry;return e.boundingBox||e.computeBoundingBox(),this.boundingBox.union(e.boundingBox),this},rg.prototype.addMesh=function(t,e,n,r,i){t=Rs(t),e=Rs(e),Array.isArray(n)&&(n=Es(n,t.length)),r&&(r=Rs(r));var o={position:t,color:e,index:n,normal:r},a=new Up(this,Object.assign({serial:this.meshCount,name:i},o)),s=new gm(Object.assign({picking:a},o));return this.bufferList.push(s),ng.setFromArray(t),this.boundingBox.union(ng),this.meshCount+=1,this},rg.prototype.addSphere=function(t,e,n,r){return tg(t,this.spherePosition),tg(e,this.sphereColor),this.sphereRadius.push(n),this.sphereName.push(r),this.boundingBox.expandByPoint(eg.fromArray(t)),this},rg.prototype.addEllipsoid=function(t,e,n,r,i,o){return tg(t,this.ellipsoidPosition),tg(e,this.ellipsoidColor),this.ellipsoidRadius.push(n),tg(r,this.ellipsoidMajorAxis),tg(i,this.ellipsoidMinorAxis),this.ellipsoidName.push(o),this.boundingBox.expandByPoint(eg.fromArray(t)),this},rg.prototype.addCylinder=function(t,e,n,r,i){return tg(t,this.cylinderPosition1),tg(e,this.cylinderPosition2),tg(n,this.cylinderColor),this.cylinderRadius.push(r),this.cylinderName.push(i),this.boundingBox.expandByPoint(eg.fromArray(t)),this.boundingBox.expandByPoint(eg.fromArray(e)),this},rg.prototype.addCone=function(t,e,n,r,i){return tg(t,this.conePosition1),tg(e,this.conePosition2),tg(n,this.coneColor),this.coneRadius.push(r),this.coneName.push(i),this.boundingBox.expandByPoint(eg.fromArray(t)),this.boundingBox.expandByPoint(eg.fromArray(e)),this},rg.prototype.addArrow=function(t,e,n,r,i){return tg(t,this.arrowPosition1),tg(e,this.arrowPosition2),tg(n,this.arrowColor),this.arrowRadius.push(r),this.arrowName.push(i),this.boundingBox.expandByPoint(eg.fromArray(t)),this.boundingBox.expandByPoint(eg.fromArray(e)),this},rg.prototype.addLabel=function(t,e,n,r){return tg(t,this.labelPosition),tg(e,this.labelColor),this.labelSize.push(n),this.labelText.push(r),this.boundingBox.expandByPoint(eg.fromArray(t)),this},rg.prototype.getBufferList=function(){var t=[];if(this.spherePosition.length){var e=new Mm({position:new Float32Array(this.spherePosition),color:new Float32Array(this.sphereColor),radius:new Float32Array(this.sphereRadius),picking:new jp(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(e)}if(this.ellipsoidPosition.length){var n=new function(t,e){return new Om(t,e)}({position:new Float32Array(this.ellipsoidPosition),color:new Float32Array(this.ellipsoidColor),radius:new Float32Array(this.ellipsoidRadius),majorAxis:new Float32Array(this.ellipsoidMajorAxis),minorAxis:new Float32Array(this.ellipsoidMinorAxis),picking:new Fp(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(n)}if(this.cylinderPosition1.length){var r=new jm({position1:new Float32Array(this.cylinderPosition1),position2:new Float32Array(this.cylinderPosition2),color:new Float32Array(this.cylinderColor),color2:new Float32Array(this.cylinderColor),radius:new Float32Array(this.cylinderRadius),picking:new Pp(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(r)}if(this.conePosition1.length){var i=new qm({position1:new Float32Array(this.conePosition1),position2:new Float32Array(this.conePosition2),color:new Float32Array(this.coneColor),radius:new Float32Array(this.coneRadius),picking:new Np(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(i)}if(this.arrowPosition1.length){var o=new Ym({position1:new Float32Array(this.arrowPosition1),position2:new Float32Array(this.arrowPosition2),color:new Float32Array(this.arrowColor),radius:new Float32Array(this.arrowRadius),picking:new Ip(this)},{aspectRatio:this.aspectRatio,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(o)}if(this.labelPosition.length){var a=new Jm({position:new Float32Array(this.labelPosition),color:new Float32Array(this.labelColor),size:new Float32Array(this.labelSize),text:this.labelText},this.labelParams);t.push(a)}return this.bufferList.concat(t)},rg.prototype.dispose=function(){this.bufferList.forEach(function(t){t.dispose()}),this.bufferList.length=0,this.spherePosition.length=0,this.sphereColor.length=0,this.sphereRadius.length=0,this.sphereName.length=0,this.ellipsoidPosition.length=0,this.ellipsoidColor.length=0,this.ellipsoidRadius.length=0,this.ellipsoidMajorAxis.length=0,this.ellipsoidMinorAxis.length=0,this.ellipsoidName.length=0,this.cylinderPosition1.length=0,this.cylinderPosition2.length=0,this.cylinderColor.length=0,this.cylinderRadius.length=0,this.cylinderName.length=0,this.conePosition1.length=0,this.conePosition2.length=0,this.coneColor.length=0,this.coneRadius.length=0,this.coneName.length=0,this.arrowPosition1.length=0,this.arrowPosition2.length=0,this.arrowColor.length=0,this.arrowRadius.length=0,this.arrowName.length=0,this.labelPosition.length=0,this.labelColor.length=0,this.labelSize.length=0,this.labelText.length=0},ig.center.get=function(){return this._center||(this._center=this.boundingBox.getCenter()),this._center},ig.type.get=function(){return"Shape"},Object.defineProperties(rg.prototype,ig);var og=function(t,e,n){this.type="",this.parameters={lazy:{type:"boolean"},clipNear:{type:"range",step:1,max:100,min:0,buffer:!0},clipRadius:{type:"number",precision:1,max:1e3,min:0,buffer:!0},clipCenter:{type:"vector3",precision:1,buffer:!0},flatShaded:{type:"boolean",buffer:!0},opacity:{type:"range",step:.01,max:1,min:0,buffer:!0},depthWrite:{type:"boolean",buffer:!0},side:{type:"select",buffer:!0,options:{front:"front",back:"back",double:"double"}},wireframe:{type:"boolean",buffer:!0},linewidth:{type:"integer",max:50,min:1,buffer:!0},colorScheme:{type:"select",update:"color",options:{}},colorScale:{type:"select",update:"color",options:ol.getScales()},colorReverse:{type:"boolean",update:"color"},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:ol.getModes()},roughness:{type:"range",step:.01,max:1,min:0,buffer:!0},metalness:{type:"range",step:.01,max:1,min:0,buffer:!0},diffuse:{type:"color",buffer:!0},matrix:{type:"hidden",buffer:!0},disablePicking:{type:"boolean",rebuild:!0}},this.viewer=e,this.tasks=new Rl,this.queue=new sm(this.make.bind(this)),this.bufferList=[],this.parameters.colorScheme&&(this.parameters.colorScheme.options=ol.getSchemes())};og.prototype.init=function(t){var e=t||{};this.clipNear=gs(e.clipNear,0),this.clipRadius=gs(e.clipRadius,0),this.clipCenter=gs(e.clipCenter,new Ne),this.flatShaded=gs(e.flatShaded,!1),this.side=gs(e.side,"double"),this.opacity=gs(e.opacity,1),this.depthWrite=gs(e.depthWrite,!0),this.wireframe=gs(e.wireframe,!1),this.linewidth=gs(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=gs(e.colorScheme,"uniform"),this.colorScale=gs(e.colorScale,""),this.colorReverse=gs(e.colorReverse,!1),this.colorValue=gs(e.colorValue,9474192),this.colorDomain=gs(e.colorDomain,void 0),this.colorMode=gs(e.colorMode,"hcl"),this.visible=gs(e.visible,!0),this.quality=gs(e.quality,void 0),this.roughness=gs(e.roughness,.4),this.metalness=gs(e.metalness,0),this.diffuse=gs(e.diffuse,16777215),this.lazy=gs(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}},this.matrix=gs(e.matrix,new De),this.disablePicking=gs(e.disablePicking,!1);var n=this.parameters;!0===n.sphereDetail&&(n.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),!0===n.radialSegments&&(n.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),!0===n.openEnded&&(n.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),!0===n.disableImpostor&&(n.disableImpostor={type:"boolean",rebuild:!0}),"low"===e.quality?(n.sphereDetail&&(this.sphereDetail=0),n.radialSegments&&(this.radialSegments=5)):"medium"===e.quality?(n.sphereDetail&&(this.sphereDetail=1),n.radialSegments&&(this.radialSegments=10)):"high"===e.quality?(n.sphereDetail&&(this.sphereDetail=2),n.radialSegments&&(this.radialSegments=20)):(n.sphereDetail&&(this.sphereDetail=gs(e.sphereDetail,1)),n.radialSegments&&(this.radialSegments=gs(e.radialSegments,10))),n.openEnded&&(this.openEnded=gs(e.openEnded,!0)),n.disableImpostor&&(this.disableImpostor=gs(e.disableImpostor,!1))},og.prototype.getColorParams=function(t){return Object.assign({scheme:this.colorScheme,scale:this.colorScale,reverse:this.colorReverse,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode},t)},og.prototype.getBufferParams=function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,depthWrite:this.depthWrite,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse,matrix:this.matrix,disablePicking:this.disablePicking},t)},og.prototype.setColor=function(t,e){return Object.keys(ol.getSchemes()).includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new En(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},og.prototype.create=function(){},og.prototype.update=function(){this.build()},og.prototype.build=function(t){if(!this.lazy||this.visible){if(!this.prepare)return this.tasks.increment(),void this.make();this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),this.queue.push(t||!1)}else this.lazyProps.build=!0},og.prototype.make=function(t,e){nl&&el.time("Representation.make "+this.type);var n=function(){t?(this.update(t),this.viewer.requestRender(),this.tasks.decrement(),e&&e()):(this.clear(),this.create(),this.manualAttach||this.disposed||(nl&&el.time("Representation.attach "+this.type),this.attach(function(){nl&&el.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),e&&e()}.bind(this)))),nl&&el.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(n):n()},og.prototype.attach=function(t){this.setVisibility(this.visible),t()},og.prototype.setVisibility=function(t,e){if(this.visible=t,this.visible){var n=this.lazyProps,r=n.bufferParams,i=n.what;if(n.build)return n.build=!1,void this.build();(Object.keys(r).length||Object.keys(i).length)&&(n.bufferParams={},n.what={},this.updateParameters(r,i))}return this.bufferList.forEach(function(e){e.setVisibility(t)}),e||this.viewer.requestRender(),this},og.prototype.setParameters=function(t,e,n){var r=t||{},i=this.parameters;e=e||{},n=n||!1;var o={};for(var a in r)void 0!==r[a]&&void 0!==i[a]&&(i[a].int&&(r[a]=parseInt(r[a])),i[a].float&&(r[a]=parseFloat(r[a])),(r[a]!==this[a]||r[a].equals&&!r[a].equals(this[a]))&&(this[a].set?this[a].set(r[a]):this[a]=r[a],i[a].buffer&&(!0===i[a].buffer?o[a]=r[a]:o[i[a].buffer]=r[a]),i[a].update&&(e[i[a].update]=!0),!i[a].rebuild||"impostor"===i[a].rebuild&&Ju&&!this.disableImpostor||(n=!0)));return n?this.build():this.updateParameters(o,e),this},og.prototype.updateParameters=function(t,e){if(this.lazy&&!this.visible)return Object.assign(this.lazyProps.bufferParams,t),void Object.assign(this.lazyProps.what,e);this.bufferList.forEach(function(e){e.setParameters(t)}),Object.keys(e).length&&this.update(e),this.viewer.requestRender()},og.prototype.getParameters=function(){var t=this,e={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach(function(n){null!==t.parameters[n]&&(e[n]=t[n])}),e},og.prototype.clear=function(){var t=this;this.bufferList.forEach(function(e){t.viewer.remove(e),e.dispose()}),this.bufferList.length=0,this.viewer.requestRender()},og.prototype.dispose=function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()};var ag=function(t){function e(e,n,r){Array.isArray(e)||(e=[e]),t.call(this,e,n,r),this.type="buffer",this.parameters=Object.assign({},this.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),this.buffer=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){t.prototype.init.call(this,e),this.build()},e.prototype.create=function(){this.bufferList.push.apply(this.bufferList,this.buffer)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t),t.setParameters(e.getBufferParams())}),this.setVisibility(this.visible),t()},e}(og),sg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isSurface:{}};return n.isSurface.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(gm);function cg(t){t.visible=!0}function ug(t){t.visible=!1}var lg=function(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.picking=t.picking,this.background=t.background,this.disablePicking=t.disablePicking,this.group=new yi,this.wireframeGroup=new yi,this.pickingGroup=new yi,this.matrix=t.matrix,this.frontMeshes=[],this.backMeshes=[];var e=t,n=new t.constructor;e.makeMaterial(),n.makeMaterial(),n.picking=t.picking,n.geometry=t.geometry,n.wireframeGeometry=t.wireframeGeometry,n.setParameters(t.getParameters()),n.updateShader(),e.setParameters({side:"front"}),n.setParameters({side:"back",opacity:n.opacity}),this.buffer=t,this.frontBuffer=e,this.backBuffer=n},hg={matrix:{},pickable:{}};hg.matrix.set=function(t){fm.prototype.setMatrix.call(this,t)},hg.matrix.get=function(){return this.group.matrix.clone()},hg.pickable.get=function(){return!!this.picking&&!this.disablePicking},lg.prototype.getMesh=function(t){var e,n;return t?(n=this.backBuffer.getPickingMesh(),e=this.frontBuffer.getPickingMesh()):(n=this.backBuffer.getMesh(),e=this.frontBuffer.getMesh()),this.frontMeshes.push(e),this.backMeshes.push(n),this.setParameters({side:this.side}),(new yi).add(n,e)},lg.prototype.getWireframeMesh=function(){return this.buffer.getWireframeMesh()},lg.prototype.getPickingMesh=function(){return this.getMesh(!0)},lg.prototype.setAttributes=function(t){this.buffer.setAttributes(t)},lg.prototype.setParameters=function(t){"front"===(t=Object.assign({},t)).side?(this.frontMeshes.forEach(cg),this.backMeshes.forEach(ug)):"back"===t.side?(this.frontMeshes.forEach(ug),this.backMeshes.forEach(cg)):"double"===t.side&&(this.frontMeshes.forEach(cg),this.backMeshes.forEach(cg)),void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,void 0!==t.side&&(this.side=t.side),delete t.side,this.frontBuffer.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,this.backBuffer.setParameters(t)},lg.prototype.dispose=function(){this.frontBuffer.dispose(),this.backBuffer.dispose()},Object.defineProperties(lg.prototype,hg),lg.prototype.setVisibility=fm.prototype.setVisibility,ul.add("shader/Line.vert","uniform float nearClip;\nuniform vec3 clipCenter;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),ul.add("shader/Line.frag","uniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\ngl_FragColor = vec4( vColor, opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}");var pg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isLine:{},vertexShader:{},fragmentShader:{}};return n.isLine.get=function(){return!0},n.vertexShader.get=function(){return"Line.vert"},n.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,n),e}(fm),dg=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="surface",this.parameters=Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},negateIsolevel:{type:"boolean"},smooth:{type:"integer",precision:1,max:10,min:0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},boxSize:{type:"integer",precision:1,max:100,min:0},colorVolume:{type:"hidden"},contour:{type:"boolean",rebuild:!0},useWorker:{type:"boolean",rebuild:!0},wrap:{type:"boolean",rebuild:!0}},this.parameters),e instanceof sf?(this.surface=void 0,this.volume=e):(this.surface=e,this.volume=void 0),this.boxCenter=new Ne,this.__boxCenter=new Ne,this.box=new Hn,this.__box=new Hn,this._position=new Ne,this.setBox=function(){this._position.copy(n.translationGroup.position).negate(),this._position.equals(this.boxCenter)||this.setParameters({boxCenter:this._position})},this.viewer.signals.ticked.add(this.setBox,this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"uniform"),n.colorValue=gs(n.colorValue,14540253),this.isolevelType=gs(n.isolevelType,"sigma"),this.isolevel=gs(n.isolevel,2),this.negateIsolevel=gs(n.negateIsolevel,!1),this.smooth=gs(n.smooth,0),this.background=gs(n.background,!1),this.opaqueBack=gs(n.opaqueBack,!0),this.boxSize=gs(n.boxSize,0),this.colorVolume=gs(n.colorVolume,void 0),this.contour=gs(n.contour,!1),this.useWorker=gs(n.useWorker,!0),this.wrap=gs(n.wrap,!1),t.prototype.init.call(this,n),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t)}),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){var e,n=this;if(this.volume)if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,this.negateIsolevel&&(e*=-1),!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__contour!==this.contour||this.__wrap!==this.wrap||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__contour=this.contour,this.__wrap=this.wrap,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var r=function(e){n.surface=e,t()};this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap,r):r(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap))}else t();else t()},e.prototype.create=function(){var t,e={position:this.surface.getPosition(),color:this.surface.getColor(this.getColorParams()),index:this.surface.getIndex()};if(this.contour)t=new pg(e,this.getBufferParams({wireframe:!1}));else{e.normal=this.surface.getNormal(),e.picking=this.surface.getPicking();var n=new sg(e,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1}));t=new lg(n)}this.bufferList.push(t)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=t||{}).position&&(e.position=this.surface.getPosition()),t.color&&(e.color=this.surface.getColor(this.getColorParams())),t.index&&(e.index=this.surface.getIndex()),t.normal&&(e.normal=this.surface.getNormal()),this.bufferList.forEach(function(t){t.setAttributes(e)})}},e.prototype.setParameters=function(e,n,r){return e&&void 0!==e.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===e.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===e.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=e.isolevelType),e&&e.boxCenter&&(this.boxCenter.copy(e.boxCenter),delete e.boxCenter),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,n,r),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),e&&void 0!==e.colorVolume&&(n.color=!0),this.surface&&(void 0!==e.isolevel||void 0!==e.negateIsolevel||void 0!==e.smooth||void 0!==e.wrap||void 0!==e.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!this.contour}),this},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.dispose=function(){this.viewer.signals.ticked.remove(this.setBox,this),t.prototype.dispose.call(this)},e}(og);ul.add("shader/Point.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float size;\nuniform float canvasHeight;\nuniform float pixelRatio;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\n#include begin_vertex\n#include project_vertex\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * pixelRatio * ( ( canvasHeight / 2.0 ) / -mvPosition.z );\n#else\ngl_PointSize = size * pixelRatio;\n#endif\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),ul.add("shader/Point.frag","uniform vec3 diffuse;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\n#ifdef USE_MAP\nif( texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) ).a < 0.5 )\ndiscard;\n#endif\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 outgoingLight = vec3( 0.0 );\nvec4 diffuseColor = vec4( diffuse, 1.0 );\n#ifdef USE_MAP\ndiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif\n#include color_fragment\n#include alphatest_fragment\noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a * opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var fg=function(t){function e(e,n){var r=e||{},i=n||{};r.primitiveId||(r.primitiveId=Xl(r.position.length/3)),t.call(this,r,i),this.pointSize=gs(i.pointSize,1),this.sizeAttenuation=gs(i.sizeAttenuation,!0),this.sortParticles=gs(i.sortParticles,!1),this.alphaTest=gs(i.alphaTest,.5),this.useTexture=gs(i.useTexture,!1),this.forceTransparent=gs(i.forceTransparent,!1),this.edgeBleach=gs(i.edgeBleach,0),this.addUniforms({size:{value:this.pointSize},canvasHeight:{value:1},pixelRatio:{value:1},map:{value:null}})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={parameters:{},isPoint:{},vertexShader:{},fragmentShader:{}};return n.parameters.get=function(){return Object.assign.call(this,{pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},t.prototype.parameters)},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.makeTexture();var e=this.material,n=this.wireframeMaterial,r=this.pickingMaterial;e.uniforms.map.value=this.tex,e.needsUpdate=!0,n.uniforms.map.value=this.tex,n.needsUpdate=!0,r.uniforms.map.value=this.tex,r.needsUpdate=!0},e.prototype.makeTexture=function(){this.tex&&this.tex.dispose(),this.tex=function(t){for(var e,n,r=t||{},i=gs(r.width,256),o=gs(r.height,256),a=[i/2,o/2],s=Math.min(i/2,o/2),c=gs(r.delta,1/(s+1))*s,u=0,l=0,h=new Uint8Array(i*o*4),p=0,d=h.length;p<d;p+=4){var f=1-vu(s-c,s,(e=a[0]-u,n=a[1]-l,Math.sqrt(e*e+n*n)));h[p]=255*f,h[p+1]=255*f,h[p+2]=255*f,h[p+3]=255*f,++u===i&&(u=0,l++)}var m=new ze(h,i,o);return m.needsUpdate=!0,m}({delta:this.edgeBleach})},e.prototype.getDefines=function(e){var n=t.prototype.getDefines.call(this,e);return this.sizeAttenuation&&(n.USE_SIZEATTENUATION=1),this.useTexture&&(n.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(n.ALPHATEST=this.alphaTest.toPrecision(2)),n},e.prototype.setUniforms=function(e){e&&void 0!==e.edgeBleach&&(this.makeTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.tex&&this.tex.dispose()},n.isPoint.get=function(){return!0},n.vertexShader.get=function(){return"Point.vert"},n.fragmentShader.get=function(){return"Point.frag"},Object.defineProperties(e.prototype,n),e}(fm),mg=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="dot",this.parameters=Object.assign({thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},thresholdOut:{type:"boolean",rebuild:!0},dotType:{type:"select",rebuild:!0,options:{"":"",sphere:"sphere",point:"point"}},radiusType:{type:"select",options:{"":"",value:"value","abs-value":"abs-value","value-min":"value-min",deviation:"deviation",size:"size"}},radius:{type:"number",precision:3,max:10,min:.001,property:"size"},scale:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,disableImpostor:!0,pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},this.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform",random:"random"}}}),e instanceof sf?(this.surface=void 0,this.volume=new uf(e)):(this.surface=e,this.volume=void 0),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"uniform"),n.colorValue=gs(n.colorValue,14540253),this.thresholdType=gs(n.thresholdType,"sigma"),this.thresholdMin=gs(n.thresholdMin,2),this.thresholdMax=gs(n.thresholdMax,1/0),this.thresholdOut=gs(n.thresholdOut,!1),this.dotType=gs(n.dotType,"point"),this.radius=gs(n.radius,.1),this.scale=gs(n.scale,1),this.pointSize=gs(n.pointSize,1),this.sizeAttenuation=gs(n.sizeAttenuation,!0),this.sortParticles=gs(n.sortParticles,!1),this.useTexture=gs(n.useTexture,!1),this.alphaTest=gs(n.alphaTest,.5),this.forceTransparent=gs(n.forceTransparent,!1),this.edgeBleach=gs(n.edgeBleach,0),t.prototype.init.call(this,n),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t)}),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t={};if(this.volume){var e,n,r=this.volume;"sigma"===this.thresholdType?(e=r.getValueForSigma(this.thresholdMin),n=r.getValueForSigma(this.thresholdMax)):(e=this.thresholdMin,n=this.thresholdMax),r.setFilter(e,n,this.thresholdOut),t.position=r.getDataPosition(),t.color=r.getDataColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=r.getDataSize(this.radius,this.scale),t.picking=r.getDataPicking())}else{var i=this.surface;t.position=i.getPosition(),t.color=i.getColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=i.getSize(this.radius,this.scale),t.picking=i.getPicking())}"sphere"===this.dotType?this.dotBuffer=new Mm(t,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new fg(t,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach})),this.bufferList.push(this.dotBuffer)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=t||{}).color&&(this.volume?e.color=this.volume.getDataColor(this.getColorParams()):e.color=this.surface.getColor(this.getColorParams())),"sphere"===this.dotType&&(t.radius||t.scale)&&(this.volume?e.radius=this.volume.getDataSize(this.radius,this.scale):e.radius=this.surface.getSize(this.radius,this.scale)),this.dotBuffer.setAttributes(e)}},e.prototype.setParameters=function(e,n,r){return n=n||{},e&&void 0!==e.thresholdType&&this.volume instanceof sf&&("value"===this.thresholdType&&"sigma"===e.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===e.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=e.thresholdType),e&&void 0!==e.radiusType&&("radius"===e.radiusType?this.radius=.1:this.radius=e.radiusType,n.radius=!0,"sphere"!==this.dotType||Ju&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(n.radius=!0,"sphere"!==this.dotType||Ju&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(n.scale=!0,"sphere"!==this.dotType||Ju&&!this.disableImpostor||(r=!0)),t.prototype.setParameters.call(this,e,n,r),this},e}(og);ul.add("shader/Image.vert","uniform float clipRadius;\nuniform vec3 clipCenter;\nvarying vec2 vUv;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nvoid main() {\n#include begin_vertex\n#include project_vertex\nvUv = uv;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n}"),ul.add("shader/Image.frag","uniform sampler2D map;\nuniform float opacity;\nuniform vec2 mapSize;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec2 vUv;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform sampler2D pickingMap;\nuniform float objectId;\n#else\n#include fog_pars_fragment\n#endif\n#if defined( CUBIC_INTERPOLATION )\n#if defined( CATMULROM_FILTER ) || defined( MITCHELL_FILTER )\n#if defined( CATMULROM_FILTER )\nconst float B = 0.0;\nconst float C = 0.5;\n#elif defined( MITCHELL_FILTER )\nconst float B = 0.333;\nconst float C = 0.333;\n#endif\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f < 1.0 ){\nreturn ( ( 12.0 - 9.0 * B - 6.0 * C ) * ( f * f * f ) +\n( -18.0 + 12.0 * B + 6.0 *C ) * ( f * f ) +\n( 6.0 - 2.0 * B ) ) / 6.0;\n}else if( f >= 1.0 && f < 2.0 ){\nreturn ( ( -B - 6.0 * C ) * ( f * f * f )\n+ ( 6.0 * B + 30.0 * C ) * ( f *f ) +\n( - ( 12.0 * B ) - 48.0 * C ) * f +\n8.0 * B + 24.0 * C ) / 6.0;\n}else{\nreturn 0.0;\n}\n}\n#elif defined( BSPLINE_FILTER )\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f >= 0.0 && f <= 1.0 ){\nreturn ( 2.0 / 3.0 ) + ( 0.5 ) * ( f * f * f ) - ( f * f );\n}else if( f > 1.0 && f <= 2.0 ){\nreturn 1.0 / 6.0 * pow( ( 2.0 - f ), 3.0 );\n}\nreturn 1.0;\n}\n#else\nfloat filter( float x ){\nreturn 1.0;\n}\n#endif\nvec4 biCubic( sampler2D tex, vec2 texCoord ){\nvec2 texelSize = 1.0 / mapSize;\ntexCoord -= texelSize / 2.0;\nvec4 nSum = vec4( 0.0 );\nfloat nDenom = 0.0;\nvec2 cell = fract( texCoord * mapSize );\nfor( float m = -1.0; m <= 2.0; ++m ){\nfor( float n = -1.0; n <= 2.0; ++n ){\nvec4 vecData = texture2D(\ntex, texCoord + texelSize * vec2( m, n )\n);\nfloat c = filter( m - cell.x ) * filter( -n + cell.y );\nnSum += vecData * c;\nnDenom += c;\n}\n}\nreturn nSum / nDenom;\n}\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( CUBIC_INTERPOLATION )\ngl_FragColor = biCubic( map, vUv );\n#else\ngl_FragColor = texture2D( map, vUv );\n#endif\n#if defined( PICKING )\nif( gl_FragColor.a < 0.7 )\ndiscard;\ngl_FragColor = vec4( texture2D( pickingMap, vUv ).xyz, objectId );\n#else\nif( gl_FragColor.a < 0.01 )\ndiscard;\ngl_FragColor.a *= opacity;\n#include fog_fragment\n#endif\n}");var gg=new Uint16Array([0,1,2,1,3,2]),vg=new Float32Array([0,1,0,0,1,1,1,0]),yg=function(t){function e(e,n){var r=e||{},i=n||{};t.call(this,{position:r.position,index:gg,picking:r.picking},i),this.forceTransparent=!0,this.filter=gs(i.filter,"nearest");var o=new ze(r.imageData,r.width,r.height);o.flipY=!0,this.tex=o;for(var a=r.imageData.length,s=new Uint8Array(a),c=0;c<a;c+=4){var u=c/4;s[c]=u>>16&255,s[c+1]=u>>8&255,s[c+2]=255&u}var l=new ze(s,r.width,r.height);l.flipY=!0,l.minFilter=Tt,l.magFilter=Tt,this.pickingTex=l,this.addUniforms({map:{value:o},pickingMap:{value:l},mapSize:{value:new Se(r.width,r.height)}}),this.geometry.addAttribute("uv",new yr(vg,2))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={parameters:{},vertexShader:{},fragmentShader:{}};return n.parameters.get=function(){return Object.assign.call(this,{filter:{updateShader:!0,uniform:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var n=t.prototype.getDefines.call(this,e);return this.filter.startsWith("cubic")&&(n.CUBIC_INTERPOLATION=1,this.filter.endsWith("bspline")?n.BSPLINE_FILTER=1:this.filter.endsWith("catmulrom")?n.CATMULROM_FILTER=1:this.filter.endsWith("mitchell")&&(n.MITCHELL_FILTER=1)),n},e.prototype.updateTexture=function(){var t=this.tex;this.filter.startsWith("cubic")?(t.minFilter=Tt,t.magFilter=Tt):"linear"===this.filter?(t.minFilter=Rt,t.magFilter=Rt):(t.minFilter=Tt,t.magFilter=Tt),t.needsUpdate=!0,this.pickingTex.needsUpdate=!0},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.updateTexture();var e=this.material;e.uniforms.map.value=this.tex,e.blending=N,e.needsUpdate=!0;var n=this.wireframeMaterial;n.uniforms.map.value=this.tex,n.blending=N,n.needsUpdate=!0;var r=this.pickingMaterial;r.uniforms.map.value=this.tex,r.uniforms.pickingMap.value=this.pickingTex,r.blending=N,r.needsUpdate=!0},e.prototype.setUniforms=function(e){e&&void 0!==e.filter&&(this.updateTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},n.vertexShader.get=function(){return"Image.vert"},n.fragmentShader.get=function(){return"Image.frag"},Object.defineProperties(e.prototype,n),e}(fm),bg=function(t,e){var n=e||{};this.dimension=gs(n.dimension,"x"),this.positionType=gs(n.positionType,"percent"),this.position=gs(n.position,30),this.thresholdType=gs(n.thresholdType,"sigma"),this.thresholdMin=gs(n.thresholdMin,-1/0),this.thresholdMax=gs(n.thresholdMax,1/0),this.normalize=gs(n.normalize,!1),this.volume=t};bg.prototype.getPositionFromCoordinate=function(t){var e,n=this.dimension,r=this.volume,i=r.matrix,o=(new Ne).setFromMatrixPosition(i)[n],a=(new Ne).setFromMatrixScale(i)[n];return e="x"===n?r.nx:"y"===n?r.ny:r.nz,Math.round(((t-o)/(e/100)+1)/a)},bg.prototype.getData=function(t){t=t||{};var e,n=this.volume,r=n.data,i=n.matrix;function o(t){return Math.round(t/100*(e-1))}function a(t,e,r,i){return 3*(r*n.ny*n.nx+e*n.nx+t)+i}e="coordinate"===this.positionType?this.getPositionFromCoordinate(this.position):this.position;var s,c,u,l,h,p=new Float32Array(12),d=new Ne,f=0,m=0,g=0,v=n.nx,y=n.ny,b=n.nz;function x(t,e,n,r){d.set(t,e,n).applyMatrix4(i).toArray(p,r)}"x"===this.dimension?(u=o(n.nx),l=n.ny-1,h=n.nz-1,s=n.nz,c=n.ny,v=(f=u)+1,x(u,0,0,0),x(u,l,0,3),x(u,0,h,6),x(u,l,h,9)):"y"===this.dimension?(u=n.nx-1,l=o(n.ny),h=n.nz-1,s=n.nz,c=n.nx,y=(m=l)+1,x(0,l,0,0),x(u,l,0,3),x(0,l,h,6),x(u,l,h,9)):"z"===this.dimension&&(u=n.nx-1,l=n.ny-1,h=o(n.nz),s=n.nx,c=n.ny,b=(g=h)+1,x(0,0,h,0),x(0,l,h,3),x(u,0,h,6),x(u,l,h,9));var _,w,S=0,C=0,A=new Uint8Array(s*c*4),E=new Float32Array(s*c);"sigma"===this.thresholdType?(_=n.getValueForSigma(this.thresholdMin),w=n.getValueForSigma(this.thresholdMax)):(_=this.thresholdMin,w=this.thresholdMax);var M=Object.assign({},t.colorParams,{volume:n});this.normalize&&(M.domain=[0,1]);var T,P,I,R=ol.getScheme(M),O=new Float32Array(3),L=R.getScale();if(this.normalize){T=1/0,P=-1/0;for(var k=m;k<y;++k)for(var N=f;N<v;++N)for(var D=g;D<b;++D){var z=r[a(N,k,D,0)/3];z<T&&(T=z),z>P&&(P=z)}I=P-T}for(var F=m;F<y;++F)for(var B=f;B<v;++B)for(var U=g;U<b;++U){var j=a(B,F,U,0)/3,G=r[j];this.normalize&&(G=(G-T)/I),R.colorToArray(L(G),O),A[S]=Math.round(255*O[0]),A[S+1]=Math.round(255*O[1]),A[S+2]=Math.round(255*O[2]),A[S+3]=G>_&&G<w?255:0,E[C]=j,++C,S+=4}var V=new $p(E,n);return{position:p,imageData:A,width:s,height:c,picking:V}};var xg=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="slice",this.parameters=Object.assign({filter:{type:"select",buffer:!0,options:{nearest:"nearest",linear:"linear","cubic-bspline":"cubic-bspline","cubic-catmulrom":"cubic-catmulrom","cubic-mitchell":"cubic-mitchell"}},positionType:{type:"select",rebuild:!0,options:{percent:"percent",coordinate:"coordinate"}},position:{type:"range",step:.1,max:100,min:1,rebuild:!0},dimension:{type:"select",rebuild:!0,options:{x:"x",y:"y",z:"z"}},thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-1/0,rebuild:!0},normalize:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null,linewidth:null,colorScheme:null,roughness:null,metalness:null,diffuse:null}),this.volume=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=this.volume,r=e||{};r.colorDomain=gs(r.colorDomain,[n.min,n.max]),r.colorScheme=gs(r.colorScheme,"value"),r.colorScale=gs(r.colorScale,"Spectral"),this.colorScheme="value",this.dimension=gs(r.dimension,"x"),this.filter=gs(r.filter,"cubic-bspline"),this.positionType=gs(r.positionType,"percent"),this.position=gs(r.position,30),this.thresholdType=gs(r.thresholdType,"sigma"),this.thresholdMin=gs(r.thresholdMin,-1/0),this.thresholdMax=gs(r.thresholdMax,1/0),this.normalize=gs(r.normalize,!1),t.prototype.init.call(this,r),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t)}),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t=new bg(this.volume,{positionType:this.positionType,position:this.position,dimension:this.dimension,thresholdType:this.thresholdType,thresholdMin:this.thresholdMin,thresholdMax:this.thresholdMax,normalize:this.normalize}),e=new yg(t.getData({colorParams:this.getColorParams()}),this.getBufferParams({filter:this.filter}));this.bufferList.push(e)},e}(og),_g=function(t){function e(e,n,r){var i=r||{};if(t.call(this,e,n,i),this.type="structure",this.parameters=Object.assign({radiusType:{type:"select",options:Sd.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},this.parameters),this.selection=new Hu(i.sele),this.dataList=[],this.structure=e,this.structureView=this.structure.getView(this.selection),e.biomolDict){var o={default:"default","":e.unitcell?"AU":"FULL"};Object.keys(e.biomolDict).forEach(function(t){o[t]=t}),this.parameters.assembly={type:"select",options:o,rebuild:!0}}else this.parameters.assembly=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={defaultScale:{}};return n.defaultScale.get=function(){return{vdw:1,covalent:1,bfactor:.01,sstruc:1}},e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"element"),this.radius=gs(n.radius,"vdw"),this.scale=gs(n.scale,1),this.assembly=gs(n.assembly,"default"),this.defaultAssembly=gs(n.defaultAssembly,""),"auto"===n.quality&&(n.quality=this.getQuality()),t.prototype.init.call(this,n),this.selection.signals.stringChanged.add(function(){this.build()},this),this.build()},e.prototype.getAssembly=function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},e.prototype.getQuality=function(){var t,e=this.structureView,n=this.getAssembly();return t=n?n.getAtomCount(e):e.atomCount,Zu&&(t*=4),e.atomStore.count/e.residueStore.count<2&&(t*=10),t<15e3?"high":t<8e4?"medium":"low"},e.prototype.create=function(){if(0!==this.structureView.atomCount){var t=this.getAssembly();if(t)t.partList.forEach(function(t,e){var n=t.getView(this.structureView);if(0!==n.atomCount){var r=this.createData(n,e);r&&(r.sview=n,r.instanceList=t.getInstanceList(),this.dataList.push(r))}},this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},e.prototype.createData=function(){console.error("createData not implemented")},e.prototype.update=function(t){!this.lazy||this.visible?this.dataList.forEach(function(e){e.bufferList.length>0&&this.updateData(t,e)},this):Object.assign(this.lazyProps.what,t)},e.prototype.updateData=function(){this.build()},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.structure=this.structure,e},e.prototype.getAtomParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.getBondParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.setSelection=function(t,e){return this.selection.setString(t,e),this},e.prototype.setParameters=function(e,n,r){return n=n||{},e&&void 0!==e.radiusType&&("size"===e.radiusType?this.radius=1:this.radius=e.radiusType,delete e.radiusType,n.radius=!0,Ju&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(n.radius=!0,Ju&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(n.radius=!0,Ju&&!this.disableImpostor||(r=!0)),e&&void 0!==e.defaultAssembly&&(r=!0),t.prototype.setParameters.call(this,e,n,r),this},e.prototype.getParameters=function(){return Object.assign(t.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly})},e.prototype.attach=function(t){var e=this.viewer,n=this.bufferList;this.dataList.forEach(function(t){t.bufferList.forEach(function(r){n.push(r),e.add(r,t.instanceList)})}),this.setVisibility(this.visible),t()},e.prototype.clear=function(){this.dataList.length=0,t.prototype.clear.call(this)},e.prototype.dispose=function(){this.structureView.dispose(),delete this.structure,delete this.structureView,t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,n),e}(og),wg=function(t){function e(e,n){var r=4*(e.position1.length/3);t.call(this,{position:new Float32Array(3*r),color:new Float32Array(3*r)},n),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,n,r,i,o,a,s=this.geometry.attributes;t.position1&&t.position2&&(e=t.position1,n=t.position2,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(r=t.color,i=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,l,h,p,d,f,m,g,v,y,b=this.size,x=0;x<b;x++)u=3*x,c=4*x*3,e&&n&&(d=e[u],f=e[u+1],m=e[u+2],l=(d+(g=n[u]))/2,h=(f+(v=n[u+1]))/2,p=(m+(y=n[u+2]))/2,o[c]=d,o[c+1]=f,o[c+2]=m,o[c+3]=l,o[c+4]=h,o[c+5]=p,o[c+6]=l,o[c+7]=h,o[c+8]=p,o[c+9]=g,o[c+10]=v,o[c+11]=y),r&&i&&(a[c]=a[c+3]=r[u],a[c+1]=a[c+4]=r[u+1],a[c+2]=a[c+5]=r[u+2],a[c+6]=a[c+9]=i[u],a[c+7]=a[c+10]=i[u+1],a[c+8]=a[c+11]=i[u+2])},n.isLine.get=function(){return!0},n.vertexShader.get=function(){return"Line.vert"},n.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,n),e}(fm),Sg=function(t){function e(e,n,r){t.call(this,e.structure,n,r),this.type="trajectory",this.parameters=Object.assign({drawLine:{type:"boolean",rebuild:!0},drawCylinder:{type:"boolean",rebuild:!0},drawPoint:{type:"boolean",rebuild:!0},drawSphere:{type:"boolean",rebuild:!0},linewidth:{type:"integer",max:20,min:1,rebuild:!0},pointSize:{type:"integer",max:20,min:1,rebuild:!0},sizeAttenuation:{type:"boolean",rebuild:!0},sort:{type:"boolean",rebuild:!0}},this.parameters),this.manualAttach=!0,this.trajectory=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"uniform"),n.colorValue=gs(n.colorValue,14540253),this.drawLine=gs(n.drawLine,!0),this.drawCylinder=gs(n.drawCylinder,!1),this.drawPoint=gs(n.drawPoint,!1),this.drawSphere=gs(n.drawSphere,!1),this.pointSize=gs(n.pointSize,1),this.sizeAttenuation=gs(n.sizeAttenuation,!1),this.sort=gs(n.sort,!0),t.prototype.init.call(this,n)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach(function(t){e.viewer.add(t)}),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){t()},e.prototype.create=function(){if(0!==this.atomSet.atomCount){var t=this,e=this.atomSet.atoms[0].index;this.trajectory.getPath(e,function(e){var n=e.length/3,r=new En(t.colorValue);if(t.drawSphere){var i=new Mm({position:e,color:ql(n,r.r,r.g,r.b),radius:Wl(n,.2)},t.getBufferParams({sphereDetail:t.sphereDetail,dullInterior:!0,disableImpostor:t.disableImpostor}));t.bufferList.push(i)}if(t.drawCylinder){var o=new jm({position1:e.subarray(0,-3),position2:e.subarray(3),color:ql(n-1,r.r,r.g,r.b),color2:ql(n-1,r.r,r.g,r.b),radius:Wl(n,.05)},t.getBufferParams({openEnded:!1,radialSegments:t.radialSegments,disableImpostor:t.disableImpostor,dullInterior:!0}));t.bufferList.push(o)}if(t.drawPoint){var a=new fg({position:e,color:ql(n,r.r,r.g,r.b)},t.getBufferParams({pointSize:t.pointSize,sizeAttenuation:t.sizeAttenuation,sort:t.sort}));t.bufferList.push(a)}if(t.drawLine){var s=new wg({position1:e.subarray(0,-3),position2:e.subarray(3),color:ql(n-1,r.r,r.g,r.b),color2:ql(n-1,r.r,r.g,r.b)},t.getBufferParams());t.bufferList.push(s)}t.attach()})}},e}(_g);function Cg(t){el.error("makeRepresentation: representation type "+t+" unknown")}var Ag=0,Eg=new De,Mg=new Ne,Tg=function(t,e){Object.defineProperty(this,"id",{value:Ag++});var n=e||{};this.name=n.name,this.uuid=pu(),this.visible=void 0===n.visible||n.visible,this.signals={representationAdded:new Su,representationRemoved:new Su,visibilityChanged:new Su,matrixChanged:new Su,statusChanged:new Su,nameChanged:new Su,disposed:new Su},this.stage=t,this.viewer=t.viewer,this.reprList=[],this.annotationList=[],this.matrix=new De,this.position=new Ne,this.quaternion=new ke,this.scale=new Ne(1,1,1),this.transform=new De,this.controls=new ap(this)},Pg={type:{}};Pg.type.get=function(){return"component"},Tg.prototype.setPosition=function(t){return Array.isArray(t)?this.position.fromArray(t):this.position.copy(t),this.updateMatrix(),this},Tg.prototype.setRotation=function(t){if(Array.isArray(t))if(3===t.length){var e=(new Zn).fromArray(t);this.quaternion.setFromEuler(e)}else this.quaternion.fromArray(t);else t instanceof Zn?this.quaternion.setFromEuler(t):this.quaternion.copy(t);return this.updateMatrix(),this},Tg.prototype.setScale=function(t){return this.scale.set(t,t,t),this.updateMatrix(),this},Tg.prototype.setTransform=function(t){return this.transform.copy(t),this.updateMatrix(),this},Tg.prototype.updateMatrix=function(){var t=this,e=this.getCenterUntransformed(Mg);this.matrix.makeTranslation(-e.x,-e.y,-e.z),Eg.makeRotationFromQuaternion(this.quaternion),this.matrix.premultiply(Eg),Eg.makeScale(this.scale.x,this.scale.y,this.scale.z),this.matrix.premultiply(Eg);var n=this.position;Eg.makeTranslation(n.x+e.x,n.y+e.y,n.z+e.z),this.matrix.premultiply(Eg),this.matrix.premultiply(this.transform),this.reprList.forEach(function(e){e.setParameters({matrix:t.matrix})}),this.stage.viewer.updateBoundingBox(),this.signals.matrixChanged.dispatch(this.matrix)},Tg.prototype.addAnnotation=function(t,e,n){var r=new np(this,t,e,n);return this.annotationList.push(r),r},Tg.prototype.removeAnnotation=function(t){var e=this.annotationList.indexOf(t);-1!==e&&(this.annotationList.splice(e,1),t.dispose())},Tg.prototype.removeAllAnnotations=function(){this.annotationList.forEach(function(t){t.dispose()}),this.annotationList.length=0},Tg.prototype.addRepresentation=function(t,e,n){var r=n||{},i=this.stage.getParameters();r.matrix=this.matrix.clone(),r.quality=r.quality||i.quality,r.disableImpostor=gs(r.disableImpostor,!i.impostor),r.useWorker=gs(r.useWorker,i.workerDefault),r.visible=gs(r.visible,!0);var o=Object.assign({},r,{visible:this.visible&&r.visible}),a=function(t,e,n,r){var i;if(nl&&el.time("makeRepresentation "+t),e instanceof om){if(!(i=sl.get(t)))return void Cg(t)}else if(e instanceof rf)if("surface"===t)i=dg;else{if("dot"!==t)return void Cg(t);i=mg}else if(e instanceof sf)if("surface"===t)i=dg;else if("dot"===t)i=mg;else{if("slice"!==t)return void Cg(t);i=xg}else if(e instanceof lm)i=Sg;else if(e instanceof rg)i=ag,e=e.getBufferList();else{if("buffer"!==t)return void el.error("makeRepresentation: object "+e+" unknown");i=ag}var o=new i(e,n,r);return nl&&el.timeEnd("makeRepresentation "+t),o}(t,e,this.viewer,o),s=this.__getRepresentationComponent(a,r);return this.reprList.push(s),this.signals.representationAdded.dispatch(s),s},Tg.prototype.addBufferRepresentation=function(t,e){return Tg.prototype.addRepresentation.call(this,"buffer",t,e)},Tg.prototype.hasRepresentation=function(t){return-1!==this.reprList.indexOf(t)},Tg.prototype.removeRepresentation=function(t){var e=this.reprList.indexOf(t);-1!==e&&(this.reprList.splice(e,1),t.dispose(),this.signals.representationRemoved.dispatch(t))},Tg.prototype.updateRepresentations=function(t){this.reprList.forEach(function(e){e.update(t)}),this.stage.viewer.requestRender()},Tg.prototype.removeAllRepresentations=function(){this.reprList.slice(0).forEach(function(t){t.dispose()})},Tg.prototype.dispose=function(){this.removeAllAnnotations(),this.removeAllRepresentations(),delete this.annotationList,delete this.reprList,this.signals.disposed.dispatch()},Tg.prototype.setVisibility=function(t){return this.visible=t,this.eachRepresentation(function(t){t.updateVisibility()}),this.annotationList.forEach(function(t){t.updateVisibility()}),this.signals.visibilityChanged.dispatch(t),this},Tg.prototype.setStatus=function(t){return this.status=t,this.signals.statusChanged.dispatch(t),this},Tg.prototype.setName=function(t){return this.name=t,this.signals.nameChanged.dispatch(t),this},Tg.prototype.getBox=function(){return(t=this).getBoxUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},Tg.prototype.getCenter=function(){return(t=this).getCenterUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},Tg.prototype.getZoom=function(){return this.stage.getZoomForBox((t=this).getBox.apply(t,arguments));var t},Tg.prototype.getBoxUntransformed=function(){},Tg.prototype.getCenterUntransformed=function(){return this.getBoxUntransformed().getCenter()},Tg.prototype.autoView=function(t){this.stage.animationControls.zoomMove(this.getCenter(),this.getZoom(),gs(t,0))},Tg.prototype.eachRepresentation=function(t){this.reprList.forEach(t)},Object.defineProperties(Tg.prototype,Pg),Tg.prototype.__getRepresentationComponent=function(t,e){return new Ig(this.stage,t,e,this)};var Ig=function(t){function e(e,n,r,i){var o=r||{};o.name=gs(o.name,n.type),t.call(this,e,o),this.signals=Object.assign(this.signals,{parametersChanged:new Su}),this.parent=i,this.setRepresentation(n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"representation"},e.prototype.getType=function(){return this.repr.type},e.prototype.setRepresentation=function(t){this.disposeRepresentation(),this.repr=t,this.stage.tasks.listen(this.repr.tasks),this.updateVisibility()},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.hasRepresentation=function(){},e.prototype.disposeRepresentation=function(){this.repr&&(this.stage.tasks.unlisten(this.repr.tasks),this.repr.dispose())},e.prototype.dispose=function(){this.parent&&this.parent.hasRepresentation(this)?this.parent.removeRepresentation(this):(this.disposeRepresentation(),this.signals.disposed.dispatch())},e.prototype.setVisibility=function(t){return this.visible=t,this.updateVisibility(),this.signals.visibilityChanged.dispatch(this.visible),this},e.prototype.getVisibility=function(){return this.parent?this.parent.visible&&this.visible:this.visible},e.prototype.toggleVisibility=function(){return this.setVisibility(!this.visible)},e.prototype.updateVisibility=function(){this.repr.setVisibility(this.getVisibility())},e.prototype.update=function(t){return this.repr.update(t),this},e.prototype.build=function(t){return this.repr.build(t),this},e.prototype.setSelection=function(t){return this.repr.setSelection(t),this},e.prototype.setParameters=function(t){return this.repr.setParameters(t),this.signals.parametersChanged.dispatch(this.repr.getParameters()),this},e.prototype.getParameters=function(){return this.repr.getParameters()},e.prototype.setColor=function(t){return this.repr.setColor(t),this},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,n),e}(Tg),Rg=function(t){this.list=t||[];for(var e=this.list.length,n=0;n<e;++n){this.list[n].signals.disposed.add(this._remove,this)}};Rg.prototype._remove=function(t){var e=this.list.indexOf(t);-1!==e&&this.list.splice(e,1)},Rg.prototype._invoke=function(t,e){for(var n=this.list.length,r=0;r<n;++r){var i=this.list[r],o=i[t];"function"==typeof o&&o.apply(i,e)}return this},Rg.prototype.setVisibility=function(t){return this._invoke("setVisibility",[t])},Rg.prototype.setSelection=function(t){return this._invoke("setSelection",[t])},Rg.prototype.dispose=function(){return this._invoke("dispose")};var Og=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addRepresentation=function(t,e){return this._invoke("addRepresentation",[t,e])},e.prototype.autoView=function(t){return this._invoke("autoView",[t])},e}(Rg),Lg=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setParameters=function(t){return this._invoke("setParameters",[t])},e.prototype.setColor=function(t){return this._invoke("setColor",[t])},e}(Rg);function kg(t,e){return t instanceof RegExp?null!==e.name.match(t):e.name===t}var Ng=new Ne,Dg=function(t,e){if(this.signals={parametersChanged:new Su,fullscreenChanged:new Su,componentAdded:new Su,componentRemoved:new Su,clicked:new Su,hovered:new Su},this.tasks=new Rl,this.compList=[],this.defaultFileParams={},this.viewer=new uh(t),this.viewer.renderer){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{display:"none",position:"fixed",zIndex:2+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif"}),document.body.appendChild(this.tooltip),this.mouseObserver=new hh(this.viewer.renderer.domElement),this.viewerControls=new Lh(this),this.trackballControls=new xh(this),this.pickingControls=new Ch(this),this.animationControls=new Wh(this),this.mouseControls=new Zh(this),this.pickingBehavior=new Qh(this),this.mouseBehavior=new Jh(this),this.animationBehavior=new tp(this),this.keyBehavior=new ep(this),this.spinAnimation=this.animationControls.spin([0,1,0],.005),this.spinAnimation.pause(!0),this.rockAnimation=this.animationControls.rock([0,1,0],.005),this.rockAnimation.pause(!0);var n=Object.assign({impostor:!0,quality:"medium",workerDefault:!0,sampleLevel:0,backgroundColor:"black",rotateSpeed:2,zoomSpeed:1.2,panSpeed:1,clipNear:0,clipFar:100,clipDist:10,fogNear:50,fogFar:100,cameraFov:40,cameraType:"perspective",lightColor:14540253,lightIntensity:1,ambientColor:14540253,ambientIntensity:.2,hoverTimeout:0,tooltip:!0,mousePreset:"default"},e);this.parameters={backgroundColor:{type:"color"},quality:{type:"select",options:{auto:"auto",low:"low",medium:"medium",high:"high"}},sampleLevel:{type:"range",step:1,max:5,min:-1},impostor:{type:"boolean"},workerDefault:{type:"boolean"},rotateSpeed:{type:"number",precision:1,max:10,min:0},zoomSpeed:{type:"number",precision:1,max:10,min:0},panSpeed:{type:"number",precision:1,max:10,min:0},clipNear:{type:"range",step:1,max:100,min:0},clipFar:{type:"range",step:1,max:100,min:0},clipDist:{type:"integer",max:200,min:0},fogNear:{type:"range",step:1,max:100,min:0},fogFar:{type:"range",step:1,max:100,min:0},cameraType:{type:"select",options:{perspective:"perspective",orthographic:"orthographic"}},cameraFov:{type:"range",step:1,max:120,min:15},lightColor:{type:"color"},lightIntensity:{type:"number",precision:2,max:10,min:0},ambientColor:{type:"color"},ambientIntensity:{type:"number",precision:2,max:10,min:0},hoverTimeout:{type:"integer",max:1e4,min:-1},tooltip:{type:"boolean"},mousePreset:{type:"select",options:{default:"default",pymol:"pymol",coot:"coot"}}},this.setParameters(n),this.viewer.animate()}};Dg.prototype.setParameters=function(t){var e=Object.assign({},t),n=this.parameters,r=this.viewer,i=this.trackballControls;for(var o in e)void 0!==e[o]&&n[o]&&(n[o].int&&(e[o]=parseInt(e[o])),n[o].float&&(e[o]=parseFloat(e[o])),n[o].value=e[o]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(i.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(i.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(i.panSpeed=e.panSpeed),void 0!==e.mousePreset&&this.mouseControls.preset(e.mousePreset),this.mouseObserver.setParameters({hoverTimeout:e.hoverTimeout}),r.setClip(e.clipNear,e.clipFar,e.clipDist),r.setFog(void 0,e.fogNear,e.fogFar),r.setCamera(e.cameraType,e.cameraFov),r.setSampling(e.sampleLevel),r.setBackground(e.backgroundColor),r.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},Dg.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},Dg.prototype.defaultFileRepresentation=function(t){if("structure"===t.type){var e,n,r;t.setSelection("/0");var i=t.structure;if(i.biomolDict.BU1){var o=i.biomolDict.BU1;e=o.getAtomCount(i),n=o.getResidueCount(i),r=o.getInstanceCount(),t.setDefaultAssembly("BU1")}else e=i.getModelProxy(0).atomCount,n=i.getModelProxy(0).residueCount,r=1;var a=e;Zu&&(a*=4);var s=i.atomStore.count/i.residueStore.count<2;s&&(a*=10);var c="chainname",u="RdYlBu",l=!1;if(1===i.getChainnameCount("polymer and /0")&&(c="residueindex",u="spectral",l=!0),nl&&console.log(a,e,r,s),n/r<4)t.addRepresentation("ball+stick",{colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"});else if(r>5&&a>15e3||a>7e5){var h=Math.min(1.5,Math.max(.1,2e3/(a/r)));s&&(h=Math.min(h,.15)),t.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:h,colorScheme:c,colorScale:u,colorReverse:l,useWorker:!1})}else a>25e4?t.addRepresentation("backbone",{lineOnly:!0,colorScheme:c,colorScale:u,colorReverse:l}):a>1e5?t.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:c,colorScale:u,colorReverse:l,scale:2}):a>8e4?t.addRepresentation("backbone",{colorScheme:c,colorScale:u,colorReverse:l,scale:2}):(t.addRepresentation("cartoon",{colorScheme:c,colorScale:u,colorReverse:l,scale:.7,aspectRatio:5,quality:"auto"}),a<5e4&&t.addRepresentation("base",{colorScheme:c,colorScale:u,colorReverse:l,quality:"auto"}),t.addRepresentation("ball+stick",{sele:"ligand",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));t.structure.frames.length&&t.addTrajectory()}else"surface"!==t.type&&"volume"!==t.type||t.addRepresentation("surface");this.tasks.onZeroOnce(this.autoView,this)},Dg.prototype.loadFile=function(t,e){var n=Object.assign({},this.defaultFileParams,e),r=new Tg(this,n);r.name=bs(t).name,this.addComponent(r);var i=this.tasks;i.increment();var o=function(t){return this.removeComponent(r),"script"===(r=this.addComponentFromObject(t,n)).type?r.run():n.defaultRepresentation&&this.defaultFileRepresentation(r),i.decrement(),r}.bind(this);return("dcd"===gs(n.ext,bs(t).ext)?Promise.reject(new Error("loadFile: ext 'dcd' must be loaded into a structure component")):Al(t,n)).then(o,function(t){throw r.setStatus(t),i.decrement(),t})},Dg.prototype.addComponent=function(t){t?(this.compList.push(t),this.signals.componentAdded.dispatch(t)):el.warn("Stage.addComponent: no component given")},Dg.prototype.addComponentFromObject=function(t,e){var n=hl.get(t.type);if(n){var r=new n(this,t,e);return this.addComponent(r),r}el.warn("no component for object type",t.type)},Dg.prototype.removeComponent=function(t){var e=this.compList.indexOf(t);-1!==e&&(this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t))},Dg.prototype.removeAllComponents=function(t){this.compList.slice().forEach(function(e){t&&e.type!==t||this.removeComponent(e)},this)},Dg.prototype.handleResize=function(){this.viewer.handleResize()},Dg.prototype.setSize=function(t,e){var n=this.viewer.container;n!==document.body&&(void 0!==t&&(n.style.width=t),void 0!==e&&(n.style.height=e),this.handleResize())},Dg.prototype.toggleFullscreen=function(t){if(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled){var e=this;t=t||this.viewer.container,this.lastFullscreenElement=t,n()?document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t.dataset.normalWidth=t.style.width,t.dataset.normalHeight=t.style.height,t.style.width=window.screen.width+"px",t.style.height=window.screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout(function(){e.handleResize()},100))}else el.log("fullscreen mode (currently) not possible");function n(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function r(){if(!n()&&e.lastFullscreenElement){var t=e.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r),e.handleResize(),e.signals.fullscreenChanged.dispatch(!1)}}},Dg.prototype.setSpin=function(t){t?(this.spinAnimation.resume(!0),this.rockAnimation.pause(!0)):this.spinAnimation.pause(!0)},Dg.prototype.setRock=function(t){t?(this.rockAnimation.resume(!0),this.spinAnimation.pause(!0)):this.rockAnimation.pause(!0)},Dg.prototype.toggleSpin=function(){this.setSpin(this.spinAnimation.paused)},Dg.prototype.toggleRock=function(){this.setRock(this.rockAnimation.paused)},Dg.prototype.setFocus=function(t){var e=du(t/2,0,49.9),n=100-e,r=(n-e)/2;this.setParameters({clipNear:e,clipFar:n,fogNear:fu(n-r),fogFar:fu(n+r)})},Dg.prototype.getZoomForBox=function(t){var e=t.getSize(Ng),n=Math.max(e.x,e.y,e.z),r=Math.min(e.x,e.y,e.z),i=n+Math.sqrt(r),o=Fs(this.viewer.perspectiveCamera.fov),a=this.viewer.width,s=this.viewer.height,c=s<a?1:a/s;return i=Math.abs(.5*i/c/Math.sin(o/2)),-(i+=this.parameters.clipDist.value)},Dg.prototype.getBox=function(){return this.viewer.boundingBox},Dg.prototype.getZoom=function(){return this.getZoomForBox(this.getBox())},Dg.prototype.getCenter=function(t){return this.getBox().getCenter(t)},Dg.prototype.autoView=function(t){this.animationControls.zoomMove(this.getCenter(),this.getZoom(),gs(t,0))},Dg.prototype.makeImage=function(t){var e=this.viewer,n=this.tasks;return new Promise(function(r,i){n.onZeroOnce(function(){n.increment(),e.makeImage(t).then(function(t){n.decrement(),r(t)}).catch(function(t){n.decrement(),i(t)})})})},Dg.prototype.setImpostor=function(t){this.parameters.impostor.value=t;var e=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(n){if("script"!==n.type&&e.includes(n.getType())){var r=n.getParameters();r.disableImpostor=!t,n.build(r)}})},Dg.prototype.setQuality=function(t){this.parameters.quality.value=t;var e=["tube","cartoon","ribbon","trace","rope"],n=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(r){if("script"!==r.type){var i=r.getParameters();if(!e.includes(r.getType())){if(!n.includes(r.getType()))return;if(!i.disableImpostor)return void(r.repr.quality=t)}i.quality=t,r.build(i)}})},Dg.prototype.eachComponent=function(t,e){this.compList.slice().forEach(function(n,r){e&&n.type!==e||t(n,r)})},Dg.prototype.eachRepresentation=function(t,e){this.eachComponent(function(e){e.reprList.slice().forEach(function(n){t(n,e)})},e)},Dg.prototype.getComponentsByName=function(t,e){var n=[];return this.eachComponent(function(e){(void 0===t||kg(t,e))&&n.push(e)},e),new Og(n)},Dg.prototype.getComponentsByObject=function(t){var e=[];return this.eachComponent(function(n){n[n.type]===t&&e.push(n)}),new Og(e)},Dg.prototype.getRepresentationsByName=function(t,e){var n,r;"object"!=typeof t||t instanceof RegExp?(n=void 0,r=t):(n=t.comp,r=t.repr);var i=[];return this.eachRepresentation(function(t,e){(void 0===n||kg(n,e))&&(void 0===r||kg(r,t))&&i.push(t)},e),new Lg(i)},Dg.prototype.getAnythingByName=function(t){var e=this.getComponentsByName(t).list,n=this.getRepresentationsByName(t).list;return new Rg(e.concat(n))},Dg.prototype.dispose=function(){this.tasks.dispose()};var zg=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]];function Fg(t,e){var n,r=0,i={};return e.forEach(function(e){n=0;var o={};e.forEach(function(e){o[t[n++]]=e}),i[t[r++]]=o}),i}var Bg={blosum62:Fg("ARNDCQEGHILKMFPSTWYVBZ?",[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]]),blosum62x:Fg("ACDEFGHIKLMNPQRSTVWY",zg)},Ug=function(t,e,n,r,i){this.seq1=t,this.seq2=e,this.gapPenalty=n||-10,this.gapExtensionPenalty=r||-1,this.substMatrix=i||"blosum62",this.substMatrix&&(this.substMatrix=Bg[this.substMatrix])};Ug.prototype.initMatrices=function(){var t,e;for(this.n=this.seq1.length,this.m=this.seq2.length,this.score=void 0,this.ali="",this.S=[],this.V=[],this.H=[],t=0;t<=this.n;++t)for(this.S[t]=[],this.V[t]=[],this.H[t]=[],e=0;e<=this.m;++e)this.S[t][e]=0,this.V[t][e]=0,this.H[t][e]=0;for(t=0;t<=this.n;++t)this.S[t][0]=this.gap(0),this.H[t][0]=-1/0;for(e=0;e<=this.m;++e)this.S[0][e]=this.gap(0),this.V[0][e]=-1/0;this.S[0][0]=0},Ug.prototype.gap=function(t){return this.gapPenalty+t*this.gapExtensionPenalty},Ug.prototype.makeScoreFn=function(){var t,e,n=this.seq1,r=this.seq2,i=this.substMatrix;return i?function(o,a){t=n[o],e=r[a];try{return i[t][e]}catch(t){return-4}}:(el.warn("Alignment: no subst matrix"),function(i,o){return t=n[i],e=r[o],t===e?5:-3})},Ug.prototype.calc=function(){nl&&el.time("Alignment.calc"),this.initMatrices();var t,e,n,r,i,o,a,s=this.gap(0),c=this.makeScoreFn(),u=this.gapExtensionPenalty,l=this.V,h=this.H,p=this.S,d=this.n,f=this.m;for(o=1;o<=d;++o)for(e=p[o-1],t=l[o-1],n=l[o],r=h[o],i=p[o],a=1;a<=f;++a)n[a]=Math.max(e[a]+s,t[a]+u),r[a]=Math.max(i[a-1]+s,r[a-1]+u),i[a]=Math.max(e[a-1]+c(o-1,a-1),n[a],r[a]);nl&&el.timeEnd("Alignment.calc"),nl&&el.log(this.S,this.V,this.H)},Ug.prototype.trace=function(){nl&&el.time("Alignment.trace"),this.ali1="",this.ali2="";var t,e=this.makeScoreFn(),n=this.n,r=this.m;for(this.S[n][r]>=this.V[n][r]?(t="S",this.score=this.S[n][r]):this.V[n][r]>=this.H[n][r]?(t="V",this.score=this.V[n][r]):(t="H",this.score=this.H[n][r]),nl&&el.log("Alignment: SCORE",this.score),nl&&el.log("Alignment: S, V, H",this.S[n][r],this.V[n][r],this.H[n][r]);n>0&&r>0;)"S"===t?this.S[n][r]===this.S[n-1][r-1]+e(n-1,r-1)?(this.ali1=this.seq1[n-1]+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--n,--r,t="S"):this.S[n][r]===this.V[n][r]?t="V":this.S[n][r]===this.H[n][r]?t="H":(--n,--r):"V"===t?this.V[n][r]===this.V[n-1][r]+this.gapExtensionPenalty?(this.ali1=this.seq1[n-1]+this.ali1,this.ali2="-"+this.ali2,--n,t="V"):this.V[n][r]===this.S[n-1][r]+this.gap(0)?(this.ali1=this.seq1[n-1]+this.ali1,this.ali2="-"+this.ali2,--n,t="S"):--n:"H"===t?this.H[n][r]===this.H[n][r-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="H"):this.H[n][r]===this.S[n][r-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="S"):--r:el.error("Alignment: no matrix");for(;n>0;)this.ali1=this.seq1[n-1]+this.ali1,this.ali2="-"+this.ali2,--n;for(;r>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r;nl&&el.timeEnd("Alignment.trace"),nl&&el.log([this.ali1,this.ali2])};var jg=function(t){function e(e){var n=this;t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=gs(e.reverse,!0)),this.scalePerModel={},this.structure.eachModel(function(t){n.domain=[t.atomOffset,t.atomEnd],n.scalePerModel[t.index]=n.getScale()})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.scalePerModel[t.modelIndex](t.index)},e}(xu);ol.add("atomindex",jg);var Gg=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="OrRd"),!e.domain){var n,r=1/0,i=-1/0;e.sele&&(n=new Hu(e.sele)),this.structure.eachAtom(function(t){var e=t.bfactor;r=Math.min(r,e),i=Math.max(i,e)},n),this.domain=[r,i]}this.bfactorScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.bfactorScale(t.bfactor)},e}(xu);ol.add("bfactor",Gg);var Vg=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var n={},r={};this.structure.eachModel(function(t){var e=0,i={};t.eachChain(function(t){void 0===i[t.chainid]&&(i[t.chainid]=e,e+=1)}),this.domain=[0,e-1],n[t.index]=i,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=n[t.modelIndex];return r[t.modelIndex](e[t.chainid])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("chainid",Vg);var Hg=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="Spectral"),e.domain){var n=this.getScale();this.atomColor=function(t){return n(t.chainIndex)}}else{var r={};this.structure.eachModel(function(t){this.domain=[t.chainOffset,t.chainEnd],r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){return r[t.modelIndex](t.chainIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("chainindex",Hg);var $g=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var n={},r={};this.structure.eachModel(function(t){var e=0,i={};t.eachChain(function(t){void 0===i[t.chainname]&&(i[t.chainname]=e,e+=1)}),this.domain=[0,e-1],n[t.index]=i,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=n[t.modelIndex];return r[t.modelIndex](e[t.chainname])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("chainname",$g);var Wg=function(t){function e(e){t.call(this,e),e.scale||(this.scale="RdYlBu"),this.rsrzScale=this.getScale({domain:[2,0]}),this.rsccScale=this.getScale({domain:[.678,1]});var n=e.structure.validation||{};this.rsrzDict=n.rsrzDict||{},this.rsccDict=n.rsccDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.resno;t.inscode&&(e+="^"+t.inscode),t.chainname&&(e+=":"+t.chainname),e+="/"+t.modelIndex;var n=this.rsrzDict[e];if(void 0!==n)return this.rsrzScale(n);var r=this.rsccDict[e];return void 0!==r?this.rsccScale(r):9474192},e}(xu);ol.add("densityfit",Wg);var qg={ARG:{CD:.1,CZ:.5,NE:-.1},ASN:{CG:.55,OD1:-.55},ASP:{CB:-.16,CG:.36,OD1:-.6,OD2:-.6},CYS:{CB:.19,SG:-.19},GLN:{CD:.55,OE1:-.55},GLU:{CD:.36,CG:-.16,OE1:-.6,OE2:-.6},HIS:{CB:.1,CD2:.2,CE1:.45,CG:.15,ND1:.05,NE2:.05},LYS:{CE:.25,NZ:.75},MET:{CE:.06,CG:.06,SD:-.12},PTR:{C:.55,CA:.1,CZ:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SEP:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SER:{CB:.25,OG:-.25},THR:{CB:.25,OG1:-.25},TPO:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,OG1:-1.1,O1P:-.85,O2P:-.85,O3P:-.85,P:1.4},TRP:{CD1:.06,CD2:.1,CE2:-.04,CE3:-.03,CG:-.03,NE1:-.06},TYR:{CZ:.25,OH:-.25},backbone:{C:.55,O:-.55,N:-.35,CA:.1}},Xg=12,Yg=1.04,Kg=.25;var Zg=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rwb"),e.domain||(this.domain=[-.5,0,.5]);var n=this.getScale();var r=this.structure,i=new Float32Array(r.atomCount),o=[],a=[];r.eachAtom(function(t){var e;if(i[t.index]=((e=t).isProtein()&&(qg[e.resname]&&qg[e.resname][e.atomname]||qg.backbone[e.atomname])||0)*t.occupancy,"N"===t.atomname){var n=function(t,e){var n=!1,r=!1,i=!1;return(e=e||new Ne).set(2*t.x,2*t.y,2*t.z),t.eachBondedAtom(function(t){if(!n)return"H"===t.atomname?(e.set(t),void(n=!0)):void(r||"CA"!==t.atomname?i||"C"!==t.atomname||(i=!0,e.sub(t)):(e.sub(t),r=!0))}),n?e:r&&i?(e.normalize(),e.multiplyScalar(Yg),e.add(t),e):void 0}(t);void 0!==n&&(o.push(n),a.push(Kg*t.occupancy))}});var s=this.structure.getBoundingBox();s.expandByScalar(Yg);var c=function(t){for(var e=t.length,n=new Float32Array(e),r=new Float32Array(e),i=new Float32Array(e),o=0;o<t.length;o++){var a=t[o];n[o]=a.x,r[o]=a.y,i[o]=a.z}return{x:n,y:r,z:i,count:e}}(o),u=new Wd(c,s),l=new Wd(this.structure.atomStore,s),h=this.atomProxy,p=new Ne,d=Xg*Xg;this.positionColor=function(t){for(var e=0,r=l.within(t.x,t.y,t.z,Xg),o=0;o<r.length;o++){var s=r[o],f=i[s];if(0!==f){h.index=s,p.x=t.x-h.x,p.y=t.y-h.y,p.z=t.z-h.z;var m=p.lengthSq();m<d&&(e+=f/m)}}for(var g=u.within(t.x,t.y,t.z,Xg),v=0;v<g.length;v++){var y=g[v];p.x=t.x-c.x[y],p.y=t.y-c.y[y],p.z=t.z-c.z[y];var b=p.lengthSq();b<d&&(e+=a[y]/b)}return n(e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("electrostatic",Zg);var Qg={H:16777215,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215,D:16777152,T:16777120},Jg=function(t){function e(e){var n=e||{};n.value=gs(n.value,Qg.C),t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.element;return"C"===e?this.value:Qg[e]||16777215},e}(xu);ol.add("element",Jg);var tv=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral"),e.domain||(this.domain=[0,this.structure.entityList.length-1]);var n=this.getScale();this.atomColor=function(t){return n(t.entityIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("entityindex",tv);var ev=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.entity;switch(e?e.entityType:void 0){case Yp:return 8374655;case Kp:return 16629894;case Zp:return 12496596;case Qp:return 3697840;default:return 16777113}},e}(xu);ol.add("entitytype",ev);var nv=function(t){function e(e){t.call(this,e);var n=e.structure.validation||{};this.geoAtomDict=n.geoAtomDict||{},this.geoDict=n.geoDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e,n=t.resno;t.inscode&&(n+="^"+t.inscode),t.chainname&&(n+=":"+t.chainname),n+="/"+t.modelIndex;var r,i=this.geoAtomDict[n];if(void 0!==i){var o=i[t.atomname]||0;r=o,e=16843009*((r=(858993459&(r-=r>>1&1431655765))+(r>>2&858993459))+(r>>4)&252645135)>>24}else e=this.geoDict[n]||0;return 0===e?2188972:1===e?16703627:2===e?16018755:e>=3?10813478:9474192},e}(xu);ol.add("geoquality",nv);var rv=function(t){function e(e){var n;t.call(this,e),e.scale||(this.scale="RdYlGn");var r={};for(n in ld)r[n]=ld[n][0];if(!e.domain){var i,o=1/0,a=-1/0;for(n in r)i=r[n],o=Math.min(o,i),a=Math.max(a,i);this.domain=[o,0,a]}var s=this.getScale();this.atomColor=function(t){return s(r[t.resname]||hd)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("hydrophobicity",rv);var iv=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rainbow"),e.domain||(this.domain=[0,this.structure.modelStore.count]);var n=this.getScale();this.atomColor=function(t){return n(t.modelIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("modelindex",iv);var ov=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){switch(t.residueType.moleculeType){case 1:return 3697840;case 2:return 15729279;case 3:return 12496596;case 4:return 16629894;case 5:return 12540695;case 6:return 8374655;default:return 16777113}},e}(xu);ol.add("moleculetype",ov);var av=function(t){function e(e){t.call(this,e),e.scale||(this.scale="PuBu"),e.domain||(this.domain=[0,1]);var n=this.getScale();this.atomColor=function(t){return n(t.occupancy)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);function sv(){return 16777215*Math.random()}ol.add("occupancy",av);var cv=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return sv()},e.prototype.volumeColor=function(){return sv()},e.prototype.positionColor=function(){return sv()},e}(xu);ol.add("random",cv);var uv=function(t){function e(e){var n=this;if(t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=gs(e.reverse,!0)),e.domain){var r=this.getScale();this.atomColor=function(t){return r(t.residueIndex)}}else{var i={};this.structure.eachChain(function(t){n.domain=[t.residueOffset,t.residueEnd],i[t.index]=n.getScale()}),this.atomColor=function(t){return i[t.chainIndex](t.residueIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xu);ol.add("residueindex",uv);var lv={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:16777215,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,ASX:16711935,GLX:16711935,ASH:16711935,GLH:16711935,A:10526975,G:16740464,I:8454143,C:16747595,T:10551200,U:16744576,DA:10526975,DG:16740464,DI:8454143,DC:16747595,DT:10551200,DU:16744576},hv=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return lv[t.resname]||16711935},e}(xu);ol.add("resname",hv);var pv=16711808,dv=10485888,fv=6291584,mv=16762880,gv=6324479,vv=16777215,yv=11403518,bv=16580962,xv=10921722,_v=function(t){function e(e){t.call(this,e),this.rp=this.structure.getResidueProxy()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.sstruc,n=this.rp;return"h"===e?pv:"g"===e?dv:"i"===e?fv:"e"===e||"b"===e?mv:"t"===e?gv:(n.index=t.residueIndex,n.isDna()?yv:n.isRna()?bv:n.isSaccharide()?xv:n.isProtein()||"s"===e||"l"===e?vv:8421504)},e}(xu);ol.add("sstruc",_v);var wv=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return this.value},e.prototype.bondColor=function(){return this.value},e.prototype.valueColor=function(){return this.value},e.prototype.volumeColor=function(){return this.value},e}(xu);ol.add("uniform",wv);var Sv=function(t){function e(e){t.call(this,e),this.valueScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.volumeColor=function(t){return this.valueScale(this.volume.data[t])},e}(xu);ol.add("value",Sv);var Cv=function(t){function e(e){t.call(this,e);var n=this.volume;if(n&&n.inverseMatrix){var r=this.getScale(),i=n.inverseMatrix,o=n.data,a=n.nx,s=n.ny,c=a*s,u=new Ne;this.positionColor=function(t){u.copy(t),u.applyMatrix4(i);var e=Math.floor(u.x),n=Math.floor(u.y),l=Math.floor(u.z),h=(l*s+n)*a+e,p=h+1,d=h+a,f=h+c,m=d+1,g=f+1,v=d+c,y=v+1,b=o[h],x=o[p],_=o[d],w=o[f],S=o[m],C=o[g],A=o[v],E=o[y],M=u.x-e,T=u.y-n,P=u.z-l,I=mu(b,x,M),R=mu(w,C,M),O=mu(_,S,M),L=mu(A,E,M),k=mu(mu(I,O,T),mu(R,L,T),P);return r(k)}}else{var l=this.value;this.positionColor=function(){return l}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.positionColor=function(){},e}(xu);ol.add("volume",Cv);var Av=function(t){function e(e,n,r){var i=this,o=r||{};o.name=gs(o.name,n.name),t.call(this,e,o),this.script=n,this.status="loaded",this.script.signals.nameChanged.add(function(t){i.setName(t)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"script"},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.run=function(){var t=this;this.setStatus("running"),this.script.call(this.stage).then(function(){t.setStatus("finished")}),this.setStatus("called")},e.prototype.dispose=function(){this.signals.disposed.dispatch()},e.prototype.setVisibility=function(){},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,n),e}(Tg);hl.add("script",Av);var Ev=function(t){function e(e,n,r){var i=r||{};i.name=gs(i.name,n.name),t.call(this,e,i),this.shape=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"shape"},e.prototype.addRepresentation=function(e,n){return t.prototype.addRepresentation.call(this,e,this.shape,n)},e.prototype.getBoxUntransformed=function(){return this.shape.boundingBox},e.prototype.getCenterUntransformed=function(){return this.shape.center},e.prototype.dispose=function(){this.shape.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,n),e}(Tg);hl.add("shape",Ev);var Mv=function(t){function e(e,n,r,i){var o=this,a=r||{};a.name=gs(a.name,n.name),t.call(this,e,a),this.signals=Object.assign(this.signals,{frameChanged:new Su,playerChanged:new Su,gotNumframes:new Su,parametersChanged:new Su}),this.trajectory=n,this.parent=i,this.status="loaded",this.defaultStep=gs(a.defaultStep,void 0),this.defaultTimeout=gs(a.defaultTimeout,50),this.defaultInterpolateType=gs(a.defaultInterpolateType,""),this.defaultInterpolateStep=gs(a.defaultInterpolateStep,5),this.defaultMode=gs(a.defaultMode,"loop"),this.defaultDirection=gs(a.defaultDirection,"forward"),n.signals.frameChanged.add(function(t){o.signals.frameChanged.dispatch(t)}),n.signals.playerChanged.add(function(t){o.signals.playerChanged.dispatch(t)}),n.signals.gotNumframes.add(function(t){o.signals.gotNumframes.dispatch(t)}),void 0!==a.initialFrame&&this.setFrame(a.initialFrame)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"trajectory"},e.prototype.addRepresentation=function(e,n){return t.prototype.addRepresentation.call(this,e,this.trajectory,n)},e.prototype.setFrame=function(t){this.trajectory.setFrame(t)},e.prototype.setParameters=function(t){this.trajectory.setParameters(t),this.signals.parametersChanged.dispatch(t)},e.prototype.dispose=function(){this.trajectory.dispose(),t.prototype.dispose.call(this)},e.prototype.getCenter=function(){},Object.defineProperties(e.prototype,n),e}(Tg),Tv=function(t){function e(e,n,r){t.call(this,"",n,r),this.name=e.name,this.path=e.path,this.frames=e.coordinates,this.boxes=e.boxes,this.getNumframes()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"frames"},e.prototype.makeAtomIndices=function(){"StructureView"===this.structure.type?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var n,r=this.frames[t];if(this.atomIndices){var i=this.atomIndices,o=i.length;n=new Float32Array(3*o);for(var a=0;a<o;++a){var s=3*a,c=3*i[a];n[s+0]=r[c+0],n[s+1]=r[c+1],n[s+2]=r[c+2]}}else n=new Float32Array(r);var u=this.boxes[t],l=this.frames.length;this.process(t,u,n,l),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.frames&&this.setNumframes(this.frames.length)},e.prototype.getPath=function(t,e){var n,r,i,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(n=0;n<o;++n)r=3*n,i=this.frames[n],s[r+0]=i[a+0],s[r+1]=i[a+1],s[r+2]=i[a+2];e(s)},Object.defineProperties(e.prototype,n),e}(lm),Pv=function(t){function e(e,n,r){t.call(this,"",n,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"structure"},e.prototype.makeAtomIndices=function(){this.structure.atomSet.getSize()<this.structure.atomStore.count?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var n,r=this.structure,i=r.frames[t];if(this.atomIndices){var o=this.atomIndices,a=o.length;n=new Float32Array(3*a);for(var s=0;s<a;++s){var c=3*s,u=3*o[s];n[c+0]=i[u+0],n[c+1]=i[u+1],n[c+2]=i[u+2]}}else n=new Float32Array(i);var l=r.boxes[t],h=r.frames.length;this.process(t,l,n,h),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.setNumframes(this.structure.frames.length)},e.prototype.getPath=function(t,e){var n,r,i,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(n=0;n<o;++n)r=3*n,i=this.structure.frames[n],s[r+0]=i[a+0],s[r+1]=i[a+1],s[r+2]=i[a+2];e(s)},Object.defineProperties(e.prototype,n),e}(lm),Iv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"remote"},e.prototype.makeAtomIndices=function(){var t=[];if("StructureView"===this.structure.type){var e,n,r=this.structure.getAtomIndices(),i=r[0],o=r[0],a=r.length;for(e=1;e<a;++e)o+1<(n=r[e])&&(t.push([i,o+1]),i=n),o=n;t.push([i,o+1])}else t.push([0,this.atomCount]);this.atomIndices=t},e.prototype._loadFrame=function(t,e){var n=new window.XMLHttpRequest,r=al.trajectory,i=r.getFrameUrl(this.trajPath,t),o=r.getFrameParams(this.trajPath,this.atomIndices);n.open("POST",i,!0),n.responseType="arraybuffer",n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.addEventListener("load",function(){var r=n.response;if(r){var o=new Int32Array(r,0,1)[0],a=new Float32Array(r,8,9),s=new Float32Array(r,44);this.process(t,a,s,o),"function"==typeof e&&e()}else el.error("empty arrayBuffer for '"+i+"'")}.bind(this),!1),n.send(o)},e.prototype.getNumframes=function(){var t=new window.XMLHttpRequest,e=al.trajectory.getNumframesUrl(this.trajPath);t.open("GET",e,!0),t.addEventListener("load",function(){this.setNumframes(parseInt(t.response))}.bind(this),!1),t.send(null)},e.prototype.getPath=function(t,e){if(this.pathCache[t])e(this.pathCache[t]);else{el.time("loadPath");var n=new window.XMLHttpRequest,r=al.trajectory.getPathUrl(this.trajPath,t);n.open("POST",r,!0),n.responseType="arraybuffer",n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.addEventListener("load",function(){el.timeEnd("loadPath");var i=n.response;if(i){var o=new Float32Array(i);this.pathCache[t]=o,e(o)}else el.error("empty arrayBuffer for '"+r+"'")}.bind(this),!1),n.send("")}},Object.defineProperties(e.prototype,n),e}(lm);om.prototype.getView=function(t){return new Rv(this,t)};var Rv=function(t){function e(e,n){t.call(this),this.structure=e,this.selection=n,this.center=new Ne,this.boundingBox=new Hn,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy(),this.selection&&this.selection.signals.stringChanged.add(this.refresh,this),this.structure.signals.refreshed.add(this.refresh,this),this.refresh()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},name:{},path:{},title:{},id:{},atomSetDict:{},biomolDict:{},entityList:{},unitcell:{},frames:{},boxes:{},validation:{},bondStore:{},backboneBondStore:{},rungBondStore:{},atomStore:{},residueStore:{},chainStore:{},modelStore:{},atomMap:{},residueMap:{},bondHash:{},spatialHash:{}};return e.prototype.init=function(){},n.type.get=function(){return"StructureView"},n.name.get=function(){return this.structure.name},n.path.get=function(){return this.structure.path},n.title.get=function(){return this.structure.title},n.id.get=function(){return this.structure.id},n.atomSetDict.get=function(){return this.structure.atomSetDict},n.biomolDict.get=function(){return this.structure.biomolDict},n.entityList.get=function(){return this.structure.entityList},n.unitcell.get=function(){return this.structure.unitcell},n.frames.get=function(){return this.structure.frames},n.boxes.get=function(){return this.structure.boxes},n.validation.get=function(){return this.structure.validation},n.bondStore.get=function(){return this.structure.bondStore},n.backboneBondStore.get=function(){return this.structure.backboneBondStore},n.rungBondStore.get=function(){return this.structure.rungBondStore},n.atomStore.get=function(){return this.structure.atomStore},n.residueStore.get=function(){return this.structure.residueStore},n.chainStore.get=function(){return this.structure.chainStore},n.modelStore.get=function(){return this.structure.modelStore},n.atomMap.get=function(){return this.structure.atomMap},n.residueMap.get=function(){return this.structure.residueMap},n.bondHash.get=function(){return this.structure.bondHash},n.spatialHash.get=function(){return this.structure.spatialHash},e.prototype.refresh=function(){for(var t in nl&&el.time("StructureView.refresh"),this.atomSetCache={},this.atomSet=this.getAtomSet(this.selection,!0),this.structure.atomSet&&(this.atomSet=this.atomSet.intersection(this.structure.atomSet)),this.bondSet=this.getBondSet(),this.atomSetDict){var e=this.atomSetDict[t];this.atomSetCache["__"+t]=e.makeIntersection(this.atomSet)}this.atomCount=this.atomSet.getSize(),this.bondCount=this.bondSet.getSize(),this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),nl&&el.timeEnd("StructureView.refresh"),this.signals.refreshed.dispatch()},e.prototype.setSelection=function(t){this.selection=t,this.refresh()},e.prototype.getSelection=function(t){var e=[];t&&t.string&&e.push(t.string);var n=this.structure.getSelection();n&&n.string&&e.push(n.string),this.selection&&this.selection.string&&e.push(this.selection.string);var r="";return e.length>0&&(r="( "+e.join(" ) AND ( ")+" )"),new Hu(r)},e.prototype.getStructure=function(){return this.structure.getStructure()},e.prototype.eachBond=function(t,e){this.structure.eachBond(t,this.getSelection(e))},e.prototype.eachAtom=function(t,e){var n=this.getAtomProxy(),r=this.getAtomSet(e),i=this.atomStore.count;if(r.getSize()<i)r.forEach(function(e){n.index=e,t(n)});else for(var o=0;o<i;++o)n.index=o,t(n)},e.prototype.eachResidue=function(t,e){this.structure.eachResidue(t,this.getSelection(e))},e.prototype.eachResidueN=function(){console.error("StructureView.eachResidueN() not implemented")},e.prototype.eachChain=function(t,e){this.structure.eachChain(t,this.getSelection(e))},e.prototype.eachModel=function(t,e){this.structure.eachModel(t,this.getSelection(e))},e.prototype.getAtomSet=function(t,e){var n=this.structure.getAtomSet(t);return!e&&this.atomSet&&(n=n.makeIntersection(this.atomSet)),n},e.prototype.getAtomIndices=function(t){return this.structure.getAtomIndices(this.getSelection(t))},e.prototype.refreshPosition=function(){return this.structure.refreshPosition()},e.prototype.dispose=function(){this.selection&&this.selection.signals.stringChanged.remove(this.refresh,this),this.structure.signals.refreshed.remove(this.refresh,this),delete this.structure,delete this.atomSet,delete this.bondSet,delete this.atomCount,delete this.bondCount},Object.defineProperties(e.prototype,n),e}(om),Ov=function(t){function e(e,n,r){var i=r||{};i.name=gs(i.name,n.name),t.call(this,e,i),this.signals=Object.assign(this.signals,{trajectoryAdded:new Su,trajectoryRemoved:new Su,defaultAssemblyChanged:new Su}),this.structure=n,this.trajList=[],this.initSelection(i.sele),this.setDefaultAssembly(i.assembly||"")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"structure"},e.prototype.initSelection=function(t){var e=this;this.selection=new Hu(t),this.structureView=new Rv(this.structure,this.selection),this.selection.signals.stringChanged.add(function(){e.structureView.setSelection(e.selection),e.rebuildRepresentations(),e.rebuildTrajectories()})},e.prototype.setSelection=function(t){return this.selection.setString(t),this},e.prototype.setDefaultAssembly=function(t){var e=this;this.defaultAssembly=t,this.reprList.forEach(function(t){t.setParameters({defaultAssembly:e.defaultAssembly})}),this.signals.defaultAssemblyChanged.dispatch(t)},e.prototype.rebuildRepresentations=function(){this.reprList.forEach(function(t){t.build()})},e.prototype.rebuildTrajectories=function(){var t=this;this.trajList.slice().forEach(function(e){e.trajectory.setStructure(t.structureView)})},e.prototype.addRepresentation=function(e,n){var r=n||{};return r.defaultAssembly=this.defaultAssembly,t.prototype.addRepresentation.call(this,e,this.structureView,r)},e.prototype.addTrajectory=function(t,e){var n=this,r=function(t,e,n){return t&&"Frames"===t.type?new Tv(t,e,n):!t&&e.frames?new Pv(t,e,n):new Iv(t,e,n)}(t,this.structureView,e);r.signals.frameChanged.add(function(){n.updateRepresentations({position:!0})});var i=new Mv(this.stage,r,e,this);return this.trajList.push(i),this.signals.trajectoryAdded.dispatch(i),i},e.prototype.removeTrajectory=function(t){var e=this.trajList.indexOf(t);-1!==e&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},e.prototype.dispose=function(){this.trajList.slice().forEach(function(t){t.dispose()}),this.trajList.length=0,this.structure.dispose(),t.prototype.dispose.call(this)},e.prototype.autoView=function(t,e){Number.isInteger(t)&&(e=t,t=void 0),this.stage.animationControls.zoomMove(this.getCenter(t),this.getZoom(t),gs(e,0))},e.prototype.getBoxUntransformed=function(t){return t?this.structureView.getBoundingBox(new Hu(t)):this.structureView.boundingBox},e.prototype.getCenterUntransformed=function(t){return t&&"string"==typeof t?this.structure.atomCenter(new Hu(t)):this.structure.center},e.prototype.superpose=function(t,e,n,r){return function(t,e,n,r,i){var o,a,s,c,u;if(n=gs(n,!1),r=gs(r,""),i=gs(i,""),n){var l=t,h=e;r&&i&&(l=t.getView(new Hu(r)),h=e.getView(new Hu(i)));var p,d,f,m,g,v=l.getSequence(),y=h.getSequence(),b=new Ug(v.join(""),y.join(""));b.calc(),b.trace(),o=0,a=0,s=b.ali1.length;var x=[],_=[];for(p=0;p<s;++p)m=b.ali1[p],g=b.ali2[p],d=0,f=0,"-"===m?_[a]=!1:(_[a]=!0,d=1),"-"===g?x[o]=!1:(x[o]=!0,f=1),o+=d,a+=f;var w=[],S=[],C=l.getAtomProxy(),A=h.getAtomProxy();o=0,l.eachResidue(function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(x[o]&&(C.index=t.getAtomIndexByName("CA"),w.push(C.x,C.y,C.z)),o+=1)}),o=0,h.eachResidue(function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(_[o]&&(A.index=t.getAtomIndexByName("CA"),S.push(A.x,A.y,A.z)),o+=1)}),c=new Float32Array(w),u=new Float32Array(S)}else c=t.getView(new Hu(r+" and .CA")),u=e.getView(new Hu(i+" and .CA"));new cm(c,u).transform(t),t.refreshPosition()}(this.structureView,t.structureView,e,n,r),this.updateRepresentations({position:!0}),this},e.prototype.setVisibility=function(e){return t.prototype.setVisibility.call(this,e),this.trajList.forEach(function(t){t.setVisibility(e)}),this},Object.defineProperties(e.prototype,n),e}(Tg);hl.add("structure",Ov),hl.add("structureview",Ov);var Lv=function(t){function e(e,n,r){var i=r||{};i.name=gs(i.name,n.name),t.call(this,e,i),this.surface=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"surface"},e.prototype.addRepresentation=function(e,n){return t.prototype.addRepresentation.call(this,e,this.surface,n)},e.prototype.getBoxUntransformed=function(){return this.surface.boundingBox},e.prototype.getCenterUntransformed=function(){return this.surface.center},e.prototype.dispose=function(){this.surface.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,n),e}(Tg);hl.add("surface",Lv);var kv=function(t){function e(e,n,r){var i=r||{};i.name=gs(i.name,n.name),t.call(this,e,i),this.volume=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"volume"},e.prototype.addRepresentation=function(e,n){return t.prototype.addRepresentation.call(this,e,this.volume,n)},e.prototype.getBoxUntransformed=function(){return this.volume.boundingBox},e.prototype.getCenterUntransformed=function(){return this.volume.center},e.prototype.dispose=function(){this.volume.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,n),e}(Tg);hl.add("volume",kv);var Nv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="axes",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.radius=gs(n.radius,.5),n.colorValue=gs(n.colorValue,"lightgreen"),this.showAxes=gs(n.showAxes,!0),this.showBox=gs(n.showBox,!1),t.prototype.init.call(this,n)},e.prototype.getPrincipalAxes=function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getPrincipalAxes(t)},e.prototype.getAxesData=function(t){var e=this.getPrincipalAxes(t),n=new En(this.colorValue),r=0,i=0;this.showAxes&&(r+=6,i+=3),this.showBox&&(r+=8,i+=12);var o=new Float32Array(3*r),a=ql(r,n.r,n.g,n.b),s=Wl(r,this.radius),c=new Float32Array(3*i),u=new Float32Array(3*i),l=ql(i,n.r,n.g,n.b),h=Wl(i,this.radius),p=0;if(this.showAxes){var d=function(t,e){t.toArray(o,2*p),e.toArray(o,2*p+3),t.toArray(c,p),e.toArray(u,p),p+=3};d(e.begA,e.endA),d(e.begB,e.endB),d(e.begC,e.endC)}if(this.showBox){var f=new Ne,m=e.getProjectedScaleForAtoms(t),g=m.d1a,v=m.d2a,y=m.d3a,b=m.d1b,x=m.d2b,_=m.d3b;console.log(g,v,y,b,x,_);var w=2*p,S=function(t,n,r){f.copy(e.center).addScaledVector(e.normVecA,t).addScaledVector(e.normVecB,n).addScaledVector(e.normVecC,r),f.toArray(o,w),w+=3};S(g,v,y),S(g,v,_),S(g,x,_),S(g,x,y),S(b,x,_),S(b,x,y),S(b,v,y),S(b,v,_);var C=p,A=function(t,e){f.fromArray(o,2*p+3*t).toArray(c,C),f.fromArray(o,2*p+3*e).toArray(u,C),C+=3};A(0,1),A(0,3),A(0,6),A(1,2),A(1,7),A(2,3),A(2,4),A(3,5),A(4,5),A(4,7),A(5,6),A(6,7)}var E=new Op(e);return{vertex:{position:o,color:a,radius:s,picking:E},edge:{position1:c,position2:u,color:l,color2:l,radius:h,picking:E}}},e.prototype.create=function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Mm(t.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new jm(t.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},e.prototype.updateData=function(t,e){var n=this.getAxesData(e.sview),r={},i={};t&&!t.position||(r.position=n.vertex.position,i.position1=n.edge.position1,i.position2=n.edge.position2),t&&!t.color||(r.color=n.vertex.color,i.color=n.edge.color,i.color2=n.edge.color),t&&!t.radius||(r.radius=n.vertex.radius,i.radius=n.edge.radius),this.sphereBuffer.setAttributes(r),this.cylinderBuffer.setAttributes(i)},e}(_g);sl.add("axes",Nv);var Dv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="ball+stick",this.parameters=Object.assign({sphereDetail:!0,radialSegments:!0,openEnded:!0,disableImpostor:!0,aspectRatio:{type:"number",precision:1,max:10,min:1},lineOnly:{type:"boolean",rebuild:!0},cylinderOnly:{type:"boolean",rebuild:!0},multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondScale:{type:"number",precision:2,max:1,min:.01},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.radius=gs(n.radius,.15),this.aspectRatio=gs(n.aspectRatio,2),this.lineOnly=gs(n.lineOnly,!1),this.cylinderOnly=gs(n.cylinderOnly,!1),this.multipleBond=gs(n.multipleBond,"off"),this.bondSpacing=gs(n.bondSpacing,1),this.bondScale=gs(n.bondScale,.4),t.prototype.init.call(this,n)},e.prototype.getAtomParams=function(e,n){return n=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},n),t.prototype.getAtomParams.call(this,e,n)},e.prototype.getAtomData=function(t,e,n){return t.getAtomData(this.getAtomParams(e,n))},e.prototype.getBondParams=function(e,n){return n=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},n),t.prototype.getBondParams.call(this,e,n)},e.prototype.getBondData=function(t,e,n){return t.getBondData(this.getBondParams(e,n))},e.prototype.createData=function(t){var e=this.getBondData(t),n=[];if(this.lineOnly)this.lineBuffer=new wg(e,this.getBufferParams()),n.push(this.lineBuffer);else{var r=new jm(e,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(n.push(r),!this.cylinderOnly){var i=new Mm(this.getAtomData(t),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));n.push(i)}}return{bufferList:n}},e.prototype.updateData=function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var n=this.getBondData(e.sview,t);if(this.lineOnly){var r={};t&&!t.position||(r.position1=n.position1,r.position2=n.position2),t&&!t.color||(r.color=n.color,r.color2=n.color2),e.bufferList[0].setAttributes(r)}else{var i={};if(t&&!t.position||(i.position1=n.position1,i.position2=n.position2),t&&!t.color||(i.color=n.color,i.color2=n.color2),t&&!t.radius||(i.radius=n.radius),e.bufferList[0].setAttributes(i),!this.cylinderOnly){var o=this.getAtomData(e.sview,t),a={};t&&!t.position||(a.position=o.position),t&&!t.color||(a.color=o.color),t&&!t.radius||(a.radius=o.radius),e.bufferList[1].setAttributes(a)}}},e.prototype.setParameters=function(e){var n=!1,r={};return e&&(e.aspectRatio||e.bondSpacing||e.bondScale)&&(r.radius=!0,Ju&&!this.disableImpostor||(n=!0)),t.prototype.setParameters.call(this,e,r,n),this},e}(_g);sl.add("ball+stick",Dv);var zv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="backbone",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.aspectRatio=gs(n.aspectRatio,1),n.radius=gs(n.radius,.25),t.prototype.init.call(this,n)},e.prototype.getAtomData=function(t,e,n){return t.getBackboneAtomData(this.getAtomParams(e,n))},e.prototype.getBondData=function(t,e,n){return t.getBackboneBondData(this.getBondParams(e,n))},e}(Dv);sl.add("backbone",zv);var Fv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="base",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.aspectRatio=gs(n.aspectRatio,1),n.radius=gs(n.radius,.3),t.prototype.init.call(this,n)},e.prototype.getAtomData=function(t,e,n){return t.getRungAtomData(this.getAtomParams(e,n))},e.prototype.getBondData=function(t,e,n){var r=this.getBondParams(e,n);return r.colorParams.rung=!0,t.getRungBondData(r)},e}(Dv);function Bv(t,e){this.polymer=t,this.size=t.residueCount;var n=e||{};this.directional=n.directional||!1,this.positionIterator=n.positionIterator||!1,this.subdiv=n.subdiv||1,this.smoothSheet=n.smoothSheet||!1,isNaN(n.tension)?this.tension=this.polymer.isNucleic()?.5:.9:this.tension=n.tension||.5,this.interpolator=new function(t,e){var n=1/t,r=1e-4,i=new Ne,o=new Ne;function a(t,n,r,i,o,a,s){a[s+0]=gu(t.x,n.x,r.x,i.x,o,e),a[s+1]=gu(t.y,n.y,r.y,i.y,o,e),a[s+2]=gu(t.z,n.z,r.z,i.z,o,e)}function s(t,n,r,i,o,a){a.x=gu(t.x,n.x,r.x,i.x,o,e),a.y=gu(t.y,n.y,r.y,i.y,o,e),a.z=gu(t.z,n.z,r.z,i.z,o,e)}function c(e,r,i,o,s,c){for(var u=0;u<t;++u)a(e,r,i,o,n*u,s,c+3*u)}function u(e,a,c,u,l,h){for(var p=0;p<t;++p){var d=n*p,f=d-r,m=d+r,g=h+3*p;f<0&&(f=0),m>1&&(m=1),s(e,a,c,u,f,i),s(e,a,c,u,m,o),o.sub(i).normalize(),o.toArray(l,g)}}function l(e,n,r,i,o){for(var a=n.next(),s=n.next(),c=n.next(),u=n.size,l=u-1,h=i||0,p=0;p<l;++p)e(a,a=s,s=c,c=n.next(),r,h),h+=3*t;o&&(e(n.get(u-2),a=n.get(u-1),s=n.get(0),c=n.get(1),r,h),h+=3*t)}this.getPosition=function(e,n,r,i){e.reset(),l(c,e,n,r,i);var o=e.size-1,a=o*t*3;i&&(a+=3*t);var s=e.get(i?0:o);n[a]=s.x,n[a+1]=s.y,n[a+2]=s.z},this.getTangent=function(e,n,r,i){e.reset(),l(u,e,n,r,i);var o=(e.size-1)*t*3;i&&(o+=3*t),Kl(n,n,o-3,o,3)};var h=new Ne,p=new Ne,d=new Ne,f=new Ne,m=Math.ceil(t/2);function g(e,r,a,c,u,l,g,v,y,b,x,_,w){for(var S=0;S<t;++S){var C=_+3*S;w&&(C+=3*m);var A=n*S;s(e,r,a,c,A,i),s(u,l,g,v,A,o),h.subVectors(o,i).normalize(),p.fromArray(y,C),f.crossVectors(h,p).normalize(),f.toArray(x,C),d.crossVectors(p,f).normalize(),d.toArray(b,C)}}function v(e,n,r,i,o){for(var a=0;a<t;++a){var s=o+3*a;e.copy(d),p.fromArray(n,s),f.crossVectors(e,p).normalize(),f.toArray(i,s),d.crossVectors(p,f).normalize(),d.toArray(r,s)}}function y(e,n,r,i,o){var a;for(a=0;a<m;++a)r(e,i,o+3*a);for(a=m;a<t;++a)r(n,i,o+3*a)}function b(e,n,r,i,o){var a;for(a=0;a<m;++a)i[o+a]=r(e);for(a=m;a<t;++a)i[o+a]=r(n)}function x(e,n,r,i,o){for(var a=r(e),s=r(n),c=0;c<t;++c){var u=c/t;i[o+c]=(1-u)*a+u*s}}this.getNormal=function(e,n,r,i,o,a){d.set(0,0,1);for(var s=e-1,c=o||0,u=0;u<s;++u)v(h,n,r,i,c),c+=3*t;a&&(v(h,n,r,i,c),c+=3*t),f.toArray(i,c),d.toArray(r,c)},this.getNormalDir=function(e,n,r,i,o,a,s,c){e.reset(),n.reset();var u=new Ne,l=new Ne,h=new Ne,p=new Ne,v=new Ne,y=(new Ne).copy(e.next()),b=(new Ne).copy(e.next()),x=(new Ne).copy(e.next()),_=new Ne,w=(new Ne).copy(n.next()),S=(new Ne).copy(n.next()),C=(new Ne).copy(n.next());d.set(0,0,1);for(var A=e.size,E=A-1,M=a||0,T=0;T<E;++T)v.copy(y),y.copy(b),b.copy(x),x.copy(e.next()),_.copy(w),w.copy(S),S.copy(C),C.copy(n.next()),0===T?(u.subVectors(_,v),l.subVectors(w,y),u.dot(l)<0&&(l.multiplyScalar(-1),w.addVectors(y,l)),h.subVectors(S,b),l.dot(h)<0&&(h.multiplyScalar(-1),S.addVectors(b,h))):h.copy(p),p.subVectors(C,x),h.dot(p)<0&&(p.multiplyScalar(-1),C.addVectors(x,p)),g(v,y,b,x,_,w,S,C,r,i,o,M,c),M+=3*t;if(s&&(v.copy(e.get(A-2)),y.copy(e.get(A-1)),b.copy(e.get(0)),x.copy(e.get(1)),_.copy(n.get(A-2)),w.copy(n.get(A-1)),S.copy(n.get(0)),C.copy(n.get(1)),h.copy(p),p.subVectors(C,x),h.dot(p)<0&&(p.multiplyScalar(-1),C.addVectors(x,p)),g(v,y,b,x,_,w,S,C,r,i,o,M,c),M+=3*t),c){f.fromArray(o,3*m),d.fromArray(i,3*m);for(var P=0;P<m;++P)f.toArray(o,3*P),d.toArray(i,3*P)}else f.toArray(o,M),d.toArray(i,M)},this.getColor=function(e,n,r,i,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=i||0,l=0;l<c;++l)y(a,a=e.next(),n,r,u),u+=3*t;o&&(y(e.get(s-1),a=e.get(0),n,r,u),u+=3*t),r[u]=r[u-3],r[u+1]=r[u-2],r[u+2]=r[u-1]},this.getPicking=function(e,n,r,i,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=i||0,l=0;l<c;++l)b(a,a=e.next(),n,r,u),u+=t;o&&(b(e.get(s-1),a=e.get(0),n,r,u),u+=t),r[u]=r[u-1]},this.getSize=function(e,n,r,i,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=i||0,l=0;l<c;++l)x(a,a=e.next(),n,r,u),u+=t;o&&(x(e.get(s-1),a=e.get(0),n,r,u),u+=t),r[u]=r[u-1]}}(this.subdiv,this.tension)}sl.add("base",Fv),Bv.prototype={constructor:Bv,getAtomIterator:function(t,e){var n=this.polymer,r=n.structure,i=n.residueCount,o=0,a=-1,s=[r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy()],c=[new Ne,new Ne,new Ne,new Ne];var u=r.getAtomProxy(),l=r.getAtomProxy();return{size:i,next:function(){var t=this.get(a);return a+=1,t},get:function(r){var a=s[o%4];if(a.index=n.getAtomIndexByType(r,t),e&&r>0&&r<i&&"e"===a.sstruc){var h=c[o%4];return u.index=n.getAtomIndexByType(r+1,t),l.index=n.getAtomIndexByType(r-1,t),h.addVectors(u,l).add(a).add(a).multiplyScalar(.25),o+=1,h}return o+=1,a},reset:function(){o=0,a=-1}}},getSubdividedColor:function(t){var e=this.subdiv,n=this.polymer,r=(n.residueCount-1)*e*3+3;n.isCyclic&&(r+=3*e);var i=new Float32Array(r),o=this.getAtomIterator("trace"),a=t||{};a.structure=n.structure;var s=ol.getScheme(a);return this.interpolator.getColor(o,function(t,e,n){s.atomColorToArray(t,e,n)},i,0,n.isCyclic),{color:i}},getSubdividedPicking:function(){var t=this.subdiv,e=this.polymer,n=(e.residueCount-1)*t+1;e.isCyclic&&(n+=t);var r=e.structure,i=this.getAtomIterator("trace"),o=new Float32Array(n);return this.interpolator.getPicking(i,function(t){return t.index},o,0,e.isCyclic),{picking:new Rp(o,r)}},getSubdividedPosition:function(){return{position:this.getPosition()}},getSubdividedOrientation:function(){var t=this.getTangent(),e=this.getNormals(t);return{tangent:t,normal:e.normal,binormal:e.binormal}},getSubdividedSize:function(t,e){var n=this.subdiv,r=this.polymer,i=(r.residueCount-1)*n+1;r.isCyclic&&(i+=n);var o=new Float32Array(i),a=this.getAtomIterator("trace"),s=new Sd(t,e);return this.interpolator.getSize(a,function(t){return s.atomRadius(t)},o,0,r.isCyclic),{size:o}},getPosition:function(){var t=this.subdiv,e=this.polymer,n=(e.residueCount-1)*t*3+3;e.isCyclic&&(n+=3*t);var r=new Float32Array(n),i=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getPosition(i,r,0,e.isCyclic),r},getTangent:function(){var t=this.subdiv,e=this.polymer,n=(this.size-1)*t*3+3;e.isCyclic&&(n+=3*t);var r=new Float32Array(n),i=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getTangent(i,r,0,e.isCyclic),r},getNormals:function(t){var e=this.subdiv,n=this.polymer,r=n.isProtein(),i=this.size,o=(i-1)*e*3+3;n.isCyclic&&(o+=3*e);var a=new Float32Array(o),s=new Float32Array(o);if(this.directional&&!this.polymer.isCg()){var c=this.getAtomIterator("direction1"),u=this.getAtomIterator("direction2");this.interpolator.getNormalDir(c,u,t,a,s,0,n.isCyclic,r)}else this.interpolator.getNormal(i,t,a,s,0,n.isCyclic,r);return{normal:a,binormal:s}}};var Uv=new Ne,jv=new Ne,Gv=function(t){function e(e,n){var r=e||{},i=n||{},o=gs(i.radialSegments,4),a=gs(i.capped,!1),s=a?o:0,c=a?o-2:0,u=r.position.length/3,l=u*o*3+2*s*3,h=2*(u-1)*o*3+2*c*3,p=new Float32Array(l),d=new Float32Array(l),f=new Float32Array(l),m=Es(h,l/3);t.call(this,{position:p,color:d,index:m,normal:f,picking:r.picking},i),this.aspectRatio=gs(i.aspectRatio,1),this.radialSegments=o,this.capped=a,this.capVertices=s,this.capTriangles=c,this.size2=u,r.primitiveId=Xl(u),this.setAttributes(r),this.meshIndex=m,this.makeIndex()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setAttributes=function(t){var e,n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E,M,T,P,I,R,O,L,k,N=this.aspectRatio,D=this.size2,z=D-1,F=this.radialSegments,B=this.geometry.attributes;t.position&&(e=t.position,n=t.normal,r=t.binormal,i=t.tangent,a=t.size,c=B.position.array,l=B.normal.array,B.position.needsUpdate=!0,B.normal.needsUpdate=!0),t.color&&(o=t.color,u=B.color.array,B.color.needsUpdate=!0),t.primitiveId&&(s=t.primitiveId,h=B.primitiveId.array,B.primitiveId.needsUpdate=!0);var U=[],j=[],G=[],V=[],H=[],$=[];if(e)for(d=0;d<F;++d)y=d/F*2*Math.PI,U[d]=N*Math.cos(y),j[d]=Math.sin(y),G[d]=N*Math.cos(y-.01),V[d]=Math.sin(y-.01),H[d]=N*Math.cos(y+.01),$[d]=Math.sin(y+.01);for(p=0;p<D;++p)for(m=(f=3*p)*F,e&&(Uv.set(i[f],i[f+1],i[f+2]),E=n[f],M=n[f+1],T=n[f+2],P=r[f],I=r[f+1],R=r[f+2],O=e[f],L=e[f+1],k=e[f+2],A=a[p]),d=0;d<F;++d)g=m+3*d,e&&(b=-A*U[d],x=A*j[d],_=-A*G[d],w=A*V[d],S=-A*H[d],C=A*$[d],c[g]=O+b*E+x*P,c[g+1]=L+b*M+x*I,c[g+2]=k+b*T+x*R,jv.set(S*E+C*P-(_*E+w*P),S*M+C*I-(_*M+w*I),S*T+C*R-(_*T+w*R)).cross(Uv),l[g]=jv.x,l[g+1]=jv.y,l[g+2]=jv.z),o&&(u[g]=o[f],u[g+1]=o[f+1],u[g+2]=o[f+2]),s&&(h[p*F+d]=s[p]);for(f=0,m=3*D*F,d=0;d<F;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],l[v]=i[f],l[v+1]=i[f+1],l[v+2]=i[f+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(h[D*F+d]=h[0+d]);for(f=3*(D-1)*F,m=3*(D+1)*F,d=0;d<F;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],l[v]=i[3*z],l[v+1]=i[3*z+1],l[v+2]=i[3*z+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(h[(D+1)*F+d]=h[(D-1)*F+d])},e.prototype.makeIndex=function(){var t,e,n,r,i,o,a=this.meshIndex,s=this.size2,c=s-1,u=this.capTriangles,l=this.radialSegments,h=this.radialSegments+1;for(t=0;t<c;++t)for(e=t*l*3*2,n=t*l,r=(t+1)*l,o=0;o<l;++o)a[i=e+3*o*2]=n+o,a[i+1]=n+(o+1)%l,a[i+2]=r+o,a[i+3]=r+o,a[i+4]=n+(o+1)%l,a[i+5]=r+(o+1)%l;var p=[0];for(o=1;o<h/2;++o)p.push(o),l-o!==o&&p.push(l-o);for(i=c*l*3*2,e=s*l,o=0;o<p.length-2;++o)o%2==0?(a[i+3*o+0]=e+p[o+0],a[i+3*o+1]=e+p[o+1],a[i+3*o+2]=e+p[o+2]):(a[i+3*o+0]=e+p[o+2],a[i+3*o+1]=e+p[o+1],a[i+3*o+2]=e+p[o+0]);for(i=c*l*3*2+3*u,e=s*l+l,o=0;o<p.length-2;++o)o%2==0?(a[i+3*o+0]=e+p[o+0],a[i+3*o+1]=e+p[o+1],a[i+3*o+2]=e+p[o+2]):(a[i+3*o+0]=e+p[o+2],a[i+3*o+1]=e+p[o+1],a[i+3*o+2]=e+p[o+0])},e}(gm),Vv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="cartoon",this.parameters=Object.assign({aspectRatio:{type:"number",precision:1,max:10,min:1},subdiv:{type:"integer",max:50,min:1,rebuild:!0},radialSegments:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},capped:{type:"boolean",rebuild:!0},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"chainname"),n.colorScale=gs(n.colorScale,"RdYlBu"),n.radius=gs(n.radius,"sstruc"),n.scale=gs(n.scale,.7),this.aspectRatio=gs(n.aspectRatio,5),this.tension=gs(n.tension,NaN),this.capped=gs(n.capped,!0),this.smoothSheet=gs(n.smoothSheet,!1),"low"===n.quality?(this.subdiv=3,this.radialSegments=6):"medium"===n.quality?this.subdiv=6:"high"===n.quality?this.subdiv=12:this.subdiv=gs(n.subdiv,6),t.prototype.init.call(this,n)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:1!==this.aspectRatio,smoothSheet:this.smoothSheet},t)},e.prototype.getSpline=function(t){return new Bv(t,this.getSplineParams())},e.prototype.getScale=function(t){return t.isCg()?this.scale*this.aspectRatio:this.scale},e.prototype.getAspectRatio=function(t){return t.isCg()?1:this.aspectRatio},e.prototype.createData=function(t){var e=this,n=[],r=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){r.push(t);var i=e.getSpline(t),o=i.getSubdividedPosition(),a=i.getSubdividedOrientation(),s=i.getSubdividedColor(e.getColorParams()),c=i.getSubdividedPicking(),u=i.getSubdividedSize(e.radius,e.getScale(t));n.push(new Gv(Object.assign({},o,a,s,c,u),e.getBufferParams({radialSegments:e.radialSegments,aspectRatio:e.getAspectRatio(t),capped:e.capped,dullInterior:!0})))}},t.getSelection()),{bufferList:n,polymerList:r}},e.prototype.updateData=function(t,e){nl&&el.time(this.type+" repr update"),t=t||{};for(var n=0,r=e.polymerList.length;n<r;++n){var i={},o=e.polymerList[n],a=this.getSpline(o);if(e.bufferList[n].aspectRatio=this.getAspectRatio(o),t.position||t.radius){var s=a.getSubdividedPosition(),c=a.getSubdividedOrientation(),u=a.getSubdividedSize(this.radius,this.getScale(o));i.position=s.position,i.normal=c.normal,i.binormal=c.binormal,i.tangent=c.tangent,i.size=u.size}if(t.color){var l=a.getSubdividedColor(this.getColorParams());i.color=l.color}if(t.picking){var h=a.getSubdividedPicking();i.picking=h.picking}e.bufferList[n].setAttributes(i)}nl&&el.timeEnd(this.type+" repr update")},e.prototype.setParameters=function(e){var n={};return e&&e.aspectRatio&&(n.radius=!0),e&&e.tension&&(n.position=!0),t.prototype.setParameters.call(this,e,n,!1),this},e}(_g);sl.add("cartoon",Vv);var Hv=function(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new wf(e)};function $v(t,e,n){e=e||3.5,n=n||40;for(var r=new Hu("( ARG and ( .NE or .NH1 or .NH2 ) ) or ( ASP and .ND2 ) or ( GLN and .NE2 ) or ( HIS and ( .ND1 or .NE2 ) ) or ( LYS and .NZ ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TRP and .NE1 ) or ( TYR and .OH ) or ( PROTEIN and .N )"),i=new Hu("( ASN and .OD1 ) or ( ASP and ( OD1 or .OD2 ) ) or ( GLN and .OE1 ) or ( GLU and ( .OE1 or .OE2 ) ) or ( HIS and ( .ND1 or .NE2 ) ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TYR and .OH ) or ( PROTEIN and .O )"),o=t.getView(r),a=t.getView(i),s=new Hv(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),l=t.getAtomProxy(),h=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new Ne,g=new Ne,v=function(t,e,r,i){var o,a;t.atomname===r?(o=t,a=e):(o=e,a=t),d.index=o.residueIndex;var s=d.getAtomIndexByName(i);return m.subVectors(s,o),g.subVectors(s,a),Bs(m.angleTo(g))<n},y=0,b=c.count;y<b;++y)if(u.index=c.atomIndex1[y],l.index=c.atomIndex2[y],"O"===u.atomname&&"N"===l.atomname||"N"===u.atomname&&"O"===l.atomname)s.bondSet.clear(y);else if("N"===u.atomname||"N"===l.atomname){var x,_;if("N"===u.atomname?(x=u,_=l):(x=l,_=u),d.index=x.residueIndex,h.index=d.getAtomIndexByName("CA"),void 0===h.index)continue;var w=d.getPreviousConnectedResidue(f);if(void 0===w)continue;if(p.index=w.getAtomIndexByName("C"),void 0===p.index)continue;m.subVectors(x,p),g.subVectors(x,h),m.add(g).multiplyScalar(.5),g.subVectors(_,x),Bs(m.angleTo(g))>n&&s.bondSet.clear(y)}else("OH"===u.atomname&&"TYR"===u.resname||"OH"===l.atomname&&"TYR"===l.resname)&&(v(u,l,"OH","CZ")||s.bondSet.clear(y));return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}function Wv(t,e,n){e=e||3.5,n=n||40;for(var r=new Hu("( PROTEIN and .N )"),i=new Hu("( PROTEIN and .O )"),o=t.getView(r),a=t.getView(i),s=new Hv(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),l=t.getAtomProxy(),h=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new Ne,g=new Ne,v=0,y=c.count;v<y;++v){var b,x;if(u.index=c.atomIndex1[v],l.index=c.atomIndex2[v],"N"===u.atomname?(b=u,x=l):(b=l,x=u),d.index=b.residueIndex,h.index=d.getAtomIndexByName("CA"),void 0!==h.index){var _=d.getPreviousConnectedResidue(f);void 0!==_&&(p.index=_.getAtomIndexByName("C"),void 0!==p.index&&(m.subVectors(b,p),g.subVectors(b,h),m.add(g).multiplyScalar(.5),g.subVectors(x,b),Bs(m.angleTo(g))>n&&s.bondSet.clear(v)))}}return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}Hv.prototype.within=function(t,e){el.time("Contact within");var n=this.kdtree2,r=this.sview1.getAtomProxy(),i=this.sview1.getAtomSet(!1),o=new df;this.sview1.eachAtom(function(a){for(var s=!1,c=n.nearest(a,1/0,t),u=0,l=c.length;u<l;++u){var h=c[u];r.index=h.index,a.residueIndex!==r.residueIndex&&(!e||h.distance>e)&&(s=!0,i.set(r.index),o.addBond(a,r,1))}s&&i.set(a.index)});var a=new qp(o.count,!0);return el.timeEnd("Contact within"),{atomSet:i,bondSet:a,bondStore:o}};var qv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="contact",this.parameters=Object.assign({contactType:{type:"select",rebuild:!0,options:{polar:"polar",polarBackbone:"polar backbone"}},maxDistance:{type:"number",precision:1,max:10,min:.1,rebuild:!0},maxAngle:{type:"integer",max:180,min:0,rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.radius=gs(n.radius,.25),this.contactType=gs(n.contactType,"polarBackbone"),this.maxDistance=gs(n.maxDistance,3.5),this.maxAngle=gs(n.maxAngle,40),t.prototype.init.call(this,n)},e.prototype.getContactData=function(t){return{polar:$v,polarBackbone:Wv}[this.contactType](t,this.maxDistance,this.maxAngle)},e.prototype.getBondData=function(t,e,n){var r=t.getBondData(this.getBondParams(e,n));return r.picking&&(r.picking=new kp(r.picking.array,r.picking.structure,n.bondStore)),r},e.prototype.createData=function(t){var e=this.getContactData(t);return{bufferList:[new jm(this.getBondData(t,void 0,{bondSet:e.bondSet,bondStore:e.bondStore}),this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],bondSet:e.bondSet,bondStore:e.bondStore}},e.prototype.updateData=function(t,e){if(!t||t.position){var n=this.getContactData(e.sview);e.bondSet=n.bondSet,e.bondStore=n.bondStore}var r={bondSet:e.bondSet,bondStore:e.bondStore},i=this.getBondData(e.sview,t,r),o={};t&&!t.position||(o.position=$l(i.position1,i.position2),o.position1=i.position1,o.position2=i.position2),t&&!t.color||(o.color=i.color,o.color2=i.color2),t&&!t.radius||(o.radius=i.radius),e.bufferList[0].setAttributes(o)},e}(_g);sl.add("contact",qv);var Xv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="distance",this.parameters=Object.assign({labelSize:{type:"number",precision:3,max:10,min:.001},labelColor:{type:"color"},labelVisible:{type:"boolean"},labelZOffset:{type:"number",precision:1,max:20,min:-20,buffer:"zOffset"},labelUnit:{type:"select",rebuild:!0,options:{"":"",angstrom:"angstrom",nm:"nm"}},atomPair:{type:"hidden",rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters,{flatShaded:null,assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.radius=gs(n.radius,.15),this.fontFamily=gs(n.fontFamily,"sans-serif"),this.fontStyle=gs(n.fontStyle,"normal"),this.fontWeight=gs(n.fontWeight,"bold"),this.sdf=gs(n.sdf,"Firefox"!==Ku),this.labelSize=gs(n.labelSize,2),this.labelColor=gs(n.labelColor,16777215),this.labelVisible=gs(n.labelVisible,!0),this.labelZOffset=gs(n.labelZOffset,.5),this.labelUnit=gs(n.labelUnit,""),this.atomPair=gs(n.atomPair,[]),t.prototype.init.call(this,n)},e.prototype.getDistanceData=function(t,e){var n=e.length,r=new Array(n),i=new Float32Array(3*n),o=new Hu,a=new Hu,s=new df,c=t.getAtomProxy(),u=t.getAtomProxy(),l=0;e.forEach(function(e,n){var h=e[0],p=e[1];if(Number.isInteger(h)&&Number.isInteger(p))c.index=h,u.index=p;else{o.setString(h),a.setString(p);var d=t.getAtomIndices(o),f=t.getAtomIndices(a);if(!d.length||!f.length)return void(l+=1);c.index=d[0],u.index=f[0]}s.addBond(c,u,1),n-=l;var m=c.distanceTo(u);switch(this.labelUnit){case"angstrom":r[n]=m.toFixed(2)+" "+String.fromCharCode(8491);break;case"nm":r[n]=(m/10).toFixed(2)+" nm";break;default:r[n]=m.toFixed(2)}var g=3*n;i[g+0]=(c.x+u.x)/2,i[g+1]=(c.y+u.y)/2,i[g+2]=(c.z+u.z)/2},this),l>0&&(n-=l,i=i.subarray(0,3*n));var h=new qp(s.count,!0);return{text:r,position:i,bondSet:h,bondStore:s}},e.prototype.getBondData=function(t,e,n){var r=t.getBondData(this.getBondParams(e,n));return r.picking&&(r.picking=new zp(r.picking.array,r.picking.structure,n.bondStore)),r},e.prototype.create=function(){if(0!==this.structureView.atomCount){var t=this.atomPair.length;if(0!==t){var e=this.getDistanceData(this.structureView,this.atomPair),n=new En(this.labelColor);this.textBuffer=new Jm({position:e.position,size:Wl(t,this.labelSize),color:ql(t,n.r,n.g,n.b),text:e.text},this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,zOffset:this.labelZOffset,opacity:1,visible:this.labelVisible}));var r={bondSet:e.bondSet,bondStore:e.bondStore},i=this.getBondData(this.structureView,void 0,r);this.cylinderBuffer=new jm(i,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bondSet:e.bondSet,bondStore:e.bondStore,position:e.position,bufferList:[this.textBuffer,this.cylinderBuffer]})}}},e.prototype.update=function(e){e.position?this.build():t.prototype.update.call(this,e)},e.prototype.updateData=function(t,e){var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,n),i={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=Wl(a,this.labelSize)),t.labelColor){var s=new En(this.labelColor);o.color=ql(a,s.r,s.g,s.b)}t.color&&(i.color=r.color,i.color2=r.color2),(t.radius||t.scale)&&(i.radius=r.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(i)},e.prototype.setVisibility=function(e,n){return t.prototype.setVisibility.call(this,e,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),n||this.viewer.requestRender(),this},e.prototype.setParameters=function(e){var n={};return e&&e.labelSize&&(n.labelSize=!0),e&&(e.labelColor||0===e.labelColor)&&(n.labelColor=!0),t.prototype.setParameters.call(this,e,n,!1),e&&void 0!==e.labelVisible&&this.setVisibility(this.visible),this},e}(_g);sl.add("distance",Xv);var Yv=function(t){function e(e,n){var r=n||{},i=2*(e.position.length/3),o=new En(gs(r.color,"grey")),a=new Float32Array(3*i),s=ql(i,o.r,o.g,o.b);t.call(this,{position:a,color:s},r),this.scale=gs(r.scale,1),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,n,r,i=this.geometry.attributes;t.position&&t.vector&&(e=t.position,n=t.vector,r=i.position.array,i.position.needsUpdate=!0);var o,a,s=this.size/2,c=this.scale;if(t.position&&t.vector)for(var u=0;u<s;u++)a=3*u,r[(o=2*u*3)+0]=e[a+0],r[o+1]=e[a+1],r[o+2]=e[a+2],r[o+3]=e[a+0]+n[a+0]*c,r[o+4]=e[a+1]+n[a+1]*c,r[o+5]=e[a+2]+n[a+2]*c},n.isLine.get=function(){return!0},n.vertexShader.get=function(){return"Line.vert"},n.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,n),e}(fm),Kv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="helixorient",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"sstruc"),n.radius=gs(n.radius,.15),n.scale=gs(n.scale,1),t.prototype.init.call(this,n)},e.prototype.createData=function(t){var e=this,n=[],r=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){r.push(t);var i=new yf(t),o=i.getPosition(),a=i.getColor(e.getColorParams()),s=i.getSize(e.radius,e.scale),c=i.getPicking();n.push(new Mm({position:o.center,color:a.color,radius:s.size,picking:c.picking},e.getBufferParams({sphereDetail:e.sphereDetail,disableImpostor:e.disableImpostor,dullInterior:!0})),new Yv({position:o.center,vector:o.axis},e.getBufferParams({color:"skyblue",scale:1})),new Yv({position:o.center,vector:o.resdir},e.getBufferParams({color:"lightgreen",scale:1})))}},t.getSelection()),{bufferList:n,polymerList:r}},e.prototype.updateData=function(t,e){nl&&el.time(this.type+" repr update"),t=t||{};for(var n=0,r=e.polymerList.length;n<r;++n){var i=3*n,o={},a=new yf(e.polymerList[n]);if(t.position){var s=a.getPosition();o.position=s.center,e.bufferList[i+1].setAttributes({position:s.center,vector:s.axis}),e.bufferList[i+2].setAttributes({position:s.center,vector:s.resdir})}e.bufferList[i].setAttributes(o)}nl&&el.timeEnd(this.type+" repr update")},e}(_g);sl.add("helixorient",Kv);var Zv=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="licorice",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.aspectRatio=1,t.prototype.init.call(this,n)},e}(Dv);sl.add("licorice",Zv),ul.add("shader/HyperballStickImpostor.vert","\nattribute vec3 mapping;\nattribute float radius;\nattribute float radius2;\nattribute vec3 position1;\nattribute vec3 position2;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform float shrink;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewProjectionMatrixInverse;\nvoid main(){\nvRadius = radius;\nvRadius2 = radius2;\nvec4 spaceposition;\nvec3 position_atom1;\nvec3 position_atom2;\nvec4 vertex_position;\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nfloat radius1 = radius;\nposition_atom1 = position1;\nposition_atom2 = position2;\nfloat distance = distance( position_atom1, position_atom2 );\nspaceposition.z = mapping.z * distance;\nif (radius1 > radius2) {\nspaceposition.y = mapping.y * 1.5 * radius1;\nspaceposition.x = mapping.x * 1.5 * radius1;\n} else {\nspaceposition.y = mapping.y * 1.5 * radius2;\nspaceposition.x = mapping.x * 1.5 * radius2;\n}\nspaceposition.w = 1.0;\nvec4 e3 = vec4( 1.0 );\nvec3 e1, e1_temp, e2, e2_temp;\ne3.xyz = normalize(position_atom1-position_atom2);\nif (e3.z == 0.0) { e3.z = 0.0000000000001;}\nif ( (position_atom1.x - position_atom2.x) == 0.0) { position_atom1.x += 0.001;}\nif ( (position_atom1.y - position_atom2.y) == 0.0) { position_atom1.y += 0.001;}\nif ( (position_atom1.z - position_atom2.z) == 0.0) { position_atom1.z += 0.001;}\nvec4 focus = vec4( 1.0 );\nfocus.x = ( position_atom1.x*position_atom1.x - position_atom2.x*position_atom2.x +\n( radius2*radius2 - radius1*radius1 )*e3.x*e3.x/shrink )/(2.0*(position_atom1.x - position_atom2.x));\nfocus.y = ( position_atom1.y*position_atom1.y - position_atom2.y*position_atom2.y +\n( radius2*radius2 - radius1*radius1 )*e3.y*e3.y/shrink )/(2.0*(position_atom1.y - position_atom2.y));\nfocus.z = ( position_atom1.z*position_atom1.z - position_atom2.z*position_atom2.z +\n( radius2*radius2 - radius1*radius1 )*e3.z*e3.z/shrink )/(2.0*(position_atom1.z - position_atom2.z));\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2_temp = e1.yzx * e3.zxy - e1.zxy * e3.yzx;\ne2 = normalize(e2_temp);\nmat3 R= mat3( e1.xyz, e2.xyz, e3.xyz );\nvertex_position.xyz = R * spaceposition.xyz;\nvertex_position.w = 1.0;\nvertex_position.x += (position_atom1.x+position_atom2.x) / 2.0;\nvertex_position.y += (position_atom1.y+position_atom2.y) / 2.0;\nvertex_position.z += (position_atom1.z+position_atom2.z) / 2.0;\ngl_Position = modelViewProjectionMatrix * vertex_position;\nvec4 i_near, i_far;\nvec4 near = gl_Position;\nnear.z = 0.0 ;\nnear = modelViewProjectionMatrixInverse * near;\ni_near = near;\nvec4 far = gl_Position;\nfar.z = far.w ;\ni_far = modelViewProjectionMatrixInverse * far;\nprime1 = vec4( position_atom1 - (position_atom1 - focus.xyz)*shrink, 1.0 );\nprime2 = vec4( position_atom2 - (position_atom2 - focus.xyz)*shrink, 1.0 );\nfloat Rsquare = (radius1*radius1/shrink) - (\n(position_atom1.x - focus.x)*(position_atom1.x - focus.x) +\n(position_atom1.y - focus.y)*(position_atom1.y - focus.y) +\n(position_atom1.z - focus.z)*(position_atom1.z - focus.z)\n);\nfocus.w = Rsquare;\nmatrix_near = mat4( i_near, i_far, focus, e3 );\ngl_Position.z = 1.0;\n}"),ul.add("shader/HyperballStickImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float shrink;\nuniform mat4 modelViewMatrix;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewMatrixInverseTranspose;\nuniform mat4 projectionMatrix;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat calcClip( vec4 cameraPos ){\nreturn dot( cameraPos, vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nfloat calcClip( vec3 cameraPos ){\nreturn calcClip( vec4( cameraPos, 1.0 ) );\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nstruct Ray {\nvec3 origin ;\nvec3 direction ;\n};\nbool cutoff_plane (vec3 M, vec3 cutoff, vec3 x3){\nfloat a = x3.x;\nfloat b = x3.y;\nfloat c = x3.z;\nfloat d = -x3.x*cutoff.x-x3.y*cutoff.y-x3.z*cutoff.z;\nfloat l = a*M.x+b*M.y+c*M.z+d;\nif (l<0.0) {return true;}\nelse{return false;}\n}\nvec3 isect_surf(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t1 =(-b-sqrt(delta))/a;\nreturn r.origin+t1*r.direction;\n}\nvec3 isect_surf2(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t2 =(-b+sqrt(delta))/a;\nreturn r.origin+t2*r.direction;\n}\nRay primary_ray(vec4 near1, vec4 far1){\nvec3 near=near1.xyz/near1.w;\nvec3 far=far1.xyz/far1.w;\nreturn Ray(near,far-near);\n}\nfloat update_z_buffer(vec3 M, mat4 ModelViewP){\nfloat depth1;\nvec4 Ms=(ModelViewP*vec4(M,1.0));\nreturn depth1=(1.0+Ms.z/Ms.w)/2.0;\n}\nvoid main(){\nfloat radius = max( vRadius, vRadius2 );\nvec4 i_near, i_far, focus;\nvec3 e3, e1, e1_temp, e2;\ni_near = vec4(matrix_near[0][0],matrix_near[0][1],matrix_near[0][2],matrix_near[0][3]);\ni_far = vec4(matrix_near[1][0],matrix_near[1][1],matrix_near[1][2],matrix_near[1][3]);\nfocus = vec4(matrix_near[2][0],matrix_near[2][1],matrix_near[2][2],matrix_near[2][3]);\ne3 = vec3(matrix_near[3][0],matrix_near[3][1],matrix_near[3][2]);\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2 = normalize(cross(e1,e3));\nvec4 equation = focus;\nfloat shrinkfactor = shrink;\nfloat t1 = -1.0/(1.0-shrinkfactor);\nfloat t2 = 1.0/(shrinkfactor);\nvec4 colonne1, colonne2, colonne3, colonne4;\nmat4 mat;\nvec3 equation1 = vec3(t2,t2,t1);\nfloat A1 = - e1.x*equation.x - e1.y*equation.y - e1.z*equation.z;\nfloat A2 = - e2.x*equation.x - e2.y*equation.y - e2.z*equation.z;\nfloat A3 = - e3.x*equation.x - e3.y*equation.y - e3.z*equation.z;\nfloat A11 = equation1.x*e1.x*e1.x + equation1.y*e2.x*e2.x + equation1.z*e3.x*e3.x;\nfloat A21 = equation1.x*e1.x*e1.y + equation1.y*e2.x*e2.y + equation1.z*e3.x*e3.y;\nfloat A31 = equation1.x*e1.x*e1.z + equation1.y*e2.x*e2.z + equation1.z*e3.x*e3.z;\nfloat A41 = equation1.x*e1.x*A1 + equation1.y*e2.x*A2 + equation1.z*e3.x*A3;\nfloat A22 = equation1.x*e1.y*e1.y + equation1.y*e2.y*e2.y + equation1.z*e3.y*e3.y;\nfloat A32 = equation1.x*e1.y*e1.z + equation1.y*e2.y*e2.z + equation1.z*e3.y*e3.z;\nfloat A42 = equation1.x*e1.y*A1 + equation1.y*e2.y*A2 + equation1.z*e3.y*A3;\nfloat A33 = equation1.x*e1.z*e1.z + equation1.y*e2.z*e2.z + equation1.z*e3.z*e3.z;\nfloat A43 = equation1.x*e1.z*A1 + equation1.y*e2.z*A2 + equation1.z*e3.z*A3;\nfloat A44 = equation1.x*A1*A1 + equation1.y*A2*A2 + equation1.z*A3*A3 - equation.w;\ncolonne1 = vec4(A11,A21,A31,A41);\ncolonne2 = vec4(A21,A22,A32,A42);\ncolonne3 = vec4(A31,A32,A33,A43);\ncolonne4 = vec4(A41,A42,A43,A44);\nmat = mat4(colonne1,colonne2,colonne3,colonne4);\nRay ray = primary_ray(i_near,i_far) ;\nvec3 M;\nM = isect_surf(ray, mat);\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nvec4 M1 = vec4(M,1.0);\nvec4 M2 = mat*M1;\nvec3 _normal = ( modelViewMatrixInverseTranspose * M2 ).xyz;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\n#ifdef NEAR_CLIP\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 ){\nM = isect_surf2(ray, mat);\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / radius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix);\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#endif\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\nfloat distance_ratio = ((M.x-prime2.x)*e3.x + (M.y-prime2.y)*e3.y +(M.z-prime2.z)*e3.z) /\ndistance(prime2.xyz,prime1.xyz);\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vViewPosition = -( modelViewMatrix * vec4( M, 1.0 ) ).xyz;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distance_ratio>0.5 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var Qv=new Float32Array([-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,1]),Jv=new Uint16Array([0,1,2,0,2,3,1,5,6,1,6,2,4,6,5,4,7,6,0,7,4,0,3,7,0,5,1,0,4,5,3,2,6,3,6,7]),ty=function(t){function e(e,n){t.call(this,e,n);var r=e||{},i=gs((n||{}).shrink,.14);this.addUniforms({modelViewProjectionMatrix:{value:new De},modelViewProjectionMatrixInverse:{value:new De},modelViewMatrixInverseTranspose:{value:new De},shrink:{value:i}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null},radius2:{type:"f",value:null}}),this.setAttributes(r),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return n.parameters.get=function(){return Object.assign.call(this,{shrink:{uniform:!0}},t.prototype.parameters)},n.isImpostor.get=function(){return!0},n.vertexShader.get=function(){return"HyperballStickImpostor.vert"},n.fragmentShader.get=function(){return"HyperballStickImpostor.frag"},Object.defineProperties(e.prototype,n),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return n.mapping.get=function(){return Qv},n.mappingIndices.get=function(){return Jv},n.mappingIndicesSize.get=function(){return 36},n.mappingType.get=function(){return"v3"},n.mappingSize.get=function(){return 8},n.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,n),e}(wm)),ey=function(t,e){return!Ju||e&&e.disableImpostor?(t.radius=function(t,e){for(var n=t.length,r=new Float32Array(n),i=0;i<n;i++)r[i]=Math.min(t[i],e[i]);return r}(t.radius1,t.radius2),new zm(t,e)):new ty(t,e)},ny=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="hyperball",this.parameters=Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.scale=gs(n.scale,.2),n.radius=gs(n.radius,"vdw"),this.shrink=gs(n.shrink,.12),t.prototype.init.call(this,n)},e.prototype.getBondParams=function(e,n){return e&&!e.radius||(n=Object.assign({radius2:!0},n)),t.prototype.getBondParams.call(this,e,n)},e.prototype.createData=function(t){var e=new Mm(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));return this.__center=new Float32Array(3*t.bondCount),{bufferList:[e,new ey(t.getBondData(this.getBondParams()),this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}))]}},e.prototype.updateData=function(t,e){var n=e.sview.getAtomData(this.getAtomParams()),r=e.sview.getBondData(this.getBondParams()),i={},o={};if(!t||t.position){i.position=n.position;var a=r.position1,s=r.position2;o.position=$l(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(i.color=n.color,o.color=r.color,o.color2=r.color2),t&&!t.radius||(i.radius=n.radius,o.radius=r.radius,o.radius2=r.radius2),e.bufferList[0].setAttributes(i),e.bufferList[1].setAttributes(o)},e}(Zv);function ry(t,e){this.type=t,this.text=e||{}}sl.add("hyperball",ny),ry.prototype={constructor:ry,atomLabel:function(t){var e;switch(this.type){case"atomname":e=t.atomname;break;case"atomindex":e=""+t.index;break;case"occupancy":e=t.occupancy.toFixed(2);break;case"bfactor":e=t.bfactor.toFixed(2);break;case"serial":e=""+t.serial;break;case"element":e=t.element;break;case"atom":e=t.atomname+"|"+t.index;break;case"resname":e=t.resname;break;case"resno":e=""+t.resno;break;case"res":var n=t.resname.toUpperCase();e=(pd[n]||n)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},ry.types={"":"",atomname:"atom name",atomindex:"atom index",occupancy:"occupancy",bfactor:"b-factor",serial:"serial",element:"element",atom:"atom name + index",resname:"residue name",resno:"residue no",res:"residue name + no",text:"text",qualified:"qualified name"};var iy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="label",this.parameters=Object.assign({labelType:{type:"select",options:ry.types,rebuild:!0},labelText:{type:"hidden",rebuild:!0},fontFamily:{type:"select",options:{"sans-serif":"sans-serif",monospace:"monospace",serif:"serif"},buffer:!0},fontStyle:{type:"select",options:{normal:"normal",italic:"italic"},buffer:!0},fontWeight:{type:"select",options:{normal:"normal",bold:"bold"},buffer:!0},sdf:{type:"boolean",buffer:!0},xOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},yOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},zOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},attachment:{type:"select",options:{"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right","middle-left":"middle-left","middle-center":"middle-center","middle-right":"middle-right","top-left":"top-left","top-center":"top-center","top-right":"top-right"},rebuild:!0},showBorder:{type:"boolean",buffer:!0},borderColor:{type:"color",buffer:!0},borderWidth:{type:"number",precision:2,max:.3,min:0,buffer:!0},showBackground:{type:"boolean",rebuild:!0},backgroundColor:{type:"color",buffer:!0},backgroundMargin:{type:"number",precision:2,max:2,min:0,rebuild:!0},backgroundOpacity:{type:"range",step:.01,max:1,min:0,buffer:!0}},this.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};this.labelType=gs(n.labelType,"res"),this.labelText=gs(n.labelText,{}),this.fontFamily=gs(n.fontFamily,"sans-serif"),this.fontStyle=gs(n.fontStyle,"normal"),this.fontWeight=gs(n.fontWeight,"bold"),this.sdf=gs(n.sdf,"Chrome"===Ku),this.xOffset=gs(n.xOffset,0),this.yOffset=gs(n.yOffset,0),this.zOffset=gs(n.zOffset,.5),this.attachment=gs(n.attachment,"bottom-left"),this.showBorder=gs(n.showBorder,!1),this.borderColor=gs(n.borderColor,"lightgrey"),this.borderWidth=gs(n.borderWidth,.15),this.showBackground=gs(n.showBackground,!1),this.backgroundColor=gs(n.backgroundColor,"lightgrey"),this.backgroundMargin=gs(n.backgroundMargin,.5),this.backgroundOpacity=gs(n.backgroundOpacity,1),t.prototype.init.call(this,n)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,radius:!0})),n=[],r=new ry(this.labelType,this.labelText);return t.eachAtom(function(t){n.push(r.atomLabel(t))}),{bufferList:[new Jm({position:e.position,size:e.radius,color:e.color,text:n},this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,xOffset:this.xOffset,yOffset:this.yOffset,zOffset:this.zOffset,attachment:this.attachment,showBorder:this.showBorder,borderColor:this.borderColor,borderWidth:this.borderWidth,showBackground:this.showBackground,backgroundColor:this.backgroundColor,backgroundMargin:this.backgroundMargin,backgroundOpacity:this.backgroundOpacity}))]}},e.prototype.updateData=function(t,e){var n=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=n.position),t&&!t.radius||(r.size=n.radius),t&&!t.color||(r.color=n.color),e.bufferList[0].setAttributes(r)},e}(_g);sl.add("label",iy);var oy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="line",this.parameters=Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};this.multipleBond=gs(n.multipleBond,"off"),this.bondSpacing=gs(n.bondSpacing,1),t.prototype.init.call(this,n)},e.prototype.getBondParams=function(e,n){return n=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},n),t.prototype.getBondParams.call(this,e,n)},e.prototype.createData=function(t){var e=t.getBondData(this.getBondParams({position:!0,color:!0}));return{bufferList:[new wg(e,this.getBufferParams())]}},e.prototype.updateData=function(t,e){var n=e.sview.getBondData(this.getBondParams(t)),r={};t&&!t.position||(r.position1=n.position1,r.position2=n.position2),t&&!t.color||(r.color=n.color,r.color2=n.color2),e.bufferList[0].setAttributes(r)},e.prototype.setParameters=function(e){var n={};return e&&e.bondSpacing&&(n.position=!0),t.prototype.setParameters.call(this,e,n,!1),this},e}(_g);function ay(t,e,n,r,i){var o,a=new(r=r||Int32Array)(t*e*n*(i=i||1));function s(t,r,o){return((t*e+r)*n+o)*i}this.data=a,this.index=s,this.set=function(t,e,n){var r=arguments,c=s(t,e,n);for(o=0;o<i;++o)a[c+o]=r[3+o]},this.toArray=function(t,e,n,r,c){var u=s(t,e,n);for(void 0===r&&(r=[]),void 0===c&&(c=0),o=0;o<i;++o)r[c+o]=a[u+o]},this.fromArray=function(t,e,n,r,c){var u=s(t,e,n);for(void 0===c&&(c=0),o=0;o<i;++o)a[u+o]=r[c+o]},this.copy=function(t){this.data.set(t.data)},this.clone=function(){return new ay(t,e,n,r,i).copy(this)}}function sy(t,e,n){var r=ef(e),i=lp(t);0===t.length&&(i[0].set([0,0,0]),i[1].set([0,0,0]));var o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x=i[0],_=i[1];function w(t,e,n,i,w){o=e||1.4,a=n||2,g=w||!0;var S=0;for(var C in r)S=Math.max(S,C);var A=nf(x,_,S,a,t?o:0);c=A.dim[0],u=A.dim[1],l=A.dim[2],h=A.matrix,p=A.tran,a=A.scaleFactor,d={},f={},M(t),m=o*a,s=i||o/a,v=new Uint8Array(c*u*l),t&&(y=new Float64Array(c*u*l)),g&&(b=new Int32Array(c*u*l))}var S=1,C=2,A=4,E=[new Int32Array([1,0,0]),new Int32Array([-1,0,0]),new Int32Array([0,1,0]),new Int32Array([0,-1,0]),new Int32Array([0,0,1]),new Int32Array([0,0,-1]),new Int32Array([1,1,0]),new Int32Array([1,-1,0]),new Int32Array([-1,1,0]),new Int32Array([-1,-1,0]),new Int32Array([1,0,1]),new Int32Array([1,0,-1]),new Int32Array([-1,0,1]),new Int32Array([-1,0,-1]),new Int32Array([0,1,1]),new Int32Array([0,1,-1]),new Int32Array([0,-1,1]),new Int32Array([0,-1,-1]),new Int32Array([1,1,1]),new Int32Array([1,1,-1]),new Int32Array([1,-1,1]),new Int32Array([-1,1,1]),new Int32Array([1,-1,-1]),new Int32Array([-1,-1,1]),new Int32Array([-1,1,-1]),new Int32Array([-1,-1,-1])];function M(t){var e,n,i,s,c,u,l,h,p,m;for(var g in r)if(e=r[g],!d[g]){for(u=(l=t?(e+o)*a+.5:e*a+.5)*l,h=Math.floor(l)+1,p=new Int32Array(h*h),m=0,n=0;n<h;++n)for(i=0;i<h;++i)(s=n*n+i*i)>u?p[m]=-1:(c=Math.sqrt(u-s),p[m]=Math.floor(c)),++m;f[g]=h,d[g]=p}}function T(n){var r,i,o,s,h,m,y,x,_,w,C,A,E,M,T,P,I,R,O=3*n,L=n;r=Math.floor(.5+a*(t[O]+p[0])),i=Math.floor(.5+a*(t[O+1]+p[1])),o=Math.floor(.5+a*(t[O+2]+p[2]));var k,N=e[L],D=d[N],z=0,F=u*l,B=f[N];for(w=0;w<B;++w)for(C=0;C<B;++C){if(-1!==(k=D[z]))for(P=-1;P<2;++P)for(I=-1;I<2;++I)for(R=-1;R<2;++R)if(0!==P&&0!==I&&0!==R)for(y=P*w,_=R*C,A=0;A<=k;++A)if(M=i+(x=A*I),T=o+_,!((E=r+y)<0||M<0||T<0||E>=c||M>=u||T>=l)){var U=E*F+M*l+T;if(g)if(v[U]&S){if(v[U]&S){var j=b[U];j!==O&&y*y+x*x+_*_<(s=r+y-Math.floor(.5+a*(t[j]+p[0])))*s+(h=i+x-Math.floor(.5+a*(t[j+1]+p[1])))*h+(m=o+_-Math.floor(.5+a*(t[j+2]+p[2])))*m&&(b[U]=n)}}else v[U]|=S,b[U]=n;else v[U]|=S}z++}}function P(e){var n,r;for(console.time("EDTSurface fillvoxels"),n=0,r=v.length;n<r;++n)v[n]=0,e&&(y[n]=-1),g&&(b[n]=-1);for(n=0,r=t.length/3;n<r;++n)T(n);for(n=0,r=v.length;n<r;++n)v[n]&S&&(v[n]|=C);console.timeEnd("EDTSurface fillvoxels")}function I(n){var r,i,o,s,h,m,y,x,_,w,S,A,E,M,T,P,I,R,O,L=3*n,k=n,N=0;r=Math.floor(.5+a*(t[L]+p[0])),i=Math.floor(.5+a*(t[L+1]+p[1])),o=Math.floor(.5+a*(t[L+2]+p[2]));var D=e[k],z=u*l;for(E=0,O=f[D];E<O;++E)for(M=0;M<O;++M){if(-1!==d[D][N])for(P=-1;P<2;++P)for(I=-1;I<2;++I)for(R=-1;R<2;++R)if(0!==P&&0!==I&&0!==R)for(y=P*E,_=R*M,T=0;T<=d[D][N];++T)if(S=i+(x=T*I),A=o+_,!((w=r+y)<0||S<0||A<0||w>=c||S>=u||A>=l)){var F=w*z+S*l+A;if(v[F]&C){if(g){var B=b[F];y*y+x*x+_*_<(s=Math.floor(.5+a*(t[B]+p[0])))*s+(h=Math.floor(.5+a*(t[B+1]+p[1])))*h+(m=Math.floor(.5+a*(t[B+2]+p[2])))*m&&(b[F]=n)}}else v[F]|=C,g&&(b[F]=n)}N++}}function R(){var t,e,n,r;console.time("EDTSurface fastdistancemap");var i,o=new ay(c,u,l,Uint16Array,3),a=u*l,h=m*m,p=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(n=0;n<l;++n)v[i=t*a+e*l+n]&=~C,v[i]&S&&v[i]&A&&(o.set(t,e,n,t,e,n),y[i]=0,v[i]|=C,p+=1);var d=new Int32Array(3*p),f=0,x=new Int32Array(3*p),_=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(n=0;n<l;++n)v[i=t*a+e*l+n]&A&&(d[f]=t,d[f+1]=e,d[f+2]=n,f+=3,v[i]&=~A);do{for(_=O(d,o,f,x),f=0,t=0,r=_;t<r;t+=3)i=a*x[t]+l*x[t+1]+x[t+2],v[i]&=~A,y[i]<=1.0404*h&&(d[f]=x[t],d[f+1]=x[t+1],d[f+2]=x[t+2],f+=3)}while(f>0);var w,E=s*s,M=new Uint16Array(3);for(t=0;t<c;++t)for(e=0;e<u;++e)for(n=0;n<l;++n)v[i=t*a+e*l+n]&=~A,v[i]&S&&(v[i]&C&&!(v[i]&C&&y[i]>=E)||(v[i]|=A,g&&v[i]&C&&(o.toArray(t,e,n,M),w=M[0]*a+M[1]*l+M[2],b[i]=b[w])));console.timeEnd("EDTSurface fastdistancemap")}function O(t,e,n,r){var i,o,a,s,h,p,d,f,m,g,b,x,_=new Uint16Array(3),w=0;if(0===n)return w;var M=-1,T=-1,P=-1,I=u*l;for(d=0,m=n;d<m;d+=3)for(i=t[d],o=t[d+1],a=t[d+2],e.toArray(i,o,a,_),f=0;f<6;++f)M=i+(x=E[f])[0],T=o+x[1],P=a+x[2],M<c&&M>-1&&T<u&&T>-1&&P<l&&P>-1&&(v[b=M*I+l*T+P]&S&&!(v[b]&C)?(e.fromArray(M,T,P,_),g=(s=M-_[0])*s+(h=T-_[1])*h+(p=P-_[2])*p,y[b]=g,v[b]|=C,v[b]|=A,r[w]=M,r[w+1]=T,r[w+2]=P,w+=3):v[b]&S&&v[b]&C&&(g=(s=M-_[0])*s+(h=T-_[1])*h+(p=P-_[2])*p)<y[b]&&(e.fromArray(M,T,P,_),y[b]=g,v[b]&A||(v[b]|=A,r[w]=M,r[w+1]=T,r[w+2]=P,w+=3)));for(d=0,m=n;d<m;d+=3)for(i=t[d],o=t[d+1],a=t[d+2],e.toArray(i,o,a,_),f=6;f<18;f++)M=i+(x=E[f])[0],T=o+x[1],P=a+x[2],M<c&&M>-1&&T<u&&T>-1&&P<l&&P>-1&&(v[b=M*I+l*T+P]&S&&!(v[b]&C)?(e.fromArray(M,T,P,_),g=(s=M-_[0])*s+(h=T-_[1])*h+(p=P-_[2])*p,y[b]=g,v[b]|=C,v[b]|=A,r[w]=M,r[w+1]=T,r[w+2]=P,w+=3):v[b]&S&&v[b]&C&&(g=(s=M-_[0])*s+(h=T-_[1])*h+(p=P-_[2])*p)<y[b]&&(e.fromArray(M,T,P,_),y[b]=g,v[b]&A||(v[b]|=A,r[w]=M,r[w+1]=T,r[w+2]=P,w+=3)));for(d=0,m=n;d<m;d+=3)for(i=t[d],o=t[d+1],a=t[d+2],e.toArray(i,o,a,_),f=18;f<26;f++)M=i+(x=E[f])[0],T=o+x[1],P=a+x[2],M<c&&M>-1&&T<u&&T>-1&&P<l&&P>-1&&(v[b=M*I+l*T+P]&S&&!(v[b]&C)?(e.fromArray(M,T,P,_),g=(s=M-_[0])*s+(h=T-_[1])*h+(p=P-_[2])*p,y[b]=g,v[b]|=C,v[b]|=A,r[w]=M,r[w+1]=T,r[w+2]=P,w+=3):v[b]&S&&v[b]&C&&(g=(s=M-_[0])*s+(h=T-_[1])*h+(p=P-_[2])*p)<y[b]&&(e.fromArray(M,T,P,_),y[b]=g,v[b]&A||(v[b]|=A,r[w]=M,r[w+1]=T,r[w+2]=P,w+=3)));return w}this.getVolume=function(e,r,i,o,a){console.time("EDTSurface.getVolume");var s="vws"!==e;w(s,r,i,o,a),P(s),function(){var t,e,n,r=u*l;for(t=0;t<c;++t)for(e=0;e<l;++e)for(n=0;n<u;++n){var i=t*r+n*l+e;if(v[i]&S)for(var o=0;o<26;){var a=t+E[o][0],s=e+E[o][2],h=n+E[o][1];if(a>-1&&a<c&&h>-1&&h<u&&s>-1&&s<l&&!(v[a*r+h*l+s]&S)){v[i]|=A;break}o++}}}(),"ms"!==e&&"ses"!==e||R(),"ses"===e&&(M(!1),function(){var e,n;for(e=0,n=v.length;e<n;++e)v[e]&=~C;for(e=0,n=t.length/3;e<n;++e)I(e)}()),function(t){var e,n=v.length;if("vws"===t)for(e=0;e<n;++e)v[e]&=~A,v[e]=v[e]&C?1:0;else if("ms"===t)for(e=0;e<n;++e)v[e]&=~C,v[e]&A&&(v[e]|=C),v[e]&=~A,v[e]=v[e]&C?1:0;else if("ses"===t)for(e=0;e<n;++e)v[e]&A&&v[e]&C?v[e]&=~A:v[e]&A&&!(v[e]&C)&&(v[e]|=C),v[e]=v[e]&C?1:0;else if("sas"===t)for(e=0;e<n;++e)v[e]&=~A,v[e]=v[e]&C?1:0}(e);for(var h=0,p=b.length;h<p;++h)b[h]=n[b[h]];return console.timeEnd("EDTSurface.getVolume"),{data:v,nx:l,ny:u,nz:c,atomindex:b}},this.getSurface=function(t,e,n,r,i,o,a){var s=this.getVolume(t,e,n,r,i);return new af(s.data,s.nx,s.ny,s.nz,s.atomindex).getSurface(1,o,void 0,h,a)}}function cy(t,e,n,r,i,o,a){var s=t.length,c=i[0],u=i[1],l=i[2],h=o[0],p=o[1],d=o[2];function f(t,e){return Math.floor((t-e)/a)}for(var m,g,v,y=f(h,c)+1,b=f(p,u)+1,x=f(d,l)+1,_=y*b*x,w=b*x,S=[],C=0;C<s;C++){var A=(m=t[C],g=e[C],v=n[C],(f(m,c)*b+f(g,u))*x+f(v,l));void 0===S[A]?S[A]=[C]:S[A].push(C)}var E=new Uint32Array(_),M=new Uint16Array(_),T=new Uint32Array(s),P=0,I=0;for(C=0;C<_;C++){var R=E[C]=P,O=S[C];if(void 0!==O)for(var L=0;L<O.length;L++)T[P]=O[L],P++;var k=P-R;M[C]=k,k>I&&(I=k)}this.neighbourListLength=27*I+1,this.withinRadii=function(i,o,a,s,h){for(var p=0,d=f(i,c),m=f(o,u),g=f(a,l),v=Math.max(0,d-1),_=Math.max(0,m-1),S=Math.max(0,g-1),C=Math.min(y,d+1),A=Math.min(b,m+1),P=Math.min(x,g+1),I=v;I<=C;++I)for(var R=I*w,O=_;O<=A;++O)for(var L=O*x,k=S;k<=P;++k)for(var N=R+L+k,D=E[N],z=D+M[N],F=D;F<z;F++){var B=T[F],U=t[B]-i,j=e[B]-o,G=n[B]-a,V=r[B]+s;U*U+j*j+G*G<=V*V&&(h[p++]=T[F])}h[p]=-1}}function uy(t,e,n){for(var r=e.length,i=new Float32Array(r),o=new Float32Array(r),a=new Float32Array(r),s=0;s<r;s++){var c=3*s;i[s]=t[c],o[s]=t[c+1],a[s]=t[c+2]}var u=lp(t);0===t.length&&(u[0].set([0,0,0]),u[1].set([0,0,0]));var l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E,M,T,P=u[0],I=u[1],R=-1,O=new Float32Array([0,0,0]),L=new Float32Array([0,0,0]),k=new Float32Array([0,0,0]);function N(t,n,s,c){d=gs(t,1.4),f=gs(n,2),m=gs(s,!0),g=gs(c,30),l=new Float32Array(r),h=new Float32Array(r);for(var u=0;u<l.length;++u){var O=e[u]+d;l[u]=O,h[u]=O*O}p=0;for(var L=0;L<l.length;++L)l[L]>p&&(p=l[L]);var k;k=nf(P,I,p,f,0),f=k.scaleFactor,v=k.dim,y=k.matrix,T=Math.min(5,2+Math.floor(d*f)),b=Wl(v[0]*v[1]*v[2],-1001),x=new Int32Array(b.length),_=new Float32Array(v[0]),w=new Float32Array(v[1]),S=new Float32Array(v[2]),D(_,P[0],1/f),D(w,P[1],1/f),D(S,P[2],1/f),function(){var t=0,e=2*Math.PI/g;A=new Float32Array(g),C=new Float32Array(g);for(var n=0;n<g;n++)A[n]=Math.cos(t),C[n]=Math.sin(t),t+=e}(),E=new cy(i,o,a,l,P,I,2.01*p),M=new Int32Array(E.neighbourListLength),R=-1}function D(t,e,n){for(var r=0;r<t.length;r++)t[r]=e+n*r}function z(t,e,n,r,i){var o;if(-1!==R){if((o=R)!==r&&o!==i&&F(o,t,e,n))return o;R=-1}var a=0;for(o=M[a];o>=0;){if(o!==r&&o!==i&&F(o,t,e,n))return R=o,o;o=M[++a]}return R=-1,-1}function F(e,n,r,i){var o=3*e,a=h[e],s=t[o]-n,c=t[o+1]-r,u=t[o+2]-i;return s*s+c*c+u*u<a}function B(){for(var t=0;t<r;t++){var e=i[t],n=o[t],s=a[t],c=l[t],u=h[t];E.withinRadii(e,n,s,c,M);for(var p=Math.ceil(c*f),d=Math.floor(f*(e-P[0])),g=Math.floor(f*(n-P[1])),y=Math.floor(f*(s-P[2])),C=Math.max(0,d-p),A=Math.max(0,g-p),T=Math.max(0,y-p),I=Math.min(v[0],d+p+2),R=Math.min(v[1],g+p+2),O=Math.min(v[2],y+p+2),L=C;L<I;L++)for(var k=_[L]-e,N=v[1]*v[2]*L,D=A;D<R;D++)for(var F=w[D]-n,B=k*k+F*F,U=N+v[2]*D,j=T;j<O;j++){var G=S[j]-s,V=B+G*G;if(V<u){var H=j+U;b[H]<0&&(b[H]=-b[H]);var $=Math.sqrt(V),W=c/$,q=k*W,X=F*W,Y=G*W;if(-1===z(q+=e,X+=n,Y+=s,t,-1)){var K=c-$;K<b[H]&&(b[H]=K,m&&(x[H]=t))}}}}}function U(t,e){var n=l[t],r=l[e],s=O[0]=i[e]-i[t],c=O[1]=o[e]-o[t],u=O[2]=a[e]-a[t],h=s*s+c*c+u*u,p=Math.sqrt(h),d=n*((n*n+p*p-r*r)/(2*n*p));_p(O,O),function(t,e){t[0]=t[1]=t[2]=1,0!==e[0]?t[0]=(e[1]+e[2])/-e[0]:0!==e[1]?t[1]=(e[0]+e[2])/-e[1]:0!==e[2]&&(t[2]=(e[0]+e[1])/-e[2])}(L,O),_p(L,L),mp(k,O,L),_p(k,k);var y=Math.sqrt(n*n-d*d);xp(L,L,y),xp(k,k,y),xp(O,O,d),O[0]+=i[t],O[1]+=o[t],O[2]+=a[t],R=-1;for(var E=T,M=0;M<g;M++){var I=A[M],N=C[M],D=O[0]+I*L[0]+N*k[0],F=O[1]+I*L[1]+N*k[1],B=O[2]+I*L[2]+N*k[2];if(-1===z(D,F,B,t,e))for(var U=Math.floor(f*(D-P[0])),j=Math.floor(f*(F-P[1])),G=Math.floor(f*(B-P[2])),V=Math.max(0,U-E),H=Math.max(0,j-E),$=Math.max(0,G-E),W=Math.min(v[0],U+E+2),q=Math.min(v[1],j+E+2),X=Math.min(v[2],G+E+2),Y=V;Y<W;Y++){s=D-_[Y];for(var K=v[1]*v[2]*Y,Z=H;Z<q;Z++)for(var Q=s*s+(c=F-w[Z])*c,J=K+v[2]*Z,tt=$;tt<X;tt++){h=Q+(u=B-S[tt])*u;var et=tt+J,nt=b[et];nt>0&&h<nt*nt&&(b[et]=Math.sqrt(h),m&&(x[et]=t))}}}}function j(t,e,s){console.time("AVSurface.getVolume"),console.time("AVSurface.init"),N(t,e,s),console.timeEnd("AVSurface.init"),console.time("AVSurface.projectPoints"),B(),console.timeEnd("AVSurface.projectPoints"),console.time("AVSurface.projectTorii"),function(){for(var t=0;t<r;t++){E.withinRadii(i[t],o[t],a[t],l[t],M);for(var e=0,n=M[e];n>=0;)t<n&&U(t,n),n=M[++e]}}(),console.timeEnd("AVSurface.projectTorii"),function(){for(var t=0;t<b.length;t++)b[t]<0&&(b[t]=0)}(),function(){for(var t=0;t<x.length;t++)x[t]=n[x[t]]}(),console.timeEnd("AVSurface.getVolume")}this.getSurface=function(t,e,n,r,i,o,a){return j(e,n,i),new af(b,v[2],v[1],v[0],x).getSurface(e,!1,void 0,y,a)}}sl.add("line",oy),sy.__deps=[nf,ef,af,lp,ay],uy.__deps=[nf,af,Wl,lp,xp,mp,_p,cy,gs],il.add("molsurf",function(t,e){var n=t.data.args,r=t.data.params;if(n&&r){var i=new("av"===r.type?uy:sy)(n.coordList,n.radiusList,n.indexList).getSurface(r.type,r.probeRadius,r.scaleFactor,r.cutoff,!0,r.smooth,r.contour),o=[i.position.buffer,i.index.buffer];i.normal&&o.push(i.normal.buffer),i.atomindex&&o.push(i.atomindex.buffer),e({sd:i,p:r},o)}},[sy,uy]);var ly=function(t){this.structure=t};ly.prototype._getAtomData=function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},ly.prototype._makeSurface=function(t,e){var n=new rf(e.name,"",t);return n.info.type=e.type,n.info.probeRadius=e.probeRadius,n.info.scaleFactor=e.scaleFactor,n.info.smooth=e.smooth,n.info.cutoff=e.cutoff,n},ly.prototype.getSurface=function(t){var e=t||{},n=this._getAtomData(),r=n.position,i=n.radius,o=n.index,a=new("av"===e.type?uy:sy)(r,i,o).getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth,e.contour);return this._makeSurface(a,e)},ly.prototype.getSurfaceWorker=function(t,e){var n=this,r=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new qd("molsurf"));var i=this._getAtomData(),o=i.position,a=i.radius,s=i.index,c={args:{coordList:o,radiusList:a,indexList:s},params:r},u=[o.buffer,a.buffer,s.buffer];this.worker.post(c,u,function(t){e(n._makeSurface(t.data.sd,r))},function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),n.worker.terminate(),n.worker=void 0;var i=n.getSurface(r);e(i)})}else{var l=this.getSurface(r);e(l)}},ly.prototype.dispose=function(){this.worker&&this.worker.terminate()};var hy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="surface",this.parameters=Object.assign({surfaceType:{type:"select",rebuild:!0,options:{vws:"vws",sas:"sas",ms:"ms",ses:"ses",av:"av"}},probeRadius:{type:"number",precision:1,max:20,min:0,rebuild:!0},smooth:{type:"integer",precision:1,max:10,min:0,rebuild:!0},scaleFactor:{type:"number",precision:1,max:5,min:0,rebuild:!0},cutoff:{type:"number",precision:2,max:50,min:0,rebuild:!0},contour:{type:"boolean",rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text",rebuild:!0},colorVolume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},this.parameters,{radiusType:null,radius:null,scale:null}),this.__infoList=[],this.structure.signals.refreshed.add(function(){this.__forceNewMolsurf=!0},this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"uniform"),n.colorValue=gs(n.colorValue,14540253),n.disablePicking=gs(n.disablePicking,!0),this.surfaceType=gs(n.surfaceType,"ms"),this.probeRadius=gs(n.probeRadius,1.4),this.smooth=gs(n.smooth,2),this.scaleFactor=gs(n.scaleFactor,2),this.cutoff=gs(n.cutoff,0),this.contour=gs(n.contour,!1),this.background=gs(n.background,!1),this.opaqueBack=gs(n.opaqueBack,!0),this.filterSele=gs(n.filterSele,""),this.colorVolume=gs(n.colorVolume,void 0),this.useWorker=gs(n.useWorker,!0),t.prototype.init.call(this,e)},e.prototype.prepareData=function(t,e,n){var r=this.__infoList[e];if(r||(r={},this.__infoList[e]=r),r.molsurf&&r.sele===t.selection.string)n(e);else{if(this.filterSele){var i=t.structure.getView(new Hu(this.filterSele)),o=i.boundingBox.getSize(),a=Math.max(o.x,o.y,o.z),s=t.getAtomSetWithinPoint(i.center,a/2+6);t=t.getView(new Hu(t.getAtomSetWithinSelection(s,3).toSeleString()))}r.sele=t.selection.string,r.molsurf=new ly(t);var c=this.getSurfaceParams(),u=function(t){r.surface=t,n(e)};this.useWorker?r.molsurf.getSurfaceWorker(c,u):u(r.molsurf.getSurface(c))}},e.prototype.prepare=function(t){var e=this;if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach(function(t){t.molsurf.dispose()}),this.__infoList.length=0),0!==this.structureView.atomCount){var n=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),r="default"===this.assembly?this.defaultAssembly:this.assembly,i=this.structure.biomolDict[r];i?i.partList.forEach(function(t,r){var o=t.getView(e.structureView);e.prepareData(o,r,function(t){t===i.partList.length-1&&n()})}):this.prepareData(this.structureView,0,n)}else t()},e.prototype.createData=function(t,e){var n=this.__infoList[e],r=n.surface,i={position:r.getPosition(),color:r.getColor(this.getColorParams()),index:r.getFilteredIndex(this.filterSele,t)},o=[];if(r.contour){var a=new pg(i,this.getBufferParams({wireframe:!1}));o.push(a)}else{i.normal=r.getNormal(),i.picking=r.getPicking(t.getStructure());var s=new sg(i,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),c=new lg(s);o.push(c)}return{bufferList:o,info:n}},e.prototype.updateData=function(t,e){var n={};if(t.position)return this.__forceNewMolsurf=!0,void this.build();t.color&&(n.color=e.info.surface.getColor(this.getColorParams())),t.index&&(n.index=e.info.surface.getFilteredIndex(this.filterSele,e.sview)),e.bufferList[0].setAttributes(n)},e.prototype.setParameters=function(e,n,r){return n=n||{},e&&e.filterSele&&(n.index=!0),e&&void 0!==e.colorVolume&&(n.color=!0),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,n,r),this},e.prototype.getSurfaceParams=function(t){return Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth&&!this.contour,cutoff:this.cutoff,contour:this.contour,useWorker:this.useWorker},t)},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.clear=function(){t.prototype.clear.call(this)},e.prototype.dispose=function(){this.__infoList.forEach(function(t){t.molsurf.dispose()}),this.__infoList.length=0,t.prototype.dispose.call(this)},e}(_g);sl.add("surface",hy);var py=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="point",this.parameters=Object.assign({pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},this.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};this.pointSize=gs(n.pointSize,1),this.sizeAttenuation=gs(n.sizeAttenuation,!0),this.sortParticles=gs(n.sortParticles,!1),this.useTexture=gs(n.useTexture,!1),this.alphaTest=gs(n.alphaTest,.5),this.forceTransparent=gs(n.forceTransparent,!1),this.edgeBleach=gs(n.edgeBleach,0),t.prototype.init.call(this,n)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,picking:!0}));return{bufferList:[new fg(e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}))]}},e.prototype.updateData=function(t,e){var n=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=n.position),t&&!t.color||(r.color=n.color),e.bufferList[0].setAttributes(r)},e}(_g);sl.add("point",py),ul.add("shader/Ribbon.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec3 dir;\nattribute float size;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\ntransformed += normalize( dir ) * size;\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}");var dy=new Uint16Array([0,1,2,1,3,2]),fy=function(t){function e(e,n){var r=e||{},i=r.position.length/3-1,o=4*i,a=3*o,s=new Float32Array(a),c=new Float32Array(a),u=new Float32Array(a),l=Es(a,a/3);t.call(this,{position:s,color:c,index:l,normal:u,picking:r.picking},n),this.addAttributes({dir:{type:"v3",value:new Float32Array(a)}}),this.addAttributes({size:{type:"f",value:new Float32Array(o)}}),r.primitiveId=Xl(i),this.setAttributes(r),this.meshIndex=l,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={vertexShader:{}};return e.prototype.setAttributes=function(t){var e,n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x=this.size/4,_=this.geometry.attributes;t.position&&(e=t.position,s=_.position.array,_.position.needsUpdate=!0),t.normal&&(n=t.normal,c=_.normal.array,_.normal.needsUpdate=!0),t.size&&(r=t.size,u=_.size.array,_.size.needsUpdate=!0),t.dir&&(i=t.dir,l=_.dir.array,_.dir.needsUpdate=!0),t.color&&(o=t.color,h=_.color.array,_.color.needsUpdate=!0),t.primitiveId&&(a=t.primitiveId,p=_.primitiveId.array,_.primitiveId.needsUpdate=!0);var w=r?r[0]:null;for(d=0;d<x;++d){for(y=3*d,m=3*d*4,v=4*d,e&&(s[m]=s[m+3]=e[y],s[m+1]=s[m+4]=e[y+1],s[m+2]=s[m+5]=e[y+2],s[m+6]=s[m+9]=e[y+3],s[m+7]=s[m+10]=e[y+4],s[m+8]=s[m+11]=e[y+5]),n&&(c[m]=c[m+3]=-n[y],c[m+1]=c[m+4]=-n[y+1],c[m+2]=c[m+5]=-n[y+2],c[m+6]=c[m+9]=-n[y+3],c[m+7]=c[m+10]=-n[y+4],c[m+8]=c[m+11]=-n[y+5]),f=0;f<4;++f)g=m+3*f,o&&(h[g]=o[y],h[g+1]=o[y+1],h[g+2]=o[y+2]),a&&(p[v+f]=a[d]);r&&(b=r[d],w!==r[d]?(u[v]=w,u[v+1]=w,u[v+2]=b,u[v+3]=b):(u[v]=b,u[v+1]=b,u[v+2]=b,u[v+3]=b),w=b),i&&(l[m]=i[y],l[m+1]=i[y+1],l[m+2]=i[y+2],l[m+3]=-i[y],l[m+4]=-i[y+1],l[m+5]=-i[y+2],l[m+6]=i[y+3],l[m+7]=i[y+4],l[m+8]=i[y+5],l[m+9]=-i[y+3],l[m+10]=-i[y+4],l[m+11]=-i[y+5])}},e.prototype.makeIndex=function(){var t,e,n,r,i=this.meshIndex,o=i.length/4/3;for(e=0;e<o;++e)for(n=6*e,r=4*e,i.set(dy,n),t=0;t<6;++t)i[n+t]+=r},n.vertexShader.get=function(){return"Ribbon.vert"},Object.defineProperties(e.prototype,n),e}(gm),my=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="ribbon",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{side:null,wireframe:null,linewidth:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"chainname"),n.colorScale=gs(n.colorScale,"RdYlBu"),n.radius=gs(n.radius,"sstruc"),n.scale=gs(n.scale,4),"low"===n.quality?this.subdiv=3:"medium"===n.quality?this.subdiv=6:"high"===n.quality?this.subdiv=12:this.subdiv=gs(n.subdiv,6),this.tension=gs(n.tension,NaN),this.smoothSheet=gs(n.smoothSheet,!1),t.prototype.init.call(this,n)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!0,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,n=[],r=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){r.push(t);var i=new Bv(t,e.getSplineParams()),o=i.getSubdividedPosition(),a=i.getSubdividedOrientation(),s=i.getSubdividedColor(e.getColorParams()),c=i.getSubdividedPicking(),u=i.getSubdividedSize(e.radius,e.scale);n.push(new fy({position:o.position,normal:a.binormal,dir:a.normal,color:s.color,size:u.size,picking:c.picking},e.getBufferParams()))}},t.getSelection()),{bufferList:n,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var n=0,r=e.polymerList.length;for(n=0;n<r;++n){var i={},o=new Bv(e.polymerList[n],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition(),s=o.getSubdividedOrientation();i.position=a.position,i.normal=s.binormal,i.dir=s.normal}if(t.radius||t.scale){var c=o.getSubdividedSize(this.radius,this.scale);i.size=c.size}if(t.color){var u=o.getSubdividedColor(this.getColorParams());i.color=u.color}e.bufferList[n].setAttributes(i)}},e.prototype.setParameters=function(e){var n={};return e&&e.tension&&(n.position=!0),t.prototype.setParameters.call(this,e,n,!1),this},e}(_g);sl.add("ribbon",my);var gy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="rocket",this.parameters=Object.assign({localAngle:{type:"integer",max:180,min:0,rebuild:!0},centerDist:{type:"number",precision:1,max:10,min:0,rebuild:!0},ssBorder:{type:"boolean",rebuild:!0},radialSegments:!0,openEnded:!0,disableImpostor:!0},this.parameters),this.helixbundleList=[],this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"sstruc"),n.radius=gs(n.radius,1.5),n.scale=gs(n.scale,1),n.openEnded=gs(n.openEnded,!1),this.localAngle=gs(n.localAngle,30),this.centerDist=gs(n.centerDist,2.5),this.ssBorder=gs(n.ssBorder,!1),t.prototype.init.call(this,n)},e.prototype.createData=function(t){var e=this,n=0,r=[],i=[];this.structure.eachPolymer(function(t){if(!(t.residueCount<4||t.isNucleic())){var o=new bf(t),a=o.getAxis(e.localAngle,e.centerDist,e.ssBorder,e.getColorParams(),e.radius,e.scale);n+=a.size.length,r.push(a),i.push(o)}},t.getSelection());var o={begin:new Float32Array(3*n),end:new Float32Array(3*n),size:new Float32Array(n),color:new Float32Array(3*n),picking:new Float32Array(n)},a=0;return r.forEach(function(t){o.begin.set(t.begin,3*a),o.end.set(t.end,3*a),o.size.set(t.size,a),o.color.set(t.color,3*a),o.picking.set(t.picking.array,a),a+=t.size.length}),n&&(o.picking=new Rp(o.picking,t.getStructure())),{bufferList:[new jm({position1:o.begin,position2:o.end,color:o.color,color2:o.color,radius:o.size,picking:o.picking},this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],axisList:r,helixbundleList:i,axisData:o}},e.prototype.updateData=function(t,e){var n=this;if((t=t||{}).position)this.build();else{var r={};if(t.color||t.radius){var i=0;e.helixbundleList.forEach(function(r){var o=r.getAxis(n.localAngle,n.centerDist,n.ssBorder,n.getColorParams(),n.radius,n.scale);t.color&&e.axisData.color.set(o.color,3*i),(t.radius||t.scale)&&e.axisData.size.set(o.size,i),i+=o.size.length}),t.color&&(r.color=e.axisData.color,r.color2=e.axisData.color),(t.radius||t.scale)&&(r.radius=e.axisData.size)}e.bufferList[0].setAttributes(r)}},e}(_g);sl.add("rocket",gy);var vy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="rope",this.parameters=Object.assign({smooth:{type:"integer",max:15,min:0,rebuild:!0}},this.parameters,{aspectRatio:null,smoothSheet:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.aspectRatio=1,n.tension=gs(n.tension,.5),n.scale=gs(n.scale,5),n.smoothSheet=!1,this.smooth=gs(n.smooth,2),t.prototype.init.call(this,n)},e.prototype.getSpline=function(t){var e=new yf(t);return new Bv(t,this.getSplineParams({directional:!1,positionIterator:e.getCenterIterator(this.smooth)}))},e}(Vv);sl.add("rope",vy);var yy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="spacefill",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};t.prototype.init.call(this,n)},e.prototype.createData=function(t){return{bufferList:[new Mm(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,dullInterior:!0,disableImpostor:this.disableImpostor}))]}},e.prototype.updateData=function(t,e){var n=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=n.position),t&&!t.color||(r.color=n.color),t&&!t.radius||(r.radius=n.radius),e.bufferList[0].setAttributes(r)},e}(_g);sl.add("spacefill",yy);var by=function(t){function e(e,n){var r=n||{},i=(e||{}).position.length/3-1,o=new Float32Array(3*i*2),a=new Float32Array(3*i*2);t.call(this,{position:o,color:a},r),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,n,r,i,o=this.geometry.attributes;if(t.position&&(e=t.position,r=o.position.array,o.position.needsUpdate=!0),t.color&&(n=t.color,i=o.color.array,o.color.needsUpdate=!0),e||n)for(var a,s,c=this.size-1,u=0;u<c;++u)a=3*u,s=3*u*2,e&&(r[s]=e[a],r[s+1]=e[a+1],r[s+2]=e[a+2],r[s+3]=e[a+3],r[s+4]=e[a+4],r[s+5]=e[a+5]),n&&(i[s]=n[a],i[s+1]=n[a+1],i[s+2]=n[a+2],i[s+3]=n[a+3],i[s+4]=n[a+4],i[s+5]=n[a+5]);else el.warn("TraceBuffer.prototype.setAttributes no data")},n.isLine.get=function(){return!0},n.vertexShader.get=function(){return"Line.vert"},n.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,n),e}(fm),xy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="trace",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorScheme=gs(n.colorScheme,"chainname"),n.colorScale=gs(n.colorScale,"RdYlBu"),"low"===n.quality?this.subdiv=3:"medium"===n.quality?this.subdiv=6:"high"===n.quality?this.subdiv=12:this.subdiv=gs(n.subdiv,6),this.tension=gs(n.tension,NaN),this.smoothSheet=gs(n.smoothSheet,!1),t.prototype.init.call(this,n)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!1,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,n=[],r=[];return this.structure.eachPolymer(function(t){if(!(t.residueCount<4)){r.push(t);var i=new Bv(t,e.getSplineParams()),o=i.getSubdividedPosition(),a=i.getSubdividedColor(e.getColorParams());n.push(new by(Object.assign({},o,a),e.getBufferParams()))}},t.getSelection()),{bufferList:n,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var n=0,r=e.polymerList.length;for(n=0;n<r;++n){var i={},o=new Bv(e.polymerList[n],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition();i.position=a.position}if(t.color){var s=o.getSubdividedColor(this.getColorParams());i.color=s.color}e.bufferList[n].setAttributes(i)}},e.prototype.setParameters=function(e){var n={};return e&&e.tension&&(n.position=!0),t.prototype.setParameters.call(this,e,n,!1),this},e}(_g);sl.add("trace",xy);var _y=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="tube",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.aspectRatio=1,n.scale=gs(n.scale,2),"low"===n.quality&&(this.radialSegments=5),t.prototype.init.call(this,n)},e.prototype.getSplineParams=function(){return t.prototype.getSplineParams.call(this,{directional:!1})},e}(Vv);sl.add("tube",_y);var wy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="unitcell",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{},r=.5;this.structure.unitcell&&(r=Math.cbrt(this.structure.unitcell.volume)/200),n.radius=gs(n.radius,r),n.colorValue=gs(n.colorValue,"orange"),t.prototype.init.call(this,n)},e.prototype.getUnitcellData=function(t){return t.unitcell.getData(t)},e.prototype.create=function(){var t=this.structureView.getStructure();if(t.unitcell){var e=this.getUnitcellData(t);this.sphereBuffer=new Mm(e.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new jm(e.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})}},e.prototype.updateData=function(t,e){var n=e.sview.getStructure(),r=this.getUnitcellData(n),i={},o={};t&&!t.position||(i.position=r.vertexPosition,o.position1=r.edgePosition1,o.position2=r.edgePosition2),t&&!t.color||(i.color=r.vertexColor,o.color=r.edgeColor,o.color2=r.edgeColor),t&&!t.radius||(i.radius=r.vertexRadius,o.radius=r.edgeRadius),this.sphereBuffer.setAttributes(i),this.cylinderBuffer.setAttributes(o)},e}(_g);sl.add("unitcell",wy);var Sy=function(t){function e(e,n,r){t.call(this,e,n,r),this.type="validation",this.parameters=Object.assign({},this.parameters,{radiusType:null,radius:null,scale:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var n=e||{};n.colorValue=gs(n.colorValue,"#f0027f"),t.prototype.init.call(this,n)},e.prototype.createData=function(t){if(t.validation){var e=t.validation.getClashData({structure:t,color:this.colorValue});return{bufferList:[new jm(e,this.getBufferParams({openEnded:!1}))]}}},e}(_g);sl.add("validation",Sy);var Cy=function(t,e){var n=e||{};this.streamer=t,this.name=gs(n.name,""),this.path=gs(n.path,"")},Ay={type:{},__objName:{}};Ay.type.get=function(){return""},Ay.__objName.get=function(){return""},Cy.prototype.parse=function(){var t=this;return this.streamer.read().then(function(){return t._beforeParse(),t._parse(),t._afterParse(),t[t.__objName]})},Cy.prototype._parse=function(){},Cy.prototype._beforeParse=function(){},Cy.prototype._afterParse=function(){nl&&el.log(this[this.__objName])},Object.defineProperties(Cy.prototype,Ay);var Ey=function(t){function e(e,n){var r=n||{};t.call(this,e,r),this.firstModelOnly=gs(r.firstModelOnly,!1),this.asTrajectory=gs(r.asTrajectory,!1),this.cAlphaOnly=gs(r.cAlphaOnly,!1),this.structure=new om(this.name,this.path),this.structureBuilder=new function(t){var e,n,r=null,i=null,o=null,a=null,s=null,c=null,u=t.atomStore,l=t.residueStore,h=t.chainStore,p=t.modelStore,d=t.residueMap,f=-1,m=-1,g=-1,v=-1;function y(t){for(var r=l.atomCount[t],i=l.atomOffset[t],o=new Array(r),a=0;a<r;++a)o[a]=u.atomTypeId[i+a];l.residueTypeId[t]=d.add(e,o,n)}this.addAtom=function(t,d,b,x,_,w,S,C){var A=!1,E=!1,M=!1;r!==t?(A=!0,E=!0,M=!0,v+=1,g+=1,m+=1):i!==b?(E=!0,M=!0,g+=1,m+=1):a===_&&o===x&&s===C||(M=!0,m+=1),f+=1,A&&(p.growIfFull(),p.chainOffset[v]=g,p.chainCount[v]=0,p.count+=1,h.modelIndex[g]=v),E&&(h.growIfFull(),h.setChainname(g,d),h.setChainid(g,b),h.residueOffset[g]=m,h.residueCount[g]=0,h.count+=1,h.modelIndex[g]=v,p.chainCount[v]+=1,l.chainIndex[m]=g),M&&(e=o,n=c,m>0&&y(m-1),l.growIfFull(),l.resno[m]=_,void 0!==S&&(l.sstruc[m]=S.charCodeAt(0)),void 0!==C&&(l.inscode[m]=C.charCodeAt(0)),l.atomOffset[m]=f,l.atomCount[m]=0,l.count+=1,l.chainIndex[m]=g,h.residueCount[g]+=1),u.count+=1,u.residueIndex[f]=m,l.atomCount[m]+=1,r=t,i=b,o=x,a=_,s=C,c=w},this.finalize=function(){e=o,n=c,m>-1&&y(m)}}(this.structure)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"structure"},n.__objName.get=function(){return"structure"},Object.defineProperties(e.prototype,n),e}(Cy);var My=function(t,e,n,r,i){this.structure=t,this.index=e,this.description=n||"",this.entityType=function(t){switch(t=t.toLowerCase()){case"polymer":return Yp;case"non-polymer":return Kp;case"macrolide":return Zp;case"water":return Qp;default:return Xp}}(r||""),this.chainIndexList=i||[],i.forEach(function(n){t.chainStore.entityIndex[n]=e})},Ty={type:{}};Ty.type.get=function(){return"Entity"},My.prototype.getEntityType=function(){return this.entityType},My.prototype.isPolymer=function(){return this.entityType===Yp},My.prototype.isNonPolymer=function(){return this.entityType===Kp},My.prototype.isMacrolide=function(){return this.entityType===Zp},My.prototype.isWater=function(){return this.entityType===Qp},My.prototype.eachChain=function(t){var e=this.structure.getChainProxy();this.chainIndexList.forEach(function(n){e.index=n,t(e)})},Object.defineProperties(My.prototype,Ty);var Py=function(t){var e=t||{};this.a=e.a||1,this.b=e.b||1,this.c=e.c||1,this.alpha=e.alpha||90,this.beta=e.beta||90,this.gamma=e.gamma||90,this.spacegroup=e.spacegroup||"P 1",this.cartToFrac=e.cartToFrac||e.scale,this.fracToCart=new De;var n=Fs(this.alpha),r=Fs(this.beta),i=Fs(this.gamma),o=Math.cos(n),a=Math.cos(r),s=Math.cos(i),c=Math.sin(r),u=Math.sin(i);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-o*o-a*a-s*s+2*o*a*s),void 0===this.cartToFrac){var l=this.a*this.b*u/this.volume,h=(a*s-o)/(c*u);this.fracToCart.set(this.a,0,0,0,this.b*s,this.b*u,0,0,this.c*a,-this.c*c*h,1/l,0,0,0,0,1).transpose(),this.cartToFrac=(new De).getInverse(this.fracToCart)}else this.fracToCart.getInverse(this.cartToFrac)};Py.prototype.getPosition=function(t){var e=new Float32Array(24),n=t.unitcell,r=t.center.clone().applyMatrix4(n.cartToFrac).floor().multiplyScalar(2).addScalar(1),i=new Ne,o=0;function a(t,a,s){i.set(t,a,s).multiply(r).applyMatrix4(n.fracToCart).toArray(e,o),o+=3}return a(0,0,0),a(1,0,0),a(0,1,0),a(0,0,1),a(1,1,0),a(1,0,1),a(0,1,1),a(1,1,1),e},Py.prototype.getCenter=function(t){return function(t,e){var n=t.length;e=e||new Ne;for(var r=0;r<n;r+=3)e.x+=t[r],e.y+=t[r+1],e.z+=t[r+2];return e.divideScalar(n/3),e}(this.getPosition(t))},Py.prototype.getData=function(t,e){var n=e||{},r=gs(n.colorValue,"orange"),i=gs(n.radius,Math.cbrt(this.volume)/200),o=new En(r),a=new Ne,s=this.getPosition(t),c=ql(8,o.r,o.g,o.b),u=Wl(8,i),l=new Float32Array(36),h=new Float32Array(36),p=ql(12,o.r,o.g,o.b),d=Wl(12,i),f=0;function m(t,e){a.fromArray(s,3*t).toArray(l,f),a.fromArray(s,3*e).toArray(h,f),f+=3}m(0,1),m(0,2),m(0,3),m(1,4),m(1,5),m(2,6),m(3,5),m(4,7),m(5,7),m(2,4),m(7,6),m(3,6);var g=new Vp(this,t);return{vertex:{position:s,color:c,radius:u,picking:g},edge:{position1:l,position2:h,color:p,color2:p,radius:d,picking:g}}};var Iy={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"},Ry=function(t){function e(e,n){var r=n||{};t.call(this,e,r),this.hex=gs(r.hex,!1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"pdb"},e.prototype._parse=function(){nl&&el.time("PdbParser._parse "+this.name);var t=!1,e=this.streamer.peekLines(1)[0],n=e.substr(62,4),r=e.substr(72,4);n===r&&r.trim()&&(t=!0);var i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E,M,T,P,I,R,O,L,k,N,D="pqr"===this.type,z=/\s+/,F=this.structure,B=this.structureBuilder,U=this.hex,j=10,G=10,V=this.firstModelOnly,H=this.asTrajectory,$=this.cAlphaOnly,W=F.frames,q=F.boxes,X=!1,Y=F.biomolDict,K={},Z={},Q={},J=[],tt=["MOL_ID","MOLECULE","CHAIN","FRAGMENT","SYNONYM","EC","ENGINEERED","MUTATION","OTHER_DETAILS"],et={},nt={},rt={helices:[],sheets:[]},it=rt.helices,ot=rt.sheets,at=F.atomMap,st=F.atomStore;st.resize(Math.round(this.streamer.data.length/80));var ct=F.getAtomProxy(),ut=F.getAtomProxy(),lt=0,ht=0,pt=!0;this.streamer.eachChunkOfLines(function(e){!function(e,n,r){for(var rt=e;rt<n;++rt)if(u=r[rt],"ATOM  "===(l=u.substr(0,6))||"HETATM"===l){if(pt&&(H?(X?(i=new Float32Array(3*st.count),W.push(i)):i=[],o=0):V||(K={}),I=(P=1).toString(),R=!0,pt=!1),V&&ht>0)continue;var dt=void 0,ft=void 0,mt=void 0,gt=void 0,vt=void 0;if(D){if(vt=10===(gt=u.split(z)).length?1:0,v=gt[2],$&&"CA"!==v)continue;dt=parseFloat(gt[6-vt]),ft=parseFloat(gt[7-vt]),mt=parseFloat(gt[8-vt])}else{if(v=u.substr(12,4).trim(),$&&"CA"!==v)continue;dt=parseFloat(u.substr(30,8)),ft=parseFloat(u.substr(38,8)),mt=parseFloat(u.substr(46,8))}if(H){var yt=3*o;if(i[yt+0]=dt,i[yt+1]=ft,i[yt+2]=mt,o+=1,X)continue}var bt=void 0;D?(h=parseInt(gt[1]),bt="",y="H"===u[0]?1:0,p=vt?"":gt[4],d=parseInt(gt[5-vt]),g="",f=gt[3],b=parseFloat(gt[9-vt]),x="",m=0):(h=parseInt(u.substr(6,5),j),U&&99999===h&&(j=16),y="H"===u[0]?1:0,p=u[21].trim(),d=parseInt(u.substr(22,4),G)||1,U&&9999===d&&(G=16),g=u[26].trim(),f=u.substr(17,4).trim()||"MOL",b=parseFloat(u.substr(60,6)),x=u[16].trim(),m=parseFloat(u.substr(54,6)),t||(bt=u.substr(76,2).trim(),p||(p=u.substr(72,4).trim()))),st.growIfFull(),st.atomTypeId[lt]=at.add(v,bt),st.x[lt]=dt,st.y[lt]=ft,st.z[lt]=mt,st.serial[lt]=h,st.bfactor[lt]=isNaN(b)?0:b,st.altloc[lt]=x.charCodeAt(0),st.occupancy[lt]=isNaN(m)?0:m,y?O===p&&k===f&&(vd.includes(f)||L===d&&N===g)||(I=(P+=1).toString(),L=d,k=f,N=g):R||O===p||(I=(P+=1).toString()),B.addAtom(ht,p,I,f,d,y,void 0,g),K[h]=lt,lt+=1,R=!1,O=p}else if("CONECT"===l){var xt=K[parseInt(u.substr(6,5))],_t=[11,16,21,26],wt={};if(void 0===xt)continue;for(var St=0;St<4;++St){var Ct=parseInt(u.substr(_t[St],5));if(!Number.isNaN(Ct)&&void 0!==(Ct=K[Ct]))if(xt<Ct?(ct.index=xt,ut.index=Ct):(ct.index=Ct,ut.index=xt),void 0!==wt[Ct])F.bondStore.bondOrder[wt[Ct]]+=1;else{var At=ct.index+"|"+ut.index;void 0===Q[At]&&(Q[At]=!0,wt[Ct]=F.bondStore.count,F.bondStore.addBond(ct,ut,1))}}}else if("HELIX "===l){_=u[19].trim(),w=parseInt(u.substr(21,4)),S=u[25].trim(),C=u[31].trim(),A=parseInt(u.substr(33,4)),E=u[37].trim();var Et=parseInt(u.substr(39,1));Et=(Iy[Et]||Iy[""]).charCodeAt(0),it.push([_,w,S,C,A,E,Et])}else if("SHEET "===l)_=u[21].trim(),w=parseInt(u.substr(22,4)),S=u[26].trim(),C=u[32].trim(),A=parseInt(u.substr(33,4)),E=u[37].trim(),ot.push([_,w,S,C,A,E]);else if("HETNAM"===l)nt[u.substr(11,3)]=u.substr(15).trim();else if("COMPND"===l){var Mt=u.substr(10,70).trim(),Tt=Mt.indexOf(":"),Pt=Mt.substring(0,Tt),It=void 0;tt.includes(Pt)?(T=Pt,It=Mt.substring(Tt+2)):It=Mt,It=It.replace(/;$/,""),"MOL_ID"===T?(M={chainList:[],name:""},J.push(M)):"MOLECULE"===T?(M.name&&(M.name+=" "),M.name+=It):"CHAIN"===T&&Array.prototype.push.apply(M.chainList,It.split(/\s*,\s*/))}else if(u.startsWith("TER")){var Rt=F.getChainProxy(F.chainStore.count-1);et[Rt.chainname]=Rt.index,I=(P+=1).toString(),R=!0}else if("REMARK"===l&&"350"===u.substr(7,3)){if("BIOMOLECULE:"===u.substr(11,12)){var Ot=u.substr(23).trim();/^(0|[1-9][0-9]*)$/.test(Ot)&&(Ot="BU"+Ot),a=new Ef(Ot),Y[Ot]=a}else if("BIOMT"===u.substr(13,5)){var Lt=u.split(/\s+/),kt=parseInt(u[18])-1;0===kt&&(c=new De,s.matrixList.push(c));var Nt=c.elements;Nt[0+kt]=parseFloat(Lt[4]),Nt[4+kt]=parseFloat(Lt[5]),Nt[8+kt]=parseFloat(Lt[6]),Nt[12+kt]=parseFloat(Lt[7])}else if("APPLY THE FOLLOWING TO CHAINS:"===u.substr(11,30)||"                   AND CHAINS:"===u.substr(11,30)){"APPLY"===u.substr(11,5)&&(s=a.addPart());for(var Dt=u.substr(41,30).split(","),zt=0,Ft=Dt.length;zt<Ft;++zt){var Bt=Dt[zt].trim();Bt&&s.chainList.push(Bt)}}}else if("HEADER"===l)F.id=u.substr(62,4);else if("TITLE "===l)F.title+=(F.title?" ":"")+u.substr(10,70).trim();else if("MODEL "===l)pt=!0;else if("ENDMDL"===l||u.startsWith("END")){if(pt)continue;H&&!X&&(W.push(new Float32Array(i)),X=!0),ht+=1,pt=!0}else if("MTRIX"===u.substr(0,5)){if("1"===u[59])continue;var Ut=u.split(/\s+/),jt=Ut[1].trim();"1"===u[5]&&"1"===jt&&(a=new Ef("NCS"),Y.NCS=a,s=a.addPart());var Gt=parseInt(u[5])-1;0===Gt&&(c=new De,s.matrixList.push(c));var Vt=c.elements;Vt[0+Gt]=parseFloat(Ut[2]),Vt[4+Gt]=parseFloat(Ut[3]),Vt[8+Gt]=parseFloat(Ut[4]),Vt[12+Gt]=parseFloat(Ut[5])}else if("ORIGX"===u.substr(0,5)){Z.origx||(Z.origx=new De);var Ht=u.split(/\s+/),$t=parseInt(u[5])-1,Wt=Z.origx.elements;Wt[0+$t]=parseFloat(Ht[1]),Wt[4+$t]=parseFloat(Ht[2]),Wt[8+$t]=parseFloat(Ht[3]),Wt[12+$t]=parseFloat(Ht[4])}else if("SCALE"===u.substr(0,5)){Z.scale||(Z.scale=new De);var qt=u.split(/\s+/),Xt=parseInt(u[5])-1,Yt=Z.scale.elements;Yt[0+Xt]=parseFloat(qt[1]),Yt[4+Xt]=parseFloat(qt[2]),Yt[8+Xt]=parseFloat(qt[3]),Yt[12+Xt]=parseFloat(qt[4])}else if("CRYST1"===l){var Kt=parseFloat(u.substr(6,9)),Zt=parseFloat(u.substr(15,9)),Qt=parseFloat(u.substr(24,9)),Jt=parseFloat(u.substr(33,7)),te=parseFloat(u.substr(40,7)),ee=parseFloat(u.substr(47,7)),ne=u.substr(55,11).trim(),re=new Float32Array(9);re[0]=Kt,re[4]=Zt,re[8]=Qt,q.push(re),0===ht&&(Z.a=Kt,Z.b=Zt,Z.c=Qt,Z.alpha=Jt,Z.beta=te,Z.gamma=ee,Z.spacegroup=ne)}}(0,e.length,e)});var dt=J.length;if(J.length){F.eachChain(function(t){t.entityIndex=dt}),J.forEach(function(t,e){var n=t.chainList.map(function(t){return et[t]});F.entityList.push(new My(F,e,t.name,"polymer",n))});var ft=J.length,mt=F.getResidueProxy(),gt={};F.eachChain(function(t){t.entityIndex===dt&&(mt.index=t.residueOffset,gt[mt.resname]||(gt[mt.resname]=[]),gt[mt.resname].push(t.index))}),Object.keys(gt).forEach(function(t){var e=gt[t],n="non-polymer",r=nt[t]||t;vd.includes(t)&&(r="water",n="water"),F.entityList.push(new My(F,ft,r,n,e)),ft+=1})}void 0!==Z.a?F.unitcell=new Py(Z):F.unitcell=void 0,(it.length||ot.length)&&If(F,rt),B.finalize(),F.finalizeAtoms(),t||Nf(F),Df(F),F.finalizeBonds(),it.length||ot.length||kf(F),Bf(F),nl&&el.timeEnd("PdbParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Ey);cl.add("pdb",Ry),cl.add("pdb1",Ry),cl.add("ent",Ry);var Oy=/\s+/,Ly=/'((?:(?!'\s).)*)'|"((?:(?!"\s).)*)"|(\S+)/g,ky=/"/g,Ny=/^['"]+|['"]+$/g;function Dy(t){return!t||t[0]!==t[t.length-1]||"'"!==t[0]&&'"'!==t[0]?t:t.substring(1,t.length-1)}function zy(t,e){Array.isArray(t[e])||Object.keys(t).forEach(function(e){t[e]=[t[e]]})}function Fy(t){return"?"!==t}function By(t,e){return Fy(t)?t:e}function Uy(t){switch(t.toLowerCase()){case"?":case"sing":return 1;case"doub":return 2;case"trip":return 3;case"quad":return 4}return 0}var jy=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"cif"},e.prototype._parse=function(){el.time("CifParser._parse "+this.name);var t,e,n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_=this.structure,w=this.structureBuilder,S=this.firstModelOnly,C=this.asTrajectory,A=this.cAlphaOnly,E=_.frames,M={},T={},P={},I=!1,R=null,O=!1,L=!1,k=!1,N=[],D=null,z=null,F=null,B=null,U=[],j=_.atomMap,G=_.atomStore;G.resize(this.streamer.data.length/100);var V,H=0,$=0;if(this.streamer.eachChunkOfLines(function(W){!function(W,q,X){for(var Y=W;Y<q;++Y)if(n=X[Y],((r=n.trim())||I||L)&&"#"!==r[0])if("data_"===r.substring(0,5))M.data=r.substring(5).trim();else if(";"===r[0])I?(L?(D===N.length&&(D=0),N[D].push(R),D+=1):!1===F?M[z]=R:M[z][F]=R,I=!1,R=null):(I=!0,R=r.substring(1));else if("loop_"===r)L=!0,k=!0,N.length=0,U.length=0,D=0;else if("_"===r[0]){var K,Z,Q;if(L&&!k&&(L=!1),L)Z=(K=r.split("."))[0].substring(1),Q=K[1],1===K.length?(Q=!1,M[Z]||(M[Z]=[]),N.push(M[Z])):(M[Z]||(M[Z]={}),M[Z][Q]?nl&&el.warn(Z,Q,"already exists"):(M[Z][Q]=[],N.push(M[Z][Q]),U.push(Q))),z=Z,F=Q,B=!0;else{var J=r.match(Ly),tt=J[0],et=J[1];Z=(K=tt.split("."))[0].substring(1),Q=K[1],1===K.length?(Q=!1,M[Z]=et):(M[Z]||(M[Z]={}),M[Z][Q]?nl&&el.warn(Z,Q,"already exists"):M[Z][Q]=et),et||(O=!0),z=Z,F=Q}}else if(I)R+=n;else if(L){if(!r)continue;if("atom_site"===z){var nt=r.split(Oy);B&&(i=U.indexOf("auth_asym_id"),o=U.indexOf("auth_seq_id"),a=U.indexOf("label_atom_id"),s=U.indexOf("label_comp_id"),c=U.indexOf("label_asym_id"),u=U.indexOf("label_entity_id"),l=U.indexOf("label_alt_id"),g=U.indexOf("Cartn_x"),v=U.indexOf("Cartn_y"),y=U.indexOf("Cartn_z"),p=U.indexOf("id"),d=U.indexOf("type_symbol"),h=U.indexOf("group_PDB"),b=U.indexOf("B_iso_or_equiv"),f=U.indexOf("pdbx_PDB_model_num"),m=U.indexOf("pdbx_PDB_ins_code"),x=U.indexOf("occupancy"),B=!1,V=parseInt(nt[f]),C&&(t=[],e=0));var rt=parseInt(nt[f]);if(V!==rt&&(C&&(0===$&&E.push(new Float32Array(t)),t=new Float32Array(3*G.count),E.push(t),e=0),$+=1),V=rt,S&&$>0)continue;var it=nt[a].replace(ky,"");if(A&&"CA"!==it)continue;var ot=parseFloat(nt[g]),at=parseFloat(nt[v]),st=parseFloat(nt[y]);if(C){var ct=3*e;if(t[ct+0]=ot,t[ct+1]=at,t[ct+2]=st,e+=1,$>0)continue}var ut=nt[s],lt=parseInt(nt[o]),ht=nt[m];ht="?"===ht?"":ht;var pt=nt[i],dt=nt[c],ft="H"===nt[h][0]?1:0,mt=nt[d],gt=parseFloat(nt[b]),vt=parseFloat(nt[x]),yt=nt[l];if(yt="."===yt?"":yt,G.growIfFull(),G.atomTypeId[H]=j.add(it,mt),G.x[H]=ot,G.y[H]=at,G.z[H]=st,G.serial[H]=parseInt(nt[p]),G.bfactor[H]=isNaN(gt)?0:gt,G.occupancy[H]=isNaN(vt)?0:vt,G.altloc[H]=yt.charCodeAt(0),w.addAtom($,pt,dt,ut,lt,ft,void 0,ht),nl){var bt=T[dt];void 0!==bt&&bt!==pt&&nl&&el.warn(bt,pt)}T[dt]=pt;var xt=nt[u];P[xt]||(P[xt]=new Set),P[xt].add(_.chainStore.count-1),H+=1}else{var _t=r.match(Ly),wt=_t.length;D===N.length&&(D=0);for(var St=0;St<wt;++St)N[D+St].push(_t[St]);D+=wt}k=!1}else if("'"===r[0]&&"'"===r[r.length-1]){var Ct=r.substring(1,r.length-1);!1===F?M[z]=Ct:M[z][F]=Ct}else O?!1===F?M[z]=r:M[z][F]=r:nl&&el.log("CifParser._parse: unknown state",r);else I=!1,L=!1,O=!1,N.length=0,D=null,z=null,F=null,B=null,U.length=0}(0,W.length,W)}),M.chem_comp&&M.chem_comp_atom)!function(t,e,n){var r,i,o=e.atomStore,a=e.atomMap,s=t.chem_comp,c=t.chem_comp_atom,u=t.chem_comp_bond;s&&(s.name&&(e.title=s.name.trim().replace(Ny,"")),s.id&&(e.id=s.id.trim().replace(Ny,"")));var l={};if(c){var h,p,d,f;for(i=c.comp_id.length,r=0;r<i;++r)o.growIfFull(),h=c.atom_id[r].replace(ky,""),p=c.type_symbol[r],l[h]=r,o.atomTypeId[r]=a.add(h,p),o.x[r]=c.model_Cartn_x[r],o.y[r]=c.model_Cartn_y[r],o.z[r]=c.model_Cartn_z[r],o.serial[r]=r,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,n.addAtom(0,"","",d,f,1);for(r=0;r<i;++r){var m=r+i;o.growIfFull(),h=c.atom_id[r].replace(ky,""),p=c.type_symbol[r],o.atomTypeId[m]=a.add(h,p),o.x[m]=c.pdbx_model_Cartn_x_ideal[r],o.y[m]=c.pdbx_model_Cartn_y_ideal[r],o.z[m]=c.pdbx_model_Cartn_z_ideal[r],o.serial[m]=m,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,n.addAtom(1,"","",d,f,1)}}if(c&&u){var g,v,y;i=u.comp_id.length;var b=c.comp_id.length,x=e.getAtomProxy(),_=e.getAtomProxy();for(r=0;r<i;++r)g=u.atom_id_1[r].replace(ky,""),v=u.atom_id_2[r].replace(ky,""),y=Uy(u.value_order[r]),x.index=l[g],_.index=l[v],e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y),x.index+=b,_.index+=b,e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y)}}(M,_,w),w.finalize(),_.finalizeAtoms(),_.finalizeBonds(),Vf(_);else if(M.atom_site_type_symbol&&M.atom_site_label&&M.atom_site_fract_x)!function(t,e,n){var r=e.atomStore,i=e.atomMap;t.data&&(e.id=t.data,e.name=t.data),e.unitcell=new Py({a:parseFloat(t.cell_length_a),b:parseFloat(t.cell_length_b),c:parseFloat(t.cell_length_c),alpha:parseFloat(t.cell_angle_alpha),beta:parseFloat(t.cell_angle_beta),gamma:parseFloat(t.cell_angle_gamma),spacegroup:Dy(t.symmetry_space_group_name_H)});for(var o=new Ne,a=new Ne,s=t.atom_site_type_symbol.length,c=0;c<s;++c){r.growIfFull();var u=t.atom_site_label[c],l=t.atom_site_type_symbol[c];r.atomTypeId[c]=i.add(u,l),o.set(t.atom_site_fract_x[c],t.atom_site_fract_y[c],t.atom_site_fract_z[c]),o.applyMatrix4(e.unitcell.fracToCart),a.add(o),r.x[c]=o.x,r.y[c]=o.y,r.z[c]=o.z,t.atom_site_occupancy&&(r.occupancy[c]=parseFloat(t.atom_site_occupancy[c])),r.serial[c]=c,n.addAtom(0,"","","HET",1,1)}a.divideScalar(s),e.center=a,Bf(e);var h=new Ne,p=new Ne,d=e.biomolDict.SUPERCELL.partList[0].matrixList,f=s;function m(t){return i.get(r.atomTypeId[t]).covalent}for(var g=new De,v=function(t){var e=m(t);o.set(r.x[t],r.y[t],r.z[t]),d.forEach(function(i){if(!g.equals(i)){h.copy(o),h.applyMatrix4(i);for(var a=0;a<s;++a){p.set(r.x[a],r.y[a],r.z[a]);var c=h.distanceToSquared(p),u=m(a)+e,l=u+.3,d=u-.5;if(c<l*l&&c>d*d)return r.growIfFull(),r.atomTypeId[f]=r.atomTypeId[t],r.x[f]=h.x,r.y[f]=h.y,r.z[f]=h.z,r.occupancy[f]=r.occupancy[t],r.serial[f]=f,r.altloc[f]="A".charCodeAt(0),n.addAtom(0,"","","HET",1,1),void(f+=1)}}})},y=0;y<s;++y)v(y)}(M,_,w),w.finalize(),_.finalizeAtoms(),Df(_),_.finalizeBonds();else{var W=function(t,e,n){var r,i,o,a,s=[],c=[],u=t.struct_conf;if(u)for(zy(u,"id"),r=0,i=u.beg_auth_seq_id.length;r<i;++r){var l=parseInt(u.pdbx_PDB_helix_class[r]);Number.isNaN(l)||(o=u.pdbx_beg_PDB_ins_code[r],a=u.pdbx_end_PDB_ins_code[r],s.push([n[u.beg_label_asym_id[r]],parseInt(u.beg_auth_seq_id[r]),By(o,""),n[u.end_label_asym_id[r]],parseInt(u.end_auth_seq_id[r]),By(a,""),(Iy[l]||Iy[""]).charCodeAt(0)]))}var h=t.struct_sheet_range;if(h)for(zy(h,"id"),r=0,i=h.beg_auth_seq_id.length;r<i;++r)o=h.pdbx_beg_PDB_ins_code[r],a=h.pdbx_end_PDB_ins_code[r],c.push([n[h.beg_label_asym_id[r]],parseInt(h.beg_auth_seq_id[r]),By(o,""),n[h.end_label_asym_id[r]],parseInt(h.end_auth_seq_id[r]),By(a,"")]);return!(!u&&!h)&&{helices:s,sheets:c}}(M,0,T);if(function(t,e,n){var r={},i=e.biomolDict;if(t.pdbx_struct_oper_list){var o=t.pdbx_struct_oper_list;zy(o,"id"),o.id.forEach(function(t,e){var n=new De,i=n.elements;i[0]=parseFloat(o["matrix[1][1]"][e]),i[1]=parseFloat(o["matrix[1][2]"][e]),i[2]=parseFloat(o["matrix[1][3]"][e]),i[4]=parseFloat(o["matrix[2][1]"][e]),i[5]=parseFloat(o["matrix[2][2]"][e]),i[6]=parseFloat(o["matrix[2][3]"][e]),i[8]=parseFloat(o["matrix[3][1]"][e]),i[9]=parseFloat(o["matrix[3][2]"][e]),i[10]=parseFloat(o["matrix[3][3]"][e]),i[3]=parseFloat(o["vector[1]"][e]),i[7]=parseFloat(o["vector[2]"][e]),i[11]=parseFloat(o["vector[3]"][e]),n.transpose(),r[t]=n})}if(t.pdbx_struct_assembly_gen){var a=t.pdbx_struct_assembly_gen;zy(a,"assembly_id");var s=function(t){var e={};return t.replace(/[()']/g,"").split(",").forEach(function(t){if(t.includes("-"))for(var n=t.split("-"),i=parseInt(n[0]),o=parseInt(n[1]);i<=o;++i)e[i]=r[i];else e[t]=r[t]}),e};a.assembly_id.forEach(function(t,e){var r={},o=a.oper_expression[e].replace(/['"]\(|['"]/g,"");if(o.includes(")(")||o.indexOf("(")>0){o=o.split("(");var c=s(o[0]),u=s(o[1]);Object.keys(c).forEach(function(t){Object.keys(u).forEach(function(e){var n=new De;n.multiplyMatrices(c[t],u[e]),r[t+"x"+e]=n})})}else r=s(o);var l=[];for(var h in r)l.push(r[h]);var p=t;/^(0|[1-9][0-9]*)$/.test(p)&&(p="BU"+p);for(var d=a.asym_id_list[e].split(","),f=0,m=d.length;f<m;++f)d[f]=n[d[f]];void 0===i[p]&&(i[p]=new Ef(p)),i[p].addPart(l,d)})}if(t.struct_ncs_oper){var c=t.struct_ncs_oper;zy(c,"id"),i.NCS=new Ef("NCS");var u=i.NCS.addPart();c.id.forEach(function(t,e){if("given"!==c.code[e]){var n=new De,r=n.elements;r[0]=parseFloat(c["matrix[1][1]"][e]),r[1]=parseFloat(c["matrix[1][2]"][e]),r[2]=parseFloat(c["matrix[1][3]"][e]),r[4]=parseFloat(c["matrix[2][1]"][e]),r[5]=parseFloat(c["matrix[2][2]"][e]),r[6]=parseFloat(c["matrix[2][3]"][e]),r[8]=parseFloat(c["matrix[3][1]"][e]),r[9]=parseFloat(c["matrix[3][2]"][e]),r[10]=parseFloat(c["matrix[3][3]"][e]),r[3]=parseFloat(c["vector[1]"][e]),r[7]=parseFloat(c["vector[2]"][e]),r[11]=parseFloat(c["vector[3]"][e]),n.transpose(),u.matrixList.push(n)}}),0===u.matrixList.length&&delete i.NCS}var l={};if(t.cell){var h=t.cell,p=parseFloat(h.length_a),d=parseFloat(h.length_b),f=parseFloat(h.length_c),m=new Float32Array(9);m[0]=p,m[4]=d,m[8]=f,e.boxes.push(m),l.a=p,l.b=d,l.c=f,l.alpha=parseFloat(h.angle_alpha),l.beta=parseFloat(h.angle_beta),l.gamma=parseFloat(h.angle_gamma)}t.symmetry&&(l.spacegroup=Dy(t.symmetry["space_group_name_H-M"]));var g=new De;if(t.database_PDB_matrix){var v=t.database_PDB_matrix,y=g.elements;y[0]=parseFloat(v["origx[1][1]"]),y[1]=parseFloat(v["origx[1][2]"]),y[2]=parseFloat(v["origx[1][3]"]),y[4]=parseFloat(v["origx[2][1]"]),y[5]=parseFloat(v["origx[2][2]"]),y[6]=parseFloat(v["origx[2][3]"]),y[8]=parseFloat(v["origx[3][1]"]),y[9]=parseFloat(v["origx[3][2]"]),y[10]=parseFloat(v["origx[3][3]"]),y[3]=parseFloat(v["origx_vector[1]"]),y[7]=parseFloat(v["origx_vector[2]"]),y[11]=parseFloat(v["origx_vector[3]"]),g.transpose(),l.origx=g}var b=new De;if(t.atom_sites){var x=t.atom_sites,_=b.elements;_[0]=parseFloat(x["fract_transf_matrix[1][1]"]),_[1]=parseFloat(x["fract_transf_matrix[1][2]"]),_[2]=parseFloat(x["fract_transf_matrix[1][3]"]),_[4]=parseFloat(x["fract_transf_matrix[2][1]"]),_[5]=parseFloat(x["fract_transf_matrix[2][2]"]),_[6]=parseFloat(x["fract_transf_matrix[2][3]"]),_[8]=parseFloat(x["fract_transf_matrix[3][1]"]),_[9]=parseFloat(x["fract_transf_matrix[3][2]"]),_[10]=parseFloat(x["fract_transf_matrix[3][3]"]),_[3]=parseFloat(x["fract_transf_vector[1]"]),_[7]=parseFloat(x["fract_transf_vector[2]"]),_[11]=parseFloat(x["fract_transf_vector[3]"]),b.transpose(),l.scale=b}void 0!==l.a?e.unitcell=new Py(l):e.unitcell=void 0}(M,_,T),function(t,e,n){var r=t.struct_conn;if(r){zy(r,"id");for(var i=/"/g,o=e.getAtomProxy(),a=e.getAtomProxy(),s={},c=0,u=r.id.length;c<u;++c){var l=r.conn_type_id[c];if("hydrog"!==l&&"mismat"!==l&&"saltbr"!==l&&"1_555"===r.ptnr1_symmetry[c]&&"1_555"===r.ptnr2_symmetry[c]){var h=r.pdbx_ptnr1_PDB_ins_code[c],p=r.pdbx_ptnr1_label_alt_id[c],d=r.ptnr1_auth_seq_id[c]+(Fy(h)?"^"+h:"")+":"+n[r.ptnr1_label_asym_id[c]]+"."+r.ptnr1_label_atom_id[c].replace(i,"")+(Fy(p)?"%"+p:""),f=s[d];if(!f){var m=new Hu(d);if(m.selection.error){nl&&el.warn("invalid selection for connection",d);continue}f=e.getAtomIndices(m),s[d]=f}var g=r.pdbx_ptnr2_PDB_ins_code[c],v=r.pdbx_ptnr2_label_alt_id[c],y=r.ptnr2_auth_seq_id[c]+(Fy(g)?"^"+g:"")+":"+n[r.ptnr2_label_asym_id[c]]+"."+r.ptnr2_label_atom_id[c].replace(i,"")+(Fy(v)?"%"+v:""),b=s[y];if(!b){var x=new Hu(y);if(x.selection.error){nl&&el.warn("invalid selection for connection",y);continue}b=e.getAtomIndices(x),s[y]=b}var _=f.length,w=b.length;if(_>w){var S=_;_=w,w=S;var C=f;f=b,b=C}if(0!==_&&0!==w)for(var A=0;A<w;++A)o.index=f[A%_],a.index=b[A],o&&a?e.bondStore.addBond(o,a,Uy(r.pdbx_value_order[c])):el.log("atoms for connection not found");else nl&&el.warn("no atoms found for",d,y)}}}}(M,_,T),function(t,e,n){if(t.entity){zy(t.entity,"id");for(var r=t.entity,i=r.id.length,o=0;o<i;++o){var a=r.pdbx_description[o],s=r.type[o],c=Array.from(n[r.id[o]]);e.entityList[o]=new My(e,o,a,s,c)}}}(M,_,P),M.struct&&M.struct.title&&(_.title=M.struct.title.trim().replace(Ny,"")),M.entry&&M.entry.id&&(_.id=M.entry.id.trim().replace(Ny,"")),M.database_PDB_rev){if(M.database_PDB_rev.date){zy(M.database_PDB_rev,"date");var q=M.database_PDB_rev.date.filter(Fy);q.length&&(_.header.releaseDate=q[q.length-1])}if(M.database_PDB_rev.date_original){zy(M.database_PDB_rev,"date_original");var X=M.database_PDB_rev.date_original.filter(Fy);X.length&&(_.header.depositionDate=X[X.length-1])}}M.reflns&&M.reflns.d_resolution_high?Fy(M.reflns.d_resolution_high)&&(_.header.resolution=parseFloat(M.reflns.d_resolution_high)):M.refine&&M.refine.ls_d_res_high&&Fy(M.refine.ls_d_res_high)&&(_.header.resolution=parseFloat(M.refine.ls_d_res_high)),M.refine&&M.refine.ls_R_factor_R_free&&Fy(M.refine.ls_R_factor_R_free)&&(_.header.rFree=parseFloat(M.refine.ls_R_factor_R_free)),M.refine&&M.refine.ls_R_factor_R_work&&Fy(M.refine.ls_R_factor_R_work)&&(_.header.rWork=parseFloat(M.refine.ls_R_factor_R_work)),M.exptl&&M.exptl.method&&(zy(M.exptl,"method"),_.header.experimentalMethods=M.exptl.method.map(function(t){return t.replace(Ny,"")})),w.finalize(),_.finalizeAtoms(),Df(_),_.finalizeBonds(),W?If(_,W):kf(_),Bf(_),_.extraData.cif=M}nl&&el.timeEnd("CifParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Ey);cl.add("cif",jy),cl.add("mcif",jy),cl.add("mmcif",jy);var Gy=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"gro"},e.prototype._parse=function(){nl&&el.time("GroParser._parse "+this.name);var t,e,n=this.structure,r=this.structureBuilder,i=this.firstModelOnly,o=this.asTrajectory,a=this.cAlphaOnly,s=n.frames,c=n.boxes,u=this.streamer.peekLines(3);n.title=u[0].trim();var l,h,p,d,f=5+(u[2].length-u[2].lastIndexOf(".")-1),m=20,g=20+f,v=20+2*f,y=parseInt(u[1]),b=y+3,x=n.atomMap,_=n.atomStore;_.resize(y);var w=0,S=0,C=0;this.streamer.eachChunkOfLines(function(n){!function(n,u,A){for(var E=n;E<u;++E){var M=++C-1,T=A[E];if(T)if(M%b==0)o&&(t=new Float32Array(3*y),s.push(t),e=0);else if(M%b==1);else if(M%b==b-1){var P=T.trim().split(/\s+/),I=new Float32Array(9);if(I[0]=10*parseFloat(P[0]),I[4]=10*parseFloat(P[1]),I[8]=10*parseFloat(P[2]),c.push(I),i)return!0;S+=1}else{if(l=T.substr(10,5).trim(),a&&"CA"!==l)continue;var R=10*parseFloat(T.substr(m,f)),O=10*parseFloat(T.substr(g,f)),L=10*parseFloat(T.substr(v,f));if(o){var k=3*e;if(t[k+0]=R,t[k+1]=O,t[k+2]=L,e+=1,M>b)continue}h=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),d=parseInt(T.substr(15,5)),_.growIfFull(),_.atomTypeId[w]=x.add(l),_.x[w]=R,_.y[w]=O,_.z[w]=L,_.serial[w]=d,r.addAtom(S,"","",h,p,0,"l"),w+=1}}}(0,n.length,n)}),r.finalize(),n.finalizeAtoms(),Nf(n),Df(n),n.finalizeBonds(),kf(n),nl&&el.timeEnd("GroParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Ey);cl.add("gro",Gy);var Vy=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"].concat(["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"]);function Hy(t,e,n){return e?new t(e.buffer,e.byteOffset,e.byteLength/(n||1)):void 0}function $y(t){return Hy(DataView,t)}function Wy(t){return Hy(Int8Array,t)}function qy(t){return Hy(Int32Array,t,4)}function Xy(t,e){var n=t.length/2;e||(e=new Int16Array(n));for(var r=0,i=0;r<n;++r,i+=2)e[r]=t[i]<<8^t[i+1]<<0;return e}function Yy(t,e){var n=t.length/4;e||(e=new Int32Array(n));for(var r=0,i=0;r<n;++r,i+=4)e[r]=t[i]<<24^t[i+1]<<16^t[i+2]<<8^t[i+3]<<0;return e}function Ky(t,e,n){var r=t.length,i=1/e;n||(n=new Float32Array(r));for(var o=0;o<r;++o)n[o]=t[o]*i;return n}function Zy(t,e){var n,r;if(!e){var i=0;for(n=0,r=t.length;n<r;n+=2)i+=t[n+1];e=new t.constructor(i)}var o=0;for(n=0,r=t.length;n<r;n+=2)for(var a=t[n],s=t[n+1],c=0;c<s;++c)e[o]=a,++o;return e}function Qy(t,e){var n=t.length;e||(e=new t.constructor(n)),n&&(e[0]=t[0]);for(var r=1;r<n;++r)e[r]=t[r]+e[r-1];return e}function Jy(t,e){var n,r,i=t instanceof Int8Array?127:32767,o=-i-1,a=t.length;if(!e){var s=0;for(n=0;n<a;++n)t[n]<i&&t[n]>o&&++s;e=new Int32Array(s)}for(n=0,r=0;n<a;){for(var c=0;t[n]===i||t[n]===o;)c+=t[n],++n;c+=t[n],++n,e[r]=c,++r}return e}function tb(t,e,n){return Ky(Jy(t,qy(n)),e,n)}function eb(t,e,n){var r=Jy(t,qy(n));return function(t,e,n){return Ky(Qy(t,qy(n)),e,n)}(r,e,Hy(Float32Array,r,4))}function nb(t,e,n,r){switch(t){case 1:return function(t,e){var n=t.length;e||(e=new Float32Array(n/4));for(var r=$y(e),i=$y(t),o=0,a=0,s=n/4;o<s;++o,a+=4)r.setFloat32(a,i.getFloat32(a),!0);return e}(e);case 2:return Wy(e);case 3:return Xy(e);case 4:return Yy(e);case 5:return Hy(Uint8Array,e);case 6:return Zy(Yy(e),new Uint8Array(n));case 7:return Zy(Yy(e));case 8:return Qy(Zy(Yy(e)),i);case 9:return function(t,e,n){return Ky(Zy(t,qy(n)),e,n)}(Yy(e),Yy(r)[0]);case 10:return eb(Xy(e),Yy(r)[0]);case 11:return Ky(Xy(e),Yy(r)[0]);case 12:return tb(Xy(e),Yy(r)[0]);case 13:return tb(Wy(e),Yy(r)[0]);case 14:return Jy(Xy(e));case 15:return Jy(Wy(e))}var i}function rb(t,e){var n=(e=e||{}).ignoreFields,r={};return Vy.forEach(function(e){var i,o,a,s,c,u=!!n&&-1!==n.indexOf(e),l=t[e];u||void 0===l||(l instanceof Uint8Array?r[e]=nb.apply(null,(o=$y(i=l),a=o.getInt32(0),s=o.getInt32(4),c=i.subarray(8,12),[a,i=i.subarray(12),s,c])):r[e]=l)}),r}var ib={0:"i".charCodeAt(0),1:"s".charCodeAt(0),2:"h".charCodeAt(0),3:"e".charCodeAt(0),4:"g".charCodeAt(0),5:"b".charCodeAt(0),6:"t".charCodeAt(0),7:"l".charCodeAt(0),"-1":"".charCodeAt(0)},ob=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"mmtf"},e.prototype._parse=function(){var t,e,n,r,i;nl&&el.time("MmtfParser._parse "+this.name);var o,a,s,c,u,l,h=this.structure,p=rb(function(t){var e=0,n=new DataView(t.buffer);function r(t){for(var e={},n=0;n<t;n++)e[s()]=s();return e}function i(n){var r=t.subarray(e,e+n);return e+=n,r}function o(n){var r=t.subarray(e,e+n);if(e+=n,n>65535){for(var i=[],o=0;o<r.length;o+=65535)i.push(String.fromCharCode.apply(null,r.subarray(o,o+65535)));return i.join("")}return String.fromCharCode.apply(null,r)}function a(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=s();return e}function s(){var s,c,u=t[e];if(0==(128&u))return e++,u;if(128==(240&u))return e++,r(c=15&u);if(144==(240&u))return e++,a(c=15&u);if(160==(224&u))return e++,o(c=31&u);if(224==(224&u))return s=n.getInt8(e),e++,s;switch(u){case 192:return e++,null;case 194:return e++,!1;case 195:return e++,!0;case 196:return c=n.getUint8(e+1),e+=2,i(c);case 197:return c=n.getUint16(e+1),e+=3,i(c);case 198:return c=n.getUint32(e+1),e+=5,i(c);case 202:return s=n.getFloat32(e+1),e+=5,s;case 203:return s=n.getFloat64(e+1),e+=9,s;case 204:return s=t[e+1],e+=2,s;case 205:return s=n.getUint16(e+1),e+=3,s;case 206:return s=n.getUint32(e+1),e+=5,s;case 208:return s=n.getInt8(e+1),e+=2,s;case 209:return s=n.getInt16(e+1),e+=3,s;case 210:return s=n.getInt32(e+1),e+=5,s;case 217:return c=n.getUint8(e+1),e+=2,o(c);case 218:return c=n.getUint16(e+1),e+=3,o(c);case 219:return c=n.getUint32(e+1),e+=5,o(c);case 220:return c=n.getUint16(e+1),e+=3,a(c);case 221:return c=n.getUint32(e+1),e+=5,a(c);case 222:return c=n.getUint16(e+1),e+=3,r(c);case 223:return c=n.getUint32(e+1),e+=5,r(c)}throw new Error("Unknown type 0x"+u.toString(16))}return s()}(this.streamer.data));if(["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"].forEach(function(t){void 0!==p[t]&&(h.header[t]=p[t])}),h.id=p.structureId,h.title=p.title,this.firstModelOnly||this.asTrajectory){for(u=1,s=0,t=0,e=c=p.chainsPerModel[0];t<e;++t)s+=p.groupsPerChain[t];for(a=0,t=0,e=s;t<e;++t)a+=(i=p.groupList[p.groupTypeList[t]]).atomNameList.length;o=p.numBonds,l=[c]}else o=p.numBonds,a=p.numAtoms,s=p.numGroups,c=p.numChains,u=p.numModels,l=p.chainsPerModel;if(o+=s,this.asTrajectory)for(t=0,e=p.numModels;t<e;++t){var d=new Float32Array(3*a),f=a*t;for(n=0;n<a;++n){var m=3*n,g=n+f;d[m]=p.xCoordList[g],d[m+1]=p.yCoordList[g],d[m+2]=p.zCoordList[g]}h.frames.push(d)}var v=new Uint32Array(o),y=new Uint32Array(o),b=new Uint8Array(o),x=new Uint32Array(a),_=new Uint32Array(s),w=new Uint32Array(s),S=new Uint16Array(s),C=new Uint16Array(c),A=new Uint32Array(c),E=new Uint32Array(c),M=new Uint32Array(u),T=new Uint32Array(u),P=0;for(t=0,e=u;t<e;++t){var I=l[t];for(M[t]=P,T[t]=I,n=0;n<I;++n)C[n+P]=t;P+=I}var R=p.groupsPerChain,O=0;for(t=0,e=c;t<e;++t){var L=R[t];for(A[t]=O,E[t]=L,n=0;n<L;++n)_[n+O]=t;O+=L}var k=0,N=0;for(t=0,e=s;t<e;++t){var D=(i=p.groupList[p.groupTypeList[t]]).atomNameList.length,z=i.bondAtomList,F=i.bondOrderList;for(n=0,r=F.length;n<r;++n)v[N]=k+z[2*n],y[N]=k+z[2*n+1],b[N]=F[n],N+=1;for(w[t]=k,S[t]=D,n=0;n<D;++n)x[k]=t,k+=1}var B=p.bondAtomList;if(B)for(p.bondOrderList&&b.set(p.bondOrderList,N),t=0,e=B.length;t<e;t+=2){var U=B[t],j=B[t+1];U<a&&j<a&&(v[N]=U,y[N]=j,N+=1)}h.bondStore.length=b.length,h.bondStore.count=N,h.bondStore.atomIndex1=v,h.bondStore.atomIndex2=y,h.bondStore.bondOrder=b,h.atomStore.length=a,h.atomStore.count=a,h.atomStore.residueIndex=x,h.atomStore.atomTypeId=new Uint16Array(a),h.atomStore.x=p.xCoordList.subarray(0,a),h.atomStore.y=p.yCoordList.subarray(0,a),h.atomStore.z=p.zCoordList.subarray(0,a),h.atomStore.serial=p.atomIdList.subarray(0,a),h.atomStore.bfactor=p.bFactorList.subarray(0,a),h.atomStore.altloc=p.altLocList.subarray(0,a),h.atomStore.occupancy=p.occupancyList.subarray(0,a),h.residueStore.length=s,h.residueStore.count=s,h.residueStore.chainIndex=_,h.residueStore.residueTypeId=p.groupTypeList,h.residueStore.atomOffset=w,h.residueStore.atomCount=S,h.residueStore.resno=p.groupIdList.subarray(0,s),h.residueStore.sstruc=p.secStructList.subarray(0,s),h.residueStore.inscode=p.insCodeList.subarray(0,s),h.chainStore.length=c,h.chainStore.count=c,h.chainStore.entityIndex=new Uint16Array(c),h.chainStore.modelIndex=C,h.chainStore.residueOffset=A,h.chainStore.residueCount=E,h.chainStore.chainname=p.chainNameList.subarray(0,4*c),h.chainStore.chainid=p.chainIdList.subarray(0,4*c),h.modelStore.length=u,h.modelStore.count=u,h.modelStore.chainOffset=M,h.modelStore.chainCount=T;var G={};for(t=0,e=p.groupList.length;t<e;++t){var V=p.groupList[t],H=[];for(n=0,r=V.atomNameList.length;n<r;++n){var $=V.elementList[n].toUpperCase(),W=V.atomNameList[n];H.push(h.atomMap.add(W,$))}var q=V.chemCompType.toUpperCase(),X=id.includes(q),Y=V.bondOrderList.length,K=new Array(Y),Z=new Array(Y);for(n=0;n<Y;++n)K[n]=V.bondAtomList[2*n],Z[n]=V.bondAtomList[2*n+1];var Q={atomIndices1:K,atomIndices2:Z,bondOrders:V.bondOrderList};G[t]=h.residueMap.add(V.groupName,H,X,q,Q)}for(t=0,e=s;t<e;++t)h.residueStore.residueTypeId[t]=G[h.residueStore.residueTypeId[t]];for(t=0,e=h.atomStore.count;t<e;++t){var J=h.atomStore.residueIndex[t],tt=h.residueMap.list[h.residueStore.residueTypeId[J]],et=h.residueStore.atomOffset[J];h.atomStore.atomTypeId[t]=tt.atomTypeIdList[t-et]}if(p.secStructList){var nt=p.secStructList.length;for(t=0,e=h.residueStore.count;t<e;++t){var rt=ib[h.residueStore.sstruc[t%nt]];void 0!==rt&&(h.residueStore.sstruc[t]=rt)}}if(p.entityList&&p.entityList.forEach(function(t,e){h.entityList[e]=new My(h,e,t.description,t.type,t.chainIndexList)}),p.bioAssemblyList&&p.bioAssemblyList.forEach(function(t,e){var n=e+1,r=new Ef(n);h.biomolDict["BU"+n]=r;var i={};t.transformList.forEach(function(t){var e=(new De).fromArray(t.matrix).transpose(),n=t.chainIndexList.map(function(t){for(var e="",n=0;n<4;++n){var r=p.chainNameList[4*t+n];if(!r)break;e+=String.fromCharCode(r)}return e}),o=i[n];o?o.matrixList.push(e):i[n]=r.addPart([e],n)})}),p.ncsOperatorList){var it=new Ef("NCS"),ot=it.addPart();p.ncsOperatorList.forEach(function(t){var e=(new De).fromArray(t).transpose();ot.matrixList.push(e)}),ot.matrixList.length>0&&(h.biomolDict.NCS=it)}var at=p.unitCell;at&&Array.isArray(at)&&at[0]?h.unitcell=new Py({a:at[0],b:at[1],c:at[2],alpha:at[3],beta:at[4],gamma:at[5],spacegroup:p.spaceGroup}):h.unitcell=void 0,Ff(h,!0),zf(h,!0),h.finalizeAtoms(),h.finalizeBonds(),Bf(h),nl&&el.timeEnd("MmtfParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Ey);cl.add("mmtf",ob);var ab=/\s+/,sb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"mol2"},e.prototype._parse=function(){nl&&el.time("Mol2Parser._parse "+this.name);var t,e,n=this.structure,r=this.structureBuilder,i=this.firstModelOnly,o=this.asTrajectory,a=n.frames,s=!1,c=n.atomMap,u=n.atomStore;u.resize(Math.round(this.streamer.data.length/60));var l=0,h=0,p=0,d=-1,f=0,m=0,g=1,v=2,y=3,b=n.getAtomProxy(),x=n.getAtomProxy(),_={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines(function(w){!function(w,S,C){for(var A,E=w;E<S;++E){var M=C[E].trim();if(""!==M&&"#"!==M[0])if("@"===M[0])"@<TRIPOS>MOLECULE"===M?(m=g,h=0,++d):"@<TRIPOS>ATOM"===M?(m=v,p=u.count,o&&(e=0,t=new Float32Array(3*f),a.push(t),d>0&&(s=!0))):m="@<TRIPOS>BOND"===M?y:0;else if(m===g)0===h?(n.title=M,n.id=M):1===h&&(A=M.split(ab),f=parseInt(A[0])),++h;else if(m===v){if(A=M.split(ab),i&&d>0)continue;var T=parseFloat(A[2]),P=parseFloat(A[3]),I=parseFloat(A[4]);if(o){var R=3*e;if(t[R+0]=T,t[R+1]=P,t[R+2]=I,e+=1,s)continue}var O=A[0],L=A[1],k=A[5].split(".")[0],N=A[6]?parseInt(A[6]):1,D=A[7]?A[7]:"",z=A[8]?parseFloat(A[8]):0;u.growIfFull(),u.atomTypeId[l]=c.add(L,k),u.x[l]=T,u.y[l]=P,u.z[l]=I,u.serial[l]=O,u.bfactor[l]=z,r.addAtom(d,"","",D,N,1),l+=1}else if(m===y){if(i&&d>0)continue;if(o&&d>0)continue;A=M.split(ab),b.index=parseInt(A[1])-1+p,x.index=parseInt(A[2])-1+p;var F=_[A[3]];n.bondStore.addBond(b,x,F)}}}(0,w.length,w)}),r.finalize(),n.finalizeAtoms(),Nf(n),zf(n,!0),Ff(n,!0),n.finalizeBonds(),Vf(n),kf(n),nl&&el.timeEnd("Mol2Parser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Ey);cl.add("mol2",sb);var cb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"pqr"},Object.defineProperties(e.prototype,n),e}(Ry);cl.add("pqr",cb);var ub=1,lb=2,hb=3,pb=4,db=5,fb=6,mb=/\s+/,gb=/(^\*|REMARK)*/,vb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"psf"},e.prototype._parse=function(){nl&&el.time("PsfParser._parse "+this.name);var t,e,n,r,i=this.structure,o=this.structureBuilder,a=i.atomMap,s=i.atomStore,c=[],u=0,l=0;this.streamer.eachChunkOfLines(function(i){!function(i,h,p){for(var d=i;d<h;++d){var f=p[d].trim();if(f)if(t===lb){var m=f.split(mb),g=parseInt(m[0]),v=parseInt(m[2]),y=m[3],b=m[4];s.growIfFull(),s.atomTypeId[u]=a.add(b),s.serial[u]=g,o.addAtom(0,"","",y,v,1),u+=1}else if(t===hb)for(var x=f.split(mb),_=0,w=x.length;_<w;_+=2)e[l]=parseInt(x[_])-1,n[l]=parseInt(x[_+1])-1,r[l]=1,l+=1;else if(t===ub)c.push(f.replace(gb,"").trim());else if(t===pb);else if(t===db);else if(t===fb);else if(f.includes("!NATOM")){t=lb;var S=parseInt(f.split(mb)[0]);s.resize(S)}else if(f.includes("!NBOND")){t=hb;var C=parseInt(f.split(mb)[0]);e=new Uint32Array(C),n=new Uint32Array(C),r=new Uint8Array(C)}else f.includes("!NTITLE")?t=ub:f.includes("!NTHETA")?t=pb:f.includes("!NPHI")?t=db:f.includes("!NIMPHI")&&(t=fb);else t=void 0}}(0,i.length,i)}),i.title=c.join(" "),i.bondStore.length=r.length,i.bondStore.count=l,i.bondStore.atomIndex1=e,i.bondStore.atomIndex2=n,i.bondStore.bondOrder=r,o.finalize(),i.finalizeAtoms(),Nf(i),i.finalizeBonds(),Vf(i),nl&&el.timeEnd("PsfParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Ey);cl.add("psf",vb);var yb=/> <(.+)>/,bb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"sdf"},e.prototype._parse=function(){nl&&el.time("SdfParser._parse "+this.name);var t=this.structure,e=this.structureBuilder,n=this.firstModelOnly,r=this.asTrajectory,i=this.streamer.peekLines(2);t.id=i[0].trim(),t.title=i[1].trim();var o,a,s=t.frames,c=!1,u=t.atomMap,l=t.atomStore;l.resize(Math.round(this.streamer.data.length/50));var h,p,d,f,m,g,v,y=t.getAtomProxy(),b=t.getAtomProxy(),x=0,_=0,w=0,S=0,C=[],A=!1,E={};t.extraData.sdf=C,this.streamer.eachChunkOfLines(function(i){!function(i,M,T){for(var P=i;P<M;++P){var I=T[P];if("$$$$"===I.substr(0,4))_=-1,++w,S=l.count,C.push(E),E={},A=!1;else if(3===_)p=parseInt(I.substr(0,3)),d=parseInt(I.substr(3,3)),v=(g=m=(f=4)+p)+d,r&&(a=0,o=new Float32Array(3*p),s.push(o),w>0&&(c=!0));else if(_>=f&&_<m){if(n&&w>0)continue;var R=parseFloat(I.substr(0,10)),O=parseFloat(I.substr(10,10)),L=parseFloat(I.substr(20,10));if(r){var k=3*a;if(o[k+0]=R,o[k+1]=O,o[k+2]=L,a+=1,c)continue}var N=I.substr(31,3).trim(),D=N+(x+1);l.growIfFull(),l.atomTypeId[x]=u.add(D,N),l.x[x]=R,l.y[x]=O,l.z[x]=L,l.serial[x]=x,e.addAtom(w,"","","HET",1,1),x+=1}else if(_>=g&&_<v){if(n&&w>0)continue;if(r&&w>0)continue;y.index=parseInt(I.substr(0,3))-1+S,b.index=parseInt(I.substr(3,3))-1+S;var z=parseInt(I.substr(6,3));t.bondStore.addBond(y,b,z)}else(h=I.match(yb))?(A=h[1],E[A]=[]):!1!==A&&I&&E[A].push(I);++_}}(0,i.length,i)}),e.finalize(),t.finalizeAtoms(),t.finalizeBonds(),Vf(t),nl&&el.timeEnd("SdfParser._parse "+this.name)},e.prototype._postProcess=function(){Vf(this.structure)},Object.defineProperties(e.prototype,n),e}(Ey);cl.add("sdf",bb),cl.add("sd",bb);var xb=function(t,e){this.name=t,this.path=e,this.coordinates=[],this.boxes=[]},_b={type:{}};_b.type.get=function(){return"Frames"},Object.defineProperties(xb.prototype,_b);var wb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"dcd"},e.prototype._parse=function(){nl&&el.time("DcdParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,n,r=new DataView(t),i=this.frames,o=i.coordinates,a=i.boxes,s={},c=0,u=new Int32Array(t,0,23),l=u[0]!==r.getInt32(0);if(84!==u[0])for(n=t.byteLength,e=0;e<n;e+=4)r.setFloat32(e,r.getFloat32(e),!0);84!==u[0]&&el.error("dcd bad format, header block start"),"CORD"!==String.fromCharCode(r.getUint8(4),r.getUint8(5),r.getUint8(6),r.getUint8(7))&&el.error("dcd bad format, format string");var h=!1,p=!1,d=!1;0!==u[22]&&(h=!0,0!==u[12]&&(p=!0),1===u[13]&&(d=!0)),s.NSET=u[2],s.ISTART=u[3],s.NSAVC=u[4],s.NAMNF=u[10],s.DELTA=h?r.getFloat32(44,l):r.getFloat64(44,l),84!==u[22]&&el.error("dcd bad format, header block end"),c=c+84+8;var f=r.getInt32(c,l),m=c+1;if((f-4)%80!=0&&el.error("dcd bad format, title block start"),s.TITLE=Cs(new Uint8Array(t,m,f)),r.getInt32(m+f+4-1,l)!==f&&el.error("dcd bad format, title block end"),c=c+f+8,4!==r.getInt32(c,l)&&el.error("dcd bad format, natom block start"),s.NATOM=r.getInt32(c+4,l),4!==r.getInt32(c+8,l)&&el.error("dcd bad format, natom block end"),c=c+4+8,s.NAMNF>0)el.error("dcd format with fixed atoms unsupported, aborting");else{var g=s.NATOM,v=4*g;for(e=0,n=s.NSET;e<n;++e){if(p){c+=4;var y=new Float32Array(9);y[0]=r.getFloat64(c,l),y[4]=r.getFloat64(c+16,l),y[8]=r.getFloat64(c+40,l),a.push(y),c+=48,c+=4}for(var b=new Float32Array(3*g),x=0;x<3;++x){r.getInt32(c,l)!==v&&el.error("dcd bad format, coord block start",e,x),c+=4;for(var _=new Float32Array(t,c,g),w=0;w<g;++w)b[3*w+x]=_[w];c+=v,r.getInt32(c,l)!==v&&el.error("dcd bad format, coord block end",e,x),c+=4}if(o.push(b),d)c+=4+r.getInt32(c,l)+4}nl&&el.timeEnd("DcdParser._parse "+this.name)}},Object.defineProperties(e.prototype,n),e}(function(t){function e(e,n){t.call(this,e,n),this.frames=new xb(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"trajectory"},n.__objName.get=function(){return"frames"},Object.defineProperties(e.prototype,n),e}(Cy));cl.add("dcd",wb);var Sb=function(t){function e(e,n){var r=n||{};t.call(this,e,r),this.volume=new sf(this.name,this.path),this.voxelSize=gs(r.voxelSize,1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"volume"},n.__objName.get=function(){return"volume"},e.prototype._afterParse=function(){this.volume.setMatrix(this.getMatrix())},e.prototype.getMatrix=function(){return new De},Object.defineProperties(e.prototype,n),e}(Cy),Cb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"cube"},e.prototype._parse=function(){nl&&el.time("CubeParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(6),n={},r=/\s+/,i=.529177210859*this.voxelSize;function o(t,n){var i=e[t].trim().split(r)[n];return parseFloat(i)}n.atomCount=Math.abs(o(2,0)),n.originX=.529177210859*o(2,1),n.originY=.529177210859*o(2,2),n.originZ=.529177210859*o(2,3),n.NVX=o(3,0),n.NVY=o(4,0),n.NVZ=o(5,0),n.basisX=new Ne(o(3,1),o(3,2),o(3,3)).multiplyScalar(i),n.basisY=new Ne(o(4,1),o(4,2),o(4,3)).multiplyScalar(i),n.basisZ=new Ne(o(5,1),o(5,2),o(5,3)).multiplyScalar(i);var a=new Float32Array(n.NVX*n.NVY*n.NVZ),s=0,c=0,u=o(2,0)>0?0:1;this.streamer.eachChunkOfLines(function(t){!function(t,e,i){for(var o=t;o<e;++o){var l=i[o].trim();if(""!==l&&c>=n.atomCount+6+u)for(var h=0,p=(l=l.split(r)).length;h<p;++h)1!==l.length&&(a[s]=parseFloat(l[h]),++s);++c}}(0,t.length,t)}),t.header=n,t.setData(a,n.NVZ,n.NVY,n.NVX),nl&&el.timeEnd("CubeParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=new De;return e.multiply((new De).makeTranslation(t.originX,t.originY,t.originZ)),e.multiply((new De).makeBasis(t.basisZ,t.basisY,t.basisX)),e},Object.defineProperties(e.prototype,n),e}(Sb);cl.add("cub",Cb),cl.add("cube",Cb);var Ab=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"dsn6"},e.prototype._parse=function(){nl&&el.time("Dsn6Parser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,n,r=this.volume,i={},o=new Int16Array(t),a=new Uint8Array(t),s=String.fromCharCode.apply(null,a.subarray(0,512));if(s.startsWith(":-)"))i.xStart=parseInt(s.substr(10,5)),i.yStart=parseInt(s.substr(15,5)),i.zStart=parseInt(s.substr(20,5)),i.xExtent=parseInt(s.substr(32,5)),i.yExtent=parseInt(s.substr(38,5)),i.zExtent=parseInt(s.substr(42,5)),i.xRate=parseInt(s.substr(52,5)),i.yRate=parseInt(s.substr(58,5)),i.zRate=parseInt(s.substr(62,5)),i.xlen=parseFloat(s.substr(73,10))*this.voxelSize,i.ylen=parseFloat(s.substr(83,10))*this.voxelSize,i.zlen=parseFloat(s.substr(93,10))*this.voxelSize,i.alpha=parseFloat(s.substr(103,10)),i.beta=parseFloat(s.substr(113,10)),i.gamma=parseFloat(s.substr(123,10)),e=parseFloat(s.substr(138,12))/100,n=parseInt(s.substr(155,8));else{if(100!==o[18])for(var c=0,u=o.length;c<u;++c){var l=o[c];o[c]=(255&l)<<8|l>>8&255}i.xStart=o[0],i.yStart=o[1],i.zStart=o[2],i.xExtent=o[3],i.yExtent=o[4],i.zExtent=o[5],i.xRate=o[6],i.yRate=o[7],i.zRate=o[8];var h=1/o[17],p=h*this.voxelSize;i.xlen=o[9]*p,i.ylen=o[10]*p,i.zlen=o[11]*p,i.alpha=o[12]*h,i.beta=o[13]*h,i.gamma=o[14]*h,e=o[15]/100,n=o[16]}r.header=i,el.log(i,e,n);for(var d=new Float32Array(i.xExtent*i.yExtent*i.zExtent),f=512,m=Math.ceil(i.xExtent/8),g=Math.ceil(i.yExtent/8),v=Math.ceil(i.zExtent/8),y=0;y<v;++y)for(var b=0;b<g;++b)for(var x=0;x<m;++x)for(var _=0;_<8;++_)for(var w=8*y+_,S=0;S<8;++S)for(var C=8*b+S,A=0;A<8;++A){var E=8*x+A;if(!(E<i.xExtent&&C<i.yExtent&&w<i.zExtent)){f+=8-A;break}d[(E*i.yExtent+C)*i.zExtent+w]=(a[f]-n)/e,++f}r.setData(d,i.zExtent,i.yExtent,i.xExtent),nl&&el.timeEnd("Dsn6Parser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],n=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var i=[0,e,n,r],o=[0,t.xRate,t.yRate,t.zRate],a=[0,1,2,3],s=new De;return s.set(i[a[1]][0]/o[a[1]],i[a[2]][0]/o[a[2]],i[a[3]][0]/o[a[3]],0,i[a[1]][1]/o[a[1]],i[a[2]][1]/o[a[2]],i[a[3]][1]/o[a[3]],0,i[a[1]][2]/o[a[1]],i[a[2]][2]/o[a[2]],i[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new De).makeRotationY(Fs(90))),s.multiply((new De).makeTranslation(-t.zStart,t.yStart,t.xStart)),s.multiply((new De).makeScale(-1,1,1)),s},Object.defineProperties(e.prototype,n),e}(Sb);cl.add("dsn6",Ab),cl.add("brix",Ab);var Eb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"dx"},e.prototype._parse=function(){nl&&el.time("DxParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(30),n=this.parseHeaderLines(e),r=this.volume.header,i=n.dataLineStart,o=/\s+/,a=r.nx*r.ny*r.nz,s=new Float32Array(a),c=0,u=0;this.streamer.eachChunkOfLines(function(t){!function(t,e,n){for(var r=t;r<e;++r){if(c<a&&u>i){var l=n[r].trim();if(""!==l)for(var h=l.split(o),p=0,d=h.length;p<d;++p)s[c]=parseFloat(h[p]),++c}++u}}(0,t.length,t)}),t.setData(s,r.nz,r.ny,r.nx),nl&&el.timeEnd("DxParser._parse "+this.name)},e.prototype.parseHeaderLines=function(t){for(var e={},n=/\s+/,r=t.length,i=0,o=0,a=0,s=0;s<r;++s){var c,u=t[s];if(u.startsWith("object 1"))c=u.split(n),e.nx=parseInt(c[5]),e.ny=parseInt(c[6]),e.nz=parseInt(c[7]);else if(u.startsWith("origin"))c=u.split(n),e.xmin=parseFloat(c[1]),e.ymin=parseFloat(c[2]),e.zmin=parseFloat(c[3]);else if(u.startsWith("delta"))c=u.split(n),0===a?e.hx=parseFloat(c[1])*this.voxelSize:1===a?e.hy=parseFloat(c[2])*this.voxelSize:2===a&&(e.hz=parseFloat(c[3])*this.voxelSize),a+=1;else if(u.startsWith("object 3")){i=s,o+=u.length+1;break}o+=u.length+1}return this.volume.header=e,{dataLineStart:i,headerByteCount:o}},e.prototype.getMatrix=function(){var t=this.volume.header,e=new De;return e.multiply((new De).makeRotationY(Fs(90))),e.multiply((new De).makeTranslation(-t.zmin,t.ymin,t.xmin)),e.multiply((new De).makeScale(-t.hz,t.hy,t.hx)),e},Object.defineProperties(e.prototype,n),e}(Sb);cl.add("dx",Eb);var Mb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"dxbin"},e.prototype._parse=function(){nl&&el.time("DxbinParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);for(var e=function(t,e,n){e=void 0!==e?e:10485760,n=void 0!==n?n:"\n";for(var r="",i=[],o=0;o<t.length;o+=e){var a=Cs(t.subarray(o,o+e)),s=a.lastIndexOf(n);if(-1===s)r+=a;else{var c=r+a.substr(0,s);i=i.concat(c.split(n)),r=s===a.length-n.length?"":a.substr(s+n.length)}}return""!==r&&i.push(r),i}(new Uint8Array(t,0,1e3)),n=this.parseHeaderLines(e),r=this.volume.header,i=n.headerByteCount,o=r.nx*r.ny*r.nz,a=new DataView(t),s=new Float32Array(o),c=0;c<o;++c)s[c]=a.getFloat64(8*c+i,!0);this.volume.setData(s,r.nz,r.ny,r.nx),nl&&el.timeEnd("DxbinParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Eb);cl.add("dxbin",Mb);var Tb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"mrc"},e.prototype._parse=function(){nl&&el.time("MrcParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,n=this.volume,r={},i=new Int32Array(t,0,56),o=new Float32Array(t,0,56),a=new DataView(t);if(r.MAP=String.fromCharCode(a.getUint8(208),a.getUint8(209),a.getUint8(210),a.getUint8(211)),r.MACHST=[a.getUint8(212),a.getUint8(213)],17===r.MACHST[0]&&17===r.MACHST[1])for(var s=t.byteLength,c=0;c<s;c+=4)a.setFloat32(c,a.getFloat32(c),!0);if(r.NX=i[0],r.NY=i[1],r.NZ=i[2],r.MODE=i[3],r.NXSTART=i[4],r.NYSTART=i[5],r.NZSTART=i[6],r.MX=i[7],r.MY=i[8],r.MZ=i[9],r.xlen=o[10]*this.voxelSize,r.ylen=o[11]*this.voxelSize,r.zlen=o[12]*this.voxelSize,r.alpha=o[13],r.beta=o[14],r.gamma=o[15],r.MAPC=i[16],r.MAPR=i[17],r.MAPS=i[18],r.DMIN=o[19],r.DMAX=o[20],r.DMEAN=o[21],r.ISPG=i[22],r.NSYMBT=i[23],r.LSKFLG=i[24],r.originX=o[49],r.originY=o[50],r.originZ=o[51],r.ARMS=o[54],n.header=r,2===r.MODE)e=new Float32Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ);else if(0===r.MODE){if(e=new Float32Array(new Int8Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ)),-128===i[39]&&127===i[40])for(var u=(r.DMAX-r.DMIN)/255,l=.5*(r.DMIN+r.DMAX+u),h=0,p=e.length;h<p;++h)e[h]=u*e[h]+l}else el.error("MrcParser unknown mode",r.MODE);n.setData(e,r.NX,r.NY,r.NZ),nl&&el.timeEnd("MrcParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],n=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var i=[0,e,n,r],o=[0,t.MX,t.MY,t.MZ],a=[0,t.MAPC,t.MAPR,t.MAPS],s=new De;return s.set(i[a[1]][0]/o[a[1]],i[a[2]][0]/o[a[2]],i[a[3]][0]/o[a[3]],0,i[a[1]][1]/o[a[1]],i[a[2]][1]/o[a[2]],i[a[3]][1]/o[a[3]],0,i[a[1]][2]/o[a[1]],i[a[2]][2]/o[a[2]],i[a[3]][2]/o[a[3]],0,0,0,0,1),s.setPosition(new Ne(t.originX,t.originY,t.originZ)),s.multiply((new De).makeTranslation(t.NXSTART,t.NYSTART,t.NZSTART)),s},Object.defineProperties(e.prototype,n),e}(Sb);cl.add("mrc",Tb),cl.add("ccp4",Tb),cl.add("map",Tb);var Pb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"xplor"},e.prototype._parse=function(){nl&&el.time("XplorParser._parse "+this.name);var t,e=this.volume,n=this.streamer.peekLines(8),r={},i=/\s+/;function o(t){return t.trim().split(i).map(parseFloat)}var a=(t=n[2].startsWith("REMARKS")?parseInt(n[1].substring(0,8))+2:5)+3,s=o(n[t]);r.NA=s[0],r.AMIN=s[1],r.AMAX=s[2],r.NB=s[3],r.BMIN=s[4],r.BMAX=s[5],r.NC=s[6],r.CMIN=s[7],r.CMAX=s[8];var c=o(n[t+1]);r.a=c[0]*this.voxelSize,r.b=c[1]*this.voxelSize,r.c=c[2]*this.voxelSize,r.alpha=c[3],r.beta=c[4],r.gamma=c[5];var u=r.AMAX-r.AMIN+1,l=r.BMAX-r.BMIN+1,h=r.CMAX-r.CMIN+1,p=u*l*h,d=new Float32Array(p),f=0,m=0,g=1+u*l/6;this.streamer.eachChunkOfLines(function(t){!function(t,e,n){for(var r=t;r<e;++r){var i=n[r];if(m>=a&&(m-a)%g!=0&&f<p)for(var o=0;o<6;++o)d[f]=parseFloat(i.substr(12*o,12)),++f;++m}}(0,t.length,t)}),e.header=r,e.setData(d,u,l,h),nl&&el.timeEnd("XplorParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.a,0,0],n=[t.b*Math.cos(Math.PI/180*t.gamma),t.b*Math.sin(Math.PI/180*t.gamma),0],r=[t.c*Math.cos(Math.PI/180*t.beta),t.c*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.c*t.c*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var i=[0,e,n,r],o=[0,t.NA,t.NB,t.NC],a=[0,1,2,3],s=new De;return s.set(i[a[1]][0]/o[a[1]],i[a[2]][0]/o[a[2]],i[a[3]][0]/o[a[3]],0,i[a[1]][1]/o[a[1]],i[a[2]][1]/o[a[2]],i[a[3]][1]/o[a[3]],0,i[a[1]][2]/o[a[1]],i[a[2]][2]/o[a[2]],i[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new De).makeTranslation(t.AMIN,t.BMIN,t.CMIN)),s},Object.defineProperties(e.prototype,n),e}(Sb);cl.add("xplor",Pb),cl.add("cns",Pb);var Ib=function(t){function e(e,n){t.call(this,e,n),this.loader=this.getLoader(),this.surface=new rf(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"surface"},n.__objName.get=function(){return"surface"},e.prototype._parse=function(){var t=this.loader.parse(this.streamer.asText());this.surface.fromGeometry(t)},Object.defineProperties(e.prototype,n),e}(Cy);function Rb(){this.regexp={vertex_pattern:/^v\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}}Rb.prototype={constructor:Rb,setPath:function(t){this.path=t},_createParserState:function(){var t={objects:[],object:{},vertices:[],normals:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);this.object={name:t||"",geometry:{vertices:[],normals:[]},fromDeclaration:!1!==e},this.objects.push(this.object)},parseVertexIndex:function(t,e){var n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseNormalIndex:function(t,e){var n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},addVertex:function(t,e,n){var r=this.vertices,i=this.object.geometry.vertices;i.push(r[t+0]),i.push(r[t+1]),i.push(r[t+2]),i.push(r[e+0]),i.push(r[e+1]),i.push(r[e+2]),i.push(r[n+0]),i.push(r[n+1]),i.push(r[n+2])},addVertexLine:function(t){var e=this.vertices,n=this.object.geometry.vertices;n.push(e[t+0]),n.push(e[t+1]),n.push(e[t+2])},addNormal:function(t,e,n){var r=this.normals,i=this.object.geometry.normals;i.push(r[t+0]),i.push(r[t+1]),i.push(r[t+2]),i.push(r[e+0]),i.push(r[e+1]),i.push(r[e+2]),i.push(r[n+0]),i.push(r[n+1]),i.push(r[n+2])},addFace:function(t,e,n,r,i,o,a,s){var c,u=this.vertices.length,l=this.parseVertexIndex(t,u),h=this.parseVertexIndex(e,u),p=this.parseVertexIndex(n,u);if(void 0===r?this.addVertex(l,h,p):(c=this.parseVertexIndex(r,u),this.addVertex(l,h,c),this.addVertex(h,p,c)),void 0!==i){var d=this.normals.length;l=this.parseNormalIndex(i,d),h=i===o?l:this.parseNormalIndex(o,d),p=i===a?l:this.parseNormalIndex(a,d),void 0===r?this.addNormal(l,h,p):(c=this.parseNormalIndex(s,d),this.addNormal(l,h,c),this.addNormal(h,p,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,n=0,r=t.length;n<r;n++)this.addVertexLine(this.parseVertexIndex(t[n],e))}};return t.startObject("",!1),t},parse:function(t){var e,n,r=this._createParserState();-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));var i=t.split("\n"),o="",a="",s="",c=[],u="function"==typeof"".trimLeft;for(e=0,n=i.length;e<n;e++)if(o=i[e],0!==(o=u?o.trimLeft():o.trim()).length&&"#"!==(a=o.charAt(0)))if("v"===a){if(" "===(s=o.charAt(1))&&null!==(c=this.regexp.vertex_pattern.exec(o)))r.vertices.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("n"===s&&null!==(c=this.regexp.normal_pattern.exec(o)))r.normals.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("t"!==s||null===(c=this.regexp.uv_pattern.exec(o)))throw new Error("Unexpected vertex/normal/uv line: '"+o+"'")}else if("f"===a)if(null!==(c=this.regexp.face_vertex_uv_normal.exec(o)))r.addFace(c[1],c[4],c[7],c[10],c[3],c[6],c[9],c[12]);else if(null!==(c=this.regexp.face_vertex_uv.exec(o)));else if(null!==(c=this.regexp.face_vertex_normal.exec(o)))r.addFace(c[1],c[3],c[5],c[7],c[2],c[4],c[6],c[8]);else{if(null===(c=this.regexp.face_vertex.exec(o)))throw new Error("Unexpected face line: '"+o+"'");r.addFace(c[1],c[2],c[3],c[4])}else if("l"===a){var l=o.substring(1).trim().split(" "),h=[],p=[];if(-1===o.indexOf("/"))h=l;else for(var d=0,f=l.length;d<f;d++){var m=l[d].split("/");""!==m[0]&&h.push(m[0]),""!==m[1]&&p.push(m[1])}r.addLineGeometry(h,p)}else if(null!==(c=this.regexp.object_pattern.exec(o))){var g=c[0].substr(1).trim();r.startObject(g)}else if(this.regexp.material_use_pattern.test(o));else if(this.regexp.material_library_pattern.test(o));else if(null===(c=this.regexp.smoothing_pattern.exec(o))){if("\0"===o)continue;throw new Error("Unexpected line: '"+o+"'")}var v=[];for(e=0,n=r.objects.length;e<n;e++){var y=r.objects[e].geometry;if(0!==y.vertices.length){var b=new Cr;b.addAttribute("position",new yr(new Float32Array(y.vertices),3)),y.normals.length>0?b.addAttribute("normal",new yr(new Float32Array(y.normals),3)):b.computeVertexNormals(),v.push(b)}}return v}};var Ob=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"obj"},e.prototype.getLoader=function(){return new Rb},Object.defineProperties(e.prototype,n),e}(Ib);function Lb(){this.propertyNameMapping={}}cl.add("obj",Ob),Lb.prototype={constructor:Lb,setPropertyNameMapping:function(t){this.propertyNameMapping=t},bin2str:function(t){for(var e=new Uint8Array(t),n="",r=0;r<t.byteLength;r++)n+=String.fromCharCode(e[r]);return n},isASCII:function(t){return"ascii"===this.parseHeader(this.bin2str(t)).format},parse:function(t){return t instanceof ArrayBuffer?this.isASCII(t)?this.parseASCII(this.bin2str(t)):this.parseBinary(t):this.parseASCII(t)},parseHeader:function(t){var e="",n=0,r=/ply([\s\S]*)end_header\s/.exec(t);null!==r&&(e=r[1],n=r[0].length);var i,o,a,s,c,u,l={comments:[],elements:[],headerLength:n},h=e.split("\n");for(var p=0;p<h.length;p++){var d=h[p];if(""!==(d=d.trim()))switch(o=(a=d.split(/\s+/)).shift(),d=a.join(" "),o){case"format":l.format=a[0],l.version=a[1];break;case"comment":l.comments.push(d);break;case"element":void 0!==i&&l.elements.push(i),(i={}).name=a[0],i.count=parseInt(a[1]),i.properties=[];break;case"property":i.properties.push((s=a,c=this.propertyNameMapping,u=void 0,"list"===(u={type:s[0]}).type?(u.name=s[3],u.countType=s[1],u.itemType=s[2]):u.name=s[1],u.name in c&&(u.name=c[u.name]),u));break;default:console.log("unhandled",o,a)}}return void 0!==i&&l.elements.push(i),l},parseASCIINumber:function(t,e){switch(e){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(t);case"float":case"double":case"float32":case"float64":return parseFloat(t)}},parseASCIIElement:function(t,e){for(var n=e.split(/\s+/),r={},i=0;i<t.length;i++)if("list"===t[i].type){for(var o=[],a=this.parseASCIINumber(n.shift(),t[i].countType),s=0;s<a;s++)o.push(this.parseASCIINumber(n.shift(),t[i].itemType));r[t[i].name]=o}else r[t[i].name]=this.parseASCIINumber(n.shift(),t[i].type);return r},parseASCII:function(t){var e,n=new vr,r=this.parseHeader(t),i="";null!==(e=/end_header\s([\s\S]*)$/.exec(t))&&(i=e[1]);var o=i.split("\n"),a=0,s=0;n.useColor=!1;for(var c=0;c<o.length;c++){var u=o[c];if(""!==(u=u.trim())){s>=r.elements[a].count&&(a++,s=0);var l=this.parseASCIIElement(r.elements[a].properties,u);this.handleElement(n,r.elements[a].name,l),s++}}return this.postProcess(n)},postProcess:function(t){if(t.useColor){for(var e=0;e<t.faces.length;e++)t.faces[e].vertexColors=[t.colors[t.faces[e].a],t.colors[t.faces[e].b],t.colors[t.faces[e].c]];t.elementsNeedUpdate=!0}return t.computeBoundingSphere(),t},handleElement:function(t,e,n){if("vertex"===e){if(t.vertices.push(new Ne(n.x,n.y,n.z)),"red"in n&&"green"in n&&"blue"in n){t.useColor=!0;var r=new En;r.setRGB(n.red/255,n.green/255,n.blue/255),t.colors.push(r)}}else if("face"===e){var i=n.vertex_indices;3===i.length?t.faces.push(new ar(i[0],i[1],i[2])):4===i.length&&t.faces.push(new ar(i[0],i[1],i[3]),new ar(i[1],i[2],i[3]))}},binaryRead:function(t,e,n,r){switch(n){case"int8":case"char":return[t.getInt8(e),1];case"uint8":case"uchar":return[t.getUint8(e),1];case"int16":case"short":return[t.getInt16(e,r),2];case"uint16":case"ushort":return[t.getUint16(e,r),2];case"int32":case"int":return[t.getInt32(e,r),4];case"uint32":case"uint":return[t.getUint32(e,r),4];case"float32":case"float":return[t.getFloat32(e,r),4];case"float64":case"double":return[t.getFloat64(e,r),8]}},binaryReadElement:function(t,e,n,r){for(var i,o={},a=0,s=0;s<n.length;s++)if("list"===n[s].type){var c=[],u=(i=this.binaryRead(t,e+a,n[s].countType,r))[0];a+=i[1];for(var l=0;l<u;l++)i=this.binaryRead(t,e+a,n[s].itemType,r),c.push(i[0]),a+=i[1];o[n[s].name]=c}else i=this.binaryRead(t,e+a,n[s].type,r),o[n[s].name]=i[0],a+=i[1];return[o,a]},parseBinary:function(t){for(var e,n=new vr,r=this.parseHeader(this.bin2str(t)),i="binary_little_endian"===r.format,o=new DataView(t,r.headerLength),a=0,s=0;s<r.elements.length;s++)for(var c=0;c<r.elements[s].count;c++){a+=(e=this.binaryReadElement(o,a,r.elements[s].properties,i))[1];var u=e[0];this.handleElement(n,r.elements[s].name,u)}return this.postProcess(n)}};var kb=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"ply"},e.prototype.getLoader=function(){return new Lb},Object.defineProperties(e.prototype,n),e}(Ib);cl.add("ply",kb);var Nb=function(t){function e(e,n){var r=n||{};t.call(this,e,r),this.delimiter=gs(r.delimiter,","),this.comment=gs(r.comment,"#"),this.columnNames=gs(r.columnNames,!1),this.table={name:this.name,path:this.path,columnNames:[],data:[]}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"csv"},n.__objName.get=function(){return"table"},e.prototype._parse=function(){var t=this,e=this.table.data,n=new RegExp("\\s*"+this.delimiter+"\\s*"),r=0;this.streamer.eachChunkOfLines(function(i){for(var o=i.length,a=0;a<o;++a){var s=i[a].trim();if(!s.startsWith(t.comment)){var c=s.split(n);0===r?t.table.columnNames=c:s&&e.push(c),++r}}})},Object.defineProperties(e.prototype,n),e}(Cy);cl.add("csv",Nb);var Db=function(t){function e(e,n){var r=n||{};t.call(this,e,r),this.string=gs(r.string,!1),this.json={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"json"},n.__objName.get=function(){return"json"},e.prototype._parse=function(){this.streamer.isBinary()||this.string?this.json.data=JSON.parse(this.streamer.asText()):this.json.data=this.streamer.data},Object.defineProperties(e.prototype,n),e}(Cy);cl.add("json",Db);var zb=function(t){function e(e,n){t.call(this,e,n),this.text={name:this.name,path:this.path,data:""}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"text"},n.__objName.get=function(){return"text"},e.prototype._parse=function(){this.text.data=this.streamer.asText()},Object.defineProperties(e.prototype,n),e}(Cy);cl.add("txt",zb),cl.add("text",zb);var Fb=/^['"]|['"]$/g,Bb=/^<([\w-:.]+)\s*/,Ub=/^([^<]*)/,jb=/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/;function Gb(t){return t=t.trim().replace(/<!--[\s\S]*?-->/g,""),{declaration:function(){if(n(/^<\?xml\s*/)){for(var t={attributes:{}};!r()&&!i("?>");){var o=e();if(!o)return t;t.attributes[o.name]=o.value}return n(/\?>\s*/),t}}(),root:function t(){var o=n(Bb);if(o){for(var a,s={name:o[1],attributes:{},children:[]};!(r()||i(">")||i("?>")||i("/>"));){var c=e();if(!c)return s;s.attributes[c.name]=c.value}if(n(/^\s*\/>\s*/))return s;for(n(/\??>\s*/),s.content=function(){var t=n(Ub);return t?t[1]:""}();a=t();)s.children.push(a);return n(/^<\/[\w-:.]+>\s*/),s}}()};function e(){var t,e=n(jb);if(e)return{name:e[1],value:(t=e[2],t.replace(Fb,""))}}function n(e){var n=t.match(e);if(n)return t=t.slice(n[0].length),n}function r(){return 0===t.length}function i(e){return 0===t.indexOf(e)}}var Vb=function(t){function e(e,n){var r=n||{};t.call(this,e,r),this.useDomParser=gs(r.useDomParser,!1),this.xml={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},__objName:{}};return n.type.get=function(){return"xml"},n.__objName.get=function(){return"xml"},e.prototype.__xmlParser=function(t){return Gb(t)},e.prototype.__domParser=function(t){return(new window.DOMParser).parseFromString(t,"text/xml")},e.prototype._parse=function(){nl&&el.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.data instanceof window.Document?this.xml.data=this.streamer.data:this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.__xmlParser(this.streamer.asText()),nl&&el.timeEnd("XmlParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Cy);function Hb(t,e,n){var r=t.icode.value,i=t.chain.value,o=t.altcode.value,a=t.resnum.value;return r.trim()&&(a+="^"+r),i.trim()&&(a+=":"+i),e&&(a+="."+e),n&&o.trim()&&(a+="%"+o),a+="/"+(parseInt(t.model.value)-1)}function $b(t,e,n){void 0===t[e]?t[e]=n:t[e]|=n}function Wb(t,e){return void 0!==t&&t.value===e}function qb(t,e,n){for(var r=0,i=e.getElementsByTagName("clash"),o=0,a=i.length;o<a;++o)if(t[i[o].attributes.cid.value]){r+=1;break}return e.getElementsByTagName("angle-outlier").length>0&&(r+=1),e.getElementsByTagName("bond-outlier").length>0&&(r+=1),e.getElementsByTagName("plane-outlier").length>0&&(r+=1),Wb(n.rota,"OUTLIER")&&(r+=1),Wb(n.rama,"OUTLIER")&&(r+=1),Wb(n.RNApucker,"outlier")&&(r+=1),r}cl.add("xml",Vb);var Xb=function(t,e){this.name=t,this.path=e,this.rsrzDict={},this.rsccDict={},this.clashDict={},this.clashArray=[],this.geoDict={},this.geoAtomDict={},this.atomDict={},this.clashSele="NONE"},Yb={type:{}};Yb.type.get=function(){return"validation"},Xb.prototype.fromXml=function(t){nl&&el.time("Validation.fromXml");var e=this.rsrzDict,n=this.rsccDict,r=this.clashDict,i=this.clashArray,o=this.geoDict,a=this.geoAtomDict,s=this.atomDict,c=t.getElementsByTagName("ModelledSubgroup"),u={},l=[];nl&&el.time("Validation.fromXml#clashDict");for(var h=0,p=c.length;h<p;++h){var d=c[h],f=d.attributes,m=Hb(f);void 0!==f.rsrz&&(e[m]=parseFloat(f.rsrz.value)),void 0!==f.rscc&&(n[m]=parseFloat(f.rscc.value)),f.sele=m;for(var g=d.getElementsByTagName("clash"),v=0,y=g.length;v<y;++v){var b=g[v].attributes,x=b.atom.value;if("H"!==Gf(x)){var _=b.cid.value,w=Hb(f,x,!0);if(s[w]=!0,void 0===u[_])u[_]={sele1:w,res1:m};else{var S=u[_];S.res1!==m&&(S.sele2=w,S.res2=m,l.push(S.res1,m),r[_]=S,i.push(S))}}}}nl&&el.timeEnd("Validation.fromXml#clashDict");for(var C=0,A=c.length;C<A;++C){var E=c[C],M=E.attributes,T=M.sele;if("."!==M.seq.value){var P=qb(r,E,M);P>0&&(o[T]=P)}else{var I=E.getElementsByTagName("clash"),R=E.getElementsByTagName("mog-bond-outlier"),O=E.getElementsByTagName("mog-angle-outlier");if(R.length>0||O.length>0||I.length>0){var L={};a[T]=L;for(var k=0,N=I.length;k<N;++k){var D=I[k].attributes;r[D.cid.value]&&$b(L,D.atom.value,1)}for(var z=0,F=R.length;z<F;++z){R[z].attributes.atoms.value.split(",").forEach(function(t){$b(L,t,2)})}for(var B=0,U=O.length;B<U;++B){O[B].attributes.atoms.value.split(",").forEach(function(t){$b(L,t,4)})}}}}this.clashSele=l.length?l.join(" OR "):"NONE",nl&&el.timeEnd("Validation.fromXml")},Xb.prototype.getClashData=function(t){nl&&el.time("Validation.getClashData");var e=t||{},n=e.structure,r=n.atomSet,i=new En(gs(e.color,"#f0027f")),o=n.getAtomProxy(),a=n.getAtomProxy(),s=new Ne,c=new Ne,u=new Ne,l=this.clashArray,h=l.length,p=new Float32Array(3*h),d=new Float32Array(3*h),f=ql(h,i.r,i.g,i.b),m=new Float32Array(h),g=new Float32Array(h);nl&&el.time("Validation.getClashData#atomDict");var v=this.atomDict;n.eachAtom(function(t){var e=function(t){var e=t.inscode,n=t.chainname,r=t.atomname,i=t.altloc,o=t.resno;return e&&(o+="^"+e),n&&(o+=":"+n),r&&(o+="."+r),i&&(o+="%"+i),o+="/"+t.modelIndex}(t);!0===v[e]&&(v[e]=t.index)}),nl&&el.timeEnd("Validation.getClashData#atomDict");var y=0;return l.forEach(function(t,e){if(o.index=v[t.sele1],a.index=v[t.sele2],void 0!==o.index&&void 0!==a.index&&r.isSet(o.index,a.index)){s.subVectors(a,o).setLength(o.vdw),c.copy(o).add(s),s.subVectors(o,a).setLength(a.vdw),u.copy(a).add(s);var n=o.distanceTo(a)/2,i=Math.sqrt(o.vdw*o.vdw-n*n),l=Math.sqrt(a.vdw*a.vdw-n*n);c.toArray(p,3*y),u.toArray(d,3*y),m[y]=(i+l)/2,g[y]=e,++y}}),nl&&el.timeEnd("Validation.getClashData"),{position1:p.subarray(0,3*y),position2:d.subarray(0,3*y),color:f.subarray(0,3*y),color2:f.subarray(0,3*y),radius:m.subarray(0,y),picking:new Dp(g.subarray(0,y),this,n)}},Object.defineProperties(Xb.prototype,Yb);var Kb=function(t){function e(e,n){var r=n||{};t.call(this,e,r),this.useDomParser=!0,this.validation=new Xb(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={__objName:{}};return n.__objName.get=function(){return"validation"},e.prototype._parse=function(){t.prototype._parse.call(this),nl&&el.time("ValidationParser._parse "+this.name),this.validation.fromXml(this.xml.data),nl&&el.timeEnd("ValidationParser._parse "+this.name)},Object.defineProperties(e.prototype,n),e}(Vb);function Zb(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)}function Qb(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]}function Jb(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}cl.add("validation",Kb);var tx=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();function ex(t,e,n,r){var i=tx,o=r+n;t^=-1;for(var a=r;a<o;a++)t=t>>>8^i[255&(t^e[a])];return-1^t}var nx=30,rx=12;function ix(t,e){var n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E;n=t.state,r=t.next_in,A=t.input,i=r+(t.avail_in-5),o=t.next_out,E=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),c=n.dmax,u=n.wsize,l=n.whave,h=n.wnext,p=n.window,d=n.hold,f=n.bits,m=n.lencode,g=n.distcode,v=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;t:do{f<15&&(d+=A[r++]<<f,f+=8,d+=A[r++]<<f,f+=8),b=m[d&v];e:for(;;){if(d>>>=x=b>>>24,f-=x,0===(x=b>>>16&255))E[o++]=65535&b;else{if(!(16&x)){if(0==(64&x)){b=m[(65535&b)+(d&(1<<x)-1)];continue e}if(32&x){n.mode=rx;break t}t.msg="invalid literal/length code",n.mode=nx;break t}_=65535&b,(x&=15)&&(f<x&&(d+=A[r++]<<f,f+=8),_+=d&(1<<x)-1,d>>>=x,f-=x),f<15&&(d+=A[r++]<<f,f+=8,d+=A[r++]<<f,f+=8),b=g[d&y];n:for(;;){if(d>>>=x=b>>>24,f-=x,!(16&(x=b>>>16&255))){if(0==(64&x)){b=g[(65535&b)+(d&(1<<x)-1)];continue n}t.msg="invalid distance code",n.mode=nx;break t}if(w=65535&b,f<(x&=15)&&(d+=A[r++]<<f,(f+=8)<x&&(d+=A[r++]<<f,f+=8)),(w+=d&(1<<x)-1)>c){t.msg="invalid distance too far back",n.mode=nx;break t}if(d>>>=x,f-=x,w>(x=o-a)){if((x=w-x)>l&&n.sane){t.msg="invalid distance too far back",n.mode=nx;break t}if(S=0,C=p,0===h){if(S+=u-x,x<_){_-=x;do{E[o++]=p[S++]}while(--x);S=o-w,C=E}}else if(h<x){if(S+=u+h-x,(x-=h)<_){_-=x;do{E[o++]=p[S++]}while(--x);if(S=0,h<_){_-=x=h;do{E[o++]=p[S++]}while(--x);S=o-w,C=E}}}else if(S+=h-x,x<_){_-=x;do{E[o++]=p[S++]}while(--x);S=o-w,C=E}for(;_>2;)E[o++]=C[S++],E[o++]=C[S++],E[o++]=C[S++],_-=3;_&&(E[o++]=C[S++],_>1&&(E[o++]=C[S++]))}else{S=o-w;do{E[o++]=E[S++],E[o++]=E[S++],E[o++]=E[S++],_-=3}while(_>2);_&&(E[o++]=E[S++],_>1&&(E[o++]=E[S++]))}break}}break}}while(r<i&&o<s);r-=_=f>>3,d&=(1<<(f-=_<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=o<s?s-o+257:257-(o-s),n.hold=d,n.bits=f}var ox=15,ax=852,sx=592,cx=0,ux=1,lx=2,hx=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],px=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],dx=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],fx=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function mx(t,e,n,r,i,o,a,s){var c,u,l,h,p,d,f,m,g,v=s.bits,y=0,b=0,x=0,_=0,w=0,S=0,C=0,A=0,E=0,M=0,T=null,P=0,I=new Uint16Array(ox+1),R=new Uint16Array(ox+1),O=null,L=0;for(y=0;y<=ox;y++)I[y]=0;for(b=0;b<r;b++)I[e[n+b]]++;for(w=v,_=ox;_>=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w<x&&(w=x),A=1,y=1;y<=ox;y++)if(A<<=1,(A-=I[y])<0)return-1;if(A>0&&(t===cx||1!==_))return-1;for(R[1]=0,y=1;y<ox;y++)R[y+1]=R[y]+I[y];for(b=0;b<r;b++)0!==e[n+b]&&(a[R[e[n+b]]++]=b);if(t===cx?(T=O=a,d=19):t===ux?(T=hx,P-=257,O=px,L-=257,d=256):(T=dx,O=fx,d=-1),M=0,b=0,y=x,p=o,S=w,C=0,l=-1,h=(E=1<<w)-1,t===ux&&E>ax||t===lx&&E>sx)return 1;for(;;){0,f=y-C,a[b]<d?(m=0,g=a[b]):a[b]>d?(m=O[L+a[b]],g=T[P+a[b]]):(m=96,g=0),c=1<<y-C,x=u=1<<S;do{i[p+(M>>C)+(u-=c)]=f<<24|m<<16|g|0}while(0!==u);for(c=1<<y-1;M&c;)c>>=1;if(0!==c?(M&=c-1,M+=c):M=0,b++,0==--I[y]){if(y===_)break;y=e[n+a[b]]}if(y>w&&(M&h)!==l){for(0===C&&(C=w),p+=x,A=1<<(S=y-C);S+C<_&&!((A-=I[S+C])<=0);)S++,A<<=1;if(E+=1<<S,t===ux&&E>ax||t===lx&&E>sx)return 1;i[l=M&h]=w<<24|S<<16|p-o|0}}return 0!==M&&(i[p+M]=y-C<<24|64<<16|0),s.bits=w,0}var gx=0,vx=1,yx=2,bx=4,xx=5,_x=6,wx=0,Sx=1,Cx=2,Ax=-2,Ex=-3,Mx=-4,Tx=-5,Px=8,Ix=1,Rx=2,Ox=3,Lx=4,kx=5,Nx=6,Dx=7,zx=8,Fx=9,Bx=10,Ux=11,jx=12,Gx=13,Vx=14,Hx=15,$x=16,Wx=17,qx=18,Xx=19,Yx=20,Kx=21,Zx=22,Qx=23,Jx=24,t_=25,e_=26,n_=27,r_=28,i_=29,o_=30,a_=31,s_=32,c_=852,u_=592;function l_(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function h_(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ix,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(c_),e.distcode=e.distdyn=new Int32Array(u_),e.sane=1,e.back=-1,wx):Ax}(t)):Ax}function p_(t,e){var n,r;return t?(r=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},t.state=r,r.window=null,(n=function(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Ax:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,h_(t))):Ax}(t,e))!==wx&&(t.state=null),n):Ax}var d_,f_,m_=!0;function g_(t){if(m_){var e;for(d_=new Int32Array(512),f_=new Int32Array(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(mx(vx,t.lens,0,288,d_,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;mx(yx,t.lens,0,32,f_,0,t.work,{bits:5}),m_=!1}t.lencode=d_,t.lenbits=9,t.distcode=f_,t.distbits=5}function v_(t,e,n,r){var i,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(Qb(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>r&&(i=r),Qb(o.window,e,n-r,i,o.wnext),(r-=i)?(Qb(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}function y_(t,e){var n,r,i,o,a,s,c,u,l,h,p,d,f,m,g,v,y,b,x,_,w,S,C,A,E=0,M=new Uint8Array(4),T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return Ax;(n=t.state).mode===jx&&(n.mode=Gx),a=t.next_out,i=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=n.hold,l=n.bits,h=s,p=c,S=wx;t:for(;;)switch(n.mode){case Ix:if(0===n.wrap){n.mode=Gx;break}for(;l<16;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(2&n.wrap&&35615===u){n.check=0,M[0]=255&u,M[1]=u>>>8&255,n.check=ex(n.check,M,2,0),u=0,l=0,n.mode=Rx;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",n.mode=o_;break}if((15&u)!==Px){t.msg="unknown compression method",n.mode=o_;break}if(l-=4,w=8+(15&(u>>>=4)),0===n.wbits)n.wbits=w;else if(w>n.wbits){t.msg="invalid window size",n.mode=o_;break}n.dmax=1<<w,t.adler=n.check=1,n.mode=512&u?Bx:jx,u=0,l=0;break;case Rx:for(;l<16;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(n.flags=u,(255&n.flags)!==Px){t.msg="unknown compression method",n.mode=o_;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=o_;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&(M[0]=255&u,M[1]=u>>>8&255,n.check=ex(n.check,M,2,0)),u=0,l=0,n.mode=Ox;case Ox:for(;l<32;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}n.head&&(n.head.time=u),512&n.flags&&(M[0]=255&u,M[1]=u>>>8&255,M[2]=u>>>16&255,M[3]=u>>>24&255,n.check=ex(n.check,M,4,0)),u=0,l=0,n.mode=Lx;case Lx:for(;l<16;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&(M[0]=255&u,M[1]=u>>>8&255,n.check=ex(n.check,M,2,0)),u=0,l=0,n.mode=kx;case kx:if(1024&n.flags){for(;l<16;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&(M[0]=255&u,M[1]=u>>>8&255,n.check=ex(n.check,M,2,0)),u=0,l=0}else n.head&&(n.head.extra=null);n.mode=Nx;case Nx:if(1024&n.flags&&((d=n.length)>s&&(d=s),d&&(n.head&&(w=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Qb(n.head.extra,r,o,d,w)),512&n.flags&&(n.check=ex(n.check,r,d,o)),s-=d,o+=d,n.length-=d),n.length))break t;n.length=0,n.mode=Dx;case Dx:if(2048&n.flags){if(0===s)break t;d=0;do{w=r[o+d++],n.head&&w&&n.length<65536&&(n.head.name+=String.fromCharCode(w))}while(w&&d<s);if(512&n.flags&&(n.check=ex(n.check,r,d,o)),s-=d,o+=d,w)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=zx;case zx:if(4096&n.flags){if(0===s)break t;d=0;do{w=r[o+d++],n.head&&w&&n.length<65536&&(n.head.comment+=String.fromCharCode(w))}while(w&&d<s);if(512&n.flags&&(n.check=ex(n.check,r,d,o)),s-=d,o+=d,w)break t}else n.head&&(n.head.comment=null);n.mode=Fx;case Fx:if(512&n.flags){for(;l<16;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(u!==(65535&n.check)){t.msg="header crc mismatch",n.mode=o_;break}u=0,l=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=jx;break;case Bx:for(;l<32;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}t.adler=n.check=l_(u),u=0,l=0,n.mode=Ux;case Ux:if(0===n.havedict)return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,n.hold=u,n.bits=l,Cx;t.adler=n.check=1,n.mode=jx;case jx:if(e===xx||e===_x)break t;case Gx:if(n.last){u>>>=7&l,l-=7&l,n.mode=n_;break}for(;l<3;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}switch(n.last=1&u,l-=1,3&(u>>>=1)){case 0:n.mode=Vx;break;case 1:if(g_(n),n.mode=Yx,e===_x){u>>>=2,l-=2;break t}break;case 2:n.mode=Wx;break;case 3:t.msg="invalid block type",n.mode=o_}u>>>=2,l-=2;break;case Vx:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",n.mode=o_;break}if(n.length=65535&u,u=0,l=0,n.mode=Hx,e===_x)break t;case Hx:n.mode=$x;case $x:if(d=n.length){if(d>s&&(d=s),d>c&&(d=c),0===d)break t;Qb(i,r,o,d,a),s-=d,o+=d,c-=d,a+=d,n.length-=d;break}n.mode=jx;break;case Wx:for(;l<14;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(n.nlen=257+(31&u),u>>>=5,l-=5,n.ndist=1+(31&u),u>>>=5,l-=5,n.ncode=4+(15&u),u>>>=4,l-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=o_;break}n.have=0,n.mode=qx;case qx:for(;n.have<n.ncode;){for(;l<3;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}n.lens[T[n.have++]]=7&u,u>>>=3,l-=3}for(;n.have<19;)n.lens[T[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,C={bits:n.lenbits},S=mx(gx,n.lens,0,19,n.lencode,0,n.work,C),n.lenbits=C.bits,S){t.msg="invalid code lengths set",n.mode=o_;break}n.have=0,n.mode=Xx;case Xx:for(;n.have<n.nlen+n.ndist;){for(;v=(E=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,y=65535&E,!((g=E>>>24)<=l);){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(y<16)u>>>=g,l-=g,n.lens[n.have++]=y;else{if(16===y){for(A=g+2;l<A;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(u>>>=g,l-=g,0===n.have){t.msg="invalid bit length repeat",n.mode=o_;break}w=n.lens[n.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===y){for(A=g+3;l<A;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}l-=g,w=0,d=3+(7&(u>>>=g)),u>>>=3,l-=3}else{for(A=g+7;l<A;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}l-=g,w=0,d=11+(127&(u>>>=g)),u>>>=7,l-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=o_;break}for(;d--;)n.lens[n.have++]=w}}if(n.mode===o_)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=o_;break}if(n.lenbits=9,C={bits:n.lenbits},S=mx(vx,n.lens,0,n.nlen,n.lencode,0,n.work,C),n.lenbits=C.bits,S){t.msg="invalid literal/lengths set",n.mode=o_;break}if(n.distbits=6,n.distcode=n.distdyn,C={bits:n.distbits},S=mx(yx,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,C),n.distbits=C.bits,S){t.msg="invalid distances set",n.mode=o_;break}if(n.mode=Yx,e===_x)break t;case Yx:n.mode=Kx;case Kx:if(s>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,n.hold=u,n.bits=l,ix(t,p),a=t.next_out,i=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=n.hold,l=n.bits,n.mode===jx&&(n.back=-1);break}for(n.back=0;v=(E=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,y=65535&E,!((g=E>>>24)<=l);){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(v&&0==(240&v)){for(b=g,x=v,_=y;v=(E=n.lencode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&E,!(b+(g=E>>>24)<=l);){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}u>>>=b,l-=b,n.back+=b}if(u>>>=g,l-=g,n.back+=g,n.length=y,0===v){n.mode=e_;break}if(32&v){n.back=-1,n.mode=jx;break}if(64&v){t.msg="invalid literal/length code",n.mode=o_;break}n.extra=15&v,n.mode=Zx;case Zx:if(n.extra){for(A=n.extra;l<A;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Qx;case Qx:for(;v=(E=n.distcode[u&(1<<n.distbits)-1])>>>16&255,y=65535&E,!((g=E>>>24)<=l);){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(0==(240&v)){for(b=g,x=v,_=y;v=(E=n.distcode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&E,!(b+(g=E>>>24)<=l);){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}u>>>=b,l-=b,n.back+=b}if(u>>>=g,l-=g,n.back+=g,64&v){t.msg="invalid distance code",n.mode=o_;break}n.offset=y,n.extra=15&v,n.mode=Jx;case Jx:if(n.extra){for(A=n.extra;l<A;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=o_;break}n.mode=t_;case t_:if(0===c)break t;if(d=p-c,n.offset>d){if((d=n.offset-d)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=o_;break}d>n.wnext?(d-=n.wnext,f=n.wsize-d):f=n.wnext-d,d>n.length&&(d=n.length),m=n.window}else m=i,f=a-n.offset,d=n.length;d>c&&(d=c),c-=d,n.length-=d;do{i[a++]=m[f++]}while(--d);0===n.length&&(n.mode=Kx);break;case e_:if(0===c)break t;i[a++]=n.length,c--,n.mode=Kx;break;case n_:if(n.wrap){for(;l<32;){if(0===s)break t;s--,u|=r[o++]<<l,l+=8}if(p-=c,t.total_out+=p,n.total+=p,p&&(t.adler=n.check=n.flags?ex(n.check,i,p,a-p):Jb(n.check,i,p,a-p)),p=c,(n.flags?u:l_(u))!==n.check){t.msg="incorrect data check",n.mode=o_;break}u=0,l=0}n.mode=r_;case r_:if(n.wrap&&n.flags){for(;l<32;){if(0===s)break t;s--,u+=r[o++]<<l,l+=8}if(u!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=o_;break}u=0,l=0}n.mode=i_;case i_:S=Sx;break t;case o_:S=Ex;break t;case a_:return Mx;case s_:default:return Ax}return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,n.hold=u,n.bits=l,(n.wsize||p!==t.avail_out&&n.mode<o_&&(n.mode<n_||e!==bx))&&v_(t,t.output,t.next_out,p-t.avail_out)?(n.mode=a_,Mx):(h-=t.avail_in,p-=t.avail_out,t.total_in+=h,t.total_out+=p,n.total+=p,n.wrap&&p&&(t.adler=n.check=n.flags?ex(n.check,i,p,t.next_out-p):Jb(n.check,i,p,t.next_out-p)),t.data_type=n.bits+(n.last?64:0)+(n.mode===jx?128:0)+(n.mode===Yx||n.mode===Hx?256:0),(0===h&&0===p||e===bx)&&S===wx&&(S=Tx),S)}function b_(t,e){var n,r=e.length;return t&&t.state?0!==(n=t.state).wrap&&n.mode!==Ux?Ax:n.mode===Ux&&Jb(1,e,r,0)!==n.check?Ex:v_(t,e,r,r)?(n.mode=a_,Mx):(n.havedict=1,wx):Ax}var x_=!0,__=!0;try{String.fromCharCode.apply(null,[0])}catch(t){x_=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){__=!1}for(var w_=new Uint8Array(256),S_=0;S_<256;S_++)w_[S_]=S_>=252?6:S_>=248?5:S_>=240?4:S_>=224?3:S_>=192?2:1;function C_(t){var e,n,r,i,o,a=t.length,s=0;for(i=0;i<a;i++)55296==(64512&(n=t.charCodeAt(i)))&&i+1<a&&56320==(64512&(r=t.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(r-56320),i++),s+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(s),o=0,i=0;o<s;i++)55296==(64512&(n=t.charCodeAt(i)))&&i+1<a&&56320==(64512&(r=t.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(r-56320),i++),n<128?e[o++]=n:n<2048?(e[o++]=192|n>>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e}function A_(t,e){var n,r,i,o,a=e||t.length,s=new Array(2*a);for(r=0,n=0;n<a;)if((i=t[n++])<128)s[r++]=i;else if((o=w_[i])>4)s[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&n<a;)i=i<<6|63&t[n++],o--;o>1?s[r++]=65533:i<65536?s[r++]=i:(i-=65536,s[r++]=55296|i>>10&1023,s[r++]=56320|1023&i)}return function(t,e){if(e<65537&&(t.subarray&&__||!t.subarray&&x_))return String.fromCharCode.apply(null,Zb(t,e));for(var n="",r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n}(s,r)}function E_(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0?e:0===n?e:n+w_[t[n]]>e?n:e}w_[254]=w_[254]=1;var M_=0,T_={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};var P_=Object.prototype.toString;function I_(t){if(!(this instanceof I_))return new I_(t);this.options=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}}return t}({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},this.strm.avail_out=0;var n,r,i,o=p_(this.strm,e.windowBits);if(o!==M_)throw new Error(T_[o]);this.header=new function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},n=this.strm,r=this.header,n&&n.state&&(0==(2&(i=n.state).wrap)||(i.head=r,r.done=!1))}I_.prototype.push=function(t,e){var n,r,i,o,a,s,c=this.strm,u=this.options.chunkSize,l=this.options.dictionary,h=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?c.input=function(t){for(var e=new Uint8Array(t.length),n=0,r=e.length;n<r;n++)e[n]=t.charCodeAt(n);return e}(t):"[object ArrayBuffer]"===P_.call(t)?c.input=new Uint8Array(t):c.input=t,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new Uint8Array(u),c.next_out=0,c.avail_out=u),2===(n=y_(c,0))&&l&&(s="string"==typeof l?C_(l):"[object ArrayBuffer]"===P_.call(l)?new Uint8Array(l):l,n=b_(this.strm,s)),-5===n&&!0===h&&(n=M_,h=!1),1!==n&&n!==M_)return this.onEnd(n),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&1!==n&&(0!==c.avail_in||4!==r&&2!==r)||("string"===this.options.to?(i=E_(c.output,c.next_out),o=c.next_out-i,a=A_(c.output,i),c.next_out=o,c.avail_out=u-o,o&&Qb(c.output,c.output,i,o,0),this.onData(a)):this.onData(Zb(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(h=!0)}while((c.avail_in>0||0===c.avail_out)&&1!==n);return 1===n&&(r=4),4===r?(n=function(t){if(!t||!t.state)return Ax;var e=t.state;return e.window&&(e.window=null),t.state=null,wx}(this.strm),this.onEnd(n),this.ended=!0,n===M_):2!==r||(this.onEnd(M_),c.avail_out=0,!0)},I_.prototype.onData=function(t){this.chunks.push(t)},I_.prototype.onEnd=function(t){t===M_&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=function(t){var e,n,r,i,o,a;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(a=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)o=t[e],a.set(o,i),i+=o.length;return a}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},ll.add("gz",function(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=function(t,e){var n=new I_(e);if(n.push(t,!0),n.err)throw n.msg;return n.result}(t)}catch(n){e=t}return e});var R_="//files.rcsb.org/download/",O_="//mmtf.rcsb.org/v1.0/full/",L_="//mmtf.rcsb.org/v1.0/reduced/";al.add("rcsb",new function(){this.getUrl=function(t){var e,n=bs(t),r=n.name.substr(0,4);return!["pdb","cif"].includes(n.ext)||!1!==n.compressed&&"gz"!==n.compressed?"mmtf"===n.ext?e=n.base.endsWith(".bb")?L_+r:O_+r:n.ext?(el.warn("unsupported ext",n.ext),e=O_+r):e=O_+r:e=R_+n.path,vs()+e},this.getExt=function(t){var e=bs(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}});var k_="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/",N_="/SDF?record_type=3d";function D_(){this.getUrl=function(t){return t}}al.add("pubchem",new function(){this.getUrl=function(t){var e,n=bs(t),r=n.name;return n.ext&&"sdf"!==n.ext?(el.warn("unsupported ext",n.ext),e=k_+r+N_):e=k_+r+N_,vs()+e},this.getExt=function(t){var e=bs(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}),al.add("ftp",new D_),al.add("http",new D_),al.add("https",new D_);"undefined"==typeof window||window.Promise||(window.Promise=p)}).call(this,n(127).setImmediate)},function(t,e,n){"use strict";var r=n(129),i=n(128),o=n(67);t.exports={formats:o,parse:i,stringify:r}},function(t,e,n){"use strict";function r(t){var e,n=t.Symbol;return"function"==typeof n?n.observable?e=n.observable:(e=n("observable"),n.observable=e):e="@@observable",e}n.d(e,"a",function(){return r})},function(t,e,n){t.exports=function(){"use strict";var t={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},e={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},n=Object.defineProperty,r=Object.getOwnPropertyNames,i=Object.getOwnPropertySymbols,o=Object.getOwnPropertyDescriptor,a=Object.getPrototypeOf,s=a&&a(Object);return function c(u,l,h){if("string"!=typeof l){if(s){var p=a(l);p&&p!==s&&c(u,p,h)}var d=r(l);i&&(d=d.concat(i(l)));for(var f=0;f<d.length;++f){var m=d[f];if(!(t[m]||e[m]||h&&h[m])){var g=o(l,m);try{n(u,m,g)}catch(t){}}}return u}return u}}()},function(t,e,n){"use strict";n.r(e);var r=n(0),i=n(22),o=n(1),a=n.n(o),s=a.a.shape({trySubscribe:a.a.func.isRequired,tryUnsubscribe:a.a.func.isRequired,notifyNestedSubs:a.a.func.isRequired,isSubscribed:a.a.func.isRequired}),c=a.a.shape({subscribe:a.a.func.isRequired,dispatch:a.a.func.isRequired,getState:a.a.func.isRequired});var u=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"store",n=arguments[1]||e+"Subscription",i=function(t){function i(n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o[e]=n.store,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,t),i.prototype.getChildContext=function(){var t;return(t={})[e]=this[e],t[n]=null,t},i.prototype.render=function(){return r.Children.only(this.props.children)},i}(r.Component);return i.propTypes={store:c.isRequired,children:a.a.element.isRequired},i.childContextTypes=((t={})[e]=c.isRequired,t[n]=s,t),i}(),l=n(81),h=n.n(l),p=n(16),d=n.n(p);var f=null,m={notify:function(){}};var g=function(){function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.store=e,this.parentSub=n,this.onStateChange=r,this.unsubscribe=null,this.listeners=m}return t.prototype.addNestedSub=function(t){return this.trySubscribe(),this.listeners.subscribe(t)},t.prototype.notifyNestedSubs=function(){this.listeners.notify()},t.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},t.prototype.trySubscribe=function(){var t,e;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=(t=[],e=[],{clear:function(){e=f,t=f},notify:function(){for(var n=t=e,r=0;r<n.length;r++)n[r]()},get:function(){return e},subscribe:function(n){var r=!0;return e===t&&(e=t.slice()),e.push(n),function(){r&&t!==f&&(r=!1,e===t&&(e=t.slice()),e.splice(e.indexOf(n),1))}}}))},t.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=m)},t}(),v=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};var y=0,b={};function x(){}function _(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.getDisplayName,a=void 0===o?function(t){return"ConnectAdvanced("+t+")"}:o,u=i.methodName,l=void 0===u?"connectAdvanced":u,p=i.renderCountProp,f=void 0===p?void 0:p,m=i.shouldHandleStateChanges,_=void 0===m||m,w=i.storeKey,S=void 0===w?"store":w,C=i.withRef,A=void 0!==C&&C,E=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(i,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),M=S+"Subscription",T=y++,P=((e={})[S]=c,e[M]=s,e),I=((n={})[M]=s,n);return function(e){d()("function"==typeof e,"You must pass a component to the function returned by "+l+". Instead received "+JSON.stringify(e));var n=e.displayName||e.name||"Component",i=a(n),o=v({},E,{getDisplayName:a,methodName:l,renderCountProp:f,shouldHandleStateChanges:_,storeKey:S,withRef:A,displayName:i,wrappedComponentName:n,WrappedComponent:e}),s=function(n){function a(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,n.call(this,t,e));return r.version=T,r.state={},r.renderCount=0,r.store=t[S]||e[S],r.propsMode=Boolean(t[S]),r.setWrappedInstance=r.setWrappedInstance.bind(r),d()(r.store,'Could not find "'+S+'" in either the context or props of "'+i+'". Either wrap the root component in a <Provider>, or explicitly pass "'+S+'" as a prop to "'+i+'".'),r.initSelector(),r.initSubscription(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(a,n),a.prototype.getChildContext=function(){var t,e=this.propsMode?null:this.subscription;return(t={})[M]=e||this.context[M],t},a.prototype.componentDidMount=function(){_&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},a.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},a.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},a.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=x,this.store=null,this.selector.run=x,this.selector.shouldComponentUpdate=!1},a.prototype.getWrappedInstance=function(){return d()(A,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+l+"() call."),this.wrappedInstance},a.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},a.prototype.initSelector=function(){var e=t(this.store.dispatch,o);this.selector=function(t,e){var n={run:function(r){try{var i=t(e.getState(),r);(i!==n.props||n.error)&&(n.shouldComponentUpdate=!0,n.props=i,n.error=null)}catch(t){n.shouldComponentUpdate=!0,n.error=t}}};return n}(e,this.store),this.selector.run(this.props)},a.prototype.initSubscription=function(){if(_){var t=(this.propsMode?this.props:this.context)[M];this.subscription=new g(this.store,t,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},a.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(b)):this.notifyNestedSubs()},a.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},a.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},a.prototype.addExtraProps=function(t){if(!(A||f||this.propsMode&&this.subscription))return t;var e=v({},t);return A&&(e.ref=this.setWrappedInstance),f&&(e[f]=this.renderCount++),this.propsMode&&this.subscription&&(e[M]=this.subscription),e},a.prototype.render=function(){var t=this.selector;if(t.shouldComponentUpdate=!1,t.error)throw t.error;return Object(r.createElement)(e,this.addExtraProps(t.props))},a}(r.Component);return s.WrappedComponent=e,s.displayName=i,s.childContextTypes=I,s.contextTypes=P,s.propTypes=P,h()(s,e)}}var w=Object.prototype.hasOwnProperty;function S(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function C(t,e){if(S(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var i=0;i<n.length;i++)if(!w.call(e,n[i])||!S(t[n[i]],e[n[i]]))return!1;return!0}var A=n(53),E={INIT:"@@redux/INIT"+Math.random().toString(36).substring(7).split("").join("."),REPLACE:"@@redux/REPLACE"+Math.random().toString(36).substring(7).split("").join(".")},M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function P(t){if("object"!==(void 0===t?"undefined":M(t))||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function I(t,e){return function(){return e(t.apply(this,arguments))}}var R=n(163),O="object"==typeof self&&self&&self.Object===Object&&self,L=(R.a||O||Function("return this")()).Symbol,k=Object.prototype;k.hasOwnProperty,k.toString,L&&L.toStringTag;Object.prototype.toString;L&&L.toStringTag;Object.getPrototypeOf,Object;var N=Function.prototype,D=Object.prototype,z=N.toString;D.hasOwnProperty,z.call(Object);function F(t){return function(e,n){var r=t(e,n);function i(){return r}return i.dependsOnOwnProps=!1,i}}function B(t){return null!==t.dependsOnOwnProps&&void 0!==t.dependsOnOwnProps?Boolean(t.dependsOnOwnProps):1!==t.length}function U(t,e){return function(e,n){n.displayName;var r=function(t,e){return r.dependsOnOwnProps?r.mapToProps(t,e):r.mapToProps(t)};return r.dependsOnOwnProps=!0,r.mapToProps=function(e,n){r.mapToProps=t,r.dependsOnOwnProps=B(t);var i=r(e,n);return"function"==typeof i&&(r.mapToProps=i,r.dependsOnOwnProps=B(i),i=r(e,n)),i},r}}var j=[function(t){return"function"==typeof t?U(t):void 0},function(t){return t?void 0:F(function(t){return{dispatch:t}})},function(t){return t&&"object"==typeof t?F(function(e){return function(t,e){if("function"==typeof t)return I(t,e);if("object"!==(void 0===t?"undefined":M(t))||null===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":void 0===t?"undefined":M(t))+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(t),r={},i=0;i<n.length;i++){var o=n[i],a=t[o];"function"==typeof a&&(r[o]=I(a,e))}return r}(t,e)}):void 0}];var G=[function(t){return"function"==typeof t?U(t):void 0},function(t){return t?void 0:F(function(){return{}})}],V=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function H(t,e,n){return V({},n,t,e)}var $=[function(t){return"function"==typeof t?function(t){return function(e,n){n.displayName;var r=n.pure,i=n.areMergedPropsEqual,o=!1,a=void 0;return function(e,n,s){var c=t(e,n,s);return o?r&&i(c,a)||(a=c):(o=!0,a=c),a}}}(t):void 0},function(t){return t?void 0:function(){return H}}];function W(t,e,n,r){return function(i,o){return n(t(i,o),e(r,o),o)}}function q(t,e,n,r,i){var o=i.areStatesEqual,a=i.areOwnPropsEqual,s=i.areStatePropsEqual,c=!1,u=void 0,l=void 0,h=void 0,p=void 0,d=void 0;function f(i,c){var f,m,g=!a(c,l),v=!o(i,u);return u=i,l=c,g&&v?(h=t(u,l),e.dependsOnOwnProps&&(p=e(r,l)),d=n(h,p,l)):g?(t.dependsOnOwnProps&&(h=t(u,l)),e.dependsOnOwnProps&&(p=e(r,l)),d=n(h,p,l)):v?(f=t(u,l),m=!s(f,h),h=f,m&&(d=n(h,p,l)),d):d}return function(i,o){return c?f(i,o):(h=t(u=i,l=o),p=e(r,l),d=n(h,p,l),c=!0,d)}}function X(t,e){var n=e.initMapStateToProps,r=e.initMapDispatchToProps,i=e.initMergeProps,o=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=n(t,o),s=r(t,o),c=i(t,o);return(o.pure?q:W)(a,s,c,t,o)}var Y=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function K(t,e,n){for(var r=e.length-1;r>=0;r--){var i=e[r](t);if(i)return i}return function(e,r){throw new Error("Invalid value of type "+typeof t+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function Z(t,e){return t===e}var Q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.connectHOC,n=void 0===e?_:e,r=t.mapStateToPropsFactories,i=void 0===r?G:r,o=t.mapDispatchToPropsFactories,a=void 0===o?j:o,s=t.mergePropsFactories,c=void 0===s?$:s,u=t.selectorFactory,l=void 0===u?X:u;return function(t,e,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=o.pure,u=void 0===s||s,h=o.areStatesEqual,p=void 0===h?Z:h,d=o.areOwnPropsEqual,f=void 0===d?C:d,m=o.areStatePropsEqual,g=void 0===m?C:m,v=o.areMergedPropsEqual,y=void 0===v?C:v,b=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(o,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),x=K(t,i,"mapStateToProps"),_=K(e,a,"mapDispatchToProps"),w=K(r,c,"mergeProps");return n(l,Y({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:Boolean(t),initMapStateToProps:x,initMapDispatchToProps:_,initMergeProps:w,pure:u,areStatesEqual:p,areOwnPropsEqual:f,areStatePropsEqual:g,areMergedPropsEqual:y},b))}}(),J=(n(148),Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}),tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et=function(t){return"@@redux-saga/"+t},nt=et("TASK"),rt=et("HELPER"),it=et("MATCH"),ot=et("CANCEL_PROMISE"),at=et("SAGA_ACTION"),st=et("SELF_CANCELLATION"),ct=function(t){return function(){return t}},ut=ct(!0),lt=function(){},ht=function(t){return t};function pt(t,e,n){if(!e(t))throw Ct("error","uncaught at check",n),new Error(n)}var dt=Object.prototype.hasOwnProperty;function ft(t,e){return mt.notUndef(t)&&dt.call(t,e)}var mt={undef:function(t){return null===t||void 0===t},notUndef:function(t){return null!==t&&void 0!==t},func:function(t){return"function"==typeof t},number:function(t){return"number"==typeof t},string:function(t){return"string"==typeof t},array:Array.isArray,object:function(t){return t&&!mt.array(t)&&"object"===(void 0===t?"undefined":tt(t))},promise:function(t){return t&&mt.func(t.then)},iterator:function(t){return t&&mt.func(t.next)&&mt.func(t.throw)},iterable:function(t){return t&&mt.func(Symbol)?mt.func(t[Symbol.iterator]):mt.array(t)},task:function(t){return t&&t[nt]},observable:function(t){return t&&mt.func(t.subscribe)},buffer:function(t){return t&&mt.func(t.isEmpty)&&mt.func(t.take)&&mt.func(t.put)},pattern:function(t){return t&&(mt.string(t)||"symbol"===(void 0===t?"undefined":tt(t))||mt.func(t)||mt.array(t))},channel:function(t){return t&&mt.func(t.take)&&mt.func(t.close)},helper:function(t){return t&&t[rt]},stringableFunc:function(t){return mt.func(t)&&ft(t,"toString")}},gt={assign:function(t,e){for(var n in e)ft(e,n)&&(t[n]=e[n])}};function vt(t,e){var n=t.indexOf(e);n>=0&&t.splice(n,1)}var yt={from:function(t){var e=Array(t.length);for(var n in t)ft(t,n)&&(e[n]=t[n]);return e}};function bt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=J({},t),n=new Promise(function(t,n){e.resolve=t,e.reject=n});return e.promise=n,e}var xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(){return++t}}(),_t=function(t){throw t},wt=function(t){return{value:t,done:!0}};function St(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments[3],i={name:n,next:t,throw:e,return:wt};return r&&(i[rt]=!0),"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ct(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";"undefined"==typeof window?console.log("redux-saga "+t+": "+e+"\n"+(n&&n.stack||n)):console[t](e,n)}function At(t,e){return function(){return t.apply(void 0,arguments)}}var Et=function(t,e){return t+" has been deprecated in favor of "+e+", please update your code"},Mt=function(t){return new Error("\n  redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug\n  in redux-saga code and not yours. Thanks for reporting this in the project's github repo.\n  Error: "+t+"\n")},Tt=function(t,e){return(t?t+".":"")+"setContext(props): argument "+e+" is not a plain object"},Pt=function(t){return function(e){return t(Object.defineProperty(e,at,{value:!0}))}},It="Channel's Buffer overflow!",Rt=1,Ot=3,Lt=4,kt={isEmpty:ut,put:lt,take:lt};function Nt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments[1],n=new Array(t),r=0,i=0,o=0,a=function(e){n[i]=e,i=(i+1)%t,r++},s=function(){if(0!=r){var e=n[o];return n[o]=null,r--,o=(o+1)%t,e}},c=function(){for(var t=[];r;)t.push(s());return t};return{isEmpty:function(){return 0==r},put:function(s){if(r<t)a(s);else{var u=void 0;switch(e){case Rt:throw new Error(It);case Ot:n[i]=s,o=i=(i+1)%t;break;case Lt:u=2*t,n=c(),r=n.length,i=n.length,o=0,n.length=u,t=u,a(s)}}},take:s,flush:c}}var Dt={none:function(){return kt},fixed:function(t){return Nt(t,Rt)},dropping:function(t){return Nt(t,2)},sliding:function(t){return Nt(t,Ot)},expanding:function(t){return Nt(t,Lt)}},zt=[],Ft=0;function Bt(t){try{jt(),t()}finally{Gt()}}function Ut(t){zt.push(t),Ft||(jt(),Vt())}function jt(){Ft++}function Gt(){Ft--}function Vt(){Gt();for(var t=void 0;!Ft&&void 0!==(t=zt.shift());)Bt(t)}var Ht=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$t={type:"@@redux-saga/CHANNEL_END"},Wt=function(t){return t&&"@@redux-saga/CHANNEL_END"===t.type};var qt="invalid buffer passed to channel factory function",Xt="Saga was provided with an undefined action";function Yt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt.none(),n=arguments[2];arguments.length>2&&pt(n,mt.func,"Invalid match function passed to eventChannel");var r=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dt.fixed(),e=!1,n=[];function r(){if(e&&n.length)throw Mt("Cannot have a closed channel with pending takers");if(n.length&&!t.isEmpty())throw Mt("Cannot have pending takers with non empty buffer")}return pt(t,mt.buffer,qt),{take:function(i){r(),pt(i,mt.func,"channel.take's callback must be a function"),e&&t.isEmpty()?i($t):t.isEmpty()?(n.push(i),i.cancel=function(){return vt(n,i)}):i(t.take())},put:function(i){if(r(),pt(i,mt.notUndef,Xt),!e){if(!n.length)return t.put(i);for(var o=0;o<n.length;o++){var a=n[o];if(!a[it]||a[it](i))return n.splice(o,1),a(i)}}},flush:function(n){r(),pt(n,mt.func,"channel.flush' callback must be a function"),e&&t.isEmpty()?n($t):n(t.flush())},close:function(){if(r(),!e&&(e=!0,n.length)){var t=n;n=[];for(var i=0,o=t.length;i<o;i++)t[i]($t)}},get __takers__(){return n},get __closed__(){return e}}}(e),i=function(){r.__closed__||(o&&o(),r.close())},o=t(function(t){Wt(t)?i():n&&!n(t)||r.put(t)});if(r.__closed__&&o(),!mt.func(o))throw new Error("in eventChannel: subscribe should return a function to unsubscribe");return{take:r.take,flush:r.flush,close:i}}var Kt={done:!0,value:void 0},Zt={};function Qt(t){return mt.channel(t)?"channel":Array.isArray(t)?String(t.map(function(t){return String(t)})):String(t)}function Jt(t,e){var n=void 0,r=e;function i(e,i){if(r===Zt)return Kt;if(i)throw r=Zt,i;n&&n(e);var o=t[r](),a=o[0],s=o[1],c=o[2];return n=c,(r=a)===Zt?Kt:s}return St(i,function(t){return i(null,t)},arguments.length>2&&void 0!==arguments[2]?arguments[2]:"iterator",!0)}function te(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];var o={done:!1,value:be(t)},a=function(t){return{done:!1,value:Ce.apply(void 0,[e].concat(r,[t]))}},s=function(t){return{done:!1,value:function t(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];if(n.length>1)return _e(n.map(function(e){return t(e)}));var i=n[0];1===n.length&&(pt(i,mt.notUndef,"cancel(task): argument task is undefined"),pt(i,mt.task,"cancel(task): argument "+i+" is not a valid Task object "+ve));return ye(le,i||st)}(t)}},c=void 0,u=void 0,l=function(t){return c=t},h=function(t){return u=t};return Jt({q1:function(){return["q2",o,h]},q2:function(){return u===$t?[Zt]:c?["q3",s(c)]:["q1",a(u),l]},q3:function(){return["q1",a(u),l]}},"q1","takeLatest("+Qt(t)+", "+e.name+")")}var ee=et("IO"),ne="TAKE",re="PUT",ie="ALL",oe="RACE",ae="CALL",se="CPS",ce="FORK",ue="JOIN",le="CANCEL",he="SELECT",pe="ACTION_CHANNEL",de="CANCELLED",fe="FLUSH",me="GET_CONTEXT",ge="SET_CONTEXT",ve="\n(HINT: if you are getting this errors in tests, consider using createMockTask from redux-saga/utils)",ye=function(t,e){var n;return(n={})[ee]=!0,n[t]=e,n};function be(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";if(arguments.length&&pt(arguments[0],mt.notUndef,"take(patternOrChannel): patternOrChannel is undefined"),mt.pattern(t))return ye(ne,{pattern:t});if(mt.channel(t))return ye(ne,{channel:t});throw new Error("take(patternOrChannel): argument "+String(t)+" is not valid channel or a valid pattern")}be.maybe=function(){var t=be.apply(void 0,arguments);return t[ne].maybe=!0,t};be.maybe;function xe(t,e){return arguments.length>1?(pt(t,mt.notUndef,"put(channel, action): argument channel is undefined"),pt(t,mt.channel,"put(channel, action): argument "+t+" is not a valid channel"),pt(e,mt.notUndef,"put(channel, action): argument action is undefined")):(pt(t,mt.notUndef,"put(action): argument action is undefined"),e=t,t=null),ye(re,{channel:t,action:e})}function _e(t){return ye(ie,t)}function we(t,e,n){pt(e,mt.notUndef,t+": argument fn is undefined");var r=null;if(mt.array(e)){var i=e;r=i[0],e=i[1]}else if(e.fn){var o=e;r=o.context,e=o.fn}return r&&mt.string(e)&&mt.func(r[e])&&(e=r[e]),pt(e,mt.func,t+": argument "+e+" is not a function"),{context:r,fn:e,args:n}}function Se(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return ye(ae,we("call",t,n))}function Ce(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return ye(ce,we("fork",t,n))}function Ae(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===arguments.length?t=ht:(pt(t,mt.notUndef,"select(selector,[...]): argument selector is undefined"),pt(t,mt.func,"select(selector,[...]): argument "+t+" is not a function")),ye(he,{selector:t,args:n})}function Ee(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return Ce.apply(void 0,[te,t,e].concat(r))}xe.resolve=function(){var t=xe.apply(void 0,arguments);return t[re].resolve=!0,t},xe.sync=At(xe.resolve);var Me=function(t){return function(e){return e&&e[ee]&&e[t]}},Te={take:Me(ne),put:Me(re),all:Me(ie),race:Me(oe),call:Me(ae),cps:Me(se),fork:Me(ce),join:Me(ue),cancel:Me(le),select:Me(he),actionChannel:Me(pe),cancelled:Me(de),flush:Me(fe),getContext:Me(me),setContext:Me(ge)},Pe=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var Re="proc first argument (Saga function result) must be an iterator",Oe={toString:function(){return"@@redux-saga/CHANNEL_END"}},Le={toString:function(){return"@@redux-saga/TASK_CANCEL"}},ke={wildcard:function(){return ut},default:function(t){return"symbol"===(void 0===t?"undefined":Ie(t))?function(e){return e.type===t}:function(e){return e.type===String(t)}},array:function(t){return function(e){return t.some(function(t){return Ne(t)(e)})}},predicate:function(t){return function(e){return t(e)}}};function Ne(t){return("*"===t?ke.wildcard:mt.array(t)?ke.array:mt.stringableFunc(t)?ke.default:mt.func(t)?ke.predicate:ke.default)(t)}var De=function(t){return{fn:t}};function ze(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return lt},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:lt,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:lt,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"anonymous",c=arguments[8];pt(t,mt.iterator,Re);var u=At(M,Et("[...effects]","all([...effects])")),l=o.sagaMonitor,h=o.logger,p=o.onError,d=h||Ct,f=function(t){var e=t.sagaStack;!e&&t.stack&&(e=-1!==t.stack.split("\n")[0].indexOf(t.message)?t.stack:"Error: "+t.message+"\n"+t.stack),d("error","uncaught at "+s,e||t.message||t)},m=function(t){var e=Yt(function(e){return t(function(t){t[at]?e(t):Ut(function(){return e(t)})})});return Ht({},e,{take:function(t,n){arguments.length>1&&(pt(n,mt.func,"channel.take's matcher argument must be a function"),t[it]=n),e.take(t)}})}(e),g=Object.create(i);_.cancel=lt;var v=function(t,e,n,r){var i,o;return n._deferredEnd=null,(i={})[nt]=!0,i.id=t,i.name=e,"done",(o={}).done=o.done||{},o.done.get=function(){if(n._deferredEnd)return n._deferredEnd.promise;var t=bt();return n._deferredEnd=t,n._isRunning||(n._error?t.reject(n._error):t.resolve(n._result)),t.promise},i.cont=r,i.joiners=[],i.cancel=x,i.isRunning=function(){return n._isRunning},i.isCancelled=function(){return n._isCancelled},i.isAborted=function(){return n._isAborted},i.result=function(){return n._result},i.error=function(){return n._error},i.setContext=function(t){pt(t,mt.object,Tt("task",t)),gt.assign(g,t)},function(t,e){for(var n in e){var r=e[n];r.configurable=r.enumerable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,n,r)}}(i,o),i}(a,s,t,c),y={name:s,cancel:function(){y.isRunning&&!y.isCancelled&&(y.isCancelled=!0,_(Le))},isRunning:!0},b=function(t,e,n){var r=[],i=void 0,o=!1;function a(t){c(),n(t,!0)}function s(t){r.push(t),t.cont=function(s,c){o||(vt(r,t),t.cont=lt,c?a(s):(t===e&&(i=s),r.length||(o=!0,n(i))))}}function c(){o||(o=!0,r.forEach(function(t){t.cont=lt,t.cancel()}),r=[])}return s(e),{addTask:s,cancelAll:c,abort:a,getTasks:function(){return r},taskNames:function(){return r.map(function(t){return t.name})}}}(0,y,w);function x(){t._isRunning&&!t._isCancelled&&(t._isCancelled=!0,b.cancelAll(),w(Le))}return c&&(c.cancel=x),t._isRunning=!0,_(),v;function _(e,n){if(!y.isRunning)throw new Error("Trying to resume an already finished generator");try{var r=void 0;n?r=t.throw(e):e===Le?(y.isCancelled=!0,_.cancel(),r=mt.func(t.return)?t.return(Le):{done:!0,value:Le}):r=e===Oe?mt.func(t.return)?t.return():{done:!0}:t.next(e),r.done?(y.isMainRunning=!1,y.cont&&y.cont(r.value)):S(r.value,a,"",_)}catch(t){y.isCancelled&&f(t),y.isMainRunning=!1,y.cont(t,!0)}}function w(e,n){t._isRunning=!1,m.close(),n?(e instanceof Error&&Object.defineProperty(e,"sagaStack",{value:"at "+s+" \n "+(e.sagaStack||e.stack),configurable:!0}),v.cont||(e instanceof Error&&p?p(e):f(e)),t._error=e,t._isAborted=!0,t._deferredEnd&&t._deferredEnd.reject(e)):(t._result=e,t._deferredEnd&&t._deferredEnd.resolve(e)),v.cont&&v.cont(e,n),v.joiners.forEach(function(t){return t.cb(e,n)}),v.joiners=null}function S(t,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments[3],c=xt();l&&l.effectTriggered({effectId:c,parentEffectId:i,label:o,effect:t});var h=void 0;function p(t,e){h||(h=!0,a.cancel=lt,l&&(e?l.effectRejected(c,t):l.effectResolved(c,t)),a(t,e))}p.cancel=lt,a.cancel=function(){if(!h){h=!0;try{p.cancel()}catch(t){f(t)}p.cancel=lt,l&&l.effectCancelled(c)}};var d=void 0;return mt.promise(t)?C(t,p):mt.helper(t)?E(De(t),c,p):mt.iterator(t)?A(t,c,s,p):mt.array(t)?u(t,c,p):(d=Te.take(t))?function(t,e){var n=t.channel,r=t.pattern,i=t.maybe;n=n||m;var o=function(t){return t instanceof Error?e(t,!0):Wt(t)&&!i?e(Oe):e(t)};try{n.take(o,Ne(r))}catch(t){return e(t,!0)}e.cancel=o.cancel}(d,p):(d=Te.put(t))?function(t,e){var r=t.channel,i=t.action,o=t.resolve;Ut(function(){var t=void 0;try{t=(r?r.put:n)(i)}catch(t){if(r||o)return e(t,!0);f(t)}if(!o||!mt.promise(t))return e(t);C(t,e)})}(d,p):(d=Te.all(t))?M(d,c,p):(d=Te.race(t))?function(t,e,n){var r=void 0,i=Object.keys(t),o={};i.forEach(function(e){var a=function(o,a){if(!r)if(a)n.cancel(),n(o,!0);else if(!Wt(o)&&o!==Oe&&o!==Le){var s;n.cancel(),r=!0;var c=((s={})[e]=o,s);n(mt.array(t)?[].slice.call(Pe({},c,{length:i.length})):c)}};a.cancel=lt,o[e]=a}),n.cancel=function(){r||(r=!0,i.forEach(function(t){return o[t].cancel()}))},i.forEach(function(n){r||S(t[n],e,n,o[n])})}(d,c,p):(d=Te.call(t))?function(t,e,n){var r=t.context,i=t.fn,o=t.args,a=void 0;try{a=i.apply(r,o)}catch(t){return n(t,!0)}return mt.promise(a)?C(a,n):mt.iterator(a)?A(a,e,i.name,n):n(a)}(d,c,p):(d=Te.cps(t))?function(t,e){var n=t.context,r=t.fn,i=t.args;try{var o=function(t,n){return mt.undef(t)?e(n):e(t,!0)};r.apply(n,i.concat(o)),o.cancel&&(e.cancel=function(){return o.cancel()})}catch(t){return e(t,!0)}}(d,p):(d=Te.fork(t))?E(d,c,p):(d=Te.join(t))?function(t,e){if(t.isRunning()){var n={task:v,cb:e};e.cancel=function(){return vt(t.joiners,n)},t.joiners.push(n)}else t.isAborted()?e(t.error(),!0):e(t.result())}(d,p):(d=Te.cancel(t))?function(t,e){t===st&&(t=v);t.isRunning()&&t.cancel();e()}(d,p):(d=Te.select(t))?function(t,e){var n=t.selector,i=t.args;try{var o=n.apply(void 0,[r()].concat(i));e(o)}catch(t){e(t,!0)}}(d,p):(d=Te.actionChannel(t))?function(t,n){var r=t.pattern,i=t.buffer,o=Ne(r);o.pattern=r,n(Yt(e,i||Dt.fixed(),o))}(d,p):(d=Te.flush(t))?function(t,e){t.flush(e)}(d,p):(d=Te.cancelled(t))?function(t,e){e(!!y.isCancelled)}(0,p):(d=Te.getContext(t))?function(t,e){e(g[t])}(d,p):(d=Te.setContext(t))?function(t,e){gt.assign(g,t),e()}(d,p):p(t)}function C(t,e){var n=t[ot];mt.func(n)?e.cancel=n:mt.func(t.abort)&&(e.cancel=function(){return t.abort()}),t.then(e,function(t){return e(t,!0)})}function A(t,i,a,s){ze(t,e,n,r,g,o,i,a,s)}function E(t,i,a){var s=t.context,c=t.fn,u=t.args,l=t.detached,h=function(t){var e=t.context,n=t.fn,r=t.args;if(mt.iterator(n))return n;var i,o,a=void 0,s=void 0;try{a=n.apply(e,r)}catch(t){s=t}return mt.iterator(a)?a:St(s?function(){throw s}:(i=void 0,o={done:!1,value:a},function(t){return i?{done:!0,value:t}:(i=!0,o)}))}({context:s,fn:c,args:u});try{jt();var p=ze(h,e,n,r,g,o,i,c.name,l?null:lt);l?a(p):h._isRunning?(b.addTask(p),a(p)):h._error?b.abort(h._error):a(p)}finally{Vt()}}function M(t,e,n){var r=Object.keys(t);if(!r.length)return n(mt.array(t)?[]:{});var i=0,o=void 0,a={},s={};r.forEach(function(e){var c=function(s,c){o||(c||Wt(s)||s===Oe||s===Le?(n.cancel(),n(s,c)):(a[e]=s,++i===r.length&&(o=!0,n(mt.array(t)?yt.from(Pe({},a,{length:r.length})):a))))};c.cancel=lt,s[e]=c}),n.cancel=function(){o||(o=!0,r.forEach(function(t){return s[t].cancel()}))},r.forEach(function(n){return S(t[n],e,n,s[n])})}}var Fe="runSaga(storeInterface, saga, ...args): saga argument must be a Generator function!";var Be=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.context,n=void 0===e?{}:e,r=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(t,["context"]),i=r.sagaMonitor,o=r.logger,a=r.onError;if(mt.func(r))throw new Error("Saga middleware no longer accept Generator functions. Use sagaMiddleware.run instead");if(o&&!mt.func(o))throw new Error("`options.logger` passed to the Saga middleware is not a function!");if(a&&!mt.func(a))throw new Error("`options.onError` passed to the Saga middleware is not a function!");if(r.emitter&&!mt.func(r.emitter))throw new Error("`options.emitter` passed to the Saga middleware is not a function!");function s(t){var e,c=t.getState,u=t.dispatch,l=(e=[],{subscribe:function(t){return e.push(t),function(){return vt(e,t)}},emit:function(t){for(var n=e.slice(),r=0,i=n.length;r<i;r++)n[r](t)}});return l.emit=(r.emitter||ht)(l.emit),s.run=function(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];var o=void 0;mt.iterator(t)?(o=t,t=e):(pt(e,mt.func,Fe),pt(o=e.apply(void 0,r),mt.iterator,Fe));var a=t,s=a.subscribe,c=a.dispatch,u=a.getState,l=a.context,h=a.sagaMonitor,p=a.logger,d=a.onError,f=xt();h&&(h.effectTriggered=h.effectTriggered||lt,h.effectResolved=h.effectResolved||lt,h.effectRejected=h.effectRejected||lt,h.effectCancelled=h.effectCancelled||lt,h.actionDispatched=h.actionDispatched||lt,h.effectTriggered({effectId:f,root:!0,parentEffectId:0,effect:{root:!0,saga:e,args:r}}));var m=ze(o,s,Pt(c),u,l,{sagaMonitor:h,logger:p,onError:d},f,e.name);return h&&h.effectResolved(f,m),m}.bind(null,{context:n,subscribe:l.subscribe,dispatch:u,getState:c,sagaMonitor:i,logger:o,onError:a}),function(t){return function(e){i&&i.actionDispatched&&i.actionDispatched(e);var n=t(e);return l.emit(e),n}}}return s.run=function(){throw new Error("Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware")},s.setContext=function(t){pt(t,mt.object,Tt("sagaMiddleware",t)),gt.assign(n,t)},s},Ue=n(3),je=n.n(Ue);function Ge(t){return"/"===t.charAt(0)}function Ve(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}var He=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],r=e&&e.split("/")||[],i=t&&Ge(t),o=e&&Ge(e),a=i||o;if(t&&Ge(t)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var s=void 0;if(r.length){var c=r[r.length-1];s="."===c||".."===c||""===c}else s=!1;for(var u=0,l=r.length;l>=0;l--){var h=r[l];"."===h?Ve(r,l):".."===h?(Ve(r,l),u++):u&&(Ve(r,l),u--)}if(!a)for(;u--;u)r.unshift("..");!a||""===r[0]||r[0]&&Ge(r[0])||r.unshift("");var p=r.join("/");return s&&"/"!==p.substr(-1)&&(p+="/"),p};"function"==typeof Symbol&&Symbol.iterator;var $e=function(t){return"/"===t.charAt(0)?t:"/"+t},We=function(t,e){return new RegExp("^"+e+"(\\/|\\?|#|$)","i").test(t)},qe=function(t,e){return We(t,e)?t.substr(e.length):t},Xe=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},Ye=function(t){var e=t.pathname,n=t.search,r=t.hash,i=e||"/";return n&&"?"!==n&&(i+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(i+="#"===r.charAt(0)?r:"#"+r),i},Ke=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ze=function(t,e,n,r){var i=void 0;"string"==typeof t?(i=function(t){var e=t||"/",n="",r="",i=e.indexOf("#");-1!==i&&(r=e.substr(i),e=e.substr(0,i));var o=e.indexOf("?");return-1!==o&&(n=e.substr(o),e=e.substr(0,o)),{pathname:e,search:"?"===n?"":n,hash:"#"===r?"":r}}(t)).state=e:(void 0===(i=Ke({},t)).pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==e&&void 0===i.state&&(i.state=e));try{i.pathname=decodeURI(i.pathname)}catch(t){throw t instanceof URIError?new URIError('Pathname "'+i.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):t}return n&&(i.key=n),r?i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=He(i.pathname,r.pathname)):i.pathname=r.pathname:i.pathname||(i.pathname="/"),i},Qe=function(){var t=null,e=[];return{setPrompt:function(e){return je()(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},confirmTransitionTo:function(e,n,r,i){if(null!=t){var o="function"==typeof t?t(e,n):t;"string"==typeof o?"function"==typeof r?r(o,i):(je()(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),i(!0)):i(!1!==o)}else i(!0)},appendListener:function(t){var n=!0,r=function(){n&&t.apply(void 0,arguments)};return e.push(r),function(){n=!1,e=e.filter(function(t){return t!==r})}},notifyListeners:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];e.forEach(function(t){return t.apply(void 0,n)})}}},Je=!("undefined"==typeof window||!window.document||!window.document.createElement),tn=function(t,e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},en=function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)},nn=function(t,e){return e(window.confirm(t))},rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},on=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},an=function(){try{return window.history.state||{}}catch(t){return{}}},sn=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d()(Je,"Browser history needs a DOM");var e,n=window.history,r=(-1===(e=window.navigator.userAgent).indexOf("Android 2.")&&-1===e.indexOf("Android 4.0")||-1===e.indexOf("Mobile Safari")||-1!==e.indexOf("Chrome")||-1!==e.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,i=!(-1===window.navigator.userAgent.indexOf("Trident")),o=t.forceRefresh,a=void 0!==o&&o,s=t.getUserConfirmation,c=void 0===s?nn:s,u=t.keyLength,l=void 0===u?6:u,h=t.basename?Xe($e(t.basename)):"",p=function(t){var e=t||{},n=e.key,r=e.state,i=window.location,o=i.pathname+i.search+i.hash;return je()(!h||We(o,h),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+o+'" to begin with "'+h+'".'),h&&(o=qe(o,h)),Ze(o,r,n)},f=function(){return Math.random().toString(36).substr(2,l)},m=Qe(),g=function(t){on(P,t),P.length=n.length,m.notifyListeners(P.location,P.action)},v=function(t){(function(t){return void 0===t.state&&-1===navigator.userAgent.indexOf("CriOS")})(t)||x(p(t.state))},y=function(){x(p(an()))},b=!1,x=function(t){b?(b=!1,g()):m.confirmTransitionTo(t,"POP",c,function(e){e?g({action:"POP",location:t}):_(t)})},_=function(t){var e=P.location,n=S.indexOf(e.key);-1===n&&(n=0);var r=S.indexOf(t.key);-1===r&&(r=0);var i=n-r;i&&(b=!0,A(i))},w=p(an()),S=[w.key],C=function(t){return h+Ye(t)},A=function(t){n.go(t)},E=0,M=function(t){1===(E+=t)?(tn(window,"popstate",v),i&&tn(window,"hashchange",y)):0===E&&(en(window,"popstate",v),i&&en(window,"hashchange",y))},T=!1,P={length:n.length,action:"POP",location:w,createHref:C,push:function(t,e){je()(!("object"===(void 0===t?"undefined":rn(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i=Ze(t,e,f(),P.location);m.confirmTransitionTo(i,"PUSH",c,function(t){if(t){var e=C(i),o=i.key,s=i.state;if(r)if(n.pushState({key:o,state:s},null,e),a)window.location.href=e;else{var c=S.indexOf(P.location.key),u=S.slice(0,-1===c?0:c+1);u.push(i.key),S=u,g({action:"PUSH",location:i})}else je()(void 0===s,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=e}})},replace:function(t,e){je()(!("object"===(void 0===t?"undefined":rn(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i=Ze(t,e,f(),P.location);m.confirmTransitionTo(i,"REPLACE",c,function(t){if(t){var e=C(i),o=i.key,s=i.state;if(r)if(n.replaceState({key:o,state:s},null,e),a)window.location.replace(e);else{var c=S.indexOf(P.location.key);-1!==c&&(S[c]=i.key),g({action:"REPLACE",location:i})}else je()(void 0===s,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(e)}})},go:A,goBack:function(){return A(-1)},goForward:function(){return A(1)},block:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=m.setPrompt(t);return T||(M(1),T=!0),function(){return T&&(T=!1,M(-1)),e()}},listen:function(t){var e=m.appendListener(t);return M(1),function(){M(-1),e()}}};return P};Object.assign,"function"==typeof Symbol&&Symbol.iterator,Object.assign;var cn=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},un="ROUTE:UPLOAD",ln="ROUTE:FILE",hn="ROUTE:RESULT",pn="ROUTE:NOT_FOUND",dn="ROUTE:ON_LOAD_PAGE";function fn(){return{type:un}}function mn(t){return{type:ln,id:t}}function gn(t){return{type:hn,id:t}}function vn(t){return/^ROUTE:/.test(t.type)}var yn="CHANGE_LOCATION";function bn(t){return{type:yn,route:t}}var xn=sn(),_n=/^\/file\/([a-zA-Z0-9]+)$/,wn=/^\/result\/([a-zA-Z0-9]+)$/;function Sn(t){if("/"===t.pathname)return fn();var e=_n.exec(t.pathname);if(e)return mn(e[1]);var n=wn.exec(t.pathname);return n?gn(n[1]):{type:pn}}function Cn(){return cn(this,function(t){switch(t.label){case 0:return[4,Ee(yn,function(t){return function(t){switch(t.type){case un:return xn.push("/");case hn:return xn.push("/result/"+t.id);case ln:return xn.push("/file/"+t.id);case pn:case dn:return}}(t.route)})];case 1:return t.sent(),[2]}})}var An={id:null,phase:null,total:0,progress:0,name:"",downloadShown:!1,modalShown:!1,descriptors:[],disabled:{},file_errors:[],is3D:!1,desalt:!1,gen3D:!1,current:0,mols:[]},En=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Mn="FILE:SET_ID";var Tn="FILE:UPDATE_STATE";var Pn="FILE:SET_DOWNLOAD_SHOWN";function In(t){return{type:Pn,shown:t}}var Rn="FILE:SET_DESCRIPTORS";var On="FILE:SET_DESCRIPTOR_ENABLED";function Ln(t){return En({type:On},t)}var kn="FILE:SET_ALL_DESCRIPTORS_ENABLED";var Nn="FILE:SET_MODAL_SHOWN";function Dn(t){return{type:Nn,shown:t}}var zn="FILE:SET_FILE_INFO";var Fn="FILE:CLOSE_ERROR";function Bn(t){return{type:Fn,index:t}}var Un="FILE:SET_CURRENT_MOL";function jn(t){return{type:Un,index:t}}var Gn="FILE:MOL_FETCHED";function Vn(t,e){return{type:Gn,nth:t,mol:e}}var Hn="FILE:NOT_FOUND";function $n(){return{type:Hn}}var Wn="FILE:DESCRIPTOR_FETCH_FAILED";var qn="FILE:CALCULATE";var Xn="FILE:CALCULATE_STARTED";var Yn="FILE:CALCULATE_FAILURE";var Kn=n(11),Zn=n.n(Kn),Qn=n(10),Jn=n(79),tr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},er=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}c((r=r.apply(t,e||[])).next())})},nr=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function rr(t){var e=t.file,n=t.gen3D,r=t.desalt;return er(this,void 0,Qn.Promise,function(){var t;return nr(this,function(i){switch(i.label){case 0:return(t=new FormData).append("file",e),t.append("gen3D",n.toString()),t.append("desalt",r.toString()),[4,Zn.a.post("/api/file",t)];case 1:return[2,i.sent().data.id]}})})}function ir(t,e){return Yt(function(n){var r=new EventSource(t);return r.onmessage=function(t){var r=JSON.parse(t.data);n(tr({},r,{error:!1})),e(r)&&n($t)},r.onerror=function(t){n({error:!0,payload:t})},function(){r.close()}})}var or="pending",ar="in-progress",sr="done",cr="error";function ur(t){return ir("/api/file/"+t,function(t){return t.phase===sr||t.phase===cr})}function lr(){return er(this,void 0,Qn.Promise,function(){return nr(this,function(t){switch(t.label){case 0:return[4,Zn.a.get("/api/descriptor")];case 1:return[2,t.sent().data.descriptors]}})})}function hr(t){return er(this,void 0,Qn.Promise,function(){return nr(this,function(e){switch(e.label){case 0:return[4,Zn.a.get("/api/file/"+t)];case 1:return[2,e.sent().data]}})})}function pr(t,e){return er(this,void 0,Qn.Promise,function(){return nr(this,function(n){switch(n.label){case 0:return[4,Zn.a.get("/api/file/"+t+"/"+e+".png",{responseType:"blob"})];case 1:return[2,n.sent().data]}})})}function dr(t,e){return er(this,void 0,Qn.Promise,function(){return nr(this,function(n){switch(n.label){case 0:return[4,Zn.a.get("/api/file/"+t+"/"+e+".mol",{responseType:"blob"})];case 1:return[2,n.sent().data]}})})}function fr(t,e){return er(this,void 0,Qn.Promise,function(){var n;return nr(this,function(r){switch(r.label){case 0:return n=Jn.stringify({disabled:e},{indices:!1}),[4,Zn.a.post("/api/calc/"+t,n)];case 1:return[2,r.sent().data.id]}})})}function mr(t){return ir("/api/calc/"+t,function(t){return t.done})}function gr(t){return er(this,void 0,Qn.Promise,function(){return nr(this,function(e){switch(e.label){case 0:return[4,Zn.a.get("/api/calc/"+t)];case 1:return[2,e.sent().data]}})})}function vr(){return er(this,void 0,Qn.Promise,function(){return nr(this,function(t){switch(t.label){case 0:return[4,Zn.a.get("/api/info")];case 1:return[2,t.sent().data]}})})}var yr=window.localStorage;function br(t){return function(e){yr.setItem(t,JSON.stringify(e))}}function xr(t,e){return function(){var n=yr.getItem(t);return null===n?e():JSON.parse(n)}}var _r=br("descriptors.disabled"),wr=xr("descriptors.disabled",function(){return[]}),Sr=br("upload.generate3D"),Cr=xr("upload.generate3D",function(){return!1}),Ar=br("upload.desalt"),Er=xr("upload.desalt",function(){return!0}),Mr=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function Tr(){var t,e,n,r,i,o,a;return Mr(this,function(s){switch(s.label){case 0:return[4,Ae(function(t){return t.file})];case 1:if(t=s.sent(),e=t.current,n=t.mols,r=t.id,i=t.is3D,void 0===(o=n[e])||void 0!==o.mol)return[2];s.label=2;case 2:return s.trys.push([2,5,,7]),[4,Se(i?dr:pr,r||"",e)];case 3:return a=s.sent(),[4,xe(Vn(e,a))];case 4:return s.sent(),[3,7];case 5:return s.sent(),[4,xe(Vn(e,null))];case 6:return s.sent(),[3,7];case 7:return[2]}})}function Pr(t){var e=t.id;return Mr(this,function(t){switch(t.label){case 0:return[4,xe(function(t){return{type:Mn,id:t}}(e))];case 1:return t.sent(),[2]}})}function Ir(t){var e,n,r=t.id;return Mr(this,function(t){switch(t.label){case 0:return[4,Se(ur,r)];case 1:e=t.sent(),t.label=2;case 2:return[4,be(e)];case 3:return(n=t.sent()).error?[4,xe($n())]:[3,5];case 4:return t.sent(),[3,8];case 5:return[4,xe((i=n,En({type:Tn},i)))];case 6:t.sent(),t.label=7;case 7:return[3,2];case 8:return[2]}var i})}function Rr(){var t;return Mr(this,function(e){switch(e.label){case 0:return[4,Ae(function(t){return!t.file.descriptors})];case 1:if(e.sent())return[2];e.label=2;case 2:return e.trys.push([2,5,,7]),[4,Se(lr)];case 3:return t=e.sent(),[4,xe((n=t,{type:Rn,descriptors:n}))];case 4:return e.sent(),[3,7];case 5:return e.sent(),[4,xe({type:Wn})];case 6:return e.sent(),[3,7];case 7:return[2]}var n})}function Or(t){var e,n,r=t.phase;return Mr(this,function(t){switch(t.label){case 0:return r===or||r===ar?[2]:[4,Ae(function(t){return t.file.id})];case 1:e=t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,Se(hr,e)];case 3:return n=t.sent(),[4,xe((i=n,En({type:zn},i)))];case 4:return t.sent(),[3,7];case 5:return t.sent(),[4,xe($n())];case 6:return t.sent(),[3,7];case 7:return[2]}var i})}function Lr(t){var e,n=t.id,r=t.disabled;return Mr(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,Se(fr,n,r)];case 1:return[4,xe(function(t){return{type:Xn,id:t}}(t.sent()))];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),[4,xe((i=e.toString(),{type:Yn,error:i}))];case 4:return t.sent(),[3,5];case 5:return[2]}var i})}function kr(t){var e=t.id;return Mr(this,function(t){switch(t.label){case 0:return[4,xe(bn(gn(e)))];case 1:return t.sent(),[2]}})}function Nr(){var t,e,n;return Mr(this,function(r){switch(r.label){case 0:return[4,Ae(function(t){return t.file.disabled})];case 1:for(n in t=r.sent(),e=[],t)t.hasOwnProperty(n)&&t[n]&&e.push(n);return _r(e),[2]}})}function Dr(t){var e=t.store;return Mr(this,function(t){switch(t.label){case 0:return e?[4,Nr()]:[2];case 1:return t.sent(),[2]}})}function zr(){var t,e,n;return Mr(this,function(r){switch(r.label){case 0:t=wr(),e=0,n=t,r.label=1;case 1:return e<n.length?[4,xe(Ln({name:n[e],enabled:!1,store:!1}))]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}})}function Fr(){return Mr(this,function(t){switch(t.label){case 0:return[4,Ee(ln,Pr)];case 1:return t.sent(),[4,Ee(ln,Rr)];case 2:return t.sent(),[4,Ee(Mn,Ir)];case 3:return t.sent(),[4,Ee(Rn,zr)];case 4:return t.sent(),[4,Ee(Tn,Or)];case 5:return t.sent(),[4,Ee(qn,Lr)];case 6:return t.sent(),[4,Ee(Xn,kr)];case 7:return t.sent(),[4,Ee(On,Dr)];case 8:return t.sent(),[4,Ee(kn,Nr)];case 9:return t.sent(),[4,Ee(zn,Tr)];case 10:return t.sent(),[4,Ee(Un,Tr)];case 11:return t.sent(),[2]}})}function Br(t){return r.createElement("button",{className:"btn btn-link tooltip tooltip-left","data-tooltip":"Back",onClick:t.onClick},r.createElement("i",{className:"fa fa-undo"}))}function Ur(t){return r.createElement("button",{className:"btn btn-link tooltip tooltip-left","data-tooltip":"Config",onClick:t.onClick},r.createElement("i",{className:"fa fa-lg fa-cog"}))}function jr(t){return r.createElement("button",{className:"btn btn-link tooltip tooltip-left","data-tooltip":"Top",onClick:t.onClick},r.createElement("i",{className:"fa fa-lg fa-home"}))}function Gr(){return r.createElement("a",{className:"btn btn-link tooltip tooltip-left","data-tooltip":"help",href:"https://github.com/mordred-descriptor/mordred-web/tree/master/help/index.md",target:"_blank"},r.createElement("i",{className:"fa fa-lg fa-question"}))}function Vr(){return r.createElement("footer",null,r.createElement("div",null,"This site is provided by"," ",r.createElement("a",{href:"https://github.com/mordred-descriptor/mordred"},"mordred"),". licensed under the BSD3 license."))}function Hr(t){var e=t.onClickError||function(t){};return r.createElement("div",{className:"file-page page centered"},r.createElement("div",{className:"top-bar"},r.createElement("div",null,r.createElement("h2",null,t.title)),r.createElement("div",null,r.createElement("button",{className:"btn btn-link tooltip tooltip-left","data-tooltip":"Back",onClick:t.onClickBack},r.createElement("i",{className:"fa fa-undo"})))),(t.toasts||[]).map(function(t,n){return r.createElement("div",{className:"toast toast-error",key:n},r.createElement("button",{onClick:function(){return e(n)},className:"btn btn-clear float-right"}),t)}),t.children,r.createElement(Vr,null))}function $r(){return r.createElement("div",{className:"loading-page"},r.createElement("div",{className:"loading"}))}function Wr(t){var e=t.name,n=t.text,i=100*t.progress+"%";return r.createElement("div",{className:"bar-container"},r.createElement("div",{className:"name"},e),r.createElement("div",{className:"bar"},r.createElement("div",{className:"bar-item",style:{width:i}},n)))}var qr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function Xr(t){var e=t.title,n=t.name,i=t.text,o=t.progress;return r.createElement("div",{className:"progress-page page centered"},r.createElement("div",{className:"container"},r.createElement("h1",{className:"title"},e),r.createElement(Wr,qr({},{name:n,text:i,progress:o}))),r.createElement(Vr,null))}var Yr=n(4),Kr=n.n(Yr);function Zr(t,e,n){return t===e||(t.correspondingElement?t.correspondingElement.classList.contains(n):t.classList.contains(n))}var Qr=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}}),n=function(){};return window.addEventListener("testPassiveEventSupport",n,e),window.removeEventListener("testPassiveEventSupport",n,e),t}};var Jr,ti,ei=(void 0===Jr&&(Jr=0),function(){return++Jr}),ni={},ri={},ii=["touchstart","touchmove"],oi="ignore-react-onclickoutside";function ai(t,e){var n=null;return-1!==ii.indexOf(e)&&ti&&(n={passive:!t.props.preventDefault}),n}var si=function(t,e){var n,o;return o=n=function(n){var o,a;function s(t){var e;return(e=n.call(this,t)||this).__outsideClickHandler=function(t){if("function"!=typeof e.__clickOutsideHandlerProp){var n=e.getInstance();if("function"!=typeof n.props.handleClickOutside){if("function"!=typeof n.handleClickOutside)throw new Error("WrappedComponent lacks a handleClickOutside(event) function for processing outside click events.");n.handleClickOutside(t)}else n.props.handleClickOutside(t)}else e.__clickOutsideHandlerProp(t)},e.enableOnClickOutside=function(){if("undefined"!=typeof document&&!ri[e._uid]){void 0===ti&&(ti=Qr()),ri[e._uid]=!0;var t=e.props.eventTypes;t.forEach||(t=[t]),ni[e._uid]=function(t){var n;e.props.disableOnClickOutside||null!==e.componentNode&&(e.props.preventDefault&&t.preventDefault(),e.props.stopPropagation&&t.stopPropagation(),e.props.excludeScrollbar&&(n=t,document.documentElement.clientWidth<=n.clientX||document.documentElement.clientHeight<=n.clientY)||function(t,e,n){if(t===e)return!0;for(;t.parentNode;){if(Zr(t,e,n))return!0;t=t.parentNode}return t}(t.target,e.componentNode,e.props.outsideClickIgnoreClass)===document&&e.__outsideClickHandler(t))},t.forEach(function(t){document.addEventListener(t,ni[e._uid],ai(e,t))})}},e.disableOnClickOutside=function(){delete ri[e._uid];var t=ni[e._uid];if(t&&"undefined"!=typeof document){var n=e.props.eventTypes;n.forEach||(n=[n]),n.forEach(function(n){return document.removeEventListener(n,t,ai(e,n))}),delete ni[e._uid]}},e.getRef=function(t){return e.instanceRef=t},e._uid=ei(),e}a=n,(o=s).prototype=Object.create(a.prototype),o.prototype.constructor=o,o.__proto__=a;var c=s.prototype;return c.getInstance=function(){if(!t.prototype.isReactComponent)return this;var e=this.instanceRef;return e.getInstance?e.getInstance():e},c.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var t=this.getInstance();if(e&&"function"==typeof e.handleClickOutside&&(this.__clickOutsideHandlerProp=e.handleClickOutside(t),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=Object(i.findDOMNode)(this.getInstance()),this.enableOnClickOutside()}},c.componentDidUpdate=function(){this.componentNode=Object(i.findDOMNode)(this.getInstance())},c.componentWillUnmount=function(){this.disableOnClickOutside()},c.render=function(){var e=this.props,n=(e.excludeScrollbar,function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}(e,["excludeScrollbar"]));return t.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(r.createElement)(t,n)},s}(r.Component),n.displayName="OnClickOutside("+(t.displayName||t.name||"Component")+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:e&&e.excludeScrollbar||!1,outsideClickIgnoreClass:oi,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return t.getClass?t.getClass():t},o},ci=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function ui(t){var e=t.children;return r.createElement("label",{className:"form-switch"},r.createElement("input",ci({type:"checkbox"},ci({},t,{children:null}))),r.createElement("i",{className:"form-icon"}),e)}var li,hi=(li=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},function(t,e){function n(){this.constructor=t}li(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),pi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},di=si(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return hi(e,t),e.prototype.handleClickOutside=function(t){this.props.onClickOutside()},e.prototype.render=function(){for(var t=this.props,e=!0,n=0,i=t.descriptors;n<i.length;n++){var o=i[n];if(t.disabled[o]){e=!1;break}}var a=t.descriptors?t.descriptors.map(function(e,n){return r.createElement(ui,{key:n,checked:!t.disabled[e],onChange:function(n){return t.onChangeDesc(e,n.target.checked)}},e)}):null===t.descriptors?r.createElement("div",{className:"toast toast-error"},"failed to load descriptor list"):r.createElement("div",{className:"loading"});return r.createElement("div",{className:"modal-container"},r.createElement("div",{className:"modal-header"},r.createElement("div",{className:"modal-title"},"Descriptor config"),r.createElement(ui,{checked:e,onChange:function(e){return t.onChangeAll(e.target.checked)}},"all")),r.createElement("div",{className:"modal-body"},a),r.createElement("div",{className:"modal-footer"},r.createElement("button",{className:"btn btn-primary",onClick:t.onClick},"Close")))},e}(r.Component)),fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return hi(e,t),e.prototype.render=function(){var t=this.props;return r.createElement("div",{className:Yr("modal descriptor-modal",{active:t.shown})},r.createElement("div",{className:"modal-overlay"}),r.createElement(di,pi({disableOnClickOutside:!t.shown},t)))},e}(r.Component),mi=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),gi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},vi=si(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return mi(e,t),e.prototype.handleClickOutside=function(t){this.props.onClickOutside()},e.prototype.render=function(){var t=this.props,e=gi({},t.buttonProps);for(var n in t.buttonData)t.buttonData.hasOwnProperty(n)&&(e["data-"+n]=t.buttonData[n]);var i=Array.isArray(t.children)?t.children:[t.children];return r.createElement("div",{className:Yr("dropdown",{active:t.active})},r.createElement("button",gi({},e)),r.createElement("ul",{className:"menu"},i.map(function(t,e){return r.createElement("li",{className:"menu-item",key:e},t)})))},e}(r.Component));function yi(t){return r.createElement(vi,{active:t.shown,onClickOutside:t.onClickOutside,buttonData:{tooltip:"Download"},buttonProps:{className:"btn btn-link dropdown-toggle tooltip tooltip-right",onClick:t.onButtonClick,children:r.createElement("i",{className:"fa fa-lg fa-download"})},disableOnClickOutside:!t.shown},t.children)}var bi=n(78),xi=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_i=function(t){function e(e){var n=t.call(this,e)||this;return n.width=0,n.height=0,n.callback=function(){},n}return xi(e,t),e.prototype.handleResize=function(){if(!this.view||!this.stage)throw"MolViewer: handleResize called before mounting component";var t=this.view.clientHeight,e=this.view.clientWidth;this.height===t&&this.width===e||(this.height=t,this.width=e,this.stage.handleResize())},e.prototype.componentDidMount=function(){var t=this.refs.view;this.stage=new bi.a(t,{backgroundColor:this.props.backgroundColor}),this.view=t,this.handleResize(),this.callback=this.handleResize.bind(this),window.addEventListener("resize",this.callback)},e.prototype.componentWillUpdate=function(t,e){var n=this;if(!this.view||!this.stage)throw"MolViewer: componentWillUpdate called before mounting component";this.props.src!==t.src&&(this.stage.handleResize(),this.stage.removeAllComponents(),t.src&&this.stage.loadFile(t.src,t.loaderParams||{}).then(function(t){if(!n.stage)throw"MolViewer: componentWillUpdate called before mounting component";t.addRepresentation("ball+stick",{}),n.stage.autoView(0)}))},e.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.callback)},e.prototype.render=function(){return r.createElement("div",{ref:"view",className:this.props.className})},e}(r.Component);function wi(t){var e=t.mol,n=t.is3D,i=null;void 0===e?i=r.createElement("div",{className:"loading"}):null===e&&(i=r.createElement("i",{className:"failed fa fa-2x fa-times"}));var o=null;return o=n?r.createElement(_i,{backgroundColor:"white",className:"mol-display",src:e||void 0,loaderParams:{ext:"sdf"}}):e?r.createElement("img",{className:"mol-display",src:window.URL.createObjectURL(e)}):r.createElement("div",{className:"mol-display"}),r.createElement("div",{className:"mol-display-wrapper"},i,o)}function Si(t){return r.createElement("div",{className:"mol-view-container"},r.createElement("div",{className:"mol-name"},r.createElement("h4",{className:"text-center"},t.name," ",t.forcefield?r.createElement("span",{className:"forcefield label"},t.forcefield):null)),r.createElement("div",{className:"mol-view"},r.createElement("button",{className:"btn btn-link mol-nav mol-nav-left",disabled:t.current<=0,onClick:t.onClickLeft},r.createElement("i",{className:"fa fa-angle-left fa-2x"})),r.createElement(wi,{mol:t.mol,is3D:t.is3D}),r.createElement("button",{className:"btn btn-link mol-nav mol-nav-right",disabled:t.current>=t.total-1,onClick:t.onClickRight},r.createElement("i",{className:"fa fa-angle-right fa-2x"}))),r.createElement("div",{className:"jump-field text-center"},t.current+1,"/",t.total))}var Ci=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function Ai(t){var e=t.mols[t.current];return r.createElement("div",{className:"file-page page centered"},r.createElement(fi,{shown:t.modalShown,descriptors:t.descriptors||[],disabled:t.disabled,onClickOutside:function(){return t.dispatch(Dn(!1))},onChangeDesc:function(e,n){return t.dispatch(Ln({name:e,enabled:n,store:!0}))},onChangeAll:function(e){return t.dispatch({type:kn,enabled:e})},onClick:function(){return t.dispatch(Dn(!1))}}),r.createElement("div",{className:"top-bar"},r.createElement("div",null,r.createElement("h2",null,t.name),r.createElement(yi,{shown:t.downloadShown,id:t.id||"",onClickOutside:function(){return t.dispatch(In(!1))},onButtonClick:function(){return t.dispatch(In(!t.downloadShown))}},r.createElement("a",{href:"/api/file/"+t.id+".smi"},"SMILES"),r.createElement("a",{href:"/api/file/"+t.id+".sdf"},"SDF"))),r.createElement("div",null,r.createElement(Br,{onClick:function(){return t.dispatch(bn(fn()))}}),r.createElement(Ur,{onClick:function(){return t.dispatch(Dn(!0))}}),r.createElement(Gr,null))),t.file_errors.map(function(e,n){return r.createElement("div",{className:"toast toast-error",key:n},r.createElement("button",{onClick:function(){return t.dispatch(Bn(n))},className:"btn btn-clear float-right"}),e)}),r.createElement(Si,{name:e.name,forcefield:e.forcefield,current:t.current,total:t.total,mol:e.mol,is3D:t.is3D,onClickLeft:function(){return t.dispatch(jn(t.current-1))},onClickRight:function(){return t.dispatch(jn(t.current+1))}}),r.createElement("div",{className:"action text-right calculate-action"},r.createElement("button",{className:"btn btn-primary",disabled:!t.id,onClick:function(){return t.dispatch((e=t.id||"",n=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&t[n]&&e.push(n);return e}(t.disabled),{type:qn,id:e,disabled:n}));var e,n}},"Calculate")),r.createElement(Vr,null))}function Ei(t){var e=function(){return t.dispatch(bn(fn()))};if("not-found"===t.phase)return r.createElement(Hr,{title:"File ID not found",onClickBack:e},t.id);if(t.phase===or||t.phase===ar){var n=t.progress/t.total,i=Math.round(1e4*n)/100;return r.createElement(Xr,{title:t.phase===or?"Pending":"Preparing ...",name:t.name,text:i+"% ("+t.progress+"/"+t.total+")",progress:n})}return t.phase===sr&&t.mols[t.current]?r.createElement(Ai,Ci({},t)):t.phase===cr?r.createElement(Hr,{title:"Error",onClickBack:e,toasts:t.file_errors,onClickError:function(e){return t.dispatch(Bn(e))}}):r.createElement($r,null)}var Mi=n(13);function Ti(t,e){return t.slice(0,e).concat(t.slice(e+1))}var Pi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};var Ii={id:null,notFound:!1,total:0,current:0,name:null,done:!1,file_name:"",file_id:"",descriptorInfo:[],downloadShown:!1,errors:[],sortBy:"index",sortDirection:"ASC"},Ri=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Oi="RESULT:SET_ID";var Li="RESULT:NOT_FOUND";function ki(){return{type:Li}}var Ni="RESULT:UPDATE_STATE";var Di="RESULT:SET_RESULT_INFO";var zi="RESULT:SET_DOWNLOAD_DROPDOWN";var Fi="RESULT:CHANGE_SORT";var Bi="RESULT:CLOSE_ERROR";var Ui=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function ji(){return Ui(this,function(t){switch(t.label){case 0:return[4,Ee(hn,function(t){var e=t.id;return Ui(this,function(t){switch(t.label){case 0:return[4,xe(function(t){return{type:Oi,id:t}}(e))];case 1:return t.sent(),[2]}})})];case 1:return t.sent(),[4,Ee(Oi,function(t){var e,n,r=t.id;return Ui(this,function(t){switch(t.label){case 0:return[4,Se(mr,r)];case 1:e=t.sent(),t.label=2;case 2:return[4,be(e)];case 3:return(n=t.sent()).error?[4,xe(ki())]:[3,5];case 4:return t.sent(),[3,8];case 5:return[4,xe((i=n,Ri({},i,{type:Ni})))];case 6:t.sent(),t.label=7;case 7:return[3,2];case 8:return[2]}var i})})];case 2:return t.sent(),[4,Ee(Ni,function(t){var e,n,r=t.done;return Ui(this,function(t){switch(t.label){case 0:return r?[4,Ae(function(t){return t.result.id})]:[2];case 1:e=t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,Se(gr,e)];case 3:return n=t.sent(),[4,xe((i=n,Ri({type:Di},i)))];case 4:return t.sent(),[3,7];case 5:return t.sent(),[4,xe(ki())];case 6:return t.sent(),[3,7];case 7:return[2]}var i})})];case 3:return t.sent(),[2]}})}var Gi=n(15),Vi=n.n(Gi),Hi=n(6),$i=n.n(Hi),Wi=n(9),qi=n.n(Wi),Xi=n(14),Yi=n.n(Xi),Ki={ASC:"ASC",DESC:"DESC"};function Zi(t){var e=t.sortDirection,n=Kr()("ReactVirtualized__Table__sortableHeaderIcon",{"ReactVirtualized__Table__sortableHeaderIcon--ASC":e===Ki.ASC,"ReactVirtualized__Table__sortableHeaderIcon--DESC":e===Ki.DESC});return r.createElement("svg",{className:n,width:18,height:18,viewBox:"0 0 24 24"},e===Ki.ASC?r.createElement("path",{d:"M7 14l5-5 5 5z"}):r.createElement("path",{d:"M7 10l5 5 5-5z"}),r.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}function Qi(t){var e=t.dataKey,n=t.label,i=t.sortBy,o=t.sortDirection,a=i===e,s=[r.createElement("span",{className:"ReactVirtualized__Table__headerTruncatedText",key:"label",title:n},n)];return a&&s.push(r.createElement(Zi,{key:"SortIndicator",sortDirection:o})),s}Zi.propTypes={},Qi.propTypes=null;var Ji=function(t){function e(){return $i()(this,e),qi()(this,(e.__proto__||Vi()(e)).apply(this,arguments))}return Yi()(e,t),e}(r.Component);Ji.defaultProps={cellDataGetter:function(t){var e=t.dataKey,n=t.rowData;return"function"==typeof n.get?n.get(e):n[e]},cellRenderer:function(t){var e=t.cellData;return null==e?"":String(e)},defaultSortDirection:Ki.ASC,flexGrow:0,flexShrink:1,headerRenderer:Qi,style:{}};var to=Ji;Ji.propTypes={};var eo=n(2),no=n.n(eo),ro=n(8),io=n.n(ro),oo=n(35),ao=n.n(oo);function so(t){var e=t.cellCount,n=t.cellSize,r=t.computeMetadataCallback,i=t.computeMetadataCallbackProps,o=t.nextCellsCount,a=t.nextCellSize,s=t.nextScrollToIndex,c=t.scrollToIndex,u=t.updateScrollOffsetForScrollToIndex;e===o&&("number"!=typeof n&&"number"!=typeof a||n===a)||(r(i),c>=0&&c===s&&u())}var co=n(75),uo=n.n(co),lo=function(){function t(e){var n=e.cellCount,r=e.cellSizeGetter,i=e.estimatedCellSize;$i()(this,t),this._cellSizeAndPositionData={},this._lastMeasuredIndex=-1,this._lastBatchedIndex=-1,this._cellSizeGetter=r,this._cellCount=n,this._estimatedCellSize=i}return io()(t,[{key:"areOffsetsAdjusted",value:function(){return!1}},{key:"configure",value:function(t){var e=t.cellCount,n=t.estimatedCellSize,r=t.cellSizeGetter;this._cellCount=e,this._estimatedCellSize=n,this._cellSizeGetter=r}},{key:"getCellCount",value:function(){return this._cellCount}},{key:"getEstimatedCellSize",value:function(){return this._estimatedCellSize}},{key:"getLastMeasuredIndex",value:function(){return this._lastMeasuredIndex}},{key:"getOffsetAdjustment",value:function(){return 0}},{key:"getSizeAndPositionOfCell",value:function(t){if(t<0||t>=this._cellCount)throw Error("Requested index "+t+" is outside of range 0.."+this._cellCount);if(t>this._lastMeasuredIndex)for(var e=this.getSizeAndPositionOfLastMeasuredCell(),n=e.offset+e.size,r=this._lastMeasuredIndex+1;r<=t;r++){var i=this._cellSizeGetter({index:r});if(void 0===i||isNaN(i))throw Error("Invalid size returned for cell "+r+" of value "+i);null===i?(this._cellSizeAndPositionData[r]={offset:n,size:0},this._lastBatchedIndex=t):(this._cellSizeAndPositionData[r]={offset:n,size:i},n+=i,this._lastMeasuredIndex=t)}return this._cellSizeAndPositionData[t]}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._lastMeasuredIndex>=0?this._cellSizeAndPositionData[this._lastMeasuredIndex]:{offset:0,size:0}}},{key:"getTotalSize",value:function(){var t=this.getSizeAndPositionOfLastMeasuredCell();return t.offset+t.size+(this._cellCount-this._lastMeasuredIndex-1)*this._estimatedCellSize}},{key:"getUpdatedOffsetForIndex",value:function(t){var e=t.align,n=void 0===e?"auto":e,r=t.containerSize,i=t.currentOffset,o=t.targetIndex;if(r<=0)return 0;var a=this.getSizeAndPositionOfCell(o),s=a.offset,c=s-r+a.size,u=void 0;switch(n){case"start":u=s;break;case"end":u=c;break;case"center":u=s-(r-a.size)/2;break;default:u=Math.max(c,Math.min(s,i))}var l=this.getTotalSize();return Math.max(0,Math.min(l-r,u))}},{key:"getVisibleCellRange",value:function(t){var e=t.containerSize,n=t.offset;if(0===this.getTotalSize())return{};var r=n+e,i=this._findNearestCell(n),o=this.getSizeAndPositionOfCell(i);n=o.offset+o.size;for(var a=i;n<r&&a<this._cellCount-1;)a++,n+=this.getSizeAndPositionOfCell(a).size;return{start:i,stop:a}}},{key:"resetCell",value:function(t){this._lastMeasuredIndex=Math.min(this._lastMeasuredIndex,t-1)}},{key:"_binarySearch",value:function(t,e,n){for(;e<=t;){var r=e+Math.floor((t-e)/2),i=this.getSizeAndPositionOfCell(r).offset;if(i===n)return r;i<n?e=r+1:i>n&&(t=r-1)}return e>0?e-1:0}},{key:"_exponentialSearch",value:function(t,e){for(var n=1;t<this._cellCount&&this.getSizeAndPositionOfCell(t).offset<e;)t+=n,n*=2;return this._binarySearch(Math.min(t,this._cellCount-1),Math.floor(t/2),e)}},{key:"_findNearestCell",value:function(t){if(isNaN(t))throw Error("Invalid offset "+t+" specified");t=Math.max(0,t);var e=this.getSizeAndPositionOfLastMeasuredCell(),n=Math.max(0,this._lastMeasuredIndex);return e.offset>=t?this._binarySearch(n,0,t):this._exponentialSearch(n,t)}}]),t}(),ho=function(){return"undefined"!=typeof window&&window.chrome&&window.chrome.webstore?16777100:15e5},po=function(){function t(e){var n=e.maxScrollSize,r=void 0===n?ho():n,i=uo()(e,["maxScrollSize"]);$i()(this,t),this._cellSizeAndPositionManager=new lo(i),this._maxScrollSize=r}return io()(t,[{key:"areOffsetsAdjusted",value:function(){return this._cellSizeAndPositionManager.getTotalSize()>this._maxScrollSize}},{key:"configure",value:function(t){this._cellSizeAndPositionManager.configure(t)}},{key:"getCellCount",value:function(){return this._cellSizeAndPositionManager.getCellCount()}},{key:"getEstimatedCellSize",value:function(){return this._cellSizeAndPositionManager.getEstimatedCellSize()}},{key:"getLastMeasuredIndex",value:function(){return this._cellSizeAndPositionManager.getLastMeasuredIndex()}},{key:"getOffsetAdjustment",value:function(t){var e=t.containerSize,n=t.offset,r=this._cellSizeAndPositionManager.getTotalSize(),i=this.getTotalSize(),o=this._getOffsetPercentage({containerSize:e,offset:n,totalSize:i});return Math.round(o*(i-r))}},{key:"getSizeAndPositionOfCell",value:function(t){return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(t)}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell()}},{key:"getTotalSize",value:function(){return Math.min(this._maxScrollSize,this._cellSizeAndPositionManager.getTotalSize())}},{key:"getUpdatedOffsetForIndex",value:function(t){var e=t.align,n=void 0===e?"auto":e,r=t.containerSize,i=t.currentOffset,o=t.targetIndex;i=this._safeOffsetToOffset({containerSize:r,offset:i});var a=this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({align:n,containerSize:r,currentOffset:i,targetIndex:o});return this._offsetToSafeOffset({containerSize:r,offset:a})}},{key:"getVisibleCellRange",value:function(t){var e=t.containerSize,n=t.offset;return n=this._safeOffsetToOffset({containerSize:e,offset:n}),this._cellSizeAndPositionManager.getVisibleCellRange({containerSize:e,offset:n})}},{key:"resetCell",value:function(t){this._cellSizeAndPositionManager.resetCell(t)}},{key:"_getOffsetPercentage",value:function(t){var e=t.containerSize,n=t.offset,r=t.totalSize;return r<=e?0:n/(r-e)}},{key:"_offsetToSafeOffset",value:function(t){var e=t.containerSize,n=t.offset,r=this._cellSizeAndPositionManager.getTotalSize(),i=this.getTotalSize();if(r===i)return n;var o=this._getOffsetPercentage({containerSize:e,offset:n,totalSize:r});return Math.round(o*(i-e))}},{key:"_safeOffsetToOffset",value:function(t){var e=t.containerSize,n=t.offset,r=this._cellSizeAndPositionManager.getTotalSize(),i=this.getTotalSize();if(r===i)return n;var o=this._getOffsetPercentage({containerSize:e,offset:n,totalSize:i});return Math.round(o*(r-e))}}]),t}(),fo=n(52),mo=n.n(fo);function go(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e={};return function(n){var r=n.callback,i=n.indices,o=mo()(i),a=!t||o.every(function(t){var e=i[t];return Array.isArray(e)?e.length>0:e>=0}),s=o.length!==mo()(e).length||o.some(function(t){var n=e[t],r=i[t];return Array.isArray(r)?n.join(",")!==r.join(","):n!==r});e=i,a&&s&&r(i)}}var vo=1;function yo(t){var e=t.cellSize,n=t.cellSizeAndPositionManager,r=t.previousCellsCount,i=t.previousCellSize,o=t.previousScrollToAlignment,a=t.previousScrollToIndex,s=t.previousSize,c=t.scrollOffset,u=t.scrollToAlignment,l=t.scrollToIndex,h=t.size,p=t.sizeJustIncreasedFromZero,d=t.updateScrollIndexCallback,f=n.getCellCount(),m=l>=0&&l<f;m&&(h!==s||p||!i||"number"==typeof e&&e!==i||u!==o||l!==a)?d(l):!m&&f>0&&(h<s||f<r)&&c>n.getTotalSize()-h&&d(f-1)}var bo=n(77),xo=n.n(bo),_o=n(76),wo=n.n(_o),So=void 0,Co=(So="undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).requestAnimationFrame||So.webkitRequestAnimationFrame||So.mozRequestAnimationFrame||So.oRequestAnimationFrame||So.msRequestAnimationFrame||function(t){return So.setTimeout(t,1e3/60)},Ao=So.cancelAnimationFrame||So.webkitCancelAnimationFrame||So.mozCancelAnimationFrame||So.oCancelAnimationFrame||So.msCancelAnimationFrame||function(t){So.clearTimeout(t)},Eo=function(t){return Ao(t.id)},Mo="observed",To="requested",Po=function(t){function e(t){$i()(this,e);var n=qi()(this,(e.__proto__||Vi()(e)).call(this,t));n._onGridRenderedMemoizer=go(),n._onScrollMemoizer=go(!1),n._deferredInvalidateColumnIndex=null,n._deferredInvalidateRowIndex=null,n._recomputeScrollLeftFlag=!1,n._recomputeScrollTopFlag=!1,n._horizontalScrollBarSize=0,n._verticalScrollBarSize=0,n._scrollbarPresenceChanged=!1,n._renderedColumnStartIndex=0,n._renderedColumnStopIndex=0,n._renderedRowStartIndex=0,n._renderedRowStopIndex=0,n._styleCache={},n._cellCache={},n._debounceScrollEndedCallback=function(){n._disablePointerEventsTimeoutId=null,n.setState({isScrolling:!1,needToResetStyleCache:!1})},n._invokeOnGridRenderedHelper=function(){var t=n.props.onSectionRendered;n._onGridRenderedMemoizer({callback:t,indices:{columnOverscanStartIndex:n._columnStartIndex,columnOverscanStopIndex:n._columnStopIndex,columnStartIndex:n._renderedColumnStartIndex,columnStopIndex:n._renderedColumnStopIndex,rowOverscanStartIndex:n._rowStartIndex,rowOverscanStopIndex:n._rowStopIndex,rowStartIndex:n._renderedRowStartIndex,rowStopIndex:n._renderedRowStopIndex}})},n._setScrollingContainerRef=function(t){n._scrollingContainer=t},n._onScroll=function(t){t.target===n._scrollingContainer&&n.handleScrollEvent(t.target)};var r=new po({cellCount:t.columnCount,cellSizeGetter:function(n){return e._wrapSizeGetter(t.columnWidth)(n)},estimatedCellSize:e._getEstimatedColumnSize(t)}),i=new po({cellCount:t.rowCount,cellSizeGetter:function(n){return e._wrapSizeGetter(t.rowHeight)(n)},estimatedCellSize:e._getEstimatedRowSize(t)});return n.state={instanceProps:{columnSizeAndPositionManager:r,rowSizeAndPositionManager:i,prevColumnWidth:t.columnWidth,prevRowHeight:t.rowHeight,prevColumnCount:t.columnCount,prevRowCount:t.rowCount,prevIsScrolling:!0===t.isScrolling,prevScrollToColumn:t.scrollToColumn,prevScrollToRow:t.scrollToRow,scrollbarSize:0,scrollbarSizeMeasured:!1},isScrolling:!1,scrollDirectionHorizontal:vo,scrollDirectionVertical:vo,scrollLeft:0,scrollTop:0,scrollPositionChangeReason:null,needToResetStyleCache:!1},t.scrollToRow>0&&(n._initialScrollTop=n._getCalculatedScrollTop(t,n.state)),t.scrollToColumn>0&&(n._initialScrollLeft=n._getCalculatedScrollLeft(t,n.state)),n}return Yi()(e,t),io()(e,[{key:"getOffsetForCell",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.alignment,n=void 0===e?this.props.scrollToAlignment:e,r=t.columnIndex,i=void 0===r?this.props.scrollToColumn:r,o=t.rowIndex,a=void 0===o?this.props.scrollToRow:o,s=no()({},this.props,{scrollToAlignment:n,scrollToColumn:i,scrollToRow:a});return{scrollLeft:this._getCalculatedScrollLeft(s),scrollTop:this._getCalculatedScrollTop(s)}}},{key:"getTotalRowsHeight",value:function(){return this.state.instanceProps.rowSizeAndPositionManager.getTotalSize()}},{key:"getTotalColumnsWidth",value:function(){return this.state.instanceProps.columnSizeAndPositionManager.getTotalSize()}},{key:"handleScrollEvent",value:function(t){var e=t.scrollLeft,n=void 0===e?0:e,r=t.scrollTop,i=void 0===r?0:r;if(!(i<0)){this._debounceScrollEnded();var o=this.props,a=o.autoHeight,s=o.autoWidth,c=o.height,u=o.width,l=this.state.instanceProps,h=l.scrollbarSize,p=l.rowSizeAndPositionManager.getTotalSize(),d=l.columnSizeAndPositionManager.getTotalSize(),f=Math.min(Math.max(0,d-u+h),n),m=Math.min(Math.max(0,p-c+h),i);if(this.state.scrollLeft!==f||this.state.scrollTop!==m){var g={isScrolling:!0,scrollDirectionHorizontal:f!==this.state.scrollLeft?f>this.state.scrollLeft?vo:-1:this.state.scrollDirectionHorizontal,scrollDirectionVertical:m!==this.state.scrollTop?m>this.state.scrollTop?vo:-1:this.state.scrollDirectionVertical,scrollPositionChangeReason:Mo};a||(g.scrollTop=m),s||(g.scrollLeft=f),g.needToResetStyleCache=!1,this.setState(g)}this._invokeOnScrollMemoizer({scrollLeft:f,scrollTop:m,totalColumnsWidth:d,totalRowsHeight:p})}}},{key:"invalidateCellSizeAfterRender",value:function(t){var e=t.columnIndex,n=t.rowIndex;this._deferredInvalidateColumnIndex="number"==typeof this._deferredInvalidateColumnIndex?Math.min(this._deferredInvalidateColumnIndex,e):e,this._deferredInvalidateRowIndex="number"==typeof this._deferredInvalidateRowIndex?Math.min(this._deferredInvalidateRowIndex,n):n}},{key:"measureAllCells",value:function(){var t=this.props,e=t.columnCount,n=t.rowCount,r=this.state.instanceProps;r.columnSizeAndPositionManager.getSizeAndPositionOfCell(e-1),r.rowSizeAndPositionManager.getSizeAndPositionOfCell(n-1)}},{key:"recomputeGridSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.columnIndex,n=void 0===e?0:e,r=t.rowIndex,i=void 0===r?0:r,o=this.props,a=o.scrollToColumn,s=o.scrollToRow,c=this.state.instanceProps;c.columnSizeAndPositionManager.resetCell(n),c.rowSizeAndPositionManager.resetCell(i),this._recomputeScrollLeftFlag=a>=0&&n<=a,this._recomputeScrollTopFlag=s>=0&&i<=s,this._styleCache={},this._cellCache={},this.forceUpdate()}},{key:"scrollToCell",value:function(t){var e=t.columnIndex,n=t.rowIndex,r=this.props.columnCount,i=this.props;r>1&&void 0!==e&&this._updateScrollLeftForScrollToColumn(no()({},i,{scrollToColumn:e})),void 0!==n&&this._updateScrollTopForScrollToRow(no()({},i,{scrollToRow:n}))}},{key:"componentDidMount",value:function(){var t=this.props,n=t.getScrollbarSize,r=t.height,i=t.scrollLeft,o=t.scrollToColumn,a=t.scrollTop,s=t.scrollToRow,c=t.width,u=this.state.instanceProps;this._initialScrollTop=0,this._initialScrollLeft=0,this._handleInvalidatedGridSize(),u.scrollbarSizeMeasured||this.setState(function(t){return t.instanceProps.scrollbarSize=n(),t.instanceProps.scrollbarSizeMeasured=!0,t.needToResetStyleCache=!1,t}),("number"==typeof i&&i>=0||"number"==typeof a&&a>=0)&&this.setState(function(t){var n=e._getScrollToPositionStateUpdate({prevState:t,scrollLeft:i,scrollTop:a});return n?(n.needToResetStyleCache=!1,n):null}),this._scrollingContainer.scrollLeft!==this.state.scrollLeft&&(this._scrollingContainer.scrollLeft=this.state.scrollLeft),this._scrollingContainer.scrollTop!==this.state.scrollTop&&(this._scrollingContainer.scrollTop=this.state.scrollTop);var l=r>0&&c>0;o>=0&&l&&this._updateScrollLeftForScrollToColumn(),s>=0&&l&&this._updateScrollTopForScrollToRow(),this._invokeOnGridRenderedHelper(),this._invokeOnScrollMemoizer({scrollLeft:i||0,scrollTop:a||0,totalColumnsWidth:u.columnSizeAndPositionManager.getTotalSize(),totalRowsHeight:u.rowSizeAndPositionManager.getTotalSize()}),this._maybeCallOnScrollbarPresenceChange()}},{key:"componentDidUpdate",value:function(t,e){var n=this,r=this.props,i=r.autoHeight,o=r.autoWidth,a=r.columnCount,s=r.height,c=r.rowCount,u=r.scrollToAlignment,l=r.scrollToColumn,h=r.scrollToRow,p=r.width,d=this.state,f=d.scrollLeft,m=d.scrollPositionChangeReason,g=d.scrollTop,v=d.instanceProps;this._handleInvalidatedGridSize();var y=a>0&&0===t.columnCount||c>0&&0===t.rowCount;m===To&&(!o&&f>=0&&(f!==this._scrollingContainer.scrollLeft||y)&&(this._scrollingContainer.scrollLeft=f),!i&&g>=0&&(g!==this._scrollingContainer.scrollTop||y)&&(this._scrollingContainer.scrollTop=g));var b=(0===t.width||0===t.height)&&s>0&&p>0;if(this._recomputeScrollLeftFlag?(this._recomputeScrollLeftFlag=!1,this._updateScrollLeftForScrollToColumn(this.props)):yo({cellSizeAndPositionManager:v.columnSizeAndPositionManager,previousCellsCount:t.columnCount,previousCellSize:t.columnWidth,previousScrollToAlignment:t.scrollToAlignment,previousScrollToIndex:t.scrollToColumn,previousSize:t.width,scrollOffset:f,scrollToAlignment:u,scrollToIndex:l,size:p,sizeJustIncreasedFromZero:b,updateScrollIndexCallback:function(){return n._updateScrollLeftForScrollToColumn(n.props)}}),this._recomputeScrollTopFlag?(this._recomputeScrollTopFlag=!1,this._updateScrollTopForScrollToRow(this.props)):yo({cellSizeAndPositionManager:v.rowSizeAndPositionManager,previousCellsCount:t.rowCount,previousCellSize:t.rowHeight,previousScrollToAlignment:t.scrollToAlignment,previousScrollToIndex:t.scrollToRow,previousSize:t.height,scrollOffset:g,scrollToAlignment:u,scrollToIndex:h,size:s,sizeJustIncreasedFromZero:b,updateScrollIndexCallback:function(){return n._updateScrollTopForScrollToRow(n.props)}}),this._invokeOnGridRenderedHelper(),f!==e.scrollLeft||g!==e.scrollTop){var x=v.rowSizeAndPositionManager.getTotalSize(),_=v.columnSizeAndPositionManager.getTotalSize();this._invokeOnScrollMemoizer({scrollLeft:f,scrollTop:g,totalColumnsWidth:_,totalRowsHeight:x})}this._maybeCallOnScrollbarPresenceChange()}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&Eo(this._disablePointerEventsTimeoutId)}},{key:"render",value:function(){var t=this.props,e=t.autoContainerWidth,n=t.autoHeight,i=t.autoWidth,o=t.className,a=t.containerProps,s=t.containerRole,c=t.containerStyle,u=t.height,l=t.id,h=t.noContentRenderer,p=t.role,d=t.style,f=t.tabIndex,m=t.width,g=this.state,v=g.instanceProps,y=g.needToResetStyleCache,b=this._isScrolling(),x={boxSizing:"border-box",direction:"ltr",height:n?"auto":u,position:"relative",width:i?"auto":m,WebkitOverflowScrolling:"touch",willChange:"transform"};y&&(this._styleCache={}),this.state.isScrolling||this._resetStyleCache(),this._calculateChildrenToRender(this.props,this.state);var _=v.columnSizeAndPositionManager.getTotalSize(),w=v.rowSizeAndPositionManager.getTotalSize(),S=w>u?v.scrollbarSize:0,C=_>m?v.scrollbarSize:0;C===this._horizontalScrollBarSize&&S===this._verticalScrollBarSize||(this._horizontalScrollBarSize=C,this._verticalScrollBarSize=S,this._scrollbarPresenceChanged=!0),x.overflowX=_+S<=m?"hidden":"auto",x.overflowY=w+C<=u?"hidden":"auto";var A=this._childrenToDisplay,E=0===A.length&&u>0&&m>0;return r.createElement("div",no()({ref:this._setScrollingContainerRef},a,{"aria-label":this.props["aria-label"],"aria-readonly":this.props["aria-readonly"],className:Kr()("ReactVirtualized__Grid",o),id:l,onScroll:this._onScroll,role:p,style:no()({},x,d),tabIndex:f}),A.length>0&&r.createElement("div",{className:"ReactVirtualized__Grid__innerScrollContainer",role:s,style:no()({width:e?"auto":_,height:w,maxWidth:_,maxHeight:w,overflow:"hidden",pointerEvents:b?"none":"",position:"relative"},c)},A),E&&h())}},{key:"_calculateChildrenToRender",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=t.cellRenderer,r=t.cellRangeRenderer,i=t.columnCount,o=t.deferredMeasurementCache,a=t.height,s=t.overscanColumnCount,c=t.overscanIndicesGetter,u=t.overscanRowCount,l=t.rowCount,h=t.width,p=e.scrollDirectionHorizontal,d=e.scrollDirectionVertical,f=e.instanceProps,m=this._initialScrollTop>0?this._initialScrollTop:e.scrollTop,g=this._initialScrollLeft>0?this._initialScrollLeft:e.scrollLeft,v=this._isScrolling(t,e);if(this._childrenToDisplay=[],a>0&&h>0){var y=f.columnSizeAndPositionManager.getVisibleCellRange({containerSize:h,offset:g}),b=f.rowSizeAndPositionManager.getVisibleCellRange({containerSize:a,offset:m}),x=f.columnSizeAndPositionManager.getOffsetAdjustment({containerSize:h,offset:g}),_=f.rowSizeAndPositionManager.getOffsetAdjustment({containerSize:a,offset:m});this._renderedColumnStartIndex=y.start,this._renderedColumnStopIndex=y.stop,this._renderedRowStartIndex=b.start,this._renderedRowStopIndex=b.stop;var w=c({direction:"horizontal",cellCount:i,overscanCellsCount:s,scrollDirection:p,startIndex:"number"==typeof y.start?y.start:0,stopIndex:"number"==typeof y.stop?y.stop:-1}),S=c({direction:"vertical",cellCount:l,overscanCellsCount:u,scrollDirection:d,startIndex:"number"==typeof b.start?b.start:0,stopIndex:"number"==typeof b.stop?b.stop:-1}),C=w.overscanStartIndex,A=w.overscanStopIndex,E=S.overscanStartIndex,M=S.overscanStopIndex;if(o){if(!o.hasFixedHeight())for(var T=E;T<=M;T++)if(!o.has(T,0)){C=0,A=i-1;break}if(!o.hasFixedWidth())for(var P=C;P<=A;P++)if(!o.has(0,P)){E=0,M=l-1;break}}this._childrenToDisplay=r({cellCache:this._cellCache,cellRenderer:n,columnSizeAndPositionManager:f.columnSizeAndPositionManager,columnStartIndex:C,columnStopIndex:A,deferredMeasurementCache:o,horizontalOffsetAdjustment:x,isScrolling:v,parent:this,rowSizeAndPositionManager:f.rowSizeAndPositionManager,rowStartIndex:E,rowStopIndex:M,scrollLeft:g,scrollTop:m,styleCache:this._styleCache,verticalOffsetAdjustment:_,visibleColumnIndices:y,visibleRowIndices:b}),this._columnStartIndex=C,this._columnStopIndex=A,this._rowStartIndex=E,this._rowStopIndex=M}}},{key:"_debounceScrollEnded",value:function(){var t,e,n,r,i=this.props.scrollingResetTimeInterval;this._disablePointerEventsTimeoutId&&Eo(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=(t=this._debounceScrollEndedCallback,e=i,n=Date.now(),r={id:Co(function i(){Date.now()-n>=e?t.call():r.id=Co(i)})})}},{key:"_handleInvalidatedGridSize",value:function(){if("number"==typeof this._deferredInvalidateColumnIndex&&"number"==typeof this._deferredInvalidateRowIndex){var t=this._deferredInvalidateColumnIndex,e=this._deferredInvalidateRowIndex;this._deferredInvalidateColumnIndex=null,this._deferredInvalidateRowIndex=null,this.recomputeGridSize({columnIndex:t,rowIndex:e})}}},{key:"_invokeOnScrollMemoizer",value:function(t){var e=this,n=t.scrollLeft,r=t.scrollTop,i=t.totalColumnsWidth,o=t.totalRowsHeight;this._onScrollMemoizer({callback:function(t){var n=t.scrollLeft,r=t.scrollTop,a=e.props,s=a.height;(0,a.onScroll)({clientHeight:s,clientWidth:a.width,scrollHeight:o,scrollLeft:n,scrollTop:r,scrollWidth:i})},indices:{scrollLeft:n,scrollTop:r}})}},{key:"_isScrolling",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return Object.hasOwnProperty.call(t,"isScrolling")?Boolean(t.isScrolling):Boolean(e.isScrolling)}},{key:"_maybeCallOnScrollbarPresenceChange",value:function(){if(this._scrollbarPresenceChanged){var t=this.props.onScrollbarPresenceChange;this._scrollbarPresenceChanged=!1,t({horizontal:this._horizontalScrollBarSize>0,size:this.state.instanceProps.scrollbarSize,vertical:this._verticalScrollBarSize>0})}}},{key:"scrollToPosition",value:function(t){var n=t.scrollLeft,r=t.scrollTop;this.setState(function(t){var i=e._getScrollToPositionStateUpdate({prevState:t,scrollLeft:n,scrollTop:r});return i?(i.needToResetStyleCache=!1,i):null})}},{key:"_getCalculatedScrollLeft",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return e._getCalculatedScrollLeft(t,n)}},{key:"_updateScrollLeftForScrollToColumn",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,r=e._getScrollLeftForScrollToColumnStateUpdate(t,n);r&&(r.needToResetStyleCache=!1),this.setState(r)}},{key:"_getCalculatedScrollTop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return e._getCalculatedScrollTop(t,n)}},{key:"_resetStyleCache",value:function(){var t=this._styleCache;this._cellCache={},this._styleCache={};for(var e=this._rowStartIndex;e<=this._rowStopIndex;e++)for(var n=this._columnStartIndex;n<=this._columnStopIndex;n++){var r=e+"-"+n;this._styleCache[r]=t[r]}}},{key:"_updateScrollTopForScrollToRow",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,r=e._getScrollTopForScrollToRowStateUpdate(t,n);r&&(r.needToResetStyleCache=!1),this.setState(r)}}],[{key:"getDerivedStateFromProps",value:function(t,n){var r={};0===t.columnCount&&0!==n.scrollLeft||0===t.rowCount&&0!==n.scrollTop?(r.scrollLeft=0,r.scrollTop=0):t.scrollLeft===n.scrollLeft&&t.scrollTop===n.scrollTop||t.scrollToColumn>0&&n.scrollLeft&&0===t.scrollLeft||t.scrollToRow>0&&n.scrollTop&&0===t.scrollTop||ao()(r,e._getScrollToPositionStateUpdate({prevState:n,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}));var i=n.instanceProps;r.needToResetStyleCache=!1,t.columnWidth===i.prevColumnWidth&&t.rowHeight===i.prevRowHeight||(r.needToResetStyleCache=!0),i.columnSizeAndPositionManager.configure({cellCount:t.columnCount,estimatedCellSize:e._getEstimatedColumnSize(t),cellSizeGetter:e._wrapSizeGetter(t.columnWidth)}),i.rowSizeAndPositionManager.configure({cellCount:t.rowCount,estimatedCellSize:e._getEstimatedRowSize(t),cellSizeGetter:e._wrapSizeGetter(t.rowHeight)}),0!==i.prevColumnCount&&0!==i.prevRowCount||(i.prevColumnCount=0,i.prevRowCount=0),t.autoHeight&&!1===t.isScrolling&&!0===i.prevIsScrolling&&ao()(r,{isScrolling:!1});var o=void 0,a=void 0;return so({cellCount:i.prevColumnCount,cellSize:"number"==typeof i.prevColumnWidth?i.prevColumnWidth:null,computeMetadataCallback:function(){return i.columnSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:t,nextCellsCount:t.columnCount,nextCellSize:"number"==typeof t.columnWidth?t.columnWidth:null,nextScrollToIndex:t.scrollToColumn,scrollToIndex:i.prevScrollToColumn,updateScrollOffsetForScrollToIndex:function(){o=e._getScrollLeftForScrollToColumnStateUpdate(t,n)}}),so({cellCount:i.prevRowCount,cellSize:"number"==typeof i.prevRowHeight?i.prevRowHeight:null,computeMetadataCallback:function(){return i.rowSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:t,nextCellsCount:t.rowCount,nextCellSize:"number"==typeof t.rowHeight?t.rowHeight:null,nextScrollToIndex:t.scrollToRow,scrollToIndex:i.prevScrollToRow,updateScrollOffsetForScrollToIndex:function(){a=e._getScrollTopForScrollToRowStateUpdate(t,n)}}),i.prevColumnCount=t.columnCount,i.prevColumnWidth=t.columnWidth,i.prevIsScrolling=!0===t.isScrolling,i.prevRowCount=t.rowCount,i.prevRowHeight=t.rowHeight,i.prevScrollToColumn=t.scrollToColumn,i.prevScrollToRow=t.scrollToRow,i.scrollbarSize=t.getScrollbarSize(),void 0===i.scrollbarSize?(i.scrollbarSizeMeasured=!1,i.scrollbarSize=0):i.scrollbarSizeMeasured=!0,r.instanceProps=i,no()({},r,o,a)}},{key:"_getEstimatedColumnSize",value:function(t){return"number"==typeof t.columnWidth?t.columnWidth:t.estimatedColumnSize}},{key:"_getEstimatedRowSize",value:function(t){return"number"==typeof t.rowHeight?t.rowHeight:t.estimatedRowSize}},{key:"_getScrollToPositionStateUpdate",value:function(t){var e=t.prevState,n=t.scrollLeft,r=t.scrollTop,i={scrollPositionChangeReason:To};return"number"==typeof n&&n>=0&&(i.scrollDirectionHorizontal=n>e.scrollLeft?vo:-1,i.scrollLeft=n),"number"==typeof r&&r>=0&&(i.scrollDirectionVertical=r>e.scrollTop?vo:-1,i.scrollTop=r),"number"==typeof n&&n>=0&&n!==e.scrollLeft||"number"==typeof r&&r>=0&&r!==e.scrollTop?i:null}},{key:"_wrapSizeGetter",value:function(t){return"function"==typeof t?t:function(){return t}}},{key:"_getCalculatedScrollLeft",value:function(t,e){var n=t.columnCount,r=t.height,i=t.scrollToAlignment,o=t.scrollToColumn,a=t.width,s=e.scrollLeft,c=e.instanceProps;if(n>0){var u=n-1,l=o<0?u:Math.min(u,o),h=c.rowSizeAndPositionManager.getTotalSize(),p=c.scrollbarSizeMeasured&&h>r?c.scrollbarSize:0;return c.columnSizeAndPositionManager.getUpdatedOffsetForIndex({align:i,containerSize:a-p,currentOffset:s,targetIndex:l})}return 0}},{key:"_getScrollLeftForScrollToColumnStateUpdate",value:function(t,n){var r=n.scrollLeft,i=e._getCalculatedScrollLeft(t,n);return"number"==typeof i&&i>=0&&r!==i?e._getScrollToPositionStateUpdate({prevState:n,scrollLeft:i,scrollTop:-1}):null}},{key:"_getCalculatedScrollTop",value:function(t,e){var n=t.height,r=t.rowCount,i=t.scrollToAlignment,o=t.scrollToRow,a=t.width,s=e.scrollTop,c=e.instanceProps;if(r>0){var u=r-1,l=o<0?u:Math.min(u,o),h=c.columnSizeAndPositionManager.getTotalSize(),p=c.scrollbarSizeMeasured&&h>a?c.scrollbarSize:0;return c.rowSizeAndPositionManager.getUpdatedOffsetForIndex({align:i,containerSize:n-p,currentOffset:s,targetIndex:l})}return 0}},{key:"_getScrollTopForScrollToRowStateUpdate",value:function(t,n){var r=n.scrollTop,i=e._getCalculatedScrollTop(t,n);return"number"==typeof i&&i>=0&&r!==i?e._getScrollToPositionStateUpdate({prevState:n,scrollLeft:-1,scrollTop:i}):null}}]),e}(r.PureComponent);Po.defaultProps={"aria-label":"grid","aria-readonly":!0,autoContainerWidth:!1,autoHeight:!1,autoWidth:!1,cellRangeRenderer:function(t){for(var e=t.cellCache,n=t.cellRenderer,r=t.columnSizeAndPositionManager,i=t.columnStartIndex,o=t.columnStopIndex,a=t.deferredMeasurementCache,s=t.horizontalOffsetAdjustment,c=t.isScrolling,u=t.parent,l=t.rowSizeAndPositionManager,h=t.rowStartIndex,p=t.rowStopIndex,d=t.styleCache,f=t.verticalOffsetAdjustment,m=t.visibleColumnIndices,g=t.visibleRowIndices,v=[],y=r.areOffsetsAdjusted()||l.areOffsetsAdjusted(),b=!c&&!y,x=h;x<=p;x++)for(var _=l.getSizeAndPositionOfCell(x),w=i;w<=o;w++){var S=r.getSizeAndPositionOfCell(w),C=w>=m.start&&w<=m.stop&&x>=g.start&&x<=g.stop,A=x+"-"+w,E=void 0;b&&d[A]?E=d[A]:a&&!a.has(x,w)?E={height:"auto",left:0,position:"absolute",top:0,width:"auto"}:(E={height:_.size,left:S.offset+s,position:"absolute",top:_.offset+f,width:S.size},d[A]=E);var M={columnIndex:w,isScrolling:c,isVisible:C,key:A,parent:u,rowIndex:x,style:E},T=void 0;!c||s||f?T=n(M):(e[A]||(e[A]=n(M)),T=e[A]),null!=T&&!1!==T&&v.push(T)}return v},containerRole:"rowgroup",containerStyle:{},estimatedColumnSize:100,estimatedRowSize:30,getScrollbarSize:xo.a,noContentRenderer:function(){return null},onScroll:function(){},onScrollbarPresenceChange:function(){},onSectionRendered:function(){},overscanColumnCount:0,overscanIndicesGetter:function(t){var e=t.cellCount,n=t.overscanCellsCount,r=t.scrollDirection,i=t.startIndex,o=t.stopIndex;return r===vo?{overscanStartIndex:Math.max(0,i),overscanStopIndex:Math.min(e-1,o+n)}:{overscanStartIndex:Math.max(0,i-n),overscanStopIndex:Math.min(e-1,o)}},overscanRowCount:10,role:"grid",scrollingResetTimeInterval:150,scrollToAlignment:"auto",scrollToColumn:-1,scrollToRow:-1,style:{},tabIndex:0},Po.propTypes=null,wo()(Po);var Io=Po,Ro=1;function Oo(t){var e=t.className,n=t.columns,i=t.index,o=t.key,a=t.onRowClick,s=t.onRowDoubleClick,c=t.onRowMouseOut,u=t.onRowMouseOver,l=t.onRowRightClick,h=t.rowData,p=t.style,d={};return(a||s||c||u||l)&&(d["aria-label"]="row",d.tabIndex=0,a&&(d.onClick=function(t){return a({event:t,index:i,rowData:h})}),s&&(d.onDoubleClick=function(t){return s({event:t,index:i,rowData:h})}),c&&(d.onMouseOut=function(t){return c({event:t,index:i,rowData:h})}),u&&(d.onMouseOver=function(t){return u({event:t,index:i,rowData:h})}),l&&(d.onContextMenu=function(t){return l({event:t,index:i,rowData:h})})),r.createElement("div",no()({},d,{className:e,key:o,role:"row",style:p}),n)}function Lo(t){var e=t.className,n=t.columns,i=t.style;return r.createElement("div",{className:e,role:"row",style:i},n)}Oo.propTypes=null,Lo.propTypes=null;var ko=function(t){function e(t){$i()(this,e);var n=qi()(this,(e.__proto__||Vi()(e)).call(this,t));return n.state={scrollbarWidth:0},n._createColumn=n._createColumn.bind(n),n._createRow=n._createRow.bind(n),n._onScroll=n._onScroll.bind(n),n._onSectionRendered=n._onSectionRendered.bind(n),n._setRef=n._setRef.bind(n),n}return Yi()(e,t),io()(e,[{key:"forceUpdateGrid",value:function(){this.Grid&&this.Grid.forceUpdate()}},{key:"getOffsetForRow",value:function(t){var e=t.alignment,n=t.index;return this.Grid?this.Grid.getOffsetForCell({alignment:e,rowIndex:n}).scrollTop:0}},{key:"invalidateCellSizeAfterRender",value:function(t){var e=t.columnIndex,n=t.rowIndex;this.Grid&&this.Grid.invalidateCellSizeAfterRender({rowIndex:n,columnIndex:e})}},{key:"measureAllRows",value:function(){this.Grid&&this.Grid.measureAllCells()}},{key:"recomputeGridSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.columnIndex,n=void 0===e?0:e,r=t.rowIndex,i=void 0===r?0:r;this.Grid&&this.Grid.recomputeGridSize({rowIndex:i,columnIndex:n})}},{key:"recomputeRowHeights",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:t})}},{key:"scrollToPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:t})}},{key:"scrollToRow",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:t})}},{key:"componentDidMount",value:function(){this._setScrollbarWidth()}},{key:"componentDidUpdate",value:function(){this._setScrollbarWidth()}},{key:"render",value:function(){var t=this,e=this.props,n=e.children,i=e.className,o=e.disableHeader,a=e.gridClassName,s=e.gridStyle,c=e.headerHeight,u=e.headerRowRenderer,l=e.height,h=e.id,p=e.noRowsRenderer,d=e.rowClassName,f=e.rowStyle,m=e.scrollToIndex,g=e.style,v=e.width,y=this.state.scrollbarWidth,b=o?l:l-c,x="function"==typeof d?d({index:-1}):d,_="function"==typeof f?f({index:-1}):f;return this._cachedColumnStyles=[],r.Children.toArray(n).forEach(function(e,n){var r=t._getFlexStyleForColumn(e,e.props.style);t._cachedColumnStyles[n]=no()({},r,{overflow:"hidden"})}),r.createElement("div",{className:Kr()("ReactVirtualized__Table",i),id:h,role:"grid",style:g},!o&&u({className:Kr()("ReactVirtualized__Table__headerRow",x),columns:this._getHeaderColumns(),style:no()({},_,{height:c,overflow:"hidden",paddingRight:y,width:v})}),r.createElement(Io,no()({},this.props,{autoContainerWidth:!0,className:Kr()("ReactVirtualized__Table__Grid",a),cellRenderer:this._createRow,columnWidth:v,columnCount:1,height:b,id:void 0,noContentRenderer:p,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,role:"rowgroup",scrollbarWidth:y,scrollToRow:m,style:no()({},s,{overflowX:"hidden"})})))}},{key:"_createColumn",value:function(t){var e=t.column,n=t.columnIndex,i=t.isScrolling,o=t.parent,a=t.rowData,s=t.rowIndex,c=e.props,u=c.cellDataGetter,l=c.cellRenderer,h=c.className,p=c.columnData,d=c.dataKey,f=c.id,m=l({cellData:u({columnData:p,dataKey:d,rowData:a}),columnData:p,columnIndex:n,dataKey:d,isScrolling:i,parent:o,rowData:a,rowIndex:s}),g=this._cachedColumnStyles[n],v="string"==typeof m?m:null;return r.createElement("div",{"aria-describedby":f,className:Kr()("ReactVirtualized__Table__rowColumn",h),key:"Row"+s+"-Col"+n,role:"gridcell",style:g,title:v},m)}},{key:"_createHeader",value:function(t){var e=t.column,n=t.index,i=this.props,o=i.headerClassName,a=i.headerStyle,s=i.onHeaderClick,c=i.sort,u=i.sortBy,l=i.sortDirection,h=e.props,p=h.columnData,d=h.dataKey,f=h.defaultSortDirection,m=h.disableSort,g=h.headerRenderer,v=h.id,y=h.label,b=!m&&c,x=Kr()("ReactVirtualized__Table__headerColumn",o,e.props.headerClassName,{ReactVirtualized__Table__sortableHeaderColumn:b}),_=this._getFlexStyleForColumn(e,no()({},a,e.props.headerStyle)),w=g({columnData:p,dataKey:d,disableSort:m,label:y,sortBy:u,sortDirection:l}),S=void 0,C=void 0,A=void 0,E=void 0,M=void 0;if(b||s){var T=u!==d?f:l===Ki.DESC?Ki.ASC:Ki.DESC,P=function(t){b&&c({defaultSortDirection:f,event:t,sortBy:d,sortDirection:T}),s&&s({columnData:p,dataKey:d,event:t})};M=e.props["aria-label"]||y||d,A=0,S=P,C=function(t){"Enter"!==t.key&&" "!==t.key||P(t)}}return u===d&&(E=l===Ki.ASC?"ascending":"descending"),r.createElement("div",{"aria-label":M,"aria-sort":E,className:x,id:v,key:"Header-Col"+n,onClick:S,onKeyDown:C,role:"columnheader",style:_,tabIndex:A},w)}},{key:"_createRow",value:function(t){var e=this,n=t.rowIndex,i=t.isScrolling,o=t.key,a=t.parent,s=t.style,c=this.props,u=c.children,l=c.onRowClick,h=c.onRowDoubleClick,p=c.onRowRightClick,d=c.onRowMouseOver,f=c.onRowMouseOut,m=c.rowClassName,g=c.rowGetter,v=c.rowRenderer,y=c.rowStyle,b=this.state.scrollbarWidth,x="function"==typeof m?m({index:n}):m,_="function"==typeof y?y({index:n}):y,w=g({index:n}),S=r.Children.toArray(u).map(function(t,r){return e._createColumn({column:t,columnIndex:r,isScrolling:i,parent:a,rowData:w,rowIndex:n,scrollbarWidth:b})}),C=Kr()("ReactVirtualized__Table__row",x),A=no()({},s,_,{height:this._getRowHeight(n),overflow:"hidden",paddingRight:b});return v({className:C,columns:S,index:n,isScrolling:i,key:o,onRowClick:l,onRowDoubleClick:h,onRowRightClick:p,onRowMouseOver:d,onRowMouseOut:f,rowData:w,style:A})}},{key:"_getFlexStyleForColumn",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.props.flexGrow+" "+t.props.flexShrink+" "+t.props.width+"px",r=no()({},e,{flex:n,msFlex:n,WebkitFlex:n});return t.props.maxWidth&&(r.maxWidth=t.props.maxWidth),t.props.minWidth&&(r.minWidth=t.props.minWidth),r}},{key:"_getHeaderColumns",value:function(){var t=this,e=this.props,n=e.children;return(e.disableHeader?[]:r.Children.toArray(n)).map(function(e,n){return t._createHeader({column:e,index:n})})}},{key:"_getRowHeight",value:function(t){var e=this.props.rowHeight;return"function"==typeof e?e({index:t}):e}},{key:"_onScroll",value:function(t){var e=t.clientHeight,n=t.scrollHeight,r=t.scrollTop;(0,this.props.onScroll)({clientHeight:e,scrollHeight:n,scrollTop:r})}},{key:"_onSectionRendered",value:function(t){var e=t.rowOverscanStartIndex,n=t.rowOverscanStopIndex,r=t.rowStartIndex,i=t.rowStopIndex;(0,this.props.onRowsRendered)({overscanStartIndex:e,overscanStopIndex:n,startIndex:r,stopIndex:i})}},{key:"_setRef",value:function(t){this.Grid=t}},{key:"_setScrollbarWidth",value:function(){if(this.Grid){var t=Object(i.findDOMNode)(this.Grid),e=t.clientWidth||0,n=(t.offsetWidth||0)-e;this.setState({scrollbarWidth:n})}}}]),e}(r.PureComponent);ko.defaultProps={disableHeader:!1,estimatedRowSize:30,headerHeight:0,headerStyle:{},noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanIndicesGetter:function(t){var e=t.cellCount,n=t.overscanCellsCount,r=t.scrollDirection,i=t.startIndex,o=t.stopIndex;return n=Math.max(1,n),r===Ro?{overscanStartIndex:Math.max(0,i-1),overscanStopIndex:Math.min(e-1,o+n)}:{overscanStartIndex:Math.max(0,i-n),overscanStopIndex:Math.min(e-1,o+1)}},overscanRowCount:10,rowRenderer:Oo,headerRowRenderer:Lo,rowStyle:{},scrollToAlignment:"auto",scrollToIndex:-1,style:{}};var No=ko;ko.propTypes={};var Do=n(162),zo=function(t){function e(){var t,n,r,i;$i()(this,e);for(var o=arguments.length,a=Array(o),s=0;s<o;s++)a[s]=arguments[s];return n=r=qi()(this,(t=e.__proto__||Vi()(e)).call.apply(t,[this].concat(a))),r.state={height:r.props.defaultHeight||0,width:r.props.defaultWidth||0},r._onResize=function(){var t=r.props,e=t.disableHeight,n=t.disableWidth,i=t.onResize;if(r._parentNode){var o=r._parentNode.offsetHeight||0,a=r._parentNode.offsetWidth||0,s=window.getComputedStyle(r._parentNode)||{},c=parseInt(s.paddingLeft,10)||0,u=parseInt(s.paddingRight,10)||0,l=parseInt(s.paddingTop,10)||0,h=parseInt(s.paddingBottom,10)||0,p=o-l-h,d=a-c-u;(!e&&r.state.height!==p||!n&&r.state.width!==d)&&(r.setState({height:o-l-h,width:a-c-u}),i({height:o,width:a}))}},r._setRef=function(t){r._autoSizer=t},i=n,qi()(r,i)}return Yi()(e,t),io()(e,[{key:"componentDidMount",value:function(){var t=this.props.nonce;this._autoSizer&&this._autoSizer.parentNode&&this._autoSizer.parentNode.ownerDocument&&this._autoSizer.parentNode.ownerDocument.defaultView&&this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement&&(this._parentNode=this._autoSizer.parentNode,this._detectElementResize=Object(Do.a)(t),this._detectElementResize.addResizeListener(this._parentNode,this._onResize),this._onResize())}},{key:"componentWillUnmount",value:function(){this._detectElementResize&&this._parentNode&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize)}},{key:"render",value:function(){var t=this.props,e=t.children,n=t.className,i=t.disableHeight,o=t.disableWidth,a=t.style,s=this.state,c=s.height,u=s.width,l={overflow:"visible"},h={};return i||(l.height=0,h.height=c),o||(l.width=0,h.width=u),r.createElement("div",{className:n,ref:this._setRef,style:no()({},l,a)},e(h))}}]),e}(r.PureComponent);zo.defaultProps={onResize:function(){},disableHeight:!1,disableWidth:!1,style:{}},zo.propTypes=null;var Fo=zo;var Bo=Math.log10||function(t){return Math.log(t)/Math.LN10};function Uo(t,e){void 0===e&&(e=2);var n=function(t){var e=Math.abs(t);return 0===e?1:Math.floor(Bo(e))+1}(t);return n>e||n<2-e?[t/Math.pow(10,n-1),n-1]:[t,0]}var jo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function Go(t){var e=t.label,n=t.dataKey,i=t.sortBy,o=t.sortDirection;if(t.disableSort)return r.createElement("div",null,e||n);if(i!==n)return r.createElement("div",null,e||n," ",r.createElement("i",{className:"sort-placeholder fa fa-sort"}));var a="ASC"===o?"fa-sort-asc":"fa-sort-desc";return r.createElement("div",null,e||n," ",r.createElement("i",{className:Yr("fa",a)}))}function Vo(t){var e=t.cellData;if(null===e)return r.createElement("div",{className:"data-NA"},"-");if(0===e)return r.createElement("div",{className:"data-zero"},"0.000");var n=Uo(e,4),i=n[0],o=n[1];return 0===o?r.createElement("div",null,i.toPrecision(4)):r.createElement("div",null,i.toPrecision(4)," × 10",r.createElement("sup",null,o))}function Ho(t){var e={headerRenderer:Go,cellRenderer:Vo,flexGrow:1,width:100};return r.createElement("div",{className:"result-page page centered"},r.createElement("div",{className:"top-bar"},r.createElement("div",null,r.createElement("h2",null,t.name)),r.createElement("div",null,r.createElement(Br,{onClick:function(){return t.dispatch(bn(mn(t.file_id)))}}),r.createElement(jr,{onClick:function(){return t.dispatch(bn(fn()))}}),r.createElement(Gr,null))),t.errors.map(function(e,n){var i=e.name,o=e.nth,a=e.error,s=null===o?a:o+1+": "+i+": "+a;return r.createElement("div",{key:n,className:"toast toast-error"},s,r.createElement("button",{onClick:function(){return t.dispatch({type:Bi,index:n})},className:"btn btn-clear float-right"}))}),r.createElement("div",{className:"result-section"},r.createElement("h5",{className:"header"},"Summary"),r.createElement(Fo,{disableHeight:!0},function(n){var i=n.width;return r.createElement(No,{className:"table",height:300,rowHeight:50,headerHeight:50,rowCount:t.descriptorInfo.length,width:i,rowGetter:function(e){var n=e.index;return t.descriptorInfo[n]},sort:function(e){return t.dispatch(function(t){return{type:Fi,sortBy:t.sortBy,sortDirection:t.sortDirection}}(e))},sortBy:t.sortBy,sortDirection:t.sortDirection},r.createElement(to,{label:"#",dataKey:"index",headerRenderer:Go,width:40,minWidth:40}),r.createElement(to,{dataKey:"name",disableSort:!0,headerRenderer:Go,flexGrow:1,width:100}),r.createElement(to,jo({dataKey:"min"},e)),r.createElement(to,jo({dataKey:"max"},e)),r.createElement(to,jo({dataKey:"mean"},e)),r.createElement(to,jo({dataKey:"std"},e)))})),r.createElement("div",{className:"result-section"},r.createElement("h5",{className:"header"},"Downloads"),r.createElement("div",{className:"download-buttons-wrapper"},r.createElement("div",{className:"download-buttons"},r.createElement("div",{className:"download-group"},r.createElement("div",{className:"download-label"},"All descriptor values"),r.createElement("div",{className:"btn-group"},r.createElement("a",{className:"btn btn-sm btn-primary",href:"/api/calc/"+t.id+".csv"},"csv"),r.createElement("a",{className:"btn btn-sm btn-primary",href:"/api/calc/"+t.id+".xlsx"},"xlsx"))),r.createElement("div",{className:"download-group"},r.createElement("div",{className:"download-label"},"Error log"),r.createElement("a",{className:"btn btn-sm btn-primary",href:"/api/calc/"+t.id+".txt",download:t.id+".txt"},"txt"))))),r.createElement(Vr,null))}function $o(t){if(null===t.id)return r.createElement($r,null);if(t.notFound)return r.createElement(Hr,{title:"File ID not found",onClickBack:function(){return t.dispatch(bn(mn(t.file_id)))}},t.id);if(!t.done){var e=t.current/t.total,n=Math.round(1e4*e)/100;return r.createElement(Xr,{title:"Calculating ...",name:t.name||"",text:n+"% ("+t.current+"/"+t.total+")",progress:e})}return r.createElement(Ho,jo({},t))}var Wo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};var qo={file:null,gen3D:!1,desalt:!0,error:null,file_size_limit:0},Xo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Yo="UPLOAD:CHANGE_GENERATE_3D",Ko="UPLOAD:CHANGE_DESALT";function Zo(t){return Xo({type:Yo},t)}function Qo(t){return Xo({type:Ko},t)}var Jo="UPLOAD:SET_FILE";var ta="UPLOAD:UPLOADED";var ea="UPLOAD:SET_ERROR";function na(t){return{type:ea,error:t}}var ra="UPLOAD:SET_FILE_SIZE_LIMIT";var ia=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},oa=1048576;function aa(t){var e,n,r,i,o,a,s=t.file;return ia(this,function(t){switch(t.label){case 0:return null===s?[2]:[4,Ae(function(t){return t.upload})];case 1:return e=t.sent(),n=e.desalt,r=e.gen3D,i=e.file_size_limit,s.size>i*oa?[4,xe(na("file size too large (> "+i+"MB)"))]:[3,3];case 2:return t.sent(),[2];case 3:return t.trys.push([3,6,,12]),[4,Se(rr,{file:s,gen3D:r,desalt:n})];case 4:return[4,xe(function(t){return{type:ta,id:t}}(t.sent()))];case 5:return t.sent(),[3,12];case 6:return(o=t.sent()).response?(a=o.response).status&&a.statusText?[4,xe(na(a.status+" "+a.statusText))]:[3,8]:[3,9];case 7:t.sent(),t.label=8;case 8:return[3,11];case 9:return[4,xe(na(o.toString()))];case 10:t.sent(),t.label=11;case 11:return[3,12];case 12:return[2]}})}function sa(t){var e=t.id;return ia(this,function(t){switch(t.label){case 0:return[4,xe(bn(mn(e)))];case 1:return t.sent(),[2]}})}function ca(){var t,e;return ia(this,function(n){switch(n.label){case 0:return t=Er(),e=Cr(),[4,xe(Qo({enabled:t,store:!1}))];case 1:return n.sent(),[4,xe(Zo({enabled:e,store:!1}))];case 2:return n.sent(),[2]}})}function ua(){var t;return ia(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,5]),[4,Se(vr)];case 1:return t=e.sent(),[4,xe((n=t.file_size_limit,{type:ra,limit:n}))];case 2:return e.sent(),[3,5];case 3:return[4,xe(na(e.sent().toString()))];case 4:return e.sent(),[3,5];case 5:return[2]}var n})}function la(t){var e=t.enabled,n=t.store;return ia(this,function(t){return n&&Ar(e),[2]})}function ha(t){var e=t.enabled,n=t.store;return ia(this,function(t){return n&&Sr(e),[2]})}function pa(){return ia(this,function(t){switch(t.label){case 0:return[4,Ee(un,ca)];case 1:return t.sent(),[4,Ee(un,ua)];case 2:return t.sent(),[4,Ee(Jo,aa)];case 3:return t.sent(),[4,Ee(ta,sa)];case 4:return t.sent(),[4,Ee(Ko,la)];case 5:return t.sent(),[4,Ee(Yo,ha)];case 6:return t.sent(),[2]}})}function da(t){return r.createElement("div",{className:"upload-page page centered"},r.createElement("div",{className:"top-bar"},r.createElement("div",null,r.createElement("h2",null," ")),r.createElement("div",null,r.createElement(Gr,null))),r.createElement("div",{className:"empty"},r.createElement("h2",{className:"empty-title"},"Mordred Web UI"),r.createElement("p",{className:"empty-subtitle"},"Descriptor calculator"),t.error?r.createElement("div",{className:"toast toast-error"},r.createElement("button",{onClick:function(){return t.dispatch(na(null))},className:"btn btn-clear float-right"}),t.error):null,r.createElement("div",{className:"empty-action upload-button-container"},r.createElement("input",{type:"file",hidden:!0,id:"upload-file",onChange:function(e){return t.dispatch((n=e.target.files&&e.target.files[0]||null,{type:Jo,file:n}));var n}}),r.createElement("label",{htmlFor:"upload-file",className:"btn btn-primary"},"Upload"),r.createElement("div",null,r.createElement("a",{className:"download-example tooltip tooltip-bottom","data-tooltip":"download example smi file",href:"/static/examples/example.smi"},"smi")," ","or"," ",r.createElement("a",{className:"download-example tooltip tooltip-bottom","data-tooltip":"download example sdf file",href:"/static/examples/example.sdf"},"sdf")," ","file")),r.createElement("div",{className:"empty-action"},r.createElement(ui,{checked:t.gen3D,onChange:function(e){return t.dispatch(Zo({enabled:e.target.checked,store:!0}))}},"Generate 3D conformer"),r.createElement(ui,{checked:t.desalt,onChange:function(e){return t.dispatch(Qo({enabled:e.target.checked,store:!0}))}},"Desalt"))),r.createElement(Vr,null))}var fa={route:{type:dn},upload:qo,result:Ii,file:An},ma=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ga=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};var va=Be();var ya=function t(e,n,r){var i;if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(t)(e,n)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,a=n,s=[],c=s,u=!1;function l(){c===s&&(c=s.slice())}function h(){if(u)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function p(t){if("function"!=typeof t)throw new Error("Expected the listener to be a function.");if(u)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var e=!0;return l(),c.push(t),function(){if(e){if(u)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");e=!1,l();var n=c.indexOf(t);c.splice(n,1)}}}function d(t){if(!P(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,a=o(a,t)}finally{u=!1}for(var e=s=c,n=0;n<e.length;n++)(0,e[n])();return t}return d({type:E.INIT}),(i={dispatch:d,subscribe:p,getState:h,replaceReducer:function(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");o=t,d({type:E.REPLACE})}})[A.a]=function(){var t,e=p;return(t={subscribe:function(t){if("object"!==(void 0===t?"undefined":M(t))||null===t)throw new TypeError("Expected the observer to be an object.");function n(){t.next&&t.next(h())}return n(),{unsubscribe:e(n)}}})[A.a]=function(){return this},t},i}(function(t,e){return void 0===t&&(t=fa),/^UPLOAD:/.test(e.type)?ma({},t,{upload:function(t,e){void 0===t&&(t=qo);var n={};switch(e.type){case Yo:n={gen3D:e.enabled};break;case Ko:n={desalt:e.enabled};break;case Jo:n={file:e.file};break;case ta:break;case ea:n={error:e.error};break;case ra:n={file_size_limit:e.limit};break;default:return t}return Mi({},t,n)}(t.upload,e)}):function(t){return/^FILE:/.test(t.type)}(e)?ma({},t,{file:function(t,e){void 0===t&&(t=An);var n={};switch(e.type){case Mn:n={id:e.id,phase:null,current:0};break;case Tn:n={total:e.total,progress:e.current,phase:e.phase,name:e.name};break;case Pn:n={downloadShown:e.shown};break;case Rn:n={descriptors:e.descriptors};break;case On:var r=Pi({},t.disabled);r[e.name]=!e.enabled,n={disabled:r};break;case kn:if(e.enabled)n={disabled:{}};else{for(var i={},o=0,a=t.descriptors||[];o<a.length;o++)i[a[o]]=!0;n={disabled:i}}break;case Nn:n={modalShown:e.shown};break;case zn:n={file_errors:e.errors,desalt:e.desalt,gen3D:e.gen3D,mols:e.mols,is3D:e.is3D};break;case Fn:n={file_errors:Ti(t.file_errors,e.index)};break;case Un:n={current:e.index};break;case Gn:var s=Pi({},t.mols);s[e.nth].mol=e.mol,n={mols:s};break;case Hn:n={phase:"not-found"};break;case Wn:n={descriptors:null};break;case qn:case Xn:break;case Yn:n={file_errors:[e.error]};break;default:return t}return Mi({},t,n)}(t.file,e)}):function(t){return/^RESULT:/.test(t.type)}(e)?ma({},t,{result:function(t,e){void 0===t&&(t=Ii);var n={};switch(e.type){case Oi:n={id:e.id};break;case Li:n={notFound:!0};break;case Ni:n={total:e.total,current:e.current,name:e.name,done:e.done};break;case Di:n={file_id:e.file_id,file_name:e.file_name,descriptorInfo:e.descriptors.map(function(t,e){return Wo({},t,{index:e})}),errors:e.errors};break;case zi:n={downloadShown:e.shown};break;case Fi:var r=t.descriptorInfo.slice(),i=e.sortBy,o=function(t,e){return function(n,r){var o=n[i],a=r[i];return null===o?e:null===a?t:o>a?t:e}},a="ASC"===e.sortDirection?o(1,-1):o(-1,1);r.sort(a),n={sortBy:e.sortBy,sortDirection:e.sortDirection,descriptorInfo:r};break;case Bi:n={errors:Ti(t.errors,e.index)};break;default:return t}return Mi({},t,n)}(t.result,e)}):vn(n=e)||n.type===yn?ma({},t,{route:function(t,e){return vn(e)?e:t}(t.route,e)}):t;var n},function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=t.apply(void 0,r),a=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},s={getState:o.getState,dispatch:function(){return a.apply(void 0,arguments)}},c=e.map(function(t){return t(s)});return a=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce(function(t,e){return function(){return t(e.apply(void 0,arguments))}})}.apply(void 0,c)(o.dispatch),T({},o,{dispatch:a})}}}.apply(void 0,[va]));va.run(function(){return ga(this,function(t){switch(t.label){case 0:return[4,Ce(pa)];case 1:return t.sent(),[4,Ce(Fr)];case 2:return t.sent(),[4,Ce(ji)];case 3:return t.sent(),[4,Ce(Cn)];case 4:return t.sent(),[2]}})}),xn.listen(function(t){ya.dispatch(Sn(t))}),ya.dispatch(Sn(xn.location));var ba=Q(function(t){return t})(function(t){var e=t.route,n=t.dispatch;switch(e.type){case un:return r.createElement(da,ma({dispatch:n},t.upload));case ln:return r.createElement(Ei,ma({dispatch:n},t.file));case hn:return r.createElement($o,ma({dispatch:n},t.result));case pn:return r.createElement("h1",null,"page not found");case dn:return r.createElement("div",null);default:return r.createElement("div",null,r.createElement("h1",null,"BUG: unknown route"),r.createElement("p",null,JSON.stringify(e)))}});i.render(r.createElement(u,{store:ya},r.createElement(ba,null)),document.getElementById("main"))},function(t,e,n){var r=n(30),i=n(28);n(59)("keys",function(){return function(t){return i(r(t))}})},function(t,e,n){n(83),t.exports=n(7).Object.keys},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=!("undefined"==typeof window||!window.document||!window.document.createElement),t.exports=e.default},function(t,e,n){var r=n(20);r(r.S,"Object",{create:n(39)})},function(t,e,n){n(86);var r=n(7).Object;t.exports=function(t,e){return r.create(t,e)}},function(t,e,n){t.exports={default:n(87),__esModule:!0}},function(t,e,n){var r=n(26),i=n(29),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(66)(Function.call,n(54).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return o(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:o}},function(t,e,n){var r=n(20);r(r.S,"Object",{setPrototypeOf:n(89).set})},function(t,e,n){n(90),t.exports=n(7).Object.setPrototypeOf},function(t,e,n){t.exports={default:n(91),__esModule:!0}},function(t,e,n){n(36)("observable")},function(t,e,n){n(36)("asyncIterator")},function(t,e){},function(t,e,n){var r=n(24),i=n(55).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return a.slice()}}(t):i(r(t))}},function(t,e,n){var r=n(61);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(28),i=n(41),o=n(31);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,s=n(t),c=o.f,u=0;s.length>u;)c.call(t,a=s[u++])&&e.push(a);return e}},function(t,e,n){var r=n(32)("meta"),i=n(26),o=n(17),a=n(19).f,s=0,c=Object.isExtensible||function(){return!0},u=!n(25)(function(){return c(Object.preventExtensions({}))}),l=function(t){a(t,r,{value:{i:"O"+ ++s,w:{}}})},h=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!c(t))return"F";if(!e)return"E";l(t)}return t[r].i},getWeak:function(t,e){if(!o(t,r)){if(!c(t))return!0;if(!e)return!1;l(t)}return t[r].w},onFreeze:function(t){return u&&h.NEED&&c(t)&&!o(t,r)&&l(t),t}}},function(t,e,n){"use strict";var r=n(12),i=n(17),o=n(18),a=n(20),s=n(56),c=n(99).KEY,u=n(25),l=n(43),h=n(38),p=n(32),d=n(23),f=n(37),m=n(36),g=n(98),v=n(97),y=n(29),b=n(26),x=n(24),_=n(47),w=n(34),S=n(39),C=n(96),A=n(54),E=n(19),M=n(28),T=A.f,P=E.f,I=C.f,R=r.Symbol,O=r.JSON,L=O&&O.stringify,k=d("_hidden"),N=d("toPrimitive"),D={}.propertyIsEnumerable,z=l("symbol-registry"),F=l("symbols"),B=l("op-symbols"),U=Object.prototype,j="function"==typeof R,G=r.QObject,V=!G||!G.prototype||!G.prototype.findChild,H=o&&u(function(){return 7!=S(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=T(U,e);r&&delete U[e],P(t,e,n),r&&t!==U&&P(U,e,r)}:P,$=function(t){var e=F[t]=S(R.prototype);return e._k=t,e},W=j&&"symbol"==typeof R.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof R},q=function(t,e,n){return t===U&&q(B,e,n),y(t),e=_(e,!0),y(n),i(F,e)?(n.enumerable?(i(t,k)&&t[k][e]&&(t[k][e]=!1),n=S(n,{enumerable:w(0,!1)})):(i(t,k)||P(t,k,w(1,{})),t[k][e]=!0),H(t,e,n)):P(t,e,n)},X=function(t,e){y(t);for(var n,r=g(e=x(e)),i=0,o=r.length;o>i;)q(t,n=r[i++],e[n]);return t},Y=function(t){var e=D.call(this,t=_(t,!0));return!(this===U&&i(F,t)&&!i(B,t))&&(!(e||!i(this,t)||!i(F,t)||i(this,k)&&this[k][t])||e)},K=function(t,e){if(t=x(t),e=_(e,!0),t!==U||!i(F,e)||i(B,e)){var n=T(t,e);return!n||!i(F,e)||i(t,k)&&t[k][e]||(n.enumerable=!0),n}},Z=function(t){for(var e,n=I(x(t)),r=[],o=0;n.length>o;)i(F,e=n[o++])||e==k||e==c||r.push(e);return r},Q=function(t){for(var e,n=t===U,r=I(n?B:x(t)),o=[],a=0;r.length>a;)!i(F,e=r[a++])||n&&!i(U,e)||o.push(F[e]);return o};j||(s((R=function(){if(this instanceof R)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===U&&e.call(B,n),i(this,k)&&i(this[k],t)&&(this[k][t]=!1),H(this,t,w(1,n))};return o&&V&&H(U,t,{configurable:!0,set:e}),$(t)}).prototype,"toString",function(){return this._k}),A.f=K,E.f=q,n(55).f=C.f=Z,n(31).f=Y,n(41).f=Q,o&&!n(33)&&s(U,"propertyIsEnumerable",Y,!0),f.f=function(t){return $(d(t))}),a(a.G+a.W+a.F*!j,{Symbol:R});for(var J="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;J.length>tt;)d(J[tt++]);for(var et=M(d.store),nt=0;et.length>nt;)m(et[nt++]);a(a.S+a.F*!j,"Symbol",{for:function(t){return i(z,t+="")?z[t]:z[t]=R(t)},keyFor:function(t){if(!W(t))throw TypeError(t+" is not a symbol!");for(var e in z)if(z[e]===t)return e},useSetter:function(){V=!0},useSimple:function(){V=!1}}),a(a.S+a.F*!j,"Object",{create:function(t,e){return void 0===e?S(t):X(S(t),e)},defineProperty:q,defineProperties:X,getOwnPropertyDescriptor:K,getOwnPropertyNames:Z,getOwnPropertySymbols:Q}),O&&a(a.S+a.F*(!j||u(function(){var t=R();return"[null]"!=L([t])||"{}"!=L({a:t})||"{}"!=L(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(b(e)||void 0!==t)&&!W(t))return v(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!W(e))return e}),r[1]=e,L.apply(O,r)}}),R.prototype[N]||n(27)(R.prototype,N,R.prototype.valueOf),h(R,"Symbol"),h(Math,"Math",!0),h(r.JSON,"JSON",!0)},function(t,e,n){n(100),n(95),n(94),n(93),t.exports=n(7).Symbol},function(t,e,n){t.exports={default:n(101),__esModule:!0}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e){t.exports=function(){}},function(t,e,n){"use strict";var r=n(104),i=n(103),o=n(40),a=n(24);t.exports=n(57)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e,n){n(105);for(var r=n(12),i=n(27),o=n(40),a=n(23)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;c<s.length;c++){var u=s[c],l=r[u],h=l&&l.prototype;h&&!h[a]&&i(h,a,u),o[u]=o.Array}},function(t,e,n){var r=n(12).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(19),i=n(29),o=n(28);t.exports=n(18)?Object.defineProperties:function(t,e){i(t);for(var n,a=o(e),s=a.length,c=0;s>c;)r.f(t,n=a[c++],e[n]);return t}},function(t,e,n){"use strict";var r=n(39),i=n(34),o=n(38),a={};n(27)(a,n(23)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},function(t,e,n){var r=n(45),i=n(46);t.exports=function(t){return function(e,n){var o,a,s=String(i(e)),c=r(n),u=s.length;return c<0||c>=u?t?"":void 0:(o=s.charCodeAt(c))<55296||o>56319||c+1===u||(a=s.charCodeAt(c+1))<56320||a>57343?t?s.charAt(c):o:t?s.slice(c,c+2):a-56320+(o-55296<<10)+65536}}},function(t,e,n){"use strict";var r=n(110)(!0);n(57)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){n(111),n(106),t.exports=n(37).f("iterator")},function(t,e,n){t.exports={default:n(112),__esModule:!0}},function(t,e,n){var r=n(20);r(r.S+r.F*!n(18),"Object",{defineProperty:n(19).f})},function(t,e,n){n(114);var r=n(7).Object;t.exports=function(t,e,n){return r.defineProperty(t,e,n)}},function(t,e,n){t.exports={default:n(115),__esModule:!0}},function(t,e,n){var r=n(30),i=n(60);n(59)("getPrototypeOf",function(){return function(t){return i(r(t))}})},function(t,e,n){n(117),t.exports=n(7).Object.getPrototypeOf},function(t,e,n){var r=n(45),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},function(t,e,n){var r=n(45),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e,n){var r=n(24),i=n(120),o=n(119);t.exports=function(t){return function(e,n,a){var s,c=r(e),u=i(c.length),l=o(a,u);if(t&&n!=n){for(;u>l;)if((s=c[l++])!=s)return!0}else for(;u>l;l++)if((t||l in c)&&c[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){"use strict";var r=n(28),i=n(41),o=n(31),a=n(30),s=n(62),c=Object.assign;t.exports=!c||n(25)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=c({},t)[n]||Object.keys(c({},e)).join("")!=r})?function(t,e){for(var n=a(t),c=arguments.length,u=1,l=i.f,h=o.f;c>u;)for(var p,d=s(arguments[u++]),f=l?r(d).concat(l(d)):r(d),m=f.length,g=0;m>g;)h.call(d,p=f[g++])&&(n[p]=d[p]);return n}:c},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(20);r(r.S+r.F,"Object",{assign:n(122)})},function(t,e,n){n(124),t.exports=n(7).Object.assign},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,a,s,c=1,u={},l=!1,h=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){f(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return u[c]=i,r(c),c++},p.clearImmediate=d}function d(t){delete u[t]}function f(t){if(l)setTimeout(f,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{d(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(21),n(48))},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(126),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(21))},function(t,e,n){"use strict";var r=n(68),i=Object.prototype.hasOwnProperty,o={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:r.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},a=function(t,e,n){if(t){var r=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,a=/(\[[^[\]]*])/.exec(r),s=a?r.slice(0,a.index):r,c=[];if(s){if(!n.plainObjects&&i.call(Object.prototype,s)&&!n.allowPrototypes)return;c.push(s)}for(var u=0;null!==(a=o.exec(r))&&u<n.depth;){if(u+=1,!n.plainObjects&&i.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(a[1])}return a&&c.push("["+r.slice(a.index)+"]"),function(t,e,n){for(var r=e,i=t.length-1;i>=0;--i){var o,a=t[i];if("[]"===a)o=(o=[]).concat(r);else{o=n.plainObjects?Object.create(null):{};var s="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,c=parseInt(s,10);!isNaN(c)&&a!==s&&String(c)===s&&c>=0&&n.parseArrays&&c<=n.arrayLimit?(o=[])[c]=r:o[s]=r}r=o}return r}(c,e,n)}};t.exports=function(t,e){var n=e?r.assign({},e):{};if(null!==n.decoder&&void 0!==n.decoder&&"function"!=typeof n.decoder)throw new TypeError("Decoder has to be a function.");if(n.ignoreQueryPrefix=!0===n.ignoreQueryPrefix,n.delimiter="string"==typeof n.delimiter||r.isRegExp(n.delimiter)?n.delimiter:o.delimiter,n.depth="number"==typeof n.depth?n.depth:o.depth,n.arrayLimit="number"==typeof n.arrayLimit?n.arrayLimit:o.arrayLimit,n.parseArrays=!1!==n.parseArrays,n.decoder="function"==typeof n.decoder?n.decoder:o.decoder,n.allowDots="boolean"==typeof n.allowDots?n.allowDots:o.allowDots,n.plainObjects="boolean"==typeof n.plainObjects?n.plainObjects:o.plainObjects,n.allowPrototypes="boolean"==typeof n.allowPrototypes?n.allowPrototypes:o.allowPrototypes,n.parameterLimit="number"==typeof n.parameterLimit?n.parameterLimit:o.parameterLimit,n.strictNullHandling="boolean"==typeof n.strictNullHandling?n.strictNullHandling:o.strictNullHandling,""===t||null===t||void 0===t)return n.plainObjects?Object.create(null):{};for(var s="string"==typeof t?function(t,e){for(var n={},r=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,a=e.parameterLimit===1/0?void 0:e.parameterLimit,s=r.split(e.delimiter,a),c=0;c<s.length;++c){var u,l,h=s[c],p=h.indexOf("]="),d=-1===p?h.indexOf("="):p+1;-1===d?(u=e.decoder(h,o.decoder),l=e.strictNullHandling?null:""):(u=e.decoder(h.slice(0,d),o.decoder),l=e.decoder(h.slice(d+1),o.decoder)),i.call(n,u)?n[u]=[].concat(n[u]).concat(l):n[u]=l}return n}(t,n):t,c=n.plainObjects?Object.create(null):{},u=Object.keys(s),l=0;l<u.length;++l){var h=u[l],p=a(h,s[h],n);c=r.merge(c,p,n)}return r.compact(c)}},function(t,e,n){"use strict";var r=n(68),i=n(67),o={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},a=Date.prototype.toISOString,s={delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,serializeDate:function(t){return a.call(t)},skipNulls:!1,strictNullHandling:!1},c=function t(e,n,i,o,a,c,u,l,h,p,d,f){var m=e;if("function"==typeof u)m=u(n,m);else if(m instanceof Date)m=p(m);else if(null===m){if(o)return c&&!f?c(n,s.encoder):n;m=""}if("string"==typeof m||"number"==typeof m||"boolean"==typeof m||r.isBuffer(m))return c?[d(f?n:c(n,s.encoder))+"="+d(c(m,s.encoder))]:[d(n)+"="+d(String(m))];var g,v=[];if(void 0===m)return v;if(Array.isArray(u))g=u;else{var y=Object.keys(m);g=l?y.sort(l):y}for(var b=0;b<g.length;++b){var x=g[b];a&&null===m[x]||(v=Array.isArray(m)?v.concat(t(m[x],i(n,x),i,o,a,c,u,l,h,p,d,f)):v.concat(t(m[x],n+(h?"."+x:"["+x+"]"),i,o,a,c,u,l,h,p,d,f)))}return v};t.exports=function(t,e){var n=t,a=e?r.assign({},e):{};if(null!==a.encoder&&void 0!==a.encoder&&"function"!=typeof a.encoder)throw new TypeError("Encoder has to be a function.");var u=void 0===a.delimiter?s.delimiter:a.delimiter,l="boolean"==typeof a.strictNullHandling?a.strictNullHandling:s.strictNullHandling,h="boolean"==typeof a.skipNulls?a.skipNulls:s.skipNulls,p="boolean"==typeof a.encode?a.encode:s.encode,d="function"==typeof a.encoder?a.encoder:s.encoder,f="function"==typeof a.sort?a.sort:null,m=void 0!==a.allowDots&&a.allowDots,g="function"==typeof a.serializeDate?a.serializeDate:s.serializeDate,v="boolean"==typeof a.encodeValuesOnly?a.encodeValuesOnly:s.encodeValuesOnly;if(void 0===a.format)a.format=i.default;else if(!Object.prototype.hasOwnProperty.call(i.formatters,a.format))throw new TypeError("Unknown format option provided.");var y,b,x=i.formatters[a.format];"function"==typeof a.filter?n=(b=a.filter)("",n):Array.isArray(a.filter)&&(y=b=a.filter);var _,w=[];if("object"!=typeof n||null===n)return"";_=a.arrayFormat in o?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var S=o[_];y||(y=Object.keys(n)),f&&y.sort(f);for(var C=0;C<y.length;++C){var A=y[C];h&&null===n[A]||(w=w.concat(c(n[A],A,S,l,h,p?d:null,b,f,m,g,x,v)))}var E=w.join(u),M=!0===a.addQueryPrefix?"?":"";return E.length>0?M+E:""}},function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,n){"use strict";var r=n(69);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var n=this;t(function(t){n.reason||(n.reason=new r(t),e(n.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var t;return{token:new i(function(e){t=e}),cancel:t}},t.exports=i},function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,n){"use strict";var r=n(5);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";var r=n(5),i=n(134),o=n(70),a=n(49),s=n(133),c=n(132);function u(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return u(t),t.baseURL&&!s(t.url)&&(t.url=c(t.baseURL,t.url)),t.headers=t.headers||{},t.data=i(t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||a.adapter)(t).then(function(e){return u(t),e.data=i(e.data,e.headers,t.transformResponse),e},function(e){return o(e)||(u(t),e&&e.response&&(e.response.data=i(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(t,e,n){"use strict";var r=n(5);function i(){this.handlers=[]}i.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=i},function(t,e,n){"use strict";var r=n(5);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,i,o,a){var s=[];s.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(i)&&s.push("path="+i),r.isString(o)&&s.push("domain="+o),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,n){"use strict";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function i(){this.message="String contains an invalid character"}i.prototype=new Error,i.prototype.code=5,i.prototype.name="InvalidCharacterError",t.exports=function(t){for(var e,n,o=String(t),a="",s=0,c=r;o.charAt(0|s)||(c="=",s%1);a+=c.charAt(63&e>>8-s%1*8)){if((n=o.charCodeAt(s+=.75))>255)throw new i;e=e<<8|n}return a}},function(t,e,n){"use strict";var r=n(5);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},function(t,e,n){"use strict";var r=n(5),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,o,a={};return t?(r.forEach(t.split("\n"),function(t){if(o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e){if(a[e]&&i.indexOf(e)>=0)return;a[e]="set-cookie"===e?(a[e]?a[e]:[]).concat([n]):a[e]?a[e]+", "+n:n}}),a):a}},function(t,e,n){"use strict";var r=n(5);function i(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(r.isURLSearchParams(e))o=e.toString();else{var a=[];r.forEach(e,function(t,e){null!==t&&void 0!==t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),a.push(i(e)+"="+i(t))}))}),o=a.join("&")}return o&&(t+=(-1===t.indexOf("?")?"?":"&")+o),t}},function(t,e,n){"use strict";t.exports=function(t,e,n,r,i){return t.config=e,n&&(t.code=n),t.request=r,t.response=i,t}},function(t,e,n){"use strict";var r=n(71);t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(r("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}},function(t,e,n){"use strict";var r=n(5);t.exports=function(t,e){r.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}},function(t,e,n){"use strict";var r=n(49),i=n(5),o=n(136),a=n(135);function s(t){this.defaults=t,this.interceptors={request:new o,response:new o}}s.prototype.request=function(t){"string"==typeof t&&(t=i.merge({url:arguments[0]},arguments[1])),(t=i.merge(r,{method:"get"},this.defaults,t)).method=t.method.toLowerCase();var e=[a,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},i.forEach(["delete","get","head","options"],function(t){s.prototype[t]=function(e,n){return this.request(i.merge(n||{},{method:t,url:e}))}}),i.forEach(["post","put","patch"],function(t){s.prototype[t]=function(e,n,r){return this.request(i.merge(r||{},{method:t,url:e,data:n}))}}),t.exports=s},function(t,e){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
/*!
 * Determine if an object is a Buffer
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
t.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,n){"use strict";var r=n(5),i=n(73),o=n(145),a=n(49);function s(t){var e=new o(t),n=i(o.prototype.request,e);return r.extend(n,o.prototype,e),r.extend(n,e),n}var c=s(a);c.Axios=o,c.create=function(t){return s(r.merge(a,t))},c.Cancel=n(69),c.CancelToken=n(131),c.isCancel=n(70),c.all=function(t){return Promise.all(t)},c.spread=n(130),t.exports=c,t.exports.default=c},function(t,e,n){(function(t){!function(e){"use strict";function n(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}function r(t,e){Object.defineProperty(this,"kind",{value:t,enumerable:!0}),e&&e.length&&Object.defineProperty(this,"path",{value:e,enumerable:!0})}function i(t,e,n){i.super_.call(this,"E",t),Object.defineProperty(this,"lhs",{value:e,enumerable:!0}),Object.defineProperty(this,"rhs",{value:n,enumerable:!0})}function o(t,e){o.super_.call(this,"N",t),Object.defineProperty(this,"rhs",{value:e,enumerable:!0})}function a(t,e){a.super_.call(this,"D",t),Object.defineProperty(this,"lhs",{value:e,enumerable:!0})}function s(t,e,n){s.super_.call(this,"A",t),Object.defineProperty(this,"index",{value:e,enumerable:!0}),Object.defineProperty(this,"item",{value:n,enumerable:!0})}function c(t,e,n){var r=t.slice((n||e)+1||t.length);return t.length=e<0?t.length+e:e,t.push.apply(t,r),t}function u(t){var e=void 0===t?"undefined":w(t);return"object"!==e?e:t===Math?"math":null===t?"null":Array.isArray(t)?"array":"[object Date]"===Object.prototype.toString.call(t)?"date":"function"==typeof t.toString&&/^\/.*\//.test(t.toString())?"regexp":"object"}function l(t,e,n,r,h,p,d){h=h||[],d=d||[];var f=h.slice(0);if(void 0!==p){if(r){if("function"==typeof r&&r(f,p))return;if("object"===(void 0===r?"undefined":w(r))){if(r.prefilter&&r.prefilter(f,p))return;if(r.normalize){var m=r.normalize(f,p,t,e);m&&(t=m[0],e=m[1])}}}f.push(p)}"regexp"===u(t)&&"regexp"===u(e)&&(t=t.toString(),e=e.toString());var g=void 0===t?"undefined":w(t),v=void 0===e?"undefined":w(e),y="undefined"!==g||d&&d[d.length-1].lhs&&d[d.length-1].lhs.hasOwnProperty(p),b="undefined"!==v||d&&d[d.length-1].rhs&&d[d.length-1].rhs.hasOwnProperty(p);if(!y&&b)n(new o(f,e));else if(!b&&y)n(new a(f,t));else if(u(t)!==u(e))n(new i(f,t,e));else if("date"===u(t)&&t-e!=0)n(new i(f,t,e));else if("object"===g&&null!==t&&null!==e)if(d.filter(function(e){return e.lhs===t}).length)t!==e&&n(new i(f,t,e));else{if(d.push({lhs:t,rhs:e}),Array.isArray(t)){var x;for(t.length,x=0;x<t.length;x++)x>=e.length?n(new s(f,x,new a(void 0,t[x]))):l(t[x],e[x],n,r,f,x,d);for(;x<e.length;)n(new s(f,x,new o(void 0,e[x++])))}else{var _=Object.keys(t),S=Object.keys(e);_.forEach(function(i,o){var a=S.indexOf(i);a>=0?(l(t[i],e[i],n,r,f,i,d),S=c(S,a)):l(t[i],void 0,n,r,f,i,d)}),S.forEach(function(t){l(void 0,e[t],n,r,f,t,d)})}d.length=d.length-1}else t!==e&&("number"===g&&isNaN(t)&&isNaN(e)||n(new i(f,t,e)))}function h(t,e,n,r){return r=r||[],l(t,e,function(t){t&&r.push(t)},n),r.length?r:void 0}function p(t,e,n){if(t&&e&&n&&n.kind){for(var r=t,i=-1,o=n.path?n.path.length-1:0;++i<o;)void 0===r[n.path[i]]&&(r[n.path[i]]="number"==typeof n.path[i]?[]:{}),r=r[n.path[i]];switch(n.kind){case"A":!function t(e,n,r){if(r.path&&r.path.length){var i,o=e[n],a=r.path.length-1;for(i=0;i<a;i++)o=o[r.path[i]];switch(r.kind){case"A":t(o[r.path[i]],r.index,r.item);break;case"D":delete o[r.path[i]];break;case"E":case"N":o[r.path[i]]=r.rhs}}else switch(r.kind){case"A":t(e[n],r.index,r.item);break;case"D":e=c(e,n);break;case"E":case"N":e[n]=r.rhs}return e}(n.path?r[n.path[i]]:r,n.index,n.item);break;case"D":delete r[n.path[i]];break;case"E":case"N":r[n.path[i]]=n.rhs}}}function d(t,e,n,r){var i=h(t,e);try{r?n.groupCollapsed("diff"):n.group("diff")}catch(t){n.log("diff")}i?i.forEach(function(t){var e=t.kind,r=function(t){var e=t.kind,n=t.path,r=t.lhs,i=t.rhs,o=t.index,a=t.item;switch(e){case"E":return[n.join("."),r,"→",i];case"N":return[n.join("."),i];case"D":return[n.join(".")];case"A":return[n.join(".")+"["+o+"]",a];default:return[]}}(t);n.log.apply(n,["%c "+A[e].text,function(t){return"color: "+A[t].color+"; font-weight: bold"}(e)].concat(S(r)))}):n.log("—— no diff ——");try{n.groupEnd()}catch(t){n.log("—— diff end —— ")}}function f(t,e,n,r){switch(void 0===t?"undefined":w(t)){case"object":return"function"==typeof t[r]?t[r].apply(t,S(n)):t[r];case"function":return t(e);default:return t}}function m(t,e){var n=e.logger,r=e.actionTransformer,i=e.titleFormatter,o=void 0===i?function(t){var e=t.timestamp,n=t.duration;return function(t,r,i){var o=["action"];return o.push("%c"+String(t.type)),e&&o.push("%c@ "+r),n&&o.push("%c(in "+i.toFixed(2)+" ms)"),o.join(" ")}}(e):i,a=e.collapsed,s=e.colors,c=e.level,u=e.diff,l=void 0===e.titleFormatter;t.forEach(function(i,h){var p=i.started,m=i.startedTime,g=i.action,v=i.prevState,y=i.error,b=i.took,_=i.nextState,w=t[h+1];w&&(_=w.prevState,b=w.started-p);var S=r(g),C="function"==typeof a?a(function(){return _},g,i):a,A=x(m),E=s.title?"color: "+s.title(S)+";":"",M=["color: gray; font-weight: lighter;"];M.push(E),e.timestamp&&M.push("color: gray; font-weight: lighter;"),e.duration&&M.push("color: gray; font-weight: lighter;");var T=o(S,A,b);try{C?s.title&&l?n.groupCollapsed.apply(n,["%c "+T].concat(M)):n.groupCollapsed(T):s.title&&l?n.group.apply(n,["%c "+T].concat(M)):n.group(T)}catch(t){n.log(T)}var P=f(c,S,[v],"prevState"),I=f(c,S,[S],"action"),R=f(c,S,[y,v],"error"),O=f(c,S,[_],"nextState");if(P)if(s.prevState){var L="color: "+s.prevState(v)+"; font-weight: bold";n[P]("%c prev state",L,v)}else n[P]("prev state",v);if(I)if(s.action){var k="color: "+s.action(S)+"; font-weight: bold";n[I]("%c action    ",k,S)}else n[I]("action    ",S);if(y&&R)if(s.error){var N="color: "+s.error(y,v)+"; font-weight: bold;";n[R]("%c error     ",N,y)}else n[R]("error     ",y);if(O)if(s.nextState){var D="color: "+s.nextState(_)+"; font-weight: bold";n[O]("%c next state",D,_)}else n[O]("next state",_);u&&d(v,_,n,C);try{n.groupEnd()}catch(t){n.log("—— log end ——")}})}function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},E,t),n=e.logger,r=e.stateTransformer,i=e.errorTransformer,o=e.predicate,a=e.logErrors,s=e.diffPredicate;if(void 0===n)return function(){return function(t){return function(e){return t(e)}}};if(t.getState&&t.dispatch)return console.error("[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n// Logger with default options\nimport { logger } from 'redux-logger'\nconst store = createStore(\n  reducer,\n  applyMiddleware(logger)\n)\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from 'redux-logger'\nconst logger = createLogger({\n  // ...options\n});\nconst store = createStore(\n  reducer,\n  applyMiddleware(logger)\n)\n"),function(){return function(t){return function(e){return t(e)}}};var c=[];return function(t){var n=t.getState;return function(t){return function(u){if("function"==typeof o&&!o(n,u))return t(u);var l={};c.push(l),l.started=_.now(),l.startedTime=new Date,l.prevState=r(n()),l.action=u;var h=void 0;if(a)try{h=t(u)}catch(t){l.error=i(t)}else h=t(u);l.took=_.now()-l.started,l.nextState=r(n());var p=e.diff&&"function"==typeof s?s(n,u):e.diff;if(m(c,Object.assign({},e,{diff:p})),c.length=0,l.error)throw l.error;return h}}}}var v,y,b=function(t,e){return function(t,e){return new Array(e+1).join(t)}("0",e-t.toString().length)+t},x=function(t){return b(t.getHours(),2)+":"+b(t.getMinutes(),2)+":"+b(t.getSeconds(),2)+"."+b(t.getMilliseconds(),3)},_="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance:Date,w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},C=[];v="object"===(void 0===t?"undefined":w(t))&&t?t:"undefined"!=typeof window?window:{},(y=v.DeepDiff)&&C.push(function(){void 0!==y&&v.DeepDiff===h&&(v.DeepDiff=y,y=void 0)}),n(i,r),n(o,r),n(a,r),n(s,r),Object.defineProperties(h,{diff:{value:h,enumerable:!0},observableDiff:{value:l,enumerable:!0},applyDiff:{value:function(t,e,n){t&&e&&l(t,e,function(r){n&&!n(t,e,r)||p(t,e,r)})},enumerable:!0},applyChange:{value:p,enumerable:!0},revertChange:{value:function(t,e,n){if(t&&e&&n&&n.kind){var r,i,o=t;for(i=n.path.length-1,r=0;r<i;r++)void 0===o[n.path[r]]&&(o[n.path[r]]={}),o=o[n.path[r]];switch(n.kind){case"A":!function t(e,n,r){if(r.path&&r.path.length){var i,o=e[n],a=r.path.length-1;for(i=0;i<a;i++)o=o[r.path[i]];switch(r.kind){case"A":t(o[r.path[i]],r.index,r.item);break;case"D":case"E":o[r.path[i]]=r.lhs;break;case"N":delete o[r.path[i]]}}else switch(r.kind){case"A":t(e[n],r.index,r.item);break;case"D":case"E":e[n]=r.lhs;break;case"N":e=c(e,n)}return e}(o[n.path[r]],n.index,n.item);break;case"D":case"E":o[n.path[r]]=n.lhs;break;case"N":delete o[n.path[r]]}}},enumerable:!0},isConflict:{value:function(){return void 0!==y},enumerable:!0},noConflict:{value:function(){return C&&(C.forEach(function(t){t()}),C=null),h},enumerable:!0}});var A={E:{color:"#2196F3",text:"CHANGED:"},N:{color:"#4CAF50",text:"ADDED:"},D:{color:"#F44336",text:"DELETED:"},A:{color:"#2196F3",text:"ARRAY:"}},E={level:"log",logger:console,logErrors:!0,collapsed:void 0,predicate:void 0,duration:!1,timestamp:!0,stateTransformer:function(t){return t},actionTransformer:function(t){return t},errorTransformer:function(t){return t},colors:{title:function(){return"inherit"},prevState:function(){return"#9E9E9E"},action:function(){return"#03A9F4"},nextState:function(){return"#4CAF50"},error:function(){return"#F20404"}},diff:!1,diffPredicate:void 0,transformer:void 0},M=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.dispatch,n=t.getState;return"function"==typeof e||"function"==typeof n?g()({dispatch:e,getState:n}):void console.error("\n[redux-logger v3] BREAKING CHANGE\n[redux-logger v3] Since 3.0.0 redux-logger exports by default logger with default settings.\n[redux-logger v3] Change\n[redux-logger v3] import createLogger from 'redux-logger'\n[redux-logger v3] to\n[redux-logger v3] import { createLogger } from 'redux-logger'\n")};e.defaults=E,e.createLogger=g,e.logger=M,e.default=M,Object.defineProperty(e,"__esModule",{value:!0})}(e)}).call(this,n(21))},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";var r=n(50),i=n(51),o=n(150);t.exports=function(){function t(t,e,n,r,a,s){s!==o&&i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=r,n.PropTypes=n,n}},function(t,e,n){"use strict";t.exports=function(t){var e=(t?t.ownerDocument||t:document).defaultView||window;return!(!t||!("function"==typeof e.Node?t instanceof e.Node:"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName))}},function(t,e,n){"use strict";var r=n(152);t.exports=function(t){return r(t)&&3==t.nodeType}},function(t,e,n){"use strict";var r=n(153);t.exports=function t(e,n){return!(!e||!n)&&(e===n||!r(e)&&(r(n)?t(e,n.parentNode):"contains"in e?e.contains(n):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(n))))}},function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty;function i(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}t.exports=function(t,e){if(i(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(var a=0;a<n.length;a++)if(!r.call(e,n[a])||!i(t[n[a]],e[n[a]]))return!1;return!0}},function(t,e,n){"use strict";t.exports=function(t){if(void 0===(t=t||("undefined"!=typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}},function(t,e,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=i},function(t,e,n){"use strict";
/** @license React v16.3.2
 * react-dom.production.min.js
 *
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var r=n(51),i=n(0),o=n(157),a=n(13),s=n(50),c=n(156),u=n(155),l=n(154),h=n(74);function p(t){for(var e=arguments.length-1,n="http://reactjs.org/docs/error-decoder.html?invariant="+t,i=0;i<e;i++)n+="&args[]="+encodeURIComponent(arguments[i+1]);r(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}i||p("227");var d={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,invokeGuardedCallback:function(t,e,n,r,i,o,a,s,c){(function(t,e,n,r,i,o,a,s,c){this._hasCaughtError=!1,this._caughtError=null;var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(t){this._caughtError=t,this._hasCaughtError=!0}}).apply(d,arguments)},invokeGuardedCallbackAndCatchFirstError:function(t,e,n,r,i,o,a,s,c){if(d.invokeGuardedCallback.apply(this,arguments),d.hasCaughtError()){var u=d.clearCaughtError();d._hasRethrowError||(d._hasRethrowError=!0,d._rethrowError=u)}},rethrowCaughtError:function(){return function(){if(d._hasRethrowError){var t=d._rethrowError;throw d._rethrowError=null,d._hasRethrowError=!1,t}}.apply(d,arguments)},hasCaughtError:function(){return d._hasCaughtError},clearCaughtError:function(){if(d._hasCaughtError){var t=d._caughtError;return d._caughtError=null,d._hasCaughtError=!1,t}p("198")}};var f=null,m={};function g(){if(f)for(var t in m){var e=m[t],n=f.indexOf(t);if(-1<n||p("96",t),!y[n])for(var r in e.extractEvents||p("97",t),y[n]=e,n=e.eventTypes){var i=void 0,o=n[r],a=e,s=r;b.hasOwnProperty(s)&&p("99",s),b[s]=o;var c=o.phasedRegistrationNames;if(c){for(i in c)c.hasOwnProperty(i)&&v(c[i],a,s);i=!0}else o.registrationName?(v(o.registrationName,a,s),i=!0):i=!1;i||p("98",r,t)}}}function v(t,e,n){x[t]&&p("100",t),x[t]=e,_[t]=e.eventTypes[n].dependencies}var y=[],b={},x={},_={};function w(t){f&&p("101"),f=Array.prototype.slice.call(t),g()}function S(t){var e,n=!1;for(e in t)if(t.hasOwnProperty(e)){var r=t[e];m.hasOwnProperty(e)&&m[e]===r||(m[e]&&p("102",e),m[e]=r,n=!0)}n&&g()}var C=Object.freeze({plugins:y,eventNameDispatchConfigs:b,registrationNameModules:x,registrationNameDependencies:_,possibleRegistrationNames:null,injectEventPluginOrder:w,injectEventPluginsByName:S}),A=null,E=null,M=null;function T(t,e,n,r){e=t.type||"unknown-event",t.currentTarget=M(r),d.invokeGuardedCallbackAndCatchFirstError(e,n,void 0,t),t.currentTarget=null}function P(t,e){return null==e&&p("30"),null==t?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}function I(t,e,n){Array.isArray(t)?t.forEach(e,n):t&&e.call(n,t)}var R=null;function O(t,e){if(t){var n=t._dispatchListeners,r=t._dispatchInstances;if(Array.isArray(n))for(var i=0;i<n.length&&!t.isPropagationStopped();i++)T(t,e,n[i],r[i]);else n&&T(t,e,n,r);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}function L(t){return O(t,!0)}function k(t){return O(t,!1)}var N={injectEventPluginOrder:w,injectEventPluginsByName:S};function D(t,e){var n=t.stateNode;if(!n)return null;var r=A(n);if(!r)return null;n=r[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(r=!r.disabled)||(r=!("button"===(t=t.type)||"input"===t||"select"===t||"textarea"===t)),t=!r;break t;default:t=!1}return t?null:(n&&"function"!=typeof n&&p("231",e,typeof n),n)}function z(t,e){null!==t&&(R=P(R,t)),t=R,R=null,t&&(I(t,e?L:k),R&&p("95"),d.rethrowCaughtError())}function F(t,e,n,r){for(var i=null,o=0;o<y.length;o++){var a=y[o];a&&(a=a.extractEvents(t,e,n,r))&&(i=P(i,a))}z(i,!1)}var B=Object.freeze({injection:N,getListener:D,runEventsInBatch:z,runExtractedEventsInBatch:F}),U=Math.random().toString(36).slice(2),j="__reactInternalInstance$"+U,G="__reactEventHandlers$"+U;function V(t){if(t[j])return t[j];for(;!t[j];){if(!t.parentNode)return null;t=t.parentNode}return 5===(t=t[j]).tag||6===t.tag?t:null}function H(t){if(5===t.tag||6===t.tag)return t.stateNode;p("33")}function $(t){return t[G]||null}var W=Object.freeze({precacheFiberNode:function(t,e){e[j]=t},getClosestInstanceFromNode:V,getInstanceFromNode:function(t){return!(t=t[j])||5!==t.tag&&6!==t.tag?null:t},getNodeFromInstance:H,getFiberCurrentPropsFromNode:$,updateFiberProps:function(t,e){t[G]=e}});function q(t){do{t=t.return}while(t&&5!==t.tag);return t||null}function X(t,e,n){for(var r=[];t;)r.push(t),t=q(t);for(t=r.length;0<t--;)e(r[t],"captured",n);for(t=0;t<r.length;t++)e(r[t],"bubbled",n)}function Y(t,e,n){(e=D(t,n.dispatchConfig.phasedRegistrationNames[e]))&&(n._dispatchListeners=P(n._dispatchListeners,e),n._dispatchInstances=P(n._dispatchInstances,t))}function K(t){t&&t.dispatchConfig.phasedRegistrationNames&&X(t._targetInst,Y,t)}function Z(t){if(t&&t.dispatchConfig.phasedRegistrationNames){var e=t._targetInst;X(e=e?q(e):null,Y,t)}}function Q(t,e,n){t&&n&&n.dispatchConfig.registrationName&&(e=D(t,n.dispatchConfig.registrationName))&&(n._dispatchListeners=P(n._dispatchListeners,e),n._dispatchInstances=P(n._dispatchInstances,t))}function J(t){t&&t.dispatchConfig.registrationName&&Q(t._targetInst,null,t)}function tt(t){I(t,K)}function et(t,e,n,r){if(n&&r)t:{for(var i=n,o=r,a=0,s=i;s;s=q(s))a++;s=0;for(var c=o;c;c=q(c))s++;for(;0<a-s;)i=q(i),a--;for(;0<s-a;)o=q(o),s--;for(;a--;){if(i===o||i===o.alternate)break t;i=q(i),o=q(o)}i=null}else i=null;for(o=i,i=[];n&&n!==o&&(null===(a=n.alternate)||a!==o);)i.push(n),n=q(n);for(n=[];r&&r!==o&&(null===(a=r.alternate)||a!==o);)n.push(r),r=q(r);for(r=0;r<i.length;r++)Q(i[r],"bubbled",t);for(t=n.length;0<t--;)Q(n[t],"captured",e)}var nt=Object.freeze({accumulateTwoPhaseDispatches:tt,accumulateTwoPhaseDispatchesSkipTarget:function(t){I(t,Z)},accumulateEnterLeaveDispatches:et,accumulateDirectDispatches:function(t){I(t,J)}}),rt=null;function it(){return!rt&&o.canUseDOM&&(rt="textContent"in document.documentElement?"textContent":"innerText"),rt}var ot={_root:null,_startText:null,_fallbackText:null};function at(){if(ot._fallbackText)return ot._fallbackText;var t,e,n=ot._startText,r=n.length,i=st(),o=i.length;for(t=0;t<r&&n[t]===i[t];t++);var a=r-t;for(e=1;e<=a&&n[r-e]===i[o-e];e++);return ot._fallbackText=i.slice(t,1<e?1-e:void 0),ot._fallbackText}function st(){return"value"in ot._root?ot._root.value:ot._root[it()]}var ct="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),ut={type:null,target:null,currentTarget:s.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};function lt(t,e,n,r){for(var i in this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=n,t=this.constructor.Interface)t.hasOwnProperty(i)&&((e=t[i])?this[i]=e(n):"target"===i?this.target=r:this[i]=n[i]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?s.thatReturnsTrue:s.thatReturnsFalse,this.isPropagationStopped=s.thatReturnsFalse,this}function ht(t,e,n,r){if(this.eventPool.length){var i=this.eventPool.pop();return this.call(i,t,e,n,r),i}return new this(t,e,n,r)}function pt(t){t instanceof this||p("223"),t.destructor(),10>this.eventPool.length&&this.eventPool.push(t)}function dt(t){t.eventPool=[],t.getPooled=ht,t.release=pt}a(lt.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!=typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=s.thatReturnsTrue)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!=typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=s.thatReturnsTrue)},persist:function(){this.isPersistent=s.thatReturnsTrue},isPersistent:s.thatReturnsFalse,destructor:function(){var t,e=this.constructor.Interface;for(t in e)this[t]=null;for(e=0;e<ct.length;e++)this[ct[e]]=null}}),lt.Interface=ut,lt.extend=function(t){function e(){}function n(){return r.apply(this,arguments)}var r=this;e.prototype=r.prototype;var i=new e;return a(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=a({},r.Interface,t),n.extend=r.extend,dt(n),n},dt(lt);var ft=lt.extend({data:null}),mt=lt.extend({data:null}),gt=[9,13,27,32],vt=o.canUseDOM&&"CompositionEvent"in window,yt=null;o.canUseDOM&&"documentMode"in document&&(yt=document.documentMode);var bt=o.canUseDOM&&"TextEvent"in window&&!yt,xt=o.canUseDOM&&(!vt||yt&&8<yt&&11>=yt),_t=String.fromCharCode(32),wt={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"topBlur topCompositionEnd topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"topBlur topCompositionStart topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"topBlur topCompositionUpdate topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")}},St=!1;function Ct(t,e){switch(t){case"topKeyUp":return-1!==gt.indexOf(e.keyCode);case"topKeyDown":return 229!==e.keyCode;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function At(t){return"object"==typeof(t=t.detail)&&"data"in t?t.data:null}var Et=!1;var Mt={eventTypes:wt,extractEvents:function(t,e,n,r){var i=void 0,o=void 0;if(vt)t:{switch(t){case"topCompositionStart":i=wt.compositionStart;break t;case"topCompositionEnd":i=wt.compositionEnd;break t;case"topCompositionUpdate":i=wt.compositionUpdate;break t}i=void 0}else Et?Ct(t,n)&&(i=wt.compositionEnd):"topKeyDown"===t&&229===n.keyCode&&(i=wt.compositionStart);return i?(xt&&(Et||i!==wt.compositionStart?i===wt.compositionEnd&&Et&&(o=at()):(ot._root=r,ot._startText=st(),Et=!0)),i=ft.getPooled(i,e,n,r),o?i.data=o:null!==(o=At(n))&&(i.data=o),tt(i),o=i):o=null,(t=bt?function(t,e){switch(t){case"topCompositionEnd":return At(e);case"topKeyPress":return 32!==e.which?null:(St=!0,_t);case"topTextInput":return(t=e.data)===_t&&St?null:t;default:return null}}(t,n):function(t,e){if(Et)return"topCompositionEnd"===t||!vt&&Ct(t,e)?(t=at(),ot._root=null,ot._startText=null,ot._fallbackText=null,Et=!1,t):null;switch(t){case"topPaste":return null;case"topKeyPress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"topCompositionEnd":return xt?null:e.data;default:return null}}(t,n))?((e=mt.getPooled(wt.beforeInput,e,n,r)).data=t,tt(e)):e=null,null===o?e:null===e?o:[o,e]}},Tt=null,Pt={injectFiberControlledHostComponent:function(t){Tt=t}},It=null,Rt=null;function Ot(t){if(t=E(t)){Tt&&"function"==typeof Tt.restoreControlledState||p("194");var e=A(t.stateNode);Tt.restoreControlledState(t.stateNode,t.type,e)}}function Lt(t){It?Rt?Rt.push(t):Rt=[t]:It=t}function kt(){return null!==It||null!==Rt}function Nt(){if(It){var t=It,e=Rt;if(Rt=It=null,Ot(t),e)for(t=0;t<e.length;t++)Ot(e[t])}}var Dt=Object.freeze({injection:Pt,enqueueStateRestore:Lt,needsStateRestore:kt,restoreStateIfNeeded:Nt});function zt(t,e){return t(e)}function Ft(t,e,n){return t(e,n)}function Bt(){}var Ut=!1;function jt(t,e){if(Ut)return t(e);Ut=!0;try{return zt(t,e)}finally{Ut=!1,kt()&&(Bt(),Nt())}}var Gt={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!Gt[t.type]:"textarea"===e}function Ht(t){return(t=t.target||window).correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}function $t(t,e){return!(!o.canUseDOM||e&&!("addEventListener"in document))&&((e=(t="on"+t)in document)||((e=document.createElement("div")).setAttribute(t,"return;"),e="function"==typeof e[t]),e)}function Wt(t){var e=t.type;return(t=t.nodeName)&&"input"===t.toLowerCase()&&("checkbox"===e||"radio"===e)}function qt(t){t._valueTracker||(t._valueTracker=function(t){var e=Wt(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&"function"==typeof n.get&&"function"==typeof n.set)return Object.defineProperty(t,e,{configurable:!0,get:function(){return n.get.call(this)},set:function(t){r=""+t,n.set.call(this,t)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(t){r=""+t},stopTracking:function(){t._valueTracker=null,delete t[e]}}}(t))}function Xt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Wt(t)?t.checked?"true":"false":t.value),(t=r)!==n&&(e.setValue(t),!0)}var Yt=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Kt="function"==typeof Symbol&&Symbol.for,Zt=Kt?Symbol.for("react.element"):60103,Qt=Kt?Symbol.for("react.call"):60104,Jt=Kt?Symbol.for("react.return"):60105,te=Kt?Symbol.for("react.portal"):60106,ee=Kt?Symbol.for("react.fragment"):60107,ne=Kt?Symbol.for("react.strict_mode"):60108,re=Kt?Symbol.for("react.provider"):60109,ie=Kt?Symbol.for("react.context"):60110,oe=Kt?Symbol.for("react.async_mode"):60111,ae=Kt?Symbol.for("react.forward_ref"):60112,se="function"==typeof Symbol&&Symbol.iterator;function ce(t){return null===t||void 0===t?null:"function"==typeof(t=se&&t[se]||t["@@iterator"])?t:null}function ue(t){if("function"==typeof(t=t.type))return t.displayName||t.name;if("string"==typeof t)return t;switch(t){case ee:return"ReactFragment";case te:return"ReactPortal";case Qt:return"ReactCall";case Jt:return"ReactReturn"}if("object"==typeof t&&null!==t)switch(t.$$typeof){case ae:return""!==(t=t.render.displayName||t.render.name||"")?"ForwardRef("+t+")":"ForwardRef"}return null}function le(t){var e="";do{t:switch(t.tag){case 0:case 1:case 2:case 5:var n=t._debugOwner,r=t._debugSource,i=ue(t),o=null;n&&(o=ue(n)),n=r,i="\n    in "+(i||"Unknown")+(n?" (at "+n.fileName.replace(/^.*[\\\/]/,"")+":"+n.lineNumber+")":o?" (created by "+o+")":"");break t;default:i=""}e+=i,t=t.return}while(t);return e}var he=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,pe={},de={};function fe(t,e,n,r,i){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e}var me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){me[t]=new fe(t,0,!1,t,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];me[e]=new fe(e,1,!1,t[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){me[t]=new fe(t,2,!1,t.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","preserveAlpha"].forEach(function(t){me[t]=new fe(t,2,!1,t,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){me[t]=new fe(t,3,!1,t.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(t){me[t]=new fe(t,3,!0,t.toLowerCase(),null)}),["capture","download"].forEach(function(t){me[t]=new fe(t,4,!1,t.toLowerCase(),null)}),["cols","rows","size","span"].forEach(function(t){me[t]=new fe(t,6,!1,t.toLowerCase(),null)}),["rowSpan","start"].forEach(function(t){me[t]=new fe(t,5,!1,t.toLowerCase(),null)});var ge=/[\-:]([a-z])/g;function ve(t){return t[1].toUpperCase()}function ye(t,e,n,r){var i=me.hasOwnProperty(e)?me[e]:null;(null!==i?0===i.type:!r&&(2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])))||(function(t,e,n,r){if(null===e||void 0===e||function(t,e,n,r){if(null!==n&&0===n.type)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(t=t.toLowerCase().slice(0,5))&&"aria-"!==t);default:return!1}}(t,e,n,r))return!0;if(null!==n)switch(n.type){case 3:return!e;case 4:return!1===e;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}(e,n,i,r)&&(n=null),r||null===i?function(t){return!!de.hasOwnProperty(t)||!pe.hasOwnProperty(t)&&(he.test(t)?de[t]=!0:(pe[t]=!0,!1))}(e)&&(null===n?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=null===n?3!==i.type&&"":n:(e=i.attributeName,r=i.attributeNamespace,null===n?t.removeAttribute(e):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}function be(t,e){var n=e.checked;return a({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:t._wrapperState.initialChecked})}function xe(t,e){var n=null==e.defaultValue?"":e.defaultValue,r=null!=e.checked?e.checked:e.defaultChecked;n=Ae(null!=e.value?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function _e(t,e){null!=(e=e.checked)&&ye(t,"checked",e,!1)}function we(t,e){_e(t,e);var n=Ae(e.value);null!=n&&("number"===e.type?(0===n&&""===t.value||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n)),e.hasOwnProperty("value")?Ce(t,e.type,n):e.hasOwnProperty("defaultValue")&&Ce(t,e.type,Ae(e.defaultValue)),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked)}function Se(t,e){(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue"))&&(""===t.value&&(t.value=""+t._wrapperState.initialValue),t.defaultValue=""+t._wrapperState.initialValue),""!==(e=t.name)&&(t.name=""),t.defaultChecked=!t.defaultChecked,t.defaultChecked=!t.defaultChecked,""!==e&&(t.name=e)}function Ce(t,e,n){"number"===e&&t.ownerDocument.activeElement===t||(null==n?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}function Ae(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ge,ve);me[e]=new fe(e,1,!1,t,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ge,ve);me[e]=new fe(e,1,!1,t,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ge,ve);me[e]=new fe(e,1,!1,t,"http://www.w3.org/XML/1998/namespace")}),me.tabIndex=new fe("tabIndex",1,!1,"tabindex",null);var Ee={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"topBlur topChange topClick topFocus topInput topKeyDown topKeyUp topSelectionChange".split(" ")}};function Me(t,e,n){return(t=lt.getPooled(Ee.change,t,e,n)).type="change",Lt(n),tt(t),t}var Te=null,Pe=null;function Ie(t){z(t,!1)}function Re(t){if(Xt(H(t)))return t}function Oe(t,e){if("topChange"===t)return e}var Le=!1;function ke(){Te&&(Te.detachEvent("onpropertychange",Ne),Pe=Te=null)}function Ne(t){"value"===t.propertyName&&Re(Pe)&&jt(Ie,t=Me(Pe,t,Ht(t)))}function De(t,e,n){"topFocus"===t?(ke(),Pe=n,(Te=e).attachEvent("onpropertychange",Ne)):"topBlur"===t&&ke()}function ze(t){if("topSelectionChange"===t||"topKeyUp"===t||"topKeyDown"===t)return Re(Pe)}function Fe(t,e){if("topClick"===t)return Re(e)}function Be(t,e){if("topInput"===t||"topChange"===t)return Re(e)}o.canUseDOM&&(Le=$t("input")&&(!document.documentMode||9<document.documentMode));var Ue={eventTypes:Ee,_isInputEventSupported:Le,extractEvents:function(t,e,n,r){var i=e?H(e):window,o=void 0,a=void 0,s=i.nodeName&&i.nodeName.toLowerCase();if("select"===s||"input"===s&&"file"===i.type?o=Oe:Vt(i)?Le?o=Be:(o=ze,a=De):(s=i.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(o=Fe),o&&(o=o(t,e)))return Me(o,n,r);a&&a(t,i,e),"topBlur"===t&&null!=e&&(t=e._wrapperState||i._wrapperState)&&t.controlled&&"number"===i.type&&Ce(i,"number",i.value)}},je=lt.extend({view:null,detail:null}),Ge={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ve(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):!!(t=Ge[t])&&!!e[t]}function He(){return Ve}var $e=je.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:He,button:null,buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)}}),We={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},qe={eventTypes:We,extractEvents:function(t,e,n,r){if("topMouseOver"===t&&(n.relatedTarget||n.fromElement)||"topMouseOut"!==t&&"topMouseOver"!==t)return null;var i=r.window===r?r:(i=r.ownerDocument)?i.defaultView||i.parentWindow:window;if("topMouseOut"===t?(t=e,e=(e=n.relatedTarget||n.toElement)?V(e):null):t=null,t===e)return null;var o=null==t?i:H(t);i=null==e?i:H(e);var a=$e.getPooled(We.mouseLeave,t,n,r);return a.type="mouseleave",a.target=o,a.relatedTarget=i,(n=$e.getPooled(We.mouseEnter,e,n,r)).type="mouseenter",n.target=i,n.relatedTarget=o,et(a,n,t,e),[a,n]}};function Xe(t){var e=t;if(t.alternate)for(;e.return;)e=e.return;else{if(0!=(2&e.effectTag))return 1;for(;e.return;)if(0!=(2&(e=e.return).effectTag))return 1}return 3===e.tag?2:3}function Ye(t){return!!(t=t._reactInternalFiber)&&2===Xe(t)}function Ke(t){2!==Xe(t)&&p("188")}function Ze(t){var e=t.alternate;if(!e)return 3===(e=Xe(t))&&p("188"),1===e?null:t;for(var n=t,r=e;;){var i=n.return,o=i?i.alternate:null;if(!i||!o)break;if(i.child===o.child){for(var a=i.child;a;){if(a===n)return Ke(i),t;if(a===r)return Ke(i),e;a=a.sibling}p("188")}if(n.return!==r.return)n=i,r=o;else{a=!1;for(var s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}a||p("189")}}n.alternate!==r&&p("190")}return 3!==n.tag&&p("188"),n.stateNode.current===n?t:e}function Qe(t){if(!(t=Ze(t)))return null;for(var e=t;;){if(5===e.tag||6===e.tag)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}var Je=lt.extend({animationName:null,elapsedTime:null,pseudoElement:null}),tn=lt.extend({clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),en=je.extend({relatedTarget:null});function nn(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,10===t&&(t=13),32<=t||13===t?t:0}var rn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},on={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},an=je.extend({key:function(t){if(t.key){var e=rn[t.key]||t.key;if("Unidentified"!==e)return e}return"keypress"===t.type?13===(t=nn(t))?"Enter":String.fromCharCode(t):"keydown"===t.type||"keyup"===t.type?on[t.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:He,charCode:function(t){return"keypress"===t.type?nn(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?nn(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),sn=$e.extend({dataTransfer:null}),cn=je.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:He}),un=lt.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),ln=$e.extend({deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),hn={},pn={};function dn(t,e){var n=t[0].toUpperCase()+t.slice(1),r="on"+n;e={phasedRegistrationNames:{bubbled:r,captured:r+"Capture"},dependencies:[n="top"+n],isInteractive:e},hn[t]=e,pn[n]=e}"blur cancel click close contextMenu copy cut doubleClick dragEnd dragStart drop focus input invalid keyDown keyPress keyUp mouseDown mouseUp paste pause play rateChange reset seeked submit touchCancel touchEnd touchStart volumeChange".split(" ").forEach(function(t){dn(t,!0)}),"abort animationEnd animationIteration animationStart canPlay canPlayThrough drag dragEnter dragExit dragLeave dragOver durationChange emptied encrypted ended error load loadedData loadedMetadata loadStart mouseMove mouseOut mouseOver playing progress scroll seeking stalled suspend timeUpdate toggle touchMove transitionEnd waiting wheel".split(" ").forEach(function(t){dn(t,!1)});var fn={eventTypes:hn,isInteractiveTopLevelEventType:function(t){return void 0!==(t=pn[t])&&!0===t.isInteractive},extractEvents:function(t,e,n,r){var i=pn[t];if(!i)return null;switch(t){case"topKeyPress":if(0===nn(n))return null;case"topKeyDown":case"topKeyUp":t=an;break;case"topBlur":case"topFocus":t=en;break;case"topClick":if(2===n.button)return null;case"topDoubleClick":case"topMouseDown":case"topMouseMove":case"topMouseUp":case"topMouseOut":case"topMouseOver":case"topContextMenu":t=$e;break;case"topDrag":case"topDragEnd":case"topDragEnter":case"topDragExit":case"topDragLeave":case"topDragOver":case"topDragStart":case"topDrop":t=sn;break;case"topTouchCancel":case"topTouchEnd":case"topTouchMove":case"topTouchStart":t=cn;break;case"topAnimationEnd":case"topAnimationIteration":case"topAnimationStart":t=Je;break;case"topTransitionEnd":t=un;break;case"topScroll":t=je;break;case"topWheel":t=ln;break;case"topCopy":case"topCut":case"topPaste":t=tn;break;default:t=lt}return tt(e=t.getPooled(i,e,n,r)),e}},mn=fn.isInteractiveTopLevelEventType,gn=[];function vn(t){var e=t.targetInst;do{if(!e){t.ancestors.push(e);break}var n;for(n=e;n.return;)n=n.return;if(!(n=3!==n.tag?null:n.stateNode.containerInfo))break;t.ancestors.push(e),e=V(n)}while(e);for(n=0;n<t.ancestors.length;n++)e=t.ancestors[n],F(t.topLevelType,e,t.nativeEvent,Ht(t.nativeEvent))}var yn=!0;function bn(t){yn=!!t}function xn(t,e,n){if(!n)return null;t=(mn(t)?wn:Sn).bind(null,t),n.addEventListener(e,t,!1)}function _n(t,e,n){if(!n)return null;t=(mn(t)?wn:Sn).bind(null,t),n.addEventListener(e,t,!0)}function wn(t,e){Ft(Sn,t,e)}function Sn(t,e){if(yn){var n=Ht(e);if(null!==(n=V(n))&&"number"==typeof n.tag&&2!==Xe(n)&&(n=null),gn.length){var r=gn.pop();r.topLevelType=t,r.nativeEvent=e,r.targetInst=n,t=r}else t={topLevelType:t,nativeEvent:e,targetInst:n,ancestors:[]};try{jt(vn,t)}finally{t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>gn.length&&gn.push(t)}}}var Cn=Object.freeze({get _enabled(){return yn},setEnabled:bn,isEnabled:function(){return yn},trapBubbledEvent:xn,trapCapturedEvent:_n,dispatchEvent:Sn});function An(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n["ms"+t]="MS"+e,n["O"+t]="o"+e.toLowerCase(),n}var En={animationend:An("Animation","AnimationEnd"),animationiteration:An("Animation","AnimationIteration"),animationstart:An("Animation","AnimationStart"),transitionend:An("Transition","TransitionEnd")},Mn={},Tn={};function Pn(t){if(Mn[t])return Mn[t];if(!En[t])return t;var e,n=En[t];for(e in n)if(n.hasOwnProperty(e)&&e in Tn)return Mn[t]=n[e];return t}o.canUseDOM&&(Tn=document.createElement("div").style,"AnimationEvent"in window||(delete En.animationend.animation,delete En.animationiteration.animation,delete En.animationstart.animation),"TransitionEvent"in window||delete En.transitionend.transition);var In={topAnimationEnd:Pn("animationend"),topAnimationIteration:Pn("animationiteration"),topAnimationStart:Pn("animationstart"),topBlur:"blur",topCancel:"cancel",topChange:"change",topClick:"click",topClose:"close",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoad:"load",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:Pn("transitionend"),topWheel:"wheel"},Rn={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},On={},Ln=0,kn="_reactListenersID"+(""+Math.random()).slice(2);function Nn(t){return Object.prototype.hasOwnProperty.call(t,kn)||(t[kn]=Ln++,On[t[kn]]={}),On[t[kn]]}function Dn(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function zn(t,e){var n,r=Dn(t);for(t=0;r;){if(3===r.nodeType){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}t:{for(;r;){if(r.nextSibling){r=r.nextSibling;break t}r=r.parentNode}r=void 0}r=Dn(r)}}function Fn(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&"text"===t.type||"textarea"===e||"true"===t.contentEditable)}var Bn=o.canUseDOM&&"documentMode"in document&&11>=document.documentMode,Un={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"topBlur topContextMenu topFocus topKeyDown topKeyUp topMouseDown topMouseUp topSelectionChange".split(" ")}},jn=null,Gn=null,Vn=null,Hn=!1;function $n(t,e){if(Hn||null==jn||jn!==c())return null;var n=jn;return"selectionStart"in n&&Fn(n)?n={start:n.selectionStart,end:n.selectionEnd}:window.getSelection?n={anchorNode:(n=window.getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}:n=void 0,Vn&&u(Vn,n)?null:(Vn=n,(t=lt.getPooled(Un.select,Gn,t,e)).type="select",t.target=jn,tt(t),t)}var Wn={eventTypes:Un,extractEvents:function(t,e,n,r){var i,o=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(i=!o)){t:{o=Nn(o),i=_.onSelect;for(var a=0;a<i.length;a++){var s=i[a];if(!o.hasOwnProperty(s)||!o[s]){o=!1;break t}}o=!0}i=!o}if(i)return null;switch(o=e?H(e):window,t){case"topFocus":(Vt(o)||"true"===o.contentEditable)&&(jn=o,Gn=e,Vn=null);break;case"topBlur":Vn=Gn=jn=null;break;case"topMouseDown":Hn=!0;break;case"topContextMenu":case"topMouseUp":return Hn=!1,$n(n,r);case"topSelectionChange":if(Bn)break;case"topKeyDown":case"topKeyUp":return $n(n,r)}return null}};function qn(t,e,n,r){this.tag=t,this.key=n,this.stateNode=this.type=null,this.sibling=this.child=this.return=null,this.index=0,this.ref=null,this.pendingProps=e,this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.expirationTime=0,this.alternate=null}function Xn(t,e,n){var r=t.alternate;return null===r?((r=new qn(t.tag,e,t.key,t.mode)).type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.effectTag=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.expirationTime=n,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Yn(t,e,n){var r=t.type,i=t.key;t=t.props;var o=void 0;if("function"==typeof r)o=r.prototype&&r.prototype.isReactComponent?2:0;else if("string"==typeof r)o=5;else switch(r){case ee:return Kn(t.children,e,n,i);case oe:o=11,e|=3;break;case ne:o=11,e|=2;break;case Qt:o=7;break;case Jt:o=9;break;default:if("object"==typeof r&&null!==r)switch(r.$$typeof){case re:o=13;break;case ie:o=12;break;case ae:o=14;break;default:if("number"==typeof r.tag)return(e=r).pendingProps=t,e.expirationTime=n,e;p("130",null==r?r:typeof r,"")}else p("130",null==r?r:typeof r,"")}return(e=new qn(o,t,i,e)).type=r,e.expirationTime=n,e}function Kn(t,e,n,r){return(t=new qn(10,t,r,e)).expirationTime=n,t}function Zn(t,e,n){return(t=new qn(6,t,null,e)).expirationTime=n,t}function Qn(t,e,n){return(e=new qn(4,null!==t.children?t.children:[],t.key,e)).expirationTime=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}N.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin TapEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),A=W.getFiberCurrentPropsFromNode,E=W.getInstanceFromNode,M=W.getNodeFromInstance,N.injectEventPluginsByName({SimpleEventPlugin:fn,EnterLeaveEventPlugin:qe,ChangeEventPlugin:Ue,SelectEventPlugin:Wn,BeforeInputEventPlugin:Mt});var Jn=null,tr=null;function er(t){return function(e){try{return t(e)}catch(t){}}}function nr(t){"function"==typeof Jn&&Jn(t)}function rr(t){"function"==typeof tr&&tr(t)}function ir(t){return{baseState:t,expirationTime:0,first:null,last:null,callbackList:null,hasForceUpdate:!1,isInitialized:!1,capturedValues:null}}function or(t,e){null===t.last?t.first=t.last=e:(t.last.next=e,t.last=e),(0===t.expirationTime||t.expirationTime>e.expirationTime)&&(t.expirationTime=e.expirationTime)}new Set;var ar=void 0,sr=void 0;function cr(t){ar=sr=null;var e=t.alternate,n=t.updateQueue;null===n&&(n=t.updateQueue=ir(null)),null!==e?null===(t=e.updateQueue)&&(t=e.updateQueue=ir(null)):t=null,ar=n,sr=t!==n?t:null}function ur(t,e){cr(t),t=ar;var n=sr;null===n?or(t,e):null===t.last||null===n.last?(or(t,e),or(n,e)):(or(t,e),n.last=e)}function lr(t,e,n,r){return"function"==typeof(t=t.partialState)?t.call(e,n,r):t}function hr(t,e,n,r,i,o){null!==t&&t.updateQueue===n&&(n=e.updateQueue={baseState:n.baseState,expirationTime:n.expirationTime,first:n.first,last:n.last,isInitialized:n.isInitialized,capturedValues:n.capturedValues,callbackList:null,hasForceUpdate:!1}),n.expirationTime=0,n.isInitialized?t=n.baseState:(t=n.baseState=e.memoizedState,n.isInitialized=!0);for(var s=!0,c=n.first,u=!1;null!==c;){var l=c.expirationTime;if(l>o){var h=n.expirationTime;(0===h||h>l)&&(n.expirationTime=l),u||(u=!0,n.baseState=t)}else u||(n.first=c.next,null===n.first&&(n.last=null)),c.isReplace?(t=lr(c,r,t,i),s=!0):(l=lr(c,r,t,i))&&(t=s?a({},t,l):a(t,l),s=!1),c.isForced&&(n.hasForceUpdate=!0),null!==c.callback&&(null===(l=n.callbackList)&&(l=n.callbackList=[]),l.push(c)),null!==c.capturedValue&&(null===(l=n.capturedValues)?n.capturedValues=[c.capturedValue]:l.push(c.capturedValue));c=c.next}return null!==n.callbackList?e.effectTag|=32:null!==n.first||n.hasForceUpdate||null!==n.capturedValues||(e.updateQueue=null),u||(n.baseState=t),t}function pr(t,e){var n=t.callbackList;if(null!==n)for(t.callbackList=null,t=0;t<n.length;t++){var r=n[t],i=r.callback;r.callback=null,"function"!=typeof i&&p("191",i),i.call(e)}}var dr=Array.isArray;function fr(t,e,n){if(null!==(t=n.ref)&&"function"!=typeof t&&"object"!=typeof t){if(n._owner){var r=void 0;(n=n._owner)&&(2!==n.tag&&p("110"),r=n.stateNode),r||p("147",t);var i=""+t;return null!==e&&null!==e.ref&&e.ref._stringRef===i?e.ref:((e=function(t){var e=r.refs===h?r.refs={}:r.refs;null===t?delete e[i]:e[i]=t})._stringRef=i,e)}"string"!=typeof t&&p("148"),n._owner||p("254",t)}return t}function mr(t,e){"textarea"!==t.type&&p("31","[object Object]"===Object.prototype.toString.call(e)?"object with keys {"+Object.keys(e).join(", ")+"}":e,"")}function gr(t){function e(e,n){if(t){var r=e.lastEffect;null!==r?(r.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!t)return null;for(;null!==r;)e(n,r),r=r.sibling;return null}function r(t,e){for(t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function i(t,e,n){return(t=Xn(t,e,n)).index=0,t.sibling=null,t}function o(e,n,r){return e.index=r,t?null!==(r=e.alternate)?(r=r.index)<n?(e.effectTag=2,n):r:(e.effectTag=2,n):n}function a(e){return t&&null===e.alternate&&(e.effectTag=2),e}function s(t,e,n,r){return null===e||6!==e.tag?((e=Zn(n,t.mode,r)).return=t,e):((e=i(e,n,r)).return=t,e)}function c(t,e,n,r){return null!==e&&e.type===n.type?((r=i(e,n.props,r)).ref=fr(t,e,n),r.return=t,r):((r=Yn(n,t.mode,r)).ref=fr(t,e,n),r.return=t,r)}function u(t,e,n,r){return null===e||4!==e.tag||e.stateNode.containerInfo!==n.containerInfo||e.stateNode.implementation!==n.implementation?((e=Qn(n,t.mode,r)).return=t,e):((e=i(e,n.children||[],r)).return=t,e)}function l(t,e,n,r,o){return null===e||10!==e.tag?((e=Kn(n,t.mode,r,o)).return=t,e):((e=i(e,n,r)).return=t,e)}function h(t,e,n){if("string"==typeof e||"number"==typeof e)return(e=Zn(""+e,t.mode,n)).return=t,e;if("object"==typeof e&&null!==e){switch(e.$$typeof){case Zt:return(n=Yn(e,t.mode,n)).ref=fr(t,null,e),n.return=t,n;case te:return(e=Qn(e,t.mode,n)).return=t,e}if(dr(e)||ce(e))return(e=Kn(e,t.mode,n,null)).return=t,e;mr(t,e)}return null}function d(t,e,n,r){var i=null!==e?e.key:null;if("string"==typeof n||"number"==typeof n)return null!==i?null:s(t,e,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case Zt:return n.key===i?n.type===ee?l(t,e,n.props.children,r,i):c(t,e,n,r):null;case te:return n.key===i?u(t,e,n,r):null}if(dr(n)||ce(n))return null!==i?null:l(t,e,n,r,null);mr(t,n)}return null}function f(t,e,n,r,i){if("string"==typeof r||"number"==typeof r)return s(e,t=t.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case Zt:return t=t.get(null===r.key?n:r.key)||null,r.type===ee?l(e,t,r.props.children,i,r.key):c(e,t,r,i);case te:return u(e,t=t.get(null===r.key?n:r.key)||null,r,i)}if(dr(r)||ce(r))return l(e,t=t.get(n)||null,r,i,null);mr(e,r)}return null}function m(i,a,s,c){for(var u=null,l=null,p=a,m=a=0,g=null;null!==p&&m<s.length;m++){p.index>m?(g=p,p=null):g=p.sibling;var v=d(i,p,s[m],c);if(null===v){null===p&&(p=g);break}t&&p&&null===v.alternate&&e(i,p),a=o(v,a,m),null===l?u=v:l.sibling=v,l=v,p=g}if(m===s.length)return n(i,p),u;if(null===p){for(;m<s.length;m++)(p=h(i,s[m],c))&&(a=o(p,a,m),null===l?u=p:l.sibling=p,l=p);return u}for(p=r(i,p);m<s.length;m++)(g=f(p,i,m,s[m],c))&&(t&&null!==g.alternate&&p.delete(null===g.key?m:g.key),a=o(g,a,m),null===l?u=g:l.sibling=g,l=g);return t&&p.forEach(function(t){return e(i,t)}),u}function g(i,a,s,c){var u=ce(s);"function"!=typeof u&&p("150"),null==(s=u.call(s))&&p("151");for(var l=u=null,m=a,g=a=0,v=null,y=s.next();null!==m&&!y.done;g++,y=s.next()){m.index>g?(v=m,m=null):v=m.sibling;var b=d(i,m,y.value,c);if(null===b){m||(m=v);break}t&&m&&null===b.alternate&&e(i,m),a=o(b,a,g),null===l?u=b:l.sibling=b,l=b,m=v}if(y.done)return n(i,m),u;if(null===m){for(;!y.done;g++,y=s.next())null!==(y=h(i,y.value,c))&&(a=o(y,a,g),null===l?u=y:l.sibling=y,l=y);return u}for(m=r(i,m);!y.done;g++,y=s.next())null!==(y=f(m,i,g,y.value,c))&&(t&&null!==y.alternate&&m.delete(null===y.key?g:y.key),a=o(y,a,g),null===l?u=y:l.sibling=y,l=y);return t&&m.forEach(function(t){return e(i,t)}),u}return function(t,r,o,s){"object"==typeof o&&null!==o&&o.type===ee&&null===o.key&&(o=o.props.children);var c="object"==typeof o&&null!==o;if(c)switch(o.$$typeof){case Zt:t:{var u=o.key;for(c=r;null!==c;){if(c.key===u){if(10===c.tag?o.type===ee:c.type===o.type){n(t,c.sibling),(r=i(c,o.type===ee?o.props.children:o.props,s)).ref=fr(t,c,o),r.return=t,t=r;break t}n(t,c);break}e(t,c),c=c.sibling}o.type===ee?((r=Kn(o.props.children,t.mode,s,o.key)).return=t,t=r):((s=Yn(o,t.mode,s)).ref=fr(t,r,o),s.return=t,t=s)}return a(t);case te:t:{for(c=o.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(t,r.sibling),(r=i(r,o.children||[],s)).return=t,t=r;break t}n(t,r);break}e(t,r),r=r.sibling}(r=Qn(o,t.mode,s)).return=t,t=r}return a(t)}if("string"==typeof o||"number"==typeof o)return o=""+o,null!==r&&6===r.tag?(n(t,r.sibling),(r=i(r,o,s)).return=t,t=r):(n(t,r),(r=Zn(o,t.mode,s)).return=t,t=r),a(t);if(dr(o))return m(t,r,o,s);if(ce(o))return g(t,r,o,s);if(c&&mr(t,o),void 0===o)switch(t.tag){case 2:case 1:p("152",(s=t.type).displayName||s.name||"Component")}return n(t,r)}}var vr=gr(!0),yr=gr(!1);function br(t,e,n,r,i,o,s){function c(t,e,n){l(t,e,n,e.expirationTime)}function l(t,e,n,r){e.child=null===t?yr(e,null,n,r):vr(e,t.child,n,r)}function d(t,e){var n=e.ref;(null===t&&null!==n||null!==t&&t.ref!==n)&&(e.effectTag|=128)}function f(t,e,n,r,i,o){if(d(t,e),!n&&!i)return r&&T(e,!1),v(t,e);n=e.stateNode,Yt.current=e;var a=i?null:n.render();return e.effectTag|=1,i&&(l(t,e,null,o),e.child=null),l(t,e,a,o),e.memoizedState=n.state,e.memoizedProps=n.props,r&&T(e,!0),e.child}function m(t){var e=t.stateNode;e.pendingContext?M(t,e.pendingContext,e.pendingContext!==e.context):e.context&&M(t,e.context,!1),_(t,e.containerInfo)}function g(t,e,n,r){var i=t.child;for(null!==i&&(i.return=t);null!==i;){switch(i.tag){case 12:var o=0|i.stateNode;if(i.type===e&&0!=(o&n)){for(o=i;null!==o;){var a=o.alternate;if(0===o.expirationTime||o.expirationTime>r)o.expirationTime=r,null!==a&&(0===a.expirationTime||a.expirationTime>r)&&(a.expirationTime=r);else{if(null===a||!(0===a.expirationTime||a.expirationTime>r))break;a.expirationTime=r}o=o.return}o=null}else o=i.child;break;case 13:o=i.type===t.type?null:i.child;break;default:o=i.child}if(null!==o)o.return=i;else for(o=i;null!==o;){if(o===t){o=null;break}if(null!==(i=o.sibling)){o=i;break}o=o.return}i=o}}function v(t,e){if(null!==t&&e.child!==t.child&&p("153"),null!==e.child){var n=Xn(t=e.child,t.pendingProps,t.expirationTime);for(e.child=n,n.return=e;null!==t.sibling;)t=t.sibling,(n=n.sibling=Xn(t,t.pendingProps,t.expirationTime)).return=e;n.sibling=null}return e.child}var y=t.shouldSetTextContent,b=t.shouldDeprioritizeSubtree,x=e.pushHostContext,_=e.pushHostContainer,w=r.pushProvider,S=n.getMaskedContext,C=n.getUnmaskedContext,A=n.hasContextChanged,E=n.pushContextProvider,M=n.pushTopLevelContextObject,T=n.invalidateContextProvider,P=i.enterHydrationState,I=i.resetHydrationState,R=i.tryToClaimNextHydratableInstance,O=(t=function(t,e,n,r,i){function o(t,e,n,r,i,o){if(null===e||null!==t.updateQueue&&t.updateQueue.hasForceUpdate)return!0;var a=t.stateNode;return t=t.type,"function"==typeof a.shouldComponentUpdate?a.shouldComponentUpdate(n,i,o):!(t.prototype&&t.prototype.isPureReactComponent&&u(e,n)&&u(r,i))}function s(t,e){e.updater=v,t.stateNode=e,e._reactInternalFiber=t}function c(t,e,n,r){t=e.state,"function"==typeof e.componentWillReceiveProps&&e.componentWillReceiveProps(n,r),"function"==typeof e.UNSAFE_componentWillReceiveProps&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&v.enqueueReplaceState(e,e.state,null)}function l(t,e,n,r){if("function"==typeof(t=t.type).getDerivedStateFromProps)return t.getDerivedStateFromProps.call(null,n,r)}var p=t.cacheContext,d=t.getMaskedContext,f=t.getUnmaskedContext,m=t.isContextConsumer,g=t.hasContextChanged,v={isMounted:Ye,enqueueSetState:function(t,r,i){t=t._reactInternalFiber,i=void 0===i?null:i;var o=n(t);ur(t,{expirationTime:o,partialState:r,callback:i,isReplace:!1,isForced:!1,capturedValue:null,next:null}),e(t,o)},enqueueReplaceState:function(t,r,i){t=t._reactInternalFiber,i=void 0===i?null:i;var o=n(t);ur(t,{expirationTime:o,partialState:r,callback:i,isReplace:!0,isForced:!1,capturedValue:null,next:null}),e(t,o)},enqueueForceUpdate:function(t,r){t=t._reactInternalFiber,r=void 0===r?null:r;var i=n(t);ur(t,{expirationTime:i,partialState:null,callback:r,isReplace:!1,isForced:!0,capturedValue:null,next:null}),e(t,i)}};return{adoptClassInstance:s,callGetDerivedStateFromProps:l,constructClassInstance:function(t,e){var n=t.type,r=f(t),i=m(t),o=i?d(t,r):h,c=null!==(n=new n(e,o)).state&&void 0!==n.state?n.state:null;return s(t,n),t.memoizedState=c,null!==(e=l(t,0,e,c))&&void 0!==e&&(t.memoizedState=a({},t.memoizedState,e)),i&&p(t,r,o),n},mountClassInstance:function(t,e){var n=t.type,r=t.alternate,i=t.stateNode,o=t.pendingProps,a=f(t);i.props=o,i.state=t.memoizedState,i.refs=h,i.context=d(t,a),"function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(n=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),n!==i.state&&v.enqueueReplaceState(i,i.state,null),null!==(n=t.updateQueue)&&(i.state=hr(r,t,n,i,o,e))),"function"==typeof i.componentDidMount&&(t.effectTag|=4)},resumeMountClassInstance:function(t,e){var n=t.type,s=t.stateNode;s.props=t.memoizedProps,s.state=t.memoizedState;var u=t.memoizedProps,h=t.pendingProps,p=s.context,m=f(t);m=d(t,m),(n="function"==typeof n.getDerivedStateFromProps||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(u!==h||p!==m)&&c(t,s,h,m),p=t.memoizedState,e=null!==t.updateQueue?hr(null,t,t.updateQueue,s,h,e):p;var v=void 0;if(u!==h&&(v=l(t,0,h,e)),null!==v&&void 0!==v){e=null===e||void 0===e?v:a({},e,v);var y=t.updateQueue;null!==y&&(y.baseState=a({},y.baseState,v))}return u!==h||p!==e||g()||null!==t.updateQueue&&t.updateQueue.hasForceUpdate?((u=o(t,u,h,p,e,m))?(n||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.effectTag|=4)):("function"==typeof s.componentDidMount&&(t.effectTag|=4),r(t,h),i(t,e)),s.props=h,s.state=e,s.context=m,u):("function"==typeof s.componentDidMount&&(t.effectTag|=4),!1)},updateClassInstance:function(t,e,n){var s=e.type,u=e.stateNode;u.props=e.memoizedProps,u.state=e.memoizedState;var h=e.memoizedProps,p=e.pendingProps,m=u.context,v=f(e);v=d(e,v),(s="function"==typeof s.getDerivedStateFromProps||"function"==typeof u.getSnapshotBeforeUpdate)||"function"!=typeof u.UNSAFE_componentWillReceiveProps&&"function"!=typeof u.componentWillReceiveProps||(h!==p||m!==v)&&c(e,u,p,v),m=e.memoizedState,n=null!==e.updateQueue?hr(t,e,e.updateQueue,u,p,n):m;var y=void 0;if(h!==p&&(y=l(e,0,p,n)),null!==y&&void 0!==y){n=null===n||void 0===n?y:a({},n,y);var b=e.updateQueue;null!==b&&(b.baseState=a({},b.baseState,y))}return h!==p||m!==n||g()||null!==e.updateQueue&&e.updateQueue.hasForceUpdate?((y=o(e,h,p,m,n,v))?(s||"function"!=typeof u.UNSAFE_componentWillUpdate&&"function"!=typeof u.componentWillUpdate||("function"==typeof u.componentWillUpdate&&u.componentWillUpdate(p,n,v),"function"==typeof u.UNSAFE_componentWillUpdate&&u.UNSAFE_componentWillUpdate(p,n,v)),"function"==typeof u.componentDidUpdate&&(e.effectTag|=4),"function"==typeof u.getSnapshotBeforeUpdate&&(e.effectTag|=2048)):("function"!=typeof u.componentDidUpdate||h===t.memoizedProps&&m===t.memoizedState||(e.effectTag|=4),"function"!=typeof u.getSnapshotBeforeUpdate||h===t.memoizedProps&&m===t.memoizedState||(e.effectTag|=2048),r(e,p),i(e,n)),u.props=p,u.state=n,u.context=v,y):("function"!=typeof u.componentDidUpdate||h===t.memoizedProps&&m===t.memoizedState||(e.effectTag|=4),"function"!=typeof u.getSnapshotBeforeUpdate||h===t.memoizedProps&&m===t.memoizedState||(e.effectTag|=2048),!1)}}}(n,o,s,function(t,e){t.memoizedProps=e},function(t,e){t.memoizedState=e})).adoptClassInstance,L=t.callGetDerivedStateFromProps,k=t.constructClassInstance,N=t.mountClassInstance,D=t.resumeMountClassInstance,z=t.updateClassInstance;return{beginWork:function(t,e,n){if(0===e.expirationTime||e.expirationTime>n){switch(e.tag){case 3:m(e);break;case 2:E(e);break;case 4:_(e,e.stateNode.containerInfo);break;case 13:w(e)}return null}switch(e.tag){case 0:null!==t&&p("155");var r=e.type,i=e.pendingProps,o=C(e);return r=r(i,o=S(e,o)),e.effectTag|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof?(o=e.type,e.tag=2,e.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,"function"==typeof o.getDerivedStateFromProps&&(null!==(i=L(e,r,i,e.memoizedState))&&void 0!==i&&(e.memoizedState=a({},e.memoizedState,i))),i=E(e),O(e,r),N(e,n),t=f(t,e,!0,i,!1,n)):(e.tag=1,c(t,e,r),e.memoizedProps=i,t=e.child),t;case 1:return i=e.type,n=e.pendingProps,A()||e.memoizedProps!==n?(r=C(e),i=i(n,r=S(e,r)),e.effectTag|=1,c(t,e,i),e.memoizedProps=n,t=e.child):t=v(t,e),t;case 2:i=E(e),null===t?null===e.stateNode?(k(e,e.pendingProps),N(e,n),r=!0):r=D(e,n):r=z(t,e,n),o=!1;var s=e.updateQueue;return null!==s&&null!==s.capturedValues&&(o=r=!0),f(t,e,r,i,o,n);case 3:t:if(m(e),r=e.updateQueue,null!==r){if(o=e.memoizedState,i=hr(t,e,r,null,null,n),e.memoizedState=i,null!==(r=e.updateQueue)&&null!==r.capturedValues)r=null;else{if(o===i){I(),t=v(t,e);break t}r=i.element}o=e.stateNode,(null===t||null===t.child)&&o.hydrate&&P(e)?(e.effectTag|=2,e.child=yr(e,null,r,n)):(I(),c(t,e,r)),e.memoizedState=i,t=e.child}else I(),t=v(t,e);return t;case 5:return x(e),null===t&&R(e),i=e.type,s=e.memoizedProps,r=e.pendingProps,o=null!==t?t.memoizedProps:null,A()||s!==r||((s=1&e.mode&&b(i,r))&&(e.expirationTime=1073741823),s&&1073741823===n)?(s=r.children,y(i,r)?s=null:o&&y(i,o)&&(e.effectTag|=16),d(t,e),1073741823!==n&&1&e.mode&&b(i,r)?(e.expirationTime=1073741823,e.memoizedProps=r,t=null):(c(t,e,s),e.memoizedProps=r,t=e.child)):t=v(t,e),t;case 6:return null===t&&R(e),e.memoizedProps=e.pendingProps,null;case 8:e.tag=7;case 7:return i=e.pendingProps,A()||e.memoizedProps!==i||(i=e.memoizedProps),r=i.children,e.stateNode=null===t?yr(e,e.stateNode,r,n):vr(e,t.stateNode,r,n),e.memoizedProps=i,e.stateNode;case 9:return null;case 4:return _(e,e.stateNode.containerInfo),i=e.pendingProps,A()||e.memoizedProps!==i?(null===t?e.child=vr(e,null,i,n):c(t,e,i),e.memoizedProps=i,t=e.child):t=v(t,e),t;case 14:return c(t,e,n=(n=e.type.render)(e.pendingProps,e.ref)),e.memoizedProps=n,e.child;case 10:return n=e.pendingProps,A()||e.memoizedProps!==n?(c(t,e,n),e.memoizedProps=n,t=e.child):t=v(t,e),t;case 11:return n=e.pendingProps.children,A()||null!==n&&e.memoizedProps!==n?(c(t,e,n),e.memoizedProps=n,t=e.child):t=v(t,e),t;case 13:return function(t,e,n){var r=e.type._context,i=e.pendingProps,o=e.memoizedProps;if(!A()&&o===i)return e.stateNode=0,w(e),v(t,e);var a=i.value;if(e.memoizedProps=i,null===o)a=1073741823;else if(o.value===i.value){if(o.children===i.children)return e.stateNode=0,w(e),v(t,e);a=0}else{var s=o.value;if(s===a&&(0!==s||1/s==1/a)||s!=s&&a!=a){if(o.children===i.children)return e.stateNode=0,w(e),v(t,e);a=0}else if(a="function"==typeof r._calculateChangedBits?r._calculateChangedBits(s,a):1073741823,0==(a|=0)){if(o.children===i.children)return e.stateNode=0,w(e),v(t,e)}else g(e,r,a,n)}return e.stateNode=a,w(e),c(t,e,i.children),e.child}(t,e,n);case 12:t:{r=e.type,o=e.pendingProps,s=e.memoizedProps,i=r._currentValue;var u=r._changedBits;if(A()||0!==u||s!==o){e.memoizedProps=o;var l=o.unstable_observedBits;if(void 0!==l&&null!==l||(l=1073741823),e.stateNode=l,0!=(u&l))g(e,r,u,n);else if(s===o){t=v(t,e);break t}c(t,e,n=(n=o.children)(i)),t=e.child}else t=v(t,e)}return t;default:p("156")}}}}function xr(t,e){var n=e.source;null===e.stack&&le(n),null!==n&&ue(n),e=e.value,null!==t&&2===t.tag&&ue(t);try{e&&e.suppressReactErrorLogging||console.error(e)}catch(t){t&&t.suppressReactErrorLogging||console.error(t)}}var _r={};function wr(t){function e(){if(null!==tt)for(var t=tt.return;null!==t;)k(t),t=t.return;et=null,nt=0,tt=null,ot=!1}function n(t){return null!==at&&at.has(t)}function r(t){for(;;){var e=t.alternate,n=t.return,r=t.sibling;if(0==(512&t.effectTag)){e=R(e,t,nt);var i=t;if(1073741823===nt||1073741823!==i.expirationTime){t:switch(i.tag){case 3:case 2:var o=i.updateQueue;o=null===o?0:o.expirationTime;break t;default:o=0}for(var a=i.child;null!==a;)0!==a.expirationTime&&(0===o||o>a.expirationTime)&&(o=a.expirationTime),a=a.sibling;i.expirationTime=o}if(null!==e)return e;if(null!==n&&0==(512&n.effectTag)&&(null===n.firstEffect&&(n.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=t.firstEffect),n.lastEffect=t.lastEffect),1<t.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=t:n.firstEffect=t,n.lastEffect=t)),null!==r)return r;if(null===n){ot=!0;break}t=n}else{if(null!==(t=L(t)))return t.effectTag&=2559,t;if(null!==n&&(n.firstEffect=n.lastEffect=null,n.effectTag|=512),null!==r)return r;if(null===n)break;t=n}}return null}function i(t){var e=I(t.alternate,t,nt);return null===e&&(e=r(t)),Yt.current=null,e}function o(t,n,o){J&&p("243"),J=!0,n===nt&&t===et&&null!==tt||(e(),nt=n,tt=Xn((et=t).current,null,nt),t.pendingCommitExpirationTime=0);for(var a=!1;;){try{if(o)for(;null!==tt&&!C();)tt=i(tt);else for(;null!==tt;)tt=i(tt)}catch(t){if(null===tt){a=!0,A(t);break}var s=(o=tt).return;if(null===s){a=!0,A(t);break}O(s,o,t),tt=r(o)}break}return J=!1,a||null!==tt?null:ot?(t.pendingCommitExpirationTime=n,t.current.alternate):void p("262")}function s(t,e,n,r){ur(e,{expirationTime:r,partialState:null,callback:null,isReplace:!1,isForced:!1,capturedValue:t={value:n,source:t,stack:le(t)},next:null}),l(e,r)}function c(t,e){t:{J&&!it&&p("263");for(var r=t.return;null!==r;){switch(r.tag){case 2:var i=r.stateNode;if("function"==typeof r.type.getDerivedStateFromCatch||"function"==typeof i.componentDidCatch&&!n(i)){s(t,r,e,1),t=void 0;break t}break;case 3:s(t,r,e,1),t=void 0;break t}r=r.return}3===t.tag&&s(t,t,e,1),t=void 0}return t}function u(t){return t=0!==Q?Q:J?it?1:nt:1&t.mode?_t?10*(1+((d()+15)/10|0)):25*(1+((d()+500)/25|0)):1,_t&&(0===ft||t>ft)&&(ft=t),t}function l(t,n){t:{for(;null!==t;){if((0===t.expirationTime||t.expirationTime>n)&&(t.expirationTime=n),null!==t.alternate&&(0===t.alternate.expirationTime||t.alternate.expirationTime>n)&&(t.alternate.expirationTime=n),null===t.return){if(3!==t.tag){n=void 0;break t}var r=t.stateNode;!J&&0!==nt&&n<nt&&e(),J&&!it&&et===r||g(r,n),Ct>St&&p("185")}t=t.return}n=void 0}return n}function d(){return K=H()-Y,2+(K/10|0)}function f(t,e,n,r,i){var o=Q;Q=1;try{return t(e,n,r,i)}finally{Q=o}}function m(t){if(0!==ut){if(t>ut)return;W(lt)}var e=H()-Y;ut=t,lt=$(y,{timeout:10*(t-2)-e})}function g(t,e){if(null===t.nextScheduledRoot)t.remainingExpirationTime=e,null===ct?(st=ct=t,t.nextScheduledRoot=t):(ct=ct.nextScheduledRoot=t).nextScheduledRoot=st;else{var n=t.remainingExpirationTime;(0===n||e<n)&&(t.remainingExpirationTime=e)}ht||(bt?xt&&(pt=t,dt=1,w(t,1,!1)):1===e?b():m(e))}function v(){var t=0,e=null;if(null!==ct)for(var n=ct,r=st;null!==r;){var i=r.remainingExpirationTime;if(0===i){if((null===n||null===ct)&&p("244"),r===r.nextScheduledRoot){st=ct=r.nextScheduledRoot=null;break}if(r===st)st=i=r.nextScheduledRoot,ct.nextScheduledRoot=i,r.nextScheduledRoot=null;else{if(r===ct){(ct=n).nextScheduledRoot=st,r.nextScheduledRoot=null;break}n.nextScheduledRoot=r.nextScheduledRoot,r.nextScheduledRoot=null}r=n.nextScheduledRoot}else{if((0===t||i<t)&&(t=i,e=r),r===ct)break;n=r,r=r.nextScheduledRoot}}null!==(n=pt)&&n===e&&1===t?Ct++:Ct=0,pt=e,dt=t}function y(t){x(0,!0,t)}function b(){x(1,!1,null)}function x(t,e,n){if(yt=n,v(),e)for(;null!==pt&&0!==dt&&(0===t||t>=dt)&&(!mt||d()>=dt);)w(pt,dt,!mt),v();else for(;null!==pt&&0!==dt&&(0===t||t>=dt);)w(pt,dt,!1),v();null!==yt&&(ut=0,lt=-1),0!==dt&&m(dt),yt=null,mt=!1,_()}function _(){if(Ct=0,null!==wt){var t=wt;wt=null;for(var e=0;e<t.length;e++){var n=t[e];try{n._onComplete()}catch(t){gt||(gt=!0,vt=t)}}}if(gt)throw t=vt,vt=null,gt=!1,t}function w(t,e,n){ht&&p("245"),ht=!0,n?null!==(n=t.finishedWork)?S(t,n,e):(t.finishedWork=null,null!==(n=o(t,e,!0))&&(C()?t.finishedWork=n:S(t,n,e))):null!==(n=t.finishedWork)?S(t,n,e):(t.finishedWork=null,null!==(n=o(t,e,!1))&&S(t,n,e)),ht=!1}function S(t,e,n){var r=t.firstBatch;if(null!==r&&r._expirationTime<=n&&(null===wt?wt=[r]:wt.push(r),r._defer))return t.finishedWork=e,void(t.remainingExpirationTime=0);t.finishedWork=null,it=J=!0,(n=e.stateNode).current===e&&p("177"),0===(r=n.pendingCommitExpirationTime)&&p("261"),n.pendingCommitExpirationTime=0;var i=d();if(Yt.current=null,1<e.effectTag)if(null!==e.lastEffect){e.lastEffect.nextEffect=e;var o=e.firstEffect}else o=e;else o=e.firstEffect;for(q(n.containerInfo),rt=o;null!==rt;){var a=!1,s=void 0;try{for(;null!==rt;)2048&rt.effectTag&&N(rt.alternate,rt),rt=rt.nextEffect}catch(t){a=!0,s=t}a&&(null===rt&&p("178"),c(rt,s),null!==rt&&(rt=rt.nextEffect))}for(rt=o;null!==rt;){a=!1,s=void 0;try{for(;null!==rt;){var u=rt.effectTag;if(16&u&&D(rt),128&u){var l=rt.alternate;null!==l&&V(l)}switch(14&u){case 2:z(rt),rt.effectTag&=-3;break;case 6:z(rt),rt.effectTag&=-3,B(rt.alternate,rt);break;case 4:B(rt.alternate,rt);break;case 8:F(rt)}rt=rt.nextEffect}}catch(t){a=!0,s=t}a&&(null===rt&&p("178"),c(rt,s),null!==rt&&(rt=rt.nextEffect))}for(X(n.containerInfo),n.current=e,rt=o;null!==rt;){u=!1,l=void 0;try{for(o=n,a=i,s=r;null!==rt;){var h=rt.effectTag;36&h&&U(o,rt.alternate,rt,a,s),256&h&&j(rt,A),128&h&&G(rt);var f=rt.nextEffect;rt.nextEffect=null,rt=f}}catch(t){u=!0,l=t}u&&(null===rt&&p("178"),c(rt,l),null!==rt&&(rt=rt.nextEffect))}J=it=!1,nr(e.stateNode),0===(e=n.current.expirationTime)&&(at=null),t.remainingExpirationTime=e}function C(){return!(null===yt||yt.timeRemaining()>At)&&(mt=!0)}function A(t){null===pt&&p("246"),pt.remainingExpirationTime=0,gt||(gt=!0,vt=t)}var E=function(){var t=[],e=-1;return{createCursor:function(t){return{current:t}},isEmpty:function(){return-1===e},pop:function(n){0>e||(n.current=t[e],t[e]=null,e--)},push:function(n,r){t[++e]=n.current,n.current=r},checkThatStackIsEmpty:function(){},resetStackAfterFatalErrorInDev:function(){}}}(),M=function(t,e){function n(t){return t===_r&&p("174"),t}var r=t.getChildHostContext,i=t.getRootHostContext;t=e.createCursor;var o=e.push,a=e.pop,s=t(_r),c=t(_r),u=t(_r);return{getHostContext:function(){return n(s.current)},getRootHostContainer:function(){return n(u.current)},popHostContainer:function(t){a(s,t),a(c,t),a(u,t)},popHostContext:function(t){c.current===t&&(a(s,t),a(c,t))},pushHostContainer:function(t,e){o(u,e,t),o(c,t,t),o(s,_r,t),e=i(e),a(s,t),o(s,e,t)},pushHostContext:function(t){var e=n(u.current),i=n(s.current);i!==(e=r(i,t.type,e))&&(o(c,t,t),o(s,e,t))}}}(t,E),T=function(t){function e(t,e,n){(t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=n}function n(t){return 2===t.tag&&null!=t.type.childContextTypes}function r(t,e){var n=t.stateNode,r=t.type.childContextTypes;if("function"!=typeof n.getChildContext)return e;for(var i in n=n.getChildContext())i in r||p("108",ue(t)||"Unknown",i);return a({},e,n)}var i=t.createCursor,o=t.push,s=t.pop,c=i(h),u=i(!1),l=h;return{getUnmaskedContext:function(t){return n(t)?l:c.current},cacheContext:e,getMaskedContext:function(t,n){var r=t.type.contextTypes;if(!r)return h;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===n)return i.__reactInternalMemoizedMaskedChildContext;var o,a={};for(o in r)a[o]=n[o];return i&&e(t,n,a),a},hasContextChanged:function(){return u.current},isContextConsumer:function(t){return 2===t.tag&&null!=t.type.contextTypes},isContextProvider:n,popContextProvider:function(t){n(t)&&(s(u,t),s(c,t))},popTopLevelContextObject:function(t){s(u,t),s(c,t)},pushTopLevelContextObject:function(t,e,n){null!=c.cursor&&p("168"),o(c,e,t),o(u,n,t)},processChildContext:r,pushContextProvider:function(t){if(!n(t))return!1;var e=t.stateNode;return e=e&&e.__reactInternalMemoizedMergedChildContext||h,l=c.current,o(c,e,t),o(u,u.current,t),!0},invalidateContextProvider:function(t,e){var n=t.stateNode;if(n||p("169"),e){var i=r(t,l);n.__reactInternalMemoizedMergedChildContext=i,s(u,t),s(c,t),o(c,i,t)}else s(u,t);o(u,e,t)},findCurrentUnmaskedContext:function(t){for((2!==Xe(t)||2!==t.tag)&&p("170");3!==t.tag;){if(n(t))return t.stateNode.__reactInternalMemoizedMergedChildContext;(t=t.return)||p("171")}return t.stateNode.context}}}(E);E=function(t){var e=t.createCursor,n=t.push,r=t.pop,i=e(null),o=e(null),a=e(0);return{pushProvider:function(t){var e=t.type._context;n(a,e._changedBits,t),n(o,e._currentValue,t),n(i,t,t),e._currentValue=t.pendingProps.value,e._changedBits=t.stateNode},popProvider:function(t){var e=a.current,n=o.current;r(i,t),r(o,t),r(a,t),(t=t.type._context)._currentValue=n,t._changedBits=e}}}(E);var P=function(t){function e(t,e){var n=new qn(5,null,null,0);n.type="DELETED",n.stateNode=e,n.return=t,n.effectTag=8,null!==t.lastEffect?(t.lastEffect.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n}function n(t,e){switch(t.tag){case 5:return null!==(e=o(e,t.type,t.pendingProps))&&(t.stateNode=e,!0);case 6:return null!==(e=a(e,t.pendingProps))&&(t.stateNode=e,!0);default:return!1}}function r(t){for(t=t.return;null!==t&&5!==t.tag&&3!==t.tag;)t=t.return;h=t}var i=t.shouldSetTextContent;if(!(t=t.hydration))return{enterHydrationState:function(){return!1},resetHydrationState:function(){},tryToClaimNextHydratableInstance:function(){},prepareToHydrateHostInstance:function(){p("175")},prepareToHydrateHostTextInstance:function(){p("176")},popHydrationState:function(){return!1}};var o=t.canHydrateInstance,a=t.canHydrateTextInstance,s=t.getNextHydratableSibling,c=t.getFirstHydratableChild,u=t.hydrateInstance,l=t.hydrateTextInstance,h=null,d=null,f=!1;return{enterHydrationState:function(t){return d=c(t.stateNode.containerInfo),h=t,f=!0},resetHydrationState:function(){d=h=null,f=!1},tryToClaimNextHydratableInstance:function(t){if(f){var r=d;if(r){if(!n(t,r)){if(!(r=s(r))||!n(t,r))return t.effectTag|=2,f=!1,void(h=t);e(h,d)}h=t,d=c(r)}else t.effectTag|=2,f=!1,h=t}},prepareToHydrateHostInstance:function(t,e,n){return e=u(t.stateNode,t.type,t.memoizedProps,e,n,t),t.updateQueue=e,null!==e},prepareToHydrateHostTextInstance:function(t){return l(t.stateNode,t.memoizedProps,t)},popHydrationState:function(t){if(t!==h)return!1;if(!f)return r(t),f=!0,!1;var n=t.type;if(5!==t.tag||"head"!==n&&"body"!==n&&!i(n,t.memoizedProps))for(n=d;n;)e(t,n),n=s(n);return r(t),d=h?s(t.stateNode):null,!0}}}(t),I=br(t,M,T,E,P,l,u).beginWork,R=function(t,e,n,r,i){function o(t){t.effectTag|=4}var a=t.createInstance,s=t.createTextInstance,c=t.appendInitialChild,u=t.finalizeInitialChildren,l=t.prepareUpdate,h=t.persistence,d=e.getRootHostContainer,f=e.popHostContext,m=e.getHostContext,g=e.popHostContainer,v=n.popContextProvider,y=n.popTopLevelContextObject,b=r.popProvider,x=i.prepareToHydrateHostInstance,_=i.prepareToHydrateHostTextInstance,w=i.popHydrationState,S=void 0,C=void 0,A=void 0;return t.mutation?(S=function(){},C=function(t,e,n){(e.updateQueue=n)&&o(e)},A=function(t,e,n,r){n!==r&&o(e)}):p(h?"235":"236"),{completeWork:function(t,e,n){var r=e.pendingProps;switch(e.tag){case 1:return null;case 2:return v(e),t=e.stateNode,null!==(r=e.updateQueue)&&null!==r.capturedValues&&(e.effectTag&=-65,"function"==typeof t.componentDidCatch?e.effectTag|=256:r.capturedValues=null),null;case 3:return g(e),y(e),(r=e.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==t&&null!==t.child||(w(e),e.effectTag&=-3),S(e),null!==(t=e.updateQueue)&&null!==t.capturedValues&&(e.effectTag|=256),null;case 5:f(e),n=d();var i=e.type;if(null!==t&&null!=e.stateNode){var h=t.memoizedProps,E=e.stateNode,M=m();E=l(E,i,h,r,n,M),C(t,e,E,i,h,r,n,M),t.ref!==e.ref&&(e.effectTag|=128)}else{if(!r)return null===e.stateNode&&p("166"),null;if(t=m(),w(e))x(e,n,t)&&o(e);else{h=a(i,r,n,t,e);t:for(M=e.child;null!==M;){if(5===M.tag||6===M.tag)c(h,M.stateNode);else if(4!==M.tag&&null!==M.child){M.child.return=M,M=M.child;continue}if(M===e)break;for(;null===M.sibling;){if(null===M.return||M.return===e)break t;M=M.return}M.sibling.return=M.return,M=M.sibling}u(h,i,r,n,t)&&o(e),e.stateNode=h}null!==e.ref&&(e.effectTag|=128)}return null;case 6:if(t&&null!=e.stateNode)A(t,e,t.memoizedProps,r);else{if("string"!=typeof r)return null===e.stateNode&&p("166"),null;t=d(),n=m(),w(e)?_(e)&&o(e):e.stateNode=s(r,t,n,e)}return null;case 7:(r=e.memoizedProps)||p("165"),e.tag=8,i=[];t:for((h=e.stateNode)&&(h.return=e);null!==h;){if(5===h.tag||6===h.tag||4===h.tag)p("247");else if(9===h.tag)i.push(h.pendingProps.value);else if(null!==h.child){h.child.return=h,h=h.child;continue}for(;null===h.sibling;){if(null===h.return||h.return===e)break t;h=h.return}h.sibling.return=h.return,h=h.sibling}return r=(h=r.handler)(r.props,i),e.child=vr(e,null!==t?t.child:null,r,n),e.child;case 8:return e.tag=7,null;case 9:case 14:case 10:case 11:return null;case 4:return g(e),S(e),null;case 13:return b(e),null;case 12:return null;case 0:p("167");default:p("156")}}}}(t,M,T,E,P).completeWork,O=(M=function(t,e,n,r,i){var o=t.popHostContainer,a=t.popHostContext,s=e.popContextProvider,c=e.popTopLevelContextObject,u=n.popProvider;return{throwException:function(t,e,n){e.effectTag|=512,e.firstEffect=e.lastEffect=null,e={value:n,source:e,stack:le(e)};do{switch(t.tag){case 3:return cr(t),t.updateQueue.capturedValues=[e],void(t.effectTag|=1024);case 2:if(n=t.stateNode,0==(64&t.effectTag)&&null!==n&&"function"==typeof n.componentDidCatch&&!i(n)){cr(t);var r=(n=t.updateQueue).capturedValues;return null===r?n.capturedValues=[e]:r.push(e),void(t.effectTag|=1024)}}t=t.return}while(null!==t)},unwindWork:function(t){switch(t.tag){case 2:s(t);var e=t.effectTag;return 1024&e?(t.effectTag=-1025&e|64,t):null;case 3:return o(t),c(t),1024&(e=t.effectTag)?(t.effectTag=-1025&e|64,t):null;case 5:return a(t),null;case 4:return o(t),null;case 13:return u(t),null;default:return null}},unwindInterruptedWork:function(t){switch(t.tag){case 2:s(t);break;case 3:o(t),c(t);break;case 5:a(t);break;case 4:o(t);break;case 13:u(t)}}}}(M,T,E,0,n)).throwException,L=M.unwindWork,k=M.unwindInterruptedWork,N=(M=function(t,e,n,r,i){function o(t){var n=t.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){e(t,n)}else n.current=null}function a(t){switch(rr(t),t.tag){case 2:o(t);var n=t.stateNode;if("function"==typeof n.componentWillUnmount)try{n.props=t.memoizedProps,n.state=t.memoizedState,n.componentWillUnmount()}catch(n){e(t,n)}break;case 5:o(t);break;case 7:s(t.stateNode);break;case 4:h&&u(t)}}function s(t){for(var e=t;;)if(a(e),null===e.child||h&&4===e.tag){if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;e=e.return}e.sibling.return=e.return,e=e.sibling}else e.child.return=e,e=e.child}function c(t){return 5===t.tag||3===t.tag||4===t.tag}function u(t){for(var e=t,n=!1,r=void 0,i=void 0;;){if(!n){n=e.return;t:for(;;){switch(null===n&&p("160"),n.tag){case 5:r=n.stateNode,i=!1;break t;case 3:case 4:r=n.stateNode.containerInfo,i=!0;break t}n=n.return}n=!0}if(5===e.tag||6===e.tag)s(e),i?w(r,e.stateNode):_(r,e.stateNode);else if(4===e.tag?r=e.stateNode.containerInfo:a(e),null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;4===(e=e.return).tag&&(n=!1)}e.sibling.return=e.return,e=e.sibling}}var l=t.getPublicInstance,h=t.mutation;t=t.persistence,h||p(t?"235":"236");var d=h.commitMount,f=h.commitUpdate,m=h.resetTextContent,g=h.commitTextUpdate,v=h.appendChild,y=h.appendChildToContainer,b=h.insertBefore,x=h.insertInContainerBefore,_=h.removeChild,w=h.removeChildFromContainer;return{commitBeforeMutationLifeCycles:function(t,e){switch(e.tag){case 2:if(2048&e.effectTag&&null!==t){var n=t.memoizedProps,r=t.memoizedState;(t=e.stateNode).props=e.memoizedProps,t.state=e.memoizedState,e=t.getSnapshotBeforeUpdate(n,r),t.__reactInternalSnapshotBeforeUpdate=e}break;case 3:case 5:case 6:case 4:break;default:p("163")}},commitResetTextContent:function(t){m(t.stateNode)},commitPlacement:function(t){t:{for(var e=t.return;null!==e;){if(c(e)){var n=e;break t}e=e.return}p("160"),n=void 0}var r=e=void 0;switch(n.tag){case 5:e=n.stateNode,r=!1;break;case 3:case 4:e=n.stateNode.containerInfo,r=!0;break;default:p("161")}16&n.effectTag&&(m(e),n.effectTag&=-17);t:e:for(n=t;;){for(;null===n.sibling;){if(null===n.return||c(n.return)){n=null;break t}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag;){if(2&n.effectTag)continue e;if(null===n.child||4===n.tag)continue e;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break t}}for(var i=t;;){if(5===i.tag||6===i.tag)n?r?x(e,i.stateNode,n):b(e,i.stateNode,n):r?y(e,i.stateNode):v(e,i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},commitDeletion:function(t){u(t),t.return=null,t.child=null,t.alternate&&(t.alternate.child=null,t.alternate.return=null)},commitWork:function(t,e){switch(e.tag){case 2:break;case 5:var n=e.stateNode;if(null!=n){var r=e.memoizedProps;t=null!==t?t.memoizedProps:r;var i=e.type,o=e.updateQueue;e.updateQueue=null,null!==o&&f(n,o,i,t,r,e)}break;case 6:null===e.stateNode&&p("162"),n=e.memoizedProps,g(e.stateNode,null!==t?t.memoizedProps:n,n);break;case 3:break;default:p("163")}},commitLifeCycles:function(t,e,n){switch(n.tag){case 2:if(t=n.stateNode,4&n.effectTag)if(null===e)t.props=n.memoizedProps,t.state=n.memoizedState,t.componentDidMount();else{var r=e.memoizedProps;e=e.memoizedState,t.props=n.memoizedProps,t.state=n.memoizedState,t.componentDidUpdate(r,e,t.__reactInternalSnapshotBeforeUpdate)}null!==(n=n.updateQueue)&&pr(n,t);break;case 3:if(null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 5:t=l(n.child.stateNode);break;case 2:t=n.child.stateNode}pr(e,t)}break;case 5:t=n.stateNode,null===e&&4&n.effectTag&&d(t,n.type,n.memoizedProps,n);break;case 6:case 4:break;default:p("163")}},commitErrorLogging:function(t,e){switch(t.tag){case 2:var n=t.type;e=t.stateNode;var r=t.updateQueue;(null===r||null===r.capturedValues)&&p("264");var o=r.capturedValues;for(r.capturedValues=null,"function"!=typeof n.getDerivedStateFromCatch&&i(e),e.props=t.memoizedProps,e.state=t.memoizedState,n=0;n<o.length;n++){var a=(r=o[n]).value,s=r.stack;xr(t,r),e.componentDidCatch(a,{componentStack:null!==s?s:""})}break;case 3:for((null===(n=t.updateQueue)||null===n.capturedValues)&&p("264"),o=n.capturedValues,n.capturedValues=null,n=0;n<o.length;n++)xr(t,r=o[n]),e(r.value);break;default:p("265")}},commitAttachRef:function(t){var e=t.ref;if(null!==e){var n=t.stateNode;switch(t.tag){case 5:t=l(n);break;default:t=n}"function"==typeof e?e(t):e.current=t}},commitDetachRef:function(t){null!==(t=t.ref)&&("function"==typeof t?t(null):t.current=null)}}}(t,c,0,0,function(t){null===at?at=new Set([t]):at.add(t)})).commitBeforeMutationLifeCycles,D=M.commitResetTextContent,z=M.commitPlacement,F=M.commitDeletion,B=M.commitWork,U=M.commitLifeCycles,j=M.commitErrorLogging,G=M.commitAttachRef,V=M.commitDetachRef,H=t.now,$=t.scheduleDeferredCallback,W=t.cancelDeferredCallback,q=t.prepareForCommit,X=t.resetAfterCommit,Y=H(),K=Y,Z=0,Q=0,J=!1,tt=null,et=null,nt=0,rt=null,it=!1,ot=!1,at=null,st=null,ct=null,ut=0,lt=-1,ht=!1,pt=null,dt=0,ft=0,mt=!1,gt=!1,vt=null,yt=null,bt=!1,xt=!1,_t=!1,wt=null,St=1e3,Ct=0,At=1;return{recalculateCurrentTime:d,computeExpirationForFiber:u,scheduleWork:l,requestWork:g,flushRoot:function(t,e){ht&&p("253"),pt=t,dt=e,w(t,e,!1),b(),_()},batchedUpdates:function(t,e){var n=bt;bt=!0;try{return t(e)}finally{(bt=n)||ht||b()}},unbatchedUpdates:function(t,e){if(bt&&!xt){xt=!0;try{return t(e)}finally{xt=!1}}return t(e)},flushSync:function(t,e){ht&&p("187");var n=bt;bt=!0;try{return f(t,e)}finally{bt=n,b()}},flushControlled:function(t){var e=bt;bt=!0;try{f(t)}finally{(bt=e)||ht||x(1,!1,null)}},deferredUpdates:function(t){var e=Q;Q=25*(1+((d()+500)/25|0));try{return t()}finally{Q=e}},syncUpdates:f,interactiveUpdates:function(t,e,n){if(_t)return t(e,n);bt||ht||0===ft||(x(ft,!1,null),ft=0);var r=_t,i=bt;bt=_t=!0;try{return t(e,n)}finally{_t=r,(bt=i)||ht||b()}},flushInteractiveUpdates:function(){ht||0===ft||(x(ft,!1,null),ft=0)},computeUniqueAsyncExpiration:function(){var t=25*(1+((d()+500)/25|0));return t<=Z&&(t=Z+1),Z=t},legacyContext:T}}function Sr(t){function e(t,e,n,r,i,a){if(r=e.current,n){n=n._reactInternalFiber;var s=c(n);n=u(n)?l(n,s):s}else n=h;return null===e.context?e.context=n:e.pendingContext=n,ur(r,{expirationTime:i,partialState:{element:t},callback:void 0===(e=a)?null:e,isReplace:!1,isForced:!1,capturedValue:null,next:null}),o(r,i),i}var n=t.getPublicInstance,r=(t=wr(t)).recalculateCurrentTime,i=t.computeExpirationForFiber,o=t.scheduleWork,s=t.legacyContext,c=s.findCurrentUnmaskedContext,u=s.isContextProvider,l=s.processChildContext;return{createContainer:function(t,e,n){return t={current:e=new qn(3,null,null,e?3:0),containerInfo:t,pendingChildren:null,pendingCommitExpirationTime:0,finishedWork:null,context:null,pendingContext:null,hydrate:n,remainingExpirationTime:0,firstBatch:null,nextScheduledRoot:null},e.stateNode=t},updateContainer:function(t,n,o,a){var s=n.current;return e(t,n,o,r(),s=i(s),a)},updateContainerAtExpirationTime:function(t,n,i,o,a){return e(t,n,i,r(),o,a)},flushRoot:t.flushRoot,requestWork:t.requestWork,computeUniqueAsyncExpiration:t.computeUniqueAsyncExpiration,batchedUpdates:t.batchedUpdates,unbatchedUpdates:t.unbatchedUpdates,deferredUpdates:t.deferredUpdates,syncUpdates:t.syncUpdates,interactiveUpdates:t.interactiveUpdates,flushInteractiveUpdates:t.flushInteractiveUpdates,flushControlled:t.flushControlled,flushSync:t.flushSync,getPublicRootInstance:function(t){if(!(t=t.current).child)return null;switch(t.child.tag){case 5:return n(t.child.stateNode);default:return t.child.stateNode}},findHostInstance:function(t){var e=t._reactInternalFiber;return void 0===e&&("function"==typeof t.render?p("188"):p("268",Object.keys(t))),null===(t=Qe(e))?null:t.stateNode},findHostInstanceWithNoPortals:function(t){return null===(t=function(t){if(!(t=Ze(t)))return null;for(var e=t;;){if(5===e.tag||6===e.tag)return e;if(e.child&&4!==e.tag)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}(t))?null:t.stateNode},injectIntoDevTools:function(t){var e=t.findFiberByHostInstance;return function(t){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var n=e.inject(t);Jn=er(function(t){return e.onCommitFiberRoot(n,t)}),tr=er(function(t){return e.onCommitFiberUnmount(n,t)})}catch(t){}return!0}(a({},t,{findHostInstanceByFiber:function(t){return null===(t=Qe(t))?null:t.stateNode},findFiberByHostInstance:function(t){return e?e(t):null}}))}}}var Cr=Object.freeze({default:Sr}),Ar=Cr&&Sr||Cr,Er=Ar.default?Ar.default:Ar;var Mr="object"==typeof performance&&"function"==typeof performance.now,Tr=void 0;Tr=Mr?function(){return performance.now()}:function(){return Date.now()};var Pr=void 0,Ir=void 0;if(o.canUseDOM)if("function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback){var Rr=null,Or=!1,Lr=-1,kr=!1,Nr=0,Dr=33,zr=33,Fr=void 0;Fr=Mr?{didTimeout:!1,timeRemaining:function(){var t=Nr-performance.now();return 0<t?t:0}}:{didTimeout:!1,timeRemaining:function(){var t=Nr-Date.now();return 0<t?t:0}};var Br="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(t){if(t.source===window&&t.data===Br){if(Or=!1,t=Tr(),0>=Nr-t){if(!(-1!==Lr&&Lr<=t))return void(kr||(kr=!0,requestAnimationFrame(Ur)));Fr.didTimeout=!0}else Fr.didTimeout=!1;Lr=-1,t=Rr,Rr=null,null!==t&&t(Fr)}},!1);var Ur=function(t){kr=!1;var e=t-Nr+zr;e<zr&&Dr<zr?(8>e&&(e=8),zr=e<Dr?Dr:e):Dr=e,Nr=t+zr,Or||(Or=!0,window.postMessage(Br,"*"))};Pr=function(t,e){return Rr=t,null!=e&&"number"==typeof e.timeout&&(Lr=Tr()+e.timeout),kr||(kr=!0,requestAnimationFrame(Ur)),0},Ir=function(){Rr=null,Or=!1,Lr=-1}}else Pr=window.requestIdleCallback,Ir=window.cancelIdleCallback;else Pr=function(t){return setTimeout(function(){t({timeRemaining:function(){return 1/0},didTimeout:!1})})},Ir=function(t){clearTimeout(t)};function jr(t,e){return t=a({children:void 0},e),(e=function(t){var e="";return i.Children.forEach(t,function(t){null==t||"string"!=typeof t&&"number"!=typeof t||(e+=t)}),e}(e.children))&&(t.children=e),t}function Gr(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+n,e=null,i=0;i<t.length;i++){if(t[i].value===n)return t[i].selected=!0,void(r&&(t[i].defaultSelected=!0));null!==e||t[i].disabled||(e=t[i])}null!==e&&(e.selected=!0)}}function Vr(t,e){var n=e.value;t._wrapperState={initialValue:null!=n?n:e.defaultValue,wasMultiple:!!e.multiple}}function Hr(t,e){return null!=e.dangerouslySetInnerHTML&&p("91"),a({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function $r(t,e){var n=e.value;null==n&&(n=e.defaultValue,null!=(e=e.children)&&(null!=n&&p("92"),Array.isArray(e)&&(1>=e.length||p("93"),e=e[0]),n=""+e),null==n&&(n="")),t._wrapperState={initialValue:""+n}}function Wr(t,e){var n=e.value;null!=n&&((n=""+n)!==t.value&&(t.value=n),null==e.defaultValue&&(t.defaultValue=n)),null!=e.defaultValue&&(t.defaultValue=e.defaultValue)}function qr(t){var e=t.textContent;e===t._wrapperState.initialValue&&(t.value=e)}var Xr={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Yr(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Kr(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?Yr(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}var Zr,Qr=void 0,Jr=(Zr=function(t,e){if(t.namespaceURI!==Xr.svg||"innerHTML"in t)t.innerHTML=e;else{for((Qr=Qr||document.createElement("div")).innerHTML="<svg>"+e+"</svg>",e=Qr.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,e,n,r){MSApp.execUnsafeLocalFunction(function(){return Zr(t,e)})}:Zr);function ti(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e}var ei={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ni=["Webkit","ms","Moz","O"];function ri(t,e){for(var n in t=t.style,e)if(e.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=n,o=e[n];i=null==o||"boolean"==typeof o||""===o?"":r||"number"!=typeof o||0===o||ei.hasOwnProperty(i)&&ei[i]?(""+o).trim():o+"px","float"===n&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}Object.keys(ei).forEach(function(t){ni.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ei[e]=ei[t]})});var ii=a({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function oi(t,e,n){e&&(ii[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML)&&p("137",t,n()),null!=e.dangerouslySetInnerHTML&&(null!=e.children&&p("60"),"object"==typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML||p("61")),null!=e.style&&"object"!=typeof e.style&&p("62",n()))}function ai(t,e){if(-1===t.indexOf("-"))return"string"==typeof e.is;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var si=s.thatReturns("");function ci(t,e){var n=Nn(t=9===t.nodeType||11===t.nodeType?t:t.ownerDocument);e=_[e];for(var r=0;r<e.length;r++){var i=e[r];n.hasOwnProperty(i)&&n[i]||("topScroll"===i?_n("topScroll","scroll",t):"topFocus"===i||"topBlur"===i?(_n("topFocus","focus",t),_n("topBlur","blur",t),n.topBlur=!0,n.topFocus=!0):"topCancel"===i?($t("cancel",!0)&&_n("topCancel","cancel",t),n.topCancel=!0):"topClose"===i?($t("close",!0)&&_n("topClose","close",t),n.topClose=!0):In.hasOwnProperty(i)&&xn(i,In[i],t),n[i]=!0)}}function ui(t,e,n,r){return n=9===n.nodeType?n:n.ownerDocument,r===Xr.html&&(r=Yr(t)),r===Xr.html?"script"===t?((t=n.createElement("div")).innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):t="string"==typeof e.is?n.createElement(t,{is:e.is}):n.createElement(t):t=n.createElementNS(r,t),t}function li(t,e){return(9===e.nodeType?e:e.ownerDocument).createTextNode(t)}function hi(t,e,n,r){var i=ai(e,n);switch(e){case"iframe":case"object":xn("topLoad","load",t);var o=n;break;case"video":case"audio":for(o in Rn)Rn.hasOwnProperty(o)&&xn(o,Rn[o],t);o=n;break;case"source":xn("topError","error",t),o=n;break;case"img":case"image":case"link":xn("topError","error",t),xn("topLoad","load",t),o=n;break;case"form":xn("topReset","reset",t),xn("topSubmit","submit",t),o=n;break;case"details":xn("topToggle","toggle",t),o=n;break;case"input":xe(t,n),o=be(t,n),xn("topInvalid","invalid",t),ci(r,"onChange");break;case"option":o=jr(t,n);break;case"select":Vr(t,n),o=a({},n,{value:void 0}),xn("topInvalid","invalid",t),ci(r,"onChange");break;case"textarea":$r(t,n),o=Hr(t,n),xn("topInvalid","invalid",t),ci(r,"onChange");break;default:o=n}oi(e,o,si);var c,u=o;for(c in u)if(u.hasOwnProperty(c)){var l=u[c];"style"===c?ri(t,l):"dangerouslySetInnerHTML"===c?null!=(l=l?l.__html:void 0)&&Jr(t,l):"children"===c?"string"==typeof l?("textarea"!==e||""!==l)&&ti(t,l):"number"==typeof l&&ti(t,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(x.hasOwnProperty(c)?null!=l&&ci(r,c):null!=l&&ye(t,c,l,i))}switch(e){case"input":qt(t),Se(t,n);break;case"textarea":qt(t),qr(t);break;case"option":null!=n.value&&t.setAttribute("value",n.value);break;case"select":t.multiple=!!n.multiple,null!=(e=n.value)?Gr(t,!!n.multiple,e,!1):null!=n.defaultValue&&Gr(t,!!n.multiple,n.defaultValue,!0);break;default:"function"==typeof o.onClick&&(t.onclick=s)}}function pi(t,e,n,r,i){var o=null;switch(e){case"input":n=be(t,n),r=be(t,r),o=[];break;case"option":n=jr(t,n),r=jr(t,r),o=[];break;case"select":n=a({},n,{value:void 0}),r=a({},r,{value:void 0}),o=[];break;case"textarea":n=Hr(t,n),r=Hr(t,r),o=[];break;default:"function"!=typeof n.onClick&&"function"==typeof r.onClick&&(t.onclick=s)}oi(e,r,si),e=t=void 0;var c=null;for(t in n)if(!r.hasOwnProperty(t)&&n.hasOwnProperty(t)&&null!=n[t])if("style"===t){var u=n[t];for(e in u)u.hasOwnProperty(e)&&(c||(c={}),c[e]="")}else"dangerouslySetInnerHTML"!==t&&"children"!==t&&"suppressContentEditableWarning"!==t&&"suppressHydrationWarning"!==t&&"autoFocus"!==t&&(x.hasOwnProperty(t)?o||(o=[]):(o=o||[]).push(t,null));for(t in r){var l=r[t];if(u=null!=n?n[t]:void 0,r.hasOwnProperty(t)&&l!==u&&(null!=l||null!=u))if("style"===t)if(u){for(e in u)!u.hasOwnProperty(e)||l&&l.hasOwnProperty(e)||(c||(c={}),c[e]="");for(e in l)l.hasOwnProperty(e)&&u[e]!==l[e]&&(c||(c={}),c[e]=l[e])}else c||(o||(o=[]),o.push(t,c)),c=l;else"dangerouslySetInnerHTML"===t?(l=l?l.__html:void 0,u=u?u.__html:void 0,null!=l&&u!==l&&(o=o||[]).push(t,""+l)):"children"===t?u===l||"string"!=typeof l&&"number"!=typeof l||(o=o||[]).push(t,""+l):"suppressContentEditableWarning"!==t&&"suppressHydrationWarning"!==t&&(x.hasOwnProperty(t)?(null!=l&&ci(i,t),o||u===l||(o=[])):(o=o||[]).push(t,l))}return c&&(o=o||[]).push("style",c),o}function di(t,e,n,r,i){"input"===n&&"radio"===i.type&&null!=i.name&&_e(t,i),ai(n,r),r=ai(n,i);for(var o=0;o<e.length;o+=2){var a=e[o],s=e[o+1];"style"===a?ri(t,s):"dangerouslySetInnerHTML"===a?Jr(t,s):"children"===a?ti(t,s):ye(t,a,s,r)}switch(n){case"input":we(t,i);break;case"textarea":Wr(t,i);break;case"select":t._wrapperState.initialValue=void 0,e=t._wrapperState.wasMultiple,t._wrapperState.wasMultiple=!!i.multiple,null!=(n=i.value)?Gr(t,!!i.multiple,n,!1):e!==!!i.multiple&&(null!=i.defaultValue?Gr(t,!!i.multiple,i.defaultValue,!0):Gr(t,!!i.multiple,i.multiple?[]:"",!1))}}function fi(t,e,n,r,i){switch(e){case"iframe":case"object":xn("topLoad","load",t);break;case"video":case"audio":for(var o in Rn)Rn.hasOwnProperty(o)&&xn(o,Rn[o],t);break;case"source":xn("topError","error",t);break;case"img":case"image":case"link":xn("topError","error",t),xn("topLoad","load",t);break;case"form":xn("topReset","reset",t),xn("topSubmit","submit",t);break;case"details":xn("topToggle","toggle",t);break;case"input":xe(t,n),xn("topInvalid","invalid",t),ci(i,"onChange");break;case"select":Vr(t,n),xn("topInvalid","invalid",t),ci(i,"onChange");break;case"textarea":$r(t,n),xn("topInvalid","invalid",t),ci(i,"onChange")}for(var a in oi(e,n,si),r=null,n)n.hasOwnProperty(a)&&(o=n[a],"children"===a?"string"==typeof o?t.textContent!==o&&(r=["children",o]):"number"==typeof o&&t.textContent!==""+o&&(r=["children",""+o]):x.hasOwnProperty(a)&&null!=o&&ci(i,a));switch(e){case"input":qt(t),Se(t,n);break;case"textarea":qt(t),qr(t);break;case"select":case"option":break;default:"function"==typeof n.onClick&&(t.onclick=s)}return r}function mi(t,e){return t.nodeValue!==e}var gi=Object.freeze({createElement:ui,createTextNode:li,setInitialProperties:hi,diffProperties:pi,updateProperties:di,diffHydratedProperties:fi,diffHydratedText:mi,warnForUnmatchedText:function(){},warnForDeletedHydratableElement:function(){},warnForDeletedHydratableText:function(){},warnForInsertedHydratedElement:function(){},warnForInsertedHydratedText:function(){},restoreControlledState:function(t,e,n){switch(e){case"input":if(we(t,n),e=n.name,"radio"===n.type&&null!=e){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=$(r);i||p("90"),Xt(r),we(r,i)}}}break;case"textarea":Wr(t,n);break;case"select":null!=(e=n.value)&&Gr(t,!!n.multiple,e,!1)}}});Pt.injectFiberControlledHostComponent(gi);var vi=null,yi=null;function bi(t){this._expirationTime=Ci.computeUniqueAsyncExpiration(),this._root=t,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function xi(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function _i(t,e,n){this._internalRoot=Ci.createContainer(t,e,n)}function wi(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType&&(8!==t.nodeType||" react-mount-point-unstable "!==t.nodeValue))}function Si(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}bi.prototype.render=function(t){this._defer||p("250"),this._hasChildren=!0,this._children=t;var e=this._root._internalRoot,n=this._expirationTime,r=new xi;return Ci.updateContainerAtExpirationTime(t,e,null,n,r._onCommit),r},bi.prototype.then=function(t){if(this._didComplete)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},bi.prototype.commit=function(){var t=this._root._internalRoot,e=t.firstBatch;if(this._defer&&null!==e||p("251"),this._hasChildren){var n=this._expirationTime;if(e!==this){this._hasChildren&&(n=this._expirationTime=e._expirationTime,this.render(this._children));for(var r=null,i=e;i!==this;)r=i,i=i._next;null===r&&p("251"),r._next=i._next,this._next=e,t.firstBatch=this}this._defer=!1,Ci.flushRoot(t,n),e=this._next,this._next=null,null!==(e=t.firstBatch=e)&&e._hasChildren&&e.render(e._children)}else this._next=null,this._defer=!1},bi.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++)(0,t[e])()}},xi.prototype.then=function(t){if(this._didCommit)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},xi.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++){var n=t[e];"function"!=typeof n&&p("191",n),n()}}},_i.prototype.render=function(t,e){var n=this._internalRoot,r=new xi;return null!==(e=void 0===e?null:e)&&r.then(e),Ci.updateContainer(t,n,null,r._onCommit),r},_i.prototype.unmount=function(t){var e=this._internalRoot,n=new xi;return null!==(t=void 0===t?null:t)&&n.then(t),Ci.updateContainer(null,e,null,n._onCommit),n},_i.prototype.legacy_renderSubtreeIntoContainer=function(t,e,n){var r=this._internalRoot,i=new xi;return null!==(n=void 0===n?null:n)&&i.then(n),Ci.updateContainer(e,r,t,i._onCommit),i},_i.prototype.createBatch=function(){var t=new bi(this),e=t._expirationTime,n=this._internalRoot,r=n.firstBatch;if(null===r)n.firstBatch=t,t._next=null;else{for(n=null;null!==r&&r._expirationTime<=e;)n=r,r=r._next;t._next=r,null!==n&&(n._next=t)}return t};var Ci=Er({getRootHostContext:function(t){var e=t.nodeType;switch(e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Kr(null,"");break;default:t=Kr(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}return t},getChildHostContext:function(t,e){return Kr(t,e)},getPublicInstance:function(t){return t},prepareForCommit:function(){vi=yn;var t=c();if(Fn(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{var n=window.getSelection&&window.getSelection();if(n&&0!==n.rangeCount){e=n.anchorNode;var r=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{e.nodeType,i.nodeType}catch(t){e=null;break t}var o=0,a=-1,s=-1,u=0,l=0,h=t,p=null;e:for(;;){for(var d;h!==e||0!==r&&3!==h.nodeType||(a=o+r),h!==i||0!==n&&3!==h.nodeType||(s=o+n),3===h.nodeType&&(o+=h.nodeValue.length),null!==(d=h.firstChild);)p=h,h=d;for(;;){if(h===t)break e;if(p===e&&++u===r&&(a=o),p===i&&++l===n&&(s=o),null!==(d=h.nextSibling))break;p=(h=p).parentNode}h=d}e=-1===a||-1===s?null:{start:a,end:s}}else e=null}e=e||{start:0,end:0}}else e=null;yi={focusedElem:t,selectionRange:e},bn(!1)},resetAfterCommit:function(){var t=yi,e=c(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&l(document.documentElement,n)){if(Fn(n))if(e=r.start,void 0===(t=r.end)&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(window.getSelection){e=window.getSelection();var i=n[it()].length;t=Math.min(r.start,i),r=void 0===r.end?t:Math.min(r.end,i),!e.extend&&t>r&&(i=r,r=t,t=i),i=zn(n,t);var o=zn(n,r);if(i&&o&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)){var a=document.createRange();a.setStart(i.node,i.offset),e.removeAllRanges(),t>r?(e.addRange(a),e.extend(o.node,o.offset)):(a.setEnd(o.node,o.offset),e.addRange(a))}}for(e=[],t=n;t=t.parentNode;)1===t.nodeType&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(n.focus(),n=0;n<e.length;n++)(t=e[n]).element.scrollLeft=t.left,t.element.scrollTop=t.top}yi=null,bn(vi),vi=null},createInstance:function(t,e,n,r,i){return(t=ui(t,e,n,r))[j]=i,t[G]=e,t},appendInitialChild:function(t,e){t.appendChild(e)},finalizeInitialChildren:function(t,e,n,r){return hi(t,e,n,r),Si(e,n)},prepareUpdate:function(t,e,n,r,i){return pi(t,e,n,r,i)},shouldSetTextContent:function(t,e){return"textarea"===t||"string"==typeof e.children||"number"==typeof e.children||"object"==typeof e.dangerouslySetInnerHTML&&null!==e.dangerouslySetInnerHTML&&"string"==typeof e.dangerouslySetInnerHTML.__html},shouldDeprioritizeSubtree:function(t,e){return!!e.hidden},createTextInstance:function(t,e,n,r){return(t=li(t,e))[j]=r,t},now:Tr,mutation:{commitMount:function(t,e,n){Si(e,n)&&t.focus()},commitUpdate:function(t,e,n,r,i){t[G]=i,di(t,e,n,r,i)},resetTextContent:function(t){ti(t,"")},commitTextUpdate:function(t,e,n){t.nodeValue=n},appendChild:function(t,e){t.appendChild(e)},appendChildToContainer:function(t,e){8===t.nodeType?t.parentNode.insertBefore(e,t):t.appendChild(e)},insertBefore:function(t,e,n){t.insertBefore(e,n)},insertInContainerBefore:function(t,e,n){8===t.nodeType?t.parentNode.insertBefore(e,n):t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},removeChildFromContainer:function(t,e){8===t.nodeType?t.parentNode.removeChild(e):t.removeChild(e)}},hydration:{canHydrateInstance:function(t,e){return 1!==t.nodeType||e.toLowerCase()!==t.nodeName.toLowerCase()?null:t},canHydrateTextInstance:function(t,e){return""===e||3!==t.nodeType?null:t},getNextHydratableSibling:function(t){for(t=t.nextSibling;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t},getFirstHydratableChild:function(t){for(t=t.firstChild;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t},hydrateInstance:function(t,e,n,r,i,o){return t[j]=o,t[G]=n,fi(t,e,n,i,r)},hydrateTextInstance:function(t,e,n){return t[j]=n,mi(t,e)},didNotMatchHydratedContainerTextInstance:function(){},didNotMatchHydratedTextInstance:function(){},didNotHydrateContainerInstance:function(){},didNotHydrateInstance:function(){},didNotFindHydratableContainerInstance:function(){},didNotFindHydratableContainerTextInstance:function(){},didNotFindHydratableInstance:function(){},didNotFindHydratableTextInstance:function(){}},scheduleDeferredCallback:Pr,cancelDeferredCallback:Ir}),Ai=Ci;function Ei(t,e,n,r,i){wi(n)||p("200");var o=n._reactRootContainer;if(o){if("function"==typeof i){var a=i;i=function(){var t=Ci.getPublicRootInstance(o._internalRoot);a.call(t)}}null!=t?o.legacy_renderSubtreeIntoContainer(t,e,i):o.render(e,i)}else{if(o=n._reactRootContainer=function(t,e){if(e||(e=!(!(e=t?9===t.nodeType?t.documentElement:t.firstChild:null)||1!==e.nodeType||!e.hasAttribute("data-reactroot"))),!e)for(var n;n=t.lastChild;)t.removeChild(n);return new _i(t,!1,e)}(n,r),"function"==typeof i){var s=i;i=function(){var t=Ci.getPublicRootInstance(o._internalRoot);s.call(t)}}Ci.unbatchedUpdates(function(){null!=t?o.legacy_renderSubtreeIntoContainer(t,e,i):o.render(e,i)})}return Ci.getPublicRootInstance(o._internalRoot)}function Mi(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return wi(e)||p("200"),function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:te,key:null==r?null:""+r,children:t,containerInfo:e,implementation:n}}(t,e,null,n)}zt=Ai.batchedUpdates,Ft=Ai.interactiveUpdates,Bt=Ai.flushInteractiveUpdates;var Ti={createPortal:Mi,findDOMNode:function(t){return null==t?null:1===t.nodeType?t:Ci.findHostInstance(t)},hydrate:function(t,e,n){return Ei(null,t,e,!0,n)},render:function(t,e,n){return Ei(null,t,e,!1,n)},unstable_renderSubtreeIntoContainer:function(t,e,n,r){return(null==t||void 0===t._reactInternalFiber)&&p("38"),Ei(t,e,n,!1,r)},unmountComponentAtNode:function(t){return wi(t)||p("40"),!!t._reactRootContainer&&(Ci.unbatchedUpdates(function(){Ei(null,null,t,!1,function(){t._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return Mi.apply(void 0,arguments)},unstable_batchedUpdates:Ci.batchedUpdates,unstable_deferredUpdates:Ci.deferredUpdates,flushSync:Ci.flushSync,unstable_flushControlled:Ci.flushControlled,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{EventPluginHub:B,EventPluginRegistry:C,EventPropagators:nt,ReactControlledComponent:Dt,ReactDOMComponentTree:W,ReactDOMEventListener:Cn},unstable_createRoot:function(t,e){return new _i(t,!0,null!=e&&!0===e.hydrate)}};Ci.injectIntoDevTools({findFiberByHostInstance:V,bundleType:0,version:"16.3.2",rendererPackageName:"react-dom"});var Pi=Object.freeze({default:Ti}),Ii=Pi&&Ti||Pi;t.exports=Ii.default?Ii.default:Ii},function(t,e,n){"use strict";
/** @license React v16.3.2
 * react.production.min.js
 *
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var r=n(13),i=n(51),o=n(74),a=n(50),s="function"==typeof Symbol&&Symbol.for,c=s?Symbol.for("react.element"):60103,u=s?Symbol.for("react.portal"):60106,l=s?Symbol.for("react.fragment"):60107,h=s?Symbol.for("react.strict_mode"):60108,p=s?Symbol.for("react.provider"):60109,d=s?Symbol.for("react.context"):60110,f=s?Symbol.for("react.async_mode"):60111,m=s?Symbol.for("react.forward_ref"):60112,g="function"==typeof Symbol&&Symbol.iterator;function v(t){for(var e=arguments.length-1,n="http://reactjs.org/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);i(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};function b(t,e,n){this.props=t,this.context=e,this.refs=o,this.updater=n||y}function x(){}function _(t,e,n){this.props=t,this.context=e,this.refs=o,this.updater=n||y}b.prototype.isReactComponent={},b.prototype.setState=function(t,e){"object"!=typeof t&&"function"!=typeof t&&null!=t&&v("85"),this.updater.enqueueSetState(this,t,e,"setState")},b.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},x.prototype=b.prototype;var w=_.prototype=new x;w.constructor=_,r(w,b.prototype),w.isPureReactComponent=!0;var S={current:null},C=Object.prototype.hasOwnProperty,A={key:!0,ref:!0,__self:!0,__source:!0};function E(t,e,n){var r=void 0,i={},o=null,a=null;if(null!=e)for(r in void 0!==e.ref&&(a=e.ref),void 0!==e.key&&(o=""+e.key),e)C.call(e,r)&&!A.hasOwnProperty(r)&&(i[r]=e[r]);var s=arguments.length-2;if(1===s)i.children=n;else if(1<s){for(var u=Array(s),l=0;l<s;l++)u[l]=arguments[l+2];i.children=u}if(t&&t.defaultProps)for(r in s=t.defaultProps)void 0===i[r]&&(i[r]=s[r]);return{$$typeof:c,type:t,key:o,ref:a,props:i,_owner:S.current}}function M(t){return"object"==typeof t&&null!==t&&t.$$typeof===c}var T=/\/+/g,P=[];function I(t,e,n,r){if(P.length){var i=P.pop();return i.result=t,i.keyPrefix=e,i.func=n,i.context=r,i.count=0,i}return{result:t,keyPrefix:e,func:n,context:r,count:0}}function R(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>P.length&&P.push(t)}function O(t,e,n,r){var i=typeof t;"undefined"!==i&&"boolean"!==i||(t=null);var o=!1;if(null===t)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case c:case u:o=!0}}if(o)return n(r,t,""===e?"."+L(t,0):e),1;if(o=0,e=""===e?".":e+":",Array.isArray(t))for(var a=0;a<t.length;a++){var s=e+L(i=t[a],a);o+=O(i,s,n,r)}else if(null===t||void 0===t?s=null:s="function"==typeof(s=g&&t[g]||t["@@iterator"])?s:null,"function"==typeof s)for(t=s.call(t),a=0;!(i=t.next()).done;)o+=O(i=i.value,s=e+L(i,a++),n,r);else"object"===i&&v("31","[object Object]"===(n=""+t)?"object with keys {"+Object.keys(t).join(", ")+"}":n,"");return o}function L(t,e){return"object"==typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}(t.key):e.toString(36)}function k(t,e){t.func.call(t.context,e,t.count++)}function N(t,e,n){var r=t.result,i=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?D(t,r,n,a.thatReturnsArgument):null!=t&&(M(t)&&(e=i+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(T,"$&/")+"/")+n,t={$$typeof:c,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}),r.push(t))}function D(t,e,n,r,i){var o="";null!=n&&(o=(""+n).replace(T,"$&/")+"/"),e=I(e,o,r,i),null==t||O(t,"",N,e),R(e)}var z={Children:{map:function(t,e,n){if(null==t)return t;var r=[];return D(t,r,null,e,n),r},forEach:function(t,e,n){if(null==t)return t;e=I(null,null,e,n),null==t||O(t,"",k,e),R(e)},count:function(t){return null==t?0:O(t,"",a.thatReturnsNull,null)},toArray:function(t){var e=[];return D(t,e,null,a.thatReturnsArgument),e},only:function(t){return M(t)||v("143"),t}},createRef:function(){return{current:null}},Component:b,PureComponent:_,createContext:function(t,e){return void 0===e&&(e=null),(t={$$typeof:d,_calculateChangedBits:e,_defaultValue:t,_currentValue:t,_changedBits:0,Provider:null,Consumer:null}).Provider={$$typeof:p,_context:t},t.Consumer=t},forwardRef:function(t){return{$$typeof:m,render:t}},Fragment:l,StrictMode:h,unstable_AsyncMode:f,createElement:E,cloneElement:function(t,e,n){(null===t||void 0===t)&&v("267",t);var i=void 0,o=r({},t.props),a=t.key,s=t.ref,u=t._owner;if(null!=e){void 0!==e.ref&&(s=e.ref,u=S.current),void 0!==e.key&&(a=""+e.key);var l=void 0;for(i in t.type&&t.type.defaultProps&&(l=t.type.defaultProps),e)C.call(e,i)&&!A.hasOwnProperty(i)&&(o[i]=void 0===e[i]&&void 0!==l?l[i]:e[i])}if(1===(i=arguments.length-2))o.children=n;else if(1<i){l=Array(i);for(var h=0;h<i;h++)l[h]=arguments[h+2];o.children=l}return{$$typeof:c,type:t.type,key:a,ref:s,props:o,_owner:u}},createFactory:function(t){var e=E.bind(null,t);return e.type=t,e},isValidElement:M,version:"16.3.2",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:S,assign:r}},F=Object.freeze({default:z}),B=F&&z||F;t.exports=B.default?B.default:B},function(t,e){
/** @license
 * eventsource.js
 * Available under MIT License (MIT)
 * https://github.com/Yaffle/EventSource/
 */
!function(t){"use strict";var e=t.setTimeout,n=t.clearTimeout,r=t.XMLHttpRequest,i=t.XDomainRequest,o=t.EventSource,a=t.document;null==Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e});var s=function(){};function c(t){this.withCredentials=!1,this.responseType="",this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=s,this.onreadystatechange=s,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=s}function u(t){this._xhr=new c(t)}function l(){this._listeners=Object.create(null)}function h(t){e(function(){throw t},0)}function p(t){this.type=t,this.target=void 0}function d(t,e){p.call(this,t),this.data=e.data,this.lastEventId=e.lastEventId}c.prototype.open=function(t,i){this._abort(!0);var o=this,a=this._xhr,c=1,u=0;this._abort=function(t){0!==o._sendTimeout&&(n(o._sendTimeout),o._sendTimeout=0),1!==c&&2!==c&&3!==c||(c=4,a.onload=s,a.onerror=s,a.onabort=s,a.onprogress=s,a.onreadystatechange=s,a.abort(),0!==u&&(n(u),u=0),t||(o.readyState=4,o.onreadystatechange())),c=0};var l=function(){if(1===c){var t=0,e="",n=void 0;if("contentType"in a)t=200,e="OK",n=a.contentType;else try{t=a.status,e=a.statusText,n=a.getResponseHeader("Content-Type")}catch(r){t=0,e="",n=void 0}0!==t&&(c=2,o.readyState=2,o.status=t,o.statusText=e,o._contentType=n,o.onreadystatechange())}},h=function(){if(l(),2===c||3===c){c=3;var t="";try{t=a.responseText}catch(t){}o.readyState=3,o.responseText=t,o.onprogress()}},p=function(){h(),1!==c&&2!==c&&3!==c||(c=4,0!==u&&(n(u),u=0),o.readyState=4,o.onreadystatechange())},d=function(){u=e(function(){d()},500),3===a.readyState&&h()};a.onload=p,a.onerror=p,a.onabort=p,"sendAsBinary"in r.prototype||"mozAnon"in r.prototype||(a.onprogress=h),a.onreadystatechange=function(){void 0!=a&&(4===a.readyState?p():3===a.readyState?h():2===a.readyState&&l())},"contentType"in a&&(i+=(-1===i.indexOf("?",0)?"?":"&")+"padding=true"),a.open(t,i,!0),"readyState"in a&&(u=e(function(){d()},0))},c.prototype.abort=function(){this._abort(!1)},c.prototype.getResponseHeader=function(t){return this._contentType},c.prototype.setRequestHeader=function(t,e){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(t,e)},c.prototype.send=function(){if("ontimeout"in r.prototype||void 0==a||void 0==a.readyState||"complete"===a.readyState){var t=this._xhr;t.withCredentials=this.withCredentials,t.responseType=this.responseType;try{t.send(void 0)}catch(t){throw t}}else{var n=this;n._sendTimeout=e(function(){n._sendTimeout=0,n.send()},4)}},u.prototype.open=function(t,e,n,r,i,o){var a=this._xhr;a.open("GET",r);var s=0;for(var c in a.onprogress=function(){var t=a.responseText.slice(s);s+=t.length,e(t)},a.onreadystatechange=function(){if(2===a.readyState){var e=a.status,r=a.statusText,i=a.getResponseHeader("Content-Type");t(e,r,i)}else 4===a.readyState&&n()},a.withCredentials=i,a.responseType="text",o)Object.prototype.hasOwnProperty.call(o,c)&&a.setRequestHeader(c,o[c]);a.send()},u.prototype.cancel=function(){this._xhr.abort()},l.prototype.dispatchEvent=function(t){t.target=this;var e=this._listeners[t.type];if(void 0!=e)for(var n=e.length,r=0;r<n;r+=1){var i=e[r];try{"function"==typeof i.handleEvent?i.handleEvent(t):i.call(this,t)}catch(t){h(t)}}},l.prototype.addEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];void 0==r&&(r=[],n[t]=r);for(var i=!1,o=0;o<r.length;o+=1)r[o]===e&&(i=!0);i||r.push(e)},l.prototype.removeEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];if(void 0!=r){for(var i=[],o=0;o<r.length;o+=1)r[o]!==e&&i.push(r[o]);0===i.length?delete n[t]:n[t]=i}},d.prototype=Object.create(p.prototype);var f=-1,m=0,g=1,v=2,y=-1,b=0,x=1,_=2,w=3,S=/^text\/event\-stream;?(\s*charset\=utf\-8)?$/i,C=function(t,e){var n=parseInt(t,10);return n!=n&&(n=e),A(n)},A=function(t){return Math.min(Math.max(t,1e3),18e6)},E=function(t,e,n){try{"function"==typeof e&&e.call(t,n)}catch(t){h(t)}};function M(t,o){l.call(this),this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this._close=void 0,function(t,o,a){o=String(o);var s=void 0!=a&&Boolean(a.withCredentials),c=A(1e3),l=void 0!=a&&void 0!=a.heartbeatTimeout?C(a.heartbeatTimeout,45e3):A(45e3),M="",T=c,P=!1,I=void 0!=a&&void 0!=a.headers?JSON.parse(JSON.stringify(a.headers)):void 0,R=new u(new(void 0!=a&&void 0!=a.Transport?a.Transport:void 0!=i?i:r)),O=0,L=f,k="",N="",D="",z="",F=b,B=0,U=0,j=function(e,n,r){if(L===m)if(200===e&&void 0!=r&&S.test(r)){L=g,P=!0,T=c,t.readyState=g;var i=new p("open");t.dispatchEvent(i),E(t,t.onopen,i)}else{var o="";200!==e?(n&&(n=n.replace(/\s+/g," ")),o="EventSource's response has a status "+e+" "+n+" that is not 200. Aborting the connection."):o="EventSource's response has a Content-Type specifying an unsupported type: "+(void 0==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",h(new Error(o)),H();var i=new p("error");t.dispatchEvent(i),E(t,t.onerror,i)}},G=function(r){if(L===g){for(var i=-1,o=0;o<r.length;o+=1){var a=r.charCodeAt(o);a!=="\n".charCodeAt(0)&&a!=="\r".charCodeAt(0)||(i=o)}var s=(-1!==i?z:"")+r.slice(0,i+1);z=(-1===i?z:"")+r.slice(i+1),""!==s&&(P=!0);for(var u=0;u<s.length;u+=1){var a=s.charCodeAt(u);if(F===y&&a==="\n".charCodeAt(0))F=b;else if(F===y&&(F=b),a==="\r".charCodeAt(0)||a==="\n".charCodeAt(0)){if(F!==b){F===x&&(U=u+1);var h=s.slice(B,U-1),p=s.slice(U+(U<u&&s.charCodeAt(U)===" ".charCodeAt(0)?1:0),u);"data"===h?(k+="\n",k+=p):"id"===h?N=p:"event"===h?D=p:"retry"===h?(c=C(p,c),T=c):"heartbeatTimeout"===h&&(l=C(p,l),0!==O&&(n(O),O=e(function(){$()},l)))}if(F===b){if(""!==k){M=N,""===D&&(D="message");var f=new d(D,{data:k.slice(1),lastEventId:N});if(t.dispatchEvent(f),"message"===D&&E(t,t.onmessage,f),L===v)return}k="",D=""}F=a==="\r".charCodeAt(0)?y:b}else F===b&&(B=u,F=x),F===x?a===":".charCodeAt(0)&&(U=u+1,F=_):F===_&&(F=w)}}},V=function(){if(L===g||L===m){L=f,0!==O&&(n(O),O=0),O=e(function(){$()},T),T=A(Math.min(16*c,2*T)),t.readyState=m;var r=new p("error");t.dispatchEvent(r),E(t,t.onerror,r)}},H=function(){L=v,R.cancel(),0!==O&&(n(O),O=0),t.readyState=v},$=function(){if(O=0,L===f){P=!1,O=e(function(){$()},l),L=m,k="",D="",N=M,z="",B=0,U=0,F=b;var t=o;"data:"!==o.slice(0,5)&&"blob:"!==o.slice(0,5)&&(t=o+(-1===o.indexOf("?",0)?"?":"&")+"lastEventId="+encodeURIComponent(M));var n={Accept:"text/event-stream"};if(void 0!=I)for(var r in I)Object.prototype.hasOwnProperty.call(I,r)&&(n[r]=I[r]);try{R.open(j,G,V,t,s,n)}catch(t){throw H(),t}}else P?(P=!1,O=e(function(){$()},l)):(h(new Error("No activity within "+l+" milliseconds. Reconnecting.")),R.cancel())};t.url=o,t.readyState=m,t.withCredentials=s,t._close=H,$()}(this,t,o)}M.prototype=Object.create(l.prototype),M.prototype.CONNECTING=m,M.prototype.OPEN=g,M.prototype.CLOSED=v,M.prototype.close=function(){this._close()},M.CONNECTING=m,M.OPEN=g,M.CLOSED=v,M.prototype.withCredentials=void 0,t.EventSourcePolyfill=M,t.NativeEventSource=o,void 0==r||void 0!=o&&"withCredentials"in o.prototype||(t.EventSource=M)}("undefined"!=typeof window?window:this)},function(t,e,n){n(160),t.exports=n(82)},function(t,e,n){"use strict";(function(t){function r(e){var n;n="undefined"!=typeof window?window:"undefined"!=typeof self?self:t;var r,i,o="undefined"!=typeof document&&document.attachEvent;if(!o){var a=(i=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||function(t){return n.setTimeout(t,20)},function(t){return i(t)}),s=(r=n.cancelAnimationFrame||n.mozCancelAnimationFrame||n.webkitCancelAnimationFrame||n.clearTimeout,function(t){return r(t)}),c=function(t){var e=t.__resizeTriggers__,n=e.firstElementChild,r=e.lastElementChild,i=n.firstElementChild;r.scrollLeft=r.scrollWidth,r.scrollTop=r.scrollHeight,i.style.width=n.offsetWidth+1+"px",i.style.height=n.offsetHeight+1+"px",n.scrollLeft=n.scrollWidth,n.scrollTop=n.scrollHeight},u=function(t){if(!(t.target.className.indexOf("contract-trigger")<0&&t.target.className.indexOf("expand-trigger")<0)){var e=this;c(this),this.__resizeRAF__&&s(this.__resizeRAF__),this.__resizeRAF__=a(function(){(function(t){return t.offsetWidth!=t.__resizeLast__.width||t.offsetHeight!=t.__resizeLast__.height})(e)&&(e.__resizeLast__.width=e.offsetWidth,e.__resizeLast__.height=e.offsetHeight,e.__resizeListeners__.forEach(function(n){n.call(e,t)}))})}},l=!1,h="",p="animationstart",d="Webkit Moz O ms".split(" "),f="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),m=document.createElement("fakeelement");if(void 0!==m.style.animationName&&(l=!0),!1===l)for(var g=0;g<d.length;g++)if(void 0!==m.style[d[g]+"AnimationName"]){h="-"+d[g].toLowerCase()+"-",p=f[g],l=!0;break}var v="resizeanim",y="@"+h+"keyframes "+v+" { from { opacity: 0; } to { opacity: 0; } } ",b=h+"animation: 1ms "+v+"; "}return{addResizeListener:function(t,r){if(o)t.attachEvent("onresize",r);else{if(!t.__resizeTriggers__){var i=t.ownerDocument,a=n.getComputedStyle(t);a&&"static"==a.position&&(t.style.position="relative"),function(t){if(!t.getElementById("detectElementResize")){var n=(y||"")+".resize-triggers { "+(b||"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',r=t.head||t.getElementsByTagName("head")[0],i=t.createElement("style");i.id="detectElementResize",i.type="text/css",null!=e&&i.setAttribute("nonce",e),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(t.createTextNode(n)),r.appendChild(i)}}(i),t.__resizeLast__={},t.__resizeListeners__=[],(t.__resizeTriggers__=i.createElement("div")).className="resize-triggers",t.__resizeTriggers__.innerHTML='<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',t.appendChild(t.__resizeTriggers__),c(t),t.addEventListener("scroll",u,!0),p&&(t.__resizeTriggers__.__animationListener__=function(e){e.animationName==v&&c(t)},t.__resizeTriggers__.addEventListener(p,t.__resizeTriggers__.__animationListener__))}t.__resizeListeners__.push(r)}},removeResizeListener:function(t,e){if(o)t.detachEvent("onresize",e);else if(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(e),1),!t.__resizeListeners__.length){t.removeEventListener("scroll",u,!0),t.__resizeTriggers__.__animationListener__&&(t.__resizeTriggers__.removeEventListener(p,t.__resizeTriggers__.__animationListener__),t.__resizeTriggers__.__animationListener__=null);try{t.__resizeTriggers__=!t.removeChild(t.__resizeTriggers__)}catch(t){}}}}}n.d(e,"a",function(){return r})}).call(this,n(21))},function(t,e,n){"use strict";(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.a=n}).call(this,n(21))}]);